drm_mode.h 19 KB

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