drm_mode.h 20 KB

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