drm_mode.h 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315
  1. /*
  2. * Copyright (c) 2007 Dave Airlie <airlied@linux.ie>
  3. * Copyright (c) 2007 Jakob Bornecrantz <wallbraker@gmail.com>
  4. * Copyright (c) 2008 Red Hat Inc.
  5. * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA
  6. * Copyright (c) 2007-2008 Intel Corporation
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining a
  9. * copy of this software and associated documentation files (the "Software"),
  10. * to deal in the Software without restriction, including without limitation
  11. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  12. * and/or sell copies of the Software, and to permit persons to whom the
  13. * Software is furnished to do so, subject to the following conditions:
  14. *
  15. * The above copyright notice and this permission notice shall be included in
  16. * all copies or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  23. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  24. * IN THE SOFTWARE.
  25. */
  26. #ifndef _DRM_MODE_H
  27. #define _DRM_MODE_H
  28. #include "drm.h"
  29. #if defined(__cplusplus)
  30. extern "C" {
  31. #endif
  32. /**
  33. * DOC: overview
  34. *
  35. * DRM exposes many UAPI and structure definition to have a consistent
  36. * and standardized interface with user.
  37. * Userspace can refer to these structure definitions and UAPI formats
  38. * to communicate to driver
  39. */
  40. #define DRM_CONNECTOR_NAME_LEN 32
  41. #define DRM_DISPLAY_MODE_LEN 32
  42. #define DRM_PROP_NAME_LEN 32
  43. #define DRM_MODE_TYPE_BUILTIN (1<<0) /* deprecated */
  44. #define DRM_MODE_TYPE_CLOCK_C ((1<<1) | DRM_MODE_TYPE_BUILTIN) /* deprecated */
  45. #define DRM_MODE_TYPE_CRTC_C ((1<<2) | DRM_MODE_TYPE_BUILTIN) /* deprecated */
  46. #define DRM_MODE_TYPE_PREFERRED (1<<3)
  47. #define DRM_MODE_TYPE_DEFAULT (1<<4) /* deprecated */
  48. #define DRM_MODE_TYPE_USERDEF (1<<5)
  49. #define DRM_MODE_TYPE_DRIVER (1<<6)
  50. #define DRM_MODE_TYPE_ALL (DRM_MODE_TYPE_PREFERRED | \
  51. DRM_MODE_TYPE_USERDEF | \
  52. DRM_MODE_TYPE_DRIVER)
  53. /* Video mode flags */
  54. /* bit compatible with the xrandr RR_ definitions (bits 0-13)
  55. *
  56. * ABI warning: Existing userspace really expects
  57. * the mode flags to match the xrandr definitions. Any
  58. * changes that don't match the xrandr definitions will
  59. * likely need a new client cap or some other mechanism
  60. * to avoid breaking existing userspace. This includes
  61. * allocating new flags in the previously unused bits!
  62. */
  63. #define DRM_MODE_FLAG_PHSYNC (1<<0)
  64. #define DRM_MODE_FLAG_NHSYNC (1<<1)
  65. #define DRM_MODE_FLAG_PVSYNC (1<<2)
  66. #define DRM_MODE_FLAG_NVSYNC (1<<3)
  67. #define DRM_MODE_FLAG_INTERLACE (1<<4)
  68. #define DRM_MODE_FLAG_DBLSCAN (1<<5)
  69. #define DRM_MODE_FLAG_CSYNC (1<<6)
  70. #define DRM_MODE_FLAG_PCSYNC (1<<7)
  71. #define DRM_MODE_FLAG_NCSYNC (1<<8)
  72. #define DRM_MODE_FLAG_HSKEW (1<<9) /* hskew provided */
  73. #define DRM_MODE_FLAG_BCAST (1<<10) /* deprecated */
  74. #define DRM_MODE_FLAG_PIXMUX (1<<11) /* deprecated */
  75. #define DRM_MODE_FLAG_DBLCLK (1<<12)
  76. #define DRM_MODE_FLAG_CLKDIV2 (1<<13)
  77. /*
  78. * When adding a new stereo mode don't forget to adjust DRM_MODE_FLAGS_3D_MAX
  79. * (define not exposed to user space).
  80. */
  81. #define DRM_MODE_FLAG_3D_MASK (0x1f<<14)
  82. #define DRM_MODE_FLAG_3D_NONE (0<<14)
  83. #define DRM_MODE_FLAG_3D_FRAME_PACKING (1<<14)
  84. #define DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE (2<<14)
  85. #define DRM_MODE_FLAG_3D_LINE_ALTERNATIVE (3<<14)
  86. #define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL (4<<14)
  87. #define DRM_MODE_FLAG_3D_L_DEPTH (5<<14)
  88. #define DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH (6<<14)
  89. #define DRM_MODE_FLAG_3D_TOP_AND_BOTTOM (7<<14)
  90. #define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF (8<<14)
  91. /* Picture aspect ratio options */
  92. #define DRM_MODE_PICTURE_ASPECT_NONE 0
  93. #define DRM_MODE_PICTURE_ASPECT_4_3 1
  94. #define DRM_MODE_PICTURE_ASPECT_16_9 2
  95. #define DRM_MODE_PICTURE_ASPECT_64_27 3
  96. #define DRM_MODE_PICTURE_ASPECT_256_135 4
  97. /* Content type options */
  98. #define DRM_MODE_CONTENT_TYPE_NO_DATA 0
  99. #define DRM_MODE_CONTENT_TYPE_GRAPHICS 1
  100. #define DRM_MODE_CONTENT_TYPE_PHOTO 2
  101. #define DRM_MODE_CONTENT_TYPE_CINEMA 3
  102. #define DRM_MODE_CONTENT_TYPE_GAME 4
  103. /* Aspect ratio flag bitmask (4 bits 22:19) */
  104. #define DRM_MODE_FLAG_PIC_AR_MASK (0x0F<<19)
  105. #define DRM_MODE_FLAG_PIC_AR_NONE \
  106. (DRM_MODE_PICTURE_ASPECT_NONE<<19)
  107. #define DRM_MODE_FLAG_PIC_AR_4_3 \
  108. (DRM_MODE_PICTURE_ASPECT_4_3<<19)
  109. #define DRM_MODE_FLAG_PIC_AR_16_9 \
  110. (DRM_MODE_PICTURE_ASPECT_16_9<<19)
  111. #define DRM_MODE_FLAG_PIC_AR_64_27 \
  112. (DRM_MODE_PICTURE_ASPECT_64_27<<19)
  113. #define DRM_MODE_FLAG_PIC_AR_256_135 \
  114. (DRM_MODE_PICTURE_ASPECT_256_135<<19)
  115. #define DRM_MODE_FLAG_ALL (DRM_MODE_FLAG_PHSYNC | \
  116. DRM_MODE_FLAG_NHSYNC | \
  117. DRM_MODE_FLAG_PVSYNC | \
  118. DRM_MODE_FLAG_NVSYNC | \
  119. DRM_MODE_FLAG_INTERLACE | \
  120. DRM_MODE_FLAG_DBLSCAN | \
  121. DRM_MODE_FLAG_CSYNC | \
  122. DRM_MODE_FLAG_PCSYNC | \
  123. DRM_MODE_FLAG_NCSYNC | \
  124. DRM_MODE_FLAG_HSKEW | \
  125. DRM_MODE_FLAG_DBLCLK | \
  126. DRM_MODE_FLAG_CLKDIV2 | \
  127. DRM_MODE_FLAG_3D_MASK)
  128. /* DPMS flags */
  129. /* bit compatible with the xorg definitions. */
  130. #define DRM_MODE_DPMS_ON 0
  131. #define DRM_MODE_DPMS_STANDBY 1
  132. #define DRM_MODE_DPMS_SUSPEND 2
  133. #define DRM_MODE_DPMS_OFF 3
  134. /* Scaling mode options */
  135. #define DRM_MODE_SCALE_NONE 0 /* Unmodified timing (display or
  136. software can still scale) */
  137. #define DRM_MODE_SCALE_FULLSCREEN 1 /* Full screen, ignore aspect */
  138. #define DRM_MODE_SCALE_CENTER 2 /* Centered, no scaling */
  139. #define DRM_MODE_SCALE_ASPECT 3 /* Full screen, preserve aspect */
  140. /* Dithering mode options */
  141. #define DRM_MODE_DITHERING_OFF 0
  142. #define DRM_MODE_DITHERING_ON 1
  143. #define DRM_MODE_DITHERING_AUTO 2
  144. /* Dirty info options */
  145. #define DRM_MODE_DIRTY_OFF 0
  146. #define DRM_MODE_DIRTY_ON 1
  147. #define DRM_MODE_DIRTY_ANNOTATE 2
  148. /* Link Status options */
  149. #define DRM_MODE_LINK_STATUS_GOOD 0
  150. #define DRM_MODE_LINK_STATUS_BAD 1
  151. /*
  152. * DRM_MODE_ROTATE_<degrees>
  153. *
  154. * Signals that a drm plane is been rotated <degrees> degrees in counter
  155. * clockwise direction.
  156. *
  157. * This define is provided as a convenience, looking up the property id
  158. * using the name->prop id lookup is the preferred method.
  159. */
  160. #define DRM_MODE_ROTATE_0 (1<<0)
  161. #define DRM_MODE_ROTATE_90 (1<<1)
  162. #define DRM_MODE_ROTATE_180 (1<<2)
  163. #define DRM_MODE_ROTATE_270 (1<<3)
  164. /*
  165. * DRM_MODE_ROTATE_MASK
  166. *
  167. * Bitmask used to look for drm plane rotations.
  168. */
  169. #define DRM_MODE_ROTATE_MASK (\
  170. DRM_MODE_ROTATE_0 | \
  171. DRM_MODE_ROTATE_90 | \
  172. DRM_MODE_ROTATE_180 | \
  173. DRM_MODE_ROTATE_270)
  174. /*
  175. * DRM_MODE_REFLECT_<axis>
  176. *
  177. * Signals that the contents of a drm plane is reflected along the <axis> axis,
  178. * in the same way as mirroring.
  179. * See kerneldoc chapter "Plane Composition Properties" for more details.
  180. *
  181. * This define is provided as a convenience, looking up the property id
  182. * using the name->prop id lookup is the preferred method.
  183. */
  184. #define DRM_MODE_REFLECT_X (1<<4)
  185. #define DRM_MODE_REFLECT_Y (1<<5)
  186. /*
  187. * DRM_MODE_REFLECT_MASK
  188. *
  189. * Bitmask used to look for drm plane reflections.
  190. */
  191. #define DRM_MODE_REFLECT_MASK (\
  192. DRM_MODE_REFLECT_X | \
  193. DRM_MODE_REFLECT_Y)
  194. /* Content Protection Flags */
  195. #define DRM_MODE_CONTENT_PROTECTION_UNDESIRED 0
  196. #define DRM_MODE_CONTENT_PROTECTION_DESIRED 1
  197. #define DRM_MODE_CONTENT_PROTECTION_ENABLED 2
  198. /**
  199. * struct drm_mode_modeinfo - Display mode information.
  200. * @clock: pixel clock in kHz
  201. * @hdisplay: horizontal display size
  202. * @hsync_start: horizontal sync start
  203. * @hsync_end: horizontal sync end
  204. * @htotal: horizontal total size
  205. * @hskew: horizontal skew
  206. * @vdisplay: vertical display size
  207. * @vsync_start: vertical sync start
  208. * @vsync_end: vertical sync end
  209. * @vtotal: vertical total size
  210. * @vscan: vertical scan
  211. * @vrefresh: approximate vertical refresh rate in Hz
  212. * @flags: bitmask of misc. flags, see DRM_MODE_FLAG_* defines
  213. * @type: bitmask of type flags, see DRM_MODE_TYPE_* defines
  214. * @name: string describing the mode resolution
  215. *
  216. * This is the user-space API display mode information structure. For the
  217. * kernel version see struct drm_display_mode.
  218. */
  219. struct drm_mode_modeinfo {
  220. __u32 clock;
  221. __u16 hdisplay;
  222. __u16 hsync_start;
  223. __u16 hsync_end;
  224. __u16 htotal;
  225. __u16 hskew;
  226. __u16 vdisplay;
  227. __u16 vsync_start;
  228. __u16 vsync_end;
  229. __u16 vtotal;
  230. __u16 vscan;
  231. __u32 vrefresh;
  232. __u32 flags;
  233. __u32 type;
  234. char name[DRM_DISPLAY_MODE_LEN];
  235. };
  236. struct drm_mode_card_res {
  237. __u64 fb_id_ptr;
  238. __u64 crtc_id_ptr;
  239. __u64 connector_id_ptr;
  240. __u64 encoder_id_ptr;
  241. __u32 count_fbs;
  242. __u32 count_crtcs;
  243. __u32 count_connectors;
  244. __u32 count_encoders;
  245. __u32 min_width;
  246. __u32 max_width;
  247. __u32 min_height;
  248. __u32 max_height;
  249. };
  250. struct drm_mode_crtc {
  251. __u64 set_connectors_ptr;
  252. __u32 count_connectors;
  253. __u32 crtc_id; /**< Id */
  254. __u32 fb_id; /**< Id of framebuffer */
  255. __u32 x; /**< x Position on the framebuffer */
  256. __u32 y; /**< y Position on the framebuffer */
  257. __u32 gamma_size;
  258. __u32 mode_valid;
  259. struct drm_mode_modeinfo mode;
  260. };
  261. #define DRM_MODE_PRESENT_TOP_FIELD (1<<0)
  262. #define DRM_MODE_PRESENT_BOTTOM_FIELD (1<<1)
  263. /* Planes blend with or override other bits on the CRTC */
  264. struct drm_mode_set_plane {
  265. __u32 plane_id;
  266. __u32 crtc_id;
  267. __u32 fb_id; /* fb object contains surface format type */
  268. __u32 flags; /* see above flags */
  269. /* Signed dest location allows it to be partially off screen */
  270. __s32 crtc_x;
  271. __s32 crtc_y;
  272. __u32 crtc_w;
  273. __u32 crtc_h;
  274. /* Source values are 16.16 fixed point */
  275. __u32 src_x;
  276. __u32 src_y;
  277. __u32 src_h;
  278. __u32 src_w;
  279. };
  280. /**
  281. * struct drm_mode_get_plane - Get plane metadata.
  282. *
  283. * Userspace can perform a GETPLANE ioctl to retrieve information about a
  284. * plane.
  285. *
  286. * To retrieve the number of formats supported, set @count_format_types to zero
  287. * and call the ioctl. @count_format_types will be updated with the value.
  288. *
  289. * To retrieve these formats, allocate an array with the memory needed to store
  290. * @count_format_types formats. Point @format_type_ptr to this array and call
  291. * the ioctl again (with @count_format_types still set to the value returned in
  292. * the first ioctl call).
  293. */
  294. struct drm_mode_get_plane {
  295. /**
  296. * @plane_id: Object ID of the plane whose information should be
  297. * retrieved. Set by caller.
  298. */
  299. __u32 plane_id;
  300. /** @crtc_id: Object ID of the current CRTC. */
  301. __u32 crtc_id;
  302. /** @fb_id: Object ID of the current fb. */
  303. __u32 fb_id;
  304. /**
  305. * @possible_crtcs: Bitmask of CRTC's compatible with the plane. CRTC's
  306. * are created and they receive an index, which corresponds to their
  307. * position in the bitmask. Bit N corresponds to
  308. * :ref:`CRTC index<crtc_index>` N.
  309. */
  310. __u32 possible_crtcs;
  311. /** @gamma_size: Never used. */
  312. __u32 gamma_size;
  313. /** @count_format_types: Number of formats. */
  314. __u32 count_format_types;
  315. /**
  316. * @format_type_ptr: Pointer to ``__u32`` array of formats that are
  317. * supported by the plane. These formats do not require modifiers.
  318. */
  319. __u64 format_type_ptr;
  320. };
  321. struct drm_mode_get_plane_res {
  322. __u64 plane_id_ptr;
  323. __u32 count_planes;
  324. };
  325. #define DRM_MODE_ENCODER_NONE 0
  326. #define DRM_MODE_ENCODER_DAC 1
  327. #define DRM_MODE_ENCODER_TMDS 2
  328. #define DRM_MODE_ENCODER_LVDS 3
  329. #define DRM_MODE_ENCODER_TVDAC 4
  330. #define DRM_MODE_ENCODER_VIRTUAL 5
  331. #define DRM_MODE_ENCODER_DSI 6
  332. #define DRM_MODE_ENCODER_DPMST 7
  333. #define DRM_MODE_ENCODER_DPI 8
  334. struct drm_mode_get_encoder {
  335. __u32 encoder_id;
  336. __u32 encoder_type;
  337. __u32 crtc_id; /**< Id of crtc */
  338. __u32 possible_crtcs;
  339. __u32 possible_clones;
  340. };
  341. /* This is for connectors with multiple signal types. */
  342. /* Try to match DRM_MODE_CONNECTOR_X as closely as possible. */
  343. enum drm_mode_subconnector {
  344. DRM_MODE_SUBCONNECTOR_Automatic = 0, /* DVI-I, TV */
  345. DRM_MODE_SUBCONNECTOR_Unknown = 0, /* DVI-I, TV, DP */
  346. DRM_MODE_SUBCONNECTOR_VGA = 1, /* DP */
  347. DRM_MODE_SUBCONNECTOR_DVID = 3, /* DVI-I DP */
  348. DRM_MODE_SUBCONNECTOR_DVIA = 4, /* DVI-I */
  349. DRM_MODE_SUBCONNECTOR_Composite = 5, /* TV */
  350. DRM_MODE_SUBCONNECTOR_SVIDEO = 6, /* TV */
  351. DRM_MODE_SUBCONNECTOR_Component = 8, /* TV */
  352. DRM_MODE_SUBCONNECTOR_SCART = 9, /* TV */
  353. DRM_MODE_SUBCONNECTOR_DisplayPort = 10, /* DP */
  354. DRM_MODE_SUBCONNECTOR_HDMIA = 11, /* DP */
  355. DRM_MODE_SUBCONNECTOR_Native = 15, /* DP */
  356. DRM_MODE_SUBCONNECTOR_Wireless = 18, /* DP */
  357. };
  358. #define DRM_MODE_CONNECTOR_Unknown 0
  359. #define DRM_MODE_CONNECTOR_VGA 1
  360. #define DRM_MODE_CONNECTOR_DVII 2
  361. #define DRM_MODE_CONNECTOR_DVID 3
  362. #define DRM_MODE_CONNECTOR_DVIA 4
  363. #define DRM_MODE_CONNECTOR_Composite 5
  364. #define DRM_MODE_CONNECTOR_SVIDEO 6
  365. #define DRM_MODE_CONNECTOR_LVDS 7
  366. #define DRM_MODE_CONNECTOR_Component 8
  367. #define DRM_MODE_CONNECTOR_9PinDIN 9
  368. #define DRM_MODE_CONNECTOR_DisplayPort 10
  369. #define DRM_MODE_CONNECTOR_HDMIA 11
  370. #define DRM_MODE_CONNECTOR_HDMIB 12
  371. #define DRM_MODE_CONNECTOR_TV 13
  372. #define DRM_MODE_CONNECTOR_eDP 14
  373. #define DRM_MODE_CONNECTOR_VIRTUAL 15
  374. #define DRM_MODE_CONNECTOR_DSI 16
  375. #define DRM_MODE_CONNECTOR_DPI 17
  376. #define DRM_MODE_CONNECTOR_WRITEBACK 18
  377. #define DRM_MODE_CONNECTOR_SPI 19
  378. #define DRM_MODE_CONNECTOR_USB 20
  379. /**
  380. * struct drm_mode_get_connector - Get connector metadata.
  381. *
  382. * User-space can perform a GETCONNECTOR ioctl to retrieve information about a
  383. * connector. User-space is expected to retrieve encoders, modes and properties
  384. * by performing this ioctl at least twice: the first time to retrieve the
  385. * number of elements, the second time to retrieve the elements themselves.
  386. *
  387. * To retrieve the number of elements, set @count_props and @count_encoders to
  388. * zero, set @count_modes to 1, and set @modes_ptr to a temporary struct
  389. * drm_mode_modeinfo element.
  390. *
  391. * To retrieve the elements, allocate arrays for @encoders_ptr, @modes_ptr,
  392. * @props_ptr and @prop_values_ptr, then set @count_modes, @count_props and
  393. * @count_encoders to their capacity.
  394. *
  395. * Performing the ioctl only twice may be racy: the number of elements may have
  396. * changed with a hotplug event in-between the two ioctls. User-space is
  397. * expected to retry the last ioctl until the number of elements stabilizes.
  398. * The kernel won't fill any array which doesn't have the expected length.
  399. *
  400. * **Force-probing a connector**
  401. *
  402. * If the @count_modes field is set to zero and the DRM client is the current
  403. * DRM master, the kernel will perform a forced probe on the connector to
  404. * refresh the connector status, modes and EDID. A forced-probe can be slow,
  405. * might cause flickering and the ioctl will block.
  406. *
  407. * User-space needs to force-probe connectors to ensure their metadata is
  408. * up-to-date at startup and after receiving a hot-plug event. User-space
  409. * may perform a forced-probe when the user explicitly requests it. User-space
  410. * shouldn't perform a forced-probe in other situations.
  411. */
  412. struct drm_mode_get_connector {
  413. /** @encoders_ptr: Pointer to ``__u32`` array of object IDs. */
  414. __u64 encoders_ptr;
  415. /** @modes_ptr: Pointer to struct drm_mode_modeinfo array. */
  416. __u64 modes_ptr;
  417. /** @props_ptr: Pointer to ``__u32`` array of property IDs. */
  418. __u64 props_ptr;
  419. /** @prop_values_ptr: Pointer to ``__u64`` array of property values. */
  420. __u64 prop_values_ptr;
  421. /** @count_modes: Number of modes. */
  422. __u32 count_modes;
  423. /** @count_props: Number of properties. */
  424. __u32 count_props;
  425. /** @count_encoders: Number of encoders. */
  426. __u32 count_encoders;
  427. /** @encoder_id: Object ID of the current encoder. */
  428. __u32 encoder_id;
  429. /** @connector_id: Object ID of the connector. */
  430. __u32 connector_id;
  431. /**
  432. * @connector_type: Type of the connector.
  433. *
  434. * See DRM_MODE_CONNECTOR_* defines.
  435. */
  436. __u32 connector_type;
  437. /**
  438. * @connector_type_id: Type-specific connector number.
  439. *
  440. * This is not an object ID. This is a per-type connector number. Each
  441. * (type, type_id) combination is unique across all connectors of a DRM
  442. * device.
  443. */
  444. __u32 connector_type_id;
  445. /**
  446. * @connection: Status of the connector.
  447. *
  448. * See enum drm_connector_status.
  449. */
  450. __u32 connection;
  451. /** @mm_width: Width of the connected sink in millimeters. */
  452. __u32 mm_width;
  453. /** @mm_height: Height of the connected sink in millimeters. */
  454. __u32 mm_height;
  455. /**
  456. * @subpixel: Subpixel order of the connected sink.
  457. *
  458. * See enum subpixel_order.
  459. */
  460. __u32 subpixel;
  461. /** @pad: Padding, must be zero. */
  462. __u32 pad;
  463. };
  464. #define DRM_MODE_PROP_PENDING (1<<0) /* deprecated, do not use */
  465. #define DRM_MODE_PROP_RANGE (1<<1)
  466. #define DRM_MODE_PROP_IMMUTABLE (1<<2)
  467. #define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */
  468. #define DRM_MODE_PROP_BLOB (1<<4)
  469. #define DRM_MODE_PROP_BITMASK (1<<5) /* bitmask of enumerated types */
  470. /* non-extended types: legacy bitmask, one bit per type: */
  471. #define DRM_MODE_PROP_LEGACY_TYPE ( \
  472. DRM_MODE_PROP_RANGE | \
  473. DRM_MODE_PROP_ENUM | \
  474. DRM_MODE_PROP_BLOB | \
  475. DRM_MODE_PROP_BITMASK)
  476. /* extended-types: rather than continue to consume a bit per type,
  477. * grab a chunk of the bits to use as integer type id.
  478. */
  479. #define DRM_MODE_PROP_EXTENDED_TYPE 0x0000ffc0
  480. #define DRM_MODE_PROP_TYPE(n) ((n) << 6)
  481. #define DRM_MODE_PROP_OBJECT DRM_MODE_PROP_TYPE(1)
  482. #define DRM_MODE_PROP_SIGNED_RANGE DRM_MODE_PROP_TYPE(2)
  483. /* the PROP_ATOMIC flag is used to hide properties from userspace that
  484. * is not aware of atomic properties. This is mostly to work around
  485. * older userspace (DDX drivers) that read/write each prop they find,
  486. * witout being aware that this could be triggering a lengthy modeset.
  487. */
  488. #define DRM_MODE_PROP_ATOMIC 0x80000000
  489. /**
  490. * struct drm_mode_property_enum - Description for an enum/bitfield entry.
  491. * @value: numeric value for this enum entry.
  492. * @name: symbolic name for this enum entry.
  493. *
  494. * See struct drm_property_enum for details.
  495. */
  496. struct drm_mode_property_enum {
  497. __u64 value;
  498. char name[DRM_PROP_NAME_LEN];
  499. };
  500. /**
  501. * struct drm_mode_get_property - Get property metadata.
  502. *
  503. * User-space can perform a GETPROPERTY ioctl to retrieve information about a
  504. * property. The same property may be attached to multiple objects, see
  505. * "Modeset Base Object Abstraction".
  506. *
  507. * The meaning of the @values_ptr field changes depending on the property type.
  508. * See &drm_property.flags for more details.
  509. *
  510. * The @enum_blob_ptr and @count_enum_blobs fields are only meaningful when the
  511. * property has the type &DRM_MODE_PROP_ENUM or &DRM_MODE_PROP_BITMASK. For
  512. * backwards compatibility, the kernel will always set @count_enum_blobs to
  513. * zero when the property has the type &DRM_MODE_PROP_BLOB. User-space must
  514. * ignore these two fields if the property has a different type.
  515. *
  516. * User-space is expected to retrieve values and enums by performing this ioctl
  517. * at least twice: the first time to retrieve the number of elements, the
  518. * second time to retrieve the elements themselves.
  519. *
  520. * To retrieve the number of elements, set @count_values and @count_enum_blobs
  521. * to zero, then call the ioctl. @count_values will be updated with the number
  522. * of elements. If the property has the type &DRM_MODE_PROP_ENUM or
  523. * &DRM_MODE_PROP_BITMASK, @count_enum_blobs will be updated as well.
  524. *
  525. * To retrieve the elements themselves, allocate an array for @values_ptr and
  526. * set @count_values to its capacity. If the property has the type
  527. * &DRM_MODE_PROP_ENUM or &DRM_MODE_PROP_BITMASK, allocate an array for
  528. * @enum_blob_ptr and set @count_enum_blobs to its capacity. Calling the ioctl
  529. * again will fill the arrays.
  530. */
  531. struct drm_mode_get_property {
  532. /** @values_ptr: Pointer to a ``__u64`` array. */
  533. __u64 values_ptr;
  534. /** @enum_blob_ptr: Pointer to a struct drm_mode_property_enum array. */
  535. __u64 enum_blob_ptr;
  536. /**
  537. * @prop_id: Object ID of the property which should be retrieved. Set
  538. * by the caller.
  539. */
  540. __u32 prop_id;
  541. /**
  542. * @flags: ``DRM_MODE_PROP_*`` bitfield. See &drm_property.flags for
  543. * a definition of the flags.
  544. */
  545. __u32 flags;
  546. /**
  547. * @name: Symbolic property name. User-space should use this field to
  548. * recognize properties.
  549. */
  550. char name[DRM_PROP_NAME_LEN];
  551. /** @count_values: Number of elements in @values_ptr. */
  552. __u32 count_values;
  553. /** @count_enum_blobs: Number of elements in @enum_blob_ptr. */
  554. __u32 count_enum_blobs;
  555. };
  556. struct drm_mode_connector_set_property {
  557. __u64 value;
  558. __u32 prop_id;
  559. __u32 connector_id;
  560. };
  561. #define DRM_MODE_OBJECT_CRTC 0xcccccccc
  562. #define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
  563. #define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0
  564. #define DRM_MODE_OBJECT_MODE 0xdededede
  565. #define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
  566. #define DRM_MODE_OBJECT_FB 0xfbfbfbfb
  567. #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
  568. #define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
  569. #define DRM_MODE_OBJECT_ANY 0
  570. struct drm_mode_obj_get_properties {
  571. __u64 props_ptr;
  572. __u64 prop_values_ptr;
  573. __u32 count_props;
  574. __u32 obj_id;
  575. __u32 obj_type;
  576. };
  577. struct drm_mode_obj_set_property {
  578. __u64 value;
  579. __u32 prop_id;
  580. __u32 obj_id;
  581. __u32 obj_type;
  582. };
  583. struct drm_mode_get_blob {
  584. __u32 blob_id;
  585. __u32 length;
  586. __u64 data;
  587. };
  588. struct drm_mode_fb_cmd {
  589. __u32 fb_id;
  590. __u32 width;
  591. __u32 height;
  592. __u32 pitch;
  593. __u32 bpp;
  594. __u32 depth;
  595. /* driver specific handle */
  596. __u32 handle;
  597. };
  598. #define DRM_MODE_FB_INTERLACED (1<<0) /* for interlaced framebuffers */
  599. #define DRM_MODE_FB_MODIFIERS (1<<1) /* enables ->modifer[] */
  600. /**
  601. * struct drm_mode_fb_cmd2 - Frame-buffer metadata.
  602. *
  603. * This struct holds frame-buffer metadata. There are two ways to use it:
  604. *
  605. * - User-space can fill this struct and perform a &DRM_IOCTL_MODE_ADDFB2
  606. * ioctl to register a new frame-buffer. The new frame-buffer object ID will
  607. * be set by the kernel in @fb_id.
  608. * - User-space can set @fb_id and perform a &DRM_IOCTL_MODE_GETFB2 ioctl to
  609. * fetch metadata about an existing frame-buffer.
  610. *
  611. * In case of planar formats, this struct allows up to 4 buffer objects with
  612. * offsets and pitches per plane. The pitch and offset order are dictated by
  613. * the format FourCC as defined by ``drm_fourcc.h``, e.g. NV12 is described as:
  614. *
  615. * YUV 4:2:0 image with a plane of 8-bit Y samples followed by an
  616. * interleaved U/V plane containing 8-bit 2x2 subsampled colour difference
  617. * samples.
  618. *
  619. * So it would consist of a Y plane at ``offsets[0]`` and a UV plane at
  620. * ``offsets[1]``.
  621. *
  622. * To accommodate tiled, compressed, etc formats, a modifier can be specified.
  623. * For more information see the "Format Modifiers" section. Note that even
  624. * though it looks like we have a modifier per-plane, we in fact do not. The
  625. * modifier for each plane must be identical. Thus all combinations of
  626. * different data layouts for multi-plane formats must be enumerated as
  627. * separate modifiers.
  628. *
  629. * All of the entries in @handles, @pitches, @offsets and @modifier must be
  630. * zero when unused. Warning, for @offsets and @modifier zero can't be used to
  631. * figure out whether the entry is used or not since it's a valid value (a zero
  632. * offset is common, and a zero modifier is &DRM_FORMAT_MOD_LINEAR).
  633. */
  634. struct drm_mode_fb_cmd2 {
  635. /** @fb_id: Object ID of the frame-buffer. */
  636. __u32 fb_id;
  637. /** @width: Width of the frame-buffer. */
  638. __u32 width;
  639. /** @height: Height of the frame-buffer. */
  640. __u32 height;
  641. /**
  642. * @pixel_format: FourCC format code, see ``DRM_FORMAT_*`` constants in
  643. * ``drm_fourcc.h``.
  644. */
  645. __u32 pixel_format;
  646. /**
  647. * @flags: Frame-buffer flags (see &DRM_MODE_FB_INTERLACED and
  648. * &DRM_MODE_FB_MODIFIERS).
  649. */
  650. __u32 flags;
  651. /**
  652. * @handles: GEM buffer handle, one per plane. Set to 0 if the plane is
  653. * unused. The same handle can be used for multiple planes.
  654. */
  655. __u32 handles[4];
  656. /** @pitches: Pitch (aka. stride) in bytes, one per plane. */
  657. __u32 pitches[4];
  658. /** @offsets: Offset into the buffer in bytes, one per plane. */
  659. __u32 offsets[4];
  660. /**
  661. * @modifier: Format modifier, one per plane. See ``DRM_FORMAT_MOD_*``
  662. * constants in ``drm_fourcc.h``. All planes must use the same
  663. * modifier. Ignored unless &DRM_MODE_FB_MODIFIERS is set in @flags.
  664. */
  665. __u64 modifier[4];
  666. };
  667. #define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01
  668. #define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02
  669. #define DRM_MODE_FB_DIRTY_FLAGS 0x03
  670. #define DRM_MODE_FB_DIRTY_MAX_CLIPS 256
  671. /*
  672. * Mark a region of a framebuffer as dirty.
  673. *
  674. * Some hardware does not automatically update display contents
  675. * as a hardware or software draw to a framebuffer. This ioctl
  676. * allows userspace to tell the kernel and the hardware what
  677. * regions of the framebuffer have changed.
  678. *
  679. * The kernel or hardware is free to update more then just the
  680. * region specified by the clip rects. The kernel or hardware
  681. * may also delay and/or coalesce several calls to dirty into a
  682. * single update.
  683. *
  684. * Userspace may annotate the updates, the annotates are a
  685. * promise made by the caller that the change is either a copy
  686. * of pixels or a fill of a single color in the region specified.
  687. *
  688. * If the DRM_MODE_FB_DIRTY_ANNOTATE_COPY flag is given then
  689. * the number of updated regions are half of num_clips given,
  690. * where the clip rects are paired in src and dst. The width and
  691. * height of each one of the pairs must match.
  692. *
  693. * If the DRM_MODE_FB_DIRTY_ANNOTATE_FILL flag is given the caller
  694. * promises that the region specified of the clip rects is filled
  695. * completely with a single color as given in the color argument.
  696. */
  697. struct drm_mode_fb_dirty_cmd {
  698. __u32 fb_id;
  699. __u32 flags;
  700. __u32 color;
  701. __u32 num_clips;
  702. __u64 clips_ptr;
  703. };
  704. struct drm_mode_mode_cmd {
  705. __u32 connector_id;
  706. struct drm_mode_modeinfo mode;
  707. };
  708. #define DRM_MODE_CURSOR_BO 0x01
  709. #define DRM_MODE_CURSOR_MOVE 0x02
  710. #define DRM_MODE_CURSOR_FLAGS 0x03
  711. /*
  712. * depending on the value in flags different members are used.
  713. *
  714. * CURSOR_BO uses
  715. * crtc_id
  716. * width
  717. * height
  718. * handle - if 0 turns the cursor off
  719. *
  720. * CURSOR_MOVE uses
  721. * crtc_id
  722. * x
  723. * y
  724. */
  725. struct drm_mode_cursor {
  726. __u32 flags;
  727. __u32 crtc_id;
  728. __s32 x;
  729. __s32 y;
  730. __u32 width;
  731. __u32 height;
  732. /* driver specific handle */
  733. __u32 handle;
  734. };
  735. struct drm_mode_cursor2 {
  736. __u32 flags;
  737. __u32 crtc_id;
  738. __s32 x;
  739. __s32 y;
  740. __u32 width;
  741. __u32 height;
  742. /* driver specific handle */
  743. __u32 handle;
  744. __s32 hot_x;
  745. __s32 hot_y;
  746. };
  747. struct drm_mode_crtc_lut {
  748. __u32 crtc_id;
  749. __u32 gamma_size;
  750. /* pointers to arrays */
  751. __u64 red;
  752. __u64 green;
  753. __u64 blue;
  754. };
  755. struct drm_color_ctm {
  756. /*
  757. * Conversion matrix in S31.32 sign-magnitude
  758. * (not two's complement!) format.
  759. *
  760. * out matrix in
  761. * |R| |0 1 2| |R|
  762. * |G| = |3 4 5| x |G|
  763. * |B| |6 7 8| |B|
  764. */
  765. __u64 matrix[9];
  766. };
  767. struct drm_color_lut {
  768. /*
  769. * Values are mapped linearly to 0.0 - 1.0 range, with 0x0 == 0.0 and
  770. * 0xffff == 1.0.
  771. */
  772. __u16 red;
  773. __u16 green;
  774. __u16 blue;
  775. __u16 reserved;
  776. };
  777. /**
  778. * struct hdr_metadata_infoframe - HDR Metadata Infoframe Data.
  779. *
  780. * HDR Metadata Infoframe as per CTA 861.G spec. This is expected
  781. * to match exactly with the spec.
  782. *
  783. * Userspace is expected to pass the metadata information as per
  784. * the format described in this structure.
  785. */
  786. struct hdr_metadata_infoframe {
  787. /**
  788. * @eotf: Electro-Optical Transfer Function (EOTF)
  789. * used in the stream.
  790. */
  791. __u8 eotf;
  792. /**
  793. * @metadata_type: Static_Metadata_Descriptor_ID.
  794. */
  795. __u8 metadata_type;
  796. /**
  797. * @display_primaries: Color Primaries of the Data.
  798. * These are coded as unsigned 16-bit values in units of
  799. * 0.00002, where 0x0000 represents zero and 0xC350
  800. * represents 1.0000.
  801. * @display_primaries.x: X cordinate of color primary.
  802. * @display_primaries.y: Y cordinate of color primary.
  803. */
  804. struct {
  805. __u16 x, y;
  806. } display_primaries[3];
  807. /**
  808. * @white_point: White Point of Colorspace Data.
  809. * These are coded as unsigned 16-bit values in units of
  810. * 0.00002, where 0x0000 represents zero and 0xC350
  811. * represents 1.0000.
  812. * @white_point.x: X cordinate of whitepoint of color primary.
  813. * @white_point.y: Y cordinate of whitepoint of color primary.
  814. */
  815. struct {
  816. __u16 x, y;
  817. } white_point;
  818. /**
  819. * @max_display_mastering_luminance: Max Mastering Display Luminance.
  820. * This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
  821. * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
  822. */
  823. __u16 max_display_mastering_luminance;
  824. /**
  825. * @min_display_mastering_luminance: Min Mastering Display Luminance.
  826. * This value is coded as an unsigned 16-bit value in units of
  827. * 0.0001 cd/m2, where 0x0001 represents 0.0001 cd/m2 and 0xFFFF
  828. * represents 6.5535 cd/m2.
  829. */
  830. __u16 min_display_mastering_luminance;
  831. /**
  832. * @max_cll: Max Content Light Level.
  833. * This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
  834. * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
  835. */
  836. __u16 max_cll;
  837. /**
  838. * @max_fall: Max Frame Average Light Level.
  839. * This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
  840. * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
  841. */
  842. __u16 max_fall;
  843. };
  844. /**
  845. * struct hdr_output_metadata - HDR output metadata
  846. *
  847. * Metadata Information to be passed from userspace
  848. */
  849. struct hdr_output_metadata {
  850. /**
  851. * @metadata_type: Static_Metadata_Descriptor_ID.
  852. */
  853. __u32 metadata_type;
  854. /**
  855. * @hdmi_metadata_type1: HDR Metadata Infoframe.
  856. */
  857. union {
  858. struct hdr_metadata_infoframe hdmi_metadata_type1;
  859. };
  860. };
  861. /**
  862. * DRM_MODE_PAGE_FLIP_EVENT
  863. *
  864. * Request that the kernel sends back a vblank event (see
  865. * struct drm_event_vblank) with the &DRM_EVENT_FLIP_COMPLETE type when the
  866. * page-flip is done.
  867. */
  868. #define DRM_MODE_PAGE_FLIP_EVENT 0x01
  869. /**
  870. * DRM_MODE_PAGE_FLIP_ASYNC
  871. *
  872. * Request that the page-flip is performed as soon as possible, ie. with no
  873. * delay due to waiting for vblank. This may cause tearing to be visible on
  874. * the screen.
  875. */
  876. #define DRM_MODE_PAGE_FLIP_ASYNC 0x02
  877. #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
  878. #define DRM_MODE_PAGE_FLIP_TARGET_RELATIVE 0x8
  879. #define DRM_MODE_PAGE_FLIP_TARGET (DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE | \
  880. DRM_MODE_PAGE_FLIP_TARGET_RELATIVE)
  881. /**
  882. * DRM_MODE_PAGE_FLIP_FLAGS
  883. *
  884. * Bitmask of flags suitable for &drm_mode_crtc_page_flip_target.flags.
  885. */
  886. #define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT | \
  887. DRM_MODE_PAGE_FLIP_ASYNC | \
  888. DRM_MODE_PAGE_FLIP_TARGET)
  889. /*
  890. * Request a page flip on the specified crtc.
  891. *
  892. * This ioctl will ask KMS to schedule a page flip for the specified
  893. * crtc. Once any pending rendering targeting the specified fb (as of
  894. * ioctl time) has completed, the crtc will be reprogrammed to display
  895. * that fb after the next vertical refresh. The ioctl returns
  896. * immediately, but subsequent rendering to the current fb will block
  897. * in the execbuffer ioctl until the page flip happens. If a page
  898. * flip is already pending as the ioctl is called, EBUSY will be
  899. * returned.
  900. *
  901. * Flag DRM_MODE_PAGE_FLIP_EVENT requests that drm sends back a vblank
  902. * event (see drm.h: struct drm_event_vblank) when the page flip is
  903. * done. The user_data field passed in with this ioctl will be
  904. * returned as the user_data field in the vblank event struct.
  905. *
  906. * Flag DRM_MODE_PAGE_FLIP_ASYNC requests that the flip happen
  907. * 'as soon as possible', meaning that it not delay waiting for vblank.
  908. * This may cause tearing on the screen.
  909. *
  910. * The reserved field must be zero.
  911. */
  912. struct drm_mode_crtc_page_flip {
  913. __u32 crtc_id;
  914. __u32 fb_id;
  915. __u32 flags;
  916. __u32 reserved;
  917. __u64 user_data;
  918. };
  919. /*
  920. * Request a page flip on the specified crtc.
  921. *
  922. * Same as struct drm_mode_crtc_page_flip, but supports new flags and
  923. * re-purposes the reserved field:
  924. *
  925. * The sequence field must be zero unless either of the
  926. * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is specified. When
  927. * the ABSOLUTE flag is specified, the sequence field denotes the absolute
  928. * vblank sequence when the flip should take effect. When the RELATIVE
  929. * flag is specified, the sequence field denotes the relative (to the
  930. * current one when the ioctl is called) vblank sequence when the flip
  931. * should take effect. NOTE: DRM_IOCTL_WAIT_VBLANK must still be used to
  932. * make sure the vblank sequence before the target one has passed before
  933. * calling this ioctl. The purpose of the
  934. * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is merely to clarify
  935. * the target for when code dealing with a page flip runs during a
  936. * vertical blank period.
  937. */
  938. struct drm_mode_crtc_page_flip_target {
  939. __u32 crtc_id;
  940. __u32 fb_id;
  941. __u32 flags;
  942. __u32 sequence;
  943. __u64 user_data;
  944. };
  945. /* create a dumb scanout buffer */
  946. struct drm_mode_create_dumb {
  947. __u32 height;
  948. __u32 width;
  949. __u32 bpp;
  950. __u32 flags;
  951. /* handle, pitch, size will be returned */
  952. __u32 handle;
  953. __u32 pitch;
  954. __u64 size;
  955. };
  956. /* set up for mmap of a dumb scanout buffer */
  957. struct drm_mode_map_dumb {
  958. /** Handle for the object being mapped. */
  959. __u32 handle;
  960. __u32 pad;
  961. /**
  962. * Fake offset to use for subsequent mmap call
  963. *
  964. * This is a fixed-size type for 32/64 compatibility.
  965. */
  966. __u64 offset;
  967. };
  968. struct drm_mode_destroy_dumb {
  969. __u32 handle;
  970. };
  971. /**
  972. * DRM_MODE_ATOMIC_TEST_ONLY
  973. *
  974. * Do not apply the atomic commit, instead check whether the hardware supports
  975. * this configuration.
  976. *
  977. * See &drm_mode_config_funcs.atomic_check for more details on test-only
  978. * commits.
  979. */
  980. #define DRM_MODE_ATOMIC_TEST_ONLY 0x0100
  981. /**
  982. * DRM_MODE_ATOMIC_NONBLOCK
  983. *
  984. * Do not block while applying the atomic commit. The &DRM_IOCTL_MODE_ATOMIC
  985. * IOCTL returns immediately instead of waiting for the changes to be applied
  986. * in hardware. Note, the driver will still check that the update can be
  987. * applied before retuning.
  988. */
  989. #define DRM_MODE_ATOMIC_NONBLOCK 0x0200
  990. /**
  991. * DRM_MODE_ATOMIC_ALLOW_MODESET
  992. *
  993. * Allow the update to result in temporary or transient visible artifacts while
  994. * the update is being applied. Applying the update may also take significantly
  995. * more time than a page flip. All visual artifacts will disappear by the time
  996. * the update is completed, as signalled through the vblank event's timestamp
  997. * (see struct drm_event_vblank).
  998. *
  999. * This flag must be set when the KMS update might cause visible artifacts.
  1000. * Without this flag such KMS update will return a EINVAL error. What kind of
  1001. * update may cause visible artifacts depends on the driver and the hardware.
  1002. * User-space that needs to know beforehand if an update might cause visible
  1003. * artifacts can use &DRM_MODE_ATOMIC_TEST_ONLY without
  1004. * &DRM_MODE_ATOMIC_ALLOW_MODESET to see if it fails.
  1005. *
  1006. * To the best of the driver's knowledge, visual artifacts are guaranteed to
  1007. * not appear when this flag is not set. Some sinks might display visual
  1008. * artifacts outside of the driver's control.
  1009. */
  1010. #define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400
  1011. /**
  1012. * DRM_MODE_ATOMIC_FLAGS
  1013. *
  1014. * Bitfield of flags accepted by the &DRM_IOCTL_MODE_ATOMIC IOCTL in
  1015. * &drm_mode_atomic.flags.
  1016. */
  1017. #define DRM_MODE_ATOMIC_FLAGS (\
  1018. DRM_MODE_PAGE_FLIP_EVENT |\
  1019. DRM_MODE_PAGE_FLIP_ASYNC |\
  1020. DRM_MODE_ATOMIC_TEST_ONLY |\
  1021. DRM_MODE_ATOMIC_NONBLOCK |\
  1022. DRM_MODE_ATOMIC_ALLOW_MODESET)
  1023. struct drm_mode_atomic {
  1024. __u32 flags;
  1025. __u32 count_objs;
  1026. __u64 objs_ptr;
  1027. __u64 count_props_ptr;
  1028. __u64 props_ptr;
  1029. __u64 prop_values_ptr;
  1030. __u64 reserved;
  1031. __u64 user_data;
  1032. };
  1033. struct drm_format_modifier_blob {
  1034. #define FORMAT_BLOB_CURRENT 1
  1035. /* Version of this blob format */
  1036. __u32 version;
  1037. /* Flags */
  1038. __u32 flags;
  1039. /* Number of fourcc formats supported */
  1040. __u32 count_formats;
  1041. /* Where in this blob the formats exist (in bytes) */
  1042. __u32 formats_offset;
  1043. /* Number of drm_format_modifiers */
  1044. __u32 count_modifiers;
  1045. /* Where in this blob the modifiers exist (in bytes) */
  1046. __u32 modifiers_offset;
  1047. /* __u32 formats[] */
  1048. /* struct drm_format_modifier modifiers[] */
  1049. };
  1050. struct drm_format_modifier {
  1051. /* Bitmask of formats in get_plane format list this info applies to. The
  1052. * offset allows a sliding window of which 64 formats (bits).
  1053. *
  1054. * Some examples:
  1055. * In today's world with < 65 formats, and formats 0, and 2 are
  1056. * supported
  1057. * 0x0000000000000005
  1058. * ^-offset = 0, formats = 5
  1059. *
  1060. * If the number formats grew to 128, and formats 98-102 are
  1061. * supported with the modifier:
  1062. *
  1063. * 0x0000007c00000000 0000000000000000
  1064. * ^
  1065. * |__offset = 64, formats = 0x7c00000000
  1066. *
  1067. */
  1068. __u64 formats;
  1069. __u32 offset;
  1070. __u32 pad;
  1071. /* The modifier that applies to the >get_plane format list bitmask. */
  1072. __u64 modifier;
  1073. };
  1074. /**
  1075. * struct drm_mode_create_blob - Create New blob property
  1076. *
  1077. * Create a new 'blob' data property, copying length bytes from data pointer,
  1078. * and returning new blob ID.
  1079. */
  1080. struct drm_mode_create_blob {
  1081. /** @data: Pointer to data to copy. */
  1082. __u64 data;
  1083. /** @length: Length of data to copy. */
  1084. __u32 length;
  1085. /** @blob_id: Return: new property ID. */
  1086. __u32 blob_id;
  1087. };
  1088. /**
  1089. * struct drm_mode_destroy_blob - Destroy user blob
  1090. * @blob_id: blob_id to destroy
  1091. *
  1092. * Destroy a user-created blob property.
  1093. *
  1094. * User-space can release blobs as soon as they do not need to refer to them by
  1095. * their blob object ID. For instance, if you are using a MODE_ID blob in an
  1096. * atomic commit and you will not make another commit re-using the same ID, you
  1097. * can destroy the blob as soon as the commit has been issued, without waiting
  1098. * for it to complete.
  1099. */
  1100. struct drm_mode_destroy_blob {
  1101. __u32 blob_id;
  1102. };
  1103. /**
  1104. * struct drm_mode_create_lease - Create lease
  1105. *
  1106. * Lease mode resources, creating another drm_master.
  1107. *
  1108. * The @object_ids array must reference at least one CRTC, one connector and
  1109. * one plane if &DRM_CLIENT_CAP_UNIVERSAL_PLANES is enabled. Alternatively,
  1110. * the lease can be completely empty.
  1111. */
  1112. struct drm_mode_create_lease {
  1113. /** @object_ids: Pointer to array of object ids (__u32) */
  1114. __u64 object_ids;
  1115. /** @object_count: Number of object ids */
  1116. __u32 object_count;
  1117. /** @flags: flags for new FD (O_CLOEXEC, etc) */
  1118. __u32 flags;
  1119. /** @lessee_id: Return: unique identifier for lessee. */
  1120. __u32 lessee_id;
  1121. /** @fd: Return: file descriptor to new drm_master file */
  1122. __u32 fd;
  1123. };
  1124. /**
  1125. * struct drm_mode_list_lessees - List lessees
  1126. *
  1127. * List lesses from a drm_master.
  1128. */
  1129. struct drm_mode_list_lessees {
  1130. /**
  1131. * @count_lessees: Number of lessees.
  1132. *
  1133. * On input, provides length of the array.
  1134. * On output, provides total number. No
  1135. * more than the input number will be written
  1136. * back, so two calls can be used to get
  1137. * the size and then the data.
  1138. */
  1139. __u32 count_lessees;
  1140. /** @pad: Padding. */
  1141. __u32 pad;
  1142. /**
  1143. * @lessees_ptr: Pointer to lessees.
  1144. *
  1145. * Pointer to __u64 array of lessee ids
  1146. */
  1147. __u64 lessees_ptr;
  1148. };
  1149. /**
  1150. * struct drm_mode_get_lease - Get Lease
  1151. *
  1152. * Get leased objects.
  1153. */
  1154. struct drm_mode_get_lease {
  1155. /**
  1156. * @count_objects: Number of leased objects.
  1157. *
  1158. * On input, provides length of the array.
  1159. * On output, provides total number. No
  1160. * more than the input number will be written
  1161. * back, so two calls can be used to get
  1162. * the size and then the data.
  1163. */
  1164. __u32 count_objects;
  1165. /** @pad: Padding. */
  1166. __u32 pad;
  1167. /**
  1168. * @objects_ptr: Pointer to objects.
  1169. *
  1170. * Pointer to __u32 array of object ids.
  1171. */
  1172. __u64 objects_ptr;
  1173. };
  1174. /**
  1175. * struct drm_mode_revoke_lease - Revoke lease
  1176. */
  1177. struct drm_mode_revoke_lease {
  1178. /** @lessee_id: Unique ID of lessee */
  1179. __u32 lessee_id;
  1180. };
  1181. /**
  1182. * struct drm_mode_rect - Two dimensional rectangle.
  1183. * @x1: Horizontal starting coordinate (inclusive).
  1184. * @y1: Vertical starting coordinate (inclusive).
  1185. * @x2: Horizontal ending coordinate (exclusive).
  1186. * @y2: Vertical ending coordinate (exclusive).
  1187. *
  1188. * With drm subsystem using struct drm_rect to manage rectangular area this
  1189. * export it to user-space.
  1190. *
  1191. * Currently used by drm_mode_atomic blob property FB_DAMAGE_CLIPS.
  1192. */
  1193. struct drm_mode_rect {
  1194. __s32 x1;
  1195. __s32 y1;
  1196. __s32 x2;
  1197. __s32 y2;
  1198. };
  1199. #if defined(__cplusplus)
  1200. }
  1201. #endif
  1202. #endif