drm.h 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219
  1. /*
  2. * Header for the Direct Rendering Manager
  3. *
  4. * Author: Rickard E. (Rik) Faith <[email protected]>
  5. *
  6. * Acknowledgments:
  7. * Dec 1999, Richard Henderson <[email protected]>, move to generic cmpxchg.
  8. */
  9. /*
  10. * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
  11. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
  12. * All rights reserved.
  13. *
  14. * Permission is hereby granted, free of charge, to any person obtaining a
  15. * copy of this software and associated documentation files (the "Software"),
  16. * to deal in the Software without restriction, including without limitation
  17. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  18. * and/or sell copies of the Software, and to permit persons to whom the
  19. * Software is furnished to do so, subject to the following conditions:
  20. *
  21. * The above copyright notice and this permission notice (including the next
  22. * paragraph) shall be included in all copies or substantial portions of the
  23. * Software.
  24. *
  25. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  26. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  27. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  28. * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  29. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  30. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  31. * OTHER DEALINGS IN THE SOFTWARE.
  32. */
  33. #ifndef _DRM_H_
  34. #define _DRM_H_
  35. #if defined(__KERNEL__)
  36. #include <linux/types.h>
  37. #include <asm/ioctl.h>
  38. typedef unsigned int drm_handle_t;
  39. #elif defined(__linux__)
  40. #include <linux/types.h>
  41. #include <asm/ioctl.h>
  42. typedef unsigned int drm_handle_t;
  43. #else /* One of the BSDs */
  44. #include <stdint.h>
  45. #include <sys/ioccom.h>
  46. #include <sys/types.h>
  47. typedef int8_t __s8;
  48. typedef uint8_t __u8;
  49. typedef int16_t __s16;
  50. typedef uint16_t __u16;
  51. typedef int32_t __s32;
  52. typedef uint32_t __u32;
  53. typedef int64_t __s64;
  54. typedef uint64_t __u64;
  55. typedef size_t __kernel_size_t;
  56. typedef unsigned long drm_handle_t;
  57. #endif
  58. #if defined(__cplusplus)
  59. extern "C" {
  60. #endif
  61. #define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */
  62. #define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */
  63. #define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */
  64. #define DRM_RAM_PERCENT 10 /**< How much system ram can we lock? */
  65. #define _DRM_LOCK_HELD 0x80000000U /**< Hardware lock is held */
  66. #define _DRM_LOCK_CONT 0x40000000U /**< Hardware lock is contended */
  67. #define _DRM_LOCK_IS_HELD(lock) ((lock) & _DRM_LOCK_HELD)
  68. #define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT)
  69. #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT))
  70. typedef unsigned int drm_context_t;
  71. typedef unsigned int drm_drawable_t;
  72. typedef unsigned int drm_magic_t;
  73. /*
  74. * Cliprect.
  75. *
  76. * \warning: If you change this structure, make sure you change
  77. * XF86DRIClipRectRec in the server as well
  78. *
  79. * \note KW: Actually it's illegal to change either for
  80. * backwards-compatibility reasons.
  81. */
  82. struct drm_clip_rect {
  83. unsigned short x1;
  84. unsigned short y1;
  85. unsigned short x2;
  86. unsigned short y2;
  87. };
  88. /*
  89. * Drawable information.
  90. */
  91. struct drm_drawable_info {
  92. unsigned int num_rects;
  93. struct drm_clip_rect *rects;
  94. };
  95. /*
  96. * Texture region,
  97. */
  98. struct drm_tex_region {
  99. unsigned char next;
  100. unsigned char prev;
  101. unsigned char in_use;
  102. unsigned char padding;
  103. unsigned int age;
  104. };
  105. /*
  106. * Hardware lock.
  107. *
  108. * The lock structure is a simple cache-line aligned integer. To avoid
  109. * processor bus contention on a multiprocessor system, there should not be any
  110. * other data stored in the same cache line.
  111. */
  112. struct drm_hw_lock {
  113. __volatile__ unsigned int lock; /**< lock variable */
  114. char padding[60]; /**< Pad to cache line */
  115. };
  116. /*
  117. * DRM_IOCTL_VERSION ioctl argument type.
  118. *
  119. * \sa drmGetVersion().
  120. */
  121. struct drm_version {
  122. int version_major; /**< Major version */
  123. int version_minor; /**< Minor version */
  124. int version_patchlevel; /**< Patch level */
  125. __kernel_size_t name_len; /**< Length of name buffer */
  126. char __user *name; /**< Name of driver */
  127. __kernel_size_t date_len; /**< Length of date buffer */
  128. char __user *date; /**< User-space buffer to hold date */
  129. __kernel_size_t desc_len; /**< Length of desc buffer */
  130. char __user *desc; /**< User-space buffer to hold desc */
  131. };
  132. /*
  133. * DRM_IOCTL_GET_UNIQUE ioctl argument type.
  134. *
  135. * \sa drmGetBusid() and drmSetBusId().
  136. */
  137. struct drm_unique {
  138. __kernel_size_t unique_len; /**< Length of unique */
  139. char __user *unique; /**< Unique name for driver instantiation */
  140. };
  141. struct drm_list {
  142. int count; /**< Length of user-space structures */
  143. struct drm_version __user *version;
  144. };
  145. struct drm_block {
  146. int unused;
  147. };
  148. /*
  149. * DRM_IOCTL_CONTROL ioctl argument type.
  150. *
  151. * \sa drmCtlInstHandler() and drmCtlUninstHandler().
  152. */
  153. struct drm_control {
  154. enum {
  155. DRM_ADD_COMMAND,
  156. DRM_RM_COMMAND,
  157. DRM_INST_HANDLER,
  158. DRM_UNINST_HANDLER
  159. } func;
  160. int irq;
  161. };
  162. /*
  163. * Type of memory to map.
  164. */
  165. enum drm_map_type {
  166. _DRM_FRAME_BUFFER = 0, /**< WC (no caching), no core dump */
  167. _DRM_REGISTERS = 1, /**< no caching, no core dump */
  168. _DRM_SHM = 2, /**< shared, cached */
  169. _DRM_AGP = 3, /**< AGP/GART */
  170. _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */
  171. _DRM_CONSISTENT = 5 /**< Consistent memory for PCI DMA */
  172. };
  173. /*
  174. * Memory mapping flags.
  175. */
  176. enum drm_map_flags {
  177. _DRM_RESTRICTED = 0x01, /**< Cannot be mapped to user-virtual */
  178. _DRM_READ_ONLY = 0x02,
  179. _DRM_LOCKED = 0x04, /**< shared, cached, locked */
  180. _DRM_KERNEL = 0x08, /**< kernel requires access */
  181. _DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */
  182. _DRM_CONTAINS_LOCK = 0x20, /**< SHM page that contains lock */
  183. _DRM_REMOVABLE = 0x40, /**< Removable mapping */
  184. _DRM_DRIVER = 0x80 /**< Managed by driver */
  185. };
  186. struct drm_ctx_priv_map {
  187. unsigned int ctx_id; /**< Context requesting private mapping */
  188. void *handle; /**< Handle of map */
  189. };
  190. /*
  191. * DRM_IOCTL_GET_MAP, DRM_IOCTL_ADD_MAP and DRM_IOCTL_RM_MAP ioctls
  192. * argument type.
  193. *
  194. * \sa drmAddMap().
  195. */
  196. struct drm_map {
  197. unsigned long offset; /**< Requested physical address (0 for SAREA)*/
  198. unsigned long size; /**< Requested physical size (bytes) */
  199. enum drm_map_type type; /**< Type of memory to map */
  200. enum drm_map_flags flags; /**< Flags */
  201. void *handle; /**< User-space: "Handle" to pass to mmap() */
  202. /**< Kernel-space: kernel-virtual address */
  203. int mtrr; /**< MTRR slot used */
  204. /* Private data */
  205. };
  206. /*
  207. * DRM_IOCTL_GET_CLIENT ioctl argument type.
  208. */
  209. struct drm_client {
  210. int idx; /**< Which client desired? */
  211. int auth; /**< Is client authenticated? */
  212. unsigned long pid; /**< Process ID */
  213. unsigned long uid; /**< User ID */
  214. unsigned long magic; /**< Magic */
  215. unsigned long iocs; /**< Ioctl count */
  216. };
  217. enum drm_stat_type {
  218. _DRM_STAT_LOCK,
  219. _DRM_STAT_OPENS,
  220. _DRM_STAT_CLOSES,
  221. _DRM_STAT_IOCTLS,
  222. _DRM_STAT_LOCKS,
  223. _DRM_STAT_UNLOCKS,
  224. _DRM_STAT_VALUE, /**< Generic value */
  225. _DRM_STAT_BYTE, /**< Generic byte counter (1024bytes/K) */
  226. _DRM_STAT_COUNT, /**< Generic non-byte counter (1000/k) */
  227. _DRM_STAT_IRQ, /**< IRQ */
  228. _DRM_STAT_PRIMARY, /**< Primary DMA bytes */
  229. _DRM_STAT_SECONDARY, /**< Secondary DMA bytes */
  230. _DRM_STAT_DMA, /**< DMA */
  231. _DRM_STAT_SPECIAL, /**< Special DMA (e.g., priority or polled) */
  232. _DRM_STAT_MISSED /**< Missed DMA opportunity */
  233. /* Add to the *END* of the list */
  234. };
  235. /*
  236. * DRM_IOCTL_GET_STATS ioctl argument type.
  237. */
  238. struct drm_stats {
  239. unsigned long count;
  240. struct {
  241. unsigned long value;
  242. enum drm_stat_type type;
  243. } data[15];
  244. };
  245. /*
  246. * Hardware locking flags.
  247. */
  248. enum drm_lock_flags {
  249. _DRM_LOCK_READY = 0x01, /**< Wait until hardware is ready for DMA */
  250. _DRM_LOCK_QUIESCENT = 0x02, /**< Wait until hardware quiescent */
  251. _DRM_LOCK_FLUSH = 0x04, /**< Flush this context's DMA queue first */
  252. _DRM_LOCK_FLUSH_ALL = 0x08, /**< Flush all DMA queues first */
  253. /* These *HALT* flags aren't supported yet
  254. -- they will be used to support the
  255. full-screen DGA-like mode. */
  256. _DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */
  257. _DRM_HALT_CUR_QUEUES = 0x20 /**< Halt all current queues */
  258. };
  259. /*
  260. * DRM_IOCTL_LOCK, DRM_IOCTL_UNLOCK and DRM_IOCTL_FINISH ioctl argument type.
  261. *
  262. * \sa drmGetLock() and drmUnlock().
  263. */
  264. struct drm_lock {
  265. int context;
  266. enum drm_lock_flags flags;
  267. };
  268. /*
  269. * DMA flags
  270. *
  271. * \warning
  272. * These values \e must match xf86drm.h.
  273. *
  274. * \sa drm_dma.
  275. */
  276. enum drm_dma_flags {
  277. /* Flags for DMA buffer dispatch */
  278. _DRM_DMA_BLOCK = 0x01, /**<
  279. * Block until buffer dispatched.
  280. *
  281. * \note The buffer may not yet have
  282. * been processed by the hardware --
  283. * getting a hardware lock with the
  284. * hardware quiescent will ensure
  285. * that the buffer has been
  286. * processed.
  287. */
  288. _DRM_DMA_WHILE_LOCKED = 0x02, /**< Dispatch while lock held */
  289. _DRM_DMA_PRIORITY = 0x04, /**< High priority dispatch */
  290. /* Flags for DMA buffer request */
  291. _DRM_DMA_WAIT = 0x10, /**< Wait for free buffers */
  292. _DRM_DMA_SMALLER_OK = 0x20, /**< Smaller-than-requested buffers OK */
  293. _DRM_DMA_LARGER_OK = 0x40 /**< Larger-than-requested buffers OK */
  294. };
  295. /*
  296. * DRM_IOCTL_ADD_BUFS and DRM_IOCTL_MARK_BUFS ioctl argument type.
  297. *
  298. * \sa drmAddBufs().
  299. */
  300. struct drm_buf_desc {
  301. int count; /**< Number of buffers of this size */
  302. int size; /**< Size in bytes */
  303. int low_mark; /**< Low water mark */
  304. int high_mark; /**< High water mark */
  305. enum {
  306. _DRM_PAGE_ALIGN = 0x01, /**< Align on page boundaries for DMA */
  307. _DRM_AGP_BUFFER = 0x02, /**< Buffer is in AGP space */
  308. _DRM_SG_BUFFER = 0x04, /**< Scatter/gather memory buffer */
  309. _DRM_FB_BUFFER = 0x08, /**< Buffer is in frame buffer */
  310. _DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */
  311. } flags;
  312. unsigned long agp_start; /**<
  313. * Start address of where the AGP buffers are
  314. * in the AGP aperture
  315. */
  316. };
  317. /*
  318. * DRM_IOCTL_INFO_BUFS ioctl argument type.
  319. */
  320. struct drm_buf_info {
  321. int count; /**< Entries in list */
  322. struct drm_buf_desc __user *list;
  323. };
  324. /*
  325. * DRM_IOCTL_FREE_BUFS ioctl argument type.
  326. */
  327. struct drm_buf_free {
  328. int count;
  329. int __user *list;
  330. };
  331. /*
  332. * Buffer information
  333. *
  334. * \sa drm_buf_map.
  335. */
  336. struct drm_buf_pub {
  337. int idx; /**< Index into the master buffer list */
  338. int total; /**< Buffer size */
  339. int used; /**< Amount of buffer in use (for DMA) */
  340. void __user *address; /**< Address of buffer */
  341. };
  342. /*
  343. * DRM_IOCTL_MAP_BUFS ioctl argument type.
  344. */
  345. struct drm_buf_map {
  346. int count; /**< Length of the buffer list */
  347. #ifdef __cplusplus
  348. void __user *virt;
  349. #else
  350. void __user *virtual; /**< Mmap'd area in user-virtual */
  351. #endif
  352. struct drm_buf_pub __user *list; /**< Buffer information */
  353. };
  354. /*
  355. * DRM_IOCTL_DMA ioctl argument type.
  356. *
  357. * Indices here refer to the offset into the buffer list in drm_buf_get.
  358. *
  359. * \sa drmDMA().
  360. */
  361. struct drm_dma {
  362. int context; /**< Context handle */
  363. int send_count; /**< Number of buffers to send */
  364. int __user *send_indices; /**< List of handles to buffers */
  365. int __user *send_sizes; /**< Lengths of data to send */
  366. enum drm_dma_flags flags; /**< Flags */
  367. int request_count; /**< Number of buffers requested */
  368. int request_size; /**< Desired size for buffers */
  369. int __user *request_indices; /**< Buffer information */
  370. int __user *request_sizes;
  371. int granted_count; /**< Number of buffers granted */
  372. };
  373. enum drm_ctx_flags {
  374. _DRM_CONTEXT_PRESERVED = 0x01,
  375. _DRM_CONTEXT_2DONLY = 0x02
  376. };
  377. /*
  378. * DRM_IOCTL_ADD_CTX ioctl argument type.
  379. *
  380. * \sa drmCreateContext() and drmDestroyContext().
  381. */
  382. struct drm_ctx {
  383. drm_context_t handle;
  384. enum drm_ctx_flags flags;
  385. };
  386. /*
  387. * DRM_IOCTL_RES_CTX ioctl argument type.
  388. */
  389. struct drm_ctx_res {
  390. int count;
  391. struct drm_ctx __user *contexts;
  392. };
  393. /*
  394. * DRM_IOCTL_ADD_DRAW and DRM_IOCTL_RM_DRAW ioctl argument type.
  395. */
  396. struct drm_draw {
  397. drm_drawable_t handle;
  398. };
  399. /*
  400. * DRM_IOCTL_UPDATE_DRAW ioctl argument type.
  401. */
  402. typedef enum {
  403. DRM_DRAWABLE_CLIPRECTS
  404. } drm_drawable_info_type_t;
  405. struct drm_update_draw {
  406. drm_drawable_t handle;
  407. unsigned int type;
  408. unsigned int num;
  409. unsigned long long data;
  410. };
  411. /*
  412. * DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type.
  413. */
  414. struct drm_auth {
  415. drm_magic_t magic;
  416. };
  417. /*
  418. * DRM_IOCTL_IRQ_BUSID ioctl argument type.
  419. *
  420. * \sa drmGetInterruptFromBusID().
  421. */
  422. struct drm_irq_busid {
  423. int irq; /**< IRQ number */
  424. int busnum; /**< bus number */
  425. int devnum; /**< device number */
  426. int funcnum; /**< function number */
  427. };
  428. enum drm_vblank_seq_type {
  429. _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */
  430. _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */
  431. /* bits 1-6 are reserved for high crtcs */
  432. _DRM_VBLANK_HIGH_CRTC_MASK = 0x0000003e,
  433. _DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */
  434. _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */
  435. _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */
  436. _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */
  437. _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking, unsupported */
  438. };
  439. #define _DRM_VBLANK_HIGH_CRTC_SHIFT 1
  440. #define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE)
  441. #define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \
  442. _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS)
  443. struct drm_wait_vblank_request {
  444. enum drm_vblank_seq_type type;
  445. unsigned int sequence;
  446. unsigned long signal;
  447. };
  448. struct drm_wait_vblank_reply {
  449. enum drm_vblank_seq_type type;
  450. unsigned int sequence;
  451. long tval_sec;
  452. long tval_usec;
  453. };
  454. /*
  455. * DRM_IOCTL_WAIT_VBLANK ioctl argument type.
  456. *
  457. * \sa drmWaitVBlank().
  458. */
  459. union drm_wait_vblank {
  460. struct drm_wait_vblank_request request;
  461. struct drm_wait_vblank_reply reply;
  462. };
  463. #define _DRM_PRE_MODESET 1
  464. #define _DRM_POST_MODESET 2
  465. /*
  466. * DRM_IOCTL_MODESET_CTL ioctl argument type
  467. *
  468. * \sa drmModesetCtl().
  469. */
  470. struct drm_modeset_ctl {
  471. __u32 crtc;
  472. __u32 cmd;
  473. };
  474. /*
  475. * DRM_IOCTL_AGP_ENABLE ioctl argument type.
  476. *
  477. * \sa drmAgpEnable().
  478. */
  479. struct drm_agp_mode {
  480. unsigned long mode; /**< AGP mode */
  481. };
  482. /*
  483. * DRM_IOCTL_AGP_ALLOC and DRM_IOCTL_AGP_FREE ioctls argument type.
  484. *
  485. * \sa drmAgpAlloc() and drmAgpFree().
  486. */
  487. struct drm_agp_buffer {
  488. unsigned long size; /**< In bytes -- will round to page boundary */
  489. unsigned long handle; /**< Used for binding / unbinding */
  490. unsigned long type; /**< Type of memory to allocate */
  491. unsigned long physical; /**< Physical used by i810 */
  492. };
  493. /*
  494. * DRM_IOCTL_AGP_BIND and DRM_IOCTL_AGP_UNBIND ioctls argument type.
  495. *
  496. * \sa drmAgpBind() and drmAgpUnbind().
  497. */
  498. struct drm_agp_binding {
  499. unsigned long handle; /**< From drm_agp_buffer */
  500. unsigned long offset; /**< In bytes -- will round to page boundary */
  501. };
  502. /*
  503. * DRM_IOCTL_AGP_INFO ioctl argument type.
  504. *
  505. * \sa drmAgpVersionMajor(), drmAgpVersionMinor(), drmAgpGetMode(),
  506. * drmAgpBase(), drmAgpSize(), drmAgpMemoryUsed(), drmAgpMemoryAvail(),
  507. * drmAgpVendorId() and drmAgpDeviceId().
  508. */
  509. struct drm_agp_info {
  510. int agp_version_major;
  511. int agp_version_minor;
  512. unsigned long mode;
  513. unsigned long aperture_base; /* physical address */
  514. unsigned long aperture_size; /* bytes */
  515. unsigned long memory_allowed; /* bytes */
  516. unsigned long memory_used;
  517. /* PCI information */
  518. unsigned short id_vendor;
  519. unsigned short id_device;
  520. };
  521. /*
  522. * DRM_IOCTL_SG_ALLOC ioctl argument type.
  523. */
  524. struct drm_scatter_gather {
  525. unsigned long size; /**< In bytes -- will round to page boundary */
  526. unsigned long handle; /**< Used for mapping / unmapping */
  527. };
  528. /*
  529. * DRM_IOCTL_SET_VERSION ioctl argument type.
  530. */
  531. struct drm_set_version {
  532. int drm_di_major;
  533. int drm_di_minor;
  534. int drm_dd_major;
  535. int drm_dd_minor;
  536. };
  537. /* DRM_IOCTL_GEM_CLOSE ioctl argument type */
  538. struct drm_gem_close {
  539. /** Handle of the object to be closed. */
  540. __u32 handle;
  541. __u32 pad;
  542. };
  543. /* DRM_IOCTL_GEM_FLINK ioctl argument type */
  544. struct drm_gem_flink {
  545. /** Handle for the object being named */
  546. __u32 handle;
  547. /** Returned global name */
  548. __u32 name;
  549. };
  550. /* DRM_IOCTL_GEM_OPEN ioctl argument type */
  551. struct drm_gem_open {
  552. /** Name of object being opened */
  553. __u32 name;
  554. /** Returned handle for the object */
  555. __u32 handle;
  556. /** Returned size of the object */
  557. __u64 size;
  558. };
  559. /**
  560. * DRM_CAP_DUMB_BUFFER
  561. *
  562. * If set to 1, the driver supports creating dumb buffers via the
  563. * &DRM_IOCTL_MODE_CREATE_DUMB ioctl.
  564. */
  565. #define DRM_CAP_DUMB_BUFFER 0x1
  566. /**
  567. * DRM_CAP_VBLANK_HIGH_CRTC
  568. *
  569. * If set to 1, the kernel supports specifying a :ref:`CRTC index<crtc_index>`
  570. * in the high bits of &drm_wait_vblank_request.type.
  571. *
  572. * Starting kernel version 2.6.39, this capability is always set to 1.
  573. */
  574. #define DRM_CAP_VBLANK_HIGH_CRTC 0x2
  575. /**
  576. * DRM_CAP_DUMB_PREFERRED_DEPTH
  577. *
  578. * The preferred bit depth for dumb buffers.
  579. *
  580. * The bit depth is the number of bits used to indicate the color of a single
  581. * pixel excluding any padding. This is different from the number of bits per
  582. * pixel. For instance, XRGB8888 has a bit depth of 24 but has 32 bits per
  583. * pixel.
  584. *
  585. * Note that this preference only applies to dumb buffers, it's irrelevant for
  586. * other types of buffers.
  587. */
  588. #define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3
  589. /**
  590. * DRM_CAP_DUMB_PREFER_SHADOW
  591. *
  592. * If set to 1, the driver prefers userspace to render to a shadow buffer
  593. * instead of directly rendering to a dumb buffer. For best speed, userspace
  594. * should do streaming ordered memory copies into the dumb buffer and never
  595. * read from it.
  596. *
  597. * Note that this preference only applies to dumb buffers, it's irrelevant for
  598. * other types of buffers.
  599. */
  600. #define DRM_CAP_DUMB_PREFER_SHADOW 0x4
  601. /**
  602. * DRM_CAP_PRIME
  603. *
  604. * Bitfield of supported PRIME sharing capabilities. See &DRM_PRIME_CAP_IMPORT
  605. * and &DRM_PRIME_CAP_EXPORT.
  606. *
  607. * PRIME buffers are exposed as dma-buf file descriptors. See
  608. * Documentation/gpu/drm-mm.rst, section "PRIME Buffer Sharing".
  609. */
  610. #define DRM_CAP_PRIME 0x5
  611. /**
  612. * DRM_PRIME_CAP_IMPORT
  613. *
  614. * If this bit is set in &DRM_CAP_PRIME, the driver supports importing PRIME
  615. * buffers via the &DRM_IOCTL_PRIME_FD_TO_HANDLE ioctl.
  616. */
  617. #define DRM_PRIME_CAP_IMPORT 0x1
  618. /**
  619. * DRM_PRIME_CAP_EXPORT
  620. *
  621. * If this bit is set in &DRM_CAP_PRIME, the driver supports exporting PRIME
  622. * buffers via the &DRM_IOCTL_PRIME_HANDLE_TO_FD ioctl.
  623. */
  624. #define DRM_PRIME_CAP_EXPORT 0x2
  625. /**
  626. * DRM_CAP_TIMESTAMP_MONOTONIC
  627. *
  628. * If set to 0, the kernel will report timestamps with ``CLOCK_REALTIME`` in
  629. * struct drm_event_vblank. If set to 1, the kernel will report timestamps with
  630. * ``CLOCK_MONOTONIC``. See ``clock_gettime(2)`` for the definition of these
  631. * clocks.
  632. *
  633. * Starting from kernel version 2.6.39, the default value for this capability
  634. * is 1. Starting kernel version 4.15, this capability is always set to 1.
  635. */
  636. #define DRM_CAP_TIMESTAMP_MONOTONIC 0x6
  637. /**
  638. * DRM_CAP_ASYNC_PAGE_FLIP
  639. *
  640. * If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC.
  641. */
  642. #define DRM_CAP_ASYNC_PAGE_FLIP 0x7
  643. /**
  644. * DRM_CAP_CURSOR_WIDTH
  645. *
  646. * The ``CURSOR_WIDTH`` and ``CURSOR_HEIGHT`` capabilities return a valid
  647. * width x height combination for the hardware cursor. The intention is that a
  648. * hardware agnostic userspace can query a cursor plane size to use.
  649. *
  650. * Note that the cross-driver contract is to merely return a valid size;
  651. * drivers are free to attach another meaning on top, eg. i915 returns the
  652. * maximum plane size.
  653. */
  654. #define DRM_CAP_CURSOR_WIDTH 0x8
  655. /**
  656. * DRM_CAP_CURSOR_HEIGHT
  657. *
  658. * See &DRM_CAP_CURSOR_WIDTH.
  659. */
  660. #define DRM_CAP_CURSOR_HEIGHT 0x9
  661. /**
  662. * DRM_CAP_ADDFB2_MODIFIERS
  663. *
  664. * If set to 1, the driver supports supplying modifiers in the
  665. * &DRM_IOCTL_MODE_ADDFB2 ioctl.
  666. */
  667. #define DRM_CAP_ADDFB2_MODIFIERS 0x10
  668. /**
  669. * DRM_CAP_PAGE_FLIP_TARGET
  670. *
  671. * If set to 1, the driver supports the &DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE and
  672. * &DRM_MODE_PAGE_FLIP_TARGET_RELATIVE flags in
  673. * &drm_mode_crtc_page_flip_target.flags for the &DRM_IOCTL_MODE_PAGE_FLIP
  674. * ioctl.
  675. */
  676. #define DRM_CAP_PAGE_FLIP_TARGET 0x11
  677. /**
  678. * DRM_CAP_CRTC_IN_VBLANK_EVENT
  679. *
  680. * If set to 1, the kernel supports reporting the CRTC ID in
  681. * &drm_event_vblank.crtc_id for the &DRM_EVENT_VBLANK and
  682. * &DRM_EVENT_FLIP_COMPLETE events.
  683. *
  684. * Starting kernel version 4.12, this capability is always set to 1.
  685. */
  686. #define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12
  687. /**
  688. * DRM_CAP_SYNCOBJ
  689. *
  690. * If set to 1, the driver supports sync objects. See
  691. * Documentation/gpu/drm-mm.rst, section "DRM Sync Objects".
  692. */
  693. #define DRM_CAP_SYNCOBJ 0x13
  694. /**
  695. * DRM_CAP_SYNCOBJ_TIMELINE
  696. *
  697. * If set to 1, the driver supports timeline operations on sync objects. See
  698. * Documentation/gpu/drm-mm.rst, section "DRM Sync Objects".
  699. */
  700. #define DRM_CAP_SYNCOBJ_TIMELINE 0x14
  701. /* DRM_IOCTL_GET_CAP ioctl argument type */
  702. struct drm_get_cap {
  703. __u64 capability;
  704. __u64 value;
  705. };
  706. /**
  707. * DRM_CLIENT_CAP_STEREO_3D
  708. *
  709. * If set to 1, the DRM core will expose the stereo 3D capabilities of the
  710. * monitor by advertising the supported 3D layouts in the flags of struct
  711. * drm_mode_modeinfo. See ``DRM_MODE_FLAG_3D_*``.
  712. *
  713. * This capability is always supported for all drivers starting from kernel
  714. * version 3.13.
  715. */
  716. #define DRM_CLIENT_CAP_STEREO_3D 1
  717. /**
  718. * DRM_CLIENT_CAP_UNIVERSAL_PLANES
  719. *
  720. * If set to 1, the DRM core will expose all planes (overlay, primary, and
  721. * cursor) to userspace.
  722. *
  723. * This capability has been introduced in kernel version 3.15. Starting from
  724. * kernel version 3.17, this capability is always supported for all drivers.
  725. */
  726. #define DRM_CLIENT_CAP_UNIVERSAL_PLANES 2
  727. /**
  728. * DRM_CLIENT_CAP_ATOMIC
  729. *
  730. * If set to 1, the DRM core will expose atomic properties to userspace. This
  731. * implicitly enables &DRM_CLIENT_CAP_UNIVERSAL_PLANES and
  732. * &DRM_CLIENT_CAP_ASPECT_RATIO.
  733. *
  734. * If the driver doesn't support atomic mode-setting, enabling this capability
  735. * will fail with -EOPNOTSUPP.
  736. *
  737. * This capability has been introduced in kernel version 4.0. Starting from
  738. * kernel version 4.2, this capability is always supported for atomic-capable
  739. * drivers.
  740. */
  741. #define DRM_CLIENT_CAP_ATOMIC 3
  742. /**
  743. * DRM_CLIENT_CAP_ASPECT_RATIO
  744. *
  745. * If set to 1, the DRM core will provide aspect ratio information in modes.
  746. * See ``DRM_MODE_FLAG_PIC_AR_*``.
  747. *
  748. * This capability is always supported for all drivers starting from kernel
  749. * version 4.18.
  750. */
  751. #define DRM_CLIENT_CAP_ASPECT_RATIO 4
  752. /**
  753. * DRM_CLIENT_CAP_WRITEBACK_CONNECTORS
  754. *
  755. * If set to 1, the DRM core will expose special connectors to be used for
  756. * writing back to memory the scene setup in the commit. The client must enable
  757. * &DRM_CLIENT_CAP_ATOMIC first.
  758. *
  759. * This capability is always supported for atomic-capable drivers starting from
  760. * kernel version 4.19.
  761. */
  762. #define DRM_CLIENT_CAP_WRITEBACK_CONNECTORS 5
  763. /* DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */
  764. struct drm_set_client_cap {
  765. __u64 capability;
  766. __u64 value;
  767. };
  768. #define DRM_RDWR O_RDWR
  769. #define DRM_CLOEXEC O_CLOEXEC
  770. struct drm_prime_handle {
  771. __u32 handle;
  772. /** Flags.. only applicable for handle->fd */
  773. __u32 flags;
  774. /** Returned dmabuf file descriptor */
  775. __s32 fd;
  776. };
  777. struct drm_syncobj_create {
  778. __u32 handle;
  779. #define DRM_SYNCOBJ_CREATE_SIGNALED (1 << 0)
  780. __u32 flags;
  781. };
  782. struct drm_syncobj_destroy {
  783. __u32 handle;
  784. __u32 pad;
  785. };
  786. #define DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE (1 << 0)
  787. #define DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE (1 << 0)
  788. struct drm_syncobj_handle {
  789. __u32 handle;
  790. __u32 flags;
  791. __s32 fd;
  792. __u32 pad;
  793. };
  794. struct drm_syncobj_transfer {
  795. __u32 src_handle;
  796. __u32 dst_handle;
  797. __u64 src_point;
  798. __u64 dst_point;
  799. __u32 flags;
  800. __u32 pad;
  801. };
  802. #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)
  803. #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1)
  804. #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2) /* wait for time point to become available */
  805. struct drm_syncobj_wait {
  806. __u64 handles;
  807. /* absolute timeout */
  808. __s64 timeout_nsec;
  809. __u32 count_handles;
  810. __u32 flags;
  811. __u32 first_signaled; /* only valid when not waiting all */
  812. __u32 pad;
  813. };
  814. struct drm_syncobj_timeline_wait {
  815. __u64 handles;
  816. /* wait on specific timeline point for every handles*/
  817. __u64 points;
  818. /* absolute timeout */
  819. __s64 timeout_nsec;
  820. __u32 count_handles;
  821. __u32 flags;
  822. __u32 first_signaled; /* only valid when not waiting all */
  823. __u32 pad;
  824. };
  825. struct drm_syncobj_array {
  826. __u64 handles;
  827. __u32 count_handles;
  828. __u32 pad;
  829. };
  830. #define DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED (1 << 0) /* last available point on timeline syncobj */
  831. struct drm_syncobj_timeline_array {
  832. __u64 handles;
  833. __u64 points;
  834. __u32 count_handles;
  835. __u32 flags;
  836. };
  837. /* Query current scanout sequence number */
  838. struct drm_crtc_get_sequence {
  839. __u32 crtc_id; /* requested crtc_id */
  840. __u32 active; /* return: crtc output is active */
  841. __u64 sequence; /* return: most recent vblank sequence */
  842. __s64 sequence_ns; /* return: most recent time of first pixel out */
  843. };
  844. /* Queue event to be delivered at specified sequence. Time stamp marks
  845. * when the first pixel of the refresh cycle leaves the display engine
  846. * for the display
  847. */
  848. #define DRM_CRTC_SEQUENCE_RELATIVE 0x00000001 /* sequence is relative to current */
  849. #define DRM_CRTC_SEQUENCE_NEXT_ON_MISS 0x00000002 /* Use next sequence if we've missed */
  850. struct drm_crtc_queue_sequence {
  851. __u32 crtc_id;
  852. __u32 flags;
  853. __u64 sequence; /* on input, target sequence. on output, actual sequence */
  854. __u64 user_data; /* user data passed to event */
  855. };
  856. #if defined(__cplusplus)
  857. }
  858. #endif
  859. #include "drm_mode.h"
  860. #if defined(__cplusplus)
  861. extern "C" {
  862. #endif
  863. #define DRM_IOCTL_BASE 'd'
  864. #define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr)
  865. #define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type)
  866. #define DRM_IOW(nr,type) _IOW(DRM_IOCTL_BASE,nr,type)
  867. #define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type)
  868. #define DRM_IOCTL_VERSION DRM_IOWR(0x00, struct drm_version)
  869. #define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, struct drm_unique)
  870. #define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, struct drm_auth)
  871. #define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, struct drm_irq_busid)
  872. #define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, struct drm_map)
  873. #define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client)
  874. #define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats)
  875. #define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version)
  876. #define DRM_IOCTL_MODESET_CTL DRM_IOW(0x08, struct drm_modeset_ctl)
  877. #define DRM_IOCTL_GEM_CLOSE DRM_IOW (0x09, struct drm_gem_close)
  878. #define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink)
  879. #define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open)
  880. #define DRM_IOCTL_GET_CAP DRM_IOWR(0x0c, struct drm_get_cap)
  881. #define DRM_IOCTL_SET_CLIENT_CAP DRM_IOW( 0x0d, struct drm_set_client_cap)
  882. #define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique)
  883. #define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth)
  884. #define DRM_IOCTL_BLOCK DRM_IOWR(0x12, struct drm_block)
  885. #define DRM_IOCTL_UNBLOCK DRM_IOWR(0x13, struct drm_block)
  886. #define DRM_IOCTL_CONTROL DRM_IOW( 0x14, struct drm_control)
  887. #define DRM_IOCTL_ADD_MAP DRM_IOWR(0x15, struct drm_map)
  888. #define DRM_IOCTL_ADD_BUFS DRM_IOWR(0x16, struct drm_buf_desc)
  889. #define DRM_IOCTL_MARK_BUFS DRM_IOW( 0x17, struct drm_buf_desc)
  890. #define DRM_IOCTL_INFO_BUFS DRM_IOWR(0x18, struct drm_buf_info)
  891. #define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, struct drm_buf_map)
  892. #define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, struct drm_buf_free)
  893. #define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, struct drm_map)
  894. #define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, struct drm_ctx_priv_map)
  895. #define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, struct drm_ctx_priv_map)
  896. #define DRM_IOCTL_SET_MASTER DRM_IO(0x1e)
  897. #define DRM_IOCTL_DROP_MASTER DRM_IO(0x1f)
  898. #define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, struct drm_ctx)
  899. #define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, struct drm_ctx)
  900. #define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, struct drm_ctx)
  901. #define DRM_IOCTL_GET_CTX DRM_IOWR(0x23, struct drm_ctx)
  902. #define DRM_IOCTL_SWITCH_CTX DRM_IOW( 0x24, struct drm_ctx)
  903. #define DRM_IOCTL_NEW_CTX DRM_IOW( 0x25, struct drm_ctx)
  904. #define DRM_IOCTL_RES_CTX DRM_IOWR(0x26, struct drm_ctx_res)
  905. #define DRM_IOCTL_ADD_DRAW DRM_IOWR(0x27, struct drm_draw)
  906. #define DRM_IOCTL_RM_DRAW DRM_IOWR(0x28, struct drm_draw)
  907. #define DRM_IOCTL_DMA DRM_IOWR(0x29, struct drm_dma)
  908. #define DRM_IOCTL_LOCK DRM_IOW( 0x2a, struct drm_lock)
  909. #define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock)
  910. #define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock)
  911. #define DRM_IOCTL_PRIME_HANDLE_TO_FD DRM_IOWR(0x2d, struct drm_prime_handle)
  912. #define DRM_IOCTL_PRIME_FD_TO_HANDLE DRM_IOWR(0x2e, struct drm_prime_handle)
  913. #define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30)
  914. #define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31)
  915. #define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, struct drm_agp_mode)
  916. #define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, struct drm_agp_info)
  917. #define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, struct drm_agp_buffer)
  918. #define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, struct drm_agp_buffer)
  919. #define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, struct drm_agp_binding)
  920. #define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, struct drm_agp_binding)
  921. #define DRM_IOCTL_SG_ALLOC DRM_IOWR(0x38, struct drm_scatter_gather)
  922. #define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, struct drm_scatter_gather)
  923. #define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, union drm_wait_vblank)
  924. #define DRM_IOCTL_CRTC_GET_SEQUENCE DRM_IOWR(0x3b, struct drm_crtc_get_sequence)
  925. #define DRM_IOCTL_CRTC_QUEUE_SEQUENCE DRM_IOWR(0x3c, struct drm_crtc_queue_sequence)
  926. #define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, struct drm_update_draw)
  927. #define DRM_IOCTL_MODE_GETRESOURCES DRM_IOWR(0xA0, struct drm_mode_card_res)
  928. #define DRM_IOCTL_MODE_GETCRTC DRM_IOWR(0xA1, struct drm_mode_crtc)
  929. #define DRM_IOCTL_MODE_SETCRTC DRM_IOWR(0xA2, struct drm_mode_crtc)
  930. #define DRM_IOCTL_MODE_CURSOR DRM_IOWR(0xA3, struct drm_mode_cursor)
  931. #define DRM_IOCTL_MODE_GETGAMMA DRM_IOWR(0xA4, struct drm_mode_crtc_lut)
  932. #define DRM_IOCTL_MODE_SETGAMMA DRM_IOWR(0xA5, struct drm_mode_crtc_lut)
  933. #define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xA6, struct drm_mode_get_encoder)
  934. #define DRM_IOCTL_MODE_GETCONNECTOR DRM_IOWR(0xA7, struct drm_mode_get_connector)
  935. #define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA8, struct drm_mode_mode_cmd) /* deprecated (never worked) */
  936. #define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd) /* deprecated (never worked) */
  937. #define DRM_IOCTL_MODE_GETPROPERTY DRM_IOWR(0xAA, struct drm_mode_get_property)
  938. #define DRM_IOCTL_MODE_SETPROPERTY DRM_IOWR(0xAB, struct drm_mode_connector_set_property)
  939. #define DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xAC, struct drm_mode_get_blob)
  940. #define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd)
  941. #define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd)
  942. /**
  943. * DRM_IOCTL_MODE_RMFB - Remove a framebuffer.
  944. *
  945. * This removes a framebuffer previously added via ADDFB/ADDFB2. The IOCTL
  946. * argument is a framebuffer object ID.
  947. *
  948. * Warning: removing a framebuffer currently in-use on an enabled plane will
  949. * disable that plane. The CRTC the plane is linked to may also be disabled
  950. * (depending on driver capabilities).
  951. */
  952. #define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int)
  953. #define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip)
  954. #define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd)
  955. #define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb)
  956. #define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb)
  957. #define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb)
  958. #define DRM_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xB5, struct drm_mode_get_plane_res)
  959. #define DRM_IOCTL_MODE_GETPLANE DRM_IOWR(0xB6, struct drm_mode_get_plane)
  960. #define DRM_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct drm_mode_set_plane)
  961. #define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2)
  962. #define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties)
  963. #define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property)
  964. #define DRM_IOCTL_MODE_CURSOR2 DRM_IOWR(0xBB, struct drm_mode_cursor2)
  965. #define DRM_IOCTL_MODE_ATOMIC DRM_IOWR(0xBC, struct drm_mode_atomic)
  966. #define DRM_IOCTL_MODE_CREATEPROPBLOB DRM_IOWR(0xBD, struct drm_mode_create_blob)
  967. #define DRM_IOCTL_MODE_DESTROYPROPBLOB DRM_IOWR(0xBE, struct drm_mode_destroy_blob)
  968. #define DRM_IOCTL_SYNCOBJ_CREATE DRM_IOWR(0xBF, struct drm_syncobj_create)
  969. #define DRM_IOCTL_SYNCOBJ_DESTROY DRM_IOWR(0xC0, struct drm_syncobj_destroy)
  970. #define DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD DRM_IOWR(0xC1, struct drm_syncobj_handle)
  971. #define DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE DRM_IOWR(0xC2, struct drm_syncobj_handle)
  972. #define DRM_IOCTL_SYNCOBJ_WAIT DRM_IOWR(0xC3, struct drm_syncobj_wait)
  973. #define DRM_IOCTL_SYNCOBJ_RESET DRM_IOWR(0xC4, struct drm_syncobj_array)
  974. #define DRM_IOCTL_SYNCOBJ_SIGNAL DRM_IOWR(0xC5, struct drm_syncobj_array)
  975. #define DRM_IOCTL_MODE_CREATE_LEASE DRM_IOWR(0xC6, struct drm_mode_create_lease)
  976. #define DRM_IOCTL_MODE_LIST_LESSEES DRM_IOWR(0xC7, struct drm_mode_list_lessees)
  977. #define DRM_IOCTL_MODE_GET_LEASE DRM_IOWR(0xC8, struct drm_mode_get_lease)
  978. #define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease)
  979. #define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait)
  980. #define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, struct drm_syncobj_timeline_array)
  981. #define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer)
  982. #define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL DRM_IOWR(0xCD, struct drm_syncobj_timeline_array)
  983. /**
  984. * DRM_IOCTL_MODE_GETFB2 - Get framebuffer metadata.
  985. *
  986. * This queries metadata about a framebuffer. User-space fills
  987. * &drm_mode_fb_cmd2.fb_id as the input, and the kernels fills the rest of the
  988. * struct as the output.
  989. *
  990. * If the client is DRM master or has &CAP_SYS_ADMIN, &drm_mode_fb_cmd2.handles
  991. * will be filled with GEM buffer handles. Planes are valid until one has a
  992. * zero handle -- this can be used to compute the number of planes.
  993. *
  994. * Otherwise, &drm_mode_fb_cmd2.handles will be zeroed and planes are valid
  995. * until one has a zero &drm_mode_fb_cmd2.pitches.
  996. *
  997. * If the framebuffer has a format modifier, &DRM_MODE_FB_MODIFIERS will be set
  998. * in &drm_mode_fb_cmd2.flags and &drm_mode_fb_cmd2.modifier will contain the
  999. * modifier. Otherwise, user-space must ignore &drm_mode_fb_cmd2.modifier.
  1000. */
  1001. #define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE, struct drm_mode_fb_cmd2)
  1002. /*
  1003. * Device specific ioctls should only be in their respective headers
  1004. * The device specific ioctl range is from 0x40 to 0x9f.
  1005. * Generic IOCTLS restart at 0xA0.
  1006. *
  1007. * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and
  1008. * drmCommandReadWrite().
  1009. */
  1010. #define DRM_COMMAND_BASE 0x40
  1011. #define DRM_COMMAND_END 0xA0
  1012. /*
  1013. * Header for events written back to userspace on the drm fd. The
  1014. * type defines the type of event, the length specifies the total
  1015. * length of the event (including the header), and user_data is
  1016. * typically a 64 bit value passed with the ioctl that triggered the
  1017. * event. A read on the drm fd will always only return complete
  1018. * events, that is, if for example the read buffer is 100 bytes, and
  1019. * there are two 64 byte events pending, only one will be returned.
  1020. *
  1021. * Event types 0 - 0x7fffffff are generic drm events, 0x80000000 and
  1022. * up are chipset specific.
  1023. */
  1024. struct drm_event {
  1025. __u32 type;
  1026. __u32 length;
  1027. };
  1028. #define DRM_EVENT_VBLANK 0x01
  1029. #define DRM_EVENT_FLIP_COMPLETE 0x02
  1030. #define DRM_EVENT_CRTC_SEQUENCE 0x03
  1031. struct drm_event_vblank {
  1032. struct drm_event base;
  1033. __u64 user_data;
  1034. __u32 tv_sec;
  1035. __u32 tv_usec;
  1036. __u32 sequence;
  1037. __u32 crtc_id; /* 0 on older kernels that do not support this */
  1038. };
  1039. /* Event delivered at sequence. Time stamp marks when the first pixel
  1040. * of the refresh cycle leaves the display engine for the display
  1041. */
  1042. struct drm_event_crtc_sequence {
  1043. struct drm_event base;
  1044. __u64 user_data;
  1045. __s64 time_ns;
  1046. __u64 sequence;
  1047. };
  1048. /* typedef area */
  1049. #ifndef __KERNEL__
  1050. typedef struct drm_clip_rect drm_clip_rect_t;
  1051. typedef struct drm_drawable_info drm_drawable_info_t;
  1052. typedef struct drm_tex_region drm_tex_region_t;
  1053. typedef struct drm_hw_lock drm_hw_lock_t;
  1054. typedef struct drm_version drm_version_t;
  1055. typedef struct drm_unique drm_unique_t;
  1056. typedef struct drm_list drm_list_t;
  1057. typedef struct drm_block drm_block_t;
  1058. typedef struct drm_control drm_control_t;
  1059. typedef enum drm_map_type drm_map_type_t;
  1060. typedef enum drm_map_flags drm_map_flags_t;
  1061. typedef struct drm_ctx_priv_map drm_ctx_priv_map_t;
  1062. typedef struct drm_map drm_map_t;
  1063. typedef struct drm_client drm_client_t;
  1064. typedef enum drm_stat_type drm_stat_type_t;
  1065. typedef struct drm_stats drm_stats_t;
  1066. typedef enum drm_lock_flags drm_lock_flags_t;
  1067. typedef struct drm_lock drm_lock_t;
  1068. typedef enum drm_dma_flags drm_dma_flags_t;
  1069. typedef struct drm_buf_desc drm_buf_desc_t;
  1070. typedef struct drm_buf_info drm_buf_info_t;
  1071. typedef struct drm_buf_free drm_buf_free_t;
  1072. typedef struct drm_buf_pub drm_buf_pub_t;
  1073. typedef struct drm_buf_map drm_buf_map_t;
  1074. typedef struct drm_dma drm_dma_t;
  1075. typedef union drm_wait_vblank drm_wait_vblank_t;
  1076. typedef struct drm_agp_mode drm_agp_mode_t;
  1077. typedef enum drm_ctx_flags drm_ctx_flags_t;
  1078. typedef struct drm_ctx drm_ctx_t;
  1079. typedef struct drm_ctx_res drm_ctx_res_t;
  1080. typedef struct drm_draw drm_draw_t;
  1081. typedef struct drm_update_draw drm_update_draw_t;
  1082. typedef struct drm_auth drm_auth_t;
  1083. typedef struct drm_irq_busid drm_irq_busid_t;
  1084. typedef enum drm_vblank_seq_type drm_vblank_seq_type_t;
  1085. typedef struct drm_agp_buffer drm_agp_buffer_t;
  1086. typedef struct drm_agp_binding drm_agp_binding_t;
  1087. typedef struct drm_agp_info drm_agp_info_t;
  1088. typedef struct drm_scatter_gather drm_scatter_gather_t;
  1089. typedef struct drm_set_version drm_set_version_t;
  1090. #endif
  1091. #if defined(__cplusplus)
  1092. }
  1093. #endif
  1094. #endif