xref: /openbmc/linux/include/uapi/drm/drm_mode.h (revision c900529f3d9161bfde5cca0754f83b4d3c3e0220)
1718dceddSDavid Howells /*
2718dceddSDavid Howells  * Copyright (c) 2007 Dave Airlie <airlied@linux.ie>
3718dceddSDavid Howells  * Copyright (c) 2007 Jakob Bornecrantz <wallbraker@gmail.com>
4718dceddSDavid Howells  * Copyright (c) 2008 Red Hat Inc.
5718dceddSDavid Howells  * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA
6718dceddSDavid Howells  * Copyright (c) 2007-2008 Intel Corporation
7718dceddSDavid Howells  *
8718dceddSDavid Howells  * Permission is hereby granted, free of charge, to any person obtaining a
9718dceddSDavid Howells  * copy of this software and associated documentation files (the "Software"),
10718dceddSDavid Howells  * to deal in the Software without restriction, including without limitation
11718dceddSDavid Howells  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12718dceddSDavid Howells  * and/or sell copies of the Software, and to permit persons to whom the
13718dceddSDavid Howells  * Software is furnished to do so, subject to the following conditions:
14718dceddSDavid Howells  *
15718dceddSDavid Howells  * The above copyright notice and this permission notice shall be included in
16718dceddSDavid Howells  * all copies or substantial portions of the Software.
17718dceddSDavid Howells  *
18718dceddSDavid Howells  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19718dceddSDavid Howells  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20718dceddSDavid Howells  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21718dceddSDavid Howells  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22718dceddSDavid Howells  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23718dceddSDavid Howells  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24718dceddSDavid Howells  * IN THE SOFTWARE.
25718dceddSDavid Howells  */
26718dceddSDavid Howells 
27718dceddSDavid Howells #ifndef _DRM_MODE_H
28718dceddSDavid Howells #define _DRM_MODE_H
29718dceddSDavid Howells 
30abd5422dSGabriel Laskar #include "drm.h"
31718dceddSDavid Howells 
32ebbb0e5cSEmil Velikov #if defined(__cplusplus)
33ebbb0e5cSEmil Velikov extern "C" {
34ebbb0e5cSEmil Velikov #endif
35ebbb0e5cSEmil Velikov 
36a09db883SUma Shankar /**
37a09db883SUma Shankar  * DOC: overview
38a09db883SUma Shankar  *
39a09db883SUma Shankar  * DRM exposes many UAPI and structure definition to have a consistent
40a09db883SUma Shankar  * and standardized interface with user.
41a09db883SUma Shankar  * Userspace can refer to these structure definitions and UAPI formats
42a09db883SUma Shankar  * to communicate to driver
43a09db883SUma Shankar  */
44a09db883SUma Shankar 
45718dceddSDavid Howells #define DRM_CONNECTOR_NAME_LEN	32
46718dceddSDavid Howells #define DRM_DISPLAY_MODE_LEN	32
47718dceddSDavid Howells #define DRM_PROP_NAME_LEN	32
48718dceddSDavid Howells 
49b7245cc5SVille Syrjälä #define DRM_MODE_TYPE_BUILTIN	(1<<0) /* deprecated */
50b7245cc5SVille Syrjälä #define DRM_MODE_TYPE_CLOCK_C	((1<<1) | DRM_MODE_TYPE_BUILTIN) /* deprecated */
51b7245cc5SVille Syrjälä #define DRM_MODE_TYPE_CRTC_C	((1<<2) | DRM_MODE_TYPE_BUILTIN) /* deprecated */
52718dceddSDavid Howells #define DRM_MODE_TYPE_PREFERRED	(1<<3)
53b7245cc5SVille Syrjälä #define DRM_MODE_TYPE_DEFAULT	(1<<4) /* deprecated */
54718dceddSDavid Howells #define DRM_MODE_TYPE_USERDEF	(1<<5)
55718dceddSDavid Howells #define DRM_MODE_TYPE_DRIVER	(1<<6)
56718dceddSDavid Howells 
57b7245cc5SVille Syrjälä #define DRM_MODE_TYPE_ALL	(DRM_MODE_TYPE_PREFERRED |	\
58c6ed6dadSVille Syrjälä 				 DRM_MODE_TYPE_USERDEF |	\
59c6ed6dadSVille Syrjälä 				 DRM_MODE_TYPE_DRIVER)
60c6ed6dadSVille Syrjälä 
61718dceddSDavid Howells /* Video mode flags */
6291d5ee04SVille Syrjälä /* bit compatible with the xrandr RR_ definitions (bits 0-13)
6391d5ee04SVille Syrjälä  *
6491d5ee04SVille Syrjälä  * ABI warning: Existing userspace really expects
6591d5ee04SVille Syrjälä  * the mode flags to match the xrandr definitions. Any
6691d5ee04SVille Syrjälä  * changes that don't match the xrandr definitions will
6791d5ee04SVille Syrjälä  * likely need a new client cap or some other mechanism
6891d5ee04SVille Syrjälä  * to avoid breaking existing userspace. This includes
6991d5ee04SVille Syrjälä  * allocating new flags in the previously unused bits!
7091d5ee04SVille Syrjälä  */
71718dceddSDavid Howells #define DRM_MODE_FLAG_PHSYNC			(1<<0)
72718dceddSDavid Howells #define DRM_MODE_FLAG_NHSYNC			(1<<1)
73718dceddSDavid Howells #define DRM_MODE_FLAG_PVSYNC			(1<<2)
74718dceddSDavid Howells #define DRM_MODE_FLAG_NVSYNC			(1<<3)
75718dceddSDavid Howells #define DRM_MODE_FLAG_INTERLACE			(1<<4)
76718dceddSDavid Howells #define DRM_MODE_FLAG_DBLSCAN			(1<<5)
77718dceddSDavid Howells #define DRM_MODE_FLAG_CSYNC			(1<<6)
78718dceddSDavid Howells #define DRM_MODE_FLAG_PCSYNC			(1<<7)
79718dceddSDavid Howells #define DRM_MODE_FLAG_NCSYNC			(1<<8)
80718dceddSDavid Howells #define DRM_MODE_FLAG_HSKEW			(1<<9) /* hskew provided */
8105ebac09SVille Syrjälä #define DRM_MODE_FLAG_BCAST			(1<<10) /* deprecated */
82d15f40c8SVille Syrjälä #define DRM_MODE_FLAG_PIXMUX			(1<<11) /* deprecated */
83718dceddSDavid Howells #define DRM_MODE_FLAG_DBLCLK			(1<<12)
84718dceddSDavid Howells #define DRM_MODE_FLAG_CLKDIV2			(1<<13)
855848ad40SDamien Lespiau  /*
865848ad40SDamien Lespiau   * When adding a new stereo mode don't forget to adjust DRM_MODE_FLAGS_3D_MAX
875848ad40SDamien Lespiau   * (define not exposed to user space).
885848ad40SDamien Lespiau   */
89f7e121b7SDamien Lespiau #define DRM_MODE_FLAG_3D_MASK			(0x1f<<14)
90f7e121b7SDamien Lespiau #define  DRM_MODE_FLAG_3D_NONE		(0<<14)
914aa17cf0SDamien Lespiau #define  DRM_MODE_FLAG_3D_FRAME_PACKING		(1<<14)
92f7e121b7SDamien Lespiau #define  DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE	(2<<14)
93f7e121b7SDamien Lespiau #define  DRM_MODE_FLAG_3D_LINE_ALTERNATIVE	(3<<14)
94f7e121b7SDamien Lespiau #define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL	(4<<14)
95f7e121b7SDamien Lespiau #define  DRM_MODE_FLAG_3D_L_DEPTH		(5<<14)
96f7e121b7SDamien Lespiau #define  DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH	(6<<14)
97f7e121b7SDamien Lespiau #define  DRM_MODE_FLAG_3D_TOP_AND_BOTTOM	(7<<14)
98f7e121b7SDamien Lespiau #define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF	(8<<14)
99f7e121b7SDamien Lespiau 
100876f43c0SShashank Sharma /* Picture aspect ratio options */
101876f43c0SShashank Sharma #define DRM_MODE_PICTURE_ASPECT_NONE		0
102876f43c0SShashank Sharma #define DRM_MODE_PICTURE_ASPECT_4_3		1
103876f43c0SShashank Sharma #define DRM_MODE_PICTURE_ASPECT_16_9		2
104900aa8adSShashank Sharma #define DRM_MODE_PICTURE_ASPECT_64_27		3
105900aa8adSShashank Sharma #define DRM_MODE_PICTURE_ASPECT_256_135		4
106876f43c0SShashank Sharma 
10750525c33SStanislav Lisovskiy /* Content type options */
10850525c33SStanislav Lisovskiy #define DRM_MODE_CONTENT_TYPE_NO_DATA		0
10950525c33SStanislav Lisovskiy #define DRM_MODE_CONTENT_TYPE_GRAPHICS		1
11050525c33SStanislav Lisovskiy #define DRM_MODE_CONTENT_TYPE_PHOTO		2
11150525c33SStanislav Lisovskiy #define DRM_MODE_CONTENT_TYPE_CINEMA		3
11250525c33SStanislav Lisovskiy #define DRM_MODE_CONTENT_TYPE_GAME		4
11350525c33SStanislav Lisovskiy 
114876f43c0SShashank Sharma /* Aspect ratio flag bitmask (4 bits 22:19) */
115876f43c0SShashank Sharma #define DRM_MODE_FLAG_PIC_AR_MASK		(0x0F<<19)
116876f43c0SShashank Sharma #define  DRM_MODE_FLAG_PIC_AR_NONE \
117876f43c0SShashank Sharma 			(DRM_MODE_PICTURE_ASPECT_NONE<<19)
118876f43c0SShashank Sharma #define  DRM_MODE_FLAG_PIC_AR_4_3 \
119876f43c0SShashank Sharma 			(DRM_MODE_PICTURE_ASPECT_4_3<<19)
120876f43c0SShashank Sharma #define  DRM_MODE_FLAG_PIC_AR_16_9 \
121876f43c0SShashank Sharma 			(DRM_MODE_PICTURE_ASPECT_16_9<<19)
122900aa8adSShashank Sharma #define  DRM_MODE_FLAG_PIC_AR_64_27 \
123900aa8adSShashank Sharma 			(DRM_MODE_PICTURE_ASPECT_64_27<<19)
124900aa8adSShashank Sharma #define  DRM_MODE_FLAG_PIC_AR_256_135 \
125900aa8adSShashank Sharma 			(DRM_MODE_PICTURE_ASPECT_256_135<<19)
126718dceddSDavid Howells 
127c6ed6dadSVille Syrjälä #define  DRM_MODE_FLAG_ALL	(DRM_MODE_FLAG_PHSYNC |		\
128c6ed6dadSVille Syrjälä 				 DRM_MODE_FLAG_NHSYNC |		\
129c6ed6dadSVille Syrjälä 				 DRM_MODE_FLAG_PVSYNC |		\
130c6ed6dadSVille Syrjälä 				 DRM_MODE_FLAG_NVSYNC |		\
131c6ed6dadSVille Syrjälä 				 DRM_MODE_FLAG_INTERLACE |	\
132c6ed6dadSVille Syrjälä 				 DRM_MODE_FLAG_DBLSCAN |	\
133c6ed6dadSVille Syrjälä 				 DRM_MODE_FLAG_CSYNC |		\
134c6ed6dadSVille Syrjälä 				 DRM_MODE_FLAG_PCSYNC |		\
135c6ed6dadSVille Syrjälä 				 DRM_MODE_FLAG_NCSYNC |		\
136c6ed6dadSVille Syrjälä 				 DRM_MODE_FLAG_HSKEW |		\
137c6ed6dadSVille Syrjälä 				 DRM_MODE_FLAG_DBLCLK |		\
138c6ed6dadSVille Syrjälä 				 DRM_MODE_FLAG_CLKDIV2 |	\
139c6ed6dadSVille Syrjälä 				 DRM_MODE_FLAG_3D_MASK)
140c6ed6dadSVille Syrjälä 
141718dceddSDavid Howells /* DPMS flags */
142718dceddSDavid Howells /* bit compatible with the xorg definitions. */
143718dceddSDavid Howells #define DRM_MODE_DPMS_ON	0
144718dceddSDavid Howells #define DRM_MODE_DPMS_STANDBY	1
145718dceddSDavid Howells #define DRM_MODE_DPMS_SUSPEND	2
146718dceddSDavid Howells #define DRM_MODE_DPMS_OFF	3
147718dceddSDavid Howells 
148718dceddSDavid Howells /* Scaling mode options */
149718dceddSDavid Howells #define DRM_MODE_SCALE_NONE		0 /* Unmodified timing (display or
150718dceddSDavid Howells 					     software can still scale) */
151718dceddSDavid Howells #define DRM_MODE_SCALE_FULLSCREEN	1 /* Full screen, ignore aspect */
152718dceddSDavid Howells #define DRM_MODE_SCALE_CENTER		2 /* Centered, no scaling */
153718dceddSDavid Howells #define DRM_MODE_SCALE_ASPECT		3 /* Full screen, preserve aspect */
154718dceddSDavid Howells 
155718dceddSDavid Howells /* Dithering mode options */
156718dceddSDavid Howells #define DRM_MODE_DITHERING_OFF	0
157718dceddSDavid Howells #define DRM_MODE_DITHERING_ON	1
158718dceddSDavid Howells #define DRM_MODE_DITHERING_AUTO 2
159718dceddSDavid Howells 
160718dceddSDavid Howells /* Dirty info options */
161718dceddSDavid Howells #define DRM_MODE_DIRTY_OFF      0
162718dceddSDavid Howells #define DRM_MODE_DIRTY_ON       1
163718dceddSDavid Howells #define DRM_MODE_DIRTY_ANNOTATE 2
164718dceddSDavid Howells 
16540ee6fbeSManasi Navare /* Link Status options */
16640ee6fbeSManasi Navare #define DRM_MODE_LINK_STATUS_GOOD	0
16740ee6fbeSManasi Navare #define DRM_MODE_LINK_STATUS_BAD	1
168c2c446adSRobert Foss 
169c2c446adSRobert Foss /*
170c2c446adSRobert Foss  * DRM_MODE_ROTATE_<degrees>
171c2c446adSRobert Foss  *
172c2c446adSRobert Foss  * Signals that a drm plane is been rotated <degrees> degrees in counter
173c2c446adSRobert Foss  * clockwise direction.
174c2c446adSRobert Foss  *
175c2c446adSRobert Foss  * This define is provided as a convenience, looking up the property id
176c2c446adSRobert Foss  * using the name->prop id lookup is the preferred method.
177c2c446adSRobert Foss  */
178c2c446adSRobert Foss #define DRM_MODE_ROTATE_0       (1<<0)
179c2c446adSRobert Foss #define DRM_MODE_ROTATE_90      (1<<1)
180c2c446adSRobert Foss #define DRM_MODE_ROTATE_180     (1<<2)
181c2c446adSRobert Foss #define DRM_MODE_ROTATE_270     (1<<3)
182c2c446adSRobert Foss 
183c2c446adSRobert Foss /*
184c2c446adSRobert Foss  * DRM_MODE_ROTATE_MASK
185c2c446adSRobert Foss  *
186c2c446adSRobert Foss  * Bitmask used to look for drm plane rotations.
187c2c446adSRobert Foss  */
188c2c446adSRobert Foss #define DRM_MODE_ROTATE_MASK (\
189c2c446adSRobert Foss 		DRM_MODE_ROTATE_0  | \
190c2c446adSRobert Foss 		DRM_MODE_ROTATE_90  | \
191c2c446adSRobert Foss 		DRM_MODE_ROTATE_180 | \
192c2c446adSRobert Foss 		DRM_MODE_ROTATE_270)
193c2c446adSRobert Foss 
194c2c446adSRobert Foss /*
195c2c446adSRobert Foss  * DRM_MODE_REFLECT_<axis>
196c2c446adSRobert Foss  *
1971f86fa15SAlexandru Gheorghe  * Signals that the contents of a drm plane is reflected along the <axis> axis,
198c2c446adSRobert Foss  * in the same way as mirroring.
1991f86fa15SAlexandru Gheorghe  * See kerneldoc chapter "Plane Composition Properties" for more details.
200c2c446adSRobert Foss  *
201c2c446adSRobert Foss  * This define is provided as a convenience, looking up the property id
202c2c446adSRobert Foss  * using the name->prop id lookup is the preferred method.
203c2c446adSRobert Foss  */
204c2c446adSRobert Foss #define DRM_MODE_REFLECT_X      (1<<4)
205c2c446adSRobert Foss #define DRM_MODE_REFLECT_Y      (1<<5)
206c2c446adSRobert Foss 
207c2c446adSRobert Foss /*
208c2c446adSRobert Foss  * DRM_MODE_REFLECT_MASK
209c2c446adSRobert Foss  *
210c2c446adSRobert Foss  * Bitmask used to look for drm plane reflections.
211c2c446adSRobert Foss  */
212c2c446adSRobert Foss #define DRM_MODE_REFLECT_MASK (\
213c2c446adSRobert Foss 		DRM_MODE_REFLECT_X | \
214c2c446adSRobert Foss 		DRM_MODE_REFLECT_Y)
215c2c446adSRobert Foss 
21624557865SSean Paul /* Content Protection Flags */
21724557865SSean Paul #define DRM_MODE_CONTENT_PROTECTION_UNDESIRED	0
21824557865SSean Paul #define DRM_MODE_CONTENT_PROTECTION_DESIRED     1
21924557865SSean Paul #define DRM_MODE_CONTENT_PROTECTION_ENABLED     2
22040ee6fbeSManasi Navare 
22122f0d898SSimon Ser /**
22222f0d898SSimon Ser  * struct drm_mode_modeinfo - Display mode information.
22322f0d898SSimon Ser  * @clock: pixel clock in kHz
22422f0d898SSimon Ser  * @hdisplay: horizontal display size
22522f0d898SSimon Ser  * @hsync_start: horizontal sync start
22622f0d898SSimon Ser  * @hsync_end: horizontal sync end
22722f0d898SSimon Ser  * @htotal: horizontal total size
22822f0d898SSimon Ser  * @hskew: horizontal skew
22922f0d898SSimon Ser  * @vdisplay: vertical display size
23022f0d898SSimon Ser  * @vsync_start: vertical sync start
23122f0d898SSimon Ser  * @vsync_end: vertical sync end
23222f0d898SSimon Ser  * @vtotal: vertical total size
23322f0d898SSimon Ser  * @vscan: vertical scan
23422f0d898SSimon Ser  * @vrefresh: approximate vertical refresh rate in Hz
23522f0d898SSimon Ser  * @flags: bitmask of misc. flags, see DRM_MODE_FLAG_* defines
23622f0d898SSimon Ser  * @type: bitmask of type flags, see DRM_MODE_TYPE_* defines
23722f0d898SSimon Ser  * @name: string describing the mode resolution
23822f0d898SSimon Ser  *
23922f0d898SSimon Ser  * This is the user-space API display mode information structure. For the
24022f0d898SSimon Ser  * kernel version see struct drm_display_mode.
24122f0d898SSimon Ser  */
242718dceddSDavid Howells struct drm_mode_modeinfo {
243718dceddSDavid Howells 	__u32 clock;
244bbda9c1fSRob Clark 	__u16 hdisplay;
245bbda9c1fSRob Clark 	__u16 hsync_start;
246bbda9c1fSRob Clark 	__u16 hsync_end;
247bbda9c1fSRob Clark 	__u16 htotal;
248bbda9c1fSRob Clark 	__u16 hskew;
249bbda9c1fSRob Clark 	__u16 vdisplay;
250bbda9c1fSRob Clark 	__u16 vsync_start;
251bbda9c1fSRob Clark 	__u16 vsync_end;
252bbda9c1fSRob Clark 	__u16 vtotal;
253bbda9c1fSRob Clark 	__u16 vscan;
254718dceddSDavid Howells 
255718dceddSDavid Howells 	__u32 vrefresh;
256718dceddSDavid Howells 
257718dceddSDavid Howells 	__u32 flags;
258718dceddSDavid Howells 	__u32 type;
259718dceddSDavid Howells 	char name[DRM_DISPLAY_MODE_LEN];
260718dceddSDavid Howells };
261718dceddSDavid Howells 
262718dceddSDavid Howells struct drm_mode_card_res {
263718dceddSDavid Howells 	__u64 fb_id_ptr;
264718dceddSDavid Howells 	__u64 crtc_id_ptr;
265718dceddSDavid Howells 	__u64 connector_id_ptr;
266718dceddSDavid Howells 	__u64 encoder_id_ptr;
267718dceddSDavid Howells 	__u32 count_fbs;
268718dceddSDavid Howells 	__u32 count_crtcs;
269718dceddSDavid Howells 	__u32 count_connectors;
270718dceddSDavid Howells 	__u32 count_encoders;
271bbda9c1fSRob Clark 	__u32 min_width;
272bbda9c1fSRob Clark 	__u32 max_width;
273bbda9c1fSRob Clark 	__u32 min_height;
274bbda9c1fSRob Clark 	__u32 max_height;
275718dceddSDavid Howells };
276718dceddSDavid Howells 
277718dceddSDavid Howells struct drm_mode_crtc {
278718dceddSDavid Howells 	__u64 set_connectors_ptr;
279718dceddSDavid Howells 	__u32 count_connectors;
280718dceddSDavid Howells 
281718dceddSDavid Howells 	__u32 crtc_id; /**< Id */
282718dceddSDavid Howells 	__u32 fb_id; /**< Id of framebuffer */
283718dceddSDavid Howells 
284bbda9c1fSRob Clark 	__u32 x; /**< x Position on the framebuffer */
285bbda9c1fSRob Clark 	__u32 y; /**< y Position on the framebuffer */
286718dceddSDavid Howells 
287718dceddSDavid Howells 	__u32 gamma_size;
288718dceddSDavid Howells 	__u32 mode_valid;
289718dceddSDavid Howells 	struct drm_mode_modeinfo mode;
290718dceddSDavid Howells };
291718dceddSDavid Howells 
292718dceddSDavid Howells #define DRM_MODE_PRESENT_TOP_FIELD	(1<<0)
293718dceddSDavid Howells #define DRM_MODE_PRESENT_BOTTOM_FIELD	(1<<1)
294718dceddSDavid Howells 
295718dceddSDavid Howells /* Planes blend with or override other bits on the CRTC */
296718dceddSDavid Howells struct drm_mode_set_plane {
297718dceddSDavid Howells 	__u32 plane_id;
298718dceddSDavid Howells 	__u32 crtc_id;
299718dceddSDavid Howells 	__u32 fb_id; /* fb object contains surface format type */
300718dceddSDavid Howells 	__u32 flags; /* see above flags */
301718dceddSDavid Howells 
302718dceddSDavid Howells 	/* Signed dest location allows it to be partially off screen */
303bbda9c1fSRob Clark 	__s32 crtc_x;
304bbda9c1fSRob Clark 	__s32 crtc_y;
305bbda9c1fSRob Clark 	__u32 crtc_w;
306bbda9c1fSRob Clark 	__u32 crtc_h;
307718dceddSDavid Howells 
308718dceddSDavid Howells 	/* Source values are 16.16 fixed point */
309bbda9c1fSRob Clark 	__u32 src_x;
310bbda9c1fSRob Clark 	__u32 src_y;
311bbda9c1fSRob Clark 	__u32 src_h;
312bbda9c1fSRob Clark 	__u32 src_w;
313718dceddSDavid Howells };
314718dceddSDavid Howells 
315ade0e676SLeandro Ribeiro /**
316ade0e676SLeandro Ribeiro  * struct drm_mode_get_plane - Get plane metadata.
317ade0e676SLeandro Ribeiro  *
318ade0e676SLeandro Ribeiro  * Userspace can perform a GETPLANE ioctl to retrieve information about a
319ade0e676SLeandro Ribeiro  * plane.
320ade0e676SLeandro Ribeiro  *
321ade0e676SLeandro Ribeiro  * To retrieve the number of formats supported, set @count_format_types to zero
322ade0e676SLeandro Ribeiro  * and call the ioctl. @count_format_types will be updated with the value.
323ade0e676SLeandro Ribeiro  *
324ade0e676SLeandro Ribeiro  * To retrieve these formats, allocate an array with the memory needed to store
325ade0e676SLeandro Ribeiro  * @count_format_types formats. Point @format_type_ptr to this array and call
326ade0e676SLeandro Ribeiro  * the ioctl again (with @count_format_types still set to the value returned in
327ade0e676SLeandro Ribeiro  * the first ioctl call).
328ade0e676SLeandro Ribeiro  */
329718dceddSDavid Howells struct drm_mode_get_plane {
330ade0e676SLeandro Ribeiro 	/**
331ade0e676SLeandro Ribeiro 	 * @plane_id: Object ID of the plane whose information should be
332ade0e676SLeandro Ribeiro 	 * retrieved. Set by caller.
333ade0e676SLeandro Ribeiro 	 */
334718dceddSDavid Howells 	__u32 plane_id;
335718dceddSDavid Howells 
336ade0e676SLeandro Ribeiro 	/** @crtc_id: Object ID of the current CRTC. */
337718dceddSDavid Howells 	__u32 crtc_id;
338ade0e676SLeandro Ribeiro 	/** @fb_id: Object ID of the current fb. */
339718dceddSDavid Howells 	__u32 fb_id;
340718dceddSDavid Howells 
341ade0e676SLeandro Ribeiro 	/**
342ade0e676SLeandro Ribeiro 	 * @possible_crtcs: Bitmask of CRTC's compatible with the plane. CRTC's
343ade0e676SLeandro Ribeiro 	 * are created and they receive an index, which corresponds to their
344ade0e676SLeandro Ribeiro 	 * position in the bitmask. Bit N corresponds to
345ade0e676SLeandro Ribeiro 	 * :ref:`CRTC index<crtc_index>` N.
346ade0e676SLeandro Ribeiro 	 */
347718dceddSDavid Howells 	__u32 possible_crtcs;
348ade0e676SLeandro Ribeiro 	/** @gamma_size: Never used. */
349718dceddSDavid Howells 	__u32 gamma_size;
350718dceddSDavid Howells 
351ade0e676SLeandro Ribeiro 	/** @count_format_types: Number of formats. */
352718dceddSDavid Howells 	__u32 count_format_types;
353ade0e676SLeandro Ribeiro 	/**
354ade0e676SLeandro Ribeiro 	 * @format_type_ptr: Pointer to ``__u32`` array of formats that are
355ade0e676SLeandro Ribeiro 	 * supported by the plane. These formats do not require modifiers.
356ade0e676SLeandro Ribeiro 	 */
357718dceddSDavid Howells 	__u64 format_type_ptr;
358718dceddSDavid Howells };
359718dceddSDavid Howells 
360718dceddSDavid Howells struct drm_mode_get_plane_res {
361718dceddSDavid Howells 	__u64 plane_id_ptr;
362718dceddSDavid Howells 	__u32 count_planes;
363718dceddSDavid Howells };
364718dceddSDavid Howells 
365718dceddSDavid Howells #define DRM_MODE_ENCODER_NONE	0
366718dceddSDavid Howells #define DRM_MODE_ENCODER_DAC	1
367718dceddSDavid Howells #define DRM_MODE_ENCODER_TMDS	2
368718dceddSDavid Howells #define DRM_MODE_ENCODER_LVDS	3
369718dceddSDavid Howells #define DRM_MODE_ENCODER_TVDAC	4
370718dceddSDavid Howells #define DRM_MODE_ENCODER_VIRTUAL 5
371b8923273SShobhit Kumar #define DRM_MODE_ENCODER_DSI	6
372182407a6SDave Airlie #define DRM_MODE_ENCODER_DPMST	7
3730b27c02aSEric Anholt #define DRM_MODE_ENCODER_DPI	8
374718dceddSDavid Howells 
375718dceddSDavid Howells struct drm_mode_get_encoder {
376718dceddSDavid Howells 	__u32 encoder_id;
377718dceddSDavid Howells 	__u32 encoder_type;
378718dceddSDavid Howells 
379718dceddSDavid Howells 	__u32 crtc_id; /**< Id of crtc */
380718dceddSDavid Howells 
381718dceddSDavid Howells 	__u32 possible_crtcs;
382718dceddSDavid Howells 	__u32 possible_clones;
383718dceddSDavid Howells };
384718dceddSDavid Howells 
385718dceddSDavid Howells /* This is for connectors with multiple signal types. */
386718dceddSDavid Howells /* Try to match DRM_MODE_CONNECTOR_X as closely as possible. */
387dee7a4feSBoris Brezillon enum drm_mode_subconnector {
388e5b92773SOleg Vasilev 	DRM_MODE_SUBCONNECTOR_Automatic   = 0,  /* DVI-I, TV     */
389e5b92773SOleg Vasilev 	DRM_MODE_SUBCONNECTOR_Unknown     = 0,  /* DVI-I, TV, DP */
390e5b92773SOleg Vasilev 	DRM_MODE_SUBCONNECTOR_VGA	  = 1,  /*            DP */
391e5b92773SOleg Vasilev 	DRM_MODE_SUBCONNECTOR_DVID	  = 3,  /* DVI-I      DP */
392e5b92773SOleg Vasilev 	DRM_MODE_SUBCONNECTOR_DVIA	  = 4,  /* DVI-I         */
393e5b92773SOleg Vasilev 	DRM_MODE_SUBCONNECTOR_Composite   = 5,  /*        TV     */
394e5b92773SOleg Vasilev 	DRM_MODE_SUBCONNECTOR_SVIDEO	  = 6,  /*        TV     */
395e5b92773SOleg Vasilev 	DRM_MODE_SUBCONNECTOR_Component   = 8,  /*        TV     */
396e5b92773SOleg Vasilev 	DRM_MODE_SUBCONNECTOR_SCART	  = 9,  /*        TV     */
397e5b92773SOleg Vasilev 	DRM_MODE_SUBCONNECTOR_DisplayPort = 10, /*            DP */
398e5b92773SOleg Vasilev 	DRM_MODE_SUBCONNECTOR_HDMIA       = 11, /*            DP */
399e5b92773SOleg Vasilev 	DRM_MODE_SUBCONNECTOR_Native      = 15, /*            DP */
400e5b92773SOleg Vasilev 	DRM_MODE_SUBCONNECTOR_Wireless    = 18, /*            DP */
401dee7a4feSBoris Brezillon };
402718dceddSDavid Howells 
403718dceddSDavid Howells #define DRM_MODE_CONNECTOR_Unknown	0
404718dceddSDavid Howells #define DRM_MODE_CONNECTOR_VGA		1
405718dceddSDavid Howells #define DRM_MODE_CONNECTOR_DVII		2
406718dceddSDavid Howells #define DRM_MODE_CONNECTOR_DVID		3
407718dceddSDavid Howells #define DRM_MODE_CONNECTOR_DVIA		4
408718dceddSDavid Howells #define DRM_MODE_CONNECTOR_Composite	5
409718dceddSDavid Howells #define DRM_MODE_CONNECTOR_SVIDEO	6
410718dceddSDavid Howells #define DRM_MODE_CONNECTOR_LVDS		7
411718dceddSDavid Howells #define DRM_MODE_CONNECTOR_Component	8
412718dceddSDavid Howells #define DRM_MODE_CONNECTOR_9PinDIN	9
413718dceddSDavid Howells #define DRM_MODE_CONNECTOR_DisplayPort	10
414718dceddSDavid Howells #define DRM_MODE_CONNECTOR_HDMIA	11
415718dceddSDavid Howells #define DRM_MODE_CONNECTOR_HDMIB	12
416718dceddSDavid Howells #define DRM_MODE_CONNECTOR_TV		13
417718dceddSDavid Howells #define DRM_MODE_CONNECTOR_eDP		14
418718dceddSDavid Howells #define DRM_MODE_CONNECTOR_VIRTUAL      15
419b8923273SShobhit Kumar #define DRM_MODE_CONNECTOR_DSI		16
4200b27c02aSEric Anholt #define DRM_MODE_CONNECTOR_DPI		17
421935774cdSBrian Starkey #define DRM_MODE_CONNECTOR_WRITEBACK	18
422fc06bf1dSNoralf Trønnes #define DRM_MODE_CONNECTOR_SPI		19
423757e2671SNoralf Trønnes #define DRM_MODE_CONNECTOR_USB		20
424718dceddSDavid Howells 
4252ac5ef3bSSimon Ser /**
4262ac5ef3bSSimon Ser  * struct drm_mode_get_connector - Get connector metadata.
4272ac5ef3bSSimon Ser  *
4282ac5ef3bSSimon Ser  * User-space can perform a GETCONNECTOR ioctl to retrieve information about a
4292ac5ef3bSSimon Ser  * connector. User-space is expected to retrieve encoders, modes and properties
4302ac5ef3bSSimon Ser  * by performing this ioctl at least twice: the first time to retrieve the
4312ac5ef3bSSimon Ser  * number of elements, the second time to retrieve the elements themselves.
4322ac5ef3bSSimon Ser  *
4332ac5ef3bSSimon Ser  * To retrieve the number of elements, set @count_props and @count_encoders to
4342ac5ef3bSSimon Ser  * zero, set @count_modes to 1, and set @modes_ptr to a temporary struct
4352ac5ef3bSSimon Ser  * drm_mode_modeinfo element.
4362ac5ef3bSSimon Ser  *
4372ac5ef3bSSimon Ser  * To retrieve the elements, allocate arrays for @encoders_ptr, @modes_ptr,
4382ac5ef3bSSimon Ser  * @props_ptr and @prop_values_ptr, then set @count_modes, @count_props and
4392ac5ef3bSSimon Ser  * @count_encoders to their capacity.
4402ac5ef3bSSimon Ser  *
4412ac5ef3bSSimon Ser  * Performing the ioctl only twice may be racy: the number of elements may have
4422ac5ef3bSSimon Ser  * changed with a hotplug event in-between the two ioctls. User-space is
4432ac5ef3bSSimon Ser  * expected to retry the last ioctl until the number of elements stabilizes.
4442ac5ef3bSSimon Ser  * The kernel won't fill any array which doesn't have the expected length.
4452ac5ef3bSSimon Ser  *
4462ac5ef3bSSimon Ser  * **Force-probing a connector**
4472ac5ef3bSSimon Ser  *
4488f86c82aSSimon Ser  * If the @count_modes field is set to zero and the DRM client is the current
4498f86c82aSSimon Ser  * DRM master, the kernel will perform a forced probe on the connector to
4508f86c82aSSimon Ser  * refresh the connector status, modes and EDID. A forced-probe can be slow,
4518f86c82aSSimon Ser  * might cause flickering and the ioctl will block.
4522ac5ef3bSSimon Ser  *
453a7e2e1c5SSimon Ser  * User-space needs to force-probe connectors to ensure their metadata is
454a7e2e1c5SSimon Ser  * up-to-date at startup and after receiving a hot-plug event. User-space
455a7e2e1c5SSimon Ser  * may perform a forced-probe when the user explicitly requests it. User-space
456a7e2e1c5SSimon Ser  * shouldn't perform a forced-probe in other situations.
4572ac5ef3bSSimon Ser  */
458718dceddSDavid Howells struct drm_mode_get_connector {
4592ac5ef3bSSimon Ser 	/** @encoders_ptr: Pointer to ``__u32`` array of object IDs. */
460718dceddSDavid Howells 	__u64 encoders_ptr;
4612ac5ef3bSSimon Ser 	/** @modes_ptr: Pointer to struct drm_mode_modeinfo array. */
462718dceddSDavid Howells 	__u64 modes_ptr;
4632ac5ef3bSSimon Ser 	/** @props_ptr: Pointer to ``__u32`` array of property IDs. */
464718dceddSDavid Howells 	__u64 props_ptr;
4652ac5ef3bSSimon Ser 	/** @prop_values_ptr: Pointer to ``__u64`` array of property values. */
466718dceddSDavid Howells 	__u64 prop_values_ptr;
467718dceddSDavid Howells 
4682ac5ef3bSSimon Ser 	/** @count_modes: Number of modes. */
469718dceddSDavid Howells 	__u32 count_modes;
4702ac5ef3bSSimon Ser 	/** @count_props: Number of properties. */
471718dceddSDavid Howells 	__u32 count_props;
4722ac5ef3bSSimon Ser 	/** @count_encoders: Number of encoders. */
473718dceddSDavid Howells 	__u32 count_encoders;
474718dceddSDavid Howells 
4752ac5ef3bSSimon Ser 	/** @encoder_id: Object ID of the current encoder. */
4762ac5ef3bSSimon Ser 	__u32 encoder_id;
4772ac5ef3bSSimon Ser 	/** @connector_id: Object ID of the connector. */
4782ac5ef3bSSimon Ser 	__u32 connector_id;
4792ac5ef3bSSimon Ser 	/**
4802ac5ef3bSSimon Ser 	 * @connector_type: Type of the connector.
4812ac5ef3bSSimon Ser 	 *
4822ac5ef3bSSimon Ser 	 * See DRM_MODE_CONNECTOR_* defines.
4832ac5ef3bSSimon Ser 	 */
484718dceddSDavid Howells 	__u32 connector_type;
4852ac5ef3bSSimon Ser 	/**
4862ac5ef3bSSimon Ser 	 * @connector_type_id: Type-specific connector number.
4872ac5ef3bSSimon Ser 	 *
4882ac5ef3bSSimon Ser 	 * This is not an object ID. This is a per-type connector number. Each
4892ac5ef3bSSimon Ser 	 * (type, type_id) combination is unique across all connectors of a DRM
4902ac5ef3bSSimon Ser 	 * device.
491*f1bfcad6SSimon Ser 	 *
492*f1bfcad6SSimon Ser 	 * The (type, type_id) combination is not a stable identifier: the
493*f1bfcad6SSimon Ser 	 * type_id can change depending on the driver probe order.
4942ac5ef3bSSimon Ser 	 */
495718dceddSDavid Howells 	__u32 connector_type_id;
496718dceddSDavid Howells 
4972ac5ef3bSSimon Ser 	/**
4982ac5ef3bSSimon Ser 	 * @connection: Status of the connector.
4992ac5ef3bSSimon Ser 	 *
5002ac5ef3bSSimon Ser 	 * See enum drm_connector_status.
5012ac5ef3bSSimon Ser 	 */
502718dceddSDavid Howells 	__u32 connection;
5032ac5ef3bSSimon Ser 	/** @mm_width: Width of the connected sink in millimeters. */
5042ac5ef3bSSimon Ser 	__u32 mm_width;
5052ac5ef3bSSimon Ser 	/** @mm_height: Height of the connected sink in millimeters. */
5062ac5ef3bSSimon Ser 	__u32 mm_height;
5072ac5ef3bSSimon Ser 	/**
5082ac5ef3bSSimon Ser 	 * @subpixel: Subpixel order of the connected sink.
5092ac5ef3bSSimon Ser 	 *
5102ac5ef3bSSimon Ser 	 * See enum subpixel_order.
5112ac5ef3bSSimon Ser 	 */
512718dceddSDavid Howells 	__u32 subpixel;
513bc5bd37cSChris Wilson 
5142ac5ef3bSSimon Ser 	/** @pad: Padding, must be zero. */
515bc5bd37cSChris Wilson 	__u32 pad;
516718dceddSDavid Howells };
517718dceddSDavid Howells 
518147ccf93SVille Syrjälä #define DRM_MODE_PROP_PENDING	(1<<0) /* deprecated, do not use */
519718dceddSDavid Howells #define DRM_MODE_PROP_RANGE	(1<<1)
520718dceddSDavid Howells #define DRM_MODE_PROP_IMMUTABLE	(1<<2)
521718dceddSDavid Howells #define DRM_MODE_PROP_ENUM	(1<<3) /* enumerated type with text strings */
522718dceddSDavid Howells #define DRM_MODE_PROP_BLOB	(1<<4)
523718dceddSDavid Howells #define DRM_MODE_PROP_BITMASK	(1<<5) /* bitmask of enumerated types */
524718dceddSDavid Howells 
5255ea22f24SRob Clark /* non-extended types: legacy bitmask, one bit per type: */
5265ea22f24SRob Clark #define DRM_MODE_PROP_LEGACY_TYPE  ( \
5275ea22f24SRob Clark 		DRM_MODE_PROP_RANGE | \
5285ea22f24SRob Clark 		DRM_MODE_PROP_ENUM | \
5295ea22f24SRob Clark 		DRM_MODE_PROP_BLOB | \
5305ea22f24SRob Clark 		DRM_MODE_PROP_BITMASK)
5315ea22f24SRob Clark 
5325ea22f24SRob Clark /* extended-types: rather than continue to consume a bit per type,
5335ea22f24SRob Clark  * grab a chunk of the bits to use as integer type id.
5345ea22f24SRob Clark  */
5355ea22f24SRob Clark #define DRM_MODE_PROP_EXTENDED_TYPE	0x0000ffc0
5365ea22f24SRob Clark #define DRM_MODE_PROP_TYPE(n)		((n) << 6)
53798f75de4SRob Clark #define DRM_MODE_PROP_OBJECT		DRM_MODE_PROP_TYPE(1)
538ebc44cf3SRob Clark #define DRM_MODE_PROP_SIGNED_RANGE	DRM_MODE_PROP_TYPE(2)
5395ea22f24SRob Clark 
54088a48e29SRob Clark /* the PROP_ATOMIC flag is used to hide properties from userspace that
54188a48e29SRob Clark  * is not aware of atomic properties.  This is mostly to work around
54288a48e29SRob Clark  * older userspace (DDX drivers) that read/write each prop they find,
54388a48e29SRob Clark  * witout being aware that this could be triggering a lengthy modeset.
54488a48e29SRob Clark  */
54588a48e29SRob Clark #define DRM_MODE_PROP_ATOMIC        0x80000000
54688a48e29SRob Clark 
5476e5b47a4SSimon Ser /**
5486e5b47a4SSimon Ser  * struct drm_mode_property_enum - Description for an enum/bitfield entry.
5496e5b47a4SSimon Ser  * @value: numeric value for this enum entry.
5506e5b47a4SSimon Ser  * @name: symbolic name for this enum entry.
5516e5b47a4SSimon Ser  *
5526e5b47a4SSimon Ser  * See struct drm_property_enum for details.
5536e5b47a4SSimon Ser  */
554718dceddSDavid Howells struct drm_mode_property_enum {
555718dceddSDavid Howells 	__u64 value;
556718dceddSDavid Howells 	char name[DRM_PROP_NAME_LEN];
557718dceddSDavid Howells };
558718dceddSDavid Howells 
5596e5b47a4SSimon Ser /**
5606e5b47a4SSimon Ser  * struct drm_mode_get_property - Get property metadata.
5616e5b47a4SSimon Ser  *
5626e5b47a4SSimon Ser  * User-space can perform a GETPROPERTY ioctl to retrieve information about a
5636e5b47a4SSimon Ser  * property. The same property may be attached to multiple objects, see
5646e5b47a4SSimon Ser  * "Modeset Base Object Abstraction".
5656e5b47a4SSimon Ser  *
5666e5b47a4SSimon Ser  * The meaning of the @values_ptr field changes depending on the property type.
5676e5b47a4SSimon Ser  * See &drm_property.flags for more details.
5686e5b47a4SSimon Ser  *
5696e5b47a4SSimon Ser  * The @enum_blob_ptr and @count_enum_blobs fields are only meaningful when the
5706e5b47a4SSimon Ser  * property has the type &DRM_MODE_PROP_ENUM or &DRM_MODE_PROP_BITMASK. For
5716e5b47a4SSimon Ser  * backwards compatibility, the kernel will always set @count_enum_blobs to
5726e5b47a4SSimon Ser  * zero when the property has the type &DRM_MODE_PROP_BLOB. User-space must
5736e5b47a4SSimon Ser  * ignore these two fields if the property has a different type.
5746e5b47a4SSimon Ser  *
5756e5b47a4SSimon Ser  * User-space is expected to retrieve values and enums by performing this ioctl
5766e5b47a4SSimon Ser  * at least twice: the first time to retrieve the number of elements, the
5776e5b47a4SSimon Ser  * second time to retrieve the elements themselves.
5786e5b47a4SSimon Ser  *
5796e5b47a4SSimon Ser  * To retrieve the number of elements, set @count_values and @count_enum_blobs
5806e5b47a4SSimon Ser  * to zero, then call the ioctl. @count_values will be updated with the number
5816e5b47a4SSimon Ser  * of elements. If the property has the type &DRM_MODE_PROP_ENUM or
5826e5b47a4SSimon Ser  * &DRM_MODE_PROP_BITMASK, @count_enum_blobs will be updated as well.
5836e5b47a4SSimon Ser  *
5846e5b47a4SSimon Ser  * To retrieve the elements themselves, allocate an array for @values_ptr and
5856e5b47a4SSimon Ser  * set @count_values to its capacity. If the property has the type
5866e5b47a4SSimon Ser  * &DRM_MODE_PROP_ENUM or &DRM_MODE_PROP_BITMASK, allocate an array for
5876e5b47a4SSimon Ser  * @enum_blob_ptr and set @count_enum_blobs to its capacity. Calling the ioctl
5886e5b47a4SSimon Ser  * again will fill the arrays.
5896e5b47a4SSimon Ser  */
590718dceddSDavid Howells struct drm_mode_get_property {
5916e5b47a4SSimon Ser 	/** @values_ptr: Pointer to a ``__u64`` array. */
5926e5b47a4SSimon Ser 	__u64 values_ptr;
5936e5b47a4SSimon Ser 	/** @enum_blob_ptr: Pointer to a struct drm_mode_property_enum array. */
5946e5b47a4SSimon Ser 	__u64 enum_blob_ptr;
595718dceddSDavid Howells 
5966e5b47a4SSimon Ser 	/**
5976e5b47a4SSimon Ser 	 * @prop_id: Object ID of the property which should be retrieved. Set
5986e5b47a4SSimon Ser 	 * by the caller.
5996e5b47a4SSimon Ser 	 */
600718dceddSDavid Howells 	__u32 prop_id;
6016e5b47a4SSimon Ser 	/**
6026e5b47a4SSimon Ser 	 * @flags: ``DRM_MODE_PROP_*`` bitfield. See &drm_property.flags for
6036e5b47a4SSimon Ser 	 * a definition of the flags.
6046e5b47a4SSimon Ser 	 */
605718dceddSDavid Howells 	__u32 flags;
6066e5b47a4SSimon Ser 	/**
6076e5b47a4SSimon Ser 	 * @name: Symbolic property name. User-space should use this field to
6086e5b47a4SSimon Ser 	 * recognize properties.
6096e5b47a4SSimon Ser 	 */
610718dceddSDavid Howells 	char name[DRM_PROP_NAME_LEN];
611718dceddSDavid Howells 
6126e5b47a4SSimon Ser 	/** @count_values: Number of elements in @values_ptr. */
613718dceddSDavid Howells 	__u32 count_values;
6146e5b47a4SSimon Ser 	/** @count_enum_blobs: Number of elements in @enum_blob_ptr. */
615718dceddSDavid Howells 	__u32 count_enum_blobs;
616718dceddSDavid Howells };
617718dceddSDavid Howells 
618718dceddSDavid Howells struct drm_mode_connector_set_property {
619718dceddSDavid Howells 	__u64 value;
620718dceddSDavid Howells 	__u32 prop_id;
621718dceddSDavid Howells 	__u32 connector_id;
622718dceddSDavid Howells };
623718dceddSDavid Howells 
6248812f381SDaniel Vetter #define DRM_MODE_OBJECT_CRTC 0xcccccccc
6258812f381SDaniel Vetter #define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
6268812f381SDaniel Vetter #define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0
6278812f381SDaniel Vetter #define DRM_MODE_OBJECT_MODE 0xdededede
6288812f381SDaniel Vetter #define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
6298812f381SDaniel Vetter #define DRM_MODE_OBJECT_FB 0xfbfbfbfb
6308812f381SDaniel Vetter #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
6318812f381SDaniel Vetter #define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
6328812f381SDaniel Vetter #define DRM_MODE_OBJECT_ANY 0
6338812f381SDaniel Vetter 
634718dceddSDavid Howells struct drm_mode_obj_get_properties {
635718dceddSDavid Howells 	__u64 props_ptr;
636718dceddSDavid Howells 	__u64 prop_values_ptr;
637718dceddSDavid Howells 	__u32 count_props;
638718dceddSDavid Howells 	__u32 obj_id;
639718dceddSDavid Howells 	__u32 obj_type;
640718dceddSDavid Howells };
641718dceddSDavid Howells 
642718dceddSDavid Howells struct drm_mode_obj_set_property {
643718dceddSDavid Howells 	__u64 value;
644718dceddSDavid Howells 	__u32 prop_id;
645718dceddSDavid Howells 	__u32 obj_id;
646718dceddSDavid Howells 	__u32 obj_type;
647718dceddSDavid Howells };
648718dceddSDavid Howells 
649718dceddSDavid Howells struct drm_mode_get_blob {
650718dceddSDavid Howells 	__u32 blob_id;
651718dceddSDavid Howells 	__u32 length;
652718dceddSDavid Howells 	__u64 data;
653718dceddSDavid Howells };
654718dceddSDavid Howells 
655718dceddSDavid Howells struct drm_mode_fb_cmd {
656718dceddSDavid Howells 	__u32 fb_id;
657bbda9c1fSRob Clark 	__u32 width;
658bbda9c1fSRob Clark 	__u32 height;
659718dceddSDavid Howells 	__u32 pitch;
660718dceddSDavid Howells 	__u32 bpp;
661718dceddSDavid Howells 	__u32 depth;
662718dceddSDavid Howells 	/* driver specific handle */
663718dceddSDavid Howells 	__u32 handle;
664718dceddSDavid Howells };
665718dceddSDavid Howells 
666718dceddSDavid Howells #define DRM_MODE_FB_INTERLACED	(1<<0) /* for interlaced framebuffers */
667e3eb3250SRob Clark #define DRM_MODE_FB_MODIFIERS	(1<<1) /* enables ->modifer[] */
668718dceddSDavid Howells 
669a3574119SSimon Ser /**
670a3574119SSimon Ser  * struct drm_mode_fb_cmd2 - Frame-buffer metadata.
671a3574119SSimon Ser  *
672a3574119SSimon Ser  * This struct holds frame-buffer metadata. There are two ways to use it:
673a3574119SSimon Ser  *
674a3574119SSimon Ser  * - User-space can fill this struct and perform a &DRM_IOCTL_MODE_ADDFB2
675a3574119SSimon Ser  *   ioctl to register a new frame-buffer. The new frame-buffer object ID will
676a3574119SSimon Ser  *   be set by the kernel in @fb_id.
677a3574119SSimon Ser  * - User-space can set @fb_id and perform a &DRM_IOCTL_MODE_GETFB2 ioctl to
678a3574119SSimon Ser  *   fetch metadata about an existing frame-buffer.
679a3574119SSimon Ser  *
680a3574119SSimon Ser  * In case of planar formats, this struct allows up to 4 buffer objects with
6810c05fcd3SGeert Uytterhoeven  * offsets and pitches per plane. The pitch and offset order are dictated by
6820c05fcd3SGeert Uytterhoeven  * the format FourCC as defined by ``drm_fourcc.h``, e.g. NV12 is described as:
683a3574119SSimon Ser  *
6840c05fcd3SGeert Uytterhoeven  *     YUV 4:2:0 image with a plane of 8-bit Y samples followed by an
6850c05fcd3SGeert Uytterhoeven  *     interleaved U/V plane containing 8-bit 2x2 subsampled colour difference
686a3574119SSimon Ser  *     samples.
687a3574119SSimon Ser  *
688a3574119SSimon Ser  * So it would consist of a Y plane at ``offsets[0]`` and a UV plane at
689a3574119SSimon Ser  * ``offsets[1]``.
690a3574119SSimon Ser  *
691a3574119SSimon Ser  * To accommodate tiled, compressed, etc formats, a modifier can be specified.
692a3574119SSimon Ser  * For more information see the "Format Modifiers" section. Note that even
693a3574119SSimon Ser  * though it looks like we have a modifier per-plane, we in fact do not. The
694a3574119SSimon Ser  * modifier for each plane must be identical. Thus all combinations of
695a3574119SSimon Ser  * different data layouts for multi-plane formats must be enumerated as
696a3574119SSimon Ser  * separate modifiers.
697a3574119SSimon Ser  *
698a3574119SSimon Ser  * All of the entries in @handles, @pitches, @offsets and @modifier must be
699a3574119SSimon Ser  * zero when unused. Warning, for @offsets and @modifier zero can't be used to
700a3574119SSimon Ser  * figure out whether the entry is used or not since it's a valid value (a zero
701a3574119SSimon Ser  * offset is common, and a zero modifier is &DRM_FORMAT_MOD_LINEAR).
702a3574119SSimon Ser  */
703718dceddSDavid Howells struct drm_mode_fb_cmd2 {
704a3574119SSimon Ser 	/** @fb_id: Object ID of the frame-buffer. */
705718dceddSDavid Howells 	__u32 fb_id;
706a3574119SSimon Ser 	/** @width: Width of the frame-buffer. */
707bbda9c1fSRob Clark 	__u32 width;
708a3574119SSimon Ser 	/** @height: Height of the frame-buffer. */
709bbda9c1fSRob Clark 	__u32 height;
710a3574119SSimon Ser 	/**
711a3574119SSimon Ser 	 * @pixel_format: FourCC format code, see ``DRM_FORMAT_*`` constants in
712a3574119SSimon Ser 	 * ``drm_fourcc.h``.
713a3574119SSimon Ser 	 */
714a3574119SSimon Ser 	__u32 pixel_format;
715a3574119SSimon Ser 	/**
716a3574119SSimon Ser 	 * @flags: Frame-buffer flags (see &DRM_MODE_FB_INTERLACED and
717a3574119SSimon Ser 	 * &DRM_MODE_FB_MODIFIERS).
718a3574119SSimon Ser 	 */
719a3574119SSimon Ser 	__u32 flags;
720718dceddSDavid Howells 
721a3574119SSimon Ser 	/**
722a3574119SSimon Ser 	 * @handles: GEM buffer handle, one per plane. Set to 0 if the plane is
723a3574119SSimon Ser 	 * unused. The same handle can be used for multiple planes.
724718dceddSDavid Howells 	 */
725718dceddSDavid Howells 	__u32 handles[4];
726a3574119SSimon Ser 	/** @pitches: Pitch (aka. stride) in bytes, one per plane. */
727a3574119SSimon Ser 	__u32 pitches[4];
728a3574119SSimon Ser 	/** @offsets: Offset into the buffer in bytes, one per plane. */
729a3574119SSimon Ser 	__u32 offsets[4];
730a3574119SSimon Ser 	/**
731a3574119SSimon Ser 	 * @modifier: Format modifier, one per plane. See ``DRM_FORMAT_MOD_*``
732a3574119SSimon Ser 	 * constants in ``drm_fourcc.h``. All planes must use the same
733a3574119SSimon Ser 	 * modifier. Ignored unless &DRM_MODE_FB_MODIFIERS is set in @flags.
734a3574119SSimon Ser 	 */
735a3574119SSimon Ser 	__u64 modifier[4];
736718dceddSDavid Howells };
737718dceddSDavid Howells 
738718dceddSDavid Howells #define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01
739718dceddSDavid Howells #define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02
740718dceddSDavid Howells #define DRM_MODE_FB_DIRTY_FLAGS         0x03
741718dceddSDavid Howells 
742718dceddSDavid Howells #define DRM_MODE_FB_DIRTY_MAX_CLIPS     256
743718dceddSDavid Howells 
744718dceddSDavid Howells /*
745718dceddSDavid Howells  * Mark a region of a framebuffer as dirty.
746718dceddSDavid Howells  *
747718dceddSDavid Howells  * Some hardware does not automatically update display contents
748718dceddSDavid Howells  * as a hardware or software draw to a framebuffer. This ioctl
749718dceddSDavid Howells  * allows userspace to tell the kernel and the hardware what
750718dceddSDavid Howells  * regions of the framebuffer have changed.
751718dceddSDavid Howells  *
752718dceddSDavid Howells  * The kernel or hardware is free to update more then just the
753718dceddSDavid Howells  * region specified by the clip rects. The kernel or hardware
754718dceddSDavid Howells  * may also delay and/or coalesce several calls to dirty into a
755718dceddSDavid Howells  * single update.
756718dceddSDavid Howells  *
757718dceddSDavid Howells  * Userspace may annotate the updates, the annotates are a
758718dceddSDavid Howells  * promise made by the caller that the change is either a copy
759718dceddSDavid Howells  * of pixels or a fill of a single color in the region specified.
760718dceddSDavid Howells  *
761718dceddSDavid Howells  * If the DRM_MODE_FB_DIRTY_ANNOTATE_COPY flag is given then
762718dceddSDavid Howells  * the number of updated regions are half of num_clips given,
763718dceddSDavid Howells  * where the clip rects are paired in src and dst. The width and
764718dceddSDavid Howells  * height of each one of the pairs must match.
765718dceddSDavid Howells  *
766718dceddSDavid Howells  * If the DRM_MODE_FB_DIRTY_ANNOTATE_FILL flag is given the caller
767718dceddSDavid Howells  * promises that the region specified of the clip rects is filled
768718dceddSDavid Howells  * completely with a single color as given in the color argument.
769718dceddSDavid Howells  */
770718dceddSDavid Howells 
771718dceddSDavid Howells struct drm_mode_fb_dirty_cmd {
772718dceddSDavid Howells 	__u32 fb_id;
773718dceddSDavid Howells 	__u32 flags;
774718dceddSDavid Howells 	__u32 color;
775718dceddSDavid Howells 	__u32 num_clips;
776718dceddSDavid Howells 	__u64 clips_ptr;
777718dceddSDavid Howells };
778718dceddSDavid Howells 
779718dceddSDavid Howells struct drm_mode_mode_cmd {
780718dceddSDavid Howells 	__u32 connector_id;
781718dceddSDavid Howells 	struct drm_mode_modeinfo mode;
782718dceddSDavid Howells };
783718dceddSDavid Howells 
784718dceddSDavid Howells #define DRM_MODE_CURSOR_BO	0x01
785718dceddSDavid Howells #define DRM_MODE_CURSOR_MOVE	0x02
786718dceddSDavid Howells #define DRM_MODE_CURSOR_FLAGS	0x03
787718dceddSDavid Howells 
788718dceddSDavid Howells /*
789718dceddSDavid Howells  * depending on the value in flags different members are used.
790718dceddSDavid Howells  *
791718dceddSDavid Howells  * CURSOR_BO uses
792715f59ccSChristopher Harvey  *    crtc_id
793718dceddSDavid Howells  *    width
794718dceddSDavid Howells  *    height
795715f59ccSChristopher Harvey  *    handle - if 0 turns the cursor off
796718dceddSDavid Howells  *
797718dceddSDavid Howells  * CURSOR_MOVE uses
798715f59ccSChristopher Harvey  *    crtc_id
799718dceddSDavid Howells  *    x
800718dceddSDavid Howells  *    y
801718dceddSDavid Howells  */
802718dceddSDavid Howells struct drm_mode_cursor {
803718dceddSDavid Howells 	__u32 flags;
804718dceddSDavid Howells 	__u32 crtc_id;
805718dceddSDavid Howells 	__s32 x;
806718dceddSDavid Howells 	__s32 y;
807718dceddSDavid Howells 	__u32 width;
808718dceddSDavid Howells 	__u32 height;
809718dceddSDavid Howells 	/* driver specific handle */
810718dceddSDavid Howells 	__u32 handle;
811718dceddSDavid Howells };
812718dceddSDavid Howells 
8134c813d4dSDave Airlie struct drm_mode_cursor2 {
8144c813d4dSDave Airlie 	__u32 flags;
8154c813d4dSDave Airlie 	__u32 crtc_id;
8164c813d4dSDave Airlie 	__s32 x;
8174c813d4dSDave Airlie 	__s32 y;
8184c813d4dSDave Airlie 	__u32 width;
8194c813d4dSDave Airlie 	__u32 height;
8204c813d4dSDave Airlie 	/* driver specific handle */
8214c813d4dSDave Airlie 	__u32 handle;
8224c813d4dSDave Airlie 	__s32 hot_x;
8234c813d4dSDave Airlie 	__s32 hot_y;
8244c813d4dSDave Airlie };
8254c813d4dSDave Airlie 
826718dceddSDavid Howells struct drm_mode_crtc_lut {
827718dceddSDavid Howells 	__u32 crtc_id;
828718dceddSDavid Howells 	__u32 gamma_size;
829718dceddSDavid Howells 
830718dceddSDavid Howells 	/* pointers to arrays */
831718dceddSDavid Howells 	__u64 red;
832718dceddSDavid Howells 	__u64 green;
833718dceddSDavid Howells 	__u64 blue;
834718dceddSDavid Howells };
835718dceddSDavid Howells 
8365488dc16SLionel Landwerlin struct drm_color_ctm {
83768824bb5SVille Syrjälä 	/*
83868824bb5SVille Syrjälä 	 * Conversion matrix in S31.32 sign-magnitude
83968824bb5SVille Syrjälä 	 * (not two's complement!) format.
84099e7e3b6SVille Syrjälä 	 *
84199e7e3b6SVille Syrjälä 	 * out   matrix    in
84299e7e3b6SVille Syrjälä 	 * |R|   |0 1 2|   |R|
84399e7e3b6SVille Syrjälä 	 * |G| = |3 4 5| x |G|
84499e7e3b6SVille Syrjälä 	 * |B|   |6 7 8|   |B|
84568824bb5SVille Syrjälä 	 */
84668824bb5SVille Syrjälä 	__u64 matrix[9];
8475488dc16SLionel Landwerlin };
8485488dc16SLionel Landwerlin 
8495488dc16SLionel Landwerlin struct drm_color_lut {
8505488dc16SLionel Landwerlin 	/*
8511fa6fa1cSDaniel Vetter 	 * Values are mapped linearly to 0.0 - 1.0 range, with 0x0 == 0.0 and
8521fa6fa1cSDaniel Vetter 	 * 0xffff == 1.0.
8535488dc16SLionel Landwerlin 	 */
8545488dc16SLionel Landwerlin 	__u16 red;
8555488dc16SLionel Landwerlin 	__u16 green;
8565488dc16SLionel Landwerlin 	__u16 blue;
8575488dc16SLionel Landwerlin 	__u16 reserved;
8585488dc16SLionel Landwerlin };
8595488dc16SLionel Landwerlin 
860a09db883SUma Shankar /**
861a09db883SUma Shankar  * struct hdr_metadata_infoframe - HDR Metadata Infoframe Data.
862a09db883SUma Shankar  *
863a09db883SUma Shankar  * HDR Metadata Infoframe as per CTA 861.G spec. This is expected
864a09db883SUma Shankar  * to match exactly with the spec.
865a09db883SUma Shankar  *
866a09db883SUma Shankar  * Userspace is expected to pass the metadata information as per
867a09db883SUma Shankar  * the format described in this structure.
868a09db883SUma Shankar  */
869fbb5d035SUma Shankar struct hdr_metadata_infoframe {
870a09db883SUma Shankar 	/**
871a09db883SUma Shankar 	 * @eotf: Electro-Optical Transfer Function (EOTF)
872a09db883SUma Shankar 	 * used in the stream.
873a09db883SUma Shankar 	 */
874fbb5d035SUma Shankar 	__u8 eotf;
875a09db883SUma Shankar 	/**
876a09db883SUma Shankar 	 * @metadata_type: Static_Metadata_Descriptor_ID.
877a09db883SUma Shankar 	 */
878fbb5d035SUma Shankar 	__u8 metadata_type;
879a09db883SUma Shankar 	/**
880a09db883SUma Shankar 	 * @display_primaries: Color Primaries of the Data.
881a09db883SUma Shankar 	 * These are coded as unsigned 16-bit values in units of
882a09db883SUma Shankar 	 * 0.00002, where 0x0000 represents zero and 0xC350
883a09db883SUma Shankar 	 * represents 1.0000.
884a09db883SUma Shankar 	 * @display_primaries.x: X cordinate of color primary.
885a09db883SUma Shankar 	 * @display_primaries.y: Y cordinate of color primary.
886a09db883SUma Shankar 	 */
887fbb5d035SUma Shankar 	struct {
888fbb5d035SUma Shankar 		__u16 x, y;
889fbb5d035SUma Shankar 	} display_primaries[3];
890a09db883SUma Shankar 	/**
891a09db883SUma Shankar 	 * @white_point: White Point of Colorspace Data.
892a09db883SUma Shankar 	 * These are coded as unsigned 16-bit values in units of
893a09db883SUma Shankar 	 * 0.00002, where 0x0000 represents zero and 0xC350
894a09db883SUma Shankar 	 * represents 1.0000.
895a09db883SUma Shankar 	 * @white_point.x: X cordinate of whitepoint of color primary.
896a09db883SUma Shankar 	 * @white_point.y: Y cordinate of whitepoint of color primary.
897a09db883SUma Shankar 	 */
898fbb5d035SUma Shankar 	struct {
899fbb5d035SUma Shankar 		__u16 x, y;
900fbb5d035SUma Shankar 	} white_point;
901a09db883SUma Shankar 	/**
902a09db883SUma Shankar 	 * @max_display_mastering_luminance: Max Mastering Display Luminance.
903a09db883SUma Shankar 	 * This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
904a09db883SUma Shankar 	 * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
905a09db883SUma Shankar 	 */
906fbb5d035SUma Shankar 	__u16 max_display_mastering_luminance;
907a09db883SUma Shankar 	/**
908a09db883SUma Shankar 	 * @min_display_mastering_luminance: Min Mastering Display Luminance.
909a09db883SUma Shankar 	 * This value is coded as an unsigned 16-bit value in units of
910a09db883SUma Shankar 	 * 0.0001 cd/m2, where 0x0001 represents 0.0001 cd/m2 and 0xFFFF
911a09db883SUma Shankar 	 * represents 6.5535 cd/m2.
912a09db883SUma Shankar 	 */
913fbb5d035SUma Shankar 	__u16 min_display_mastering_luminance;
914a09db883SUma Shankar 	/**
915a09db883SUma Shankar 	 * @max_cll: Max Content Light Level.
916a09db883SUma Shankar 	 * This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
917a09db883SUma Shankar 	 * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
918a09db883SUma Shankar 	 */
919fbb5d035SUma Shankar 	__u16 max_cll;
920a09db883SUma Shankar 	/**
921a09db883SUma Shankar 	 * @max_fall: Max Frame Average Light Level.
922a09db883SUma Shankar 	 * This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
923a09db883SUma Shankar 	 * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
924a09db883SUma Shankar 	 */
925fbb5d035SUma Shankar 	__u16 max_fall;
926fbb5d035SUma Shankar };
927fbb5d035SUma Shankar 
928a09db883SUma Shankar /**
929a09db883SUma Shankar  * struct hdr_output_metadata - HDR output metadata
930a09db883SUma Shankar  *
931a09db883SUma Shankar  * Metadata Information to be passed from userspace
932a09db883SUma Shankar  */
933fbb5d035SUma Shankar struct hdr_output_metadata {
934a09db883SUma Shankar 	/**
935a09db883SUma Shankar 	 * @metadata_type: Static_Metadata_Descriptor_ID.
936a09db883SUma Shankar 	 */
937fbb5d035SUma Shankar 	__u32 metadata_type;
938a09db883SUma Shankar 	/**
939a09db883SUma Shankar 	 * @hdmi_metadata_type1: HDR Metadata Infoframe.
940a09db883SUma Shankar 	 */
941fbb5d035SUma Shankar 	union {
942fbb5d035SUma Shankar 		struct hdr_metadata_infoframe hdmi_metadata_type1;
943fbb5d035SUma Shankar 	};
944fbb5d035SUma Shankar };
945fbb5d035SUma Shankar 
946f633a206SSimon Ser /**
947f633a206SSimon Ser  * DRM_MODE_PAGE_FLIP_EVENT
948f633a206SSimon Ser  *
949f633a206SSimon Ser  * Request that the kernel sends back a vblank event (see
950f633a206SSimon Ser  * struct drm_event_vblank) with the &DRM_EVENT_FLIP_COMPLETE type when the
951f633a206SSimon Ser  * page-flip is done.
952f633a206SSimon Ser  */
953718dceddSDavid Howells #define DRM_MODE_PAGE_FLIP_EVENT 0x01
954f633a206SSimon Ser /**
955f633a206SSimon Ser  * DRM_MODE_PAGE_FLIP_ASYNC
956f633a206SSimon Ser  *
957f633a206SSimon Ser  * Request that the page-flip is performed as soon as possible, ie. with no
958f633a206SSimon Ser  * delay due to waiting for vblank. This may cause tearing to be visible on
959f633a206SSimon Ser  * the screen.
960f633a206SSimon Ser  */
9619bba0c42SKeith Packard #define DRM_MODE_PAGE_FLIP_ASYNC 0x02
962f837297aSMichel Dänzer #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
963f837297aSMichel Dänzer #define DRM_MODE_PAGE_FLIP_TARGET_RELATIVE 0x8
964f837297aSMichel Dänzer #define DRM_MODE_PAGE_FLIP_TARGET (DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE | \
965f837297aSMichel Dänzer 				   DRM_MODE_PAGE_FLIP_TARGET_RELATIVE)
966f633a206SSimon Ser /**
967f633a206SSimon Ser  * DRM_MODE_PAGE_FLIP_FLAGS
968f633a206SSimon Ser  *
969f633a206SSimon Ser  * Bitmask of flags suitable for &drm_mode_crtc_page_flip_target.flags.
970f633a206SSimon Ser  */
971f837297aSMichel Dänzer #define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT | \
972f837297aSMichel Dänzer 				  DRM_MODE_PAGE_FLIP_ASYNC | \
973f837297aSMichel Dänzer 				  DRM_MODE_PAGE_FLIP_TARGET)
974718dceddSDavid Howells 
975718dceddSDavid Howells /*
976718dceddSDavid Howells  * Request a page flip on the specified crtc.
977718dceddSDavid Howells  *
978718dceddSDavid Howells  * This ioctl will ask KMS to schedule a page flip for the specified
979718dceddSDavid Howells  * crtc.  Once any pending rendering targeting the specified fb (as of
980718dceddSDavid Howells  * ioctl time) has completed, the crtc will be reprogrammed to display
981718dceddSDavid Howells  * that fb after the next vertical refresh.  The ioctl returns
982718dceddSDavid Howells  * immediately, but subsequent rendering to the current fb will block
983718dceddSDavid Howells  * in the execbuffer ioctl until the page flip happens.  If a page
984718dceddSDavid Howells  * flip is already pending as the ioctl is called, EBUSY will be
985718dceddSDavid Howells  * returned.
986718dceddSDavid Howells  *
9879bba0c42SKeith Packard  * Flag DRM_MODE_PAGE_FLIP_EVENT requests that drm sends back a vblank
9889bba0c42SKeith Packard  * event (see drm.h: struct drm_event_vblank) when the page flip is
9899bba0c42SKeith Packard  * done.  The user_data field passed in with this ioctl will be
9909bba0c42SKeith Packard  * returned as the user_data field in the vblank event struct.
9919bba0c42SKeith Packard  *
9929bba0c42SKeith Packard  * Flag DRM_MODE_PAGE_FLIP_ASYNC requests that the flip happen
9939bba0c42SKeith Packard  * 'as soon as possible', meaning that it not delay waiting for vblank.
9949bba0c42SKeith Packard  * This may cause tearing on the screen.
995718dceddSDavid Howells  *
996f837297aSMichel Dänzer  * The reserved field must be zero.
997718dceddSDavid Howells  */
998718dceddSDavid Howells 
999718dceddSDavid Howells struct drm_mode_crtc_page_flip {
1000718dceddSDavid Howells 	__u32 crtc_id;
1001718dceddSDavid Howells 	__u32 fb_id;
1002718dceddSDavid Howells 	__u32 flags;
1003718dceddSDavid Howells 	__u32 reserved;
1004718dceddSDavid Howells 	__u64 user_data;
1005718dceddSDavid Howells };
1006718dceddSDavid Howells 
1007f837297aSMichel Dänzer /*
1008f837297aSMichel Dänzer  * Request a page flip on the specified crtc.
1009f837297aSMichel Dänzer  *
1010f837297aSMichel Dänzer  * Same as struct drm_mode_crtc_page_flip, but supports new flags and
1011f837297aSMichel Dänzer  * re-purposes the reserved field:
1012f837297aSMichel Dänzer  *
1013f837297aSMichel Dänzer  * The sequence field must be zero unless either of the
1014f837297aSMichel Dänzer  * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is specified. When
1015f837297aSMichel Dänzer  * the ABSOLUTE flag is specified, the sequence field denotes the absolute
1016f837297aSMichel Dänzer  * vblank sequence when the flip should take effect. When the RELATIVE
1017f837297aSMichel Dänzer  * flag is specified, the sequence field denotes the relative (to the
1018f837297aSMichel Dänzer  * current one when the ioctl is called) vblank sequence when the flip
1019f837297aSMichel Dänzer  * should take effect. NOTE: DRM_IOCTL_WAIT_VBLANK must still be used to
1020f837297aSMichel Dänzer  * make sure the vblank sequence before the target one has passed before
1021f837297aSMichel Dänzer  * calling this ioctl. The purpose of the
1022f837297aSMichel Dänzer  * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is merely to clarify
1023f837297aSMichel Dänzer  * the target for when code dealing with a page flip runs during a
1024f837297aSMichel Dänzer  * vertical blank period.
1025f837297aSMichel Dänzer  */
1026f837297aSMichel Dänzer 
1027f837297aSMichel Dänzer struct drm_mode_crtc_page_flip_target {
1028f837297aSMichel Dänzer 	__u32 crtc_id;
1029f837297aSMichel Dänzer 	__u32 fb_id;
1030f837297aSMichel Dänzer 	__u32 flags;
1031f837297aSMichel Dänzer 	__u32 sequence;
1032f837297aSMichel Dänzer 	__u64 user_data;
1033f837297aSMichel Dänzer };
1034f837297aSMichel Dänzer 
1035718dceddSDavid Howells /* create a dumb scanout buffer */
1036718dceddSDavid Howells struct drm_mode_create_dumb {
103705623b7fSMikko Rapeli 	__u32 height;
103805623b7fSMikko Rapeli 	__u32 width;
103905623b7fSMikko Rapeli 	__u32 bpp;
104005623b7fSMikko Rapeli 	__u32 flags;
1041718dceddSDavid Howells 	/* handle, pitch, size will be returned */
104205623b7fSMikko Rapeli 	__u32 handle;
104305623b7fSMikko Rapeli 	__u32 pitch;
104405623b7fSMikko Rapeli 	__u64 size;
1045718dceddSDavid Howells };
1046718dceddSDavid Howells 
1047718dceddSDavid Howells /* set up for mmap of a dumb scanout buffer */
1048718dceddSDavid Howells struct drm_mode_map_dumb {
1049718dceddSDavid Howells 	/** Handle for the object being mapped. */
1050718dceddSDavid Howells 	__u32 handle;
1051718dceddSDavid Howells 	__u32 pad;
1052718dceddSDavid Howells 	/**
1053718dceddSDavid Howells 	 * Fake offset to use for subsequent mmap call
1054718dceddSDavid Howells 	 *
1055718dceddSDavid Howells 	 * This is a fixed-size type for 32/64 compatibility.
1056718dceddSDavid Howells 	 */
1057718dceddSDavid Howells 	__u64 offset;
1058718dceddSDavid Howells };
1059718dceddSDavid Howells 
1060718dceddSDavid Howells struct drm_mode_destroy_dumb {
106105623b7fSMikko Rapeli 	__u32 handle;
1062718dceddSDavid Howells };
1063718dceddSDavid Howells 
1064f633a206SSimon Ser /**
1065f633a206SSimon Ser  * DRM_MODE_ATOMIC_TEST_ONLY
1066f633a206SSimon Ser  *
1067f633a206SSimon Ser  * Do not apply the atomic commit, instead check whether the hardware supports
1068f633a206SSimon Ser  * this configuration.
1069f633a206SSimon Ser  *
1070f633a206SSimon Ser  * See &drm_mode_config_funcs.atomic_check for more details on test-only
1071f633a206SSimon Ser  * commits.
1072f633a206SSimon Ser  */
1073d34f20d6SRob Clark #define DRM_MODE_ATOMIC_TEST_ONLY 0x0100
1074f633a206SSimon Ser /**
1075f633a206SSimon Ser  * DRM_MODE_ATOMIC_NONBLOCK
1076f633a206SSimon Ser  *
1077f633a206SSimon Ser  * Do not block while applying the atomic commit. The &DRM_IOCTL_MODE_ATOMIC
1078f633a206SSimon Ser  * IOCTL returns immediately instead of waiting for the changes to be applied
1079f633a206SSimon Ser  * in hardware. Note, the driver will still check that the update can be
1080f633a206SSimon Ser  * applied before retuning.
1081f633a206SSimon Ser  */
1082d34f20d6SRob Clark #define DRM_MODE_ATOMIC_NONBLOCK  0x0200
1083f633a206SSimon Ser /**
1084f633a206SSimon Ser  * DRM_MODE_ATOMIC_ALLOW_MODESET
1085f633a206SSimon Ser  *
1086f633a206SSimon Ser  * Allow the update to result in temporary or transient visible artifacts while
1087f633a206SSimon Ser  * the update is being applied. Applying the update may also take significantly
1088f633a206SSimon Ser  * more time than a page flip. All visual artifacts will disappear by the time
1089f633a206SSimon Ser  * the update is completed, as signalled through the vblank event's timestamp
1090f633a206SSimon Ser  * (see struct drm_event_vblank).
1091f633a206SSimon Ser  *
1092f633a206SSimon Ser  * This flag must be set when the KMS update might cause visible artifacts.
1093f633a206SSimon Ser  * Without this flag such KMS update will return a EINVAL error. What kind of
1094f633a206SSimon Ser  * update may cause visible artifacts depends on the driver and the hardware.
1095f633a206SSimon Ser  * User-space that needs to know beforehand if an update might cause visible
1096f633a206SSimon Ser  * artifacts can use &DRM_MODE_ATOMIC_TEST_ONLY without
1097f633a206SSimon Ser  * &DRM_MODE_ATOMIC_ALLOW_MODESET to see if it fails.
1098f633a206SSimon Ser  *
1099f633a206SSimon Ser  * To the best of the driver's knowledge, visual artifacts are guaranteed to
1100f633a206SSimon Ser  * not appear when this flag is not set. Some sinks might display visual
1101f633a206SSimon Ser  * artifacts outside of the driver's control.
1102f633a206SSimon Ser  */
1103d34f20d6SRob Clark #define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400
1104d34f20d6SRob Clark 
1105f633a206SSimon Ser /**
1106f633a206SSimon Ser  * DRM_MODE_ATOMIC_FLAGS
1107f633a206SSimon Ser  *
1108f633a206SSimon Ser  * Bitfield of flags accepted by the &DRM_IOCTL_MODE_ATOMIC IOCTL in
1109f633a206SSimon Ser  * &drm_mode_atomic.flags.
1110f633a206SSimon Ser  */
1111d34f20d6SRob Clark #define DRM_MODE_ATOMIC_FLAGS (\
1112d34f20d6SRob Clark 		DRM_MODE_PAGE_FLIP_EVENT |\
1113d34f20d6SRob Clark 		DRM_MODE_PAGE_FLIP_ASYNC |\
1114d34f20d6SRob Clark 		DRM_MODE_ATOMIC_TEST_ONLY |\
1115d34f20d6SRob Clark 		DRM_MODE_ATOMIC_NONBLOCK |\
1116d34f20d6SRob Clark 		DRM_MODE_ATOMIC_ALLOW_MODESET)
1117d34f20d6SRob Clark 
1118d34f20d6SRob Clark struct drm_mode_atomic {
1119d34f20d6SRob Clark 	__u32 flags;
1120d34f20d6SRob Clark 	__u32 count_objs;
1121d34f20d6SRob Clark 	__u64 objs_ptr;
1122d34f20d6SRob Clark 	__u64 count_props_ptr;
1123d34f20d6SRob Clark 	__u64 props_ptr;
1124d34f20d6SRob Clark 	__u64 prop_values_ptr;
1125d34f20d6SRob Clark 	__u64 reserved;
1126d34f20d6SRob Clark 	__u64 user_data;
1127d34f20d6SRob Clark };
1128d34f20d6SRob Clark 
1129db1689aaSBen Widawsky struct drm_format_modifier_blob {
1130db1689aaSBen Widawsky #define FORMAT_BLOB_CURRENT 1
1131db1689aaSBen Widawsky 	/* Version of this blob format */
1132f44d8538SLionel Landwerlin 	__u32 version;
1133db1689aaSBen Widawsky 
1134db1689aaSBen Widawsky 	/* Flags */
1135f44d8538SLionel Landwerlin 	__u32 flags;
1136db1689aaSBen Widawsky 
1137db1689aaSBen Widawsky 	/* Number of fourcc formats supported */
1138f44d8538SLionel Landwerlin 	__u32 count_formats;
1139db1689aaSBen Widawsky 
1140db1689aaSBen Widawsky 	/* Where in this blob the formats exist (in bytes) */
1141f44d8538SLionel Landwerlin 	__u32 formats_offset;
1142db1689aaSBen Widawsky 
1143db1689aaSBen Widawsky 	/* Number of drm_format_modifiers */
1144f44d8538SLionel Landwerlin 	__u32 count_modifiers;
1145db1689aaSBen Widawsky 
1146db1689aaSBen Widawsky 	/* Where in this blob the modifiers exist (in bytes) */
1147f44d8538SLionel Landwerlin 	__u32 modifiers_offset;
1148db1689aaSBen Widawsky 
1149f44d8538SLionel Landwerlin 	/* __u32 formats[] */
1150db1689aaSBen Widawsky 	/* struct drm_format_modifier modifiers[] */
1151db1689aaSBen Widawsky };
1152db1689aaSBen Widawsky 
1153db1689aaSBen Widawsky struct drm_format_modifier {
1154db1689aaSBen Widawsky 	/* Bitmask of formats in get_plane format list this info applies to. The
1155db1689aaSBen Widawsky 	 * offset allows a sliding window of which 64 formats (bits).
1156db1689aaSBen Widawsky 	 *
1157db1689aaSBen Widawsky 	 * Some examples:
1158db1689aaSBen Widawsky 	 * In today's world with < 65 formats, and formats 0, and 2 are
1159db1689aaSBen Widawsky 	 * supported
1160db1689aaSBen Widawsky 	 * 0x0000000000000005
1161db1689aaSBen Widawsky 	 *		  ^-offset = 0, formats = 5
1162db1689aaSBen Widawsky 	 *
1163db1689aaSBen Widawsky 	 * If the number formats grew to 128, and formats 98-102 are
1164db1689aaSBen Widawsky 	 * supported with the modifier:
1165db1689aaSBen Widawsky 	 *
11666b8ed872SGabriel Krisman Bertazi 	 * 0x0000007c00000000 0000000000000000
1167db1689aaSBen Widawsky 	 *		  ^
11686b8ed872SGabriel Krisman Bertazi 	 *		  |__offset = 64, formats = 0x7c00000000
1169db1689aaSBen Widawsky 	 *
1170db1689aaSBen Widawsky 	 */
1171db1689aaSBen Widawsky 	__u64 formats;
1172db1689aaSBen Widawsky 	__u32 offset;
1173db1689aaSBen Widawsky 	__u32 pad;
1174db1689aaSBen Widawsky 
1175db1689aaSBen Widawsky 	/* The modifier that applies to the >get_plane format list bitmask. */
1176db1689aaSBen Widawsky 	__u64 modifier;
1177db1689aaSBen Widawsky };
1178db1689aaSBen Widawsky 
1179e2f5d2eaSDaniel Stone /**
1180762949bbSLionel Landwerlin  * struct drm_mode_create_blob - Create New blob property
118152aa300fSSimon Ser  *
1182e2f5d2eaSDaniel Stone  * Create a new 'blob' data property, copying length bytes from data pointer,
1183e2f5d2eaSDaniel Stone  * and returning new blob ID.
1184e2f5d2eaSDaniel Stone  */
1185e2f5d2eaSDaniel Stone struct drm_mode_create_blob {
118652aa300fSSimon Ser 	/** @data: Pointer to data to copy. */
1187e2f5d2eaSDaniel Stone 	__u64 data;
118852aa300fSSimon Ser 	/** @length: Length of data to copy. */
1189e2f5d2eaSDaniel Stone 	__u32 length;
119052aa300fSSimon Ser 	/** @blob_id: Return: new property ID. */
1191e2f5d2eaSDaniel Stone 	__u32 blob_id;
1192e2f5d2eaSDaniel Stone };
1193e2f5d2eaSDaniel Stone 
1194e2f5d2eaSDaniel Stone /**
1195cfc1ce7eSUma Shankar  * struct drm_mode_destroy_blob - Destroy user blob
1196cfc1ce7eSUma Shankar  * @blob_id: blob_id to destroy
119752aa300fSSimon Ser  *
1198e2f5d2eaSDaniel Stone  * Destroy a user-created blob property.
1199f3f0e410SSimon Ser  *
1200f3f0e410SSimon Ser  * User-space can release blobs as soon as they do not need to refer to them by
1201f3f0e410SSimon Ser  * their blob object ID.  For instance, if you are using a MODE_ID blob in an
1202f3f0e410SSimon Ser  * atomic commit and you will not make another commit re-using the same ID, you
1203f3f0e410SSimon Ser  * can destroy the blob as soon as the commit has been issued, without waiting
1204f3f0e410SSimon Ser  * for it to complete.
1205e2f5d2eaSDaniel Stone  */
1206e2f5d2eaSDaniel Stone struct drm_mode_destroy_blob {
1207e2f5d2eaSDaniel Stone 	__u32 blob_id;
1208e2f5d2eaSDaniel Stone };
1209e2f5d2eaSDaniel Stone 
121062884cd3SKeith Packard /**
1211cfc1ce7eSUma Shankar  * struct drm_mode_create_lease - Create lease
121252aa300fSSimon Ser  *
121362884cd3SKeith Packard  * Lease mode resources, creating another drm_master.
1214353be7c2SSimon Ser  *
1215353be7c2SSimon Ser  * The @object_ids array must reference at least one CRTC, one connector and
12164bb2d367SSimon Ser  * one plane if &DRM_CLIENT_CAP_UNIVERSAL_PLANES is enabled. Alternatively,
12174bb2d367SSimon Ser  * the lease can be completely empty.
121862884cd3SKeith Packard  */
121962884cd3SKeith Packard struct drm_mode_create_lease {
122052aa300fSSimon Ser 	/** @object_ids: Pointer to array of object ids (__u32) */
122162884cd3SKeith Packard 	__u64 object_ids;
122252aa300fSSimon Ser 	/** @object_count: Number of object ids */
122362884cd3SKeith Packard 	__u32 object_count;
122452aa300fSSimon Ser 	/** @flags: flags for new FD (O_CLOEXEC, etc) */
122562884cd3SKeith Packard 	__u32 flags;
122662884cd3SKeith Packard 
122752aa300fSSimon Ser 	/** @lessee_id: Return: unique identifier for lessee. */
122862884cd3SKeith Packard 	__u32 lessee_id;
122952aa300fSSimon Ser 	/** @fd: Return: file descriptor to new drm_master file */
123062884cd3SKeith Packard 	__u32 fd;
123162884cd3SKeith Packard };
123262884cd3SKeith Packard 
123362884cd3SKeith Packard /**
1234cfc1ce7eSUma Shankar  * struct drm_mode_list_lessees - List lessees
123552aa300fSSimon Ser  *
123652aa300fSSimon Ser  * List lesses from a drm_master.
123762884cd3SKeith Packard  */
123862884cd3SKeith Packard struct drm_mode_list_lessees {
123952aa300fSSimon Ser 	/**
124052aa300fSSimon Ser 	 * @count_lessees: Number of lessees.
124152aa300fSSimon Ser 	 *
124262884cd3SKeith Packard 	 * On input, provides length of the array.
124362884cd3SKeith Packard 	 * On output, provides total number. No
124462884cd3SKeith Packard 	 * more than the input number will be written
124562884cd3SKeith Packard 	 * back, so two calls can be used to get
124662884cd3SKeith Packard 	 * the size and then the data.
124762884cd3SKeith Packard 	 */
124862884cd3SKeith Packard 	__u32 count_lessees;
124952aa300fSSimon Ser 	/** @pad: Padding. */
125062884cd3SKeith Packard 	__u32 pad;
125162884cd3SKeith Packard 
125252aa300fSSimon Ser 	/**
125352aa300fSSimon Ser 	 * @lessees_ptr: Pointer to lessees.
125452aa300fSSimon Ser 	 *
125552aa300fSSimon Ser 	 * Pointer to __u64 array of lessee ids
125662884cd3SKeith Packard 	 */
125762884cd3SKeith Packard 	__u64 lessees_ptr;
125862884cd3SKeith Packard };
125962884cd3SKeith Packard 
126062884cd3SKeith Packard /**
1261cfc1ce7eSUma Shankar  * struct drm_mode_get_lease - Get Lease
126252aa300fSSimon Ser  *
126352aa300fSSimon Ser  * Get leased objects.
126462884cd3SKeith Packard  */
126562884cd3SKeith Packard struct drm_mode_get_lease {
126652aa300fSSimon Ser 	/**
126752aa300fSSimon Ser 	 * @count_objects: Number of leased objects.
126852aa300fSSimon Ser 	 *
126962884cd3SKeith Packard 	 * On input, provides length of the array.
127062884cd3SKeith Packard 	 * On output, provides total number. No
127162884cd3SKeith Packard 	 * more than the input number will be written
127262884cd3SKeith Packard 	 * back, so two calls can be used to get
127362884cd3SKeith Packard 	 * the size and then the data.
127462884cd3SKeith Packard 	 */
127562884cd3SKeith Packard 	__u32 count_objects;
127652aa300fSSimon Ser 	/** @pad: Padding. */
127762884cd3SKeith Packard 	__u32 pad;
127862884cd3SKeith Packard 
127952aa300fSSimon Ser 	/**
128052aa300fSSimon Ser 	 * @objects_ptr: Pointer to objects.
128152aa300fSSimon Ser 	 *
128252aa300fSSimon Ser 	 * Pointer to __u32 array of object ids.
128362884cd3SKeith Packard 	 */
128462884cd3SKeith Packard 	__u64 objects_ptr;
128562884cd3SKeith Packard };
128662884cd3SKeith Packard 
128762884cd3SKeith Packard /**
1288cfc1ce7eSUma Shankar  * struct drm_mode_revoke_lease - Revoke lease
128962884cd3SKeith Packard  */
129062884cd3SKeith Packard struct drm_mode_revoke_lease {
129152aa300fSSimon Ser 	/** @lessee_id: Unique ID of lessee */
129262884cd3SKeith Packard 	__u32 lessee_id;
129362884cd3SKeith Packard };
129462884cd3SKeith Packard 
1295d3b21767SLukasz Spintzyk /**
1296d3b21767SLukasz Spintzyk  * struct drm_mode_rect - Two dimensional rectangle.
1297d3b21767SLukasz Spintzyk  * @x1: Horizontal starting coordinate (inclusive).
1298d3b21767SLukasz Spintzyk  * @y1: Vertical starting coordinate (inclusive).
1299d3b21767SLukasz Spintzyk  * @x2: Horizontal ending coordinate (exclusive).
1300d3b21767SLukasz Spintzyk  * @y2: Vertical ending coordinate (exclusive).
1301d3b21767SLukasz Spintzyk  *
1302d3b21767SLukasz Spintzyk  * With drm subsystem using struct drm_rect to manage rectangular area this
1303d3b21767SLukasz Spintzyk  * export it to user-space.
1304d3b21767SLukasz Spintzyk  *
1305d3b21767SLukasz Spintzyk  * Currently used by drm_mode_atomic blob property FB_DAMAGE_CLIPS.
1306d3b21767SLukasz Spintzyk  */
1307d3b21767SLukasz Spintzyk struct drm_mode_rect {
1308d3b21767SLukasz Spintzyk 	__s32 x1;
1309d3b21767SLukasz Spintzyk 	__s32 y1;
1310d3b21767SLukasz Spintzyk 	__s32 x2;
1311d3b21767SLukasz Spintzyk 	__s32 y2;
1312d3b21767SLukasz Spintzyk };
1313d3b21767SLukasz Spintzyk 
1314ebbb0e5cSEmil Velikov #if defined(__cplusplus)
1315ebbb0e5cSEmil Velikov }
1316ebbb0e5cSEmil Velikov #endif
1317ebbb0e5cSEmil Velikov 
1318718dceddSDavid Howells #endif
1319