drm.h revision 3bd834a2178ee1273fd84628e87210a500f8fc84
12019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
22019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * \file drm.h
32019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * Header for the Direct Rendering Manager
42019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
52019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * \author Rickard E. (Rik) Faith <faith@valinux.com>
62019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
72019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * \par Acknowledgments:
82019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic \c cmpxchg.
92019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
102019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
1161f23c1887b17cf1073a138bd8f54bf9339acc5cflorian/*
122c74d242132a5046da515fc925723ed72118a2a5florian * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
132019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
142019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * All rights reserved.
152019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
162019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * Permission is hereby granted, free of charge, to any person obtaining a
172019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * copy of this software and associated documentation files (the "Software"),
182019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * to deal in the Software without restriction, including without limitation
192019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * the rights to use, copy, modify, merge, publish, distribute, sublicense,
202019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * and/or sell copies of the Software, and to permit persons to whom the
212019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * Software is furnished to do so, subject to the following conditions:
222019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
232019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * The above copyright notice and this permission notice (including the next
242019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * paragraph) shall be included in all copies or substantial portions of the
252019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * Software.
262019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
272019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
282019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
292019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
302019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
312019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
322019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
332019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * OTHER DEALINGS IN THE SOFTWARE.
342019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
352019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
362019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#ifndef _DRM_H_
372019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define _DRM_H_
382019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
392019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#if defined(__linux__)
402019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
412019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#include <linux/types.h>
422019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#include <asm/ioctl.h>
4379af575cdeeb388e196b6db19394df0bbfad65e9floriantypedef unsigned int drm_handle_t;
44428dfdd50cd81fda921f9bfc5f6451adc591aeffflorian
452019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#else /* One of the BSDs */
462019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
472019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#include <sys/ioccom.h>
482019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#include <sys/types.h>
492019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef int8_t   __s8;
502019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef uint8_t  __u8;
512019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef int16_t  __s16;
522019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef uint16_t __u16;
53f26994aee03b9855a50328cd34de8a072cd47cf5floriantypedef int32_t  __s32;
542019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef uint32_t __u32;
55b4df768d103fab8a7cb260812cde6789d1128878floriantypedef int64_t  __s64;
56b4df768d103fab8a7cb260812cde6789d1128878floriantypedef uint64_t __u64;
57b4df768d103fab8a7cb260812cde6789d1128878floriantypedef unsigned long drm_handle_t;
58b4df768d103fab8a7cb260812cde6789d1128878florian
59b4df768d103fab8a7cb260812cde6789d1128878florian#endif
60b4df768d103fab8a7cb260812cde6789d1128878florian
61b4df768d103fab8a7cb260812cde6789d1128878florian#define DRM_NAME	"drm"	  /**< Name in kernel, /dev, and /proc */
62b4df768d103fab8a7cb260812cde6789d1128878florian#define DRM_MIN_ORDER	5	  /**< At least 2^5 bytes = 32 bytes */
631c85704c5412ec4826f2e4d4da10034595aef713florian#define DRM_MAX_ORDER	22	  /**< Up to 2^22 bytes = 4MB */
64b4df768d103fab8a7cb260812cde6789d1128878florian#define DRM_RAM_PERCENT 10	  /**< How much system ram can we lock? */
65b4df768d103fab8a7cb260812cde6789d1128878florian
662019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define _DRM_LOCK_HELD	0x80000000U /**< Hardware lock is held */
672019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define _DRM_LOCK_CONT	0x40000000U /**< Hardware lock is contended */
682019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define _DRM_LOCK_IS_HELD(lock)	   ((lock) & _DRM_LOCK_HELD)
692019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define _DRM_LOCK_IS_CONT(lock)	   ((lock) & _DRM_LOCK_CONT)
702019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT))
712019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
722019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef unsigned int drm_context_t;
732019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef unsigned int drm_drawable_t;
742019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef unsigned int drm_magic_t;
752019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
762019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
772019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * Cliprect.
782019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
792019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * \warning: If you change this structure, make sure you change
802019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * XF86DRIClipRectRec in the server as well
812019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
822019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * \note KW: Actually it's illegal to change either for
832019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * backwards-compatibility reasons.
842019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
852019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_clip_rect {
862019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned short x1;
872019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned short y1;
882019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned short x2;
892019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned short y2;
902019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
912019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
922019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
932019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * Drawable information.
942019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
952019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_drawable_info {
962019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned int num_rects;
972019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	struct drm_clip_rect *rects;
982019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
992019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
1002019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
1012019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * Texture region,
1022019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
1032019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_tex_region {
1042019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned char next;
1052019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned char prev;
1062019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned char in_use;
1072019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned char padding;
1082019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned int age;
1092019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
1102019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
1112019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
1122019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * Hardware lock.
1132019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
1142019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * The lock structure is a simple cache-line aligned integer.  To avoid
115b4df768d103fab8a7cb260812cde6789d1128878florian * processor bus contention on a multiprocessor system, there should not be any
1162019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * other data stored in the same cache line.
1172019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
1182019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_hw_lock {
1192019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	__volatile__ unsigned int lock;		/**< lock variable */
1202019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	char padding[60];			/**< Pad to cache line */
1212019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
1222019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
1238844a6329d275814456e3a2a5a7bffac75da0957florian/**
1242019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_VERSION ioctl argument type.
1252019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
1262019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * \sa drmGetVersion().
1272019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
1282019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_version {
1292019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int version_major;	  /**< Major version */
1302019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int version_minor;	  /**< Minor version */
1312019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int version_patchlevel;	  /**< Patch level */
1322019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	size_t name_len;	  /**< Length of name buffer */
1332019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	char *name;	  /**< Name of driver */
1342019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	size_t date_len;	  /**< Length of date buffer */
1352019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	char *date;	  /**< User-space buffer to hold date */
1362019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	size_t desc_len;	  /**< Length of desc buffer */
1372019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	char *desc;	  /**< User-space buffer to hold desc */
1382019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
1392019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
1402019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
1412019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_GET_UNIQUE ioctl argument type.
1422019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
1432019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * \sa drmGetBusid() and drmSetBusId().
1442019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
1452019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_unique {
1462019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	size_t unique_len;	  /**< Length of unique */
1472019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	char *unique;	  /**< Unique name for driver instantiation */
1482019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
1498844a6329d275814456e3a2a5a7bffac75da0957florian
1508844a6329d275814456e3a2a5a7bffac75da0957florianstruct drm_list {
1512019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int count;		  /**< Length of user-space structures */
1522019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	struct drm_version *version;
1532019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
1542019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
1552019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_block {
1562019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int unused;
1572019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
1582019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
1592019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
1602019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_CONTROL ioctl argument type.
1612019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
1622019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * \sa drmCtlInstHandler() and drmCtlUninstHandler().
1632019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
1642019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_control {
1652019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	enum {
1662019a976f07ff418dde2dfc7cc74667ef66d7764sewardj		DRM_ADD_COMMAND,
1672019a976f07ff418dde2dfc7cc74667ef66d7764sewardj		DRM_RM_COMMAND,
1682019a976f07ff418dde2dfc7cc74667ef66d7764sewardj		DRM_INST_HANDLER,
1692019a976f07ff418dde2dfc7cc74667ef66d7764sewardj		DRM_UNINST_HANDLER
1702019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	} func;
1712019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int irq;
1722019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
1732019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
1742019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
1752019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * Type of memory to map.
1762019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
1772019a976f07ff418dde2dfc7cc74667ef66d7764sewardjenum drm_map_type {
1782019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_FRAME_BUFFER = 0,	  /**< WC (no caching), no core dump */
1792019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_REGISTERS = 1,	  /**< no caching, no core dump */
1802019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_SHM = 2,		  /**< shared, cached */
1812019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_AGP = 3,		  /**< AGP/GART */
1822019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_SCATTER_GATHER = 4,  /**< Scatter/gather memory for PCI DMA */
1832019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_CONSISTENT = 5,	  /**< Consistent memory for PCI DMA */
1848844a6329d275814456e3a2a5a7bffac75da0957florian	_DRM_GEM = 6,		  /**< GEM object */
1852019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
1862019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
1872019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
1882019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * Memory mapping flags.
1892019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
1902019a976f07ff418dde2dfc7cc74667ef66d7764sewardjenum drm_map_flags {
1912019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_RESTRICTED = 0x01,	     /**< Cannot be mapped to user-virtual */
1922019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_READ_ONLY = 0x02,
1932019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_LOCKED = 0x04,	     /**< shared, cached, locked */
1942019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_KERNEL = 0x08,	     /**< kernel requires access */
1952019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */
1962019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_CONTAINS_LOCK = 0x20,   /**< SHM page that contains lock */
1972019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_REMOVABLE = 0x40,	     /**< Removable mapping */
1982019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_DRIVER = 0x80	     /**< Managed by driver */
1992019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
2002019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
2012019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_ctx_priv_map {
2022019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned int ctx_id;	 /**< Context requesting private mapping */
2032019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	void *handle;		 /**< Handle of map */
2042019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
2052019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
2062019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
2072019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_GET_MAP, DRM_IOCTL_ADD_MAP and DRM_IOCTL_RM_MAP ioctls
2082019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * argument type.
2092019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
2102019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * \sa drmAddMap().
2112019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
2122019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_map {
2132019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned long offset;	 /**< Requested physical address (0 for SAREA)*/
2142019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned long size;	 /**< Requested physical size (bytes) */
2152019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	enum drm_map_type type;	 /**< Type of memory to map */
2162019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	enum drm_map_flags flags;	 /**< Flags */
2172019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	void *handle;		 /**< User-space: "Handle" to pass to mmap() */
2182019a976f07ff418dde2dfc7cc74667ef66d7764sewardj				 /**< Kernel-space: kernel-virtual address */
2192019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int mtrr;		 /**< MTRR slot used */
2202019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	/*   Private data */
2212019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
2222019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
2232019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
2242019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_GET_CLIENT ioctl argument type.
2252019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
2262019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_client {
2272019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int idx;		/**< Which client desired? */
2282019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int auth;		/**< Is client authenticated? */
2292019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned long pid;	/**< Process ID */
2302019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned long uid;	/**< User ID */
2312019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned long magic;	/**< Magic */
2322019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned long iocs;	/**< Ioctl count */
2332019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
2342019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
2352019a976f07ff418dde2dfc7cc74667ef66d7764sewardjenum drm_stat_type {
2362019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_STAT_LOCK,
2372019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_STAT_OPENS,
2382019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_STAT_CLOSES,
2392019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_STAT_IOCTLS,
2402019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_STAT_LOCKS,
2412019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_STAT_UNLOCKS,
2422019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_STAT_VALUE,	/**< Generic value */
2432019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_STAT_BYTE,		/**< Generic byte counter (1024bytes/K) */
2442019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_STAT_COUNT,	/**< Generic non-byte counter (1000/k) */
2452019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
2462019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_STAT_IRQ,		/**< IRQ */
2472019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_STAT_PRIMARY,	/**< Primary DMA bytes */
2482019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_STAT_SECONDARY,	/**< Secondary DMA bytes */
2492019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_STAT_DMA,		/**< DMA */
2502019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_STAT_SPECIAL,	/**< Special DMA (e.g., priority or polled) */
2512019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_STAT_MISSED	/**< Missed DMA opportunity */
2522019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	    /* Add to the *END* of the list */
2532019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
2542019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
2552019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
2562019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_GET_STATS ioctl argument type.
2572019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
2582019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_stats {
2592019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned long count;
2602019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	struct {
2612019a976f07ff418dde2dfc7cc74667ef66d7764sewardj		unsigned long value;
2622019a976f07ff418dde2dfc7cc74667ef66d7764sewardj		enum drm_stat_type type;
2632019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	} data[15];
2642019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
2652019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
2662019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
2672019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * Hardware locking flags.
2682019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
2692019a976f07ff418dde2dfc7cc74667ef66d7764sewardjenum drm_lock_flags {
2702019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_LOCK_READY = 0x01,	     /**< Wait until hardware is ready for DMA */
2712019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_LOCK_QUIESCENT = 0x02,  /**< Wait until hardware quiescent */
2722019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_LOCK_FLUSH = 0x04,	     /**< Flush this context's DMA queue first */
2732019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_LOCK_FLUSH_ALL = 0x08,  /**< Flush all DMA queues first */
2742019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	/* These *HALT* flags aren't supported yet
2752019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	   -- they will be used to support the
2762019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	   full-screen DGA-like mode. */
2772019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */
2782019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_HALT_CUR_QUEUES = 0x20  /**< Halt all current queues */
2792019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
2802019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
2812019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
2822019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_LOCK, DRM_IOCTL_UNLOCK and DRM_IOCTL_FINISH ioctl argument type.
2832019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
2842019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * \sa drmGetLock() and drmUnlock().
2852019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
2862019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_lock {
2872019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int context;
2882019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	enum drm_lock_flags flags;
2892019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
2902019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
2912019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
2922019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DMA flags
2932019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
2942019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * \warning
2952019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * These values \e must match xf86drm.h.
2962019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
2972019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * \sa drm_dma.
2982019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
2992019a976f07ff418dde2dfc7cc74667ef66d7764sewardjenum drm_dma_flags {
3002019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	/* Flags for DMA buffer dispatch */
3012019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_DMA_BLOCK = 0x01,	      /**<
3022019a976f07ff418dde2dfc7cc74667ef66d7764sewardj				       * Block until buffer dispatched.
3032019a976f07ff418dde2dfc7cc74667ef66d7764sewardj				       *
3042019a976f07ff418dde2dfc7cc74667ef66d7764sewardj				       * \note The buffer may not yet have
3052019a976f07ff418dde2dfc7cc74667ef66d7764sewardj				       * been processed by the hardware --
3062019a976f07ff418dde2dfc7cc74667ef66d7764sewardj				       * getting a hardware lock with the
3072019a976f07ff418dde2dfc7cc74667ef66d7764sewardj				       * hardware quiescent will ensure
3082019a976f07ff418dde2dfc7cc74667ef66d7764sewardj				       * that the buffer has been
3092019a976f07ff418dde2dfc7cc74667ef66d7764sewardj				       * processed.
3102019a976f07ff418dde2dfc7cc74667ef66d7764sewardj				       */
3112019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_DMA_WHILE_LOCKED = 0x02, /**< Dispatch while lock held */
3122019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_DMA_PRIORITY = 0x04,     /**< High priority dispatch */
3132019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
3142019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	/* Flags for DMA buffer request */
3152019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_DMA_WAIT = 0x10,	      /**< Wait for free buffers */
3162019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_DMA_SMALLER_OK = 0x20,   /**< Smaller-than-requested buffers OK */
3172019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_DMA_LARGER_OK = 0x40     /**< Larger-than-requested buffers OK */
3182019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
3192019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
3202019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
3212019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_ADD_BUFS and DRM_IOCTL_MARK_BUFS ioctl argument type.
3222019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
3232019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * \sa drmAddBufs().
3242019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
3252019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_buf_desc {
3262019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int count;		 /**< Number of buffers of this size */
3272019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int size;		 /**< Size in bytes */
3282019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int low_mark;		 /**< Low water mark */
3292019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int high_mark;		 /**< High water mark */
3302019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	enum {
3312019a976f07ff418dde2dfc7cc74667ef66d7764sewardj		_DRM_PAGE_ALIGN = 0x01,	/**< Align on page boundaries for DMA */
3322019a976f07ff418dde2dfc7cc74667ef66d7764sewardj		_DRM_AGP_BUFFER = 0x02,	/**< Buffer is in AGP space */
3332019a976f07ff418dde2dfc7cc74667ef66d7764sewardj		_DRM_SG_BUFFER = 0x04,	/**< Scatter/gather memory buffer */
3342019a976f07ff418dde2dfc7cc74667ef66d7764sewardj		_DRM_FB_BUFFER = 0x08,	/**< Buffer is in frame buffer */
3352019a976f07ff418dde2dfc7cc74667ef66d7764sewardj		_DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */
3362019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	} flags;
3372019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned long agp_start; /**<
3382019a976f07ff418dde2dfc7cc74667ef66d7764sewardj				  * Start address of where the AGP buffers are
3392019a976f07ff418dde2dfc7cc74667ef66d7764sewardj				  * in the AGP aperture
3402019a976f07ff418dde2dfc7cc74667ef66d7764sewardj				  */
3412019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
3422019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
3432019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
3442019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_INFO_BUFS ioctl argument type.
3452019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
3462019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_buf_info {
3472019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int count;		/**< Entries in list */
3482019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	struct drm_buf_desc *list;
3492019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
3502019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
3512019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
3522019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_FREE_BUFS ioctl argument type.
353b4df768d103fab8a7cb260812cde6789d1128878florian */
3542019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_buf_free {
3552019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int count;
3562019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int *list;
3572019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
3582019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
3592019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
3602019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * Buffer information
3612019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
3622019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * \sa drm_buf_map.
3632019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
3642019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_buf_pub {
3652019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int idx;		       /**< Index into the master buffer list */
3662019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int total;		       /**< Buffer size */
3672019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int used;		       /**< Amount of buffer in use (for DMA) */
3682019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	void *address;	       /**< Address of buffer */
3692019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
3702019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
3712019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
3722019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_MAP_BUFS ioctl argument type.
3732019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
374b4df768d103fab8a7cb260812cde6789d1128878florianstruct drm_buf_map {
3752019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int count;		/**< Length of the buffer list */
3762019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	void *virtual;		/**< Mmap'd area in user-virtual */
3772019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	struct drm_buf_pub *list;	/**< Buffer information */
3782019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
3792019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
3802019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
3812019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_DMA ioctl argument type.
3822019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
3832019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * Indices here refer to the offset into the buffer list in drm_buf_get.
3842019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
3852019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * \sa drmDMA().
3862019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
3872019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_dma {
3882019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int context;			  /**< Context handle */
3892019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int send_count;			  /**< Number of buffers to send */
3902019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int *send_indices;	  /**< List of handles to buffers */
3912019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int *send_sizes;		  /**< Lengths of data to send */
3922019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	enum drm_dma_flags flags;	  /**< Flags */
3932019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int request_count;		  /**< Number of buffers requested */
3942019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int request_size;		  /**< Desired size for buffers */
3952019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int *request_indices;	  /**< Buffer information */
396b4df768d103fab8a7cb260812cde6789d1128878florian	int *request_sizes;
3972019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int granted_count;		  /**< Number of buffers granted */
3982019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
3992019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
4002019a976f07ff418dde2dfc7cc74667ef66d7764sewardjenum drm_ctx_flags {
4012019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_CONTEXT_PRESERVED = 0x01,
402b4df768d103fab8a7cb260812cde6789d1128878florian	_DRM_CONTEXT_2DONLY = 0x02
4032019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
4042019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
4052019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
4062019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_ADD_CTX ioctl argument type.
4072019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
4082019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * \sa drmCreateContext() and drmDestroyContext().
4092019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
4102019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_ctx {
4112019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	drm_context_t handle;
4122019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	enum drm_ctx_flags flags;
4132019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
4142019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
4152019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
4162019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_RES_CTX ioctl argument type.
4172019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
4182019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_ctx_res {
4192019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int count;
4202019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	struct drm_ctx *contexts;
4212019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
4222019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
4232019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
4242019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_ADD_DRAW and DRM_IOCTL_RM_DRAW ioctl argument type.
4252019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
4262019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_draw {
4272019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	drm_drawable_t handle;
428b4df768d103fab8a7cb260812cde6789d1128878florian};
4292019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
4302019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
4312019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_UPDATE_DRAW ioctl argument type.
4322019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
4332019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef enum {
4342019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	DRM_DRAWABLE_CLIPRECTS,
4352019a976f07ff418dde2dfc7cc74667ef66d7764sewardj} drm_drawable_info_type_t;
436b4df768d103fab8a7cb260812cde6789d1128878florian
4372019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_update_draw {
4382019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	drm_drawable_t handle;
4392019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned int type;
4402019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned int num;
4412019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned long long data;
4422019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
4432019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
4442019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
4452019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type.
446b4df768d103fab8a7cb260812cde6789d1128878florian */
4472019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_auth {
4482019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	drm_magic_t magic;
4492019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
4502019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
4512019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
4522019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_IRQ_BUSID ioctl argument type.
4532019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
4542019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * \sa drmGetInterruptFromBusID().
4552019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
4562019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_irq_busid {
4572019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int irq;	/**< IRQ number */
4582019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int busnum;	/**< bus number */
4592019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int devnum;	/**< device number */
4602019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int funcnum;	/**< function number */
4612019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
4622019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
4632019a976f07ff418dde2dfc7cc74667ef66d7764sewardjenum drm_vblank_seq_type {
4642019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_VBLANK_ABSOLUTE = 0x0,	/**< Wait for specific vblank sequence number */
4652019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_VBLANK_RELATIVE = 0x1,	/**< Wait for given number of vblanks */
4662019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_VBLANK_EVENT = 0x4000000,   /**< Send event instead of blocking */
4672019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_VBLANK_FLIP = 0x8000000,   /**< Scheduled buffer swap should flip */
4682019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_VBLANK_NEXTONMISS = 0x10000000,	/**< If missed, wait for next vblank */
4692019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_VBLANK_SECONDARY = 0x20000000,	/**< Secondary display controller */
4702019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	_DRM_VBLANK_SIGNAL = 0x40000000	/**< Send signal instead of blocking, unsupported */
4712019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
4722019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
4732019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE)
4742019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \
4752019a976f07ff418dde2dfc7cc74667ef66d7764sewardj				_DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS)
4762019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
4772019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_wait_vblank_request {
4782019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	enum drm_vblank_seq_type type;
4792019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned int sequence;
4802019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned long signal;
4812019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
4822019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
4832019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_wait_vblank_reply {
4842019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	enum drm_vblank_seq_type type;
4852019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned int sequence;
4862019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	long tval_sec;
4872019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	long tval_usec;
4882019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
4892019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
4902019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
4912019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_WAIT_VBLANK ioctl argument type.
4922019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
4932019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * \sa drmWaitVBlank().
4942019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
4952019a976f07ff418dde2dfc7cc74667ef66d7764sewardjunion drm_wait_vblank {
4962019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	struct drm_wait_vblank_request request;
4972019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	struct drm_wait_vblank_reply reply;
4982019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
4992019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
5002019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define _DRM_PRE_MODESET 1
5012019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define _DRM_POST_MODESET 2
5022019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
5032019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
5042019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_MODESET_CTL ioctl argument type
5052019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
5062019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * \sa drmModesetCtl().
5072019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
5082019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_modeset_ctl {
5092019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	__u32 crtc;
5102019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	__u32 cmd;
5112019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
5122019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
5132019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
5142019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_AGP_ENABLE ioctl argument type.
5152019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
5162019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * \sa drmAgpEnable().
5172019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
5182019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_agp_mode {
5192019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned long mode;	/**< AGP mode */
5202019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
5212019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
5222019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
5232019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_AGP_ALLOC and DRM_IOCTL_AGP_FREE ioctls argument type.
5242019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
5252019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * \sa drmAgpAlloc() and drmAgpFree().
5262019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
5272019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_agp_buffer {
5282019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned long size;	/**< In bytes -- will round to page boundary */
5292019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned long handle;	/**< Used for binding / unbinding */
530b4df768d103fab8a7cb260812cde6789d1128878florian	unsigned long type;	/**< Type of memory to allocate */
5312019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned long physical;	/**< Physical used by i810 */
5322019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
5332019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
5342019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
5352019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_AGP_BIND and DRM_IOCTL_AGP_UNBIND ioctls argument type.
5362019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
5372019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * \sa drmAgpBind() and drmAgpUnbind().
5382019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
5392019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_agp_binding {
5402019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned long handle;	/**< From drm_agp_buffer */
5412019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned long offset;	/**< In bytes -- will round to page boundary */
5422019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
5432019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
5442019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
5452019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_AGP_INFO ioctl argument type.
5462019a976f07ff418dde2dfc7cc74667ef66d7764sewardj *
5472019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * \sa drmAgpVersionMajor(), drmAgpVersionMinor(), drmAgpGetMode(),
5482019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * drmAgpBase(), drmAgpSize(), drmAgpMemoryUsed(), drmAgpMemoryAvail(),
5492019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * drmAgpVendorId() and drmAgpDeviceId().
5502019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
5512019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_agp_info {
5522019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int agp_version_major;
5532019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int agp_version_minor;
5542019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned long mode;
5552019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned long aperture_base;	/* physical address */
5562019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned long aperture_size;	/* bytes */
5572019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned long memory_allowed;	/* bytes */
5582019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned long memory_used;
5592019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
5602019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	/* PCI information */
5612019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned short id_vendor;
5622019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned short id_device;
5632019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
5642019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
5652019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
5662019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_SG_ALLOC ioctl argument type.
5672019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
5682019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_scatter_gather {
5692019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned long size;	/**< In bytes -- will round to page boundary */
5702019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	unsigned long handle;	/**< Used for mapping / unmapping */
5712019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
5722019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
5732019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
5742019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * DRM_IOCTL_SET_VERSION ioctl argument type.
5752019a976f07ff418dde2dfc7cc74667ef66d7764sewardj */
5762019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_set_version {
5772019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int drm_di_major;
5782019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int drm_di_minor;
5792019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int drm_dd_major;
5802019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	int drm_dd_minor;
5812019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
5822019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
5832019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/** DRM_IOCTL_GEM_CLOSE ioctl argument type */
5842019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_gem_close {
5852019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	/** Handle of the object to be closed. */
5862019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	__u32 handle;
5872019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	__u32 pad;
588611b06e7d8f45e291dbfadcfa42e2f55021d73f5sewardj};
589611b06e7d8f45e291dbfadcfa42e2f55021d73f5sewardj
590611b06e7d8f45e291dbfadcfa42e2f55021d73f5sewardj/** DRM_IOCTL_GEM_FLINK ioctl argument type */
591611b06e7d8f45e291dbfadcfa42e2f55021d73f5sewardjstruct drm_gem_flink {
5922019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	/** Handle for the object being named */
5932019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	__u32 handle;
5942019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
5952019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	/** Returned global name */
5962019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	__u32 name;
5972019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
5982019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
5992019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/** DRM_IOCTL_GEM_OPEN ioctl argument type */
6002019a976f07ff418dde2dfc7cc74667ef66d7764sewardjstruct drm_gem_open {
6012019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	/** Name of object being opened */
6022019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	__u32 name;
6032019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
6042019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	/** Returned handle for the object */
6052019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	__u32 handle;
6062019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
6072019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	/** Returned size of the object */
6082019a976f07ff418dde2dfc7cc74667ef66d7764sewardj	__u64 size;
6092019a976f07ff418dde2dfc7cc74667ef66d7764sewardj};
6102019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
6112019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#include "drm_mode.h"
6122019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
6132019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_BASE			'd'
614448cbba56bb995b0dc8030928de7156f528eef0bflorian#define DRM_IO(nr)			_IO(DRM_IOCTL_BASE,nr)
615448cbba56bb995b0dc8030928de7156f528eef0bflorian#define DRM_IOR(nr,type)		_IOR(DRM_IOCTL_BASE,nr,type)
616448cbba56bb995b0dc8030928de7156f528eef0bflorian#define DRM_IOW(nr,type)		_IOW(DRM_IOCTL_BASE,nr,type)
617448cbba56bb995b0dc8030928de7156f528eef0bflorian#define DRM_IOWR(nr,type)		_IOWR(DRM_IOCTL_BASE,nr,type)
618448cbba56bb995b0dc8030928de7156f528eef0bflorian
619448cbba56bb995b0dc8030928de7156f528eef0bflorian#define DRM_IOCTL_VERSION		DRM_IOWR(0x00, struct drm_version)
620448cbba56bb995b0dc8030928de7156f528eef0bflorian#define DRM_IOCTL_GET_UNIQUE		DRM_IOWR(0x01, struct drm_unique)
621448cbba56bb995b0dc8030928de7156f528eef0bflorian#define DRM_IOCTL_GET_MAGIC		DRM_IOR( 0x02, struct drm_auth)
622448cbba56bb995b0dc8030928de7156f528eef0bflorian#define DRM_IOCTL_IRQ_BUSID		DRM_IOWR(0x03, struct drm_irq_busid)
623448cbba56bb995b0dc8030928de7156f528eef0bflorian#define DRM_IOCTL_GET_MAP               DRM_IOWR(0x04, struct drm_map)
624448cbba56bb995b0dc8030928de7156f528eef0bflorian#define DRM_IOCTL_GET_CLIENT            DRM_IOWR(0x05, struct drm_client)
6252019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_GET_STATS             DRM_IOR( 0x06, struct drm_stats)
6262019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_SET_VERSION		DRM_IOWR(0x07, struct drm_set_version)
6272019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_MODESET_CTL           DRM_IOW(0x08, struct drm_modeset_ctl)
6282019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_GEM_CLOSE		DRM_IOW (0x09, struct drm_gem_close)
6292019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_GEM_FLINK		DRM_IOWR(0x0a, struct drm_gem_flink)
6302019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_GEM_OPEN		DRM_IOWR(0x0b, struct drm_gem_open)
6312019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
6322019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_SET_UNIQUE		DRM_IOW( 0x10, struct drm_unique)
6332019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_AUTH_MAGIC		DRM_IOW( 0x11, struct drm_auth)
6342019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_BLOCK			DRM_IOWR(0x12, struct drm_block)
6352019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_UNBLOCK		DRM_IOWR(0x13, struct drm_block)
6362019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_CONTROL		DRM_IOW( 0x14, struct drm_control)
6372019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_ADD_MAP		DRM_IOWR(0x15, struct drm_map)
6382019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_ADD_BUFS		DRM_IOWR(0x16, struct drm_buf_desc)
63901ed6e7e73b3f13e8c2bbb037036385f88e4d12eflorian#define DRM_IOCTL_MARK_BUFS		DRM_IOW( 0x17, struct drm_buf_desc)
64001ed6e7e73b3f13e8c2bbb037036385f88e4d12eflorian#define DRM_IOCTL_INFO_BUFS		DRM_IOWR(0x18, struct drm_buf_info)
6412019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_MAP_BUFS		DRM_IOWR(0x19, struct drm_buf_map)
6422019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_FREE_BUFS		DRM_IOW( 0x1a, struct drm_buf_free)
6432019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
6442019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_RM_MAP		DRM_IOW( 0x1b, struct drm_map)
6452019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
6462019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_SET_SAREA_CTX		DRM_IOW( 0x1c, struct drm_ctx_priv_map)
6472019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_GET_SAREA_CTX 	DRM_IOWR(0x1d, struct drm_ctx_priv_map)
6482019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
6492019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_SET_MASTER            DRM_IO(0x1e)
6502019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_DROP_MASTER           DRM_IO(0x1f)
6512019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
6522019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_ADD_CTX		DRM_IOWR(0x20, struct drm_ctx)
6532019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_RM_CTX		DRM_IOWR(0x21, struct drm_ctx)
6542019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_MOD_CTX		DRM_IOW( 0x22, struct drm_ctx)
6552019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_GET_CTX		DRM_IOWR(0x23, struct drm_ctx)
6562019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_SWITCH_CTX		DRM_IOW( 0x24, struct drm_ctx)
6572019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_NEW_CTX		DRM_IOW( 0x25, struct drm_ctx)
6582019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_RES_CTX		DRM_IOWR(0x26, struct drm_ctx_res)
6592019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_ADD_DRAW		DRM_IOWR(0x27, struct drm_draw)
6602019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_RM_DRAW		DRM_IOWR(0x28, struct drm_draw)
6612019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_DMA			DRM_IOWR(0x29, struct drm_dma)
6622019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_LOCK			DRM_IOW( 0x2a, struct drm_lock)
6632019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_UNLOCK		DRM_IOW( 0x2b, struct drm_lock)
6642019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_FINISH		DRM_IOW( 0x2c, struct drm_lock)
6652019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
6662019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_AGP_ACQUIRE		DRM_IO(  0x30)
6672019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_AGP_RELEASE		DRM_IO(  0x31)
668cc491a6e32728eeedba4ba7515ebba6ca83009e4florian#define DRM_IOCTL_AGP_ENABLE		DRM_IOW( 0x32, struct drm_agp_mode)
669cc491a6e32728eeedba4ba7515ebba6ca83009e4florian#define DRM_IOCTL_AGP_INFO		DRM_IOR( 0x33, struct drm_agp_info)
670cc491a6e32728eeedba4ba7515ebba6ca83009e4florian#define DRM_IOCTL_AGP_ALLOC		DRM_IOWR(0x34, struct drm_agp_buffer)
671cc491a6e32728eeedba4ba7515ebba6ca83009e4florian#define DRM_IOCTL_AGP_FREE		DRM_IOW( 0x35, struct drm_agp_buffer)
672cc491a6e32728eeedba4ba7515ebba6ca83009e4florian#define DRM_IOCTL_AGP_BIND		DRM_IOW( 0x36, struct drm_agp_binding)
673cc491a6e32728eeedba4ba7515ebba6ca83009e4florian#define DRM_IOCTL_AGP_UNBIND		DRM_IOW( 0x37, struct drm_agp_binding)
674cc491a6e32728eeedba4ba7515ebba6ca83009e4florian
675cc491a6e32728eeedba4ba7515ebba6ca83009e4florian#define DRM_IOCTL_SG_ALLOC		DRM_IOWR(0x38, struct drm_scatter_gather)
6762019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_SG_FREE		DRM_IOW( 0x39, struct drm_scatter_gather)
6772019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
6782019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_WAIT_VBLANK		DRM_IOWR(0x3a, union drm_wait_vblank)
679cc491a6e32728eeedba4ba7515ebba6ca83009e4florian
680cc491a6e32728eeedba4ba7515ebba6ca83009e4florian#define DRM_IOCTL_UPDATE_DRAW		DRM_IOW(0x3f, struct drm_update_draw)
681cc491a6e32728eeedba4ba7515ebba6ca83009e4florian
682cc491a6e32728eeedba4ba7515ebba6ca83009e4florian#define DRM_IOCTL_MODE_GETRESOURCES	DRM_IOWR(0xA0, struct drm_mode_card_res)
683cc491a6e32728eeedba4ba7515ebba6ca83009e4florian#define DRM_IOCTL_MODE_GETCRTC		DRM_IOWR(0xA1, struct drm_mode_crtc)
684cc491a6e32728eeedba4ba7515ebba6ca83009e4florian#define DRM_IOCTL_MODE_SETCRTC		DRM_IOWR(0xA2, struct drm_mode_crtc)
6852019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_MODE_CURSOR		DRM_IOWR(0xA3, struct drm_mode_cursor)
6862019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_MODE_GETGAMMA		DRM_IOWR(0xA4, struct drm_mode_crtc_lut)
6872019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_MODE_SETGAMMA		DRM_IOWR(0xA5, struct drm_mode_crtc_lut)
6882019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_MODE_GETENCODER	DRM_IOWR(0xA6, struct drm_mode_get_encoder)
689cc491a6e32728eeedba4ba7515ebba6ca83009e4florian#define DRM_IOCTL_MODE_GETCONNECTOR	DRM_IOWR(0xA7, struct drm_mode_get_connector)
690cc491a6e32728eeedba4ba7515ebba6ca83009e4florian#define DRM_IOCTL_MODE_ATTACHMODE	DRM_IOWR(0xA8, struct drm_mode_mode_cmd)
691cc491a6e32728eeedba4ba7515ebba6ca83009e4florian#define DRM_IOCTL_MODE_DETACHMODE	DRM_IOWR(0xA9, struct drm_mode_mode_cmd)
692cc491a6e32728eeedba4ba7515ebba6ca83009e4florian
693cc491a6e32728eeedba4ba7515ebba6ca83009e4florian#define DRM_IOCTL_MODE_GETPROPERTY	DRM_IOWR(0xAA, struct drm_mode_get_property)
694cc491a6e32728eeedba4ba7515ebba6ca83009e4florian#define DRM_IOCTL_MODE_SETPROPERTY	DRM_IOWR(0xAB, struct drm_mode_connector_set_property)
6952019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_MODE_GETPROPBLOB	DRM_IOWR(0xAC, struct drm_mode_get_blob)
6962019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#define DRM_IOCTL_MODE_GETFB		DRM_IOWR(0xAD, struct drm_mode_fb_cmd)
6979fcff4cc9bb9aeea78c5a4ae4b6cf1fb168d95acflorian#define DRM_IOCTL_MODE_ADDFB		DRM_IOWR(0xAE, struct drm_mode_fb_cmd)
698cc491a6e32728eeedba4ba7515ebba6ca83009e4florian#define DRM_IOCTL_MODE_RMFB		DRM_IOWR(0xAF, unsigned int)
699cc491a6e32728eeedba4ba7515ebba6ca83009e4florian#define DRM_IOCTL_MODE_PAGE_FLIP	DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip)
700cc491a6e32728eeedba4ba7515ebba6ca83009e4florian#define DRM_IOCTL_MODE_DIRTYFB		DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd)
701cc491a6e32728eeedba4ba7515ebba6ca83009e4florian
702cc491a6e32728eeedba4ba7515ebba6ca83009e4florian/*@}*/
703cc491a6e32728eeedba4ba7515ebba6ca83009e4florian
7042019a976f07ff418dde2dfc7cc74667ef66d7764sewardj/**
7052019a976f07ff418dde2dfc7cc74667ef66d7764sewardj * Device specific ioctls should only be in their respective headers
7061239020c948a6e20faaa8d0fa5dea44302e18f8aflorian * The device specific ioctl range is from 0x40 to 0x99.
7071239020c948a6e20faaa8d0fa5dea44302e18f8aflorian * Generic IOCTLS restart at 0xA0.
7081239020c948a6e20faaa8d0fa5dea44302e18f8aflorian *
7091239020c948a6e20faaa8d0fa5dea44302e18f8aflorian * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and
7101239020c948a6e20faaa8d0fa5dea44302e18f8aflorian * drmCommandReadWrite().
7111239020c948a6e20faaa8d0fa5dea44302e18f8aflorian */
7121239020c948a6e20faaa8d0fa5dea44302e18f8aflorian#define DRM_COMMAND_BASE                0x40
7131239020c948a6e20faaa8d0fa5dea44302e18f8aflorian#define DRM_COMMAND_END			0xA0
7141239020c948a6e20faaa8d0fa5dea44302e18f8aflorian
7151239020c948a6e20faaa8d0fa5dea44302e18f8aflorian/**
7161239020c948a6e20faaa8d0fa5dea44302e18f8aflorian * Header for events written back to userspace on the drm fd.  The
717a52e37e8547ed42060a262d510047eea202dbe9fsewardj * type defines the type of event, the length specifies the total
718ad43b3aab3af108802ea091bc58d12903ec002a8florian * length of the event (including the header), and user_data is
719ad43b3aab3af108802ea091bc58d12903ec002a8florian * typically a 64 bit value passed with the ioctl that triggered the
720a52e37e8547ed42060a262d510047eea202dbe9fsewardj * event.  A read on the drm fd will always only return complete
721a52e37e8547ed42060a262d510047eea202dbe9fsewardj * events, that is, if for example the read buffer is 100 bytes, and
722125e20dc4036944b19bed3e98a15d05cce8c29f6florian * there are two 64 byte events pending, only one will be returned.
723125e20dc4036944b19bed3e98a15d05cce8c29f6florian *
7242c74d242132a5046da515fc925723ed72118a2a5florian * Event types 0 - 0x7fffffff are generic drm events, 0x80000000 and
7252c74d242132a5046da515fc925723ed72118a2a5florian * up are chipset specific.
726c8e4f56ac6b0bcbb6cc3ac8b36f52d4b72932b46florian */
727c8e4f56ac6b0bcbb6cc3ac8b36f52d4b72932b46florianstruct drm_event {
728c8e4f56ac6b0bcbb6cc3ac8b36f52d4b72932b46florian	__u32 type;
729c8e4f56ac6b0bcbb6cc3ac8b36f52d4b72932b46florian	__u32 length;
7308844a6329d275814456e3a2a5a7bffac75da0957florian};
7318844a6329d275814456e3a2a5a7bffac75da0957florian
7328844a6329d275814456e3a2a5a7bffac75da0957florian#define DRM_EVENT_VBLANK 0x01
7338844a6329d275814456e3a2a5a7bffac75da0957florian#define DRM_EVENT_FLIP_COMPLETE 0x02
7348844a6329d275814456e3a2a5a7bffac75da0957florian
7358844a6329d275814456e3a2a5a7bffac75da0957florianstruct drm_event_vblank {
7368844a6329d275814456e3a2a5a7bffac75da0957florian	struct drm_event base;
7378844a6329d275814456e3a2a5a7bffac75da0957florian	__u64 user_data;
7388844a6329d275814456e3a2a5a7bffac75da0957florian	__u32 tv_sec;
7398844a6329d275814456e3a2a5a7bffac75da0957florian	__u32 tv_usec;
7408844a6329d275814456e3a2a5a7bffac75da0957florian	__u32 sequence;
7418844a6329d275814456e3a2a5a7bffac75da0957florian	__u32 reserved;
7428844a6329d275814456e3a2a5a7bffac75da0957florian};
7438844a6329d275814456e3a2a5a7bffac75da0957florian
7448844a6329d275814456e3a2a5a7bffac75da0957florian/* typedef area */
7458844a6329d275814456e3a2a5a7bffac75da0957floriantypedef struct drm_clip_rect drm_clip_rect_t;
7468844a6329d275814456e3a2a5a7bffac75da0957floriantypedef struct drm_drawable_info drm_drawable_info_t;
7478844a6329d275814456e3a2a5a7bffac75da0957floriantypedef struct drm_tex_region drm_tex_region_t;
7488844a6329d275814456e3a2a5a7bffac75da0957floriantypedef struct drm_hw_lock drm_hw_lock_t;
7498844a6329d275814456e3a2a5a7bffac75da0957floriantypedef struct drm_version drm_version_t;
7508844a6329d275814456e3a2a5a7bffac75da0957floriantypedef struct drm_unique drm_unique_t;
7518844a6329d275814456e3a2a5a7bffac75da0957floriantypedef struct drm_list drm_list_t;
7528844a6329d275814456e3a2a5a7bffac75da0957floriantypedef struct drm_block drm_block_t;
7532019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef struct drm_control drm_control_t;
7542019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef enum drm_map_type drm_map_type_t;
7552019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef enum drm_map_flags drm_map_flags_t;
7562019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef struct drm_ctx_priv_map drm_ctx_priv_map_t;
7572019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef struct drm_map drm_map_t;
7582019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef struct drm_client drm_client_t;
7592019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef enum drm_stat_type drm_stat_type_t;
7602019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef struct drm_stats drm_stats_t;
7612019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef enum drm_lock_flags drm_lock_flags_t;
7622019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef struct drm_lock drm_lock_t;
7632019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef enum drm_dma_flags drm_dma_flags_t;
7642019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef struct drm_buf_desc drm_buf_desc_t;
7652019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef struct drm_buf_info drm_buf_info_t;
7662019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef struct drm_buf_free drm_buf_free_t;
7672019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef struct drm_buf_pub drm_buf_pub_t;
7682019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef struct drm_buf_map drm_buf_map_t;
7692019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef struct drm_dma drm_dma_t;
7702019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef union drm_wait_vblank drm_wait_vblank_t;
7712019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef struct drm_agp_mode drm_agp_mode_t;
7722019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef enum drm_ctx_flags drm_ctx_flags_t;
7732019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef struct drm_ctx drm_ctx_t;
7742019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef struct drm_ctx_res drm_ctx_res_t;
7752019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef struct drm_draw drm_draw_t;
7762019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef struct drm_update_draw drm_update_draw_t;
7772019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef struct drm_auth drm_auth_t;
7782019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef struct drm_irq_busid drm_irq_busid_t;
7792019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef enum drm_vblank_seq_type drm_vblank_seq_type_t;
7802019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
781b4df768d103fab8a7cb260812cde6789d1128878floriantypedef struct drm_agp_buffer drm_agp_buffer_t;
7822019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef struct drm_agp_binding drm_agp_binding_t;
7832019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef struct drm_agp_info drm_agp_info_t;
7842019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef struct drm_scatter_gather drm_scatter_gather_t;
7852019a976f07ff418dde2dfc7cc74667ef66d7764sewardjtypedef struct drm_set_version drm_set_version_t;
7862019a976f07ff418dde2dfc7cc74667ef66d7764sewardj
7872019a976f07ff418dde2dfc7cc74667ef66d7764sewardj#endif
7882019a976f07ff418dde2dfc7cc74667ef66d7764sewardj