17ec681f3Smrg/*
201e04c3fSmrg * Header for the Direct Rendering Manager
301e04c3fSmrg *
47ec681f3Smrg * Author: Rickard E. (Rik) Faith <faith@valinux.com>
501e04c3fSmrg *
67ec681f3Smrg * Acknowledgments:
77ec681f3Smrg * Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic cmpxchg.
801e04c3fSmrg */
901e04c3fSmrg
1001e04c3fSmrg/*
1101e04c3fSmrg * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
1201e04c3fSmrg * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
1301e04c3fSmrg * All rights reserved.
1401e04c3fSmrg *
1501e04c3fSmrg * Permission is hereby granted, free of charge, to any person obtaining a
1601e04c3fSmrg * copy of this software and associated documentation files (the "Software"),
1701e04c3fSmrg * to deal in the Software without restriction, including without limitation
1801e04c3fSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
1901e04c3fSmrg * and/or sell copies of the Software, and to permit persons to whom the
2001e04c3fSmrg * Software is furnished to do so, subject to the following conditions:
2101e04c3fSmrg *
2201e04c3fSmrg * The above copyright notice and this permission notice (including the next
2301e04c3fSmrg * paragraph) shall be included in all copies or substantial portions of the
2401e04c3fSmrg * Software.
2501e04c3fSmrg *
2601e04c3fSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2701e04c3fSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2801e04c3fSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
2901e04c3fSmrg * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
3001e04c3fSmrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3101e04c3fSmrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3201e04c3fSmrg * OTHER DEALINGS IN THE SOFTWARE.
3301e04c3fSmrg */
3401e04c3fSmrg
3501e04c3fSmrg#ifndef _DRM_H_
3601e04c3fSmrg#define _DRM_H_
3701e04c3fSmrg
3801e04c3fSmrg#if   defined(__linux__)
3901e04c3fSmrg
4001e04c3fSmrg#include <linux/types.h>
4101e04c3fSmrg#include <asm/ioctl.h>
4201e04c3fSmrgtypedef unsigned int drm_handle_t;
4301e04c3fSmrg
4401e04c3fSmrg#else /* One of the BSDs */
4501e04c3fSmrg
467ec681f3Smrg#include <stdint.h>
4701e04c3fSmrg#include <sys/ioccom.h>
4801e04c3fSmrg#include <sys/types.h>
4901e04c3fSmrgtypedef int8_t   __s8;
5001e04c3fSmrgtypedef uint8_t  __u8;
5101e04c3fSmrgtypedef int16_t  __s16;
5201e04c3fSmrgtypedef uint16_t __u16;
5301e04c3fSmrgtypedef int32_t  __s32;
5401e04c3fSmrgtypedef uint32_t __u32;
5501e04c3fSmrgtypedef int64_t  __s64;
5601e04c3fSmrgtypedef uint64_t __u64;
5701e04c3fSmrgtypedef size_t   __kernel_size_t;
5801e04c3fSmrgtypedef unsigned long drm_handle_t;
5901e04c3fSmrg
6001e04c3fSmrg#endif
6101e04c3fSmrg
6201e04c3fSmrg#if defined(__cplusplus)
6301e04c3fSmrgextern "C" {
6401e04c3fSmrg#endif
6501e04c3fSmrg
6601e04c3fSmrg#define DRM_NAME	"drm"	  /**< Name in kernel, /dev, and /proc */
6701e04c3fSmrg#define DRM_MIN_ORDER	5	  /**< At least 2^5 bytes = 32 bytes */
6801e04c3fSmrg#define DRM_MAX_ORDER	22	  /**< Up to 2^22 bytes = 4MB */
6901e04c3fSmrg#define DRM_RAM_PERCENT 10	  /**< How much system ram can we lock? */
7001e04c3fSmrg
7101e04c3fSmrg#define _DRM_LOCK_HELD	0x80000000U /**< Hardware lock is held */
7201e04c3fSmrg#define _DRM_LOCK_CONT	0x40000000U /**< Hardware lock is contended */
7301e04c3fSmrg#define _DRM_LOCK_IS_HELD(lock)	   ((lock) & _DRM_LOCK_HELD)
7401e04c3fSmrg#define _DRM_LOCK_IS_CONT(lock)	   ((lock) & _DRM_LOCK_CONT)
7501e04c3fSmrg#define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT))
7601e04c3fSmrg
7701e04c3fSmrgtypedef unsigned int drm_context_t;
7801e04c3fSmrgtypedef unsigned int drm_drawable_t;
7901e04c3fSmrgtypedef unsigned int drm_magic_t;
8001e04c3fSmrg
817ec681f3Smrg/*
8201e04c3fSmrg * Cliprect.
8301e04c3fSmrg *
8401e04c3fSmrg * \warning: If you change this structure, make sure you change
8501e04c3fSmrg * XF86DRIClipRectRec in the server as well
8601e04c3fSmrg *
8701e04c3fSmrg * \note KW: Actually it's illegal to change either for
8801e04c3fSmrg * backwards-compatibility reasons.
8901e04c3fSmrg */
9001e04c3fSmrgstruct drm_clip_rect {
9101e04c3fSmrg	unsigned short x1;
9201e04c3fSmrg	unsigned short y1;
9301e04c3fSmrg	unsigned short x2;
9401e04c3fSmrg	unsigned short y2;
9501e04c3fSmrg};
9601e04c3fSmrg
977ec681f3Smrg/*
9801e04c3fSmrg * Drawable information.
9901e04c3fSmrg */
10001e04c3fSmrgstruct drm_drawable_info {
10101e04c3fSmrg	unsigned int num_rects;
10201e04c3fSmrg	struct drm_clip_rect *rects;
10301e04c3fSmrg};
10401e04c3fSmrg
1057ec681f3Smrg/*
10601e04c3fSmrg * Texture region,
10701e04c3fSmrg */
10801e04c3fSmrgstruct drm_tex_region {
10901e04c3fSmrg	unsigned char next;
11001e04c3fSmrg	unsigned char prev;
11101e04c3fSmrg	unsigned char in_use;
11201e04c3fSmrg	unsigned char padding;
11301e04c3fSmrg	unsigned int age;
11401e04c3fSmrg};
11501e04c3fSmrg
1167ec681f3Smrg/*
11701e04c3fSmrg * Hardware lock.
11801e04c3fSmrg *
11901e04c3fSmrg * The lock structure is a simple cache-line aligned integer.  To avoid
12001e04c3fSmrg * processor bus contention on a multiprocessor system, there should not be any
12101e04c3fSmrg * other data stored in the same cache line.
12201e04c3fSmrg */
12301e04c3fSmrgstruct drm_hw_lock {
12401e04c3fSmrg	__volatile__ unsigned int lock;		/**< lock variable */
12501e04c3fSmrg	char padding[60];			/**< Pad to cache line */
12601e04c3fSmrg};
12701e04c3fSmrg
1287ec681f3Smrg/*
12901e04c3fSmrg * DRM_IOCTL_VERSION ioctl argument type.
13001e04c3fSmrg *
13101e04c3fSmrg * \sa drmGetVersion().
13201e04c3fSmrg */
13301e04c3fSmrgstruct drm_version {
13401e04c3fSmrg	int version_major;	  /**< Major version */
13501e04c3fSmrg	int version_minor;	  /**< Minor version */
13601e04c3fSmrg	int version_patchlevel;	  /**< Patch level */
13701e04c3fSmrg	__kernel_size_t name_len;	  /**< Length of name buffer */
13801e04c3fSmrg	char *name;	  /**< Name of driver */
13901e04c3fSmrg	__kernel_size_t date_len;	  /**< Length of date buffer */
14001e04c3fSmrg	char *date;	  /**< User-space buffer to hold date */
14101e04c3fSmrg	__kernel_size_t desc_len;	  /**< Length of desc buffer */
14201e04c3fSmrg	char *desc;	  /**< User-space buffer to hold desc */
14301e04c3fSmrg};
14401e04c3fSmrg
1457ec681f3Smrg/*
14601e04c3fSmrg * DRM_IOCTL_GET_UNIQUE ioctl argument type.
14701e04c3fSmrg *
14801e04c3fSmrg * \sa drmGetBusid() and drmSetBusId().
14901e04c3fSmrg */
15001e04c3fSmrgstruct drm_unique {
15101e04c3fSmrg	__kernel_size_t unique_len;	  /**< Length of unique */
15201e04c3fSmrg	char *unique;	  /**< Unique name for driver instantiation */
15301e04c3fSmrg};
15401e04c3fSmrg
15501e04c3fSmrgstruct drm_list {
15601e04c3fSmrg	int count;		  /**< Length of user-space structures */
15701e04c3fSmrg	struct drm_version *version;
15801e04c3fSmrg};
15901e04c3fSmrg
16001e04c3fSmrgstruct drm_block {
16101e04c3fSmrg	int unused;
16201e04c3fSmrg};
16301e04c3fSmrg
1647ec681f3Smrg/*
16501e04c3fSmrg * DRM_IOCTL_CONTROL ioctl argument type.
16601e04c3fSmrg *
16701e04c3fSmrg * \sa drmCtlInstHandler() and drmCtlUninstHandler().
16801e04c3fSmrg */
16901e04c3fSmrgstruct drm_control {
17001e04c3fSmrg	enum {
17101e04c3fSmrg		DRM_ADD_COMMAND,
17201e04c3fSmrg		DRM_RM_COMMAND,
17301e04c3fSmrg		DRM_INST_HANDLER,
17401e04c3fSmrg		DRM_UNINST_HANDLER
17501e04c3fSmrg	} func;
17601e04c3fSmrg	int irq;
17701e04c3fSmrg};
17801e04c3fSmrg
1797ec681f3Smrg/*
18001e04c3fSmrg * Type of memory to map.
18101e04c3fSmrg */
18201e04c3fSmrgenum drm_map_type {
18301e04c3fSmrg	_DRM_FRAME_BUFFER = 0,	  /**< WC (no caching), no core dump */
18401e04c3fSmrg	_DRM_REGISTERS = 1,	  /**< no caching, no core dump */
18501e04c3fSmrg	_DRM_SHM = 2,		  /**< shared, cached */
18601e04c3fSmrg	_DRM_AGP = 3,		  /**< AGP/GART */
18701e04c3fSmrg	_DRM_SCATTER_GATHER = 4,  /**< Scatter/gather memory for PCI DMA */
18801e04c3fSmrg	_DRM_CONSISTENT = 5	  /**< Consistent memory for PCI DMA */
18901e04c3fSmrg};
19001e04c3fSmrg
1917ec681f3Smrg/*
19201e04c3fSmrg * Memory mapping flags.
19301e04c3fSmrg */
19401e04c3fSmrgenum drm_map_flags {
19501e04c3fSmrg	_DRM_RESTRICTED = 0x01,	     /**< Cannot be mapped to user-virtual */
19601e04c3fSmrg	_DRM_READ_ONLY = 0x02,
19701e04c3fSmrg	_DRM_LOCKED = 0x04,	     /**< shared, cached, locked */
19801e04c3fSmrg	_DRM_KERNEL = 0x08,	     /**< kernel requires access */
19901e04c3fSmrg	_DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */
20001e04c3fSmrg	_DRM_CONTAINS_LOCK = 0x20,   /**< SHM page that contains lock */
20101e04c3fSmrg	_DRM_REMOVABLE = 0x40,	     /**< Removable mapping */
20201e04c3fSmrg	_DRM_DRIVER = 0x80	     /**< Managed by driver */
20301e04c3fSmrg};
20401e04c3fSmrg
20501e04c3fSmrgstruct drm_ctx_priv_map {
20601e04c3fSmrg	unsigned int ctx_id;	 /**< Context requesting private mapping */
20701e04c3fSmrg	void *handle;		 /**< Handle of map */
20801e04c3fSmrg};
20901e04c3fSmrg
2107ec681f3Smrg/*
21101e04c3fSmrg * DRM_IOCTL_GET_MAP, DRM_IOCTL_ADD_MAP and DRM_IOCTL_RM_MAP ioctls
21201e04c3fSmrg * argument type.
21301e04c3fSmrg *
21401e04c3fSmrg * \sa drmAddMap().
21501e04c3fSmrg */
21601e04c3fSmrgstruct drm_map {
21701e04c3fSmrg	unsigned long offset;	 /**< Requested physical address (0 for SAREA)*/
21801e04c3fSmrg	unsigned long size;	 /**< Requested physical size (bytes) */
21901e04c3fSmrg	enum drm_map_type type;	 /**< Type of memory to map */
22001e04c3fSmrg	enum drm_map_flags flags;	 /**< Flags */
22101e04c3fSmrg	void *handle;		 /**< User-space: "Handle" to pass to mmap() */
22201e04c3fSmrg				 /**< Kernel-space: kernel-virtual address */
22301e04c3fSmrg	int mtrr;		 /**< MTRR slot used */
22401e04c3fSmrg	/*   Private data */
22501e04c3fSmrg};
22601e04c3fSmrg
2277ec681f3Smrg/*
22801e04c3fSmrg * DRM_IOCTL_GET_CLIENT ioctl argument type.
22901e04c3fSmrg */
23001e04c3fSmrgstruct drm_client {
23101e04c3fSmrg	int idx;		/**< Which client desired? */
23201e04c3fSmrg	int auth;		/**< Is client authenticated? */
23301e04c3fSmrg	unsigned long pid;	/**< Process ID */
23401e04c3fSmrg	unsigned long uid;	/**< User ID */
23501e04c3fSmrg	unsigned long magic;	/**< Magic */
23601e04c3fSmrg	unsigned long iocs;	/**< Ioctl count */
23701e04c3fSmrg};
23801e04c3fSmrg
23901e04c3fSmrgenum drm_stat_type {
24001e04c3fSmrg	_DRM_STAT_LOCK,
24101e04c3fSmrg	_DRM_STAT_OPENS,
24201e04c3fSmrg	_DRM_STAT_CLOSES,
24301e04c3fSmrg	_DRM_STAT_IOCTLS,
24401e04c3fSmrg	_DRM_STAT_LOCKS,
24501e04c3fSmrg	_DRM_STAT_UNLOCKS,
24601e04c3fSmrg	_DRM_STAT_VALUE,	/**< Generic value */
24701e04c3fSmrg	_DRM_STAT_BYTE,		/**< Generic byte counter (1024bytes/K) */
24801e04c3fSmrg	_DRM_STAT_COUNT,	/**< Generic non-byte counter (1000/k) */
24901e04c3fSmrg
25001e04c3fSmrg	_DRM_STAT_IRQ,		/**< IRQ */
25101e04c3fSmrg	_DRM_STAT_PRIMARY,	/**< Primary DMA bytes */
25201e04c3fSmrg	_DRM_STAT_SECONDARY,	/**< Secondary DMA bytes */
25301e04c3fSmrg	_DRM_STAT_DMA,		/**< DMA */
25401e04c3fSmrg	_DRM_STAT_SPECIAL,	/**< Special DMA (e.g., priority or polled) */
25501e04c3fSmrg	_DRM_STAT_MISSED	/**< Missed DMA opportunity */
25601e04c3fSmrg	    /* Add to the *END* of the list */
25701e04c3fSmrg};
25801e04c3fSmrg
2597ec681f3Smrg/*
26001e04c3fSmrg * DRM_IOCTL_GET_STATS ioctl argument type.
26101e04c3fSmrg */
26201e04c3fSmrgstruct drm_stats {
26301e04c3fSmrg	unsigned long count;
26401e04c3fSmrg	struct {
26501e04c3fSmrg		unsigned long value;
26601e04c3fSmrg		enum drm_stat_type type;
26701e04c3fSmrg	} data[15];
26801e04c3fSmrg};
26901e04c3fSmrg
2707ec681f3Smrg/*
27101e04c3fSmrg * Hardware locking flags.
27201e04c3fSmrg */
27301e04c3fSmrgenum drm_lock_flags {
27401e04c3fSmrg	_DRM_LOCK_READY = 0x01,	     /**< Wait until hardware is ready for DMA */
27501e04c3fSmrg	_DRM_LOCK_QUIESCENT = 0x02,  /**< Wait until hardware quiescent */
27601e04c3fSmrg	_DRM_LOCK_FLUSH = 0x04,	     /**< Flush this context's DMA queue first */
27701e04c3fSmrg	_DRM_LOCK_FLUSH_ALL = 0x08,  /**< Flush all DMA queues first */
27801e04c3fSmrg	/* These *HALT* flags aren't supported yet
27901e04c3fSmrg	   -- they will be used to support the
28001e04c3fSmrg	   full-screen DGA-like mode. */
28101e04c3fSmrg	_DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */
28201e04c3fSmrg	_DRM_HALT_CUR_QUEUES = 0x20  /**< Halt all current queues */
28301e04c3fSmrg};
28401e04c3fSmrg
2857ec681f3Smrg/*
28601e04c3fSmrg * DRM_IOCTL_LOCK, DRM_IOCTL_UNLOCK and DRM_IOCTL_FINISH ioctl argument type.
28701e04c3fSmrg *
28801e04c3fSmrg * \sa drmGetLock() and drmUnlock().
28901e04c3fSmrg */
29001e04c3fSmrgstruct drm_lock {
29101e04c3fSmrg	int context;
29201e04c3fSmrg	enum drm_lock_flags flags;
29301e04c3fSmrg};
29401e04c3fSmrg
2957ec681f3Smrg/*
29601e04c3fSmrg * DMA flags
29701e04c3fSmrg *
29801e04c3fSmrg * \warning
29901e04c3fSmrg * These values \e must match xf86drm.h.
30001e04c3fSmrg *
30101e04c3fSmrg * \sa drm_dma.
30201e04c3fSmrg */
30301e04c3fSmrgenum drm_dma_flags {
30401e04c3fSmrg	/* Flags for DMA buffer dispatch */
30501e04c3fSmrg	_DRM_DMA_BLOCK = 0x01,	      /**<
30601e04c3fSmrg				       * Block until buffer dispatched.
30701e04c3fSmrg				       *
30801e04c3fSmrg				       * \note The buffer may not yet have
30901e04c3fSmrg				       * been processed by the hardware --
31001e04c3fSmrg				       * getting a hardware lock with the
31101e04c3fSmrg				       * hardware quiescent will ensure
31201e04c3fSmrg				       * that the buffer has been
31301e04c3fSmrg				       * processed.
31401e04c3fSmrg				       */
31501e04c3fSmrg	_DRM_DMA_WHILE_LOCKED = 0x02, /**< Dispatch while lock held */
31601e04c3fSmrg	_DRM_DMA_PRIORITY = 0x04,     /**< High priority dispatch */
31701e04c3fSmrg
31801e04c3fSmrg	/* Flags for DMA buffer request */
31901e04c3fSmrg	_DRM_DMA_WAIT = 0x10,	      /**< Wait for free buffers */
32001e04c3fSmrg	_DRM_DMA_SMALLER_OK = 0x20,   /**< Smaller-than-requested buffers OK */
32101e04c3fSmrg	_DRM_DMA_LARGER_OK = 0x40     /**< Larger-than-requested buffers OK */
32201e04c3fSmrg};
32301e04c3fSmrg
3247ec681f3Smrg/*
32501e04c3fSmrg * DRM_IOCTL_ADD_BUFS and DRM_IOCTL_MARK_BUFS ioctl argument type.
32601e04c3fSmrg *
32701e04c3fSmrg * \sa drmAddBufs().
32801e04c3fSmrg */
32901e04c3fSmrgstruct drm_buf_desc {
33001e04c3fSmrg	int count;		 /**< Number of buffers of this size */
33101e04c3fSmrg	int size;		 /**< Size in bytes */
33201e04c3fSmrg	int low_mark;		 /**< Low water mark */
33301e04c3fSmrg	int high_mark;		 /**< High water mark */
33401e04c3fSmrg	enum {
33501e04c3fSmrg		_DRM_PAGE_ALIGN = 0x01,	/**< Align on page boundaries for DMA */
33601e04c3fSmrg		_DRM_AGP_BUFFER = 0x02,	/**< Buffer is in AGP space */
33701e04c3fSmrg		_DRM_SG_BUFFER = 0x04,	/**< Scatter/gather memory buffer */
33801e04c3fSmrg		_DRM_FB_BUFFER = 0x08,	/**< Buffer is in frame buffer */
33901e04c3fSmrg		_DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */
34001e04c3fSmrg	} flags;
34101e04c3fSmrg	unsigned long agp_start; /**<
34201e04c3fSmrg				  * Start address of where the AGP buffers are
34301e04c3fSmrg				  * in the AGP aperture
34401e04c3fSmrg				  */
34501e04c3fSmrg};
34601e04c3fSmrg
3477ec681f3Smrg/*
34801e04c3fSmrg * DRM_IOCTL_INFO_BUFS ioctl argument type.
34901e04c3fSmrg */
35001e04c3fSmrgstruct drm_buf_info {
35101e04c3fSmrg	int count;		/**< Entries in list */
35201e04c3fSmrg	struct drm_buf_desc *list;
35301e04c3fSmrg};
35401e04c3fSmrg
3557ec681f3Smrg/*
35601e04c3fSmrg * DRM_IOCTL_FREE_BUFS ioctl argument type.
35701e04c3fSmrg */
35801e04c3fSmrgstruct drm_buf_free {
35901e04c3fSmrg	int count;
36001e04c3fSmrg	int *list;
36101e04c3fSmrg};
36201e04c3fSmrg
3637ec681f3Smrg/*
36401e04c3fSmrg * Buffer information
36501e04c3fSmrg *
36601e04c3fSmrg * \sa drm_buf_map.
36701e04c3fSmrg */
36801e04c3fSmrgstruct drm_buf_pub {
36901e04c3fSmrg	int idx;		       /**< Index into the master buffer list */
37001e04c3fSmrg	int total;		       /**< Buffer size */
37101e04c3fSmrg	int used;		       /**< Amount of buffer in use (for DMA) */
37201e04c3fSmrg	void *address;	       /**< Address of buffer */
37301e04c3fSmrg};
37401e04c3fSmrg
3757ec681f3Smrg/*
37601e04c3fSmrg * DRM_IOCTL_MAP_BUFS ioctl argument type.
37701e04c3fSmrg */
37801e04c3fSmrgstruct drm_buf_map {
37901e04c3fSmrg	int count;		/**< Length of the buffer list */
38001e04c3fSmrg#ifdef __cplusplus
38101e04c3fSmrg	void *virt;
38201e04c3fSmrg#else
38301e04c3fSmrg	void *virtual;		/**< Mmap'd area in user-virtual */
38401e04c3fSmrg#endif
38501e04c3fSmrg	struct drm_buf_pub *list;	/**< Buffer information */
38601e04c3fSmrg};
38701e04c3fSmrg
3887ec681f3Smrg/*
38901e04c3fSmrg * DRM_IOCTL_DMA ioctl argument type.
39001e04c3fSmrg *
39101e04c3fSmrg * Indices here refer to the offset into the buffer list in drm_buf_get.
39201e04c3fSmrg *
39301e04c3fSmrg * \sa drmDMA().
39401e04c3fSmrg */
39501e04c3fSmrgstruct drm_dma {
39601e04c3fSmrg	int context;			  /**< Context handle */
39701e04c3fSmrg	int send_count;			  /**< Number of buffers to send */
39801e04c3fSmrg	int *send_indices;	  /**< List of handles to buffers */
39901e04c3fSmrg	int *send_sizes;		  /**< Lengths of data to send */
40001e04c3fSmrg	enum drm_dma_flags flags;	  /**< Flags */
40101e04c3fSmrg	int request_count;		  /**< Number of buffers requested */
40201e04c3fSmrg	int request_size;		  /**< Desired size for buffers */
40301e04c3fSmrg	int *request_indices;	  /**< Buffer information */
40401e04c3fSmrg	int *request_sizes;
40501e04c3fSmrg	int granted_count;		  /**< Number of buffers granted */
40601e04c3fSmrg};
40701e04c3fSmrg
40801e04c3fSmrgenum drm_ctx_flags {
40901e04c3fSmrg	_DRM_CONTEXT_PRESERVED = 0x01,
41001e04c3fSmrg	_DRM_CONTEXT_2DONLY = 0x02
41101e04c3fSmrg};
41201e04c3fSmrg
4137ec681f3Smrg/*
41401e04c3fSmrg * DRM_IOCTL_ADD_CTX ioctl argument type.
41501e04c3fSmrg *
41601e04c3fSmrg * \sa drmCreateContext() and drmDestroyContext().
41701e04c3fSmrg */
41801e04c3fSmrgstruct drm_ctx {
41901e04c3fSmrg	drm_context_t handle;
42001e04c3fSmrg	enum drm_ctx_flags flags;
42101e04c3fSmrg};
42201e04c3fSmrg
4237ec681f3Smrg/*
42401e04c3fSmrg * DRM_IOCTL_RES_CTX ioctl argument type.
42501e04c3fSmrg */
42601e04c3fSmrgstruct drm_ctx_res {
42701e04c3fSmrg	int count;
42801e04c3fSmrg	struct drm_ctx *contexts;
42901e04c3fSmrg};
43001e04c3fSmrg
4317ec681f3Smrg/*
43201e04c3fSmrg * DRM_IOCTL_ADD_DRAW and DRM_IOCTL_RM_DRAW ioctl argument type.
43301e04c3fSmrg */
43401e04c3fSmrgstruct drm_draw {
43501e04c3fSmrg	drm_drawable_t handle;
43601e04c3fSmrg};
43701e04c3fSmrg
4387ec681f3Smrg/*
43901e04c3fSmrg * DRM_IOCTL_UPDATE_DRAW ioctl argument type.
44001e04c3fSmrg */
44101e04c3fSmrgtypedef enum {
44201e04c3fSmrg	DRM_DRAWABLE_CLIPRECTS
44301e04c3fSmrg} drm_drawable_info_type_t;
44401e04c3fSmrg
44501e04c3fSmrgstruct drm_update_draw {
44601e04c3fSmrg	drm_drawable_t handle;
44701e04c3fSmrg	unsigned int type;
44801e04c3fSmrg	unsigned int num;
44901e04c3fSmrg	unsigned long long data;
45001e04c3fSmrg};
45101e04c3fSmrg
4527ec681f3Smrg/*
45301e04c3fSmrg * DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type.
45401e04c3fSmrg */
45501e04c3fSmrgstruct drm_auth {
45601e04c3fSmrg	drm_magic_t magic;
45701e04c3fSmrg};
45801e04c3fSmrg
4597ec681f3Smrg/*
46001e04c3fSmrg * DRM_IOCTL_IRQ_BUSID ioctl argument type.
46101e04c3fSmrg *
46201e04c3fSmrg * \sa drmGetInterruptFromBusID().
46301e04c3fSmrg */
46401e04c3fSmrgstruct drm_irq_busid {
46501e04c3fSmrg	int irq;	/**< IRQ number */
46601e04c3fSmrg	int busnum;	/**< bus number */
46701e04c3fSmrg	int devnum;	/**< device number */
46801e04c3fSmrg	int funcnum;	/**< function number */
46901e04c3fSmrg};
47001e04c3fSmrg
47101e04c3fSmrgenum drm_vblank_seq_type {
47201e04c3fSmrg	_DRM_VBLANK_ABSOLUTE = 0x0,	/**< Wait for specific vblank sequence number */
47301e04c3fSmrg	_DRM_VBLANK_RELATIVE = 0x1,	/**< Wait for given number of vblanks */
47401e04c3fSmrg	/* bits 1-6 are reserved for high crtcs */
47501e04c3fSmrg	_DRM_VBLANK_HIGH_CRTC_MASK = 0x0000003e,
47601e04c3fSmrg	_DRM_VBLANK_EVENT = 0x4000000,   /**< Send event instead of blocking */
47701e04c3fSmrg	_DRM_VBLANK_FLIP = 0x8000000,   /**< Scheduled buffer swap should flip */
47801e04c3fSmrg	_DRM_VBLANK_NEXTONMISS = 0x10000000,	/**< If missed, wait for next vblank */
47901e04c3fSmrg	_DRM_VBLANK_SECONDARY = 0x20000000,	/**< Secondary display controller */
48001e04c3fSmrg	_DRM_VBLANK_SIGNAL = 0x40000000	/**< Send signal instead of blocking, unsupported */
48101e04c3fSmrg};
48201e04c3fSmrg#define _DRM_VBLANK_HIGH_CRTC_SHIFT 1
48301e04c3fSmrg
48401e04c3fSmrg#define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE)
48501e04c3fSmrg#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \
48601e04c3fSmrg				_DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS)
48701e04c3fSmrg
48801e04c3fSmrgstruct drm_wait_vblank_request {
48901e04c3fSmrg	enum drm_vblank_seq_type type;
49001e04c3fSmrg	unsigned int sequence;
49101e04c3fSmrg	unsigned long signal;
49201e04c3fSmrg};
49301e04c3fSmrg
49401e04c3fSmrgstruct drm_wait_vblank_reply {
49501e04c3fSmrg	enum drm_vblank_seq_type type;
49601e04c3fSmrg	unsigned int sequence;
49701e04c3fSmrg	long tval_sec;
49801e04c3fSmrg	long tval_usec;
49901e04c3fSmrg};
50001e04c3fSmrg
5017ec681f3Smrg/*
50201e04c3fSmrg * DRM_IOCTL_WAIT_VBLANK ioctl argument type.
50301e04c3fSmrg *
50401e04c3fSmrg * \sa drmWaitVBlank().
50501e04c3fSmrg */
50601e04c3fSmrgunion drm_wait_vblank {
50701e04c3fSmrg	struct drm_wait_vblank_request request;
50801e04c3fSmrg	struct drm_wait_vblank_reply reply;
50901e04c3fSmrg};
51001e04c3fSmrg
51101e04c3fSmrg#define _DRM_PRE_MODESET 1
51201e04c3fSmrg#define _DRM_POST_MODESET 2
51301e04c3fSmrg
5147ec681f3Smrg/*
51501e04c3fSmrg * DRM_IOCTL_MODESET_CTL ioctl argument type
51601e04c3fSmrg *
51701e04c3fSmrg * \sa drmModesetCtl().
51801e04c3fSmrg */
51901e04c3fSmrgstruct drm_modeset_ctl {
52001e04c3fSmrg	__u32 crtc;
52101e04c3fSmrg	__u32 cmd;
52201e04c3fSmrg};
52301e04c3fSmrg
5247ec681f3Smrg/*
52501e04c3fSmrg * DRM_IOCTL_AGP_ENABLE ioctl argument type.
52601e04c3fSmrg *
52701e04c3fSmrg * \sa drmAgpEnable().
52801e04c3fSmrg */
52901e04c3fSmrgstruct drm_agp_mode {
53001e04c3fSmrg	unsigned long mode;	/**< AGP mode */
53101e04c3fSmrg};
53201e04c3fSmrg
5337ec681f3Smrg/*
53401e04c3fSmrg * DRM_IOCTL_AGP_ALLOC and DRM_IOCTL_AGP_FREE ioctls argument type.
53501e04c3fSmrg *
53601e04c3fSmrg * \sa drmAgpAlloc() and drmAgpFree().
53701e04c3fSmrg */
53801e04c3fSmrgstruct drm_agp_buffer {
53901e04c3fSmrg	unsigned long size;	/**< In bytes -- will round to page boundary */
54001e04c3fSmrg	unsigned long handle;	/**< Used for binding / unbinding */
54101e04c3fSmrg	unsigned long type;	/**< Type of memory to allocate */
54201e04c3fSmrg	unsigned long physical;	/**< Physical used by i810 */
54301e04c3fSmrg};
54401e04c3fSmrg
5457ec681f3Smrg/*
54601e04c3fSmrg * DRM_IOCTL_AGP_BIND and DRM_IOCTL_AGP_UNBIND ioctls argument type.
54701e04c3fSmrg *
54801e04c3fSmrg * \sa drmAgpBind() and drmAgpUnbind().
54901e04c3fSmrg */
55001e04c3fSmrgstruct drm_agp_binding {
55101e04c3fSmrg	unsigned long handle;	/**< From drm_agp_buffer */
55201e04c3fSmrg	unsigned long offset;	/**< In bytes -- will round to page boundary */
55301e04c3fSmrg};
55401e04c3fSmrg
5557ec681f3Smrg/*
55601e04c3fSmrg * DRM_IOCTL_AGP_INFO ioctl argument type.
55701e04c3fSmrg *
55801e04c3fSmrg * \sa drmAgpVersionMajor(), drmAgpVersionMinor(), drmAgpGetMode(),
55901e04c3fSmrg * drmAgpBase(), drmAgpSize(), drmAgpMemoryUsed(), drmAgpMemoryAvail(),
56001e04c3fSmrg * drmAgpVendorId() and drmAgpDeviceId().
56101e04c3fSmrg */
56201e04c3fSmrgstruct drm_agp_info {
56301e04c3fSmrg	int agp_version_major;
56401e04c3fSmrg	int agp_version_minor;
56501e04c3fSmrg	unsigned long mode;
56601e04c3fSmrg	unsigned long aperture_base;	/* physical address */
56701e04c3fSmrg	unsigned long aperture_size;	/* bytes */
56801e04c3fSmrg	unsigned long memory_allowed;	/* bytes */
56901e04c3fSmrg	unsigned long memory_used;
57001e04c3fSmrg
57101e04c3fSmrg	/* PCI information */
57201e04c3fSmrg	unsigned short id_vendor;
57301e04c3fSmrg	unsigned short id_device;
57401e04c3fSmrg};
57501e04c3fSmrg
5767ec681f3Smrg/*
57701e04c3fSmrg * DRM_IOCTL_SG_ALLOC ioctl argument type.
57801e04c3fSmrg */
57901e04c3fSmrgstruct drm_scatter_gather {
58001e04c3fSmrg	unsigned long size;	/**< In bytes -- will round to page boundary */
58101e04c3fSmrg	unsigned long handle;	/**< Used for mapping / unmapping */
58201e04c3fSmrg};
58301e04c3fSmrg
5847ec681f3Smrg/*
58501e04c3fSmrg * DRM_IOCTL_SET_VERSION ioctl argument type.
58601e04c3fSmrg */
58701e04c3fSmrgstruct drm_set_version {
58801e04c3fSmrg	int drm_di_major;
58901e04c3fSmrg	int drm_di_minor;
59001e04c3fSmrg	int drm_dd_major;
59101e04c3fSmrg	int drm_dd_minor;
59201e04c3fSmrg};
59301e04c3fSmrg
5947ec681f3Smrg/* DRM_IOCTL_GEM_CLOSE ioctl argument type */
59501e04c3fSmrgstruct drm_gem_close {
59601e04c3fSmrg	/** Handle of the object to be closed. */
59701e04c3fSmrg	__u32 handle;
59801e04c3fSmrg	__u32 pad;
59901e04c3fSmrg};
60001e04c3fSmrg
6017ec681f3Smrg/* DRM_IOCTL_GEM_FLINK ioctl argument type */
60201e04c3fSmrgstruct drm_gem_flink {
60301e04c3fSmrg	/** Handle for the object being named */
60401e04c3fSmrg	__u32 handle;
60501e04c3fSmrg
60601e04c3fSmrg	/** Returned global name */
60701e04c3fSmrg	__u32 name;
60801e04c3fSmrg};
60901e04c3fSmrg
6107ec681f3Smrg/* DRM_IOCTL_GEM_OPEN ioctl argument type */
61101e04c3fSmrgstruct drm_gem_open {
61201e04c3fSmrg	/** Name of object being opened */
61301e04c3fSmrg	__u32 name;
61401e04c3fSmrg
61501e04c3fSmrg	/** Returned handle for the object */
61601e04c3fSmrg	__u32 handle;
61701e04c3fSmrg
61801e04c3fSmrg	/** Returned size of the object */
61901e04c3fSmrg	__u64 size;
62001e04c3fSmrg};
62101e04c3fSmrg
6227ec681f3Smrg/**
6237ec681f3Smrg * DRM_CAP_DUMB_BUFFER
6247ec681f3Smrg *
6257ec681f3Smrg * If set to 1, the driver supports creating dumb buffers via the
6267ec681f3Smrg * &DRM_IOCTL_MODE_CREATE_DUMB ioctl.
6277ec681f3Smrg */
62801e04c3fSmrg#define DRM_CAP_DUMB_BUFFER		0x1
6297ec681f3Smrg/**
6307ec681f3Smrg * DRM_CAP_VBLANK_HIGH_CRTC
6317ec681f3Smrg *
6327ec681f3Smrg * If set to 1, the kernel supports specifying a :ref:`CRTC index<crtc_index>`
6337ec681f3Smrg * in the high bits of &drm_wait_vblank_request.type.
6347ec681f3Smrg *
6357ec681f3Smrg * Starting kernel version 2.6.39, this capability is always set to 1.
6367ec681f3Smrg */
63701e04c3fSmrg#define DRM_CAP_VBLANK_HIGH_CRTC	0x2
6387ec681f3Smrg/**
6397ec681f3Smrg * DRM_CAP_DUMB_PREFERRED_DEPTH
6407ec681f3Smrg *
6417ec681f3Smrg * The preferred bit depth for dumb buffers.
6427ec681f3Smrg *
6437ec681f3Smrg * The bit depth is the number of bits used to indicate the color of a single
6447ec681f3Smrg * pixel excluding any padding. This is different from the number of bits per
6457ec681f3Smrg * pixel. For instance, XRGB8888 has a bit depth of 24 but has 32 bits per
6467ec681f3Smrg * pixel.
6477ec681f3Smrg *
6487ec681f3Smrg * Note that this preference only applies to dumb buffers, it's irrelevant for
6497ec681f3Smrg * other types of buffers.
6507ec681f3Smrg */
65101e04c3fSmrg#define DRM_CAP_DUMB_PREFERRED_DEPTH	0x3
6527ec681f3Smrg/**
6537ec681f3Smrg * DRM_CAP_DUMB_PREFER_SHADOW
6547ec681f3Smrg *
6557ec681f3Smrg * If set to 1, the driver prefers userspace to render to a shadow buffer
6567ec681f3Smrg * instead of directly rendering to a dumb buffer. For best speed, userspace
6577ec681f3Smrg * should do streaming ordered memory copies into the dumb buffer and never
6587ec681f3Smrg * read from it.
6597ec681f3Smrg *
6607ec681f3Smrg * Note that this preference only applies to dumb buffers, it's irrelevant for
6617ec681f3Smrg * other types of buffers.
6627ec681f3Smrg */
66301e04c3fSmrg#define DRM_CAP_DUMB_PREFER_SHADOW	0x4
6647ec681f3Smrg/**
6657ec681f3Smrg * DRM_CAP_PRIME
6667ec681f3Smrg *
6677ec681f3Smrg * Bitfield of supported PRIME sharing capabilities. See &DRM_PRIME_CAP_IMPORT
6687ec681f3Smrg * and &DRM_PRIME_CAP_EXPORT.
6697ec681f3Smrg *
6707ec681f3Smrg * PRIME buffers are exposed as dma-buf file descriptors. See
6717ec681f3Smrg * Documentation/gpu/drm-mm.rst, section "PRIME Buffer Sharing".
6727ec681f3Smrg */
67301e04c3fSmrg#define DRM_CAP_PRIME			0x5
6747ec681f3Smrg/**
6757ec681f3Smrg * DRM_PRIME_CAP_IMPORT
6767ec681f3Smrg *
6777ec681f3Smrg * If this bit is set in &DRM_CAP_PRIME, the driver supports importing PRIME
6787ec681f3Smrg * buffers via the &DRM_IOCTL_PRIME_FD_TO_HANDLE ioctl.
6797ec681f3Smrg */
68001e04c3fSmrg#define  DRM_PRIME_CAP_IMPORT		0x1
6817ec681f3Smrg/**
6827ec681f3Smrg * DRM_PRIME_CAP_EXPORT
6837ec681f3Smrg *
6847ec681f3Smrg * If this bit is set in &DRM_CAP_PRIME, the driver supports exporting PRIME
6857ec681f3Smrg * buffers via the &DRM_IOCTL_PRIME_HANDLE_TO_FD ioctl.
6867ec681f3Smrg */
68701e04c3fSmrg#define  DRM_PRIME_CAP_EXPORT		0x2
6887ec681f3Smrg/**
6897ec681f3Smrg * DRM_CAP_TIMESTAMP_MONOTONIC
6907ec681f3Smrg *
6917ec681f3Smrg * If set to 0, the kernel will report timestamps with ``CLOCK_REALTIME`` in
6927ec681f3Smrg * struct drm_event_vblank. If set to 1, the kernel will report timestamps with
6937ec681f3Smrg * ``CLOCK_MONOTONIC``. See ``clock_gettime(2)`` for the definition of these
6947ec681f3Smrg * clocks.
6957ec681f3Smrg *
6967ec681f3Smrg * Starting from kernel version 2.6.39, the default value for this capability
6977ec681f3Smrg * is 1. Starting kernel version 4.15, this capability is always set to 1.
6987ec681f3Smrg */
69901e04c3fSmrg#define DRM_CAP_TIMESTAMP_MONOTONIC	0x6
7007ec681f3Smrg/**
7017ec681f3Smrg * DRM_CAP_ASYNC_PAGE_FLIP
7027ec681f3Smrg *
7037ec681f3Smrg * If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC.
7047ec681f3Smrg */
70501e04c3fSmrg#define DRM_CAP_ASYNC_PAGE_FLIP		0x7
7067ec681f3Smrg/**
7077ec681f3Smrg * DRM_CAP_CURSOR_WIDTH
7087ec681f3Smrg *
7097ec681f3Smrg * The ``CURSOR_WIDTH`` and ``CURSOR_HEIGHT`` capabilities return a valid
7107ec681f3Smrg * width x height combination for the hardware cursor. The intention is that a
7117ec681f3Smrg * hardware agnostic userspace can query a cursor plane size to use.
71201e04c3fSmrg *
71301e04c3fSmrg * Note that the cross-driver contract is to merely return a valid size;
71401e04c3fSmrg * drivers are free to attach another meaning on top, eg. i915 returns the
71501e04c3fSmrg * maximum plane size.
71601e04c3fSmrg */
71701e04c3fSmrg#define DRM_CAP_CURSOR_WIDTH		0x8
7187ec681f3Smrg/**
7197ec681f3Smrg * DRM_CAP_CURSOR_HEIGHT
7207ec681f3Smrg *
7217ec681f3Smrg * See &DRM_CAP_CURSOR_WIDTH.
7227ec681f3Smrg */
72301e04c3fSmrg#define DRM_CAP_CURSOR_HEIGHT		0x9
7247ec681f3Smrg/**
7257ec681f3Smrg * DRM_CAP_ADDFB2_MODIFIERS
7267ec681f3Smrg *
7277ec681f3Smrg * If set to 1, the driver supports supplying modifiers in the
7287ec681f3Smrg * &DRM_IOCTL_MODE_ADDFB2 ioctl.
7297ec681f3Smrg */
73001e04c3fSmrg#define DRM_CAP_ADDFB2_MODIFIERS	0x10
7317ec681f3Smrg/**
7327ec681f3Smrg * DRM_CAP_PAGE_FLIP_TARGET
7337ec681f3Smrg *
7347ec681f3Smrg * If set to 1, the driver supports the &DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE and
7357ec681f3Smrg * &DRM_MODE_PAGE_FLIP_TARGET_RELATIVE flags in
7367ec681f3Smrg * &drm_mode_crtc_page_flip_target.flags for the &DRM_IOCTL_MODE_PAGE_FLIP
7377ec681f3Smrg * ioctl.
7387ec681f3Smrg */
73901e04c3fSmrg#define DRM_CAP_PAGE_FLIP_TARGET	0x11
7407ec681f3Smrg/**
7417ec681f3Smrg * DRM_CAP_CRTC_IN_VBLANK_EVENT
7427ec681f3Smrg *
7437ec681f3Smrg * If set to 1, the kernel supports reporting the CRTC ID in
7447ec681f3Smrg * &drm_event_vblank.crtc_id for the &DRM_EVENT_VBLANK and
7457ec681f3Smrg * &DRM_EVENT_FLIP_COMPLETE events.
7467ec681f3Smrg *
7477ec681f3Smrg * Starting kernel version 4.12, this capability is always set to 1.
7487ec681f3Smrg */
74901e04c3fSmrg#define DRM_CAP_CRTC_IN_VBLANK_EVENT	0x12
7507ec681f3Smrg/**
7517ec681f3Smrg * DRM_CAP_SYNCOBJ
7527ec681f3Smrg *
7537ec681f3Smrg * If set to 1, the driver supports sync objects. See
7547ec681f3Smrg * Documentation/gpu/drm-mm.rst, section "DRM Sync Objects".
7557ec681f3Smrg */
75601e04c3fSmrg#define DRM_CAP_SYNCOBJ		0x13
7577ec681f3Smrg/**
7587ec681f3Smrg * DRM_CAP_SYNCOBJ_TIMELINE
7597ec681f3Smrg *
7607ec681f3Smrg * If set to 1, the driver supports timeline operations on sync objects. See
7617ec681f3Smrg * Documentation/gpu/drm-mm.rst, section "DRM Sync Objects".
7627ec681f3Smrg */
7637ec681f3Smrg#define DRM_CAP_SYNCOBJ_TIMELINE	0x14
76401e04c3fSmrg
7657ec681f3Smrg/* DRM_IOCTL_GET_CAP ioctl argument type */
76601e04c3fSmrgstruct drm_get_cap {
76701e04c3fSmrg	__u64 capability;
76801e04c3fSmrg	__u64 value;
76901e04c3fSmrg};
77001e04c3fSmrg
77101e04c3fSmrg/**
77201e04c3fSmrg * DRM_CLIENT_CAP_STEREO_3D
77301e04c3fSmrg *
7747ec681f3Smrg * If set to 1, the DRM core will expose the stereo 3D capabilities of the
77501e04c3fSmrg * monitor by advertising the supported 3D layouts in the flags of struct
7767ec681f3Smrg * drm_mode_modeinfo. See ``DRM_MODE_FLAG_3D_*``.
7777ec681f3Smrg *
7787ec681f3Smrg * This capability is always supported for all drivers starting from kernel
7797ec681f3Smrg * version 3.13.
78001e04c3fSmrg */
78101e04c3fSmrg#define DRM_CLIENT_CAP_STEREO_3D	1
78201e04c3fSmrg
78301e04c3fSmrg/**
78401e04c3fSmrg * DRM_CLIENT_CAP_UNIVERSAL_PLANES
78501e04c3fSmrg *
78601e04c3fSmrg * If set to 1, the DRM core will expose all planes (overlay, primary, and
78701e04c3fSmrg * cursor) to userspace.
7887ec681f3Smrg *
7897ec681f3Smrg * This capability has been introduced in kernel version 3.15. Starting from
7907ec681f3Smrg * kernel version 3.17, this capability is always supported for all drivers.
79101e04c3fSmrg */
79201e04c3fSmrg#define DRM_CLIENT_CAP_UNIVERSAL_PLANES  2
79301e04c3fSmrg
79401e04c3fSmrg/**
79501e04c3fSmrg * DRM_CLIENT_CAP_ATOMIC
79601e04c3fSmrg *
7977ec681f3Smrg * If set to 1, the DRM core will expose atomic properties to userspace. This
7987ec681f3Smrg * implicitly enables &DRM_CLIENT_CAP_UNIVERSAL_PLANES and
7997ec681f3Smrg * &DRM_CLIENT_CAP_ASPECT_RATIO.
8007ec681f3Smrg *
8017ec681f3Smrg * If the driver doesn't support atomic mode-setting, enabling this capability
8027ec681f3Smrg * will fail with -EOPNOTSUPP.
8037ec681f3Smrg *
8047ec681f3Smrg * This capability has been introduced in kernel version 4.0. Starting from
8057ec681f3Smrg * kernel version 4.2, this capability is always supported for atomic-capable
8067ec681f3Smrg * drivers.
80701e04c3fSmrg */
80801e04c3fSmrg#define DRM_CLIENT_CAP_ATOMIC	3
80901e04c3fSmrg
81053c12917Smaya/**
81153c12917Smaya * DRM_CLIENT_CAP_ASPECT_RATIO
81253c12917Smaya *
81353c12917Smaya * If set to 1, the DRM core will provide aspect ratio information in modes.
8147ec681f3Smrg * See ``DRM_MODE_FLAG_PIC_AR_*``.
8157ec681f3Smrg *
8167ec681f3Smrg * This capability is always supported for all drivers starting from kernel
8177ec681f3Smrg * version 4.18.
81853c12917Smaya */
81953c12917Smaya#define DRM_CLIENT_CAP_ASPECT_RATIO    4
82053c12917Smaya
82153c12917Smaya/**
82253c12917Smaya * DRM_CLIENT_CAP_WRITEBACK_CONNECTORS
82353c12917Smaya *
82453c12917Smaya * If set to 1, the DRM core will expose special connectors to be used for
8257ec681f3Smrg * writing back to memory the scene setup in the commit. The client must enable
8267ec681f3Smrg * &DRM_CLIENT_CAP_ATOMIC first.
8277ec681f3Smrg *
8287ec681f3Smrg * This capability is always supported for atomic-capable drivers starting from
8297ec681f3Smrg * kernel version 4.19.
83053c12917Smaya */
83153c12917Smaya#define DRM_CLIENT_CAP_WRITEBACK_CONNECTORS	5
83253c12917Smaya
8337ec681f3Smrg/* DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */
83401e04c3fSmrgstruct drm_set_client_cap {
83501e04c3fSmrg	__u64 capability;
83601e04c3fSmrg	__u64 value;
83701e04c3fSmrg};
83801e04c3fSmrg
83901e04c3fSmrg#define DRM_RDWR O_RDWR
84001e04c3fSmrg#define DRM_CLOEXEC O_CLOEXEC
84101e04c3fSmrgstruct drm_prime_handle {
84201e04c3fSmrg	__u32 handle;
84301e04c3fSmrg
84401e04c3fSmrg	/** Flags.. only applicable for handle->fd */
84501e04c3fSmrg	__u32 flags;
84601e04c3fSmrg
84701e04c3fSmrg	/** Returned dmabuf file descriptor */
84801e04c3fSmrg	__s32 fd;
84901e04c3fSmrg};
85001e04c3fSmrg
85101e04c3fSmrgstruct drm_syncobj_create {
85201e04c3fSmrg	__u32 handle;
85301e04c3fSmrg#define DRM_SYNCOBJ_CREATE_SIGNALED (1 << 0)
85401e04c3fSmrg	__u32 flags;
85501e04c3fSmrg};
85601e04c3fSmrg
85701e04c3fSmrgstruct drm_syncobj_destroy {
85801e04c3fSmrg	__u32 handle;
85901e04c3fSmrg	__u32 pad;
86001e04c3fSmrg};
86101e04c3fSmrg
86201e04c3fSmrg#define DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE (1 << 0)
86301e04c3fSmrg#define DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE (1 << 0)
86401e04c3fSmrgstruct drm_syncobj_handle {
86501e04c3fSmrg	__u32 handle;
86601e04c3fSmrg	__u32 flags;
86701e04c3fSmrg
86801e04c3fSmrg	__s32 fd;
86901e04c3fSmrg	__u32 pad;
87001e04c3fSmrg};
87101e04c3fSmrg
8727ec681f3Smrgstruct drm_syncobj_transfer {
8737ec681f3Smrg	__u32 src_handle;
8747ec681f3Smrg	__u32 dst_handle;
8757ec681f3Smrg	__u64 src_point;
8767ec681f3Smrg	__u64 dst_point;
8777ec681f3Smrg	__u32 flags;
8787ec681f3Smrg	__u32 pad;
8797ec681f3Smrg};
8807ec681f3Smrg
88101e04c3fSmrg#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)
88201e04c3fSmrg#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1)
8837ec681f3Smrg#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2) /* wait for time point to become available */
88401e04c3fSmrgstruct drm_syncobj_wait {
88501e04c3fSmrg	__u64 handles;
88601e04c3fSmrg	/* absolute timeout */
88701e04c3fSmrg	__s64 timeout_nsec;
88801e04c3fSmrg	__u32 count_handles;
88901e04c3fSmrg	__u32 flags;
89001e04c3fSmrg	__u32 first_signaled; /* only valid when not waiting all */
89101e04c3fSmrg	__u32 pad;
89201e04c3fSmrg};
89301e04c3fSmrg
8947ec681f3Smrgstruct drm_syncobj_timeline_wait {
8957ec681f3Smrg	__u64 handles;
8967ec681f3Smrg	/* wait on specific timeline point for every handles*/
8977ec681f3Smrg	__u64 points;
8987ec681f3Smrg	/* absolute timeout */
8997ec681f3Smrg	__s64 timeout_nsec;
9007ec681f3Smrg	__u32 count_handles;
9017ec681f3Smrg	__u32 flags;
9027ec681f3Smrg	__u32 first_signaled; /* only valid when not waiting all */
9037ec681f3Smrg	__u32 pad;
9047ec681f3Smrg};
9057ec681f3Smrg
9067ec681f3Smrg
90701e04c3fSmrgstruct drm_syncobj_array {
90801e04c3fSmrg	__u64 handles;
90901e04c3fSmrg	__u32 count_handles;
91001e04c3fSmrg	__u32 pad;
91101e04c3fSmrg};
91201e04c3fSmrg
9137ec681f3Smrg#define DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED (1 << 0) /* last available point on timeline syncobj */
9147ec681f3Smrgstruct drm_syncobj_timeline_array {
9157ec681f3Smrg	__u64 handles;
9167ec681f3Smrg	__u64 points;
9177ec681f3Smrg	__u32 count_handles;
9187ec681f3Smrg	__u32 flags;
9197ec681f3Smrg};
9207ec681f3Smrg
9217ec681f3Smrg
92201e04c3fSmrg/* Query current scanout sequence number */
92301e04c3fSmrgstruct drm_crtc_get_sequence {
92401e04c3fSmrg	__u32 crtc_id;		/* requested crtc_id */
92501e04c3fSmrg	__u32 active;		/* return: crtc output is active */
92601e04c3fSmrg	__u64 sequence;		/* return: most recent vblank sequence */
92701e04c3fSmrg	__s64 sequence_ns;	/* return: most recent time of first pixel out */
92801e04c3fSmrg};
92901e04c3fSmrg
93001e04c3fSmrg/* Queue event to be delivered at specified sequence. Time stamp marks
93101e04c3fSmrg * when the first pixel of the refresh cycle leaves the display engine
93201e04c3fSmrg * for the display
93301e04c3fSmrg */
93401e04c3fSmrg#define DRM_CRTC_SEQUENCE_RELATIVE		0x00000001	/* sequence is relative to current */
93501e04c3fSmrg#define DRM_CRTC_SEQUENCE_NEXT_ON_MISS		0x00000002	/* Use next sequence if we've missed */
93601e04c3fSmrg
93701e04c3fSmrgstruct drm_crtc_queue_sequence {
93801e04c3fSmrg	__u32 crtc_id;
93901e04c3fSmrg	__u32 flags;
94001e04c3fSmrg	__u64 sequence;		/* on input, target sequence. on output, actual sequence */
94101e04c3fSmrg	__u64 user_data;	/* user data passed to event */
94201e04c3fSmrg};
94301e04c3fSmrg
94401e04c3fSmrg#if defined(__cplusplus)
94501e04c3fSmrg}
94601e04c3fSmrg#endif
94701e04c3fSmrg
94801e04c3fSmrg#include "drm_mode.h"
94901e04c3fSmrg
95001e04c3fSmrg#if defined(__cplusplus)
95101e04c3fSmrgextern "C" {
95201e04c3fSmrg#endif
95301e04c3fSmrg
95401e04c3fSmrg#define DRM_IOCTL_BASE			'd'
95501e04c3fSmrg#define DRM_IO(nr)			_IO(DRM_IOCTL_BASE,nr)
95601e04c3fSmrg#define DRM_IOR(nr,type)		_IOR(DRM_IOCTL_BASE,nr,type)
95701e04c3fSmrg#define DRM_IOW(nr,type)		_IOW(DRM_IOCTL_BASE,nr,type)
95801e04c3fSmrg#define DRM_IOWR(nr,type)		_IOWR(DRM_IOCTL_BASE,nr,type)
95901e04c3fSmrg
96001e04c3fSmrg#define DRM_IOCTL_VERSION		DRM_IOWR(0x00, struct drm_version)
96101e04c3fSmrg#define DRM_IOCTL_GET_UNIQUE		DRM_IOWR(0x01, struct drm_unique)
96201e04c3fSmrg#define DRM_IOCTL_GET_MAGIC		DRM_IOR( 0x02, struct drm_auth)
96301e04c3fSmrg#define DRM_IOCTL_IRQ_BUSID		DRM_IOWR(0x03, struct drm_irq_busid)
96401e04c3fSmrg#define DRM_IOCTL_GET_MAP               DRM_IOWR(0x04, struct drm_map)
96501e04c3fSmrg#define DRM_IOCTL_GET_CLIENT            DRM_IOWR(0x05, struct drm_client)
96601e04c3fSmrg#define DRM_IOCTL_GET_STATS             DRM_IOR( 0x06, struct drm_stats)
96701e04c3fSmrg#define DRM_IOCTL_SET_VERSION		DRM_IOWR(0x07, struct drm_set_version)
96801e04c3fSmrg#define DRM_IOCTL_MODESET_CTL           DRM_IOW(0x08, struct drm_modeset_ctl)
96901e04c3fSmrg#define DRM_IOCTL_GEM_CLOSE		DRM_IOW (0x09, struct drm_gem_close)
97001e04c3fSmrg#define DRM_IOCTL_GEM_FLINK		DRM_IOWR(0x0a, struct drm_gem_flink)
97101e04c3fSmrg#define DRM_IOCTL_GEM_OPEN		DRM_IOWR(0x0b, struct drm_gem_open)
97201e04c3fSmrg#define DRM_IOCTL_GET_CAP		DRM_IOWR(0x0c, struct drm_get_cap)
97301e04c3fSmrg#define DRM_IOCTL_SET_CLIENT_CAP	DRM_IOW( 0x0d, struct drm_set_client_cap)
97401e04c3fSmrg
97501e04c3fSmrg#define DRM_IOCTL_SET_UNIQUE		DRM_IOW( 0x10, struct drm_unique)
97601e04c3fSmrg#define DRM_IOCTL_AUTH_MAGIC		DRM_IOW( 0x11, struct drm_auth)
97701e04c3fSmrg#define DRM_IOCTL_BLOCK			DRM_IOWR(0x12, struct drm_block)
97801e04c3fSmrg#define DRM_IOCTL_UNBLOCK		DRM_IOWR(0x13, struct drm_block)
97901e04c3fSmrg#define DRM_IOCTL_CONTROL		DRM_IOW( 0x14, struct drm_control)
98001e04c3fSmrg#define DRM_IOCTL_ADD_MAP		DRM_IOWR(0x15, struct drm_map)
98101e04c3fSmrg#define DRM_IOCTL_ADD_BUFS		DRM_IOWR(0x16, struct drm_buf_desc)
98201e04c3fSmrg#define DRM_IOCTL_MARK_BUFS		DRM_IOW( 0x17, struct drm_buf_desc)
98301e04c3fSmrg#define DRM_IOCTL_INFO_BUFS		DRM_IOWR(0x18, struct drm_buf_info)
98401e04c3fSmrg#define DRM_IOCTL_MAP_BUFS		DRM_IOWR(0x19, struct drm_buf_map)
98501e04c3fSmrg#define DRM_IOCTL_FREE_BUFS		DRM_IOW( 0x1a, struct drm_buf_free)
98601e04c3fSmrg
98701e04c3fSmrg#define DRM_IOCTL_RM_MAP		DRM_IOW( 0x1b, struct drm_map)
98801e04c3fSmrg
98901e04c3fSmrg#define DRM_IOCTL_SET_SAREA_CTX		DRM_IOW( 0x1c, struct drm_ctx_priv_map)
99001e04c3fSmrg#define DRM_IOCTL_GET_SAREA_CTX 	DRM_IOWR(0x1d, struct drm_ctx_priv_map)
99101e04c3fSmrg
99201e04c3fSmrg#define DRM_IOCTL_SET_MASTER            DRM_IO(0x1e)
99301e04c3fSmrg#define DRM_IOCTL_DROP_MASTER           DRM_IO(0x1f)
99401e04c3fSmrg
99501e04c3fSmrg#define DRM_IOCTL_ADD_CTX		DRM_IOWR(0x20, struct drm_ctx)
99601e04c3fSmrg#define DRM_IOCTL_RM_CTX		DRM_IOWR(0x21, struct drm_ctx)
99701e04c3fSmrg#define DRM_IOCTL_MOD_CTX		DRM_IOW( 0x22, struct drm_ctx)
99801e04c3fSmrg#define DRM_IOCTL_GET_CTX		DRM_IOWR(0x23, struct drm_ctx)
99901e04c3fSmrg#define DRM_IOCTL_SWITCH_CTX		DRM_IOW( 0x24, struct drm_ctx)
100001e04c3fSmrg#define DRM_IOCTL_NEW_CTX		DRM_IOW( 0x25, struct drm_ctx)
100101e04c3fSmrg#define DRM_IOCTL_RES_CTX		DRM_IOWR(0x26, struct drm_ctx_res)
100201e04c3fSmrg#define DRM_IOCTL_ADD_DRAW		DRM_IOWR(0x27, struct drm_draw)
100301e04c3fSmrg#define DRM_IOCTL_RM_DRAW		DRM_IOWR(0x28, struct drm_draw)
100401e04c3fSmrg#define DRM_IOCTL_DMA			DRM_IOWR(0x29, struct drm_dma)
100501e04c3fSmrg#define DRM_IOCTL_LOCK			DRM_IOW( 0x2a, struct drm_lock)
100601e04c3fSmrg#define DRM_IOCTL_UNLOCK		DRM_IOW( 0x2b, struct drm_lock)
100701e04c3fSmrg#define DRM_IOCTL_FINISH		DRM_IOW( 0x2c, struct drm_lock)
100801e04c3fSmrg
100901e04c3fSmrg#define DRM_IOCTL_PRIME_HANDLE_TO_FD    DRM_IOWR(0x2d, struct drm_prime_handle)
101001e04c3fSmrg#define DRM_IOCTL_PRIME_FD_TO_HANDLE    DRM_IOWR(0x2e, struct drm_prime_handle)
101101e04c3fSmrg
101201e04c3fSmrg#define DRM_IOCTL_AGP_ACQUIRE		DRM_IO(  0x30)
101301e04c3fSmrg#define DRM_IOCTL_AGP_RELEASE		DRM_IO(  0x31)
101401e04c3fSmrg#define DRM_IOCTL_AGP_ENABLE		DRM_IOW( 0x32, struct drm_agp_mode)
101501e04c3fSmrg#define DRM_IOCTL_AGP_INFO		DRM_IOR( 0x33, struct drm_agp_info)
101601e04c3fSmrg#define DRM_IOCTL_AGP_ALLOC		DRM_IOWR(0x34, struct drm_agp_buffer)
101701e04c3fSmrg#define DRM_IOCTL_AGP_FREE		DRM_IOW( 0x35, struct drm_agp_buffer)
101801e04c3fSmrg#define DRM_IOCTL_AGP_BIND		DRM_IOW( 0x36, struct drm_agp_binding)
101901e04c3fSmrg#define DRM_IOCTL_AGP_UNBIND		DRM_IOW( 0x37, struct drm_agp_binding)
102001e04c3fSmrg
102101e04c3fSmrg#define DRM_IOCTL_SG_ALLOC		DRM_IOWR(0x38, struct drm_scatter_gather)
102201e04c3fSmrg#define DRM_IOCTL_SG_FREE		DRM_IOW( 0x39, struct drm_scatter_gather)
102301e04c3fSmrg
102401e04c3fSmrg#define DRM_IOCTL_WAIT_VBLANK		DRM_IOWR(0x3a, union drm_wait_vblank)
102501e04c3fSmrg
102601e04c3fSmrg#define DRM_IOCTL_CRTC_GET_SEQUENCE	DRM_IOWR(0x3b, struct drm_crtc_get_sequence)
102701e04c3fSmrg#define DRM_IOCTL_CRTC_QUEUE_SEQUENCE	DRM_IOWR(0x3c, struct drm_crtc_queue_sequence)
102801e04c3fSmrg
102901e04c3fSmrg#define DRM_IOCTL_UPDATE_DRAW		DRM_IOW(0x3f, struct drm_update_draw)
103001e04c3fSmrg
103101e04c3fSmrg#define DRM_IOCTL_MODE_GETRESOURCES	DRM_IOWR(0xA0, struct drm_mode_card_res)
103201e04c3fSmrg#define DRM_IOCTL_MODE_GETCRTC		DRM_IOWR(0xA1, struct drm_mode_crtc)
103301e04c3fSmrg#define DRM_IOCTL_MODE_SETCRTC		DRM_IOWR(0xA2, struct drm_mode_crtc)
103401e04c3fSmrg#define DRM_IOCTL_MODE_CURSOR		DRM_IOWR(0xA3, struct drm_mode_cursor)
103501e04c3fSmrg#define DRM_IOCTL_MODE_GETGAMMA		DRM_IOWR(0xA4, struct drm_mode_crtc_lut)
103601e04c3fSmrg#define DRM_IOCTL_MODE_SETGAMMA		DRM_IOWR(0xA5, struct drm_mode_crtc_lut)
103701e04c3fSmrg#define DRM_IOCTL_MODE_GETENCODER	DRM_IOWR(0xA6, struct drm_mode_get_encoder)
103801e04c3fSmrg#define DRM_IOCTL_MODE_GETCONNECTOR	DRM_IOWR(0xA7, struct drm_mode_get_connector)
103901e04c3fSmrg#define DRM_IOCTL_MODE_ATTACHMODE	DRM_IOWR(0xA8, struct drm_mode_mode_cmd) /* deprecated (never worked) */
104001e04c3fSmrg#define DRM_IOCTL_MODE_DETACHMODE	DRM_IOWR(0xA9, struct drm_mode_mode_cmd) /* deprecated (never worked) */
104101e04c3fSmrg
104201e04c3fSmrg#define DRM_IOCTL_MODE_GETPROPERTY	DRM_IOWR(0xAA, struct drm_mode_get_property)
104301e04c3fSmrg#define DRM_IOCTL_MODE_SETPROPERTY	DRM_IOWR(0xAB, struct drm_mode_connector_set_property)
104401e04c3fSmrg#define DRM_IOCTL_MODE_GETPROPBLOB	DRM_IOWR(0xAC, struct drm_mode_get_blob)
104501e04c3fSmrg#define DRM_IOCTL_MODE_GETFB		DRM_IOWR(0xAD, struct drm_mode_fb_cmd)
104601e04c3fSmrg#define DRM_IOCTL_MODE_ADDFB		DRM_IOWR(0xAE, struct drm_mode_fb_cmd)
10477ec681f3Smrg/**
10487ec681f3Smrg * DRM_IOCTL_MODE_RMFB - Remove a framebuffer.
10497ec681f3Smrg *
10507ec681f3Smrg * This removes a framebuffer previously added via ADDFB/ADDFB2. The IOCTL
10517ec681f3Smrg * argument is a framebuffer object ID.
10527ec681f3Smrg *
10537ec681f3Smrg * Warning: removing a framebuffer currently in-use on an enabled plane will
10547ec681f3Smrg * disable that plane. The CRTC the plane is linked to may also be disabled
10557ec681f3Smrg * (depending on driver capabilities).
10567ec681f3Smrg */
105701e04c3fSmrg#define DRM_IOCTL_MODE_RMFB		DRM_IOWR(0xAF, unsigned int)
105801e04c3fSmrg#define DRM_IOCTL_MODE_PAGE_FLIP	DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip)
105901e04c3fSmrg#define DRM_IOCTL_MODE_DIRTYFB		DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd)
106001e04c3fSmrg
106101e04c3fSmrg#define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb)
106201e04c3fSmrg#define DRM_IOCTL_MODE_MAP_DUMB    DRM_IOWR(0xB3, struct drm_mode_map_dumb)
106301e04c3fSmrg#define DRM_IOCTL_MODE_DESTROY_DUMB    DRM_IOWR(0xB4, struct drm_mode_destroy_dumb)
106401e04c3fSmrg#define DRM_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xB5, struct drm_mode_get_plane_res)
106501e04c3fSmrg#define DRM_IOCTL_MODE_GETPLANE	DRM_IOWR(0xB6, struct drm_mode_get_plane)
106601e04c3fSmrg#define DRM_IOCTL_MODE_SETPLANE	DRM_IOWR(0xB7, struct drm_mode_set_plane)
106701e04c3fSmrg#define DRM_IOCTL_MODE_ADDFB2		DRM_IOWR(0xB8, struct drm_mode_fb_cmd2)
106801e04c3fSmrg#define DRM_IOCTL_MODE_OBJ_GETPROPERTIES	DRM_IOWR(0xB9, struct drm_mode_obj_get_properties)
106901e04c3fSmrg#define DRM_IOCTL_MODE_OBJ_SETPROPERTY	DRM_IOWR(0xBA, struct drm_mode_obj_set_property)
107001e04c3fSmrg#define DRM_IOCTL_MODE_CURSOR2		DRM_IOWR(0xBB, struct drm_mode_cursor2)
107101e04c3fSmrg#define DRM_IOCTL_MODE_ATOMIC		DRM_IOWR(0xBC, struct drm_mode_atomic)
107201e04c3fSmrg#define DRM_IOCTL_MODE_CREATEPROPBLOB	DRM_IOWR(0xBD, struct drm_mode_create_blob)
107301e04c3fSmrg#define DRM_IOCTL_MODE_DESTROYPROPBLOB	DRM_IOWR(0xBE, struct drm_mode_destroy_blob)
107401e04c3fSmrg
107501e04c3fSmrg#define DRM_IOCTL_SYNCOBJ_CREATE	DRM_IOWR(0xBF, struct drm_syncobj_create)
107601e04c3fSmrg#define DRM_IOCTL_SYNCOBJ_DESTROY	DRM_IOWR(0xC0, struct drm_syncobj_destroy)
107701e04c3fSmrg#define DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD	DRM_IOWR(0xC1, struct drm_syncobj_handle)
107801e04c3fSmrg#define DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE	DRM_IOWR(0xC2, struct drm_syncobj_handle)
107901e04c3fSmrg#define DRM_IOCTL_SYNCOBJ_WAIT		DRM_IOWR(0xC3, struct drm_syncobj_wait)
108001e04c3fSmrg#define DRM_IOCTL_SYNCOBJ_RESET		DRM_IOWR(0xC4, struct drm_syncobj_array)
108101e04c3fSmrg#define DRM_IOCTL_SYNCOBJ_SIGNAL	DRM_IOWR(0xC5, struct drm_syncobj_array)
108201e04c3fSmrg
108301e04c3fSmrg#define DRM_IOCTL_MODE_CREATE_LEASE	DRM_IOWR(0xC6, struct drm_mode_create_lease)
108401e04c3fSmrg#define DRM_IOCTL_MODE_LIST_LESSEES	DRM_IOWR(0xC7, struct drm_mode_list_lessees)
108501e04c3fSmrg#define DRM_IOCTL_MODE_GET_LEASE	DRM_IOWR(0xC8, struct drm_mode_get_lease)
108601e04c3fSmrg#define DRM_IOCTL_MODE_REVOKE_LEASE	DRM_IOWR(0xC9, struct drm_mode_revoke_lease)
108701e04c3fSmrg
10887ec681f3Smrg#define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT	DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait)
10897ec681f3Smrg#define DRM_IOCTL_SYNCOBJ_QUERY		DRM_IOWR(0xCB, struct drm_syncobj_timeline_array)
10907ec681f3Smrg#define DRM_IOCTL_SYNCOBJ_TRANSFER	DRM_IOWR(0xCC, struct drm_syncobj_transfer)
10917ec681f3Smrg#define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL	DRM_IOWR(0xCD, struct drm_syncobj_timeline_array)
10927ec681f3Smrg
10937ec681f3Smrg#define DRM_IOCTL_MODE_GETFB2		DRM_IOWR(0xCE, struct drm_mode_fb_cmd2)
10947ec681f3Smrg
10957ec681f3Smrg/*
109601e04c3fSmrg * Device specific ioctls should only be in their respective headers
109701e04c3fSmrg * The device specific ioctl range is from 0x40 to 0x9f.
109801e04c3fSmrg * Generic IOCTLS restart at 0xA0.
109901e04c3fSmrg *
110001e04c3fSmrg * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and
110101e04c3fSmrg * drmCommandReadWrite().
110201e04c3fSmrg */
110301e04c3fSmrg#define DRM_COMMAND_BASE                0x40
110401e04c3fSmrg#define DRM_COMMAND_END			0xA0
110501e04c3fSmrg
11067ec681f3Smrg/*
110701e04c3fSmrg * Header for events written back to userspace on the drm fd.  The
110801e04c3fSmrg * type defines the type of event, the length specifies the total
110901e04c3fSmrg * length of the event (including the header), and user_data is
111001e04c3fSmrg * typically a 64 bit value passed with the ioctl that triggered the
111101e04c3fSmrg * event.  A read on the drm fd will always only return complete
111201e04c3fSmrg * events, that is, if for example the read buffer is 100 bytes, and
111301e04c3fSmrg * there are two 64 byte events pending, only one will be returned.
111401e04c3fSmrg *
111501e04c3fSmrg * Event types 0 - 0x7fffffff are generic drm events, 0x80000000 and
111601e04c3fSmrg * up are chipset specific.
111701e04c3fSmrg */
111801e04c3fSmrgstruct drm_event {
111901e04c3fSmrg	__u32 type;
112001e04c3fSmrg	__u32 length;
112101e04c3fSmrg};
112201e04c3fSmrg
112301e04c3fSmrg#define DRM_EVENT_VBLANK 0x01
112401e04c3fSmrg#define DRM_EVENT_FLIP_COMPLETE 0x02
112501e04c3fSmrg#define DRM_EVENT_CRTC_SEQUENCE	0x03
112601e04c3fSmrg
112701e04c3fSmrgstruct drm_event_vblank {
112801e04c3fSmrg	struct drm_event base;
112901e04c3fSmrg	__u64 user_data;
113001e04c3fSmrg	__u32 tv_sec;
113101e04c3fSmrg	__u32 tv_usec;
113201e04c3fSmrg	__u32 sequence;
113301e04c3fSmrg	__u32 crtc_id; /* 0 on older kernels that do not support this */
113401e04c3fSmrg};
113501e04c3fSmrg
113601e04c3fSmrg/* Event delivered at sequence. Time stamp marks when the first pixel
113701e04c3fSmrg * of the refresh cycle leaves the display engine for the display
113801e04c3fSmrg */
113901e04c3fSmrgstruct drm_event_crtc_sequence {
114001e04c3fSmrg	struct drm_event	base;
114101e04c3fSmrg	__u64			user_data;
114201e04c3fSmrg	__s64			time_ns;
114301e04c3fSmrg	__u64			sequence;
114401e04c3fSmrg};
114501e04c3fSmrg
114601e04c3fSmrg/* typedef area */
114701e04c3fSmrgtypedef struct drm_clip_rect drm_clip_rect_t;
114801e04c3fSmrgtypedef struct drm_drawable_info drm_drawable_info_t;
114901e04c3fSmrgtypedef struct drm_tex_region drm_tex_region_t;
115001e04c3fSmrgtypedef struct drm_hw_lock drm_hw_lock_t;
115101e04c3fSmrgtypedef struct drm_version drm_version_t;
115201e04c3fSmrgtypedef struct drm_unique drm_unique_t;
115301e04c3fSmrgtypedef struct drm_list drm_list_t;
115401e04c3fSmrgtypedef struct drm_block drm_block_t;
115501e04c3fSmrgtypedef struct drm_control drm_control_t;
115601e04c3fSmrgtypedef enum drm_map_type drm_map_type_t;
115701e04c3fSmrgtypedef enum drm_map_flags drm_map_flags_t;
115801e04c3fSmrgtypedef struct drm_ctx_priv_map drm_ctx_priv_map_t;
115901e04c3fSmrgtypedef struct drm_map drm_map_t;
116001e04c3fSmrgtypedef struct drm_client drm_client_t;
116101e04c3fSmrgtypedef enum drm_stat_type drm_stat_type_t;
116201e04c3fSmrgtypedef struct drm_stats drm_stats_t;
116301e04c3fSmrgtypedef enum drm_lock_flags drm_lock_flags_t;
116401e04c3fSmrgtypedef struct drm_lock drm_lock_t;
116501e04c3fSmrgtypedef enum drm_dma_flags drm_dma_flags_t;
116601e04c3fSmrgtypedef struct drm_buf_desc drm_buf_desc_t;
116701e04c3fSmrgtypedef struct drm_buf_info drm_buf_info_t;
116801e04c3fSmrgtypedef struct drm_buf_free drm_buf_free_t;
116901e04c3fSmrgtypedef struct drm_buf_pub drm_buf_pub_t;
117001e04c3fSmrgtypedef struct drm_buf_map drm_buf_map_t;
117101e04c3fSmrgtypedef struct drm_dma drm_dma_t;
117201e04c3fSmrgtypedef union drm_wait_vblank drm_wait_vblank_t;
117301e04c3fSmrgtypedef struct drm_agp_mode drm_agp_mode_t;
117401e04c3fSmrgtypedef enum drm_ctx_flags drm_ctx_flags_t;
117501e04c3fSmrgtypedef struct drm_ctx drm_ctx_t;
117601e04c3fSmrgtypedef struct drm_ctx_res drm_ctx_res_t;
117701e04c3fSmrgtypedef struct drm_draw drm_draw_t;
117801e04c3fSmrgtypedef struct drm_update_draw drm_update_draw_t;
117901e04c3fSmrgtypedef struct drm_auth drm_auth_t;
118001e04c3fSmrgtypedef struct drm_irq_busid drm_irq_busid_t;
118101e04c3fSmrgtypedef enum drm_vblank_seq_type drm_vblank_seq_type_t;
118201e04c3fSmrg
118301e04c3fSmrgtypedef struct drm_agp_buffer drm_agp_buffer_t;
118401e04c3fSmrgtypedef struct drm_agp_binding drm_agp_binding_t;
118501e04c3fSmrgtypedef struct drm_agp_info drm_agp_info_t;
118601e04c3fSmrgtypedef struct drm_scatter_gather drm_scatter_gather_t;
118701e04c3fSmrgtypedef struct drm_set_version drm_set_version_t;
118801e04c3fSmrg
118901e04c3fSmrg#if defined(__cplusplus)
119001e04c3fSmrg}
119101e04c3fSmrg#endif
119201e04c3fSmrg
119301e04c3fSmrg#endif
1194