18c2ecf20Sopenharmony_ci/** 28c2ecf20Sopenharmony_ci * \file drm.h 38c2ecf20Sopenharmony_ci * Header for the Direct Rendering Manager 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * \author Rickard E. (Rik) Faith <faith@valinux.com> 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * \par Acknowledgments: 88c2ecf20Sopenharmony_ci * Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic \c cmpxchg. 98c2ecf20Sopenharmony_ci */ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci/* 128c2ecf20Sopenharmony_ci * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 138c2ecf20Sopenharmony_ci * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 148c2ecf20Sopenharmony_ci * All rights reserved. 158c2ecf20Sopenharmony_ci * 168c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 178c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 188c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation 198c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 208c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 218c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 228c2ecf20Sopenharmony_ci * 238c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice (including the next 248c2ecf20Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 258c2ecf20Sopenharmony_ci * Software. 268c2ecf20Sopenharmony_ci * 278c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 288c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 298c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 308c2ecf20Sopenharmony_ci * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 318c2ecf20Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 328c2ecf20Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 338c2ecf20Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE. 348c2ecf20Sopenharmony_ci */ 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci#ifndef _DRM_H_ 378c2ecf20Sopenharmony_ci#define _DRM_H_ 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#if defined(__KERNEL__) 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci#include <linux/types.h> 428c2ecf20Sopenharmony_ci#include <asm/ioctl.h> 438c2ecf20Sopenharmony_citypedef unsigned int drm_handle_t; 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci#elif defined(__linux__) 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci#include <linux/types.h> 488c2ecf20Sopenharmony_ci#include <asm/ioctl.h> 498c2ecf20Sopenharmony_citypedef unsigned int drm_handle_t; 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci#else /* One of the BSDs */ 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci#include <stdint.h> 548c2ecf20Sopenharmony_ci#include <sys/ioccom.h> 558c2ecf20Sopenharmony_ci#include <sys/types.h> 568c2ecf20Sopenharmony_citypedef int8_t __s8; 578c2ecf20Sopenharmony_citypedef uint8_t __u8; 588c2ecf20Sopenharmony_citypedef int16_t __s16; 598c2ecf20Sopenharmony_citypedef uint16_t __u16; 608c2ecf20Sopenharmony_citypedef int32_t __s32; 618c2ecf20Sopenharmony_citypedef uint32_t __u32; 628c2ecf20Sopenharmony_citypedef int64_t __s64; 638c2ecf20Sopenharmony_citypedef uint64_t __u64; 648c2ecf20Sopenharmony_citypedef size_t __kernel_size_t; 658c2ecf20Sopenharmony_citypedef unsigned long drm_handle_t; 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci#endif 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci#if defined(__cplusplus) 708c2ecf20Sopenharmony_ciextern "C" { 718c2ecf20Sopenharmony_ci#endif 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci#define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */ 748c2ecf20Sopenharmony_ci#define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */ 758c2ecf20Sopenharmony_ci#define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */ 768c2ecf20Sopenharmony_ci#define DRM_RAM_PERCENT 10 /**< How much system ram can we lock? */ 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci#define _DRM_LOCK_HELD 0x80000000U /**< Hardware lock is held */ 798c2ecf20Sopenharmony_ci#define _DRM_LOCK_CONT 0x40000000U /**< Hardware lock is contended */ 808c2ecf20Sopenharmony_ci#define _DRM_LOCK_IS_HELD(lock) ((lock) & _DRM_LOCK_HELD) 818c2ecf20Sopenharmony_ci#define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT) 828c2ecf20Sopenharmony_ci#define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_citypedef unsigned int drm_context_t; 858c2ecf20Sopenharmony_citypedef unsigned int drm_drawable_t; 868c2ecf20Sopenharmony_citypedef unsigned int drm_magic_t; 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci/** 898c2ecf20Sopenharmony_ci * Cliprect. 908c2ecf20Sopenharmony_ci * 918c2ecf20Sopenharmony_ci * \warning: If you change this structure, make sure you change 928c2ecf20Sopenharmony_ci * XF86DRIClipRectRec in the server as well 938c2ecf20Sopenharmony_ci * 948c2ecf20Sopenharmony_ci * \note KW: Actually it's illegal to change either for 958c2ecf20Sopenharmony_ci * backwards-compatibility reasons. 968c2ecf20Sopenharmony_ci */ 978c2ecf20Sopenharmony_cistruct drm_clip_rect { 988c2ecf20Sopenharmony_ci unsigned short x1; 998c2ecf20Sopenharmony_ci unsigned short y1; 1008c2ecf20Sopenharmony_ci unsigned short x2; 1018c2ecf20Sopenharmony_ci unsigned short y2; 1028c2ecf20Sopenharmony_ci}; 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci/** 1058c2ecf20Sopenharmony_ci * Drawable information. 1068c2ecf20Sopenharmony_ci */ 1078c2ecf20Sopenharmony_cistruct drm_drawable_info { 1088c2ecf20Sopenharmony_ci unsigned int num_rects; 1098c2ecf20Sopenharmony_ci struct drm_clip_rect *rects; 1108c2ecf20Sopenharmony_ci}; 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci/** 1138c2ecf20Sopenharmony_ci * Texture region, 1148c2ecf20Sopenharmony_ci */ 1158c2ecf20Sopenharmony_cistruct drm_tex_region { 1168c2ecf20Sopenharmony_ci unsigned char next; 1178c2ecf20Sopenharmony_ci unsigned char prev; 1188c2ecf20Sopenharmony_ci unsigned char in_use; 1198c2ecf20Sopenharmony_ci unsigned char padding; 1208c2ecf20Sopenharmony_ci unsigned int age; 1218c2ecf20Sopenharmony_ci}; 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci/** 1248c2ecf20Sopenharmony_ci * Hardware lock. 1258c2ecf20Sopenharmony_ci * 1268c2ecf20Sopenharmony_ci * The lock structure is a simple cache-line aligned integer. To avoid 1278c2ecf20Sopenharmony_ci * processor bus contention on a multiprocessor system, there should not be any 1288c2ecf20Sopenharmony_ci * other data stored in the same cache line. 1298c2ecf20Sopenharmony_ci */ 1308c2ecf20Sopenharmony_cistruct drm_hw_lock { 1318c2ecf20Sopenharmony_ci __volatile__ unsigned int lock; /**< lock variable */ 1328c2ecf20Sopenharmony_ci char padding[60]; /**< Pad to cache line */ 1338c2ecf20Sopenharmony_ci}; 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ci/** 1368c2ecf20Sopenharmony_ci * DRM_IOCTL_VERSION ioctl argument type. 1378c2ecf20Sopenharmony_ci * 1388c2ecf20Sopenharmony_ci * \sa drmGetVersion(). 1398c2ecf20Sopenharmony_ci */ 1408c2ecf20Sopenharmony_cistruct drm_version { 1418c2ecf20Sopenharmony_ci int version_major; /**< Major version */ 1428c2ecf20Sopenharmony_ci int version_minor; /**< Minor version */ 1438c2ecf20Sopenharmony_ci int version_patchlevel; /**< Patch level */ 1448c2ecf20Sopenharmony_ci __kernel_size_t name_len; /**< Length of name buffer */ 1458c2ecf20Sopenharmony_ci char __user *name; /**< Name of driver */ 1468c2ecf20Sopenharmony_ci __kernel_size_t date_len; /**< Length of date buffer */ 1478c2ecf20Sopenharmony_ci char __user *date; /**< User-space buffer to hold date */ 1488c2ecf20Sopenharmony_ci __kernel_size_t desc_len; /**< Length of desc buffer */ 1498c2ecf20Sopenharmony_ci char __user *desc; /**< User-space buffer to hold desc */ 1508c2ecf20Sopenharmony_ci}; 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci/** 1538c2ecf20Sopenharmony_ci * DRM_IOCTL_GET_UNIQUE ioctl argument type. 1548c2ecf20Sopenharmony_ci * 1558c2ecf20Sopenharmony_ci * \sa drmGetBusid() and drmSetBusId(). 1568c2ecf20Sopenharmony_ci */ 1578c2ecf20Sopenharmony_cistruct drm_unique { 1588c2ecf20Sopenharmony_ci __kernel_size_t unique_len; /**< Length of unique */ 1598c2ecf20Sopenharmony_ci char __user *unique; /**< Unique name for driver instantiation */ 1608c2ecf20Sopenharmony_ci}; 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_cistruct drm_list { 1638c2ecf20Sopenharmony_ci int count; /**< Length of user-space structures */ 1648c2ecf20Sopenharmony_ci struct drm_version __user *version; 1658c2ecf20Sopenharmony_ci}; 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_cistruct drm_block { 1688c2ecf20Sopenharmony_ci int unused; 1698c2ecf20Sopenharmony_ci}; 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ci/** 1728c2ecf20Sopenharmony_ci * DRM_IOCTL_CONTROL ioctl argument type. 1738c2ecf20Sopenharmony_ci * 1748c2ecf20Sopenharmony_ci * \sa drmCtlInstHandler() and drmCtlUninstHandler(). 1758c2ecf20Sopenharmony_ci */ 1768c2ecf20Sopenharmony_cistruct drm_control { 1778c2ecf20Sopenharmony_ci enum { 1788c2ecf20Sopenharmony_ci DRM_ADD_COMMAND, 1798c2ecf20Sopenharmony_ci DRM_RM_COMMAND, 1808c2ecf20Sopenharmony_ci DRM_INST_HANDLER, 1818c2ecf20Sopenharmony_ci DRM_UNINST_HANDLER 1828c2ecf20Sopenharmony_ci } func; 1838c2ecf20Sopenharmony_ci int irq; 1848c2ecf20Sopenharmony_ci}; 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci/** 1878c2ecf20Sopenharmony_ci * Type of memory to map. 1888c2ecf20Sopenharmony_ci */ 1898c2ecf20Sopenharmony_cienum drm_map_type { 1908c2ecf20Sopenharmony_ci _DRM_FRAME_BUFFER = 0, /**< WC (no caching), no core dump */ 1918c2ecf20Sopenharmony_ci _DRM_REGISTERS = 1, /**< no caching, no core dump */ 1928c2ecf20Sopenharmony_ci _DRM_SHM = 2, /**< shared, cached */ 1938c2ecf20Sopenharmony_ci _DRM_AGP = 3, /**< AGP/GART */ 1948c2ecf20Sopenharmony_ci _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */ 1958c2ecf20Sopenharmony_ci _DRM_CONSISTENT = 5 /**< Consistent memory for PCI DMA */ 1968c2ecf20Sopenharmony_ci}; 1978c2ecf20Sopenharmony_ci 1988c2ecf20Sopenharmony_ci/** 1998c2ecf20Sopenharmony_ci * Memory mapping flags. 2008c2ecf20Sopenharmony_ci */ 2018c2ecf20Sopenharmony_cienum drm_map_flags { 2028c2ecf20Sopenharmony_ci _DRM_RESTRICTED = 0x01, /**< Cannot be mapped to user-virtual */ 2038c2ecf20Sopenharmony_ci _DRM_READ_ONLY = 0x02, 2048c2ecf20Sopenharmony_ci _DRM_LOCKED = 0x04, /**< shared, cached, locked */ 2058c2ecf20Sopenharmony_ci _DRM_KERNEL = 0x08, /**< kernel requires access */ 2068c2ecf20Sopenharmony_ci _DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */ 2078c2ecf20Sopenharmony_ci _DRM_CONTAINS_LOCK = 0x20, /**< SHM page that contains lock */ 2088c2ecf20Sopenharmony_ci _DRM_REMOVABLE = 0x40, /**< Removable mapping */ 2098c2ecf20Sopenharmony_ci _DRM_DRIVER = 0x80 /**< Managed by driver */ 2108c2ecf20Sopenharmony_ci}; 2118c2ecf20Sopenharmony_ci 2128c2ecf20Sopenharmony_cistruct drm_ctx_priv_map { 2138c2ecf20Sopenharmony_ci unsigned int ctx_id; /**< Context requesting private mapping */ 2148c2ecf20Sopenharmony_ci void *handle; /**< Handle of map */ 2158c2ecf20Sopenharmony_ci}; 2168c2ecf20Sopenharmony_ci 2178c2ecf20Sopenharmony_ci/** 2188c2ecf20Sopenharmony_ci * DRM_IOCTL_GET_MAP, DRM_IOCTL_ADD_MAP and DRM_IOCTL_RM_MAP ioctls 2198c2ecf20Sopenharmony_ci * argument type. 2208c2ecf20Sopenharmony_ci * 2218c2ecf20Sopenharmony_ci * \sa drmAddMap(). 2228c2ecf20Sopenharmony_ci */ 2238c2ecf20Sopenharmony_cistruct drm_map { 2248c2ecf20Sopenharmony_ci unsigned long offset; /**< Requested physical address (0 for SAREA)*/ 2258c2ecf20Sopenharmony_ci unsigned long size; /**< Requested physical size (bytes) */ 2268c2ecf20Sopenharmony_ci enum drm_map_type type; /**< Type of memory to map */ 2278c2ecf20Sopenharmony_ci enum drm_map_flags flags; /**< Flags */ 2288c2ecf20Sopenharmony_ci void *handle; /**< User-space: "Handle" to pass to mmap() */ 2298c2ecf20Sopenharmony_ci /**< Kernel-space: kernel-virtual address */ 2308c2ecf20Sopenharmony_ci int mtrr; /**< MTRR slot used */ 2318c2ecf20Sopenharmony_ci /* Private data */ 2328c2ecf20Sopenharmony_ci}; 2338c2ecf20Sopenharmony_ci 2348c2ecf20Sopenharmony_ci/** 2358c2ecf20Sopenharmony_ci * DRM_IOCTL_GET_CLIENT ioctl argument type. 2368c2ecf20Sopenharmony_ci */ 2378c2ecf20Sopenharmony_cistruct drm_client { 2388c2ecf20Sopenharmony_ci int idx; /**< Which client desired? */ 2398c2ecf20Sopenharmony_ci int auth; /**< Is client authenticated? */ 2408c2ecf20Sopenharmony_ci unsigned long pid; /**< Process ID */ 2418c2ecf20Sopenharmony_ci unsigned long uid; /**< User ID */ 2428c2ecf20Sopenharmony_ci unsigned long magic; /**< Magic */ 2438c2ecf20Sopenharmony_ci unsigned long iocs; /**< Ioctl count */ 2448c2ecf20Sopenharmony_ci}; 2458c2ecf20Sopenharmony_ci 2468c2ecf20Sopenharmony_cienum drm_stat_type { 2478c2ecf20Sopenharmony_ci _DRM_STAT_LOCK, 2488c2ecf20Sopenharmony_ci _DRM_STAT_OPENS, 2498c2ecf20Sopenharmony_ci _DRM_STAT_CLOSES, 2508c2ecf20Sopenharmony_ci _DRM_STAT_IOCTLS, 2518c2ecf20Sopenharmony_ci _DRM_STAT_LOCKS, 2528c2ecf20Sopenharmony_ci _DRM_STAT_UNLOCKS, 2538c2ecf20Sopenharmony_ci _DRM_STAT_VALUE, /**< Generic value */ 2548c2ecf20Sopenharmony_ci _DRM_STAT_BYTE, /**< Generic byte counter (1024bytes/K) */ 2558c2ecf20Sopenharmony_ci _DRM_STAT_COUNT, /**< Generic non-byte counter (1000/k) */ 2568c2ecf20Sopenharmony_ci 2578c2ecf20Sopenharmony_ci _DRM_STAT_IRQ, /**< IRQ */ 2588c2ecf20Sopenharmony_ci _DRM_STAT_PRIMARY, /**< Primary DMA bytes */ 2598c2ecf20Sopenharmony_ci _DRM_STAT_SECONDARY, /**< Secondary DMA bytes */ 2608c2ecf20Sopenharmony_ci _DRM_STAT_DMA, /**< DMA */ 2618c2ecf20Sopenharmony_ci _DRM_STAT_SPECIAL, /**< Special DMA (e.g., priority or polled) */ 2628c2ecf20Sopenharmony_ci _DRM_STAT_MISSED /**< Missed DMA opportunity */ 2638c2ecf20Sopenharmony_ci /* Add to the *END* of the list */ 2648c2ecf20Sopenharmony_ci}; 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_ci/** 2678c2ecf20Sopenharmony_ci * DRM_IOCTL_GET_STATS ioctl argument type. 2688c2ecf20Sopenharmony_ci */ 2698c2ecf20Sopenharmony_cistruct drm_stats { 2708c2ecf20Sopenharmony_ci unsigned long count; 2718c2ecf20Sopenharmony_ci struct { 2728c2ecf20Sopenharmony_ci unsigned long value; 2738c2ecf20Sopenharmony_ci enum drm_stat_type type; 2748c2ecf20Sopenharmony_ci } data[15]; 2758c2ecf20Sopenharmony_ci}; 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_ci/** 2788c2ecf20Sopenharmony_ci * Hardware locking flags. 2798c2ecf20Sopenharmony_ci */ 2808c2ecf20Sopenharmony_cienum drm_lock_flags { 2818c2ecf20Sopenharmony_ci _DRM_LOCK_READY = 0x01, /**< Wait until hardware is ready for DMA */ 2828c2ecf20Sopenharmony_ci _DRM_LOCK_QUIESCENT = 0x02, /**< Wait until hardware quiescent */ 2838c2ecf20Sopenharmony_ci _DRM_LOCK_FLUSH = 0x04, /**< Flush this context's DMA queue first */ 2848c2ecf20Sopenharmony_ci _DRM_LOCK_FLUSH_ALL = 0x08, /**< Flush all DMA queues first */ 2858c2ecf20Sopenharmony_ci /* These *HALT* flags aren't supported yet 2868c2ecf20Sopenharmony_ci -- they will be used to support the 2878c2ecf20Sopenharmony_ci full-screen DGA-like mode. */ 2888c2ecf20Sopenharmony_ci _DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */ 2898c2ecf20Sopenharmony_ci _DRM_HALT_CUR_QUEUES = 0x20 /**< Halt all current queues */ 2908c2ecf20Sopenharmony_ci}; 2918c2ecf20Sopenharmony_ci 2928c2ecf20Sopenharmony_ci/** 2938c2ecf20Sopenharmony_ci * DRM_IOCTL_LOCK, DRM_IOCTL_UNLOCK and DRM_IOCTL_FINISH ioctl argument type. 2948c2ecf20Sopenharmony_ci * 2958c2ecf20Sopenharmony_ci * \sa drmGetLock() and drmUnlock(). 2968c2ecf20Sopenharmony_ci */ 2978c2ecf20Sopenharmony_cistruct drm_lock { 2988c2ecf20Sopenharmony_ci int context; 2998c2ecf20Sopenharmony_ci enum drm_lock_flags flags; 3008c2ecf20Sopenharmony_ci}; 3018c2ecf20Sopenharmony_ci 3028c2ecf20Sopenharmony_ci/** 3038c2ecf20Sopenharmony_ci * DMA flags 3048c2ecf20Sopenharmony_ci * 3058c2ecf20Sopenharmony_ci * \warning 3068c2ecf20Sopenharmony_ci * These values \e must match xf86drm.h. 3078c2ecf20Sopenharmony_ci * 3088c2ecf20Sopenharmony_ci * \sa drm_dma. 3098c2ecf20Sopenharmony_ci */ 3108c2ecf20Sopenharmony_cienum drm_dma_flags { 3118c2ecf20Sopenharmony_ci /* Flags for DMA buffer dispatch */ 3128c2ecf20Sopenharmony_ci _DRM_DMA_BLOCK = 0x01, /**< 3138c2ecf20Sopenharmony_ci * Block until buffer dispatched. 3148c2ecf20Sopenharmony_ci * 3158c2ecf20Sopenharmony_ci * \note The buffer may not yet have 3168c2ecf20Sopenharmony_ci * been processed by the hardware -- 3178c2ecf20Sopenharmony_ci * getting a hardware lock with the 3188c2ecf20Sopenharmony_ci * hardware quiescent will ensure 3198c2ecf20Sopenharmony_ci * that the buffer has been 3208c2ecf20Sopenharmony_ci * processed. 3218c2ecf20Sopenharmony_ci */ 3228c2ecf20Sopenharmony_ci _DRM_DMA_WHILE_LOCKED = 0x02, /**< Dispatch while lock held */ 3238c2ecf20Sopenharmony_ci _DRM_DMA_PRIORITY = 0x04, /**< High priority dispatch */ 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_ci /* Flags for DMA buffer request */ 3268c2ecf20Sopenharmony_ci _DRM_DMA_WAIT = 0x10, /**< Wait for free buffers */ 3278c2ecf20Sopenharmony_ci _DRM_DMA_SMALLER_OK = 0x20, /**< Smaller-than-requested buffers OK */ 3288c2ecf20Sopenharmony_ci _DRM_DMA_LARGER_OK = 0x40 /**< Larger-than-requested buffers OK */ 3298c2ecf20Sopenharmony_ci}; 3308c2ecf20Sopenharmony_ci 3318c2ecf20Sopenharmony_ci/** 3328c2ecf20Sopenharmony_ci * DRM_IOCTL_ADD_BUFS and DRM_IOCTL_MARK_BUFS ioctl argument type. 3338c2ecf20Sopenharmony_ci * 3348c2ecf20Sopenharmony_ci * \sa drmAddBufs(). 3358c2ecf20Sopenharmony_ci */ 3368c2ecf20Sopenharmony_cistruct drm_buf_desc { 3378c2ecf20Sopenharmony_ci int count; /**< Number of buffers of this size */ 3388c2ecf20Sopenharmony_ci int size; /**< Size in bytes */ 3398c2ecf20Sopenharmony_ci int low_mark; /**< Low water mark */ 3408c2ecf20Sopenharmony_ci int high_mark; /**< High water mark */ 3418c2ecf20Sopenharmony_ci enum { 3428c2ecf20Sopenharmony_ci _DRM_PAGE_ALIGN = 0x01, /**< Align on page boundaries for DMA */ 3438c2ecf20Sopenharmony_ci _DRM_AGP_BUFFER = 0x02, /**< Buffer is in AGP space */ 3448c2ecf20Sopenharmony_ci _DRM_SG_BUFFER = 0x04, /**< Scatter/gather memory buffer */ 3458c2ecf20Sopenharmony_ci _DRM_FB_BUFFER = 0x08, /**< Buffer is in frame buffer */ 3468c2ecf20Sopenharmony_ci _DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */ 3478c2ecf20Sopenharmony_ci } flags; 3488c2ecf20Sopenharmony_ci unsigned long agp_start; /**< 3498c2ecf20Sopenharmony_ci * Start address of where the AGP buffers are 3508c2ecf20Sopenharmony_ci * in the AGP aperture 3518c2ecf20Sopenharmony_ci */ 3528c2ecf20Sopenharmony_ci}; 3538c2ecf20Sopenharmony_ci 3548c2ecf20Sopenharmony_ci/** 3558c2ecf20Sopenharmony_ci * DRM_IOCTL_INFO_BUFS ioctl argument type. 3568c2ecf20Sopenharmony_ci */ 3578c2ecf20Sopenharmony_cistruct drm_buf_info { 3588c2ecf20Sopenharmony_ci int count; /**< Entries in list */ 3598c2ecf20Sopenharmony_ci struct drm_buf_desc __user *list; 3608c2ecf20Sopenharmony_ci}; 3618c2ecf20Sopenharmony_ci 3628c2ecf20Sopenharmony_ci/** 3638c2ecf20Sopenharmony_ci * DRM_IOCTL_FREE_BUFS ioctl argument type. 3648c2ecf20Sopenharmony_ci */ 3658c2ecf20Sopenharmony_cistruct drm_buf_free { 3668c2ecf20Sopenharmony_ci int count; 3678c2ecf20Sopenharmony_ci int __user *list; 3688c2ecf20Sopenharmony_ci}; 3698c2ecf20Sopenharmony_ci 3708c2ecf20Sopenharmony_ci/** 3718c2ecf20Sopenharmony_ci * Buffer information 3728c2ecf20Sopenharmony_ci * 3738c2ecf20Sopenharmony_ci * \sa drm_buf_map. 3748c2ecf20Sopenharmony_ci */ 3758c2ecf20Sopenharmony_cistruct drm_buf_pub { 3768c2ecf20Sopenharmony_ci int idx; /**< Index into the master buffer list */ 3778c2ecf20Sopenharmony_ci int total; /**< Buffer size */ 3788c2ecf20Sopenharmony_ci int used; /**< Amount of buffer in use (for DMA) */ 3798c2ecf20Sopenharmony_ci void __user *address; /**< Address of buffer */ 3808c2ecf20Sopenharmony_ci}; 3818c2ecf20Sopenharmony_ci 3828c2ecf20Sopenharmony_ci/** 3838c2ecf20Sopenharmony_ci * DRM_IOCTL_MAP_BUFS ioctl argument type. 3848c2ecf20Sopenharmony_ci */ 3858c2ecf20Sopenharmony_cistruct drm_buf_map { 3868c2ecf20Sopenharmony_ci int count; /**< Length of the buffer list */ 3878c2ecf20Sopenharmony_ci#ifdef __cplusplus 3888c2ecf20Sopenharmony_ci void __user *virt; 3898c2ecf20Sopenharmony_ci#else 3908c2ecf20Sopenharmony_ci void __user *virtual; /**< Mmap'd area in user-virtual */ 3918c2ecf20Sopenharmony_ci#endif 3928c2ecf20Sopenharmony_ci struct drm_buf_pub __user *list; /**< Buffer information */ 3938c2ecf20Sopenharmony_ci}; 3948c2ecf20Sopenharmony_ci 3958c2ecf20Sopenharmony_ci/** 3968c2ecf20Sopenharmony_ci * DRM_IOCTL_DMA ioctl argument type. 3978c2ecf20Sopenharmony_ci * 3988c2ecf20Sopenharmony_ci * Indices here refer to the offset into the buffer list in drm_buf_get. 3998c2ecf20Sopenharmony_ci * 4008c2ecf20Sopenharmony_ci * \sa drmDMA(). 4018c2ecf20Sopenharmony_ci */ 4028c2ecf20Sopenharmony_cistruct drm_dma { 4038c2ecf20Sopenharmony_ci int context; /**< Context handle */ 4048c2ecf20Sopenharmony_ci int send_count; /**< Number of buffers to send */ 4058c2ecf20Sopenharmony_ci int __user *send_indices; /**< List of handles to buffers */ 4068c2ecf20Sopenharmony_ci int __user *send_sizes; /**< Lengths of data to send */ 4078c2ecf20Sopenharmony_ci enum drm_dma_flags flags; /**< Flags */ 4088c2ecf20Sopenharmony_ci int request_count; /**< Number of buffers requested */ 4098c2ecf20Sopenharmony_ci int request_size; /**< Desired size for buffers */ 4108c2ecf20Sopenharmony_ci int __user *request_indices; /**< Buffer information */ 4118c2ecf20Sopenharmony_ci int __user *request_sizes; 4128c2ecf20Sopenharmony_ci int granted_count; /**< Number of buffers granted */ 4138c2ecf20Sopenharmony_ci}; 4148c2ecf20Sopenharmony_ci 4158c2ecf20Sopenharmony_cienum drm_ctx_flags { 4168c2ecf20Sopenharmony_ci _DRM_CONTEXT_PRESERVED = 0x01, 4178c2ecf20Sopenharmony_ci _DRM_CONTEXT_2DONLY = 0x02 4188c2ecf20Sopenharmony_ci}; 4198c2ecf20Sopenharmony_ci 4208c2ecf20Sopenharmony_ci/** 4218c2ecf20Sopenharmony_ci * DRM_IOCTL_ADD_CTX ioctl argument type. 4228c2ecf20Sopenharmony_ci * 4238c2ecf20Sopenharmony_ci * \sa drmCreateContext() and drmDestroyContext(). 4248c2ecf20Sopenharmony_ci */ 4258c2ecf20Sopenharmony_cistruct drm_ctx { 4268c2ecf20Sopenharmony_ci drm_context_t handle; 4278c2ecf20Sopenharmony_ci enum drm_ctx_flags flags; 4288c2ecf20Sopenharmony_ci}; 4298c2ecf20Sopenharmony_ci 4308c2ecf20Sopenharmony_ci/** 4318c2ecf20Sopenharmony_ci * DRM_IOCTL_RES_CTX ioctl argument type. 4328c2ecf20Sopenharmony_ci */ 4338c2ecf20Sopenharmony_cistruct drm_ctx_res { 4348c2ecf20Sopenharmony_ci int count; 4358c2ecf20Sopenharmony_ci struct drm_ctx __user *contexts; 4368c2ecf20Sopenharmony_ci}; 4378c2ecf20Sopenharmony_ci 4388c2ecf20Sopenharmony_ci/** 4398c2ecf20Sopenharmony_ci * DRM_IOCTL_ADD_DRAW and DRM_IOCTL_RM_DRAW ioctl argument type. 4408c2ecf20Sopenharmony_ci */ 4418c2ecf20Sopenharmony_cistruct drm_draw { 4428c2ecf20Sopenharmony_ci drm_drawable_t handle; 4438c2ecf20Sopenharmony_ci}; 4448c2ecf20Sopenharmony_ci 4458c2ecf20Sopenharmony_ci/** 4468c2ecf20Sopenharmony_ci * DRM_IOCTL_UPDATE_DRAW ioctl argument type. 4478c2ecf20Sopenharmony_ci */ 4488c2ecf20Sopenharmony_citypedef enum { 4498c2ecf20Sopenharmony_ci DRM_DRAWABLE_CLIPRECTS 4508c2ecf20Sopenharmony_ci} drm_drawable_info_type_t; 4518c2ecf20Sopenharmony_ci 4528c2ecf20Sopenharmony_cistruct drm_update_draw { 4538c2ecf20Sopenharmony_ci drm_drawable_t handle; 4548c2ecf20Sopenharmony_ci unsigned int type; 4558c2ecf20Sopenharmony_ci unsigned int num; 4568c2ecf20Sopenharmony_ci unsigned long long data; 4578c2ecf20Sopenharmony_ci}; 4588c2ecf20Sopenharmony_ci 4598c2ecf20Sopenharmony_ci/** 4608c2ecf20Sopenharmony_ci * DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type. 4618c2ecf20Sopenharmony_ci */ 4628c2ecf20Sopenharmony_cistruct drm_auth { 4638c2ecf20Sopenharmony_ci drm_magic_t magic; 4648c2ecf20Sopenharmony_ci}; 4658c2ecf20Sopenharmony_ci 4668c2ecf20Sopenharmony_ci/** 4678c2ecf20Sopenharmony_ci * DRM_IOCTL_IRQ_BUSID ioctl argument type. 4688c2ecf20Sopenharmony_ci * 4698c2ecf20Sopenharmony_ci * \sa drmGetInterruptFromBusID(). 4708c2ecf20Sopenharmony_ci */ 4718c2ecf20Sopenharmony_cistruct drm_irq_busid { 4728c2ecf20Sopenharmony_ci int irq; /**< IRQ number */ 4738c2ecf20Sopenharmony_ci int busnum; /**< bus number */ 4748c2ecf20Sopenharmony_ci int devnum; /**< device number */ 4758c2ecf20Sopenharmony_ci int funcnum; /**< function number */ 4768c2ecf20Sopenharmony_ci}; 4778c2ecf20Sopenharmony_ci 4788c2ecf20Sopenharmony_cienum drm_vblank_seq_type { 4798c2ecf20Sopenharmony_ci _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ 4808c2ecf20Sopenharmony_ci _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ 4818c2ecf20Sopenharmony_ci /* bits 1-6 are reserved for high crtcs */ 4828c2ecf20Sopenharmony_ci _DRM_VBLANK_HIGH_CRTC_MASK = 0x0000003e, 4838c2ecf20Sopenharmony_ci _DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */ 4848c2ecf20Sopenharmony_ci _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ 4858c2ecf20Sopenharmony_ci _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ 4868c2ecf20Sopenharmony_ci _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ 4878c2ecf20Sopenharmony_ci _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking, unsupported */ 4888c2ecf20Sopenharmony_ci}; 4898c2ecf20Sopenharmony_ci#define _DRM_VBLANK_HIGH_CRTC_SHIFT 1 4908c2ecf20Sopenharmony_ci 4918c2ecf20Sopenharmony_ci#define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) 4928c2ecf20Sopenharmony_ci#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \ 4938c2ecf20Sopenharmony_ci _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS) 4948c2ecf20Sopenharmony_ci 4958c2ecf20Sopenharmony_cistruct drm_wait_vblank_request { 4968c2ecf20Sopenharmony_ci enum drm_vblank_seq_type type; 4978c2ecf20Sopenharmony_ci unsigned int sequence; 4988c2ecf20Sopenharmony_ci unsigned long signal; 4998c2ecf20Sopenharmony_ci}; 5008c2ecf20Sopenharmony_ci 5018c2ecf20Sopenharmony_cistruct drm_wait_vblank_reply { 5028c2ecf20Sopenharmony_ci enum drm_vblank_seq_type type; 5038c2ecf20Sopenharmony_ci unsigned int sequence; 5048c2ecf20Sopenharmony_ci long tval_sec; 5058c2ecf20Sopenharmony_ci long tval_usec; 5068c2ecf20Sopenharmony_ci}; 5078c2ecf20Sopenharmony_ci 5088c2ecf20Sopenharmony_ci/** 5098c2ecf20Sopenharmony_ci * DRM_IOCTL_WAIT_VBLANK ioctl argument type. 5108c2ecf20Sopenharmony_ci * 5118c2ecf20Sopenharmony_ci * \sa drmWaitVBlank(). 5128c2ecf20Sopenharmony_ci */ 5138c2ecf20Sopenharmony_ciunion drm_wait_vblank { 5148c2ecf20Sopenharmony_ci struct drm_wait_vblank_request request; 5158c2ecf20Sopenharmony_ci struct drm_wait_vblank_reply reply; 5168c2ecf20Sopenharmony_ci}; 5178c2ecf20Sopenharmony_ci 5188c2ecf20Sopenharmony_ci#define _DRM_PRE_MODESET 1 5198c2ecf20Sopenharmony_ci#define _DRM_POST_MODESET 2 5208c2ecf20Sopenharmony_ci 5218c2ecf20Sopenharmony_ci/** 5228c2ecf20Sopenharmony_ci * DRM_IOCTL_MODESET_CTL ioctl argument type 5238c2ecf20Sopenharmony_ci * 5248c2ecf20Sopenharmony_ci * \sa drmModesetCtl(). 5258c2ecf20Sopenharmony_ci */ 5268c2ecf20Sopenharmony_cistruct drm_modeset_ctl { 5278c2ecf20Sopenharmony_ci __u32 crtc; 5288c2ecf20Sopenharmony_ci __u32 cmd; 5298c2ecf20Sopenharmony_ci}; 5308c2ecf20Sopenharmony_ci 5318c2ecf20Sopenharmony_ci/** 5328c2ecf20Sopenharmony_ci * DRM_IOCTL_AGP_ENABLE ioctl argument type. 5338c2ecf20Sopenharmony_ci * 5348c2ecf20Sopenharmony_ci * \sa drmAgpEnable(). 5358c2ecf20Sopenharmony_ci */ 5368c2ecf20Sopenharmony_cistruct drm_agp_mode { 5378c2ecf20Sopenharmony_ci unsigned long mode; /**< AGP mode */ 5388c2ecf20Sopenharmony_ci}; 5398c2ecf20Sopenharmony_ci 5408c2ecf20Sopenharmony_ci/** 5418c2ecf20Sopenharmony_ci * DRM_IOCTL_AGP_ALLOC and DRM_IOCTL_AGP_FREE ioctls argument type. 5428c2ecf20Sopenharmony_ci * 5438c2ecf20Sopenharmony_ci * \sa drmAgpAlloc() and drmAgpFree(). 5448c2ecf20Sopenharmony_ci */ 5458c2ecf20Sopenharmony_cistruct drm_agp_buffer { 5468c2ecf20Sopenharmony_ci unsigned long size; /**< In bytes -- will round to page boundary */ 5478c2ecf20Sopenharmony_ci unsigned long handle; /**< Used for binding / unbinding */ 5488c2ecf20Sopenharmony_ci unsigned long type; /**< Type of memory to allocate */ 5498c2ecf20Sopenharmony_ci unsigned long physical; /**< Physical used by i810 */ 5508c2ecf20Sopenharmony_ci}; 5518c2ecf20Sopenharmony_ci 5528c2ecf20Sopenharmony_ci/** 5538c2ecf20Sopenharmony_ci * DRM_IOCTL_AGP_BIND and DRM_IOCTL_AGP_UNBIND ioctls argument type. 5548c2ecf20Sopenharmony_ci * 5558c2ecf20Sopenharmony_ci * \sa drmAgpBind() and drmAgpUnbind(). 5568c2ecf20Sopenharmony_ci */ 5578c2ecf20Sopenharmony_cistruct drm_agp_binding { 5588c2ecf20Sopenharmony_ci unsigned long handle; /**< From drm_agp_buffer */ 5598c2ecf20Sopenharmony_ci unsigned long offset; /**< In bytes -- will round to page boundary */ 5608c2ecf20Sopenharmony_ci}; 5618c2ecf20Sopenharmony_ci 5628c2ecf20Sopenharmony_ci/** 5638c2ecf20Sopenharmony_ci * DRM_IOCTL_AGP_INFO ioctl argument type. 5648c2ecf20Sopenharmony_ci * 5658c2ecf20Sopenharmony_ci * \sa drmAgpVersionMajor(), drmAgpVersionMinor(), drmAgpGetMode(), 5668c2ecf20Sopenharmony_ci * drmAgpBase(), drmAgpSize(), drmAgpMemoryUsed(), drmAgpMemoryAvail(), 5678c2ecf20Sopenharmony_ci * drmAgpVendorId() and drmAgpDeviceId(). 5688c2ecf20Sopenharmony_ci */ 5698c2ecf20Sopenharmony_cistruct drm_agp_info { 5708c2ecf20Sopenharmony_ci int agp_version_major; 5718c2ecf20Sopenharmony_ci int agp_version_minor; 5728c2ecf20Sopenharmony_ci unsigned long mode; 5738c2ecf20Sopenharmony_ci unsigned long aperture_base; /* physical address */ 5748c2ecf20Sopenharmony_ci unsigned long aperture_size; /* bytes */ 5758c2ecf20Sopenharmony_ci unsigned long memory_allowed; /* bytes */ 5768c2ecf20Sopenharmony_ci unsigned long memory_used; 5778c2ecf20Sopenharmony_ci 5788c2ecf20Sopenharmony_ci /* PCI information */ 5798c2ecf20Sopenharmony_ci unsigned short id_vendor; 5808c2ecf20Sopenharmony_ci unsigned short id_device; 5818c2ecf20Sopenharmony_ci}; 5828c2ecf20Sopenharmony_ci 5838c2ecf20Sopenharmony_ci/** 5848c2ecf20Sopenharmony_ci * DRM_IOCTL_SG_ALLOC ioctl argument type. 5858c2ecf20Sopenharmony_ci */ 5868c2ecf20Sopenharmony_cistruct drm_scatter_gather { 5878c2ecf20Sopenharmony_ci unsigned long size; /**< In bytes -- will round to page boundary */ 5888c2ecf20Sopenharmony_ci unsigned long handle; /**< Used for mapping / unmapping */ 5898c2ecf20Sopenharmony_ci}; 5908c2ecf20Sopenharmony_ci 5918c2ecf20Sopenharmony_ci/** 5928c2ecf20Sopenharmony_ci * DRM_IOCTL_SET_VERSION ioctl argument type. 5938c2ecf20Sopenharmony_ci */ 5948c2ecf20Sopenharmony_cistruct drm_set_version { 5958c2ecf20Sopenharmony_ci int drm_di_major; 5968c2ecf20Sopenharmony_ci int drm_di_minor; 5978c2ecf20Sopenharmony_ci int drm_dd_major; 5988c2ecf20Sopenharmony_ci int drm_dd_minor; 5998c2ecf20Sopenharmony_ci}; 6008c2ecf20Sopenharmony_ci 6018c2ecf20Sopenharmony_ci/** DRM_IOCTL_GEM_CLOSE ioctl argument type */ 6028c2ecf20Sopenharmony_cistruct drm_gem_close { 6038c2ecf20Sopenharmony_ci /** Handle of the object to be closed. */ 6048c2ecf20Sopenharmony_ci __u32 handle; 6058c2ecf20Sopenharmony_ci __u32 pad; 6068c2ecf20Sopenharmony_ci}; 6078c2ecf20Sopenharmony_ci 6088c2ecf20Sopenharmony_ci/** DRM_IOCTL_GEM_FLINK ioctl argument type */ 6098c2ecf20Sopenharmony_cistruct drm_gem_flink { 6108c2ecf20Sopenharmony_ci /** Handle for the object being named */ 6118c2ecf20Sopenharmony_ci __u32 handle; 6128c2ecf20Sopenharmony_ci 6138c2ecf20Sopenharmony_ci /** Returned global name */ 6148c2ecf20Sopenharmony_ci __u32 name; 6158c2ecf20Sopenharmony_ci}; 6168c2ecf20Sopenharmony_ci 6178c2ecf20Sopenharmony_ci/** DRM_IOCTL_GEM_OPEN ioctl argument type */ 6188c2ecf20Sopenharmony_cistruct drm_gem_open { 6198c2ecf20Sopenharmony_ci /** Name of object being opened */ 6208c2ecf20Sopenharmony_ci __u32 name; 6218c2ecf20Sopenharmony_ci 6228c2ecf20Sopenharmony_ci /** Returned handle for the object */ 6238c2ecf20Sopenharmony_ci __u32 handle; 6248c2ecf20Sopenharmony_ci 6258c2ecf20Sopenharmony_ci /** Returned size of the object */ 6268c2ecf20Sopenharmony_ci __u64 size; 6278c2ecf20Sopenharmony_ci}; 6288c2ecf20Sopenharmony_ci 6298c2ecf20Sopenharmony_ci#define DRM_CAP_DUMB_BUFFER 0x1 6308c2ecf20Sopenharmony_ci#define DRM_CAP_VBLANK_HIGH_CRTC 0x2 6318c2ecf20Sopenharmony_ci#define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3 6328c2ecf20Sopenharmony_ci#define DRM_CAP_DUMB_PREFER_SHADOW 0x4 6338c2ecf20Sopenharmony_ci#define DRM_CAP_PRIME 0x5 6348c2ecf20Sopenharmony_ci#define DRM_PRIME_CAP_IMPORT 0x1 6358c2ecf20Sopenharmony_ci#define DRM_PRIME_CAP_EXPORT 0x2 6368c2ecf20Sopenharmony_ci#define DRM_CAP_TIMESTAMP_MONOTONIC 0x6 6378c2ecf20Sopenharmony_ci#define DRM_CAP_ASYNC_PAGE_FLIP 0x7 6388c2ecf20Sopenharmony_ci/* 6398c2ecf20Sopenharmony_ci * The CURSOR_WIDTH and CURSOR_HEIGHT capabilities return a valid widthxheight 6408c2ecf20Sopenharmony_ci * combination for the hardware cursor. The intention is that a hardware 6418c2ecf20Sopenharmony_ci * agnostic userspace can query a cursor plane size to use. 6428c2ecf20Sopenharmony_ci * 6438c2ecf20Sopenharmony_ci * Note that the cross-driver contract is to merely return a valid size; 6448c2ecf20Sopenharmony_ci * drivers are free to attach another meaning on top, eg. i915 returns the 6458c2ecf20Sopenharmony_ci * maximum plane size. 6468c2ecf20Sopenharmony_ci */ 6478c2ecf20Sopenharmony_ci#define DRM_CAP_CURSOR_WIDTH 0x8 6488c2ecf20Sopenharmony_ci#define DRM_CAP_CURSOR_HEIGHT 0x9 6498c2ecf20Sopenharmony_ci#define DRM_CAP_ADDFB2_MODIFIERS 0x10 6508c2ecf20Sopenharmony_ci#define DRM_CAP_PAGE_FLIP_TARGET 0x11 6518c2ecf20Sopenharmony_ci#define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12 6528c2ecf20Sopenharmony_ci#define DRM_CAP_SYNCOBJ 0x13 6538c2ecf20Sopenharmony_ci#define DRM_CAP_SYNCOBJ_TIMELINE 0x14 6548c2ecf20Sopenharmony_ci 6558c2ecf20Sopenharmony_ci/** DRM_IOCTL_GET_CAP ioctl argument type */ 6568c2ecf20Sopenharmony_cistruct drm_get_cap { 6578c2ecf20Sopenharmony_ci __u64 capability; 6588c2ecf20Sopenharmony_ci __u64 value; 6598c2ecf20Sopenharmony_ci}; 6608c2ecf20Sopenharmony_ci 6618c2ecf20Sopenharmony_ci/** 6628c2ecf20Sopenharmony_ci * DRM_CLIENT_CAP_STEREO_3D 6638c2ecf20Sopenharmony_ci * 6648c2ecf20Sopenharmony_ci * if set to 1, the DRM core will expose the stereo 3D capabilities of the 6658c2ecf20Sopenharmony_ci * monitor by advertising the supported 3D layouts in the flags of struct 6668c2ecf20Sopenharmony_ci * drm_mode_modeinfo. 6678c2ecf20Sopenharmony_ci */ 6688c2ecf20Sopenharmony_ci#define DRM_CLIENT_CAP_STEREO_3D 1 6698c2ecf20Sopenharmony_ci 6708c2ecf20Sopenharmony_ci/** 6718c2ecf20Sopenharmony_ci * DRM_CLIENT_CAP_UNIVERSAL_PLANES 6728c2ecf20Sopenharmony_ci * 6738c2ecf20Sopenharmony_ci * If set to 1, the DRM core will expose all planes (overlay, primary, and 6748c2ecf20Sopenharmony_ci * cursor) to userspace. 6758c2ecf20Sopenharmony_ci */ 6768c2ecf20Sopenharmony_ci#define DRM_CLIENT_CAP_UNIVERSAL_PLANES 2 6778c2ecf20Sopenharmony_ci 6788c2ecf20Sopenharmony_ci/** 6798c2ecf20Sopenharmony_ci * DRM_CLIENT_CAP_ATOMIC 6808c2ecf20Sopenharmony_ci * 6818c2ecf20Sopenharmony_ci * If set to 1, the DRM core will expose atomic properties to userspace 6828c2ecf20Sopenharmony_ci */ 6838c2ecf20Sopenharmony_ci#define DRM_CLIENT_CAP_ATOMIC 3 6848c2ecf20Sopenharmony_ci 6858c2ecf20Sopenharmony_ci/** 6868c2ecf20Sopenharmony_ci * DRM_CLIENT_CAP_ASPECT_RATIO 6878c2ecf20Sopenharmony_ci * 6888c2ecf20Sopenharmony_ci * If set to 1, the DRM core will provide aspect ratio information in modes. 6898c2ecf20Sopenharmony_ci */ 6908c2ecf20Sopenharmony_ci#define DRM_CLIENT_CAP_ASPECT_RATIO 4 6918c2ecf20Sopenharmony_ci 6928c2ecf20Sopenharmony_ci/** 6938c2ecf20Sopenharmony_ci * DRM_CLIENT_CAP_WRITEBACK_CONNECTORS 6948c2ecf20Sopenharmony_ci * 6958c2ecf20Sopenharmony_ci * If set to 1, the DRM core will expose special connectors to be used for 6968c2ecf20Sopenharmony_ci * writing back to memory the scene setup in the commit. Depends on client 6978c2ecf20Sopenharmony_ci * also supporting DRM_CLIENT_CAP_ATOMIC 6988c2ecf20Sopenharmony_ci */ 6998c2ecf20Sopenharmony_ci#define DRM_CLIENT_CAP_WRITEBACK_CONNECTORS 5 7008c2ecf20Sopenharmony_ci 7018c2ecf20Sopenharmony_ci/** DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */ 7028c2ecf20Sopenharmony_cistruct drm_set_client_cap { 7038c2ecf20Sopenharmony_ci __u64 capability; 7048c2ecf20Sopenharmony_ci __u64 value; 7058c2ecf20Sopenharmony_ci}; 7068c2ecf20Sopenharmony_ci 7078c2ecf20Sopenharmony_ci#define DRM_RDWR O_RDWR 7088c2ecf20Sopenharmony_ci#define DRM_CLOEXEC O_CLOEXEC 7098c2ecf20Sopenharmony_cistruct drm_prime_handle { 7108c2ecf20Sopenharmony_ci __u32 handle; 7118c2ecf20Sopenharmony_ci 7128c2ecf20Sopenharmony_ci /** Flags.. only applicable for handle->fd */ 7138c2ecf20Sopenharmony_ci __u32 flags; 7148c2ecf20Sopenharmony_ci 7158c2ecf20Sopenharmony_ci /** Returned dmabuf file descriptor */ 7168c2ecf20Sopenharmony_ci __s32 fd; 7178c2ecf20Sopenharmony_ci}; 7188c2ecf20Sopenharmony_ci 7198c2ecf20Sopenharmony_cistruct drm_syncobj_create { 7208c2ecf20Sopenharmony_ci __u32 handle; 7218c2ecf20Sopenharmony_ci#define DRM_SYNCOBJ_CREATE_SIGNALED (1 << 0) 7228c2ecf20Sopenharmony_ci __u32 flags; 7238c2ecf20Sopenharmony_ci}; 7248c2ecf20Sopenharmony_ci 7258c2ecf20Sopenharmony_cistruct drm_syncobj_destroy { 7268c2ecf20Sopenharmony_ci __u32 handle; 7278c2ecf20Sopenharmony_ci __u32 pad; 7288c2ecf20Sopenharmony_ci}; 7298c2ecf20Sopenharmony_ci 7308c2ecf20Sopenharmony_ci#define DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE (1 << 0) 7318c2ecf20Sopenharmony_ci#define DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE (1 << 0) 7328c2ecf20Sopenharmony_cistruct drm_syncobj_handle { 7338c2ecf20Sopenharmony_ci __u32 handle; 7348c2ecf20Sopenharmony_ci __u32 flags; 7358c2ecf20Sopenharmony_ci 7368c2ecf20Sopenharmony_ci __s32 fd; 7378c2ecf20Sopenharmony_ci __u32 pad; 7388c2ecf20Sopenharmony_ci}; 7398c2ecf20Sopenharmony_ci 7408c2ecf20Sopenharmony_cistruct drm_syncobj_transfer { 7418c2ecf20Sopenharmony_ci __u32 src_handle; 7428c2ecf20Sopenharmony_ci __u32 dst_handle; 7438c2ecf20Sopenharmony_ci __u64 src_point; 7448c2ecf20Sopenharmony_ci __u64 dst_point; 7458c2ecf20Sopenharmony_ci __u32 flags; 7468c2ecf20Sopenharmony_ci __u32 pad; 7478c2ecf20Sopenharmony_ci}; 7488c2ecf20Sopenharmony_ci 7498c2ecf20Sopenharmony_ci#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0) 7508c2ecf20Sopenharmony_ci#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1) 7518c2ecf20Sopenharmony_ci#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2) /* wait for time point to become available */ 7528c2ecf20Sopenharmony_cistruct drm_syncobj_wait { 7538c2ecf20Sopenharmony_ci __u64 handles; 7548c2ecf20Sopenharmony_ci /* absolute timeout */ 7558c2ecf20Sopenharmony_ci __s64 timeout_nsec; 7568c2ecf20Sopenharmony_ci __u32 count_handles; 7578c2ecf20Sopenharmony_ci __u32 flags; 7588c2ecf20Sopenharmony_ci __u32 first_signaled; /* only valid when not waiting all */ 7598c2ecf20Sopenharmony_ci __u32 pad; 7608c2ecf20Sopenharmony_ci}; 7618c2ecf20Sopenharmony_ci 7628c2ecf20Sopenharmony_cistruct drm_syncobj_timeline_wait { 7638c2ecf20Sopenharmony_ci __u64 handles; 7648c2ecf20Sopenharmony_ci /* wait on specific timeline point for every handles*/ 7658c2ecf20Sopenharmony_ci __u64 points; 7668c2ecf20Sopenharmony_ci /* absolute timeout */ 7678c2ecf20Sopenharmony_ci __s64 timeout_nsec; 7688c2ecf20Sopenharmony_ci __u32 count_handles; 7698c2ecf20Sopenharmony_ci __u32 flags; 7708c2ecf20Sopenharmony_ci __u32 first_signaled; /* only valid when not waiting all */ 7718c2ecf20Sopenharmony_ci __u32 pad; 7728c2ecf20Sopenharmony_ci}; 7738c2ecf20Sopenharmony_ci 7748c2ecf20Sopenharmony_ci 7758c2ecf20Sopenharmony_cistruct drm_syncobj_array { 7768c2ecf20Sopenharmony_ci __u64 handles; 7778c2ecf20Sopenharmony_ci __u32 count_handles; 7788c2ecf20Sopenharmony_ci __u32 pad; 7798c2ecf20Sopenharmony_ci}; 7808c2ecf20Sopenharmony_ci 7818c2ecf20Sopenharmony_ci#define DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED (1 << 0) /* last available point on timeline syncobj */ 7828c2ecf20Sopenharmony_cistruct drm_syncobj_timeline_array { 7838c2ecf20Sopenharmony_ci __u64 handles; 7848c2ecf20Sopenharmony_ci __u64 points; 7858c2ecf20Sopenharmony_ci __u32 count_handles; 7868c2ecf20Sopenharmony_ci __u32 flags; 7878c2ecf20Sopenharmony_ci}; 7888c2ecf20Sopenharmony_ci 7898c2ecf20Sopenharmony_ci 7908c2ecf20Sopenharmony_ci/* Query current scanout sequence number */ 7918c2ecf20Sopenharmony_cistruct drm_crtc_get_sequence { 7928c2ecf20Sopenharmony_ci __u32 crtc_id; /* requested crtc_id */ 7938c2ecf20Sopenharmony_ci __u32 active; /* return: crtc output is active */ 7948c2ecf20Sopenharmony_ci __u64 sequence; /* return: most recent vblank sequence */ 7958c2ecf20Sopenharmony_ci __s64 sequence_ns; /* return: most recent time of first pixel out */ 7968c2ecf20Sopenharmony_ci}; 7978c2ecf20Sopenharmony_ci 7988c2ecf20Sopenharmony_ci/* Queue event to be delivered at specified sequence. Time stamp marks 7998c2ecf20Sopenharmony_ci * when the first pixel of the refresh cycle leaves the display engine 8008c2ecf20Sopenharmony_ci * for the display 8018c2ecf20Sopenharmony_ci */ 8028c2ecf20Sopenharmony_ci#define DRM_CRTC_SEQUENCE_RELATIVE 0x00000001 /* sequence is relative to current */ 8038c2ecf20Sopenharmony_ci#define DRM_CRTC_SEQUENCE_NEXT_ON_MISS 0x00000002 /* Use next sequence if we've missed */ 8048c2ecf20Sopenharmony_ci 8058c2ecf20Sopenharmony_cistruct drm_crtc_queue_sequence { 8068c2ecf20Sopenharmony_ci __u32 crtc_id; 8078c2ecf20Sopenharmony_ci __u32 flags; 8088c2ecf20Sopenharmony_ci __u64 sequence; /* on input, target sequence. on output, actual sequence */ 8098c2ecf20Sopenharmony_ci __u64 user_data; /* user data passed to event */ 8108c2ecf20Sopenharmony_ci}; 8118c2ecf20Sopenharmony_ci 8128c2ecf20Sopenharmony_ci#if defined(__cplusplus) 8138c2ecf20Sopenharmony_ci} 8148c2ecf20Sopenharmony_ci#endif 8158c2ecf20Sopenharmony_ci 8168c2ecf20Sopenharmony_ci#include "drm_mode.h" 8178c2ecf20Sopenharmony_ci 8188c2ecf20Sopenharmony_ci#if defined(__cplusplus) 8198c2ecf20Sopenharmony_ciextern "C" { 8208c2ecf20Sopenharmony_ci#endif 8218c2ecf20Sopenharmony_ci 8228c2ecf20Sopenharmony_ci#define DRM_IOCTL_BASE 'd' 8238c2ecf20Sopenharmony_ci#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) 8248c2ecf20Sopenharmony_ci#define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type) 8258c2ecf20Sopenharmony_ci#define DRM_IOW(nr,type) _IOW(DRM_IOCTL_BASE,nr,type) 8268c2ecf20Sopenharmony_ci#define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type) 8278c2ecf20Sopenharmony_ci 8288c2ecf20Sopenharmony_ci#define DRM_IOCTL_VERSION DRM_IOWR(0x00, struct drm_version) 8298c2ecf20Sopenharmony_ci#define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, struct drm_unique) 8308c2ecf20Sopenharmony_ci#define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, struct drm_auth) 8318c2ecf20Sopenharmony_ci#define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, struct drm_irq_busid) 8328c2ecf20Sopenharmony_ci#define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, struct drm_map) 8338c2ecf20Sopenharmony_ci#define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client) 8348c2ecf20Sopenharmony_ci#define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats) 8358c2ecf20Sopenharmony_ci#define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version) 8368c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODESET_CTL DRM_IOW(0x08, struct drm_modeset_ctl) 8378c2ecf20Sopenharmony_ci#define DRM_IOCTL_GEM_CLOSE DRM_IOW (0x09, struct drm_gem_close) 8388c2ecf20Sopenharmony_ci#define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink) 8398c2ecf20Sopenharmony_ci#define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open) 8408c2ecf20Sopenharmony_ci#define DRM_IOCTL_GET_CAP DRM_IOWR(0x0c, struct drm_get_cap) 8418c2ecf20Sopenharmony_ci#define DRM_IOCTL_SET_CLIENT_CAP DRM_IOW( 0x0d, struct drm_set_client_cap) 8428c2ecf20Sopenharmony_ci 8438c2ecf20Sopenharmony_ci#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique) 8448c2ecf20Sopenharmony_ci#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth) 8458c2ecf20Sopenharmony_ci#define DRM_IOCTL_BLOCK DRM_IOWR(0x12, struct drm_block) 8468c2ecf20Sopenharmony_ci#define DRM_IOCTL_UNBLOCK DRM_IOWR(0x13, struct drm_block) 8478c2ecf20Sopenharmony_ci#define DRM_IOCTL_CONTROL DRM_IOW( 0x14, struct drm_control) 8488c2ecf20Sopenharmony_ci#define DRM_IOCTL_ADD_MAP DRM_IOWR(0x15, struct drm_map) 8498c2ecf20Sopenharmony_ci#define DRM_IOCTL_ADD_BUFS DRM_IOWR(0x16, struct drm_buf_desc) 8508c2ecf20Sopenharmony_ci#define DRM_IOCTL_MARK_BUFS DRM_IOW( 0x17, struct drm_buf_desc) 8518c2ecf20Sopenharmony_ci#define DRM_IOCTL_INFO_BUFS DRM_IOWR(0x18, struct drm_buf_info) 8528c2ecf20Sopenharmony_ci#define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, struct drm_buf_map) 8538c2ecf20Sopenharmony_ci#define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, struct drm_buf_free) 8548c2ecf20Sopenharmony_ci 8558c2ecf20Sopenharmony_ci#define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, struct drm_map) 8568c2ecf20Sopenharmony_ci 8578c2ecf20Sopenharmony_ci#define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, struct drm_ctx_priv_map) 8588c2ecf20Sopenharmony_ci#define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, struct drm_ctx_priv_map) 8598c2ecf20Sopenharmony_ci 8608c2ecf20Sopenharmony_ci#define DRM_IOCTL_SET_MASTER DRM_IO(0x1e) 8618c2ecf20Sopenharmony_ci#define DRM_IOCTL_DROP_MASTER DRM_IO(0x1f) 8628c2ecf20Sopenharmony_ci 8638c2ecf20Sopenharmony_ci#define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, struct drm_ctx) 8648c2ecf20Sopenharmony_ci#define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, struct drm_ctx) 8658c2ecf20Sopenharmony_ci#define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, struct drm_ctx) 8668c2ecf20Sopenharmony_ci#define DRM_IOCTL_GET_CTX DRM_IOWR(0x23, struct drm_ctx) 8678c2ecf20Sopenharmony_ci#define DRM_IOCTL_SWITCH_CTX DRM_IOW( 0x24, struct drm_ctx) 8688c2ecf20Sopenharmony_ci#define DRM_IOCTL_NEW_CTX DRM_IOW( 0x25, struct drm_ctx) 8698c2ecf20Sopenharmony_ci#define DRM_IOCTL_RES_CTX DRM_IOWR(0x26, struct drm_ctx_res) 8708c2ecf20Sopenharmony_ci#define DRM_IOCTL_ADD_DRAW DRM_IOWR(0x27, struct drm_draw) 8718c2ecf20Sopenharmony_ci#define DRM_IOCTL_RM_DRAW DRM_IOWR(0x28, struct drm_draw) 8728c2ecf20Sopenharmony_ci#define DRM_IOCTL_DMA DRM_IOWR(0x29, struct drm_dma) 8738c2ecf20Sopenharmony_ci#define DRM_IOCTL_LOCK DRM_IOW( 0x2a, struct drm_lock) 8748c2ecf20Sopenharmony_ci#define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock) 8758c2ecf20Sopenharmony_ci#define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock) 8768c2ecf20Sopenharmony_ci 8778c2ecf20Sopenharmony_ci#define DRM_IOCTL_PRIME_HANDLE_TO_FD DRM_IOWR(0x2d, struct drm_prime_handle) 8788c2ecf20Sopenharmony_ci#define DRM_IOCTL_PRIME_FD_TO_HANDLE DRM_IOWR(0x2e, struct drm_prime_handle) 8798c2ecf20Sopenharmony_ci 8808c2ecf20Sopenharmony_ci#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) 8818c2ecf20Sopenharmony_ci#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) 8828c2ecf20Sopenharmony_ci#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, struct drm_agp_mode) 8838c2ecf20Sopenharmony_ci#define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, struct drm_agp_info) 8848c2ecf20Sopenharmony_ci#define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, struct drm_agp_buffer) 8858c2ecf20Sopenharmony_ci#define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, struct drm_agp_buffer) 8868c2ecf20Sopenharmony_ci#define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, struct drm_agp_binding) 8878c2ecf20Sopenharmony_ci#define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, struct drm_agp_binding) 8888c2ecf20Sopenharmony_ci 8898c2ecf20Sopenharmony_ci#define DRM_IOCTL_SG_ALLOC DRM_IOWR(0x38, struct drm_scatter_gather) 8908c2ecf20Sopenharmony_ci#define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, struct drm_scatter_gather) 8918c2ecf20Sopenharmony_ci 8928c2ecf20Sopenharmony_ci#define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, union drm_wait_vblank) 8938c2ecf20Sopenharmony_ci 8948c2ecf20Sopenharmony_ci#define DRM_IOCTL_CRTC_GET_SEQUENCE DRM_IOWR(0x3b, struct drm_crtc_get_sequence) 8958c2ecf20Sopenharmony_ci#define DRM_IOCTL_CRTC_QUEUE_SEQUENCE DRM_IOWR(0x3c, struct drm_crtc_queue_sequence) 8968c2ecf20Sopenharmony_ci 8978c2ecf20Sopenharmony_ci#define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, struct drm_update_draw) 8988c2ecf20Sopenharmony_ci 8998c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_GETRESOURCES DRM_IOWR(0xA0, struct drm_mode_card_res) 9008c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_GETCRTC DRM_IOWR(0xA1, struct drm_mode_crtc) 9018c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_SETCRTC DRM_IOWR(0xA2, struct drm_mode_crtc) 9028c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_CURSOR DRM_IOWR(0xA3, struct drm_mode_cursor) 9038c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_GETGAMMA DRM_IOWR(0xA4, struct drm_mode_crtc_lut) 9048c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_SETGAMMA DRM_IOWR(0xA5, struct drm_mode_crtc_lut) 9058c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xA6, struct drm_mode_get_encoder) 9068c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_GETCONNECTOR DRM_IOWR(0xA7, struct drm_mode_get_connector) 9078c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA8, struct drm_mode_mode_cmd) /* deprecated (never worked) */ 9088c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd) /* deprecated (never worked) */ 9098c2ecf20Sopenharmony_ci 9108c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_GETPROPERTY DRM_IOWR(0xAA, struct drm_mode_get_property) 9118c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_SETPROPERTY DRM_IOWR(0xAB, struct drm_mode_connector_set_property) 9128c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xAC, struct drm_mode_get_blob) 9138c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd) 9148c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) 9158c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int) 9168c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip) 9178c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd) 9188c2ecf20Sopenharmony_ci 9198c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb) 9208c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb) 9218c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb) 9228c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xB5, struct drm_mode_get_plane_res) 9238c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_GETPLANE DRM_IOWR(0xB6, struct drm_mode_get_plane) 9248c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct drm_mode_set_plane) 9258c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2) 9268c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties) 9278c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property) 9288c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_CURSOR2 DRM_IOWR(0xBB, struct drm_mode_cursor2) 9298c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_ATOMIC DRM_IOWR(0xBC, struct drm_mode_atomic) 9308c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_CREATEPROPBLOB DRM_IOWR(0xBD, struct drm_mode_create_blob) 9318c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_DESTROYPROPBLOB DRM_IOWR(0xBE, struct drm_mode_destroy_blob) 9328c2ecf20Sopenharmony_ci 9338c2ecf20Sopenharmony_ci#define DRM_IOCTL_SYNCOBJ_CREATE DRM_IOWR(0xBF, struct drm_syncobj_create) 9348c2ecf20Sopenharmony_ci#define DRM_IOCTL_SYNCOBJ_DESTROY DRM_IOWR(0xC0, struct drm_syncobj_destroy) 9358c2ecf20Sopenharmony_ci#define DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD DRM_IOWR(0xC1, struct drm_syncobj_handle) 9368c2ecf20Sopenharmony_ci#define DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE DRM_IOWR(0xC2, struct drm_syncobj_handle) 9378c2ecf20Sopenharmony_ci#define DRM_IOCTL_SYNCOBJ_WAIT DRM_IOWR(0xC3, struct drm_syncobj_wait) 9388c2ecf20Sopenharmony_ci#define DRM_IOCTL_SYNCOBJ_RESET DRM_IOWR(0xC4, struct drm_syncobj_array) 9398c2ecf20Sopenharmony_ci#define DRM_IOCTL_SYNCOBJ_SIGNAL DRM_IOWR(0xC5, struct drm_syncobj_array) 9408c2ecf20Sopenharmony_ci 9418c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_CREATE_LEASE DRM_IOWR(0xC6, struct drm_mode_create_lease) 9428c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_LIST_LESSEES DRM_IOWR(0xC7, struct drm_mode_list_lessees) 9438c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_GET_LEASE DRM_IOWR(0xC8, struct drm_mode_get_lease) 9448c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease) 9458c2ecf20Sopenharmony_ci 9468c2ecf20Sopenharmony_ci#define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait) 9478c2ecf20Sopenharmony_ci#define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, struct drm_syncobj_timeline_array) 9488c2ecf20Sopenharmony_ci#define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer) 9498c2ecf20Sopenharmony_ci#define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL DRM_IOWR(0xCD, struct drm_syncobj_timeline_array) 9508c2ecf20Sopenharmony_ci 9518c2ecf20Sopenharmony_ci#define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE, struct drm_mode_fb_cmd2) 9528c2ecf20Sopenharmony_ci 9538c2ecf20Sopenharmony_ci/** 9548c2ecf20Sopenharmony_ci * Device specific ioctls should only be in their respective headers 9558c2ecf20Sopenharmony_ci * The device specific ioctl range is from 0x40 to 0x9f. 9568c2ecf20Sopenharmony_ci * Generic IOCTLS restart at 0xA0. 9578c2ecf20Sopenharmony_ci * 9588c2ecf20Sopenharmony_ci * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and 9598c2ecf20Sopenharmony_ci * drmCommandReadWrite(). 9608c2ecf20Sopenharmony_ci */ 9618c2ecf20Sopenharmony_ci#define DRM_COMMAND_BASE 0x40 9628c2ecf20Sopenharmony_ci#define DRM_COMMAND_END 0xA0 9638c2ecf20Sopenharmony_ci 9648c2ecf20Sopenharmony_ci/** 9658c2ecf20Sopenharmony_ci * Header for events written back to userspace on the drm fd. The 9668c2ecf20Sopenharmony_ci * type defines the type of event, the length specifies the total 9678c2ecf20Sopenharmony_ci * length of the event (including the header), and user_data is 9688c2ecf20Sopenharmony_ci * typically a 64 bit value passed with the ioctl that triggered the 9698c2ecf20Sopenharmony_ci * event. A read on the drm fd will always only return complete 9708c2ecf20Sopenharmony_ci * events, that is, if for example the read buffer is 100 bytes, and 9718c2ecf20Sopenharmony_ci * there are two 64 byte events pending, only one will be returned. 9728c2ecf20Sopenharmony_ci * 9738c2ecf20Sopenharmony_ci * Event types 0 - 0x7fffffff are generic drm events, 0x80000000 and 9748c2ecf20Sopenharmony_ci * up are chipset specific. 9758c2ecf20Sopenharmony_ci */ 9768c2ecf20Sopenharmony_cistruct drm_event { 9778c2ecf20Sopenharmony_ci __u32 type; 9788c2ecf20Sopenharmony_ci __u32 length; 9798c2ecf20Sopenharmony_ci}; 9808c2ecf20Sopenharmony_ci 9818c2ecf20Sopenharmony_ci#define DRM_EVENT_VBLANK 0x01 9828c2ecf20Sopenharmony_ci#define DRM_EVENT_FLIP_COMPLETE 0x02 9838c2ecf20Sopenharmony_ci#define DRM_EVENT_CRTC_SEQUENCE 0x03 9848c2ecf20Sopenharmony_ci 9858c2ecf20Sopenharmony_cistruct drm_event_vblank { 9868c2ecf20Sopenharmony_ci struct drm_event base; 9878c2ecf20Sopenharmony_ci __u64 user_data; 9888c2ecf20Sopenharmony_ci __u32 tv_sec; 9898c2ecf20Sopenharmony_ci __u32 tv_usec; 9908c2ecf20Sopenharmony_ci __u32 sequence; 9918c2ecf20Sopenharmony_ci __u32 crtc_id; /* 0 on older kernels that do not support this */ 9928c2ecf20Sopenharmony_ci}; 9938c2ecf20Sopenharmony_ci 9948c2ecf20Sopenharmony_ci/* Event delivered at sequence. Time stamp marks when the first pixel 9958c2ecf20Sopenharmony_ci * of the refresh cycle leaves the display engine for the display 9968c2ecf20Sopenharmony_ci */ 9978c2ecf20Sopenharmony_cistruct drm_event_crtc_sequence { 9988c2ecf20Sopenharmony_ci struct drm_event base; 9998c2ecf20Sopenharmony_ci __u64 user_data; 10008c2ecf20Sopenharmony_ci __s64 time_ns; 10018c2ecf20Sopenharmony_ci __u64 sequence; 10028c2ecf20Sopenharmony_ci}; 10038c2ecf20Sopenharmony_ci 10048c2ecf20Sopenharmony_ci/* typedef area */ 10058c2ecf20Sopenharmony_ci#ifndef __KERNEL__ 10068c2ecf20Sopenharmony_citypedef struct drm_clip_rect drm_clip_rect_t; 10078c2ecf20Sopenharmony_citypedef struct drm_drawable_info drm_drawable_info_t; 10088c2ecf20Sopenharmony_citypedef struct drm_tex_region drm_tex_region_t; 10098c2ecf20Sopenharmony_citypedef struct drm_hw_lock drm_hw_lock_t; 10108c2ecf20Sopenharmony_citypedef struct drm_version drm_version_t; 10118c2ecf20Sopenharmony_citypedef struct drm_unique drm_unique_t; 10128c2ecf20Sopenharmony_citypedef struct drm_list drm_list_t; 10138c2ecf20Sopenharmony_citypedef struct drm_block drm_block_t; 10148c2ecf20Sopenharmony_citypedef struct drm_control drm_control_t; 10158c2ecf20Sopenharmony_citypedef enum drm_map_type drm_map_type_t; 10168c2ecf20Sopenharmony_citypedef enum drm_map_flags drm_map_flags_t; 10178c2ecf20Sopenharmony_citypedef struct drm_ctx_priv_map drm_ctx_priv_map_t; 10188c2ecf20Sopenharmony_citypedef struct drm_map drm_map_t; 10198c2ecf20Sopenharmony_citypedef struct drm_client drm_client_t; 10208c2ecf20Sopenharmony_citypedef enum drm_stat_type drm_stat_type_t; 10218c2ecf20Sopenharmony_citypedef struct drm_stats drm_stats_t; 10228c2ecf20Sopenharmony_citypedef enum drm_lock_flags drm_lock_flags_t; 10238c2ecf20Sopenharmony_citypedef struct drm_lock drm_lock_t; 10248c2ecf20Sopenharmony_citypedef enum drm_dma_flags drm_dma_flags_t; 10258c2ecf20Sopenharmony_citypedef struct drm_buf_desc drm_buf_desc_t; 10268c2ecf20Sopenharmony_citypedef struct drm_buf_info drm_buf_info_t; 10278c2ecf20Sopenharmony_citypedef struct drm_buf_free drm_buf_free_t; 10288c2ecf20Sopenharmony_citypedef struct drm_buf_pub drm_buf_pub_t; 10298c2ecf20Sopenharmony_citypedef struct drm_buf_map drm_buf_map_t; 10308c2ecf20Sopenharmony_citypedef struct drm_dma drm_dma_t; 10318c2ecf20Sopenharmony_citypedef union drm_wait_vblank drm_wait_vblank_t; 10328c2ecf20Sopenharmony_citypedef struct drm_agp_mode drm_agp_mode_t; 10338c2ecf20Sopenharmony_citypedef enum drm_ctx_flags drm_ctx_flags_t; 10348c2ecf20Sopenharmony_citypedef struct drm_ctx drm_ctx_t; 10358c2ecf20Sopenharmony_citypedef struct drm_ctx_res drm_ctx_res_t; 10368c2ecf20Sopenharmony_citypedef struct drm_draw drm_draw_t; 10378c2ecf20Sopenharmony_citypedef struct drm_update_draw drm_update_draw_t; 10388c2ecf20Sopenharmony_citypedef struct drm_auth drm_auth_t; 10398c2ecf20Sopenharmony_citypedef struct drm_irq_busid drm_irq_busid_t; 10408c2ecf20Sopenharmony_citypedef enum drm_vblank_seq_type drm_vblank_seq_type_t; 10418c2ecf20Sopenharmony_ci 10428c2ecf20Sopenharmony_citypedef struct drm_agp_buffer drm_agp_buffer_t; 10438c2ecf20Sopenharmony_citypedef struct drm_agp_binding drm_agp_binding_t; 10448c2ecf20Sopenharmony_citypedef struct drm_agp_info drm_agp_info_t; 10458c2ecf20Sopenharmony_citypedef struct drm_scatter_gather drm_scatter_gather_t; 10468c2ecf20Sopenharmony_citypedef struct drm_set_version drm_set_version_t; 10478c2ecf20Sopenharmony_ci#endif 10488c2ecf20Sopenharmony_ci 10498c2ecf20Sopenharmony_ci#if defined(__cplusplus) 10508c2ecf20Sopenharmony_ci} 10518c2ecf20Sopenharmony_ci#endif 10528c2ecf20Sopenharmony_ci 10538c2ecf20Sopenharmony_ci#endif 1054