/*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/**600* struct drm_gem_close - Argument for &DRM_IOCTL_GEM_CLOSE ioctl.601* @handle: Handle of the object to be closed.602* @pad: Padding.603*604* Releases the handle to an mm object.605*/606struct drm_gem_close {607__u32 handle;608__u32 pad;609};610611/**612* struct drm_gem_flink - Argument for &DRM_IOCTL_GEM_FLINK ioctl.613* @handle: Handle for the object being named.614* @name: Returned global name.615*616* Create a global name for an object, returning the name.617*618* Note that the name does not hold a reference; when the object619* is freed, the name goes away.620*/621struct drm_gem_flink {622__u32 handle;623__u32 name;624};625626/**627* struct drm_gem_open - Argument for &DRM_IOCTL_GEM_OPEN ioctl.628* @name: Name of object being opened.629* @handle: Returned handle for the object.630* @size: Returned size of the object631*632* Open an object using the global name, returning a handle and the size.633*634* This handle (of course) holds a reference to the object, so the object635* will not go away until the handle is deleted.636*/637struct drm_gem_open {638__u32 name;639__u32 handle;640__u64 size;641};642643/**644* struct drm_gem_change_handle - Argument for &DRM_IOCTL_GEM_CHANGE_HANDLE ioctl.645* @handle: The handle of a gem object.646* @new_handle: An available gem handle.647*648* This ioctl changes the handle of a GEM object to the specified one.649* The new handle must be unused. On success the old handle is closed650* and all further IOCTL should refer to the new handle only.651* Calls to DRM_IOCTL_PRIME_FD_TO_HANDLE will return the new handle.652*/653struct drm_gem_change_handle {654__u32 handle;655__u32 new_handle;656};657658/**659* DRM_CAP_DUMB_BUFFER660*661* If set to 1, the driver supports creating dumb buffers via the662* &DRM_IOCTL_MODE_CREATE_DUMB ioctl.663*/664#define DRM_CAP_DUMB_BUFFER 0x1665/**666* DRM_CAP_VBLANK_HIGH_CRTC667*668* If set to 1, the kernel supports specifying a :ref:`CRTC index<crtc_index>`669* in the high bits of &drm_wait_vblank_request.type.670*671* Starting kernel version 2.6.39, this capability is always set to 1.672*/673#define DRM_CAP_VBLANK_HIGH_CRTC 0x2674/**675* DRM_CAP_DUMB_PREFERRED_DEPTH676*677* The preferred bit depth for dumb buffers.678*679* The bit depth is the number of bits used to indicate the color of a single680* pixel excluding any padding. This is different from the number of bits per681* pixel. For instance, XRGB8888 has a bit depth of 24 but has 32 bits per682* pixel.683*684* Note that this preference only applies to dumb buffers, it's irrelevant for685* other types of buffers.686*/687#define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3688/**689* DRM_CAP_DUMB_PREFER_SHADOW690*691* If set to 1, the driver prefers userspace to render to a shadow buffer692* instead of directly rendering to a dumb buffer. For best speed, userspace693* should do streaming ordered memory copies into the dumb buffer and never694* read from it.695*696* Note that this preference only applies to dumb buffers, it's irrelevant for697* other types of buffers.698*/699#define DRM_CAP_DUMB_PREFER_SHADOW 0x4700/**701* DRM_CAP_PRIME702*703* Bitfield of supported PRIME sharing capabilities. See &DRM_PRIME_CAP_IMPORT704* and &DRM_PRIME_CAP_EXPORT.705*706* Starting from kernel version 6.6, both &DRM_PRIME_CAP_IMPORT and707* &DRM_PRIME_CAP_EXPORT are always advertised.708*709* PRIME buffers are exposed as dma-buf file descriptors.710* See :ref:`prime_buffer_sharing`.711*/712#define DRM_CAP_PRIME 0x5713/**714* DRM_PRIME_CAP_IMPORT715*716* If this bit is set in &DRM_CAP_PRIME, the driver supports importing PRIME717* buffers via the &DRM_IOCTL_PRIME_FD_TO_HANDLE ioctl.718*719* Starting from kernel version 6.6, this bit is always set in &DRM_CAP_PRIME.720*/721#define DRM_PRIME_CAP_IMPORT 0x1722/**723* DRM_PRIME_CAP_EXPORT724*725* If this bit is set in &DRM_CAP_PRIME, the driver supports exporting PRIME726* buffers via the &DRM_IOCTL_PRIME_HANDLE_TO_FD ioctl.727*728* Starting from kernel version 6.6, this bit is always set in &DRM_CAP_PRIME.729*/730#define DRM_PRIME_CAP_EXPORT 0x2731/**732* DRM_CAP_TIMESTAMP_MONOTONIC733*734* If set to 0, the kernel will report timestamps with ``CLOCK_REALTIME`` in735* struct drm_event_vblank. If set to 1, the kernel will report timestamps with736* ``CLOCK_MONOTONIC``. See ``clock_gettime(2)`` for the definition of these737* clocks.738*739* Starting from kernel version 2.6.39, the default value for this capability740* is 1. Starting kernel version 4.15, this capability is always set to 1.741*/742#define DRM_CAP_TIMESTAMP_MONOTONIC 0x6743/**744* DRM_CAP_ASYNC_PAGE_FLIP745*746* If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC for legacy747* page-flips.748*/749#define DRM_CAP_ASYNC_PAGE_FLIP 0x7750/**751* DRM_CAP_CURSOR_WIDTH752*753* The ``CURSOR_WIDTH`` and ``CURSOR_HEIGHT`` capabilities return a valid754* width x height combination for the hardware cursor. The intention is that a755* hardware agnostic userspace can query a cursor plane size to use.756*757* Note that the cross-driver contract is to merely return a valid size;758* drivers are free to attach another meaning on top, eg. i915 returns the759* maximum plane size.760*/761#define DRM_CAP_CURSOR_WIDTH 0x8762/**763* DRM_CAP_CURSOR_HEIGHT764*765* See &DRM_CAP_CURSOR_WIDTH.766*/767#define DRM_CAP_CURSOR_HEIGHT 0x9768/**769* DRM_CAP_ADDFB2_MODIFIERS770*771* If set to 1, the driver supports supplying modifiers in the772* &DRM_IOCTL_MODE_ADDFB2 ioctl.773*/774#define DRM_CAP_ADDFB2_MODIFIERS 0x10775/**776* DRM_CAP_PAGE_FLIP_TARGET777*778* If set to 1, the driver supports the &DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE and779* &DRM_MODE_PAGE_FLIP_TARGET_RELATIVE flags in780* &drm_mode_crtc_page_flip_target.flags for the &DRM_IOCTL_MODE_PAGE_FLIP781* ioctl.782*/783#define DRM_CAP_PAGE_FLIP_TARGET 0x11784/**785* DRM_CAP_CRTC_IN_VBLANK_EVENT786*787* If set to 1, the kernel supports reporting the CRTC ID in788* &drm_event_vblank.crtc_id for the &DRM_EVENT_VBLANK and789* &DRM_EVENT_FLIP_COMPLETE events.790*791* Starting kernel version 4.12, this capability is always set to 1.792*/793#define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12794/**795* DRM_CAP_SYNCOBJ796*797* If set to 1, the driver supports sync objects. See :ref:`drm_sync_objects`.798*/799#define DRM_CAP_SYNCOBJ 0x13800/**801* DRM_CAP_SYNCOBJ_TIMELINE802*803* If set to 1, the driver supports timeline operations on sync objects. See804* :ref:`drm_sync_objects`.805*/806#define DRM_CAP_SYNCOBJ_TIMELINE 0x14807/**808* DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP809*810* If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC for atomic811* commits.812*/813#define DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP 0x15814815/* DRM_IOCTL_GET_CAP ioctl argument type */816struct drm_get_cap {817__u64 capability;818__u64 value;819};820821/**822* DRM_CLIENT_CAP_STEREO_3D823*824* If set to 1, the DRM core will expose the stereo 3D capabilities of the825* monitor by advertising the supported 3D layouts in the flags of struct826* drm_mode_modeinfo. See ``DRM_MODE_FLAG_3D_*``.827*828* This capability is always supported for all drivers starting from kernel829* version 3.13.830*/831#define DRM_CLIENT_CAP_STEREO_3D 1832833/**834* DRM_CLIENT_CAP_UNIVERSAL_PLANES835*836* If set to 1, the DRM core will expose all planes (overlay, primary, and837* cursor) to userspace.838*839* This capability has been introduced in kernel version 3.15. Starting from840* kernel version 3.17, this capability is always supported for all drivers.841*/842#define DRM_CLIENT_CAP_UNIVERSAL_PLANES 2843844/**845* DRM_CLIENT_CAP_ATOMIC846*847* If set to 1, the DRM core will expose atomic properties to userspace. This848* implicitly enables &DRM_CLIENT_CAP_UNIVERSAL_PLANES and849* &DRM_CLIENT_CAP_ASPECT_RATIO.850*851* If the driver doesn't support atomic mode-setting, enabling this capability852* will fail with -EOPNOTSUPP.853*854* This capability has been introduced in kernel version 4.0. Starting from855* kernel version 4.2, this capability is always supported for atomic-capable856* drivers.857*/858#define DRM_CLIENT_CAP_ATOMIC 3859860/**861* DRM_CLIENT_CAP_ASPECT_RATIO862*863* If set to 1, the DRM core will provide aspect ratio information in modes.864* See ``DRM_MODE_FLAG_PIC_AR_*``.865*866* This capability is always supported for all drivers starting from kernel867* version 4.18.868*/869#define DRM_CLIENT_CAP_ASPECT_RATIO 4870871/**872* DRM_CLIENT_CAP_WRITEBACK_CONNECTORS873*874* If set to 1, the DRM core will expose special connectors to be used for875* writing back to memory the scene setup in the commit. The client must enable876* &DRM_CLIENT_CAP_ATOMIC first.877*878* This capability is always supported for atomic-capable drivers starting from879* kernel version 4.19.880*/881#define DRM_CLIENT_CAP_WRITEBACK_CONNECTORS 5882883/**884* DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT885*886* Drivers for para-virtualized hardware (e.g. vmwgfx, qxl, virtio and887* virtualbox) have additional restrictions for cursor planes (thus888* making cursor planes on those drivers not truly universal,) e.g.889* they need cursor planes to act like one would expect from a mouse890* cursor and have correctly set hotspot properties.891* If this client cap is not set the DRM core will hide cursor plane on892* those virtualized drivers because not setting it implies that the893* client is not capable of dealing with those extra restictions.894* Clients which do set cursor hotspot and treat the cursor plane895* like a mouse cursor should set this property.896* The client must enable &DRM_CLIENT_CAP_ATOMIC first.897*898* Setting this property on drivers which do not special case899* cursor planes (i.e. non-virtualized drivers) will return900* EOPNOTSUPP, which can be used by userspace to gauge901* requirements of the hardware/drivers they're running on.902*903* This capability is always supported for atomic-capable virtualized904* drivers starting from kernel version 6.6.905*/906#define DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT 6907908/* DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */909struct drm_set_client_cap {910__u64 capability;911__u64 value;912};913914#define DRM_RDWR O_RDWR915#define DRM_CLOEXEC O_CLOEXEC916struct drm_prime_handle {917__u32 handle;918919/** Flags.. only applicable for handle->fd */920__u32 flags;921922/** Returned dmabuf file descriptor */923__s32 fd;924};925926struct drm_syncobj_create {927__u32 handle;928#define DRM_SYNCOBJ_CREATE_SIGNALED (1 << 0)929__u32 flags;930};931932struct drm_syncobj_destroy {933__u32 handle;934__u32 pad;935};936937#define DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE (1 << 0)938#define DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_TIMELINE (1 << 1)939#define DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE (1 << 0)940#define DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_TIMELINE (1 << 1)941struct drm_syncobj_handle {942__u32 handle;943__u32 flags;944945__s32 fd;946__u32 pad;947948__u64 point;949};950951struct drm_syncobj_transfer {952__u32 src_handle;953__u32 dst_handle;954__u64 src_point;955__u64 dst_point;956__u32 flags;957__u32 pad;958};959960#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)961#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1)962#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2) /* wait for time point to become available */963#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_DEADLINE (1 << 3) /* set fence deadline to deadline_nsec */964struct drm_syncobj_wait {965__u64 handles;966/* absolute timeout */967__s64 timeout_nsec;968__u32 count_handles;969__u32 flags;970__u32 first_signaled; /* only valid when not waiting all */971__u32 pad;972/**973* @deadline_nsec - fence deadline hint974*975* Deadline hint, in absolute CLOCK_MONOTONIC, to set on backing976* fence(s) if the DRM_SYNCOBJ_WAIT_FLAGS_WAIT_DEADLINE flag is977* set.978*/979__u64 deadline_nsec;980};981982struct drm_syncobj_timeline_wait {983__u64 handles;984/* wait on specific timeline point for every handles*/985__u64 points;986/* absolute timeout */987__s64 timeout_nsec;988__u32 count_handles;989__u32 flags;990__u32 first_signaled; /* only valid when not waiting all */991__u32 pad;992/**993* @deadline_nsec - fence deadline hint994*995* Deadline hint, in absolute CLOCK_MONOTONIC, to set on backing996* fence(s) if the DRM_SYNCOBJ_WAIT_FLAGS_WAIT_DEADLINE flag is997* set.998*/999__u64 deadline_nsec;1000};10011002/**1003* struct drm_syncobj_eventfd1004* @handle: syncobj handle.1005* @flags: Zero to wait for the point to be signalled, or1006* &DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE to wait for a fence to be1007* available for the point.1008* @point: syncobj timeline point (set to zero for binary syncobjs).1009* @fd: Existing eventfd to sent events to.1010* @pad: Must be zero.1011*1012* Register an eventfd to be signalled by a syncobj. The eventfd counter will1013* be incremented by one.1014*/1015struct drm_syncobj_eventfd {1016__u32 handle;1017__u32 flags;1018__u64 point;1019__s32 fd;1020__u32 pad;1021};102210231024struct drm_syncobj_array {1025__u64 handles;1026__u32 count_handles;1027__u32 pad;1028};10291030#define DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED (1 << 0) /* last available point on timeline syncobj */1031struct drm_syncobj_timeline_array {1032__u64 handles;1033__u64 points;1034__u32 count_handles;1035__u32 flags;1036};103710381039/* Query current scanout sequence number */1040struct drm_crtc_get_sequence {1041__u32 crtc_id; /* requested crtc_id */1042__u32 active; /* return: crtc output is active */1043__u64 sequence; /* return: most recent vblank sequence */1044__s64 sequence_ns; /* return: most recent time of first pixel out */1045};10461047/* Queue event to be delivered at specified sequence. Time stamp marks1048* when the first pixel of the refresh cycle leaves the display engine1049* for the display1050*/1051#define DRM_CRTC_SEQUENCE_RELATIVE 0x00000001 /* sequence is relative to current */1052#define DRM_CRTC_SEQUENCE_NEXT_ON_MISS 0x00000002 /* Use next sequence if we've missed */10531054struct drm_crtc_queue_sequence {1055__u32 crtc_id;1056__u32 flags;1057__u64 sequence; /* on input, target sequence. on output, actual sequence */1058__u64 user_data; /* user data passed to event */1059};10601061#define DRM_CLIENT_NAME_MAX_LEN 641062struct drm_set_client_name {1063__u64 name_len;1064__u64 name;1065};106610671068#if defined(__cplusplus)1069}1070#endif10711072#include "drm_mode.h"10731074#if defined(__cplusplus)1075extern "C" {1076#endif10771078#define DRM_IOCTL_BASE 'd'1079#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr)1080#define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type)1081#define DRM_IOW(nr,type) _IOW(DRM_IOCTL_BASE,nr,type)1082#define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type)10831084#define DRM_IOCTL_VERSION DRM_IOWR(0x00, struct drm_version)1085#define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, struct drm_unique)1086#define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, struct drm_auth)1087#define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, struct drm_irq_busid)1088#define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, struct drm_map)1089#define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client)1090#define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats)1091#define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version)1092#define DRM_IOCTL_MODESET_CTL DRM_IOW(0x08, struct drm_modeset_ctl)1093/**1094* DRM_IOCTL_GEM_CLOSE - Close a GEM handle.1095*1096* GEM handles are not reference-counted by the kernel. User-space is1097* responsible for managing their lifetime. For example, if user-space imports1098* the same memory object twice on the same DRM file description, the same GEM1099* handle is returned by both imports, and user-space needs to ensure1100* &DRM_IOCTL_GEM_CLOSE is performed once only. The same situation can happen1101* when a memory object is allocated, then exported and imported again on the1102* same DRM file description. The &DRM_IOCTL_MODE_GETFB2 IOCTL is an exception1103* and always returns fresh new GEM handles even if an existing GEM handle1104* already refers to the same memory object before the IOCTL is performed.1105*/1106#define DRM_IOCTL_GEM_CLOSE DRM_IOW (0x09, struct drm_gem_close)1107#define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink)1108#define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open)1109#define DRM_IOCTL_GET_CAP DRM_IOWR(0x0c, struct drm_get_cap)1110#define DRM_IOCTL_SET_CLIENT_CAP DRM_IOW( 0x0d, struct drm_set_client_cap)11111112#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique)1113#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth)1114#define DRM_IOCTL_BLOCK DRM_IOWR(0x12, struct drm_block)1115#define DRM_IOCTL_UNBLOCK DRM_IOWR(0x13, struct drm_block)1116#define DRM_IOCTL_CONTROL DRM_IOW( 0x14, struct drm_control)1117#define DRM_IOCTL_ADD_MAP DRM_IOWR(0x15, struct drm_map)1118#define DRM_IOCTL_ADD_BUFS DRM_IOWR(0x16, struct drm_buf_desc)1119#define DRM_IOCTL_MARK_BUFS DRM_IOW( 0x17, struct drm_buf_desc)1120#define DRM_IOCTL_INFO_BUFS DRM_IOWR(0x18, struct drm_buf_info)1121#define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, struct drm_buf_map)1122#define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, struct drm_buf_free)11231124#define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, struct drm_map)11251126#define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, struct drm_ctx_priv_map)1127#define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, struct drm_ctx_priv_map)11281129#define DRM_IOCTL_SET_MASTER DRM_IO(0x1e)1130#define DRM_IOCTL_DROP_MASTER DRM_IO(0x1f)11311132#define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, struct drm_ctx)1133#define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, struct drm_ctx)1134#define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, struct drm_ctx)1135#define DRM_IOCTL_GET_CTX DRM_IOWR(0x23, struct drm_ctx)1136#define DRM_IOCTL_SWITCH_CTX DRM_IOW( 0x24, struct drm_ctx)1137#define DRM_IOCTL_NEW_CTX DRM_IOW( 0x25, struct drm_ctx)1138#define DRM_IOCTL_RES_CTX DRM_IOWR(0x26, struct drm_ctx_res)1139#define DRM_IOCTL_ADD_DRAW DRM_IOWR(0x27, struct drm_draw)1140#define DRM_IOCTL_RM_DRAW DRM_IOWR(0x28, struct drm_draw)1141#define DRM_IOCTL_DMA DRM_IOWR(0x29, struct drm_dma)1142#define DRM_IOCTL_LOCK DRM_IOW( 0x2a, struct drm_lock)1143#define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock)1144#define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock)11451146/**1147* DRM_IOCTL_PRIME_HANDLE_TO_FD - Convert a GEM handle to a DMA-BUF FD.1148*1149* User-space sets &drm_prime_handle.handle with the GEM handle to export and1150* &drm_prime_handle.flags, and gets back a DMA-BUF file descriptor in1151* &drm_prime_handle.fd.1152*1153* The export can fail for any driver-specific reason, e.g. because export is1154* not supported for this specific GEM handle (but might be for others).1155*1156* Support for exporting DMA-BUFs is advertised via &DRM_PRIME_CAP_EXPORT.1157*/1158#define DRM_IOCTL_PRIME_HANDLE_TO_FD DRM_IOWR(0x2d, struct drm_prime_handle)1159/**1160* DRM_IOCTL_PRIME_FD_TO_HANDLE - Convert a DMA-BUF FD to a GEM handle.1161*1162* User-space sets &drm_prime_handle.fd with a DMA-BUF file descriptor to1163* import, and gets back a GEM handle in &drm_prime_handle.handle.1164* &drm_prime_handle.flags is unused.1165*1166* If an existing GEM handle refers to the memory object backing the DMA-BUF,1167* that GEM handle is returned. Therefore user-space which needs to handle1168* arbitrary DMA-BUFs must have a user-space lookup data structure to manually1169* reference-count duplicated GEM handles. For more information see1170* &DRM_IOCTL_GEM_CLOSE.1171*1172* The import can fail for any driver-specific reason, e.g. because import is1173* only supported for DMA-BUFs allocated on this DRM device.1174*1175* Support for importing DMA-BUFs is advertised via &DRM_PRIME_CAP_IMPORT.1176*/1177#define DRM_IOCTL_PRIME_FD_TO_HANDLE DRM_IOWR(0x2e, struct drm_prime_handle)11781179#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30)1180#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31)1181#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, struct drm_agp_mode)1182#define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, struct drm_agp_info)1183#define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, struct drm_agp_buffer)1184#define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, struct drm_agp_buffer)1185#define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, struct drm_agp_binding)1186#define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, struct drm_agp_binding)11871188#define DRM_IOCTL_SG_ALLOC DRM_IOWR(0x38, struct drm_scatter_gather)1189#define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, struct drm_scatter_gather)11901191#define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, union drm_wait_vblank)11921193#define DRM_IOCTL_CRTC_GET_SEQUENCE DRM_IOWR(0x3b, struct drm_crtc_get_sequence)1194#define DRM_IOCTL_CRTC_QUEUE_SEQUENCE DRM_IOWR(0x3c, struct drm_crtc_queue_sequence)11951196#define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, struct drm_update_draw)11971198#define DRM_IOCTL_MODE_GETRESOURCES DRM_IOWR(0xA0, struct drm_mode_card_res)1199#define DRM_IOCTL_MODE_GETCRTC DRM_IOWR(0xA1, struct drm_mode_crtc)1200#define DRM_IOCTL_MODE_SETCRTC DRM_IOWR(0xA2, struct drm_mode_crtc)1201#define DRM_IOCTL_MODE_CURSOR DRM_IOWR(0xA3, struct drm_mode_cursor)1202#define DRM_IOCTL_MODE_GETGAMMA DRM_IOWR(0xA4, struct drm_mode_crtc_lut)1203#define DRM_IOCTL_MODE_SETGAMMA DRM_IOWR(0xA5, struct drm_mode_crtc_lut)1204#define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xA6, struct drm_mode_get_encoder)1205#define DRM_IOCTL_MODE_GETCONNECTOR DRM_IOWR(0xA7, struct drm_mode_get_connector)1206#define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA8, struct drm_mode_mode_cmd) /* deprecated (never worked) */1207#define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd) /* deprecated (never worked) */12081209#define DRM_IOCTL_MODE_GETPROPERTY DRM_IOWR(0xAA, struct drm_mode_get_property)1210#define DRM_IOCTL_MODE_SETPROPERTY DRM_IOWR(0xAB, struct drm_mode_connector_set_property)1211#define DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xAC, struct drm_mode_get_blob)1212#define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd)1213#define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd)1214/**1215* DRM_IOCTL_MODE_RMFB - Remove a framebuffer.1216*1217* This removes a framebuffer previously added via ADDFB/ADDFB2. The IOCTL1218* argument is a framebuffer object ID.1219*1220* Warning: removing a framebuffer currently in-use on an enabled plane will1221* disable that plane. The CRTC the plane is linked to may also be disabled1222* (depending on driver capabilities).1223*/1224#define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int)1225#define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip)1226#define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd)12271228/**1229* DRM_IOCTL_MODE_CREATE_DUMB - Create a new dumb buffer object.1230*1231* KMS dumb buffers provide a very primitive way to allocate a buffer object1232* suitable for scanout and map it for software rendering. KMS dumb buffers are1233* not suitable for hardware-accelerated rendering nor video decoding. KMS dumb1234* buffers are not suitable to be displayed on any other device than the KMS1235* device where they were allocated from. Also see1236* :ref:`kms_dumb_buffer_objects`.1237*1238* The IOCTL argument is a struct drm_mode_create_dumb.1239*1240* User-space is expected to create a KMS dumb buffer via this IOCTL, then add1241* it as a KMS framebuffer via &DRM_IOCTL_MODE_ADDFB and map it via1242* &DRM_IOCTL_MODE_MAP_DUMB.1243*1244* &DRM_CAP_DUMB_BUFFER indicates whether this IOCTL is supported.1245* &DRM_CAP_DUMB_PREFERRED_DEPTH and &DRM_CAP_DUMB_PREFER_SHADOW indicate1246* driver preferences for dumb buffers.1247*/1248#define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb)1249#define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb)1250#define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb)1251#define DRM_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xB5, struct drm_mode_get_plane_res)1252#define DRM_IOCTL_MODE_GETPLANE DRM_IOWR(0xB6, struct drm_mode_get_plane)1253#define DRM_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct drm_mode_set_plane)1254#define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2)1255#define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties)1256#define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property)1257#define DRM_IOCTL_MODE_CURSOR2 DRM_IOWR(0xBB, struct drm_mode_cursor2)1258#define DRM_IOCTL_MODE_ATOMIC DRM_IOWR(0xBC, struct drm_mode_atomic)1259#define DRM_IOCTL_MODE_CREATEPROPBLOB DRM_IOWR(0xBD, struct drm_mode_create_blob)1260#define DRM_IOCTL_MODE_DESTROYPROPBLOB DRM_IOWR(0xBE, struct drm_mode_destroy_blob)12611262#define DRM_IOCTL_SYNCOBJ_CREATE DRM_IOWR(0xBF, struct drm_syncobj_create)1263#define DRM_IOCTL_SYNCOBJ_DESTROY DRM_IOWR(0xC0, struct drm_syncobj_destroy)1264#define DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD DRM_IOWR(0xC1, struct drm_syncobj_handle)1265#define DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE DRM_IOWR(0xC2, struct drm_syncobj_handle)1266#define DRM_IOCTL_SYNCOBJ_WAIT DRM_IOWR(0xC3, struct drm_syncobj_wait)1267#define DRM_IOCTL_SYNCOBJ_RESET DRM_IOWR(0xC4, struct drm_syncobj_array)1268#define DRM_IOCTL_SYNCOBJ_SIGNAL DRM_IOWR(0xC5, struct drm_syncobj_array)12691270#define DRM_IOCTL_MODE_CREATE_LEASE DRM_IOWR(0xC6, struct drm_mode_create_lease)1271#define DRM_IOCTL_MODE_LIST_LESSEES DRM_IOWR(0xC7, struct drm_mode_list_lessees)1272#define DRM_IOCTL_MODE_GET_LEASE DRM_IOWR(0xC8, struct drm_mode_get_lease)1273#define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease)12741275#define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait)1276#define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, struct drm_syncobj_timeline_array)1277#define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer)1278#define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL DRM_IOWR(0xCD, struct drm_syncobj_timeline_array)12791280/**1281* DRM_IOCTL_MODE_GETFB2 - Get framebuffer metadata.1282*1283* This queries metadata about a framebuffer. User-space fills1284* &drm_mode_fb_cmd2.fb_id as the input, and the kernels fills the rest of the1285* struct as the output.1286*1287* If the client is DRM master or has &CAP_SYS_ADMIN, &drm_mode_fb_cmd2.handles1288* will be filled with GEM buffer handles. Fresh new GEM handles are always1289* returned, even if another GEM handle referring to the same memory object1290* already exists on the DRM file description. The caller is responsible for1291* removing the new handles, e.g. via the &DRM_IOCTL_GEM_CLOSE IOCTL. The same1292* new handle will be returned for multiple planes in case they use the same1293* memory object. Planes are valid until one has a zero handle -- this can be1294* used to compute the number of planes.1295*1296* Otherwise, &drm_mode_fb_cmd2.handles will be zeroed and planes are valid1297* until one has a zero &drm_mode_fb_cmd2.pitches.1298*1299* If the framebuffer has a format modifier, &DRM_MODE_FB_MODIFIERS will be set1300* in &drm_mode_fb_cmd2.flags and &drm_mode_fb_cmd2.modifier will contain the1301* modifier. Otherwise, user-space must ignore &drm_mode_fb_cmd2.modifier.1302*1303* To obtain DMA-BUF FDs for each plane without leaking GEM handles, user-space1304* can export each handle via &DRM_IOCTL_PRIME_HANDLE_TO_FD, then immediately1305* close each unique handle via &DRM_IOCTL_GEM_CLOSE, making sure to not1306* double-close handles which are specified multiple times in the array.1307*/1308#define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE, struct drm_mode_fb_cmd2)13091310#define DRM_IOCTL_SYNCOBJ_EVENTFD DRM_IOWR(0xCF, struct drm_syncobj_eventfd)13111312/**1313* DRM_IOCTL_MODE_CLOSEFB - Close a framebuffer.1314*1315* This closes a framebuffer previously added via ADDFB/ADDFB2. The IOCTL1316* argument is a framebuffer object ID.1317*1318* This IOCTL is similar to &DRM_IOCTL_MODE_RMFB, except it doesn't disable1319* planes and CRTCs. As long as the framebuffer is used by a plane, it's kept1320* alive. When the plane no longer uses the framebuffer (because the1321* framebuffer is replaced with another one, or the plane is disabled), the1322* framebuffer is cleaned up.1323*1324* This is useful to implement flicker-free transitions between two processes.1325*1326* Depending on the threat model, user-space may want to ensure that the1327* framebuffer doesn't expose any sensitive user information: closed1328* framebuffers attached to a plane can be read back by the next DRM master.1329*/1330#define DRM_IOCTL_MODE_CLOSEFB DRM_IOWR(0xD0, struct drm_mode_closefb)13311332/**1333* DRM_IOCTL_SET_CLIENT_NAME - Attach a name to a drm_file1334*1335* Having a name allows for easier tracking and debugging.1336* The length of the name (without null ending char) must be1337* <= DRM_CLIENT_NAME_MAX_LEN.1338* The call will fail if the name contains whitespaces or non-printable chars.1339*/1340#define DRM_IOCTL_SET_CLIENT_NAME DRM_IOWR(0xD1, struct drm_set_client_name)13411342/**1343* DRM_IOCTL_GEM_CHANGE_HANDLE - Move an object to a different handle1344*1345* Some applications (notably CRIU) need objects to have specific gem handles.1346* This ioctl changes the object at one gem handle to use a new gem handle.1347*/1348#define DRM_IOCTL_GEM_CHANGE_HANDLE DRM_IOWR(0xD2, struct drm_gem_change_handle)13491350/*1351* Device specific ioctls should only be in their respective headers1352* The device specific ioctl range is from 0x40 to 0x9f.1353* Generic IOCTLS restart at 0xA0.1354*1355* \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and1356* drmCommandReadWrite().1357*/1358#define DRM_COMMAND_BASE 0x401359#define DRM_COMMAND_END 0xA013601361/**1362* struct drm_event - Header for DRM events1363* @type: event type.1364* @length: total number of payload bytes (including header).1365*1366* This struct is a header for events written back to user-space on the DRM FD.1367* A read on the DRM FD will always only return complete events: e.g. if the1368* read buffer is 100 bytes large and there are two 64 byte events pending,1369* only one will be returned.1370*1371* Event types 0 - 0x7fffffff are generic DRM events, 0x80000000 and1372* up are chipset specific. Generic DRM events include &DRM_EVENT_VBLANK,1373* &DRM_EVENT_FLIP_COMPLETE and &DRM_EVENT_CRTC_SEQUENCE.1374*/1375struct drm_event {1376__u32 type;1377__u32 length;1378};13791380/**1381* DRM_EVENT_VBLANK - vertical blanking event1382*1383* This event is sent in response to &DRM_IOCTL_WAIT_VBLANK with the1384* &_DRM_VBLANK_EVENT flag set.1385*1386* The event payload is a struct drm_event_vblank.1387*/1388#define DRM_EVENT_VBLANK 0x011389/**1390* DRM_EVENT_FLIP_COMPLETE - page-flip completion event1391*1392* This event is sent in response to an atomic commit or legacy page-flip with1393* the &DRM_MODE_PAGE_FLIP_EVENT flag set.1394*1395* The event payload is a struct drm_event_vblank.1396*/1397#define DRM_EVENT_FLIP_COMPLETE 0x021398/**1399* DRM_EVENT_CRTC_SEQUENCE - CRTC sequence event1400*1401* This event is sent in response to &DRM_IOCTL_CRTC_QUEUE_SEQUENCE.1402*1403* The event payload is a struct drm_event_crtc_sequence.1404*/1405#define DRM_EVENT_CRTC_SEQUENCE 0x0314061407struct drm_event_vblank {1408struct drm_event base;1409__u64 user_data;1410__u32 tv_sec;1411__u32 tv_usec;1412__u32 sequence;1413__u32 crtc_id; /* 0 on older kernels that do not support this */1414};14151416/* Event delivered at sequence. Time stamp marks when the first pixel1417* of the refresh cycle leaves the display engine for the display1418*/1419struct drm_event_crtc_sequence {1420struct drm_event base;1421__u64 user_data;1422__s64 time_ns;1423__u64 sequence;1424};14251426/* typedef area */1427#ifndef __KERNEL__1428typedef struct drm_clip_rect drm_clip_rect_t;1429typedef struct drm_drawable_info drm_drawable_info_t;1430typedef struct drm_tex_region drm_tex_region_t;1431typedef struct drm_hw_lock drm_hw_lock_t;1432typedef struct drm_version drm_version_t;1433typedef struct drm_unique drm_unique_t;1434typedef struct drm_list drm_list_t;1435typedef struct drm_block drm_block_t;1436typedef struct drm_control drm_control_t;1437typedef enum drm_map_type drm_map_type_t;1438typedef enum drm_map_flags drm_map_flags_t;1439typedef struct drm_ctx_priv_map drm_ctx_priv_map_t;1440typedef struct drm_map drm_map_t;1441typedef struct drm_client drm_client_t;1442typedef enum drm_stat_type drm_stat_type_t;1443typedef struct drm_stats drm_stats_t;1444typedef enum drm_lock_flags drm_lock_flags_t;1445typedef struct drm_lock drm_lock_t;1446typedef enum drm_dma_flags drm_dma_flags_t;1447typedef struct drm_buf_desc drm_buf_desc_t;1448typedef struct drm_buf_info drm_buf_info_t;1449typedef struct drm_buf_free drm_buf_free_t;1450typedef struct drm_buf_pub drm_buf_pub_t;1451typedef struct drm_buf_map drm_buf_map_t;1452typedef struct drm_dma drm_dma_t;1453typedef union drm_wait_vblank drm_wait_vblank_t;1454typedef struct drm_agp_mode drm_agp_mode_t;1455typedef enum drm_ctx_flags drm_ctx_flags_t;1456typedef struct drm_ctx drm_ctx_t;1457typedef struct drm_ctx_res drm_ctx_res_t;1458typedef struct drm_draw drm_draw_t;1459typedef struct drm_update_draw drm_update_draw_t;1460typedef struct drm_auth drm_auth_t;1461typedef struct drm_irq_busid drm_irq_busid_t;1462typedef enum drm_vblank_seq_type drm_vblank_seq_type_t;14631464typedef struct drm_agp_buffer drm_agp_buffer_t;1465typedef struct drm_agp_binding drm_agp_binding_t;1466typedef struct drm_agp_info drm_agp_info_t;1467typedef struct drm_scatter_gather drm_scatter_gather_t;1468typedef struct drm_set_version drm_set_version_t;1469#endif14701471#if defined(__cplusplus)1472}1473#endif14741475#endif147614771478