drm_mode.h 18 KB

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