1adfa0b0cSmrg/* 222944501Smrg * Header for the Direct Rendering Manager 322944501Smrg * 4adfa0b0cSmrg * Author: Rickard E. (Rik) Faith <faith@valinux.com> 522944501Smrg * 6adfa0b0cSmrg * Acknowledgments: 7adfa0b0cSmrg * Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic cmpxchg. 822944501Smrg */ 922944501Smrg 1022944501Smrg/* 1122944501Smrg * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 1222944501Smrg * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 1322944501Smrg * All rights reserved. 1422944501Smrg * 1522944501Smrg * Permission is hereby granted, free of charge, to any person obtaining a 1622944501Smrg * copy of this software and associated documentation files (the "Software"), 1722944501Smrg * to deal in the Software without restriction, including without limitation 1822944501Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 1922944501Smrg * and/or sell copies of the Software, and to permit persons to whom the 2022944501Smrg * Software is furnished to do so, subject to the following conditions: 2122944501Smrg * 2222944501Smrg * The above copyright notice and this permission notice (including the next 2322944501Smrg * paragraph) shall be included in all copies or substantial portions of the 2422944501Smrg * Software. 2522944501Smrg * 2622944501Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2722944501Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2822944501Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 2922944501Smrg * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 3022944501Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 3122944501Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 3222944501Smrg * OTHER DEALINGS IN THE SOFTWARE. 3322944501Smrg */ 3422944501Smrg 3522944501Smrg#ifndef _DRM_H_ 3622944501Smrg#define _DRM_H_ 3722944501Smrg 38fe517fc9Smrg#if defined(__linux__) 3922944501Smrg 4022944501Smrg#include <linux/types.h> 4122944501Smrg#include <asm/ioctl.h> 4222944501Smrgtypedef unsigned int drm_handle_t; 4322944501Smrg 4422944501Smrg#else /* One of the BSDs */ 4522944501Smrg 46bf6cc7dcSmrg#include <stdint.h> 4722944501Smrg#include <sys/ioccom.h> 4822944501Smrg#include <sys/types.h> 4952605895Schristos#ifndef __linux_sized_types__ 5052605895Schristos#define __linux_sized_types__ 5122944501Smrgtypedef int8_t __s8; 5222944501Smrgtypedef uint8_t __u8; 5322944501Smrgtypedef int16_t __s16; 5422944501Smrgtypedef uint16_t __u16; 5522944501Smrgtypedef int32_t __s32; 5622944501Smrgtypedef uint32_t __u32; 5722944501Smrgtypedef int64_t __s64; 5822944501Smrgtypedef uint64_t __u64; 5952605895Schristos#endif /* __linux_sized_types__ */ 60fe517fc9Smrgtypedef size_t __kernel_size_t; 6122944501Smrgtypedef unsigned long drm_handle_t; 6222944501Smrg 6322944501Smrg#endif 6422944501Smrg 652ee35494Smrg#if defined(__cplusplus) 662ee35494Smrgextern "C" { 672ee35494Smrg#endif 682ee35494Smrg 6922944501Smrg#define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */ 7022944501Smrg#define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */ 7122944501Smrg#define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */ 7222944501Smrg#define DRM_RAM_PERCENT 10 /**< How much system ram can we lock? */ 7322944501Smrg 7422944501Smrg#define _DRM_LOCK_HELD 0x80000000U /**< Hardware lock is held */ 7522944501Smrg#define _DRM_LOCK_CONT 0x40000000U /**< Hardware lock is contended */ 7622944501Smrg#define _DRM_LOCK_IS_HELD(lock) ((lock) & _DRM_LOCK_HELD) 7722944501Smrg#define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT) 7822944501Smrg#define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) 7922944501Smrg 8022944501Smrgtypedef unsigned int drm_context_t; 8122944501Smrgtypedef unsigned int drm_drawable_t; 8222944501Smrgtypedef unsigned int drm_magic_t; 8322944501Smrg 84adfa0b0cSmrg/* 8522944501Smrg * Cliprect. 8622944501Smrg * 8722944501Smrg * \warning: If you change this structure, make sure you change 8822944501Smrg * XF86DRIClipRectRec in the server as well 8922944501Smrg * 9022944501Smrg * \note KW: Actually it's illegal to change either for 9122944501Smrg * backwards-compatibility reasons. 9222944501Smrg */ 9322944501Smrgstruct drm_clip_rect { 9422944501Smrg unsigned short x1; 9522944501Smrg unsigned short y1; 9622944501Smrg unsigned short x2; 9722944501Smrg unsigned short y2; 9822944501Smrg}; 9922944501Smrg 100adfa0b0cSmrg/* 10122944501Smrg * Drawable information. 10222944501Smrg */ 10322944501Smrgstruct drm_drawable_info { 10422944501Smrg unsigned int num_rects; 10522944501Smrg struct drm_clip_rect *rects; 10622944501Smrg}; 10722944501Smrg 108adfa0b0cSmrg/* 10922944501Smrg * Texture region, 11022944501Smrg */ 11122944501Smrgstruct drm_tex_region { 11222944501Smrg unsigned char next; 11322944501Smrg unsigned char prev; 11422944501Smrg unsigned char in_use; 11522944501Smrg unsigned char padding; 11622944501Smrg unsigned int age; 11722944501Smrg}; 11822944501Smrg 119adfa0b0cSmrg/* 12022944501Smrg * Hardware lock. 12122944501Smrg * 12222944501Smrg * The lock structure is a simple cache-line aligned integer. To avoid 12322944501Smrg * processor bus contention on a multiprocessor system, there should not be any 12422944501Smrg * other data stored in the same cache line. 12522944501Smrg */ 12622944501Smrgstruct drm_hw_lock { 12722944501Smrg __volatile__ unsigned int lock; /**< lock variable */ 12822944501Smrg char padding[60]; /**< Pad to cache line */ 12922944501Smrg}; 13022944501Smrg 131adfa0b0cSmrg/* 13222944501Smrg * DRM_IOCTL_VERSION ioctl argument type. 13322944501Smrg * 13422944501Smrg * \sa drmGetVersion(). 13522944501Smrg */ 13622944501Smrgstruct drm_version { 13722944501Smrg int version_major; /**< Major version */ 13822944501Smrg int version_minor; /**< Minor version */ 13922944501Smrg int version_patchlevel; /**< Patch level */ 140fe517fc9Smrg __kernel_size_t name_len; /**< Length of name buffer */ 14122944501Smrg char *name; /**< Name of driver */ 142fe517fc9Smrg __kernel_size_t date_len; /**< Length of date buffer */ 14322944501Smrg char *date; /**< User-space buffer to hold date */ 144fe517fc9Smrg __kernel_size_t desc_len; /**< Length of desc buffer */ 14522944501Smrg char *desc; /**< User-space buffer to hold desc */ 14622944501Smrg}; 14722944501Smrg 148adfa0b0cSmrg/* 14922944501Smrg * DRM_IOCTL_GET_UNIQUE ioctl argument type. 15022944501Smrg * 15122944501Smrg * \sa drmGetBusid() and drmSetBusId(). 15222944501Smrg */ 15322944501Smrgstruct drm_unique { 154fe517fc9Smrg __kernel_size_t unique_len; /**< Length of unique */ 15522944501Smrg char *unique; /**< Unique name for driver instantiation */ 15622944501Smrg}; 15722944501Smrg 15822944501Smrgstruct drm_list { 15922944501Smrg int count; /**< Length of user-space structures */ 16022944501Smrg struct drm_version *version; 16122944501Smrg}; 16222944501Smrg 16322944501Smrgstruct drm_block { 16422944501Smrg int unused; 16522944501Smrg}; 16622944501Smrg 167adfa0b0cSmrg/* 16822944501Smrg * DRM_IOCTL_CONTROL ioctl argument type. 16922944501Smrg * 17022944501Smrg * \sa drmCtlInstHandler() and drmCtlUninstHandler(). 17122944501Smrg */ 17222944501Smrgstruct drm_control { 17322944501Smrg enum { 17422944501Smrg DRM_ADD_COMMAND, 17522944501Smrg DRM_RM_COMMAND, 17622944501Smrg DRM_INST_HANDLER, 17722944501Smrg DRM_UNINST_HANDLER 17822944501Smrg } func; 17922944501Smrg int irq; 18022944501Smrg}; 18122944501Smrg 182adfa0b0cSmrg/* 18322944501Smrg * Type of memory to map. 18422944501Smrg */ 18522944501Smrgenum drm_map_type { 18622944501Smrg _DRM_FRAME_BUFFER = 0, /**< WC (no caching), no core dump */ 18722944501Smrg _DRM_REGISTERS = 1, /**< no caching, no core dump */ 18822944501Smrg _DRM_SHM = 2, /**< shared, cached */ 18922944501Smrg _DRM_AGP = 3, /**< AGP/GART */ 19022944501Smrg _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */ 191fe517fc9Smrg _DRM_CONSISTENT = 5 /**< Consistent memory for PCI DMA */ 19222944501Smrg}; 19322944501Smrg 194adfa0b0cSmrg/* 19522944501Smrg * Memory mapping flags. 19622944501Smrg */ 19722944501Smrgenum drm_map_flags { 19822944501Smrg _DRM_RESTRICTED = 0x01, /**< Cannot be mapped to user-virtual */ 19922944501Smrg _DRM_READ_ONLY = 0x02, 20022944501Smrg _DRM_LOCKED = 0x04, /**< shared, cached, locked */ 20122944501Smrg _DRM_KERNEL = 0x08, /**< kernel requires access */ 20222944501Smrg _DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */ 20322944501Smrg _DRM_CONTAINS_LOCK = 0x20, /**< SHM page that contains lock */ 20422944501Smrg _DRM_REMOVABLE = 0x40, /**< Removable mapping */ 20522944501Smrg _DRM_DRIVER = 0x80 /**< Managed by driver */ 20622944501Smrg}; 20722944501Smrg 20822944501Smrgstruct drm_ctx_priv_map { 20922944501Smrg unsigned int ctx_id; /**< Context requesting private mapping */ 21022944501Smrg void *handle; /**< Handle of map */ 21122944501Smrg}; 21222944501Smrg 213adfa0b0cSmrg/* 21422944501Smrg * DRM_IOCTL_GET_MAP, DRM_IOCTL_ADD_MAP and DRM_IOCTL_RM_MAP ioctls 21522944501Smrg * argument type. 21622944501Smrg * 21722944501Smrg * \sa drmAddMap(). 21822944501Smrg */ 21922944501Smrgstruct drm_map { 22022944501Smrg unsigned long offset; /**< Requested physical address (0 for SAREA)*/ 22122944501Smrg unsigned long size; /**< Requested physical size (bytes) */ 22222944501Smrg enum drm_map_type type; /**< Type of memory to map */ 22322944501Smrg enum drm_map_flags flags; /**< Flags */ 22422944501Smrg void *handle; /**< User-space: "Handle" to pass to mmap() */ 22522944501Smrg /**< Kernel-space: kernel-virtual address */ 22622944501Smrg int mtrr; /**< MTRR slot used */ 22722944501Smrg /* Private data */ 22822944501Smrg}; 22922944501Smrg 230adfa0b0cSmrg/* 23122944501Smrg * DRM_IOCTL_GET_CLIENT ioctl argument type. 23222944501Smrg */ 23322944501Smrgstruct drm_client { 23422944501Smrg int idx; /**< Which client desired? */ 23522944501Smrg int auth; /**< Is client authenticated? */ 23622944501Smrg unsigned long pid; /**< Process ID */ 23722944501Smrg unsigned long uid; /**< User ID */ 23822944501Smrg unsigned long magic; /**< Magic */ 23922944501Smrg unsigned long iocs; /**< Ioctl count */ 24022944501Smrg}; 24122944501Smrg 24222944501Smrgenum drm_stat_type { 24322944501Smrg _DRM_STAT_LOCK, 24422944501Smrg _DRM_STAT_OPENS, 24522944501Smrg _DRM_STAT_CLOSES, 24622944501Smrg _DRM_STAT_IOCTLS, 24722944501Smrg _DRM_STAT_LOCKS, 24822944501Smrg _DRM_STAT_UNLOCKS, 24922944501Smrg _DRM_STAT_VALUE, /**< Generic value */ 25022944501Smrg _DRM_STAT_BYTE, /**< Generic byte counter (1024bytes/K) */ 25122944501Smrg _DRM_STAT_COUNT, /**< Generic non-byte counter (1000/k) */ 25222944501Smrg 25322944501Smrg _DRM_STAT_IRQ, /**< IRQ */ 25422944501Smrg _DRM_STAT_PRIMARY, /**< Primary DMA bytes */ 25522944501Smrg _DRM_STAT_SECONDARY, /**< Secondary DMA bytes */ 25622944501Smrg _DRM_STAT_DMA, /**< DMA */ 25722944501Smrg _DRM_STAT_SPECIAL, /**< Special DMA (e.g., priority or polled) */ 25822944501Smrg _DRM_STAT_MISSED /**< Missed DMA opportunity */ 25922944501Smrg /* Add to the *END* of the list */ 26022944501Smrg}; 26122944501Smrg 262adfa0b0cSmrg/* 26322944501Smrg * DRM_IOCTL_GET_STATS ioctl argument type. 26422944501Smrg */ 26522944501Smrgstruct drm_stats { 26622944501Smrg unsigned long count; 26722944501Smrg struct { 26822944501Smrg unsigned long value; 26922944501Smrg enum drm_stat_type type; 27022944501Smrg } data[15]; 27122944501Smrg}; 27222944501Smrg 273adfa0b0cSmrg/* 27422944501Smrg * Hardware locking flags. 27522944501Smrg */ 27622944501Smrgenum drm_lock_flags { 27722944501Smrg _DRM_LOCK_READY = 0x01, /**< Wait until hardware is ready for DMA */ 27822944501Smrg _DRM_LOCK_QUIESCENT = 0x02, /**< Wait until hardware quiescent */ 27922944501Smrg _DRM_LOCK_FLUSH = 0x04, /**< Flush this context's DMA queue first */ 28022944501Smrg _DRM_LOCK_FLUSH_ALL = 0x08, /**< Flush all DMA queues first */ 28122944501Smrg /* These *HALT* flags aren't supported yet 28222944501Smrg -- they will be used to support the 28322944501Smrg full-screen DGA-like mode. */ 28422944501Smrg _DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */ 28522944501Smrg _DRM_HALT_CUR_QUEUES = 0x20 /**< Halt all current queues */ 28622944501Smrg}; 28722944501Smrg 288adfa0b0cSmrg/* 28922944501Smrg * DRM_IOCTL_LOCK, DRM_IOCTL_UNLOCK and DRM_IOCTL_FINISH ioctl argument type. 29022944501Smrg * 29122944501Smrg * \sa drmGetLock() and drmUnlock(). 29222944501Smrg */ 29322944501Smrgstruct drm_lock { 29422944501Smrg int context; 29522944501Smrg enum drm_lock_flags flags; 29622944501Smrg}; 29722944501Smrg 298adfa0b0cSmrg/* 29922944501Smrg * DMA flags 30022944501Smrg * 30122944501Smrg * \warning 30222944501Smrg * These values \e must match xf86drm.h. 30322944501Smrg * 30422944501Smrg * \sa drm_dma. 30522944501Smrg */ 30622944501Smrgenum drm_dma_flags { 30722944501Smrg /* Flags for DMA buffer dispatch */ 30822944501Smrg _DRM_DMA_BLOCK = 0x01, /**< 30922944501Smrg * Block until buffer dispatched. 31022944501Smrg * 31122944501Smrg * \note The buffer may not yet have 31222944501Smrg * been processed by the hardware -- 31322944501Smrg * getting a hardware lock with the 31422944501Smrg * hardware quiescent will ensure 31522944501Smrg * that the buffer has been 31622944501Smrg * processed. 31722944501Smrg */ 31822944501Smrg _DRM_DMA_WHILE_LOCKED = 0x02, /**< Dispatch while lock held */ 31922944501Smrg _DRM_DMA_PRIORITY = 0x04, /**< High priority dispatch */ 32022944501Smrg 32122944501Smrg /* Flags for DMA buffer request */ 32222944501Smrg _DRM_DMA_WAIT = 0x10, /**< Wait for free buffers */ 32322944501Smrg _DRM_DMA_SMALLER_OK = 0x20, /**< Smaller-than-requested buffers OK */ 32422944501Smrg _DRM_DMA_LARGER_OK = 0x40 /**< Larger-than-requested buffers OK */ 32522944501Smrg}; 32622944501Smrg 327adfa0b0cSmrg/* 32822944501Smrg * DRM_IOCTL_ADD_BUFS and DRM_IOCTL_MARK_BUFS ioctl argument type. 32922944501Smrg * 33022944501Smrg * \sa drmAddBufs(). 33122944501Smrg */ 33222944501Smrgstruct drm_buf_desc { 33322944501Smrg int count; /**< Number of buffers of this size */ 33422944501Smrg int size; /**< Size in bytes */ 33522944501Smrg int low_mark; /**< Low water mark */ 33622944501Smrg int high_mark; /**< High water mark */ 33722944501Smrg enum { 33822944501Smrg _DRM_PAGE_ALIGN = 0x01, /**< Align on page boundaries for DMA */ 33922944501Smrg _DRM_AGP_BUFFER = 0x02, /**< Buffer is in AGP space */ 34022944501Smrg _DRM_SG_BUFFER = 0x04, /**< Scatter/gather memory buffer */ 34122944501Smrg _DRM_FB_BUFFER = 0x08, /**< Buffer is in frame buffer */ 34222944501Smrg _DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */ 34322944501Smrg } flags; 34422944501Smrg unsigned long agp_start; /**< 34522944501Smrg * Start address of where the AGP buffers are 34622944501Smrg * in the AGP aperture 34722944501Smrg */ 34822944501Smrg}; 34922944501Smrg 350adfa0b0cSmrg/* 35122944501Smrg * DRM_IOCTL_INFO_BUFS ioctl argument type. 35222944501Smrg */ 35322944501Smrgstruct drm_buf_info { 35422944501Smrg int count; /**< Entries in list */ 35522944501Smrg struct drm_buf_desc *list; 35622944501Smrg}; 35722944501Smrg 358adfa0b0cSmrg/* 35922944501Smrg * DRM_IOCTL_FREE_BUFS ioctl argument type. 36022944501Smrg */ 36122944501Smrgstruct drm_buf_free { 36222944501Smrg int count; 36322944501Smrg int *list; 36422944501Smrg}; 36522944501Smrg 366adfa0b0cSmrg/* 36722944501Smrg * Buffer information 36822944501Smrg * 36922944501Smrg * \sa drm_buf_map. 37022944501Smrg */ 37122944501Smrgstruct drm_buf_pub { 37222944501Smrg int idx; /**< Index into the master buffer list */ 37322944501Smrg int total; /**< Buffer size */ 37422944501Smrg int used; /**< Amount of buffer in use (for DMA) */ 37522944501Smrg void *address; /**< Address of buffer */ 37622944501Smrg}; 37722944501Smrg 378adfa0b0cSmrg/* 37922944501Smrg * DRM_IOCTL_MAP_BUFS ioctl argument type. 38022944501Smrg */ 38122944501Smrgstruct drm_buf_map { 38222944501Smrg int count; /**< Length of the buffer list */ 383d049871aSmrg#ifdef __cplusplus 384d049871aSmrg void *virt; 385d049871aSmrg#else 38622944501Smrg void *virtual; /**< Mmap'd area in user-virtual */ 387d049871aSmrg#endif 38822944501Smrg struct drm_buf_pub *list; /**< Buffer information */ 38922944501Smrg}; 39022944501Smrg 391adfa0b0cSmrg/* 39222944501Smrg * DRM_IOCTL_DMA ioctl argument type. 39322944501Smrg * 39422944501Smrg * Indices here refer to the offset into the buffer list in drm_buf_get. 39522944501Smrg * 39622944501Smrg * \sa drmDMA(). 39722944501Smrg */ 39822944501Smrgstruct drm_dma { 39922944501Smrg int context; /**< Context handle */ 40022944501Smrg int send_count; /**< Number of buffers to send */ 40122944501Smrg int *send_indices; /**< List of handles to buffers */ 40222944501Smrg int *send_sizes; /**< Lengths of data to send */ 40322944501Smrg enum drm_dma_flags flags; /**< Flags */ 40422944501Smrg int request_count; /**< Number of buffers requested */ 40522944501Smrg int request_size; /**< Desired size for buffers */ 40622944501Smrg int *request_indices; /**< Buffer information */ 40722944501Smrg int *request_sizes; 40822944501Smrg int granted_count; /**< Number of buffers granted */ 40922944501Smrg}; 41022944501Smrg 41122944501Smrgenum drm_ctx_flags { 41222944501Smrg _DRM_CONTEXT_PRESERVED = 0x01, 41322944501Smrg _DRM_CONTEXT_2DONLY = 0x02 41422944501Smrg}; 41522944501Smrg 416adfa0b0cSmrg/* 41722944501Smrg * DRM_IOCTL_ADD_CTX ioctl argument type. 41822944501Smrg * 41922944501Smrg * \sa drmCreateContext() and drmDestroyContext(). 42022944501Smrg */ 42122944501Smrgstruct drm_ctx { 42222944501Smrg drm_context_t handle; 42322944501Smrg enum drm_ctx_flags flags; 42422944501Smrg}; 42522944501Smrg 426adfa0b0cSmrg/* 42722944501Smrg * DRM_IOCTL_RES_CTX ioctl argument type. 42822944501Smrg */ 42922944501Smrgstruct drm_ctx_res { 43022944501Smrg int count; 43122944501Smrg struct drm_ctx *contexts; 43222944501Smrg}; 43322944501Smrg 434adfa0b0cSmrg/* 43522944501Smrg * DRM_IOCTL_ADD_DRAW and DRM_IOCTL_RM_DRAW ioctl argument type. 43622944501Smrg */ 43722944501Smrgstruct drm_draw { 43822944501Smrg drm_drawable_t handle; 43922944501Smrg}; 44022944501Smrg 441adfa0b0cSmrg/* 44222944501Smrg * DRM_IOCTL_UPDATE_DRAW ioctl argument type. 44322944501Smrg */ 44422944501Smrgtypedef enum { 445e88f27b3Smrg DRM_DRAWABLE_CLIPRECTS 44622944501Smrg} drm_drawable_info_type_t; 44722944501Smrg 44822944501Smrgstruct drm_update_draw { 44922944501Smrg drm_drawable_t handle; 45022944501Smrg unsigned int type; 45122944501Smrg unsigned int num; 45222944501Smrg unsigned long long data; 45322944501Smrg}; 45422944501Smrg 455adfa0b0cSmrg/* 45622944501Smrg * DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type. 45722944501Smrg */ 45822944501Smrgstruct drm_auth { 45922944501Smrg drm_magic_t magic; 46022944501Smrg}; 46122944501Smrg 462adfa0b0cSmrg/* 46322944501Smrg * DRM_IOCTL_IRQ_BUSID ioctl argument type. 46422944501Smrg * 46522944501Smrg * \sa drmGetInterruptFromBusID(). 46622944501Smrg */ 46722944501Smrgstruct drm_irq_busid { 46822944501Smrg int irq; /**< IRQ number */ 46922944501Smrg int busnum; /**< bus number */ 47022944501Smrg int devnum; /**< device number */ 47122944501Smrg int funcnum; /**< function number */ 47222944501Smrg}; 47322944501Smrg 47422944501Smrgenum drm_vblank_seq_type { 47522944501Smrg _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ 47622944501Smrg _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ 477fe517fc9Smrg /* bits 1-6 are reserved for high crtcs */ 478fe517fc9Smrg _DRM_VBLANK_HIGH_CRTC_MASK = 0x0000003e, 47922944501Smrg _DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */ 48022944501Smrg _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ 48122944501Smrg _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ 48222944501Smrg _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ 48322944501Smrg _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking, unsupported */ 48422944501Smrg}; 485fe517fc9Smrg#define _DRM_VBLANK_HIGH_CRTC_SHIFT 1 48622944501Smrg 48722944501Smrg#define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) 48822944501Smrg#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \ 48922944501Smrg _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS) 49022944501Smrg 49122944501Smrgstruct drm_wait_vblank_request { 49222944501Smrg enum drm_vblank_seq_type type; 49322944501Smrg unsigned int sequence; 49422944501Smrg unsigned long signal; 49522944501Smrg}; 49622944501Smrg 49722944501Smrgstruct drm_wait_vblank_reply { 49822944501Smrg enum drm_vblank_seq_type type; 49922944501Smrg unsigned int sequence; 50022944501Smrg long tval_sec; 50122944501Smrg long tval_usec; 50222944501Smrg}; 50322944501Smrg 504adfa0b0cSmrg/* 50522944501Smrg * DRM_IOCTL_WAIT_VBLANK ioctl argument type. 50622944501Smrg * 50722944501Smrg * \sa drmWaitVBlank(). 50822944501Smrg */ 50922944501Smrgunion drm_wait_vblank { 51022944501Smrg struct drm_wait_vblank_request request; 51122944501Smrg struct drm_wait_vblank_reply reply; 51222944501Smrg}; 51322944501Smrg 51422944501Smrg#define _DRM_PRE_MODESET 1 51522944501Smrg#define _DRM_POST_MODESET 2 51622944501Smrg 517adfa0b0cSmrg/* 51822944501Smrg * DRM_IOCTL_MODESET_CTL ioctl argument type 51922944501Smrg * 52022944501Smrg * \sa drmModesetCtl(). 52122944501Smrg */ 52222944501Smrgstruct drm_modeset_ctl { 52322944501Smrg __u32 crtc; 52422944501Smrg __u32 cmd; 52522944501Smrg}; 52622944501Smrg 527adfa0b0cSmrg/* 52822944501Smrg * DRM_IOCTL_AGP_ENABLE ioctl argument type. 52922944501Smrg * 53022944501Smrg * \sa drmAgpEnable(). 53122944501Smrg */ 53222944501Smrgstruct drm_agp_mode { 53322944501Smrg unsigned long mode; /**< AGP mode */ 53422944501Smrg}; 53522944501Smrg 536adfa0b0cSmrg/* 53722944501Smrg * DRM_IOCTL_AGP_ALLOC and DRM_IOCTL_AGP_FREE ioctls argument type. 53822944501Smrg * 53922944501Smrg * \sa drmAgpAlloc() and drmAgpFree(). 54022944501Smrg */ 54122944501Smrgstruct drm_agp_buffer { 54222944501Smrg unsigned long size; /**< In bytes -- will round to page boundary */ 54322944501Smrg unsigned long handle; /**< Used for binding / unbinding */ 54422944501Smrg unsigned long type; /**< Type of memory to allocate */ 54522944501Smrg unsigned long physical; /**< Physical used by i810 */ 54622944501Smrg}; 54722944501Smrg 548adfa0b0cSmrg/* 54922944501Smrg * DRM_IOCTL_AGP_BIND and DRM_IOCTL_AGP_UNBIND ioctls argument type. 55022944501Smrg * 55122944501Smrg * \sa drmAgpBind() and drmAgpUnbind(). 55222944501Smrg */ 55322944501Smrgstruct drm_agp_binding { 55422944501Smrg unsigned long handle; /**< From drm_agp_buffer */ 55522944501Smrg unsigned long offset; /**< In bytes -- will round to page boundary */ 55622944501Smrg}; 55722944501Smrg 558adfa0b0cSmrg/* 55922944501Smrg * DRM_IOCTL_AGP_INFO ioctl argument type. 56022944501Smrg * 56122944501Smrg * \sa drmAgpVersionMajor(), drmAgpVersionMinor(), drmAgpGetMode(), 56222944501Smrg * drmAgpBase(), drmAgpSize(), drmAgpMemoryUsed(), drmAgpMemoryAvail(), 56322944501Smrg * drmAgpVendorId() and drmAgpDeviceId(). 56422944501Smrg */ 56522944501Smrgstruct drm_agp_info { 56622944501Smrg int agp_version_major; 56722944501Smrg int agp_version_minor; 56822944501Smrg unsigned long mode; 56922944501Smrg unsigned long aperture_base; /* physical address */ 57022944501Smrg unsigned long aperture_size; /* bytes */ 57122944501Smrg unsigned long memory_allowed; /* bytes */ 57222944501Smrg unsigned long memory_used; 57322944501Smrg 57422944501Smrg /* PCI information */ 57522944501Smrg unsigned short id_vendor; 57622944501Smrg unsigned short id_device; 57722944501Smrg}; 57822944501Smrg 579adfa0b0cSmrg/* 58022944501Smrg * DRM_IOCTL_SG_ALLOC ioctl argument type. 58122944501Smrg */ 58222944501Smrgstruct drm_scatter_gather { 58322944501Smrg unsigned long size; /**< In bytes -- will round to page boundary */ 58422944501Smrg unsigned long handle; /**< Used for mapping / unmapping */ 58522944501Smrg}; 58622944501Smrg 587adfa0b0cSmrg/* 58822944501Smrg * DRM_IOCTL_SET_VERSION ioctl argument type. 58922944501Smrg */ 59022944501Smrgstruct drm_set_version { 59122944501Smrg int drm_di_major; 59222944501Smrg int drm_di_minor; 59322944501Smrg int drm_dd_major; 59422944501Smrg int drm_dd_minor; 59522944501Smrg}; 59622944501Smrg 597adfa0b0cSmrg/* DRM_IOCTL_GEM_CLOSE ioctl argument type */ 59822944501Smrgstruct drm_gem_close { 59922944501Smrg /** Handle of the object to be closed. */ 60022944501Smrg __u32 handle; 60122944501Smrg __u32 pad; 60222944501Smrg}; 60322944501Smrg 604adfa0b0cSmrg/* DRM_IOCTL_GEM_FLINK ioctl argument type */ 60522944501Smrgstruct drm_gem_flink { 60622944501Smrg /** Handle for the object being named */ 60722944501Smrg __u32 handle; 60822944501Smrg 60922944501Smrg /** Returned global name */ 61022944501Smrg __u32 name; 61122944501Smrg}; 61222944501Smrg 613adfa0b0cSmrg/* DRM_IOCTL_GEM_OPEN ioctl argument type */ 61422944501Smrgstruct drm_gem_open { 61522944501Smrg /** Name of object being opened */ 61622944501Smrg __u32 name; 61722944501Smrg 61822944501Smrg /** Returned handle for the object */ 61922944501Smrg __u32 handle; 62022944501Smrg 62122944501Smrg /** Returned size of the object */ 62222944501Smrg __u64 size; 62322944501Smrg}; 62422944501Smrg 625adfa0b0cSmrg/** 626adfa0b0cSmrg * DRM_CAP_DUMB_BUFFER 627adfa0b0cSmrg * 628adfa0b0cSmrg * If set to 1, the driver supports creating dumb buffers via the 629adfa0b0cSmrg * &DRM_IOCTL_MODE_CREATE_DUMB ioctl. 630adfa0b0cSmrg */ 631fe517fc9Smrg#define DRM_CAP_DUMB_BUFFER 0x1 632adfa0b0cSmrg/** 633adfa0b0cSmrg * DRM_CAP_VBLANK_HIGH_CRTC 634adfa0b0cSmrg * 63548246ce7Smrg * If set to 1, the kernel supports specifying a :ref:`CRTC index<crtc_index>` 63648246ce7Smrg * in the high bits of &drm_wait_vblank_request.type. 637adfa0b0cSmrg * 638adfa0b0cSmrg * Starting kernel version 2.6.39, this capability is always set to 1. 639adfa0b0cSmrg */ 640fe517fc9Smrg#define DRM_CAP_VBLANK_HIGH_CRTC 0x2 641adfa0b0cSmrg/** 642adfa0b0cSmrg * DRM_CAP_DUMB_PREFERRED_DEPTH 643adfa0b0cSmrg * 644adfa0b0cSmrg * The preferred bit depth for dumb buffers. 645adfa0b0cSmrg * 646adfa0b0cSmrg * The bit depth is the number of bits used to indicate the color of a single 647adfa0b0cSmrg * pixel excluding any padding. This is different from the number of bits per 648adfa0b0cSmrg * pixel. For instance, XRGB8888 has a bit depth of 24 but has 32 bits per 649adfa0b0cSmrg * pixel. 650adfa0b0cSmrg * 651adfa0b0cSmrg * Note that this preference only applies to dumb buffers, it's irrelevant for 652adfa0b0cSmrg * other types of buffers. 653adfa0b0cSmrg */ 654fe517fc9Smrg#define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3 655adfa0b0cSmrg/** 656adfa0b0cSmrg * DRM_CAP_DUMB_PREFER_SHADOW 657adfa0b0cSmrg * 658adfa0b0cSmrg * If set to 1, the driver prefers userspace to render to a shadow buffer 659adfa0b0cSmrg * instead of directly rendering to a dumb buffer. For best speed, userspace 660adfa0b0cSmrg * should do streaming ordered memory copies into the dumb buffer and never 661adfa0b0cSmrg * read from it. 662adfa0b0cSmrg * 663adfa0b0cSmrg * Note that this preference only applies to dumb buffers, it's irrelevant for 664adfa0b0cSmrg * other types of buffers. 665adfa0b0cSmrg */ 666fe517fc9Smrg#define DRM_CAP_DUMB_PREFER_SHADOW 0x4 667adfa0b0cSmrg/** 668adfa0b0cSmrg * DRM_CAP_PRIME 669adfa0b0cSmrg * 670adfa0b0cSmrg * Bitfield of supported PRIME sharing capabilities. See &DRM_PRIME_CAP_IMPORT 671adfa0b0cSmrg * and &DRM_PRIME_CAP_EXPORT. 672adfa0b0cSmrg * 67348246ce7Smrg * Starting from kernel version 6.6, both &DRM_PRIME_CAP_IMPORT and 67448246ce7Smrg * &DRM_PRIME_CAP_EXPORT are always advertised. 67548246ce7Smrg * 67648246ce7Smrg * PRIME buffers are exposed as dma-buf file descriptors. 67748246ce7Smrg * See :ref:`prime_buffer_sharing`. 678adfa0b0cSmrg */ 679fe517fc9Smrg#define DRM_CAP_PRIME 0x5 680adfa0b0cSmrg/** 681adfa0b0cSmrg * DRM_PRIME_CAP_IMPORT 682adfa0b0cSmrg * 683adfa0b0cSmrg * If this bit is set in &DRM_CAP_PRIME, the driver supports importing PRIME 684adfa0b0cSmrg * buffers via the &DRM_IOCTL_PRIME_FD_TO_HANDLE ioctl. 68548246ce7Smrg * 68648246ce7Smrg * Starting from kernel version 6.6, this bit is always set in &DRM_CAP_PRIME. 687adfa0b0cSmrg */ 688fe517fc9Smrg#define DRM_PRIME_CAP_IMPORT 0x1 689adfa0b0cSmrg/** 690adfa0b0cSmrg * DRM_PRIME_CAP_EXPORT 691adfa0b0cSmrg * 692adfa0b0cSmrg * If this bit is set in &DRM_CAP_PRIME, the driver supports exporting PRIME 693adfa0b0cSmrg * buffers via the &DRM_IOCTL_PRIME_HANDLE_TO_FD ioctl. 69448246ce7Smrg * 69548246ce7Smrg * Starting from kernel version 6.6, this bit is always set in &DRM_CAP_PRIME. 696adfa0b0cSmrg */ 697fe517fc9Smrg#define DRM_PRIME_CAP_EXPORT 0x2 698adfa0b0cSmrg/** 699adfa0b0cSmrg * DRM_CAP_TIMESTAMP_MONOTONIC 700adfa0b0cSmrg * 701adfa0b0cSmrg * If set to 0, the kernel will report timestamps with ``CLOCK_REALTIME`` in 702adfa0b0cSmrg * struct drm_event_vblank. If set to 1, the kernel will report timestamps with 703adfa0b0cSmrg * ``CLOCK_MONOTONIC``. See ``clock_gettime(2)`` for the definition of these 704adfa0b0cSmrg * clocks. 705adfa0b0cSmrg * 706adfa0b0cSmrg * Starting from kernel version 2.6.39, the default value for this capability 707adfa0b0cSmrg * is 1. Starting kernel version 4.15, this capability is always set to 1. 708adfa0b0cSmrg */ 709fe517fc9Smrg#define DRM_CAP_TIMESTAMP_MONOTONIC 0x6 710adfa0b0cSmrg/** 711adfa0b0cSmrg * DRM_CAP_ASYNC_PAGE_FLIP 712adfa0b0cSmrg * 71348246ce7Smrg * If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC for legacy 71448246ce7Smrg * page-flips. 715adfa0b0cSmrg */ 716fe517fc9Smrg#define DRM_CAP_ASYNC_PAGE_FLIP 0x7 717adfa0b0cSmrg/** 718adfa0b0cSmrg * DRM_CAP_CURSOR_WIDTH 719adfa0b0cSmrg * 720adfa0b0cSmrg * The ``CURSOR_WIDTH`` and ``CURSOR_HEIGHT`` capabilities return a valid 721adfa0b0cSmrg * width x height combination for the hardware cursor. The intention is that a 722adfa0b0cSmrg * hardware agnostic userspace can query a cursor plane size to use. 723fe517fc9Smrg * 724fe517fc9Smrg * Note that the cross-driver contract is to merely return a valid size; 725fe517fc9Smrg * drivers are free to attach another meaning on top, eg. i915 returns the 726fe517fc9Smrg * maximum plane size. 727fe517fc9Smrg */ 728fe517fc9Smrg#define DRM_CAP_CURSOR_WIDTH 0x8 729adfa0b0cSmrg/** 730adfa0b0cSmrg * DRM_CAP_CURSOR_HEIGHT 731adfa0b0cSmrg * 732adfa0b0cSmrg * See &DRM_CAP_CURSOR_WIDTH. 733adfa0b0cSmrg */ 734fe517fc9Smrg#define DRM_CAP_CURSOR_HEIGHT 0x9 735adfa0b0cSmrg/** 736adfa0b0cSmrg * DRM_CAP_ADDFB2_MODIFIERS 737adfa0b0cSmrg * 738adfa0b0cSmrg * If set to 1, the driver supports supplying modifiers in the 739adfa0b0cSmrg * &DRM_IOCTL_MODE_ADDFB2 ioctl. 740adfa0b0cSmrg */ 741fe517fc9Smrg#define DRM_CAP_ADDFB2_MODIFIERS 0x10 742adfa0b0cSmrg/** 743adfa0b0cSmrg * DRM_CAP_PAGE_FLIP_TARGET 744adfa0b0cSmrg * 745adfa0b0cSmrg * If set to 1, the driver supports the &DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE and 746adfa0b0cSmrg * &DRM_MODE_PAGE_FLIP_TARGET_RELATIVE flags in 747adfa0b0cSmrg * &drm_mode_crtc_page_flip_target.flags for the &DRM_IOCTL_MODE_PAGE_FLIP 748adfa0b0cSmrg * ioctl. 749adfa0b0cSmrg */ 7502ee35494Smrg#define DRM_CAP_PAGE_FLIP_TARGET 0x11 751adfa0b0cSmrg/** 752adfa0b0cSmrg * DRM_CAP_CRTC_IN_VBLANK_EVENT 753adfa0b0cSmrg * 754adfa0b0cSmrg * If set to 1, the kernel supports reporting the CRTC ID in 755adfa0b0cSmrg * &drm_event_vblank.crtc_id for the &DRM_EVENT_VBLANK and 756adfa0b0cSmrg * &DRM_EVENT_FLIP_COMPLETE events. 757adfa0b0cSmrg * 758adfa0b0cSmrg * Starting kernel version 4.12, this capability is always set to 1. 759adfa0b0cSmrg */ 7600655efefSmrg#define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12 761adfa0b0cSmrg/** 762adfa0b0cSmrg * DRM_CAP_SYNCOBJ 763adfa0b0cSmrg * 76448246ce7Smrg * If set to 1, the driver supports sync objects. See :ref:`drm_sync_objects`. 765adfa0b0cSmrg */ 7660655efefSmrg#define DRM_CAP_SYNCOBJ 0x13 767adfa0b0cSmrg/** 768adfa0b0cSmrg * DRM_CAP_SYNCOBJ_TIMELINE 769adfa0b0cSmrg * 770adfa0b0cSmrg * If set to 1, the driver supports timeline operations on sync objects. See 77148246ce7Smrg * :ref:`drm_sync_objects`. 772adfa0b0cSmrg */ 773bf6cc7dcSmrg#define DRM_CAP_SYNCOBJ_TIMELINE 0x14 77448246ce7Smrg/** 77548246ce7Smrg * DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP 77648246ce7Smrg * 77748246ce7Smrg * If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC for atomic 77848246ce7Smrg * commits. 77948246ce7Smrg */ 78048246ce7Smrg#define DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP 0x15 781fe517fc9Smrg 782adfa0b0cSmrg/* DRM_IOCTL_GET_CAP ioctl argument type */ 783e88f27b3Smrgstruct drm_get_cap { 784e88f27b3Smrg __u64 capability; 785e88f27b3Smrg __u64 value; 786e88f27b3Smrg}; 787e88f27b3Smrg 788e88f27b3Smrg/** 789e88f27b3Smrg * DRM_CLIENT_CAP_STEREO_3D 790e88f27b3Smrg * 791adfa0b0cSmrg * If set to 1, the DRM core will expose the stereo 3D capabilities of the 792e88f27b3Smrg * monitor by advertising the supported 3D layouts in the flags of struct 793adfa0b0cSmrg * drm_mode_modeinfo. See ``DRM_MODE_FLAG_3D_*``. 794adfa0b0cSmrg * 795adfa0b0cSmrg * This capability is always supported for all drivers starting from kernel 796adfa0b0cSmrg * version 3.13. 797e88f27b3Smrg */ 798e88f27b3Smrg#define DRM_CLIENT_CAP_STEREO_3D 1 799e88f27b3Smrg 800a884aba1Smrg/** 801a884aba1Smrg * DRM_CLIENT_CAP_UNIVERSAL_PLANES 802a884aba1Smrg * 803fe517fc9Smrg * If set to 1, the DRM core will expose all planes (overlay, primary, and 804fe517fc9Smrg * cursor) to userspace. 805adfa0b0cSmrg * 806adfa0b0cSmrg * This capability has been introduced in kernel version 3.15. Starting from 807adfa0b0cSmrg * kernel version 3.17, this capability is always supported for all drivers. 808a884aba1Smrg */ 809fe517fc9Smrg#define DRM_CLIENT_CAP_UNIVERSAL_PLANES 2 810a884aba1Smrg 811424e9256Smrg/** 812424e9256Smrg * DRM_CLIENT_CAP_ATOMIC 813424e9256Smrg * 814adfa0b0cSmrg * If set to 1, the DRM core will expose atomic properties to userspace. This 815adfa0b0cSmrg * implicitly enables &DRM_CLIENT_CAP_UNIVERSAL_PLANES and 816adfa0b0cSmrg * &DRM_CLIENT_CAP_ASPECT_RATIO. 817adfa0b0cSmrg * 818adfa0b0cSmrg * If the driver doesn't support atomic mode-setting, enabling this capability 819adfa0b0cSmrg * will fail with -EOPNOTSUPP. 820adfa0b0cSmrg * 821adfa0b0cSmrg * This capability has been introduced in kernel version 4.0. Starting from 822adfa0b0cSmrg * kernel version 4.2, this capability is always supported for atomic-capable 823adfa0b0cSmrg * drivers. 824424e9256Smrg */ 825fe517fc9Smrg#define DRM_CLIENT_CAP_ATOMIC 3 826424e9256Smrg 8276260e5d5Smrg/** 8286260e5d5Smrg * DRM_CLIENT_CAP_ASPECT_RATIO 8296260e5d5Smrg * 8306260e5d5Smrg * If set to 1, the DRM core will provide aspect ratio information in modes. 831adfa0b0cSmrg * See ``DRM_MODE_FLAG_PIC_AR_*``. 832adfa0b0cSmrg * 833adfa0b0cSmrg * This capability is always supported for all drivers starting from kernel 834adfa0b0cSmrg * version 4.18. 8356260e5d5Smrg */ 8366260e5d5Smrg#define DRM_CLIENT_CAP_ASPECT_RATIO 4 8376260e5d5Smrg 8386260e5d5Smrg/** 8396260e5d5Smrg * DRM_CLIENT_CAP_WRITEBACK_CONNECTORS 8406260e5d5Smrg * 8416260e5d5Smrg * If set to 1, the DRM core will expose special connectors to be used for 842adfa0b0cSmrg * writing back to memory the scene setup in the commit. The client must enable 843adfa0b0cSmrg * &DRM_CLIENT_CAP_ATOMIC first. 844adfa0b0cSmrg * 845adfa0b0cSmrg * This capability is always supported for atomic-capable drivers starting from 846adfa0b0cSmrg * kernel version 4.19. 8476260e5d5Smrg */ 8486260e5d5Smrg#define DRM_CLIENT_CAP_WRITEBACK_CONNECTORS 5 8496260e5d5Smrg 85048246ce7Smrg/** 85148246ce7Smrg * DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT 85248246ce7Smrg * 85348246ce7Smrg * Drivers for para-virtualized hardware (e.g. vmwgfx, qxl, virtio and 85448246ce7Smrg * virtualbox) have additional restrictions for cursor planes (thus 85548246ce7Smrg * making cursor planes on those drivers not truly universal,) e.g. 85648246ce7Smrg * they need cursor planes to act like one would expect from a mouse 85748246ce7Smrg * cursor and have correctly set hotspot properties. 85848246ce7Smrg * If this client cap is not set the DRM core will hide cursor plane on 85948246ce7Smrg * those virtualized drivers because not setting it implies that the 86048246ce7Smrg * client is not capable of dealing with those extra restictions. 86148246ce7Smrg * Clients which do set cursor hotspot and treat the cursor plane 86248246ce7Smrg * like a mouse cursor should set this property. 86348246ce7Smrg * The client must enable &DRM_CLIENT_CAP_ATOMIC first. 86448246ce7Smrg * 86548246ce7Smrg * Setting this property on drivers which do not special case 86648246ce7Smrg * cursor planes (i.e. non-virtualized drivers) will return 86748246ce7Smrg * EOPNOTSUPP, which can be used by userspace to gauge 86848246ce7Smrg * requirements of the hardware/drivers they're running on. 86948246ce7Smrg * 87048246ce7Smrg * This capability is always supported for atomic-capable virtualized 87148246ce7Smrg * drivers starting from kernel version 6.6. 87248246ce7Smrg */ 87348246ce7Smrg#define DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT 6 87448246ce7Smrg 875adfa0b0cSmrg/* DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */ 876e88f27b3Smrgstruct drm_set_client_cap { 877e88f27b3Smrg __u64 capability; 878e88f27b3Smrg __u64 value; 879e88f27b3Smrg}; 880e88f27b3Smrg 881fe517fc9Smrg#define DRM_RDWR O_RDWR 882e88f27b3Smrg#define DRM_CLOEXEC O_CLOEXEC 883e88f27b3Smrgstruct drm_prime_handle { 884e88f27b3Smrg __u32 handle; 885e88f27b3Smrg 886e88f27b3Smrg /** Flags.. only applicable for handle->fd */ 887e88f27b3Smrg __u32 flags; 888e88f27b3Smrg 889e88f27b3Smrg /** Returned dmabuf file descriptor */ 890e88f27b3Smrg __s32 fd; 891e88f27b3Smrg}; 892e88f27b3Smrg 8930655efefSmrgstruct drm_syncobj_create { 8940655efefSmrg __u32 handle; 8952b90624aSmrg#define DRM_SYNCOBJ_CREATE_SIGNALED (1 << 0) 8960655efefSmrg __u32 flags; 8970655efefSmrg}; 8980655efefSmrg 8990655efefSmrgstruct drm_syncobj_destroy { 9000655efefSmrg __u32 handle; 9010655efefSmrg __u32 pad; 9020655efefSmrg}; 9030655efefSmrg 9040655efefSmrg#define DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE (1 << 0) 9050655efefSmrg#define DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE (1 << 0) 9060655efefSmrgstruct drm_syncobj_handle { 9070655efefSmrg __u32 handle; 9080655efefSmrg __u32 flags; 9090655efefSmrg 9100655efefSmrg __s32 fd; 9110655efefSmrg __u32 pad; 9120655efefSmrg}; 9130655efefSmrg 914bf6cc7dcSmrgstruct drm_syncobj_transfer { 915bf6cc7dcSmrg __u32 src_handle; 916bf6cc7dcSmrg __u32 dst_handle; 917bf6cc7dcSmrg __u64 src_point; 918bf6cc7dcSmrg __u64 dst_point; 919bf6cc7dcSmrg __u32 flags; 920bf6cc7dcSmrg __u32 pad; 921bf6cc7dcSmrg}; 922bf6cc7dcSmrg 9232b90624aSmrg#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0) 9242b90624aSmrg#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1) 925bf6cc7dcSmrg#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2) /* wait for time point to become available */ 92648246ce7Smrg#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_DEADLINE (1 << 3) /* set fence deadline to deadline_nsec */ 9272b90624aSmrgstruct drm_syncobj_wait { 9282b90624aSmrg __u64 handles; 9292b90624aSmrg /* absolute timeout */ 9302b90624aSmrg __s64 timeout_nsec; 9312b90624aSmrg __u32 count_handles; 9322b90624aSmrg __u32 flags; 9332b90624aSmrg __u32 first_signaled; /* only valid when not waiting all */ 9342b90624aSmrg __u32 pad; 93548246ce7Smrg /** 93648246ce7Smrg * @deadline_nsec - fence deadline hint 93748246ce7Smrg * 93848246ce7Smrg * Deadline hint, in absolute CLOCK_MONOTONIC, to set on backing 93948246ce7Smrg * fence(s) if the DRM_SYNCOBJ_WAIT_FLAGS_WAIT_DEADLINE flag is 94048246ce7Smrg * set. 94148246ce7Smrg */ 94248246ce7Smrg __u64 deadline_nsec; 9432b90624aSmrg}; 9442b90624aSmrg 945bf6cc7dcSmrgstruct drm_syncobj_timeline_wait { 946bf6cc7dcSmrg __u64 handles; 947bf6cc7dcSmrg /* wait on specific timeline point for every handles*/ 948bf6cc7dcSmrg __u64 points; 949bf6cc7dcSmrg /* absolute timeout */ 950bf6cc7dcSmrg __s64 timeout_nsec; 951bf6cc7dcSmrg __u32 count_handles; 952bf6cc7dcSmrg __u32 flags; 953bf6cc7dcSmrg __u32 first_signaled; /* only valid when not waiting all */ 954bf6cc7dcSmrg __u32 pad; 95548246ce7Smrg /** 95648246ce7Smrg * @deadline_nsec - fence deadline hint 95748246ce7Smrg * 95848246ce7Smrg * Deadline hint, in absolute CLOCK_MONOTONIC, to set on backing 95948246ce7Smrg * fence(s) if the DRM_SYNCOBJ_WAIT_FLAGS_WAIT_DEADLINE flag is 96048246ce7Smrg * set. 96148246ce7Smrg */ 96248246ce7Smrg __u64 deadline_nsec; 96348246ce7Smrg}; 96448246ce7Smrg 96548246ce7Smrg/** 96648246ce7Smrg * struct drm_syncobj_eventfd 96748246ce7Smrg * @handle: syncobj handle. 96848246ce7Smrg * @flags: Zero to wait for the point to be signalled, or 96948246ce7Smrg * &DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE to wait for a fence to be 97048246ce7Smrg * available for the point. 97148246ce7Smrg * @point: syncobj timeline point (set to zero for binary syncobjs). 97248246ce7Smrg * @fd: Existing eventfd to sent events to. 97348246ce7Smrg * @pad: Must be zero. 97448246ce7Smrg * 97548246ce7Smrg * Register an eventfd to be signalled by a syncobj. The eventfd counter will 97648246ce7Smrg * be incremented by one. 97748246ce7Smrg */ 97848246ce7Smrgstruct drm_syncobj_eventfd { 97948246ce7Smrg __u32 handle; 98048246ce7Smrg __u32 flags; 98148246ce7Smrg __u64 point; 98248246ce7Smrg __s32 fd; 98348246ce7Smrg __u32 pad; 984bf6cc7dcSmrg}; 985bf6cc7dcSmrg 986bf6cc7dcSmrg 9872b90624aSmrgstruct drm_syncobj_array { 9882b90624aSmrg __u64 handles; 9892b90624aSmrg __u32 count_handles; 9902b90624aSmrg __u32 pad; 9912b90624aSmrg}; 9922b90624aSmrg 99387bf8e7cSmrg#define DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED (1 << 0) /* last available point on timeline syncobj */ 994bf6cc7dcSmrgstruct drm_syncobj_timeline_array { 995bf6cc7dcSmrg __u64 handles; 996bf6cc7dcSmrg __u64 points; 997bf6cc7dcSmrg __u32 count_handles; 99887bf8e7cSmrg __u32 flags; 999bf6cc7dcSmrg}; 1000bf6cc7dcSmrg 1001bf6cc7dcSmrg 10022b90624aSmrg/* Query current scanout sequence number */ 10032b90624aSmrgstruct drm_crtc_get_sequence { 10042b90624aSmrg __u32 crtc_id; /* requested crtc_id */ 10052b90624aSmrg __u32 active; /* return: crtc output is active */ 10062b90624aSmrg __u64 sequence; /* return: most recent vblank sequence */ 10072b90624aSmrg __s64 sequence_ns; /* return: most recent time of first pixel out */ 10082b90624aSmrg}; 10092b90624aSmrg 10102b90624aSmrg/* Queue event to be delivered at specified sequence. Time stamp marks 10112b90624aSmrg * when the first pixel of the refresh cycle leaves the display engine 10122b90624aSmrg * for the display 10132b90624aSmrg */ 10142b90624aSmrg#define DRM_CRTC_SEQUENCE_RELATIVE 0x00000001 /* sequence is relative to current */ 10152b90624aSmrg#define DRM_CRTC_SEQUENCE_NEXT_ON_MISS 0x00000002 /* Use next sequence if we've missed */ 10162b90624aSmrg 10172b90624aSmrgstruct drm_crtc_queue_sequence { 10182b90624aSmrg __u32 crtc_id; 10192b90624aSmrg __u32 flags; 10202b90624aSmrg __u64 sequence; /* on input, target sequence. on output, actual sequence */ 10212b90624aSmrg __u64 user_data; /* user data passed to event */ 10222b90624aSmrg}; 10232b90624aSmrg 10242ee35494Smrg#if defined(__cplusplus) 10252ee35494Smrg} 10262ee35494Smrg#endif 10272ee35494Smrg 102822944501Smrg#include "drm_mode.h" 102922944501Smrg 10302ee35494Smrg#if defined(__cplusplus) 10312ee35494Smrgextern "C" { 10322ee35494Smrg#endif 10332ee35494Smrg 103422944501Smrg#define DRM_IOCTL_BASE 'd' 103522944501Smrg#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) 103622944501Smrg#define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type) 103722944501Smrg#define DRM_IOW(nr,type) _IOW(DRM_IOCTL_BASE,nr,type) 103822944501Smrg#define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type) 103922944501Smrg 104022944501Smrg#define DRM_IOCTL_VERSION DRM_IOWR(0x00, struct drm_version) 104122944501Smrg#define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, struct drm_unique) 104222944501Smrg#define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, struct drm_auth) 104322944501Smrg#define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, struct drm_irq_busid) 104422944501Smrg#define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, struct drm_map) 104522944501Smrg#define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client) 104622944501Smrg#define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats) 104722944501Smrg#define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version) 104822944501Smrg#define DRM_IOCTL_MODESET_CTL DRM_IOW(0x08, struct drm_modeset_ctl) 104948246ce7Smrg/** 105048246ce7Smrg * DRM_IOCTL_GEM_CLOSE - Close a GEM handle. 105148246ce7Smrg * 105248246ce7Smrg * GEM handles are not reference-counted by the kernel. User-space is 105348246ce7Smrg * responsible for managing their lifetime. For example, if user-space imports 105448246ce7Smrg * the same memory object twice on the same DRM file description, the same GEM 105548246ce7Smrg * handle is returned by both imports, and user-space needs to ensure 105648246ce7Smrg * &DRM_IOCTL_GEM_CLOSE is performed once only. The same situation can happen 105748246ce7Smrg * when a memory object is allocated, then exported and imported again on the 105848246ce7Smrg * same DRM file description. The &DRM_IOCTL_MODE_GETFB2 IOCTL is an exception 105948246ce7Smrg * and always returns fresh new GEM handles even if an existing GEM handle 106048246ce7Smrg * already refers to the same memory object before the IOCTL is performed. 106148246ce7Smrg */ 106222944501Smrg#define DRM_IOCTL_GEM_CLOSE DRM_IOW (0x09, struct drm_gem_close) 106322944501Smrg#define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink) 106422944501Smrg#define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open) 1065e88f27b3Smrg#define DRM_IOCTL_GET_CAP DRM_IOWR(0x0c, struct drm_get_cap) 1066e88f27b3Smrg#define DRM_IOCTL_SET_CLIENT_CAP DRM_IOW( 0x0d, struct drm_set_client_cap) 106722944501Smrg 106822944501Smrg#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique) 106922944501Smrg#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth) 107022944501Smrg#define DRM_IOCTL_BLOCK DRM_IOWR(0x12, struct drm_block) 107122944501Smrg#define DRM_IOCTL_UNBLOCK DRM_IOWR(0x13, struct drm_block) 107222944501Smrg#define DRM_IOCTL_CONTROL DRM_IOW( 0x14, struct drm_control) 107322944501Smrg#define DRM_IOCTL_ADD_MAP DRM_IOWR(0x15, struct drm_map) 107422944501Smrg#define DRM_IOCTL_ADD_BUFS DRM_IOWR(0x16, struct drm_buf_desc) 107522944501Smrg#define DRM_IOCTL_MARK_BUFS DRM_IOW( 0x17, struct drm_buf_desc) 107622944501Smrg#define DRM_IOCTL_INFO_BUFS DRM_IOWR(0x18, struct drm_buf_info) 107722944501Smrg#define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, struct drm_buf_map) 107822944501Smrg#define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, struct drm_buf_free) 107922944501Smrg 108022944501Smrg#define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, struct drm_map) 108122944501Smrg 108222944501Smrg#define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, struct drm_ctx_priv_map) 108322944501Smrg#define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, struct drm_ctx_priv_map) 108422944501Smrg 108522944501Smrg#define DRM_IOCTL_SET_MASTER DRM_IO(0x1e) 108622944501Smrg#define DRM_IOCTL_DROP_MASTER DRM_IO(0x1f) 108722944501Smrg 108822944501Smrg#define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, struct drm_ctx) 108922944501Smrg#define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, struct drm_ctx) 109022944501Smrg#define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, struct drm_ctx) 109122944501Smrg#define DRM_IOCTL_GET_CTX DRM_IOWR(0x23, struct drm_ctx) 109222944501Smrg#define DRM_IOCTL_SWITCH_CTX DRM_IOW( 0x24, struct drm_ctx) 109322944501Smrg#define DRM_IOCTL_NEW_CTX DRM_IOW( 0x25, struct drm_ctx) 109422944501Smrg#define DRM_IOCTL_RES_CTX DRM_IOWR(0x26, struct drm_ctx_res) 109522944501Smrg#define DRM_IOCTL_ADD_DRAW DRM_IOWR(0x27, struct drm_draw) 109622944501Smrg#define DRM_IOCTL_RM_DRAW DRM_IOWR(0x28, struct drm_draw) 109722944501Smrg#define DRM_IOCTL_DMA DRM_IOWR(0x29, struct drm_dma) 109822944501Smrg#define DRM_IOCTL_LOCK DRM_IOW( 0x2a, struct drm_lock) 109922944501Smrg#define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock) 110022944501Smrg#define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock) 110122944501Smrg 110248246ce7Smrg/** 110348246ce7Smrg * DRM_IOCTL_PRIME_HANDLE_TO_FD - Convert a GEM handle to a DMA-BUF FD. 110448246ce7Smrg * 110548246ce7Smrg * User-space sets &drm_prime_handle.handle with the GEM handle to export and 110648246ce7Smrg * &drm_prime_handle.flags, and gets back a DMA-BUF file descriptor in 110748246ce7Smrg * &drm_prime_handle.fd. 110848246ce7Smrg * 110948246ce7Smrg * The export can fail for any driver-specific reason, e.g. because export is 111048246ce7Smrg * not supported for this specific GEM handle (but might be for others). 111148246ce7Smrg * 111248246ce7Smrg * Support for exporting DMA-BUFs is advertised via &DRM_PRIME_CAP_EXPORT. 111348246ce7Smrg */ 1114e88f27b3Smrg#define DRM_IOCTL_PRIME_HANDLE_TO_FD DRM_IOWR(0x2d, struct drm_prime_handle) 111548246ce7Smrg/** 111648246ce7Smrg * DRM_IOCTL_PRIME_FD_TO_HANDLE - Convert a DMA-BUF FD to a GEM handle. 111748246ce7Smrg * 111848246ce7Smrg * User-space sets &drm_prime_handle.fd with a DMA-BUF file descriptor to 111948246ce7Smrg * import, and gets back a GEM handle in &drm_prime_handle.handle. 112048246ce7Smrg * &drm_prime_handle.flags is unused. 112148246ce7Smrg * 112248246ce7Smrg * If an existing GEM handle refers to the memory object backing the DMA-BUF, 112348246ce7Smrg * that GEM handle is returned. Therefore user-space which needs to handle 112448246ce7Smrg * arbitrary DMA-BUFs must have a user-space lookup data structure to manually 112548246ce7Smrg * reference-count duplicated GEM handles. For more information see 112648246ce7Smrg * &DRM_IOCTL_GEM_CLOSE. 112748246ce7Smrg * 112848246ce7Smrg * The import can fail for any driver-specific reason, e.g. because import is 112948246ce7Smrg * only supported for DMA-BUFs allocated on this DRM device. 113048246ce7Smrg * 113148246ce7Smrg * Support for importing DMA-BUFs is advertised via &DRM_PRIME_CAP_IMPORT. 113248246ce7Smrg */ 1133e88f27b3Smrg#define DRM_IOCTL_PRIME_FD_TO_HANDLE DRM_IOWR(0x2e, struct drm_prime_handle) 1134e88f27b3Smrg 113522944501Smrg#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) 113622944501Smrg#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) 113722944501Smrg#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, struct drm_agp_mode) 113822944501Smrg#define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, struct drm_agp_info) 113922944501Smrg#define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, struct drm_agp_buffer) 114022944501Smrg#define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, struct drm_agp_buffer) 114122944501Smrg#define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, struct drm_agp_binding) 114222944501Smrg#define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, struct drm_agp_binding) 114322944501Smrg 114422944501Smrg#define DRM_IOCTL_SG_ALLOC DRM_IOWR(0x38, struct drm_scatter_gather) 114522944501Smrg#define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, struct drm_scatter_gather) 114622944501Smrg 114722944501Smrg#define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, union drm_wait_vblank) 114822944501Smrg 11492b90624aSmrg#define DRM_IOCTL_CRTC_GET_SEQUENCE DRM_IOWR(0x3b, struct drm_crtc_get_sequence) 11502b90624aSmrg#define DRM_IOCTL_CRTC_QUEUE_SEQUENCE DRM_IOWR(0x3c, struct drm_crtc_queue_sequence) 11512b90624aSmrg 115222944501Smrg#define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, struct drm_update_draw) 115322944501Smrg 115422944501Smrg#define DRM_IOCTL_MODE_GETRESOURCES DRM_IOWR(0xA0, struct drm_mode_card_res) 115522944501Smrg#define DRM_IOCTL_MODE_GETCRTC DRM_IOWR(0xA1, struct drm_mode_crtc) 115622944501Smrg#define DRM_IOCTL_MODE_SETCRTC DRM_IOWR(0xA2, struct drm_mode_crtc) 115722944501Smrg#define DRM_IOCTL_MODE_CURSOR DRM_IOWR(0xA3, struct drm_mode_cursor) 115822944501Smrg#define DRM_IOCTL_MODE_GETGAMMA DRM_IOWR(0xA4, struct drm_mode_crtc_lut) 115922944501Smrg#define DRM_IOCTL_MODE_SETGAMMA DRM_IOWR(0xA5, struct drm_mode_crtc_lut) 116022944501Smrg#define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xA6, struct drm_mode_get_encoder) 116122944501Smrg#define DRM_IOCTL_MODE_GETCONNECTOR DRM_IOWR(0xA7, struct drm_mode_get_connector) 1162fe517fc9Smrg#define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA8, struct drm_mode_mode_cmd) /* deprecated (never worked) */ 1163fe517fc9Smrg#define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd) /* deprecated (never worked) */ 116422944501Smrg 116522944501Smrg#define DRM_IOCTL_MODE_GETPROPERTY DRM_IOWR(0xAA, struct drm_mode_get_property) 116622944501Smrg#define DRM_IOCTL_MODE_SETPROPERTY DRM_IOWR(0xAB, struct drm_mode_connector_set_property) 116722944501Smrg#define DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xAC, struct drm_mode_get_blob) 116822944501Smrg#define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd) 116922944501Smrg#define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) 117048246ce7Smrg/** 117148246ce7Smrg * DRM_IOCTL_MODE_RMFB - Remove a framebuffer. 117248246ce7Smrg * 117348246ce7Smrg * This removes a framebuffer previously added via ADDFB/ADDFB2. The IOCTL 117448246ce7Smrg * argument is a framebuffer object ID. 117548246ce7Smrg * 117648246ce7Smrg * Warning: removing a framebuffer currently in-use on an enabled plane will 117748246ce7Smrg * disable that plane. The CRTC the plane is linked to may also be disabled 117848246ce7Smrg * (depending on driver capabilities). 117948246ce7Smrg */ 118022944501Smrg#define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int) 118122944501Smrg#define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip) 118222944501Smrg#define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd) 118322944501Smrg 118448246ce7Smrg/** 118548246ce7Smrg * DRM_IOCTL_MODE_CREATE_DUMB - Create a new dumb buffer object. 118648246ce7Smrg * 118748246ce7Smrg * KMS dumb buffers provide a very primitive way to allocate a buffer object 118848246ce7Smrg * suitable for scanout and map it for software rendering. KMS dumb buffers are 118948246ce7Smrg * not suitable for hardware-accelerated rendering nor video decoding. KMS dumb 119048246ce7Smrg * buffers are not suitable to be displayed on any other device than the KMS 119148246ce7Smrg * device where they were allocated from. Also see 119248246ce7Smrg * :ref:`kms_dumb_buffer_objects`. 119348246ce7Smrg * 119448246ce7Smrg * The IOCTL argument is a struct drm_mode_create_dumb. 119548246ce7Smrg * 119648246ce7Smrg * User-space is expected to create a KMS dumb buffer via this IOCTL, then add 119748246ce7Smrg * it as a KMS framebuffer via &DRM_IOCTL_MODE_ADDFB and map it via 119848246ce7Smrg * &DRM_IOCTL_MODE_MAP_DUMB. 119948246ce7Smrg * 120048246ce7Smrg * &DRM_CAP_DUMB_BUFFER indicates whether this IOCTL is supported. 120148246ce7Smrg * &DRM_CAP_DUMB_PREFERRED_DEPTH and &DRM_CAP_DUMB_PREFER_SHADOW indicate 120248246ce7Smrg * driver preferences for dumb buffers. 120348246ce7Smrg */ 1204e88f27b3Smrg#define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb) 1205e88f27b3Smrg#define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb) 1206e88f27b3Smrg#define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb) 1207e88f27b3Smrg#define DRM_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xB5, struct drm_mode_get_plane_res) 1208e88f27b3Smrg#define DRM_IOCTL_MODE_GETPLANE DRM_IOWR(0xB6, struct drm_mode_get_plane) 1209e88f27b3Smrg#define DRM_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct drm_mode_set_plane) 1210e88f27b3Smrg#define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2) 1211e88f27b3Smrg#define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties) 1212e88f27b3Smrg#define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property) 1213e88f27b3Smrg#define DRM_IOCTL_MODE_CURSOR2 DRM_IOWR(0xBB, struct drm_mode_cursor2) 1214424e9256Smrg#define DRM_IOCTL_MODE_ATOMIC DRM_IOWR(0xBC, struct drm_mode_atomic) 1215424e9256Smrg#define DRM_IOCTL_MODE_CREATEPROPBLOB DRM_IOWR(0xBD, struct drm_mode_create_blob) 1216424e9256Smrg#define DRM_IOCTL_MODE_DESTROYPROPBLOB DRM_IOWR(0xBE, struct drm_mode_destroy_blob) 1217e88f27b3Smrg 12180655efefSmrg#define DRM_IOCTL_SYNCOBJ_CREATE DRM_IOWR(0xBF, struct drm_syncobj_create) 12190655efefSmrg#define DRM_IOCTL_SYNCOBJ_DESTROY DRM_IOWR(0xC0, struct drm_syncobj_destroy) 12200655efefSmrg#define DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD DRM_IOWR(0xC1, struct drm_syncobj_handle) 12210655efefSmrg#define DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE DRM_IOWR(0xC2, struct drm_syncobj_handle) 12222b90624aSmrg#define DRM_IOCTL_SYNCOBJ_WAIT DRM_IOWR(0xC3, struct drm_syncobj_wait) 12232b90624aSmrg#define DRM_IOCTL_SYNCOBJ_RESET DRM_IOWR(0xC4, struct drm_syncobj_array) 12242b90624aSmrg#define DRM_IOCTL_SYNCOBJ_SIGNAL DRM_IOWR(0xC5, struct drm_syncobj_array) 12252b90624aSmrg 12262b90624aSmrg#define DRM_IOCTL_MODE_CREATE_LEASE DRM_IOWR(0xC6, struct drm_mode_create_lease) 12272b90624aSmrg#define DRM_IOCTL_MODE_LIST_LESSEES DRM_IOWR(0xC7, struct drm_mode_list_lessees) 12282b90624aSmrg#define DRM_IOCTL_MODE_GET_LEASE DRM_IOWR(0xC8, struct drm_mode_get_lease) 12292b90624aSmrg#define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease) 12300655efefSmrg 1231bf6cc7dcSmrg#define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait) 1232bf6cc7dcSmrg#define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, struct drm_syncobj_timeline_array) 1233bf6cc7dcSmrg#define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer) 1234bf6cc7dcSmrg#define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL DRM_IOWR(0xCD, struct drm_syncobj_timeline_array) 1235bf6cc7dcSmrg 123648246ce7Smrg/** 123748246ce7Smrg * DRM_IOCTL_MODE_GETFB2 - Get framebuffer metadata. 123848246ce7Smrg * 123948246ce7Smrg * This queries metadata about a framebuffer. User-space fills 124048246ce7Smrg * &drm_mode_fb_cmd2.fb_id as the input, and the kernels fills the rest of the 124148246ce7Smrg * struct as the output. 124248246ce7Smrg * 124348246ce7Smrg * If the client is DRM master or has &CAP_SYS_ADMIN, &drm_mode_fb_cmd2.handles 124448246ce7Smrg * will be filled with GEM buffer handles. Fresh new GEM handles are always 124548246ce7Smrg * returned, even if another GEM handle referring to the same memory object 124648246ce7Smrg * already exists on the DRM file description. The caller is responsible for 124748246ce7Smrg * removing the new handles, e.g. via the &DRM_IOCTL_GEM_CLOSE IOCTL. The same 124848246ce7Smrg * new handle will be returned for multiple planes in case they use the same 124948246ce7Smrg * memory object. Planes are valid until one has a zero handle -- this can be 125048246ce7Smrg * used to compute the number of planes. 125148246ce7Smrg * 125248246ce7Smrg * Otherwise, &drm_mode_fb_cmd2.handles will be zeroed and planes are valid 125348246ce7Smrg * until one has a zero &drm_mode_fb_cmd2.pitches. 125448246ce7Smrg * 125548246ce7Smrg * If the framebuffer has a format modifier, &DRM_MODE_FB_MODIFIERS will be set 125648246ce7Smrg * in &drm_mode_fb_cmd2.flags and &drm_mode_fb_cmd2.modifier will contain the 125748246ce7Smrg * modifier. Otherwise, user-space must ignore &drm_mode_fb_cmd2.modifier. 125848246ce7Smrg * 125948246ce7Smrg * To obtain DMA-BUF FDs for each plane without leaking GEM handles, user-space 126048246ce7Smrg * can export each handle via &DRM_IOCTL_PRIME_HANDLE_TO_FD, then immediately 126148246ce7Smrg * close each unique handle via &DRM_IOCTL_GEM_CLOSE, making sure to not 126248246ce7Smrg * double-close handles which are specified multiple times in the array. 126348246ce7Smrg */ 126487bf8e7cSmrg#define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE, struct drm_mode_fb_cmd2) 126587bf8e7cSmrg 126648246ce7Smrg#define DRM_IOCTL_SYNCOBJ_EVENTFD DRM_IOWR(0xCF, struct drm_syncobj_eventfd) 126748246ce7Smrg 126848246ce7Smrg/** 126948246ce7Smrg * DRM_IOCTL_MODE_CLOSEFB - Close a framebuffer. 127048246ce7Smrg * 127148246ce7Smrg * This closes a framebuffer previously added via ADDFB/ADDFB2. The IOCTL 127248246ce7Smrg * argument is a framebuffer object ID. 127348246ce7Smrg * 127448246ce7Smrg * This IOCTL is similar to &DRM_IOCTL_MODE_RMFB, except it doesn't disable 127548246ce7Smrg * planes and CRTCs. As long as the framebuffer is used by a plane, it's kept 127648246ce7Smrg * alive. When the plane no longer uses the framebuffer (because the 127748246ce7Smrg * framebuffer is replaced with another one, or the plane is disabled), the 127848246ce7Smrg * framebuffer is cleaned up. 127948246ce7Smrg * 128048246ce7Smrg * This is useful to implement flicker-free transitions between two processes. 128148246ce7Smrg * 128248246ce7Smrg * Depending on the threat model, user-space may want to ensure that the 128348246ce7Smrg * framebuffer doesn't expose any sensitive user information: closed 128448246ce7Smrg * framebuffers attached to a plane can be read back by the next DRM master. 128548246ce7Smrg */ 128648246ce7Smrg#define DRM_IOCTL_MODE_CLOSEFB DRM_IOWR(0xD0, struct drm_mode_closefb) 128748246ce7Smrg 1288adfa0b0cSmrg/* 128922944501Smrg * Device specific ioctls should only be in their respective headers 1290fe517fc9Smrg * The device specific ioctl range is from 0x40 to 0x9f. 129122944501Smrg * Generic IOCTLS restart at 0xA0. 129222944501Smrg * 129322944501Smrg * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and 129422944501Smrg * drmCommandReadWrite(). 129522944501Smrg */ 129622944501Smrg#define DRM_COMMAND_BASE 0x40 129722944501Smrg#define DRM_COMMAND_END 0xA0 129822944501Smrg 129948246ce7Smrg/** 130048246ce7Smrg * struct drm_event - Header for DRM events 130148246ce7Smrg * @type: event type. 130248246ce7Smrg * @length: total number of payload bytes (including header). 130348246ce7Smrg * 130448246ce7Smrg * This struct is a header for events written back to user-space on the DRM FD. 130548246ce7Smrg * A read on the DRM FD will always only return complete events: e.g. if the 130648246ce7Smrg * read buffer is 100 bytes large and there are two 64 byte events pending, 130748246ce7Smrg * only one will be returned. 130848246ce7Smrg * 130948246ce7Smrg * Event types 0 - 0x7fffffff are generic DRM events, 0x80000000 and 131048246ce7Smrg * up are chipset specific. Generic DRM events include &DRM_EVENT_VBLANK, 131148246ce7Smrg * &DRM_EVENT_FLIP_COMPLETE and &DRM_EVENT_CRTC_SEQUENCE. 131222944501Smrg */ 131322944501Smrgstruct drm_event { 131422944501Smrg __u32 type; 131522944501Smrg __u32 length; 131622944501Smrg}; 131722944501Smrg 131848246ce7Smrg/** 131948246ce7Smrg * DRM_EVENT_VBLANK - vertical blanking event 132048246ce7Smrg * 132148246ce7Smrg * This event is sent in response to &DRM_IOCTL_WAIT_VBLANK with the 132248246ce7Smrg * &_DRM_VBLANK_EVENT flag set. 132348246ce7Smrg * 132448246ce7Smrg * The event payload is a struct drm_event_vblank. 132548246ce7Smrg */ 132622944501Smrg#define DRM_EVENT_VBLANK 0x01 132748246ce7Smrg/** 132848246ce7Smrg * DRM_EVENT_FLIP_COMPLETE - page-flip completion event 132948246ce7Smrg * 133048246ce7Smrg * This event is sent in response to an atomic commit or legacy page-flip with 133148246ce7Smrg * the &DRM_MODE_PAGE_FLIP_EVENT flag set. 133248246ce7Smrg * 133348246ce7Smrg * The event payload is a struct drm_event_vblank. 133448246ce7Smrg */ 133522944501Smrg#define DRM_EVENT_FLIP_COMPLETE 0x02 133648246ce7Smrg/** 133748246ce7Smrg * DRM_EVENT_CRTC_SEQUENCE - CRTC sequence event 133848246ce7Smrg * 133948246ce7Smrg * This event is sent in response to &DRM_IOCTL_CRTC_QUEUE_SEQUENCE. 134048246ce7Smrg * 134148246ce7Smrg * The event payload is a struct drm_event_crtc_sequence. 134248246ce7Smrg */ 13432b90624aSmrg#define DRM_EVENT_CRTC_SEQUENCE 0x03 134422944501Smrg 134522944501Smrgstruct drm_event_vblank { 134622944501Smrg struct drm_event base; 134722944501Smrg __u64 user_data; 134822944501Smrg __u32 tv_sec; 134922944501Smrg __u32 tv_usec; 135022944501Smrg __u32 sequence; 13510655efefSmrg __u32 crtc_id; /* 0 on older kernels that do not support this */ 135222944501Smrg}; 135322944501Smrg 13542b90624aSmrg/* Event delivered at sequence. Time stamp marks when the first pixel 13552b90624aSmrg * of the refresh cycle leaves the display engine for the display 13562b90624aSmrg */ 13572b90624aSmrgstruct drm_event_crtc_sequence { 13582b90624aSmrg struct drm_event base; 13592b90624aSmrg __u64 user_data; 13602b90624aSmrg __s64 time_ns; 13612b90624aSmrg __u64 sequence; 13622b90624aSmrg}; 13632b90624aSmrg 136422944501Smrg/* typedef area */ 136522944501Smrgtypedef struct drm_clip_rect drm_clip_rect_t; 136622944501Smrgtypedef struct drm_drawable_info drm_drawable_info_t; 136722944501Smrgtypedef struct drm_tex_region drm_tex_region_t; 136822944501Smrgtypedef struct drm_hw_lock drm_hw_lock_t; 136922944501Smrgtypedef struct drm_version drm_version_t; 137022944501Smrgtypedef struct drm_unique drm_unique_t; 137122944501Smrgtypedef struct drm_list drm_list_t; 137222944501Smrgtypedef struct drm_block drm_block_t; 137322944501Smrgtypedef struct drm_control drm_control_t; 137422944501Smrgtypedef enum drm_map_type drm_map_type_t; 137522944501Smrgtypedef enum drm_map_flags drm_map_flags_t; 137622944501Smrgtypedef struct drm_ctx_priv_map drm_ctx_priv_map_t; 137722944501Smrgtypedef struct drm_map drm_map_t; 137822944501Smrgtypedef struct drm_client drm_client_t; 137922944501Smrgtypedef enum drm_stat_type drm_stat_type_t; 138022944501Smrgtypedef struct drm_stats drm_stats_t; 138122944501Smrgtypedef enum drm_lock_flags drm_lock_flags_t; 138222944501Smrgtypedef struct drm_lock drm_lock_t; 138322944501Smrgtypedef enum drm_dma_flags drm_dma_flags_t; 138422944501Smrgtypedef struct drm_buf_desc drm_buf_desc_t; 138522944501Smrgtypedef struct drm_buf_info drm_buf_info_t; 138622944501Smrgtypedef struct drm_buf_free drm_buf_free_t; 138722944501Smrgtypedef struct drm_buf_pub drm_buf_pub_t; 138822944501Smrgtypedef struct drm_buf_map drm_buf_map_t; 138922944501Smrgtypedef struct drm_dma drm_dma_t; 139022944501Smrgtypedef union drm_wait_vblank drm_wait_vblank_t; 139122944501Smrgtypedef struct drm_agp_mode drm_agp_mode_t; 139222944501Smrgtypedef enum drm_ctx_flags drm_ctx_flags_t; 139322944501Smrgtypedef struct drm_ctx drm_ctx_t; 139422944501Smrgtypedef struct drm_ctx_res drm_ctx_res_t; 139522944501Smrgtypedef struct drm_draw drm_draw_t; 139622944501Smrgtypedef struct drm_update_draw drm_update_draw_t; 139722944501Smrgtypedef struct drm_auth drm_auth_t; 139822944501Smrgtypedef struct drm_irq_busid drm_irq_busid_t; 139922944501Smrgtypedef enum drm_vblank_seq_type drm_vblank_seq_type_t; 140022944501Smrg 140122944501Smrgtypedef struct drm_agp_buffer drm_agp_buffer_t; 140222944501Smrgtypedef struct drm_agp_binding drm_agp_binding_t; 140322944501Smrgtypedef struct drm_agp_info drm_agp_info_t; 140422944501Smrgtypedef struct drm_scatter_gather drm_scatter_gather_t; 140522944501Smrgtypedef struct drm_set_version drm_set_version_t; 140622944501Smrg 14072ee35494Smrg#if defined(__cplusplus) 14082ee35494Smrg} 14092ee35494Smrg#endif 14102ee35494Smrg 141122944501Smrg#endif 1412