162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright (c) 2007 Dave Airlie <airlied@linux.ie>
362306a36Sopenharmony_ci * Copyright (c) 2007 Jakob Bornecrantz <wallbraker@gmail.com>
462306a36Sopenharmony_ci * Copyright (c) 2008 Red Hat Inc.
562306a36Sopenharmony_ci * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA
662306a36Sopenharmony_ci * Copyright (c) 2007-2008 Intel Corporation
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
962306a36Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
1062306a36Sopenharmony_ci * to deal in the Software without restriction, including without limitation
1162306a36Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
1262306a36Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
1362306a36Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
1462306a36Sopenharmony_ci *
1562306a36Sopenharmony_ci * The above copyright notice and this permission notice shall be included in
1662306a36Sopenharmony_ci * all copies or substantial portions of the Software.
1762306a36Sopenharmony_ci *
1862306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1962306a36Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2062306a36Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2162306a36Sopenharmony_ci * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2262306a36Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2362306a36Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2462306a36Sopenharmony_ci * IN THE SOFTWARE.
2562306a36Sopenharmony_ci */
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#ifndef _DRM_MODE_H
2862306a36Sopenharmony_ci#define _DRM_MODE_H
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci#include "drm.h"
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci#if defined(__cplusplus)
3362306a36Sopenharmony_ciextern "C" {
3462306a36Sopenharmony_ci#endif
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci/**
3762306a36Sopenharmony_ci * DOC: overview
3862306a36Sopenharmony_ci *
3962306a36Sopenharmony_ci * DRM exposes many UAPI and structure definition to have a consistent
4062306a36Sopenharmony_ci * and standardized interface with user.
4162306a36Sopenharmony_ci * Userspace can refer to these structure definitions and UAPI formats
4262306a36Sopenharmony_ci * to communicate to driver
4362306a36Sopenharmony_ci */
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci#define DRM_CONNECTOR_NAME_LEN	32
4662306a36Sopenharmony_ci#define DRM_DISPLAY_MODE_LEN	32
4762306a36Sopenharmony_ci#define DRM_PROP_NAME_LEN	32
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci#define DRM_MODE_TYPE_BUILTIN	(1<<0) /* deprecated */
5062306a36Sopenharmony_ci#define DRM_MODE_TYPE_CLOCK_C	((1<<1) | DRM_MODE_TYPE_BUILTIN) /* deprecated */
5162306a36Sopenharmony_ci#define DRM_MODE_TYPE_CRTC_C	((1<<2) | DRM_MODE_TYPE_BUILTIN) /* deprecated */
5262306a36Sopenharmony_ci#define DRM_MODE_TYPE_PREFERRED	(1<<3)
5362306a36Sopenharmony_ci#define DRM_MODE_TYPE_DEFAULT	(1<<4) /* deprecated */
5462306a36Sopenharmony_ci#define DRM_MODE_TYPE_USERDEF	(1<<5)
5562306a36Sopenharmony_ci#define DRM_MODE_TYPE_DRIVER	(1<<6)
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci#define DRM_MODE_TYPE_ALL	(DRM_MODE_TYPE_PREFERRED |	\
5862306a36Sopenharmony_ci				 DRM_MODE_TYPE_USERDEF |	\
5962306a36Sopenharmony_ci				 DRM_MODE_TYPE_DRIVER)
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci/* Video mode flags */
6262306a36Sopenharmony_ci/* bit compatible with the xrandr RR_ definitions (bits 0-13)
6362306a36Sopenharmony_ci *
6462306a36Sopenharmony_ci * ABI warning: Existing userspace really expects
6562306a36Sopenharmony_ci * the mode flags to match the xrandr definitions. Any
6662306a36Sopenharmony_ci * changes that don't match the xrandr definitions will
6762306a36Sopenharmony_ci * likely need a new client cap or some other mechanism
6862306a36Sopenharmony_ci * to avoid breaking existing userspace. This includes
6962306a36Sopenharmony_ci * allocating new flags in the previously unused bits!
7062306a36Sopenharmony_ci */
7162306a36Sopenharmony_ci#define DRM_MODE_FLAG_PHSYNC			(1<<0)
7262306a36Sopenharmony_ci#define DRM_MODE_FLAG_NHSYNC			(1<<1)
7362306a36Sopenharmony_ci#define DRM_MODE_FLAG_PVSYNC			(1<<2)
7462306a36Sopenharmony_ci#define DRM_MODE_FLAG_NVSYNC			(1<<3)
7562306a36Sopenharmony_ci#define DRM_MODE_FLAG_INTERLACE			(1<<4)
7662306a36Sopenharmony_ci#define DRM_MODE_FLAG_DBLSCAN			(1<<5)
7762306a36Sopenharmony_ci#define DRM_MODE_FLAG_CSYNC			(1<<6)
7862306a36Sopenharmony_ci#define DRM_MODE_FLAG_PCSYNC			(1<<7)
7962306a36Sopenharmony_ci#define DRM_MODE_FLAG_NCSYNC			(1<<8)
8062306a36Sopenharmony_ci#define DRM_MODE_FLAG_HSKEW			(1<<9) /* hskew provided */
8162306a36Sopenharmony_ci#define DRM_MODE_FLAG_BCAST			(1<<10) /* deprecated */
8262306a36Sopenharmony_ci#define DRM_MODE_FLAG_PIXMUX			(1<<11) /* deprecated */
8362306a36Sopenharmony_ci#define DRM_MODE_FLAG_DBLCLK			(1<<12)
8462306a36Sopenharmony_ci#define DRM_MODE_FLAG_CLKDIV2			(1<<13)
8562306a36Sopenharmony_ci /*
8662306a36Sopenharmony_ci  * When adding a new stereo mode don't forget to adjust DRM_MODE_FLAGS_3D_MAX
8762306a36Sopenharmony_ci  * (define not exposed to user space).
8862306a36Sopenharmony_ci  */
8962306a36Sopenharmony_ci#define DRM_MODE_FLAG_3D_MASK			(0x1f<<14)
9062306a36Sopenharmony_ci#define  DRM_MODE_FLAG_3D_NONE		(0<<14)
9162306a36Sopenharmony_ci#define  DRM_MODE_FLAG_3D_FRAME_PACKING		(1<<14)
9262306a36Sopenharmony_ci#define  DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE	(2<<14)
9362306a36Sopenharmony_ci#define  DRM_MODE_FLAG_3D_LINE_ALTERNATIVE	(3<<14)
9462306a36Sopenharmony_ci#define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL	(4<<14)
9562306a36Sopenharmony_ci#define  DRM_MODE_FLAG_3D_L_DEPTH		(5<<14)
9662306a36Sopenharmony_ci#define  DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH	(6<<14)
9762306a36Sopenharmony_ci#define  DRM_MODE_FLAG_3D_TOP_AND_BOTTOM	(7<<14)
9862306a36Sopenharmony_ci#define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF	(8<<14)
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ci/* Picture aspect ratio options */
10162306a36Sopenharmony_ci#define DRM_MODE_PICTURE_ASPECT_NONE		0
10262306a36Sopenharmony_ci#define DRM_MODE_PICTURE_ASPECT_4_3		1
10362306a36Sopenharmony_ci#define DRM_MODE_PICTURE_ASPECT_16_9		2
10462306a36Sopenharmony_ci#define DRM_MODE_PICTURE_ASPECT_64_27		3
10562306a36Sopenharmony_ci#define DRM_MODE_PICTURE_ASPECT_256_135		4
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ci/* Content type options */
10862306a36Sopenharmony_ci#define DRM_MODE_CONTENT_TYPE_NO_DATA		0
10962306a36Sopenharmony_ci#define DRM_MODE_CONTENT_TYPE_GRAPHICS		1
11062306a36Sopenharmony_ci#define DRM_MODE_CONTENT_TYPE_PHOTO		2
11162306a36Sopenharmony_ci#define DRM_MODE_CONTENT_TYPE_CINEMA		3
11262306a36Sopenharmony_ci#define DRM_MODE_CONTENT_TYPE_GAME		4
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ci/* Aspect ratio flag bitmask (4 bits 22:19) */
11562306a36Sopenharmony_ci#define DRM_MODE_FLAG_PIC_AR_MASK		(0x0F<<19)
11662306a36Sopenharmony_ci#define  DRM_MODE_FLAG_PIC_AR_NONE \
11762306a36Sopenharmony_ci			(DRM_MODE_PICTURE_ASPECT_NONE<<19)
11862306a36Sopenharmony_ci#define  DRM_MODE_FLAG_PIC_AR_4_3 \
11962306a36Sopenharmony_ci			(DRM_MODE_PICTURE_ASPECT_4_3<<19)
12062306a36Sopenharmony_ci#define  DRM_MODE_FLAG_PIC_AR_16_9 \
12162306a36Sopenharmony_ci			(DRM_MODE_PICTURE_ASPECT_16_9<<19)
12262306a36Sopenharmony_ci#define  DRM_MODE_FLAG_PIC_AR_64_27 \
12362306a36Sopenharmony_ci			(DRM_MODE_PICTURE_ASPECT_64_27<<19)
12462306a36Sopenharmony_ci#define  DRM_MODE_FLAG_PIC_AR_256_135 \
12562306a36Sopenharmony_ci			(DRM_MODE_PICTURE_ASPECT_256_135<<19)
12662306a36Sopenharmony_ci
12762306a36Sopenharmony_ci#define  DRM_MODE_FLAG_ALL	(DRM_MODE_FLAG_PHSYNC |		\
12862306a36Sopenharmony_ci				 DRM_MODE_FLAG_NHSYNC |		\
12962306a36Sopenharmony_ci				 DRM_MODE_FLAG_PVSYNC |		\
13062306a36Sopenharmony_ci				 DRM_MODE_FLAG_NVSYNC |		\
13162306a36Sopenharmony_ci				 DRM_MODE_FLAG_INTERLACE |	\
13262306a36Sopenharmony_ci				 DRM_MODE_FLAG_DBLSCAN |	\
13362306a36Sopenharmony_ci				 DRM_MODE_FLAG_CSYNC |		\
13462306a36Sopenharmony_ci				 DRM_MODE_FLAG_PCSYNC |		\
13562306a36Sopenharmony_ci				 DRM_MODE_FLAG_NCSYNC |		\
13662306a36Sopenharmony_ci				 DRM_MODE_FLAG_HSKEW |		\
13762306a36Sopenharmony_ci				 DRM_MODE_FLAG_DBLCLK |		\
13862306a36Sopenharmony_ci				 DRM_MODE_FLAG_CLKDIV2 |	\
13962306a36Sopenharmony_ci				 DRM_MODE_FLAG_3D_MASK)
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci/* DPMS flags */
14262306a36Sopenharmony_ci/* bit compatible with the xorg definitions. */
14362306a36Sopenharmony_ci#define DRM_MODE_DPMS_ON	0
14462306a36Sopenharmony_ci#define DRM_MODE_DPMS_STANDBY	1
14562306a36Sopenharmony_ci#define DRM_MODE_DPMS_SUSPEND	2
14662306a36Sopenharmony_ci#define DRM_MODE_DPMS_OFF	3
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ci/* Scaling mode options */
14962306a36Sopenharmony_ci#define DRM_MODE_SCALE_NONE		0 /* Unmodified timing (display or
15062306a36Sopenharmony_ci					     software can still scale) */
15162306a36Sopenharmony_ci#define DRM_MODE_SCALE_FULLSCREEN	1 /* Full screen, ignore aspect */
15262306a36Sopenharmony_ci#define DRM_MODE_SCALE_CENTER		2 /* Centered, no scaling */
15362306a36Sopenharmony_ci#define DRM_MODE_SCALE_ASPECT		3 /* Full screen, preserve aspect */
15462306a36Sopenharmony_ci
15562306a36Sopenharmony_ci/* Dithering mode options */
15662306a36Sopenharmony_ci#define DRM_MODE_DITHERING_OFF	0
15762306a36Sopenharmony_ci#define DRM_MODE_DITHERING_ON	1
15862306a36Sopenharmony_ci#define DRM_MODE_DITHERING_AUTO 2
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci/* Dirty info options */
16162306a36Sopenharmony_ci#define DRM_MODE_DIRTY_OFF      0
16262306a36Sopenharmony_ci#define DRM_MODE_DIRTY_ON       1
16362306a36Sopenharmony_ci#define DRM_MODE_DIRTY_ANNOTATE 2
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_ci/* Link Status options */
16662306a36Sopenharmony_ci#define DRM_MODE_LINK_STATUS_GOOD	0
16762306a36Sopenharmony_ci#define DRM_MODE_LINK_STATUS_BAD	1
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_ci/*
17062306a36Sopenharmony_ci * DRM_MODE_ROTATE_<degrees>
17162306a36Sopenharmony_ci *
17262306a36Sopenharmony_ci * Signals that a drm plane is been rotated <degrees> degrees in counter
17362306a36Sopenharmony_ci * clockwise direction.
17462306a36Sopenharmony_ci *
17562306a36Sopenharmony_ci * This define is provided as a convenience, looking up the property id
17662306a36Sopenharmony_ci * using the name->prop id lookup is the preferred method.
17762306a36Sopenharmony_ci */
17862306a36Sopenharmony_ci#define DRM_MODE_ROTATE_0       (1<<0)
17962306a36Sopenharmony_ci#define DRM_MODE_ROTATE_90      (1<<1)
18062306a36Sopenharmony_ci#define DRM_MODE_ROTATE_180     (1<<2)
18162306a36Sopenharmony_ci#define DRM_MODE_ROTATE_270     (1<<3)
18262306a36Sopenharmony_ci
18362306a36Sopenharmony_ci/*
18462306a36Sopenharmony_ci * DRM_MODE_ROTATE_MASK
18562306a36Sopenharmony_ci *
18662306a36Sopenharmony_ci * Bitmask used to look for drm plane rotations.
18762306a36Sopenharmony_ci */
18862306a36Sopenharmony_ci#define DRM_MODE_ROTATE_MASK (\
18962306a36Sopenharmony_ci		DRM_MODE_ROTATE_0  | \
19062306a36Sopenharmony_ci		DRM_MODE_ROTATE_90  | \
19162306a36Sopenharmony_ci		DRM_MODE_ROTATE_180 | \
19262306a36Sopenharmony_ci		DRM_MODE_ROTATE_270)
19362306a36Sopenharmony_ci
19462306a36Sopenharmony_ci/*
19562306a36Sopenharmony_ci * DRM_MODE_REFLECT_<axis>
19662306a36Sopenharmony_ci *
19762306a36Sopenharmony_ci * Signals that the contents of a drm plane is reflected along the <axis> axis,
19862306a36Sopenharmony_ci * in the same way as mirroring.
19962306a36Sopenharmony_ci * See kerneldoc chapter "Plane Composition Properties" for more details.
20062306a36Sopenharmony_ci *
20162306a36Sopenharmony_ci * This define is provided as a convenience, looking up the property id
20262306a36Sopenharmony_ci * using the name->prop id lookup is the preferred method.
20362306a36Sopenharmony_ci */
20462306a36Sopenharmony_ci#define DRM_MODE_REFLECT_X      (1<<4)
20562306a36Sopenharmony_ci#define DRM_MODE_REFLECT_Y      (1<<5)
20662306a36Sopenharmony_ci
20762306a36Sopenharmony_ci/*
20862306a36Sopenharmony_ci * DRM_MODE_REFLECT_MASK
20962306a36Sopenharmony_ci *
21062306a36Sopenharmony_ci * Bitmask used to look for drm plane reflections.
21162306a36Sopenharmony_ci */
21262306a36Sopenharmony_ci#define DRM_MODE_REFLECT_MASK (\
21362306a36Sopenharmony_ci		DRM_MODE_REFLECT_X | \
21462306a36Sopenharmony_ci		DRM_MODE_REFLECT_Y)
21562306a36Sopenharmony_ci
21662306a36Sopenharmony_ci/* Content Protection Flags */
21762306a36Sopenharmony_ci#define DRM_MODE_CONTENT_PROTECTION_UNDESIRED	0
21862306a36Sopenharmony_ci#define DRM_MODE_CONTENT_PROTECTION_DESIRED     1
21962306a36Sopenharmony_ci#define DRM_MODE_CONTENT_PROTECTION_ENABLED     2
22062306a36Sopenharmony_ci
22162306a36Sopenharmony_ci/**
22262306a36Sopenharmony_ci * struct drm_mode_modeinfo - Display mode information.
22362306a36Sopenharmony_ci * @clock: pixel clock in kHz
22462306a36Sopenharmony_ci * @hdisplay: horizontal display size
22562306a36Sopenharmony_ci * @hsync_start: horizontal sync start
22662306a36Sopenharmony_ci * @hsync_end: horizontal sync end
22762306a36Sopenharmony_ci * @htotal: horizontal total size
22862306a36Sopenharmony_ci * @hskew: horizontal skew
22962306a36Sopenharmony_ci * @vdisplay: vertical display size
23062306a36Sopenharmony_ci * @vsync_start: vertical sync start
23162306a36Sopenharmony_ci * @vsync_end: vertical sync end
23262306a36Sopenharmony_ci * @vtotal: vertical total size
23362306a36Sopenharmony_ci * @vscan: vertical scan
23462306a36Sopenharmony_ci * @vrefresh: approximate vertical refresh rate in Hz
23562306a36Sopenharmony_ci * @flags: bitmask of misc. flags, see DRM_MODE_FLAG_* defines
23662306a36Sopenharmony_ci * @type: bitmask of type flags, see DRM_MODE_TYPE_* defines
23762306a36Sopenharmony_ci * @name: string describing the mode resolution
23862306a36Sopenharmony_ci *
23962306a36Sopenharmony_ci * This is the user-space API display mode information structure. For the
24062306a36Sopenharmony_ci * kernel version see struct drm_display_mode.
24162306a36Sopenharmony_ci */
24262306a36Sopenharmony_cistruct drm_mode_modeinfo {
24362306a36Sopenharmony_ci	__u32 clock;
24462306a36Sopenharmony_ci	__u16 hdisplay;
24562306a36Sopenharmony_ci	__u16 hsync_start;
24662306a36Sopenharmony_ci	__u16 hsync_end;
24762306a36Sopenharmony_ci	__u16 htotal;
24862306a36Sopenharmony_ci	__u16 hskew;
24962306a36Sopenharmony_ci	__u16 vdisplay;
25062306a36Sopenharmony_ci	__u16 vsync_start;
25162306a36Sopenharmony_ci	__u16 vsync_end;
25262306a36Sopenharmony_ci	__u16 vtotal;
25362306a36Sopenharmony_ci	__u16 vscan;
25462306a36Sopenharmony_ci
25562306a36Sopenharmony_ci	__u32 vrefresh;
25662306a36Sopenharmony_ci
25762306a36Sopenharmony_ci	__u32 flags;
25862306a36Sopenharmony_ci	__u32 type;
25962306a36Sopenharmony_ci	char name[DRM_DISPLAY_MODE_LEN];
26062306a36Sopenharmony_ci};
26162306a36Sopenharmony_ci
26262306a36Sopenharmony_cistruct drm_mode_card_res {
26362306a36Sopenharmony_ci	__u64 fb_id_ptr;
26462306a36Sopenharmony_ci	__u64 crtc_id_ptr;
26562306a36Sopenharmony_ci	__u64 connector_id_ptr;
26662306a36Sopenharmony_ci	__u64 encoder_id_ptr;
26762306a36Sopenharmony_ci	__u32 count_fbs;
26862306a36Sopenharmony_ci	__u32 count_crtcs;
26962306a36Sopenharmony_ci	__u32 count_connectors;
27062306a36Sopenharmony_ci	__u32 count_encoders;
27162306a36Sopenharmony_ci	__u32 min_width;
27262306a36Sopenharmony_ci	__u32 max_width;
27362306a36Sopenharmony_ci	__u32 min_height;
27462306a36Sopenharmony_ci	__u32 max_height;
27562306a36Sopenharmony_ci};
27662306a36Sopenharmony_ci
27762306a36Sopenharmony_cistruct drm_mode_crtc {
27862306a36Sopenharmony_ci	__u64 set_connectors_ptr;
27962306a36Sopenharmony_ci	__u32 count_connectors;
28062306a36Sopenharmony_ci
28162306a36Sopenharmony_ci	__u32 crtc_id; /**< Id */
28262306a36Sopenharmony_ci	__u32 fb_id; /**< Id of framebuffer */
28362306a36Sopenharmony_ci
28462306a36Sopenharmony_ci	__u32 x; /**< x Position on the framebuffer */
28562306a36Sopenharmony_ci	__u32 y; /**< y Position on the framebuffer */
28662306a36Sopenharmony_ci
28762306a36Sopenharmony_ci	__u32 gamma_size;
28862306a36Sopenharmony_ci	__u32 mode_valid;
28962306a36Sopenharmony_ci	struct drm_mode_modeinfo mode;
29062306a36Sopenharmony_ci};
29162306a36Sopenharmony_ci
29262306a36Sopenharmony_ci#define DRM_MODE_PRESENT_TOP_FIELD	(1<<0)
29362306a36Sopenharmony_ci#define DRM_MODE_PRESENT_BOTTOM_FIELD	(1<<1)
29462306a36Sopenharmony_ci
29562306a36Sopenharmony_ci/* Planes blend with or override other bits on the CRTC */
29662306a36Sopenharmony_cistruct drm_mode_set_plane {
29762306a36Sopenharmony_ci	__u32 plane_id;
29862306a36Sopenharmony_ci	__u32 crtc_id;
29962306a36Sopenharmony_ci	__u32 fb_id; /* fb object contains surface format type */
30062306a36Sopenharmony_ci	__u32 flags; /* see above flags */
30162306a36Sopenharmony_ci
30262306a36Sopenharmony_ci	/* Signed dest location allows it to be partially off screen */
30362306a36Sopenharmony_ci	__s32 crtc_x;
30462306a36Sopenharmony_ci	__s32 crtc_y;
30562306a36Sopenharmony_ci	__u32 crtc_w;
30662306a36Sopenharmony_ci	__u32 crtc_h;
30762306a36Sopenharmony_ci
30862306a36Sopenharmony_ci	/* Source values are 16.16 fixed point */
30962306a36Sopenharmony_ci	__u32 src_x;
31062306a36Sopenharmony_ci	__u32 src_y;
31162306a36Sopenharmony_ci	__u32 src_h;
31262306a36Sopenharmony_ci	__u32 src_w;
31362306a36Sopenharmony_ci};
31462306a36Sopenharmony_ci
31562306a36Sopenharmony_ci/**
31662306a36Sopenharmony_ci * struct drm_mode_get_plane - Get plane metadata.
31762306a36Sopenharmony_ci *
31862306a36Sopenharmony_ci * Userspace can perform a GETPLANE ioctl to retrieve information about a
31962306a36Sopenharmony_ci * plane.
32062306a36Sopenharmony_ci *
32162306a36Sopenharmony_ci * To retrieve the number of formats supported, set @count_format_types to zero
32262306a36Sopenharmony_ci * and call the ioctl. @count_format_types will be updated with the value.
32362306a36Sopenharmony_ci *
32462306a36Sopenharmony_ci * To retrieve these formats, allocate an array with the memory needed to store
32562306a36Sopenharmony_ci * @count_format_types formats. Point @format_type_ptr to this array and call
32662306a36Sopenharmony_ci * the ioctl again (with @count_format_types still set to the value returned in
32762306a36Sopenharmony_ci * the first ioctl call).
32862306a36Sopenharmony_ci */
32962306a36Sopenharmony_cistruct drm_mode_get_plane {
33062306a36Sopenharmony_ci	/**
33162306a36Sopenharmony_ci	 * @plane_id: Object ID of the plane whose information should be
33262306a36Sopenharmony_ci	 * retrieved. Set by caller.
33362306a36Sopenharmony_ci	 */
33462306a36Sopenharmony_ci	__u32 plane_id;
33562306a36Sopenharmony_ci
33662306a36Sopenharmony_ci	/** @crtc_id: Object ID of the current CRTC. */
33762306a36Sopenharmony_ci	__u32 crtc_id;
33862306a36Sopenharmony_ci	/** @fb_id: Object ID of the current fb. */
33962306a36Sopenharmony_ci	__u32 fb_id;
34062306a36Sopenharmony_ci
34162306a36Sopenharmony_ci	/**
34262306a36Sopenharmony_ci	 * @possible_crtcs: Bitmask of CRTC's compatible with the plane. CRTC's
34362306a36Sopenharmony_ci	 * are created and they receive an index, which corresponds to their
34462306a36Sopenharmony_ci	 * position in the bitmask. Bit N corresponds to
34562306a36Sopenharmony_ci	 * :ref:`CRTC index<crtc_index>` N.
34662306a36Sopenharmony_ci	 */
34762306a36Sopenharmony_ci	__u32 possible_crtcs;
34862306a36Sopenharmony_ci	/** @gamma_size: Never used. */
34962306a36Sopenharmony_ci	__u32 gamma_size;
35062306a36Sopenharmony_ci
35162306a36Sopenharmony_ci	/** @count_format_types: Number of formats. */
35262306a36Sopenharmony_ci	__u32 count_format_types;
35362306a36Sopenharmony_ci	/**
35462306a36Sopenharmony_ci	 * @format_type_ptr: Pointer to ``__u32`` array of formats that are
35562306a36Sopenharmony_ci	 * supported by the plane. These formats do not require modifiers.
35662306a36Sopenharmony_ci	 */
35762306a36Sopenharmony_ci	__u64 format_type_ptr;
35862306a36Sopenharmony_ci};
35962306a36Sopenharmony_ci
36062306a36Sopenharmony_cistruct drm_mode_get_plane_res {
36162306a36Sopenharmony_ci	__u64 plane_id_ptr;
36262306a36Sopenharmony_ci	__u32 count_planes;
36362306a36Sopenharmony_ci};
36462306a36Sopenharmony_ci
36562306a36Sopenharmony_ci#define DRM_MODE_ENCODER_NONE	0
36662306a36Sopenharmony_ci#define DRM_MODE_ENCODER_DAC	1
36762306a36Sopenharmony_ci#define DRM_MODE_ENCODER_TMDS	2
36862306a36Sopenharmony_ci#define DRM_MODE_ENCODER_LVDS	3
36962306a36Sopenharmony_ci#define DRM_MODE_ENCODER_TVDAC	4
37062306a36Sopenharmony_ci#define DRM_MODE_ENCODER_VIRTUAL 5
37162306a36Sopenharmony_ci#define DRM_MODE_ENCODER_DSI	6
37262306a36Sopenharmony_ci#define DRM_MODE_ENCODER_DPMST	7
37362306a36Sopenharmony_ci#define DRM_MODE_ENCODER_DPI	8
37462306a36Sopenharmony_ci
37562306a36Sopenharmony_cistruct drm_mode_get_encoder {
37662306a36Sopenharmony_ci	__u32 encoder_id;
37762306a36Sopenharmony_ci	__u32 encoder_type;
37862306a36Sopenharmony_ci
37962306a36Sopenharmony_ci	__u32 crtc_id; /**< Id of crtc */
38062306a36Sopenharmony_ci
38162306a36Sopenharmony_ci	__u32 possible_crtcs;
38262306a36Sopenharmony_ci	__u32 possible_clones;
38362306a36Sopenharmony_ci};
38462306a36Sopenharmony_ci
38562306a36Sopenharmony_ci/* This is for connectors with multiple signal types. */
38662306a36Sopenharmony_ci/* Try to match DRM_MODE_CONNECTOR_X as closely as possible. */
38762306a36Sopenharmony_cienum drm_mode_subconnector {
38862306a36Sopenharmony_ci	DRM_MODE_SUBCONNECTOR_Automatic   = 0,  /* DVI-I, TV     */
38962306a36Sopenharmony_ci	DRM_MODE_SUBCONNECTOR_Unknown     = 0,  /* DVI-I, TV, DP */
39062306a36Sopenharmony_ci	DRM_MODE_SUBCONNECTOR_VGA	  = 1,  /*            DP */
39162306a36Sopenharmony_ci	DRM_MODE_SUBCONNECTOR_DVID	  = 3,  /* DVI-I      DP */
39262306a36Sopenharmony_ci	DRM_MODE_SUBCONNECTOR_DVIA	  = 4,  /* DVI-I         */
39362306a36Sopenharmony_ci	DRM_MODE_SUBCONNECTOR_Composite   = 5,  /*        TV     */
39462306a36Sopenharmony_ci	DRM_MODE_SUBCONNECTOR_SVIDEO	  = 6,  /*        TV     */
39562306a36Sopenharmony_ci	DRM_MODE_SUBCONNECTOR_Component   = 8,  /*        TV     */
39662306a36Sopenharmony_ci	DRM_MODE_SUBCONNECTOR_SCART	  = 9,  /*        TV     */
39762306a36Sopenharmony_ci	DRM_MODE_SUBCONNECTOR_DisplayPort = 10, /*            DP */
39862306a36Sopenharmony_ci	DRM_MODE_SUBCONNECTOR_HDMIA       = 11, /*            DP */
39962306a36Sopenharmony_ci	DRM_MODE_SUBCONNECTOR_Native      = 15, /*            DP */
40062306a36Sopenharmony_ci	DRM_MODE_SUBCONNECTOR_Wireless    = 18, /*            DP */
40162306a36Sopenharmony_ci};
40262306a36Sopenharmony_ci
40362306a36Sopenharmony_ci#define DRM_MODE_CONNECTOR_Unknown	0
40462306a36Sopenharmony_ci#define DRM_MODE_CONNECTOR_VGA		1
40562306a36Sopenharmony_ci#define DRM_MODE_CONNECTOR_DVII		2
40662306a36Sopenharmony_ci#define DRM_MODE_CONNECTOR_DVID		3
40762306a36Sopenharmony_ci#define DRM_MODE_CONNECTOR_DVIA		4
40862306a36Sopenharmony_ci#define DRM_MODE_CONNECTOR_Composite	5
40962306a36Sopenharmony_ci#define DRM_MODE_CONNECTOR_SVIDEO	6
41062306a36Sopenharmony_ci#define DRM_MODE_CONNECTOR_LVDS		7
41162306a36Sopenharmony_ci#define DRM_MODE_CONNECTOR_Component	8
41262306a36Sopenharmony_ci#define DRM_MODE_CONNECTOR_9PinDIN	9
41362306a36Sopenharmony_ci#define DRM_MODE_CONNECTOR_DisplayPort	10
41462306a36Sopenharmony_ci#define DRM_MODE_CONNECTOR_HDMIA	11
41562306a36Sopenharmony_ci#define DRM_MODE_CONNECTOR_HDMIB	12
41662306a36Sopenharmony_ci#define DRM_MODE_CONNECTOR_TV		13
41762306a36Sopenharmony_ci#define DRM_MODE_CONNECTOR_eDP		14
41862306a36Sopenharmony_ci#define DRM_MODE_CONNECTOR_VIRTUAL      15
41962306a36Sopenharmony_ci#define DRM_MODE_CONNECTOR_DSI		16
42062306a36Sopenharmony_ci#define DRM_MODE_CONNECTOR_DPI		17
42162306a36Sopenharmony_ci#define DRM_MODE_CONNECTOR_WRITEBACK	18
42262306a36Sopenharmony_ci#define DRM_MODE_CONNECTOR_SPI		19
42362306a36Sopenharmony_ci#define DRM_MODE_CONNECTOR_USB		20
42462306a36Sopenharmony_ci
42562306a36Sopenharmony_ci/**
42662306a36Sopenharmony_ci * struct drm_mode_get_connector - Get connector metadata.
42762306a36Sopenharmony_ci *
42862306a36Sopenharmony_ci * User-space can perform a GETCONNECTOR ioctl to retrieve information about a
42962306a36Sopenharmony_ci * connector. User-space is expected to retrieve encoders, modes and properties
43062306a36Sopenharmony_ci * by performing this ioctl at least twice: the first time to retrieve the
43162306a36Sopenharmony_ci * number of elements, the second time to retrieve the elements themselves.
43262306a36Sopenharmony_ci *
43362306a36Sopenharmony_ci * To retrieve the number of elements, set @count_props and @count_encoders to
43462306a36Sopenharmony_ci * zero, set @count_modes to 1, and set @modes_ptr to a temporary struct
43562306a36Sopenharmony_ci * drm_mode_modeinfo element.
43662306a36Sopenharmony_ci *
43762306a36Sopenharmony_ci * To retrieve the elements, allocate arrays for @encoders_ptr, @modes_ptr,
43862306a36Sopenharmony_ci * @props_ptr and @prop_values_ptr, then set @count_modes, @count_props and
43962306a36Sopenharmony_ci * @count_encoders to their capacity.
44062306a36Sopenharmony_ci *
44162306a36Sopenharmony_ci * Performing the ioctl only twice may be racy: the number of elements may have
44262306a36Sopenharmony_ci * changed with a hotplug event in-between the two ioctls. User-space is
44362306a36Sopenharmony_ci * expected to retry the last ioctl until the number of elements stabilizes.
44462306a36Sopenharmony_ci * The kernel won't fill any array which doesn't have the expected length.
44562306a36Sopenharmony_ci *
44662306a36Sopenharmony_ci * **Force-probing a connector**
44762306a36Sopenharmony_ci *
44862306a36Sopenharmony_ci * If the @count_modes field is set to zero and the DRM client is the current
44962306a36Sopenharmony_ci * DRM master, the kernel will perform a forced probe on the connector to
45062306a36Sopenharmony_ci * refresh the connector status, modes and EDID. A forced-probe can be slow,
45162306a36Sopenharmony_ci * might cause flickering and the ioctl will block.
45262306a36Sopenharmony_ci *
45362306a36Sopenharmony_ci * User-space needs to force-probe connectors to ensure their metadata is
45462306a36Sopenharmony_ci * up-to-date at startup and after receiving a hot-plug event. User-space
45562306a36Sopenharmony_ci * may perform a forced-probe when the user explicitly requests it. User-space
45662306a36Sopenharmony_ci * shouldn't perform a forced-probe in other situations.
45762306a36Sopenharmony_ci */
45862306a36Sopenharmony_cistruct drm_mode_get_connector {
45962306a36Sopenharmony_ci	/** @encoders_ptr: Pointer to ``__u32`` array of object IDs. */
46062306a36Sopenharmony_ci	__u64 encoders_ptr;
46162306a36Sopenharmony_ci	/** @modes_ptr: Pointer to struct drm_mode_modeinfo array. */
46262306a36Sopenharmony_ci	__u64 modes_ptr;
46362306a36Sopenharmony_ci	/** @props_ptr: Pointer to ``__u32`` array of property IDs. */
46462306a36Sopenharmony_ci	__u64 props_ptr;
46562306a36Sopenharmony_ci	/** @prop_values_ptr: Pointer to ``__u64`` array of property values. */
46662306a36Sopenharmony_ci	__u64 prop_values_ptr;
46762306a36Sopenharmony_ci
46862306a36Sopenharmony_ci	/** @count_modes: Number of modes. */
46962306a36Sopenharmony_ci	__u32 count_modes;
47062306a36Sopenharmony_ci	/** @count_props: Number of properties. */
47162306a36Sopenharmony_ci	__u32 count_props;
47262306a36Sopenharmony_ci	/** @count_encoders: Number of encoders. */
47362306a36Sopenharmony_ci	__u32 count_encoders;
47462306a36Sopenharmony_ci
47562306a36Sopenharmony_ci	/** @encoder_id: Object ID of the current encoder. */
47662306a36Sopenharmony_ci	__u32 encoder_id;
47762306a36Sopenharmony_ci	/** @connector_id: Object ID of the connector. */
47862306a36Sopenharmony_ci	__u32 connector_id;
47962306a36Sopenharmony_ci	/**
48062306a36Sopenharmony_ci	 * @connector_type: Type of the connector.
48162306a36Sopenharmony_ci	 *
48262306a36Sopenharmony_ci	 * See DRM_MODE_CONNECTOR_* defines.
48362306a36Sopenharmony_ci	 */
48462306a36Sopenharmony_ci	__u32 connector_type;
48562306a36Sopenharmony_ci	/**
48662306a36Sopenharmony_ci	 * @connector_type_id: Type-specific connector number.
48762306a36Sopenharmony_ci	 *
48862306a36Sopenharmony_ci	 * This is not an object ID. This is a per-type connector number. Each
48962306a36Sopenharmony_ci	 * (type, type_id) combination is unique across all connectors of a DRM
49062306a36Sopenharmony_ci	 * device.
49162306a36Sopenharmony_ci	 *
49262306a36Sopenharmony_ci	 * The (type, type_id) combination is not a stable identifier: the
49362306a36Sopenharmony_ci	 * type_id can change depending on the driver probe order.
49462306a36Sopenharmony_ci	 */
49562306a36Sopenharmony_ci	__u32 connector_type_id;
49662306a36Sopenharmony_ci
49762306a36Sopenharmony_ci	/**
49862306a36Sopenharmony_ci	 * @connection: Status of the connector.
49962306a36Sopenharmony_ci	 *
50062306a36Sopenharmony_ci	 * See enum drm_connector_status.
50162306a36Sopenharmony_ci	 */
50262306a36Sopenharmony_ci	__u32 connection;
50362306a36Sopenharmony_ci	/** @mm_width: Width of the connected sink in millimeters. */
50462306a36Sopenharmony_ci	__u32 mm_width;
50562306a36Sopenharmony_ci	/** @mm_height: Height of the connected sink in millimeters. */
50662306a36Sopenharmony_ci	__u32 mm_height;
50762306a36Sopenharmony_ci	/**
50862306a36Sopenharmony_ci	 * @subpixel: Subpixel order of the connected sink.
50962306a36Sopenharmony_ci	 *
51062306a36Sopenharmony_ci	 * See enum subpixel_order.
51162306a36Sopenharmony_ci	 */
51262306a36Sopenharmony_ci	__u32 subpixel;
51362306a36Sopenharmony_ci
51462306a36Sopenharmony_ci	/** @pad: Padding, must be zero. */
51562306a36Sopenharmony_ci	__u32 pad;
51662306a36Sopenharmony_ci};
51762306a36Sopenharmony_ci
51862306a36Sopenharmony_ci#define DRM_MODE_PROP_PENDING	(1<<0) /* deprecated, do not use */
51962306a36Sopenharmony_ci#define DRM_MODE_PROP_RANGE	(1<<1)
52062306a36Sopenharmony_ci#define DRM_MODE_PROP_IMMUTABLE	(1<<2)
52162306a36Sopenharmony_ci#define DRM_MODE_PROP_ENUM	(1<<3) /* enumerated type with text strings */
52262306a36Sopenharmony_ci#define DRM_MODE_PROP_BLOB	(1<<4)
52362306a36Sopenharmony_ci#define DRM_MODE_PROP_BITMASK	(1<<5) /* bitmask of enumerated types */
52462306a36Sopenharmony_ci
52562306a36Sopenharmony_ci/* non-extended types: legacy bitmask, one bit per type: */
52662306a36Sopenharmony_ci#define DRM_MODE_PROP_LEGACY_TYPE  ( \
52762306a36Sopenharmony_ci		DRM_MODE_PROP_RANGE | \
52862306a36Sopenharmony_ci		DRM_MODE_PROP_ENUM | \
52962306a36Sopenharmony_ci		DRM_MODE_PROP_BLOB | \
53062306a36Sopenharmony_ci		DRM_MODE_PROP_BITMASK)
53162306a36Sopenharmony_ci
53262306a36Sopenharmony_ci/* extended-types: rather than continue to consume a bit per type,
53362306a36Sopenharmony_ci * grab a chunk of the bits to use as integer type id.
53462306a36Sopenharmony_ci */
53562306a36Sopenharmony_ci#define DRM_MODE_PROP_EXTENDED_TYPE	0x0000ffc0
53662306a36Sopenharmony_ci#define DRM_MODE_PROP_TYPE(n)		((n) << 6)
53762306a36Sopenharmony_ci#define DRM_MODE_PROP_OBJECT		DRM_MODE_PROP_TYPE(1)
53862306a36Sopenharmony_ci#define DRM_MODE_PROP_SIGNED_RANGE	DRM_MODE_PROP_TYPE(2)
53962306a36Sopenharmony_ci
54062306a36Sopenharmony_ci/* the PROP_ATOMIC flag is used to hide properties from userspace that
54162306a36Sopenharmony_ci * is not aware of atomic properties.  This is mostly to work around
54262306a36Sopenharmony_ci * older userspace (DDX drivers) that read/write each prop they find,
54362306a36Sopenharmony_ci * witout being aware that this could be triggering a lengthy modeset.
54462306a36Sopenharmony_ci */
54562306a36Sopenharmony_ci#define DRM_MODE_PROP_ATOMIC        0x80000000
54662306a36Sopenharmony_ci
54762306a36Sopenharmony_ci/**
54862306a36Sopenharmony_ci * struct drm_mode_property_enum - Description for an enum/bitfield entry.
54962306a36Sopenharmony_ci * @value: numeric value for this enum entry.
55062306a36Sopenharmony_ci * @name: symbolic name for this enum entry.
55162306a36Sopenharmony_ci *
55262306a36Sopenharmony_ci * See struct drm_property_enum for details.
55362306a36Sopenharmony_ci */
55462306a36Sopenharmony_cistruct drm_mode_property_enum {
55562306a36Sopenharmony_ci	__u64 value;
55662306a36Sopenharmony_ci	char name[DRM_PROP_NAME_LEN];
55762306a36Sopenharmony_ci};
55862306a36Sopenharmony_ci
55962306a36Sopenharmony_ci/**
56062306a36Sopenharmony_ci * struct drm_mode_get_property - Get property metadata.
56162306a36Sopenharmony_ci *
56262306a36Sopenharmony_ci * User-space can perform a GETPROPERTY ioctl to retrieve information about a
56362306a36Sopenharmony_ci * property. The same property may be attached to multiple objects, see
56462306a36Sopenharmony_ci * "Modeset Base Object Abstraction".
56562306a36Sopenharmony_ci *
56662306a36Sopenharmony_ci * The meaning of the @values_ptr field changes depending on the property type.
56762306a36Sopenharmony_ci * See &drm_property.flags for more details.
56862306a36Sopenharmony_ci *
56962306a36Sopenharmony_ci * The @enum_blob_ptr and @count_enum_blobs fields are only meaningful when the
57062306a36Sopenharmony_ci * property has the type &DRM_MODE_PROP_ENUM or &DRM_MODE_PROP_BITMASK. For
57162306a36Sopenharmony_ci * backwards compatibility, the kernel will always set @count_enum_blobs to
57262306a36Sopenharmony_ci * zero when the property has the type &DRM_MODE_PROP_BLOB. User-space must
57362306a36Sopenharmony_ci * ignore these two fields if the property has a different type.
57462306a36Sopenharmony_ci *
57562306a36Sopenharmony_ci * User-space is expected to retrieve values and enums by performing this ioctl
57662306a36Sopenharmony_ci * at least twice: the first time to retrieve the number of elements, the
57762306a36Sopenharmony_ci * second time to retrieve the elements themselves.
57862306a36Sopenharmony_ci *
57962306a36Sopenharmony_ci * To retrieve the number of elements, set @count_values and @count_enum_blobs
58062306a36Sopenharmony_ci * to zero, then call the ioctl. @count_values will be updated with the number
58162306a36Sopenharmony_ci * of elements. If the property has the type &DRM_MODE_PROP_ENUM or
58262306a36Sopenharmony_ci * &DRM_MODE_PROP_BITMASK, @count_enum_blobs will be updated as well.
58362306a36Sopenharmony_ci *
58462306a36Sopenharmony_ci * To retrieve the elements themselves, allocate an array for @values_ptr and
58562306a36Sopenharmony_ci * set @count_values to its capacity. If the property has the type
58662306a36Sopenharmony_ci * &DRM_MODE_PROP_ENUM or &DRM_MODE_PROP_BITMASK, allocate an array for
58762306a36Sopenharmony_ci * @enum_blob_ptr and set @count_enum_blobs to its capacity. Calling the ioctl
58862306a36Sopenharmony_ci * again will fill the arrays.
58962306a36Sopenharmony_ci */
59062306a36Sopenharmony_cistruct drm_mode_get_property {
59162306a36Sopenharmony_ci	/** @values_ptr: Pointer to a ``__u64`` array. */
59262306a36Sopenharmony_ci	__u64 values_ptr;
59362306a36Sopenharmony_ci	/** @enum_blob_ptr: Pointer to a struct drm_mode_property_enum array. */
59462306a36Sopenharmony_ci	__u64 enum_blob_ptr;
59562306a36Sopenharmony_ci
59662306a36Sopenharmony_ci	/**
59762306a36Sopenharmony_ci	 * @prop_id: Object ID of the property which should be retrieved. Set
59862306a36Sopenharmony_ci	 * by the caller.
59962306a36Sopenharmony_ci	 */
60062306a36Sopenharmony_ci	__u32 prop_id;
60162306a36Sopenharmony_ci	/**
60262306a36Sopenharmony_ci	 * @flags: ``DRM_MODE_PROP_*`` bitfield. See &drm_property.flags for
60362306a36Sopenharmony_ci	 * a definition of the flags.
60462306a36Sopenharmony_ci	 */
60562306a36Sopenharmony_ci	__u32 flags;
60662306a36Sopenharmony_ci	/**
60762306a36Sopenharmony_ci	 * @name: Symbolic property name. User-space should use this field to
60862306a36Sopenharmony_ci	 * recognize properties.
60962306a36Sopenharmony_ci	 */
61062306a36Sopenharmony_ci	char name[DRM_PROP_NAME_LEN];
61162306a36Sopenharmony_ci
61262306a36Sopenharmony_ci	/** @count_values: Number of elements in @values_ptr. */
61362306a36Sopenharmony_ci	__u32 count_values;
61462306a36Sopenharmony_ci	/** @count_enum_blobs: Number of elements in @enum_blob_ptr. */
61562306a36Sopenharmony_ci	__u32 count_enum_blobs;
61662306a36Sopenharmony_ci};
61762306a36Sopenharmony_ci
61862306a36Sopenharmony_cistruct drm_mode_connector_set_property {
61962306a36Sopenharmony_ci	__u64 value;
62062306a36Sopenharmony_ci	__u32 prop_id;
62162306a36Sopenharmony_ci	__u32 connector_id;
62262306a36Sopenharmony_ci};
62362306a36Sopenharmony_ci
62462306a36Sopenharmony_ci#define DRM_MODE_OBJECT_CRTC 0xcccccccc
62562306a36Sopenharmony_ci#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
62662306a36Sopenharmony_ci#define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0
62762306a36Sopenharmony_ci#define DRM_MODE_OBJECT_MODE 0xdededede
62862306a36Sopenharmony_ci#define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
62962306a36Sopenharmony_ci#define DRM_MODE_OBJECT_FB 0xfbfbfbfb
63062306a36Sopenharmony_ci#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
63162306a36Sopenharmony_ci#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
63262306a36Sopenharmony_ci#define DRM_MODE_OBJECT_ANY 0
63362306a36Sopenharmony_ci
63462306a36Sopenharmony_cistruct drm_mode_obj_get_properties {
63562306a36Sopenharmony_ci	__u64 props_ptr;
63662306a36Sopenharmony_ci	__u64 prop_values_ptr;
63762306a36Sopenharmony_ci	__u32 count_props;
63862306a36Sopenharmony_ci	__u32 obj_id;
63962306a36Sopenharmony_ci	__u32 obj_type;
64062306a36Sopenharmony_ci};
64162306a36Sopenharmony_ci
64262306a36Sopenharmony_cistruct drm_mode_obj_set_property {
64362306a36Sopenharmony_ci	__u64 value;
64462306a36Sopenharmony_ci	__u32 prop_id;
64562306a36Sopenharmony_ci	__u32 obj_id;
64662306a36Sopenharmony_ci	__u32 obj_type;
64762306a36Sopenharmony_ci};
64862306a36Sopenharmony_ci
64962306a36Sopenharmony_cistruct drm_mode_get_blob {
65062306a36Sopenharmony_ci	__u32 blob_id;
65162306a36Sopenharmony_ci	__u32 length;
65262306a36Sopenharmony_ci	__u64 data;
65362306a36Sopenharmony_ci};
65462306a36Sopenharmony_ci
65562306a36Sopenharmony_cistruct drm_mode_fb_cmd {
65662306a36Sopenharmony_ci	__u32 fb_id;
65762306a36Sopenharmony_ci	__u32 width;
65862306a36Sopenharmony_ci	__u32 height;
65962306a36Sopenharmony_ci	__u32 pitch;
66062306a36Sopenharmony_ci	__u32 bpp;
66162306a36Sopenharmony_ci	__u32 depth;
66262306a36Sopenharmony_ci	/* driver specific handle */
66362306a36Sopenharmony_ci	__u32 handle;
66462306a36Sopenharmony_ci};
66562306a36Sopenharmony_ci
66662306a36Sopenharmony_ci#define DRM_MODE_FB_INTERLACED	(1<<0) /* for interlaced framebuffers */
66762306a36Sopenharmony_ci#define DRM_MODE_FB_MODIFIERS	(1<<1) /* enables ->modifer[] */
66862306a36Sopenharmony_ci
66962306a36Sopenharmony_ci/**
67062306a36Sopenharmony_ci * struct drm_mode_fb_cmd2 - Frame-buffer metadata.
67162306a36Sopenharmony_ci *
67262306a36Sopenharmony_ci * This struct holds frame-buffer metadata. There are two ways to use it:
67362306a36Sopenharmony_ci *
67462306a36Sopenharmony_ci * - User-space can fill this struct and perform a &DRM_IOCTL_MODE_ADDFB2
67562306a36Sopenharmony_ci *   ioctl to register a new frame-buffer. The new frame-buffer object ID will
67662306a36Sopenharmony_ci *   be set by the kernel in @fb_id.
67762306a36Sopenharmony_ci * - User-space can set @fb_id and perform a &DRM_IOCTL_MODE_GETFB2 ioctl to
67862306a36Sopenharmony_ci *   fetch metadata about an existing frame-buffer.
67962306a36Sopenharmony_ci *
68062306a36Sopenharmony_ci * In case of planar formats, this struct allows up to 4 buffer objects with
68162306a36Sopenharmony_ci * offsets and pitches per plane. The pitch and offset order are dictated by
68262306a36Sopenharmony_ci * the format FourCC as defined by ``drm_fourcc.h``, e.g. NV12 is described as:
68362306a36Sopenharmony_ci *
68462306a36Sopenharmony_ci *     YUV 4:2:0 image with a plane of 8-bit Y samples followed by an
68562306a36Sopenharmony_ci *     interleaved U/V plane containing 8-bit 2x2 subsampled colour difference
68662306a36Sopenharmony_ci *     samples.
68762306a36Sopenharmony_ci *
68862306a36Sopenharmony_ci * So it would consist of a Y plane at ``offsets[0]`` and a UV plane at
68962306a36Sopenharmony_ci * ``offsets[1]``.
69062306a36Sopenharmony_ci *
69162306a36Sopenharmony_ci * To accommodate tiled, compressed, etc formats, a modifier can be specified.
69262306a36Sopenharmony_ci * For more information see the "Format Modifiers" section. Note that even
69362306a36Sopenharmony_ci * though it looks like we have a modifier per-plane, we in fact do not. The
69462306a36Sopenharmony_ci * modifier for each plane must be identical. Thus all combinations of
69562306a36Sopenharmony_ci * different data layouts for multi-plane formats must be enumerated as
69662306a36Sopenharmony_ci * separate modifiers.
69762306a36Sopenharmony_ci *
69862306a36Sopenharmony_ci * All of the entries in @handles, @pitches, @offsets and @modifier must be
69962306a36Sopenharmony_ci * zero when unused. Warning, for @offsets and @modifier zero can't be used to
70062306a36Sopenharmony_ci * figure out whether the entry is used or not since it's a valid value (a zero
70162306a36Sopenharmony_ci * offset is common, and a zero modifier is &DRM_FORMAT_MOD_LINEAR).
70262306a36Sopenharmony_ci */
70362306a36Sopenharmony_cistruct drm_mode_fb_cmd2 {
70462306a36Sopenharmony_ci	/** @fb_id: Object ID of the frame-buffer. */
70562306a36Sopenharmony_ci	__u32 fb_id;
70662306a36Sopenharmony_ci	/** @width: Width of the frame-buffer. */
70762306a36Sopenharmony_ci	__u32 width;
70862306a36Sopenharmony_ci	/** @height: Height of the frame-buffer. */
70962306a36Sopenharmony_ci	__u32 height;
71062306a36Sopenharmony_ci	/**
71162306a36Sopenharmony_ci	 * @pixel_format: FourCC format code, see ``DRM_FORMAT_*`` constants in
71262306a36Sopenharmony_ci	 * ``drm_fourcc.h``.
71362306a36Sopenharmony_ci	 */
71462306a36Sopenharmony_ci	__u32 pixel_format;
71562306a36Sopenharmony_ci	/**
71662306a36Sopenharmony_ci	 * @flags: Frame-buffer flags (see &DRM_MODE_FB_INTERLACED and
71762306a36Sopenharmony_ci	 * &DRM_MODE_FB_MODIFIERS).
71862306a36Sopenharmony_ci	 */
71962306a36Sopenharmony_ci	__u32 flags;
72062306a36Sopenharmony_ci
72162306a36Sopenharmony_ci	/**
72262306a36Sopenharmony_ci	 * @handles: GEM buffer handle, one per plane. Set to 0 if the plane is
72362306a36Sopenharmony_ci	 * unused. The same handle can be used for multiple planes.
72462306a36Sopenharmony_ci	 */
72562306a36Sopenharmony_ci	__u32 handles[4];
72662306a36Sopenharmony_ci	/** @pitches: Pitch (aka. stride) in bytes, one per plane. */
72762306a36Sopenharmony_ci	__u32 pitches[4];
72862306a36Sopenharmony_ci	/** @offsets: Offset into the buffer in bytes, one per plane. */
72962306a36Sopenharmony_ci	__u32 offsets[4];
73062306a36Sopenharmony_ci	/**
73162306a36Sopenharmony_ci	 * @modifier: Format modifier, one per plane. See ``DRM_FORMAT_MOD_*``
73262306a36Sopenharmony_ci	 * constants in ``drm_fourcc.h``. All planes must use the same
73362306a36Sopenharmony_ci	 * modifier. Ignored unless &DRM_MODE_FB_MODIFIERS is set in @flags.
73462306a36Sopenharmony_ci	 */
73562306a36Sopenharmony_ci	__u64 modifier[4];
73662306a36Sopenharmony_ci};
73762306a36Sopenharmony_ci
73862306a36Sopenharmony_ci#define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01
73962306a36Sopenharmony_ci#define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02
74062306a36Sopenharmony_ci#define DRM_MODE_FB_DIRTY_FLAGS         0x03
74162306a36Sopenharmony_ci
74262306a36Sopenharmony_ci#define DRM_MODE_FB_DIRTY_MAX_CLIPS     256
74362306a36Sopenharmony_ci
74462306a36Sopenharmony_ci/*
74562306a36Sopenharmony_ci * Mark a region of a framebuffer as dirty.
74662306a36Sopenharmony_ci *
74762306a36Sopenharmony_ci * Some hardware does not automatically update display contents
74862306a36Sopenharmony_ci * as a hardware or software draw to a framebuffer. This ioctl
74962306a36Sopenharmony_ci * allows userspace to tell the kernel and the hardware what
75062306a36Sopenharmony_ci * regions of the framebuffer have changed.
75162306a36Sopenharmony_ci *
75262306a36Sopenharmony_ci * The kernel or hardware is free to update more then just the
75362306a36Sopenharmony_ci * region specified by the clip rects. The kernel or hardware
75462306a36Sopenharmony_ci * may also delay and/or coalesce several calls to dirty into a
75562306a36Sopenharmony_ci * single update.
75662306a36Sopenharmony_ci *
75762306a36Sopenharmony_ci * Userspace may annotate the updates, the annotates are a
75862306a36Sopenharmony_ci * promise made by the caller that the change is either a copy
75962306a36Sopenharmony_ci * of pixels or a fill of a single color in the region specified.
76062306a36Sopenharmony_ci *
76162306a36Sopenharmony_ci * If the DRM_MODE_FB_DIRTY_ANNOTATE_COPY flag is given then
76262306a36Sopenharmony_ci * the number of updated regions are half of num_clips given,
76362306a36Sopenharmony_ci * where the clip rects are paired in src and dst. The width and
76462306a36Sopenharmony_ci * height of each one of the pairs must match.
76562306a36Sopenharmony_ci *
76662306a36Sopenharmony_ci * If the DRM_MODE_FB_DIRTY_ANNOTATE_FILL flag is given the caller
76762306a36Sopenharmony_ci * promises that the region specified of the clip rects is filled
76862306a36Sopenharmony_ci * completely with a single color as given in the color argument.
76962306a36Sopenharmony_ci */
77062306a36Sopenharmony_ci
77162306a36Sopenharmony_cistruct drm_mode_fb_dirty_cmd {
77262306a36Sopenharmony_ci	__u32 fb_id;
77362306a36Sopenharmony_ci	__u32 flags;
77462306a36Sopenharmony_ci	__u32 color;
77562306a36Sopenharmony_ci	__u32 num_clips;
77662306a36Sopenharmony_ci	__u64 clips_ptr;
77762306a36Sopenharmony_ci};
77862306a36Sopenharmony_ci
77962306a36Sopenharmony_cistruct drm_mode_mode_cmd {
78062306a36Sopenharmony_ci	__u32 connector_id;
78162306a36Sopenharmony_ci	struct drm_mode_modeinfo mode;
78262306a36Sopenharmony_ci};
78362306a36Sopenharmony_ci
78462306a36Sopenharmony_ci#define DRM_MODE_CURSOR_BO	0x01
78562306a36Sopenharmony_ci#define DRM_MODE_CURSOR_MOVE	0x02
78662306a36Sopenharmony_ci#define DRM_MODE_CURSOR_FLAGS	0x03
78762306a36Sopenharmony_ci
78862306a36Sopenharmony_ci/*
78962306a36Sopenharmony_ci * depending on the value in flags different members are used.
79062306a36Sopenharmony_ci *
79162306a36Sopenharmony_ci * CURSOR_BO uses
79262306a36Sopenharmony_ci *    crtc_id
79362306a36Sopenharmony_ci *    width
79462306a36Sopenharmony_ci *    height
79562306a36Sopenharmony_ci *    handle - if 0 turns the cursor off
79662306a36Sopenharmony_ci *
79762306a36Sopenharmony_ci * CURSOR_MOVE uses
79862306a36Sopenharmony_ci *    crtc_id
79962306a36Sopenharmony_ci *    x
80062306a36Sopenharmony_ci *    y
80162306a36Sopenharmony_ci */
80262306a36Sopenharmony_cistruct drm_mode_cursor {
80362306a36Sopenharmony_ci	__u32 flags;
80462306a36Sopenharmony_ci	__u32 crtc_id;
80562306a36Sopenharmony_ci	__s32 x;
80662306a36Sopenharmony_ci	__s32 y;
80762306a36Sopenharmony_ci	__u32 width;
80862306a36Sopenharmony_ci	__u32 height;
80962306a36Sopenharmony_ci	/* driver specific handle */
81062306a36Sopenharmony_ci	__u32 handle;
81162306a36Sopenharmony_ci};
81262306a36Sopenharmony_ci
81362306a36Sopenharmony_cistruct drm_mode_cursor2 {
81462306a36Sopenharmony_ci	__u32 flags;
81562306a36Sopenharmony_ci	__u32 crtc_id;
81662306a36Sopenharmony_ci	__s32 x;
81762306a36Sopenharmony_ci	__s32 y;
81862306a36Sopenharmony_ci	__u32 width;
81962306a36Sopenharmony_ci	__u32 height;
82062306a36Sopenharmony_ci	/* driver specific handle */
82162306a36Sopenharmony_ci	__u32 handle;
82262306a36Sopenharmony_ci	__s32 hot_x;
82362306a36Sopenharmony_ci	__s32 hot_y;
82462306a36Sopenharmony_ci};
82562306a36Sopenharmony_ci
82662306a36Sopenharmony_cistruct drm_mode_crtc_lut {
82762306a36Sopenharmony_ci	__u32 crtc_id;
82862306a36Sopenharmony_ci	__u32 gamma_size;
82962306a36Sopenharmony_ci
83062306a36Sopenharmony_ci	/* pointers to arrays */
83162306a36Sopenharmony_ci	__u64 red;
83262306a36Sopenharmony_ci	__u64 green;
83362306a36Sopenharmony_ci	__u64 blue;
83462306a36Sopenharmony_ci};
83562306a36Sopenharmony_ci
83662306a36Sopenharmony_cistruct drm_color_ctm {
83762306a36Sopenharmony_ci	/*
83862306a36Sopenharmony_ci	 * Conversion matrix in S31.32 sign-magnitude
83962306a36Sopenharmony_ci	 * (not two's complement!) format.
84062306a36Sopenharmony_ci	 *
84162306a36Sopenharmony_ci	 * out   matrix    in
84262306a36Sopenharmony_ci	 * |R|   |0 1 2|   |R|
84362306a36Sopenharmony_ci	 * |G| = |3 4 5| x |G|
84462306a36Sopenharmony_ci	 * |B|   |6 7 8|   |B|
84562306a36Sopenharmony_ci	 */
84662306a36Sopenharmony_ci	__u64 matrix[9];
84762306a36Sopenharmony_ci};
84862306a36Sopenharmony_ci
84962306a36Sopenharmony_cistruct drm_color_lut {
85062306a36Sopenharmony_ci	/*
85162306a36Sopenharmony_ci	 * Values are mapped linearly to 0.0 - 1.0 range, with 0x0 == 0.0 and
85262306a36Sopenharmony_ci	 * 0xffff == 1.0.
85362306a36Sopenharmony_ci	 */
85462306a36Sopenharmony_ci	__u16 red;
85562306a36Sopenharmony_ci	__u16 green;
85662306a36Sopenharmony_ci	__u16 blue;
85762306a36Sopenharmony_ci	__u16 reserved;
85862306a36Sopenharmony_ci};
85962306a36Sopenharmony_ci
86062306a36Sopenharmony_ci/**
86162306a36Sopenharmony_ci * struct hdr_metadata_infoframe - HDR Metadata Infoframe Data.
86262306a36Sopenharmony_ci *
86362306a36Sopenharmony_ci * HDR Metadata Infoframe as per CTA 861.G spec. This is expected
86462306a36Sopenharmony_ci * to match exactly with the spec.
86562306a36Sopenharmony_ci *
86662306a36Sopenharmony_ci * Userspace is expected to pass the metadata information as per
86762306a36Sopenharmony_ci * the format described in this structure.
86862306a36Sopenharmony_ci */
86962306a36Sopenharmony_cistruct hdr_metadata_infoframe {
87062306a36Sopenharmony_ci	/**
87162306a36Sopenharmony_ci	 * @eotf: Electro-Optical Transfer Function (EOTF)
87262306a36Sopenharmony_ci	 * used in the stream.
87362306a36Sopenharmony_ci	 */
87462306a36Sopenharmony_ci	__u8 eotf;
87562306a36Sopenharmony_ci	/**
87662306a36Sopenharmony_ci	 * @metadata_type: Static_Metadata_Descriptor_ID.
87762306a36Sopenharmony_ci	 */
87862306a36Sopenharmony_ci	__u8 metadata_type;
87962306a36Sopenharmony_ci	/**
88062306a36Sopenharmony_ci	 * @display_primaries: Color Primaries of the Data.
88162306a36Sopenharmony_ci	 * These are coded as unsigned 16-bit values in units of
88262306a36Sopenharmony_ci	 * 0.00002, where 0x0000 represents zero and 0xC350
88362306a36Sopenharmony_ci	 * represents 1.0000.
88462306a36Sopenharmony_ci	 * @display_primaries.x: X cordinate of color primary.
88562306a36Sopenharmony_ci	 * @display_primaries.y: Y cordinate of color primary.
88662306a36Sopenharmony_ci	 */
88762306a36Sopenharmony_ci	struct {
88862306a36Sopenharmony_ci		__u16 x, y;
88962306a36Sopenharmony_ci	} display_primaries[3];
89062306a36Sopenharmony_ci	/**
89162306a36Sopenharmony_ci	 * @white_point: White Point of Colorspace Data.
89262306a36Sopenharmony_ci	 * These are coded as unsigned 16-bit values in units of
89362306a36Sopenharmony_ci	 * 0.00002, where 0x0000 represents zero and 0xC350
89462306a36Sopenharmony_ci	 * represents 1.0000.
89562306a36Sopenharmony_ci	 * @white_point.x: X cordinate of whitepoint of color primary.
89662306a36Sopenharmony_ci	 * @white_point.y: Y cordinate of whitepoint of color primary.
89762306a36Sopenharmony_ci	 */
89862306a36Sopenharmony_ci	struct {
89962306a36Sopenharmony_ci		__u16 x, y;
90062306a36Sopenharmony_ci	} white_point;
90162306a36Sopenharmony_ci	/**
90262306a36Sopenharmony_ci	 * @max_display_mastering_luminance: Max Mastering Display Luminance.
90362306a36Sopenharmony_ci	 * This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
90462306a36Sopenharmony_ci	 * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
90562306a36Sopenharmony_ci	 */
90662306a36Sopenharmony_ci	__u16 max_display_mastering_luminance;
90762306a36Sopenharmony_ci	/**
90862306a36Sopenharmony_ci	 * @min_display_mastering_luminance: Min Mastering Display Luminance.
90962306a36Sopenharmony_ci	 * This value is coded as an unsigned 16-bit value in units of
91062306a36Sopenharmony_ci	 * 0.0001 cd/m2, where 0x0001 represents 0.0001 cd/m2 and 0xFFFF
91162306a36Sopenharmony_ci	 * represents 6.5535 cd/m2.
91262306a36Sopenharmony_ci	 */
91362306a36Sopenharmony_ci	__u16 min_display_mastering_luminance;
91462306a36Sopenharmony_ci	/**
91562306a36Sopenharmony_ci	 * @max_cll: Max Content Light Level.
91662306a36Sopenharmony_ci	 * This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
91762306a36Sopenharmony_ci	 * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
91862306a36Sopenharmony_ci	 */
91962306a36Sopenharmony_ci	__u16 max_cll;
92062306a36Sopenharmony_ci	/**
92162306a36Sopenharmony_ci	 * @max_fall: Max Frame Average Light Level.
92262306a36Sopenharmony_ci	 * This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
92362306a36Sopenharmony_ci	 * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
92462306a36Sopenharmony_ci	 */
92562306a36Sopenharmony_ci	__u16 max_fall;
92662306a36Sopenharmony_ci};
92762306a36Sopenharmony_ci
92862306a36Sopenharmony_ci/**
92962306a36Sopenharmony_ci * struct hdr_output_metadata - HDR output metadata
93062306a36Sopenharmony_ci *
93162306a36Sopenharmony_ci * Metadata Information to be passed from userspace
93262306a36Sopenharmony_ci */
93362306a36Sopenharmony_cistruct hdr_output_metadata {
93462306a36Sopenharmony_ci	/**
93562306a36Sopenharmony_ci	 * @metadata_type: Static_Metadata_Descriptor_ID.
93662306a36Sopenharmony_ci	 */
93762306a36Sopenharmony_ci	__u32 metadata_type;
93862306a36Sopenharmony_ci	/**
93962306a36Sopenharmony_ci	 * @hdmi_metadata_type1: HDR Metadata Infoframe.
94062306a36Sopenharmony_ci	 */
94162306a36Sopenharmony_ci	union {
94262306a36Sopenharmony_ci		struct hdr_metadata_infoframe hdmi_metadata_type1;
94362306a36Sopenharmony_ci	};
94462306a36Sopenharmony_ci};
94562306a36Sopenharmony_ci
94662306a36Sopenharmony_ci/**
94762306a36Sopenharmony_ci * DRM_MODE_PAGE_FLIP_EVENT
94862306a36Sopenharmony_ci *
94962306a36Sopenharmony_ci * Request that the kernel sends back a vblank event (see
95062306a36Sopenharmony_ci * struct drm_event_vblank) with the &DRM_EVENT_FLIP_COMPLETE type when the
95162306a36Sopenharmony_ci * page-flip is done.
95262306a36Sopenharmony_ci */
95362306a36Sopenharmony_ci#define DRM_MODE_PAGE_FLIP_EVENT 0x01
95462306a36Sopenharmony_ci/**
95562306a36Sopenharmony_ci * DRM_MODE_PAGE_FLIP_ASYNC
95662306a36Sopenharmony_ci *
95762306a36Sopenharmony_ci * Request that the page-flip is performed as soon as possible, ie. with no
95862306a36Sopenharmony_ci * delay due to waiting for vblank. This may cause tearing to be visible on
95962306a36Sopenharmony_ci * the screen.
96062306a36Sopenharmony_ci */
96162306a36Sopenharmony_ci#define DRM_MODE_PAGE_FLIP_ASYNC 0x02
96262306a36Sopenharmony_ci#define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
96362306a36Sopenharmony_ci#define DRM_MODE_PAGE_FLIP_TARGET_RELATIVE 0x8
96462306a36Sopenharmony_ci#define DRM_MODE_PAGE_FLIP_TARGET (DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE | \
96562306a36Sopenharmony_ci				   DRM_MODE_PAGE_FLIP_TARGET_RELATIVE)
96662306a36Sopenharmony_ci/**
96762306a36Sopenharmony_ci * DRM_MODE_PAGE_FLIP_FLAGS
96862306a36Sopenharmony_ci *
96962306a36Sopenharmony_ci * Bitmask of flags suitable for &drm_mode_crtc_page_flip_target.flags.
97062306a36Sopenharmony_ci */
97162306a36Sopenharmony_ci#define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT | \
97262306a36Sopenharmony_ci				  DRM_MODE_PAGE_FLIP_ASYNC | \
97362306a36Sopenharmony_ci				  DRM_MODE_PAGE_FLIP_TARGET)
97462306a36Sopenharmony_ci
97562306a36Sopenharmony_ci/*
97662306a36Sopenharmony_ci * Request a page flip on the specified crtc.
97762306a36Sopenharmony_ci *
97862306a36Sopenharmony_ci * This ioctl will ask KMS to schedule a page flip for the specified
97962306a36Sopenharmony_ci * crtc.  Once any pending rendering targeting the specified fb (as of
98062306a36Sopenharmony_ci * ioctl time) has completed, the crtc will be reprogrammed to display
98162306a36Sopenharmony_ci * that fb after the next vertical refresh.  The ioctl returns
98262306a36Sopenharmony_ci * immediately, but subsequent rendering to the current fb will block
98362306a36Sopenharmony_ci * in the execbuffer ioctl until the page flip happens.  If a page
98462306a36Sopenharmony_ci * flip is already pending as the ioctl is called, EBUSY will be
98562306a36Sopenharmony_ci * returned.
98662306a36Sopenharmony_ci *
98762306a36Sopenharmony_ci * Flag DRM_MODE_PAGE_FLIP_EVENT requests that drm sends back a vblank
98862306a36Sopenharmony_ci * event (see drm.h: struct drm_event_vblank) when the page flip is
98962306a36Sopenharmony_ci * done.  The user_data field passed in with this ioctl will be
99062306a36Sopenharmony_ci * returned as the user_data field in the vblank event struct.
99162306a36Sopenharmony_ci *
99262306a36Sopenharmony_ci * Flag DRM_MODE_PAGE_FLIP_ASYNC requests that the flip happen
99362306a36Sopenharmony_ci * 'as soon as possible', meaning that it not delay waiting for vblank.
99462306a36Sopenharmony_ci * This may cause tearing on the screen.
99562306a36Sopenharmony_ci *
99662306a36Sopenharmony_ci * The reserved field must be zero.
99762306a36Sopenharmony_ci */
99862306a36Sopenharmony_ci
99962306a36Sopenharmony_cistruct drm_mode_crtc_page_flip {
100062306a36Sopenharmony_ci	__u32 crtc_id;
100162306a36Sopenharmony_ci	__u32 fb_id;
100262306a36Sopenharmony_ci	__u32 flags;
100362306a36Sopenharmony_ci	__u32 reserved;
100462306a36Sopenharmony_ci	__u64 user_data;
100562306a36Sopenharmony_ci};
100662306a36Sopenharmony_ci
100762306a36Sopenharmony_ci/*
100862306a36Sopenharmony_ci * Request a page flip on the specified crtc.
100962306a36Sopenharmony_ci *
101062306a36Sopenharmony_ci * Same as struct drm_mode_crtc_page_flip, but supports new flags and
101162306a36Sopenharmony_ci * re-purposes the reserved field:
101262306a36Sopenharmony_ci *
101362306a36Sopenharmony_ci * The sequence field must be zero unless either of the
101462306a36Sopenharmony_ci * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is specified. When
101562306a36Sopenharmony_ci * the ABSOLUTE flag is specified, the sequence field denotes the absolute
101662306a36Sopenharmony_ci * vblank sequence when the flip should take effect. When the RELATIVE
101762306a36Sopenharmony_ci * flag is specified, the sequence field denotes the relative (to the
101862306a36Sopenharmony_ci * current one when the ioctl is called) vblank sequence when the flip
101962306a36Sopenharmony_ci * should take effect. NOTE: DRM_IOCTL_WAIT_VBLANK must still be used to
102062306a36Sopenharmony_ci * make sure the vblank sequence before the target one has passed before
102162306a36Sopenharmony_ci * calling this ioctl. The purpose of the
102262306a36Sopenharmony_ci * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is merely to clarify
102362306a36Sopenharmony_ci * the target for when code dealing with a page flip runs during a
102462306a36Sopenharmony_ci * vertical blank period.
102562306a36Sopenharmony_ci */
102662306a36Sopenharmony_ci
102762306a36Sopenharmony_cistruct drm_mode_crtc_page_flip_target {
102862306a36Sopenharmony_ci	__u32 crtc_id;
102962306a36Sopenharmony_ci	__u32 fb_id;
103062306a36Sopenharmony_ci	__u32 flags;
103162306a36Sopenharmony_ci	__u32 sequence;
103262306a36Sopenharmony_ci	__u64 user_data;
103362306a36Sopenharmony_ci};
103462306a36Sopenharmony_ci
103562306a36Sopenharmony_ci/* create a dumb scanout buffer */
103662306a36Sopenharmony_cistruct drm_mode_create_dumb {
103762306a36Sopenharmony_ci	__u32 height;
103862306a36Sopenharmony_ci	__u32 width;
103962306a36Sopenharmony_ci	__u32 bpp;
104062306a36Sopenharmony_ci	__u32 flags;
104162306a36Sopenharmony_ci	/* handle, pitch, size will be returned */
104262306a36Sopenharmony_ci	__u32 handle;
104362306a36Sopenharmony_ci	__u32 pitch;
104462306a36Sopenharmony_ci	__u64 size;
104562306a36Sopenharmony_ci};
104662306a36Sopenharmony_ci
104762306a36Sopenharmony_ci/* set up for mmap of a dumb scanout buffer */
104862306a36Sopenharmony_cistruct drm_mode_map_dumb {
104962306a36Sopenharmony_ci	/** Handle for the object being mapped. */
105062306a36Sopenharmony_ci	__u32 handle;
105162306a36Sopenharmony_ci	__u32 pad;
105262306a36Sopenharmony_ci	/**
105362306a36Sopenharmony_ci	 * Fake offset to use for subsequent mmap call
105462306a36Sopenharmony_ci	 *
105562306a36Sopenharmony_ci	 * This is a fixed-size type for 32/64 compatibility.
105662306a36Sopenharmony_ci	 */
105762306a36Sopenharmony_ci	__u64 offset;
105862306a36Sopenharmony_ci};
105962306a36Sopenharmony_ci
106062306a36Sopenharmony_cistruct drm_mode_destroy_dumb {
106162306a36Sopenharmony_ci	__u32 handle;
106262306a36Sopenharmony_ci};
106362306a36Sopenharmony_ci
106462306a36Sopenharmony_ci/**
106562306a36Sopenharmony_ci * DRM_MODE_ATOMIC_TEST_ONLY
106662306a36Sopenharmony_ci *
106762306a36Sopenharmony_ci * Do not apply the atomic commit, instead check whether the hardware supports
106862306a36Sopenharmony_ci * this configuration.
106962306a36Sopenharmony_ci *
107062306a36Sopenharmony_ci * See &drm_mode_config_funcs.atomic_check for more details on test-only
107162306a36Sopenharmony_ci * commits.
107262306a36Sopenharmony_ci */
107362306a36Sopenharmony_ci#define DRM_MODE_ATOMIC_TEST_ONLY 0x0100
107462306a36Sopenharmony_ci/**
107562306a36Sopenharmony_ci * DRM_MODE_ATOMIC_NONBLOCK
107662306a36Sopenharmony_ci *
107762306a36Sopenharmony_ci * Do not block while applying the atomic commit. The &DRM_IOCTL_MODE_ATOMIC
107862306a36Sopenharmony_ci * IOCTL returns immediately instead of waiting for the changes to be applied
107962306a36Sopenharmony_ci * in hardware. Note, the driver will still check that the update can be
108062306a36Sopenharmony_ci * applied before retuning.
108162306a36Sopenharmony_ci */
108262306a36Sopenharmony_ci#define DRM_MODE_ATOMIC_NONBLOCK  0x0200
108362306a36Sopenharmony_ci/**
108462306a36Sopenharmony_ci * DRM_MODE_ATOMIC_ALLOW_MODESET
108562306a36Sopenharmony_ci *
108662306a36Sopenharmony_ci * Allow the update to result in temporary or transient visible artifacts while
108762306a36Sopenharmony_ci * the update is being applied. Applying the update may also take significantly
108862306a36Sopenharmony_ci * more time than a page flip. All visual artifacts will disappear by the time
108962306a36Sopenharmony_ci * the update is completed, as signalled through the vblank event's timestamp
109062306a36Sopenharmony_ci * (see struct drm_event_vblank).
109162306a36Sopenharmony_ci *
109262306a36Sopenharmony_ci * This flag must be set when the KMS update might cause visible artifacts.
109362306a36Sopenharmony_ci * Without this flag such KMS update will return a EINVAL error. What kind of
109462306a36Sopenharmony_ci * update may cause visible artifacts depends on the driver and the hardware.
109562306a36Sopenharmony_ci * User-space that needs to know beforehand if an update might cause visible
109662306a36Sopenharmony_ci * artifacts can use &DRM_MODE_ATOMIC_TEST_ONLY without
109762306a36Sopenharmony_ci * &DRM_MODE_ATOMIC_ALLOW_MODESET to see if it fails.
109862306a36Sopenharmony_ci *
109962306a36Sopenharmony_ci * To the best of the driver's knowledge, visual artifacts are guaranteed to
110062306a36Sopenharmony_ci * not appear when this flag is not set. Some sinks might display visual
110162306a36Sopenharmony_ci * artifacts outside of the driver's control.
110262306a36Sopenharmony_ci */
110362306a36Sopenharmony_ci#define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400
110462306a36Sopenharmony_ci
110562306a36Sopenharmony_ci/**
110662306a36Sopenharmony_ci * DRM_MODE_ATOMIC_FLAGS
110762306a36Sopenharmony_ci *
110862306a36Sopenharmony_ci * Bitfield of flags accepted by the &DRM_IOCTL_MODE_ATOMIC IOCTL in
110962306a36Sopenharmony_ci * &drm_mode_atomic.flags.
111062306a36Sopenharmony_ci */
111162306a36Sopenharmony_ci#define DRM_MODE_ATOMIC_FLAGS (\
111262306a36Sopenharmony_ci		DRM_MODE_PAGE_FLIP_EVENT |\
111362306a36Sopenharmony_ci		DRM_MODE_PAGE_FLIP_ASYNC |\
111462306a36Sopenharmony_ci		DRM_MODE_ATOMIC_TEST_ONLY |\
111562306a36Sopenharmony_ci		DRM_MODE_ATOMIC_NONBLOCK |\
111662306a36Sopenharmony_ci		DRM_MODE_ATOMIC_ALLOW_MODESET)
111762306a36Sopenharmony_ci
111862306a36Sopenharmony_cistruct drm_mode_atomic {
111962306a36Sopenharmony_ci	__u32 flags;
112062306a36Sopenharmony_ci	__u32 count_objs;
112162306a36Sopenharmony_ci	__u64 objs_ptr;
112262306a36Sopenharmony_ci	__u64 count_props_ptr;
112362306a36Sopenharmony_ci	__u64 props_ptr;
112462306a36Sopenharmony_ci	__u64 prop_values_ptr;
112562306a36Sopenharmony_ci	__u64 reserved;
112662306a36Sopenharmony_ci	__u64 user_data;
112762306a36Sopenharmony_ci};
112862306a36Sopenharmony_ci
112962306a36Sopenharmony_cistruct drm_format_modifier_blob {
113062306a36Sopenharmony_ci#define FORMAT_BLOB_CURRENT 1
113162306a36Sopenharmony_ci	/* Version of this blob format */
113262306a36Sopenharmony_ci	__u32 version;
113362306a36Sopenharmony_ci
113462306a36Sopenharmony_ci	/* Flags */
113562306a36Sopenharmony_ci	__u32 flags;
113662306a36Sopenharmony_ci
113762306a36Sopenharmony_ci	/* Number of fourcc formats supported */
113862306a36Sopenharmony_ci	__u32 count_formats;
113962306a36Sopenharmony_ci
114062306a36Sopenharmony_ci	/* Where in this blob the formats exist (in bytes) */
114162306a36Sopenharmony_ci	__u32 formats_offset;
114262306a36Sopenharmony_ci
114362306a36Sopenharmony_ci	/* Number of drm_format_modifiers */
114462306a36Sopenharmony_ci	__u32 count_modifiers;
114562306a36Sopenharmony_ci
114662306a36Sopenharmony_ci	/* Where in this blob the modifiers exist (in bytes) */
114762306a36Sopenharmony_ci	__u32 modifiers_offset;
114862306a36Sopenharmony_ci
114962306a36Sopenharmony_ci	/* __u32 formats[] */
115062306a36Sopenharmony_ci	/* struct drm_format_modifier modifiers[] */
115162306a36Sopenharmony_ci};
115262306a36Sopenharmony_ci
115362306a36Sopenharmony_cistruct drm_format_modifier {
115462306a36Sopenharmony_ci	/* Bitmask of formats in get_plane format list this info applies to. The
115562306a36Sopenharmony_ci	 * offset allows a sliding window of which 64 formats (bits).
115662306a36Sopenharmony_ci	 *
115762306a36Sopenharmony_ci	 * Some examples:
115862306a36Sopenharmony_ci	 * In today's world with < 65 formats, and formats 0, and 2 are
115962306a36Sopenharmony_ci	 * supported
116062306a36Sopenharmony_ci	 * 0x0000000000000005
116162306a36Sopenharmony_ci	 *		  ^-offset = 0, formats = 5
116262306a36Sopenharmony_ci	 *
116362306a36Sopenharmony_ci	 * If the number formats grew to 128, and formats 98-102 are
116462306a36Sopenharmony_ci	 * supported with the modifier:
116562306a36Sopenharmony_ci	 *
116662306a36Sopenharmony_ci	 * 0x0000007c00000000 0000000000000000
116762306a36Sopenharmony_ci	 *		  ^
116862306a36Sopenharmony_ci	 *		  |__offset = 64, formats = 0x7c00000000
116962306a36Sopenharmony_ci	 *
117062306a36Sopenharmony_ci	 */
117162306a36Sopenharmony_ci	__u64 formats;
117262306a36Sopenharmony_ci	__u32 offset;
117362306a36Sopenharmony_ci	__u32 pad;
117462306a36Sopenharmony_ci
117562306a36Sopenharmony_ci	/* The modifier that applies to the >get_plane format list bitmask. */
117662306a36Sopenharmony_ci	__u64 modifier;
117762306a36Sopenharmony_ci};
117862306a36Sopenharmony_ci
117962306a36Sopenharmony_ci/**
118062306a36Sopenharmony_ci * struct drm_mode_create_blob - Create New blob property
118162306a36Sopenharmony_ci *
118262306a36Sopenharmony_ci * Create a new 'blob' data property, copying length bytes from data pointer,
118362306a36Sopenharmony_ci * and returning new blob ID.
118462306a36Sopenharmony_ci */
118562306a36Sopenharmony_cistruct drm_mode_create_blob {
118662306a36Sopenharmony_ci	/** @data: Pointer to data to copy. */
118762306a36Sopenharmony_ci	__u64 data;
118862306a36Sopenharmony_ci	/** @length: Length of data to copy. */
118962306a36Sopenharmony_ci	__u32 length;
119062306a36Sopenharmony_ci	/** @blob_id: Return: new property ID. */
119162306a36Sopenharmony_ci	__u32 blob_id;
119262306a36Sopenharmony_ci};
119362306a36Sopenharmony_ci
119462306a36Sopenharmony_ci/**
119562306a36Sopenharmony_ci * struct drm_mode_destroy_blob - Destroy user blob
119662306a36Sopenharmony_ci * @blob_id: blob_id to destroy
119762306a36Sopenharmony_ci *
119862306a36Sopenharmony_ci * Destroy a user-created blob property.
119962306a36Sopenharmony_ci *
120062306a36Sopenharmony_ci * User-space can release blobs as soon as they do not need to refer to them by
120162306a36Sopenharmony_ci * their blob object ID.  For instance, if you are using a MODE_ID blob in an
120262306a36Sopenharmony_ci * atomic commit and you will not make another commit re-using the same ID, you
120362306a36Sopenharmony_ci * can destroy the blob as soon as the commit has been issued, without waiting
120462306a36Sopenharmony_ci * for it to complete.
120562306a36Sopenharmony_ci */
120662306a36Sopenharmony_cistruct drm_mode_destroy_blob {
120762306a36Sopenharmony_ci	__u32 blob_id;
120862306a36Sopenharmony_ci};
120962306a36Sopenharmony_ci
121062306a36Sopenharmony_ci/**
121162306a36Sopenharmony_ci * struct drm_mode_create_lease - Create lease
121262306a36Sopenharmony_ci *
121362306a36Sopenharmony_ci * Lease mode resources, creating another drm_master.
121462306a36Sopenharmony_ci *
121562306a36Sopenharmony_ci * The @object_ids array must reference at least one CRTC, one connector and
121662306a36Sopenharmony_ci * one plane if &DRM_CLIENT_CAP_UNIVERSAL_PLANES is enabled. Alternatively,
121762306a36Sopenharmony_ci * the lease can be completely empty.
121862306a36Sopenharmony_ci */
121962306a36Sopenharmony_cistruct drm_mode_create_lease {
122062306a36Sopenharmony_ci	/** @object_ids: Pointer to array of object ids (__u32) */
122162306a36Sopenharmony_ci	__u64 object_ids;
122262306a36Sopenharmony_ci	/** @object_count: Number of object ids */
122362306a36Sopenharmony_ci	__u32 object_count;
122462306a36Sopenharmony_ci	/** @flags: flags for new FD (O_CLOEXEC, etc) */
122562306a36Sopenharmony_ci	__u32 flags;
122662306a36Sopenharmony_ci
122762306a36Sopenharmony_ci	/** @lessee_id: Return: unique identifier for lessee. */
122862306a36Sopenharmony_ci	__u32 lessee_id;
122962306a36Sopenharmony_ci	/** @fd: Return: file descriptor to new drm_master file */
123062306a36Sopenharmony_ci	__u32 fd;
123162306a36Sopenharmony_ci};
123262306a36Sopenharmony_ci
123362306a36Sopenharmony_ci/**
123462306a36Sopenharmony_ci * struct drm_mode_list_lessees - List lessees
123562306a36Sopenharmony_ci *
123662306a36Sopenharmony_ci * List lesses from a drm_master.
123762306a36Sopenharmony_ci */
123862306a36Sopenharmony_cistruct drm_mode_list_lessees {
123962306a36Sopenharmony_ci	/**
124062306a36Sopenharmony_ci	 * @count_lessees: Number of lessees.
124162306a36Sopenharmony_ci	 *
124262306a36Sopenharmony_ci	 * On input, provides length of the array.
124362306a36Sopenharmony_ci	 * On output, provides total number. No
124462306a36Sopenharmony_ci	 * more than the input number will be written
124562306a36Sopenharmony_ci	 * back, so two calls can be used to get
124662306a36Sopenharmony_ci	 * the size and then the data.
124762306a36Sopenharmony_ci	 */
124862306a36Sopenharmony_ci	__u32 count_lessees;
124962306a36Sopenharmony_ci	/** @pad: Padding. */
125062306a36Sopenharmony_ci	__u32 pad;
125162306a36Sopenharmony_ci
125262306a36Sopenharmony_ci	/**
125362306a36Sopenharmony_ci	 * @lessees_ptr: Pointer to lessees.
125462306a36Sopenharmony_ci	 *
125562306a36Sopenharmony_ci	 * Pointer to __u64 array of lessee ids
125662306a36Sopenharmony_ci	 */
125762306a36Sopenharmony_ci	__u64 lessees_ptr;
125862306a36Sopenharmony_ci};
125962306a36Sopenharmony_ci
126062306a36Sopenharmony_ci/**
126162306a36Sopenharmony_ci * struct drm_mode_get_lease - Get Lease
126262306a36Sopenharmony_ci *
126362306a36Sopenharmony_ci * Get leased objects.
126462306a36Sopenharmony_ci */
126562306a36Sopenharmony_cistruct drm_mode_get_lease {
126662306a36Sopenharmony_ci	/**
126762306a36Sopenharmony_ci	 * @count_objects: Number of leased objects.
126862306a36Sopenharmony_ci	 *
126962306a36Sopenharmony_ci	 * On input, provides length of the array.
127062306a36Sopenharmony_ci	 * On output, provides total number. No
127162306a36Sopenharmony_ci	 * more than the input number will be written
127262306a36Sopenharmony_ci	 * back, so two calls can be used to get
127362306a36Sopenharmony_ci	 * the size and then the data.
127462306a36Sopenharmony_ci	 */
127562306a36Sopenharmony_ci	__u32 count_objects;
127662306a36Sopenharmony_ci	/** @pad: Padding. */
127762306a36Sopenharmony_ci	__u32 pad;
127862306a36Sopenharmony_ci
127962306a36Sopenharmony_ci	/**
128062306a36Sopenharmony_ci	 * @objects_ptr: Pointer to objects.
128162306a36Sopenharmony_ci	 *
128262306a36Sopenharmony_ci	 * Pointer to __u32 array of object ids.
128362306a36Sopenharmony_ci	 */
128462306a36Sopenharmony_ci	__u64 objects_ptr;
128562306a36Sopenharmony_ci};
128662306a36Sopenharmony_ci
128762306a36Sopenharmony_ci/**
128862306a36Sopenharmony_ci * struct drm_mode_revoke_lease - Revoke lease
128962306a36Sopenharmony_ci */
129062306a36Sopenharmony_cistruct drm_mode_revoke_lease {
129162306a36Sopenharmony_ci	/** @lessee_id: Unique ID of lessee */
129262306a36Sopenharmony_ci	__u32 lessee_id;
129362306a36Sopenharmony_ci};
129462306a36Sopenharmony_ci
129562306a36Sopenharmony_ci/**
129662306a36Sopenharmony_ci * struct drm_mode_rect - Two dimensional rectangle.
129762306a36Sopenharmony_ci * @x1: Horizontal starting coordinate (inclusive).
129862306a36Sopenharmony_ci * @y1: Vertical starting coordinate (inclusive).
129962306a36Sopenharmony_ci * @x2: Horizontal ending coordinate (exclusive).
130062306a36Sopenharmony_ci * @y2: Vertical ending coordinate (exclusive).
130162306a36Sopenharmony_ci *
130262306a36Sopenharmony_ci * With drm subsystem using struct drm_rect to manage rectangular area this
130362306a36Sopenharmony_ci * export it to user-space.
130462306a36Sopenharmony_ci *
130562306a36Sopenharmony_ci * Currently used by drm_mode_atomic blob property FB_DAMAGE_CLIPS.
130662306a36Sopenharmony_ci */
130762306a36Sopenharmony_cistruct drm_mode_rect {
130862306a36Sopenharmony_ci	__s32 x1;
130962306a36Sopenharmony_ci	__s32 y1;
131062306a36Sopenharmony_ci	__s32 x2;
131162306a36Sopenharmony_ci	__s32 y2;
131262306a36Sopenharmony_ci};
131362306a36Sopenharmony_ci
131462306a36Sopenharmony_ci#if defined(__cplusplus)
131562306a36Sopenharmony_ci}
131662306a36Sopenharmony_ci#endif
131762306a36Sopenharmony_ci
131862306a36Sopenharmony_ci#endif
1319