drm.h revision 87bf8e7c
122944501Smrg/** 222944501Smrg * \file drm.h 322944501Smrg * Header for the Direct Rendering Manager 422944501Smrg * 522944501Smrg * \author Rickard E. (Rik) Faith <faith@valinux.com> 622944501Smrg * 722944501Smrg * \par Acknowledgments: 822944501Smrg * Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic \c cmpxchg. 922944501Smrg */ 1022944501Smrg 1122944501Smrg/* 1222944501Smrg * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 1322944501Smrg * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 1422944501Smrg * All rights reserved. 1522944501Smrg * 1622944501Smrg * Permission is hereby granted, free of charge, to any person obtaining a 1722944501Smrg * copy of this software and associated documentation files (the "Software"), 1822944501Smrg * to deal in the Software without restriction, including without limitation 1922944501Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 2022944501Smrg * and/or sell copies of the Software, and to permit persons to whom the 2122944501Smrg * Software is furnished to do so, subject to the following conditions: 2222944501Smrg * 2322944501Smrg * The above copyright notice and this permission notice (including the next 2422944501Smrg * paragraph) shall be included in all copies or substantial portions of the 2522944501Smrg * Software. 2622944501Smrg * 2722944501Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2822944501Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2922944501Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 3022944501Smrg * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 3122944501Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 3222944501Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 3322944501Smrg * OTHER DEALINGS IN THE SOFTWARE. 3422944501Smrg */ 3522944501Smrg 3622944501Smrg#ifndef _DRM_H_ 3722944501Smrg#define _DRM_H_ 3822944501Smrg 39fe517fc9Smrg#if defined(__linux__) 4022944501Smrg 4122944501Smrg#include <linux/types.h> 4222944501Smrg#include <asm/ioctl.h> 4322944501Smrgtypedef unsigned int drm_handle_t; 4422944501Smrg 4522944501Smrg#else /* One of the BSDs */ 4622944501Smrg 47bf6cc7dcSmrg#include <stdint.h> 4822944501Smrg#include <sys/ioccom.h> 4922944501Smrg#include <sys/types.h> 5052605895Schristos#ifndef __linux_sized_types__ 5152605895Schristos#define __linux_sized_types__ 5222944501Smrgtypedef int8_t __s8; 5322944501Smrgtypedef uint8_t __u8; 5422944501Smrgtypedef int16_t __s16; 5522944501Smrgtypedef uint16_t __u16; 5622944501Smrgtypedef int32_t __s32; 5722944501Smrgtypedef uint32_t __u32; 5822944501Smrgtypedef int64_t __s64; 5922944501Smrgtypedef uint64_t __u64; 6052605895Schristos#endif /* __linux_sized_types__ */ 61fe517fc9Smrgtypedef size_t __kernel_size_t; 6222944501Smrgtypedef unsigned long drm_handle_t; 6322944501Smrg 6422944501Smrg#endif 6522944501Smrg 662ee35494Smrg#if defined(__cplusplus) 672ee35494Smrgextern "C" { 682ee35494Smrg#endif 692ee35494Smrg 7022944501Smrg#define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */ 7122944501Smrg#define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */ 7222944501Smrg#define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */ 7322944501Smrg#define DRM_RAM_PERCENT 10 /**< How much system ram can we lock? */ 7422944501Smrg 7522944501Smrg#define _DRM_LOCK_HELD 0x80000000U /**< Hardware lock is held */ 7622944501Smrg#define _DRM_LOCK_CONT 0x40000000U /**< Hardware lock is contended */ 7722944501Smrg#define _DRM_LOCK_IS_HELD(lock) ((lock) & _DRM_LOCK_HELD) 7822944501Smrg#define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT) 7922944501Smrg#define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) 8022944501Smrg 8122944501Smrgtypedef unsigned int drm_context_t; 8222944501Smrgtypedef unsigned int drm_drawable_t; 8322944501Smrgtypedef unsigned int drm_magic_t; 8422944501Smrg 8522944501Smrg/** 8622944501Smrg * Cliprect. 8722944501Smrg * 8822944501Smrg * \warning: If you change this structure, make sure you change 8922944501Smrg * XF86DRIClipRectRec in the server as well 9022944501Smrg * 9122944501Smrg * \note KW: Actually it's illegal to change either for 9222944501Smrg * backwards-compatibility reasons. 9322944501Smrg */ 9422944501Smrgstruct drm_clip_rect { 9522944501Smrg unsigned short x1; 9622944501Smrg unsigned short y1; 9722944501Smrg unsigned short x2; 9822944501Smrg unsigned short y2; 9922944501Smrg}; 10022944501Smrg 10122944501Smrg/** 10222944501Smrg * Drawable information. 10322944501Smrg */ 10422944501Smrgstruct drm_drawable_info { 10522944501Smrg unsigned int num_rects; 10622944501Smrg struct drm_clip_rect *rects; 10722944501Smrg}; 10822944501Smrg 10922944501Smrg/** 11022944501Smrg * Texture region, 11122944501Smrg */ 11222944501Smrgstruct drm_tex_region { 11322944501Smrg unsigned char next; 11422944501Smrg unsigned char prev; 11522944501Smrg unsigned char in_use; 11622944501Smrg unsigned char padding; 11722944501Smrg unsigned int age; 11822944501Smrg}; 11922944501Smrg 12022944501Smrg/** 12122944501Smrg * Hardware lock. 12222944501Smrg * 12322944501Smrg * The lock structure is a simple cache-line aligned integer. To avoid 12422944501Smrg * processor bus contention on a multiprocessor system, there should not be any 12522944501Smrg * other data stored in the same cache line. 12622944501Smrg */ 12722944501Smrgstruct drm_hw_lock { 12822944501Smrg __volatile__ unsigned int lock; /**< lock variable */ 12922944501Smrg char padding[60]; /**< Pad to cache line */ 13022944501Smrg}; 13122944501Smrg 13222944501Smrg/** 13322944501Smrg * DRM_IOCTL_VERSION ioctl argument type. 13422944501Smrg * 13522944501Smrg * \sa drmGetVersion(). 13622944501Smrg */ 13722944501Smrgstruct drm_version { 13822944501Smrg int version_major; /**< Major version */ 13922944501Smrg int version_minor; /**< Minor version */ 14022944501Smrg int version_patchlevel; /**< Patch level */ 141fe517fc9Smrg __kernel_size_t name_len; /**< Length of name buffer */ 14222944501Smrg char *name; /**< Name of driver */ 143fe517fc9Smrg __kernel_size_t date_len; /**< Length of date buffer */ 14422944501Smrg char *date; /**< User-space buffer to hold date */ 145fe517fc9Smrg __kernel_size_t desc_len; /**< Length of desc buffer */ 14622944501Smrg char *desc; /**< User-space buffer to hold desc */ 14722944501Smrg}; 14822944501Smrg 14922944501Smrg/** 15022944501Smrg * DRM_IOCTL_GET_UNIQUE ioctl argument type. 15122944501Smrg * 15222944501Smrg * \sa drmGetBusid() and drmSetBusId(). 15322944501Smrg */ 15422944501Smrgstruct drm_unique { 155fe517fc9Smrg __kernel_size_t unique_len; /**< Length of unique */ 15622944501Smrg char *unique; /**< Unique name for driver instantiation */ 15722944501Smrg}; 15822944501Smrg 15922944501Smrgstruct drm_list { 16022944501Smrg int count; /**< Length of user-space structures */ 16122944501Smrg struct drm_version *version; 16222944501Smrg}; 16322944501Smrg 16422944501Smrgstruct drm_block { 16522944501Smrg int unused; 16622944501Smrg}; 16722944501Smrg 16822944501Smrg/** 16922944501Smrg * DRM_IOCTL_CONTROL ioctl argument type. 17022944501Smrg * 17122944501Smrg * \sa drmCtlInstHandler() and drmCtlUninstHandler(). 17222944501Smrg */ 17322944501Smrgstruct drm_control { 17422944501Smrg enum { 17522944501Smrg DRM_ADD_COMMAND, 17622944501Smrg DRM_RM_COMMAND, 17722944501Smrg DRM_INST_HANDLER, 17822944501Smrg DRM_UNINST_HANDLER 17922944501Smrg } func; 18022944501Smrg int irq; 18122944501Smrg}; 18222944501Smrg 18322944501Smrg/** 18422944501Smrg * Type of memory to map. 18522944501Smrg */ 18622944501Smrgenum drm_map_type { 18722944501Smrg _DRM_FRAME_BUFFER = 0, /**< WC (no caching), no core dump */ 18822944501Smrg _DRM_REGISTERS = 1, /**< no caching, no core dump */ 18922944501Smrg _DRM_SHM = 2, /**< shared, cached */ 19022944501Smrg _DRM_AGP = 3, /**< AGP/GART */ 19122944501Smrg _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */ 192fe517fc9Smrg _DRM_CONSISTENT = 5 /**< Consistent memory for PCI DMA */ 19322944501Smrg}; 19422944501Smrg 19522944501Smrg/** 19622944501Smrg * Memory mapping flags. 19722944501Smrg */ 19822944501Smrgenum drm_map_flags { 19922944501Smrg _DRM_RESTRICTED = 0x01, /**< Cannot be mapped to user-virtual */ 20022944501Smrg _DRM_READ_ONLY = 0x02, 20122944501Smrg _DRM_LOCKED = 0x04, /**< shared, cached, locked */ 20222944501Smrg _DRM_KERNEL = 0x08, /**< kernel requires access */ 20322944501Smrg _DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */ 20422944501Smrg _DRM_CONTAINS_LOCK = 0x20, /**< SHM page that contains lock */ 20522944501Smrg _DRM_REMOVABLE = 0x40, /**< Removable mapping */ 20622944501Smrg _DRM_DRIVER = 0x80 /**< Managed by driver */ 20722944501Smrg}; 20822944501Smrg 20922944501Smrgstruct drm_ctx_priv_map { 21022944501Smrg unsigned int ctx_id; /**< Context requesting private mapping */ 21122944501Smrg void *handle; /**< Handle of map */ 21222944501Smrg}; 21322944501Smrg 21422944501Smrg/** 21522944501Smrg * DRM_IOCTL_GET_MAP, DRM_IOCTL_ADD_MAP and DRM_IOCTL_RM_MAP ioctls 21622944501Smrg * argument type. 21722944501Smrg * 21822944501Smrg * \sa drmAddMap(). 21922944501Smrg */ 22022944501Smrgstruct drm_map { 22122944501Smrg unsigned long offset; /**< Requested physical address (0 for SAREA)*/ 22222944501Smrg unsigned long size; /**< Requested physical size (bytes) */ 22322944501Smrg enum drm_map_type type; /**< Type of memory to map */ 22422944501Smrg enum drm_map_flags flags; /**< Flags */ 22522944501Smrg void *handle; /**< User-space: "Handle" to pass to mmap() */ 22622944501Smrg /**< Kernel-space: kernel-virtual address */ 22722944501Smrg int mtrr; /**< MTRR slot used */ 22822944501Smrg /* Private data */ 22922944501Smrg}; 23022944501Smrg 23122944501Smrg/** 23222944501Smrg * DRM_IOCTL_GET_CLIENT ioctl argument type. 23322944501Smrg */ 23422944501Smrgstruct drm_client { 23522944501Smrg int idx; /**< Which client desired? */ 23622944501Smrg int auth; /**< Is client authenticated? */ 23722944501Smrg unsigned long pid; /**< Process ID */ 23822944501Smrg unsigned long uid; /**< User ID */ 23922944501Smrg unsigned long magic; /**< Magic */ 24022944501Smrg unsigned long iocs; /**< Ioctl count */ 24122944501Smrg}; 24222944501Smrg 24322944501Smrgenum drm_stat_type { 24422944501Smrg _DRM_STAT_LOCK, 24522944501Smrg _DRM_STAT_OPENS, 24622944501Smrg _DRM_STAT_CLOSES, 24722944501Smrg _DRM_STAT_IOCTLS, 24822944501Smrg _DRM_STAT_LOCKS, 24922944501Smrg _DRM_STAT_UNLOCKS, 25022944501Smrg _DRM_STAT_VALUE, /**< Generic value */ 25122944501Smrg _DRM_STAT_BYTE, /**< Generic byte counter (1024bytes/K) */ 25222944501Smrg _DRM_STAT_COUNT, /**< Generic non-byte counter (1000/k) */ 25322944501Smrg 25422944501Smrg _DRM_STAT_IRQ, /**< IRQ */ 25522944501Smrg _DRM_STAT_PRIMARY, /**< Primary DMA bytes */ 25622944501Smrg _DRM_STAT_SECONDARY, /**< Secondary DMA bytes */ 25722944501Smrg _DRM_STAT_DMA, /**< DMA */ 25822944501Smrg _DRM_STAT_SPECIAL, /**< Special DMA (e.g., priority or polled) */ 25922944501Smrg _DRM_STAT_MISSED /**< Missed DMA opportunity */ 26022944501Smrg /* Add to the *END* of the list */ 26122944501Smrg}; 26222944501Smrg 26322944501Smrg/** 26422944501Smrg * DRM_IOCTL_GET_STATS ioctl argument type. 26522944501Smrg */ 26622944501Smrgstruct drm_stats { 26722944501Smrg unsigned long count; 26822944501Smrg struct { 26922944501Smrg unsigned long value; 27022944501Smrg enum drm_stat_type type; 27122944501Smrg } data[15]; 27222944501Smrg}; 27322944501Smrg 27422944501Smrg/** 27522944501Smrg * Hardware locking flags. 27622944501Smrg */ 27722944501Smrgenum drm_lock_flags { 27822944501Smrg _DRM_LOCK_READY = 0x01, /**< Wait until hardware is ready for DMA */ 27922944501Smrg _DRM_LOCK_QUIESCENT = 0x02, /**< Wait until hardware quiescent */ 28022944501Smrg _DRM_LOCK_FLUSH = 0x04, /**< Flush this context's DMA queue first */ 28122944501Smrg _DRM_LOCK_FLUSH_ALL = 0x08, /**< Flush all DMA queues first */ 28222944501Smrg /* These *HALT* flags aren't supported yet 28322944501Smrg -- they will be used to support the 28422944501Smrg full-screen DGA-like mode. */ 28522944501Smrg _DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */ 28622944501Smrg _DRM_HALT_CUR_QUEUES = 0x20 /**< Halt all current queues */ 28722944501Smrg}; 28822944501Smrg 28922944501Smrg/** 29022944501Smrg * DRM_IOCTL_LOCK, DRM_IOCTL_UNLOCK and DRM_IOCTL_FINISH ioctl argument type. 29122944501Smrg * 29222944501Smrg * \sa drmGetLock() and drmUnlock(). 29322944501Smrg */ 29422944501Smrgstruct drm_lock { 29522944501Smrg int context; 29622944501Smrg enum drm_lock_flags flags; 29722944501Smrg}; 29822944501Smrg 29922944501Smrg/** 30022944501Smrg * DMA flags 30122944501Smrg * 30222944501Smrg * \warning 30322944501Smrg * These values \e must match xf86drm.h. 30422944501Smrg * 30522944501Smrg * \sa drm_dma. 30622944501Smrg */ 30722944501Smrgenum drm_dma_flags { 30822944501Smrg /* Flags for DMA buffer dispatch */ 30922944501Smrg _DRM_DMA_BLOCK = 0x01, /**< 31022944501Smrg * Block until buffer dispatched. 31122944501Smrg * 31222944501Smrg * \note The buffer may not yet have 31322944501Smrg * been processed by the hardware -- 31422944501Smrg * getting a hardware lock with the 31522944501Smrg * hardware quiescent will ensure 31622944501Smrg * that the buffer has been 31722944501Smrg * processed. 31822944501Smrg */ 31922944501Smrg _DRM_DMA_WHILE_LOCKED = 0x02, /**< Dispatch while lock held */ 32022944501Smrg _DRM_DMA_PRIORITY = 0x04, /**< High priority dispatch */ 32122944501Smrg 32222944501Smrg /* Flags for DMA buffer request */ 32322944501Smrg _DRM_DMA_WAIT = 0x10, /**< Wait for free buffers */ 32422944501Smrg _DRM_DMA_SMALLER_OK = 0x20, /**< Smaller-than-requested buffers OK */ 32522944501Smrg _DRM_DMA_LARGER_OK = 0x40 /**< Larger-than-requested buffers OK */ 32622944501Smrg}; 32722944501Smrg 32822944501Smrg/** 32922944501Smrg * DRM_IOCTL_ADD_BUFS and DRM_IOCTL_MARK_BUFS ioctl argument type. 33022944501Smrg * 33122944501Smrg * \sa drmAddBufs(). 33222944501Smrg */ 33322944501Smrgstruct drm_buf_desc { 33422944501Smrg int count; /**< Number of buffers of this size */ 33522944501Smrg int size; /**< Size in bytes */ 33622944501Smrg int low_mark; /**< Low water mark */ 33722944501Smrg int high_mark; /**< High water mark */ 33822944501Smrg enum { 33922944501Smrg _DRM_PAGE_ALIGN = 0x01, /**< Align on page boundaries for DMA */ 34022944501Smrg _DRM_AGP_BUFFER = 0x02, /**< Buffer is in AGP space */ 34122944501Smrg _DRM_SG_BUFFER = 0x04, /**< Scatter/gather memory buffer */ 34222944501Smrg _DRM_FB_BUFFER = 0x08, /**< Buffer is in frame buffer */ 34322944501Smrg _DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */ 34422944501Smrg } flags; 34522944501Smrg unsigned long agp_start; /**< 34622944501Smrg * Start address of where the AGP buffers are 34722944501Smrg * in the AGP aperture 34822944501Smrg */ 34922944501Smrg}; 35022944501Smrg 35122944501Smrg/** 35222944501Smrg * DRM_IOCTL_INFO_BUFS ioctl argument type. 35322944501Smrg */ 35422944501Smrgstruct drm_buf_info { 35522944501Smrg int count; /**< Entries in list */ 35622944501Smrg struct drm_buf_desc *list; 35722944501Smrg}; 35822944501Smrg 35922944501Smrg/** 36022944501Smrg * DRM_IOCTL_FREE_BUFS ioctl argument type. 36122944501Smrg */ 36222944501Smrgstruct drm_buf_free { 36322944501Smrg int count; 36422944501Smrg int *list; 36522944501Smrg}; 36622944501Smrg 36722944501Smrg/** 36822944501Smrg * Buffer information 36922944501Smrg * 37022944501Smrg * \sa drm_buf_map. 37122944501Smrg */ 37222944501Smrgstruct drm_buf_pub { 37322944501Smrg int idx; /**< Index into the master buffer list */ 37422944501Smrg int total; /**< Buffer size */ 37522944501Smrg int used; /**< Amount of buffer in use (for DMA) */ 37622944501Smrg void *address; /**< Address of buffer */ 37722944501Smrg}; 37822944501Smrg 37922944501Smrg/** 38022944501Smrg * DRM_IOCTL_MAP_BUFS ioctl argument type. 38122944501Smrg */ 38222944501Smrgstruct drm_buf_map { 38322944501Smrg int count; /**< Length of the buffer list */ 384d049871aSmrg#ifdef __cplusplus 385d049871aSmrg void *virt; 386d049871aSmrg#else 38722944501Smrg void *virtual; /**< Mmap'd area in user-virtual */ 388d049871aSmrg#endif 38922944501Smrg struct drm_buf_pub *list; /**< Buffer information */ 39022944501Smrg}; 39122944501Smrg 39222944501Smrg/** 39322944501Smrg * DRM_IOCTL_DMA ioctl argument type. 39422944501Smrg * 39522944501Smrg * Indices here refer to the offset into the buffer list in drm_buf_get. 39622944501Smrg * 39722944501Smrg * \sa drmDMA(). 39822944501Smrg */ 39922944501Smrgstruct drm_dma { 40022944501Smrg int context; /**< Context handle */ 40122944501Smrg int send_count; /**< Number of buffers to send */ 40222944501Smrg int *send_indices; /**< List of handles to buffers */ 40322944501Smrg int *send_sizes; /**< Lengths of data to send */ 40422944501Smrg enum drm_dma_flags flags; /**< Flags */ 40522944501Smrg int request_count; /**< Number of buffers requested */ 40622944501Smrg int request_size; /**< Desired size for buffers */ 40722944501Smrg int *request_indices; /**< Buffer information */ 40822944501Smrg int *request_sizes; 40922944501Smrg int granted_count; /**< Number of buffers granted */ 41022944501Smrg}; 41122944501Smrg 41222944501Smrgenum drm_ctx_flags { 41322944501Smrg _DRM_CONTEXT_PRESERVED = 0x01, 41422944501Smrg _DRM_CONTEXT_2DONLY = 0x02 41522944501Smrg}; 41622944501Smrg 41722944501Smrg/** 41822944501Smrg * DRM_IOCTL_ADD_CTX ioctl argument type. 41922944501Smrg * 42022944501Smrg * \sa drmCreateContext() and drmDestroyContext(). 42122944501Smrg */ 42222944501Smrgstruct drm_ctx { 42322944501Smrg drm_context_t handle; 42422944501Smrg enum drm_ctx_flags flags; 42522944501Smrg}; 42622944501Smrg 42722944501Smrg/** 42822944501Smrg * DRM_IOCTL_RES_CTX ioctl argument type. 42922944501Smrg */ 43022944501Smrgstruct drm_ctx_res { 43122944501Smrg int count; 43222944501Smrg struct drm_ctx *contexts; 43322944501Smrg}; 43422944501Smrg 43522944501Smrg/** 43622944501Smrg * DRM_IOCTL_ADD_DRAW and DRM_IOCTL_RM_DRAW ioctl argument type. 43722944501Smrg */ 43822944501Smrgstruct drm_draw { 43922944501Smrg drm_drawable_t handle; 44022944501Smrg}; 44122944501Smrg 44222944501Smrg/** 44322944501Smrg * DRM_IOCTL_UPDATE_DRAW ioctl argument type. 44422944501Smrg */ 44522944501Smrgtypedef enum { 446e88f27b3Smrg DRM_DRAWABLE_CLIPRECTS 44722944501Smrg} drm_drawable_info_type_t; 44822944501Smrg 44922944501Smrgstruct drm_update_draw { 45022944501Smrg drm_drawable_t handle; 45122944501Smrg unsigned int type; 45222944501Smrg unsigned int num; 45322944501Smrg unsigned long long data; 45422944501Smrg}; 45522944501Smrg 45622944501Smrg/** 45722944501Smrg * DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type. 45822944501Smrg */ 45922944501Smrgstruct drm_auth { 46022944501Smrg drm_magic_t magic; 46122944501Smrg}; 46222944501Smrg 46322944501Smrg/** 46422944501Smrg * DRM_IOCTL_IRQ_BUSID ioctl argument type. 46522944501Smrg * 46622944501Smrg * \sa drmGetInterruptFromBusID(). 46722944501Smrg */ 46822944501Smrgstruct drm_irq_busid { 46922944501Smrg int irq; /**< IRQ number */ 47022944501Smrg int busnum; /**< bus number */ 47122944501Smrg int devnum; /**< device number */ 47222944501Smrg int funcnum; /**< function number */ 47322944501Smrg}; 47422944501Smrg 47522944501Smrgenum drm_vblank_seq_type { 47622944501Smrg _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ 47722944501Smrg _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ 478fe517fc9Smrg /* bits 1-6 are reserved for high crtcs */ 479fe517fc9Smrg _DRM_VBLANK_HIGH_CRTC_MASK = 0x0000003e, 48022944501Smrg _DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */ 48122944501Smrg _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ 48222944501Smrg _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ 48322944501Smrg _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ 48422944501Smrg _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking, unsupported */ 48522944501Smrg}; 486fe517fc9Smrg#define _DRM_VBLANK_HIGH_CRTC_SHIFT 1 48722944501Smrg 48822944501Smrg#define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) 48922944501Smrg#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \ 49022944501Smrg _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS) 49122944501Smrg 49222944501Smrgstruct drm_wait_vblank_request { 49322944501Smrg enum drm_vblank_seq_type type; 49422944501Smrg unsigned int sequence; 49522944501Smrg unsigned long signal; 49622944501Smrg}; 49722944501Smrg 49822944501Smrgstruct drm_wait_vblank_reply { 49922944501Smrg enum drm_vblank_seq_type type; 50022944501Smrg unsigned int sequence; 50122944501Smrg long tval_sec; 50222944501Smrg long tval_usec; 50322944501Smrg}; 50422944501Smrg 50522944501Smrg/** 50622944501Smrg * DRM_IOCTL_WAIT_VBLANK ioctl argument type. 50722944501Smrg * 50822944501Smrg * \sa drmWaitVBlank(). 50922944501Smrg */ 51022944501Smrgunion drm_wait_vblank { 51122944501Smrg struct drm_wait_vblank_request request; 51222944501Smrg struct drm_wait_vblank_reply reply; 51322944501Smrg}; 51422944501Smrg 51522944501Smrg#define _DRM_PRE_MODESET 1 51622944501Smrg#define _DRM_POST_MODESET 2 51722944501Smrg 51822944501Smrg/** 51922944501Smrg * DRM_IOCTL_MODESET_CTL ioctl argument type 52022944501Smrg * 52122944501Smrg * \sa drmModesetCtl(). 52222944501Smrg */ 52322944501Smrgstruct drm_modeset_ctl { 52422944501Smrg __u32 crtc; 52522944501Smrg __u32 cmd; 52622944501Smrg}; 52722944501Smrg 52822944501Smrg/** 52922944501Smrg * DRM_IOCTL_AGP_ENABLE ioctl argument type. 53022944501Smrg * 53122944501Smrg * \sa drmAgpEnable(). 53222944501Smrg */ 53322944501Smrgstruct drm_agp_mode { 53422944501Smrg unsigned long mode; /**< AGP mode */ 53522944501Smrg}; 53622944501Smrg 53722944501Smrg/** 53822944501Smrg * DRM_IOCTL_AGP_ALLOC and DRM_IOCTL_AGP_FREE ioctls argument type. 53922944501Smrg * 54022944501Smrg * \sa drmAgpAlloc() and drmAgpFree(). 54122944501Smrg */ 54222944501Smrgstruct drm_agp_buffer { 54322944501Smrg unsigned long size; /**< In bytes -- will round to page boundary */ 54422944501Smrg unsigned long handle; /**< Used for binding / unbinding */ 54522944501Smrg unsigned long type; /**< Type of memory to allocate */ 54622944501Smrg unsigned long physical; /**< Physical used by i810 */ 54722944501Smrg}; 54822944501Smrg 54922944501Smrg/** 55022944501Smrg * DRM_IOCTL_AGP_BIND and DRM_IOCTL_AGP_UNBIND ioctls argument type. 55122944501Smrg * 55222944501Smrg * \sa drmAgpBind() and drmAgpUnbind(). 55322944501Smrg */ 55422944501Smrgstruct drm_agp_binding { 55522944501Smrg unsigned long handle; /**< From drm_agp_buffer */ 55622944501Smrg unsigned long offset; /**< In bytes -- will round to page boundary */ 55722944501Smrg}; 55822944501Smrg 55922944501Smrg/** 56022944501Smrg * DRM_IOCTL_AGP_INFO ioctl argument type. 56122944501Smrg * 56222944501Smrg * \sa drmAgpVersionMajor(), drmAgpVersionMinor(), drmAgpGetMode(), 56322944501Smrg * drmAgpBase(), drmAgpSize(), drmAgpMemoryUsed(), drmAgpMemoryAvail(), 56422944501Smrg * drmAgpVendorId() and drmAgpDeviceId(). 56522944501Smrg */ 56622944501Smrgstruct drm_agp_info { 56722944501Smrg int agp_version_major; 56822944501Smrg int agp_version_minor; 56922944501Smrg unsigned long mode; 57022944501Smrg unsigned long aperture_base; /* physical address */ 57122944501Smrg unsigned long aperture_size; /* bytes */ 57222944501Smrg unsigned long memory_allowed; /* bytes */ 57322944501Smrg unsigned long memory_used; 57422944501Smrg 57522944501Smrg /* PCI information */ 57622944501Smrg unsigned short id_vendor; 57722944501Smrg unsigned short id_device; 57822944501Smrg}; 57922944501Smrg 58022944501Smrg/** 58122944501Smrg * DRM_IOCTL_SG_ALLOC ioctl argument type. 58222944501Smrg */ 58322944501Smrgstruct drm_scatter_gather { 58422944501Smrg unsigned long size; /**< In bytes -- will round to page boundary */ 58522944501Smrg unsigned long handle; /**< Used for mapping / unmapping */ 58622944501Smrg}; 58722944501Smrg 58822944501Smrg/** 58922944501Smrg * DRM_IOCTL_SET_VERSION ioctl argument type. 59022944501Smrg */ 59122944501Smrgstruct drm_set_version { 59222944501Smrg int drm_di_major; 59322944501Smrg int drm_di_minor; 59422944501Smrg int drm_dd_major; 59522944501Smrg int drm_dd_minor; 59622944501Smrg}; 59722944501Smrg 59822944501Smrg/** DRM_IOCTL_GEM_CLOSE ioctl argument type */ 59922944501Smrgstruct drm_gem_close { 60022944501Smrg /** Handle of the object to be closed. */ 60122944501Smrg __u32 handle; 60222944501Smrg __u32 pad; 60322944501Smrg}; 60422944501Smrg 60522944501Smrg/** DRM_IOCTL_GEM_FLINK ioctl argument type */ 60622944501Smrgstruct drm_gem_flink { 60722944501Smrg /** Handle for the object being named */ 60822944501Smrg __u32 handle; 60922944501Smrg 61022944501Smrg /** Returned global name */ 61122944501Smrg __u32 name; 61222944501Smrg}; 61322944501Smrg 61422944501Smrg/** DRM_IOCTL_GEM_OPEN ioctl argument type */ 61522944501Smrgstruct drm_gem_open { 61622944501Smrg /** Name of object being opened */ 61722944501Smrg __u32 name; 61822944501Smrg 61922944501Smrg /** Returned handle for the object */ 62022944501Smrg __u32 handle; 62122944501Smrg 62222944501Smrg /** Returned size of the object */ 62322944501Smrg __u64 size; 62422944501Smrg}; 62522944501Smrg 626fe517fc9Smrg#define DRM_CAP_DUMB_BUFFER 0x1 627fe517fc9Smrg#define DRM_CAP_VBLANK_HIGH_CRTC 0x2 628fe517fc9Smrg#define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3 629fe517fc9Smrg#define DRM_CAP_DUMB_PREFER_SHADOW 0x4 630fe517fc9Smrg#define DRM_CAP_PRIME 0x5 631fe517fc9Smrg#define DRM_PRIME_CAP_IMPORT 0x1 632fe517fc9Smrg#define DRM_PRIME_CAP_EXPORT 0x2 633fe517fc9Smrg#define DRM_CAP_TIMESTAMP_MONOTONIC 0x6 634fe517fc9Smrg#define DRM_CAP_ASYNC_PAGE_FLIP 0x7 635fe517fc9Smrg/* 636fe517fc9Smrg * The CURSOR_WIDTH and CURSOR_HEIGHT capabilities return a valid widthxheight 637fe517fc9Smrg * combination for the hardware cursor. The intention is that a hardware 638fe517fc9Smrg * agnostic userspace can query a cursor plane size to use. 639fe517fc9Smrg * 640fe517fc9Smrg * Note that the cross-driver contract is to merely return a valid size; 641fe517fc9Smrg * drivers are free to attach another meaning on top, eg. i915 returns the 642fe517fc9Smrg * maximum plane size. 643fe517fc9Smrg */ 644fe517fc9Smrg#define DRM_CAP_CURSOR_WIDTH 0x8 645fe517fc9Smrg#define DRM_CAP_CURSOR_HEIGHT 0x9 646fe517fc9Smrg#define DRM_CAP_ADDFB2_MODIFIERS 0x10 6472ee35494Smrg#define DRM_CAP_PAGE_FLIP_TARGET 0x11 6480655efefSmrg#define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12 6490655efefSmrg#define DRM_CAP_SYNCOBJ 0x13 650bf6cc7dcSmrg#define DRM_CAP_SYNCOBJ_TIMELINE 0x14 651fe517fc9Smrg 652e88f27b3Smrg/** DRM_IOCTL_GET_CAP ioctl argument type */ 653e88f27b3Smrgstruct drm_get_cap { 654e88f27b3Smrg __u64 capability; 655e88f27b3Smrg __u64 value; 656e88f27b3Smrg}; 657e88f27b3Smrg 658e88f27b3Smrg/** 659e88f27b3Smrg * DRM_CLIENT_CAP_STEREO_3D 660e88f27b3Smrg * 661e88f27b3Smrg * if set to 1, the DRM core will expose the stereo 3D capabilities of the 662e88f27b3Smrg * monitor by advertising the supported 3D layouts in the flags of struct 663e88f27b3Smrg * drm_mode_modeinfo. 664e88f27b3Smrg */ 665e88f27b3Smrg#define DRM_CLIENT_CAP_STEREO_3D 1 666e88f27b3Smrg 667a884aba1Smrg/** 668a884aba1Smrg * DRM_CLIENT_CAP_UNIVERSAL_PLANES 669a884aba1Smrg * 670fe517fc9Smrg * If set to 1, the DRM core will expose all planes (overlay, primary, and 671fe517fc9Smrg * cursor) to userspace. 672a884aba1Smrg */ 673fe517fc9Smrg#define DRM_CLIENT_CAP_UNIVERSAL_PLANES 2 674a884aba1Smrg 675424e9256Smrg/** 676424e9256Smrg * DRM_CLIENT_CAP_ATOMIC 677424e9256Smrg * 678fe517fc9Smrg * If set to 1, the DRM core will expose atomic properties to userspace 679424e9256Smrg */ 680fe517fc9Smrg#define DRM_CLIENT_CAP_ATOMIC 3 681424e9256Smrg 6826260e5d5Smrg/** 6836260e5d5Smrg * DRM_CLIENT_CAP_ASPECT_RATIO 6846260e5d5Smrg * 6856260e5d5Smrg * If set to 1, the DRM core will provide aspect ratio information in modes. 6866260e5d5Smrg */ 6876260e5d5Smrg#define DRM_CLIENT_CAP_ASPECT_RATIO 4 6886260e5d5Smrg 6896260e5d5Smrg/** 6906260e5d5Smrg * DRM_CLIENT_CAP_WRITEBACK_CONNECTORS 6916260e5d5Smrg * 6926260e5d5Smrg * If set to 1, the DRM core will expose special connectors to be used for 6936260e5d5Smrg * writing back to memory the scene setup in the commit. Depends on client 6946260e5d5Smrg * also supporting DRM_CLIENT_CAP_ATOMIC 6956260e5d5Smrg */ 6966260e5d5Smrg#define DRM_CLIENT_CAP_WRITEBACK_CONNECTORS 5 6976260e5d5Smrg 698e88f27b3Smrg/** DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */ 699e88f27b3Smrgstruct drm_set_client_cap { 700e88f27b3Smrg __u64 capability; 701e88f27b3Smrg __u64 value; 702e88f27b3Smrg}; 703e88f27b3Smrg 704fe517fc9Smrg#define DRM_RDWR O_RDWR 705e88f27b3Smrg#define DRM_CLOEXEC O_CLOEXEC 706e88f27b3Smrgstruct drm_prime_handle { 707e88f27b3Smrg __u32 handle; 708e88f27b3Smrg 709e88f27b3Smrg /** Flags.. only applicable for handle->fd */ 710e88f27b3Smrg __u32 flags; 711e88f27b3Smrg 712e88f27b3Smrg /** Returned dmabuf file descriptor */ 713e88f27b3Smrg __s32 fd; 714e88f27b3Smrg}; 715e88f27b3Smrg 7160655efefSmrgstruct drm_syncobj_create { 7170655efefSmrg __u32 handle; 7182b90624aSmrg#define DRM_SYNCOBJ_CREATE_SIGNALED (1 << 0) 7190655efefSmrg __u32 flags; 7200655efefSmrg}; 7210655efefSmrg 7220655efefSmrgstruct drm_syncobj_destroy { 7230655efefSmrg __u32 handle; 7240655efefSmrg __u32 pad; 7250655efefSmrg}; 7260655efefSmrg 7270655efefSmrg#define DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE (1 << 0) 7280655efefSmrg#define DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE (1 << 0) 7290655efefSmrgstruct drm_syncobj_handle { 7300655efefSmrg __u32 handle; 7310655efefSmrg __u32 flags; 7320655efefSmrg 7330655efefSmrg __s32 fd; 7340655efefSmrg __u32 pad; 7350655efefSmrg}; 7360655efefSmrg 737bf6cc7dcSmrgstruct drm_syncobj_transfer { 738bf6cc7dcSmrg __u32 src_handle; 739bf6cc7dcSmrg __u32 dst_handle; 740bf6cc7dcSmrg __u64 src_point; 741bf6cc7dcSmrg __u64 dst_point; 742bf6cc7dcSmrg __u32 flags; 743bf6cc7dcSmrg __u32 pad; 744bf6cc7dcSmrg}; 745bf6cc7dcSmrg 7462b90624aSmrg#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0) 7472b90624aSmrg#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1) 748bf6cc7dcSmrg#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2) /* wait for time point to become available */ 7492b90624aSmrgstruct drm_syncobj_wait { 7502b90624aSmrg __u64 handles; 7512b90624aSmrg /* absolute timeout */ 7522b90624aSmrg __s64 timeout_nsec; 7532b90624aSmrg __u32 count_handles; 7542b90624aSmrg __u32 flags; 7552b90624aSmrg __u32 first_signaled; /* only valid when not waiting all */ 7562b90624aSmrg __u32 pad; 7572b90624aSmrg}; 7582b90624aSmrg 759bf6cc7dcSmrgstruct drm_syncobj_timeline_wait { 760bf6cc7dcSmrg __u64 handles; 761bf6cc7dcSmrg /* wait on specific timeline point for every handles*/ 762bf6cc7dcSmrg __u64 points; 763bf6cc7dcSmrg /* absolute timeout */ 764bf6cc7dcSmrg __s64 timeout_nsec; 765bf6cc7dcSmrg __u32 count_handles; 766bf6cc7dcSmrg __u32 flags; 767bf6cc7dcSmrg __u32 first_signaled; /* only valid when not waiting all */ 768bf6cc7dcSmrg __u32 pad; 769bf6cc7dcSmrg}; 770bf6cc7dcSmrg 771bf6cc7dcSmrg 7722b90624aSmrgstruct drm_syncobj_array { 7732b90624aSmrg __u64 handles; 7742b90624aSmrg __u32 count_handles; 7752b90624aSmrg __u32 pad; 7762b90624aSmrg}; 7772b90624aSmrg 77887bf8e7cSmrg#define DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED (1 << 0) /* last available point on timeline syncobj */ 779bf6cc7dcSmrgstruct drm_syncobj_timeline_array { 780bf6cc7dcSmrg __u64 handles; 781bf6cc7dcSmrg __u64 points; 782bf6cc7dcSmrg __u32 count_handles; 78387bf8e7cSmrg __u32 flags; 784bf6cc7dcSmrg}; 785bf6cc7dcSmrg 786bf6cc7dcSmrg 7872b90624aSmrg/* Query current scanout sequence number */ 7882b90624aSmrgstruct drm_crtc_get_sequence { 7892b90624aSmrg __u32 crtc_id; /* requested crtc_id */ 7902b90624aSmrg __u32 active; /* return: crtc output is active */ 7912b90624aSmrg __u64 sequence; /* return: most recent vblank sequence */ 7922b90624aSmrg __s64 sequence_ns; /* return: most recent time of first pixel out */ 7932b90624aSmrg}; 7942b90624aSmrg 7952b90624aSmrg/* Queue event to be delivered at specified sequence. Time stamp marks 7962b90624aSmrg * when the first pixel of the refresh cycle leaves the display engine 7972b90624aSmrg * for the display 7982b90624aSmrg */ 7992b90624aSmrg#define DRM_CRTC_SEQUENCE_RELATIVE 0x00000001 /* sequence is relative to current */ 8002b90624aSmrg#define DRM_CRTC_SEQUENCE_NEXT_ON_MISS 0x00000002 /* Use next sequence if we've missed */ 8012b90624aSmrg 8022b90624aSmrgstruct drm_crtc_queue_sequence { 8032b90624aSmrg __u32 crtc_id; 8042b90624aSmrg __u32 flags; 8052b90624aSmrg __u64 sequence; /* on input, target sequence. on output, actual sequence */ 8062b90624aSmrg __u64 user_data; /* user data passed to event */ 8072b90624aSmrg}; 8082b90624aSmrg 8092ee35494Smrg#if defined(__cplusplus) 8102ee35494Smrg} 8112ee35494Smrg#endif 8122ee35494Smrg 81322944501Smrg#include "drm_mode.h" 81422944501Smrg 8152ee35494Smrg#if defined(__cplusplus) 8162ee35494Smrgextern "C" { 8172ee35494Smrg#endif 8182ee35494Smrg 81922944501Smrg#define DRM_IOCTL_BASE 'd' 82022944501Smrg#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) 82122944501Smrg#define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type) 82222944501Smrg#define DRM_IOW(nr,type) _IOW(DRM_IOCTL_BASE,nr,type) 82322944501Smrg#define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type) 82422944501Smrg 82522944501Smrg#define DRM_IOCTL_VERSION DRM_IOWR(0x00, struct drm_version) 82622944501Smrg#define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, struct drm_unique) 82722944501Smrg#define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, struct drm_auth) 82822944501Smrg#define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, struct drm_irq_busid) 82922944501Smrg#define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, struct drm_map) 83022944501Smrg#define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client) 83122944501Smrg#define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats) 83222944501Smrg#define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version) 83322944501Smrg#define DRM_IOCTL_MODESET_CTL DRM_IOW(0x08, struct drm_modeset_ctl) 83422944501Smrg#define DRM_IOCTL_GEM_CLOSE DRM_IOW (0x09, struct drm_gem_close) 83522944501Smrg#define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink) 83622944501Smrg#define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open) 837e88f27b3Smrg#define DRM_IOCTL_GET_CAP DRM_IOWR(0x0c, struct drm_get_cap) 838e88f27b3Smrg#define DRM_IOCTL_SET_CLIENT_CAP DRM_IOW( 0x0d, struct drm_set_client_cap) 83922944501Smrg 84022944501Smrg#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique) 84122944501Smrg#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth) 84222944501Smrg#define DRM_IOCTL_BLOCK DRM_IOWR(0x12, struct drm_block) 84322944501Smrg#define DRM_IOCTL_UNBLOCK DRM_IOWR(0x13, struct drm_block) 84422944501Smrg#define DRM_IOCTL_CONTROL DRM_IOW( 0x14, struct drm_control) 84522944501Smrg#define DRM_IOCTL_ADD_MAP DRM_IOWR(0x15, struct drm_map) 84622944501Smrg#define DRM_IOCTL_ADD_BUFS DRM_IOWR(0x16, struct drm_buf_desc) 84722944501Smrg#define DRM_IOCTL_MARK_BUFS DRM_IOW( 0x17, struct drm_buf_desc) 84822944501Smrg#define DRM_IOCTL_INFO_BUFS DRM_IOWR(0x18, struct drm_buf_info) 84922944501Smrg#define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, struct drm_buf_map) 85022944501Smrg#define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, struct drm_buf_free) 85122944501Smrg 85222944501Smrg#define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, struct drm_map) 85322944501Smrg 85422944501Smrg#define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, struct drm_ctx_priv_map) 85522944501Smrg#define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, struct drm_ctx_priv_map) 85622944501Smrg 85722944501Smrg#define DRM_IOCTL_SET_MASTER DRM_IO(0x1e) 85822944501Smrg#define DRM_IOCTL_DROP_MASTER DRM_IO(0x1f) 85922944501Smrg 86022944501Smrg#define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, struct drm_ctx) 86122944501Smrg#define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, struct drm_ctx) 86222944501Smrg#define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, struct drm_ctx) 86322944501Smrg#define DRM_IOCTL_GET_CTX DRM_IOWR(0x23, struct drm_ctx) 86422944501Smrg#define DRM_IOCTL_SWITCH_CTX DRM_IOW( 0x24, struct drm_ctx) 86522944501Smrg#define DRM_IOCTL_NEW_CTX DRM_IOW( 0x25, struct drm_ctx) 86622944501Smrg#define DRM_IOCTL_RES_CTX DRM_IOWR(0x26, struct drm_ctx_res) 86722944501Smrg#define DRM_IOCTL_ADD_DRAW DRM_IOWR(0x27, struct drm_draw) 86822944501Smrg#define DRM_IOCTL_RM_DRAW DRM_IOWR(0x28, struct drm_draw) 86922944501Smrg#define DRM_IOCTL_DMA DRM_IOWR(0x29, struct drm_dma) 87022944501Smrg#define DRM_IOCTL_LOCK DRM_IOW( 0x2a, struct drm_lock) 87122944501Smrg#define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock) 87222944501Smrg#define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock) 87322944501Smrg 874e88f27b3Smrg#define DRM_IOCTL_PRIME_HANDLE_TO_FD DRM_IOWR(0x2d, struct drm_prime_handle) 875e88f27b3Smrg#define DRM_IOCTL_PRIME_FD_TO_HANDLE DRM_IOWR(0x2e, struct drm_prime_handle) 876e88f27b3Smrg 87722944501Smrg#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) 87822944501Smrg#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) 87922944501Smrg#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, struct drm_agp_mode) 88022944501Smrg#define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, struct drm_agp_info) 88122944501Smrg#define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, struct drm_agp_buffer) 88222944501Smrg#define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, struct drm_agp_buffer) 88322944501Smrg#define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, struct drm_agp_binding) 88422944501Smrg#define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, struct drm_agp_binding) 88522944501Smrg 88622944501Smrg#define DRM_IOCTL_SG_ALLOC DRM_IOWR(0x38, struct drm_scatter_gather) 88722944501Smrg#define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, struct drm_scatter_gather) 88822944501Smrg 88922944501Smrg#define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, union drm_wait_vblank) 89022944501Smrg 8912b90624aSmrg#define DRM_IOCTL_CRTC_GET_SEQUENCE DRM_IOWR(0x3b, struct drm_crtc_get_sequence) 8922b90624aSmrg#define DRM_IOCTL_CRTC_QUEUE_SEQUENCE DRM_IOWR(0x3c, struct drm_crtc_queue_sequence) 8932b90624aSmrg 89422944501Smrg#define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, struct drm_update_draw) 89522944501Smrg 89622944501Smrg#define DRM_IOCTL_MODE_GETRESOURCES DRM_IOWR(0xA0, struct drm_mode_card_res) 89722944501Smrg#define DRM_IOCTL_MODE_GETCRTC DRM_IOWR(0xA1, struct drm_mode_crtc) 89822944501Smrg#define DRM_IOCTL_MODE_SETCRTC DRM_IOWR(0xA2, struct drm_mode_crtc) 89922944501Smrg#define DRM_IOCTL_MODE_CURSOR DRM_IOWR(0xA3, struct drm_mode_cursor) 90022944501Smrg#define DRM_IOCTL_MODE_GETGAMMA DRM_IOWR(0xA4, struct drm_mode_crtc_lut) 90122944501Smrg#define DRM_IOCTL_MODE_SETGAMMA DRM_IOWR(0xA5, struct drm_mode_crtc_lut) 90222944501Smrg#define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xA6, struct drm_mode_get_encoder) 90322944501Smrg#define DRM_IOCTL_MODE_GETCONNECTOR DRM_IOWR(0xA7, struct drm_mode_get_connector) 904fe517fc9Smrg#define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA8, struct drm_mode_mode_cmd) /* deprecated (never worked) */ 905fe517fc9Smrg#define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd) /* deprecated (never worked) */ 90622944501Smrg 90722944501Smrg#define DRM_IOCTL_MODE_GETPROPERTY DRM_IOWR(0xAA, struct drm_mode_get_property) 90822944501Smrg#define DRM_IOCTL_MODE_SETPROPERTY DRM_IOWR(0xAB, struct drm_mode_connector_set_property) 90922944501Smrg#define DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xAC, struct drm_mode_get_blob) 91022944501Smrg#define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd) 91122944501Smrg#define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) 91222944501Smrg#define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int) 91322944501Smrg#define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip) 91422944501Smrg#define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd) 91522944501Smrg 916e88f27b3Smrg#define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb) 917e88f27b3Smrg#define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb) 918e88f27b3Smrg#define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb) 919e88f27b3Smrg#define DRM_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xB5, struct drm_mode_get_plane_res) 920e88f27b3Smrg#define DRM_IOCTL_MODE_GETPLANE DRM_IOWR(0xB6, struct drm_mode_get_plane) 921e88f27b3Smrg#define DRM_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct drm_mode_set_plane) 922e88f27b3Smrg#define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2) 923e88f27b3Smrg#define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties) 924e88f27b3Smrg#define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property) 925e88f27b3Smrg#define DRM_IOCTL_MODE_CURSOR2 DRM_IOWR(0xBB, struct drm_mode_cursor2) 926424e9256Smrg#define DRM_IOCTL_MODE_ATOMIC DRM_IOWR(0xBC, struct drm_mode_atomic) 927424e9256Smrg#define DRM_IOCTL_MODE_CREATEPROPBLOB DRM_IOWR(0xBD, struct drm_mode_create_blob) 928424e9256Smrg#define DRM_IOCTL_MODE_DESTROYPROPBLOB DRM_IOWR(0xBE, struct drm_mode_destroy_blob) 929e88f27b3Smrg 9300655efefSmrg#define DRM_IOCTL_SYNCOBJ_CREATE DRM_IOWR(0xBF, struct drm_syncobj_create) 9310655efefSmrg#define DRM_IOCTL_SYNCOBJ_DESTROY DRM_IOWR(0xC0, struct drm_syncobj_destroy) 9320655efefSmrg#define DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD DRM_IOWR(0xC1, struct drm_syncobj_handle) 9330655efefSmrg#define DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE DRM_IOWR(0xC2, struct drm_syncobj_handle) 9342b90624aSmrg#define DRM_IOCTL_SYNCOBJ_WAIT DRM_IOWR(0xC3, struct drm_syncobj_wait) 9352b90624aSmrg#define DRM_IOCTL_SYNCOBJ_RESET DRM_IOWR(0xC4, struct drm_syncobj_array) 9362b90624aSmrg#define DRM_IOCTL_SYNCOBJ_SIGNAL DRM_IOWR(0xC5, struct drm_syncobj_array) 9372b90624aSmrg 9382b90624aSmrg#define DRM_IOCTL_MODE_CREATE_LEASE DRM_IOWR(0xC6, struct drm_mode_create_lease) 9392b90624aSmrg#define DRM_IOCTL_MODE_LIST_LESSEES DRM_IOWR(0xC7, struct drm_mode_list_lessees) 9402b90624aSmrg#define DRM_IOCTL_MODE_GET_LEASE DRM_IOWR(0xC8, struct drm_mode_get_lease) 9412b90624aSmrg#define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease) 9420655efefSmrg 943bf6cc7dcSmrg#define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait) 944bf6cc7dcSmrg#define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, struct drm_syncobj_timeline_array) 945bf6cc7dcSmrg#define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer) 946bf6cc7dcSmrg#define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL DRM_IOWR(0xCD, struct drm_syncobj_timeline_array) 947bf6cc7dcSmrg 94887bf8e7cSmrg#define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE, struct drm_mode_fb_cmd2) 94987bf8e7cSmrg 95022944501Smrg/** 95122944501Smrg * Device specific ioctls should only be in their respective headers 952fe517fc9Smrg * The device specific ioctl range is from 0x40 to 0x9f. 95322944501Smrg * Generic IOCTLS restart at 0xA0. 95422944501Smrg * 95522944501Smrg * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and 95622944501Smrg * drmCommandReadWrite(). 95722944501Smrg */ 95822944501Smrg#define DRM_COMMAND_BASE 0x40 95922944501Smrg#define DRM_COMMAND_END 0xA0 96022944501Smrg 96122944501Smrg/** 96222944501Smrg * Header for events written back to userspace on the drm fd. The 96322944501Smrg * type defines the type of event, the length specifies the total 96422944501Smrg * length of the event (including the header), and user_data is 96522944501Smrg * typically a 64 bit value passed with the ioctl that triggered the 96622944501Smrg * event. A read on the drm fd will always only return complete 96722944501Smrg * events, that is, if for example the read buffer is 100 bytes, and 96822944501Smrg * there are two 64 byte events pending, only one will be returned. 96922944501Smrg * 97022944501Smrg * Event types 0 - 0x7fffffff are generic drm events, 0x80000000 and 97122944501Smrg * up are chipset specific. 97222944501Smrg */ 97322944501Smrgstruct drm_event { 97422944501Smrg __u32 type; 97522944501Smrg __u32 length; 97622944501Smrg}; 97722944501Smrg 97822944501Smrg#define DRM_EVENT_VBLANK 0x01 97922944501Smrg#define DRM_EVENT_FLIP_COMPLETE 0x02 9802b90624aSmrg#define DRM_EVENT_CRTC_SEQUENCE 0x03 98122944501Smrg 98222944501Smrgstruct drm_event_vblank { 98322944501Smrg struct drm_event base; 98422944501Smrg __u64 user_data; 98522944501Smrg __u32 tv_sec; 98622944501Smrg __u32 tv_usec; 98722944501Smrg __u32 sequence; 9880655efefSmrg __u32 crtc_id; /* 0 on older kernels that do not support this */ 98922944501Smrg}; 99022944501Smrg 9912b90624aSmrg/* Event delivered at sequence. Time stamp marks when the first pixel 9922b90624aSmrg * of the refresh cycle leaves the display engine for the display 9932b90624aSmrg */ 9942b90624aSmrgstruct drm_event_crtc_sequence { 9952b90624aSmrg struct drm_event base; 9962b90624aSmrg __u64 user_data; 9972b90624aSmrg __s64 time_ns; 9982b90624aSmrg __u64 sequence; 9992b90624aSmrg}; 10002b90624aSmrg 100122944501Smrg/* typedef area */ 100222944501Smrgtypedef struct drm_clip_rect drm_clip_rect_t; 100322944501Smrgtypedef struct drm_drawable_info drm_drawable_info_t; 100422944501Smrgtypedef struct drm_tex_region drm_tex_region_t; 100522944501Smrgtypedef struct drm_hw_lock drm_hw_lock_t; 100622944501Smrgtypedef struct drm_version drm_version_t; 100722944501Smrgtypedef struct drm_unique drm_unique_t; 100822944501Smrgtypedef struct drm_list drm_list_t; 100922944501Smrgtypedef struct drm_block drm_block_t; 101022944501Smrgtypedef struct drm_control drm_control_t; 101122944501Smrgtypedef enum drm_map_type drm_map_type_t; 101222944501Smrgtypedef enum drm_map_flags drm_map_flags_t; 101322944501Smrgtypedef struct drm_ctx_priv_map drm_ctx_priv_map_t; 101422944501Smrgtypedef struct drm_map drm_map_t; 101522944501Smrgtypedef struct drm_client drm_client_t; 101622944501Smrgtypedef enum drm_stat_type drm_stat_type_t; 101722944501Smrgtypedef struct drm_stats drm_stats_t; 101822944501Smrgtypedef enum drm_lock_flags drm_lock_flags_t; 101922944501Smrgtypedef struct drm_lock drm_lock_t; 102022944501Smrgtypedef enum drm_dma_flags drm_dma_flags_t; 102122944501Smrgtypedef struct drm_buf_desc drm_buf_desc_t; 102222944501Smrgtypedef struct drm_buf_info drm_buf_info_t; 102322944501Smrgtypedef struct drm_buf_free drm_buf_free_t; 102422944501Smrgtypedef struct drm_buf_pub drm_buf_pub_t; 102522944501Smrgtypedef struct drm_buf_map drm_buf_map_t; 102622944501Smrgtypedef struct drm_dma drm_dma_t; 102722944501Smrgtypedef union drm_wait_vblank drm_wait_vblank_t; 102822944501Smrgtypedef struct drm_agp_mode drm_agp_mode_t; 102922944501Smrgtypedef enum drm_ctx_flags drm_ctx_flags_t; 103022944501Smrgtypedef struct drm_ctx drm_ctx_t; 103122944501Smrgtypedef struct drm_ctx_res drm_ctx_res_t; 103222944501Smrgtypedef struct drm_draw drm_draw_t; 103322944501Smrgtypedef struct drm_update_draw drm_update_draw_t; 103422944501Smrgtypedef struct drm_auth drm_auth_t; 103522944501Smrgtypedef struct drm_irq_busid drm_irq_busid_t; 103622944501Smrgtypedef enum drm_vblank_seq_type drm_vblank_seq_type_t; 103722944501Smrg 103822944501Smrgtypedef struct drm_agp_buffer drm_agp_buffer_t; 103922944501Smrgtypedef struct drm_agp_binding drm_agp_binding_t; 104022944501Smrgtypedef struct drm_agp_info drm_agp_info_t; 104122944501Smrgtypedef struct drm_scatter_gather drm_scatter_gather_t; 104222944501Smrgtypedef struct drm_set_version drm_set_version_t; 104322944501Smrg 10442ee35494Smrg#if defined(__cplusplus) 10452ee35494Smrg} 10462ee35494Smrg#endif 10472ee35494Smrg 104822944501Smrg#endif 1049