1d722e3fbSopenharmony_ci/* 2d722e3fbSopenharmony_ci * \file xf86drmMode.h 3d722e3fbSopenharmony_ci * Header for DRM modesetting interface. 4d722e3fbSopenharmony_ci * 5d722e3fbSopenharmony_ci * \author Jakob Bornecrantz <wallbraker@gmail.com> 6d722e3fbSopenharmony_ci * 7d722e3fbSopenharmony_ci * \par Acknowledgements: 8d722e3fbSopenharmony_ci * Feb 2007, Dave Airlie <airlied@linux.ie> 9d722e3fbSopenharmony_ci */ 10d722e3fbSopenharmony_ci 11d722e3fbSopenharmony_ci/* 12d722e3fbSopenharmony_ci * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas. 13d722e3fbSopenharmony_ci * Copyright (c) 2007-2008 Dave Airlie <airlied@linux.ie> 14d722e3fbSopenharmony_ci * Copyright (c) 2007-2008 Jakob Bornecrantz <wallbraker@gmail.com> 15d722e3fbSopenharmony_ci * 16d722e3fbSopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 17d722e3fbSopenharmony_ci * copy of this software and associated documentation files (the "Software"), 18d722e3fbSopenharmony_ci * to deal in the Software without restriction, including without limitation 19d722e3fbSopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 20d722e3fbSopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 21d722e3fbSopenharmony_ci * Software is furnished to do so, subject to the following conditions: 22d722e3fbSopenharmony_ci * 23d722e3fbSopenharmony_ci * The above copyright notice and this permission notice shall be included in 24d722e3fbSopenharmony_ci * all copies or substantial portions of the Software. 25d722e3fbSopenharmony_ci * 26d722e3fbSopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27d722e3fbSopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28d722e3fbSopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29d722e3fbSopenharmony_ci * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30d722e3fbSopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 31d722e3fbSopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 32d722e3fbSopenharmony_ci * IN THE SOFTWARE. 33d722e3fbSopenharmony_ci * 34d722e3fbSopenharmony_ci */ 35d722e3fbSopenharmony_ci 36d722e3fbSopenharmony_ci#ifndef _XF86DRMMODE_H_ 37d722e3fbSopenharmony_ci#define _XF86DRMMODE_H_ 38d722e3fbSopenharmony_ci 39d722e3fbSopenharmony_ci#if defined(__cplusplus) 40d722e3fbSopenharmony_ciextern "C" { 41d722e3fbSopenharmony_ci#endif 42d722e3fbSopenharmony_ci 43d722e3fbSopenharmony_ci#include <drm.h> 44d722e3fbSopenharmony_ci#include <drm_mode.h> 45d722e3fbSopenharmony_ci#include <stdbool.h> 46d722e3fbSopenharmony_ci#include <stddef.h> 47d722e3fbSopenharmony_ci#include <stdint.h> 48d722e3fbSopenharmony_ci 49d722e3fbSopenharmony_ci/* 50d722e3fbSopenharmony_ci * This is the interface for modesetting for drm. 51d722e3fbSopenharmony_ci * 52d722e3fbSopenharmony_ci * It aims to provide a randr1.2 compatible interface for modesettings in the 53d722e3fbSopenharmony_ci * kernel, the interface is also meant to be used by libraries like EGL. 54d722e3fbSopenharmony_ci * 55d722e3fbSopenharmony_ci * More information can be found in randrproto.txt which can be found here: 56d722e3fbSopenharmony_ci * http://gitweb.freedesktop.org/?p=xorg/proto/randrproto.git 57d722e3fbSopenharmony_ci * 58d722e3fbSopenharmony_ci * There are some major differences to be noted. Unlike the randr1.2 proto you 59d722e3fbSopenharmony_ci * need to create the memory object of the framebuffer yourself with the ttm 60d722e3fbSopenharmony_ci * buffer object interface. This object needs to be pinned. 61d722e3fbSopenharmony_ci */ 62d722e3fbSopenharmony_ci 63d722e3fbSopenharmony_ci/* 64d722e3fbSopenharmony_ci * Feature defines 65d722e3fbSopenharmony_ci * 66d722e3fbSopenharmony_ci * Just because these are defined doesn't mean that the kernel 67d722e3fbSopenharmony_ci * can do that feature, its just for new code vs old libdrm. 68d722e3fbSopenharmony_ci */ 69d722e3fbSopenharmony_ci#define DRM_MODE_FEATURE_KMS 1 70d722e3fbSopenharmony_ci#define DRM_MODE_FEATURE_DIRTYFB 1 71d722e3fbSopenharmony_ci 72d722e3fbSopenharmony_ci 73d722e3fbSopenharmony_citypedef struct _drmModeRes { 74d722e3fbSopenharmony_ci 75d722e3fbSopenharmony_ci int count_fbs; 76d722e3fbSopenharmony_ci uint32_t *fbs; 77d722e3fbSopenharmony_ci 78d722e3fbSopenharmony_ci int count_crtcs; 79d722e3fbSopenharmony_ci uint32_t *crtcs; 80d722e3fbSopenharmony_ci 81d722e3fbSopenharmony_ci int count_connectors; 82d722e3fbSopenharmony_ci uint32_t *connectors; 83d722e3fbSopenharmony_ci 84d722e3fbSopenharmony_ci int count_encoders; 85d722e3fbSopenharmony_ci uint32_t *encoders; 86d722e3fbSopenharmony_ci 87d722e3fbSopenharmony_ci uint32_t min_width, max_width; 88d722e3fbSopenharmony_ci uint32_t min_height, max_height; 89d722e3fbSopenharmony_ci} drmModeRes, *drmModeResPtr; 90d722e3fbSopenharmony_ci 91d722e3fbSopenharmony_citypedef struct _drmModeModeInfo { 92d722e3fbSopenharmony_ci uint32_t clock; 93d722e3fbSopenharmony_ci uint16_t hdisplay, hsync_start, hsync_end, htotal, hskew; 94d722e3fbSopenharmony_ci uint16_t vdisplay, vsync_start, vsync_end, vtotal, vscan; 95d722e3fbSopenharmony_ci 96d722e3fbSopenharmony_ci uint32_t vrefresh; 97d722e3fbSopenharmony_ci 98d722e3fbSopenharmony_ci uint32_t flags; 99d722e3fbSopenharmony_ci uint32_t type; 100d722e3fbSopenharmony_ci char name[DRM_DISPLAY_MODE_LEN]; 101d722e3fbSopenharmony_ci} drmModeModeInfo, *drmModeModeInfoPtr; 102d722e3fbSopenharmony_ci 103d722e3fbSopenharmony_citypedef struct _drmModeFB { 104d722e3fbSopenharmony_ci uint32_t fb_id; 105d722e3fbSopenharmony_ci uint32_t width, height; 106d722e3fbSopenharmony_ci uint32_t pitch; 107d722e3fbSopenharmony_ci uint32_t bpp; 108d722e3fbSopenharmony_ci uint32_t depth; 109d722e3fbSopenharmony_ci /* driver specific handle */ 110d722e3fbSopenharmony_ci uint32_t handle; 111d722e3fbSopenharmony_ci} drmModeFB, *drmModeFBPtr; 112d722e3fbSopenharmony_ci 113d722e3fbSopenharmony_citypedef struct _drmModeFB2 { 114d722e3fbSopenharmony_ci uint32_t fb_id; 115d722e3fbSopenharmony_ci uint32_t width, height; 116d722e3fbSopenharmony_ci uint32_t pixel_format; /* fourcc code from drm_fourcc.h */ 117d722e3fbSopenharmony_ci uint64_t modifier; /* applies to all buffers */ 118d722e3fbSopenharmony_ci uint32_t flags; 119d722e3fbSopenharmony_ci 120d722e3fbSopenharmony_ci /* per-plane GEM handle; may be duplicate entries for multiple planes */ 121d722e3fbSopenharmony_ci uint32_t handles[4]; 122d722e3fbSopenharmony_ci uint32_t pitches[4]; /* bytes */ 123d722e3fbSopenharmony_ci uint32_t offsets[4]; /* bytes */ 124d722e3fbSopenharmony_ci} drmModeFB2, *drmModeFB2Ptr; 125d722e3fbSopenharmony_ci 126d722e3fbSopenharmony_citypedef struct drm_clip_rect drmModeClip, *drmModeClipPtr; 127d722e3fbSopenharmony_ci 128d722e3fbSopenharmony_citypedef struct _drmModePropertyBlob { 129d722e3fbSopenharmony_ci uint32_t id; 130d722e3fbSopenharmony_ci uint32_t length; 131d722e3fbSopenharmony_ci void *data; 132d722e3fbSopenharmony_ci} drmModePropertyBlobRes, *drmModePropertyBlobPtr; 133d722e3fbSopenharmony_ci 134d722e3fbSopenharmony_citypedef struct _drmModeProperty { 135d722e3fbSopenharmony_ci uint32_t prop_id; 136d722e3fbSopenharmony_ci uint32_t flags; 137d722e3fbSopenharmony_ci char name[DRM_PROP_NAME_LEN]; 138d722e3fbSopenharmony_ci int count_values; 139d722e3fbSopenharmony_ci uint64_t *values; /* store the blob lengths */ 140d722e3fbSopenharmony_ci int count_enums; 141d722e3fbSopenharmony_ci struct drm_mode_property_enum *enums; 142d722e3fbSopenharmony_ci int count_blobs; 143d722e3fbSopenharmony_ci uint32_t *blob_ids; /* store the blob IDs */ 144d722e3fbSopenharmony_ci} drmModePropertyRes, *drmModePropertyPtr; 145d722e3fbSopenharmony_ci 146d722e3fbSopenharmony_cistatic inline uint32_t drmModeGetPropertyType(const drmModePropertyRes *prop) 147d722e3fbSopenharmony_ci{ 148d722e3fbSopenharmony_ci return prop->flags & (DRM_MODE_PROP_LEGACY_TYPE | DRM_MODE_PROP_EXTENDED_TYPE); 149d722e3fbSopenharmony_ci} 150d722e3fbSopenharmony_ci 151d722e3fbSopenharmony_cistatic inline int drm_property_type_is(const drmModePropertyPtr property, 152d722e3fbSopenharmony_ci uint32_t type) 153d722e3fbSopenharmony_ci{ 154d722e3fbSopenharmony_ci return drmModeGetPropertyType(property) == type; 155d722e3fbSopenharmony_ci} 156d722e3fbSopenharmony_ci 157d722e3fbSopenharmony_citypedef struct _drmModeCrtc { 158d722e3fbSopenharmony_ci uint32_t crtc_id; 159d722e3fbSopenharmony_ci uint32_t buffer_id; /**< FB id to connect to 0 = disconnect */ 160d722e3fbSopenharmony_ci 161d722e3fbSopenharmony_ci uint32_t x, y; /**< Position on the framebuffer */ 162d722e3fbSopenharmony_ci uint32_t width, height; 163d722e3fbSopenharmony_ci int mode_valid; 164d722e3fbSopenharmony_ci drmModeModeInfo mode; 165d722e3fbSopenharmony_ci 166d722e3fbSopenharmony_ci int gamma_size; /**< Number of gamma stops */ 167d722e3fbSopenharmony_ci 168d722e3fbSopenharmony_ci} drmModeCrtc, *drmModeCrtcPtr; 169d722e3fbSopenharmony_ci 170d722e3fbSopenharmony_citypedef struct _drmModeEncoder { 171d722e3fbSopenharmony_ci uint32_t encoder_id; 172d722e3fbSopenharmony_ci uint32_t encoder_type; 173d722e3fbSopenharmony_ci uint32_t crtc_id; 174d722e3fbSopenharmony_ci uint32_t possible_crtcs; 175d722e3fbSopenharmony_ci uint32_t possible_clones; 176d722e3fbSopenharmony_ci} drmModeEncoder, *drmModeEncoderPtr; 177d722e3fbSopenharmony_ci 178d722e3fbSopenharmony_ci/** 179d722e3fbSopenharmony_ci * Describes the connector status. 180d722e3fbSopenharmony_ci * 181d722e3fbSopenharmony_ci * DRM_MODE_CONNECTED means that the connector has a sink plugged in. 182d722e3fbSopenharmony_ci * DRM_MODE_DISCONNECTED means the contrary. DRM_MODE_UNKNOWNCONNECTION is used 183d722e3fbSopenharmony_ci * when it could be either. 184d722e3fbSopenharmony_ci * 185d722e3fbSopenharmony_ci * User-space should first try to enable DRM_MODE_CONNECTED connectors and 186d722e3fbSopenharmony_ci * ignore other connectors. If there are no DRM_MODE_CONNECTED connectors, 187d722e3fbSopenharmony_ci * user-space should then try to probe and enable DRM_MODE_UNKNOWNCONNECTION 188d722e3fbSopenharmony_ci * connectors. 189d722e3fbSopenharmony_ci */ 190d722e3fbSopenharmony_citypedef enum { 191d722e3fbSopenharmony_ci DRM_MODE_CONNECTED = 1, 192d722e3fbSopenharmony_ci DRM_MODE_DISCONNECTED = 2, 193d722e3fbSopenharmony_ci DRM_MODE_UNKNOWNCONNECTION = 3 194d722e3fbSopenharmony_ci} drmModeConnection; 195d722e3fbSopenharmony_ci 196d722e3fbSopenharmony_citypedef enum { 197d722e3fbSopenharmony_ci DRM_MODE_SUBPIXEL_UNKNOWN = 1, 198d722e3fbSopenharmony_ci DRM_MODE_SUBPIXEL_HORIZONTAL_RGB = 2, 199d722e3fbSopenharmony_ci DRM_MODE_SUBPIXEL_HORIZONTAL_BGR = 3, 200d722e3fbSopenharmony_ci DRM_MODE_SUBPIXEL_VERTICAL_RGB = 4, 201d722e3fbSopenharmony_ci DRM_MODE_SUBPIXEL_VERTICAL_BGR = 5, 202d722e3fbSopenharmony_ci DRM_MODE_SUBPIXEL_NONE = 6 203d722e3fbSopenharmony_ci} drmModeSubPixel; 204d722e3fbSopenharmony_ci 205d722e3fbSopenharmony_citypedef struct _drmModeConnector { 206d722e3fbSopenharmony_ci uint32_t connector_id; 207d722e3fbSopenharmony_ci uint32_t encoder_id; /**< Encoder currently connected to */ 208d722e3fbSopenharmony_ci uint32_t connector_type; 209d722e3fbSopenharmony_ci uint32_t connector_type_id; 210d722e3fbSopenharmony_ci drmModeConnection connection; 211d722e3fbSopenharmony_ci uint32_t mmWidth, mmHeight; /**< HxW in millimeters */ 212d722e3fbSopenharmony_ci drmModeSubPixel subpixel; 213d722e3fbSopenharmony_ci 214d722e3fbSopenharmony_ci int count_modes; 215d722e3fbSopenharmony_ci drmModeModeInfoPtr modes; 216d722e3fbSopenharmony_ci 217d722e3fbSopenharmony_ci int count_props; 218d722e3fbSopenharmony_ci uint32_t *props; /**< List of property ids */ 219d722e3fbSopenharmony_ci uint64_t *prop_values; /**< List of property values */ 220d722e3fbSopenharmony_ci 221d722e3fbSopenharmony_ci int count_encoders; 222d722e3fbSopenharmony_ci uint32_t *encoders; /**< List of encoder ids */ 223d722e3fbSopenharmony_ci} drmModeConnector, *drmModeConnectorPtr; 224d722e3fbSopenharmony_ci 225d722e3fbSopenharmony_ci#define DRM_PLANE_TYPE_OVERLAY 0 226d722e3fbSopenharmony_ci#define DRM_PLANE_TYPE_PRIMARY 1 227d722e3fbSopenharmony_ci#define DRM_PLANE_TYPE_CURSOR 2 228d722e3fbSopenharmony_ci 229d722e3fbSopenharmony_citypedef struct _drmModeObjectProperties { 230d722e3fbSopenharmony_ci uint32_t count_props; 231d722e3fbSopenharmony_ci uint32_t *props; 232d722e3fbSopenharmony_ci uint64_t *prop_values; 233d722e3fbSopenharmony_ci} drmModeObjectProperties, *drmModeObjectPropertiesPtr; 234d722e3fbSopenharmony_ci 235d722e3fbSopenharmony_citypedef struct _drmModeFormatModifierIterator { 236d722e3fbSopenharmony_ci uint32_t fmt_idx, mod_idx; 237d722e3fbSopenharmony_ci uint32_t fmt; 238d722e3fbSopenharmony_ci uint64_t mod; 239d722e3fbSopenharmony_ci} drmModeFormatModifierIterator; 240d722e3fbSopenharmony_ci 241d722e3fbSopenharmony_citypedef struct _drmModePlane { 242d722e3fbSopenharmony_ci uint32_t count_formats; 243d722e3fbSopenharmony_ci uint32_t *formats; 244d722e3fbSopenharmony_ci uint32_t plane_id; 245d722e3fbSopenharmony_ci 246d722e3fbSopenharmony_ci uint32_t crtc_id; 247d722e3fbSopenharmony_ci uint32_t fb_id; 248d722e3fbSopenharmony_ci 249d722e3fbSopenharmony_ci uint32_t crtc_x, crtc_y; 250d722e3fbSopenharmony_ci uint32_t x, y; 251d722e3fbSopenharmony_ci 252d722e3fbSopenharmony_ci uint32_t possible_crtcs; 253d722e3fbSopenharmony_ci uint32_t gamma_size; 254d722e3fbSopenharmony_ci} drmModePlane, *drmModePlanePtr; 255d722e3fbSopenharmony_ci 256d722e3fbSopenharmony_citypedef struct _drmModePlaneRes { 257d722e3fbSopenharmony_ci uint32_t count_planes; 258d722e3fbSopenharmony_ci uint32_t *planes; 259d722e3fbSopenharmony_ci} drmModePlaneRes, *drmModePlaneResPtr; 260d722e3fbSopenharmony_ci 261d722e3fbSopenharmony_ciextern void drmModeFreeModeInfo( drmModeModeInfoPtr ptr ); 262d722e3fbSopenharmony_ciextern void drmModeFreeResources( drmModeResPtr ptr ); 263d722e3fbSopenharmony_ciextern void drmModeFreeFB( drmModeFBPtr ptr ); 264d722e3fbSopenharmony_ciextern void drmModeFreeFB2( drmModeFB2Ptr ptr ); 265d722e3fbSopenharmony_ciextern void drmModeFreeCrtc( drmModeCrtcPtr ptr ); 266d722e3fbSopenharmony_ciextern void drmModeFreeConnector( drmModeConnectorPtr ptr ); 267d722e3fbSopenharmony_ciextern void drmModeFreeEncoder( drmModeEncoderPtr ptr ); 268d722e3fbSopenharmony_ciextern void drmModeFreePlane( drmModePlanePtr ptr ); 269d722e3fbSopenharmony_ciextern void drmModeFreePlaneResources(drmModePlaneResPtr ptr); 270d722e3fbSopenharmony_ci 271d722e3fbSopenharmony_ci/** 272d722e3fbSopenharmony_ci * Check whether the DRM node supports Kernel Mode-Setting. 273d722e3fbSopenharmony_ci * 274d722e3fbSopenharmony_ci * Returns 1 if suitable for KMS, 0 otherwise. 275d722e3fbSopenharmony_ci */ 276d722e3fbSopenharmony_ciextern int drmIsKMS(int fd); 277d722e3fbSopenharmony_ci 278d722e3fbSopenharmony_ci/** 279d722e3fbSopenharmony_ci * Retrieves all of the resources associated with a card. 280d722e3fbSopenharmony_ci */ 281d722e3fbSopenharmony_ciextern drmModeResPtr drmModeGetResources(int fd); 282d722e3fbSopenharmony_ci 283d722e3fbSopenharmony_ci/* 284d722e3fbSopenharmony_ci * FrameBuffer manipulation. 285d722e3fbSopenharmony_ci */ 286d722e3fbSopenharmony_ci 287d722e3fbSopenharmony_ci/** 288d722e3fbSopenharmony_ci * Retrieve information about framebuffer bufferId 289d722e3fbSopenharmony_ci */ 290d722e3fbSopenharmony_ciextern drmModeFBPtr drmModeGetFB(int fd, uint32_t bufferId); 291d722e3fbSopenharmony_ciextern drmModeFB2Ptr drmModeGetFB2(int fd, uint32_t bufferId); 292d722e3fbSopenharmony_ci 293d722e3fbSopenharmony_ci/** 294d722e3fbSopenharmony_ci * Creates a new framebuffer with an buffer object as its scanout buffer. 295d722e3fbSopenharmony_ci */ 296d722e3fbSopenharmony_ciextern int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth, 297d722e3fbSopenharmony_ci uint8_t bpp, uint32_t pitch, uint32_t bo_handle, 298d722e3fbSopenharmony_ci uint32_t *buf_id); 299d722e3fbSopenharmony_ci/* ...with a specific pixel format */ 300d722e3fbSopenharmony_ciextern int drmModeAddFB2(int fd, uint32_t width, uint32_t height, 301d722e3fbSopenharmony_ci uint32_t pixel_format, const uint32_t bo_handles[4], 302d722e3fbSopenharmony_ci const uint32_t pitches[4], const uint32_t offsets[4], 303d722e3fbSopenharmony_ci uint32_t *buf_id, uint32_t flags); 304d722e3fbSopenharmony_ci 305d722e3fbSopenharmony_ci/* ...with format modifiers */ 306d722e3fbSopenharmony_ciint drmModeAddFB2WithModifiers(int fd, uint32_t width, uint32_t height, 307d722e3fbSopenharmony_ci uint32_t pixel_format, const uint32_t bo_handles[4], 308d722e3fbSopenharmony_ci const uint32_t pitches[4], const uint32_t offsets[4], 309d722e3fbSopenharmony_ci const uint64_t modifier[4], uint32_t *buf_id, 310d722e3fbSopenharmony_ci uint32_t flags); 311d722e3fbSopenharmony_ci 312d722e3fbSopenharmony_ci/** 313d722e3fbSopenharmony_ci * Destroies the given framebuffer. 314d722e3fbSopenharmony_ci */ 315d722e3fbSopenharmony_ciextern int drmModeRmFB(int fd, uint32_t bufferId); 316d722e3fbSopenharmony_ci 317d722e3fbSopenharmony_ci/** 318d722e3fbSopenharmony_ci * Mark a region of a framebuffer as dirty. 319d722e3fbSopenharmony_ci */ 320d722e3fbSopenharmony_ciextern int drmModeDirtyFB(int fd, uint32_t bufferId, 321d722e3fbSopenharmony_ci drmModeClipPtr clips, uint32_t num_clips); 322d722e3fbSopenharmony_ci 323d722e3fbSopenharmony_ci 324d722e3fbSopenharmony_ci/* 325d722e3fbSopenharmony_ci * Crtc functions 326d722e3fbSopenharmony_ci */ 327d722e3fbSopenharmony_ci 328d722e3fbSopenharmony_ci/** 329d722e3fbSopenharmony_ci * Retrieve information about the ctrt crtcId 330d722e3fbSopenharmony_ci */ 331d722e3fbSopenharmony_ciextern drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtcId); 332d722e3fbSopenharmony_ci 333d722e3fbSopenharmony_ci/** 334d722e3fbSopenharmony_ci * Set the mode on a crtc crtcId with the given mode modeId. 335d722e3fbSopenharmony_ci */ 336d722e3fbSopenharmony_ciint drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId, 337d722e3fbSopenharmony_ci uint32_t x, uint32_t y, uint32_t *connectors, int count, 338d722e3fbSopenharmony_ci drmModeModeInfoPtr mode); 339d722e3fbSopenharmony_ci 340d722e3fbSopenharmony_ci/* 341d722e3fbSopenharmony_ci * Cursor functions 342d722e3fbSopenharmony_ci */ 343d722e3fbSopenharmony_ci 344d722e3fbSopenharmony_ci/** 345d722e3fbSopenharmony_ci * Set the cursor on crtc 346d722e3fbSopenharmony_ci */ 347d722e3fbSopenharmony_ciint drmModeSetCursor(int fd, uint32_t crtcId, uint32_t bo_handle, uint32_t width, uint32_t height); 348d722e3fbSopenharmony_ci 349d722e3fbSopenharmony_ciint drmModeSetCursor2(int fd, uint32_t crtcId, uint32_t bo_handle, uint32_t width, uint32_t height, int32_t hot_x, int32_t hot_y); 350d722e3fbSopenharmony_ci/** 351d722e3fbSopenharmony_ci * Move the cursor on crtc 352d722e3fbSopenharmony_ci */ 353d722e3fbSopenharmony_ciint drmModeMoveCursor(int fd, uint32_t crtcId, int x, int y); 354d722e3fbSopenharmony_ci 355d722e3fbSopenharmony_ci/** 356d722e3fbSopenharmony_ci * Encoder functions 357d722e3fbSopenharmony_ci */ 358d722e3fbSopenharmony_cidrmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id); 359d722e3fbSopenharmony_ci 360d722e3fbSopenharmony_ci/* 361d722e3fbSopenharmony_ci * Connector manipulation 362d722e3fbSopenharmony_ci */ 363d722e3fbSopenharmony_ci 364d722e3fbSopenharmony_ci/** 365d722e3fbSopenharmony_ci * Retrieve all information about the connector connectorId. This will do a 366d722e3fbSopenharmony_ci * forced probe on the connector to retrieve remote information such as EDIDs 367d722e3fbSopenharmony_ci * from the display device. 368d722e3fbSopenharmony_ci */ 369d722e3fbSopenharmony_ciextern drmModeConnectorPtr drmModeGetConnector(int fd, 370d722e3fbSopenharmony_ci uint32_t connectorId); 371d722e3fbSopenharmony_ci 372d722e3fbSopenharmony_ci/** 373d722e3fbSopenharmony_ci * Retrieve current information, i.e the currently active mode and encoder, 374d722e3fbSopenharmony_ci * about the connector connectorId. This will not do any probing on the 375d722e3fbSopenharmony_ci * connector or remote device, and only reports what is currently known. 376d722e3fbSopenharmony_ci * For the complete set of modes and encoders associated with the connector 377d722e3fbSopenharmony_ci * use drmModeGetConnector() which will do a probe to determine any display 378d722e3fbSopenharmony_ci * link changes first. 379d722e3fbSopenharmony_ci */ 380d722e3fbSopenharmony_ciextern drmModeConnectorPtr drmModeGetConnectorCurrent(int fd, 381d722e3fbSopenharmony_ci uint32_t connector_id); 382d722e3fbSopenharmony_ci 383d722e3fbSopenharmony_ci/** 384d722e3fbSopenharmony_ci * Attaches the given mode to an connector. 385d722e3fbSopenharmony_ci */ 386d722e3fbSopenharmony_ciextern int drmModeAttachMode(int fd, uint32_t connectorId, drmModeModeInfoPtr mode_info); 387d722e3fbSopenharmony_ci 388d722e3fbSopenharmony_ci/** 389d722e3fbSopenharmony_ci * Detaches a mode from the connector 390d722e3fbSopenharmony_ci * must be unused, by the given mode. 391d722e3fbSopenharmony_ci */ 392d722e3fbSopenharmony_ciextern int drmModeDetachMode(int fd, uint32_t connectorId, drmModeModeInfoPtr mode_info); 393d722e3fbSopenharmony_ci 394d722e3fbSopenharmony_ciextern drmModePropertyPtr drmModeGetProperty(int fd, uint32_t propertyId); 395d722e3fbSopenharmony_ciextern void drmModeFreeProperty(drmModePropertyPtr ptr); 396d722e3fbSopenharmony_ci 397d722e3fbSopenharmony_ciextern drmModePropertyBlobPtr drmModeGetPropertyBlob(int fd, uint32_t blob_id); 398d722e3fbSopenharmony_ciextern bool drmModeFormatModifierBlobIterNext(const drmModePropertyBlobRes *blob, 399d722e3fbSopenharmony_ci drmModeFormatModifierIterator *iter); 400d722e3fbSopenharmony_ciextern void drmModeFreePropertyBlob(drmModePropertyBlobPtr ptr); 401d722e3fbSopenharmony_ciextern int drmModeConnectorSetProperty(int fd, uint32_t connector_id, uint32_t property_id, 402d722e3fbSopenharmony_ci uint64_t value); 403d722e3fbSopenharmony_ciextern int drmCheckModesettingSupported(const char *busid); 404d722e3fbSopenharmony_ci 405d722e3fbSopenharmony_ciextern int drmModeCrtcSetGamma(int fd, uint32_t crtc_id, uint32_t size, 406d722e3fbSopenharmony_ci uint16_t *red, uint16_t *green, uint16_t *blue); 407d722e3fbSopenharmony_ciextern int drmModeCrtcGetGamma(int fd, uint32_t crtc_id, uint32_t size, 408d722e3fbSopenharmony_ci uint16_t *red, uint16_t *green, uint16_t *blue); 409d722e3fbSopenharmony_ciextern int drmModePageFlip(int fd, uint32_t crtc_id, uint32_t fb_id, 410d722e3fbSopenharmony_ci uint32_t flags, void *user_data); 411d722e3fbSopenharmony_ciextern int drmModePageFlipTarget(int fd, uint32_t crtc_id, uint32_t fb_id, 412d722e3fbSopenharmony_ci uint32_t flags, void *user_data, 413d722e3fbSopenharmony_ci uint32_t target_vblank); 414d722e3fbSopenharmony_ci 415d722e3fbSopenharmony_ciextern drmModePlaneResPtr drmModeGetPlaneResources(int fd); 416d722e3fbSopenharmony_ciextern drmModePlanePtr drmModeGetPlane(int fd, uint32_t plane_id); 417d722e3fbSopenharmony_ciextern int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t crtc_id, 418d722e3fbSopenharmony_ci uint32_t fb_id, uint32_t flags, 419d722e3fbSopenharmony_ci int32_t crtc_x, int32_t crtc_y, 420d722e3fbSopenharmony_ci uint32_t crtc_w, uint32_t crtc_h, 421d722e3fbSopenharmony_ci uint32_t src_x, uint32_t src_y, 422d722e3fbSopenharmony_ci uint32_t src_w, uint32_t src_h); 423d722e3fbSopenharmony_ci 424d722e3fbSopenharmony_ciextern drmModeObjectPropertiesPtr drmModeObjectGetProperties(int fd, 425d722e3fbSopenharmony_ci uint32_t object_id, 426d722e3fbSopenharmony_ci uint32_t object_type); 427d722e3fbSopenharmony_ciextern void drmModeFreeObjectProperties(drmModeObjectPropertiesPtr ptr); 428d722e3fbSopenharmony_ciextern int drmModeObjectSetProperty(int fd, uint32_t object_id, 429d722e3fbSopenharmony_ci uint32_t object_type, uint32_t property_id, 430d722e3fbSopenharmony_ci uint64_t value); 431d722e3fbSopenharmony_ci 432d722e3fbSopenharmony_ci 433d722e3fbSopenharmony_citypedef struct _drmModeAtomicReq drmModeAtomicReq, *drmModeAtomicReqPtr; 434d722e3fbSopenharmony_ci 435d722e3fbSopenharmony_ciextern drmModeAtomicReqPtr drmModeAtomicAlloc(void); 436d722e3fbSopenharmony_ciextern drmModeAtomicReqPtr drmModeAtomicDuplicate(drmModeAtomicReqPtr req); 437d722e3fbSopenharmony_ciextern int drmModeAtomicMerge(drmModeAtomicReqPtr base, 438d722e3fbSopenharmony_ci drmModeAtomicReqPtr augment); 439d722e3fbSopenharmony_ciextern void drmModeAtomicFree(drmModeAtomicReqPtr req); 440d722e3fbSopenharmony_ciextern int drmModeAtomicGetCursor(drmModeAtomicReqPtr req); 441d722e3fbSopenharmony_ciextern void drmModeAtomicSetCursor(drmModeAtomicReqPtr req, int cursor); 442d722e3fbSopenharmony_ciextern int drmModeAtomicAddProperty(drmModeAtomicReqPtr req, 443d722e3fbSopenharmony_ci uint32_t object_id, 444d722e3fbSopenharmony_ci uint32_t property_id, 445d722e3fbSopenharmony_ci uint64_t value); 446d722e3fbSopenharmony_ciextern int drmModeAtomicCommit(int fd, 447d722e3fbSopenharmony_ci drmModeAtomicReqPtr req, 448d722e3fbSopenharmony_ci uint32_t flags, 449d722e3fbSopenharmony_ci void *user_data); 450d722e3fbSopenharmony_ci 451d722e3fbSopenharmony_ciextern int drmModeCreatePropertyBlob(int fd, const void *data, size_t size, 452d722e3fbSopenharmony_ci uint32_t *id); 453d722e3fbSopenharmony_ciextern int drmModeDestroyPropertyBlob(int fd, uint32_t id); 454d722e3fbSopenharmony_ci 455d722e3fbSopenharmony_ci/* 456d722e3fbSopenharmony_ci * DRM mode lease APIs. These create and manage new drm_masters with 457d722e3fbSopenharmony_ci * access to a subset of the available DRM resources 458d722e3fbSopenharmony_ci */ 459d722e3fbSopenharmony_ci 460d722e3fbSopenharmony_ciextern int drmModeCreateLease(int fd, const uint32_t *objects, int num_objects, int flags, uint32_t *lessee_id); 461d722e3fbSopenharmony_ci 462d722e3fbSopenharmony_citypedef struct drmModeLesseeList { 463d722e3fbSopenharmony_ci uint32_t count; 464d722e3fbSopenharmony_ci uint32_t lessees[]; 465d722e3fbSopenharmony_ci} drmModeLesseeListRes, *drmModeLesseeListPtr; 466d722e3fbSopenharmony_ci 467d722e3fbSopenharmony_ciextern drmModeLesseeListPtr drmModeListLessees(int fd); 468d722e3fbSopenharmony_ci 469d722e3fbSopenharmony_citypedef struct drmModeObjectList { 470d722e3fbSopenharmony_ci uint32_t count; 471d722e3fbSopenharmony_ci uint32_t objects[]; 472d722e3fbSopenharmony_ci} drmModeObjectListRes, *drmModeObjectListPtr; 473d722e3fbSopenharmony_ci 474d722e3fbSopenharmony_ciextern drmModeObjectListPtr drmModeGetLease(int fd); 475d722e3fbSopenharmony_ci 476d722e3fbSopenharmony_ciextern int drmModeRevokeLease(int fd, uint32_t lessee_id); 477d722e3fbSopenharmony_ci 478d722e3fbSopenharmony_ci#if defined(__cplusplus) 479d722e3fbSopenharmony_ci} 480d722e3fbSopenharmony_ci#endif 481d722e3fbSopenharmony_ci 482d722e3fbSopenharmony_ci#endif 483