drm_mode.h revision e6188e58
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
3022944501Smrg#define DRM_DISPLAY_INFO_LEN	32
3122944501Smrg#define DRM_CONNECTOR_NAME_LEN	32
3222944501Smrg#define DRM_DISPLAY_MODE_LEN	32
3322944501Smrg#define DRM_PROP_NAME_LEN	32
3422944501Smrg
3522944501Smrg#define DRM_MODE_TYPE_BUILTIN	(1<<0)
3622944501Smrg#define DRM_MODE_TYPE_CLOCK_C	((1<<1) | DRM_MODE_TYPE_BUILTIN)
3722944501Smrg#define DRM_MODE_TYPE_CRTC_C	((1<<2) | DRM_MODE_TYPE_BUILTIN)
3822944501Smrg#define DRM_MODE_TYPE_PREFERRED	(1<<3)
3922944501Smrg#define DRM_MODE_TYPE_DEFAULT	(1<<4)
4022944501Smrg#define DRM_MODE_TYPE_USERDEF	(1<<5)
4122944501Smrg#define DRM_MODE_TYPE_DRIVER	(1<<6)
4222944501Smrg
4322944501Smrg/* Video mode flags */
4422944501Smrg/* bit compatible with the xorg definitions. */
45e88f27b3Smrg#define DRM_MODE_FLAG_PHSYNC			(1<<0)
46e88f27b3Smrg#define DRM_MODE_FLAG_NHSYNC			(1<<1)
47e88f27b3Smrg#define DRM_MODE_FLAG_PVSYNC			(1<<2)
48e88f27b3Smrg#define DRM_MODE_FLAG_NVSYNC			(1<<3)
49e88f27b3Smrg#define DRM_MODE_FLAG_INTERLACE			(1<<4)
50e88f27b3Smrg#define DRM_MODE_FLAG_DBLSCAN			(1<<5)
51e88f27b3Smrg#define DRM_MODE_FLAG_CSYNC			(1<<6)
52e88f27b3Smrg#define DRM_MODE_FLAG_PCSYNC			(1<<7)
53e88f27b3Smrg#define DRM_MODE_FLAG_NCSYNC			(1<<8)
54e88f27b3Smrg#define DRM_MODE_FLAG_HSKEW			(1<<9) /* hskew provided */
55e88f27b3Smrg#define DRM_MODE_FLAG_BCAST			(1<<10)
56e88f27b3Smrg#define DRM_MODE_FLAG_PIXMUX			(1<<11)
57e88f27b3Smrg#define DRM_MODE_FLAG_DBLCLK			(1<<12)
58e88f27b3Smrg#define DRM_MODE_FLAG_CLKDIV2			(1<<13)
59e88f27b3Smrg#define DRM_MODE_FLAG_3D_MASK			(0x1f<<14)
60e88f27b3Smrg#define  DRM_MODE_FLAG_3D_NONE			(0<<14)
61e88f27b3Smrg#define  DRM_MODE_FLAG_3D_FRAME_PACKING		(1<<14)
62e88f27b3Smrg#define  DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE	(2<<14)
63e88f27b3Smrg#define  DRM_MODE_FLAG_3D_LINE_ALTERNATIVE	(3<<14)
64e88f27b3Smrg#define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL	(4<<14)
65e88f27b3Smrg#define  DRM_MODE_FLAG_3D_L_DEPTH		(5<<14)
66e88f27b3Smrg#define  DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH	(6<<14)
67e88f27b3Smrg#define  DRM_MODE_FLAG_3D_TOP_AND_BOTTOM	(7<<14)
68e88f27b3Smrg#define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF	(8<<14)
69e88f27b3Smrg
7022944501Smrg
7122944501Smrg/* DPMS flags */
7222944501Smrg/* bit compatible with the xorg definitions. */
7322944501Smrg#define DRM_MODE_DPMS_ON	0
7422944501Smrg#define DRM_MODE_DPMS_STANDBY	1
7522944501Smrg#define DRM_MODE_DPMS_SUSPEND	2
7622944501Smrg#define DRM_MODE_DPMS_OFF	3
7722944501Smrg
7822944501Smrg/* Scaling mode options */
7922944501Smrg#define DRM_MODE_SCALE_NONE		0 /* Unmodified timing (display or
8022944501Smrg					     software can still scale) */
8122944501Smrg#define DRM_MODE_SCALE_FULLSCREEN	1 /* Full screen, ignore aspect */
8222944501Smrg#define DRM_MODE_SCALE_CENTER		2 /* Centered, no scaling */
8322944501Smrg#define DRM_MODE_SCALE_ASPECT		3 /* Full screen, preserve aspect */
8422944501Smrg
8522944501Smrg/* Dithering mode options */
8622944501Smrg#define DRM_MODE_DITHERING_OFF	0
8722944501Smrg#define DRM_MODE_DITHERING_ON	1
88d049871aSmrg#define DRM_MODE_DITHERING_AUTO 2
8922944501Smrg
9013d1d17dSmrg/* Dirty info options */
9113d1d17dSmrg#define DRM_MODE_DIRTY_OFF      0
9213d1d17dSmrg#define DRM_MODE_DIRTY_ON       1
9313d1d17dSmrg#define DRM_MODE_DIRTY_ANNOTATE 2
9413d1d17dSmrg
9522944501Smrgstruct drm_mode_modeinfo {
9622944501Smrg	__u32 clock;
9722944501Smrg	__u16 hdisplay, hsync_start, hsync_end, htotal, hskew;
9822944501Smrg	__u16 vdisplay, vsync_start, vsync_end, vtotal, vscan;
9922944501Smrg
100d049871aSmrg	__u32 vrefresh;
10122944501Smrg
10222944501Smrg	__u32 flags;
10322944501Smrg	__u32 type;
10422944501Smrg	char name[DRM_DISPLAY_MODE_LEN];
10522944501Smrg};
10622944501Smrg
10722944501Smrgstruct drm_mode_card_res {
10822944501Smrg	__u64 fb_id_ptr;
10922944501Smrg	__u64 crtc_id_ptr;
11022944501Smrg	__u64 connector_id_ptr;
11122944501Smrg	__u64 encoder_id_ptr;
11222944501Smrg	__u32 count_fbs;
11322944501Smrg	__u32 count_crtcs;
11422944501Smrg	__u32 count_connectors;
11522944501Smrg	__u32 count_encoders;
11622944501Smrg	__u32 min_width, max_width;
11722944501Smrg	__u32 min_height, max_height;
11822944501Smrg};
11922944501Smrg
12022944501Smrgstruct drm_mode_crtc {
12122944501Smrg	__u64 set_connectors_ptr;
12222944501Smrg	__u32 count_connectors;
12322944501Smrg
12422944501Smrg	__u32 crtc_id; /**< Id */
12522944501Smrg	__u32 fb_id; /**< Id of framebuffer */
12622944501Smrg
12722944501Smrg	__u32 x, y; /**< Position on the frameuffer */
12822944501Smrg
12922944501Smrg	__u32 gamma_size;
13022944501Smrg	__u32 mode_valid;
13122944501Smrg	struct drm_mode_modeinfo mode;
13222944501Smrg};
13322944501Smrg
134e88f27b3Smrg#define DRM_MODE_PRESENT_TOP_FIELD     (1<<0)
135e88f27b3Smrg#define DRM_MODE_PRESENT_BOTTOM_FIELD  (1<<1)
136e88f27b3Smrg
137e88f27b3Smrg/* Planes blend with or override other bits on the CRTC */
138e88f27b3Smrgstruct drm_mode_set_plane {
139e88f27b3Smrg	__u32 plane_id;
140e88f27b3Smrg	__u32 crtc_id;
141e88f27b3Smrg	__u32 fb_id; /* fb object contains surface format type */
142e88f27b3Smrg	__u32 flags;
143e88f27b3Smrg
144e88f27b3Smrg	/* Signed dest location allows it to be partially off screen */
145e88f27b3Smrg	__s32 crtc_x, crtc_y;
146e88f27b3Smrg	__u32 crtc_w, crtc_h;
147e88f27b3Smrg
148e88f27b3Smrg	/* Source values are 16.16 fixed point */
149e88f27b3Smrg	__u32 src_x, src_y;
150e88f27b3Smrg	__u32 src_h, src_w;
151e88f27b3Smrg};
152e88f27b3Smrg
153e88f27b3Smrgstruct drm_mode_get_plane {
154e88f27b3Smrg	__u32 plane_id;
155e88f27b3Smrg
156e88f27b3Smrg	__u32 crtc_id;
157e88f27b3Smrg	__u32 fb_id;
158e88f27b3Smrg
159e88f27b3Smrg	__u32 possible_crtcs;
160e88f27b3Smrg	__u32 gamma_size;
161e88f27b3Smrg
162e88f27b3Smrg	__u32 count_format_types;
163e88f27b3Smrg	__u64 format_type_ptr;
164e88f27b3Smrg};
165e88f27b3Smrg
166e88f27b3Smrgstruct drm_mode_get_plane_res {
167e88f27b3Smrg	__u64 plane_id_ptr;
168e88f27b3Smrg	__u32 count_planes;
169e88f27b3Smrg};
170e88f27b3Smrg
17122944501Smrg#define DRM_MODE_ENCODER_NONE	0
17222944501Smrg#define DRM_MODE_ENCODER_DAC	1
17322944501Smrg#define DRM_MODE_ENCODER_TMDS	2
17422944501Smrg#define DRM_MODE_ENCODER_LVDS	3
17522944501Smrg#define DRM_MODE_ENCODER_TVDAC	4
17608d7334dSsnj#define DRM_MODE_ENCODER_VIRTUAL 5
17708d7334dSsnj#define DRM_MODE_ENCODER_DSI	6
17808d7334dSsnj#define DRM_MODE_ENCODER_DPMST	7
17922944501Smrg
18022944501Smrgstruct drm_mode_get_encoder {
18122944501Smrg	__u32 encoder_id;
18222944501Smrg	__u32 encoder_type;
18322944501Smrg
18422944501Smrg	__u32 crtc_id; /**< Id of crtc */
18522944501Smrg
18622944501Smrg	__u32 possible_crtcs;
18722944501Smrg	__u32 possible_clones;
18822944501Smrg};
18922944501Smrg
19022944501Smrg/* This is for connectors with multiple signal types. */
19122944501Smrg/* Try to match DRM_MODE_CONNECTOR_X as closely as possible. */
19222944501Smrg#define DRM_MODE_SUBCONNECTOR_Automatic	0
19322944501Smrg#define DRM_MODE_SUBCONNECTOR_Unknown	0
19422944501Smrg#define DRM_MODE_SUBCONNECTOR_DVID	3
19522944501Smrg#define DRM_MODE_SUBCONNECTOR_DVIA	4
19622944501Smrg#define DRM_MODE_SUBCONNECTOR_Composite	5
19722944501Smrg#define DRM_MODE_SUBCONNECTOR_SVIDEO	6
19822944501Smrg#define DRM_MODE_SUBCONNECTOR_Component	8
19922944501Smrg#define DRM_MODE_SUBCONNECTOR_SCART	9
20022944501Smrg
20122944501Smrg#define DRM_MODE_CONNECTOR_Unknown	0
20222944501Smrg#define DRM_MODE_CONNECTOR_VGA		1
20322944501Smrg#define DRM_MODE_CONNECTOR_DVII		2
20422944501Smrg#define DRM_MODE_CONNECTOR_DVID		3
20522944501Smrg#define DRM_MODE_CONNECTOR_DVIA		4
20622944501Smrg#define DRM_MODE_CONNECTOR_Composite	5
20722944501Smrg#define DRM_MODE_CONNECTOR_SVIDEO	6
20822944501Smrg#define DRM_MODE_CONNECTOR_LVDS		7
20922944501Smrg#define DRM_MODE_CONNECTOR_Component	8
21022944501Smrg#define DRM_MODE_CONNECTOR_9PinDIN	9
21122944501Smrg#define DRM_MODE_CONNECTOR_DisplayPort	10
21222944501Smrg#define DRM_MODE_CONNECTOR_HDMIA	11
21322944501Smrg#define DRM_MODE_CONNECTOR_HDMIB	12
21422944501Smrg#define DRM_MODE_CONNECTOR_TV		13
215d049871aSmrg#define DRM_MODE_CONNECTOR_eDP		14
21608d7334dSsnj#define DRM_MODE_CONNECTOR_VIRTUAL      15
21708d7334dSsnj#define DRM_MODE_CONNECTOR_DSI		16
21822944501Smrg
21922944501Smrgstruct drm_mode_get_connector {
22022944501Smrg
22122944501Smrg	__u64 encoders_ptr;
22222944501Smrg	__u64 modes_ptr;
22322944501Smrg	__u64 props_ptr;
22422944501Smrg	__u64 prop_values_ptr;
22522944501Smrg
22622944501Smrg	__u32 count_modes;
22722944501Smrg	__u32 count_props;
22822944501Smrg	__u32 count_encoders;
22922944501Smrg
23022944501Smrg	__u32 encoder_id; /**< Current Encoder */
23122944501Smrg	__u32 connector_id; /**< Id */
23222944501Smrg	__u32 connector_type;
23322944501Smrg	__u32 connector_type_id;
23422944501Smrg
23522944501Smrg	__u32 connection;
23622944501Smrg	__u32 mm_width, mm_height; /**< HxW in millimeters */
23722944501Smrg	__u32 subpixel;
23822944501Smrg};
23922944501Smrg
24022944501Smrg#define DRM_MODE_PROP_PENDING	(1<<0)
24122944501Smrg#define DRM_MODE_PROP_RANGE	(1<<1)
24222944501Smrg#define DRM_MODE_PROP_IMMUTABLE	(1<<2)
24322944501Smrg#define DRM_MODE_PROP_ENUM	(1<<3) /* enumerated type with text strings */
24422944501Smrg#define DRM_MODE_PROP_BLOB	(1<<4)
245e88f27b3Smrg#define DRM_MODE_PROP_BITMASK	(1<<5) /* bitmask of enumerated types */
24622944501Smrg
24708d7334dSsnj/* non-extended types: legacy bitmask, one bit per type: */
24808d7334dSsnj#define DRM_MODE_PROP_LEGACY_TYPE  ( \
24908d7334dSsnj		DRM_MODE_PROP_RANGE | \
25008d7334dSsnj		DRM_MODE_PROP_ENUM | \
25108d7334dSsnj		DRM_MODE_PROP_BLOB | \
25208d7334dSsnj		DRM_MODE_PROP_BITMASK)
25308d7334dSsnj
25408d7334dSsnj/* extended-types: rather than continue to consume a bit per type,
25508d7334dSsnj * grab a chunk of the bits to use as integer type id.
25608d7334dSsnj */
25708d7334dSsnj#define DRM_MODE_PROP_EXTENDED_TYPE	0x0000ffc0
25808d7334dSsnj#define DRM_MODE_PROP_TYPE(n)		((n) << 6)
25908d7334dSsnj#define DRM_MODE_PROP_OBJECT		DRM_MODE_PROP_TYPE(1)
26008d7334dSsnj#define DRM_MODE_PROP_SIGNED_RANGE	DRM_MODE_PROP_TYPE(2)
26108d7334dSsnj
26222944501Smrgstruct drm_mode_property_enum {
26322944501Smrg	__u64 value;
26422944501Smrg	char name[DRM_PROP_NAME_LEN];
26522944501Smrg};
26622944501Smrg
26722944501Smrgstruct drm_mode_get_property {
26822944501Smrg	__u64 values_ptr; /* values and blob lengths */
26922944501Smrg	__u64 enum_blob_ptr; /* enum and blob id ptrs */
27022944501Smrg
27122944501Smrg	__u32 prop_id;
27222944501Smrg	__u32 flags;
27322944501Smrg	char name[DRM_PROP_NAME_LEN];
27422944501Smrg
27522944501Smrg	__u32 count_values;
27622944501Smrg	__u32 count_enum_blobs;
27722944501Smrg};
27822944501Smrg
27922944501Smrgstruct drm_mode_connector_set_property {
28022944501Smrg	__u64 value;
28122944501Smrg	__u32 prop_id;
28222944501Smrg	__u32 connector_id;
28322944501Smrg};
28422944501Smrg
285e88f27b3Smrg#define DRM_MODE_OBJECT_CRTC 0xcccccccc
286e88f27b3Smrg#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
287e88f27b3Smrg#define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0
288e88f27b3Smrg#define DRM_MODE_OBJECT_MODE 0xdededede
289e88f27b3Smrg#define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
290e88f27b3Smrg#define DRM_MODE_OBJECT_FB 0xfbfbfbfb
291e88f27b3Smrg#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
292e88f27b3Smrg#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
293e88f27b3Smrg
294e88f27b3Smrgstruct drm_mode_obj_get_properties {
295e88f27b3Smrg	__u64 props_ptr;
296e88f27b3Smrg	__u64 prop_values_ptr;
297e88f27b3Smrg	__u32 count_props;
298e88f27b3Smrg	__u32 obj_id;
299e88f27b3Smrg	__u32 obj_type;
300e88f27b3Smrg};
301e88f27b3Smrg
302e88f27b3Smrgstruct drm_mode_obj_set_property {
303e88f27b3Smrg	__u64 value;
304e88f27b3Smrg	__u32 prop_id;
305e88f27b3Smrg	__u32 obj_id;
306e88f27b3Smrg	__u32 obj_type;
307e88f27b3Smrg};
308e88f27b3Smrg
30922944501Smrgstruct drm_mode_get_blob {
31022944501Smrg	__u32 blob_id;
31122944501Smrg	__u32 length;
31222944501Smrg	__u64 data;
31322944501Smrg};
31422944501Smrg
31522944501Smrgstruct drm_mode_fb_cmd {
31622944501Smrg	__u32 fb_id;
31722944501Smrg	__u32 width, height;
31822944501Smrg	__u32 pitch;
31922944501Smrg	__u32 bpp;
32022944501Smrg	__u32 depth;
32122944501Smrg	/* driver specific handle */
32222944501Smrg	__u32 handle;
32322944501Smrg};
32422944501Smrg
325e88f27b3Smrg#define DRM_MODE_FB_INTERLACED (1<<0) /* for interlaced framebuffers */
326e88f27b3Smrg
327e88f27b3Smrgstruct drm_mode_fb_cmd2 {
328e88f27b3Smrg	__u32 fb_id;
329e88f27b3Smrg	__u32 width, height;
330e88f27b3Smrg	__u32 pixel_format; /* fourcc code from drm_fourcc.h */
331e88f27b3Smrg	__u32 flags;
332e88f27b3Smrg
333e88f27b3Smrg	/*
334e88f27b3Smrg	 * In case of planar formats, this ioctl allows up to 4
335e88f27b3Smrg	 * buffer objects with offsets and pitches per plane.
336e88f27b3Smrg	 * The pitch and offset order is dictated by the fourcc,
337e88f27b3Smrg	 * e.g. NV12 (http://fourcc.org/yuv.php#NV12) is described as:
338e88f27b3Smrg	 *
339e88f27b3Smrg	 *   YUV 4:2:0 image with a plane of 8 bit Y samples
340e88f27b3Smrg	 *   followed by an interleaved U/V plane containing
341e88f27b3Smrg	 *   8 bit 2x2 subsampled colour difference samples.
342e88f27b3Smrg	 *
343e88f27b3Smrg	 * So it would consist of Y as offset[0] and UV as
344e88f27b3Smrg	 * offset[1].  Note that offset[0] will generally
345e88f27b3Smrg	 * be 0.
346e88f27b3Smrg	 */
347e88f27b3Smrg	__u32 handles[4];
348e88f27b3Smrg	__u32 pitches[4]; /* pitch for each plane */
349e88f27b3Smrg	__u32 offsets[4]; /* offset of each plane */
350e88f27b3Smrg};
351e88f27b3Smrg
35222944501Smrg#define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01
35322944501Smrg#define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02
35422944501Smrg#define DRM_MODE_FB_DIRTY_FLAGS         0x03
35522944501Smrg
35622944501Smrg/*
35722944501Smrg * Mark a region of a framebuffer as dirty.
35822944501Smrg *
35922944501Smrg * Some hardware does not automatically update display contents
36022944501Smrg * as a hardware or software draw to a framebuffer. This ioctl
36122944501Smrg * allows userspace to tell the kernel and the hardware what
36222944501Smrg * regions of the framebuffer have changed.
36322944501Smrg *
36422944501Smrg * The kernel or hardware is free to update more then just the
36522944501Smrg * region specified by the clip rects. The kernel or hardware
36622944501Smrg * may also delay and/or coalesce several calls to dirty into a
36722944501Smrg * single update.
36822944501Smrg *
36922944501Smrg * Userspace may annotate the updates, the annotates are a
37022944501Smrg * promise made by the caller that the change is either a copy
37122944501Smrg * of pixels or a fill of a single color in the region specified.
37222944501Smrg *
37322944501Smrg * If the DRM_MODE_FB_DIRTY_ANNOTATE_COPY flag is given then
37422944501Smrg * the number of updated regions are half of num_clips given,
37522944501Smrg * where the clip rects are paired in src and dst. The width and
37622944501Smrg * height of each one of the pairs must match.
37722944501Smrg *
37822944501Smrg * If the DRM_MODE_FB_DIRTY_ANNOTATE_FILL flag is given the caller
37922944501Smrg * promises that the region specified of the clip rects is filled
38022944501Smrg * completely with a single color as given in the color argument.
38122944501Smrg */
38222944501Smrg
38322944501Smrgstruct drm_mode_fb_dirty_cmd {
38422944501Smrg	__u32 fb_id;
38522944501Smrg	__u32 flags;
38622944501Smrg	__u32 color;
38722944501Smrg	__u32 num_clips;
38822944501Smrg	__u64 clips_ptr;
38922944501Smrg};
39022944501Smrg
39122944501Smrgstruct drm_mode_mode_cmd {
39222944501Smrg	__u32 connector_id;
39322944501Smrg	struct drm_mode_modeinfo mode;
39422944501Smrg};
39522944501Smrg
39622944501Smrg#define DRM_MODE_CURSOR_BO	(1<<0)
39722944501Smrg#define DRM_MODE_CURSOR_MOVE	(1<<1)
39822944501Smrg
39922944501Smrg/*
40022944501Smrg * depending on the value in flags diffrent members are used.
40122944501Smrg *
40222944501Smrg * CURSOR_BO uses
40322944501Smrg *    crtc
40422944501Smrg *    width
40522944501Smrg *    height
40622944501Smrg *    handle - if 0 turns the cursor of
40722944501Smrg *
40822944501Smrg * CURSOR_MOVE uses
40922944501Smrg *    crtc
41022944501Smrg *    x
41122944501Smrg *    y
41222944501Smrg */
41322944501Smrgstruct drm_mode_cursor {
41422944501Smrg	__u32 flags;
41522944501Smrg	__u32 crtc_id;
41622944501Smrg	__s32 x;
41722944501Smrg	__s32 y;
41822944501Smrg	__u32 width;
41922944501Smrg	__u32 height;
42022944501Smrg	/* driver specific handle */
42122944501Smrg	__u32 handle;
42222944501Smrg};
42322944501Smrg
424e88f27b3Smrgstruct drm_mode_cursor2 {
425e88f27b3Smrg	__u32 flags;
426e88f27b3Smrg	__u32 crtc_id;
427e88f27b3Smrg	__s32 x;
428e88f27b3Smrg	__s32 y;
429e88f27b3Smrg	__u32 width;
430e88f27b3Smrg	__u32 height;
431e88f27b3Smrg	/* driver specific handle */
432e88f27b3Smrg	__u32 handle;
433e88f27b3Smrg	__s32 hot_x;
434e88f27b3Smrg	__s32 hot_y;
435e88f27b3Smrg};
436e88f27b3Smrg
43722944501Smrgstruct drm_mode_crtc_lut {
43822944501Smrg	__u32 crtc_id;
43922944501Smrg	__u32 gamma_size;
44022944501Smrg
44122944501Smrg	/* pointers to arrays */
44222944501Smrg	__u64 red;
44322944501Smrg	__u64 green;
44422944501Smrg	__u64 blue;
44522944501Smrg};
44622944501Smrg
44722944501Smrg#define DRM_MODE_PAGE_FLIP_EVENT 0x01
448e88f27b3Smrg#define DRM_MODE_PAGE_FLIP_ASYNC 0x02
449e88f27b3Smrg#define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT|DRM_MODE_PAGE_FLIP_ASYNC)
45022944501Smrg
45113d1d17dSmrg/*
45213d1d17dSmrg * Request a page flip on the specified crtc.
45313d1d17dSmrg *
45413d1d17dSmrg * This ioctl will ask KMS to schedule a page flip for the specified
45513d1d17dSmrg * crtc.  Once any pending rendering targeting the specified fb (as of
45613d1d17dSmrg * ioctl time) has completed, the crtc will be reprogrammed to display
45713d1d17dSmrg * that fb after the next vertical refresh.  The ioctl returns
45813d1d17dSmrg * immediately, but subsequent rendering to the current fb will block
45913d1d17dSmrg * in the execbuffer ioctl until the page flip happens.  If a page
46013d1d17dSmrg * flip is already pending as the ioctl is called, EBUSY will be
46113d1d17dSmrg * returned.
46213d1d17dSmrg *
46313d1d17dSmrg * The ioctl supports one flag, DRM_MODE_PAGE_FLIP_EVENT, which will
46413d1d17dSmrg * request that drm sends back a vblank event (see drm.h: struct
46513d1d17dSmrg * drm_event_vblank) when the page flip is done.  The user_data field
46613d1d17dSmrg * passed in with this ioctl will be returned as the user_data field
46713d1d17dSmrg * in the vblank event struct.
46813d1d17dSmrg *
46913d1d17dSmrg * The reserved field must be zero until we figure out something
47013d1d17dSmrg * clever to use it for.
47113d1d17dSmrg */
47213d1d17dSmrg
47322944501Smrgstruct drm_mode_crtc_page_flip {
47413d1d17dSmrg	__u32 crtc_id;
47513d1d17dSmrg	__u32 fb_id;
47613d1d17dSmrg	__u32 flags;
47713d1d17dSmrg	__u32 reserved;
47813d1d17dSmrg	__u64 user_data;
47922944501Smrg};
48022944501Smrg
481e88f27b3Smrg/* create a dumb scanout buffer */
482e88f27b3Smrgstruct drm_mode_create_dumb {
483e88f27b3Smrg        __u32 height;
484e88f27b3Smrg        __u32 width;
485e88f27b3Smrg        __u32 bpp;
486e88f27b3Smrg        __u32 flags;
487e88f27b3Smrg        /* handle, pitch, size will be returned */
488e88f27b3Smrg        __u32 handle;
489e88f27b3Smrg        __u32 pitch;
490e88f27b3Smrg        __u64 size;
491e88f27b3Smrg};
492e88f27b3Smrg
493e88f27b3Smrg/* set up for mmap of a dumb scanout buffer */
494e88f27b3Smrgstruct drm_mode_map_dumb {
495e88f27b3Smrg        /** Handle for the object being mapped. */
496e88f27b3Smrg        __u32 handle;
497e88f27b3Smrg        __u32 pad;
498e88f27b3Smrg        /**
499e88f27b3Smrg         * Fake offset to use for subsequent mmap call
500e88f27b3Smrg         *
501e88f27b3Smrg         * This is a fixed-size type for 32/64 compatibility.
502e88f27b3Smrg         */
503e88f27b3Smrg        __u64 offset;
504e88f27b3Smrg};
505e88f27b3Smrg
506e88f27b3Smrgstruct drm_mode_destroy_dumb {
507e88f27b3Smrg	__u32 handle;
508e88f27b3Smrg};
509e88f27b3Smrg
510e6188e58Smrg/* page-flip flags are valid, plus: */
511e6188e58Smrg#define DRM_MODE_ATOMIC_TEST_ONLY	0x0100
512e6188e58Smrg#define DRM_MODE_ATOMIC_NONBLOCK	0x0200
513e6188e58Smrg#define DRM_MODE_ATOMIC_ALLOW_MODESET	0x0400
514e6188e58Smrg
515e6188e58Smrgstruct drm_mode_atomic {
516e6188e58Smrg	__u32 flags;
517e6188e58Smrg	__u32 count_objs;
518e6188e58Smrg	__u64 objs_ptr;
519e6188e58Smrg	__u64 count_props_ptr;
520e6188e58Smrg	__u64 props_ptr;
521e6188e58Smrg	__u64 prop_values_ptr;
522e6188e58Smrg	__u64 reserved;
523e6188e58Smrg	__u64 user_data;
524e6188e58Smrg};
525e6188e58Smrg
526e6188e58Smrg/**
527e6188e58Smrg * Create a new 'blob' data property, copying length bytes from data pointer,
528e6188e58Smrg * and returning new blob ID.
529e6188e58Smrg */
530e6188e58Smrgstruct drm_mode_create_blob {
531e6188e58Smrg	/** Pointer to data to copy. */
532e6188e58Smrg	__u64 data;
533e6188e58Smrg	/** Length of data to copy. */
534e6188e58Smrg	__u32 length;
535e6188e58Smrg	/** Return: new property ID. */
536e6188e58Smrg	__u32 blob_id;
537e6188e58Smrg};
538e6188e58Smrg
539e6188e58Smrg/**
540e6188e58Smrg * Destroy a user-created blob property.
541e6188e58Smrg */
542e6188e58Smrgstruct drm_mode_destroy_blob {
543e6188e58Smrg	__u32 blob_id;
544e6188e58Smrg};
545e6188e58Smrg
546e6188e58Smrg
54722944501Smrg#endif
548