drm_mode.h 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318
  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. * The (type, type_id) combination is not a stable identifier: the
  445. * type_id can change depending on the driver probe order.
  446. */
  447. __u32 connector_type_id;
  448. /**
  449. * @connection: Status of the connector.
  450. *
  451. * See enum drm_connector_status.
  452. */
  453. __u32 connection;
  454. /** @mm_width: Width of the connected sink in millimeters. */
  455. __u32 mm_width;
  456. /** @mm_height: Height of the connected sink in millimeters. */
  457. __u32 mm_height;
  458. /**
  459. * @subpixel: Subpixel order of the connected sink.
  460. *
  461. * See enum subpixel_order.
  462. */
  463. __u32 subpixel;
  464. /** @pad: Padding, must be zero. */
  465. __u32 pad;
  466. };
  467. #define DRM_MODE_PROP_PENDING (1<<0) /* deprecated, do not use */
  468. #define DRM_MODE_PROP_RANGE (1<<1)
  469. #define DRM_MODE_PROP_IMMUTABLE (1<<2)
  470. #define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */
  471. #define DRM_MODE_PROP_BLOB (1<<4)
  472. #define DRM_MODE_PROP_BITMASK (1<<5) /* bitmask of enumerated types */
  473. /* non-extended types: legacy bitmask, one bit per type: */
  474. #define DRM_MODE_PROP_LEGACY_TYPE ( \
  475. DRM_MODE_PROP_RANGE | \
  476. DRM_MODE_PROP_ENUM | \
  477. DRM_MODE_PROP_BLOB | \
  478. DRM_MODE_PROP_BITMASK)
  479. /* extended-types: rather than continue to consume a bit per type,
  480. * grab a chunk of the bits to use as integer type id.
  481. */
  482. #define DRM_MODE_PROP_EXTENDED_TYPE 0x0000ffc0
  483. #define DRM_MODE_PROP_TYPE(n) ((n) << 6)
  484. #define DRM_MODE_PROP_OBJECT DRM_MODE_PROP_TYPE(1)
  485. #define DRM_MODE_PROP_SIGNED_RANGE DRM_MODE_PROP_TYPE(2)
  486. /* the PROP_ATOMIC flag is used to hide properties from userspace that
  487. * is not aware of atomic properties. This is mostly to work around
  488. * older userspace (DDX drivers) that read/write each prop they find,
  489. * witout being aware that this could be triggering a lengthy modeset.
  490. */
  491. #define DRM_MODE_PROP_ATOMIC 0x80000000
  492. /**
  493. * struct drm_mode_property_enum - Description for an enum/bitfield entry.
  494. * @value: numeric value for this enum entry.
  495. * @name: symbolic name for this enum entry.
  496. *
  497. * See struct drm_property_enum for details.
  498. */
  499. struct drm_mode_property_enum {
  500. __u64 value;
  501. char name[DRM_PROP_NAME_LEN];
  502. };
  503. /**
  504. * struct drm_mode_get_property - Get property metadata.
  505. *
  506. * User-space can perform a GETPROPERTY ioctl to retrieve information about a
  507. * property. The same property may be attached to multiple objects, see
  508. * "Modeset Base Object Abstraction".
  509. *
  510. * The meaning of the @values_ptr field changes depending on the property type.
  511. * See &drm_property.flags for more details.
  512. *
  513. * The @enum_blob_ptr and @count_enum_blobs fields are only meaningful when the
  514. * property has the type &DRM_MODE_PROP_ENUM or &DRM_MODE_PROP_BITMASK. For
  515. * backwards compatibility, the kernel will always set @count_enum_blobs to
  516. * zero when the property has the type &DRM_MODE_PROP_BLOB. User-space must
  517. * ignore these two fields if the property has a different type.
  518. *
  519. * User-space is expected to retrieve values and enums by performing this ioctl
  520. * at least twice: the first time to retrieve the number of elements, the
  521. * second time to retrieve the elements themselves.
  522. *
  523. * To retrieve the number of elements, set @count_values and @count_enum_blobs
  524. * to zero, then call the ioctl. @count_values will be updated with the number
  525. * of elements. If the property has the type &DRM_MODE_PROP_ENUM or
  526. * &DRM_MODE_PROP_BITMASK, @count_enum_blobs will be updated as well.
  527. *
  528. * To retrieve the elements themselves, allocate an array for @values_ptr and
  529. * set @count_values to its capacity. If the property has the type
  530. * &DRM_MODE_PROP_ENUM or &DRM_MODE_PROP_BITMASK, allocate an array for
  531. * @enum_blob_ptr and set @count_enum_blobs to its capacity. Calling the ioctl
  532. * again will fill the arrays.
  533. */
  534. struct drm_mode_get_property {
  535. /** @values_ptr: Pointer to a ``__u64`` array. */
  536. __u64 values_ptr;
  537. /** @enum_blob_ptr: Pointer to a struct drm_mode_property_enum array. */
  538. __u64 enum_blob_ptr;
  539. /**
  540. * @prop_id: Object ID of the property which should be retrieved. Set
  541. * by the caller.
  542. */
  543. __u32 prop_id;
  544. /**
  545. * @flags: ``DRM_MODE_PROP_*`` bitfield. See &drm_property.flags for
  546. * a definition of the flags.
  547. */
  548. __u32 flags;
  549. /**
  550. * @name: Symbolic property name. User-space should use this field to
  551. * recognize properties.
  552. */
  553. char name[DRM_PROP_NAME_LEN];
  554. /** @count_values: Number of elements in @values_ptr. */
  555. __u32 count_values;
  556. /** @count_enum_blobs: Number of elements in @enum_blob_ptr. */
  557. __u32 count_enum_blobs;
  558. };
  559. struct drm_mode_connector_set_property {
  560. __u64 value;
  561. __u32 prop_id;
  562. __u32 connector_id;
  563. };
  564. #define DRM_MODE_OBJECT_CRTC 0xcccccccc
  565. #define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
  566. #define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0
  567. #define DRM_MODE_OBJECT_MODE 0xdededede
  568. #define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
  569. #define DRM_MODE_OBJECT_FB 0xfbfbfbfb
  570. #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
  571. #define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
  572. #define DRM_MODE_OBJECT_ANY 0
  573. struct drm_mode_obj_get_properties {
  574. __u64 props_ptr;
  575. __u64 prop_values_ptr;
  576. __u32 count_props;
  577. __u32 obj_id;
  578. __u32 obj_type;
  579. };
  580. struct drm_mode_obj_set_property {
  581. __u64 value;
  582. __u32 prop_id;
  583. __u32 obj_id;
  584. __u32 obj_type;
  585. };
  586. struct drm_mode_get_blob {
  587. __u32 blob_id;
  588. __u32 length;
  589. __u64 data;
  590. };
  591. struct drm_mode_fb_cmd {
  592. __u32 fb_id;
  593. __u32 width;
  594. __u32 height;
  595. __u32 pitch;
  596. __u32 bpp;
  597. __u32 depth;
  598. /* driver specific handle */
  599. __u32 handle;
  600. };
  601. #define DRM_MODE_FB_INTERLACED (1<<0) /* for interlaced framebuffers */
  602. #define DRM_MODE_FB_MODIFIERS (1<<1) /* enables ->modifer[] */
  603. /**
  604. * struct drm_mode_fb_cmd2 - Frame-buffer metadata.
  605. *
  606. * This struct holds frame-buffer metadata. There are two ways to use it:
  607. *
  608. * - User-space can fill this struct and perform a &DRM_IOCTL_MODE_ADDFB2
  609. * ioctl to register a new frame-buffer. The new frame-buffer object ID will
  610. * be set by the kernel in @fb_id.
  611. * - User-space can set @fb_id and perform a &DRM_IOCTL_MODE_GETFB2 ioctl to
  612. * fetch metadata about an existing frame-buffer.
  613. *
  614. * In case of planar formats, this struct allows up to 4 buffer objects with
  615. * offsets and pitches per plane. The pitch and offset order are dictated by
  616. * the format FourCC as defined by ``drm_fourcc.h``, e.g. NV12 is described as:
  617. *
  618. * YUV 4:2:0 image with a plane of 8-bit Y samples followed by an
  619. * interleaved U/V plane containing 8-bit 2x2 subsampled colour difference
  620. * samples.
  621. *
  622. * So it would consist of a Y plane at ``offsets[0]`` and a UV plane at
  623. * ``offsets[1]``.
  624. *
  625. * To accommodate tiled, compressed, etc formats, a modifier can be specified.
  626. * For more information see the "Format Modifiers" section. Note that even
  627. * though it looks like we have a modifier per-plane, we in fact do not. The
  628. * modifier for each plane must be identical. Thus all combinations of
  629. * different data layouts for multi-plane formats must be enumerated as
  630. * separate modifiers.
  631. *
  632. * All of the entries in @handles, @pitches, @offsets and @modifier must be
  633. * zero when unused. Warning, for @offsets and @modifier zero can't be used to
  634. * figure out whether the entry is used or not since it's a valid value (a zero
  635. * offset is common, and a zero modifier is &DRM_FORMAT_MOD_LINEAR).
  636. */
  637. struct drm_mode_fb_cmd2 {
  638. /** @fb_id: Object ID of the frame-buffer. */
  639. __u32 fb_id;
  640. /** @width: Width of the frame-buffer. */
  641. __u32 width;
  642. /** @height: Height of the frame-buffer. */
  643. __u32 height;
  644. /**
  645. * @pixel_format: FourCC format code, see ``DRM_FORMAT_*`` constants in
  646. * ``drm_fourcc.h``.
  647. */
  648. __u32 pixel_format;
  649. /**
  650. * @flags: Frame-buffer flags (see &DRM_MODE_FB_INTERLACED and
  651. * &DRM_MODE_FB_MODIFIERS).
  652. */
  653. __u32 flags;
  654. /**
  655. * @handles: GEM buffer handle, one per plane. Set to 0 if the plane is
  656. * unused. The same handle can be used for multiple planes.
  657. */
  658. __u32 handles[4];
  659. /** @pitches: Pitch (aka. stride) in bytes, one per plane. */
  660. __u32 pitches[4];
  661. /** @offsets: Offset into the buffer in bytes, one per plane. */
  662. __u32 offsets[4];
  663. /**
  664. * @modifier: Format modifier, one per plane. See ``DRM_FORMAT_MOD_*``
  665. * constants in ``drm_fourcc.h``. All planes must use the same
  666. * modifier. Ignored unless &DRM_MODE_FB_MODIFIERS is set in @flags.
  667. */
  668. __u64 modifier[4];
  669. };
  670. #define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01
  671. #define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02
  672. #define DRM_MODE_FB_DIRTY_FLAGS 0x03
  673. #define DRM_MODE_FB_DIRTY_MAX_CLIPS 256
  674. /*
  675. * Mark a region of a framebuffer as dirty.
  676. *
  677. * Some hardware does not automatically update display contents
  678. * as a hardware or software draw to a framebuffer. This ioctl
  679. * allows userspace to tell the kernel and the hardware what
  680. * regions of the framebuffer have changed.
  681. *
  682. * The kernel or hardware is free to update more then just the
  683. * region specified by the clip rects. The kernel or hardware
  684. * may also delay and/or coalesce several calls to dirty into a
  685. * single update.
  686. *
  687. * Userspace may annotate the updates, the annotates are a
  688. * promise made by the caller that the change is either a copy
  689. * of pixels or a fill of a single color in the region specified.
  690. *
  691. * If the DRM_MODE_FB_DIRTY_ANNOTATE_COPY flag is given then
  692. * the number of updated regions are half of num_clips given,
  693. * where the clip rects are paired in src and dst. The width and
  694. * height of each one of the pairs must match.
  695. *
  696. * If the DRM_MODE_FB_DIRTY_ANNOTATE_FILL flag is given the caller
  697. * promises that the region specified of the clip rects is filled
  698. * completely with a single color as given in the color argument.
  699. */
  700. struct drm_mode_fb_dirty_cmd {
  701. __u32 fb_id;
  702. __u32 flags;
  703. __u32 color;
  704. __u32 num_clips;
  705. __u64 clips_ptr;
  706. };
  707. struct drm_mode_mode_cmd {
  708. __u32 connector_id;
  709. struct drm_mode_modeinfo mode;
  710. };
  711. #define DRM_MODE_CURSOR_BO 0x01
  712. #define DRM_MODE_CURSOR_MOVE 0x02
  713. #define DRM_MODE_CURSOR_FLAGS 0x03
  714. /*
  715. * depending on the value in flags different members are used.
  716. *
  717. * CURSOR_BO uses
  718. * crtc_id
  719. * width
  720. * height
  721. * handle - if 0 turns the cursor off
  722. *
  723. * CURSOR_MOVE uses
  724. * crtc_id
  725. * x
  726. * y
  727. */
  728. struct drm_mode_cursor {
  729. __u32 flags;
  730. __u32 crtc_id;
  731. __s32 x;
  732. __s32 y;
  733. __u32 width;
  734. __u32 height;
  735. /* driver specific handle */
  736. __u32 handle;
  737. };
  738. struct drm_mode_cursor2 {
  739. __u32 flags;
  740. __u32 crtc_id;
  741. __s32 x;
  742. __s32 y;
  743. __u32 width;
  744. __u32 height;
  745. /* driver specific handle */
  746. __u32 handle;
  747. __s32 hot_x;
  748. __s32 hot_y;
  749. };
  750. struct drm_mode_crtc_lut {
  751. __u32 crtc_id;
  752. __u32 gamma_size;
  753. /* pointers to arrays */
  754. __u64 red;
  755. __u64 green;
  756. __u64 blue;
  757. };
  758. struct drm_color_ctm {
  759. /*
  760. * Conversion matrix in S31.32 sign-magnitude
  761. * (not two's complement!) format.
  762. *
  763. * out matrix in
  764. * |R| |0 1 2| |R|
  765. * |G| = |3 4 5| x |G|
  766. * |B| |6 7 8| |B|
  767. */
  768. __u64 matrix[9];
  769. };
  770. struct drm_color_lut {
  771. /*
  772. * Values are mapped linearly to 0.0 - 1.0 range, with 0x0 == 0.0 and
  773. * 0xffff == 1.0.
  774. */
  775. __u16 red;
  776. __u16 green;
  777. __u16 blue;
  778. __u16 reserved;
  779. };
  780. /**
  781. * struct hdr_metadata_infoframe - HDR Metadata Infoframe Data.
  782. *
  783. * HDR Metadata Infoframe as per CTA 861.G spec. This is expected
  784. * to match exactly with the spec.
  785. *
  786. * Userspace is expected to pass the metadata information as per
  787. * the format described in this structure.
  788. */
  789. struct hdr_metadata_infoframe {
  790. /**
  791. * @eotf: Electro-Optical Transfer Function (EOTF)
  792. * used in the stream.
  793. */
  794. __u8 eotf;
  795. /**
  796. * @metadata_type: Static_Metadata_Descriptor_ID.
  797. */
  798. __u8 metadata_type;
  799. /**
  800. * @display_primaries: Color Primaries of the Data.
  801. * These are coded as unsigned 16-bit values in units of
  802. * 0.00002, where 0x0000 represents zero and 0xC350
  803. * represents 1.0000.
  804. * @display_primaries.x: X cordinate of color primary.
  805. * @display_primaries.y: Y cordinate of color primary.
  806. */
  807. struct {
  808. __u16 x, y;
  809. } display_primaries[3];
  810. /**
  811. * @white_point: White Point of Colorspace Data.
  812. * These are coded as unsigned 16-bit values in units of
  813. * 0.00002, where 0x0000 represents zero and 0xC350
  814. * represents 1.0000.
  815. * @white_point.x: X cordinate of whitepoint of color primary.
  816. * @white_point.y: Y cordinate of whitepoint of color primary.
  817. */
  818. struct {
  819. __u16 x, y;
  820. } white_point;
  821. /**
  822. * @max_display_mastering_luminance: Max Mastering Display Luminance.
  823. * This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
  824. * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
  825. */
  826. __u16 max_display_mastering_luminance;
  827. /**
  828. * @min_display_mastering_luminance: Min Mastering Display Luminance.
  829. * This value is coded as an unsigned 16-bit value in units of
  830. * 0.0001 cd/m2, where 0x0001 represents 0.0001 cd/m2 and 0xFFFF
  831. * represents 6.5535 cd/m2.
  832. */
  833. __u16 min_display_mastering_luminance;
  834. /**
  835. * @max_cll: Max Content Light Level.
  836. * This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
  837. * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
  838. */
  839. __u16 max_cll;
  840. /**
  841. * @max_fall: Max Frame Average Light Level.
  842. * This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
  843. * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
  844. */
  845. __u16 max_fall;
  846. };
  847. /**
  848. * struct hdr_output_metadata - HDR output metadata
  849. *
  850. * Metadata Information to be passed from userspace
  851. */
  852. struct hdr_output_metadata {
  853. /**
  854. * @metadata_type: Static_Metadata_Descriptor_ID.
  855. */
  856. __u32 metadata_type;
  857. /**
  858. * @hdmi_metadata_type1: HDR Metadata Infoframe.
  859. */
  860. union {
  861. struct hdr_metadata_infoframe hdmi_metadata_type1;
  862. };
  863. };
  864. /**
  865. * DRM_MODE_PAGE_FLIP_EVENT
  866. *
  867. * Request that the kernel sends back a vblank event (see
  868. * struct drm_event_vblank) with the &DRM_EVENT_FLIP_COMPLETE type when the
  869. * page-flip is done.
  870. */
  871. #define DRM_MODE_PAGE_FLIP_EVENT 0x01
  872. /**
  873. * DRM_MODE_PAGE_FLIP_ASYNC
  874. *
  875. * Request that the page-flip is performed as soon as possible, ie. with no
  876. * delay due to waiting for vblank. This may cause tearing to be visible on
  877. * the screen.
  878. */
  879. #define DRM_MODE_PAGE_FLIP_ASYNC 0x02
  880. #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
  881. #define DRM_MODE_PAGE_FLIP_TARGET_RELATIVE 0x8
  882. #define DRM_MODE_PAGE_FLIP_TARGET (DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE | \
  883. DRM_MODE_PAGE_FLIP_TARGET_RELATIVE)
  884. /**
  885. * DRM_MODE_PAGE_FLIP_FLAGS
  886. *
  887. * Bitmask of flags suitable for &drm_mode_crtc_page_flip_target.flags.
  888. */
  889. #define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT | \
  890. DRM_MODE_PAGE_FLIP_ASYNC | \
  891. DRM_MODE_PAGE_FLIP_TARGET)
  892. /*
  893. * Request a page flip on the specified crtc.
  894. *
  895. * This ioctl will ask KMS to schedule a page flip for the specified
  896. * crtc. Once any pending rendering targeting the specified fb (as of
  897. * ioctl time) has completed, the crtc will be reprogrammed to display
  898. * that fb after the next vertical refresh. The ioctl returns
  899. * immediately, but subsequent rendering to the current fb will block
  900. * in the execbuffer ioctl until the page flip happens. If a page
  901. * flip is already pending as the ioctl is called, EBUSY will be
  902. * returned.
  903. *
  904. * Flag DRM_MODE_PAGE_FLIP_EVENT requests that drm sends back a vblank
  905. * event (see drm.h: struct drm_event_vblank) when the page flip is
  906. * done. The user_data field passed in with this ioctl will be
  907. * returned as the user_data field in the vblank event struct.
  908. *
  909. * Flag DRM_MODE_PAGE_FLIP_ASYNC requests that the flip happen
  910. * 'as soon as possible', meaning that it not delay waiting for vblank.
  911. * This may cause tearing on the screen.
  912. *
  913. * The reserved field must be zero.
  914. */
  915. struct drm_mode_crtc_page_flip {
  916. __u32 crtc_id;
  917. __u32 fb_id;
  918. __u32 flags;
  919. __u32 reserved;
  920. __u64 user_data;
  921. };
  922. /*
  923. * Request a page flip on the specified crtc.
  924. *
  925. * Same as struct drm_mode_crtc_page_flip, but supports new flags and
  926. * re-purposes the reserved field:
  927. *
  928. * The sequence field must be zero unless either of the
  929. * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is specified. When
  930. * the ABSOLUTE flag is specified, the sequence field denotes the absolute
  931. * vblank sequence when the flip should take effect. When the RELATIVE
  932. * flag is specified, the sequence field denotes the relative (to the
  933. * current one when the ioctl is called) vblank sequence when the flip
  934. * should take effect. NOTE: DRM_IOCTL_WAIT_VBLANK must still be used to
  935. * make sure the vblank sequence before the target one has passed before
  936. * calling this ioctl. The purpose of the
  937. * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is merely to clarify
  938. * the target for when code dealing with a page flip runs during a
  939. * vertical blank period.
  940. */
  941. struct drm_mode_crtc_page_flip_target {
  942. __u32 crtc_id;
  943. __u32 fb_id;
  944. __u32 flags;
  945. __u32 sequence;
  946. __u64 user_data;
  947. };
  948. /* create a dumb scanout buffer */
  949. struct drm_mode_create_dumb {
  950. __u32 height;
  951. __u32 width;
  952. __u32 bpp;
  953. __u32 flags;
  954. /* handle, pitch, size will be returned */
  955. __u32 handle;
  956. __u32 pitch;
  957. __u64 size;
  958. };
  959. /* set up for mmap of a dumb scanout buffer */
  960. struct drm_mode_map_dumb {
  961. /** Handle for the object being mapped. */
  962. __u32 handle;
  963. __u32 pad;
  964. /**
  965. * Fake offset to use for subsequent mmap call
  966. *
  967. * This is a fixed-size type for 32/64 compatibility.
  968. */
  969. __u64 offset;
  970. };
  971. struct drm_mode_destroy_dumb {
  972. __u32 handle;
  973. };
  974. /**
  975. * DRM_MODE_ATOMIC_TEST_ONLY
  976. *
  977. * Do not apply the atomic commit, instead check whether the hardware supports
  978. * this configuration.
  979. *
  980. * See &drm_mode_config_funcs.atomic_check for more details on test-only
  981. * commits.
  982. */
  983. #define DRM_MODE_ATOMIC_TEST_ONLY 0x0100
  984. /**
  985. * DRM_MODE_ATOMIC_NONBLOCK
  986. *
  987. * Do not block while applying the atomic commit. The &DRM_IOCTL_MODE_ATOMIC
  988. * IOCTL returns immediately instead of waiting for the changes to be applied
  989. * in hardware. Note, the driver will still check that the update can be
  990. * applied before retuning.
  991. */
  992. #define DRM_MODE_ATOMIC_NONBLOCK 0x0200
  993. /**
  994. * DRM_MODE_ATOMIC_ALLOW_MODESET
  995. *
  996. * Allow the update to result in temporary or transient visible artifacts while
  997. * the update is being applied. Applying the update may also take significantly
  998. * more time than a page flip. All visual artifacts will disappear by the time
  999. * the update is completed, as signalled through the vblank event's timestamp
  1000. * (see struct drm_event_vblank).
  1001. *
  1002. * This flag must be set when the KMS update might cause visible artifacts.
  1003. * Without this flag such KMS update will return a EINVAL error. What kind of
  1004. * update may cause visible artifacts depends on the driver and the hardware.
  1005. * User-space that needs to know beforehand if an update might cause visible
  1006. * artifacts can use &DRM_MODE_ATOMIC_TEST_ONLY without
  1007. * &DRM_MODE_ATOMIC_ALLOW_MODESET to see if it fails.
  1008. *
  1009. * To the best of the driver's knowledge, visual artifacts are guaranteed to
  1010. * not appear when this flag is not set. Some sinks might display visual
  1011. * artifacts outside of the driver's control.
  1012. */
  1013. #define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400
  1014. /**
  1015. * DRM_MODE_ATOMIC_FLAGS
  1016. *
  1017. * Bitfield of flags accepted by the &DRM_IOCTL_MODE_ATOMIC IOCTL in
  1018. * &drm_mode_atomic.flags.
  1019. */
  1020. #define DRM_MODE_ATOMIC_FLAGS (\
  1021. DRM_MODE_PAGE_FLIP_EVENT |\
  1022. DRM_MODE_PAGE_FLIP_ASYNC |\
  1023. DRM_MODE_ATOMIC_TEST_ONLY |\
  1024. DRM_MODE_ATOMIC_NONBLOCK |\
  1025. DRM_MODE_ATOMIC_ALLOW_MODESET)
  1026. struct drm_mode_atomic {
  1027. __u32 flags;
  1028. __u32 count_objs;
  1029. __u64 objs_ptr;
  1030. __u64 count_props_ptr;
  1031. __u64 props_ptr;
  1032. __u64 prop_values_ptr;
  1033. __u64 reserved;
  1034. __u64 user_data;
  1035. };
  1036. struct drm_format_modifier_blob {
  1037. #define FORMAT_BLOB_CURRENT 1
  1038. /* Version of this blob format */
  1039. __u32 version;
  1040. /* Flags */
  1041. __u32 flags;
  1042. /* Number of fourcc formats supported */
  1043. __u32 count_formats;
  1044. /* Where in this blob the formats exist (in bytes) */
  1045. __u32 formats_offset;
  1046. /* Number of drm_format_modifiers */
  1047. __u32 count_modifiers;
  1048. /* Where in this blob the modifiers exist (in bytes) */
  1049. __u32 modifiers_offset;
  1050. /* __u32 formats[] */
  1051. /* struct drm_format_modifier modifiers[] */
  1052. };
  1053. struct drm_format_modifier {
  1054. /* Bitmask of formats in get_plane format list this info applies to. The
  1055. * offset allows a sliding window of which 64 formats (bits).
  1056. *
  1057. * Some examples:
  1058. * In today's world with < 65 formats, and formats 0, and 2 are
  1059. * supported
  1060. * 0x0000000000000005
  1061. * ^-offset = 0, formats = 5
  1062. *
  1063. * If the number formats grew to 128, and formats 98-102 are
  1064. * supported with the modifier:
  1065. *
  1066. * 0x0000007c00000000 0000000000000000
  1067. * ^
  1068. * |__offset = 64, formats = 0x7c00000000
  1069. *
  1070. */
  1071. __u64 formats;
  1072. __u32 offset;
  1073. __u32 pad;
  1074. /* The modifier that applies to the >get_plane format list bitmask. */
  1075. __u64 modifier;
  1076. };
  1077. /**
  1078. * struct drm_mode_create_blob - Create New blob property
  1079. *
  1080. * Create a new 'blob' data property, copying length bytes from data pointer,
  1081. * and returning new blob ID.
  1082. */
  1083. struct drm_mode_create_blob {
  1084. /** @data: Pointer to data to copy. */
  1085. __u64 data;
  1086. /** @length: Length of data to copy. */
  1087. __u32 length;
  1088. /** @blob_id: Return: new property ID. */
  1089. __u32 blob_id;
  1090. };
  1091. /**
  1092. * struct drm_mode_destroy_blob - Destroy user blob
  1093. * @blob_id: blob_id to destroy
  1094. *
  1095. * Destroy a user-created blob property.
  1096. *
  1097. * User-space can release blobs as soon as they do not need to refer to them by
  1098. * their blob object ID. For instance, if you are using a MODE_ID blob in an
  1099. * atomic commit and you will not make another commit re-using the same ID, you
  1100. * can destroy the blob as soon as the commit has been issued, without waiting
  1101. * for it to complete.
  1102. */
  1103. struct drm_mode_destroy_blob {
  1104. __u32 blob_id;
  1105. };
  1106. /**
  1107. * struct drm_mode_create_lease - Create lease
  1108. *
  1109. * Lease mode resources, creating another drm_master.
  1110. *
  1111. * The @object_ids array must reference at least one CRTC, one connector and
  1112. * one plane if &DRM_CLIENT_CAP_UNIVERSAL_PLANES is enabled. Alternatively,
  1113. * the lease can be completely empty.
  1114. */
  1115. struct drm_mode_create_lease {
  1116. /** @object_ids: Pointer to array of object ids (__u32) */
  1117. __u64 object_ids;
  1118. /** @object_count: Number of object ids */
  1119. __u32 object_count;
  1120. /** @flags: flags for new FD (O_CLOEXEC, etc) */
  1121. __u32 flags;
  1122. /** @lessee_id: Return: unique identifier for lessee. */
  1123. __u32 lessee_id;
  1124. /** @fd: Return: file descriptor to new drm_master file */
  1125. __u32 fd;
  1126. };
  1127. /**
  1128. * struct drm_mode_list_lessees - List lessees
  1129. *
  1130. * List lesses from a drm_master.
  1131. */
  1132. struct drm_mode_list_lessees {
  1133. /**
  1134. * @count_lessees: Number of lessees.
  1135. *
  1136. * On input, provides length of the array.
  1137. * On output, provides total number. No
  1138. * more than the input number will be written
  1139. * back, so two calls can be used to get
  1140. * the size and then the data.
  1141. */
  1142. __u32 count_lessees;
  1143. /** @pad: Padding. */
  1144. __u32 pad;
  1145. /**
  1146. * @lessees_ptr: Pointer to lessees.
  1147. *
  1148. * Pointer to __u64 array of lessee ids
  1149. */
  1150. __u64 lessees_ptr;
  1151. };
  1152. /**
  1153. * struct drm_mode_get_lease - Get Lease
  1154. *
  1155. * Get leased objects.
  1156. */
  1157. struct drm_mode_get_lease {
  1158. /**
  1159. * @count_objects: Number of leased objects.
  1160. *
  1161. * On input, provides length of the array.
  1162. * On output, provides total number. No
  1163. * more than the input number will be written
  1164. * back, so two calls can be used to get
  1165. * the size and then the data.
  1166. */
  1167. __u32 count_objects;
  1168. /** @pad: Padding. */
  1169. __u32 pad;
  1170. /**
  1171. * @objects_ptr: Pointer to objects.
  1172. *
  1173. * Pointer to __u32 array of object ids.
  1174. */
  1175. __u64 objects_ptr;
  1176. };
  1177. /**
  1178. * struct drm_mode_revoke_lease - Revoke lease
  1179. */
  1180. struct drm_mode_revoke_lease {
  1181. /** @lessee_id: Unique ID of lessee */
  1182. __u32 lessee_id;
  1183. };
  1184. /**
  1185. * struct drm_mode_rect - Two dimensional rectangle.
  1186. * @x1: Horizontal starting coordinate (inclusive).
  1187. * @y1: Vertical starting coordinate (inclusive).
  1188. * @x2: Horizontal ending coordinate (exclusive).
  1189. * @y2: Vertical ending coordinate (exclusive).
  1190. *
  1191. * With drm subsystem using struct drm_rect to manage rectangular area this
  1192. * export it to user-space.
  1193. *
  1194. * Currently used by drm_mode_atomic blob property FB_DAMAGE_CLIPS.
  1195. */
  1196. struct drm_mode_rect {
  1197. __s32 x1;
  1198. __s32 y1;
  1199. __s32 x2;
  1200. __s32 y2;
  1201. };
  1202. #if defined(__cplusplus)
  1203. }
  1204. #endif
  1205. #endif