drm_mode.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878
  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. #define DRM_DISPLAY_INFO_LEN 32
  33. #define DRM_CONNECTOR_NAME_LEN 32
  34. #define DRM_DISPLAY_MODE_LEN 32
  35. #define DRM_PROP_NAME_LEN 32
  36. #define DRM_MODE_TYPE_BUILTIN (1<<0)
  37. #define DRM_MODE_TYPE_CLOCK_C ((1<<1) | DRM_MODE_TYPE_BUILTIN)
  38. #define DRM_MODE_TYPE_CRTC_C ((1<<2) | DRM_MODE_TYPE_BUILTIN)
  39. #define DRM_MODE_TYPE_PREFERRED (1<<3)
  40. #define DRM_MODE_TYPE_DEFAULT (1<<4)
  41. #define DRM_MODE_TYPE_USERDEF (1<<5)
  42. #define DRM_MODE_TYPE_DRIVER (1<<6)
  43. #define DRM_MODE_TYPE_ALL (DRM_MODE_TYPE_BUILTIN | \
  44. DRM_MODE_TYPE_CLOCK_C | \
  45. DRM_MODE_TYPE_CRTC_C | \
  46. DRM_MODE_TYPE_PREFERRED | \
  47. DRM_MODE_TYPE_DEFAULT | \
  48. DRM_MODE_TYPE_USERDEF | \
  49. DRM_MODE_TYPE_DRIVER)
  50. /* Video mode flags */
  51. /* bit compatible with the xrandr RR_ definitions (bits 0-13)
  52. *
  53. * ABI warning: Existing userspace really expects
  54. * the mode flags to match the xrandr definitions. Any
  55. * changes that don't match the xrandr definitions will
  56. * likely need a new client cap or some other mechanism
  57. * to avoid breaking existing userspace. This includes
  58. * allocating new flags in the previously unused bits!
  59. */
  60. #define DRM_MODE_FLAG_PHSYNC (1<<0)
  61. #define DRM_MODE_FLAG_NHSYNC (1<<1)
  62. #define DRM_MODE_FLAG_PVSYNC (1<<2)
  63. #define DRM_MODE_FLAG_NVSYNC (1<<3)
  64. #define DRM_MODE_FLAG_INTERLACE (1<<4)
  65. #define DRM_MODE_FLAG_DBLSCAN (1<<5)
  66. #define DRM_MODE_FLAG_CSYNC (1<<6)
  67. #define DRM_MODE_FLAG_PCSYNC (1<<7)
  68. #define DRM_MODE_FLAG_NCSYNC (1<<8)
  69. #define DRM_MODE_FLAG_HSKEW (1<<9) /* hskew provided */
  70. #define DRM_MODE_FLAG_BCAST (1<<10)
  71. #define DRM_MODE_FLAG_PIXMUX (1<<11) /* deprecated */
  72. #define DRM_MODE_FLAG_DBLCLK (1<<12)
  73. #define DRM_MODE_FLAG_CLKDIV2 (1<<13)
  74. /*
  75. * When adding a new stereo mode don't forget to adjust DRM_MODE_FLAGS_3D_MAX
  76. * (define not exposed to user space).
  77. */
  78. #define DRM_MODE_FLAG_3D_MASK (0x1f<<14)
  79. #define DRM_MODE_FLAG_3D_NONE (0<<14)
  80. #define DRM_MODE_FLAG_3D_FRAME_PACKING (1<<14)
  81. #define DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE (2<<14)
  82. #define DRM_MODE_FLAG_3D_LINE_ALTERNATIVE (3<<14)
  83. #define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL (4<<14)
  84. #define DRM_MODE_FLAG_3D_L_DEPTH (5<<14)
  85. #define DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH (6<<14)
  86. #define DRM_MODE_FLAG_3D_TOP_AND_BOTTOM (7<<14)
  87. #define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF (8<<14)
  88. /* Picture aspect ratio options */
  89. #define DRM_MODE_PICTURE_ASPECT_NONE 0
  90. #define DRM_MODE_PICTURE_ASPECT_4_3 1
  91. #define DRM_MODE_PICTURE_ASPECT_16_9 2
  92. /* Aspect ratio flag bitmask (4 bits 22:19) */
  93. #define DRM_MODE_FLAG_PIC_AR_MASK (0x0F<<19)
  94. #define DRM_MODE_FLAG_PIC_AR_NONE \
  95. (DRM_MODE_PICTURE_ASPECT_NONE<<19)
  96. #define DRM_MODE_FLAG_PIC_AR_4_3 \
  97. (DRM_MODE_PICTURE_ASPECT_4_3<<19)
  98. #define DRM_MODE_FLAG_PIC_AR_16_9 \
  99. (DRM_MODE_PICTURE_ASPECT_16_9<<19)
  100. #define DRM_MODE_FLAG_ALL (DRM_MODE_FLAG_PHSYNC | \
  101. DRM_MODE_FLAG_NHSYNC | \
  102. DRM_MODE_FLAG_PVSYNC | \
  103. DRM_MODE_FLAG_NVSYNC | \
  104. DRM_MODE_FLAG_INTERLACE | \
  105. DRM_MODE_FLAG_DBLSCAN | \
  106. DRM_MODE_FLAG_CSYNC | \
  107. DRM_MODE_FLAG_PCSYNC | \
  108. DRM_MODE_FLAG_NCSYNC | \
  109. DRM_MODE_FLAG_HSKEW | \
  110. DRM_MODE_FLAG_BCAST | \
  111. DRM_MODE_FLAG_DBLCLK | \
  112. DRM_MODE_FLAG_CLKDIV2 | \
  113. DRM_MODE_FLAG_3D_MASK)
  114. /* DPMS flags */
  115. /* bit compatible with the xorg definitions. */
  116. #define DRM_MODE_DPMS_ON 0
  117. #define DRM_MODE_DPMS_STANDBY 1
  118. #define DRM_MODE_DPMS_SUSPEND 2
  119. #define DRM_MODE_DPMS_OFF 3
  120. /* Scaling mode options */
  121. #define DRM_MODE_SCALE_NONE 0 /* Unmodified timing (display or
  122. software can still scale) */
  123. #define DRM_MODE_SCALE_FULLSCREEN 1 /* Full screen, ignore aspect */
  124. #define DRM_MODE_SCALE_CENTER 2 /* Centered, no scaling */
  125. #define DRM_MODE_SCALE_ASPECT 3 /* Full screen, preserve aspect */
  126. /* Dithering mode options */
  127. #define DRM_MODE_DITHERING_OFF 0
  128. #define DRM_MODE_DITHERING_ON 1
  129. #define DRM_MODE_DITHERING_AUTO 2
  130. /* Dirty info options */
  131. #define DRM_MODE_DIRTY_OFF 0
  132. #define DRM_MODE_DIRTY_ON 1
  133. #define DRM_MODE_DIRTY_ANNOTATE 2
  134. /* Link Status options */
  135. #define DRM_MODE_LINK_STATUS_GOOD 0
  136. #define DRM_MODE_LINK_STATUS_BAD 1
  137. /*
  138. * DRM_MODE_ROTATE_<degrees>
  139. *
  140. * Signals that a drm plane is been rotated <degrees> degrees in counter
  141. * clockwise direction.
  142. *
  143. * This define is provided as a convenience, looking up the property id
  144. * using the name->prop id lookup is the preferred method.
  145. */
  146. #define DRM_MODE_ROTATE_0 (1<<0)
  147. #define DRM_MODE_ROTATE_90 (1<<1)
  148. #define DRM_MODE_ROTATE_180 (1<<2)
  149. #define DRM_MODE_ROTATE_270 (1<<3)
  150. /*
  151. * DRM_MODE_ROTATE_MASK
  152. *
  153. * Bitmask used to look for drm plane rotations.
  154. */
  155. #define DRM_MODE_ROTATE_MASK (\
  156. DRM_MODE_ROTATE_0 | \
  157. DRM_MODE_ROTATE_90 | \
  158. DRM_MODE_ROTATE_180 | \
  159. DRM_MODE_ROTATE_270)
  160. /*
  161. * DRM_MODE_REFLECT_<axis>
  162. *
  163. * Signals that the contents of a drm plane is reflected in the <axis> axis,
  164. * in the same way as mirroring.
  165. *
  166. * This define is provided as a convenience, looking up the property id
  167. * using the name->prop id lookup is the preferred method.
  168. */
  169. #define DRM_MODE_REFLECT_X (1<<4)
  170. #define DRM_MODE_REFLECT_Y (1<<5)
  171. /*
  172. * DRM_MODE_REFLECT_MASK
  173. *
  174. * Bitmask used to look for drm plane reflections.
  175. */
  176. #define DRM_MODE_REFLECT_MASK (\
  177. DRM_MODE_REFLECT_X | \
  178. DRM_MODE_REFLECT_Y)
  179. struct drm_mode_modeinfo {
  180. __u32 clock;
  181. __u16 hdisplay;
  182. __u16 hsync_start;
  183. __u16 hsync_end;
  184. __u16 htotal;
  185. __u16 hskew;
  186. __u16 vdisplay;
  187. __u16 vsync_start;
  188. __u16 vsync_end;
  189. __u16 vtotal;
  190. __u16 vscan;
  191. __u32 vrefresh;
  192. __u32 flags;
  193. __u32 type;
  194. char name[DRM_DISPLAY_MODE_LEN];
  195. };
  196. struct drm_mode_card_res {
  197. __u64 fb_id_ptr;
  198. __u64 crtc_id_ptr;
  199. __u64 connector_id_ptr;
  200. __u64 encoder_id_ptr;
  201. __u32 count_fbs;
  202. __u32 count_crtcs;
  203. __u32 count_connectors;
  204. __u32 count_encoders;
  205. __u32 min_width;
  206. __u32 max_width;
  207. __u32 min_height;
  208. __u32 max_height;
  209. };
  210. struct drm_mode_crtc {
  211. __u64 set_connectors_ptr;
  212. __u32 count_connectors;
  213. __u32 crtc_id; /**< Id */
  214. __u32 fb_id; /**< Id of framebuffer */
  215. __u32 x; /**< x Position on the framebuffer */
  216. __u32 y; /**< y Position on the framebuffer */
  217. __u32 gamma_size;
  218. __u32 mode_valid;
  219. struct drm_mode_modeinfo mode;
  220. };
  221. #define DRM_MODE_PRESENT_TOP_FIELD (1<<0)
  222. #define DRM_MODE_PRESENT_BOTTOM_FIELD (1<<1)
  223. /* Planes blend with or override other bits on the CRTC */
  224. struct drm_mode_set_plane {
  225. __u32 plane_id;
  226. __u32 crtc_id;
  227. __u32 fb_id; /* fb object contains surface format type */
  228. __u32 flags; /* see above flags */
  229. /* Signed dest location allows it to be partially off screen */
  230. __s32 crtc_x;
  231. __s32 crtc_y;
  232. __u32 crtc_w;
  233. __u32 crtc_h;
  234. /* Source values are 16.16 fixed point */
  235. __u32 src_x;
  236. __u32 src_y;
  237. __u32 src_h;
  238. __u32 src_w;
  239. };
  240. struct drm_mode_get_plane {
  241. __u32 plane_id;
  242. __u32 crtc_id;
  243. __u32 fb_id;
  244. __u32 possible_crtcs;
  245. __u32 gamma_size;
  246. __u32 count_format_types;
  247. __u64 format_type_ptr;
  248. };
  249. struct drm_mode_get_plane_res {
  250. __u64 plane_id_ptr;
  251. __u32 count_planes;
  252. };
  253. #define DRM_MODE_ENCODER_NONE 0
  254. #define DRM_MODE_ENCODER_DAC 1
  255. #define DRM_MODE_ENCODER_TMDS 2
  256. #define DRM_MODE_ENCODER_LVDS 3
  257. #define DRM_MODE_ENCODER_TVDAC 4
  258. #define DRM_MODE_ENCODER_VIRTUAL 5
  259. #define DRM_MODE_ENCODER_DSI 6
  260. #define DRM_MODE_ENCODER_DPMST 7
  261. #define DRM_MODE_ENCODER_DPI 8
  262. struct drm_mode_get_encoder {
  263. __u32 encoder_id;
  264. __u32 encoder_type;
  265. __u32 crtc_id; /**< Id of crtc */
  266. __u32 possible_crtcs;
  267. __u32 possible_clones;
  268. };
  269. /* This is for connectors with multiple signal types. */
  270. /* Try to match DRM_MODE_CONNECTOR_X as closely as possible. */
  271. enum drm_mode_subconnector {
  272. DRM_MODE_SUBCONNECTOR_Automatic = 0,
  273. DRM_MODE_SUBCONNECTOR_Unknown = 0,
  274. DRM_MODE_SUBCONNECTOR_DVID = 3,
  275. DRM_MODE_SUBCONNECTOR_DVIA = 4,
  276. DRM_MODE_SUBCONNECTOR_Composite = 5,
  277. DRM_MODE_SUBCONNECTOR_SVIDEO = 6,
  278. DRM_MODE_SUBCONNECTOR_Component = 8,
  279. DRM_MODE_SUBCONNECTOR_SCART = 9,
  280. };
  281. #define DRM_MODE_CONNECTOR_Unknown 0
  282. #define DRM_MODE_CONNECTOR_VGA 1
  283. #define DRM_MODE_CONNECTOR_DVII 2
  284. #define DRM_MODE_CONNECTOR_DVID 3
  285. #define DRM_MODE_CONNECTOR_DVIA 4
  286. #define DRM_MODE_CONNECTOR_Composite 5
  287. #define DRM_MODE_CONNECTOR_SVIDEO 6
  288. #define DRM_MODE_CONNECTOR_LVDS 7
  289. #define DRM_MODE_CONNECTOR_Component 8
  290. #define DRM_MODE_CONNECTOR_9PinDIN 9
  291. #define DRM_MODE_CONNECTOR_DisplayPort 10
  292. #define DRM_MODE_CONNECTOR_HDMIA 11
  293. #define DRM_MODE_CONNECTOR_HDMIB 12
  294. #define DRM_MODE_CONNECTOR_TV 13
  295. #define DRM_MODE_CONNECTOR_eDP 14
  296. #define DRM_MODE_CONNECTOR_VIRTUAL 15
  297. #define DRM_MODE_CONNECTOR_DSI 16
  298. #define DRM_MODE_CONNECTOR_DPI 17
  299. struct drm_mode_get_connector {
  300. __u64 encoders_ptr;
  301. __u64 modes_ptr;
  302. __u64 props_ptr;
  303. __u64 prop_values_ptr;
  304. __u32 count_modes;
  305. __u32 count_props;
  306. __u32 count_encoders;
  307. __u32 encoder_id; /**< Current Encoder */
  308. __u32 connector_id; /**< Id */
  309. __u32 connector_type;
  310. __u32 connector_type_id;
  311. __u32 connection;
  312. __u32 mm_width; /**< width in millimeters */
  313. __u32 mm_height; /**< height in millimeters */
  314. __u32 subpixel;
  315. __u32 pad;
  316. };
  317. #define DRM_MODE_PROP_PENDING (1<<0)
  318. #define DRM_MODE_PROP_RANGE (1<<1)
  319. #define DRM_MODE_PROP_IMMUTABLE (1<<2)
  320. #define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */
  321. #define DRM_MODE_PROP_BLOB (1<<4)
  322. #define DRM_MODE_PROP_BITMASK (1<<5) /* bitmask of enumerated types */
  323. /* non-extended types: legacy bitmask, one bit per type: */
  324. #define DRM_MODE_PROP_LEGACY_TYPE ( \
  325. DRM_MODE_PROP_RANGE | \
  326. DRM_MODE_PROP_ENUM | \
  327. DRM_MODE_PROP_BLOB | \
  328. DRM_MODE_PROP_BITMASK)
  329. /* extended-types: rather than continue to consume a bit per type,
  330. * grab a chunk of the bits to use as integer type id.
  331. */
  332. #define DRM_MODE_PROP_EXTENDED_TYPE 0x0000ffc0
  333. #define DRM_MODE_PROP_TYPE(n) ((n) << 6)
  334. #define DRM_MODE_PROP_OBJECT DRM_MODE_PROP_TYPE(1)
  335. #define DRM_MODE_PROP_SIGNED_RANGE DRM_MODE_PROP_TYPE(2)
  336. /* the PROP_ATOMIC flag is used to hide properties from userspace that
  337. * is not aware of atomic properties. This is mostly to work around
  338. * older userspace (DDX drivers) that read/write each prop they find,
  339. * witout being aware that this could be triggering a lengthy modeset.
  340. */
  341. #define DRM_MODE_PROP_ATOMIC 0x80000000
  342. struct drm_mode_property_enum {
  343. __u64 value;
  344. char name[DRM_PROP_NAME_LEN];
  345. };
  346. struct drm_mode_get_property {
  347. __u64 values_ptr; /* values and blob lengths */
  348. __u64 enum_blob_ptr; /* enum and blob id ptrs */
  349. __u32 prop_id;
  350. __u32 flags;
  351. char name[DRM_PROP_NAME_LEN];
  352. __u32 count_values;
  353. /* This is only used to count enum values, not blobs. The _blobs is
  354. * simply because of a historical reason, i.e. backwards compat. */
  355. __u32 count_enum_blobs;
  356. };
  357. struct drm_mode_connector_set_property {
  358. __u64 value;
  359. __u32 prop_id;
  360. __u32 connector_id;
  361. };
  362. #define DRM_MODE_OBJECT_CRTC 0xcccccccc
  363. #define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
  364. #define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0
  365. #define DRM_MODE_OBJECT_MODE 0xdededede
  366. #define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
  367. #define DRM_MODE_OBJECT_FB 0xfbfbfbfb
  368. #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
  369. #define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
  370. #define DRM_MODE_OBJECT_ANY 0
  371. struct drm_mode_obj_get_properties {
  372. __u64 props_ptr;
  373. __u64 prop_values_ptr;
  374. __u32 count_props;
  375. __u32 obj_id;
  376. __u32 obj_type;
  377. };
  378. struct drm_mode_obj_set_property {
  379. __u64 value;
  380. __u32 prop_id;
  381. __u32 obj_id;
  382. __u32 obj_type;
  383. };
  384. struct drm_mode_get_blob {
  385. __u32 blob_id;
  386. __u32 length;
  387. __u64 data;
  388. };
  389. struct drm_mode_fb_cmd {
  390. __u32 fb_id;
  391. __u32 width;
  392. __u32 height;
  393. __u32 pitch;
  394. __u32 bpp;
  395. __u32 depth;
  396. /* driver specific handle */
  397. __u32 handle;
  398. };
  399. #define DRM_MODE_FB_INTERLACED (1<<0) /* for interlaced framebuffers */
  400. #define DRM_MODE_FB_MODIFIERS (1<<1) /* enables ->modifer[] */
  401. struct drm_mode_fb_cmd2 {
  402. __u32 fb_id;
  403. __u32 width;
  404. __u32 height;
  405. __u32 pixel_format; /* fourcc code from drm_fourcc.h */
  406. __u32 flags; /* see above flags */
  407. /*
  408. * In case of planar formats, this ioctl allows up to 4
  409. * buffer objects with offsets and pitches per plane.
  410. * The pitch and offset order is dictated by the fourcc,
  411. * e.g. NV12 (http://fourcc.org/yuv.php#NV12) is described as:
  412. *
  413. * YUV 4:2:0 image with a plane of 8 bit Y samples
  414. * followed by an interleaved U/V plane containing
  415. * 8 bit 2x2 subsampled colour difference samples.
  416. *
  417. * So it would consist of Y as offsets[0] and UV as
  418. * offsets[1]. Note that offsets[0] will generally
  419. * be 0 (but this is not required).
  420. *
  421. * To accommodate tiled, compressed, etc formats, a
  422. * modifier can be specified. The default value of zero
  423. * indicates "native" format as specified by the fourcc.
  424. * Vendor specific modifier token. Note that even though
  425. * it looks like we have a modifier per-plane, we in fact
  426. * do not. The modifier for each plane must be identical.
  427. * Thus all combinations of different data layouts for
  428. * multi plane formats must be enumerated as separate
  429. * modifiers.
  430. */
  431. __u32 handles[4];
  432. __u32 pitches[4]; /* pitch for each plane */
  433. __u32 offsets[4]; /* offset of each plane */
  434. __u64 modifier[4]; /* ie, tiling, compress */
  435. };
  436. #define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01
  437. #define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02
  438. #define DRM_MODE_FB_DIRTY_FLAGS 0x03
  439. #define DRM_MODE_FB_DIRTY_MAX_CLIPS 256
  440. /*
  441. * Mark a region of a framebuffer as dirty.
  442. *
  443. * Some hardware does not automatically update display contents
  444. * as a hardware or software draw to a framebuffer. This ioctl
  445. * allows userspace to tell the kernel and the hardware what
  446. * regions of the framebuffer have changed.
  447. *
  448. * The kernel or hardware is free to update more then just the
  449. * region specified by the clip rects. The kernel or hardware
  450. * may also delay and/or coalesce several calls to dirty into a
  451. * single update.
  452. *
  453. * Userspace may annotate the updates, the annotates are a
  454. * promise made by the caller that the change is either a copy
  455. * of pixels or a fill of a single color in the region specified.
  456. *
  457. * If the DRM_MODE_FB_DIRTY_ANNOTATE_COPY flag is given then
  458. * the number of updated regions are half of num_clips given,
  459. * where the clip rects are paired in src and dst. The width and
  460. * height of each one of the pairs must match.
  461. *
  462. * If the DRM_MODE_FB_DIRTY_ANNOTATE_FILL flag is given the caller
  463. * promises that the region specified of the clip rects is filled
  464. * completely with a single color as given in the color argument.
  465. */
  466. struct drm_mode_fb_dirty_cmd {
  467. __u32 fb_id;
  468. __u32 flags;
  469. __u32 color;
  470. __u32 num_clips;
  471. __u64 clips_ptr;
  472. };
  473. struct drm_mode_mode_cmd {
  474. __u32 connector_id;
  475. struct drm_mode_modeinfo mode;
  476. };
  477. #define DRM_MODE_CURSOR_BO 0x01
  478. #define DRM_MODE_CURSOR_MOVE 0x02
  479. #define DRM_MODE_CURSOR_FLAGS 0x03
  480. /*
  481. * depending on the value in flags different members are used.
  482. *
  483. * CURSOR_BO uses
  484. * crtc_id
  485. * width
  486. * height
  487. * handle - if 0 turns the cursor off
  488. *
  489. * CURSOR_MOVE uses
  490. * crtc_id
  491. * x
  492. * y
  493. */
  494. struct drm_mode_cursor {
  495. __u32 flags;
  496. __u32 crtc_id;
  497. __s32 x;
  498. __s32 y;
  499. __u32 width;
  500. __u32 height;
  501. /* driver specific handle */
  502. __u32 handle;
  503. };
  504. struct drm_mode_cursor2 {
  505. __u32 flags;
  506. __u32 crtc_id;
  507. __s32 x;
  508. __s32 y;
  509. __u32 width;
  510. __u32 height;
  511. /* driver specific handle */
  512. __u32 handle;
  513. __s32 hot_x;
  514. __s32 hot_y;
  515. };
  516. struct drm_mode_crtc_lut {
  517. __u32 crtc_id;
  518. __u32 gamma_size;
  519. /* pointers to arrays */
  520. __u64 red;
  521. __u64 green;
  522. __u64 blue;
  523. };
  524. struct drm_color_ctm {
  525. /* Conversion matrix in S31.32 format. */
  526. __s64 matrix[9];
  527. };
  528. struct drm_color_lut {
  529. /*
  530. * Data is U0.16 fixed point format.
  531. */
  532. __u16 red;
  533. __u16 green;
  534. __u16 blue;
  535. __u16 reserved;
  536. };
  537. #define DRM_MODE_PAGE_FLIP_EVENT 0x01
  538. #define DRM_MODE_PAGE_FLIP_ASYNC 0x02
  539. #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
  540. #define DRM_MODE_PAGE_FLIP_TARGET_RELATIVE 0x8
  541. #define DRM_MODE_PAGE_FLIP_TARGET (DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE | \
  542. DRM_MODE_PAGE_FLIP_TARGET_RELATIVE)
  543. #define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT | \
  544. DRM_MODE_PAGE_FLIP_ASYNC | \
  545. DRM_MODE_PAGE_FLIP_TARGET)
  546. /*
  547. * Request a page flip on the specified crtc.
  548. *
  549. * This ioctl will ask KMS to schedule a page flip for the specified
  550. * crtc. Once any pending rendering targeting the specified fb (as of
  551. * ioctl time) has completed, the crtc will be reprogrammed to display
  552. * that fb after the next vertical refresh. The ioctl returns
  553. * immediately, but subsequent rendering to the current fb will block
  554. * in the execbuffer ioctl until the page flip happens. If a page
  555. * flip is already pending as the ioctl is called, EBUSY will be
  556. * returned.
  557. *
  558. * Flag DRM_MODE_PAGE_FLIP_EVENT requests that drm sends back a vblank
  559. * event (see drm.h: struct drm_event_vblank) when the page flip is
  560. * done. The user_data field passed in with this ioctl will be
  561. * returned as the user_data field in the vblank event struct.
  562. *
  563. * Flag DRM_MODE_PAGE_FLIP_ASYNC requests that the flip happen
  564. * 'as soon as possible', meaning that it not delay waiting for vblank.
  565. * This may cause tearing on the screen.
  566. *
  567. * The reserved field must be zero.
  568. */
  569. struct drm_mode_crtc_page_flip {
  570. __u32 crtc_id;
  571. __u32 fb_id;
  572. __u32 flags;
  573. __u32 reserved;
  574. __u64 user_data;
  575. };
  576. /*
  577. * Request a page flip on the specified crtc.
  578. *
  579. * Same as struct drm_mode_crtc_page_flip, but supports new flags and
  580. * re-purposes the reserved field:
  581. *
  582. * The sequence field must be zero unless either of the
  583. * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is specified. When
  584. * the ABSOLUTE flag is specified, the sequence field denotes the absolute
  585. * vblank sequence when the flip should take effect. When the RELATIVE
  586. * flag is specified, the sequence field denotes the relative (to the
  587. * current one when the ioctl is called) vblank sequence when the flip
  588. * should take effect. NOTE: DRM_IOCTL_WAIT_VBLANK must still be used to
  589. * make sure the vblank sequence before the target one has passed before
  590. * calling this ioctl. The purpose of the
  591. * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is merely to clarify
  592. * the target for when code dealing with a page flip runs during a
  593. * vertical blank period.
  594. */
  595. struct drm_mode_crtc_page_flip_target {
  596. __u32 crtc_id;
  597. __u32 fb_id;
  598. __u32 flags;
  599. __u32 sequence;
  600. __u64 user_data;
  601. };
  602. /* create a dumb scanout buffer */
  603. struct drm_mode_create_dumb {
  604. __u32 height;
  605. __u32 width;
  606. __u32 bpp;
  607. __u32 flags;
  608. /* handle, pitch, size will be returned */
  609. __u32 handle;
  610. __u32 pitch;
  611. __u64 size;
  612. };
  613. /* set up for mmap of a dumb scanout buffer */
  614. struct drm_mode_map_dumb {
  615. /** Handle for the object being mapped. */
  616. __u32 handle;
  617. __u32 pad;
  618. /**
  619. * Fake offset to use for subsequent mmap call
  620. *
  621. * This is a fixed-size type for 32/64 compatibility.
  622. */
  623. __u64 offset;
  624. };
  625. struct drm_mode_destroy_dumb {
  626. __u32 handle;
  627. };
  628. /* page-flip flags are valid, plus: */
  629. #define DRM_MODE_ATOMIC_TEST_ONLY 0x0100
  630. #define DRM_MODE_ATOMIC_NONBLOCK 0x0200
  631. #define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400
  632. #define DRM_MODE_ATOMIC_FLAGS (\
  633. DRM_MODE_PAGE_FLIP_EVENT |\
  634. DRM_MODE_PAGE_FLIP_ASYNC |\
  635. DRM_MODE_ATOMIC_TEST_ONLY |\
  636. DRM_MODE_ATOMIC_NONBLOCK |\
  637. DRM_MODE_ATOMIC_ALLOW_MODESET)
  638. struct drm_mode_atomic {
  639. __u32 flags;
  640. __u32 count_objs;
  641. __u64 objs_ptr;
  642. __u64 count_props_ptr;
  643. __u64 props_ptr;
  644. __u64 prop_values_ptr;
  645. __u64 reserved;
  646. __u64 user_data;
  647. };
  648. struct drm_format_modifier_blob {
  649. #define FORMAT_BLOB_CURRENT 1
  650. /* Version of this blob format */
  651. __u32 version;
  652. /* Flags */
  653. __u32 flags;
  654. /* Number of fourcc formats supported */
  655. __u32 count_formats;
  656. /* Where in this blob the formats exist (in bytes) */
  657. __u32 formats_offset;
  658. /* Number of drm_format_modifiers */
  659. __u32 count_modifiers;
  660. /* Where in this blob the modifiers exist (in bytes) */
  661. __u32 modifiers_offset;
  662. /* __u32 formats[] */
  663. /* struct drm_format_modifier modifiers[] */
  664. };
  665. struct drm_format_modifier {
  666. /* Bitmask of formats in get_plane format list this info applies to. The
  667. * offset allows a sliding window of which 64 formats (bits).
  668. *
  669. * Some examples:
  670. * In today's world with < 65 formats, and formats 0, and 2 are
  671. * supported
  672. * 0x0000000000000005
  673. * ^-offset = 0, formats = 5
  674. *
  675. * If the number formats grew to 128, and formats 98-102 are
  676. * supported with the modifier:
  677. *
  678. * 0x0000007c00000000 0000000000000000
  679. * ^
  680. * |__offset = 64, formats = 0x7c00000000
  681. *
  682. */
  683. __u64 formats;
  684. __u32 offset;
  685. __u32 pad;
  686. /* The modifier that applies to the >get_plane format list bitmask. */
  687. __u64 modifier;
  688. };
  689. /**
  690. * Create a new 'blob' data property, copying length bytes from data pointer,
  691. * and returning new blob ID.
  692. */
  693. struct drm_mode_create_blob {
  694. /** Pointer to data to copy. */
  695. __u64 data;
  696. /** Length of data to copy. */
  697. __u32 length;
  698. /** Return: new property ID. */
  699. __u32 blob_id;
  700. };
  701. /**
  702. * Destroy a user-created blob property.
  703. */
  704. struct drm_mode_destroy_blob {
  705. __u32 blob_id;
  706. };
  707. /**
  708. * Lease mode resources, creating another drm_master.
  709. */
  710. struct drm_mode_create_lease {
  711. /** Pointer to array of object ids (__u32) */
  712. __u64 object_ids;
  713. /** Number of object ids */
  714. __u32 object_count;
  715. /** flags for new FD (O_CLOEXEC, etc) */
  716. __u32 flags;
  717. /** Return: unique identifier for lessee. */
  718. __u32 lessee_id;
  719. /** Return: file descriptor to new drm_master file */
  720. __u32 fd;
  721. };
  722. /**
  723. * List lesses from a drm_master
  724. */
  725. struct drm_mode_list_lessees {
  726. /** Number of lessees.
  727. * On input, provides length of the array.
  728. * On output, provides total number. No
  729. * more than the input number will be written
  730. * back, so two calls can be used to get
  731. * the size and then the data.
  732. */
  733. __u32 count_lessees;
  734. __u32 pad;
  735. /** Pointer to lessees.
  736. * pointer to __u64 array of lessee ids
  737. */
  738. __u64 lessees_ptr;
  739. };
  740. /**
  741. * Get leased objects
  742. */
  743. struct drm_mode_get_lease {
  744. /** Number of leased objects.
  745. * On input, provides length of the array.
  746. * On output, provides total number. No
  747. * more than the input number will be written
  748. * back, so two calls can be used to get
  749. * the size and then the data.
  750. */
  751. __u32 count_objects;
  752. __u32 pad;
  753. /** Pointer to objects.
  754. * pointer to __u32 array of object ids
  755. */
  756. __u64 objects_ptr;
  757. };
  758. /**
  759. * Revoke lease
  760. */
  761. struct drm_mode_revoke_lease {
  762. /** Unique ID of lessee
  763. */
  764. __u32 lessee_id;
  765. };
  766. #if defined(__cplusplus)
  767. }
  768. #endif
  769. #endif