1d722e3fbSopenharmony_ci/** 2d722e3fbSopenharmony_ci * \file xf86drm.h 3d722e3fbSopenharmony_ci * OS-independent header for DRM user-level library interface. 4d722e3fbSopenharmony_ci * 5d722e3fbSopenharmony_ci * \author Rickard E. (Rik) Faith <faith@valinux.com> 6d722e3fbSopenharmony_ci */ 7d722e3fbSopenharmony_ci 8d722e3fbSopenharmony_ci/* 9d722e3fbSopenharmony_ci * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. 10d722e3fbSopenharmony_ci * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 11d722e3fbSopenharmony_ci * All Rights Reserved. 12d722e3fbSopenharmony_ci * 13d722e3fbSopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 14d722e3fbSopenharmony_ci * copy of this software and associated documentation files (the "Software"), 15d722e3fbSopenharmony_ci * to deal in the Software without restriction, including without limitation 16d722e3fbSopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 17d722e3fbSopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 18d722e3fbSopenharmony_ci * Software is furnished to do so, subject to the following conditions: 19d722e3fbSopenharmony_ci * 20d722e3fbSopenharmony_ci * The above copyright notice and this permission notice (including the next 21d722e3fbSopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 22d722e3fbSopenharmony_ci * Software. 23d722e3fbSopenharmony_ci * 24d722e3fbSopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25d722e3fbSopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26d722e3fbSopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 27d722e3fbSopenharmony_ci * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 28d722e3fbSopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 29d722e3fbSopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 30d722e3fbSopenharmony_ci * DEALINGS IN THE SOFTWARE. 31d722e3fbSopenharmony_ci * 32d722e3fbSopenharmony_ci */ 33d722e3fbSopenharmony_ci 34d722e3fbSopenharmony_ci#ifndef _XF86DRM_H_ 35d722e3fbSopenharmony_ci#define _XF86DRM_H_ 36d722e3fbSopenharmony_ci 37d722e3fbSopenharmony_ci#include <stdarg.h> 38d722e3fbSopenharmony_ci#include <sys/types.h> 39d722e3fbSopenharmony_ci#include <stdint.h> 40d722e3fbSopenharmony_ci#include <drm.h> 41d722e3fbSopenharmony_ci 42d722e3fbSopenharmony_ci#if defined(__cplusplus) 43d722e3fbSopenharmony_ciextern "C" { 44d722e3fbSopenharmony_ci#endif 45d722e3fbSopenharmony_ci 46d722e3fbSopenharmony_ci#ifndef DRM_MAX_MINOR 47d722e3fbSopenharmony_ci#define DRM_MAX_MINOR 16 48d722e3fbSopenharmony_ci#endif 49d722e3fbSopenharmony_ci 50d722e3fbSopenharmony_ci#if defined(__linux__) 51d722e3fbSopenharmony_ci 52d722e3fbSopenharmony_ci#define DRM_IOCTL_NR(n) _IOC_NR(n) 53d722e3fbSopenharmony_ci#define DRM_IOC_VOID _IOC_NONE 54d722e3fbSopenharmony_ci#define DRM_IOC_READ _IOC_READ 55d722e3fbSopenharmony_ci#define DRM_IOC_WRITE _IOC_WRITE 56d722e3fbSopenharmony_ci#define DRM_IOC_READWRITE _IOC_READ|_IOC_WRITE 57d722e3fbSopenharmony_ci#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size) 58d722e3fbSopenharmony_ci 59d722e3fbSopenharmony_ci#else /* One of the *BSDs */ 60d722e3fbSopenharmony_ci 61d722e3fbSopenharmony_ci#include <sys/ioccom.h> 62d722e3fbSopenharmony_ci#define DRM_IOCTL_NR(n) ((n) & 0xff) 63d722e3fbSopenharmony_ci#define DRM_IOC_VOID IOC_VOID 64d722e3fbSopenharmony_ci#define DRM_IOC_READ IOC_OUT 65d722e3fbSopenharmony_ci#define DRM_IOC_WRITE IOC_IN 66d722e3fbSopenharmony_ci#define DRM_IOC_READWRITE IOC_INOUT 67d722e3fbSopenharmony_ci#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size) 68d722e3fbSopenharmony_ci 69d722e3fbSopenharmony_ci#endif 70d722e3fbSopenharmony_ci 71d722e3fbSopenharmony_ci /* Defaults, if nothing set in xf86config */ 72d722e3fbSopenharmony_ci#define DRM_DEV_UID 0 73d722e3fbSopenharmony_ci#define DRM_DEV_GID 0 74d722e3fbSopenharmony_ci/* Default /dev/dri directory permissions 0755 */ 75d722e3fbSopenharmony_ci#define DRM_DEV_DIRMODE \ 76d722e3fbSopenharmony_ci (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH) 77d722e3fbSopenharmony_ci#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) 78d722e3fbSopenharmony_ci 79d722e3fbSopenharmony_ci#ifdef __OpenBSD__ 80d722e3fbSopenharmony_ci#define DRM_DIR_NAME "/dev" 81d722e3fbSopenharmony_ci#define DRM_PRIMARY_MINOR_NAME "drm" 82d722e3fbSopenharmony_ci#define DRM_CONTROL_MINOR_NAME "drmC" 83d722e3fbSopenharmony_ci#define DRM_RENDER_MINOR_NAME "drmR" 84d722e3fbSopenharmony_ci#else 85d722e3fbSopenharmony_ci#define DRM_DIR_NAME "/dev/dri" 86d722e3fbSopenharmony_ci#define DRM_PRIMARY_MINOR_NAME "card" 87d722e3fbSopenharmony_ci#define DRM_CONTROL_MINOR_NAME "controlD" 88d722e3fbSopenharmony_ci#define DRM_RENDER_MINOR_NAME "renderD" 89d722e3fbSopenharmony_ci#define DRM_PROC_NAME "/proc/dri/" /* For backward Linux compatibility */ 90d722e3fbSopenharmony_ci#endif 91d722e3fbSopenharmony_ci 92d722e3fbSopenharmony_ci#define DRM_DEV_NAME "%s/" DRM_PRIMARY_MINOR_NAME "%d" 93d722e3fbSopenharmony_ci#define DRM_CONTROL_DEV_NAME "%s/" DRM_CONTROL_MINOR_NAME "%d" 94d722e3fbSopenharmony_ci#define DRM_RENDER_DEV_NAME "%s/" DRM_RENDER_MINOR_NAME "%d" 95d722e3fbSopenharmony_ci 96d722e3fbSopenharmony_ci#define DRM_NODE_NAME_MAX \ 97d722e3fbSopenharmony_ci (sizeof(DRM_DIR_NAME) + 1 /* slash */ \ 98d722e3fbSopenharmony_ci + MAX3(sizeof(DRM_PRIMARY_MINOR_NAME), \ 99d722e3fbSopenharmony_ci sizeof(DRM_CONTROL_MINOR_NAME), \ 100d722e3fbSopenharmony_ci sizeof(DRM_RENDER_MINOR_NAME)) \ 101d722e3fbSopenharmony_ci + sizeof("144") /* highest possible node number */ \ 102d722e3fbSopenharmony_ci + 1) /* NULL-terminator */ 103d722e3fbSopenharmony_ci 104d722e3fbSopenharmony_ci#define DRM_ERR_NO_DEVICE (-1001) 105d722e3fbSopenharmony_ci#define DRM_ERR_NO_ACCESS (-1002) 106d722e3fbSopenharmony_ci#define DRM_ERR_NOT_ROOT (-1003) 107d722e3fbSopenharmony_ci#define DRM_ERR_INVALID (-1004) 108d722e3fbSopenharmony_ci#define DRM_ERR_NO_FD (-1005) 109d722e3fbSopenharmony_ci 110d722e3fbSopenharmony_ci#define DRM_AGP_NO_HANDLE 0 111d722e3fbSopenharmony_ci 112d722e3fbSopenharmony_citypedef unsigned int drmSize, *drmSizePtr; /**< For mapped regions */ 113d722e3fbSopenharmony_citypedef void *drmAddress, **drmAddressPtr; /**< For mapped regions */ 114d722e3fbSopenharmony_ci 115d722e3fbSopenharmony_ci#if (__GNUC__ >= 3) 116d722e3fbSopenharmony_ci#define DRM_PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a))) 117d722e3fbSopenharmony_ci#else 118d722e3fbSopenharmony_ci#define DRM_PRINTFLIKE(f, a) 119d722e3fbSopenharmony_ci#endif 120d722e3fbSopenharmony_ci 121d722e3fbSopenharmony_citypedef struct _drmServerInfo { 122d722e3fbSopenharmony_ci int (*debug_print)(const char *format, va_list ap) DRM_PRINTFLIKE(1,0); 123d722e3fbSopenharmony_ci int (*load_module)(const char *name); 124d722e3fbSopenharmony_ci void (*get_perms)(gid_t *, mode_t *); 125d722e3fbSopenharmony_ci} drmServerInfo, *drmServerInfoPtr; 126d722e3fbSopenharmony_ci 127d722e3fbSopenharmony_citypedef struct drmHashEntry { 128d722e3fbSopenharmony_ci int fd; 129d722e3fbSopenharmony_ci void (*f)(int, void *, void *); 130d722e3fbSopenharmony_ci void *tagTable; 131d722e3fbSopenharmony_ci} drmHashEntry; 132d722e3fbSopenharmony_ci 133d722e3fbSopenharmony_ciextern int drmIoctl(int fd, unsigned long request, void *arg); 134d722e3fbSopenharmony_ciextern void *drmGetHashTable(void); 135d722e3fbSopenharmony_ciextern drmHashEntry *drmGetEntry(int fd); 136d722e3fbSopenharmony_ci 137d722e3fbSopenharmony_ci/** 138d722e3fbSopenharmony_ci * Driver version information. 139d722e3fbSopenharmony_ci * 140d722e3fbSopenharmony_ci * \sa drmGetVersion() and drmSetVersion(). 141d722e3fbSopenharmony_ci */ 142d722e3fbSopenharmony_citypedef struct _drmVersion { 143d722e3fbSopenharmony_ci int version_major; /**< Major version */ 144d722e3fbSopenharmony_ci int version_minor; /**< Minor version */ 145d722e3fbSopenharmony_ci int version_patchlevel; /**< Patch level */ 146d722e3fbSopenharmony_ci int name_len; /**< Length of name buffer */ 147d722e3fbSopenharmony_ci char *name; /**< Name of driver */ 148d722e3fbSopenharmony_ci int date_len; /**< Length of date buffer */ 149d722e3fbSopenharmony_ci char *date; /**< User-space buffer to hold date */ 150d722e3fbSopenharmony_ci int desc_len; /**< Length of desc buffer */ 151d722e3fbSopenharmony_ci char *desc; /**< User-space buffer to hold desc */ 152d722e3fbSopenharmony_ci} drmVersion, *drmVersionPtr; 153d722e3fbSopenharmony_ci 154d722e3fbSopenharmony_citypedef struct _drmStats { 155d722e3fbSopenharmony_ci unsigned long count; /**< Number of data */ 156d722e3fbSopenharmony_ci struct { 157d722e3fbSopenharmony_ci unsigned long value; /**< Value from kernel */ 158d722e3fbSopenharmony_ci const char *long_format; /**< Suggested format for long_name */ 159d722e3fbSopenharmony_ci const char *long_name; /**< Long name for value */ 160d722e3fbSopenharmony_ci const char *rate_format; /**< Suggested format for rate_name */ 161d722e3fbSopenharmony_ci const char *rate_name; /**< Short name for value per second */ 162d722e3fbSopenharmony_ci int isvalue; /**< True if value (vs. counter) */ 163d722e3fbSopenharmony_ci const char *mult_names; /**< Multiplier names (e.g., "KGM") */ 164d722e3fbSopenharmony_ci int mult; /**< Multiplier value (e.g., 1024) */ 165d722e3fbSopenharmony_ci int verbose; /**< Suggest only in verbose output */ 166d722e3fbSopenharmony_ci } data[15]; 167d722e3fbSopenharmony_ci} drmStatsT; 168d722e3fbSopenharmony_ci 169d722e3fbSopenharmony_ci 170d722e3fbSopenharmony_ci /* All of these enums *MUST* match with the 171d722e3fbSopenharmony_ci kernel implementation -- so do *NOT* 172d722e3fbSopenharmony_ci change them! (The drmlib implementation 173d722e3fbSopenharmony_ci will just copy the flags instead of 174d722e3fbSopenharmony_ci translating them.) */ 175d722e3fbSopenharmony_citypedef enum { 176d722e3fbSopenharmony_ci DRM_FRAME_BUFFER = 0, /**< WC, no caching, no core dump */ 177d722e3fbSopenharmony_ci DRM_REGISTERS = 1, /**< no caching, no core dump */ 178d722e3fbSopenharmony_ci DRM_SHM = 2, /**< shared, cached */ 179d722e3fbSopenharmony_ci DRM_AGP = 3, /**< AGP/GART */ 180d722e3fbSopenharmony_ci DRM_SCATTER_GATHER = 4, /**< PCI scatter/gather */ 181d722e3fbSopenharmony_ci DRM_CONSISTENT = 5 /**< PCI consistent */ 182d722e3fbSopenharmony_ci} drmMapType; 183d722e3fbSopenharmony_ci 184d722e3fbSopenharmony_citypedef enum { 185d722e3fbSopenharmony_ci DRM_RESTRICTED = 0x0001, /**< Cannot be mapped to client-virtual */ 186d722e3fbSopenharmony_ci DRM_READ_ONLY = 0x0002, /**< Read-only in client-virtual */ 187d722e3fbSopenharmony_ci DRM_LOCKED = 0x0004, /**< Physical pages locked */ 188d722e3fbSopenharmony_ci DRM_KERNEL = 0x0008, /**< Kernel requires access */ 189d722e3fbSopenharmony_ci DRM_WRITE_COMBINING = 0x0010, /**< Use write-combining, if available */ 190d722e3fbSopenharmony_ci DRM_CONTAINS_LOCK = 0x0020, /**< SHM page that contains lock */ 191d722e3fbSopenharmony_ci DRM_REMOVABLE = 0x0040 /**< Removable mapping */ 192d722e3fbSopenharmony_ci} drmMapFlags; 193d722e3fbSopenharmony_ci 194d722e3fbSopenharmony_ci/** 195d722e3fbSopenharmony_ci * \warning These values *MUST* match drm.h 196d722e3fbSopenharmony_ci */ 197d722e3fbSopenharmony_citypedef enum { 198d722e3fbSopenharmony_ci /** \name Flags for DMA buffer dispatch */ 199d722e3fbSopenharmony_ci /*@{*/ 200d722e3fbSopenharmony_ci DRM_DMA_BLOCK = 0x01, /**< 201d722e3fbSopenharmony_ci * Block until buffer dispatched. 202d722e3fbSopenharmony_ci * 203d722e3fbSopenharmony_ci * \note the buffer may not yet have been 204d722e3fbSopenharmony_ci * processed by the hardware -- getting a 205d722e3fbSopenharmony_ci * hardware lock with the hardware quiescent 206d722e3fbSopenharmony_ci * will ensure that the buffer has been 207d722e3fbSopenharmony_ci * processed. 208d722e3fbSopenharmony_ci */ 209d722e3fbSopenharmony_ci DRM_DMA_WHILE_LOCKED = 0x02, /**< Dispatch while lock held */ 210d722e3fbSopenharmony_ci DRM_DMA_PRIORITY = 0x04, /**< High priority dispatch */ 211d722e3fbSopenharmony_ci /*@}*/ 212d722e3fbSopenharmony_ci 213d722e3fbSopenharmony_ci /** \name Flags for DMA buffer request */ 214d722e3fbSopenharmony_ci /*@{*/ 215d722e3fbSopenharmony_ci DRM_DMA_WAIT = 0x10, /**< Wait for free buffers */ 216d722e3fbSopenharmony_ci DRM_DMA_SMALLER_OK = 0x20, /**< Smaller-than-requested buffers OK */ 217d722e3fbSopenharmony_ci DRM_DMA_LARGER_OK = 0x40 /**< Larger-than-requested buffers OK */ 218d722e3fbSopenharmony_ci /*@}*/ 219d722e3fbSopenharmony_ci} drmDMAFlags; 220d722e3fbSopenharmony_ci 221d722e3fbSopenharmony_citypedef enum { 222d722e3fbSopenharmony_ci DRM_PAGE_ALIGN = 0x01, 223d722e3fbSopenharmony_ci DRM_AGP_BUFFER = 0x02, 224d722e3fbSopenharmony_ci DRM_SG_BUFFER = 0x04, 225d722e3fbSopenharmony_ci DRM_FB_BUFFER = 0x08, 226d722e3fbSopenharmony_ci DRM_PCI_BUFFER_RO = 0x10 227d722e3fbSopenharmony_ci} drmBufDescFlags; 228d722e3fbSopenharmony_ci 229d722e3fbSopenharmony_citypedef enum { 230d722e3fbSopenharmony_ci DRM_LOCK_READY = 0x01, /**< Wait until hardware is ready for DMA */ 231d722e3fbSopenharmony_ci DRM_LOCK_QUIESCENT = 0x02, /**< Wait until hardware quiescent */ 232d722e3fbSopenharmony_ci DRM_LOCK_FLUSH = 0x04, /**< Flush this context's DMA queue first */ 233d722e3fbSopenharmony_ci DRM_LOCK_FLUSH_ALL = 0x08, /**< Flush all DMA queues first */ 234d722e3fbSopenharmony_ci /* These *HALT* flags aren't supported yet 235d722e3fbSopenharmony_ci -- they will be used to support the 236d722e3fbSopenharmony_ci full-screen DGA-like mode. */ 237d722e3fbSopenharmony_ci DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */ 238d722e3fbSopenharmony_ci DRM_HALT_CUR_QUEUES = 0x20 /**< Halt all current queues */ 239d722e3fbSopenharmony_ci} drmLockFlags; 240d722e3fbSopenharmony_ci 241d722e3fbSopenharmony_citypedef enum { 242d722e3fbSopenharmony_ci DRM_CONTEXT_PRESERVED = 0x01, /**< This context is preserved and 243d722e3fbSopenharmony_ci never swapped. */ 244d722e3fbSopenharmony_ci DRM_CONTEXT_2DONLY = 0x02 /**< This context is for 2D rendering only. */ 245d722e3fbSopenharmony_ci} drm_context_tFlags, *drm_context_tFlagsPtr; 246d722e3fbSopenharmony_ci 247d722e3fbSopenharmony_citypedef struct _drmBufDesc { 248d722e3fbSopenharmony_ci int count; /**< Number of buffers of this size */ 249d722e3fbSopenharmony_ci int size; /**< Size in bytes */ 250d722e3fbSopenharmony_ci int low_mark; /**< Low water mark */ 251d722e3fbSopenharmony_ci int high_mark; /**< High water mark */ 252d722e3fbSopenharmony_ci} drmBufDesc, *drmBufDescPtr; 253d722e3fbSopenharmony_ci 254d722e3fbSopenharmony_citypedef struct _drmBufInfo { 255d722e3fbSopenharmony_ci int count; /**< Number of buffers described in list */ 256d722e3fbSopenharmony_ci drmBufDescPtr list; /**< List of buffer descriptions */ 257d722e3fbSopenharmony_ci} drmBufInfo, *drmBufInfoPtr; 258d722e3fbSopenharmony_ci 259d722e3fbSopenharmony_citypedef struct _drmBuf { 260d722e3fbSopenharmony_ci int idx; /**< Index into the master buffer list */ 261d722e3fbSopenharmony_ci int total; /**< Buffer size */ 262d722e3fbSopenharmony_ci int used; /**< Amount of buffer in use (for DMA) */ 263d722e3fbSopenharmony_ci drmAddress address; /**< Address */ 264d722e3fbSopenharmony_ci} drmBuf, *drmBufPtr; 265d722e3fbSopenharmony_ci 266d722e3fbSopenharmony_ci/** 267d722e3fbSopenharmony_ci * Buffer mapping information. 268d722e3fbSopenharmony_ci * 269d722e3fbSopenharmony_ci * Used by drmMapBufs() and drmUnmapBufs() to store information about the 270d722e3fbSopenharmony_ci * mapped buffers. 271d722e3fbSopenharmony_ci */ 272d722e3fbSopenharmony_citypedef struct _drmBufMap { 273d722e3fbSopenharmony_ci int count; /**< Number of buffers mapped */ 274d722e3fbSopenharmony_ci drmBufPtr list; /**< Buffers */ 275d722e3fbSopenharmony_ci} drmBufMap, *drmBufMapPtr; 276d722e3fbSopenharmony_ci 277d722e3fbSopenharmony_citypedef struct _drmLock { 278d722e3fbSopenharmony_ci volatile unsigned int lock; 279d722e3fbSopenharmony_ci char padding[60]; 280d722e3fbSopenharmony_ci /* This is big enough for most current (and future?) architectures: 281d722e3fbSopenharmony_ci DEC Alpha: 32 bytes 282d722e3fbSopenharmony_ci Intel Merced: ? 283d722e3fbSopenharmony_ci Intel P5/PPro/PII/PIII: 32 bytes 284d722e3fbSopenharmony_ci Intel StrongARM: 32 bytes 285d722e3fbSopenharmony_ci Intel i386/i486: 16 bytes 286d722e3fbSopenharmony_ci MIPS: 32 bytes (?) 287d722e3fbSopenharmony_ci Motorola 68k: 16 bytes 288d722e3fbSopenharmony_ci Motorola PowerPC: 32 bytes 289d722e3fbSopenharmony_ci Sun SPARC: 32 bytes 290d722e3fbSopenharmony_ci */ 291d722e3fbSopenharmony_ci} drmLock, *drmLockPtr; 292d722e3fbSopenharmony_ci 293d722e3fbSopenharmony_ci/** 294d722e3fbSopenharmony_ci * Indices here refer to the offset into 295d722e3fbSopenharmony_ci * list in drmBufInfo 296d722e3fbSopenharmony_ci */ 297d722e3fbSopenharmony_citypedef struct _drmDMAReq { 298d722e3fbSopenharmony_ci drm_context_t context; /**< Context handle */ 299d722e3fbSopenharmony_ci int send_count; /**< Number of buffers to send */ 300d722e3fbSopenharmony_ci int *send_list; /**< List of handles to buffers */ 301d722e3fbSopenharmony_ci int *send_sizes; /**< Lengths of data to send, in bytes */ 302d722e3fbSopenharmony_ci drmDMAFlags flags; /**< Flags */ 303d722e3fbSopenharmony_ci int request_count; /**< Number of buffers requested */ 304d722e3fbSopenharmony_ci int request_size; /**< Desired size of buffers requested */ 305d722e3fbSopenharmony_ci int *request_list; /**< Buffer information */ 306d722e3fbSopenharmony_ci int *request_sizes; /**< Minimum acceptable sizes */ 307d722e3fbSopenharmony_ci int granted_count; /**< Number of buffers granted at this size */ 308d722e3fbSopenharmony_ci} drmDMAReq, *drmDMAReqPtr; 309d722e3fbSopenharmony_ci 310d722e3fbSopenharmony_citypedef struct _drmRegion { 311d722e3fbSopenharmony_ci drm_handle_t handle; 312d722e3fbSopenharmony_ci unsigned int offset; 313d722e3fbSopenharmony_ci drmSize size; 314d722e3fbSopenharmony_ci drmAddress map; 315d722e3fbSopenharmony_ci} drmRegion, *drmRegionPtr; 316d722e3fbSopenharmony_ci 317d722e3fbSopenharmony_citypedef struct _drmTextureRegion { 318d722e3fbSopenharmony_ci unsigned char next; 319d722e3fbSopenharmony_ci unsigned char prev; 320d722e3fbSopenharmony_ci unsigned char in_use; 321d722e3fbSopenharmony_ci unsigned char padding; /**< Explicitly pad this out */ 322d722e3fbSopenharmony_ci unsigned int age; 323d722e3fbSopenharmony_ci} drmTextureRegion, *drmTextureRegionPtr; 324d722e3fbSopenharmony_ci 325d722e3fbSopenharmony_ci 326d722e3fbSopenharmony_citypedef enum { 327d722e3fbSopenharmony_ci DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ 328d722e3fbSopenharmony_ci DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ 329d722e3fbSopenharmony_ci /* bits 1-6 are reserved for high crtcs */ 330d722e3fbSopenharmony_ci DRM_VBLANK_HIGH_CRTC_MASK = 0x0000003e, 331d722e3fbSopenharmony_ci DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */ 332d722e3fbSopenharmony_ci DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ 333d722e3fbSopenharmony_ci DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ 334d722e3fbSopenharmony_ci DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ 335d722e3fbSopenharmony_ci DRM_VBLANK_SIGNAL = 0x40000000 /* Send signal instead of blocking */ 336d722e3fbSopenharmony_ci} drmVBlankSeqType; 337d722e3fbSopenharmony_ci#define DRM_VBLANK_HIGH_CRTC_SHIFT 1 338d722e3fbSopenharmony_ci 339d722e3fbSopenharmony_citypedef struct _drmVBlankReq { 340d722e3fbSopenharmony_ci drmVBlankSeqType type; 341d722e3fbSopenharmony_ci unsigned int sequence; 342d722e3fbSopenharmony_ci unsigned long signal; 343d722e3fbSopenharmony_ci} drmVBlankReq, *drmVBlankReqPtr; 344d722e3fbSopenharmony_ci 345d722e3fbSopenharmony_citypedef struct _drmVBlankReply { 346d722e3fbSopenharmony_ci drmVBlankSeqType type; 347d722e3fbSopenharmony_ci unsigned int sequence; 348d722e3fbSopenharmony_ci long tval_sec; 349d722e3fbSopenharmony_ci long tval_usec; 350d722e3fbSopenharmony_ci} drmVBlankReply, *drmVBlankReplyPtr; 351d722e3fbSopenharmony_ci 352d722e3fbSopenharmony_citypedef union _drmVBlank { 353d722e3fbSopenharmony_ci drmVBlankReq request; 354d722e3fbSopenharmony_ci drmVBlankReply reply; 355d722e3fbSopenharmony_ci} drmVBlank, *drmVBlankPtr; 356d722e3fbSopenharmony_ci 357d722e3fbSopenharmony_citypedef struct _drmSetVersion { 358d722e3fbSopenharmony_ci int drm_di_major; 359d722e3fbSopenharmony_ci int drm_di_minor; 360d722e3fbSopenharmony_ci int drm_dd_major; 361d722e3fbSopenharmony_ci int drm_dd_minor; 362d722e3fbSopenharmony_ci} drmSetVersion, *drmSetVersionPtr; 363d722e3fbSopenharmony_ci 364d722e3fbSopenharmony_ci#define __drm_dummy_lock(lock) (*(__volatile__ unsigned int *)lock) 365d722e3fbSopenharmony_ci 366d722e3fbSopenharmony_ci#define DRM_LOCK_HELD 0x80000000U /**< Hardware lock is held */ 367d722e3fbSopenharmony_ci#define DRM_LOCK_CONT 0x40000000U /**< Hardware lock is contended */ 368d722e3fbSopenharmony_ci 369d722e3fbSopenharmony_ci#if defined(__GNUC__) && (__GNUC__ >= 2) 370d722e3fbSopenharmony_ci# if defined(__i386) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__) 371d722e3fbSopenharmony_ci /* Reflect changes here to drmP.h */ 372d722e3fbSopenharmony_ci#define DRM_CAS(lock,old,new,__ret) \ 373d722e3fbSopenharmony_ci do { \ 374d722e3fbSopenharmony_ci int __dummy; /* Can't mark eax as clobbered */ \ 375d722e3fbSopenharmony_ci __asm__ __volatile__( \ 376d722e3fbSopenharmony_ci "lock ; cmpxchg %4,%1\n\t" \ 377d722e3fbSopenharmony_ci "setnz %0" \ 378d722e3fbSopenharmony_ci : "=d" (__ret), \ 379d722e3fbSopenharmony_ci "=m" (__drm_dummy_lock(lock)), \ 380d722e3fbSopenharmony_ci "=a" (__dummy) \ 381d722e3fbSopenharmony_ci : "2" (old), \ 382d722e3fbSopenharmony_ci "r" (new)); \ 383d722e3fbSopenharmony_ci } while (0) 384d722e3fbSopenharmony_ci 385d722e3fbSopenharmony_ci#elif defined(__alpha__) 386d722e3fbSopenharmony_ci 387d722e3fbSopenharmony_ci#define DRM_CAS(lock, old, new, ret) \ 388d722e3fbSopenharmony_ci do { \ 389d722e3fbSopenharmony_ci int tmp, old32; \ 390d722e3fbSopenharmony_ci __asm__ __volatile__( \ 391d722e3fbSopenharmony_ci " addl $31, %5, %3\n" \ 392d722e3fbSopenharmony_ci "1: ldl_l %0, %2\n" \ 393d722e3fbSopenharmony_ci " cmpeq %0, %3, %1\n" \ 394d722e3fbSopenharmony_ci " beq %1, 2f\n" \ 395d722e3fbSopenharmony_ci " mov %4, %0\n" \ 396d722e3fbSopenharmony_ci " stl_c %0, %2\n" \ 397d722e3fbSopenharmony_ci " beq %0, 3f\n" \ 398d722e3fbSopenharmony_ci " mb\n" \ 399d722e3fbSopenharmony_ci "2: cmpeq %1, 0, %1\n" \ 400d722e3fbSopenharmony_ci ".subsection 2\n" \ 401d722e3fbSopenharmony_ci "3: br 1b\n" \ 402d722e3fbSopenharmony_ci ".previous" \ 403d722e3fbSopenharmony_ci : "=&r"(tmp), "=&r"(ret), \ 404d722e3fbSopenharmony_ci "=m"(__drm_dummy_lock(lock)), \ 405d722e3fbSopenharmony_ci "=&r"(old32) \ 406d722e3fbSopenharmony_ci : "r"(new), "r"(old) \ 407d722e3fbSopenharmony_ci : "memory"); \ 408d722e3fbSopenharmony_ci } while (0) 409d722e3fbSopenharmony_ci 410d722e3fbSopenharmony_ci#elif defined(__sparc__) 411d722e3fbSopenharmony_ci 412d722e3fbSopenharmony_ci#define DRM_CAS(lock,old,new,__ret) \ 413d722e3fbSopenharmony_cido { register unsigned int __old __asm("o0"); \ 414d722e3fbSopenharmony_ci register unsigned int __new __asm("o1"); \ 415d722e3fbSopenharmony_ci register volatile unsigned int *__lock __asm("o2"); \ 416d722e3fbSopenharmony_ci __old = old; \ 417d722e3fbSopenharmony_ci __new = new; \ 418d722e3fbSopenharmony_ci __lock = (volatile unsigned int *)lock; \ 419d722e3fbSopenharmony_ci __asm__ __volatile__( \ 420d722e3fbSopenharmony_ci /*"cas [%2], %3, %0"*/ \ 421d722e3fbSopenharmony_ci ".word 0xd3e29008\n\t" \ 422d722e3fbSopenharmony_ci /*"membar #StoreStore | #StoreLoad"*/ \ 423d722e3fbSopenharmony_ci ".word 0x8143e00a" \ 424d722e3fbSopenharmony_ci : "=&r" (__new) \ 425d722e3fbSopenharmony_ci : "0" (__new), \ 426d722e3fbSopenharmony_ci "r" (__lock), \ 427d722e3fbSopenharmony_ci "r" (__old) \ 428d722e3fbSopenharmony_ci : "memory"); \ 429d722e3fbSopenharmony_ci __ret = (__new != __old); \ 430d722e3fbSopenharmony_ci} while(0) 431d722e3fbSopenharmony_ci 432d722e3fbSopenharmony_ci#elif defined(__ia64__) 433d722e3fbSopenharmony_ci 434d722e3fbSopenharmony_ci#ifdef __INTEL_COMPILER 435d722e3fbSopenharmony_ci/* this currently generates bad code (missing stop bits)... */ 436d722e3fbSopenharmony_ci#include <ia64intrin.h> 437d722e3fbSopenharmony_ci 438d722e3fbSopenharmony_ci#define DRM_CAS(lock,old,new,__ret) \ 439d722e3fbSopenharmony_ci do { \ 440d722e3fbSopenharmony_ci unsigned long __result, __old = (old) & 0xffffffff; \ 441d722e3fbSopenharmony_ci __mf(); \ 442d722e3fbSopenharmony_ci __result = _InterlockedCompareExchange_acq(&__drm_dummy_lock(lock), (new), __old);\ 443d722e3fbSopenharmony_ci __ret = (__result) != (__old); \ 444d722e3fbSopenharmony_ci/* __ret = (__sync_val_compare_and_swap(&__drm_dummy_lock(lock), \ 445d722e3fbSopenharmony_ci (old), (new)) \ 446d722e3fbSopenharmony_ci != (old)); */\ 447d722e3fbSopenharmony_ci } while (0) 448d722e3fbSopenharmony_ci 449d722e3fbSopenharmony_ci#else 450d722e3fbSopenharmony_ci#define DRM_CAS(lock,old,new,__ret) \ 451d722e3fbSopenharmony_ci do { \ 452d722e3fbSopenharmony_ci unsigned int __result, __old = (old); \ 453d722e3fbSopenharmony_ci __asm__ __volatile__( \ 454d722e3fbSopenharmony_ci "mf\n" \ 455d722e3fbSopenharmony_ci "mov ar.ccv=%2\n" \ 456d722e3fbSopenharmony_ci ";;\n" \ 457d722e3fbSopenharmony_ci "cmpxchg4.acq %0=%1,%3,ar.ccv" \ 458d722e3fbSopenharmony_ci : "=r" (__result), "=m" (__drm_dummy_lock(lock)) \ 459d722e3fbSopenharmony_ci : "r" ((unsigned long)__old), "r" (new) \ 460d722e3fbSopenharmony_ci : "memory"); \ 461d722e3fbSopenharmony_ci __ret = (__result) != (__old); \ 462d722e3fbSopenharmony_ci } while (0) 463d722e3fbSopenharmony_ci 464d722e3fbSopenharmony_ci#endif 465d722e3fbSopenharmony_ci 466d722e3fbSopenharmony_ci#elif defined(__powerpc__) 467d722e3fbSopenharmony_ci 468d722e3fbSopenharmony_ci#define DRM_CAS(lock,old,new,__ret) \ 469d722e3fbSopenharmony_ci do { \ 470d722e3fbSopenharmony_ci __asm__ __volatile__( \ 471d722e3fbSopenharmony_ci "sync;" \ 472d722e3fbSopenharmony_ci "0: lwarx %0,0,%1;" \ 473d722e3fbSopenharmony_ci " xor. %0,%3,%0;" \ 474d722e3fbSopenharmony_ci " bne 1f;" \ 475d722e3fbSopenharmony_ci " stwcx. %2,0,%1;" \ 476d722e3fbSopenharmony_ci " bne- 0b;" \ 477d722e3fbSopenharmony_ci "1: " \ 478d722e3fbSopenharmony_ci "sync;" \ 479d722e3fbSopenharmony_ci : "=&r"(__ret) \ 480d722e3fbSopenharmony_ci : "r"(lock), "r"(new), "r"(old) \ 481d722e3fbSopenharmony_ci : "cr0", "memory"); \ 482d722e3fbSopenharmony_ci } while (0) 483d722e3fbSopenharmony_ci 484d722e3fbSopenharmony_ci# elif defined (__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \ 485d722e3fbSopenharmony_ci || defined (__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \ 486d722e3fbSopenharmony_ci || defined (__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) \ 487d722e3fbSopenharmony_ci || defined (__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \ 488d722e3fbSopenharmony_ci || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \ 489d722e3fbSopenharmony_ci || defined(__ARM_ARCH_7EM__) 490d722e3fbSopenharmony_ci /* excluding ARMv4/ARMv5 and lower (lacking ldrex/strex support) */ 491d722e3fbSopenharmony_ci #undef DRM_DEV_MODE 492d722e3fbSopenharmony_ci #define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) 493d722e3fbSopenharmony_ci 494d722e3fbSopenharmony_ci #define DRM_CAS(lock,old,new,__ret) \ 495d722e3fbSopenharmony_ci do { \ 496d722e3fbSopenharmony_ci __asm__ __volatile__ ( \ 497d722e3fbSopenharmony_ci "1: ldrex %0, [%1]\n" \ 498d722e3fbSopenharmony_ci " teq %0, %2\n" \ 499d722e3fbSopenharmony_ci " ite eq\n" \ 500d722e3fbSopenharmony_ci " strexeq %0, %3, [%1]\n" \ 501d722e3fbSopenharmony_ci " movne %0, #1\n" \ 502d722e3fbSopenharmony_ci : "=&r" (__ret) \ 503d722e3fbSopenharmony_ci : "r" (lock), "r" (old), "r" (new) \ 504d722e3fbSopenharmony_ci : "cc","memory"); \ 505d722e3fbSopenharmony_ci } while (0) 506d722e3fbSopenharmony_ci 507d722e3fbSopenharmony_ci#endif /* architecture */ 508d722e3fbSopenharmony_ci#endif /* __GNUC__ >= 2 */ 509d722e3fbSopenharmony_ci 510d722e3fbSopenharmony_ci#ifndef DRM_CAS 511d722e3fbSopenharmony_ci#define DRM_CAS(lock,old,new,ret) do { ret=1; } while (0) /* FAST LOCK FAILS */ 512d722e3fbSopenharmony_ci#endif 513d722e3fbSopenharmony_ci 514d722e3fbSopenharmony_ci#if defined(__alpha__) 515d722e3fbSopenharmony_ci#define DRM_CAS_RESULT(_result) long _result 516d722e3fbSopenharmony_ci#elif defined(__powerpc__) 517d722e3fbSopenharmony_ci#define DRM_CAS_RESULT(_result) int _result 518d722e3fbSopenharmony_ci#else 519d722e3fbSopenharmony_ci#define DRM_CAS_RESULT(_result) char _result 520d722e3fbSopenharmony_ci#endif 521d722e3fbSopenharmony_ci 522d722e3fbSopenharmony_ci#define DRM_LIGHT_LOCK(fd,lock,context) \ 523d722e3fbSopenharmony_ci do { \ 524d722e3fbSopenharmony_ci DRM_CAS_RESULT(__ret); \ 525d722e3fbSopenharmony_ci DRM_CAS(lock,context,DRM_LOCK_HELD|context,__ret); \ 526d722e3fbSopenharmony_ci if (__ret) drmGetLock(fd,context,0); \ 527d722e3fbSopenharmony_ci } while(0) 528d722e3fbSopenharmony_ci 529d722e3fbSopenharmony_ci /* This one counts fast locks -- for 530d722e3fbSopenharmony_ci benchmarking only. */ 531d722e3fbSopenharmony_ci#define DRM_LIGHT_LOCK_COUNT(fd,lock,context,count) \ 532d722e3fbSopenharmony_ci do { \ 533d722e3fbSopenharmony_ci DRM_CAS_RESULT(__ret); \ 534d722e3fbSopenharmony_ci DRM_CAS(lock,context,DRM_LOCK_HELD|context,__ret); \ 535d722e3fbSopenharmony_ci if (__ret) drmGetLock(fd,context,0); \ 536d722e3fbSopenharmony_ci else ++count; \ 537d722e3fbSopenharmony_ci } while(0) 538d722e3fbSopenharmony_ci 539d722e3fbSopenharmony_ci#define DRM_LOCK(fd,lock,context,flags) \ 540d722e3fbSopenharmony_ci do { \ 541d722e3fbSopenharmony_ci if (flags) drmGetLock(fd,context,flags); \ 542d722e3fbSopenharmony_ci else DRM_LIGHT_LOCK(fd,lock,context); \ 543d722e3fbSopenharmony_ci } while(0) 544d722e3fbSopenharmony_ci 545d722e3fbSopenharmony_ci#define DRM_UNLOCK(fd,lock,context) \ 546d722e3fbSopenharmony_ci do { \ 547d722e3fbSopenharmony_ci DRM_CAS_RESULT(__ret); \ 548d722e3fbSopenharmony_ci DRM_CAS(lock,DRM_LOCK_HELD|context,context,__ret); \ 549d722e3fbSopenharmony_ci if (__ret) drmUnlock(fd,context); \ 550d722e3fbSopenharmony_ci } while(0) 551d722e3fbSopenharmony_ci 552d722e3fbSopenharmony_ci /* Simple spin locks */ 553d722e3fbSopenharmony_ci#define DRM_SPINLOCK(spin,val) \ 554d722e3fbSopenharmony_ci do { \ 555d722e3fbSopenharmony_ci DRM_CAS_RESULT(__ret); \ 556d722e3fbSopenharmony_ci do { \ 557d722e3fbSopenharmony_ci DRM_CAS(spin,0,val,__ret); \ 558d722e3fbSopenharmony_ci if (__ret) while ((spin)->lock); \ 559d722e3fbSopenharmony_ci } while (__ret); \ 560d722e3fbSopenharmony_ci } while(0) 561d722e3fbSopenharmony_ci 562d722e3fbSopenharmony_ci#define DRM_SPINLOCK_TAKE(spin,val) \ 563d722e3fbSopenharmony_ci do { \ 564d722e3fbSopenharmony_ci DRM_CAS_RESULT(__ret); \ 565d722e3fbSopenharmony_ci int cur; \ 566d722e3fbSopenharmony_ci do { \ 567d722e3fbSopenharmony_ci cur = (*spin).lock; \ 568d722e3fbSopenharmony_ci DRM_CAS(spin,cur,val,__ret); \ 569d722e3fbSopenharmony_ci } while (__ret); \ 570d722e3fbSopenharmony_ci } while(0) 571d722e3fbSopenharmony_ci 572d722e3fbSopenharmony_ci#define DRM_SPINLOCK_COUNT(spin,val,count,__ret) \ 573d722e3fbSopenharmony_ci do { \ 574d722e3fbSopenharmony_ci int __i; \ 575d722e3fbSopenharmony_ci __ret = 1; \ 576d722e3fbSopenharmony_ci for (__i = 0; __ret && __i < count; __i++) { \ 577d722e3fbSopenharmony_ci DRM_CAS(spin,0,val,__ret); \ 578d722e3fbSopenharmony_ci if (__ret) for (;__i < count && (spin)->lock; __i++); \ 579d722e3fbSopenharmony_ci } \ 580d722e3fbSopenharmony_ci } while(0) 581d722e3fbSopenharmony_ci 582d722e3fbSopenharmony_ci#define DRM_SPINUNLOCK(spin,val) \ 583d722e3fbSopenharmony_ci do { \ 584d722e3fbSopenharmony_ci DRM_CAS_RESULT(__ret); \ 585d722e3fbSopenharmony_ci if ((*spin).lock == val) { /* else server stole lock */ \ 586d722e3fbSopenharmony_ci do { \ 587d722e3fbSopenharmony_ci DRM_CAS(spin,val,0,__ret); \ 588d722e3fbSopenharmony_ci } while (__ret); \ 589d722e3fbSopenharmony_ci } \ 590d722e3fbSopenharmony_ci } while(0) 591d722e3fbSopenharmony_ci 592d722e3fbSopenharmony_ci 593d722e3fbSopenharmony_ci 594d722e3fbSopenharmony_ci/* General user-level programmer's API: unprivileged */ 595d722e3fbSopenharmony_ciextern int drmAvailable(void); 596d722e3fbSopenharmony_ciextern int drmOpen(const char *name, const char *busid); 597d722e3fbSopenharmony_ci 598d722e3fbSopenharmony_ci#define DRM_NODE_PRIMARY 0 599d722e3fbSopenharmony_ci#define DRM_NODE_CONTROL 1 600d722e3fbSopenharmony_ci#define DRM_NODE_RENDER 2 601d722e3fbSopenharmony_ci#define DRM_NODE_MAX 3 602d722e3fbSopenharmony_ci 603d722e3fbSopenharmony_ciextern int drmOpenWithType(const char *name, const char *busid, 604d722e3fbSopenharmony_ci int type); 605d722e3fbSopenharmony_ci 606d722e3fbSopenharmony_ciextern int drmOpenControl(int minor); 607d722e3fbSopenharmony_ciextern int drmOpenRender(int minor); 608d722e3fbSopenharmony_ciextern int drmClose(int fd); 609d722e3fbSopenharmony_ciextern drmVersionPtr drmGetVersion(int fd); 610d722e3fbSopenharmony_ciextern drmVersionPtr drmGetLibVersion(int fd); 611d722e3fbSopenharmony_ciextern int drmGetCap(int fd, uint64_t capability, uint64_t *value); 612d722e3fbSopenharmony_ciextern void drmFreeVersion(drmVersionPtr); 613d722e3fbSopenharmony_ciextern int drmGetMagic(int fd, drm_magic_t * magic); 614d722e3fbSopenharmony_ciextern char *drmGetBusid(int fd); 615d722e3fbSopenharmony_ciextern int drmGetInterruptFromBusID(int fd, int busnum, int devnum, 616d722e3fbSopenharmony_ci int funcnum); 617d722e3fbSopenharmony_ciextern int drmGetMap(int fd, int idx, drm_handle_t *offset, 618d722e3fbSopenharmony_ci drmSize *size, drmMapType *type, 619d722e3fbSopenharmony_ci drmMapFlags *flags, drm_handle_t *handle, 620d722e3fbSopenharmony_ci int *mtrr); 621d722e3fbSopenharmony_ciextern int drmGetClient(int fd, int idx, int *auth, int *pid, 622d722e3fbSopenharmony_ci int *uid, unsigned long *magic, 623d722e3fbSopenharmony_ci unsigned long *iocs); 624d722e3fbSopenharmony_ciextern int drmGetStats(int fd, drmStatsT *stats); 625d722e3fbSopenharmony_ciextern int drmSetInterfaceVersion(int fd, drmSetVersion *version); 626d722e3fbSopenharmony_ciextern int drmCommandNone(int fd, unsigned long drmCommandIndex); 627d722e3fbSopenharmony_ciextern int drmCommandRead(int fd, unsigned long drmCommandIndex, 628d722e3fbSopenharmony_ci void *data, unsigned long size); 629d722e3fbSopenharmony_ciextern int drmCommandWrite(int fd, unsigned long drmCommandIndex, 630d722e3fbSopenharmony_ci void *data, unsigned long size); 631d722e3fbSopenharmony_ciextern int drmCommandWriteRead(int fd, unsigned long drmCommandIndex, 632d722e3fbSopenharmony_ci void *data, unsigned long size); 633d722e3fbSopenharmony_ci 634d722e3fbSopenharmony_ci/* General user-level programmer's API: X server (root) only */ 635d722e3fbSopenharmony_ciextern void drmFreeBusid(const char *busid); 636d722e3fbSopenharmony_ciextern int drmSetBusid(int fd, const char *busid); 637d722e3fbSopenharmony_ciextern int drmAuthMagic(int fd, drm_magic_t magic); 638d722e3fbSopenharmony_ciextern int drmAddMap(int fd, 639d722e3fbSopenharmony_ci drm_handle_t offset, 640d722e3fbSopenharmony_ci drmSize size, 641d722e3fbSopenharmony_ci drmMapType type, 642d722e3fbSopenharmony_ci drmMapFlags flags, 643d722e3fbSopenharmony_ci drm_handle_t * handle); 644d722e3fbSopenharmony_ciextern int drmRmMap(int fd, drm_handle_t handle); 645d722e3fbSopenharmony_ciextern int drmAddContextPrivateMapping(int fd, drm_context_t ctx_id, 646d722e3fbSopenharmony_ci drm_handle_t handle); 647d722e3fbSopenharmony_ci 648d722e3fbSopenharmony_ciextern int drmAddBufs(int fd, int count, int size, 649d722e3fbSopenharmony_ci drmBufDescFlags flags, 650d722e3fbSopenharmony_ci int agp_offset); 651d722e3fbSopenharmony_ciextern int drmMarkBufs(int fd, double low, double high); 652d722e3fbSopenharmony_ciextern int drmCreateContext(int fd, drm_context_t * handle); 653d722e3fbSopenharmony_ciextern int drmSetContextFlags(int fd, drm_context_t context, 654d722e3fbSopenharmony_ci drm_context_tFlags flags); 655d722e3fbSopenharmony_ciextern int drmGetContextFlags(int fd, drm_context_t context, 656d722e3fbSopenharmony_ci drm_context_tFlagsPtr flags); 657d722e3fbSopenharmony_ciextern int drmAddContextTag(int fd, drm_context_t context, void *tag); 658d722e3fbSopenharmony_ciextern int drmDelContextTag(int fd, drm_context_t context); 659d722e3fbSopenharmony_ciextern void *drmGetContextTag(int fd, drm_context_t context); 660d722e3fbSopenharmony_ciextern drm_context_t * drmGetReservedContextList(int fd, int *count); 661d722e3fbSopenharmony_ciextern void drmFreeReservedContextList(drm_context_t *); 662d722e3fbSopenharmony_ciextern int drmSwitchToContext(int fd, drm_context_t context); 663d722e3fbSopenharmony_ciextern int drmDestroyContext(int fd, drm_context_t handle); 664d722e3fbSopenharmony_ciextern int drmCreateDrawable(int fd, drm_drawable_t * handle); 665d722e3fbSopenharmony_ciextern int drmDestroyDrawable(int fd, drm_drawable_t handle); 666d722e3fbSopenharmony_ciextern int drmUpdateDrawableInfo(int fd, drm_drawable_t handle, 667d722e3fbSopenharmony_ci drm_drawable_info_type_t type, 668d722e3fbSopenharmony_ci unsigned int num, void *data); 669d722e3fbSopenharmony_ciextern int drmCtlInstHandler(int fd, int irq); 670d722e3fbSopenharmony_ciextern int drmCtlUninstHandler(int fd); 671d722e3fbSopenharmony_ciextern int drmSetClientCap(int fd, uint64_t capability, 672d722e3fbSopenharmony_ci uint64_t value); 673d722e3fbSopenharmony_ci 674d722e3fbSopenharmony_ciextern int drmCrtcGetSequence(int fd, uint32_t crtcId, 675d722e3fbSopenharmony_ci uint64_t *sequence, uint64_t *ns); 676d722e3fbSopenharmony_ciextern int drmCrtcQueueSequence(int fd, uint32_t crtcId, 677d722e3fbSopenharmony_ci uint32_t flags, uint64_t sequence, 678d722e3fbSopenharmony_ci uint64_t *sequence_queued, 679d722e3fbSopenharmony_ci uint64_t user_data); 680d722e3fbSopenharmony_ci/* General user-level programmer's API: authenticated client and/or X */ 681d722e3fbSopenharmony_ciextern int drmMap(int fd, 682d722e3fbSopenharmony_ci drm_handle_t handle, 683d722e3fbSopenharmony_ci drmSize size, 684d722e3fbSopenharmony_ci drmAddressPtr address); 685d722e3fbSopenharmony_ciextern int drmUnmap(drmAddress address, drmSize size); 686d722e3fbSopenharmony_ciextern drmBufInfoPtr drmGetBufInfo(int fd); 687d722e3fbSopenharmony_ciextern drmBufMapPtr drmMapBufs(int fd); 688d722e3fbSopenharmony_ciextern int drmUnmapBufs(drmBufMapPtr bufs); 689d722e3fbSopenharmony_ciextern int drmDMA(int fd, drmDMAReqPtr request); 690d722e3fbSopenharmony_ciextern int drmFreeBufs(int fd, int count, int *list); 691d722e3fbSopenharmony_ciextern int drmGetLock(int fd, 692d722e3fbSopenharmony_ci drm_context_t context, 693d722e3fbSopenharmony_ci drmLockFlags flags); 694d722e3fbSopenharmony_ciextern int drmUnlock(int fd, drm_context_t context); 695d722e3fbSopenharmony_ciextern int drmFinish(int fd, int context, drmLockFlags flags); 696d722e3fbSopenharmony_ciextern int drmGetContextPrivateMapping(int fd, drm_context_t ctx_id, 697d722e3fbSopenharmony_ci drm_handle_t * handle); 698d722e3fbSopenharmony_ci 699d722e3fbSopenharmony_ci/* AGP/GART support: X server (root) only */ 700d722e3fbSopenharmony_ciextern int drmAgpAcquire(int fd); 701d722e3fbSopenharmony_ciextern int drmAgpRelease(int fd); 702d722e3fbSopenharmony_ciextern int drmAgpEnable(int fd, unsigned long mode); 703d722e3fbSopenharmony_ciextern int drmAgpAlloc(int fd, unsigned long size, 704d722e3fbSopenharmony_ci unsigned long type, unsigned long *address, 705d722e3fbSopenharmony_ci drm_handle_t *handle); 706d722e3fbSopenharmony_ciextern int drmAgpFree(int fd, drm_handle_t handle); 707d722e3fbSopenharmony_ciextern int drmAgpBind(int fd, drm_handle_t handle, 708d722e3fbSopenharmony_ci unsigned long offset); 709d722e3fbSopenharmony_ciextern int drmAgpUnbind(int fd, drm_handle_t handle); 710d722e3fbSopenharmony_ci 711d722e3fbSopenharmony_ci/* AGP/GART info: authenticated client and/or X */ 712d722e3fbSopenharmony_ciextern int drmAgpVersionMajor(int fd); 713d722e3fbSopenharmony_ciextern int drmAgpVersionMinor(int fd); 714d722e3fbSopenharmony_ciextern unsigned long drmAgpGetMode(int fd); 715d722e3fbSopenharmony_ciextern unsigned long drmAgpBase(int fd); /* Physical location */ 716d722e3fbSopenharmony_ciextern unsigned long drmAgpSize(int fd); /* Bytes */ 717d722e3fbSopenharmony_ciextern unsigned long drmAgpMemoryUsed(int fd); 718d722e3fbSopenharmony_ciextern unsigned long drmAgpMemoryAvail(int fd); 719d722e3fbSopenharmony_ciextern unsigned int drmAgpVendorId(int fd); 720d722e3fbSopenharmony_ciextern unsigned int drmAgpDeviceId(int fd); 721d722e3fbSopenharmony_ci 722d722e3fbSopenharmony_ci/* PCI scatter/gather support: X server (root) only */ 723d722e3fbSopenharmony_ciextern int drmScatterGatherAlloc(int fd, unsigned long size, 724d722e3fbSopenharmony_ci drm_handle_t *handle); 725d722e3fbSopenharmony_ciextern int drmScatterGatherFree(int fd, drm_handle_t handle); 726d722e3fbSopenharmony_ci 727d722e3fbSopenharmony_ciextern int drmWaitVBlank(int fd, drmVBlankPtr vbl); 728d722e3fbSopenharmony_ci 729d722e3fbSopenharmony_ci/* Support routines */ 730d722e3fbSopenharmony_ciextern void drmSetServerInfo(drmServerInfoPtr info); 731d722e3fbSopenharmony_ciextern int drmError(int err, const char *label); 732d722e3fbSopenharmony_ciextern void *drmMalloc(int size); 733d722e3fbSopenharmony_ciextern void drmFree(void *pt); 734d722e3fbSopenharmony_ci 735d722e3fbSopenharmony_ci/* Hash table routines */ 736d722e3fbSopenharmony_ciextern void *drmHashCreate(void); 737d722e3fbSopenharmony_ciextern int drmHashDestroy(void *t); 738d722e3fbSopenharmony_ciextern int drmHashLookup(void *t, unsigned long key, void **value); 739d722e3fbSopenharmony_ciextern int drmHashInsert(void *t, unsigned long key, void *value); 740d722e3fbSopenharmony_ciextern int drmHashDelete(void *t, unsigned long key); 741d722e3fbSopenharmony_ciextern int drmHashFirst(void *t, unsigned long *key, void **value); 742d722e3fbSopenharmony_ciextern int drmHashNext(void *t, unsigned long *key, void **value); 743d722e3fbSopenharmony_ci 744d722e3fbSopenharmony_ci/* PRNG routines */ 745d722e3fbSopenharmony_ciextern void *drmRandomCreate(unsigned long seed); 746d722e3fbSopenharmony_ciextern int drmRandomDestroy(void *state); 747d722e3fbSopenharmony_ciextern unsigned long drmRandom(void *state); 748d722e3fbSopenharmony_ciextern double drmRandomDouble(void *state); 749d722e3fbSopenharmony_ci 750d722e3fbSopenharmony_ci/* Skip list routines */ 751d722e3fbSopenharmony_ci 752d722e3fbSopenharmony_ciextern void *drmSLCreate(void); 753d722e3fbSopenharmony_ciextern int drmSLDestroy(void *l); 754d722e3fbSopenharmony_ciextern int drmSLLookup(void *l, unsigned long key, void **value); 755d722e3fbSopenharmony_ciextern int drmSLInsert(void *l, unsigned long key, void *value); 756d722e3fbSopenharmony_ciextern int drmSLDelete(void *l, unsigned long key); 757d722e3fbSopenharmony_ciextern int drmSLNext(void *l, unsigned long *key, void **value); 758d722e3fbSopenharmony_ciextern int drmSLFirst(void *l, unsigned long *key, void **value); 759d722e3fbSopenharmony_ciextern void drmSLDump(void *l); 760d722e3fbSopenharmony_ciextern int drmSLLookupNeighbors(void *l, unsigned long key, 761d722e3fbSopenharmony_ci unsigned long *prev_key, void **prev_value, 762d722e3fbSopenharmony_ci unsigned long *next_key, void **next_value); 763d722e3fbSopenharmony_ci 764d722e3fbSopenharmony_ciextern int drmOpenOnce(void *unused, const char *BusID, int *newlyopened); 765d722e3fbSopenharmony_ciextern int drmOpenOnceWithType(const char *BusID, int *newlyopened, int type); 766d722e3fbSopenharmony_ciextern void drmCloseOnce(int fd); 767d722e3fbSopenharmony_ciextern void drmMsg(const char *format, ...) DRM_PRINTFLIKE(1, 2); 768d722e3fbSopenharmony_ci 769d722e3fbSopenharmony_ciextern int drmSetMaster(int fd); 770d722e3fbSopenharmony_ciextern int drmDropMaster(int fd); 771d722e3fbSopenharmony_ciextern int drmIsMaster(int fd); 772d722e3fbSopenharmony_ci 773d722e3fbSopenharmony_ci#define DRM_EVENT_CONTEXT_VERSION 4 774d722e3fbSopenharmony_ci 775d722e3fbSopenharmony_citypedef struct _drmEventContext { 776d722e3fbSopenharmony_ci 777d722e3fbSopenharmony_ci /* This struct is versioned so we can add more pointers if we 778d722e3fbSopenharmony_ci * add more events. */ 779d722e3fbSopenharmony_ci int version; 780d722e3fbSopenharmony_ci 781d722e3fbSopenharmony_ci void (*vblank_handler)(int fd, 782d722e3fbSopenharmony_ci unsigned int sequence, 783d722e3fbSopenharmony_ci unsigned int tv_sec, 784d722e3fbSopenharmony_ci unsigned int tv_usec, 785d722e3fbSopenharmony_ci void *user_data); 786d722e3fbSopenharmony_ci 787d722e3fbSopenharmony_ci void (*page_flip_handler)(int fd, 788d722e3fbSopenharmony_ci unsigned int sequence, 789d722e3fbSopenharmony_ci unsigned int tv_sec, 790d722e3fbSopenharmony_ci unsigned int tv_usec, 791d722e3fbSopenharmony_ci void *user_data); 792d722e3fbSopenharmony_ci 793d722e3fbSopenharmony_ci void (*page_flip_handler2)(int fd, 794d722e3fbSopenharmony_ci unsigned int sequence, 795d722e3fbSopenharmony_ci unsigned int tv_sec, 796d722e3fbSopenharmony_ci unsigned int tv_usec, 797d722e3fbSopenharmony_ci unsigned int crtc_id, 798d722e3fbSopenharmony_ci void *user_data); 799d722e3fbSopenharmony_ci 800d722e3fbSopenharmony_ci void (*sequence_handler)(int fd, 801d722e3fbSopenharmony_ci uint64_t sequence, 802d722e3fbSopenharmony_ci uint64_t ns, 803d722e3fbSopenharmony_ci uint64_t user_data); 804d722e3fbSopenharmony_ci} drmEventContext, *drmEventContextPtr; 805d722e3fbSopenharmony_ci 806d722e3fbSopenharmony_ciextern int drmHandleEvent(int fd, drmEventContextPtr evctx); 807d722e3fbSopenharmony_ci 808d722e3fbSopenharmony_ciextern char *drmGetDeviceNameFromFd(int fd); 809d722e3fbSopenharmony_ci 810d722e3fbSopenharmony_ci/* Improved version of drmGetDeviceNameFromFd which attributes for any type of 811d722e3fbSopenharmony_ci * device/node - card, control or renderD. 812d722e3fbSopenharmony_ci */ 813d722e3fbSopenharmony_ciextern char *drmGetDeviceNameFromFd2(int fd); 814d722e3fbSopenharmony_ciextern int drmGetNodeTypeFromFd(int fd); 815d722e3fbSopenharmony_ci 816d722e3fbSopenharmony_ci/* Convert between GEM handles and DMA-BUF file descriptors. 817d722e3fbSopenharmony_ci * 818d722e3fbSopenharmony_ci * Warning: since GEM handles are not reference-counted and are unique per 819d722e3fbSopenharmony_ci * DRM file description, the caller is expected to perform its own reference 820d722e3fbSopenharmony_ci * counting. drmPrimeFDToHandle is guaranteed to return the same handle for 821d722e3fbSopenharmony_ci * different FDs if they reference the same underlying buffer object. This 822d722e3fbSopenharmony_ci * could even be a buffer object originally created on the same DRM FD. 823d722e3fbSopenharmony_ci * 824d722e3fbSopenharmony_ci * When sharing a DRM FD with an API such as EGL or GBM, the caller must not 825d722e3fbSopenharmony_ci * use drmPrimeHandleToFD nor drmPrimeFDToHandle. A single user-space 826d722e3fbSopenharmony_ci * reference-counting implementation is necessary to avoid double-closing GEM 827d722e3fbSopenharmony_ci * handles. 828d722e3fbSopenharmony_ci * 829d722e3fbSopenharmony_ci * Two processes can't share the same DRM FD and both use it to create or 830d722e3fbSopenharmony_ci * import GEM handles, even when using a single user-space reference-counting 831d722e3fbSopenharmony_ci * implementation like GBM, because GBM doesn't share its state between 832d722e3fbSopenharmony_ci * processes. 833d722e3fbSopenharmony_ci */ 834d722e3fbSopenharmony_ciextern int drmPrimeHandleToFD(int fd, uint32_t handle, uint32_t flags, int *prime_fd); 835d722e3fbSopenharmony_ciextern int drmPrimeFDToHandle(int fd, int prime_fd, uint32_t *handle); 836d722e3fbSopenharmony_ci 837d722e3fbSopenharmony_ciextern int drmCloseBufferHandle(int fd, uint32_t handle); 838d722e3fbSopenharmony_ci 839d722e3fbSopenharmony_ciextern char *drmGetPrimaryDeviceNameFromFd(int fd); 840d722e3fbSopenharmony_ciextern char *drmGetRenderDeviceNameFromFd(int fd); 841d722e3fbSopenharmony_ci 842d722e3fbSopenharmony_ci#define DRM_BUS_PCI 0 843d722e3fbSopenharmony_ci#define DRM_BUS_USB 1 844d722e3fbSopenharmony_ci#define DRM_BUS_PLATFORM 2 845d722e3fbSopenharmony_ci#define DRM_BUS_HOST1X 3 846d722e3fbSopenharmony_ci 847d722e3fbSopenharmony_citypedef struct _drmPciBusInfo { 848d722e3fbSopenharmony_ci uint16_t domain; 849d722e3fbSopenharmony_ci uint8_t bus; 850d722e3fbSopenharmony_ci uint8_t dev; 851d722e3fbSopenharmony_ci uint8_t func; 852d722e3fbSopenharmony_ci} drmPciBusInfo, *drmPciBusInfoPtr; 853d722e3fbSopenharmony_ci 854d722e3fbSopenharmony_citypedef struct _drmPciDeviceInfo { 855d722e3fbSopenharmony_ci uint16_t vendor_id; 856d722e3fbSopenharmony_ci uint16_t device_id; 857d722e3fbSopenharmony_ci uint16_t subvendor_id; 858d722e3fbSopenharmony_ci uint16_t subdevice_id; 859d722e3fbSopenharmony_ci uint8_t revision_id; 860d722e3fbSopenharmony_ci} drmPciDeviceInfo, *drmPciDeviceInfoPtr; 861d722e3fbSopenharmony_ci 862d722e3fbSopenharmony_citypedef struct _drmUsbBusInfo { 863d722e3fbSopenharmony_ci uint8_t bus; 864d722e3fbSopenharmony_ci uint8_t dev; 865d722e3fbSopenharmony_ci} drmUsbBusInfo, *drmUsbBusInfoPtr; 866d722e3fbSopenharmony_ci 867d722e3fbSopenharmony_citypedef struct _drmUsbDeviceInfo { 868d722e3fbSopenharmony_ci uint16_t vendor; 869d722e3fbSopenharmony_ci uint16_t product; 870d722e3fbSopenharmony_ci} drmUsbDeviceInfo, *drmUsbDeviceInfoPtr; 871d722e3fbSopenharmony_ci 872d722e3fbSopenharmony_ci#define DRM_PLATFORM_DEVICE_NAME_LEN 512 873d722e3fbSopenharmony_ci 874d722e3fbSopenharmony_citypedef struct _drmPlatformBusInfo { 875d722e3fbSopenharmony_ci char fullname[DRM_PLATFORM_DEVICE_NAME_LEN]; 876d722e3fbSopenharmony_ci} drmPlatformBusInfo, *drmPlatformBusInfoPtr; 877d722e3fbSopenharmony_ci 878d722e3fbSopenharmony_citypedef struct _drmPlatformDeviceInfo { 879d722e3fbSopenharmony_ci char **compatible; /* NULL terminated list of compatible strings */ 880d722e3fbSopenharmony_ci} drmPlatformDeviceInfo, *drmPlatformDeviceInfoPtr; 881d722e3fbSopenharmony_ci 882d722e3fbSopenharmony_ci#define DRM_HOST1X_DEVICE_NAME_LEN 512 883d722e3fbSopenharmony_ci 884d722e3fbSopenharmony_citypedef struct _drmHost1xBusInfo { 885d722e3fbSopenharmony_ci char fullname[DRM_HOST1X_DEVICE_NAME_LEN]; 886d722e3fbSopenharmony_ci} drmHost1xBusInfo, *drmHost1xBusInfoPtr; 887d722e3fbSopenharmony_ci 888d722e3fbSopenharmony_citypedef struct _drmHost1xDeviceInfo { 889d722e3fbSopenharmony_ci char **compatible; /* NULL terminated list of compatible strings */ 890d722e3fbSopenharmony_ci} drmHost1xDeviceInfo, *drmHost1xDeviceInfoPtr; 891d722e3fbSopenharmony_ci 892d722e3fbSopenharmony_citypedef struct _drmDevice { 893d722e3fbSopenharmony_ci char **nodes; /* DRM_NODE_MAX sized array */ 894d722e3fbSopenharmony_ci int available_nodes; /* DRM_NODE_* bitmask */ 895d722e3fbSopenharmony_ci int bustype; 896d722e3fbSopenharmony_ci union { 897d722e3fbSopenharmony_ci drmPciBusInfoPtr pci; 898d722e3fbSopenharmony_ci drmUsbBusInfoPtr usb; 899d722e3fbSopenharmony_ci drmPlatformBusInfoPtr platform; 900d722e3fbSopenharmony_ci drmHost1xBusInfoPtr host1x; 901d722e3fbSopenharmony_ci } businfo; 902d722e3fbSopenharmony_ci union { 903d722e3fbSopenharmony_ci drmPciDeviceInfoPtr pci; 904d722e3fbSopenharmony_ci drmUsbDeviceInfoPtr usb; 905d722e3fbSopenharmony_ci drmPlatformDeviceInfoPtr platform; 906d722e3fbSopenharmony_ci drmHost1xDeviceInfoPtr host1x; 907d722e3fbSopenharmony_ci } deviceinfo; 908d722e3fbSopenharmony_ci} drmDevice, *drmDevicePtr; 909d722e3fbSopenharmony_ci 910d722e3fbSopenharmony_ciextern int drmGetDevice(int fd, drmDevicePtr *device); 911d722e3fbSopenharmony_ciextern void drmFreeDevice(drmDevicePtr *device); 912d722e3fbSopenharmony_ci 913d722e3fbSopenharmony_ciextern int drmGetDevices(drmDevicePtr devices[], int max_devices); 914d722e3fbSopenharmony_ciextern void drmFreeDevices(drmDevicePtr devices[], int count); 915d722e3fbSopenharmony_ci 916d722e3fbSopenharmony_ci#define DRM_DEVICE_GET_PCI_REVISION (1 << 0) 917d722e3fbSopenharmony_ciextern int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device); 918d722e3fbSopenharmony_ciextern int drmGetDevices2(uint32_t flags, drmDevicePtr devices[], int max_devices); 919d722e3fbSopenharmony_ci 920d722e3fbSopenharmony_ciextern int drmGetDeviceFromDevId(dev_t dev_id, uint32_t flags, drmDevicePtr *device); 921d722e3fbSopenharmony_ci 922d722e3fbSopenharmony_ciextern int drmDevicesEqual(drmDevicePtr a, drmDevicePtr b); 923d722e3fbSopenharmony_ci 924d722e3fbSopenharmony_ciextern int drmSyncobjCreate(int fd, uint32_t flags, uint32_t *handle); 925d722e3fbSopenharmony_ciextern int drmSyncobjDestroy(int fd, uint32_t handle); 926d722e3fbSopenharmony_ciextern int drmSyncobjHandleToFD(int fd, uint32_t handle, int *obj_fd); 927d722e3fbSopenharmony_ciextern int drmSyncobjFDToHandle(int fd, int obj_fd, uint32_t *handle); 928d722e3fbSopenharmony_ci 929d722e3fbSopenharmony_ciextern int drmSyncobjImportSyncFile(int fd, uint32_t handle, int sync_file_fd); 930d722e3fbSopenharmony_ciextern int drmSyncobjExportSyncFile(int fd, uint32_t handle, int *sync_file_fd); 931d722e3fbSopenharmony_ciextern int drmSyncobjWait(int fd, uint32_t *handles, unsigned num_handles, 932d722e3fbSopenharmony_ci int64_t timeout_nsec, unsigned flags, 933d722e3fbSopenharmony_ci uint32_t *first_signaled); 934d722e3fbSopenharmony_ciextern int drmSyncobjReset(int fd, const uint32_t *handles, uint32_t handle_count); 935d722e3fbSopenharmony_ciextern int drmSyncobjSignal(int fd, const uint32_t *handles, uint32_t handle_count); 936d722e3fbSopenharmony_ciextern int drmSyncobjTimelineSignal(int fd, const uint32_t *handles, 937d722e3fbSopenharmony_ci uint64_t *points, uint32_t handle_count); 938d722e3fbSopenharmony_ciextern int drmSyncobjTimelineWait(int fd, uint32_t *handles, uint64_t *points, 939d722e3fbSopenharmony_ci unsigned num_handles, 940d722e3fbSopenharmony_ci int64_t timeout_nsec, unsigned flags, 941d722e3fbSopenharmony_ci uint32_t *first_signaled); 942d722e3fbSopenharmony_ciextern int drmSyncobjQuery(int fd, uint32_t *handles, uint64_t *points, 943d722e3fbSopenharmony_ci uint32_t handle_count); 944d722e3fbSopenharmony_ciextern int drmSyncobjQuery2(int fd, uint32_t *handles, uint64_t *points, 945d722e3fbSopenharmony_ci uint32_t handle_count, uint32_t flags); 946d722e3fbSopenharmony_ciextern int drmSyncobjTransfer(int fd, 947d722e3fbSopenharmony_ci uint32_t dst_handle, uint64_t dst_point, 948d722e3fbSopenharmony_ci uint32_t src_handle, uint64_t src_point, 949d722e3fbSopenharmony_ci uint32_t flags); 950d722e3fbSopenharmony_ci 951d722e3fbSopenharmony_ciextern char * 952d722e3fbSopenharmony_cidrmGetFormatModifierVendor(uint64_t modifier); 953d722e3fbSopenharmony_ci 954d722e3fbSopenharmony_ciextern char * 955d722e3fbSopenharmony_cidrmGetFormatModifierName(uint64_t modifier); 956d722e3fbSopenharmony_ci 957d722e3fbSopenharmony_ci#ifndef fourcc_mod_get_vendor 958d722e3fbSopenharmony_ci#define fourcc_mod_get_vendor(modifier) \ 959d722e3fbSopenharmony_ci (((modifier) >> 56) & 0xff) 960d722e3fbSopenharmony_ci#endif 961d722e3fbSopenharmony_ci 962d722e3fbSopenharmony_ci#if defined(__cplusplus) 963d722e3fbSopenharmony_ci} 964d722e3fbSopenharmony_ci#endif 965d722e3fbSopenharmony_ci 966d722e3fbSopenharmony_ci#endif 967