/*1* Header for the Direct Rendering Manager2*3* Author: Rickard E. (Rik) Faith <[email protected]>4*5* Acknowledgments:6* Dec 1999, Richard Henderson <[email protected]>, move to generic cmpxchg.7*/89/*10* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.11* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.12* All rights reserved.13*14* Permission is hereby granted, free of charge, to any person obtaining a15* copy of this software and associated documentation files (the "Software"),16* to deal in the Software without restriction, including without limitation17* the rights to use, copy, modify, merge, publish, distribute, sublicense,18* and/or sell copies of the Software, and to permit persons to whom the19* Software is furnished to do so, subject to the following conditions:20*21* The above copyright notice and this permission notice (including the next22* paragraph) shall be included in all copies or substantial portions of the23* Software.24*25* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR26* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,27* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL28* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR29* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,30* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR31* OTHER DEALINGS IN THE SOFTWARE.32*/3334#ifndef _DRM_H_35#define _DRM_H_3637#if defined(__KERNEL__)3839#include <linux/types.h>40#include <asm/ioctl.h>41typedef unsigned int drm_handle_t;4243#elif defined(__linux__)4445#include <linux/types.h>46#include <asm/ioctl.h>47typedef unsigned int drm_handle_t;4849#else /* One of the BSDs */5051#include <stdint.h>52#include <sys/ioccom.h>53#include <sys/types.h>54typedef int8_t __s8;55typedef uint8_t __u8;56typedef int16_t __s16;57typedef uint16_t __u16;58typedef int32_t __s32;59typedef uint32_t __u32;60typedef int64_t __s64;61typedef uint64_t __u64;62typedef size_t __kernel_size_t;63typedef unsigned long drm_handle_t;6465#endif6667#if defined(__cplusplus)68extern "C" {69#endif7071#define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */72#define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */73#define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */74#define DRM_RAM_PERCENT 10 /**< How much system ram can we lock? */7576#define _DRM_LOCK_HELD 0x80000000U /**< Hardware lock is held */77#define _DRM_LOCK_CONT 0x40000000U /**< Hardware lock is contended */78#define _DRM_LOCK_IS_HELD(lock) ((lock) & _DRM_LOCK_HELD)79#define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT)80#define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT))8182typedef unsigned int drm_context_t;83typedef unsigned int drm_drawable_t;84typedef unsigned int drm_magic_t;8586/*87* Cliprect.88*89* \warning: If you change this structure, make sure you change90* XF86DRIClipRectRec in the server as well91*92* \note KW: Actually it's illegal to change either for93* backwards-compatibility reasons.94*/95struct drm_clip_rect {96unsigned short x1;97unsigned short y1;98unsigned short x2;99unsigned short y2;100};101102/*103* Drawable information.104*/105struct drm_drawable_info {106unsigned int num_rects;107struct drm_clip_rect *rects;108};109110/*111* Texture region,112*/113struct drm_tex_region {114unsigned char next;115unsigned char prev;116unsigned char in_use;117unsigned char padding;118unsigned int age;119};120121/*122* Hardware lock.123*124* The lock structure is a simple cache-line aligned integer. To avoid125* processor bus contention on a multiprocessor system, there should not be any126* other data stored in the same cache line.127*/128struct drm_hw_lock {129__volatile__ unsigned int lock; /**< lock variable */130char padding[60]; /**< Pad to cache line */131};132133/*134* DRM_IOCTL_VERSION ioctl argument type.135*136* \sa drmGetVersion().137*/138struct drm_version {139int version_major; /**< Major version */140int version_minor; /**< Minor version */141int version_patchlevel; /**< Patch level */142__kernel_size_t name_len; /**< Length of name buffer */143char __user *name; /**< Name of driver */144__kernel_size_t date_len; /**< Length of date buffer */145char __user *date; /**< User-space buffer to hold date */146__kernel_size_t desc_len; /**< Length of desc buffer */147char __user *desc; /**< User-space buffer to hold desc */148};149150/*151* DRM_IOCTL_GET_UNIQUE ioctl argument type.152*153* \sa drmGetBusid() and drmSetBusId().154*/155struct drm_unique {156__kernel_size_t unique_len; /**< Length of unique */157char __user *unique; /**< Unique name for driver instantiation */158};159160struct drm_list {161int count; /**< Length of user-space structures */162struct drm_version __user *version;163};164165struct drm_block {166int unused;167};168169/*170* DRM_IOCTL_CONTROL ioctl argument type.171*172* \sa drmCtlInstHandler() and drmCtlUninstHandler().173*/174struct drm_control {175enum {176DRM_ADD_COMMAND,177DRM_RM_COMMAND,178DRM_INST_HANDLER,179DRM_UNINST_HANDLER180} func;181int irq;182};183184/*185* Type of memory to map.186*/187enum drm_map_type {188_DRM_FRAME_BUFFER = 0, /**< WC (no caching), no core dump */189_DRM_REGISTERS = 1, /**< no caching, no core dump */190_DRM_SHM = 2, /**< shared, cached */191_DRM_AGP = 3, /**< AGP/GART */192_DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */193_DRM_CONSISTENT = 5 /**< Consistent memory for PCI DMA */194};195196/*197* Memory mapping flags.198*/199enum drm_map_flags {200_DRM_RESTRICTED = 0x01, /**< Cannot be mapped to user-virtual */201_DRM_READ_ONLY = 0x02,202_DRM_LOCKED = 0x04, /**< shared, cached, locked */203_DRM_KERNEL = 0x08, /**< kernel requires access */204_DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */205_DRM_CONTAINS_LOCK = 0x20, /**< SHM page that contains lock */206_DRM_REMOVABLE = 0x40, /**< Removable mapping */207_DRM_DRIVER = 0x80 /**< Managed by driver */208};209210struct drm_ctx_priv_map {211unsigned int ctx_id; /**< Context requesting private mapping */212void *handle; /**< Handle of map */213};214215/*216* DRM_IOCTL_GET_MAP, DRM_IOCTL_ADD_MAP and DRM_IOCTL_RM_MAP ioctls217* argument type.218*219* \sa drmAddMap().220*/221struct drm_map {222unsigned long offset; /**< Requested physical address (0 for SAREA)*/223unsigned long size; /**< Requested physical size (bytes) */224enum drm_map_type type; /**< Type of memory to map */225enum drm_map_flags flags; /**< Flags */226void *handle; /**< User-space: "Handle" to pass to mmap() */227/**< Kernel-space: kernel-virtual address */228int mtrr; /**< MTRR slot used */229/* Private data */230};231232/*233* DRM_IOCTL_GET_CLIENT ioctl argument type.234*/235struct drm_client {236int idx; /**< Which client desired? */237int auth; /**< Is client authenticated? */238unsigned long pid; /**< Process ID */239unsigned long uid; /**< User ID */240unsigned long magic; /**< Magic */241unsigned long iocs; /**< Ioctl count */242};243244enum drm_stat_type {245_DRM_STAT_LOCK,246_DRM_STAT_OPENS,247_DRM_STAT_CLOSES,248_DRM_STAT_IOCTLS,249_DRM_STAT_LOCKS,250_DRM_STAT_UNLOCKS,251_DRM_STAT_VALUE, /**< Generic value */252_DRM_STAT_BYTE, /**< Generic byte counter (1024bytes/K) */253_DRM_STAT_COUNT, /**< Generic non-byte counter (1000/k) */254255_DRM_STAT_IRQ, /**< IRQ */256_DRM_STAT_PRIMARY, /**< Primary DMA bytes */257_DRM_STAT_SECONDARY, /**< Secondary DMA bytes */258_DRM_STAT_DMA, /**< DMA */259_DRM_STAT_SPECIAL, /**< Special DMA (e.g., priority or polled) */260_DRM_STAT_MISSED /**< Missed DMA opportunity */261/* Add to the *END* of the list */262};263264/*265* DRM_IOCTL_GET_STATS ioctl argument type.266*/267struct drm_stats {268unsigned long count;269struct {270unsigned long value;271enum drm_stat_type type;272} data[15];273};274275/*276* Hardware locking flags.277*/278enum drm_lock_flags {279_DRM_LOCK_READY = 0x01, /**< Wait until hardware is ready for DMA */280_DRM_LOCK_QUIESCENT = 0x02, /**< Wait until hardware quiescent */281_DRM_LOCK_FLUSH = 0x04, /**< Flush this context's DMA queue first */282_DRM_LOCK_FLUSH_ALL = 0x08, /**< Flush all DMA queues first */283/* These *HALT* flags aren't supported yet284-- they will be used to support the285full-screen DGA-like mode. */286_DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */287_DRM_HALT_CUR_QUEUES = 0x20 /**< Halt all current queues */288};289290/*291* DRM_IOCTL_LOCK, DRM_IOCTL_UNLOCK and DRM_IOCTL_FINISH ioctl argument type.292*293* \sa drmGetLock() and drmUnlock().294*/295struct drm_lock {296int context;297enum drm_lock_flags flags;298};299300/*301* DMA flags302*303* \warning304* These values \e must match xf86drm.h.305*306* \sa drm_dma.307*/308enum drm_dma_flags {309/* Flags for DMA buffer dispatch */310_DRM_DMA_BLOCK = 0x01, /**<311* Block until buffer dispatched.312*313* \note The buffer may not yet have314* been processed by the hardware --315* getting a hardware lock with the316* hardware quiescent will ensure317* that the buffer has been318* processed.319*/320_DRM_DMA_WHILE_LOCKED = 0x02, /**< Dispatch while lock held */321_DRM_DMA_PRIORITY = 0x04, /**< High priority dispatch */322323/* Flags for DMA buffer request */324_DRM_DMA_WAIT = 0x10, /**< Wait for free buffers */325_DRM_DMA_SMALLER_OK = 0x20, /**< Smaller-than-requested buffers OK */326_DRM_DMA_LARGER_OK = 0x40 /**< Larger-than-requested buffers OK */327};328329/*330* DRM_IOCTL_ADD_BUFS and DRM_IOCTL_MARK_BUFS ioctl argument type.331*332* \sa drmAddBufs().333*/334struct drm_buf_desc {335int count; /**< Number of buffers of this size */336int size; /**< Size in bytes */337int low_mark; /**< Low water mark */338int high_mark; /**< High water mark */339enum {340_DRM_PAGE_ALIGN = 0x01, /**< Align on page boundaries for DMA */341_DRM_AGP_BUFFER = 0x02, /**< Buffer is in AGP space */342_DRM_SG_BUFFER = 0x04, /**< Scatter/gather memory buffer */343_DRM_FB_BUFFER = 0x08, /**< Buffer is in frame buffer */344_DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */345} flags;346unsigned long agp_start; /**<347* Start address of where the AGP buffers are348* in the AGP aperture349*/350};351352/*353* DRM_IOCTL_INFO_BUFS ioctl argument type.354*/355struct drm_buf_info {356int count; /**< Entries in list */357struct drm_buf_desc __user *list;358};359360/*361* DRM_IOCTL_FREE_BUFS ioctl argument type.362*/363struct drm_buf_free {364int count;365int __user *list;366};367368/*369* Buffer information370*371* \sa drm_buf_map.372*/373struct drm_buf_pub {374int idx; /**< Index into the master buffer list */375int total; /**< Buffer size */376int used; /**< Amount of buffer in use (for DMA) */377void __user *address; /**< Address of buffer */378};379380/*381* DRM_IOCTL_MAP_BUFS ioctl argument type.382*/383struct drm_buf_map {384int count; /**< Length of the buffer list */385#ifdef __cplusplus386void __user *virt;387#else388void __user *virtual; /**< Mmap'd area in user-virtual */389#endif390struct drm_buf_pub __user *list; /**< Buffer information */391};392393/*394* DRM_IOCTL_DMA ioctl argument type.395*396* Indices here refer to the offset into the buffer list in drm_buf_get.397*398* \sa drmDMA().399*/400struct drm_dma {401int context; /**< Context handle */402int send_count; /**< Number of buffers to send */403int __user *send_indices; /**< List of handles to buffers */404int __user *send_sizes; /**< Lengths of data to send */405enum drm_dma_flags flags; /**< Flags */406int request_count; /**< Number of buffers requested */407int request_size; /**< Desired size for buffers */408int __user *request_indices; /**< Buffer information */409int __user *request_sizes;410int granted_count; /**< Number of buffers granted */411};412413enum drm_ctx_flags {414_DRM_CONTEXT_PRESERVED = 0x01,415_DRM_CONTEXT_2DONLY = 0x02416};417418/*419* DRM_IOCTL_ADD_CTX ioctl argument type.420*421* \sa drmCreateContext() and drmDestroyContext().422*/423struct drm_ctx {424drm_context_t handle;425enum drm_ctx_flags flags;426};427428/*429* DRM_IOCTL_RES_CTX ioctl argument type.430*/431struct drm_ctx_res {432int count;433struct drm_ctx __user *contexts;434};435436/*437* DRM_IOCTL_ADD_DRAW and DRM_IOCTL_RM_DRAW ioctl argument type.438*/439struct drm_draw {440drm_drawable_t handle;441};442443/*444* DRM_IOCTL_UPDATE_DRAW ioctl argument type.445*/446typedef enum {447DRM_DRAWABLE_CLIPRECTS448} drm_drawable_info_type_t;449450struct drm_update_draw {451drm_drawable_t handle;452unsigned int type;453unsigned int num;454unsigned long long data;455};456457/*458* DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type.459*/460struct drm_auth {461drm_magic_t magic;462};463464/*465* DRM_IOCTL_IRQ_BUSID ioctl argument type.466*467* \sa drmGetInterruptFromBusID().468*/469struct drm_irq_busid {470int irq; /**< IRQ number */471int busnum; /**< bus number */472int devnum; /**< device number */473int funcnum; /**< function number */474};475476enum drm_vblank_seq_type {477_DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */478_DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */479/* bits 1-6 are reserved for high crtcs */480_DRM_VBLANK_HIGH_CRTC_MASK = 0x0000003e,481_DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */482_DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */483_DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */484_DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */485_DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking, unsupported */486};487#define _DRM_VBLANK_HIGH_CRTC_SHIFT 1488489#define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE)490#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \491_DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS)492493struct drm_wait_vblank_request {494enum drm_vblank_seq_type type;495unsigned int sequence;496unsigned long signal;497};498499struct drm_wait_vblank_reply {500enum drm_vblank_seq_type type;501unsigned int sequence;502long tval_sec;503long tval_usec;504};505506/*507* DRM_IOCTL_WAIT_VBLANK ioctl argument type.508*509* \sa drmWaitVBlank().510*/511union drm_wait_vblank {512struct drm_wait_vblank_request request;513struct drm_wait_vblank_reply reply;514};515516#define _DRM_PRE_MODESET 1517#define _DRM_POST_MODESET 2518519/*520* DRM_IOCTL_MODESET_CTL ioctl argument type521*522* \sa drmModesetCtl().523*/524struct drm_modeset_ctl {525__u32 crtc;526__u32 cmd;527};528529/*530* DRM_IOCTL_AGP_ENABLE ioctl argument type.531*532* \sa drmAgpEnable().533*/534struct drm_agp_mode {535unsigned long mode; /**< AGP mode */536};537538/*539* DRM_IOCTL_AGP_ALLOC and DRM_IOCTL_AGP_FREE ioctls argument type.540*541* \sa drmAgpAlloc() and drmAgpFree().542*/543struct drm_agp_buffer {544unsigned long size; /**< In bytes -- will round to page boundary */545unsigned long handle; /**< Used for binding / unbinding */546unsigned long type; /**< Type of memory to allocate */547unsigned long physical; /**< Physical used by i810 */548};549550/*551* DRM_IOCTL_AGP_BIND and DRM_IOCTL_AGP_UNBIND ioctls argument type.552*553* \sa drmAgpBind() and drmAgpUnbind().554*/555struct drm_agp_binding {556unsigned long handle; /**< From drm_agp_buffer */557unsigned long offset; /**< In bytes -- will round to page boundary */558};559560/*561* DRM_IOCTL_AGP_INFO ioctl argument type.562*563* \sa drmAgpVersionMajor(), drmAgpVersionMinor(), drmAgpGetMode(),564* drmAgpBase(), drmAgpSize(), drmAgpMemoryUsed(), drmAgpMemoryAvail(),565* drmAgpVendorId() and drmAgpDeviceId().566*/567struct drm_agp_info {568int agp_version_major;569int agp_version_minor;570unsigned long mode;571unsigned long aperture_base; /* physical address */572unsigned long aperture_size; /* bytes */573unsigned long memory_allowed; /* bytes */574unsigned long memory_used;575576/* PCI information */577unsigned short id_vendor;578unsigned short id_device;579};580581/*582* DRM_IOCTL_SG_ALLOC ioctl argument type.583*/584struct drm_scatter_gather {585unsigned long size; /**< In bytes -- will round to page boundary */586unsigned long handle; /**< Used for mapping / unmapping */587};588589/*590* DRM_IOCTL_SET_VERSION ioctl argument type.591*/592struct drm_set_version {593int drm_di_major;594int drm_di_minor;595int drm_dd_major;596int drm_dd_minor;597};598599/* DRM_IOCTL_GEM_CLOSE ioctl argument type */600struct drm_gem_close {601/** Handle of the object to be closed. */602__u32 handle;603__u32 pad;604};605606/* DRM_IOCTL_GEM_FLINK ioctl argument type */607struct drm_gem_flink {608/** Handle for the object being named */609__u32 handle;610611/** Returned global name */612__u32 name;613};614615/* DRM_IOCTL_GEM_OPEN ioctl argument type */616struct drm_gem_open {617/** Name of object being opened */618__u32 name;619620/** Returned handle for the object */621__u32 handle;622623/** Returned size of the object */624__u64 size;625};626627/**628* DRM_CAP_DUMB_BUFFER629*630* If set to 1, the driver supports creating dumb buffers via the631* &DRM_IOCTL_MODE_CREATE_DUMB ioctl.632*/633#define DRM_CAP_DUMB_BUFFER 0x1634/**635* DRM_CAP_VBLANK_HIGH_CRTC636*637* If set to 1, the kernel supports specifying a :ref:`CRTC index<crtc_index>`638* in the high bits of &drm_wait_vblank_request.type.639*640* Starting kernel version 2.6.39, this capability is always set to 1.641*/642#define DRM_CAP_VBLANK_HIGH_CRTC 0x2643/**644* DRM_CAP_DUMB_PREFERRED_DEPTH645*646* The preferred bit depth for dumb buffers.647*648* The bit depth is the number of bits used to indicate the color of a single649* pixel excluding any padding. This is different from the number of bits per650* pixel. For instance, XRGB8888 has a bit depth of 24 but has 32 bits per651* pixel.652*653* Note that this preference only applies to dumb buffers, it's irrelevant for654* other types of buffers.655*/656#define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3657/**658* DRM_CAP_DUMB_PREFER_SHADOW659*660* If set to 1, the driver prefers userspace to render to a shadow buffer661* instead of directly rendering to a dumb buffer. For best speed, userspace662* should do streaming ordered memory copies into the dumb buffer and never663* read from it.664*665* Note that this preference only applies to dumb buffers, it's irrelevant for666* other types of buffers.667*/668#define DRM_CAP_DUMB_PREFER_SHADOW 0x4669/**670* DRM_CAP_PRIME671*672* Bitfield of supported PRIME sharing capabilities. See &DRM_PRIME_CAP_IMPORT673* and &DRM_PRIME_CAP_EXPORT.674*675* Starting from kernel version 6.6, both &DRM_PRIME_CAP_IMPORT and676* &DRM_PRIME_CAP_EXPORT are always advertised.677*678* PRIME buffers are exposed as dma-buf file descriptors.679* See :ref:`prime_buffer_sharing`.680*/681#define DRM_CAP_PRIME 0x5682/**683* DRM_PRIME_CAP_IMPORT684*685* If this bit is set in &DRM_CAP_PRIME, the driver supports importing PRIME686* buffers via the &DRM_IOCTL_PRIME_FD_TO_HANDLE ioctl.687*688* Starting from kernel version 6.6, this bit is always set in &DRM_CAP_PRIME.689*/690#define DRM_PRIME_CAP_IMPORT 0x1691/**692* DRM_PRIME_CAP_EXPORT693*694* If this bit is set in &DRM_CAP_PRIME, the driver supports exporting PRIME695* buffers via the &DRM_IOCTL_PRIME_HANDLE_TO_FD ioctl.696*697* Starting from kernel version 6.6, this bit is always set in &DRM_CAP_PRIME.698*/699#define DRM_PRIME_CAP_EXPORT 0x2700/**701* DRM_CAP_TIMESTAMP_MONOTONIC702*703* If set to 0, the kernel will report timestamps with ``CLOCK_REALTIME`` in704* struct drm_event_vblank. If set to 1, the kernel will report timestamps with705* ``CLOCK_MONOTONIC``. See ``clock_gettime(2)`` for the definition of these706* clocks.707*708* Starting from kernel version 2.6.39, the default value for this capability709* is 1. Starting kernel version 4.15, this capability is always set to 1.710*/711#define DRM_CAP_TIMESTAMP_MONOTONIC 0x6712/**713* DRM_CAP_ASYNC_PAGE_FLIP714*715* If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC for legacy716* page-flips.717*/718#define DRM_CAP_ASYNC_PAGE_FLIP 0x7719/**720* DRM_CAP_CURSOR_WIDTH721*722* The ``CURSOR_WIDTH`` and ``CURSOR_HEIGHT`` capabilities return a valid723* width x height combination for the hardware cursor. The intention is that a724* hardware agnostic userspace can query a cursor plane size to use.725*726* Note that the cross-driver contract is to merely return a valid size;727* drivers are free to attach another meaning on top, eg. i915 returns the728* maximum plane size.729*/730#define DRM_CAP_CURSOR_WIDTH 0x8731/**732* DRM_CAP_CURSOR_HEIGHT733*734* See &DRM_CAP_CURSOR_WIDTH.735*/736#define DRM_CAP_CURSOR_HEIGHT 0x9737/**738* DRM_CAP_ADDFB2_MODIFIERS739*740* If set to 1, the driver supports supplying modifiers in the741* &DRM_IOCTL_MODE_ADDFB2 ioctl.742*/743#define DRM_CAP_ADDFB2_MODIFIERS 0x10744/**745* DRM_CAP_PAGE_FLIP_TARGET746*747* If set to 1, the driver supports the &DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE and748* &DRM_MODE_PAGE_FLIP_TARGET_RELATIVE flags in749* &drm_mode_crtc_page_flip_target.flags for the &DRM_IOCTL_MODE_PAGE_FLIP750* ioctl.751*/752#define DRM_CAP_PAGE_FLIP_TARGET 0x11753/**754* DRM_CAP_CRTC_IN_VBLANK_EVENT755*756* If set to 1, the kernel supports reporting the CRTC ID in757* &drm_event_vblank.crtc_id for the &DRM_EVENT_VBLANK and758* &DRM_EVENT_FLIP_COMPLETE events.759*760* Starting kernel version 4.12, this capability is always set to 1.761*/762#define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12763/**764* DRM_CAP_SYNCOBJ765*766* If set to 1, the driver supports sync objects. See :ref:`drm_sync_objects`.767*/768#define DRM_CAP_SYNCOBJ 0x13769/**770* DRM_CAP_SYNCOBJ_TIMELINE771*772* If set to 1, the driver supports timeline operations on sync objects. See773* :ref:`drm_sync_objects`.774*/775#define DRM_CAP_SYNCOBJ_TIMELINE 0x14776/**777* DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP778*779* If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC for atomic780* commits.781*/782#define DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP 0x15783784/* DRM_IOCTL_GET_CAP ioctl argument type */785struct drm_get_cap {786__u64 capability;787__u64 value;788};789790/**791* DRM_CLIENT_CAP_STEREO_3D792*793* If set to 1, the DRM core will expose the stereo 3D capabilities of the794* monitor by advertising the supported 3D layouts in the flags of struct795* drm_mode_modeinfo. See ``DRM_MODE_FLAG_3D_*``.796*797* This capability is always supported for all drivers starting from kernel798* version 3.13.799*/800#define DRM_CLIENT_CAP_STEREO_3D 1801802/**803* DRM_CLIENT_CAP_UNIVERSAL_PLANES804*805* If set to 1, the DRM core will expose all planes (overlay, primary, and806* cursor) to userspace.807*808* This capability has been introduced in kernel version 3.15. Starting from809* kernel version 3.17, this capability is always supported for all drivers.810*/811#define DRM_CLIENT_CAP_UNIVERSAL_PLANES 2812813/**814* DRM_CLIENT_CAP_ATOMIC815*816* If set to 1, the DRM core will expose atomic properties to userspace. This817* implicitly enables &DRM_CLIENT_CAP_UNIVERSAL_PLANES and818* &DRM_CLIENT_CAP_ASPECT_RATIO.819*820* If the driver doesn't support atomic mode-setting, enabling this capability821* will fail with -EOPNOTSUPP.822*823* This capability has been introduced in kernel version 4.0. Starting from824* kernel version 4.2, this capability is always supported for atomic-capable825* drivers.826*/827#define DRM_CLIENT_CAP_ATOMIC 3828829/**830* DRM_CLIENT_CAP_ASPECT_RATIO831*832* If set to 1, the DRM core will provide aspect ratio information in modes.833* See ``DRM_MODE_FLAG_PIC_AR_*``.834*835* This capability is always supported for all drivers starting from kernel836* version 4.18.837*/838#define DRM_CLIENT_CAP_ASPECT_RATIO 4839840/**841* DRM_CLIENT_CAP_WRITEBACK_CONNECTORS842*843* If set to 1, the DRM core will expose special connectors to be used for844* writing back to memory the scene setup in the commit. The client must enable845* &DRM_CLIENT_CAP_ATOMIC first.846*847* This capability is always supported for atomic-capable drivers starting from848* kernel version 4.19.849*/850#define DRM_CLIENT_CAP_WRITEBACK_CONNECTORS 5851852/**853* DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT854*855* Drivers for para-virtualized hardware (e.g. vmwgfx, qxl, virtio and856* virtualbox) have additional restrictions for cursor planes (thus857* making cursor planes on those drivers not truly universal,) e.g.858* they need cursor planes to act like one would expect from a mouse859* cursor and have correctly set hotspot properties.860* If this client cap is not set the DRM core will hide cursor plane on861* those virtualized drivers because not setting it implies that the862* client is not capable of dealing with those extra restictions.863* Clients which do set cursor hotspot and treat the cursor plane864* like a mouse cursor should set this property.865* The client must enable &DRM_CLIENT_CAP_ATOMIC first.866*867* Setting this property on drivers which do not special case868* cursor planes (i.e. non-virtualized drivers) will return869* EOPNOTSUPP, which can be used by userspace to gauge870* requirements of the hardware/drivers they're running on.871*872* This capability is always supported for atomic-capable virtualized873* drivers starting from kernel version 6.6.874*/875#define DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT 6876877/* DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */878struct drm_set_client_cap {879__u64 capability;880__u64 value;881};882883#define DRM_RDWR O_RDWR884#define DRM_CLOEXEC O_CLOEXEC885struct drm_prime_handle {886__u32 handle;887888/** Flags.. only applicable for handle->fd */889__u32 flags;890891/** Returned dmabuf file descriptor */892__s32 fd;893};894895struct drm_syncobj_create {896__u32 handle;897#define DRM_SYNCOBJ_CREATE_SIGNALED (1 << 0)898__u32 flags;899};900901struct drm_syncobj_destroy {902__u32 handle;903__u32 pad;904};905906#define DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE (1 << 0)907#define DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_TIMELINE (1 << 1)908#define DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE (1 << 0)909#define DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_TIMELINE (1 << 1)910struct drm_syncobj_handle {911__u32 handle;912__u32 flags;913914__s32 fd;915__u32 pad;916917__u64 point;918};919920struct drm_syncobj_transfer {921__u32 src_handle;922__u32 dst_handle;923__u64 src_point;924__u64 dst_point;925__u32 flags;926__u32 pad;927};928929#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)930#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1)931#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2) /* wait for time point to become available */932#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_DEADLINE (1 << 3) /* set fence deadline to deadline_nsec */933struct drm_syncobj_wait {934__u64 handles;935/* absolute timeout */936__s64 timeout_nsec;937__u32 count_handles;938__u32 flags;939__u32 first_signaled; /* only valid when not waiting all */940__u32 pad;941/**942* @deadline_nsec - fence deadline hint943*944* Deadline hint, in absolute CLOCK_MONOTONIC, to set on backing945* fence(s) if the DRM_SYNCOBJ_WAIT_FLAGS_WAIT_DEADLINE flag is946* set.947*/948__u64 deadline_nsec;949};950951struct drm_syncobj_timeline_wait {952__u64 handles;953/* wait on specific timeline point for every handles*/954__u64 points;955/* absolute timeout */956__s64 timeout_nsec;957__u32 count_handles;958__u32 flags;959__u32 first_signaled; /* only valid when not waiting all */960__u32 pad;961/**962* @deadline_nsec - fence deadline hint963*964* Deadline hint, in absolute CLOCK_MONOTONIC, to set on backing965* fence(s) if the DRM_SYNCOBJ_WAIT_FLAGS_WAIT_DEADLINE flag is966* set.967*/968__u64 deadline_nsec;969};970971/**972* struct drm_syncobj_eventfd973* @handle: syncobj handle.974* @flags: Zero to wait for the point to be signalled, or975* &DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE to wait for a fence to be976* available for the point.977* @point: syncobj timeline point (set to zero for binary syncobjs).978* @fd: Existing eventfd to sent events to.979* @pad: Must be zero.980*981* Register an eventfd to be signalled by a syncobj. The eventfd counter will982* be incremented by one.983*/984struct drm_syncobj_eventfd {985__u32 handle;986__u32 flags;987__u64 point;988__s32 fd;989__u32 pad;990};991992993struct drm_syncobj_array {994__u64 handles;995__u32 count_handles;996__u32 pad;997};998999#define DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED (1 << 0) /* last available point on timeline syncobj */1000struct drm_syncobj_timeline_array {1001__u64 handles;1002__u64 points;1003__u32 count_handles;1004__u32 flags;1005};100610071008/* Query current scanout sequence number */1009struct drm_crtc_get_sequence {1010__u32 crtc_id; /* requested crtc_id */1011__u32 active; /* return: crtc output is active */1012__u64 sequence; /* return: most recent vblank sequence */1013__s64 sequence_ns; /* return: most recent time of first pixel out */1014};10151016/* Queue event to be delivered at specified sequence. Time stamp marks1017* when the first pixel of the refresh cycle leaves the display engine1018* for the display1019*/1020#define DRM_CRTC_SEQUENCE_RELATIVE 0x00000001 /* sequence is relative to current */1021#define DRM_CRTC_SEQUENCE_NEXT_ON_MISS 0x00000002 /* Use next sequence if we've missed */10221023struct drm_crtc_queue_sequence {1024__u32 crtc_id;1025__u32 flags;1026__u64 sequence; /* on input, target sequence. on output, actual sequence */1027__u64 user_data; /* user data passed to event */1028};10291030#define DRM_CLIENT_NAME_MAX_LEN 641031struct drm_set_client_name {1032__u64 name_len;1033__u64 name;1034};103510361037#if defined(__cplusplus)1038}1039#endif10401041#include "drm_mode.h"10421043#if defined(__cplusplus)1044extern "C" {1045#endif10461047#define DRM_IOCTL_BASE 'd'1048#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr)1049#define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type)1050#define DRM_IOW(nr,type) _IOW(DRM_IOCTL_BASE,nr,type)1051#define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type)10521053#define DRM_IOCTL_VERSION DRM_IOWR(0x00, struct drm_version)1054#define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, struct drm_unique)1055#define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, struct drm_auth)1056#define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, struct drm_irq_busid)1057#define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, struct drm_map)1058#define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client)1059#define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats)1060#define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version)1061#define DRM_IOCTL_MODESET_CTL DRM_IOW(0x08, struct drm_modeset_ctl)1062/**1063* DRM_IOCTL_GEM_CLOSE - Close a GEM handle.1064*1065* GEM handles are not reference-counted by the kernel. User-space is1066* responsible for managing their lifetime. For example, if user-space imports1067* the same memory object twice on the same DRM file description, the same GEM1068* handle is returned by both imports, and user-space needs to ensure1069* &DRM_IOCTL_GEM_CLOSE is performed once only. The same situation can happen1070* when a memory object is allocated, then exported and imported again on the1071* same DRM file description. The &DRM_IOCTL_MODE_GETFB2 IOCTL is an exception1072* and always returns fresh new GEM handles even if an existing GEM handle1073* already refers to the same memory object before the IOCTL is performed.1074*/1075#define DRM_IOCTL_GEM_CLOSE DRM_IOW (0x09, struct drm_gem_close)1076#define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink)1077#define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open)1078#define DRM_IOCTL_GET_CAP DRM_IOWR(0x0c, struct drm_get_cap)1079#define DRM_IOCTL_SET_CLIENT_CAP DRM_IOW( 0x0d, struct drm_set_client_cap)10801081#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique)1082#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth)1083#define DRM_IOCTL_BLOCK DRM_IOWR(0x12, struct drm_block)1084#define DRM_IOCTL_UNBLOCK DRM_IOWR(0x13, struct drm_block)1085#define DRM_IOCTL_CONTROL DRM_IOW( 0x14, struct drm_control)1086#define DRM_IOCTL_ADD_MAP DRM_IOWR(0x15, struct drm_map)1087#define DRM_IOCTL_ADD_BUFS DRM_IOWR(0x16, struct drm_buf_desc)1088#define DRM_IOCTL_MARK_BUFS DRM_IOW( 0x17, struct drm_buf_desc)1089#define DRM_IOCTL_INFO_BUFS DRM_IOWR(0x18, struct drm_buf_info)1090#define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, struct drm_buf_map)1091#define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, struct drm_buf_free)10921093#define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, struct drm_map)10941095#define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, struct drm_ctx_priv_map)1096#define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, struct drm_ctx_priv_map)10971098#define DRM_IOCTL_SET_MASTER DRM_IO(0x1e)1099#define DRM_IOCTL_DROP_MASTER DRM_IO(0x1f)11001101#define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, struct drm_ctx)1102#define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, struct drm_ctx)1103#define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, struct drm_ctx)1104#define DRM_IOCTL_GET_CTX DRM_IOWR(0x23, struct drm_ctx)1105#define DRM_IOCTL_SWITCH_CTX DRM_IOW( 0x24, struct drm_ctx)1106#define DRM_IOCTL_NEW_CTX DRM_IOW( 0x25, struct drm_ctx)1107#define DRM_IOCTL_RES_CTX DRM_IOWR(0x26, struct drm_ctx_res)1108#define DRM_IOCTL_ADD_DRAW DRM_IOWR(0x27, struct drm_draw)1109#define DRM_IOCTL_RM_DRAW DRM_IOWR(0x28, struct drm_draw)1110#define DRM_IOCTL_DMA DRM_IOWR(0x29, struct drm_dma)1111#define DRM_IOCTL_LOCK DRM_IOW( 0x2a, struct drm_lock)1112#define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock)1113#define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock)11141115/**1116* DRM_IOCTL_PRIME_HANDLE_TO_FD - Convert a GEM handle to a DMA-BUF FD.1117*1118* User-space sets &drm_prime_handle.handle with the GEM handle to export and1119* &drm_prime_handle.flags, and gets back a DMA-BUF file descriptor in1120* &drm_prime_handle.fd.1121*1122* The export can fail for any driver-specific reason, e.g. because export is1123* not supported for this specific GEM handle (but might be for others).1124*1125* Support for exporting DMA-BUFs is advertised via &DRM_PRIME_CAP_EXPORT.1126*/1127#define DRM_IOCTL_PRIME_HANDLE_TO_FD DRM_IOWR(0x2d, struct drm_prime_handle)1128/**1129* DRM_IOCTL_PRIME_FD_TO_HANDLE - Convert a DMA-BUF FD to a GEM handle.1130*1131* User-space sets &drm_prime_handle.fd with a DMA-BUF file descriptor to1132* import, and gets back a GEM handle in &drm_prime_handle.handle.1133* &drm_prime_handle.flags is unused.1134*1135* If an existing GEM handle refers to the memory object backing the DMA-BUF,1136* that GEM handle is returned. Therefore user-space which needs to handle1137* arbitrary DMA-BUFs must have a user-space lookup data structure to manually1138* reference-count duplicated GEM handles. For more information see1139* &DRM_IOCTL_GEM_CLOSE.1140*1141* The import can fail for any driver-specific reason, e.g. because import is1142* only supported for DMA-BUFs allocated on this DRM device.1143*1144* Support for importing DMA-BUFs is advertised via &DRM_PRIME_CAP_IMPORT.1145*/1146#define DRM_IOCTL_PRIME_FD_TO_HANDLE DRM_IOWR(0x2e, struct drm_prime_handle)11471148#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30)1149#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31)1150#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, struct drm_agp_mode)1151#define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, struct drm_agp_info)1152#define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, struct drm_agp_buffer)1153#define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, struct drm_agp_buffer)1154#define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, struct drm_agp_binding)1155#define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, struct drm_agp_binding)11561157#define DRM_IOCTL_SG_ALLOC DRM_IOWR(0x38, struct drm_scatter_gather)1158#define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, struct drm_scatter_gather)11591160#define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, union drm_wait_vblank)11611162#define DRM_IOCTL_CRTC_GET_SEQUENCE DRM_IOWR(0x3b, struct drm_crtc_get_sequence)1163#define DRM_IOCTL_CRTC_QUEUE_SEQUENCE DRM_IOWR(0x3c, struct drm_crtc_queue_sequence)11641165#define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, struct drm_update_draw)11661167#define DRM_IOCTL_MODE_GETRESOURCES DRM_IOWR(0xA0, struct drm_mode_card_res)1168#define DRM_IOCTL_MODE_GETCRTC DRM_IOWR(0xA1, struct drm_mode_crtc)1169#define DRM_IOCTL_MODE_SETCRTC DRM_IOWR(0xA2, struct drm_mode_crtc)1170#define DRM_IOCTL_MODE_CURSOR DRM_IOWR(0xA3, struct drm_mode_cursor)1171#define DRM_IOCTL_MODE_GETGAMMA DRM_IOWR(0xA4, struct drm_mode_crtc_lut)1172#define DRM_IOCTL_MODE_SETGAMMA DRM_IOWR(0xA5, struct drm_mode_crtc_lut)1173#define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xA6, struct drm_mode_get_encoder)1174#define DRM_IOCTL_MODE_GETCONNECTOR DRM_IOWR(0xA7, struct drm_mode_get_connector)1175#define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA8, struct drm_mode_mode_cmd) /* deprecated (never worked) */1176#define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd) /* deprecated (never worked) */11771178#define DRM_IOCTL_MODE_GETPROPERTY DRM_IOWR(0xAA, struct drm_mode_get_property)1179#define DRM_IOCTL_MODE_SETPROPERTY DRM_IOWR(0xAB, struct drm_mode_connector_set_property)1180#define DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xAC, struct drm_mode_get_blob)1181#define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd)1182#define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd)1183/**1184* DRM_IOCTL_MODE_RMFB - Remove a framebuffer.1185*1186* This removes a framebuffer previously added via ADDFB/ADDFB2. The IOCTL1187* argument is a framebuffer object ID.1188*1189* Warning: removing a framebuffer currently in-use on an enabled plane will1190* disable that plane. The CRTC the plane is linked to may also be disabled1191* (depending on driver capabilities).1192*/1193#define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int)1194#define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip)1195#define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd)11961197/**1198* DRM_IOCTL_MODE_CREATE_DUMB - Create a new dumb buffer object.1199*1200* KMS dumb buffers provide a very primitive way to allocate a buffer object1201* suitable for scanout and map it for software rendering. KMS dumb buffers are1202* not suitable for hardware-accelerated rendering nor video decoding. KMS dumb1203* buffers are not suitable to be displayed on any other device than the KMS1204* device where they were allocated from. Also see1205* :ref:`kms_dumb_buffer_objects`.1206*1207* The IOCTL argument is a struct drm_mode_create_dumb.1208*1209* User-space is expected to create a KMS dumb buffer via this IOCTL, then add1210* it as a KMS framebuffer via &DRM_IOCTL_MODE_ADDFB and map it via1211* &DRM_IOCTL_MODE_MAP_DUMB.1212*1213* &DRM_CAP_DUMB_BUFFER indicates whether this IOCTL is supported.1214* &DRM_CAP_DUMB_PREFERRED_DEPTH and &DRM_CAP_DUMB_PREFER_SHADOW indicate1215* driver preferences for dumb buffers.1216*/1217#define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb)1218#define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb)1219#define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb)1220#define DRM_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xB5, struct drm_mode_get_plane_res)1221#define DRM_IOCTL_MODE_GETPLANE DRM_IOWR(0xB6, struct drm_mode_get_plane)1222#define DRM_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct drm_mode_set_plane)1223#define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2)1224#define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties)1225#define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property)1226#define DRM_IOCTL_MODE_CURSOR2 DRM_IOWR(0xBB, struct drm_mode_cursor2)1227#define DRM_IOCTL_MODE_ATOMIC DRM_IOWR(0xBC, struct drm_mode_atomic)1228#define DRM_IOCTL_MODE_CREATEPROPBLOB DRM_IOWR(0xBD, struct drm_mode_create_blob)1229#define DRM_IOCTL_MODE_DESTROYPROPBLOB DRM_IOWR(0xBE, struct drm_mode_destroy_blob)12301231#define DRM_IOCTL_SYNCOBJ_CREATE DRM_IOWR(0xBF, struct drm_syncobj_create)1232#define DRM_IOCTL_SYNCOBJ_DESTROY DRM_IOWR(0xC0, struct drm_syncobj_destroy)1233#define DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD DRM_IOWR(0xC1, struct drm_syncobj_handle)1234#define DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE DRM_IOWR(0xC2, struct drm_syncobj_handle)1235#define DRM_IOCTL_SYNCOBJ_WAIT DRM_IOWR(0xC3, struct drm_syncobj_wait)1236#define DRM_IOCTL_SYNCOBJ_RESET DRM_IOWR(0xC4, struct drm_syncobj_array)1237#define DRM_IOCTL_SYNCOBJ_SIGNAL DRM_IOWR(0xC5, struct drm_syncobj_array)12381239#define DRM_IOCTL_MODE_CREATE_LEASE DRM_IOWR(0xC6, struct drm_mode_create_lease)1240#define DRM_IOCTL_MODE_LIST_LESSEES DRM_IOWR(0xC7, struct drm_mode_list_lessees)1241#define DRM_IOCTL_MODE_GET_LEASE DRM_IOWR(0xC8, struct drm_mode_get_lease)1242#define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease)12431244#define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait)1245#define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, struct drm_syncobj_timeline_array)1246#define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer)1247#define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL DRM_IOWR(0xCD, struct drm_syncobj_timeline_array)12481249/**1250* DRM_IOCTL_MODE_GETFB2 - Get framebuffer metadata.1251*1252* This queries metadata about a framebuffer. User-space fills1253* &drm_mode_fb_cmd2.fb_id as the input, and the kernels fills the rest of the1254* struct as the output.1255*1256* If the client is DRM master or has &CAP_SYS_ADMIN, &drm_mode_fb_cmd2.handles1257* will be filled with GEM buffer handles. Fresh new GEM handles are always1258* returned, even if another GEM handle referring to the same memory object1259* already exists on the DRM file description. The caller is responsible for1260* removing the new handles, e.g. via the &DRM_IOCTL_GEM_CLOSE IOCTL. The same1261* new handle will be returned for multiple planes in case they use the same1262* memory object. Planes are valid until one has a zero handle -- this can be1263* used to compute the number of planes.1264*1265* Otherwise, &drm_mode_fb_cmd2.handles will be zeroed and planes are valid1266* until one has a zero &drm_mode_fb_cmd2.pitches.1267*1268* If the framebuffer has a format modifier, &DRM_MODE_FB_MODIFIERS will be set1269* in &drm_mode_fb_cmd2.flags and &drm_mode_fb_cmd2.modifier will contain the1270* modifier. Otherwise, user-space must ignore &drm_mode_fb_cmd2.modifier.1271*1272* To obtain DMA-BUF FDs for each plane without leaking GEM handles, user-space1273* can export each handle via &DRM_IOCTL_PRIME_HANDLE_TO_FD, then immediately1274* close each unique handle via &DRM_IOCTL_GEM_CLOSE, making sure to not1275* double-close handles which are specified multiple times in the array.1276*/1277#define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE, struct drm_mode_fb_cmd2)12781279#define DRM_IOCTL_SYNCOBJ_EVENTFD DRM_IOWR(0xCF, struct drm_syncobj_eventfd)12801281/**1282* DRM_IOCTL_MODE_CLOSEFB - Close a framebuffer.1283*1284* This closes a framebuffer previously added via ADDFB/ADDFB2. The IOCTL1285* argument is a framebuffer object ID.1286*1287* This IOCTL is similar to &DRM_IOCTL_MODE_RMFB, except it doesn't disable1288* planes and CRTCs. As long as the framebuffer is used by a plane, it's kept1289* alive. When the plane no longer uses the framebuffer (because the1290* framebuffer is replaced with another one, or the plane is disabled), the1291* framebuffer is cleaned up.1292*1293* This is useful to implement flicker-free transitions between two processes.1294*1295* Depending on the threat model, user-space may want to ensure that the1296* framebuffer doesn't expose any sensitive user information: closed1297* framebuffers attached to a plane can be read back by the next DRM master.1298*/1299#define DRM_IOCTL_MODE_CLOSEFB DRM_IOWR(0xD0, struct drm_mode_closefb)13001301/**1302* DRM_IOCTL_SET_CLIENT_NAME - Attach a name to a drm_file1303*1304* Having a name allows for easier tracking and debugging.1305* The length of the name (without null ending char) must be1306* <= DRM_CLIENT_NAME_MAX_LEN.1307* The call will fail if the name contains whitespaces or non-printable chars.1308*/1309#define DRM_IOCTL_SET_CLIENT_NAME DRM_IOWR(0xD1, struct drm_set_client_name)13101311/*1312* Device specific ioctls should only be in their respective headers1313* The device specific ioctl range is from 0x40 to 0x9f.1314* Generic IOCTLS restart at 0xA0.1315*1316* \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and1317* drmCommandReadWrite().1318*/1319#define DRM_COMMAND_BASE 0x401320#define DRM_COMMAND_END 0xA013211322/**1323* struct drm_event - Header for DRM events1324* @type: event type.1325* @length: total number of payload bytes (including header).1326*1327* This struct is a header for events written back to user-space on the DRM FD.1328* A read on the DRM FD will always only return complete events: e.g. if the1329* read buffer is 100 bytes large and there are two 64 byte events pending,1330* only one will be returned.1331*1332* Event types 0 - 0x7fffffff are generic DRM events, 0x80000000 and1333* up are chipset specific. Generic DRM events include &DRM_EVENT_VBLANK,1334* &DRM_EVENT_FLIP_COMPLETE and &DRM_EVENT_CRTC_SEQUENCE.1335*/1336struct drm_event {1337__u32 type;1338__u32 length;1339};13401341/**1342* DRM_EVENT_VBLANK - vertical blanking event1343*1344* This event is sent in response to &DRM_IOCTL_WAIT_VBLANK with the1345* &_DRM_VBLANK_EVENT flag set.1346*1347* The event payload is a struct drm_event_vblank.1348*/1349#define DRM_EVENT_VBLANK 0x011350/**1351* DRM_EVENT_FLIP_COMPLETE - page-flip completion event1352*1353* This event is sent in response to an atomic commit or legacy page-flip with1354* the &DRM_MODE_PAGE_FLIP_EVENT flag set.1355*1356* The event payload is a struct drm_event_vblank.1357*/1358#define DRM_EVENT_FLIP_COMPLETE 0x021359/**1360* DRM_EVENT_CRTC_SEQUENCE - CRTC sequence event1361*1362* This event is sent in response to &DRM_IOCTL_CRTC_QUEUE_SEQUENCE.1363*1364* The event payload is a struct drm_event_crtc_sequence.1365*/1366#define DRM_EVENT_CRTC_SEQUENCE 0x0313671368struct drm_event_vblank {1369struct drm_event base;1370__u64 user_data;1371__u32 tv_sec;1372__u32 tv_usec;1373__u32 sequence;1374__u32 crtc_id; /* 0 on older kernels that do not support this */1375};13761377/* Event delivered at sequence. Time stamp marks when the first pixel1378* of the refresh cycle leaves the display engine for the display1379*/1380struct drm_event_crtc_sequence {1381struct drm_event base;1382__u64 user_data;1383__s64 time_ns;1384__u64 sequence;1385};13861387/* typedef area */1388#ifndef __KERNEL__1389typedef struct drm_clip_rect drm_clip_rect_t;1390typedef struct drm_drawable_info drm_drawable_info_t;1391typedef struct drm_tex_region drm_tex_region_t;1392typedef struct drm_hw_lock drm_hw_lock_t;1393typedef struct drm_version drm_version_t;1394typedef struct drm_unique drm_unique_t;1395typedef struct drm_list drm_list_t;1396typedef struct drm_block drm_block_t;1397typedef struct drm_control drm_control_t;1398typedef enum drm_map_type drm_map_type_t;1399typedef enum drm_map_flags drm_map_flags_t;1400typedef struct drm_ctx_priv_map drm_ctx_priv_map_t;1401typedef struct drm_map drm_map_t;1402typedef struct drm_client drm_client_t;1403typedef enum drm_stat_type drm_stat_type_t;1404typedef struct drm_stats drm_stats_t;1405typedef enum drm_lock_flags drm_lock_flags_t;1406typedef struct drm_lock drm_lock_t;1407typedef enum drm_dma_flags drm_dma_flags_t;1408typedef struct drm_buf_desc drm_buf_desc_t;1409typedef struct drm_buf_info drm_buf_info_t;1410typedef struct drm_buf_free drm_buf_free_t;1411typedef struct drm_buf_pub drm_buf_pub_t;1412typedef struct drm_buf_map drm_buf_map_t;1413typedef struct drm_dma drm_dma_t;1414typedef union drm_wait_vblank drm_wait_vblank_t;1415typedef struct drm_agp_mode drm_agp_mode_t;1416typedef enum drm_ctx_flags drm_ctx_flags_t;1417typedef struct drm_ctx drm_ctx_t;1418typedef struct drm_ctx_res drm_ctx_res_t;1419typedef struct drm_draw drm_draw_t;1420typedef struct drm_update_draw drm_update_draw_t;1421typedef struct drm_auth drm_auth_t;1422typedef struct drm_irq_busid drm_irq_busid_t;1423typedef enum drm_vblank_seq_type drm_vblank_seq_type_t;14241425typedef struct drm_agp_buffer drm_agp_buffer_t;1426typedef struct drm_agp_binding drm_agp_binding_t;1427typedef struct drm_agp_info drm_agp_info_t;1428typedef struct drm_scatter_gather drm_scatter_gather_t;1429typedef struct drm_set_version drm_set_version_t;1430#endif14311432#if defined(__cplusplus)1433}1434#endif14351436#endif143714381439