Home | History | Annotate | Line # | Download | only in drm
      1  1.1  riastrad /*	$NetBSD: drm_mode.h,v 1.2 2021/12/18 23:45:46 riastradh Exp $	*/
      2  1.1  riastrad 
      3  1.1  riastrad /*
      4  1.1  riastrad  * Copyright (c) 2007 Dave Airlie <airlied (at) linux.ie>
      5  1.1  riastrad  * Copyright (c) 2007 Jakob Bornecrantz <wallbraker (at) gmail.com>
      6  1.1  riastrad  * Copyright (c) 2008 Red Hat Inc.
      7  1.1  riastrad  * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA
      8  1.1  riastrad  * Copyright (c) 2007-2008 Intel Corporation
      9  1.1  riastrad  *
     10  1.1  riastrad  * Permission is hereby granted, free of charge, to any person obtaining a
     11  1.1  riastrad  * copy of this software and associated documentation files (the "Software"),
     12  1.1  riastrad  * to deal in the Software without restriction, including without limitation
     13  1.1  riastrad  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     14  1.1  riastrad  * and/or sell copies of the Software, and to permit persons to whom the
     15  1.1  riastrad  * Software is furnished to do so, subject to the following conditions:
     16  1.1  riastrad  *
     17  1.1  riastrad  * The above copyright notice and this permission notice shall be included in
     18  1.1  riastrad  * all copies or substantial portions of the Software.
     19  1.1  riastrad  *
     20  1.1  riastrad  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     21  1.1  riastrad  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     22  1.1  riastrad  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     23  1.1  riastrad  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     24  1.1  riastrad  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     25  1.1  riastrad  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
     26  1.1  riastrad  * IN THE SOFTWARE.
     27  1.1  riastrad  */
     28  1.1  riastrad 
     29  1.1  riastrad #ifndef _DRM_MODE_H
     30  1.1  riastrad #define _DRM_MODE_H
     31  1.1  riastrad 
     32  1.1  riastrad #include "drm.h"
     33  1.1  riastrad 
     34  1.1  riastrad #if defined(__cplusplus)
     35  1.1  riastrad extern "C" {
     36  1.1  riastrad #endif
     37  1.1  riastrad 
     38  1.1  riastrad /**
     39  1.1  riastrad  * DOC: overview
     40  1.1  riastrad  *
     41  1.1  riastrad  * DRM exposes many UAPI and structure definition to have a consistent
     42  1.1  riastrad  * and standardized interface with user.
     43  1.1  riastrad  * Userspace can refer to these structure definitions and UAPI formats
     44  1.1  riastrad  * to communicate to driver
     45  1.1  riastrad  */
     46  1.1  riastrad 
     47  1.1  riastrad #define DRM_CONNECTOR_NAME_LEN	32
     48  1.1  riastrad #define DRM_DISPLAY_MODE_LEN	32
     49  1.1  riastrad #define DRM_PROP_NAME_LEN	32
     50  1.1  riastrad 
     51  1.1  riastrad #define DRM_MODE_TYPE_BUILTIN	(1<<0) /* deprecated */
     52  1.1  riastrad #define DRM_MODE_TYPE_CLOCK_C	((1<<1) | DRM_MODE_TYPE_BUILTIN) /* deprecated */
     53  1.1  riastrad #define DRM_MODE_TYPE_CRTC_C	((1<<2) | DRM_MODE_TYPE_BUILTIN) /* deprecated */
     54  1.1  riastrad #define DRM_MODE_TYPE_PREFERRED	(1<<3)
     55  1.1  riastrad #define DRM_MODE_TYPE_DEFAULT	(1<<4) /* deprecated */
     56  1.1  riastrad #define DRM_MODE_TYPE_USERDEF	(1<<5)
     57  1.1  riastrad #define DRM_MODE_TYPE_DRIVER	(1<<6)
     58  1.1  riastrad 
     59  1.1  riastrad #define DRM_MODE_TYPE_ALL	(DRM_MODE_TYPE_PREFERRED |	\
     60  1.1  riastrad 				 DRM_MODE_TYPE_USERDEF |	\
     61  1.1  riastrad 				 DRM_MODE_TYPE_DRIVER)
     62  1.1  riastrad 
     63  1.1  riastrad /* Video mode flags */
     64  1.1  riastrad /* bit compatible with the xrandr RR_ definitions (bits 0-13)
     65  1.1  riastrad  *
     66  1.1  riastrad  * ABI warning: Existing userspace really expects
     67  1.1  riastrad  * the mode flags to match the xrandr definitions. Any
     68  1.1  riastrad  * changes that don't match the xrandr definitions will
     69  1.1  riastrad  * likely need a new client cap or some other mechanism
     70  1.1  riastrad  * to avoid breaking existing userspace. This includes
     71  1.1  riastrad  * allocating new flags in the previously unused bits!
     72  1.1  riastrad  */
     73  1.1  riastrad #define DRM_MODE_FLAG_PHSYNC			(1<<0)
     74  1.1  riastrad #define DRM_MODE_FLAG_NHSYNC			(1<<1)
     75  1.1  riastrad #define DRM_MODE_FLAG_PVSYNC			(1<<2)
     76  1.1  riastrad #define DRM_MODE_FLAG_NVSYNC			(1<<3)
     77  1.1  riastrad #define DRM_MODE_FLAG_INTERLACE			(1<<4)
     78  1.1  riastrad #define DRM_MODE_FLAG_DBLSCAN			(1<<5)
     79  1.1  riastrad #define DRM_MODE_FLAG_CSYNC			(1<<6)
     80  1.1  riastrad #define DRM_MODE_FLAG_PCSYNC			(1<<7)
     81  1.1  riastrad #define DRM_MODE_FLAG_NCSYNC			(1<<8)
     82  1.1  riastrad #define DRM_MODE_FLAG_HSKEW			(1<<9) /* hskew provided */
     83  1.1  riastrad #define DRM_MODE_FLAG_BCAST			(1<<10) /* deprecated */
     84  1.1  riastrad #define DRM_MODE_FLAG_PIXMUX			(1<<11) /* deprecated */
     85  1.1  riastrad #define DRM_MODE_FLAG_DBLCLK			(1<<12)
     86  1.1  riastrad #define DRM_MODE_FLAG_CLKDIV2			(1<<13)
     87  1.1  riastrad  /*
     88  1.1  riastrad   * When adding a new stereo mode don't forget to adjust DRM_MODE_FLAGS_3D_MAX
     89  1.1  riastrad   * (define not exposed to user space).
     90  1.1  riastrad   */
     91  1.1  riastrad #define DRM_MODE_FLAG_3D_MASK			(0x1f<<14)
     92  1.1  riastrad #define  DRM_MODE_FLAG_3D_NONE		(0<<14)
     93  1.1  riastrad #define  DRM_MODE_FLAG_3D_FRAME_PACKING		(1<<14)
     94  1.1  riastrad #define  DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE	(2<<14)
     95  1.1  riastrad #define  DRM_MODE_FLAG_3D_LINE_ALTERNATIVE	(3<<14)
     96  1.1  riastrad #define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL	(4<<14)
     97  1.1  riastrad #define  DRM_MODE_FLAG_3D_L_DEPTH		(5<<14)
     98  1.1  riastrad #define  DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH	(6<<14)
     99  1.1  riastrad #define  DRM_MODE_FLAG_3D_TOP_AND_BOTTOM	(7<<14)
    100  1.1  riastrad #define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF	(8<<14)
    101  1.1  riastrad 
    102  1.1  riastrad /* Picture aspect ratio options */
    103  1.1  riastrad #define DRM_MODE_PICTURE_ASPECT_NONE		0
    104  1.1  riastrad #define DRM_MODE_PICTURE_ASPECT_4_3		1
    105  1.1  riastrad #define DRM_MODE_PICTURE_ASPECT_16_9		2
    106  1.1  riastrad #define DRM_MODE_PICTURE_ASPECT_64_27		3
    107  1.1  riastrad #define DRM_MODE_PICTURE_ASPECT_256_135		4
    108  1.1  riastrad 
    109  1.1  riastrad /* Content type options */
    110  1.1  riastrad #define DRM_MODE_CONTENT_TYPE_NO_DATA		0
    111  1.1  riastrad #define DRM_MODE_CONTENT_TYPE_GRAPHICS		1
    112  1.1  riastrad #define DRM_MODE_CONTENT_TYPE_PHOTO		2
    113  1.1  riastrad #define DRM_MODE_CONTENT_TYPE_CINEMA		3
    114  1.1  riastrad #define DRM_MODE_CONTENT_TYPE_GAME		4
    115  1.1  riastrad 
    116  1.1  riastrad /* Aspect ratio flag bitmask (4 bits 22:19) */
    117  1.1  riastrad #define DRM_MODE_FLAG_PIC_AR_MASK		(0x0F<<19)
    118  1.1  riastrad #define  DRM_MODE_FLAG_PIC_AR_NONE \
    119  1.1  riastrad 			(DRM_MODE_PICTURE_ASPECT_NONE<<19)
    120  1.1  riastrad #define  DRM_MODE_FLAG_PIC_AR_4_3 \
    121  1.1  riastrad 			(DRM_MODE_PICTURE_ASPECT_4_3<<19)
    122  1.1  riastrad #define  DRM_MODE_FLAG_PIC_AR_16_9 \
    123  1.1  riastrad 			(DRM_MODE_PICTURE_ASPECT_16_9<<19)
    124  1.1  riastrad #define  DRM_MODE_FLAG_PIC_AR_64_27 \
    125  1.1  riastrad 			(DRM_MODE_PICTURE_ASPECT_64_27<<19)
    126  1.1  riastrad #define  DRM_MODE_FLAG_PIC_AR_256_135 \
    127  1.1  riastrad 			(DRM_MODE_PICTURE_ASPECT_256_135<<19)
    128  1.1  riastrad 
    129  1.1  riastrad #define  DRM_MODE_FLAG_ALL	(DRM_MODE_FLAG_PHSYNC |		\
    130  1.1  riastrad 				 DRM_MODE_FLAG_NHSYNC |		\
    131  1.1  riastrad 				 DRM_MODE_FLAG_PVSYNC |		\
    132  1.1  riastrad 				 DRM_MODE_FLAG_NVSYNC |		\
    133  1.1  riastrad 				 DRM_MODE_FLAG_INTERLACE |	\
    134  1.1  riastrad 				 DRM_MODE_FLAG_DBLSCAN |	\
    135  1.1  riastrad 				 DRM_MODE_FLAG_CSYNC |		\
    136  1.1  riastrad 				 DRM_MODE_FLAG_PCSYNC |		\
    137  1.1  riastrad 				 DRM_MODE_FLAG_NCSYNC |		\
    138  1.1  riastrad 				 DRM_MODE_FLAG_HSKEW |		\
    139  1.1  riastrad 				 DRM_MODE_FLAG_DBLCLK |		\
    140  1.1  riastrad 				 DRM_MODE_FLAG_CLKDIV2 |	\
    141  1.1  riastrad 				 DRM_MODE_FLAG_3D_MASK)
    142  1.1  riastrad 
    143  1.1  riastrad /* DPMS flags */
    144  1.1  riastrad /* bit compatible with the xorg definitions. */
    145  1.1  riastrad #define DRM_MODE_DPMS_ON	0
    146  1.1  riastrad #define DRM_MODE_DPMS_STANDBY	1
    147  1.1  riastrad #define DRM_MODE_DPMS_SUSPEND	2
    148  1.1  riastrad #define DRM_MODE_DPMS_OFF	3
    149  1.1  riastrad 
    150  1.1  riastrad /* Scaling mode options */
    151  1.1  riastrad #define DRM_MODE_SCALE_NONE		0 /* Unmodified timing (display or
    152  1.1  riastrad 					     software can still scale) */
    153  1.1  riastrad #define DRM_MODE_SCALE_FULLSCREEN	1 /* Full screen, ignore aspect */
    154  1.1  riastrad #define DRM_MODE_SCALE_CENTER		2 /* Centered, no scaling */
    155  1.1  riastrad #define DRM_MODE_SCALE_ASPECT		3 /* Full screen, preserve aspect */
    156  1.1  riastrad 
    157  1.1  riastrad /* Dithering mode options */
    158  1.1  riastrad #define DRM_MODE_DITHERING_OFF	0
    159  1.1  riastrad #define DRM_MODE_DITHERING_ON	1
    160  1.1  riastrad #define DRM_MODE_DITHERING_AUTO 2
    161  1.1  riastrad 
    162  1.1  riastrad /* Dirty info options */
    163  1.1  riastrad #define DRM_MODE_DIRTY_OFF      0
    164  1.1  riastrad #define DRM_MODE_DIRTY_ON       1
    165  1.1  riastrad #define DRM_MODE_DIRTY_ANNOTATE 2
    166  1.1  riastrad 
    167  1.1  riastrad /* Link Status options */
    168  1.1  riastrad #define DRM_MODE_LINK_STATUS_GOOD	0
    169  1.1  riastrad #define DRM_MODE_LINK_STATUS_BAD	1
    170  1.1  riastrad 
    171  1.1  riastrad /*
    172  1.1  riastrad  * DRM_MODE_ROTATE_<degrees>
    173  1.1  riastrad  *
    174  1.1  riastrad  * Signals that a drm plane is been rotated <degrees> degrees in counter
    175  1.1  riastrad  * clockwise direction.
    176  1.1  riastrad  *
    177  1.1  riastrad  * This define is provided as a convenience, looking up the property id
    178  1.1  riastrad  * using the name->prop id lookup is the preferred method.
    179  1.1  riastrad  */
    180  1.1  riastrad #define DRM_MODE_ROTATE_0       (1<<0)
    181  1.1  riastrad #define DRM_MODE_ROTATE_90      (1<<1)
    182  1.1  riastrad #define DRM_MODE_ROTATE_180     (1<<2)
    183  1.1  riastrad #define DRM_MODE_ROTATE_270     (1<<3)
    184  1.1  riastrad 
    185  1.1  riastrad /*
    186  1.1  riastrad  * DRM_MODE_ROTATE_MASK
    187  1.1  riastrad  *
    188  1.1  riastrad  * Bitmask used to look for drm plane rotations.
    189  1.1  riastrad  */
    190  1.1  riastrad #define DRM_MODE_ROTATE_MASK (\
    191  1.1  riastrad 		DRM_MODE_ROTATE_0  | \
    192  1.1  riastrad 		DRM_MODE_ROTATE_90  | \
    193  1.1  riastrad 		DRM_MODE_ROTATE_180 | \
    194  1.1  riastrad 		DRM_MODE_ROTATE_270)
    195  1.1  riastrad 
    196  1.1  riastrad /*
    197  1.1  riastrad  * DRM_MODE_REFLECT_<axis>
    198  1.1  riastrad  *
    199  1.1  riastrad  * Signals that the contents of a drm plane is reflected along the <axis> axis,
    200  1.1  riastrad  * in the same way as mirroring.
    201  1.1  riastrad  * See kerneldoc chapter "Plane Composition Properties" for more details.
    202  1.1  riastrad  *
    203  1.1  riastrad  * This define is provided as a convenience, looking up the property id
    204  1.1  riastrad  * using the name->prop id lookup is the preferred method.
    205  1.1  riastrad  */
    206  1.1  riastrad #define DRM_MODE_REFLECT_X      (1<<4)
    207  1.1  riastrad #define DRM_MODE_REFLECT_Y      (1<<5)
    208  1.1  riastrad 
    209  1.1  riastrad /*
    210  1.1  riastrad  * DRM_MODE_REFLECT_MASK
    211  1.1  riastrad  *
    212  1.1  riastrad  * Bitmask used to look for drm plane reflections.
    213  1.1  riastrad  */
    214  1.1  riastrad #define DRM_MODE_REFLECT_MASK (\
    215  1.1  riastrad 		DRM_MODE_REFLECT_X | \
    216  1.1  riastrad 		DRM_MODE_REFLECT_Y)
    217  1.1  riastrad 
    218  1.1  riastrad /* Content Protection Flags */
    219  1.1  riastrad #define DRM_MODE_CONTENT_PROTECTION_UNDESIRED	0
    220  1.1  riastrad #define DRM_MODE_CONTENT_PROTECTION_DESIRED     1
    221  1.1  riastrad #define DRM_MODE_CONTENT_PROTECTION_ENABLED     2
    222  1.1  riastrad 
    223  1.1  riastrad struct drm_mode_modeinfo {
    224  1.1  riastrad 	__u32 clock;
    225  1.1  riastrad 	__u16 hdisplay;
    226  1.1  riastrad 	__u16 hsync_start;
    227  1.1  riastrad 	__u16 hsync_end;
    228  1.1  riastrad 	__u16 htotal;
    229  1.1  riastrad 	__u16 hskew;
    230  1.1  riastrad 	__u16 vdisplay;
    231  1.1  riastrad 	__u16 vsync_start;
    232  1.1  riastrad 	__u16 vsync_end;
    233  1.1  riastrad 	__u16 vtotal;
    234  1.1  riastrad 	__u16 vscan;
    235  1.1  riastrad 
    236  1.1  riastrad 	__u32 vrefresh;
    237  1.1  riastrad 
    238  1.1  riastrad 	__u32 flags;
    239  1.1  riastrad 	__u32 type;
    240  1.1  riastrad 	char name[DRM_DISPLAY_MODE_LEN];
    241  1.1  riastrad };
    242  1.1  riastrad 
    243  1.1  riastrad struct drm_mode_card_res {
    244  1.1  riastrad 	__u64 fb_id_ptr;
    245  1.1  riastrad 	__u64 crtc_id_ptr;
    246  1.1  riastrad 	__u64 connector_id_ptr;
    247  1.1  riastrad 	__u64 encoder_id_ptr;
    248  1.1  riastrad 	__u32 count_fbs;
    249  1.1  riastrad 	__u32 count_crtcs;
    250  1.1  riastrad 	__u32 count_connectors;
    251  1.1  riastrad 	__u32 count_encoders;
    252  1.1  riastrad 	__u32 min_width;
    253  1.1  riastrad 	__u32 max_width;
    254  1.1  riastrad 	__u32 min_height;
    255  1.1  riastrad 	__u32 max_height;
    256  1.1  riastrad };
    257  1.1  riastrad 
    258  1.1  riastrad struct drm_mode_crtc {
    259  1.1  riastrad 	__u64 set_connectors_ptr;
    260  1.1  riastrad 	__u32 count_connectors;
    261  1.1  riastrad 
    262  1.1  riastrad 	__u32 crtc_id; /**< Id */
    263  1.1  riastrad 	__u32 fb_id; /**< Id of framebuffer */
    264  1.1  riastrad 
    265  1.1  riastrad 	__u32 x; /**< x Position on the framebuffer */
    266  1.1  riastrad 	__u32 y; /**< y Position on the framebuffer */
    267  1.1  riastrad 
    268  1.1  riastrad 	__u32 gamma_size;
    269  1.1  riastrad 	__u32 mode_valid;
    270  1.1  riastrad 	struct drm_mode_modeinfo mode;
    271  1.1  riastrad };
    272  1.1  riastrad 
    273  1.1  riastrad #define DRM_MODE_PRESENT_TOP_FIELD	(1<<0)
    274  1.1  riastrad #define DRM_MODE_PRESENT_BOTTOM_FIELD	(1<<1)
    275  1.1  riastrad 
    276  1.1  riastrad /* Planes blend with or override other bits on the CRTC */
    277  1.1  riastrad struct drm_mode_set_plane {
    278  1.1  riastrad 	__u32 plane_id;
    279  1.1  riastrad 	__u32 crtc_id;
    280  1.1  riastrad 	__u32 fb_id; /* fb object contains surface format type */
    281  1.1  riastrad 	__u32 flags; /* see above flags */
    282  1.1  riastrad 
    283  1.1  riastrad 	/* Signed dest location allows it to be partially off screen */
    284  1.1  riastrad 	__s32 crtc_x;
    285  1.1  riastrad 	__s32 crtc_y;
    286  1.1  riastrad 	__u32 crtc_w;
    287  1.1  riastrad 	__u32 crtc_h;
    288  1.1  riastrad 
    289  1.1  riastrad 	/* Source values are 16.16 fixed point */
    290  1.1  riastrad 	__u32 src_x;
    291  1.1  riastrad 	__u32 src_y;
    292  1.1  riastrad 	__u32 src_h;
    293  1.1  riastrad 	__u32 src_w;
    294  1.1  riastrad };
    295  1.1  riastrad 
    296  1.1  riastrad struct drm_mode_get_plane {
    297  1.1  riastrad 	__u32 plane_id;
    298  1.1  riastrad 
    299  1.1  riastrad 	__u32 crtc_id;
    300  1.1  riastrad 	__u32 fb_id;
    301  1.1  riastrad 
    302  1.1  riastrad 	__u32 possible_crtcs;
    303  1.1  riastrad 	__u32 gamma_size;
    304  1.1  riastrad 
    305  1.1  riastrad 	__u32 count_format_types;
    306  1.1  riastrad 	__u64 format_type_ptr;
    307  1.1  riastrad };
    308  1.1  riastrad 
    309  1.1  riastrad struct drm_mode_get_plane_res {
    310  1.1  riastrad 	__u64 plane_id_ptr;
    311  1.1  riastrad 	__u32 count_planes;
    312  1.1  riastrad };
    313  1.1  riastrad 
    314  1.1  riastrad #define DRM_MODE_ENCODER_NONE	0
    315  1.1  riastrad #define DRM_MODE_ENCODER_DAC	1
    316  1.1  riastrad #define DRM_MODE_ENCODER_TMDS	2
    317  1.1  riastrad #define DRM_MODE_ENCODER_LVDS	3
    318  1.1  riastrad #define DRM_MODE_ENCODER_TVDAC	4
    319  1.1  riastrad #define DRM_MODE_ENCODER_VIRTUAL 5
    320  1.1  riastrad #define DRM_MODE_ENCODER_DSI	6
    321  1.1  riastrad #define DRM_MODE_ENCODER_DPMST	7
    322  1.1  riastrad #define DRM_MODE_ENCODER_DPI	8
    323  1.1  riastrad 
    324  1.1  riastrad struct drm_mode_get_encoder {
    325  1.1  riastrad 	__u32 encoder_id;
    326  1.1  riastrad 	__u32 encoder_type;
    327  1.1  riastrad 
    328  1.1  riastrad 	__u32 crtc_id; /**< Id of crtc */
    329  1.1  riastrad 
    330  1.1  riastrad 	__u32 possible_crtcs;
    331  1.1  riastrad 	__u32 possible_clones;
    332  1.1  riastrad };
    333  1.1  riastrad 
    334  1.1  riastrad /* This is for connectors with multiple signal types. */
    335  1.1  riastrad /* Try to match DRM_MODE_CONNECTOR_X as closely as possible. */
    336  1.1  riastrad enum drm_mode_subconnector {
    337  1.1  riastrad 	DRM_MODE_SUBCONNECTOR_Automatic = 0,
    338  1.1  riastrad 	DRM_MODE_SUBCONNECTOR_Unknown = 0,
    339  1.1  riastrad 	DRM_MODE_SUBCONNECTOR_DVID = 3,
    340  1.1  riastrad 	DRM_MODE_SUBCONNECTOR_DVIA = 4,
    341  1.1  riastrad 	DRM_MODE_SUBCONNECTOR_Composite = 5,
    342  1.1  riastrad 	DRM_MODE_SUBCONNECTOR_SVIDEO = 6,
    343  1.1  riastrad 	DRM_MODE_SUBCONNECTOR_Component = 8,
    344  1.1  riastrad 	DRM_MODE_SUBCONNECTOR_SCART = 9,
    345  1.1  riastrad };
    346  1.1  riastrad 
    347  1.1  riastrad #define DRM_MODE_CONNECTOR_Unknown	0
    348  1.1  riastrad #define DRM_MODE_CONNECTOR_VGA		1
    349  1.1  riastrad #define DRM_MODE_CONNECTOR_DVII		2
    350  1.1  riastrad #define DRM_MODE_CONNECTOR_DVID		3
    351  1.1  riastrad #define DRM_MODE_CONNECTOR_DVIA		4
    352  1.1  riastrad #define DRM_MODE_CONNECTOR_Composite	5
    353  1.1  riastrad #define DRM_MODE_CONNECTOR_SVIDEO	6
    354  1.1  riastrad #define DRM_MODE_CONNECTOR_LVDS		7
    355  1.1  riastrad #define DRM_MODE_CONNECTOR_Component	8
    356  1.1  riastrad #define DRM_MODE_CONNECTOR_9PinDIN	9
    357  1.1  riastrad #define DRM_MODE_CONNECTOR_DisplayPort	10
    358  1.1  riastrad #define DRM_MODE_CONNECTOR_HDMIA	11
    359  1.1  riastrad #define DRM_MODE_CONNECTOR_HDMIB	12
    360  1.1  riastrad #define DRM_MODE_CONNECTOR_TV		13
    361  1.1  riastrad #define DRM_MODE_CONNECTOR_eDP		14
    362  1.1  riastrad #define DRM_MODE_CONNECTOR_VIRTUAL      15
    363  1.1  riastrad #define DRM_MODE_CONNECTOR_DSI		16
    364  1.1  riastrad #define DRM_MODE_CONNECTOR_DPI		17
    365  1.1  riastrad #define DRM_MODE_CONNECTOR_WRITEBACK	18
    366  1.1  riastrad #define DRM_MODE_CONNECTOR_SPI		19
    367  1.1  riastrad 
    368  1.1  riastrad struct drm_mode_get_connector {
    369  1.1  riastrad 
    370  1.1  riastrad 	__u64 encoders_ptr;
    371  1.1  riastrad 	__u64 modes_ptr;
    372  1.1  riastrad 	__u64 props_ptr;
    373  1.1  riastrad 	__u64 prop_values_ptr;
    374  1.1  riastrad 
    375  1.1  riastrad 	__u32 count_modes;
    376  1.1  riastrad 	__u32 count_props;
    377  1.1  riastrad 	__u32 count_encoders;
    378  1.1  riastrad 
    379  1.1  riastrad 	__u32 encoder_id; /**< Current Encoder */
    380  1.1  riastrad 	__u32 connector_id; /**< Id */
    381  1.1  riastrad 	__u32 connector_type;
    382  1.1  riastrad 	__u32 connector_type_id;
    383  1.1  riastrad 
    384  1.1  riastrad 	__u32 connection;
    385  1.1  riastrad 	__u32 mm_width;  /**< width in millimeters */
    386  1.1  riastrad 	__u32 mm_height; /**< height in millimeters */
    387  1.1  riastrad 	__u32 subpixel;
    388  1.1  riastrad 
    389  1.1  riastrad 	__u32 pad;
    390  1.1  riastrad };
    391  1.1  riastrad 
    392  1.1  riastrad #define DRM_MODE_PROP_PENDING	(1<<0) /* deprecated, do not use */
    393  1.1  riastrad #define DRM_MODE_PROP_RANGE	(1<<1)
    394  1.1  riastrad #define DRM_MODE_PROP_IMMUTABLE	(1<<2)
    395  1.1  riastrad #define DRM_MODE_PROP_ENUM	(1<<3) /* enumerated type with text strings */
    396  1.1  riastrad #define DRM_MODE_PROP_BLOB	(1<<4)
    397  1.1  riastrad #define DRM_MODE_PROP_BITMASK	(1<<5) /* bitmask of enumerated types */
    398  1.1  riastrad 
    399  1.1  riastrad /* non-extended types: legacy bitmask, one bit per type: */
    400  1.1  riastrad #define DRM_MODE_PROP_LEGACY_TYPE  ( \
    401  1.1  riastrad 		DRM_MODE_PROP_RANGE | \
    402  1.1  riastrad 		DRM_MODE_PROP_ENUM | \
    403  1.1  riastrad 		DRM_MODE_PROP_BLOB | \
    404  1.1  riastrad 		DRM_MODE_PROP_BITMASK)
    405  1.1  riastrad 
    406  1.1  riastrad /* extended-types: rather than continue to consume a bit per type,
    407  1.1  riastrad  * grab a chunk of the bits to use as integer type id.
    408  1.1  riastrad  */
    409  1.1  riastrad #define DRM_MODE_PROP_EXTENDED_TYPE	0x0000ffc0
    410  1.1  riastrad #define DRM_MODE_PROP_TYPE(n)		((n) << 6)
    411  1.1  riastrad #define DRM_MODE_PROP_OBJECT		DRM_MODE_PROP_TYPE(1)
    412  1.1  riastrad #define DRM_MODE_PROP_SIGNED_RANGE	DRM_MODE_PROP_TYPE(2)
    413  1.1  riastrad 
    414  1.1  riastrad /* the PROP_ATOMIC flag is used to hide properties from userspace that
    415  1.1  riastrad  * is not aware of atomic properties.  This is mostly to work around
    416  1.1  riastrad  * older userspace (DDX drivers) that read/write each prop they find,
    417  1.1  riastrad  * witout being aware that this could be triggering a lengthy modeset.
    418  1.1  riastrad  */
    419  1.1  riastrad #define DRM_MODE_PROP_ATOMIC        0x80000000
    420  1.1  riastrad 
    421  1.1  riastrad struct drm_mode_property_enum {
    422  1.1  riastrad 	__u64 value;
    423  1.1  riastrad 	char name[DRM_PROP_NAME_LEN];
    424  1.1  riastrad };
    425  1.1  riastrad 
    426  1.1  riastrad struct drm_mode_get_property {
    427  1.1  riastrad 	__u64 values_ptr; /* values and blob lengths */
    428  1.1  riastrad 	__u64 enum_blob_ptr; /* enum and blob id ptrs */
    429  1.1  riastrad 
    430  1.1  riastrad 	__u32 prop_id;
    431  1.1  riastrad 	__u32 flags;
    432  1.1  riastrad 	char name[DRM_PROP_NAME_LEN];
    433  1.1  riastrad 
    434  1.1  riastrad 	__u32 count_values;
    435  1.1  riastrad 	/* This is only used to count enum values, not blobs. The _blobs is
    436  1.1  riastrad 	 * simply because of a historical reason, i.e. backwards compat. */
    437  1.1  riastrad 	__u32 count_enum_blobs;
    438  1.1  riastrad };
    439  1.1  riastrad 
    440  1.1  riastrad struct drm_mode_connector_set_property {
    441  1.1  riastrad 	__u64 value;
    442  1.1  riastrad 	__u32 prop_id;
    443  1.1  riastrad 	__u32 connector_id;
    444  1.1  riastrad };
    445  1.1  riastrad 
    446  1.1  riastrad #define DRM_MODE_OBJECT_CRTC 0xcccccccc
    447  1.1  riastrad #define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
    448  1.1  riastrad #define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0
    449  1.1  riastrad #define DRM_MODE_OBJECT_MODE 0xdededede
    450  1.1  riastrad #define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
    451  1.1  riastrad #define DRM_MODE_OBJECT_FB 0xfbfbfbfb
    452  1.1  riastrad #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
    453  1.1  riastrad #define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
    454  1.1  riastrad #define DRM_MODE_OBJECT_ANY 0
    455  1.1  riastrad 
    456  1.1  riastrad struct drm_mode_obj_get_properties {
    457  1.1  riastrad 	__u64 props_ptr;
    458  1.1  riastrad 	__u64 prop_values_ptr;
    459  1.1  riastrad 	__u32 count_props;
    460  1.1  riastrad 	__u32 obj_id;
    461  1.1  riastrad 	__u32 obj_type;
    462  1.1  riastrad };
    463  1.1  riastrad 
    464  1.1  riastrad struct drm_mode_obj_set_property {
    465  1.1  riastrad 	__u64 value;
    466  1.1  riastrad 	__u32 prop_id;
    467  1.1  riastrad 	__u32 obj_id;
    468  1.1  riastrad 	__u32 obj_type;
    469  1.1  riastrad };
    470  1.1  riastrad 
    471  1.1  riastrad struct drm_mode_get_blob {
    472  1.1  riastrad 	__u32 blob_id;
    473  1.1  riastrad 	__u32 length;
    474  1.1  riastrad 	__u64 data;
    475  1.1  riastrad };
    476  1.1  riastrad 
    477  1.1  riastrad struct drm_mode_fb_cmd {
    478  1.1  riastrad 	__u32 fb_id;
    479  1.1  riastrad 	__u32 width;
    480  1.1  riastrad 	__u32 height;
    481  1.1  riastrad 	__u32 pitch;
    482  1.1  riastrad 	__u32 bpp;
    483  1.1  riastrad 	__u32 depth;
    484  1.1  riastrad 	/* driver specific handle */
    485  1.1  riastrad 	__u32 handle;
    486  1.1  riastrad };
    487  1.1  riastrad 
    488  1.1  riastrad #define DRM_MODE_FB_INTERLACED	(1<<0) /* for interlaced framebuffers */
    489  1.1  riastrad #define DRM_MODE_FB_MODIFIERS	(1<<1) /* enables ->modifer[] */
    490  1.1  riastrad 
    491  1.1  riastrad struct drm_mode_fb_cmd2 {
    492  1.1  riastrad 	__u32 fb_id;
    493  1.1  riastrad 	__u32 width;
    494  1.1  riastrad 	__u32 height;
    495  1.1  riastrad 	__u32 pixel_format; /* fourcc code from drm_fourcc.h */
    496  1.1  riastrad 	__u32 flags; /* see above flags */
    497  1.1  riastrad 
    498  1.1  riastrad 	/*
    499  1.1  riastrad 	 * In case of planar formats, this ioctl allows up to 4
    500  1.1  riastrad 	 * buffer objects with offsets and pitches per plane.
    501  1.1  riastrad 	 * The pitch and offset order is dictated by the fourcc,
    502  1.1  riastrad 	 * e.g. NV12 (http://fourcc.org/yuv.php#NV12) is described as:
    503  1.1  riastrad 	 *
    504  1.1  riastrad 	 *   YUV 4:2:0 image with a plane of 8 bit Y samples
    505  1.1  riastrad 	 *   followed by an interleaved U/V plane containing
    506  1.1  riastrad 	 *   8 bit 2x2 subsampled colour difference samples.
    507  1.1  riastrad 	 *
    508  1.1  riastrad 	 * So it would consist of Y as offsets[0] and UV as
    509  1.1  riastrad 	 * offsets[1].  Note that offsets[0] will generally
    510  1.1  riastrad 	 * be 0 (but this is not required).
    511  1.1  riastrad 	 *
    512  1.1  riastrad 	 * To accommodate tiled, compressed, etc formats, a
    513  1.1  riastrad 	 * modifier can be specified.  The default value of zero
    514  1.1  riastrad 	 * indicates "native" format as specified by the fourcc.
    515  1.1  riastrad 	 * Vendor specific modifier token.  Note that even though
    516  1.1  riastrad 	 * it looks like we have a modifier per-plane, we in fact
    517  1.1  riastrad 	 * do not. The modifier for each plane must be identical.
    518  1.1  riastrad 	 * Thus all combinations of different data layouts for
    519  1.1  riastrad 	 * multi plane formats must be enumerated as separate
    520  1.1  riastrad 	 * modifiers.
    521  1.1  riastrad 	 */
    522  1.1  riastrad 	__u32 handles[4];
    523  1.1  riastrad 	__u32 pitches[4]; /* pitch for each plane */
    524  1.1  riastrad 	__u32 offsets[4]; /* offset of each plane */
    525  1.1  riastrad 	__u64 modifier[4]; /* ie, tiling, compress */
    526  1.1  riastrad };
    527  1.1  riastrad 
    528  1.1  riastrad #define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01
    529  1.1  riastrad #define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02
    530  1.1  riastrad #define DRM_MODE_FB_DIRTY_FLAGS         0x03
    531  1.1  riastrad 
    532  1.1  riastrad #define DRM_MODE_FB_DIRTY_MAX_CLIPS     256
    533  1.1  riastrad 
    534  1.1  riastrad /*
    535  1.1  riastrad  * Mark a region of a framebuffer as dirty.
    536  1.1  riastrad  *
    537  1.1  riastrad  * Some hardware does not automatically update display contents
    538  1.1  riastrad  * as a hardware or software draw to a framebuffer. This ioctl
    539  1.1  riastrad  * allows userspace to tell the kernel and the hardware what
    540  1.1  riastrad  * regions of the framebuffer have changed.
    541  1.1  riastrad  *
    542  1.2  riastrad  * The kernel or hardware is free to update more than just the
    543  1.1  riastrad  * region specified by the clip rects. The kernel or hardware
    544  1.1  riastrad  * may also delay and/or coalesce several calls to dirty into a
    545  1.1  riastrad  * single update.
    546  1.1  riastrad  *
    547  1.1  riastrad  * Userspace may annotate the updates, the annotates are a
    548  1.1  riastrad  * promise made by the caller that the change is either a copy
    549  1.1  riastrad  * of pixels or a fill of a single color in the region specified.
    550  1.1  riastrad  *
    551  1.1  riastrad  * If the DRM_MODE_FB_DIRTY_ANNOTATE_COPY flag is given then
    552  1.1  riastrad  * the number of updated regions are half of num_clips given,
    553  1.1  riastrad  * where the clip rects are paired in src and dst. The width and
    554  1.1  riastrad  * height of each one of the pairs must match.
    555  1.1  riastrad  *
    556  1.1  riastrad  * If the DRM_MODE_FB_DIRTY_ANNOTATE_FILL flag is given the caller
    557  1.1  riastrad  * promises that the region specified of the clip rects is filled
    558  1.1  riastrad  * completely with a single color as given in the color argument.
    559  1.1  riastrad  */
    560  1.1  riastrad 
    561  1.1  riastrad struct drm_mode_fb_dirty_cmd {
    562  1.1  riastrad 	__u32 fb_id;
    563  1.1  riastrad 	__u32 flags;
    564  1.1  riastrad 	__u32 color;
    565  1.1  riastrad 	__u32 num_clips;
    566  1.1  riastrad 	__u64 clips_ptr;
    567  1.1  riastrad };
    568  1.1  riastrad 
    569  1.1  riastrad struct drm_mode_mode_cmd {
    570  1.1  riastrad 	__u32 connector_id;
    571  1.1  riastrad 	struct drm_mode_modeinfo mode;
    572  1.1  riastrad };
    573  1.1  riastrad 
    574  1.1  riastrad #define DRM_MODE_CURSOR_BO	0x01
    575  1.1  riastrad #define DRM_MODE_CURSOR_MOVE	0x02
    576  1.1  riastrad #define DRM_MODE_CURSOR_FLAGS	0x03
    577  1.1  riastrad 
    578  1.1  riastrad /*
    579  1.1  riastrad  * depending on the value in flags different members are used.
    580  1.1  riastrad  *
    581  1.1  riastrad  * CURSOR_BO uses
    582  1.1  riastrad  *    crtc_id
    583  1.1  riastrad  *    width
    584  1.1  riastrad  *    height
    585  1.1  riastrad  *    handle - if 0 turns the cursor off
    586  1.1  riastrad  *
    587  1.1  riastrad  * CURSOR_MOVE uses
    588  1.1  riastrad  *    crtc_id
    589  1.1  riastrad  *    x
    590  1.1  riastrad  *    y
    591  1.1  riastrad  */
    592  1.1  riastrad struct drm_mode_cursor {
    593  1.1  riastrad 	__u32 flags;
    594  1.1  riastrad 	__u32 crtc_id;
    595  1.1  riastrad 	__s32 x;
    596  1.1  riastrad 	__s32 y;
    597  1.1  riastrad 	__u32 width;
    598  1.1  riastrad 	__u32 height;
    599  1.1  riastrad 	/* driver specific handle */
    600  1.1  riastrad 	__u32 handle;
    601  1.1  riastrad };
    602  1.1  riastrad 
    603  1.1  riastrad struct drm_mode_cursor2 {
    604  1.1  riastrad 	__u32 flags;
    605  1.1  riastrad 	__u32 crtc_id;
    606  1.1  riastrad 	__s32 x;
    607  1.1  riastrad 	__s32 y;
    608  1.1  riastrad 	__u32 width;
    609  1.1  riastrad 	__u32 height;
    610  1.1  riastrad 	/* driver specific handle */
    611  1.1  riastrad 	__u32 handle;
    612  1.1  riastrad 	__s32 hot_x;
    613  1.1  riastrad 	__s32 hot_y;
    614  1.1  riastrad };
    615  1.1  riastrad 
    616  1.1  riastrad struct drm_mode_crtc_lut {
    617  1.1  riastrad 	__u32 crtc_id;
    618  1.1  riastrad 	__u32 gamma_size;
    619  1.1  riastrad 
    620  1.1  riastrad 	/* pointers to arrays */
    621  1.1  riastrad 	__u64 red;
    622  1.1  riastrad 	__u64 green;
    623  1.1  riastrad 	__u64 blue;
    624  1.1  riastrad };
    625  1.1  riastrad 
    626  1.1  riastrad struct drm_color_ctm {
    627  1.1  riastrad 	/*
    628  1.1  riastrad 	 * Conversion matrix in S31.32 sign-magnitude
    629  1.1  riastrad 	 * (not two's complement!) format.
    630  1.1  riastrad 	 */
    631  1.1  riastrad 	__u64 matrix[9];
    632  1.1  riastrad };
    633  1.1  riastrad 
    634  1.1  riastrad struct drm_color_lut {
    635  1.1  riastrad 	/*
    636  1.1  riastrad 	 * Values are mapped linearly to 0.0 - 1.0 range, with 0x0 == 0.0 and
    637  1.1  riastrad 	 * 0xffff == 1.0.
    638  1.1  riastrad 	 */
    639  1.1  riastrad 	__u16 red;
    640  1.1  riastrad 	__u16 green;
    641  1.1  riastrad 	__u16 blue;
    642  1.1  riastrad 	__u16 reserved;
    643  1.1  riastrad };
    644  1.1  riastrad 
    645  1.1  riastrad /**
    646  1.1  riastrad  * struct hdr_metadata_infoframe - HDR Metadata Infoframe Data.
    647  1.1  riastrad  *
    648  1.1  riastrad  * HDR Metadata Infoframe as per CTA 861.G spec. This is expected
    649  1.1  riastrad  * to match exactly with the spec.
    650  1.1  riastrad  *
    651  1.1  riastrad  * Userspace is expected to pass the metadata information as per
    652  1.1  riastrad  * the format described in this structure.
    653  1.1  riastrad  */
    654  1.1  riastrad struct hdr_metadata_infoframe {
    655  1.1  riastrad 	/**
    656  1.1  riastrad 	 * @eotf: Electro-Optical Transfer Function (EOTF)
    657  1.1  riastrad 	 * used in the stream.
    658  1.1  riastrad 	 */
    659  1.1  riastrad 	__u8 eotf;
    660  1.1  riastrad 	/**
    661  1.1  riastrad 	 * @metadata_type: Static_Metadata_Descriptor_ID.
    662  1.1  riastrad 	 */
    663  1.1  riastrad 	__u8 metadata_type;
    664  1.1  riastrad 	/**
    665  1.1  riastrad 	 * @display_primaries: Color Primaries of the Data.
    666  1.1  riastrad 	 * These are coded as unsigned 16-bit values in units of
    667  1.1  riastrad 	 * 0.00002, where 0x0000 represents zero and 0xC350
    668  1.1  riastrad 	 * represents 1.0000.
    669  1.1  riastrad 	 * @display_primaries.x: X cordinate of color primary.
    670  1.1  riastrad 	 * @display_primaries.y: Y cordinate of color primary.
    671  1.1  riastrad 	 */
    672  1.1  riastrad 	struct {
    673  1.1  riastrad 		__u16 x, y;
    674  1.1  riastrad 		} display_primaries[3];
    675  1.1  riastrad 	/**
    676  1.1  riastrad 	 * @white_point: White Point of Colorspace Data.
    677  1.1  riastrad 	 * These are coded as unsigned 16-bit values in units of
    678  1.1  riastrad 	 * 0.00002, where 0x0000 represents zero and 0xC350
    679  1.1  riastrad 	 * represents 1.0000.
    680  1.1  riastrad 	 * @white_point.x: X cordinate of whitepoint of color primary.
    681  1.1  riastrad 	 * @white_point.y: Y cordinate of whitepoint of color primary.
    682  1.1  riastrad 	 */
    683  1.1  riastrad 	struct {
    684  1.1  riastrad 		__u16 x, y;
    685  1.1  riastrad 		} white_point;
    686  1.1  riastrad 	/**
    687  1.1  riastrad 	 * @max_display_mastering_luminance: Max Mastering Display Luminance.
    688  1.1  riastrad 	 * This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
    689  1.1  riastrad 	 * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
    690  1.1  riastrad 	 */
    691  1.1  riastrad 	__u16 max_display_mastering_luminance;
    692  1.1  riastrad 	/**
    693  1.1  riastrad 	 * @min_display_mastering_luminance: Min Mastering Display Luminance.
    694  1.1  riastrad 	 * This value is coded as an unsigned 16-bit value in units of
    695  1.1  riastrad 	 * 0.0001 cd/m2, where 0x0001 represents 0.0001 cd/m2 and 0xFFFF
    696  1.1  riastrad 	 * represents 6.5535 cd/m2.
    697  1.1  riastrad 	 */
    698  1.1  riastrad 	__u16 min_display_mastering_luminance;
    699  1.1  riastrad 	/**
    700  1.1  riastrad 	 * @max_cll: Max Content Light Level.
    701  1.1  riastrad 	 * This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
    702  1.1  riastrad 	 * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
    703  1.1  riastrad 	 */
    704  1.1  riastrad 	__u16 max_cll;
    705  1.1  riastrad 	/**
    706  1.1  riastrad 	 * @max_fall: Max Frame Average Light Level.
    707  1.1  riastrad 	 * This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
    708  1.1  riastrad 	 * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
    709  1.1  riastrad 	 */
    710  1.1  riastrad 	__u16 max_fall;
    711  1.1  riastrad };
    712  1.1  riastrad 
    713  1.1  riastrad /**
    714  1.1  riastrad  * struct hdr_output_metadata - HDR output metadata
    715  1.1  riastrad  *
    716  1.1  riastrad  * Metadata Information to be passed from userspace
    717  1.1  riastrad  */
    718  1.1  riastrad struct hdr_output_metadata {
    719  1.1  riastrad 	/**
    720  1.1  riastrad 	 * @metadata_type: Static_Metadata_Descriptor_ID.
    721  1.1  riastrad 	 */
    722  1.1  riastrad 	__u32 metadata_type;
    723  1.1  riastrad 	/**
    724  1.1  riastrad 	 * @hdmi_metadata_type1: HDR Metadata Infoframe.
    725  1.1  riastrad 	 */
    726  1.1  riastrad 	union {
    727  1.1  riastrad 		struct hdr_metadata_infoframe hdmi_metadata_type1;
    728  1.1  riastrad 	};
    729  1.1  riastrad };
    730  1.1  riastrad 
    731  1.1  riastrad #define DRM_MODE_PAGE_FLIP_EVENT 0x01
    732  1.1  riastrad #define DRM_MODE_PAGE_FLIP_ASYNC 0x02
    733  1.1  riastrad #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
    734  1.1  riastrad #define DRM_MODE_PAGE_FLIP_TARGET_RELATIVE 0x8
    735  1.1  riastrad #define DRM_MODE_PAGE_FLIP_TARGET (DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE | \
    736  1.1  riastrad 				   DRM_MODE_PAGE_FLIP_TARGET_RELATIVE)
    737  1.1  riastrad #define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT | \
    738  1.1  riastrad 				  DRM_MODE_PAGE_FLIP_ASYNC | \
    739  1.1  riastrad 				  DRM_MODE_PAGE_FLIP_TARGET)
    740  1.1  riastrad 
    741  1.1  riastrad /*
    742  1.1  riastrad  * Request a page flip on the specified crtc.
    743  1.1  riastrad  *
    744  1.1  riastrad  * This ioctl will ask KMS to schedule a page flip for the specified
    745  1.1  riastrad  * crtc.  Once any pending rendering targeting the specified fb (as of
    746  1.1  riastrad  * ioctl time) has completed, the crtc will be reprogrammed to display
    747  1.1  riastrad  * that fb after the next vertical refresh.  The ioctl returns
    748  1.1  riastrad  * immediately, but subsequent rendering to the current fb will block
    749  1.1  riastrad  * in the execbuffer ioctl until the page flip happens.  If a page
    750  1.1  riastrad  * flip is already pending as the ioctl is called, EBUSY will be
    751  1.1  riastrad  * returned.
    752  1.1  riastrad  *
    753  1.1  riastrad  * Flag DRM_MODE_PAGE_FLIP_EVENT requests that drm sends back a vblank
    754  1.1  riastrad  * event (see drm.h: struct drm_event_vblank) when the page flip is
    755  1.1  riastrad  * done.  The user_data field passed in with this ioctl will be
    756  1.1  riastrad  * returned as the user_data field in the vblank event struct.
    757  1.1  riastrad  *
    758  1.1  riastrad  * Flag DRM_MODE_PAGE_FLIP_ASYNC requests that the flip happen
    759  1.1  riastrad  * 'as soon as possible', meaning that it not delay waiting for vblank.
    760  1.1  riastrad  * This may cause tearing on the screen.
    761  1.1  riastrad  *
    762  1.1  riastrad  * The reserved field must be zero.
    763  1.1  riastrad  */
    764  1.1  riastrad 
    765  1.1  riastrad struct drm_mode_crtc_page_flip {
    766  1.1  riastrad 	__u32 crtc_id;
    767  1.1  riastrad 	__u32 fb_id;
    768  1.1  riastrad 	__u32 flags;
    769  1.1  riastrad 	__u32 reserved;
    770  1.1  riastrad 	__u64 user_data;
    771  1.1  riastrad };
    772  1.1  riastrad 
    773  1.1  riastrad /*
    774  1.1  riastrad  * Request a page flip on the specified crtc.
    775  1.1  riastrad  *
    776  1.1  riastrad  * Same as struct drm_mode_crtc_page_flip, but supports new flags and
    777  1.1  riastrad  * re-purposes the reserved field:
    778  1.1  riastrad  *
    779  1.1  riastrad  * The sequence field must be zero unless either of the
    780  1.1  riastrad  * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is specified. When
    781  1.1  riastrad  * the ABSOLUTE flag is specified, the sequence field denotes the absolute
    782  1.1  riastrad  * vblank sequence when the flip should take effect. When the RELATIVE
    783  1.1  riastrad  * flag is specified, the sequence field denotes the relative (to the
    784  1.1  riastrad  * current one when the ioctl is called) vblank sequence when the flip
    785  1.1  riastrad  * should take effect. NOTE: DRM_IOCTL_WAIT_VBLANK must still be used to
    786  1.1  riastrad  * make sure the vblank sequence before the target one has passed before
    787  1.1  riastrad  * calling this ioctl. The purpose of the
    788  1.1  riastrad  * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is merely to clarify
    789  1.1  riastrad  * the target for when code dealing with a page flip runs during a
    790  1.1  riastrad  * vertical blank period.
    791  1.1  riastrad  */
    792  1.1  riastrad 
    793  1.1  riastrad struct drm_mode_crtc_page_flip_target {
    794  1.1  riastrad 	__u32 crtc_id;
    795  1.1  riastrad 	__u32 fb_id;
    796  1.1  riastrad 	__u32 flags;
    797  1.1  riastrad 	__u32 sequence;
    798  1.1  riastrad 	__u64 user_data;
    799  1.1  riastrad };
    800  1.1  riastrad 
    801  1.1  riastrad /* create a dumb scanout buffer */
    802  1.1  riastrad struct drm_mode_create_dumb {
    803  1.1  riastrad 	__u32 height;
    804  1.1  riastrad 	__u32 width;
    805  1.1  riastrad 	__u32 bpp;
    806  1.1  riastrad 	__u32 flags;
    807  1.1  riastrad 	/* handle, pitch, size will be returned */
    808  1.1  riastrad 	__u32 handle;
    809  1.1  riastrad 	__u32 pitch;
    810  1.1  riastrad 	__u64 size;
    811  1.1  riastrad };
    812  1.1  riastrad 
    813  1.1  riastrad /* set up for mmap of a dumb scanout buffer */
    814  1.1  riastrad struct drm_mode_map_dumb {
    815  1.1  riastrad 	/** Handle for the object being mapped. */
    816  1.1  riastrad 	__u32 handle;
    817  1.1  riastrad 	__u32 pad;
    818  1.1  riastrad 	/**
    819  1.1  riastrad 	 * Fake offset to use for subsequent mmap call
    820  1.1  riastrad 	 *
    821  1.1  riastrad 	 * This is a fixed-size type for 32/64 compatibility.
    822  1.1  riastrad 	 */
    823  1.1  riastrad 	__u64 offset;
    824  1.1  riastrad };
    825  1.1  riastrad 
    826  1.1  riastrad struct drm_mode_destroy_dumb {
    827  1.1  riastrad 	__u32 handle;
    828  1.1  riastrad };
    829  1.1  riastrad 
    830  1.1  riastrad /* page-flip flags are valid, plus: */
    831  1.1  riastrad #define DRM_MODE_ATOMIC_TEST_ONLY 0x0100
    832  1.1  riastrad #define DRM_MODE_ATOMIC_NONBLOCK  0x0200
    833  1.1  riastrad #define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400
    834  1.1  riastrad 
    835  1.1  riastrad #define DRM_MODE_ATOMIC_FLAGS (\
    836  1.1  riastrad 		DRM_MODE_PAGE_FLIP_EVENT |\
    837  1.1  riastrad 		DRM_MODE_PAGE_FLIP_ASYNC |\
    838  1.1  riastrad 		DRM_MODE_ATOMIC_TEST_ONLY |\
    839  1.1  riastrad 		DRM_MODE_ATOMIC_NONBLOCK |\
    840  1.1  riastrad 		DRM_MODE_ATOMIC_ALLOW_MODESET)
    841  1.1  riastrad 
    842  1.1  riastrad struct drm_mode_atomic {
    843  1.1  riastrad 	__u32 flags;
    844  1.1  riastrad 	__u32 count_objs;
    845  1.1  riastrad 	__u64 objs_ptr;
    846  1.1  riastrad 	__u64 count_props_ptr;
    847  1.1  riastrad 	__u64 props_ptr;
    848  1.1  riastrad 	__u64 prop_values_ptr;
    849  1.1  riastrad 	__u64 reserved;
    850  1.1  riastrad 	__u64 user_data;
    851  1.1  riastrad };
    852  1.1  riastrad 
    853  1.1  riastrad struct drm_format_modifier_blob {
    854  1.1  riastrad #define FORMAT_BLOB_CURRENT 1
    855  1.1  riastrad 	/* Version of this blob format */
    856  1.1  riastrad 	__u32 version;
    857  1.1  riastrad 
    858  1.1  riastrad 	/* Flags */
    859  1.1  riastrad 	__u32 flags;
    860  1.1  riastrad 
    861  1.1  riastrad 	/* Number of fourcc formats supported */
    862  1.1  riastrad 	__u32 count_formats;
    863  1.1  riastrad 
    864  1.1  riastrad 	/* Where in this blob the formats exist (in bytes) */
    865  1.1  riastrad 	__u32 formats_offset;
    866  1.1  riastrad 
    867  1.1  riastrad 	/* Number of drm_format_modifiers */
    868  1.1  riastrad 	__u32 count_modifiers;
    869  1.1  riastrad 
    870  1.1  riastrad 	/* Where in this blob the modifiers exist (in bytes) */
    871  1.1  riastrad 	__u32 modifiers_offset;
    872  1.1  riastrad 
    873  1.1  riastrad 	/* __u32 formats[] */
    874  1.1  riastrad 	/* struct drm_format_modifier modifiers[] */
    875  1.1  riastrad };
    876  1.1  riastrad 
    877  1.1  riastrad struct drm_format_modifier {
    878  1.1  riastrad 	/* Bitmask of formats in get_plane format list this info applies to. The
    879  1.1  riastrad 	 * offset allows a sliding window of which 64 formats (bits).
    880  1.1  riastrad 	 *
    881  1.1  riastrad 	 * Some examples:
    882  1.1  riastrad 	 * In today's world with < 65 formats, and formats 0, and 2 are
    883  1.1  riastrad 	 * supported
    884  1.1  riastrad 	 * 0x0000000000000005
    885  1.1  riastrad 	 *		  ^-offset = 0, formats = 5
    886  1.1  riastrad 	 *
    887  1.1  riastrad 	 * If the number formats grew to 128, and formats 98-102 are
    888  1.1  riastrad 	 * supported with the modifier:
    889  1.1  riastrad 	 *
    890  1.1  riastrad 	 * 0x0000007c00000000 0000000000000000
    891  1.1  riastrad 	 *		  ^
    892  1.1  riastrad 	 *		  |__offset = 64, formats = 0x7c00000000
    893  1.1  riastrad 	 *
    894  1.1  riastrad 	 */
    895  1.1  riastrad 	__u64 formats;
    896  1.1  riastrad 	__u32 offset;
    897  1.1  riastrad 	__u32 pad;
    898  1.1  riastrad 
    899  1.1  riastrad 	/* The modifier that applies to the >get_plane format list bitmask. */
    900  1.1  riastrad 	__u64 modifier;
    901  1.1  riastrad };
    902  1.1  riastrad 
    903  1.1  riastrad /**
    904  1.1  riastrad  * struct drm_mode_create_blob - Create New block property
    905  1.1  riastrad  * @data: Pointer to data to copy.
    906  1.1  riastrad  * @length: Length of data to copy.
    907  1.1  riastrad  * @blob_id: new property ID.
    908  1.1  riastrad  * Create a new 'blob' data property, copying length bytes from data pointer,
    909  1.1  riastrad  * and returning new blob ID.
    910  1.1  riastrad  */
    911  1.1  riastrad struct drm_mode_create_blob {
    912  1.1  riastrad 	/** Pointer to data to copy. */
    913  1.1  riastrad 	__u64 data;
    914  1.1  riastrad 	/** Length of data to copy. */
    915  1.1  riastrad 	__u32 length;
    916  1.1  riastrad 	/** Return: new property ID. */
    917  1.1  riastrad 	__u32 blob_id;
    918  1.1  riastrad };
    919  1.1  riastrad 
    920  1.1  riastrad /**
    921  1.1  riastrad  * struct drm_mode_destroy_blob - Destroy user blob
    922  1.1  riastrad  * @blob_id: blob_id to destroy
    923  1.1  riastrad  * Destroy a user-created blob property.
    924  1.1  riastrad  */
    925  1.1  riastrad struct drm_mode_destroy_blob {
    926  1.1  riastrad 	__u32 blob_id;
    927  1.1  riastrad };
    928  1.1  riastrad 
    929  1.1  riastrad /**
    930  1.1  riastrad  * struct drm_mode_create_lease - Create lease
    931  1.1  riastrad  * @object_ids: Pointer to array of object ids.
    932  1.1  riastrad  * @object_count: Number of object ids.
    933  1.1  riastrad  * @flags: flags for new FD.
    934  1.1  riastrad  * @lessee_id: unique identifier for lessee.
    935  1.1  riastrad  * @fd: file descriptor to new drm_master file.
    936  1.1  riastrad  * Lease mode resources, creating another drm_master.
    937  1.1  riastrad  */
    938  1.1  riastrad struct drm_mode_create_lease {
    939  1.1  riastrad 	/** Pointer to array of object ids (__u32) */
    940  1.1  riastrad 	__u64 object_ids;
    941  1.1  riastrad 	/** Number of object ids */
    942  1.1  riastrad 	__u32 object_count;
    943  1.1  riastrad 	/** flags for new FD (O_CLOEXEC, etc) */
    944  1.1  riastrad 	__u32 flags;
    945  1.1  riastrad 
    946  1.1  riastrad 	/** Return: unique identifier for lessee. */
    947  1.1  riastrad 	__u32 lessee_id;
    948  1.1  riastrad 	/** Return: file descriptor to new drm_master file */
    949  1.1  riastrad 	__u32 fd;
    950  1.1  riastrad };
    951  1.1  riastrad 
    952  1.1  riastrad /**
    953  1.1  riastrad  * struct drm_mode_list_lessees - List lessees
    954  1.1  riastrad  * @count_lessees: Number of lessees.
    955  1.1  riastrad  * @pad: pad.
    956  1.1  riastrad  * @lessees_ptr: Pointer to lessess.
    957  1.1  riastrad  * List lesses from a drm_master
    958  1.1  riastrad  */
    959  1.1  riastrad struct drm_mode_list_lessees {
    960  1.1  riastrad 	/** Number of lessees.
    961  1.1  riastrad 	 * On input, provides length of the array.
    962  1.1  riastrad 	 * On output, provides total number. No
    963  1.1  riastrad 	 * more than the input number will be written
    964  1.1  riastrad 	 * back, so two calls can be used to get
    965  1.1  riastrad 	 * the size and then the data.
    966  1.1  riastrad 	 */
    967  1.1  riastrad 	__u32 count_lessees;
    968  1.1  riastrad 	__u32 pad;
    969  1.1  riastrad 
    970  1.1  riastrad 	/** Pointer to lessees.
    971  1.1  riastrad 	 * pointer to __u64 array of lessee ids
    972  1.1  riastrad 	 */
    973  1.1  riastrad 	__u64 lessees_ptr;
    974  1.1  riastrad };
    975  1.1  riastrad 
    976  1.1  riastrad /**
    977  1.1  riastrad  * struct drm_mode_get_lease - Get Lease
    978  1.1  riastrad  * @count_objects: Number of leased objects.
    979  1.1  riastrad  * @pad: pad.
    980  1.1  riastrad  * @objects_ptr: Pointer to objects.
    981  1.1  riastrad  * Get leased objects
    982  1.1  riastrad  */
    983  1.1  riastrad struct drm_mode_get_lease {
    984  1.1  riastrad 	/** Number of leased objects.
    985  1.1  riastrad 	 * On input, provides length of the array.
    986  1.1  riastrad 	 * On output, provides total number. No
    987  1.1  riastrad 	 * more than the input number will be written
    988  1.1  riastrad 	 * back, so two calls can be used to get
    989  1.1  riastrad 	 * the size and then the data.
    990  1.1  riastrad 	 */
    991  1.1  riastrad 	__u32 count_objects;
    992  1.1  riastrad 	__u32 pad;
    993  1.1  riastrad 
    994  1.1  riastrad 	/** Pointer to objects.
    995  1.1  riastrad 	 * pointer to __u32 array of object ids
    996  1.1  riastrad 	 */
    997  1.1  riastrad 	__u64 objects_ptr;
    998  1.1  riastrad };
    999  1.1  riastrad 
   1000  1.1  riastrad /**
   1001  1.1  riastrad  * struct drm_mode_revoke_lease - Revoke lease
   1002  1.1  riastrad  * @lessee_id: Unique ID of lessee.
   1003  1.1  riastrad  * Revoke lease
   1004  1.1  riastrad  */
   1005  1.1  riastrad struct drm_mode_revoke_lease {
   1006  1.1  riastrad 	/** Unique ID of lessee
   1007  1.1  riastrad 	 */
   1008  1.1  riastrad 	__u32 lessee_id;
   1009  1.1  riastrad };
   1010  1.1  riastrad 
   1011  1.1  riastrad /**
   1012  1.1  riastrad  * struct drm_mode_rect - Two dimensional rectangle.
   1013  1.1  riastrad  * @x1: Horizontal starting coordinate (inclusive).
   1014  1.1  riastrad  * @y1: Vertical starting coordinate (inclusive).
   1015  1.1  riastrad  * @x2: Horizontal ending coordinate (exclusive).
   1016  1.1  riastrad  * @y2: Vertical ending coordinate (exclusive).
   1017  1.1  riastrad  *
   1018  1.1  riastrad  * With drm subsystem using struct drm_rect to manage rectangular area this
   1019  1.1  riastrad  * export it to user-space.
   1020  1.1  riastrad  *
   1021  1.1  riastrad  * Currently used by drm_mode_atomic blob property FB_DAMAGE_CLIPS.
   1022  1.1  riastrad  */
   1023  1.1  riastrad struct drm_mode_rect {
   1024  1.1  riastrad 	__s32 x1;
   1025  1.1  riastrad 	__s32 y1;
   1026  1.1  riastrad 	__s32 x2;
   1027  1.1  riastrad 	__s32 y2;
   1028  1.1  riastrad };
   1029  1.1  riastrad 
   1030  1.1  riastrad #if defined(__cplusplus)
   1031  1.1  riastrad }
   1032  1.1  riastrad #endif
   1033  1.1  riastrad 
   1034  1.1  riastrad #endif
   1035