/*1* Copyright (c) 2007 Dave Airlie <[email protected]>2* Copyright (c) 2007 Jakob Bornecrantz <[email protected]>3* Copyright (c) 2008 Red Hat Inc.4* Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA5* Copyright (c) 2007-2008 Intel Corporation6*7* Permission is hereby granted, free of charge, to any person obtaining a8* copy of this software and associated documentation files (the "Software"),9* to deal in the Software without restriction, including without limitation10* the rights to use, copy, modify, merge, publish, distribute, sublicense,11* and/or sell copies of the Software, and to permit persons to whom the12* Software is furnished to do so, subject to the following conditions:13*14* The above copyright notice and this permission notice shall be included in15* all copies or substantial portions of the Software.16*17* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR18* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,19* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE20* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER21* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING22* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS23* IN THE SOFTWARE.24*/2526#ifndef _DRM_MODE_H27#define _DRM_MODE_H2829#include "drm.h"3031#if defined(__cplusplus)32extern "C" {33#endif3435/**36* DOC: overview37*38* DRM exposes many UAPI and structure definitions to have a consistent39* and standardized interface with users.40* Userspace can refer to these structure definitions and UAPI formats41* to communicate to drivers.42*/4344#define DRM_CONNECTOR_NAME_LEN 3245#define DRM_DISPLAY_MODE_LEN 3246#define DRM_PROP_NAME_LEN 324748#define DRM_MODE_TYPE_BUILTIN (1<<0) /* deprecated */49#define DRM_MODE_TYPE_CLOCK_C ((1<<1) | DRM_MODE_TYPE_BUILTIN) /* deprecated */50#define DRM_MODE_TYPE_CRTC_C ((1<<2) | DRM_MODE_TYPE_BUILTIN) /* deprecated */51#define DRM_MODE_TYPE_PREFERRED (1<<3)52#define DRM_MODE_TYPE_DEFAULT (1<<4) /* deprecated */53#define DRM_MODE_TYPE_USERDEF (1<<5)54#define DRM_MODE_TYPE_DRIVER (1<<6)5556#define DRM_MODE_TYPE_ALL (DRM_MODE_TYPE_PREFERRED | \57DRM_MODE_TYPE_USERDEF | \58DRM_MODE_TYPE_DRIVER)5960/* Video mode flags */61/* bit compatible with the xrandr RR_ definitions (bits 0-13)62*63* ABI warning: Existing userspace really expects64* the mode flags to match the xrandr definitions. Any65* changes that don't match the xrandr definitions will66* likely need a new client cap or some other mechanism67* to avoid breaking existing userspace. This includes68* allocating new flags in the previously unused bits!69*/70#define DRM_MODE_FLAG_PHSYNC (1<<0)71#define DRM_MODE_FLAG_NHSYNC (1<<1)72#define DRM_MODE_FLAG_PVSYNC (1<<2)73#define DRM_MODE_FLAG_NVSYNC (1<<3)74#define DRM_MODE_FLAG_INTERLACE (1<<4)75#define DRM_MODE_FLAG_DBLSCAN (1<<5)76#define DRM_MODE_FLAG_CSYNC (1<<6)77#define DRM_MODE_FLAG_PCSYNC (1<<7)78#define DRM_MODE_FLAG_NCSYNC (1<<8)79#define DRM_MODE_FLAG_HSKEW (1<<9) /* hskew provided */80#define DRM_MODE_FLAG_BCAST (1<<10) /* deprecated */81#define DRM_MODE_FLAG_PIXMUX (1<<11) /* deprecated */82#define DRM_MODE_FLAG_DBLCLK (1<<12)83#define DRM_MODE_FLAG_CLKDIV2 (1<<13)84/*85* When adding a new stereo mode don't forget to adjust DRM_MODE_FLAGS_3D_MAX86* (define not exposed to user space).87*/88#define DRM_MODE_FLAG_3D_MASK (0x1f<<14)89#define DRM_MODE_FLAG_3D_NONE (0<<14)90#define DRM_MODE_FLAG_3D_FRAME_PACKING (1<<14)91#define DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE (2<<14)92#define DRM_MODE_FLAG_3D_LINE_ALTERNATIVE (3<<14)93#define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL (4<<14)94#define DRM_MODE_FLAG_3D_L_DEPTH (5<<14)95#define DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH (6<<14)96#define DRM_MODE_FLAG_3D_TOP_AND_BOTTOM (7<<14)97#define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF (8<<14)9899/* Picture aspect ratio options */100#define DRM_MODE_PICTURE_ASPECT_NONE 0101#define DRM_MODE_PICTURE_ASPECT_4_3 1102#define DRM_MODE_PICTURE_ASPECT_16_9 2103#define DRM_MODE_PICTURE_ASPECT_64_27 3104#define DRM_MODE_PICTURE_ASPECT_256_135 4105106/* Content type options */107#define DRM_MODE_CONTENT_TYPE_NO_DATA 0108#define DRM_MODE_CONTENT_TYPE_GRAPHICS 1109#define DRM_MODE_CONTENT_TYPE_PHOTO 2110#define DRM_MODE_CONTENT_TYPE_CINEMA 3111#define DRM_MODE_CONTENT_TYPE_GAME 4112113/* Aspect ratio flag bitmask (4 bits 22:19) */114#define DRM_MODE_FLAG_PIC_AR_MASK (0x0F<<19)115#define DRM_MODE_FLAG_PIC_AR_NONE \116(DRM_MODE_PICTURE_ASPECT_NONE<<19)117#define DRM_MODE_FLAG_PIC_AR_4_3 \118(DRM_MODE_PICTURE_ASPECT_4_3<<19)119#define DRM_MODE_FLAG_PIC_AR_16_9 \120(DRM_MODE_PICTURE_ASPECT_16_9<<19)121#define DRM_MODE_FLAG_PIC_AR_64_27 \122(DRM_MODE_PICTURE_ASPECT_64_27<<19)123#define DRM_MODE_FLAG_PIC_AR_256_135 \124(DRM_MODE_PICTURE_ASPECT_256_135<<19)125126#define DRM_MODE_FLAG_ALL (DRM_MODE_FLAG_PHSYNC | \127DRM_MODE_FLAG_NHSYNC | \128DRM_MODE_FLAG_PVSYNC | \129DRM_MODE_FLAG_NVSYNC | \130DRM_MODE_FLAG_INTERLACE | \131DRM_MODE_FLAG_DBLSCAN | \132DRM_MODE_FLAG_CSYNC | \133DRM_MODE_FLAG_PCSYNC | \134DRM_MODE_FLAG_NCSYNC | \135DRM_MODE_FLAG_HSKEW | \136DRM_MODE_FLAG_DBLCLK | \137DRM_MODE_FLAG_CLKDIV2 | \138DRM_MODE_FLAG_3D_MASK)139140/* DPMS flags */141/* bit compatible with the xorg definitions. */142#define DRM_MODE_DPMS_ON 0143#define DRM_MODE_DPMS_STANDBY 1144#define DRM_MODE_DPMS_SUSPEND 2145#define DRM_MODE_DPMS_OFF 3146147/* Scaling mode options */148#define DRM_MODE_SCALE_NONE 0 /* Unmodified timing (display or149software can still scale) */150#define DRM_MODE_SCALE_FULLSCREEN 1 /* Full screen, ignore aspect */151#define DRM_MODE_SCALE_CENTER 2 /* Centered, no scaling */152#define DRM_MODE_SCALE_ASPECT 3 /* Full screen, preserve aspect */153154/* Dithering mode options */155#define DRM_MODE_DITHERING_OFF 0156#define DRM_MODE_DITHERING_ON 1157#define DRM_MODE_DITHERING_AUTO 2158159/* Dirty info options */160#define DRM_MODE_DIRTY_OFF 0161#define DRM_MODE_DIRTY_ON 1162#define DRM_MODE_DIRTY_ANNOTATE 2163164/* Link Status options */165#define DRM_MODE_LINK_STATUS_GOOD 0166#define DRM_MODE_LINK_STATUS_BAD 1167168/*169* DRM_MODE_ROTATE_<degrees>170*171* Signals that a drm plane is been rotated <degrees> degrees in counter172* clockwise direction.173*174* This define is provided as a convenience, looking up the property id175* using the name->prop id lookup is the preferred method.176*/177#define DRM_MODE_ROTATE_0 (1<<0)178#define DRM_MODE_ROTATE_90 (1<<1)179#define DRM_MODE_ROTATE_180 (1<<2)180#define DRM_MODE_ROTATE_270 (1<<3)181182/*183* DRM_MODE_ROTATE_MASK184*185* Bitmask used to look for drm plane rotations.186*/187#define DRM_MODE_ROTATE_MASK (\188DRM_MODE_ROTATE_0 | \189DRM_MODE_ROTATE_90 | \190DRM_MODE_ROTATE_180 | \191DRM_MODE_ROTATE_270)192193/*194* DRM_MODE_REFLECT_<axis>195*196* Signals that the contents of a drm plane is reflected along the <axis> axis,197* in the same way as mirroring.198* See kerneldoc chapter "Plane Composition Properties" for more details.199*200* This define is provided as a convenience, looking up the property id201* using the name->prop id lookup is the preferred method.202*/203#define DRM_MODE_REFLECT_X (1<<4)204#define DRM_MODE_REFLECT_Y (1<<5)205206/*207* DRM_MODE_REFLECT_MASK208*209* Bitmask used to look for drm plane reflections.210*/211#define DRM_MODE_REFLECT_MASK (\212DRM_MODE_REFLECT_X | \213DRM_MODE_REFLECT_Y)214215/* Content Protection Flags */216#define DRM_MODE_CONTENT_PROTECTION_UNDESIRED 0217#define DRM_MODE_CONTENT_PROTECTION_DESIRED 1218#define DRM_MODE_CONTENT_PROTECTION_ENABLED 2219220/**221* struct drm_mode_modeinfo - Display mode information.222* @clock: pixel clock in kHz223* @hdisplay: horizontal display size224* @hsync_start: horizontal sync start225* @hsync_end: horizontal sync end226* @htotal: horizontal total size227* @hskew: horizontal skew228* @vdisplay: vertical display size229* @vsync_start: vertical sync start230* @vsync_end: vertical sync end231* @vtotal: vertical total size232* @vscan: vertical scan233* @vrefresh: approximate vertical refresh rate in Hz234* @flags: bitmask of misc. flags, see DRM_MODE_FLAG_* defines235* @type: bitmask of type flags, see DRM_MODE_TYPE_* defines236* @name: string describing the mode resolution237*238* This is the user-space API display mode information structure. For the239* kernel version see struct drm_display_mode.240*/241struct drm_mode_modeinfo {242__u32 clock;243__u16 hdisplay;244__u16 hsync_start;245__u16 hsync_end;246__u16 htotal;247__u16 hskew;248__u16 vdisplay;249__u16 vsync_start;250__u16 vsync_end;251__u16 vtotal;252__u16 vscan;253254__u32 vrefresh;255256__u32 flags;257__u32 type;258char name[DRM_DISPLAY_MODE_LEN];259};260261struct drm_mode_card_res {262__u64 fb_id_ptr;263__u64 crtc_id_ptr;264__u64 connector_id_ptr;265__u64 encoder_id_ptr;266__u32 count_fbs;267__u32 count_crtcs;268__u32 count_connectors;269__u32 count_encoders;270__u32 min_width;271__u32 max_width;272__u32 min_height;273__u32 max_height;274};275276struct drm_mode_crtc {277__u64 set_connectors_ptr;278__u32 count_connectors;279280__u32 crtc_id; /**< Id */281__u32 fb_id; /**< Id of framebuffer */282283__u32 x; /**< x Position on the framebuffer */284__u32 y; /**< y Position on the framebuffer */285286__u32 gamma_size;287__u32 mode_valid;288struct drm_mode_modeinfo mode;289};290291#define DRM_MODE_PRESENT_TOP_FIELD (1<<0)292#define DRM_MODE_PRESENT_BOTTOM_FIELD (1<<1)293294/* Planes blend with or override other bits on the CRTC */295struct drm_mode_set_plane {296__u32 plane_id;297__u32 crtc_id;298__u32 fb_id; /* fb object contains surface format type */299__u32 flags; /* see above flags */300301/* Signed dest location allows it to be partially off screen */302__s32 crtc_x;303__s32 crtc_y;304__u32 crtc_w;305__u32 crtc_h;306307/* Source values are 16.16 fixed point */308__u32 src_x;309__u32 src_y;310__u32 src_h;311__u32 src_w;312};313314/**315* struct drm_mode_get_plane - Get plane metadata.316*317* Userspace can perform a GETPLANE ioctl to retrieve information about a318* plane.319*320* To retrieve the number of formats supported, set @count_format_types to zero321* and call the ioctl. @count_format_types will be updated with the value.322*323* To retrieve these formats, allocate an array with the memory needed to store324* @count_format_types formats. Point @format_type_ptr to this array and call325* the ioctl again (with @count_format_types still set to the value returned in326* the first ioctl call).327*/328struct drm_mode_get_plane {329/**330* @plane_id: Object ID of the plane whose information should be331* retrieved. Set by caller.332*/333__u32 plane_id;334335/** @crtc_id: Object ID of the current CRTC. */336__u32 crtc_id;337/** @fb_id: Object ID of the current fb. */338__u32 fb_id;339340/**341* @possible_crtcs: Bitmask of CRTC's compatible with the plane. CRTC's342* are created and they receive an index, which corresponds to their343* position in the bitmask. Bit N corresponds to344* :ref:`CRTC index<crtc_index>` N.345*/346__u32 possible_crtcs;347/** @gamma_size: Never used. */348__u32 gamma_size;349350/** @count_format_types: Number of formats. */351__u32 count_format_types;352/**353* @format_type_ptr: Pointer to ``__u32`` array of formats that are354* supported by the plane. These formats do not require modifiers.355*/356__u64 format_type_ptr;357};358359struct drm_mode_get_plane_res {360__u64 plane_id_ptr;361__u32 count_planes;362};363364#define DRM_MODE_ENCODER_NONE 0365#define DRM_MODE_ENCODER_DAC 1366#define DRM_MODE_ENCODER_TMDS 2367#define DRM_MODE_ENCODER_LVDS 3368#define DRM_MODE_ENCODER_TVDAC 4369#define DRM_MODE_ENCODER_VIRTUAL 5370#define DRM_MODE_ENCODER_DSI 6371#define DRM_MODE_ENCODER_DPMST 7372#define DRM_MODE_ENCODER_DPI 8373374struct drm_mode_get_encoder {375__u32 encoder_id;376__u32 encoder_type;377378__u32 crtc_id; /**< Id of crtc */379380__u32 possible_crtcs;381__u32 possible_clones;382};383384/* This is for connectors with multiple signal types. */385/* Try to match DRM_MODE_CONNECTOR_X as closely as possible. */386enum drm_mode_subconnector {387DRM_MODE_SUBCONNECTOR_Automatic = 0, /* DVI-I, TV */388DRM_MODE_SUBCONNECTOR_Unknown = 0, /* DVI-I, TV, DP */389DRM_MODE_SUBCONNECTOR_VGA = 1, /* DP */390DRM_MODE_SUBCONNECTOR_DVID = 3, /* DVI-I DP */391DRM_MODE_SUBCONNECTOR_DVIA = 4, /* DVI-I */392DRM_MODE_SUBCONNECTOR_Composite = 5, /* TV */393DRM_MODE_SUBCONNECTOR_SVIDEO = 6, /* TV */394DRM_MODE_SUBCONNECTOR_Component = 8, /* TV */395DRM_MODE_SUBCONNECTOR_SCART = 9, /* TV */396DRM_MODE_SUBCONNECTOR_DisplayPort = 10, /* DP */397DRM_MODE_SUBCONNECTOR_HDMIA = 11, /* DP */398DRM_MODE_SUBCONNECTOR_Native = 15, /* DP */399DRM_MODE_SUBCONNECTOR_Wireless = 18, /* DP */400};401402#define DRM_MODE_CONNECTOR_Unknown 0403#define DRM_MODE_CONNECTOR_VGA 1404#define DRM_MODE_CONNECTOR_DVII 2405#define DRM_MODE_CONNECTOR_DVID 3406#define DRM_MODE_CONNECTOR_DVIA 4407#define DRM_MODE_CONNECTOR_Composite 5408#define DRM_MODE_CONNECTOR_SVIDEO 6409#define DRM_MODE_CONNECTOR_LVDS 7410#define DRM_MODE_CONNECTOR_Component 8411#define DRM_MODE_CONNECTOR_9PinDIN 9412#define DRM_MODE_CONNECTOR_DisplayPort 10413#define DRM_MODE_CONNECTOR_HDMIA 11414#define DRM_MODE_CONNECTOR_HDMIB 12415#define DRM_MODE_CONNECTOR_TV 13416#define DRM_MODE_CONNECTOR_eDP 14417#define DRM_MODE_CONNECTOR_VIRTUAL 15418#define DRM_MODE_CONNECTOR_DSI 16419#define DRM_MODE_CONNECTOR_DPI 17420#define DRM_MODE_CONNECTOR_WRITEBACK 18421#define DRM_MODE_CONNECTOR_SPI 19422#define DRM_MODE_CONNECTOR_USB 20423424/**425* struct drm_mode_get_connector - Get connector metadata.426*427* User-space can perform a GETCONNECTOR ioctl to retrieve information about a428* connector. User-space is expected to retrieve encoders, modes and properties429* by performing this ioctl at least twice: the first time to retrieve the430* number of elements, the second time to retrieve the elements themselves.431*432* To retrieve the number of elements, set @count_props and @count_encoders to433* zero, set @count_modes to 1, and set @modes_ptr to a temporary struct434* drm_mode_modeinfo element.435*436* To retrieve the elements, allocate arrays for @encoders_ptr, @modes_ptr,437* @props_ptr and @prop_values_ptr, then set @count_modes, @count_props and438* @count_encoders to their capacity.439*440* Performing the ioctl only twice may be racy: the number of elements may have441* changed with a hotplug event in-between the two ioctls. User-space is442* expected to retry the last ioctl until the number of elements stabilizes.443* The kernel won't fill any array which doesn't have the expected length.444*445* **Force-probing a connector**446*447* If the @count_modes field is set to zero and the DRM client is the current448* DRM master, the kernel will perform a forced probe on the connector to449* refresh the connector status, modes and EDID. A forced-probe can be slow,450* might cause flickering and the ioctl will block.451*452* User-space needs to force-probe connectors to ensure their metadata is453* up-to-date at startup and after receiving a hot-plug event. User-space454* may perform a forced-probe when the user explicitly requests it. User-space455* shouldn't perform a forced-probe in other situations.456*/457struct drm_mode_get_connector {458/** @encoders_ptr: Pointer to ``__u32`` array of object IDs. */459__u64 encoders_ptr;460/** @modes_ptr: Pointer to struct drm_mode_modeinfo array. */461__u64 modes_ptr;462/** @props_ptr: Pointer to ``__u32`` array of property IDs. */463__u64 props_ptr;464/** @prop_values_ptr: Pointer to ``__u64`` array of property values. */465__u64 prop_values_ptr;466467/** @count_modes: Number of modes. */468__u32 count_modes;469/** @count_props: Number of properties. */470__u32 count_props;471/** @count_encoders: Number of encoders. */472__u32 count_encoders;473474/** @encoder_id: Object ID of the current encoder. */475__u32 encoder_id;476/** @connector_id: Object ID of the connector. */477__u32 connector_id;478/**479* @connector_type: Type of the connector.480*481* See DRM_MODE_CONNECTOR_* defines.482*/483__u32 connector_type;484/**485* @connector_type_id: Type-specific connector number.486*487* This is not an object ID. This is a per-type connector number. Each488* (type, type_id) combination is unique across all connectors of a DRM489* device.490*491* The (type, type_id) combination is not a stable identifier: the492* type_id can change depending on the driver probe order.493*/494__u32 connector_type_id;495496/**497* @connection: Status of the connector.498*499* See enum drm_connector_status.500*/501__u32 connection;502/** @mm_width: Width of the connected sink in millimeters. */503__u32 mm_width;504/** @mm_height: Height of the connected sink in millimeters. */505__u32 mm_height;506/**507* @subpixel: Subpixel order of the connected sink.508*509* See enum subpixel_order.510*/511__u32 subpixel;512513/** @pad: Padding, must be zero. */514__u32 pad;515};516517#define DRM_MODE_PROP_PENDING (1<<0) /* deprecated, do not use */518#define DRM_MODE_PROP_RANGE (1<<1)519#define DRM_MODE_PROP_IMMUTABLE (1<<2)520#define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */521#define DRM_MODE_PROP_BLOB (1<<4)522#define DRM_MODE_PROP_BITMASK (1<<5) /* bitmask of enumerated types */523524/* non-extended types: legacy bitmask, one bit per type: */525#define DRM_MODE_PROP_LEGACY_TYPE ( \526DRM_MODE_PROP_RANGE | \527DRM_MODE_PROP_ENUM | \528DRM_MODE_PROP_BLOB | \529DRM_MODE_PROP_BITMASK)530531/* extended-types: rather than continue to consume a bit per type,532* grab a chunk of the bits to use as integer type id.533*/534#define DRM_MODE_PROP_EXTENDED_TYPE 0x0000ffc0535#define DRM_MODE_PROP_TYPE(n) ((n) << 6)536#define DRM_MODE_PROP_OBJECT DRM_MODE_PROP_TYPE(1)537#define DRM_MODE_PROP_SIGNED_RANGE DRM_MODE_PROP_TYPE(2)538539/* the PROP_ATOMIC flag is used to hide properties from userspace that540* is not aware of atomic properties. This is mostly to work around541* older userspace (DDX drivers) that read/write each prop they find,542* without being aware that this could be triggering a lengthy modeset.543*/544#define DRM_MODE_PROP_ATOMIC 0x80000000545546/**547* struct drm_mode_property_enum - Description for an enum/bitfield entry.548* @value: numeric value for this enum entry.549* @name: symbolic name for this enum entry.550*551* See struct drm_property_enum for details.552*/553struct drm_mode_property_enum {554__u64 value;555char name[DRM_PROP_NAME_LEN];556};557558/**559* struct drm_mode_get_property - Get property metadata.560*561* User-space can perform a GETPROPERTY ioctl to retrieve information about a562* property. The same property may be attached to multiple objects, see563* "Modeset Base Object Abstraction".564*565* The meaning of the @values_ptr field changes depending on the property type.566* See &drm_property.flags for more details.567*568* The @enum_blob_ptr and @count_enum_blobs fields are only meaningful when the569* property has the type &DRM_MODE_PROP_ENUM or &DRM_MODE_PROP_BITMASK. For570* backwards compatibility, the kernel will always set @count_enum_blobs to571* zero when the property has the type &DRM_MODE_PROP_BLOB. User-space must572* ignore these two fields if the property has a different type.573*574* User-space is expected to retrieve values and enums by performing this ioctl575* at least twice: the first time to retrieve the number of elements, the576* second time to retrieve the elements themselves.577*578* To retrieve the number of elements, set @count_values and @count_enum_blobs579* to zero, then call the ioctl. @count_values will be updated with the number580* of elements. If the property has the type &DRM_MODE_PROP_ENUM or581* &DRM_MODE_PROP_BITMASK, @count_enum_blobs will be updated as well.582*583* To retrieve the elements themselves, allocate an array for @values_ptr and584* set @count_values to its capacity. If the property has the type585* &DRM_MODE_PROP_ENUM or &DRM_MODE_PROP_BITMASK, allocate an array for586* @enum_blob_ptr and set @count_enum_blobs to its capacity. Calling the ioctl587* again will fill the arrays.588*/589struct drm_mode_get_property {590/** @values_ptr: Pointer to a ``__u64`` array. */591__u64 values_ptr;592/** @enum_blob_ptr: Pointer to a struct drm_mode_property_enum array. */593__u64 enum_blob_ptr;594595/**596* @prop_id: Object ID of the property which should be retrieved. Set597* by the caller.598*/599__u32 prop_id;600/**601* @flags: ``DRM_MODE_PROP_*`` bitfield. See &drm_property.flags for602* a definition of the flags.603*/604__u32 flags;605/**606* @name: Symbolic property name. User-space should use this field to607* recognize properties.608*/609char name[DRM_PROP_NAME_LEN];610611/** @count_values: Number of elements in @values_ptr. */612__u32 count_values;613/** @count_enum_blobs: Number of elements in @enum_blob_ptr. */614__u32 count_enum_blobs;615};616617struct drm_mode_connector_set_property {618__u64 value;619__u32 prop_id;620__u32 connector_id;621};622623#define DRM_MODE_OBJECT_CRTC 0xcccccccc624#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0625#define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0626#define DRM_MODE_OBJECT_MODE 0xdededede627#define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0628#define DRM_MODE_OBJECT_FB 0xfbfbfbfb629#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb630#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee631#define DRM_MODE_OBJECT_ANY 0632633struct drm_mode_obj_get_properties {634__u64 props_ptr;635__u64 prop_values_ptr;636__u32 count_props;637__u32 obj_id;638__u32 obj_type;639};640641struct drm_mode_obj_set_property {642__u64 value;643__u32 prop_id;644__u32 obj_id;645__u32 obj_type;646};647648struct drm_mode_get_blob {649__u32 blob_id;650__u32 length;651__u64 data;652};653654struct drm_mode_fb_cmd {655__u32 fb_id;656__u32 width;657__u32 height;658__u32 pitch;659__u32 bpp;660__u32 depth;661/* driver specific handle */662__u32 handle;663};664665#define DRM_MODE_FB_INTERLACED (1<<0) /* for interlaced framebuffers */666#define DRM_MODE_FB_MODIFIERS (1<<1) /* enables ->modifier[] */667668/**669* struct drm_mode_fb_cmd2 - Frame-buffer metadata.670*671* This struct holds frame-buffer metadata. There are two ways to use it:672*673* - User-space can fill this struct and perform a &DRM_IOCTL_MODE_ADDFB2674* ioctl to register a new frame-buffer. The new frame-buffer object ID will675* be set by the kernel in @fb_id.676* - User-space can set @fb_id and perform a &DRM_IOCTL_MODE_GETFB2 ioctl to677* fetch metadata about an existing frame-buffer.678*679* In case of planar formats, this struct allows up to 4 buffer objects with680* offsets and pitches per plane. The pitch and offset order are dictated by681* the format FourCC as defined by ``drm_fourcc.h``, e.g. NV12 is described as:682*683* YUV 4:2:0 image with a plane of 8-bit Y samples followed by an684* interleaved U/V plane containing 8-bit 2x2 subsampled colour difference685* samples.686*687* So it would consist of a Y plane at ``offsets[0]`` and a UV plane at688* ``offsets[1]``.689*690* To accommodate tiled, compressed, etc formats, a modifier can be specified.691* For more information see the "Format Modifiers" section. Note that even692* though it looks like we have a modifier per-plane, we in fact do not. The693* modifier for each plane must be identical. Thus all combinations of694* different data layouts for multi-plane formats must be enumerated as695* separate modifiers.696*697* All of the entries in @handles, @pitches, @offsets and @modifier must be698* zero when unused. Warning, for @offsets and @modifier zero can't be used to699* figure out whether the entry is used or not since it's a valid value (a zero700* offset is common, and a zero modifier is &DRM_FORMAT_MOD_LINEAR).701*/702struct drm_mode_fb_cmd2 {703/** @fb_id: Object ID of the frame-buffer. */704__u32 fb_id;705/** @width: Width of the frame-buffer. */706__u32 width;707/** @height: Height of the frame-buffer. */708__u32 height;709/**710* @pixel_format: FourCC format code, see ``DRM_FORMAT_*`` constants in711* ``drm_fourcc.h``.712*/713__u32 pixel_format;714/**715* @flags: Frame-buffer flags (see &DRM_MODE_FB_INTERLACED and716* &DRM_MODE_FB_MODIFIERS).717*/718__u32 flags;719720/**721* @handles: GEM buffer handle, one per plane. Set to 0 if the plane is722* unused. The same handle can be used for multiple planes.723*/724__u32 handles[4];725/** @pitches: Pitch (aka. stride) in bytes, one per plane. */726__u32 pitches[4];727/** @offsets: Offset into the buffer in bytes, one per plane. */728__u32 offsets[4];729/**730* @modifier: Format modifier, one per plane. See ``DRM_FORMAT_MOD_*``731* constants in ``drm_fourcc.h``. All planes must use the same732* modifier. Ignored unless &DRM_MODE_FB_MODIFIERS is set in @flags.733*/734__u64 modifier[4];735};736737#define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01738#define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02739#define DRM_MODE_FB_DIRTY_FLAGS 0x03740741#define DRM_MODE_FB_DIRTY_MAX_CLIPS 256742743/*744* Mark a region of a framebuffer as dirty.745*746* Some hardware does not automatically update display contents747* as a hardware or software draw to a framebuffer. This ioctl748* allows userspace to tell the kernel and the hardware what749* regions of the framebuffer have changed.750*751* The kernel or hardware is free to update more then just the752* region specified by the clip rects. The kernel or hardware753* may also delay and/or coalesce several calls to dirty into a754* single update.755*756* Userspace may annotate the updates, the annotates are a757* promise made by the caller that the change is either a copy758* of pixels or a fill of a single color in the region specified.759*760* If the DRM_MODE_FB_DIRTY_ANNOTATE_COPY flag is given then761* the number of updated regions are half of num_clips given,762* where the clip rects are paired in src and dst. The width and763* height of each one of the pairs must match.764*765* If the DRM_MODE_FB_DIRTY_ANNOTATE_FILL flag is given the caller766* promises that the region specified of the clip rects is filled767* completely with a single color as given in the color argument.768*/769770struct drm_mode_fb_dirty_cmd {771__u32 fb_id;772__u32 flags;773__u32 color;774__u32 num_clips;775__u64 clips_ptr;776};777778struct drm_mode_mode_cmd {779__u32 connector_id;780struct drm_mode_modeinfo mode;781};782783#define DRM_MODE_CURSOR_BO 0x01784#define DRM_MODE_CURSOR_MOVE 0x02785#define DRM_MODE_CURSOR_FLAGS 0x03786787/*788* depending on the value in flags different members are used.789*790* CURSOR_BO uses791* crtc_id792* width793* height794* handle - if 0 turns the cursor off795*796* CURSOR_MOVE uses797* crtc_id798* x799* y800*/801struct drm_mode_cursor {802__u32 flags;803__u32 crtc_id;804__s32 x;805__s32 y;806__u32 width;807__u32 height;808/* driver specific handle */809__u32 handle;810};811812struct drm_mode_cursor2 {813__u32 flags;814__u32 crtc_id;815__s32 x;816__s32 y;817__u32 width;818__u32 height;819/* driver specific handle */820__u32 handle;821__s32 hot_x;822__s32 hot_y;823};824825struct drm_mode_crtc_lut {826__u32 crtc_id;827__u32 gamma_size;828829/* pointers to arrays */830__u64 red;831__u64 green;832__u64 blue;833};834835struct drm_color_ctm {836/*837* Conversion matrix in S31.32 sign-magnitude838* (not two's complement!) format.839*840* out matrix in841* |R| |0 1 2| |R|842* |G| = |3 4 5| x |G|843* |B| |6 7 8| |B|844*/845__u64 matrix[9];846};847848struct drm_color_lut {849/*850* Values are mapped linearly to 0.0 - 1.0 range, with 0x0 == 0.0 and851* 0xffff == 1.0.852*/853__u16 red;854__u16 green;855__u16 blue;856__u16 reserved;857};858859/**860* struct drm_plane_size_hint - Plane size hints861* @width: The width of the plane in pixel862* @height: The height of the plane in pixel863*864* The plane SIZE_HINTS property blob contains an865* array of struct drm_plane_size_hint.866*/867struct drm_plane_size_hint {868__u16 width;869__u16 height;870};871872/**873* struct hdr_metadata_infoframe - HDR Metadata Infoframe Data.874*875* HDR Metadata Infoframe as per CTA 861.G spec. This is expected876* to match exactly with the spec.877*878* Userspace is expected to pass the metadata information as per879* the format described in this structure.880*/881struct hdr_metadata_infoframe {882/**883* @eotf: Electro-Optical Transfer Function (EOTF)884* used in the stream.885*/886__u8 eotf;887/**888* @metadata_type: Static_Metadata_Descriptor_ID.889*/890__u8 metadata_type;891/**892* @display_primaries: Color Primaries of the Data.893* These are coded as unsigned 16-bit values in units of894* 0.00002, where 0x0000 represents zero and 0xC350895* represents 1.0000.896* @display_primaries.x: X coordinate of color primary.897* @display_primaries.y: Y coordinate of color primary.898*/899struct {900__u16 x, y;901} display_primaries[3];902/**903* @white_point: White Point of Colorspace Data.904* These are coded as unsigned 16-bit values in units of905* 0.00002, where 0x0000 represents zero and 0xC350906* represents 1.0000.907* @white_point.x: X coordinate of whitepoint of color primary.908* @white_point.y: Y coordinate of whitepoint of color primary.909*/910struct {911__u16 x, y;912} white_point;913/**914* @max_display_mastering_luminance: Max Mastering Display Luminance.915* This value is coded as an unsigned 16-bit value in units of 1 cd/m2,916* where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.917*/918__u16 max_display_mastering_luminance;919/**920* @min_display_mastering_luminance: Min Mastering Display Luminance.921* This value is coded as an unsigned 16-bit value in units of922* 0.0001 cd/m2, where 0x0001 represents 0.0001 cd/m2 and 0xFFFF923* represents 6.5535 cd/m2.924*/925__u16 min_display_mastering_luminance;926/**927* @max_cll: Max Content Light Level.928* This value is coded as an unsigned 16-bit value in units of 1 cd/m2,929* where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.930*/931__u16 max_cll;932/**933* @max_fall: Max Frame Average Light Level.934* This value is coded as an unsigned 16-bit value in units of 1 cd/m2,935* where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.936*/937__u16 max_fall;938};939940/**941* struct hdr_output_metadata - HDR output metadata942*943* Metadata Information to be passed from userspace944*/945struct hdr_output_metadata {946/**947* @metadata_type: Static_Metadata_Descriptor_ID.948*/949__u32 metadata_type;950/**951* @hdmi_metadata_type1: HDR Metadata Infoframe.952*/953union {954struct hdr_metadata_infoframe hdmi_metadata_type1;955};956};957958/**959* DRM_MODE_PAGE_FLIP_EVENT960*961* Request that the kernel sends back a vblank event (see962* struct drm_event_vblank) with the &DRM_EVENT_FLIP_COMPLETE type when the963* page-flip is done.964*/965#define DRM_MODE_PAGE_FLIP_EVENT 0x01966/**967* DRM_MODE_PAGE_FLIP_ASYNC968*969* Request that the page-flip is performed as soon as possible, ie. with no970* delay due to waiting for vblank. This may cause tearing to be visible on971* the screen.972*973* When used with atomic uAPI, the driver will return an error if the hardware974* doesn't support performing an asynchronous page-flip for this update.975* User-space should handle this, e.g. by falling back to a regular page-flip.976*977* Note, some hardware might need to perform one last synchronous page-flip978* before being able to switch to asynchronous page-flips. As an exception,979* the driver will return success even though that first page-flip is not980* asynchronous.981*/982#define DRM_MODE_PAGE_FLIP_ASYNC 0x02983#define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4984#define DRM_MODE_PAGE_FLIP_TARGET_RELATIVE 0x8985#define DRM_MODE_PAGE_FLIP_TARGET (DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE | \986DRM_MODE_PAGE_FLIP_TARGET_RELATIVE)987/**988* DRM_MODE_PAGE_FLIP_FLAGS989*990* Bitmask of flags suitable for &drm_mode_crtc_page_flip_target.flags.991*/992#define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT | \993DRM_MODE_PAGE_FLIP_ASYNC | \994DRM_MODE_PAGE_FLIP_TARGET)995996/*997* Request a page flip on the specified crtc.998*999* This ioctl will ask KMS to schedule a page flip for the specified1000* crtc. Once any pending rendering targeting the specified fb (as of1001* ioctl time) has completed, the crtc will be reprogrammed to display1002* that fb after the next vertical refresh. The ioctl returns1003* immediately, but subsequent rendering to the current fb will block1004* in the execbuffer ioctl until the page flip happens. If a page1005* flip is already pending as the ioctl is called, EBUSY will be1006* returned.1007*1008* Flag DRM_MODE_PAGE_FLIP_EVENT requests that drm sends back a vblank1009* event (see drm.h: struct drm_event_vblank) when the page flip is1010* done. The user_data field passed in with this ioctl will be1011* returned as the user_data field in the vblank event struct.1012*1013* Flag DRM_MODE_PAGE_FLIP_ASYNC requests that the flip happen1014* 'as soon as possible', meaning that it not delay waiting for vblank.1015* This may cause tearing on the screen.1016*1017* The reserved field must be zero.1018*/10191020struct drm_mode_crtc_page_flip {1021__u32 crtc_id;1022__u32 fb_id;1023__u32 flags;1024__u32 reserved;1025__u64 user_data;1026};10271028/*1029* Request a page flip on the specified crtc.1030*1031* Same as struct drm_mode_crtc_page_flip, but supports new flags and1032* re-purposes the reserved field:1033*1034* The sequence field must be zero unless either of the1035* DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is specified. When1036* the ABSOLUTE flag is specified, the sequence field denotes the absolute1037* vblank sequence when the flip should take effect. When the RELATIVE1038* flag is specified, the sequence field denotes the relative (to the1039* current one when the ioctl is called) vblank sequence when the flip1040* should take effect. NOTE: DRM_IOCTL_WAIT_VBLANK must still be used to1041* make sure the vblank sequence before the target one has passed before1042* calling this ioctl. The purpose of the1043* DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is merely to clarify1044* the target for when code dealing with a page flip runs during a1045* vertical blank period.1046*/10471048struct drm_mode_crtc_page_flip_target {1049__u32 crtc_id;1050__u32 fb_id;1051__u32 flags;1052__u32 sequence;1053__u64 user_data;1054};10551056/**1057* struct drm_mode_create_dumb - Create a KMS dumb buffer for scanout.1058* @height: buffer height in pixels1059* @width: buffer width in pixels1060* @bpp: bits per pixel1061* @flags: must be zero1062* @handle: buffer object handle1063* @pitch: number of bytes between two consecutive lines1064* @size: size of the whole buffer in bytes1065*1066* User-space fills @height, @width, @bpp and @flags. If the IOCTL succeeds,1067* the kernel fills @handle, @pitch and @size.1068*/1069struct drm_mode_create_dumb {1070__u32 height;1071__u32 width;1072__u32 bpp;1073__u32 flags;10741075__u32 handle;1076__u32 pitch;1077__u64 size;1078};10791080/* set up for mmap of a dumb scanout buffer */1081struct drm_mode_map_dumb {1082/** Handle for the object being mapped. */1083__u32 handle;1084__u32 pad;1085/**1086* Fake offset to use for subsequent mmap call1087*1088* This is a fixed-size type for 32/64 compatibility.1089*/1090__u64 offset;1091};10921093struct drm_mode_destroy_dumb {1094__u32 handle;1095};10961097/**1098* DRM_MODE_ATOMIC_TEST_ONLY1099*1100* Do not apply the atomic commit, instead check whether the hardware supports1101* this configuration.1102*1103* See &drm_mode_config_funcs.atomic_check for more details on test-only1104* commits.1105*/1106#define DRM_MODE_ATOMIC_TEST_ONLY 0x01001107/**1108* DRM_MODE_ATOMIC_NONBLOCK1109*1110* Do not block while applying the atomic commit. The &DRM_IOCTL_MODE_ATOMIC1111* IOCTL returns immediately instead of waiting for the changes to be applied1112* in hardware. Note, the driver will still check that the update can be1113* applied before retuning.1114*/1115#define DRM_MODE_ATOMIC_NONBLOCK 0x02001116/**1117* DRM_MODE_ATOMIC_ALLOW_MODESET1118*1119* Allow the update to result in temporary or transient visible artifacts while1120* the update is being applied. Applying the update may also take significantly1121* more time than a page flip. All visual artifacts will disappear by the time1122* the update is completed, as signalled through the vblank event's timestamp1123* (see struct drm_event_vblank).1124*1125* This flag must be set when the KMS update might cause visible artifacts.1126* Without this flag such KMS update will return a EINVAL error. What kind of1127* update may cause visible artifacts depends on the driver and the hardware.1128* User-space that needs to know beforehand if an update might cause visible1129* artifacts can use &DRM_MODE_ATOMIC_TEST_ONLY without1130* &DRM_MODE_ATOMIC_ALLOW_MODESET to see if it fails.1131*1132* To the best of the driver's knowledge, visual artifacts are guaranteed to1133* not appear when this flag is not set. Some sinks might display visual1134* artifacts outside of the driver's control.1135*/1136#define DRM_MODE_ATOMIC_ALLOW_MODESET 0x040011371138/**1139* DRM_MODE_ATOMIC_FLAGS1140*1141* Bitfield of flags accepted by the &DRM_IOCTL_MODE_ATOMIC IOCTL in1142* &drm_mode_atomic.flags.1143*/1144#define DRM_MODE_ATOMIC_FLAGS (\1145DRM_MODE_PAGE_FLIP_EVENT |\1146DRM_MODE_PAGE_FLIP_ASYNC |\1147DRM_MODE_ATOMIC_TEST_ONLY |\1148DRM_MODE_ATOMIC_NONBLOCK |\1149DRM_MODE_ATOMIC_ALLOW_MODESET)11501151struct drm_mode_atomic {1152__u32 flags;1153__u32 count_objs;1154__u64 objs_ptr;1155__u64 count_props_ptr;1156__u64 props_ptr;1157__u64 prop_values_ptr;1158__u64 reserved;1159__u64 user_data;1160};11611162struct drm_format_modifier_blob {1163#define FORMAT_BLOB_CURRENT 11164/* Version of this blob format */1165__u32 version;11661167/* Flags */1168__u32 flags;11691170/* Number of fourcc formats supported */1171__u32 count_formats;11721173/* Where in this blob the formats exist (in bytes) */1174__u32 formats_offset;11751176/* Number of drm_format_modifiers */1177__u32 count_modifiers;11781179/* Where in this blob the modifiers exist (in bytes) */1180__u32 modifiers_offset;11811182/* __u32 formats[] */1183/* struct drm_format_modifier modifiers[] */1184};11851186struct drm_format_modifier {1187/* Bitmask of formats in get_plane format list this info applies to. The1188* offset allows a sliding window of which 64 formats (bits).1189*1190* Some examples:1191* In today's world with < 65 formats, and formats 0, and 2 are1192* supported1193* 0x00000000000000051194* ^-offset = 0, formats = 51195*1196* If the number formats grew to 128, and formats 98-102 are1197* supported with the modifier:1198*1199* 0x0000007c00000000 00000000000000001200* ^1201* |__offset = 64, formats = 0x7c000000001202*1203*/1204__u64 formats;1205__u32 offset;1206__u32 pad;12071208/* The modifier that applies to the >get_plane format list bitmask. */1209__u64 modifier;1210};12111212/**1213* struct drm_mode_create_blob - Create New blob property1214*1215* Create a new 'blob' data property, copying length bytes from data pointer,1216* and returning new blob ID.1217*/1218struct drm_mode_create_blob {1219/** @data: Pointer to data to copy. */1220__u64 data;1221/** @length: Length of data to copy. */1222__u32 length;1223/** @blob_id: Return: new property ID. */1224__u32 blob_id;1225};12261227/**1228* struct drm_mode_destroy_blob - Destroy user blob1229* @blob_id: blob_id to destroy1230*1231* Destroy a user-created blob property.1232*1233* User-space can release blobs as soon as they do not need to refer to them by1234* their blob object ID. For instance, if you are using a MODE_ID blob in an1235* atomic commit and you will not make another commit re-using the same ID, you1236* can destroy the blob as soon as the commit has been issued, without waiting1237* for it to complete.1238*/1239struct drm_mode_destroy_blob {1240__u32 blob_id;1241};12421243/**1244* struct drm_mode_create_lease - Create lease1245*1246* Lease mode resources, creating another drm_master.1247*1248* The @object_ids array must reference at least one CRTC, one connector and1249* one plane if &DRM_CLIENT_CAP_UNIVERSAL_PLANES is enabled. Alternatively,1250* the lease can be completely empty.1251*/1252struct drm_mode_create_lease {1253/** @object_ids: Pointer to array of object ids (__u32) */1254__u64 object_ids;1255/** @object_count: Number of object ids */1256__u32 object_count;1257/** @flags: flags for new FD (O_CLOEXEC, etc) */1258__u32 flags;12591260/** @lessee_id: Return: unique identifier for lessee. */1261__u32 lessee_id;1262/** @fd: Return: file descriptor to new drm_master file */1263__u32 fd;1264};12651266/**1267* struct drm_mode_list_lessees - List lessees1268*1269* List lesses from a drm_master.1270*/1271struct drm_mode_list_lessees {1272/**1273* @count_lessees: Number of lessees.1274*1275* On input, provides length of the array.1276* On output, provides total number. No1277* more than the input number will be written1278* back, so two calls can be used to get1279* the size and then the data.1280*/1281__u32 count_lessees;1282/** @pad: Padding. */1283__u32 pad;12841285/**1286* @lessees_ptr: Pointer to lessees.1287*1288* Pointer to __u64 array of lessee ids1289*/1290__u64 lessees_ptr;1291};12921293/**1294* struct drm_mode_get_lease - Get Lease1295*1296* Get leased objects.1297*/1298struct drm_mode_get_lease {1299/**1300* @count_objects: Number of leased objects.1301*1302* On input, provides length of the array.1303* On output, provides total number. No1304* more than the input number will be written1305* back, so two calls can be used to get1306* the size and then the data.1307*/1308__u32 count_objects;1309/** @pad: Padding. */1310__u32 pad;13111312/**1313* @objects_ptr: Pointer to objects.1314*1315* Pointer to __u32 array of object ids.1316*/1317__u64 objects_ptr;1318};13191320/**1321* struct drm_mode_revoke_lease - Revoke lease1322*/1323struct drm_mode_revoke_lease {1324/** @lessee_id: Unique ID of lessee */1325__u32 lessee_id;1326};13271328/**1329* struct drm_mode_rect - Two dimensional rectangle.1330* @x1: Horizontal starting coordinate (inclusive).1331* @y1: Vertical starting coordinate (inclusive).1332* @x2: Horizontal ending coordinate (exclusive).1333* @y2: Vertical ending coordinate (exclusive).1334*1335* With drm subsystem using struct drm_rect to manage rectangular area this1336* export it to user-space.1337*1338* Currently used by drm_mode_atomic blob property FB_DAMAGE_CLIPS.1339*/1340struct drm_mode_rect {1341__s32 x1;1342__s32 y1;1343__s32 x2;1344__s32 y2;1345};13461347/**1348* struct drm_mode_closefb1349* @fb_id: Framebuffer ID.1350* @pad: Must be zero.1351*/1352struct drm_mode_closefb {1353__u32 fb_id;1354__u32 pad;1355};13561357#if defined(__cplusplus)1358}1359#endif13601361#endif136213631364