1b8e80941Smrg/** 2b8e80941Smrg * \file drm.h 3b8e80941Smrg * Header for the Direct Rendering Manager 4b8e80941Smrg * 5b8e80941Smrg * \author Rickard E. (Rik) Faith <faith@valinux.com> 6b8e80941Smrg * 7b8e80941Smrg * \par Acknowledgments: 8b8e80941Smrg * Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic \c cmpxchg. 9b8e80941Smrg */ 10b8e80941Smrg 11b8e80941Smrg/* 12b8e80941Smrg * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 13b8e80941Smrg * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 14b8e80941Smrg * All rights reserved. 15b8e80941Smrg * 16b8e80941Smrg * Permission is hereby granted, free of charge, to any person obtaining a 17b8e80941Smrg * copy of this software and associated documentation files (the "Software"), 18b8e80941Smrg * to deal in the Software without restriction, including without limitation 19b8e80941Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 20b8e80941Smrg * and/or sell copies of the Software, and to permit persons to whom the 21b8e80941Smrg * Software is furnished to do so, subject to the following conditions: 22b8e80941Smrg * 23b8e80941Smrg * The above copyright notice and this permission notice (including the next 24b8e80941Smrg * paragraph) shall be included in all copies or substantial portions of the 25b8e80941Smrg * Software. 26b8e80941Smrg * 27b8e80941Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28b8e80941Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29b8e80941Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 30b8e80941Smrg * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 31b8e80941Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 32b8e80941Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 33b8e80941Smrg * OTHER DEALINGS IN THE SOFTWARE. 34b8e80941Smrg */ 35b8e80941Smrg 36b8e80941Smrg#ifndef _DRM_H_ 37b8e80941Smrg#define _DRM_H_ 38b8e80941Smrg 39b8e80941Smrg#if defined(__linux__) 40b8e80941Smrg 41b8e80941Smrg#include <linux/types.h> 42b8e80941Smrg#include <asm/ioctl.h> 43b8e80941Smrgtypedef unsigned int drm_handle_t; 44b8e80941Smrg 45b8e80941Smrg#else /* One of the BSDs */ 46b8e80941Smrg 47b8e80941Smrg#include <sys/ioccom.h> 48b8e80941Smrg#include <sys/types.h> 49b8e80941Smrgtypedef int8_t __s8; 50b8e80941Smrgtypedef uint8_t __u8; 51b8e80941Smrgtypedef int16_t __s16; 52b8e80941Smrgtypedef uint16_t __u16; 53b8e80941Smrgtypedef int32_t __s32; 54b8e80941Smrgtypedef uint32_t __u32; 55b8e80941Smrgtypedef int64_t __s64; 56b8e80941Smrgtypedef uint64_t __u64; 57b8e80941Smrgtypedef size_t __kernel_size_t; 58b8e80941Smrgtypedef unsigned long drm_handle_t; 59b8e80941Smrg 60b8e80941Smrg#endif 61b8e80941Smrg 62b8e80941Smrg#if defined(__cplusplus) 63b8e80941Smrgextern "C" { 64b8e80941Smrg#endif 65b8e80941Smrg 66b8e80941Smrg#define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */ 67b8e80941Smrg#define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */ 68b8e80941Smrg#define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */ 69b8e80941Smrg#define DRM_RAM_PERCENT 10 /**< How much system ram can we lock? */ 70b8e80941Smrg 71b8e80941Smrg#define _DRM_LOCK_HELD 0x80000000U /**< Hardware lock is held */ 72b8e80941Smrg#define _DRM_LOCK_CONT 0x40000000U /**< Hardware lock is contended */ 73b8e80941Smrg#define _DRM_LOCK_IS_HELD(lock) ((lock) & _DRM_LOCK_HELD) 74b8e80941Smrg#define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT) 75b8e80941Smrg#define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) 76b8e80941Smrg 77b8e80941Smrgtypedef unsigned int drm_context_t; 78b8e80941Smrgtypedef unsigned int drm_drawable_t; 79b8e80941Smrgtypedef unsigned int drm_magic_t; 80b8e80941Smrg 81b8e80941Smrg/** 82b8e80941Smrg * Cliprect. 83b8e80941Smrg * 84b8e80941Smrg * \warning: If you change this structure, make sure you change 85b8e80941Smrg * XF86DRIClipRectRec in the server as well 86b8e80941Smrg * 87b8e80941Smrg * \note KW: Actually it's illegal to change either for 88b8e80941Smrg * backwards-compatibility reasons. 89b8e80941Smrg */ 90b8e80941Smrgstruct drm_clip_rect { 91b8e80941Smrg unsigned short x1; 92b8e80941Smrg unsigned short y1; 93b8e80941Smrg unsigned short x2; 94b8e80941Smrg unsigned short y2; 95b8e80941Smrg}; 96b8e80941Smrg 97b8e80941Smrg/** 98b8e80941Smrg * Drawable information. 99b8e80941Smrg */ 100b8e80941Smrgstruct drm_drawable_info { 101b8e80941Smrg unsigned int num_rects; 102b8e80941Smrg struct drm_clip_rect *rects; 103b8e80941Smrg}; 104b8e80941Smrg 105b8e80941Smrg/** 106b8e80941Smrg * Texture region, 107b8e80941Smrg */ 108b8e80941Smrgstruct drm_tex_region { 109b8e80941Smrg unsigned char next; 110b8e80941Smrg unsigned char prev; 111b8e80941Smrg unsigned char in_use; 112b8e80941Smrg unsigned char padding; 113b8e80941Smrg unsigned int age; 114b8e80941Smrg}; 115b8e80941Smrg 116b8e80941Smrg/** 117b8e80941Smrg * Hardware lock. 118b8e80941Smrg * 119b8e80941Smrg * The lock structure is a simple cache-line aligned integer. To avoid 120b8e80941Smrg * processor bus contention on a multiprocessor system, there should not be any 121b8e80941Smrg * other data stored in the same cache line. 122b8e80941Smrg */ 123b8e80941Smrgstruct drm_hw_lock { 124b8e80941Smrg __volatile__ unsigned int lock; /**< lock variable */ 125b8e80941Smrg char padding[60]; /**< Pad to cache line */ 126b8e80941Smrg}; 127b8e80941Smrg 128b8e80941Smrg/** 129b8e80941Smrg * DRM_IOCTL_VERSION ioctl argument type. 130b8e80941Smrg * 131b8e80941Smrg * \sa drmGetVersion(). 132b8e80941Smrg */ 133b8e80941Smrgstruct drm_version { 134b8e80941Smrg int version_major; /**< Major version */ 135b8e80941Smrg int version_minor; /**< Minor version */ 136b8e80941Smrg int version_patchlevel; /**< Patch level */ 137b8e80941Smrg __kernel_size_t name_len; /**< Length of name buffer */ 138b8e80941Smrg char *name; /**< Name of driver */ 139b8e80941Smrg __kernel_size_t date_len; /**< Length of date buffer */ 140b8e80941Smrg char *date; /**< User-space buffer to hold date */ 141b8e80941Smrg __kernel_size_t desc_len; /**< Length of desc buffer */ 142b8e80941Smrg char *desc; /**< User-space buffer to hold desc */ 143b8e80941Smrg}; 144b8e80941Smrg 145b8e80941Smrg/** 146b8e80941Smrg * DRM_IOCTL_GET_UNIQUE ioctl argument type. 147b8e80941Smrg * 148b8e80941Smrg * \sa drmGetBusid() and drmSetBusId(). 149b8e80941Smrg */ 150b8e80941Smrgstruct drm_unique { 151b8e80941Smrg __kernel_size_t unique_len; /**< Length of unique */ 152b8e80941Smrg char *unique; /**< Unique name for driver instantiation */ 153b8e80941Smrg}; 154b8e80941Smrg 155b8e80941Smrgstruct drm_list { 156b8e80941Smrg int count; /**< Length of user-space structures */ 157b8e80941Smrg struct drm_version *version; 158b8e80941Smrg}; 159b8e80941Smrg 160b8e80941Smrgstruct drm_block { 161b8e80941Smrg int unused; 162b8e80941Smrg}; 163b8e80941Smrg 164b8e80941Smrg/** 165b8e80941Smrg * DRM_IOCTL_CONTROL ioctl argument type. 166b8e80941Smrg * 167b8e80941Smrg * \sa drmCtlInstHandler() and drmCtlUninstHandler(). 168b8e80941Smrg */ 169b8e80941Smrgstruct drm_control { 170b8e80941Smrg enum { 171b8e80941Smrg DRM_ADD_COMMAND, 172b8e80941Smrg DRM_RM_COMMAND, 173b8e80941Smrg DRM_INST_HANDLER, 174b8e80941Smrg DRM_UNINST_HANDLER 175b8e80941Smrg } func; 176b8e80941Smrg int irq; 177b8e80941Smrg}; 178b8e80941Smrg 179b8e80941Smrg/** 180b8e80941Smrg * Type of memory to map. 181b8e80941Smrg */ 182b8e80941Smrgenum drm_map_type { 183b8e80941Smrg _DRM_FRAME_BUFFER = 0, /**< WC (no caching), no core dump */ 184b8e80941Smrg _DRM_REGISTERS = 1, /**< no caching, no core dump */ 185b8e80941Smrg _DRM_SHM = 2, /**< shared, cached */ 186b8e80941Smrg _DRM_AGP = 3, /**< AGP/GART */ 187b8e80941Smrg _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */ 188b8e80941Smrg _DRM_CONSISTENT = 5 /**< Consistent memory for PCI DMA */ 189b8e80941Smrg}; 190b8e80941Smrg 191b8e80941Smrg/** 192b8e80941Smrg * Memory mapping flags. 193b8e80941Smrg */ 194b8e80941Smrgenum drm_map_flags { 195b8e80941Smrg _DRM_RESTRICTED = 0x01, /**< Cannot be mapped to user-virtual */ 196b8e80941Smrg _DRM_READ_ONLY = 0x02, 197b8e80941Smrg _DRM_LOCKED = 0x04, /**< shared, cached, locked */ 198b8e80941Smrg _DRM_KERNEL = 0x08, /**< kernel requires access */ 199b8e80941Smrg _DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */ 200b8e80941Smrg _DRM_CONTAINS_LOCK = 0x20, /**< SHM page that contains lock */ 201b8e80941Smrg _DRM_REMOVABLE = 0x40, /**< Removable mapping */ 202b8e80941Smrg _DRM_DRIVER = 0x80 /**< Managed by driver */ 203b8e80941Smrg}; 204b8e80941Smrg 205b8e80941Smrgstruct drm_ctx_priv_map { 206b8e80941Smrg unsigned int ctx_id; /**< Context requesting private mapping */ 207b8e80941Smrg void *handle; /**< Handle of map */ 208b8e80941Smrg}; 209b8e80941Smrg 210b8e80941Smrg/** 211b8e80941Smrg * DRM_IOCTL_GET_MAP, DRM_IOCTL_ADD_MAP and DRM_IOCTL_RM_MAP ioctls 212b8e80941Smrg * argument type. 213b8e80941Smrg * 214b8e80941Smrg * \sa drmAddMap(). 215b8e80941Smrg */ 216b8e80941Smrgstruct drm_map { 217b8e80941Smrg unsigned long offset; /**< Requested physical address (0 for SAREA)*/ 218b8e80941Smrg unsigned long size; /**< Requested physical size (bytes) */ 219b8e80941Smrg enum drm_map_type type; /**< Type of memory to map */ 220b8e80941Smrg enum drm_map_flags flags; /**< Flags */ 221b8e80941Smrg void *handle; /**< User-space: "Handle" to pass to mmap() */ 222b8e80941Smrg /**< Kernel-space: kernel-virtual address */ 223b8e80941Smrg int mtrr; /**< MTRR slot used */ 224b8e80941Smrg /* Private data */ 225b8e80941Smrg}; 226b8e80941Smrg 227b8e80941Smrg/** 228b8e80941Smrg * DRM_IOCTL_GET_CLIENT ioctl argument type. 229b8e80941Smrg */ 230b8e80941Smrgstruct drm_client { 231b8e80941Smrg int idx; /**< Which client desired? */ 232b8e80941Smrg int auth; /**< Is client authenticated? */ 233b8e80941Smrg unsigned long pid; /**< Process ID */ 234b8e80941Smrg unsigned long uid; /**< User ID */ 235b8e80941Smrg unsigned long magic; /**< Magic */ 236b8e80941Smrg unsigned long iocs; /**< Ioctl count */ 237b8e80941Smrg}; 238b8e80941Smrg 239b8e80941Smrgenum drm_stat_type { 240b8e80941Smrg _DRM_STAT_LOCK, 241b8e80941Smrg _DRM_STAT_OPENS, 242b8e80941Smrg _DRM_STAT_CLOSES, 243b8e80941Smrg _DRM_STAT_IOCTLS, 244b8e80941Smrg _DRM_STAT_LOCKS, 245b8e80941Smrg _DRM_STAT_UNLOCKS, 246b8e80941Smrg _DRM_STAT_VALUE, /**< Generic value */ 247b8e80941Smrg _DRM_STAT_BYTE, /**< Generic byte counter (1024bytes/K) */ 248b8e80941Smrg _DRM_STAT_COUNT, /**< Generic non-byte counter (1000/k) */ 249b8e80941Smrg 250b8e80941Smrg _DRM_STAT_IRQ, /**< IRQ */ 251b8e80941Smrg _DRM_STAT_PRIMARY, /**< Primary DMA bytes */ 252b8e80941Smrg _DRM_STAT_SECONDARY, /**< Secondary DMA bytes */ 253b8e80941Smrg _DRM_STAT_DMA, /**< DMA */ 254b8e80941Smrg _DRM_STAT_SPECIAL, /**< Special DMA (e.g., priority or polled) */ 255b8e80941Smrg _DRM_STAT_MISSED /**< Missed DMA opportunity */ 256b8e80941Smrg /* Add to the *END* of the list */ 257b8e80941Smrg}; 258b8e80941Smrg 259b8e80941Smrg/** 260b8e80941Smrg * DRM_IOCTL_GET_STATS ioctl argument type. 261b8e80941Smrg */ 262b8e80941Smrgstruct drm_stats { 263b8e80941Smrg unsigned long count; 264b8e80941Smrg struct { 265b8e80941Smrg unsigned long value; 266b8e80941Smrg enum drm_stat_type type; 267b8e80941Smrg } data[15]; 268b8e80941Smrg}; 269b8e80941Smrg 270b8e80941Smrg/** 271b8e80941Smrg * Hardware locking flags. 272b8e80941Smrg */ 273b8e80941Smrgenum drm_lock_flags { 274b8e80941Smrg _DRM_LOCK_READY = 0x01, /**< Wait until hardware is ready for DMA */ 275b8e80941Smrg _DRM_LOCK_QUIESCENT = 0x02, /**< Wait until hardware quiescent */ 276b8e80941Smrg _DRM_LOCK_FLUSH = 0x04, /**< Flush this context's DMA queue first */ 277b8e80941Smrg _DRM_LOCK_FLUSH_ALL = 0x08, /**< Flush all DMA queues first */ 278b8e80941Smrg /* These *HALT* flags aren't supported yet 279b8e80941Smrg -- they will be used to support the 280b8e80941Smrg full-screen DGA-like mode. */ 281b8e80941Smrg _DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */ 282b8e80941Smrg _DRM_HALT_CUR_QUEUES = 0x20 /**< Halt all current queues */ 283b8e80941Smrg}; 284b8e80941Smrg 285b8e80941Smrg/** 286b8e80941Smrg * DRM_IOCTL_LOCK, DRM_IOCTL_UNLOCK and DRM_IOCTL_FINISH ioctl argument type. 287b8e80941Smrg * 288b8e80941Smrg * \sa drmGetLock() and drmUnlock(). 289b8e80941Smrg */ 290b8e80941Smrgstruct drm_lock { 291b8e80941Smrg int context; 292b8e80941Smrg enum drm_lock_flags flags; 293b8e80941Smrg}; 294b8e80941Smrg 295b8e80941Smrg/** 296b8e80941Smrg * DMA flags 297b8e80941Smrg * 298b8e80941Smrg * \warning 299b8e80941Smrg * These values \e must match xf86drm.h. 300b8e80941Smrg * 301b8e80941Smrg * \sa drm_dma. 302b8e80941Smrg */ 303b8e80941Smrgenum drm_dma_flags { 304b8e80941Smrg /* Flags for DMA buffer dispatch */ 305b8e80941Smrg _DRM_DMA_BLOCK = 0x01, /**< 306b8e80941Smrg * Block until buffer dispatched. 307b8e80941Smrg * 308b8e80941Smrg * \note The buffer may not yet have 309b8e80941Smrg * been processed by the hardware -- 310b8e80941Smrg * getting a hardware lock with the 311b8e80941Smrg * hardware quiescent will ensure 312b8e80941Smrg * that the buffer has been 313b8e80941Smrg * processed. 314b8e80941Smrg */ 315b8e80941Smrg _DRM_DMA_WHILE_LOCKED = 0x02, /**< Dispatch while lock held */ 316b8e80941Smrg _DRM_DMA_PRIORITY = 0x04, /**< High priority dispatch */ 317b8e80941Smrg 318b8e80941Smrg /* Flags for DMA buffer request */ 319b8e80941Smrg _DRM_DMA_WAIT = 0x10, /**< Wait for free buffers */ 320b8e80941Smrg _DRM_DMA_SMALLER_OK = 0x20, /**< Smaller-than-requested buffers OK */ 321b8e80941Smrg _DRM_DMA_LARGER_OK = 0x40 /**< Larger-than-requested buffers OK */ 322b8e80941Smrg}; 323b8e80941Smrg 324b8e80941Smrg/** 325b8e80941Smrg * DRM_IOCTL_ADD_BUFS and DRM_IOCTL_MARK_BUFS ioctl argument type. 326b8e80941Smrg * 327b8e80941Smrg * \sa drmAddBufs(). 328b8e80941Smrg */ 329b8e80941Smrgstruct drm_buf_desc { 330b8e80941Smrg int count; /**< Number of buffers of this size */ 331b8e80941Smrg int size; /**< Size in bytes */ 332b8e80941Smrg int low_mark; /**< Low water mark */ 333b8e80941Smrg int high_mark; /**< High water mark */ 334b8e80941Smrg enum { 335b8e80941Smrg _DRM_PAGE_ALIGN = 0x01, /**< Align on page boundaries for DMA */ 336b8e80941Smrg _DRM_AGP_BUFFER = 0x02, /**< Buffer is in AGP space */ 337b8e80941Smrg _DRM_SG_BUFFER = 0x04, /**< Scatter/gather memory buffer */ 338b8e80941Smrg _DRM_FB_BUFFER = 0x08, /**< Buffer is in frame buffer */ 339b8e80941Smrg _DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */ 340b8e80941Smrg } flags; 341b8e80941Smrg unsigned long agp_start; /**< 342b8e80941Smrg * Start address of where the AGP buffers are 343b8e80941Smrg * in the AGP aperture 344b8e80941Smrg */ 345b8e80941Smrg}; 346b8e80941Smrg 347b8e80941Smrg/** 348b8e80941Smrg * DRM_IOCTL_INFO_BUFS ioctl argument type. 349b8e80941Smrg */ 350b8e80941Smrgstruct drm_buf_info { 351b8e80941Smrg int count; /**< Entries in list */ 352b8e80941Smrg struct drm_buf_desc *list; 353b8e80941Smrg}; 354b8e80941Smrg 355b8e80941Smrg/** 356b8e80941Smrg * DRM_IOCTL_FREE_BUFS ioctl argument type. 357b8e80941Smrg */ 358b8e80941Smrgstruct drm_buf_free { 359b8e80941Smrg int count; 360b8e80941Smrg int *list; 361b8e80941Smrg}; 362b8e80941Smrg 363b8e80941Smrg/** 364b8e80941Smrg * Buffer information 365b8e80941Smrg * 366b8e80941Smrg * \sa drm_buf_map. 367b8e80941Smrg */ 368b8e80941Smrgstruct drm_buf_pub { 369b8e80941Smrg int idx; /**< Index into the master buffer list */ 370b8e80941Smrg int total; /**< Buffer size */ 371b8e80941Smrg int used; /**< Amount of buffer in use (for DMA) */ 372b8e80941Smrg void *address; /**< Address of buffer */ 373b8e80941Smrg}; 374b8e80941Smrg 375b8e80941Smrg/** 376b8e80941Smrg * DRM_IOCTL_MAP_BUFS ioctl argument type. 377b8e80941Smrg */ 378b8e80941Smrgstruct drm_buf_map { 379b8e80941Smrg int count; /**< Length of the buffer list */ 380b8e80941Smrg#ifdef __cplusplus 381b8e80941Smrg void *virt; 382b8e80941Smrg#else 383b8e80941Smrg void *virtual; /**< Mmap'd area in user-virtual */ 384b8e80941Smrg#endif 385b8e80941Smrg struct drm_buf_pub *list; /**< Buffer information */ 386b8e80941Smrg}; 387b8e80941Smrg 388b8e80941Smrg/** 389b8e80941Smrg * DRM_IOCTL_DMA ioctl argument type. 390b8e80941Smrg * 391b8e80941Smrg * Indices here refer to the offset into the buffer list in drm_buf_get. 392b8e80941Smrg * 393b8e80941Smrg * \sa drmDMA(). 394b8e80941Smrg */ 395b8e80941Smrgstruct drm_dma { 396b8e80941Smrg int context; /**< Context handle */ 397b8e80941Smrg int send_count; /**< Number of buffers to send */ 398b8e80941Smrg int *send_indices; /**< List of handles to buffers */ 399b8e80941Smrg int *send_sizes; /**< Lengths of data to send */ 400b8e80941Smrg enum drm_dma_flags flags; /**< Flags */ 401b8e80941Smrg int request_count; /**< Number of buffers requested */ 402b8e80941Smrg int request_size; /**< Desired size for buffers */ 403b8e80941Smrg int *request_indices; /**< Buffer information */ 404b8e80941Smrg int *request_sizes; 405b8e80941Smrg int granted_count; /**< Number of buffers granted */ 406b8e80941Smrg}; 407b8e80941Smrg 408b8e80941Smrgenum drm_ctx_flags { 409b8e80941Smrg _DRM_CONTEXT_PRESERVED = 0x01, 410b8e80941Smrg _DRM_CONTEXT_2DONLY = 0x02 411b8e80941Smrg}; 412b8e80941Smrg 413b8e80941Smrg/** 414b8e80941Smrg * DRM_IOCTL_ADD_CTX ioctl argument type. 415b8e80941Smrg * 416b8e80941Smrg * \sa drmCreateContext() and drmDestroyContext(). 417b8e80941Smrg */ 418b8e80941Smrgstruct drm_ctx { 419b8e80941Smrg drm_context_t handle; 420b8e80941Smrg enum drm_ctx_flags flags; 421b8e80941Smrg}; 422b8e80941Smrg 423b8e80941Smrg/** 424b8e80941Smrg * DRM_IOCTL_RES_CTX ioctl argument type. 425b8e80941Smrg */ 426b8e80941Smrgstruct drm_ctx_res { 427b8e80941Smrg int count; 428b8e80941Smrg struct drm_ctx *contexts; 429b8e80941Smrg}; 430b8e80941Smrg 431b8e80941Smrg/** 432b8e80941Smrg * DRM_IOCTL_ADD_DRAW and DRM_IOCTL_RM_DRAW ioctl argument type. 433b8e80941Smrg */ 434b8e80941Smrgstruct drm_draw { 435b8e80941Smrg drm_drawable_t handle; 436b8e80941Smrg}; 437b8e80941Smrg 438b8e80941Smrg/** 439b8e80941Smrg * DRM_IOCTL_UPDATE_DRAW ioctl argument type. 440b8e80941Smrg */ 441b8e80941Smrgtypedef enum { 442b8e80941Smrg DRM_DRAWABLE_CLIPRECTS 443b8e80941Smrg} drm_drawable_info_type_t; 444b8e80941Smrg 445b8e80941Smrgstruct drm_update_draw { 446b8e80941Smrg drm_drawable_t handle; 447b8e80941Smrg unsigned int type; 448b8e80941Smrg unsigned int num; 449b8e80941Smrg unsigned long long data; 450b8e80941Smrg}; 451b8e80941Smrg 452b8e80941Smrg/** 453b8e80941Smrg * DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type. 454b8e80941Smrg */ 455b8e80941Smrgstruct drm_auth { 456b8e80941Smrg drm_magic_t magic; 457b8e80941Smrg}; 458b8e80941Smrg 459b8e80941Smrg/** 460b8e80941Smrg * DRM_IOCTL_IRQ_BUSID ioctl argument type. 461b8e80941Smrg * 462b8e80941Smrg * \sa drmGetInterruptFromBusID(). 463b8e80941Smrg */ 464b8e80941Smrgstruct drm_irq_busid { 465b8e80941Smrg int irq; /**< IRQ number */ 466b8e80941Smrg int busnum; /**< bus number */ 467b8e80941Smrg int devnum; /**< device number */ 468b8e80941Smrg int funcnum; /**< function number */ 469b8e80941Smrg}; 470b8e80941Smrg 471b8e80941Smrgenum drm_vblank_seq_type { 472b8e80941Smrg _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ 473b8e80941Smrg _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ 474b8e80941Smrg /* bits 1-6 are reserved for high crtcs */ 475b8e80941Smrg _DRM_VBLANK_HIGH_CRTC_MASK = 0x0000003e, 476b8e80941Smrg _DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */ 477b8e80941Smrg _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ 478b8e80941Smrg _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ 479b8e80941Smrg _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ 480b8e80941Smrg _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking, unsupported */ 481b8e80941Smrg}; 482b8e80941Smrg#define _DRM_VBLANK_HIGH_CRTC_SHIFT 1 483b8e80941Smrg 484b8e80941Smrg#define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) 485b8e80941Smrg#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \ 486b8e80941Smrg _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS) 487b8e80941Smrg 488b8e80941Smrgstruct drm_wait_vblank_request { 489b8e80941Smrg enum drm_vblank_seq_type type; 490b8e80941Smrg unsigned int sequence; 491b8e80941Smrg unsigned long signal; 492b8e80941Smrg}; 493b8e80941Smrg 494b8e80941Smrgstruct drm_wait_vblank_reply { 495b8e80941Smrg enum drm_vblank_seq_type type; 496b8e80941Smrg unsigned int sequence; 497b8e80941Smrg long tval_sec; 498b8e80941Smrg long tval_usec; 499b8e80941Smrg}; 500b8e80941Smrg 501b8e80941Smrg/** 502b8e80941Smrg * DRM_IOCTL_WAIT_VBLANK ioctl argument type. 503b8e80941Smrg * 504b8e80941Smrg * \sa drmWaitVBlank(). 505b8e80941Smrg */ 506b8e80941Smrgunion drm_wait_vblank { 507b8e80941Smrg struct drm_wait_vblank_request request; 508b8e80941Smrg struct drm_wait_vblank_reply reply; 509b8e80941Smrg}; 510b8e80941Smrg 511b8e80941Smrg#define _DRM_PRE_MODESET 1 512b8e80941Smrg#define _DRM_POST_MODESET 2 513b8e80941Smrg 514b8e80941Smrg/** 515b8e80941Smrg * DRM_IOCTL_MODESET_CTL ioctl argument type 516b8e80941Smrg * 517b8e80941Smrg * \sa drmModesetCtl(). 518b8e80941Smrg */ 519b8e80941Smrgstruct drm_modeset_ctl { 520b8e80941Smrg __u32 crtc; 521b8e80941Smrg __u32 cmd; 522b8e80941Smrg}; 523b8e80941Smrg 524b8e80941Smrg/** 525b8e80941Smrg * DRM_IOCTL_AGP_ENABLE ioctl argument type. 526b8e80941Smrg * 527b8e80941Smrg * \sa drmAgpEnable(). 528b8e80941Smrg */ 529b8e80941Smrgstruct drm_agp_mode { 530b8e80941Smrg unsigned long mode; /**< AGP mode */ 531b8e80941Smrg}; 532b8e80941Smrg 533b8e80941Smrg/** 534b8e80941Smrg * DRM_IOCTL_AGP_ALLOC and DRM_IOCTL_AGP_FREE ioctls argument type. 535b8e80941Smrg * 536b8e80941Smrg * \sa drmAgpAlloc() and drmAgpFree(). 537b8e80941Smrg */ 538b8e80941Smrgstruct drm_agp_buffer { 539b8e80941Smrg unsigned long size; /**< In bytes -- will round to page boundary */ 540b8e80941Smrg unsigned long handle; /**< Used for binding / unbinding */ 541b8e80941Smrg unsigned long type; /**< Type of memory to allocate */ 542b8e80941Smrg unsigned long physical; /**< Physical used by i810 */ 543b8e80941Smrg}; 544b8e80941Smrg 545b8e80941Smrg/** 546b8e80941Smrg * DRM_IOCTL_AGP_BIND and DRM_IOCTL_AGP_UNBIND ioctls argument type. 547b8e80941Smrg * 548b8e80941Smrg * \sa drmAgpBind() and drmAgpUnbind(). 549b8e80941Smrg */ 550b8e80941Smrgstruct drm_agp_binding { 551b8e80941Smrg unsigned long handle; /**< From drm_agp_buffer */ 552b8e80941Smrg unsigned long offset; /**< In bytes -- will round to page boundary */ 553b8e80941Smrg}; 554b8e80941Smrg 555b8e80941Smrg/** 556b8e80941Smrg * DRM_IOCTL_AGP_INFO ioctl argument type. 557b8e80941Smrg * 558b8e80941Smrg * \sa drmAgpVersionMajor(), drmAgpVersionMinor(), drmAgpGetMode(), 559b8e80941Smrg * drmAgpBase(), drmAgpSize(), drmAgpMemoryUsed(), drmAgpMemoryAvail(), 560b8e80941Smrg * drmAgpVendorId() and drmAgpDeviceId(). 561b8e80941Smrg */ 562b8e80941Smrgstruct drm_agp_info { 563b8e80941Smrg int agp_version_major; 564b8e80941Smrg int agp_version_minor; 565b8e80941Smrg unsigned long mode; 566b8e80941Smrg unsigned long aperture_base; /* physical address */ 567b8e80941Smrg unsigned long aperture_size; /* bytes */ 568b8e80941Smrg unsigned long memory_allowed; /* bytes */ 569b8e80941Smrg unsigned long memory_used; 570b8e80941Smrg 571b8e80941Smrg /* PCI information */ 572b8e80941Smrg unsigned short id_vendor; 573b8e80941Smrg unsigned short id_device; 574b8e80941Smrg}; 575b8e80941Smrg 576b8e80941Smrg/** 577b8e80941Smrg * DRM_IOCTL_SG_ALLOC ioctl argument type. 578b8e80941Smrg */ 579b8e80941Smrgstruct drm_scatter_gather { 580b8e80941Smrg unsigned long size; /**< In bytes -- will round to page boundary */ 581b8e80941Smrg unsigned long handle; /**< Used for mapping / unmapping */ 582b8e80941Smrg}; 583b8e80941Smrg 584b8e80941Smrg/** 585b8e80941Smrg * DRM_IOCTL_SET_VERSION ioctl argument type. 586b8e80941Smrg */ 587b8e80941Smrgstruct drm_set_version { 588b8e80941Smrg int drm_di_major; 589b8e80941Smrg int drm_di_minor; 590b8e80941Smrg int drm_dd_major; 591b8e80941Smrg int drm_dd_minor; 592b8e80941Smrg}; 593b8e80941Smrg 594b8e80941Smrg/** DRM_IOCTL_GEM_CLOSE ioctl argument type */ 595b8e80941Smrgstruct drm_gem_close { 596b8e80941Smrg /** Handle of the object to be closed. */ 597b8e80941Smrg __u32 handle; 598b8e80941Smrg __u32 pad; 599b8e80941Smrg}; 600b8e80941Smrg 601b8e80941Smrg/** DRM_IOCTL_GEM_FLINK ioctl argument type */ 602b8e80941Smrgstruct drm_gem_flink { 603b8e80941Smrg /** Handle for the object being named */ 604b8e80941Smrg __u32 handle; 605b8e80941Smrg 606b8e80941Smrg /** Returned global name */ 607b8e80941Smrg __u32 name; 608b8e80941Smrg}; 609b8e80941Smrg 610b8e80941Smrg/** DRM_IOCTL_GEM_OPEN ioctl argument type */ 611b8e80941Smrgstruct drm_gem_open { 612b8e80941Smrg /** Name of object being opened */ 613b8e80941Smrg __u32 name; 614b8e80941Smrg 615b8e80941Smrg /** Returned handle for the object */ 616b8e80941Smrg __u32 handle; 617b8e80941Smrg 618b8e80941Smrg /** Returned size of the object */ 619b8e80941Smrg __u64 size; 620b8e80941Smrg}; 621b8e80941Smrg 622b8e80941Smrg#define DRM_CAP_DUMB_BUFFER 0x1 623b8e80941Smrg#define DRM_CAP_VBLANK_HIGH_CRTC 0x2 624b8e80941Smrg#define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3 625b8e80941Smrg#define DRM_CAP_DUMB_PREFER_SHADOW 0x4 626b8e80941Smrg#define DRM_CAP_PRIME 0x5 627b8e80941Smrg#define DRM_PRIME_CAP_IMPORT 0x1 628b8e80941Smrg#define DRM_PRIME_CAP_EXPORT 0x2 629b8e80941Smrg#define DRM_CAP_TIMESTAMP_MONOTONIC 0x6 630b8e80941Smrg#define DRM_CAP_ASYNC_PAGE_FLIP 0x7 631b8e80941Smrg/* 632b8e80941Smrg * The CURSOR_WIDTH and CURSOR_HEIGHT capabilities return a valid widthxheight 633b8e80941Smrg * combination for the hardware cursor. The intention is that a hardware 634b8e80941Smrg * agnostic userspace can query a cursor plane size to use. 635b8e80941Smrg * 636b8e80941Smrg * Note that the cross-driver contract is to merely return a valid size; 637b8e80941Smrg * drivers are free to attach another meaning on top, eg. i915 returns the 638b8e80941Smrg * maximum plane size. 639b8e80941Smrg */ 640b8e80941Smrg#define DRM_CAP_CURSOR_WIDTH 0x8 641b8e80941Smrg#define DRM_CAP_CURSOR_HEIGHT 0x9 642b8e80941Smrg#define DRM_CAP_ADDFB2_MODIFIERS 0x10 643b8e80941Smrg#define DRM_CAP_PAGE_FLIP_TARGET 0x11 644b8e80941Smrg#define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12 645b8e80941Smrg#define DRM_CAP_SYNCOBJ 0x13 646b8e80941Smrg 647b8e80941Smrg/** DRM_IOCTL_GET_CAP ioctl argument type */ 648b8e80941Smrgstruct drm_get_cap { 649b8e80941Smrg __u64 capability; 650b8e80941Smrg __u64 value; 651b8e80941Smrg}; 652b8e80941Smrg 653b8e80941Smrg/** 654b8e80941Smrg * DRM_CLIENT_CAP_STEREO_3D 655b8e80941Smrg * 656b8e80941Smrg * if set to 1, the DRM core will expose the stereo 3D capabilities of the 657b8e80941Smrg * monitor by advertising the supported 3D layouts in the flags of struct 658b8e80941Smrg * drm_mode_modeinfo. 659b8e80941Smrg */ 660b8e80941Smrg#define DRM_CLIENT_CAP_STEREO_3D 1 661b8e80941Smrg 662b8e80941Smrg/** 663b8e80941Smrg * DRM_CLIENT_CAP_UNIVERSAL_PLANES 664b8e80941Smrg * 665b8e80941Smrg * If set to 1, the DRM core will expose all planes (overlay, primary, and 666b8e80941Smrg * cursor) to userspace. 667b8e80941Smrg */ 668b8e80941Smrg#define DRM_CLIENT_CAP_UNIVERSAL_PLANES 2 669b8e80941Smrg 670b8e80941Smrg/** 671b8e80941Smrg * DRM_CLIENT_CAP_ATOMIC 672b8e80941Smrg * 673b8e80941Smrg * If set to 1, the DRM core will expose atomic properties to userspace 674b8e80941Smrg */ 675b8e80941Smrg#define DRM_CLIENT_CAP_ATOMIC 3 676b8e80941Smrg 677b8e80941Smrg/** 678b8e80941Smrg * DRM_CLIENT_CAP_ASPECT_RATIO 679b8e80941Smrg * 680b8e80941Smrg * If set to 1, the DRM core will provide aspect ratio information in modes. 681b8e80941Smrg */ 682b8e80941Smrg#define DRM_CLIENT_CAP_ASPECT_RATIO 4 683b8e80941Smrg 684b8e80941Smrg/** 685b8e80941Smrg * DRM_CLIENT_CAP_WRITEBACK_CONNECTORS 686b8e80941Smrg * 687b8e80941Smrg * If set to 1, the DRM core will expose special connectors to be used for 688b8e80941Smrg * writing back to memory the scene setup in the commit. Depends on client 689b8e80941Smrg * also supporting DRM_CLIENT_CAP_ATOMIC 690b8e80941Smrg */ 691b8e80941Smrg#define DRM_CLIENT_CAP_WRITEBACK_CONNECTORS 5 692b8e80941Smrg 693b8e80941Smrg/** DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */ 694b8e80941Smrgstruct drm_set_client_cap { 695b8e80941Smrg __u64 capability; 696b8e80941Smrg __u64 value; 697b8e80941Smrg}; 698b8e80941Smrg 699b8e80941Smrg#define DRM_RDWR O_RDWR 700b8e80941Smrg#define DRM_CLOEXEC O_CLOEXEC 701b8e80941Smrgstruct drm_prime_handle { 702b8e80941Smrg __u32 handle; 703b8e80941Smrg 704b8e80941Smrg /** Flags.. only applicable for handle->fd */ 705b8e80941Smrg __u32 flags; 706b8e80941Smrg 707b8e80941Smrg /** Returned dmabuf file descriptor */ 708b8e80941Smrg __s32 fd; 709b8e80941Smrg}; 710b8e80941Smrg 711b8e80941Smrgstruct drm_syncobj_create { 712b8e80941Smrg __u32 handle; 713b8e80941Smrg#define DRM_SYNCOBJ_CREATE_SIGNALED (1 << 0) 714b8e80941Smrg __u32 flags; 715b8e80941Smrg}; 716b8e80941Smrg 717b8e80941Smrgstruct drm_syncobj_destroy { 718b8e80941Smrg __u32 handle; 719b8e80941Smrg __u32 pad; 720b8e80941Smrg}; 721b8e80941Smrg 722b8e80941Smrg#define DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE (1 << 0) 723b8e80941Smrg#define DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE (1 << 0) 724b8e80941Smrgstruct drm_syncobj_handle { 725b8e80941Smrg __u32 handle; 726b8e80941Smrg __u32 flags; 727b8e80941Smrg 728b8e80941Smrg __s32 fd; 729b8e80941Smrg __u32 pad; 730b8e80941Smrg}; 731b8e80941Smrg 732b8e80941Smrg#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0) 733b8e80941Smrg#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1) 734b8e80941Smrgstruct drm_syncobj_wait { 735b8e80941Smrg __u64 handles; 736b8e80941Smrg /* absolute timeout */ 737b8e80941Smrg __s64 timeout_nsec; 738b8e80941Smrg __u32 count_handles; 739b8e80941Smrg __u32 flags; 740b8e80941Smrg __u32 first_signaled; /* only valid when not waiting all */ 741b8e80941Smrg __u32 pad; 742b8e80941Smrg}; 743b8e80941Smrg 744b8e80941Smrgstruct drm_syncobj_array { 745b8e80941Smrg __u64 handles; 746b8e80941Smrg __u32 count_handles; 747b8e80941Smrg __u32 pad; 748b8e80941Smrg}; 749b8e80941Smrg 750b8e80941Smrg/* Query current scanout sequence number */ 751b8e80941Smrgstruct drm_crtc_get_sequence { 752b8e80941Smrg __u32 crtc_id; /* requested crtc_id */ 753b8e80941Smrg __u32 active; /* return: crtc output is active */ 754b8e80941Smrg __u64 sequence; /* return: most recent vblank sequence */ 755b8e80941Smrg __s64 sequence_ns; /* return: most recent time of first pixel out */ 756b8e80941Smrg}; 757b8e80941Smrg 758b8e80941Smrg/* Queue event to be delivered at specified sequence. Time stamp marks 759b8e80941Smrg * when the first pixel of the refresh cycle leaves the display engine 760b8e80941Smrg * for the display 761b8e80941Smrg */ 762b8e80941Smrg#define DRM_CRTC_SEQUENCE_RELATIVE 0x00000001 /* sequence is relative to current */ 763b8e80941Smrg#define DRM_CRTC_SEQUENCE_NEXT_ON_MISS 0x00000002 /* Use next sequence if we've missed */ 764b8e80941Smrg 765b8e80941Smrgstruct drm_crtc_queue_sequence { 766b8e80941Smrg __u32 crtc_id; 767b8e80941Smrg __u32 flags; 768b8e80941Smrg __u64 sequence; /* on input, target sequence. on output, actual sequence */ 769b8e80941Smrg __u64 user_data; /* user data passed to event */ 770b8e80941Smrg}; 771b8e80941Smrg 772b8e80941Smrg#if defined(__cplusplus) 773b8e80941Smrg} 774b8e80941Smrg#endif 775b8e80941Smrg 776b8e80941Smrg#include "drm_mode.h" 777b8e80941Smrg 778b8e80941Smrg#if defined(__cplusplus) 779b8e80941Smrgextern "C" { 780b8e80941Smrg#endif 781b8e80941Smrg 782b8e80941Smrg#define DRM_IOCTL_BASE 'd' 783b8e80941Smrg#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) 784b8e80941Smrg#define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type) 785b8e80941Smrg#define DRM_IOW(nr,type) _IOW(DRM_IOCTL_BASE,nr,type) 786b8e80941Smrg#define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type) 787b8e80941Smrg 788b8e80941Smrg#define DRM_IOCTL_VERSION DRM_IOWR(0x00, struct drm_version) 789b8e80941Smrg#define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, struct drm_unique) 790b8e80941Smrg#define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, struct drm_auth) 791b8e80941Smrg#define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, struct drm_irq_busid) 792b8e80941Smrg#define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, struct drm_map) 793b8e80941Smrg#define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client) 794b8e80941Smrg#define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats) 795b8e80941Smrg#define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version) 796b8e80941Smrg#define DRM_IOCTL_MODESET_CTL DRM_IOW(0x08, struct drm_modeset_ctl) 797b8e80941Smrg#define DRM_IOCTL_GEM_CLOSE DRM_IOW (0x09, struct drm_gem_close) 798b8e80941Smrg#define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink) 799b8e80941Smrg#define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open) 800b8e80941Smrg#define DRM_IOCTL_GET_CAP DRM_IOWR(0x0c, struct drm_get_cap) 801b8e80941Smrg#define DRM_IOCTL_SET_CLIENT_CAP DRM_IOW( 0x0d, struct drm_set_client_cap) 802b8e80941Smrg 803b8e80941Smrg#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique) 804b8e80941Smrg#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth) 805b8e80941Smrg#define DRM_IOCTL_BLOCK DRM_IOWR(0x12, struct drm_block) 806b8e80941Smrg#define DRM_IOCTL_UNBLOCK DRM_IOWR(0x13, struct drm_block) 807b8e80941Smrg#define DRM_IOCTL_CONTROL DRM_IOW( 0x14, struct drm_control) 808b8e80941Smrg#define DRM_IOCTL_ADD_MAP DRM_IOWR(0x15, struct drm_map) 809b8e80941Smrg#define DRM_IOCTL_ADD_BUFS DRM_IOWR(0x16, struct drm_buf_desc) 810b8e80941Smrg#define DRM_IOCTL_MARK_BUFS DRM_IOW( 0x17, struct drm_buf_desc) 811b8e80941Smrg#define DRM_IOCTL_INFO_BUFS DRM_IOWR(0x18, struct drm_buf_info) 812b8e80941Smrg#define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, struct drm_buf_map) 813b8e80941Smrg#define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, struct drm_buf_free) 814b8e80941Smrg 815b8e80941Smrg#define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, struct drm_map) 816b8e80941Smrg 817b8e80941Smrg#define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, struct drm_ctx_priv_map) 818b8e80941Smrg#define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, struct drm_ctx_priv_map) 819b8e80941Smrg 820b8e80941Smrg#define DRM_IOCTL_SET_MASTER DRM_IO(0x1e) 821b8e80941Smrg#define DRM_IOCTL_DROP_MASTER DRM_IO(0x1f) 822b8e80941Smrg 823b8e80941Smrg#define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, struct drm_ctx) 824b8e80941Smrg#define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, struct drm_ctx) 825b8e80941Smrg#define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, struct drm_ctx) 826b8e80941Smrg#define DRM_IOCTL_GET_CTX DRM_IOWR(0x23, struct drm_ctx) 827b8e80941Smrg#define DRM_IOCTL_SWITCH_CTX DRM_IOW( 0x24, struct drm_ctx) 828b8e80941Smrg#define DRM_IOCTL_NEW_CTX DRM_IOW( 0x25, struct drm_ctx) 829b8e80941Smrg#define DRM_IOCTL_RES_CTX DRM_IOWR(0x26, struct drm_ctx_res) 830b8e80941Smrg#define DRM_IOCTL_ADD_DRAW DRM_IOWR(0x27, struct drm_draw) 831b8e80941Smrg#define DRM_IOCTL_RM_DRAW DRM_IOWR(0x28, struct drm_draw) 832b8e80941Smrg#define DRM_IOCTL_DMA DRM_IOWR(0x29, struct drm_dma) 833b8e80941Smrg#define DRM_IOCTL_LOCK DRM_IOW( 0x2a, struct drm_lock) 834b8e80941Smrg#define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock) 835b8e80941Smrg#define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock) 836b8e80941Smrg 837b8e80941Smrg#define DRM_IOCTL_PRIME_HANDLE_TO_FD DRM_IOWR(0x2d, struct drm_prime_handle) 838b8e80941Smrg#define DRM_IOCTL_PRIME_FD_TO_HANDLE DRM_IOWR(0x2e, struct drm_prime_handle) 839b8e80941Smrg 840b8e80941Smrg#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) 841b8e80941Smrg#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) 842b8e80941Smrg#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, struct drm_agp_mode) 843b8e80941Smrg#define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, struct drm_agp_info) 844b8e80941Smrg#define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, struct drm_agp_buffer) 845b8e80941Smrg#define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, struct drm_agp_buffer) 846b8e80941Smrg#define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, struct drm_agp_binding) 847b8e80941Smrg#define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, struct drm_agp_binding) 848b8e80941Smrg 849b8e80941Smrg#define DRM_IOCTL_SG_ALLOC DRM_IOWR(0x38, struct drm_scatter_gather) 850b8e80941Smrg#define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, struct drm_scatter_gather) 851b8e80941Smrg 852b8e80941Smrg#define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, union drm_wait_vblank) 853b8e80941Smrg 854b8e80941Smrg#define DRM_IOCTL_CRTC_GET_SEQUENCE DRM_IOWR(0x3b, struct drm_crtc_get_sequence) 855b8e80941Smrg#define DRM_IOCTL_CRTC_QUEUE_SEQUENCE DRM_IOWR(0x3c, struct drm_crtc_queue_sequence) 856b8e80941Smrg 857b8e80941Smrg#define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, struct drm_update_draw) 858b8e80941Smrg 859b8e80941Smrg#define DRM_IOCTL_MODE_GETRESOURCES DRM_IOWR(0xA0, struct drm_mode_card_res) 860b8e80941Smrg#define DRM_IOCTL_MODE_GETCRTC DRM_IOWR(0xA1, struct drm_mode_crtc) 861b8e80941Smrg#define DRM_IOCTL_MODE_SETCRTC DRM_IOWR(0xA2, struct drm_mode_crtc) 862b8e80941Smrg#define DRM_IOCTL_MODE_CURSOR DRM_IOWR(0xA3, struct drm_mode_cursor) 863b8e80941Smrg#define DRM_IOCTL_MODE_GETGAMMA DRM_IOWR(0xA4, struct drm_mode_crtc_lut) 864b8e80941Smrg#define DRM_IOCTL_MODE_SETGAMMA DRM_IOWR(0xA5, struct drm_mode_crtc_lut) 865b8e80941Smrg#define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xA6, struct drm_mode_get_encoder) 866b8e80941Smrg#define DRM_IOCTL_MODE_GETCONNECTOR DRM_IOWR(0xA7, struct drm_mode_get_connector) 867b8e80941Smrg#define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA8, struct drm_mode_mode_cmd) /* deprecated (never worked) */ 868b8e80941Smrg#define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd) /* deprecated (never worked) */ 869b8e80941Smrg 870b8e80941Smrg#define DRM_IOCTL_MODE_GETPROPERTY DRM_IOWR(0xAA, struct drm_mode_get_property) 871b8e80941Smrg#define DRM_IOCTL_MODE_SETPROPERTY DRM_IOWR(0xAB, struct drm_mode_connector_set_property) 872b8e80941Smrg#define DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xAC, struct drm_mode_get_blob) 873b8e80941Smrg#define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd) 874b8e80941Smrg#define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) 875b8e80941Smrg#define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int) 876b8e80941Smrg#define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip) 877b8e80941Smrg#define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd) 878b8e80941Smrg 879b8e80941Smrg#define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb) 880b8e80941Smrg#define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb) 881b8e80941Smrg#define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb) 882b8e80941Smrg#define DRM_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xB5, struct drm_mode_get_plane_res) 883b8e80941Smrg#define DRM_IOCTL_MODE_GETPLANE DRM_IOWR(0xB6, struct drm_mode_get_plane) 884b8e80941Smrg#define DRM_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct drm_mode_set_plane) 885b8e80941Smrg#define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2) 886b8e80941Smrg#define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties) 887b8e80941Smrg#define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property) 888b8e80941Smrg#define DRM_IOCTL_MODE_CURSOR2 DRM_IOWR(0xBB, struct drm_mode_cursor2) 889b8e80941Smrg#define DRM_IOCTL_MODE_ATOMIC DRM_IOWR(0xBC, struct drm_mode_atomic) 890b8e80941Smrg#define DRM_IOCTL_MODE_CREATEPROPBLOB DRM_IOWR(0xBD, struct drm_mode_create_blob) 891b8e80941Smrg#define DRM_IOCTL_MODE_DESTROYPROPBLOB DRM_IOWR(0xBE, struct drm_mode_destroy_blob) 892b8e80941Smrg 893b8e80941Smrg#define DRM_IOCTL_SYNCOBJ_CREATE DRM_IOWR(0xBF, struct drm_syncobj_create) 894b8e80941Smrg#define DRM_IOCTL_SYNCOBJ_DESTROY DRM_IOWR(0xC0, struct drm_syncobj_destroy) 895b8e80941Smrg#define DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD DRM_IOWR(0xC1, struct drm_syncobj_handle) 896b8e80941Smrg#define DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE DRM_IOWR(0xC2, struct drm_syncobj_handle) 897b8e80941Smrg#define DRM_IOCTL_SYNCOBJ_WAIT DRM_IOWR(0xC3, struct drm_syncobj_wait) 898b8e80941Smrg#define DRM_IOCTL_SYNCOBJ_RESET DRM_IOWR(0xC4, struct drm_syncobj_array) 899b8e80941Smrg#define DRM_IOCTL_SYNCOBJ_SIGNAL DRM_IOWR(0xC5, struct drm_syncobj_array) 900b8e80941Smrg 901b8e80941Smrg#define DRM_IOCTL_MODE_CREATE_LEASE DRM_IOWR(0xC6, struct drm_mode_create_lease) 902b8e80941Smrg#define DRM_IOCTL_MODE_LIST_LESSEES DRM_IOWR(0xC7, struct drm_mode_list_lessees) 903b8e80941Smrg#define DRM_IOCTL_MODE_GET_LEASE DRM_IOWR(0xC8, struct drm_mode_get_lease) 904b8e80941Smrg#define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease) 905b8e80941Smrg 906b8e80941Smrg/** 907b8e80941Smrg * Device specific ioctls should only be in their respective headers 908b8e80941Smrg * The device specific ioctl range is from 0x40 to 0x9f. 909b8e80941Smrg * Generic IOCTLS restart at 0xA0. 910b8e80941Smrg * 911b8e80941Smrg * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and 912b8e80941Smrg * drmCommandReadWrite(). 913b8e80941Smrg */ 914b8e80941Smrg#define DRM_COMMAND_BASE 0x40 915b8e80941Smrg#define DRM_COMMAND_END 0xA0 916b8e80941Smrg 917b8e80941Smrg/** 918b8e80941Smrg * Header for events written back to userspace on the drm fd. The 919b8e80941Smrg * type defines the type of event, the length specifies the total 920b8e80941Smrg * length of the event (including the header), and user_data is 921b8e80941Smrg * typically a 64 bit value passed with the ioctl that triggered the 922b8e80941Smrg * event. A read on the drm fd will always only return complete 923b8e80941Smrg * events, that is, if for example the read buffer is 100 bytes, and 924b8e80941Smrg * there are two 64 byte events pending, only one will be returned. 925b8e80941Smrg * 926b8e80941Smrg * Event types 0 - 0x7fffffff are generic drm events, 0x80000000 and 927b8e80941Smrg * up are chipset specific. 928b8e80941Smrg */ 929b8e80941Smrgstruct drm_event { 930b8e80941Smrg __u32 type; 931b8e80941Smrg __u32 length; 932b8e80941Smrg}; 933b8e80941Smrg 934b8e80941Smrg#define DRM_EVENT_VBLANK 0x01 935b8e80941Smrg#define DRM_EVENT_FLIP_COMPLETE 0x02 936b8e80941Smrg#define DRM_EVENT_CRTC_SEQUENCE 0x03 937b8e80941Smrg 938b8e80941Smrgstruct drm_event_vblank { 939b8e80941Smrg struct drm_event base; 940b8e80941Smrg __u64 user_data; 941b8e80941Smrg __u32 tv_sec; 942b8e80941Smrg __u32 tv_usec; 943b8e80941Smrg __u32 sequence; 944b8e80941Smrg __u32 crtc_id; /* 0 on older kernels that do not support this */ 945b8e80941Smrg}; 946b8e80941Smrg 947b8e80941Smrg/* Event delivered at sequence. Time stamp marks when the first pixel 948b8e80941Smrg * of the refresh cycle leaves the display engine for the display 949b8e80941Smrg */ 950b8e80941Smrgstruct drm_event_crtc_sequence { 951b8e80941Smrg struct drm_event base; 952b8e80941Smrg __u64 user_data; 953b8e80941Smrg __s64 time_ns; 954b8e80941Smrg __u64 sequence; 955b8e80941Smrg}; 956b8e80941Smrg 957b8e80941Smrg/* typedef area */ 958b8e80941Smrgtypedef struct drm_clip_rect drm_clip_rect_t; 959b8e80941Smrgtypedef struct drm_drawable_info drm_drawable_info_t; 960b8e80941Smrgtypedef struct drm_tex_region drm_tex_region_t; 961b8e80941Smrgtypedef struct drm_hw_lock drm_hw_lock_t; 962b8e80941Smrgtypedef struct drm_version drm_version_t; 963b8e80941Smrgtypedef struct drm_unique drm_unique_t; 964b8e80941Smrgtypedef struct drm_list drm_list_t; 965b8e80941Smrgtypedef struct drm_block drm_block_t; 966b8e80941Smrgtypedef struct drm_control drm_control_t; 967b8e80941Smrgtypedef enum drm_map_type drm_map_type_t; 968b8e80941Smrgtypedef enum drm_map_flags drm_map_flags_t; 969b8e80941Smrgtypedef struct drm_ctx_priv_map drm_ctx_priv_map_t; 970b8e80941Smrgtypedef struct drm_map drm_map_t; 971b8e80941Smrgtypedef struct drm_client drm_client_t; 972b8e80941Smrgtypedef enum drm_stat_type drm_stat_type_t; 973b8e80941Smrgtypedef struct drm_stats drm_stats_t; 974b8e80941Smrgtypedef enum drm_lock_flags drm_lock_flags_t; 975b8e80941Smrgtypedef struct drm_lock drm_lock_t; 976b8e80941Smrgtypedef enum drm_dma_flags drm_dma_flags_t; 977b8e80941Smrgtypedef struct drm_buf_desc drm_buf_desc_t; 978b8e80941Smrgtypedef struct drm_buf_info drm_buf_info_t; 979b8e80941Smrgtypedef struct drm_buf_free drm_buf_free_t; 980b8e80941Smrgtypedef struct drm_buf_pub drm_buf_pub_t; 981b8e80941Smrgtypedef struct drm_buf_map drm_buf_map_t; 982b8e80941Smrgtypedef struct drm_dma drm_dma_t; 983b8e80941Smrgtypedef union drm_wait_vblank drm_wait_vblank_t; 984b8e80941Smrgtypedef struct drm_agp_mode drm_agp_mode_t; 985b8e80941Smrgtypedef enum drm_ctx_flags drm_ctx_flags_t; 986b8e80941Smrgtypedef struct drm_ctx drm_ctx_t; 987b8e80941Smrgtypedef struct drm_ctx_res drm_ctx_res_t; 988b8e80941Smrgtypedef struct drm_draw drm_draw_t; 989b8e80941Smrgtypedef struct drm_update_draw drm_update_draw_t; 990b8e80941Smrgtypedef struct drm_auth drm_auth_t; 991b8e80941Smrgtypedef struct drm_irq_busid drm_irq_busid_t; 992b8e80941Smrgtypedef enum drm_vblank_seq_type drm_vblank_seq_type_t; 993b8e80941Smrg 994b8e80941Smrgtypedef struct drm_agp_buffer drm_agp_buffer_t; 995b8e80941Smrgtypedef struct drm_agp_binding drm_agp_binding_t; 996b8e80941Smrgtypedef struct drm_agp_info drm_agp_info_t; 997b8e80941Smrgtypedef struct drm_scatter_gather drm_scatter_gather_t; 998b8e80941Smrgtypedef struct drm_set_version drm_set_version_t; 999b8e80941Smrg 1000b8e80941Smrg#if defined(__cplusplus) 1001b8e80941Smrg} 1002b8e80941Smrg#endif 1003b8e80941Smrg 1004b8e80941Smrg#endif 1005