drm_mode.h 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552
  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 definitions to have a consistent
  36. * and standardized interface with users.
  37. * Userspace can refer to these structure definitions and UAPI formats
  38. * to communicate to drivers.
  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. * without 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_COLOROP 0xfafafafa
  573. #define DRM_MODE_OBJECT_ANY 0
  574. struct drm_mode_obj_get_properties {
  575. __u64 props_ptr;
  576. __u64 prop_values_ptr;
  577. __u32 count_props;
  578. __u32 obj_id;
  579. __u32 obj_type;
  580. };
  581. struct drm_mode_obj_set_property {
  582. __u64 value;
  583. __u32 prop_id;
  584. __u32 obj_id;
  585. __u32 obj_type;
  586. };
  587. struct drm_mode_get_blob {
  588. __u32 blob_id;
  589. __u32 length;
  590. __u64 data;
  591. };
  592. struct drm_mode_fb_cmd {
  593. __u32 fb_id;
  594. __u32 width;
  595. __u32 height;
  596. __u32 pitch;
  597. __u32 bpp;
  598. __u32 depth;
  599. /* driver specific handle */
  600. __u32 handle;
  601. };
  602. #define DRM_MODE_FB_INTERLACED (1<<0) /* for interlaced framebuffers */
  603. #define DRM_MODE_FB_MODIFIERS (1<<1) /* enables ->modifier[] */
  604. /**
  605. * struct drm_mode_fb_cmd2 - Frame-buffer metadata.
  606. *
  607. * This struct holds frame-buffer metadata. There are two ways to use it:
  608. *
  609. * - User-space can fill this struct and perform a &DRM_IOCTL_MODE_ADDFB2
  610. * ioctl to register a new frame-buffer. The new frame-buffer object ID will
  611. * be set by the kernel in @fb_id.
  612. * - User-space can set @fb_id and perform a &DRM_IOCTL_MODE_GETFB2 ioctl to
  613. * fetch metadata about an existing frame-buffer.
  614. *
  615. * In case of planar formats, this struct allows up to 4 buffer objects with
  616. * offsets and pitches per plane. The pitch and offset order are dictated by
  617. * the format FourCC as defined by ``drm_fourcc.h``, e.g. NV12 is described as:
  618. *
  619. * YUV 4:2:0 image with a plane of 8-bit Y samples followed by an
  620. * interleaved U/V plane containing 8-bit 2x2 subsampled colour difference
  621. * samples.
  622. *
  623. * So it would consist of a Y plane at ``offsets[0]`` and a UV plane at
  624. * ``offsets[1]``.
  625. *
  626. * To accommodate tiled, compressed, etc formats, a modifier can be specified.
  627. * For more information see the "Format Modifiers" section. Note that even
  628. * though it looks like we have a modifier per-plane, we in fact do not. The
  629. * modifier for each plane must be identical. Thus all combinations of
  630. * different data layouts for multi-plane formats must be enumerated as
  631. * separate modifiers.
  632. *
  633. * All of the entries in @handles, @pitches, @offsets and @modifier must be
  634. * zero when unused. Warning, for @offsets and @modifier zero can't be used to
  635. * figure out whether the entry is used or not since it's a valid value (a zero
  636. * offset is common, and a zero modifier is &DRM_FORMAT_MOD_LINEAR).
  637. */
  638. struct drm_mode_fb_cmd2 {
  639. /** @fb_id: Object ID of the frame-buffer. */
  640. __u32 fb_id;
  641. /** @width: Width of the frame-buffer. */
  642. __u32 width;
  643. /** @height: Height of the frame-buffer. */
  644. __u32 height;
  645. /**
  646. * @pixel_format: FourCC format code, see ``DRM_FORMAT_*`` constants in
  647. * ``drm_fourcc.h``.
  648. */
  649. __u32 pixel_format;
  650. /**
  651. * @flags: Frame-buffer flags (see &DRM_MODE_FB_INTERLACED and
  652. * &DRM_MODE_FB_MODIFIERS).
  653. */
  654. __u32 flags;
  655. /**
  656. * @handles: GEM buffer handle, one per plane. Set to 0 if the plane is
  657. * unused. The same handle can be used for multiple planes.
  658. */
  659. __u32 handles[4];
  660. /** @pitches: Pitch (aka. stride) in bytes, one per plane. */
  661. __u32 pitches[4];
  662. /** @offsets: Offset into the buffer in bytes, one per plane. */
  663. __u32 offsets[4];
  664. /**
  665. * @modifier: Format modifier, one per plane. See ``DRM_FORMAT_MOD_*``
  666. * constants in ``drm_fourcc.h``. All planes must use the same
  667. * modifier. Ignored unless &DRM_MODE_FB_MODIFIERS is set in @flags.
  668. */
  669. __u64 modifier[4];
  670. };
  671. #define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01
  672. #define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02
  673. #define DRM_MODE_FB_DIRTY_FLAGS 0x03
  674. #define DRM_MODE_FB_DIRTY_MAX_CLIPS 256
  675. /*
  676. * Mark a region of a framebuffer as dirty.
  677. *
  678. * Some hardware does not automatically update display contents
  679. * as a hardware or software draw to a framebuffer. This ioctl
  680. * allows userspace to tell the kernel and the hardware what
  681. * regions of the framebuffer have changed.
  682. *
  683. * The kernel or hardware is free to update more then just the
  684. * region specified by the clip rects. The kernel or hardware
  685. * may also delay and/or coalesce several calls to dirty into a
  686. * single update.
  687. *
  688. * Userspace may annotate the updates, the annotates are a
  689. * promise made by the caller that the change is either a copy
  690. * of pixels or a fill of a single color in the region specified.
  691. *
  692. * If the DRM_MODE_FB_DIRTY_ANNOTATE_COPY flag is given then
  693. * the number of updated regions are half of num_clips given,
  694. * where the clip rects are paired in src and dst. The width and
  695. * height of each one of the pairs must match.
  696. *
  697. * If the DRM_MODE_FB_DIRTY_ANNOTATE_FILL flag is given the caller
  698. * promises that the region specified of the clip rects is filled
  699. * completely with a single color as given in the color argument.
  700. */
  701. struct drm_mode_fb_dirty_cmd {
  702. __u32 fb_id;
  703. __u32 flags;
  704. __u32 color;
  705. __u32 num_clips;
  706. __u64 clips_ptr;
  707. };
  708. struct drm_mode_mode_cmd {
  709. __u32 connector_id;
  710. struct drm_mode_modeinfo mode;
  711. };
  712. #define DRM_MODE_CURSOR_BO 0x01
  713. #define DRM_MODE_CURSOR_MOVE 0x02
  714. #define DRM_MODE_CURSOR_FLAGS 0x03
  715. /*
  716. * depending on the value in flags different members are used.
  717. *
  718. * CURSOR_BO uses
  719. * crtc_id
  720. * width
  721. * height
  722. * handle - if 0 turns the cursor off
  723. *
  724. * CURSOR_MOVE uses
  725. * crtc_id
  726. * x
  727. * y
  728. */
  729. struct drm_mode_cursor {
  730. __u32 flags;
  731. __u32 crtc_id;
  732. __s32 x;
  733. __s32 y;
  734. __u32 width;
  735. __u32 height;
  736. /* driver specific handle */
  737. __u32 handle;
  738. };
  739. struct drm_mode_cursor2 {
  740. __u32 flags;
  741. __u32 crtc_id;
  742. __s32 x;
  743. __s32 y;
  744. __u32 width;
  745. __u32 height;
  746. /* driver specific handle */
  747. __u32 handle;
  748. __s32 hot_x;
  749. __s32 hot_y;
  750. };
  751. struct drm_mode_crtc_lut {
  752. __u32 crtc_id;
  753. __u32 gamma_size;
  754. /* pointers to arrays */
  755. __u64 red;
  756. __u64 green;
  757. __u64 blue;
  758. };
  759. struct drm_color_ctm {
  760. /*
  761. * Conversion matrix in S31.32 sign-magnitude
  762. * (not two's complement!) format.
  763. *
  764. * out matrix in
  765. * |R| |0 1 2| |R|
  766. * |G| = |3 4 5| x |G|
  767. * |B| |6 7 8| |B|
  768. */
  769. __u64 matrix[9];
  770. };
  771. struct drm_color_ctm_3x4 {
  772. /*
  773. * Conversion matrix with 3x4 dimensions in S31.32 sign-magnitude
  774. * (not two's complement!) format.
  775. *
  776. * out matrix in
  777. * |R| |0 1 2 3 | | R |
  778. * |G| = |4 5 6 7 | x | G |
  779. * |B| |8 9 10 11| | B |
  780. * |1.0|
  781. */
  782. __u64 matrix[12];
  783. };
  784. struct drm_color_lut {
  785. /*
  786. * Values are mapped linearly to 0.0 - 1.0 range, with 0x0 == 0.0 and
  787. * 0xffff == 1.0.
  788. */
  789. __u16 red;
  790. __u16 green;
  791. __u16 blue;
  792. __u16 reserved;
  793. };
  794. /*
  795. * struct drm_color_lut32
  796. *
  797. * 32-bit per channel color LUT entry, similar to drm_color_lut.
  798. */
  799. struct drm_color_lut32 {
  800. __u32 red;
  801. __u32 green;
  802. __u32 blue;
  803. __u32 reserved;
  804. };
  805. /**
  806. * enum drm_colorop_type - Type of color operation
  807. *
  808. * drm_colorops can be of many different types. Each type behaves differently
  809. * and defines a different set of properties. This enum defines all types and
  810. * gives a high-level description.
  811. */
  812. enum drm_colorop_type {
  813. /**
  814. * @DRM_COLOROP_1D_CURVE:
  815. *
  816. * enum string "1D Curve"
  817. *
  818. * A 1D curve that is being applied to all color channels. The
  819. * curve is specified via the CURVE_1D_TYPE colorop property.
  820. */
  821. DRM_COLOROP_1D_CURVE,
  822. /**
  823. * @DRM_COLOROP_1D_LUT:
  824. *
  825. * enum string "1D LUT"
  826. *
  827. * A simple 1D LUT of uniformly spaced &drm_color_lut32 entries,
  828. * packed into a blob via the DATA property. The driver's
  829. * expected LUT size is advertised via the SIZE property.
  830. *
  831. * The DATA blob is an array of struct drm_color_lut32 with size
  832. * of "size".
  833. */
  834. DRM_COLOROP_1D_LUT,
  835. /**
  836. * @DRM_COLOROP_CTM_3X4:
  837. *
  838. * enum string "3x4 Matrix"
  839. *
  840. * A 3x4 matrix. Its values are specified via the
  841. * &drm_color_ctm_3x4 struct provided via the DATA property.
  842. *
  843. * The DATA blob is a float[12]:
  844. * out matrix in
  845. * | R | | 0 1 2 3 | | R |
  846. * | G | = | 4 5 6 7 | x | G |
  847. * | B | | 8 9 10 12 | | B |
  848. */
  849. DRM_COLOROP_CTM_3X4,
  850. /**
  851. * @DRM_COLOROP_MULTIPLIER:
  852. *
  853. * enum string "Multiplier"
  854. *
  855. * A simple multiplier, applied to all color values. The
  856. * multiplier is specified as a S31.32 via the MULTIPLIER
  857. * property.
  858. */
  859. DRM_COLOROP_MULTIPLIER,
  860. /**
  861. * @DRM_COLOROP_3D_LUT:
  862. *
  863. * enum string "3D LUT"
  864. *
  865. * A 3D LUT of &drm_color_lut32 entries,
  866. * packed into a blob via the DATA property. The driver's expected
  867. * LUT size is advertised via the SIZE property, i.e., a 3D LUT with
  868. * 17x17x17 entries will have SIZE set to 17.
  869. *
  870. * The DATA blob is a 3D array of struct drm_color_lut32 with dimension
  871. * length of "size".
  872. * The LUT elements are traversed like so:
  873. *
  874. * for B in range 0..n
  875. * for G in range 0..n
  876. * for R in range 0..n
  877. * index = R + n * (G + n * B)
  878. * color = lut3d[index]
  879. */
  880. DRM_COLOROP_3D_LUT,
  881. };
  882. /**
  883. * enum drm_colorop_lut3d_interpolation_type - type of 3DLUT interpolation
  884. */
  885. enum drm_colorop_lut3d_interpolation_type {
  886. /**
  887. * @DRM_COLOROP_LUT3D_INTERPOLATION_TETRAHEDRAL:
  888. *
  889. * Tetrahedral 3DLUT interpolation
  890. */
  891. DRM_COLOROP_LUT3D_INTERPOLATION_TETRAHEDRAL,
  892. };
  893. /**
  894. * enum drm_colorop_lut1d_interpolation_type - type of interpolation for 1D LUTs
  895. */
  896. enum drm_colorop_lut1d_interpolation_type {
  897. /**
  898. * @DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR:
  899. *
  900. * Linear interpolation. Values between points of the LUT will be
  901. * linearly interpolated.
  902. */
  903. DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR,
  904. };
  905. /**
  906. * struct drm_plane_size_hint - Plane size hints
  907. * @width: The width of the plane in pixel
  908. * @height: The height of the plane in pixel
  909. *
  910. * The plane SIZE_HINTS property blob contains an
  911. * array of struct drm_plane_size_hint.
  912. */
  913. struct drm_plane_size_hint {
  914. __u16 width;
  915. __u16 height;
  916. };
  917. /**
  918. * struct hdr_metadata_infoframe - HDR Metadata Infoframe Data.
  919. *
  920. * HDR Metadata Infoframe as per CTA 861.G spec. This is expected
  921. * to match exactly with the spec.
  922. *
  923. * Userspace is expected to pass the metadata information as per
  924. * the format described in this structure.
  925. */
  926. struct hdr_metadata_infoframe {
  927. /**
  928. * @eotf: Electro-Optical Transfer Function (EOTF)
  929. * used in the stream.
  930. */
  931. __u8 eotf;
  932. /**
  933. * @metadata_type: Static_Metadata_Descriptor_ID.
  934. */
  935. __u8 metadata_type;
  936. /**
  937. * @display_primaries: Color Primaries of the Data.
  938. * These are coded as unsigned 16-bit values in units of
  939. * 0.00002, where 0x0000 represents zero and 0xC350
  940. * represents 1.0000.
  941. * @display_primaries.x: X coordinate of color primary.
  942. * @display_primaries.y: Y coordinate of color primary.
  943. */
  944. struct {
  945. __u16 x, y;
  946. } display_primaries[3];
  947. /**
  948. * @white_point: White Point of Colorspace Data.
  949. * These are coded as unsigned 16-bit values in units of
  950. * 0.00002, where 0x0000 represents zero and 0xC350
  951. * represents 1.0000.
  952. * @white_point.x: X coordinate of whitepoint of color primary.
  953. * @white_point.y: Y coordinate of whitepoint of color primary.
  954. */
  955. struct {
  956. __u16 x, y;
  957. } white_point;
  958. /**
  959. * @max_display_mastering_luminance: Max Mastering Display Luminance.
  960. * This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
  961. * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
  962. */
  963. __u16 max_display_mastering_luminance;
  964. /**
  965. * @min_display_mastering_luminance: Min Mastering Display Luminance.
  966. * This value is coded as an unsigned 16-bit value in units of
  967. * 0.0001 cd/m2, where 0x0001 represents 0.0001 cd/m2 and 0xFFFF
  968. * represents 6.5535 cd/m2.
  969. */
  970. __u16 min_display_mastering_luminance;
  971. /**
  972. * @max_cll: Max Content Light Level.
  973. * This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
  974. * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
  975. */
  976. __u16 max_cll;
  977. /**
  978. * @max_fall: Max Frame Average Light Level.
  979. * This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
  980. * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
  981. */
  982. __u16 max_fall;
  983. };
  984. /**
  985. * struct hdr_output_metadata - HDR output metadata
  986. *
  987. * Metadata Information to be passed from userspace
  988. */
  989. struct hdr_output_metadata {
  990. /**
  991. * @metadata_type: Static_Metadata_Descriptor_ID.
  992. */
  993. __u32 metadata_type;
  994. /**
  995. * @hdmi_metadata_type1: HDR Metadata Infoframe.
  996. */
  997. union {
  998. struct hdr_metadata_infoframe hdmi_metadata_type1;
  999. };
  1000. };
  1001. /**
  1002. * DRM_MODE_PAGE_FLIP_EVENT
  1003. *
  1004. * Request that the kernel sends back a vblank event (see
  1005. * struct drm_event_vblank) with the &DRM_EVENT_FLIP_COMPLETE type when the
  1006. * page-flip is done.
  1007. *
  1008. * When used with atomic uAPI, one event will be delivered per CRTC included in
  1009. * the atomic commit. A CRTC is included in an atomic commit if one of its
  1010. * properties is set, or if a property is set on a connector or plane linked
  1011. * via the CRTC_ID property to the CRTC. At least one CRTC must be included,
  1012. * and all pulled in CRTCs must be either previously or newly powered on (in
  1013. * other words, a powered off CRTC which stays off cannot be included in the
  1014. * atomic commit).
  1015. */
  1016. #define DRM_MODE_PAGE_FLIP_EVENT 0x01
  1017. /**
  1018. * DRM_MODE_PAGE_FLIP_ASYNC
  1019. *
  1020. * Request that the page-flip is performed as soon as possible, ie. with no
  1021. * delay due to waiting for vblank. This may cause tearing to be visible on
  1022. * the screen.
  1023. *
  1024. * When used with atomic uAPI, the driver will return an error if the hardware
  1025. * doesn't support performing an asynchronous page-flip for this update.
  1026. * User-space should handle this, e.g. by falling back to a regular page-flip.
  1027. *
  1028. * Note, some hardware might need to perform one last synchronous page-flip
  1029. * before being able to switch to asynchronous page-flips. As an exception,
  1030. * the driver will return success even though that first page-flip is not
  1031. * asynchronous.
  1032. */
  1033. #define DRM_MODE_PAGE_FLIP_ASYNC 0x02
  1034. #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
  1035. #define DRM_MODE_PAGE_FLIP_TARGET_RELATIVE 0x8
  1036. #define DRM_MODE_PAGE_FLIP_TARGET (DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE | \
  1037. DRM_MODE_PAGE_FLIP_TARGET_RELATIVE)
  1038. /**
  1039. * DRM_MODE_PAGE_FLIP_FLAGS
  1040. *
  1041. * Bitmask of flags suitable for &drm_mode_crtc_page_flip_target.flags.
  1042. */
  1043. #define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT | \
  1044. DRM_MODE_PAGE_FLIP_ASYNC | \
  1045. DRM_MODE_PAGE_FLIP_TARGET)
  1046. /*
  1047. * Request a page flip on the specified crtc.
  1048. *
  1049. * This ioctl will ask KMS to schedule a page flip for the specified
  1050. * crtc. Once any pending rendering targeting the specified fb (as of
  1051. * ioctl time) has completed, the crtc will be reprogrammed to display
  1052. * that fb after the next vertical refresh. The ioctl returns
  1053. * immediately, but subsequent rendering to the current fb will block
  1054. * in the execbuffer ioctl until the page flip happens. If a page
  1055. * flip is already pending as the ioctl is called, EBUSY will be
  1056. * returned.
  1057. *
  1058. * Flag DRM_MODE_PAGE_FLIP_EVENT requests that drm sends back a vblank
  1059. * event (see drm.h: struct drm_event_vblank) when the page flip is
  1060. * done. The user_data field passed in with this ioctl will be
  1061. * returned as the user_data field in the vblank event struct.
  1062. *
  1063. * Flag DRM_MODE_PAGE_FLIP_ASYNC requests that the flip happen
  1064. * 'as soon as possible', meaning that it not delay waiting for vblank.
  1065. * This may cause tearing on the screen.
  1066. *
  1067. * The reserved field must be zero.
  1068. */
  1069. struct drm_mode_crtc_page_flip {
  1070. __u32 crtc_id;
  1071. __u32 fb_id;
  1072. __u32 flags;
  1073. __u32 reserved;
  1074. __u64 user_data;
  1075. };
  1076. /*
  1077. * Request a page flip on the specified crtc.
  1078. *
  1079. * Same as struct drm_mode_crtc_page_flip, but supports new flags and
  1080. * re-purposes the reserved field:
  1081. *
  1082. * The sequence field must be zero unless either of the
  1083. * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is specified. When
  1084. * the ABSOLUTE flag is specified, the sequence field denotes the absolute
  1085. * vblank sequence when the flip should take effect. When the RELATIVE
  1086. * flag is specified, the sequence field denotes the relative (to the
  1087. * current one when the ioctl is called) vblank sequence when the flip
  1088. * should take effect. NOTE: DRM_IOCTL_WAIT_VBLANK must still be used to
  1089. * make sure the vblank sequence before the target one has passed before
  1090. * calling this ioctl. The purpose of the
  1091. * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is merely to clarify
  1092. * the target for when code dealing with a page flip runs during a
  1093. * vertical blank period.
  1094. */
  1095. struct drm_mode_crtc_page_flip_target {
  1096. __u32 crtc_id;
  1097. __u32 fb_id;
  1098. __u32 flags;
  1099. __u32 sequence;
  1100. __u64 user_data;
  1101. };
  1102. /**
  1103. * struct drm_mode_create_dumb - Create a KMS dumb buffer for scanout.
  1104. * @height: buffer height in pixels
  1105. * @width: buffer width in pixels
  1106. * @bpp: color mode
  1107. * @flags: must be zero
  1108. * @handle: buffer object handle
  1109. * @pitch: number of bytes between two consecutive lines
  1110. * @size: size of the whole buffer in bytes
  1111. *
  1112. * User-space fills @height, @width, @bpp and @flags. If the IOCTL succeeds,
  1113. * the kernel fills @handle, @pitch and @size.
  1114. *
  1115. * The value of @bpp is a color-mode number describing a specific format
  1116. * or a variant thereof. The value often corresponds to the number of bits
  1117. * per pixel for most modes, although there are exceptions. Each color mode
  1118. * maps to a DRM format plus a number of modes with similar pixel layout.
  1119. * Framebuffer layout is always linear.
  1120. *
  1121. * Support for all modes and formats is optional. Even if dumb-buffer
  1122. * creation with a certain color mode succeeds, it is not guaranteed that
  1123. * the DRM driver supports any of the related formats. Most drivers support
  1124. * a color mode of 32 with a format of DRM_FORMAT_XRGB8888 on their primary
  1125. * plane.
  1126. *
  1127. * +------------+------------------------+------------------------+
  1128. * | Color mode | Framebuffer format | Compatible formats |
  1129. * +============+========================+========================+
  1130. * | 32 | * DRM_FORMAT_XRGB8888 | * DRM_FORMAT_BGRX8888 |
  1131. * | | | * DRM_FORMAT_RGBX8888 |
  1132. * | | | * DRM_FORMAT_XBGR8888 |
  1133. * +------------+------------------------+------------------------+
  1134. * | 24 | * DRM_FORMAT_RGB888 | * DRM_FORMAT_BGR888 |
  1135. * +------------+------------------------+------------------------+
  1136. * | 16 | * DRM_FORMAT_RGB565 | * DRM_FORMAT_BGR565 |
  1137. * +------------+------------------------+------------------------+
  1138. * | 15 | * DRM_FORMAT_XRGB1555 | * DRM_FORMAT_BGRX1555 |
  1139. * | | | * DRM_FORMAT_RGBX1555 |
  1140. * | | | * DRM_FORMAT_XBGR1555 |
  1141. * +------------+------------------------+------------------------+
  1142. * | 8 | * DRM_FORMAT_C8 | * DRM_FORMAT_D8 |
  1143. * | | | * DRM_FORMAT_R8 |
  1144. * +------------+------------------------+------------------------+
  1145. * | 4 | * DRM_FORMAT_C4 | * DRM_FORMAT_D4 |
  1146. * | | | * DRM_FORMAT_R4 |
  1147. * +------------+------------------------+------------------------+
  1148. * | 2 | * DRM_FORMAT_C2 | * DRM_FORMAT_D2 |
  1149. * | | | * DRM_FORMAT_R2 |
  1150. * +------------+------------------------+------------------------+
  1151. * | 1 | * DRM_FORMAT_C1 | * DRM_FORMAT_D1 |
  1152. * | | | * DRM_FORMAT_R1 |
  1153. * +------------+------------------------+------------------------+
  1154. *
  1155. * Color modes of 10, 12, 15, 30 and 64 are only supported for use by
  1156. * legacy user space. Please don't use them in new code. Other modes
  1157. * are not support.
  1158. *
  1159. * Do not attempt to allocate anything but linear framebuffer memory
  1160. * with single-plane RGB data. Allocation of other framebuffer
  1161. * layouts requires dedicated ioctls in the respective DRM driver.
  1162. */
  1163. struct drm_mode_create_dumb {
  1164. __u32 height;
  1165. __u32 width;
  1166. __u32 bpp;
  1167. __u32 flags;
  1168. __u32 handle;
  1169. __u32 pitch;
  1170. __u64 size;
  1171. };
  1172. /* set up for mmap of a dumb scanout buffer */
  1173. struct drm_mode_map_dumb {
  1174. /** Handle for the object being mapped. */
  1175. __u32 handle;
  1176. __u32 pad;
  1177. /**
  1178. * Fake offset to use for subsequent mmap call
  1179. *
  1180. * This is a fixed-size type for 32/64 compatibility.
  1181. */
  1182. __u64 offset;
  1183. };
  1184. struct drm_mode_destroy_dumb {
  1185. __u32 handle;
  1186. };
  1187. /**
  1188. * DRM_MODE_ATOMIC_TEST_ONLY
  1189. *
  1190. * Do not apply the atomic commit, instead check whether the hardware supports
  1191. * this configuration.
  1192. *
  1193. * See &drm_mode_config_funcs.atomic_check for more details on test-only
  1194. * commits.
  1195. */
  1196. #define DRM_MODE_ATOMIC_TEST_ONLY 0x0100
  1197. /**
  1198. * DRM_MODE_ATOMIC_NONBLOCK
  1199. *
  1200. * Do not block while applying the atomic commit. The &DRM_IOCTL_MODE_ATOMIC
  1201. * IOCTL returns immediately instead of waiting for the changes to be applied
  1202. * in hardware. Note, the driver will still check that the update can be
  1203. * applied before retuning.
  1204. */
  1205. #define DRM_MODE_ATOMIC_NONBLOCK 0x0200
  1206. /**
  1207. * DRM_MODE_ATOMIC_ALLOW_MODESET
  1208. *
  1209. * Allow the update to result in temporary or transient visible artifacts while
  1210. * the update is being applied. Applying the update may also take significantly
  1211. * more time than a page flip. All visual artifacts will disappear by the time
  1212. * the update is completed, as signalled through the vblank event's timestamp
  1213. * (see struct drm_event_vblank).
  1214. *
  1215. * This flag must be set when the KMS update might cause visible artifacts.
  1216. * Without this flag such KMS update will return a EINVAL error. What kind of
  1217. * update may cause visible artifacts depends on the driver and the hardware.
  1218. * User-space that needs to know beforehand if an update might cause visible
  1219. * artifacts can use &DRM_MODE_ATOMIC_TEST_ONLY without
  1220. * &DRM_MODE_ATOMIC_ALLOW_MODESET to see if it fails.
  1221. *
  1222. * To the best of the driver's knowledge, visual artifacts are guaranteed to
  1223. * not appear when this flag is not set. Some sinks might display visual
  1224. * artifacts outside of the driver's control.
  1225. */
  1226. #define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400
  1227. /**
  1228. * DRM_MODE_ATOMIC_FLAGS
  1229. *
  1230. * Bitfield of flags accepted by the &DRM_IOCTL_MODE_ATOMIC IOCTL in
  1231. * &drm_mode_atomic.flags.
  1232. */
  1233. #define DRM_MODE_ATOMIC_FLAGS (\
  1234. DRM_MODE_PAGE_FLIP_EVENT |\
  1235. DRM_MODE_PAGE_FLIP_ASYNC |\
  1236. DRM_MODE_ATOMIC_TEST_ONLY |\
  1237. DRM_MODE_ATOMIC_NONBLOCK |\
  1238. DRM_MODE_ATOMIC_ALLOW_MODESET)
  1239. struct drm_mode_atomic {
  1240. __u32 flags;
  1241. __u32 count_objs;
  1242. __u64 objs_ptr;
  1243. __u64 count_props_ptr;
  1244. __u64 props_ptr;
  1245. __u64 prop_values_ptr;
  1246. __u64 reserved;
  1247. __u64 user_data;
  1248. };
  1249. struct drm_format_modifier_blob {
  1250. #define FORMAT_BLOB_CURRENT 1
  1251. /* Version of this blob format */
  1252. __u32 version;
  1253. /* Flags */
  1254. __u32 flags;
  1255. /* Number of fourcc formats supported */
  1256. __u32 count_formats;
  1257. /* Where in this blob the formats exist (in bytes) */
  1258. __u32 formats_offset;
  1259. /* Number of drm_format_modifiers */
  1260. __u32 count_modifiers;
  1261. /* Where in this blob the modifiers exist (in bytes) */
  1262. __u32 modifiers_offset;
  1263. /* __u32 formats[] */
  1264. /* struct drm_format_modifier modifiers[] */
  1265. };
  1266. struct drm_format_modifier {
  1267. /* Bitmask of formats in get_plane format list this info applies to. The
  1268. * offset allows a sliding window of which 64 formats (bits).
  1269. *
  1270. * Some examples:
  1271. * In today's world with < 65 formats, and formats 0, and 2 are
  1272. * supported
  1273. * 0x0000000000000005
  1274. * ^-offset = 0, formats = 5
  1275. *
  1276. * If the number formats grew to 128, and formats 98-102 are
  1277. * supported with the modifier:
  1278. *
  1279. * 0x0000007c00000000 0000000000000000
  1280. * ^
  1281. * |__offset = 64, formats = 0x7c00000000
  1282. *
  1283. */
  1284. __u64 formats;
  1285. __u32 offset;
  1286. __u32 pad;
  1287. /* The modifier that applies to the >get_plane format list bitmask. */
  1288. __u64 modifier;
  1289. };
  1290. /**
  1291. * struct drm_mode_create_blob - Create New blob property
  1292. *
  1293. * Create a new 'blob' data property, copying length bytes from data pointer,
  1294. * and returning new blob ID.
  1295. */
  1296. struct drm_mode_create_blob {
  1297. /** @data: Pointer to data to copy. */
  1298. __u64 data;
  1299. /** @length: Length of data to copy. */
  1300. __u32 length;
  1301. /** @blob_id: Return: new property ID. */
  1302. __u32 blob_id;
  1303. };
  1304. /**
  1305. * struct drm_mode_destroy_blob - Destroy user blob
  1306. * @blob_id: blob_id to destroy
  1307. *
  1308. * Destroy a user-created blob property.
  1309. *
  1310. * User-space can release blobs as soon as they do not need to refer to them by
  1311. * their blob object ID. For instance, if you are using a MODE_ID blob in an
  1312. * atomic commit and you will not make another commit re-using the same ID, you
  1313. * can destroy the blob as soon as the commit has been issued, without waiting
  1314. * for it to complete.
  1315. */
  1316. struct drm_mode_destroy_blob {
  1317. __u32 blob_id;
  1318. };
  1319. /**
  1320. * struct drm_mode_create_lease - Create lease
  1321. *
  1322. * Lease mode resources, creating another drm_master.
  1323. *
  1324. * The @object_ids array must reference at least one CRTC, one connector and
  1325. * one plane if &DRM_CLIENT_CAP_UNIVERSAL_PLANES is enabled. Alternatively,
  1326. * the lease can be completely empty.
  1327. */
  1328. struct drm_mode_create_lease {
  1329. /** @object_ids: Pointer to array of object ids (__u32) */
  1330. __u64 object_ids;
  1331. /** @object_count: Number of object ids */
  1332. __u32 object_count;
  1333. /** @flags: flags for new FD (O_CLOEXEC, etc) */
  1334. __u32 flags;
  1335. /** @lessee_id: Return: unique identifier for lessee. */
  1336. __u32 lessee_id;
  1337. /** @fd: Return: file descriptor to new drm_master file */
  1338. __u32 fd;
  1339. };
  1340. /**
  1341. * struct drm_mode_list_lessees - List lessees
  1342. *
  1343. * List lesses from a drm_master.
  1344. */
  1345. struct drm_mode_list_lessees {
  1346. /**
  1347. * @count_lessees: Number of lessees.
  1348. *
  1349. * On input, provides length of the array.
  1350. * On output, provides total number. No
  1351. * more than the input number will be written
  1352. * back, so two calls can be used to get
  1353. * the size and then the data.
  1354. */
  1355. __u32 count_lessees;
  1356. /** @pad: Padding. */
  1357. __u32 pad;
  1358. /**
  1359. * @lessees_ptr: Pointer to lessees.
  1360. *
  1361. * Pointer to __u64 array of lessee ids
  1362. */
  1363. __u64 lessees_ptr;
  1364. };
  1365. /**
  1366. * struct drm_mode_get_lease - Get Lease
  1367. *
  1368. * Get leased objects.
  1369. */
  1370. struct drm_mode_get_lease {
  1371. /**
  1372. * @count_objects: Number of leased objects.
  1373. *
  1374. * On input, provides length of the array.
  1375. * On output, provides total number. No
  1376. * more than the input number will be written
  1377. * back, so two calls can be used to get
  1378. * the size and then the data.
  1379. */
  1380. __u32 count_objects;
  1381. /** @pad: Padding. */
  1382. __u32 pad;
  1383. /**
  1384. * @objects_ptr: Pointer to objects.
  1385. *
  1386. * Pointer to __u32 array of object ids.
  1387. */
  1388. __u64 objects_ptr;
  1389. };
  1390. /**
  1391. * struct drm_mode_revoke_lease - Revoke lease
  1392. */
  1393. struct drm_mode_revoke_lease {
  1394. /** @lessee_id: Unique ID of lessee */
  1395. __u32 lessee_id;
  1396. };
  1397. /**
  1398. * struct drm_mode_rect - Two dimensional rectangle.
  1399. * @x1: Horizontal starting coordinate (inclusive).
  1400. * @y1: Vertical starting coordinate (inclusive).
  1401. * @x2: Horizontal ending coordinate (exclusive).
  1402. * @y2: Vertical ending coordinate (exclusive).
  1403. *
  1404. * With drm subsystem using struct drm_rect to manage rectangular area this
  1405. * export it to user-space.
  1406. *
  1407. * Currently used by drm_mode_atomic blob property FB_DAMAGE_CLIPS.
  1408. */
  1409. struct drm_mode_rect {
  1410. __s32 x1;
  1411. __s32 y1;
  1412. __s32 x2;
  1413. __s32 y2;
  1414. };
  1415. /**
  1416. * struct drm_mode_closefb
  1417. * @fb_id: Framebuffer ID.
  1418. * @pad: Must be zero.
  1419. */
  1420. struct drm_mode_closefb {
  1421. __u32 fb_id;
  1422. __u32 pad;
  1423. };
  1424. #if defined(__cplusplus)
  1425. }
  1426. #endif
  1427. #endif