122944501Smrg/*
222944501Smrg * Copyright (c) 2007 Dave Airlie <airlied@linux.ie>
322944501Smrg * Copyright (c) 2007 Jakob Bornecrantz <wallbraker@gmail.com>
422944501Smrg * Copyright (c) 2008 Red Hat Inc.
522944501Smrg * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA
622944501Smrg * Copyright (c) 2007-2008 Intel Corporation
722944501Smrg *
822944501Smrg * Permission is hereby granted, free of charge, to any person obtaining a
922944501Smrg * copy of this software and associated documentation files (the "Software"),
1022944501Smrg * to deal in the Software without restriction, including without limitation
1122944501Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
1222944501Smrg * and/or sell copies of the Software, and to permit persons to whom the
1322944501Smrg * Software is furnished to do so, subject to the following conditions:
1422944501Smrg *
1522944501Smrg * The above copyright notice and this permission notice shall be included in
1622944501Smrg * all copies or substantial portions of the Software.
1722944501Smrg *
1822944501Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1922944501Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2022944501Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2122944501Smrg * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2222944501Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2322944501Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2422944501Smrg * IN THE SOFTWARE.
2522944501Smrg */
2622944501Smrg
2722944501Smrg#ifndef _DRM_MODE_H
2822944501Smrg#define _DRM_MODE_H
2922944501Smrg
303f012e29Smrg#include "drm.h"
313f012e29Smrg
32037b3c26Smrg#if defined(__cplusplus)
33037b3c26Smrgextern "C" {
34037b3c26Smrg#endif
35037b3c26Smrg
3641687f09Smrg/**
3741687f09Smrg * DOC: overview
3841687f09Smrg *
39bbff01ceSmrg * DRM exposes many UAPI and structure definitions to have a consistent
40bbff01ceSmrg * and standardized interface with users.
4141687f09Smrg * Userspace can refer to these structure definitions and UAPI formats
42bbff01ceSmrg * to communicate to drivers.
4341687f09Smrg */
4441687f09Smrg
4522944501Smrg#define DRM_CONNECTOR_NAME_LEN	32
4622944501Smrg#define DRM_DISPLAY_MODE_LEN	32
4722944501Smrg#define DRM_PROP_NAME_LEN	32
4822944501Smrg
497cdc0497Smrg#define DRM_MODE_TYPE_BUILTIN	(1<<0) /* deprecated */
507cdc0497Smrg#define DRM_MODE_TYPE_CLOCK_C	((1<<1) | DRM_MODE_TYPE_BUILTIN) /* deprecated */
517cdc0497Smrg#define DRM_MODE_TYPE_CRTC_C	((1<<2) | DRM_MODE_TYPE_BUILTIN) /* deprecated */
5222944501Smrg#define DRM_MODE_TYPE_PREFERRED	(1<<3)
537cdc0497Smrg#define DRM_MODE_TYPE_DEFAULT	(1<<4) /* deprecated */
5422944501Smrg#define DRM_MODE_TYPE_USERDEF	(1<<5)
5522944501Smrg#define DRM_MODE_TYPE_DRIVER	(1<<6)
5622944501Smrg
577cdc0497Smrg#define DRM_MODE_TYPE_ALL	(DRM_MODE_TYPE_PREFERRED |	\
587cdc0497Smrg				 DRM_MODE_TYPE_USERDEF |	\
597cdc0497Smrg				 DRM_MODE_TYPE_DRIVER)
607cdc0497Smrg
6122944501Smrg/* Video mode flags */
62d8807b2fSmrg/* bit compatible with the xrandr RR_ definitions (bits 0-13)
63d8807b2fSmrg *
64d8807b2fSmrg * ABI warning: Existing userspace really expects
65d8807b2fSmrg * the mode flags to match the xrandr definitions. Any
66d8807b2fSmrg * changes that don't match the xrandr definitions will
67d8807b2fSmrg * likely need a new client cap or some other mechanism
68d8807b2fSmrg * to avoid breaking existing userspace. This includes
69d8807b2fSmrg * allocating new flags in the previously unused bits!
70d8807b2fSmrg */
71e88f27b3Smrg#define DRM_MODE_FLAG_PHSYNC			(1<<0)
72e88f27b3Smrg#define DRM_MODE_FLAG_NHSYNC			(1<<1)
73e88f27b3Smrg#define DRM_MODE_FLAG_PVSYNC			(1<<2)
74e88f27b3Smrg#define DRM_MODE_FLAG_NVSYNC			(1<<3)
75e88f27b3Smrg#define DRM_MODE_FLAG_INTERLACE			(1<<4)
76e88f27b3Smrg#define DRM_MODE_FLAG_DBLSCAN			(1<<5)
77e88f27b3Smrg#define DRM_MODE_FLAG_CSYNC			(1<<6)
78e88f27b3Smrg#define DRM_MODE_FLAG_PCSYNC			(1<<7)
79e88f27b3Smrg#define DRM_MODE_FLAG_NCSYNC			(1<<8)
80e88f27b3Smrg#define DRM_MODE_FLAG_HSKEW			(1<<9) /* hskew provided */
817cdc0497Smrg#define DRM_MODE_FLAG_BCAST			(1<<10) /* deprecated */
827cdc0497Smrg#define DRM_MODE_FLAG_PIXMUX			(1<<11) /* deprecated */
83e88f27b3Smrg#define DRM_MODE_FLAG_DBLCLK			(1<<12)
84e88f27b3Smrg#define DRM_MODE_FLAG_CLKDIV2			(1<<13)
853f012e29Smrg /*
863f012e29Smrg  * When adding a new stereo mode don't forget to adjust DRM_MODE_FLAGS_3D_MAX
873f012e29Smrg  * (define not exposed to user space).
883f012e29Smrg  */
89e88f27b3Smrg#define DRM_MODE_FLAG_3D_MASK			(0x1f<<14)
9000a23bdaSmrg#define  DRM_MODE_FLAG_3D_NONE		(0<<14)
91e88f27b3Smrg#define  DRM_MODE_FLAG_3D_FRAME_PACKING		(1<<14)
92e88f27b3Smrg#define  DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE	(2<<14)
93e88f27b3Smrg#define  DRM_MODE_FLAG_3D_LINE_ALTERNATIVE	(3<<14)
94e88f27b3Smrg#define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL	(4<<14)
95e88f27b3Smrg#define  DRM_MODE_FLAG_3D_L_DEPTH		(5<<14)
96e88f27b3Smrg#define  DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH	(6<<14)
97e88f27b3Smrg#define  DRM_MODE_FLAG_3D_TOP_AND_BOTTOM	(7<<14)
98e88f27b3Smrg#define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF	(8<<14)
99e88f27b3Smrg
10000a23bdaSmrg/* Picture aspect ratio options */
10100a23bdaSmrg#define DRM_MODE_PICTURE_ASPECT_NONE		0
10200a23bdaSmrg#define DRM_MODE_PICTURE_ASPECT_4_3		1
10300a23bdaSmrg#define DRM_MODE_PICTURE_ASPECT_16_9		2
1047cdc0497Smrg#define DRM_MODE_PICTURE_ASPECT_64_27		3
1057cdc0497Smrg#define DRM_MODE_PICTURE_ASPECT_256_135		4
1067cdc0497Smrg
1077cdc0497Smrg/* Content type options */
1087cdc0497Smrg#define DRM_MODE_CONTENT_TYPE_NO_DATA		0
1097cdc0497Smrg#define DRM_MODE_CONTENT_TYPE_GRAPHICS		1
1107cdc0497Smrg#define DRM_MODE_CONTENT_TYPE_PHOTO		2
1117cdc0497Smrg#define DRM_MODE_CONTENT_TYPE_CINEMA		3
1127cdc0497Smrg#define DRM_MODE_CONTENT_TYPE_GAME		4
11300a23bdaSmrg
11400a23bdaSmrg/* Aspect ratio flag bitmask (4 bits 22:19) */
11500a23bdaSmrg#define DRM_MODE_FLAG_PIC_AR_MASK		(0x0F<<19)
11600a23bdaSmrg#define  DRM_MODE_FLAG_PIC_AR_NONE \
11700a23bdaSmrg			(DRM_MODE_PICTURE_ASPECT_NONE<<19)
11800a23bdaSmrg#define  DRM_MODE_FLAG_PIC_AR_4_3 \
11900a23bdaSmrg			(DRM_MODE_PICTURE_ASPECT_4_3<<19)
12000a23bdaSmrg#define  DRM_MODE_FLAG_PIC_AR_16_9 \
12100a23bdaSmrg			(DRM_MODE_PICTURE_ASPECT_16_9<<19)
1227cdc0497Smrg#define  DRM_MODE_FLAG_PIC_AR_64_27 \
1237cdc0497Smrg			(DRM_MODE_PICTURE_ASPECT_64_27<<19)
1247cdc0497Smrg#define  DRM_MODE_FLAG_PIC_AR_256_135 \
1257cdc0497Smrg			(DRM_MODE_PICTURE_ASPECT_256_135<<19)
1267cdc0497Smrg
1277cdc0497Smrg#define  DRM_MODE_FLAG_ALL	(DRM_MODE_FLAG_PHSYNC |		\
1287cdc0497Smrg				 DRM_MODE_FLAG_NHSYNC |		\
1297cdc0497Smrg				 DRM_MODE_FLAG_PVSYNC |		\
1307cdc0497Smrg				 DRM_MODE_FLAG_NVSYNC |		\
1317cdc0497Smrg				 DRM_MODE_FLAG_INTERLACE |	\
1327cdc0497Smrg				 DRM_MODE_FLAG_DBLSCAN |	\
1337cdc0497Smrg				 DRM_MODE_FLAG_CSYNC |		\
1347cdc0497Smrg				 DRM_MODE_FLAG_PCSYNC |		\
1357cdc0497Smrg				 DRM_MODE_FLAG_NCSYNC |		\
1367cdc0497Smrg				 DRM_MODE_FLAG_HSKEW |		\
1377cdc0497Smrg				 DRM_MODE_FLAG_DBLCLK |		\
1387cdc0497Smrg				 DRM_MODE_FLAG_CLKDIV2 |	\
1397cdc0497Smrg				 DRM_MODE_FLAG_3D_MASK)
14022944501Smrg
14122944501Smrg/* DPMS flags */
14222944501Smrg/* bit compatible with the xorg definitions. */
14322944501Smrg#define DRM_MODE_DPMS_ON	0
14422944501Smrg#define DRM_MODE_DPMS_STANDBY	1
14522944501Smrg#define DRM_MODE_DPMS_SUSPEND	2
14622944501Smrg#define DRM_MODE_DPMS_OFF	3
14722944501Smrg
14822944501Smrg/* Scaling mode options */
14922944501Smrg#define DRM_MODE_SCALE_NONE		0 /* Unmodified timing (display or
15022944501Smrg					     software can still scale) */
15122944501Smrg#define DRM_MODE_SCALE_FULLSCREEN	1 /* Full screen, ignore aspect */
15222944501Smrg#define DRM_MODE_SCALE_CENTER		2 /* Centered, no scaling */
15322944501Smrg#define DRM_MODE_SCALE_ASPECT		3 /* Full screen, preserve aspect */
15422944501Smrg
15522944501Smrg/* Dithering mode options */
15622944501Smrg#define DRM_MODE_DITHERING_OFF	0
15722944501Smrg#define DRM_MODE_DITHERING_ON	1
158d049871aSmrg#define DRM_MODE_DITHERING_AUTO 2
15922944501Smrg
16013d1d17dSmrg/* Dirty info options */
16113d1d17dSmrg#define DRM_MODE_DIRTY_OFF      0
16213d1d17dSmrg#define DRM_MODE_DIRTY_ON       1
16313d1d17dSmrg#define DRM_MODE_DIRTY_ANNOTATE 2
16413d1d17dSmrg
165d8807b2fSmrg/* Link Status options */
166d8807b2fSmrg#define DRM_MODE_LINK_STATUS_GOOD	0
167d8807b2fSmrg#define DRM_MODE_LINK_STATUS_BAD	1
168d8807b2fSmrg
16900a23bdaSmrg/*
17000a23bdaSmrg * DRM_MODE_ROTATE_<degrees>
17100a23bdaSmrg *
17200a23bdaSmrg * Signals that a drm plane is been rotated <degrees> degrees in counter
17300a23bdaSmrg * clockwise direction.
17400a23bdaSmrg *
17500a23bdaSmrg * This define is provided as a convenience, looking up the property id
17600a23bdaSmrg * using the name->prop id lookup is the preferred method.
17700a23bdaSmrg */
17800a23bdaSmrg#define DRM_MODE_ROTATE_0       (1<<0)
17900a23bdaSmrg#define DRM_MODE_ROTATE_90      (1<<1)
18000a23bdaSmrg#define DRM_MODE_ROTATE_180     (1<<2)
18100a23bdaSmrg#define DRM_MODE_ROTATE_270     (1<<3)
18200a23bdaSmrg
18300a23bdaSmrg/*
18400a23bdaSmrg * DRM_MODE_ROTATE_MASK
18500a23bdaSmrg *
18600a23bdaSmrg * Bitmask used to look for drm plane rotations.
18700a23bdaSmrg */
18800a23bdaSmrg#define DRM_MODE_ROTATE_MASK (\
18900a23bdaSmrg		DRM_MODE_ROTATE_0  | \
19000a23bdaSmrg		DRM_MODE_ROTATE_90  | \
19100a23bdaSmrg		DRM_MODE_ROTATE_180 | \
19200a23bdaSmrg		DRM_MODE_ROTATE_270)
19300a23bdaSmrg
19400a23bdaSmrg/*
19500a23bdaSmrg * DRM_MODE_REFLECT_<axis>
19600a23bdaSmrg *
1977cdc0497Smrg * Signals that the contents of a drm plane is reflected along the <axis> axis,
19800a23bdaSmrg * in the same way as mirroring.
1997cdc0497Smrg * See kerneldoc chapter "Plane Composition Properties" for more details.
20000a23bdaSmrg *
20100a23bdaSmrg * This define is provided as a convenience, looking up the property id
20200a23bdaSmrg * using the name->prop id lookup is the preferred method.
20300a23bdaSmrg */
20400a23bdaSmrg#define DRM_MODE_REFLECT_X      (1<<4)
20500a23bdaSmrg#define DRM_MODE_REFLECT_Y      (1<<5)
20600a23bdaSmrg
20700a23bdaSmrg/*
20800a23bdaSmrg * DRM_MODE_REFLECT_MASK
20900a23bdaSmrg *
21000a23bdaSmrg * Bitmask used to look for drm plane reflections.
21100a23bdaSmrg */
21200a23bdaSmrg#define DRM_MODE_REFLECT_MASK (\
21300a23bdaSmrg		DRM_MODE_REFLECT_X | \
21400a23bdaSmrg		DRM_MODE_REFLECT_Y)
21500a23bdaSmrg
2167cdc0497Smrg/* Content Protection Flags */
2177cdc0497Smrg#define DRM_MODE_CONTENT_PROTECTION_UNDESIRED	0
2187cdc0497Smrg#define DRM_MODE_CONTENT_PROTECTION_DESIRED     1
2197cdc0497Smrg#define DRM_MODE_CONTENT_PROTECTION_ENABLED     2
22000a23bdaSmrg
22149ef06a4Smrg/**
22249ef06a4Smrg * struct drm_mode_modeinfo - Display mode information.
22349ef06a4Smrg * @clock: pixel clock in kHz
22449ef06a4Smrg * @hdisplay: horizontal display size
22549ef06a4Smrg * @hsync_start: horizontal sync start
22649ef06a4Smrg * @hsync_end: horizontal sync end
22749ef06a4Smrg * @htotal: horizontal total size
22849ef06a4Smrg * @hskew: horizontal skew
22949ef06a4Smrg * @vdisplay: vertical display size
23049ef06a4Smrg * @vsync_start: vertical sync start
23149ef06a4Smrg * @vsync_end: vertical sync end
23249ef06a4Smrg * @vtotal: vertical total size
23349ef06a4Smrg * @vscan: vertical scan
23449ef06a4Smrg * @vrefresh: approximate vertical refresh rate in Hz
23549ef06a4Smrg * @flags: bitmask of misc. flags, see DRM_MODE_FLAG_* defines
23649ef06a4Smrg * @type: bitmask of type flags, see DRM_MODE_TYPE_* defines
23749ef06a4Smrg * @name: string describing the mode resolution
23849ef06a4Smrg *
23949ef06a4Smrg * This is the user-space API display mode information structure. For the
24049ef06a4Smrg * kernel version see struct drm_display_mode.
24149ef06a4Smrg */
24222944501Smrgstruct drm_mode_modeinfo {
24322944501Smrg	__u32 clock;
2443f012e29Smrg	__u16 hdisplay;
2453f012e29Smrg	__u16 hsync_start;
2463f012e29Smrg	__u16 hsync_end;
2473f012e29Smrg	__u16 htotal;
2483f012e29Smrg	__u16 hskew;
2493f012e29Smrg	__u16 vdisplay;
2503f012e29Smrg	__u16 vsync_start;
2513f012e29Smrg	__u16 vsync_end;
2523f012e29Smrg	__u16 vtotal;
2533f012e29Smrg	__u16 vscan;
25422944501Smrg
255d049871aSmrg	__u32 vrefresh;
25622944501Smrg
25722944501Smrg	__u32 flags;
25822944501Smrg	__u32 type;
25922944501Smrg	char name[DRM_DISPLAY_MODE_LEN];
26022944501Smrg};
26122944501Smrg
26222944501Smrgstruct drm_mode_card_res {
26322944501Smrg	__u64 fb_id_ptr;
26422944501Smrg	__u64 crtc_id_ptr;
26522944501Smrg	__u64 connector_id_ptr;
26622944501Smrg	__u64 encoder_id_ptr;
26722944501Smrg	__u32 count_fbs;
26822944501Smrg	__u32 count_crtcs;
26922944501Smrg	__u32 count_connectors;
27022944501Smrg	__u32 count_encoders;
2713f012e29Smrg	__u32 min_width;
2723f012e29Smrg	__u32 max_width;
2733f012e29Smrg	__u32 min_height;
2743f012e29Smrg	__u32 max_height;
27522944501Smrg};
27622944501Smrg
27722944501Smrgstruct drm_mode_crtc {
27822944501Smrg	__u64 set_connectors_ptr;
27922944501Smrg	__u32 count_connectors;
28022944501Smrg
28122944501Smrg	__u32 crtc_id; /**< Id */
28222944501Smrg	__u32 fb_id; /**< Id of framebuffer */
28322944501Smrg
2843f012e29Smrg	__u32 x; /**< x Position on the framebuffer */
2853f012e29Smrg	__u32 y; /**< y Position on the framebuffer */
28622944501Smrg
28722944501Smrg	__u32 gamma_size;
28822944501Smrg	__u32 mode_valid;
28922944501Smrg	struct drm_mode_modeinfo mode;
29022944501Smrg};
29122944501Smrg
2923f012e29Smrg#define DRM_MODE_PRESENT_TOP_FIELD	(1<<0)
2933f012e29Smrg#define DRM_MODE_PRESENT_BOTTOM_FIELD	(1<<1)
294e88f27b3Smrg
295e88f27b3Smrg/* Planes blend with or override other bits on the CRTC */
296e88f27b3Smrgstruct drm_mode_set_plane {
297e88f27b3Smrg	__u32 plane_id;
298e88f27b3Smrg	__u32 crtc_id;
299e88f27b3Smrg	__u32 fb_id; /* fb object contains surface format type */
3003f012e29Smrg	__u32 flags; /* see above flags */
301e88f27b3Smrg
302e88f27b3Smrg	/* Signed dest location allows it to be partially off screen */
3033f012e29Smrg	__s32 crtc_x;
3043f012e29Smrg	__s32 crtc_y;
3053f012e29Smrg	__u32 crtc_w;
3063f012e29Smrg	__u32 crtc_h;
307e88f27b3Smrg
308e88f27b3Smrg	/* Source values are 16.16 fixed point */
3093f012e29Smrg	__u32 src_x;
3103f012e29Smrg	__u32 src_y;
3113f012e29Smrg	__u32 src_h;
3123f012e29Smrg	__u32 src_w;
313e88f27b3Smrg};
314e88f27b3Smrg
315bbff01ceSmrg/**
316bbff01ceSmrg * struct drm_mode_get_plane - Get plane metadata.
317bbff01ceSmrg *
318bbff01ceSmrg * Userspace can perform a GETPLANE ioctl to retrieve information about a
319bbff01ceSmrg * plane.
320bbff01ceSmrg *
321bbff01ceSmrg * To retrieve the number of formats supported, set @count_format_types to zero
322bbff01ceSmrg * and call the ioctl. @count_format_types will be updated with the value.
323bbff01ceSmrg *
324bbff01ceSmrg * To retrieve these formats, allocate an array with the memory needed to store
325bbff01ceSmrg * @count_format_types formats. Point @format_type_ptr to this array and call
326bbff01ceSmrg * the ioctl again (with @count_format_types still set to the value returned in
327bbff01ceSmrg * the first ioctl call).
328bbff01ceSmrg */
329e88f27b3Smrgstruct drm_mode_get_plane {
330bbff01ceSmrg	/**
331bbff01ceSmrg	 * @plane_id: Object ID of the plane whose information should be
332bbff01ceSmrg	 * retrieved. Set by caller.
333bbff01ceSmrg	 */
334e88f27b3Smrg	__u32 plane_id;
335e88f27b3Smrg
336bbff01ceSmrg	/** @crtc_id: Object ID of the current CRTC. */
337e88f27b3Smrg	__u32 crtc_id;
338bbff01ceSmrg	/** @fb_id: Object ID of the current fb. */
339e88f27b3Smrg	__u32 fb_id;
340e88f27b3Smrg
341bbff01ceSmrg	/**
342bbff01ceSmrg	 * @possible_crtcs: Bitmask of CRTC's compatible with the plane. CRTC's
343bbff01ceSmrg	 * are created and they receive an index, which corresponds to their
344bbff01ceSmrg	 * position in the bitmask. Bit N corresponds to
345bbff01ceSmrg	 * :ref:`CRTC index<crtc_index>` N.
346bbff01ceSmrg	 */
347e88f27b3Smrg	__u32 possible_crtcs;
348bbff01ceSmrg	/** @gamma_size: Never used. */
349e88f27b3Smrg	__u32 gamma_size;
350e88f27b3Smrg
351bbff01ceSmrg	/** @count_format_types: Number of formats. */
352e88f27b3Smrg	__u32 count_format_types;
353bbff01ceSmrg	/**
354bbff01ceSmrg	 * @format_type_ptr: Pointer to ``__u32`` array of formats that are
355bbff01ceSmrg	 * supported by the plane. These formats do not require modifiers.
356bbff01ceSmrg	 */
357e88f27b3Smrg	__u64 format_type_ptr;
358e88f27b3Smrg};
359e88f27b3Smrg
360e88f27b3Smrgstruct drm_mode_get_plane_res {
361e88f27b3Smrg	__u64 plane_id_ptr;
362e88f27b3Smrg	__u32 count_planes;
363e88f27b3Smrg};
364e88f27b3Smrg
36522944501Smrg#define DRM_MODE_ENCODER_NONE	0
36622944501Smrg#define DRM_MODE_ENCODER_DAC	1
36722944501Smrg#define DRM_MODE_ENCODER_TMDS	2
36822944501Smrg#define DRM_MODE_ENCODER_LVDS	3
36922944501Smrg#define DRM_MODE_ENCODER_TVDAC	4
37008d7334dSsnj#define DRM_MODE_ENCODER_VIRTUAL 5
37108d7334dSsnj#define DRM_MODE_ENCODER_DSI	6
37208d7334dSsnj#define DRM_MODE_ENCODER_DPMST	7
373037b3c26Smrg#define DRM_MODE_ENCODER_DPI	8
37422944501Smrg
37522944501Smrgstruct drm_mode_get_encoder {
37622944501Smrg	__u32 encoder_id;
37722944501Smrg	__u32 encoder_type;
37822944501Smrg
37922944501Smrg	__u32 crtc_id; /**< Id of crtc */
38022944501Smrg
38122944501Smrg	__u32 possible_crtcs;
38222944501Smrg	__u32 possible_clones;
38322944501Smrg};
38422944501Smrg
38522944501Smrg/* This is for connectors with multiple signal types. */
38622944501Smrg/* Try to match DRM_MODE_CONNECTOR_X as closely as possible. */
387d8807b2fSmrgenum drm_mode_subconnector {
38841687f09Smrg	DRM_MODE_SUBCONNECTOR_Automatic   = 0,  /* DVI-I, TV     */
38941687f09Smrg	DRM_MODE_SUBCONNECTOR_Unknown     = 0,  /* DVI-I, TV, DP */
39041687f09Smrg	DRM_MODE_SUBCONNECTOR_VGA	  = 1,  /*            DP */
39141687f09Smrg	DRM_MODE_SUBCONNECTOR_DVID	  = 3,  /* DVI-I      DP */
39241687f09Smrg	DRM_MODE_SUBCONNECTOR_DVIA	  = 4,  /* DVI-I         */
39341687f09Smrg	DRM_MODE_SUBCONNECTOR_Composite   = 5,  /*        TV     */
39441687f09Smrg	DRM_MODE_SUBCONNECTOR_SVIDEO	  = 6,  /*        TV     */
39541687f09Smrg	DRM_MODE_SUBCONNECTOR_Component   = 8,  /*        TV     */
39641687f09Smrg	DRM_MODE_SUBCONNECTOR_SCART	  = 9,  /*        TV     */
39741687f09Smrg	DRM_MODE_SUBCONNECTOR_DisplayPort = 10, /*            DP */
39841687f09Smrg	DRM_MODE_SUBCONNECTOR_HDMIA       = 11, /*            DP */
39941687f09Smrg	DRM_MODE_SUBCONNECTOR_Native      = 15, /*            DP */
40041687f09Smrg	DRM_MODE_SUBCONNECTOR_Wireless    = 18, /*            DP */
401d8807b2fSmrg};
40222944501Smrg
40322944501Smrg#define DRM_MODE_CONNECTOR_Unknown	0
40422944501Smrg#define DRM_MODE_CONNECTOR_VGA		1
40522944501Smrg#define DRM_MODE_CONNECTOR_DVII		2
40622944501Smrg#define DRM_MODE_CONNECTOR_DVID		3
40722944501Smrg#define DRM_MODE_CONNECTOR_DVIA		4
40822944501Smrg#define DRM_MODE_CONNECTOR_Composite	5
40922944501Smrg#define DRM_MODE_CONNECTOR_SVIDEO	6
41022944501Smrg#define DRM_MODE_CONNECTOR_LVDS		7
41122944501Smrg#define DRM_MODE_CONNECTOR_Component	8
41222944501Smrg#define DRM_MODE_CONNECTOR_9PinDIN	9
41322944501Smrg#define DRM_MODE_CONNECTOR_DisplayPort	10
41422944501Smrg#define DRM_MODE_CONNECTOR_HDMIA	11
41522944501Smrg#define DRM_MODE_CONNECTOR_HDMIB	12
41622944501Smrg#define DRM_MODE_CONNECTOR_TV		13
417d049871aSmrg#define DRM_MODE_CONNECTOR_eDP		14
41808d7334dSsnj#define DRM_MODE_CONNECTOR_VIRTUAL      15
41908d7334dSsnj#define DRM_MODE_CONNECTOR_DSI		16
420037b3c26Smrg#define DRM_MODE_CONNECTOR_DPI		17
4217cdc0497Smrg#define DRM_MODE_CONNECTOR_WRITEBACK	18
42241687f09Smrg#define DRM_MODE_CONNECTOR_SPI		19
42349ef06a4Smrg#define DRM_MODE_CONNECTOR_USB		20
42422944501Smrg
42549ef06a4Smrg/**
42649ef06a4Smrg * struct drm_mode_get_connector - Get connector metadata.
42749ef06a4Smrg *
42849ef06a4Smrg * User-space can perform a GETCONNECTOR ioctl to retrieve information about a
42949ef06a4Smrg * connector. User-space is expected to retrieve encoders, modes and properties
43049ef06a4Smrg * by performing this ioctl at least twice: the first time to retrieve the
43149ef06a4Smrg * number of elements, the second time to retrieve the elements themselves.
43249ef06a4Smrg *
43349ef06a4Smrg * To retrieve the number of elements, set @count_props and @count_encoders to
43449ef06a4Smrg * zero, set @count_modes to 1, and set @modes_ptr to a temporary struct
43549ef06a4Smrg * drm_mode_modeinfo element.
43649ef06a4Smrg *
43749ef06a4Smrg * To retrieve the elements, allocate arrays for @encoders_ptr, @modes_ptr,
43849ef06a4Smrg * @props_ptr and @prop_values_ptr, then set @count_modes, @count_props and
43949ef06a4Smrg * @count_encoders to their capacity.
44049ef06a4Smrg *
44149ef06a4Smrg * Performing the ioctl only twice may be racy: the number of elements may have
44249ef06a4Smrg * changed with a hotplug event in-between the two ioctls. User-space is
44349ef06a4Smrg * expected to retry the last ioctl until the number of elements stabilizes.
44449ef06a4Smrg * The kernel won't fill any array which doesn't have the expected length.
44549ef06a4Smrg *
44649ef06a4Smrg * **Force-probing a connector**
44749ef06a4Smrg *
44849ef06a4Smrg * If the @count_modes field is set to zero and the DRM client is the current
44949ef06a4Smrg * DRM master, the kernel will perform a forced probe on the connector to
45049ef06a4Smrg * refresh the connector status, modes and EDID. A forced-probe can be slow,
45149ef06a4Smrg * might cause flickering and the ioctl will block.
45249ef06a4Smrg *
45349ef06a4Smrg * User-space needs to force-probe connectors to ensure their metadata is
45449ef06a4Smrg * up-to-date at startup and after receiving a hot-plug event. User-space
45549ef06a4Smrg * may perform a forced-probe when the user explicitly requests it. User-space
45649ef06a4Smrg * shouldn't perform a forced-probe in other situations.
45749ef06a4Smrg */
45822944501Smrgstruct drm_mode_get_connector {
45949ef06a4Smrg	/** @encoders_ptr: Pointer to ``__u32`` array of object IDs. */
46022944501Smrg	__u64 encoders_ptr;
46149ef06a4Smrg	/** @modes_ptr: Pointer to struct drm_mode_modeinfo array. */
46222944501Smrg	__u64 modes_ptr;
46349ef06a4Smrg	/** @props_ptr: Pointer to ``__u32`` array of property IDs. */
46422944501Smrg	__u64 props_ptr;
46549ef06a4Smrg	/** @prop_values_ptr: Pointer to ``__u64`` array of property values. */
46622944501Smrg	__u64 prop_values_ptr;
46722944501Smrg
46849ef06a4Smrg	/** @count_modes: Number of modes. */
46922944501Smrg	__u32 count_modes;
47049ef06a4Smrg	/** @count_props: Number of properties. */
47122944501Smrg	__u32 count_props;
47249ef06a4Smrg	/** @count_encoders: Number of encoders. */
47322944501Smrg	__u32 count_encoders;
47422944501Smrg
47549ef06a4Smrg	/** @encoder_id: Object ID of the current encoder. */
47649ef06a4Smrg	__u32 encoder_id;
47749ef06a4Smrg	/** @connector_id: Object ID of the connector. */
47849ef06a4Smrg	__u32 connector_id;
47949ef06a4Smrg	/**
48049ef06a4Smrg	 * @connector_type: Type of the connector.
48149ef06a4Smrg	 *
48249ef06a4Smrg	 * See DRM_MODE_CONNECTOR_* defines.
48349ef06a4Smrg	 */
48422944501Smrg	__u32 connector_type;
48549ef06a4Smrg	/**
48649ef06a4Smrg	 * @connector_type_id: Type-specific connector number.
48749ef06a4Smrg	 *
48849ef06a4Smrg	 * This is not an object ID. This is a per-type connector number. Each
48949ef06a4Smrg	 * (type, type_id) combination is unique across all connectors of a DRM
49049ef06a4Smrg	 * device.
491bbff01ceSmrg	 *
492bbff01ceSmrg	 * The (type, type_id) combination is not a stable identifier: the
493bbff01ceSmrg	 * type_id can change depending on the driver probe order.
49449ef06a4Smrg	 */
49522944501Smrg	__u32 connector_type_id;
49622944501Smrg
49749ef06a4Smrg	/**
49849ef06a4Smrg	 * @connection: Status of the connector.
49949ef06a4Smrg	 *
50049ef06a4Smrg	 * See enum drm_connector_status.
50149ef06a4Smrg	 */
50222944501Smrg	__u32 connection;
50349ef06a4Smrg	/** @mm_width: Width of the connected sink in millimeters. */
50449ef06a4Smrg	__u32 mm_width;
50549ef06a4Smrg	/** @mm_height: Height of the connected sink in millimeters. */
50649ef06a4Smrg	__u32 mm_height;
50749ef06a4Smrg	/**
50849ef06a4Smrg	 * @subpixel: Subpixel order of the connected sink.
50949ef06a4Smrg	 *
51049ef06a4Smrg	 * See enum subpixel_order.
51149ef06a4Smrg	 */
51222944501Smrg	__u32 subpixel;
5133f012e29Smrg
51449ef06a4Smrg	/** @pad: Padding, must be zero. */
5153f012e29Smrg	__u32 pad;
51622944501Smrg};
51722944501Smrg
5187cdc0497Smrg#define DRM_MODE_PROP_PENDING	(1<<0) /* deprecated, do not use */
51922944501Smrg#define DRM_MODE_PROP_RANGE	(1<<1)
52022944501Smrg#define DRM_MODE_PROP_IMMUTABLE	(1<<2)
52122944501Smrg#define DRM_MODE_PROP_ENUM	(1<<3) /* enumerated type with text strings */
52222944501Smrg#define DRM_MODE_PROP_BLOB	(1<<4)
523e88f27b3Smrg#define DRM_MODE_PROP_BITMASK	(1<<5) /* bitmask of enumerated types */
52422944501Smrg
52508d7334dSsnj/* non-extended types: legacy bitmask, one bit per type: */
52608d7334dSsnj#define DRM_MODE_PROP_LEGACY_TYPE  ( \
52708d7334dSsnj		DRM_MODE_PROP_RANGE | \
52808d7334dSsnj		DRM_MODE_PROP_ENUM | \
52908d7334dSsnj		DRM_MODE_PROP_BLOB | \
53008d7334dSsnj		DRM_MODE_PROP_BITMASK)
53108d7334dSsnj
53208d7334dSsnj/* extended-types: rather than continue to consume a bit per type,
53308d7334dSsnj * grab a chunk of the bits to use as integer type id.
53408d7334dSsnj */
53508d7334dSsnj#define DRM_MODE_PROP_EXTENDED_TYPE	0x0000ffc0
53608d7334dSsnj#define DRM_MODE_PROP_TYPE(n)		((n) << 6)
53708d7334dSsnj#define DRM_MODE_PROP_OBJECT		DRM_MODE_PROP_TYPE(1)
53808d7334dSsnj#define DRM_MODE_PROP_SIGNED_RANGE	DRM_MODE_PROP_TYPE(2)
53908d7334dSsnj
5403f012e29Smrg/* the PROP_ATOMIC flag is used to hide properties from userspace that
5413f012e29Smrg * is not aware of atomic properties.  This is mostly to work around
5423f012e29Smrg * older userspace (DDX drivers) that read/write each prop they find,
543bbff01ceSmrg * without being aware that this could be triggering a lengthy modeset.
5443f012e29Smrg */
5453f012e29Smrg#define DRM_MODE_PROP_ATOMIC        0x80000000
5463f012e29Smrg
547bbff01ceSmrg/**
548bbff01ceSmrg * struct drm_mode_property_enum - Description for an enum/bitfield entry.
549bbff01ceSmrg * @value: numeric value for this enum entry.
550bbff01ceSmrg * @name: symbolic name for this enum entry.
551bbff01ceSmrg *
552bbff01ceSmrg * See struct drm_property_enum for details.
553bbff01ceSmrg */
55422944501Smrgstruct drm_mode_property_enum {
55522944501Smrg	__u64 value;
55622944501Smrg	char name[DRM_PROP_NAME_LEN];
55722944501Smrg};
55822944501Smrg
559bbff01ceSmrg/**
560bbff01ceSmrg * struct drm_mode_get_property - Get property metadata.
561bbff01ceSmrg *
562bbff01ceSmrg * User-space can perform a GETPROPERTY ioctl to retrieve information about a
563bbff01ceSmrg * property. The same property may be attached to multiple objects, see
564bbff01ceSmrg * "Modeset Base Object Abstraction".
565bbff01ceSmrg *
566bbff01ceSmrg * The meaning of the @values_ptr field changes depending on the property type.
567bbff01ceSmrg * See &drm_property.flags for more details.
568bbff01ceSmrg *
569bbff01ceSmrg * The @enum_blob_ptr and @count_enum_blobs fields are only meaningful when the
570bbff01ceSmrg * property has the type &DRM_MODE_PROP_ENUM or &DRM_MODE_PROP_BITMASK. For
571bbff01ceSmrg * backwards compatibility, the kernel will always set @count_enum_blobs to
572bbff01ceSmrg * zero when the property has the type &DRM_MODE_PROP_BLOB. User-space must
573bbff01ceSmrg * ignore these two fields if the property has a different type.
574bbff01ceSmrg *
575bbff01ceSmrg * User-space is expected to retrieve values and enums by performing this ioctl
576bbff01ceSmrg * at least twice: the first time to retrieve the number of elements, the
577bbff01ceSmrg * second time to retrieve the elements themselves.
578bbff01ceSmrg *
579bbff01ceSmrg * To retrieve the number of elements, set @count_values and @count_enum_blobs
580bbff01ceSmrg * to zero, then call the ioctl. @count_values will be updated with the number
581bbff01ceSmrg * of elements. If the property has the type &DRM_MODE_PROP_ENUM or
582bbff01ceSmrg * &DRM_MODE_PROP_BITMASK, @count_enum_blobs will be updated as well.
583bbff01ceSmrg *
584bbff01ceSmrg * To retrieve the elements themselves, allocate an array for @values_ptr and
585bbff01ceSmrg * set @count_values to its capacity. If the property has the type
586bbff01ceSmrg * &DRM_MODE_PROP_ENUM or &DRM_MODE_PROP_BITMASK, allocate an array for
587bbff01ceSmrg * @enum_blob_ptr and set @count_enum_blobs to its capacity. Calling the ioctl
588bbff01ceSmrg * again will fill the arrays.
589bbff01ceSmrg */
59022944501Smrgstruct drm_mode_get_property {
591bbff01ceSmrg	/** @values_ptr: Pointer to a ``__u64`` array. */
592bbff01ceSmrg	__u64 values_ptr;
593bbff01ceSmrg	/** @enum_blob_ptr: Pointer to a struct drm_mode_property_enum array. */
594bbff01ceSmrg	__u64 enum_blob_ptr;
59522944501Smrg
596bbff01ceSmrg	/**
597bbff01ceSmrg	 * @prop_id: Object ID of the property which should be retrieved. Set
598bbff01ceSmrg	 * by the caller.
599bbff01ceSmrg	 */
60022944501Smrg	__u32 prop_id;
601bbff01ceSmrg	/**
602bbff01ceSmrg	 * @flags: ``DRM_MODE_PROP_*`` bitfield. See &drm_property.flags for
603bbff01ceSmrg	 * a definition of the flags.
604bbff01ceSmrg	 */
60522944501Smrg	__u32 flags;
606bbff01ceSmrg	/**
607bbff01ceSmrg	 * @name: Symbolic property name. User-space should use this field to
608bbff01ceSmrg	 * recognize properties.
609bbff01ceSmrg	 */
61022944501Smrg	char name[DRM_PROP_NAME_LEN];
61122944501Smrg
612bbff01ceSmrg	/** @count_values: Number of elements in @values_ptr. */
61322944501Smrg	__u32 count_values;
614bbff01ceSmrg	/** @count_enum_blobs: Number of elements in @enum_blob_ptr. */
61522944501Smrg	__u32 count_enum_blobs;
61622944501Smrg};
61722944501Smrg
61822944501Smrgstruct drm_mode_connector_set_property {
61922944501Smrg	__u64 value;
62022944501Smrg	__u32 prop_id;
62122944501Smrg	__u32 connector_id;
62222944501Smrg};
62322944501Smrg
624e88f27b3Smrg#define DRM_MODE_OBJECT_CRTC 0xcccccccc
625e88f27b3Smrg#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
626e88f27b3Smrg#define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0
627e88f27b3Smrg#define DRM_MODE_OBJECT_MODE 0xdededede
628e88f27b3Smrg#define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
629e88f27b3Smrg#define DRM_MODE_OBJECT_FB 0xfbfbfbfb
630e88f27b3Smrg#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
631e88f27b3Smrg#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
6323f012e29Smrg#define DRM_MODE_OBJECT_ANY 0
633e88f27b3Smrg
634e88f27b3Smrgstruct drm_mode_obj_get_properties {
635e88f27b3Smrg	__u64 props_ptr;
636e88f27b3Smrg	__u64 prop_values_ptr;
637e88f27b3Smrg	__u32 count_props;
638e88f27b3Smrg	__u32 obj_id;
639e88f27b3Smrg	__u32 obj_type;
640e88f27b3Smrg};
641e88f27b3Smrg
642e88f27b3Smrgstruct drm_mode_obj_set_property {
643e88f27b3Smrg	__u64 value;
644e88f27b3Smrg	__u32 prop_id;
645e88f27b3Smrg	__u32 obj_id;
646e88f27b3Smrg	__u32 obj_type;
647e88f27b3Smrg};
648e88f27b3Smrg
64922944501Smrgstruct drm_mode_get_blob {
65022944501Smrg	__u32 blob_id;
65122944501Smrg	__u32 length;
65222944501Smrg	__u64 data;
65322944501Smrg};
65422944501Smrg
65522944501Smrgstruct drm_mode_fb_cmd {
65622944501Smrg	__u32 fb_id;
6573f012e29Smrg	__u32 width;
6583f012e29Smrg	__u32 height;
65922944501Smrg	__u32 pitch;
66022944501Smrg	__u32 bpp;
66122944501Smrg	__u32 depth;
66222944501Smrg	/* driver specific handle */
66322944501Smrg	__u32 handle;
66422944501Smrg};
66522944501Smrg
6663f012e29Smrg#define DRM_MODE_FB_INTERLACED	(1<<0) /* for interlaced framebuffers */
667bbff01ceSmrg#define DRM_MODE_FB_MODIFIERS	(1<<1) /* enables ->modifier[] */
668e88f27b3Smrg
669bbff01ceSmrg/**
670bbff01ceSmrg * struct drm_mode_fb_cmd2 - Frame-buffer metadata.
671bbff01ceSmrg *
672bbff01ceSmrg * This struct holds frame-buffer metadata. There are two ways to use it:
673bbff01ceSmrg *
674bbff01ceSmrg * - User-space can fill this struct and perform a &DRM_IOCTL_MODE_ADDFB2
675bbff01ceSmrg *   ioctl to register a new frame-buffer. The new frame-buffer object ID will
676bbff01ceSmrg *   be set by the kernel in @fb_id.
677bbff01ceSmrg * - User-space can set @fb_id and perform a &DRM_IOCTL_MODE_GETFB2 ioctl to
678bbff01ceSmrg *   fetch metadata about an existing frame-buffer.
679bbff01ceSmrg *
680bbff01ceSmrg * In case of planar formats, this struct allows up to 4 buffer objects with
681bbff01ceSmrg * offsets and pitches per plane. The pitch and offset order are dictated by
682bbff01ceSmrg * the format FourCC as defined by ``drm_fourcc.h``, e.g. NV12 is described as:
683bbff01ceSmrg *
684bbff01ceSmrg *     YUV 4:2:0 image with a plane of 8-bit Y samples followed by an
685bbff01ceSmrg *     interleaved U/V plane containing 8-bit 2x2 subsampled colour difference
686bbff01ceSmrg *     samples.
687bbff01ceSmrg *
688bbff01ceSmrg * So it would consist of a Y plane at ``offsets[0]`` and a UV plane at
689bbff01ceSmrg * ``offsets[1]``.
690bbff01ceSmrg *
691bbff01ceSmrg * To accommodate tiled, compressed, etc formats, a modifier can be specified.
692bbff01ceSmrg * For more information see the "Format Modifiers" section. Note that even
693bbff01ceSmrg * though it looks like we have a modifier per-plane, we in fact do not. The
694bbff01ceSmrg * modifier for each plane must be identical. Thus all combinations of
695bbff01ceSmrg * different data layouts for multi-plane formats must be enumerated as
696bbff01ceSmrg * separate modifiers.
697bbff01ceSmrg *
698bbff01ceSmrg * All of the entries in @handles, @pitches, @offsets and @modifier must be
699bbff01ceSmrg * zero when unused. Warning, for @offsets and @modifier zero can't be used to
700bbff01ceSmrg * figure out whether the entry is used or not since it's a valid value (a zero
701bbff01ceSmrg * offset is common, and a zero modifier is &DRM_FORMAT_MOD_LINEAR).
702bbff01ceSmrg */
703e88f27b3Smrgstruct drm_mode_fb_cmd2 {
704bbff01ceSmrg	/** @fb_id: Object ID of the frame-buffer. */
705e88f27b3Smrg	__u32 fb_id;
706bbff01ceSmrg	/** @width: Width of the frame-buffer. */
7073f012e29Smrg	__u32 width;
708bbff01ceSmrg	/** @height: Height of the frame-buffer. */
7093f012e29Smrg	__u32 height;
710bbff01ceSmrg	/**
711bbff01ceSmrg	 * @pixel_format: FourCC format code, see ``DRM_FORMAT_*`` constants in
712bbff01ceSmrg	 * ``drm_fourcc.h``.
713bbff01ceSmrg	 */
714bbff01ceSmrg	__u32 pixel_format;
715bbff01ceSmrg	/**
716bbff01ceSmrg	 * @flags: Frame-buffer flags (see &DRM_MODE_FB_INTERLACED and
717bbff01ceSmrg	 * &DRM_MODE_FB_MODIFIERS).
718bbff01ceSmrg	 */
719bbff01ceSmrg	__u32 flags;
720e88f27b3Smrg
721bbff01ceSmrg	/**
722bbff01ceSmrg	 * @handles: GEM buffer handle, one per plane. Set to 0 if the plane is
723bbff01ceSmrg	 * unused. The same handle can be used for multiple planes.
724e88f27b3Smrg	 */
725e88f27b3Smrg	__u32 handles[4];
726bbff01ceSmrg	/** @pitches: Pitch (aka. stride) in bytes, one per plane. */
727bbff01ceSmrg	__u32 pitches[4];
728bbff01ceSmrg	/** @offsets: Offset into the buffer in bytes, one per plane. */
729bbff01ceSmrg	__u32 offsets[4];
730bbff01ceSmrg	/**
731bbff01ceSmrg	 * @modifier: Format modifier, one per plane. See ``DRM_FORMAT_MOD_*``
732bbff01ceSmrg	 * constants in ``drm_fourcc.h``. All planes must use the same
733bbff01ceSmrg	 * modifier. Ignored unless &DRM_MODE_FB_MODIFIERS is set in @flags.
734bbff01ceSmrg	 */
735bbff01ceSmrg	__u64 modifier[4];
736e88f27b3Smrg};
737e88f27b3Smrg
73822944501Smrg#define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01
73922944501Smrg#define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02
74022944501Smrg#define DRM_MODE_FB_DIRTY_FLAGS         0x03
74122944501Smrg
7423f012e29Smrg#define DRM_MODE_FB_DIRTY_MAX_CLIPS     256
7433f012e29Smrg
74422944501Smrg/*
74522944501Smrg * Mark a region of a framebuffer as dirty.
74622944501Smrg *
74722944501Smrg * Some hardware does not automatically update display contents
74822944501Smrg * as a hardware or software draw to a framebuffer. This ioctl
74922944501Smrg * allows userspace to tell the kernel and the hardware what
75022944501Smrg * regions of the framebuffer have changed.
75122944501Smrg *
75222944501Smrg * The kernel or hardware is free to update more then just the
75322944501Smrg * region specified by the clip rects. The kernel or hardware
75422944501Smrg * may also delay and/or coalesce several calls to dirty into a
75522944501Smrg * single update.
75622944501Smrg *
75722944501Smrg * Userspace may annotate the updates, the annotates are a
75822944501Smrg * promise made by the caller that the change is either a copy
75922944501Smrg * of pixels or a fill of a single color in the region specified.
76022944501Smrg *
76122944501Smrg * If the DRM_MODE_FB_DIRTY_ANNOTATE_COPY flag is given then
76222944501Smrg * the number of updated regions are half of num_clips given,
76322944501Smrg * where the clip rects are paired in src and dst. The width and
76422944501Smrg * height of each one of the pairs must match.
76522944501Smrg *
76622944501Smrg * If the DRM_MODE_FB_DIRTY_ANNOTATE_FILL flag is given the caller
76722944501Smrg * promises that the region specified of the clip rects is filled
76822944501Smrg * completely with a single color as given in the color argument.
76922944501Smrg */
77022944501Smrg
77122944501Smrgstruct drm_mode_fb_dirty_cmd {
77222944501Smrg	__u32 fb_id;
77322944501Smrg	__u32 flags;
77422944501Smrg	__u32 color;
77522944501Smrg	__u32 num_clips;
77622944501Smrg	__u64 clips_ptr;
77722944501Smrg};
77822944501Smrg
77922944501Smrgstruct drm_mode_mode_cmd {
78022944501Smrg	__u32 connector_id;
78122944501Smrg	struct drm_mode_modeinfo mode;
78222944501Smrg};
78322944501Smrg
7843f012e29Smrg#define DRM_MODE_CURSOR_BO	0x01
7853f012e29Smrg#define DRM_MODE_CURSOR_MOVE	0x02
7863f012e29Smrg#define DRM_MODE_CURSOR_FLAGS	0x03
78722944501Smrg
78822944501Smrg/*
7893f012e29Smrg * depending on the value in flags different members are used.
79022944501Smrg *
79122944501Smrg * CURSOR_BO uses
7923f012e29Smrg *    crtc_id
79322944501Smrg *    width
79422944501Smrg *    height
7953f012e29Smrg *    handle - if 0 turns the cursor off
79622944501Smrg *
79722944501Smrg * CURSOR_MOVE uses
7983f012e29Smrg *    crtc_id
79922944501Smrg *    x
80022944501Smrg *    y
80122944501Smrg */
80222944501Smrgstruct drm_mode_cursor {
80322944501Smrg	__u32 flags;
80422944501Smrg	__u32 crtc_id;
80522944501Smrg	__s32 x;
80622944501Smrg	__s32 y;
80722944501Smrg	__u32 width;
80822944501Smrg	__u32 height;
80922944501Smrg	/* driver specific handle */
81022944501Smrg	__u32 handle;
81122944501Smrg};
81222944501Smrg
813e88f27b3Smrgstruct drm_mode_cursor2 {
814e88f27b3Smrg	__u32 flags;
815e88f27b3Smrg	__u32 crtc_id;
816e88f27b3Smrg	__s32 x;
817e88f27b3Smrg	__s32 y;
818e88f27b3Smrg	__u32 width;
819e88f27b3Smrg	__u32 height;
820e88f27b3Smrg	/* driver specific handle */
821e88f27b3Smrg	__u32 handle;
822e88f27b3Smrg	__s32 hot_x;
823e88f27b3Smrg	__s32 hot_y;
824e88f27b3Smrg};
825e88f27b3Smrg
82622944501Smrgstruct drm_mode_crtc_lut {
82722944501Smrg	__u32 crtc_id;
82822944501Smrg	__u32 gamma_size;
82922944501Smrg
83022944501Smrg	/* pointers to arrays */
83122944501Smrg	__u64 red;
83222944501Smrg	__u64 green;
83322944501Smrg	__u64 blue;
83422944501Smrg};
83522944501Smrg
8363f012e29Smrgstruct drm_color_ctm {
8377cdc0497Smrg	/*
8387cdc0497Smrg	 * Conversion matrix in S31.32 sign-magnitude
8397cdc0497Smrg	 * (not two's complement!) format.
840bbff01ceSmrg	 *
841bbff01ceSmrg	 * out   matrix    in
842bbff01ceSmrg	 * |R|   |0 1 2|   |R|
843bbff01ceSmrg	 * |G| = |3 4 5| x |G|
844bbff01ceSmrg	 * |B|   |6 7 8|   |B|
8457cdc0497Smrg	 */
8467cdc0497Smrg	__u64 matrix[9];
8473f012e29Smrg};
8483f012e29Smrg
8493f012e29Smrgstruct drm_color_lut {
8503f012e29Smrg	/*
8515324fb0dSmrg	 * Values are mapped linearly to 0.0 - 1.0 range, with 0x0 == 0.0 and
8525324fb0dSmrg	 * 0xffff == 1.0.
8533f012e29Smrg	 */
8543f012e29Smrg	__u16 red;
8553f012e29Smrg	__u16 green;
8563f012e29Smrg	__u16 blue;
8573f012e29Smrg	__u16 reserved;
8583f012e29Smrg};
8593f012e29Smrg
860bbff01ceSmrg/**
861bbff01ceSmrg * struct drm_plane_size_hint - Plane size hints
862bbff01ceSmrg *
863bbff01ceSmrg * The plane SIZE_HINTS property blob contains an
864bbff01ceSmrg * array of struct drm_plane_size_hint.
865bbff01ceSmrg */
866bbff01ceSmrgstruct drm_plane_size_hint {
867bbff01ceSmrg	__u16 width;
868bbff01ceSmrg	__u16 height;
869bbff01ceSmrg};
870bbff01ceSmrg
87141687f09Smrg/**
87241687f09Smrg * struct hdr_metadata_infoframe - HDR Metadata Infoframe Data.
87341687f09Smrg *
87441687f09Smrg * HDR Metadata Infoframe as per CTA 861.G spec. This is expected
87541687f09Smrg * to match exactly with the spec.
87641687f09Smrg *
87741687f09Smrg * Userspace is expected to pass the metadata information as per
87841687f09Smrg * the format described in this structure.
87941687f09Smrg */
88041687f09Smrgstruct hdr_metadata_infoframe {
88141687f09Smrg	/**
88241687f09Smrg	 * @eotf: Electro-Optical Transfer Function (EOTF)
88341687f09Smrg	 * used in the stream.
88441687f09Smrg	 */
88541687f09Smrg	__u8 eotf;
88641687f09Smrg	/**
88741687f09Smrg	 * @metadata_type: Static_Metadata_Descriptor_ID.
88841687f09Smrg	 */
88941687f09Smrg	__u8 metadata_type;
89041687f09Smrg	/**
89141687f09Smrg	 * @display_primaries: Color Primaries of the Data.
89241687f09Smrg	 * These are coded as unsigned 16-bit values in units of
89341687f09Smrg	 * 0.00002, where 0x0000 represents zero and 0xC350
89441687f09Smrg	 * represents 1.0000.
895bbff01ceSmrg	 * @display_primaries.x: X coordinate of color primary.
896bbff01ceSmrg	 * @display_primaries.y: Y coordinate of color primary.
89741687f09Smrg	 */
89841687f09Smrg	struct {
89941687f09Smrg		__u16 x, y;
900bbff01ceSmrg	} display_primaries[3];
90141687f09Smrg	/**
90241687f09Smrg	 * @white_point: White Point of Colorspace Data.
90341687f09Smrg	 * These are coded as unsigned 16-bit values in units of
90441687f09Smrg	 * 0.00002, where 0x0000 represents zero and 0xC350
90541687f09Smrg	 * represents 1.0000.
906bbff01ceSmrg	 * @white_point.x: X coordinate of whitepoint of color primary.
907bbff01ceSmrg	 * @white_point.y: Y coordinate of whitepoint of color primary.
90841687f09Smrg	 */
90941687f09Smrg	struct {
91041687f09Smrg		__u16 x, y;
911bbff01ceSmrg	} white_point;
91241687f09Smrg	/**
91341687f09Smrg	 * @max_display_mastering_luminance: Max Mastering Display Luminance.
91441687f09Smrg	 * This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
91541687f09Smrg	 * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
91641687f09Smrg	 */
91741687f09Smrg	__u16 max_display_mastering_luminance;
91841687f09Smrg	/**
91941687f09Smrg	 * @min_display_mastering_luminance: Min Mastering Display Luminance.
92041687f09Smrg	 * This value is coded as an unsigned 16-bit value in units of
92141687f09Smrg	 * 0.0001 cd/m2, where 0x0001 represents 0.0001 cd/m2 and 0xFFFF
92241687f09Smrg	 * represents 6.5535 cd/m2.
92341687f09Smrg	 */
92441687f09Smrg	__u16 min_display_mastering_luminance;
92541687f09Smrg	/**
92641687f09Smrg	 * @max_cll: Max Content Light Level.
92741687f09Smrg	 * This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
92841687f09Smrg	 * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
92941687f09Smrg	 */
93041687f09Smrg	__u16 max_cll;
93141687f09Smrg	/**
93241687f09Smrg	 * @max_fall: Max Frame Average Light Level.
93341687f09Smrg	 * This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
93441687f09Smrg	 * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
93541687f09Smrg	 */
93641687f09Smrg	__u16 max_fall;
93741687f09Smrg};
93841687f09Smrg
93941687f09Smrg/**
94041687f09Smrg * struct hdr_output_metadata - HDR output metadata
94141687f09Smrg *
94241687f09Smrg * Metadata Information to be passed from userspace
94341687f09Smrg */
94441687f09Smrgstruct hdr_output_metadata {
94541687f09Smrg	/**
94641687f09Smrg	 * @metadata_type: Static_Metadata_Descriptor_ID.
94741687f09Smrg	 */
94841687f09Smrg	__u32 metadata_type;
94941687f09Smrg	/**
95041687f09Smrg	 * @hdmi_metadata_type1: HDR Metadata Infoframe.
95141687f09Smrg	 */
95241687f09Smrg	union {
95341687f09Smrg		struct hdr_metadata_infoframe hdmi_metadata_type1;
95441687f09Smrg	};
95541687f09Smrg};
95641687f09Smrg
957bbff01ceSmrg/**
958bbff01ceSmrg * DRM_MODE_PAGE_FLIP_EVENT
959bbff01ceSmrg *
960bbff01ceSmrg * Request that the kernel sends back a vblank event (see
961bbff01ceSmrg * struct drm_event_vblank) with the &DRM_EVENT_FLIP_COMPLETE type when the
962bbff01ceSmrg * page-flip is done.
963bbff01ceSmrg */
96422944501Smrg#define DRM_MODE_PAGE_FLIP_EVENT 0x01
965bbff01ceSmrg/**
966bbff01ceSmrg * DRM_MODE_PAGE_FLIP_ASYNC
967bbff01ceSmrg *
968bbff01ceSmrg * Request that the page-flip is performed as soon as possible, ie. with no
969bbff01ceSmrg * delay due to waiting for vblank. This may cause tearing to be visible on
970bbff01ceSmrg * the screen.
971bbff01ceSmrg *
972bbff01ceSmrg * When used with atomic uAPI, the driver will return an error if the hardware
973bbff01ceSmrg * doesn't support performing an asynchronous page-flip for this update.
974bbff01ceSmrg * User-space should handle this, e.g. by falling back to a regular page-flip.
975bbff01ceSmrg *
976bbff01ceSmrg * Note, some hardware might need to perform one last synchronous page-flip
977bbff01ceSmrg * before being able to switch to asynchronous page-flips. As an exception,
978bbff01ceSmrg * the driver will return success even though that first page-flip is not
979bbff01ceSmrg * asynchronous.
980bbff01ceSmrg */
981e88f27b3Smrg#define DRM_MODE_PAGE_FLIP_ASYNC 0x02
982037b3c26Smrg#define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
983037b3c26Smrg#define DRM_MODE_PAGE_FLIP_TARGET_RELATIVE 0x8
984037b3c26Smrg#define DRM_MODE_PAGE_FLIP_TARGET (DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE | \
985037b3c26Smrg				   DRM_MODE_PAGE_FLIP_TARGET_RELATIVE)
986bbff01ceSmrg/**
987bbff01ceSmrg * DRM_MODE_PAGE_FLIP_FLAGS
988bbff01ceSmrg *
989bbff01ceSmrg * Bitmask of flags suitable for &drm_mode_crtc_page_flip_target.flags.
990bbff01ceSmrg */
991037b3c26Smrg#define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT | \
992037b3c26Smrg				  DRM_MODE_PAGE_FLIP_ASYNC | \
993037b3c26Smrg				  DRM_MODE_PAGE_FLIP_TARGET)
99422944501Smrg
99513d1d17dSmrg/*
99613d1d17dSmrg * Request a page flip on the specified crtc.
99713d1d17dSmrg *
99813d1d17dSmrg * This ioctl will ask KMS to schedule a page flip for the specified
99913d1d17dSmrg * crtc.  Once any pending rendering targeting the specified fb (as of
100013d1d17dSmrg * ioctl time) has completed, the crtc will be reprogrammed to display
100113d1d17dSmrg * that fb after the next vertical refresh.  The ioctl returns
100213d1d17dSmrg * immediately, but subsequent rendering to the current fb will block
100313d1d17dSmrg * in the execbuffer ioctl until the page flip happens.  If a page
100413d1d17dSmrg * flip is already pending as the ioctl is called, EBUSY will be
100513d1d17dSmrg * returned.
100613d1d17dSmrg *
10073f012e29Smrg * Flag DRM_MODE_PAGE_FLIP_EVENT requests that drm sends back a vblank
10083f012e29Smrg * event (see drm.h: struct drm_event_vblank) when the page flip is
10093f012e29Smrg * done.  The user_data field passed in with this ioctl will be
10103f012e29Smrg * returned as the user_data field in the vblank event struct.
10113f012e29Smrg *
10123f012e29Smrg * Flag DRM_MODE_PAGE_FLIP_ASYNC requests that the flip happen
10133f012e29Smrg * 'as soon as possible', meaning that it not delay waiting for vblank.
10143f012e29Smrg * This may cause tearing on the screen.
101513d1d17dSmrg *
1016037b3c26Smrg * The reserved field must be zero.
101713d1d17dSmrg */
101813d1d17dSmrg
101922944501Smrgstruct drm_mode_crtc_page_flip {
102013d1d17dSmrg	__u32 crtc_id;
102113d1d17dSmrg	__u32 fb_id;
102213d1d17dSmrg	__u32 flags;
102313d1d17dSmrg	__u32 reserved;
102413d1d17dSmrg	__u64 user_data;
102522944501Smrg};
102622944501Smrg
1027037b3c26Smrg/*
1028037b3c26Smrg * Request a page flip on the specified crtc.
1029037b3c26Smrg *
1030037b3c26Smrg * Same as struct drm_mode_crtc_page_flip, but supports new flags and
1031037b3c26Smrg * re-purposes the reserved field:
1032037b3c26Smrg *
1033037b3c26Smrg * The sequence field must be zero unless either of the
1034037b3c26Smrg * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is specified. When
1035037b3c26Smrg * the ABSOLUTE flag is specified, the sequence field denotes the absolute
1036037b3c26Smrg * vblank sequence when the flip should take effect. When the RELATIVE
1037037b3c26Smrg * flag is specified, the sequence field denotes the relative (to the
1038037b3c26Smrg * current one when the ioctl is called) vblank sequence when the flip
1039037b3c26Smrg * should take effect. NOTE: DRM_IOCTL_WAIT_VBLANK must still be used to
1040037b3c26Smrg * make sure the vblank sequence before the target one has passed before
1041037b3c26Smrg * calling this ioctl. The purpose of the
1042037b3c26Smrg * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is merely to clarify
1043037b3c26Smrg * the target for when code dealing with a page flip runs during a
1044037b3c26Smrg * vertical blank period.
1045037b3c26Smrg */
1046037b3c26Smrg
1047037b3c26Smrgstruct drm_mode_crtc_page_flip_target {
1048037b3c26Smrg	__u32 crtc_id;
1049037b3c26Smrg	__u32 fb_id;
1050037b3c26Smrg	__u32 flags;
1051037b3c26Smrg	__u32 sequence;
1052037b3c26Smrg	__u64 user_data;
1053037b3c26Smrg};
1054037b3c26Smrg
1055bbff01ceSmrg/**
1056bbff01ceSmrg * struct drm_mode_create_dumb - Create a KMS dumb buffer for scanout.
1057bbff01ceSmrg * @height: buffer height in pixels
1058bbff01ceSmrg * @width: buffer width in pixels
1059bbff01ceSmrg * @bpp: bits per pixel
1060bbff01ceSmrg * @flags: must be zero
1061bbff01ceSmrg * @handle: buffer object handle
1062bbff01ceSmrg * @pitch: number of bytes between two consecutive lines
1063bbff01ceSmrg * @size: size of the whole buffer in bytes
1064bbff01ceSmrg *
1065bbff01ceSmrg * User-space fills @height, @width, @bpp and @flags. If the IOCTL succeeds,
1066bbff01ceSmrg * the kernel fills @handle, @pitch and @size.
1067bbff01ceSmrg */
1068e88f27b3Smrgstruct drm_mode_create_dumb {
10693f012e29Smrg	__u32 height;
10703f012e29Smrg	__u32 width;
10713f012e29Smrg	__u32 bpp;
10723f012e29Smrg	__u32 flags;
1073bbff01ceSmrg
10743f012e29Smrg	__u32 handle;
10753f012e29Smrg	__u32 pitch;
10763f012e29Smrg	__u64 size;
1077e88f27b3Smrg};
1078e88f27b3Smrg
1079e88f27b3Smrg/* set up for mmap of a dumb scanout buffer */
1080e88f27b3Smrgstruct drm_mode_map_dumb {
10813f012e29Smrg	/** Handle for the object being mapped. */
10823f012e29Smrg	__u32 handle;
10833f012e29Smrg	__u32 pad;
10843f012e29Smrg	/**
10853f012e29Smrg	 * Fake offset to use for subsequent mmap call
10863f012e29Smrg	 *
10873f012e29Smrg	 * This is a fixed-size type for 32/64 compatibility.
10883f012e29Smrg	 */
10893f012e29Smrg	__u64 offset;
1090e88f27b3Smrg};
1091e88f27b3Smrg
1092e88f27b3Smrgstruct drm_mode_destroy_dumb {
1093e88f27b3Smrg	__u32 handle;
1094e88f27b3Smrg};
1095e88f27b3Smrg
1096bbff01ceSmrg/**
1097bbff01ceSmrg * DRM_MODE_ATOMIC_TEST_ONLY
1098bbff01ceSmrg *
1099bbff01ceSmrg * Do not apply the atomic commit, instead check whether the hardware supports
1100bbff01ceSmrg * this configuration.
1101bbff01ceSmrg *
1102bbff01ceSmrg * See &drm_mode_config_funcs.atomic_check for more details on test-only
1103bbff01ceSmrg * commits.
1104bbff01ceSmrg */
11053f012e29Smrg#define DRM_MODE_ATOMIC_TEST_ONLY 0x0100
1106bbff01ceSmrg/**
1107bbff01ceSmrg * DRM_MODE_ATOMIC_NONBLOCK
1108bbff01ceSmrg *
1109bbff01ceSmrg * Do not block while applying the atomic commit. The &DRM_IOCTL_MODE_ATOMIC
1110bbff01ceSmrg * IOCTL returns immediately instead of waiting for the changes to be applied
1111bbff01ceSmrg * in hardware. Note, the driver will still check that the update can be
1112bbff01ceSmrg * applied before retuning.
1113bbff01ceSmrg */
11143f012e29Smrg#define DRM_MODE_ATOMIC_NONBLOCK  0x0200
1115bbff01ceSmrg/**
1116bbff01ceSmrg * DRM_MODE_ATOMIC_ALLOW_MODESET
1117bbff01ceSmrg *
1118bbff01ceSmrg * Allow the update to result in temporary or transient visible artifacts while
1119bbff01ceSmrg * the update is being applied. Applying the update may also take significantly
1120bbff01ceSmrg * more time than a page flip. All visual artifacts will disappear by the time
1121bbff01ceSmrg * the update is completed, as signalled through the vblank event's timestamp
1122bbff01ceSmrg * (see struct drm_event_vblank).
1123bbff01ceSmrg *
1124bbff01ceSmrg * This flag must be set when the KMS update might cause visible artifacts.
1125bbff01ceSmrg * Without this flag such KMS update will return a EINVAL error. What kind of
1126bbff01ceSmrg * update may cause visible artifacts depends on the driver and the hardware.
1127bbff01ceSmrg * User-space that needs to know beforehand if an update might cause visible
1128bbff01ceSmrg * artifacts can use &DRM_MODE_ATOMIC_TEST_ONLY without
1129bbff01ceSmrg * &DRM_MODE_ATOMIC_ALLOW_MODESET to see if it fails.
1130bbff01ceSmrg *
1131bbff01ceSmrg * To the best of the driver's knowledge, visual artifacts are guaranteed to
1132bbff01ceSmrg * not appear when this flag is not set. Some sinks might display visual
1133bbff01ceSmrg * artifacts outside of the driver's control.
1134bbff01ceSmrg */
11353f012e29Smrg#define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400
11363f012e29Smrg
1137bbff01ceSmrg/**
1138bbff01ceSmrg * DRM_MODE_ATOMIC_FLAGS
1139bbff01ceSmrg *
1140bbff01ceSmrg * Bitfield of flags accepted by the &DRM_IOCTL_MODE_ATOMIC IOCTL in
1141bbff01ceSmrg * &drm_mode_atomic.flags.
1142bbff01ceSmrg */
11433f012e29Smrg#define DRM_MODE_ATOMIC_FLAGS (\
11443f012e29Smrg		DRM_MODE_PAGE_FLIP_EVENT |\
11453f012e29Smrg		DRM_MODE_PAGE_FLIP_ASYNC |\
11463f012e29Smrg		DRM_MODE_ATOMIC_TEST_ONLY |\
11473f012e29Smrg		DRM_MODE_ATOMIC_NONBLOCK |\
11483f012e29Smrg		DRM_MODE_ATOMIC_ALLOW_MODESET)
1149e6188e58Smrg
1150e6188e58Smrgstruct drm_mode_atomic {
1151e6188e58Smrg	__u32 flags;
1152e6188e58Smrg	__u32 count_objs;
1153e6188e58Smrg	__u64 objs_ptr;
1154e6188e58Smrg	__u64 count_props_ptr;
1155e6188e58Smrg	__u64 props_ptr;
1156e6188e58Smrg	__u64 prop_values_ptr;
1157e6188e58Smrg	__u64 reserved;
1158e6188e58Smrg	__u64 user_data;
1159e6188e58Smrg};
1160e6188e58Smrg
1161d8807b2fSmrgstruct drm_format_modifier_blob {
1162d8807b2fSmrg#define FORMAT_BLOB_CURRENT 1
1163d8807b2fSmrg	/* Version of this blob format */
1164d8807b2fSmrg	__u32 version;
1165d8807b2fSmrg
1166d8807b2fSmrg	/* Flags */
1167d8807b2fSmrg	__u32 flags;
1168d8807b2fSmrg
1169d8807b2fSmrg	/* Number of fourcc formats supported */
1170d8807b2fSmrg	__u32 count_formats;
1171d8807b2fSmrg
1172d8807b2fSmrg	/* Where in this blob the formats exist (in bytes) */
1173d8807b2fSmrg	__u32 formats_offset;
1174d8807b2fSmrg
1175d8807b2fSmrg	/* Number of drm_format_modifiers */
1176d8807b2fSmrg	__u32 count_modifiers;
1177d8807b2fSmrg
1178d8807b2fSmrg	/* Where in this blob the modifiers exist (in bytes) */
1179d8807b2fSmrg	__u32 modifiers_offset;
1180d8807b2fSmrg
118100a23bdaSmrg	/* __u32 formats[] */
1182d8807b2fSmrg	/* struct drm_format_modifier modifiers[] */
1183d8807b2fSmrg};
1184d8807b2fSmrg
1185d8807b2fSmrgstruct drm_format_modifier {
1186d8807b2fSmrg	/* Bitmask of formats in get_plane format list this info applies to. The
1187d8807b2fSmrg	 * offset allows a sliding window of which 64 formats (bits).
1188d8807b2fSmrg	 *
1189d8807b2fSmrg	 * Some examples:
1190d8807b2fSmrg	 * In today's world with < 65 formats, and formats 0, and 2 are
1191d8807b2fSmrg	 * supported
1192d8807b2fSmrg	 * 0x0000000000000005
1193d8807b2fSmrg	 *		  ^-offset = 0, formats = 5
1194d8807b2fSmrg	 *
1195d8807b2fSmrg	 * If the number formats grew to 128, and formats 98-102 are
1196d8807b2fSmrg	 * supported with the modifier:
1197d8807b2fSmrg	 *
119800a23bdaSmrg	 * 0x0000007c00000000 0000000000000000
1199d8807b2fSmrg	 *		  ^
120000a23bdaSmrg	 *		  |__offset = 64, formats = 0x7c00000000
1201d8807b2fSmrg	 *
1202d8807b2fSmrg	 */
1203d8807b2fSmrg	__u64 formats;
1204d8807b2fSmrg	__u32 offset;
1205d8807b2fSmrg	__u32 pad;
1206d8807b2fSmrg
1207d8807b2fSmrg	/* The modifier that applies to the >get_plane format list bitmask. */
1208d8807b2fSmrg	__u64 modifier;
1209d8807b2fSmrg};
1210d8807b2fSmrg
1211e6188e58Smrg/**
121249ef06a4Smrg * struct drm_mode_create_blob - Create New blob property
121349ef06a4Smrg *
1214e6188e58Smrg * Create a new 'blob' data property, copying length bytes from data pointer,
1215e6188e58Smrg * and returning new blob ID.
1216e6188e58Smrg */
1217e6188e58Smrgstruct drm_mode_create_blob {
121849ef06a4Smrg	/** @data: Pointer to data to copy. */
1219e6188e58Smrg	__u64 data;
122049ef06a4Smrg	/** @length: Length of data to copy. */
1221e6188e58Smrg	__u32 length;
122249ef06a4Smrg	/** @blob_id: Return: new property ID. */
1223e6188e58Smrg	__u32 blob_id;
1224e6188e58Smrg};
1225e6188e58Smrg
1226e6188e58Smrg/**
122741687f09Smrg * struct drm_mode_destroy_blob - Destroy user blob
122841687f09Smrg * @blob_id: blob_id to destroy
122949ef06a4Smrg *
1230e6188e58Smrg * Destroy a user-created blob property.
123141687f09Smrg *
123241687f09Smrg * User-space can release blobs as soon as they do not need to refer to them by
123341687f09Smrg * their blob object ID.  For instance, if you are using a MODE_ID blob in an
123441687f09Smrg * atomic commit and you will not make another commit re-using the same ID, you
123541687f09Smrg * can destroy the blob as soon as the commit has been issued, without waiting
123641687f09Smrg * for it to complete.
1237e6188e58Smrg */
1238e6188e58Smrgstruct drm_mode_destroy_blob {
1239e6188e58Smrg	__u32 blob_id;
1240e6188e58Smrg};
1241e6188e58Smrg
124200a23bdaSmrg/**
124341687f09Smrg * struct drm_mode_create_lease - Create lease
124449ef06a4Smrg *
124500a23bdaSmrg * Lease mode resources, creating another drm_master.
1246bbff01ceSmrg *
1247bbff01ceSmrg * The @object_ids array must reference at least one CRTC, one connector and
1248bbff01ceSmrg * one plane if &DRM_CLIENT_CAP_UNIVERSAL_PLANES is enabled. Alternatively,
1249bbff01ceSmrg * the lease can be completely empty.
125000a23bdaSmrg */
125100a23bdaSmrgstruct drm_mode_create_lease {
125249ef06a4Smrg	/** @object_ids: Pointer to array of object ids (__u32) */
125300a23bdaSmrg	__u64 object_ids;
125449ef06a4Smrg	/** @object_count: Number of object ids */
125500a23bdaSmrg	__u32 object_count;
125649ef06a4Smrg	/** @flags: flags for new FD (O_CLOEXEC, etc) */
125700a23bdaSmrg	__u32 flags;
125800a23bdaSmrg
125949ef06a4Smrg	/** @lessee_id: Return: unique identifier for lessee. */
126000a23bdaSmrg	__u32 lessee_id;
126149ef06a4Smrg	/** @fd: Return: file descriptor to new drm_master file */
126200a23bdaSmrg	__u32 fd;
126300a23bdaSmrg};
126400a23bdaSmrg
126500a23bdaSmrg/**
126641687f09Smrg * struct drm_mode_list_lessees - List lessees
126749ef06a4Smrg *
126849ef06a4Smrg * List lesses from a drm_master.
126900a23bdaSmrg */
127000a23bdaSmrgstruct drm_mode_list_lessees {
127149ef06a4Smrg	/**
127249ef06a4Smrg	 * @count_lessees: Number of lessees.
127349ef06a4Smrg	 *
127400a23bdaSmrg	 * On input, provides length of the array.
127500a23bdaSmrg	 * On output, provides total number. No
127600a23bdaSmrg	 * more than the input number will be written
127700a23bdaSmrg	 * back, so two calls can be used to get
127800a23bdaSmrg	 * the size and then the data.
127900a23bdaSmrg	 */
128000a23bdaSmrg	__u32 count_lessees;
128149ef06a4Smrg	/** @pad: Padding. */
128200a23bdaSmrg	__u32 pad;
128300a23bdaSmrg
128449ef06a4Smrg	/**
128549ef06a4Smrg	 * @lessees_ptr: Pointer to lessees.
128649ef06a4Smrg	 *
128749ef06a4Smrg	 * Pointer to __u64 array of lessee ids
128800a23bdaSmrg	 */
128900a23bdaSmrg	__u64 lessees_ptr;
129000a23bdaSmrg};
129100a23bdaSmrg
129200a23bdaSmrg/**
129341687f09Smrg * struct drm_mode_get_lease - Get Lease
129449ef06a4Smrg *
129549ef06a4Smrg * Get leased objects.
129600a23bdaSmrg */
129700a23bdaSmrgstruct drm_mode_get_lease {
129849ef06a4Smrg	/**
129949ef06a4Smrg	 * @count_objects: Number of leased objects.
130049ef06a4Smrg	 *
130100a23bdaSmrg	 * On input, provides length of the array.
130200a23bdaSmrg	 * On output, provides total number. No
130300a23bdaSmrg	 * more than the input number will be written
130400a23bdaSmrg	 * back, so two calls can be used to get
130500a23bdaSmrg	 * the size and then the data.
130600a23bdaSmrg	 */
130700a23bdaSmrg	__u32 count_objects;
130849ef06a4Smrg	/** @pad: Padding. */
130900a23bdaSmrg	__u32 pad;
131000a23bdaSmrg
131149ef06a4Smrg	/**
131249ef06a4Smrg	 * @objects_ptr: Pointer to objects.
131349ef06a4Smrg	 *
131449ef06a4Smrg	 * Pointer to __u32 array of object ids.
131500a23bdaSmrg	 */
131600a23bdaSmrg	__u64 objects_ptr;
131700a23bdaSmrg};
131800a23bdaSmrg
131900a23bdaSmrg/**
132041687f09Smrg * struct drm_mode_revoke_lease - Revoke lease
132100a23bdaSmrg */
132200a23bdaSmrgstruct drm_mode_revoke_lease {
132349ef06a4Smrg	/** @lessee_id: Unique ID of lessee */
132400a23bdaSmrg	__u32 lessee_id;
132500a23bdaSmrg};
132600a23bdaSmrg
13275324fb0dSmrg/**
13285324fb0dSmrg * struct drm_mode_rect - Two dimensional rectangle.
13295324fb0dSmrg * @x1: Horizontal starting coordinate (inclusive).
13305324fb0dSmrg * @y1: Vertical starting coordinate (inclusive).
13315324fb0dSmrg * @x2: Horizontal ending coordinate (exclusive).
13325324fb0dSmrg * @y2: Vertical ending coordinate (exclusive).
13335324fb0dSmrg *
13345324fb0dSmrg * With drm subsystem using struct drm_rect to manage rectangular area this
13355324fb0dSmrg * export it to user-space.
13365324fb0dSmrg *
13375324fb0dSmrg * Currently used by drm_mode_atomic blob property FB_DAMAGE_CLIPS.
13385324fb0dSmrg */
13395324fb0dSmrgstruct drm_mode_rect {
13405324fb0dSmrg	__s32 x1;
13415324fb0dSmrg	__s32 y1;
13425324fb0dSmrg	__s32 x2;
13435324fb0dSmrg	__s32 y2;
13445324fb0dSmrg};
13455324fb0dSmrg
1346bbff01ceSmrg/**
1347bbff01ceSmrg * struct drm_mode_closefb
1348bbff01ceSmrg * @fb_id: Framebuffer ID.
1349bbff01ceSmrg * @pad: Must be zero.
1350bbff01ceSmrg */
1351bbff01ceSmrgstruct drm_mode_closefb {
1352bbff01ceSmrg	__u32 fb_id;
1353bbff01ceSmrg	__u32 pad;
1354bbff01ceSmrg};
1355bbff01ceSmrg
1356037b3c26Smrg#if defined(__cplusplus)
1357037b3c26Smrg}
1358037b3c26Smrg#endif
1359037b3c26Smrg
136022944501Smrg#endif
1361