diff options
Diffstat (limited to 'include/drm/drm_mode.h')
-rw-r--r-- | include/drm/drm_mode.h | 266 |
1 files changed, 223 insertions, 43 deletions
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h index 6708e2b7..5f9fadbd 100644 --- a/include/drm/drm_mode.h +++ b/include/drm/drm_mode.h | |||
@@ -38,16 +38,24 @@ extern "C" { | |||
38 | #define DRM_DISPLAY_MODE_LEN 32 | 38 | #define DRM_DISPLAY_MODE_LEN 32 |
39 | #define DRM_PROP_NAME_LEN 32 | 39 | #define DRM_PROP_NAME_LEN 32 |
40 | 40 | ||
41 | #define DRM_MODE_TYPE_BUILTIN (1<<0) | 41 | #define DRM_MODE_TYPE_BUILTIN (1<<0) /* deprecated */ |
42 | #define DRM_MODE_TYPE_CLOCK_C ((1<<1) | DRM_MODE_TYPE_BUILTIN) | 42 | #define DRM_MODE_TYPE_CLOCK_C ((1<<1) | DRM_MODE_TYPE_BUILTIN) /* deprecated */ |
43 | #define DRM_MODE_TYPE_CRTC_C ((1<<2) | DRM_MODE_TYPE_BUILTIN) | 43 | #define DRM_MODE_TYPE_CRTC_C ((1<<2) | DRM_MODE_TYPE_BUILTIN) /* deprecated */ |
44 | #define DRM_MODE_TYPE_PREFERRED (1<<3) | 44 | #define DRM_MODE_TYPE_PREFERRED (1<<3) |
45 | #define DRM_MODE_TYPE_DEFAULT (1<<4) | 45 | #define DRM_MODE_TYPE_DEFAULT (1<<4) /* deprecated */ |
46 | #define DRM_MODE_TYPE_USERDEF (1<<5) | 46 | #define DRM_MODE_TYPE_USERDEF (1<<5) |
47 | #define DRM_MODE_TYPE_DRIVER (1<<6) | 47 | #define DRM_MODE_TYPE_DRIVER (1<<6) |
48 | 48 | ||
49 | /* Video mode flags */ | 49 | /* Video mode flags */ |
50 | /* bit compatible with the xorg definitions. */ | 50 | /* bit compatible with the xrandr RR_ definitions (bits 0-13) |
51 | * | ||
52 | * ABI warning: Existing userspace really expects | ||
53 | * the mode flags to match the xrandr definitions. Any | ||
54 | * changes that don't match the xrandr definitions will | ||
55 | * likely need a new client cap or some other mechanism | ||
56 | * to avoid breaking existing userspace. This includes | ||
57 | * allocating new flags in the previously unused bits! | ||
58 | */ | ||
51 | #define DRM_MODE_FLAG_PHSYNC (1<<0) | 59 | #define DRM_MODE_FLAG_PHSYNC (1<<0) |
52 | #define DRM_MODE_FLAG_NHSYNC (1<<1) | 60 | #define DRM_MODE_FLAG_NHSYNC (1<<1) |
53 | #define DRM_MODE_FLAG_PVSYNC (1<<2) | 61 | #define DRM_MODE_FLAG_PVSYNC (1<<2) |
@@ -58,8 +66,8 @@ extern "C" { | |||
58 | #define DRM_MODE_FLAG_PCSYNC (1<<7) | 66 | #define DRM_MODE_FLAG_PCSYNC (1<<7) |
59 | #define DRM_MODE_FLAG_NCSYNC (1<<8) | 67 | #define DRM_MODE_FLAG_NCSYNC (1<<8) |
60 | #define DRM_MODE_FLAG_HSKEW (1<<9) /* hskew provided */ | 68 | #define DRM_MODE_FLAG_HSKEW (1<<9) /* hskew provided */ |
61 | #define DRM_MODE_FLAG_BCAST (1<<10) | 69 | #define DRM_MODE_FLAG_BCAST (1<<10) /* deprecated */ |
62 | #define DRM_MODE_FLAG_PIXMUX (1<<11) | 70 | #define DRM_MODE_FLAG_PIXMUX (1<<11) /* deprecated */ |
63 | #define DRM_MODE_FLAG_DBLCLK (1<<12) | 71 | #define DRM_MODE_FLAG_DBLCLK (1<<12) |
64 | #define DRM_MODE_FLAG_CLKDIV2 (1<<13) | 72 | #define DRM_MODE_FLAG_CLKDIV2 (1<<13) |
65 | /* | 73 | /* |
@@ -67,7 +75,7 @@ extern "C" { | |||
67 | * (define not exposed to user space). | 75 | * (define not exposed to user space). |
68 | */ | 76 | */ |
69 | #define DRM_MODE_FLAG_3D_MASK (0x1f<<14) | 77 | #define DRM_MODE_FLAG_3D_MASK (0x1f<<14) |
70 | #define DRM_MODE_FLAG_3D_NONE (0<<14) | 78 | #define DRM_MODE_FLAG_3D_NONE (0<<14) |
71 | #define DRM_MODE_FLAG_3D_FRAME_PACKING (1<<14) | 79 | #define DRM_MODE_FLAG_3D_FRAME_PACKING (1<<14) |
72 | #define DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE (2<<14) | 80 | #define DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE (2<<14) |
73 | #define DRM_MODE_FLAG_3D_LINE_ALTERNATIVE (3<<14) | 81 | #define DRM_MODE_FLAG_3D_LINE_ALTERNATIVE (3<<14) |
@@ -77,6 +85,19 @@ extern "C" { | |||
77 | #define DRM_MODE_FLAG_3D_TOP_AND_BOTTOM (7<<14) | 85 | #define DRM_MODE_FLAG_3D_TOP_AND_BOTTOM (7<<14) |
78 | #define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF (8<<14) | 86 | #define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF (8<<14) |
79 | 87 | ||
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 | |||
93 | /* Aspect ratio flag bitmask (4 bits 22:19) */ | ||
94 | #define DRM_MODE_FLAG_PIC_AR_MASK (0x0F<<19) | ||
95 | #define DRM_MODE_FLAG_PIC_AR_NONE \ | ||
96 | (DRM_MODE_PICTURE_ASPECT_NONE<<19) | ||
97 | #define DRM_MODE_FLAG_PIC_AR_4_3 \ | ||
98 | (DRM_MODE_PICTURE_ASPECT_4_3<<19) | ||
99 | #define DRM_MODE_FLAG_PIC_AR_16_9 \ | ||
100 | (DRM_MODE_PICTURE_ASPECT_16_9<<19) | ||
80 | 101 | ||
81 | /* DPMS flags */ | 102 | /* DPMS flags */ |
82 | /* bit compatible with the xorg definitions. */ | 103 | /* bit compatible with the xorg definitions. */ |
@@ -92,11 +113,6 @@ extern "C" { | |||
92 | #define DRM_MODE_SCALE_CENTER 2 /* Centered, no scaling */ | 113 | #define DRM_MODE_SCALE_CENTER 2 /* Centered, no scaling */ |
93 | #define DRM_MODE_SCALE_ASPECT 3 /* Full screen, preserve aspect */ | 114 | #define DRM_MODE_SCALE_ASPECT 3 /* Full screen, preserve aspect */ |
94 | 115 | ||
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 | |||
100 | /* Dithering mode options */ | 116 | /* Dithering mode options */ |
101 | #define DRM_MODE_DITHERING_OFF 0 | 117 | #define DRM_MODE_DITHERING_OFF 0 |
102 | #define DRM_MODE_DITHERING_ON 1 | 118 | #define DRM_MODE_DITHERING_ON 1 |
@@ -107,13 +123,60 @@ extern "C" { | |||
107 | #define DRM_MODE_DIRTY_ON 1 | 123 | #define DRM_MODE_DIRTY_ON 1 |
108 | #define DRM_MODE_DIRTY_ANNOTATE 2 | 124 | #define DRM_MODE_DIRTY_ANNOTATE 2 |
109 | 125 | ||
110 | /* rotation property bits */ | 126 | /* Link Status options */ |
111 | #define DRM_ROTATE_0 0 | 127 | #define DRM_MODE_LINK_STATUS_GOOD 0 |
112 | #define DRM_ROTATE_90 1 | 128 | #define DRM_MODE_LINK_STATUS_BAD 1 |
113 | #define DRM_ROTATE_180 2 | 129 | |
114 | #define DRM_ROTATE_270 3 | 130 | /* |
115 | #define DRM_REFLECT_X 4 | 131 | * DRM_MODE_ROTATE_<degrees> |
116 | #define DRM_REFLECT_Y 5 | 132 | * |
133 | * Signals that a drm plane is been rotated <degrees> degrees in counter | ||
134 | * clockwise direction. | ||
135 | * | ||
136 | * This define is provided as a convenience, looking up the property id | ||
137 | * using the name->prop id lookup is the preferred method. | ||
138 | */ | ||
139 | #define DRM_MODE_ROTATE_0 (1<<0) | ||
140 | #define DRM_MODE_ROTATE_90 (1<<1) | ||
141 | #define DRM_MODE_ROTATE_180 (1<<2) | ||
142 | #define DRM_MODE_ROTATE_270 (1<<3) | ||
143 | |||
144 | /* | ||
145 | * DRM_MODE_ROTATE_MASK | ||
146 | * | ||
147 | * Bitmask used to look for drm plane rotations. | ||
148 | */ | ||
149 | #define DRM_MODE_ROTATE_MASK (\ | ||
150 | DRM_MODE_ROTATE_0 | \ | ||
151 | DRM_MODE_ROTATE_90 | \ | ||
152 | DRM_MODE_ROTATE_180 | \ | ||
153 | DRM_MODE_ROTATE_270) | ||
154 | |||
155 | /* | ||
156 | * DRM_MODE_REFLECT_<axis> | ||
157 | * | ||
158 | * Signals that the contents of a drm plane is reflected in the <axis> axis, | ||
159 | * in the same way as mirroring. | ||
160 | * | ||
161 | * This define is provided as a convenience, looking up the property id | ||
162 | * using the name->prop id lookup is the preferred method. | ||
163 | */ | ||
164 | #define DRM_MODE_REFLECT_X (1<<4) | ||
165 | #define DRM_MODE_REFLECT_Y (1<<5) | ||
166 | |||
167 | /* | ||
168 | * DRM_MODE_REFLECT_MASK | ||
169 | * | ||
170 | * Bitmask used to look for drm plane reflections. | ||
171 | */ | ||
172 | #define DRM_MODE_REFLECT_MASK (\ | ||
173 | DRM_MODE_REFLECT_X | \ | ||
174 | DRM_MODE_REFLECT_Y) | ||
175 | |||
176 | /* Content Protection Flags */ | ||
177 | #define DRM_MODE_CONTENT_PROTECTION_UNDESIRED 0 | ||
178 | #define DRM_MODE_CONTENT_PROTECTION_DESIRED 1 | ||
179 | #define DRM_MODE_CONTENT_PROTECTION_ENABLED 2 | ||
117 | 180 | ||
118 | struct drm_mode_modeinfo { | 181 | struct drm_mode_modeinfo { |
119 | __u32 clock; | 182 | __u32 clock; |
@@ -228,14 +291,16 @@ struct drm_mode_get_encoder { | |||
228 | 291 | ||
229 | /* This is for connectors with multiple signal types. */ | 292 | /* This is for connectors with multiple signal types. */ |
230 | /* Try to match DRM_MODE_CONNECTOR_X as closely as possible. */ | 293 | /* Try to match DRM_MODE_CONNECTOR_X as closely as possible. */ |
231 | #define DRM_MODE_SUBCONNECTOR_Automatic 0 | 294 | enum drm_mode_subconnector { |
232 | #define DRM_MODE_SUBCONNECTOR_Unknown 0 | 295 | DRM_MODE_SUBCONNECTOR_Automatic = 0, |
233 | #define DRM_MODE_SUBCONNECTOR_DVID 3 | 296 | DRM_MODE_SUBCONNECTOR_Unknown = 0, |
234 | #define DRM_MODE_SUBCONNECTOR_DVIA 4 | 297 | DRM_MODE_SUBCONNECTOR_DVID = 3, |
235 | #define DRM_MODE_SUBCONNECTOR_Composite 5 | 298 | DRM_MODE_SUBCONNECTOR_DVIA = 4, |
236 | #define DRM_MODE_SUBCONNECTOR_SVIDEO 6 | 299 | DRM_MODE_SUBCONNECTOR_Composite = 5, |
237 | #define DRM_MODE_SUBCONNECTOR_Component 8 | 300 | DRM_MODE_SUBCONNECTOR_SVIDEO = 6, |
238 | #define DRM_MODE_SUBCONNECTOR_SCART 9 | 301 | DRM_MODE_SUBCONNECTOR_Component = 8, |
302 | DRM_MODE_SUBCONNECTOR_SCART = 9, | ||
303 | }; | ||
239 | 304 | ||
240 | #define DRM_MODE_CONNECTOR_Unknown 0 | 305 | #define DRM_MODE_CONNECTOR_Unknown 0 |
241 | #define DRM_MODE_CONNECTOR_VGA 1 | 306 | #define DRM_MODE_CONNECTOR_VGA 1 |
@@ -280,7 +345,7 @@ struct drm_mode_get_connector { | |||
280 | __u32 pad; | 345 | __u32 pad; |
281 | }; | 346 | }; |
282 | 347 | ||
283 | #define DRM_MODE_PROP_PENDING (1<<0) | 348 | #define DRM_MODE_PROP_PENDING (1<<0) /* deprecated, do not use */ |
284 | #define DRM_MODE_PROP_RANGE (1<<1) | 349 | #define DRM_MODE_PROP_RANGE (1<<1) |
285 | #define DRM_MODE_PROP_IMMUTABLE (1<<2) | 350 | #define DRM_MODE_PROP_IMMUTABLE (1<<2) |
286 | #define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */ | 351 | #define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */ |
@@ -400,17 +465,20 @@ struct drm_mode_fb_cmd2 { | |||
400 | * offsets[1]. Note that offsets[0] will generally | 465 | * offsets[1]. Note that offsets[0] will generally |
401 | * be 0 (but this is not required). | 466 | * be 0 (but this is not required). |
402 | * | 467 | * |
403 | * To accommodate tiled, compressed, etc formats, a per-plane | 468 | * To accommodate tiled, compressed, etc formats, a |
404 | * modifier can be specified. The default value of zero | 469 | * modifier can be specified. The default value of zero |
405 | * indicates "native" format as specified by the fourcc. | 470 | * indicates "native" format as specified by the fourcc. |
406 | * Vendor specific modifier token. This allows, for example, | 471 | * Vendor specific modifier token. Note that even though |
407 | * different tiling/swizzling pattern on different planes. | 472 | * it looks like we have a modifier per-plane, we in fact |
408 | * See discussion above of DRM_FORMAT_MOD_xxx. | 473 | * do not. The modifier for each plane must be identical. |
474 | * Thus all combinations of different data layouts for | ||
475 | * multi plane formats must be enumerated as separate | ||
476 | * modifiers. | ||
409 | */ | 477 | */ |
410 | __u32 handles[4]; | 478 | __u32 handles[4]; |
411 | __u32 pitches[4]; /* pitch for each plane */ | 479 | __u32 pitches[4]; /* pitch for each plane */ |
412 | __u32 offsets[4]; /* offset of each plane */ | 480 | __u32 offsets[4]; /* offset of each plane */ |
413 | __u64 modifier[4]; /* ie, tiling, compressed (per plane) */ | 481 | __u64 modifier[4]; /* ie, tiling, compress */ |
414 | }; | 482 | }; |
415 | 483 | ||
416 | #define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01 | 484 | #define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01 |
@@ -512,8 +580,11 @@ struct drm_mode_crtc_lut { | |||
512 | }; | 580 | }; |
513 | 581 | ||
514 | struct drm_color_ctm { | 582 | struct drm_color_ctm { |
515 | /* Conversion matrix in S31.32 format. */ | 583 | /* |
516 | __s64 matrix[9]; | 584 | * Conversion matrix in S31.32 sign-magnitude |
585 | * (not two's complement!) format. | ||
586 | */ | ||
587 | __u64 matrix[9]; | ||
517 | }; | 588 | }; |
518 | 589 | ||
519 | struct drm_color_lut { | 590 | struct drm_color_lut { |
@@ -637,13 +708,6 @@ struct drm_mode_destroy_dumb { | |||
637 | DRM_MODE_ATOMIC_NONBLOCK |\ | 708 | DRM_MODE_ATOMIC_NONBLOCK |\ |
638 | DRM_MODE_ATOMIC_ALLOW_MODESET) | 709 | DRM_MODE_ATOMIC_ALLOW_MODESET) |
639 | 710 | ||
640 | #define DRM_MODE_ATOMIC_FLAGS (\ | ||
641 | DRM_MODE_PAGE_FLIP_EVENT |\ | ||
642 | DRM_MODE_PAGE_FLIP_ASYNC |\ | ||
643 | DRM_MODE_ATOMIC_TEST_ONLY |\ | ||
644 | DRM_MODE_ATOMIC_NONBLOCK |\ | ||
645 | DRM_MODE_ATOMIC_ALLOW_MODESET) | ||
646 | |||
647 | struct drm_mode_atomic { | 711 | struct drm_mode_atomic { |
648 | __u32 flags; | 712 | __u32 flags; |
649 | __u32 count_objs; | 713 | __u32 count_objs; |
@@ -655,6 +719,56 @@ struct drm_mode_atomic { | |||
655 | __u64 user_data; | 719 | __u64 user_data; |
656 | }; | 720 | }; |
657 | 721 | ||
722 | struct drm_format_modifier_blob { | ||
723 | #define FORMAT_BLOB_CURRENT 1 | ||
724 | /* Version of this blob format */ | ||
725 | __u32 version; | ||
726 | |||
727 | /* Flags */ | ||
728 | __u32 flags; | ||
729 | |||
730 | /* Number of fourcc formats supported */ | ||
731 | __u32 count_formats; | ||
732 | |||
733 | /* Where in this blob the formats exist (in bytes) */ | ||
734 | __u32 formats_offset; | ||
735 | |||
736 | /* Number of drm_format_modifiers */ | ||
737 | __u32 count_modifiers; | ||
738 | |||
739 | /* Where in this blob the modifiers exist (in bytes) */ | ||
740 | __u32 modifiers_offset; | ||
741 | |||
742 | /* __u32 formats[] */ | ||
743 | /* struct drm_format_modifier modifiers[] */ | ||
744 | }; | ||
745 | |||
746 | struct drm_format_modifier { | ||
747 | /* Bitmask of formats in get_plane format list this info applies to. The | ||
748 | * offset allows a sliding window of which 64 formats (bits). | ||
749 | * | ||
750 | * Some examples: | ||
751 | * In today's world with < 65 formats, and formats 0, and 2 are | ||
752 | * supported | ||
753 | * 0x0000000000000005 | ||
754 | * ^-offset = 0, formats = 5 | ||
755 | * | ||
756 | * If the number formats grew to 128, and formats 98-102 are | ||
757 | * supported with the modifier: | ||
758 | * | ||
759 | * 0x0000007c00000000 0000000000000000 | ||
760 | * ^ | ||
761 | * |__offset = 64, formats = 0x7c00000000 | ||
762 | * | ||
763 | */ | ||
764 | __u64 formats; | ||
765 | __u32 offset; | ||
766 | __u32 pad; | ||
767 | |||
768 | /* The modifier that applies to the >get_plane format list bitmask. */ | ||
769 | __u64 modifier; | ||
770 | }; | ||
771 | |||
658 | /** | 772 | /** |
659 | * Create a new 'blob' data property, copying length bytes from data pointer, | 773 | * Create a new 'blob' data property, copying length bytes from data pointer, |
660 | * and returning new blob ID. | 774 | * and returning new blob ID. |
@@ -675,6 +789,72 @@ struct drm_mode_destroy_blob { | |||
675 | __u32 blob_id; | 789 | __u32 blob_id; |
676 | }; | 790 | }; |
677 | 791 | ||
792 | /** | ||
793 | * Lease mode resources, creating another drm_master. | ||
794 | */ | ||
795 | struct drm_mode_create_lease { | ||
796 | /** Pointer to array of object ids (__u32) */ | ||
797 | __u64 object_ids; | ||
798 | /** Number of object ids */ | ||
799 | __u32 object_count; | ||
800 | /** flags for new FD (O_CLOEXEC, etc) */ | ||
801 | __u32 flags; | ||
802 | |||
803 | /** Return: unique identifier for lessee. */ | ||
804 | __u32 lessee_id; | ||
805 | /** Return: file descriptor to new drm_master file */ | ||
806 | __u32 fd; | ||
807 | }; | ||
808 | |||
809 | /** | ||
810 | * List lesses from a drm_master | ||
811 | */ | ||
812 | struct drm_mode_list_lessees { | ||
813 | /** Number of lessees. | ||
814 | * On input, provides length of the array. | ||
815 | * On output, provides total number. No | ||
816 | * more than the input number will be written | ||
817 | * back, so two calls can be used to get | ||
818 | * the size and then the data. | ||
819 | */ | ||
820 | __u32 count_lessees; | ||
821 | __u32 pad; | ||
822 | |||
823 | /** Pointer to lessees. | ||
824 | * pointer to __u64 array of lessee ids | ||
825 | */ | ||
826 | __u64 lessees_ptr; | ||
827 | }; | ||
828 | |||
829 | /** | ||
830 | * Get leased objects | ||
831 | */ | ||
832 | struct drm_mode_get_lease { | ||
833 | /** Number of leased objects. | ||
834 | * On input, provides length of the array. | ||
835 | * On output, provides total number. No | ||
836 | * more than the input number will be written | ||
837 | * back, so two calls can be used to get | ||
838 | * the size and then the data. | ||
839 | */ | ||
840 | __u32 count_objects; | ||
841 | __u32 pad; | ||
842 | |||
843 | /** Pointer to objects. | ||
844 | * pointer to __u32 array of object ids | ||
845 | */ | ||
846 | __u64 objects_ptr; | ||
847 | }; | ||
848 | |||
849 | /** | ||
850 | * Revoke lease | ||
851 | */ | ||
852 | struct drm_mode_revoke_lease { | ||
853 | /** Unique ID of lessee | ||
854 | */ | ||
855 | __u32 lessee_id; | ||
856 | }; | ||
857 | |||
678 | #if defined(__cplusplus) | 858 | #if defined(__cplusplus) |
679 | } | 859 | } |
680 | #endif | 860 | #endif |