summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'include/drm/drm_mode.h')
-rw-r--r--include/drm/drm_mode.h210
1 files changed, 157 insertions, 53 deletions
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 59e67b14..6708e2b7 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -27,6 +27,12 @@
27#ifndef _DRM_MODE_H 27#ifndef _DRM_MODE_H
28#define _DRM_MODE_H 28#define _DRM_MODE_H
29 29
30#include "drm.h"
31
32#if defined(__cplusplus)
33extern "C" {
34#endif
35
30#define DRM_DISPLAY_INFO_LEN 32 36#define DRM_DISPLAY_INFO_LEN 32
31#define DRM_CONNECTOR_NAME_LEN 32 37#define DRM_CONNECTOR_NAME_LEN 32
32#define DRM_DISPLAY_MODE_LEN 32 38#define DRM_DISPLAY_MODE_LEN 32
@@ -56,6 +62,10 @@
56#define DRM_MODE_FLAG_PIXMUX (1<<11) 62#define DRM_MODE_FLAG_PIXMUX (1<<11)
57#define DRM_MODE_FLAG_DBLCLK (1<<12) 63#define DRM_MODE_FLAG_DBLCLK (1<<12)
58#define DRM_MODE_FLAG_CLKDIV2 (1<<13) 64#define DRM_MODE_FLAG_CLKDIV2 (1<<13)
65 /*
66 * When adding a new stereo mode don't forget to adjust DRM_MODE_FLAGS_3D_MAX
67 * (define not exposed to user space).
68 */
59#define DRM_MODE_FLAG_3D_MASK (0x1f<<14) 69#define DRM_MODE_FLAG_3D_MASK (0x1f<<14)
60#define DRM_MODE_FLAG_3D_NONE (0<<14) 70#define DRM_MODE_FLAG_3D_NONE (0<<14)
61#define DRM_MODE_FLAG_3D_FRAME_PACKING (1<<14) 71#define DRM_MODE_FLAG_3D_FRAME_PACKING (1<<14)
@@ -82,6 +92,11 @@
82#define DRM_MODE_SCALE_CENTER 2 /* Centered, no scaling */ 92#define DRM_MODE_SCALE_CENTER 2 /* Centered, no scaling */
83#define DRM_MODE_SCALE_ASPECT 3 /* Full screen, preserve aspect */ 93#define DRM_MODE_SCALE_ASPECT 3 /* Full screen, preserve aspect */
84 94
95/* Picture aspect ratio options */
96#define DRM_MODE_PICTURE_ASPECT_NONE 0
97#define DRM_MODE_PICTURE_ASPECT_4_3 1
98#define DRM_MODE_PICTURE_ASPECT_16_9 2
99
85/* Dithering mode options */ 100/* Dithering mode options */
86#define DRM_MODE_DITHERING_OFF 0 101#define DRM_MODE_DITHERING_OFF 0
87#define DRM_MODE_DITHERING_ON 1 102#define DRM_MODE_DITHERING_ON 1
@@ -102,8 +117,16 @@
102 117
103struct drm_mode_modeinfo { 118struct drm_mode_modeinfo {
104 __u32 clock; 119 __u32 clock;
105 __u16 hdisplay, hsync_start, hsync_end, htotal, hskew; 120 __u16 hdisplay;
106 __u16 vdisplay, vsync_start, vsync_end, vtotal, vscan; 121 __u16 hsync_start;
122 __u16 hsync_end;
123 __u16 htotal;
124 __u16 hskew;
125 __u16 vdisplay;
126 __u16 vsync_start;
127 __u16 vsync_end;
128 __u16 vtotal;
129 __u16 vscan;
107 130
108 __u32 vrefresh; 131 __u32 vrefresh;
109 132
@@ -121,8 +144,10 @@ struct drm_mode_card_res {
121 __u32 count_crtcs; 144 __u32 count_crtcs;
122 __u32 count_connectors; 145 __u32 count_connectors;
123 __u32 count_encoders; 146 __u32 count_encoders;
124 __u32 min_width, max_width; 147 __u32 min_width;
125 __u32 min_height, max_height; 148 __u32 max_width;
149 __u32 min_height;
150 __u32 max_height;
126}; 151};
127 152
128struct drm_mode_crtc { 153struct drm_mode_crtc {
@@ -132,30 +157,35 @@ struct drm_mode_crtc {
132 __u32 crtc_id; /**< Id */ 157 __u32 crtc_id; /**< Id */
133 __u32 fb_id; /**< Id of framebuffer */ 158 __u32 fb_id; /**< Id of framebuffer */
134 159
135 __u32 x, y; /**< Position on the frameuffer */ 160 __u32 x; /**< x Position on the framebuffer */
161 __u32 y; /**< y Position on the framebuffer */
136 162
137 __u32 gamma_size; 163 __u32 gamma_size;
138 __u32 mode_valid; 164 __u32 mode_valid;
139 struct drm_mode_modeinfo mode; 165 struct drm_mode_modeinfo mode;
140}; 166};
141 167
142#define DRM_MODE_PRESENT_TOP_FIELD (1<<0) 168#define DRM_MODE_PRESENT_TOP_FIELD (1<<0)
143#define DRM_MODE_PRESENT_BOTTOM_FIELD (1<<1) 169#define DRM_MODE_PRESENT_BOTTOM_FIELD (1<<1)
144 170
145/* Planes blend with or override other bits on the CRTC */ 171/* Planes blend with or override other bits on the CRTC */
146struct drm_mode_set_plane { 172struct drm_mode_set_plane {
147 __u32 plane_id; 173 __u32 plane_id;
148 __u32 crtc_id; 174 __u32 crtc_id;
149 __u32 fb_id; /* fb object contains surface format type */ 175 __u32 fb_id; /* fb object contains surface format type */
150 __u32 flags; 176 __u32 flags; /* see above flags */
151 177
152 /* Signed dest location allows it to be partially off screen */ 178 /* Signed dest location allows it to be partially off screen */
153 __s32 crtc_x, crtc_y; 179 __s32 crtc_x;
154 __u32 crtc_w, crtc_h; 180 __s32 crtc_y;
181 __u32 crtc_w;
182 __u32 crtc_h;
155 183
156 /* Source values are 16.16 fixed point */ 184 /* Source values are 16.16 fixed point */
157 __u32 src_x, src_y; 185 __u32 src_x;
158 __u32 src_h, src_w; 186 __u32 src_y;
187 __u32 src_h;
188 __u32 src_w;
159}; 189};
160 190
161struct drm_mode_get_plane { 191struct drm_mode_get_plane {
@@ -184,6 +214,7 @@ struct drm_mode_get_plane_res {
184#define DRM_MODE_ENCODER_VIRTUAL 5 214#define DRM_MODE_ENCODER_VIRTUAL 5
185#define DRM_MODE_ENCODER_DSI 6 215#define DRM_MODE_ENCODER_DSI 6
186#define DRM_MODE_ENCODER_DPMST 7 216#define DRM_MODE_ENCODER_DPMST 7
217#define DRM_MODE_ENCODER_DPI 8
187 218
188struct drm_mode_get_encoder { 219struct drm_mode_get_encoder {
189 __u32 encoder_id; 220 __u32 encoder_id;
@@ -223,6 +254,7 @@ struct drm_mode_get_encoder {
223#define DRM_MODE_CONNECTOR_eDP 14 254#define DRM_MODE_CONNECTOR_eDP 14
224#define DRM_MODE_CONNECTOR_VIRTUAL 15 255#define DRM_MODE_CONNECTOR_VIRTUAL 15
225#define DRM_MODE_CONNECTOR_DSI 16 256#define DRM_MODE_CONNECTOR_DSI 16
257#define DRM_MODE_CONNECTOR_DPI 17
226 258
227struct drm_mode_get_connector { 259struct drm_mode_get_connector {
228 260
@@ -241,8 +273,11 @@ struct drm_mode_get_connector {
241 __u32 connector_type_id; 273 __u32 connector_type_id;
242 274
243 __u32 connection; 275 __u32 connection;
244 __u32 mm_width, mm_height; /**< HxW in millimeters */ 276 __u32 mm_width; /**< width in millimeters */
277 __u32 mm_height; /**< height in millimeters */
245 __u32 subpixel; 278 __u32 subpixel;
279
280 __u32 pad;
246}; 281};
247 282
248#define DRM_MODE_PROP_PENDING (1<<0) 283#define DRM_MODE_PROP_PENDING (1<<0)
@@ -288,6 +323,8 @@ struct drm_mode_get_property {
288 char name[DRM_PROP_NAME_LEN]; 323 char name[DRM_PROP_NAME_LEN];
289 324
290 __u32 count_values; 325 __u32 count_values;
326 /* This is only used to count enum values, not blobs. The _blobs is
327 * simply because of a historical reason, i.e. backwards compat. */
291 __u32 count_enum_blobs; 328 __u32 count_enum_blobs;
292}; 329};
293 330
@@ -305,6 +342,7 @@ struct drm_mode_connector_set_property {
305#define DRM_MODE_OBJECT_FB 0xfbfbfbfb 342#define DRM_MODE_OBJECT_FB 0xfbfbfbfb
306#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb 343#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
307#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee 344#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
345#define DRM_MODE_OBJECT_ANY 0
308 346
309struct drm_mode_obj_get_properties { 347struct drm_mode_obj_get_properties {
310 __u64 props_ptr; 348 __u64 props_ptr;
@@ -329,7 +367,8 @@ struct drm_mode_get_blob {
329 367
330struct drm_mode_fb_cmd { 368struct drm_mode_fb_cmd {
331 __u32 fb_id; 369 __u32 fb_id;
332 __u32 width, height; 370 __u32 width;
371 __u32 height;
333 __u32 pitch; 372 __u32 pitch;
334 __u32 bpp; 373 __u32 bpp;
335 __u32 depth; 374 __u32 depth;
@@ -342,9 +381,10 @@ struct drm_mode_fb_cmd {
342 381
343struct drm_mode_fb_cmd2 { 382struct drm_mode_fb_cmd2 {
344 __u32 fb_id; 383 __u32 fb_id;
345 __u32 width, height; 384 __u32 width;
385 __u32 height;
346 __u32 pixel_format; /* fourcc code from drm_fourcc.h */ 386 __u32 pixel_format; /* fourcc code from drm_fourcc.h */
347 __u32 flags; 387 __u32 flags; /* see above flags */
348 388
349 /* 389 /*
350 * In case of planar formats, this ioctl allows up to 4 390 * In case of planar formats, this ioctl allows up to 4
@@ -356,9 +396,9 @@ struct drm_mode_fb_cmd2 {
356 * followed by an interleaved U/V plane containing 396 * followed by an interleaved U/V plane containing
357 * 8 bit 2x2 subsampled colour difference samples. 397 * 8 bit 2x2 subsampled colour difference samples.
358 * 398 *
359 * So it would consist of Y as offset[0] and UV as 399 * So it would consist of Y as offsets[0] and UV as
360 * offset[1]. Note that offset[0] will generally 400 * offsets[1]. Note that offsets[0] will generally
361 * be 0. 401 * be 0 (but this is not required).
362 * 402 *
363 * To accommodate tiled, compressed, etc formats, a per-plane 403 * To accommodate tiled, compressed, etc formats, a per-plane
364 * modifier can be specified. The default value of zero 404 * modifier can be specified. The default value of zero
@@ -377,6 +417,8 @@ struct drm_mode_fb_cmd2 {
377#define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02 417#define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02
378#define DRM_MODE_FB_DIRTY_FLAGS 0x03 418#define DRM_MODE_FB_DIRTY_FLAGS 0x03
379 419
420#define DRM_MODE_FB_DIRTY_MAX_CLIPS 256
421
380/* 422/*
381 * Mark a region of a framebuffer as dirty. 423 * Mark a region of a framebuffer as dirty.
382 * 424 *
@@ -417,20 +459,21 @@ struct drm_mode_mode_cmd {
417 struct drm_mode_modeinfo mode; 459 struct drm_mode_modeinfo mode;
418}; 460};
419 461
420#define DRM_MODE_CURSOR_BO (1<<0) 462#define DRM_MODE_CURSOR_BO 0x01
421#define DRM_MODE_CURSOR_MOVE (1<<1) 463#define DRM_MODE_CURSOR_MOVE 0x02
464#define DRM_MODE_CURSOR_FLAGS 0x03
422 465
423/* 466/*
424 * depending on the value in flags diffrent members are used. 467 * depending on the value in flags different members are used.
425 * 468 *
426 * CURSOR_BO uses 469 * CURSOR_BO uses
427 * crtc 470 * crtc_id
428 * width 471 * width
429 * height 472 * height
430 * handle - if 0 turns the cursor of 473 * handle - if 0 turns the cursor off
431 * 474 *
432 * CURSOR_MOVE uses 475 * CURSOR_MOVE uses
433 * crtc 476 * crtc_id
434 * x 477 * x
435 * y 478 * y
436 */ 479 */
@@ -468,9 +511,30 @@ struct drm_mode_crtc_lut {
468 __u64 blue; 511 __u64 blue;
469}; 512};
470 513
514struct drm_color_ctm {
515 /* Conversion matrix in S31.32 format. */
516 __s64 matrix[9];
517};
518
519struct drm_color_lut {
520 /*
521 * Data is U0.16 fixed point format.
522 */
523 __u16 red;
524 __u16 green;
525 __u16 blue;
526 __u16 reserved;
527};
528
471#define DRM_MODE_PAGE_FLIP_EVENT 0x01 529#define DRM_MODE_PAGE_FLIP_EVENT 0x01
472#define DRM_MODE_PAGE_FLIP_ASYNC 0x02 530#define DRM_MODE_PAGE_FLIP_ASYNC 0x02
473#define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT|DRM_MODE_PAGE_FLIP_ASYNC) 531#define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
532#define DRM_MODE_PAGE_FLIP_TARGET_RELATIVE 0x8
533#define DRM_MODE_PAGE_FLIP_TARGET (DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE | \
534 DRM_MODE_PAGE_FLIP_TARGET_RELATIVE)
535#define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT | \
536 DRM_MODE_PAGE_FLIP_ASYNC | \
537 DRM_MODE_PAGE_FLIP_TARGET)
474 538
475/* 539/*
476 * Request a page flip on the specified crtc. 540 * Request a page flip on the specified crtc.
@@ -484,14 +548,16 @@ struct drm_mode_crtc_lut {
484 * flip is already pending as the ioctl is called, EBUSY will be 548 * flip is already pending as the ioctl is called, EBUSY will be
485 * returned. 549 * returned.
486 * 550 *
487 * The ioctl supports one flag, DRM_MODE_PAGE_FLIP_EVENT, which will 551 * Flag DRM_MODE_PAGE_FLIP_EVENT requests that drm sends back a vblank
488 * request that drm sends back a vblank event (see drm.h: struct 552 * event (see drm.h: struct drm_event_vblank) when the page flip is
489 * drm_event_vblank) when the page flip is done. The user_data field 553 * done. The user_data field passed in with this ioctl will be
490 * passed in with this ioctl will be returned as the user_data field 554 * returned as the user_data field in the vblank event struct.
491 * in the vblank event struct.
492 * 555 *
493 * The reserved field must be zero until we figure out something 556 * Flag DRM_MODE_PAGE_FLIP_ASYNC requests that the flip happen
494 * clever to use it for. 557 * 'as soon as possible', meaning that it not delay waiting for vblank.
558 * This may cause tearing on the screen.
559 *
560 * The reserved field must be zero.
495 */ 561 */
496 562
497struct drm_mode_crtc_page_flip { 563struct drm_mode_crtc_page_flip {
@@ -502,29 +568,57 @@ struct drm_mode_crtc_page_flip {
502 __u64 user_data; 568 __u64 user_data;
503}; 569};
504 570
571/*
572 * Request a page flip on the specified crtc.
573 *
574 * Same as struct drm_mode_crtc_page_flip, but supports new flags and
575 * re-purposes the reserved field:
576 *
577 * The sequence field must be zero unless either of the
578 * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is specified. When
579 * the ABSOLUTE flag is specified, the sequence field denotes the absolute
580 * vblank sequence when the flip should take effect. When the RELATIVE
581 * flag is specified, the sequence field denotes the relative (to the
582 * current one when the ioctl is called) vblank sequence when the flip
583 * should take effect. NOTE: DRM_IOCTL_WAIT_VBLANK must still be used to
584 * make sure the vblank sequence before the target one has passed before
585 * calling this ioctl. The purpose of the
586 * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is merely to clarify
587 * the target for when code dealing with a page flip runs during a
588 * vertical blank period.
589 */
590
591struct drm_mode_crtc_page_flip_target {
592 __u32 crtc_id;
593 __u32 fb_id;
594 __u32 flags;
595 __u32 sequence;
596 __u64 user_data;
597};
598
505/* create a dumb scanout buffer */ 599/* create a dumb scanout buffer */
506struct drm_mode_create_dumb { 600struct drm_mode_create_dumb {
507 __u32 height; 601 __u32 height;
508 __u32 width; 602 __u32 width;
509 __u32 bpp; 603 __u32 bpp;
510 __u32 flags; 604 __u32 flags;
511 /* handle, pitch, size will be returned */ 605 /* handle, pitch, size will be returned */
512 __u32 handle; 606 __u32 handle;
513 __u32 pitch; 607 __u32 pitch;
514 __u64 size; 608 __u64 size;
515}; 609};
516 610
517/* set up for mmap of a dumb scanout buffer */ 611/* set up for mmap of a dumb scanout buffer */
518struct drm_mode_map_dumb { 612struct drm_mode_map_dumb {
519 /** Handle for the object being mapped. */ 613 /** Handle for the object being mapped. */
520 __u32 handle; 614 __u32 handle;
521 __u32 pad; 615 __u32 pad;
522 /** 616 /**
523 * Fake offset to use for subsequent mmap call 617 * Fake offset to use for subsequent mmap call
524 * 618 *
525 * This is a fixed-size type for 32/64 compatibility. 619 * This is a fixed-size type for 32/64 compatibility.
526 */ 620 */
527 __u64 offset; 621 __u64 offset;
528}; 622};
529 623
530struct drm_mode_destroy_dumb { 624struct drm_mode_destroy_dumb {
@@ -532,9 +626,16 @@ struct drm_mode_destroy_dumb {
532}; 626};
533 627
534/* page-flip flags are valid, plus: */ 628/* page-flip flags are valid, plus: */
535#define DRM_MODE_ATOMIC_TEST_ONLY 0x0100 629#define DRM_MODE_ATOMIC_TEST_ONLY 0x0100
536#define DRM_MODE_ATOMIC_NONBLOCK 0x0200 630#define DRM_MODE_ATOMIC_NONBLOCK 0x0200
537#define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400 631#define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400
632
633#define DRM_MODE_ATOMIC_FLAGS (\
634 DRM_MODE_PAGE_FLIP_EVENT |\
635 DRM_MODE_PAGE_FLIP_ASYNC |\
636 DRM_MODE_ATOMIC_TEST_ONLY |\
637 DRM_MODE_ATOMIC_NONBLOCK |\
638 DRM_MODE_ATOMIC_ALLOW_MODESET)
538 639
539#define DRM_MODE_ATOMIC_FLAGS (\ 640#define DRM_MODE_ATOMIC_FLAGS (\
540 DRM_MODE_PAGE_FLIP_EVENT |\ 641 DRM_MODE_PAGE_FLIP_EVENT |\
@@ -574,5 +675,8 @@ struct drm_mode_destroy_blob {
574 __u32 blob_id; 675 __u32 blob_id;
575}; 676};
576 677
678#if defined(__cplusplus)
679}
680#endif
577 681
578#endif 682#endif