162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Header for the Direct Rendering Manager
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Author: Rickard E. (Rik) Faith <faith@valinux.com>
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Acknowledgments:
762306a36Sopenharmony_ci * Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic cmpxchg.
862306a36Sopenharmony_ci */
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci/*
1162306a36Sopenharmony_ci * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
1262306a36Sopenharmony_ci * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
1362306a36Sopenharmony_ci * All rights reserved.
1462306a36Sopenharmony_ci *
1562306a36Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
1662306a36Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
1762306a36Sopenharmony_ci * to deal in the Software without restriction, including without limitation
1862306a36Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
1962306a36Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
2062306a36Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
2162306a36Sopenharmony_ci *
2262306a36Sopenharmony_ci * The above copyright notice and this permission notice (including the next
2362306a36Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
2462306a36Sopenharmony_ci * Software.
2562306a36Sopenharmony_ci *
2662306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2762306a36Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2862306a36Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
2962306a36Sopenharmony_ci * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
3062306a36Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3162306a36Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3262306a36Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE.
3362306a36Sopenharmony_ci */
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#ifndef _DRM_H_
3662306a36Sopenharmony_ci#define _DRM_H_
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#if defined(__KERNEL__)
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#include <linux/types.h>
4162306a36Sopenharmony_ci#include <asm/ioctl.h>
4262306a36Sopenharmony_citypedef unsigned int drm_handle_t;
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci#elif defined(__linux__)
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci#include <linux/types.h>
4762306a36Sopenharmony_ci#include <asm/ioctl.h>
4862306a36Sopenharmony_citypedef unsigned int drm_handle_t;
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci#else /* One of the BSDs */
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci#include <stdint.h>
5362306a36Sopenharmony_ci#include <sys/ioccom.h>
5462306a36Sopenharmony_ci#include <sys/types.h>
5562306a36Sopenharmony_citypedef int8_t   __s8;
5662306a36Sopenharmony_citypedef uint8_t  __u8;
5762306a36Sopenharmony_citypedef int16_t  __s16;
5862306a36Sopenharmony_citypedef uint16_t __u16;
5962306a36Sopenharmony_citypedef int32_t  __s32;
6062306a36Sopenharmony_citypedef uint32_t __u32;
6162306a36Sopenharmony_citypedef int64_t  __s64;
6262306a36Sopenharmony_citypedef uint64_t __u64;
6362306a36Sopenharmony_citypedef size_t   __kernel_size_t;
6462306a36Sopenharmony_citypedef unsigned long drm_handle_t;
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci#endif
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci#if defined(__cplusplus)
6962306a36Sopenharmony_ciextern "C" {
7062306a36Sopenharmony_ci#endif
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci#define DRM_NAME	"drm"	  /**< Name in kernel, /dev, and /proc */
7362306a36Sopenharmony_ci#define DRM_MIN_ORDER	5	  /**< At least 2^5 bytes = 32 bytes */
7462306a36Sopenharmony_ci#define DRM_MAX_ORDER	22	  /**< Up to 2^22 bytes = 4MB */
7562306a36Sopenharmony_ci#define DRM_RAM_PERCENT 10	  /**< How much system ram can we lock? */
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci#define _DRM_LOCK_HELD	0x80000000U /**< Hardware lock is held */
7862306a36Sopenharmony_ci#define _DRM_LOCK_CONT	0x40000000U /**< Hardware lock is contended */
7962306a36Sopenharmony_ci#define _DRM_LOCK_IS_HELD(lock)	   ((lock) & _DRM_LOCK_HELD)
8062306a36Sopenharmony_ci#define _DRM_LOCK_IS_CONT(lock)	   ((lock) & _DRM_LOCK_CONT)
8162306a36Sopenharmony_ci#define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT))
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_citypedef unsigned int drm_context_t;
8462306a36Sopenharmony_citypedef unsigned int drm_drawable_t;
8562306a36Sopenharmony_citypedef unsigned int drm_magic_t;
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci/*
8862306a36Sopenharmony_ci * Cliprect.
8962306a36Sopenharmony_ci *
9062306a36Sopenharmony_ci * \warning: If you change this structure, make sure you change
9162306a36Sopenharmony_ci * XF86DRIClipRectRec in the server as well
9262306a36Sopenharmony_ci *
9362306a36Sopenharmony_ci * \note KW: Actually it's illegal to change either for
9462306a36Sopenharmony_ci * backwards-compatibility reasons.
9562306a36Sopenharmony_ci */
9662306a36Sopenharmony_cistruct drm_clip_rect {
9762306a36Sopenharmony_ci	unsigned short x1;
9862306a36Sopenharmony_ci	unsigned short y1;
9962306a36Sopenharmony_ci	unsigned short x2;
10062306a36Sopenharmony_ci	unsigned short y2;
10162306a36Sopenharmony_ci};
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci/*
10462306a36Sopenharmony_ci * Drawable information.
10562306a36Sopenharmony_ci */
10662306a36Sopenharmony_cistruct drm_drawable_info {
10762306a36Sopenharmony_ci	unsigned int num_rects;
10862306a36Sopenharmony_ci	struct drm_clip_rect *rects;
10962306a36Sopenharmony_ci};
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci/*
11262306a36Sopenharmony_ci * Texture region,
11362306a36Sopenharmony_ci */
11462306a36Sopenharmony_cistruct drm_tex_region {
11562306a36Sopenharmony_ci	unsigned char next;
11662306a36Sopenharmony_ci	unsigned char prev;
11762306a36Sopenharmony_ci	unsigned char in_use;
11862306a36Sopenharmony_ci	unsigned char padding;
11962306a36Sopenharmony_ci	unsigned int age;
12062306a36Sopenharmony_ci};
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ci/*
12362306a36Sopenharmony_ci * Hardware lock.
12462306a36Sopenharmony_ci *
12562306a36Sopenharmony_ci * The lock structure is a simple cache-line aligned integer.  To avoid
12662306a36Sopenharmony_ci * processor bus contention on a multiprocessor system, there should not be any
12762306a36Sopenharmony_ci * other data stored in the same cache line.
12862306a36Sopenharmony_ci */
12962306a36Sopenharmony_cistruct drm_hw_lock {
13062306a36Sopenharmony_ci	__volatile__ unsigned int lock;		/**< lock variable */
13162306a36Sopenharmony_ci	char padding[60];			/**< Pad to cache line */
13262306a36Sopenharmony_ci};
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci/*
13562306a36Sopenharmony_ci * DRM_IOCTL_VERSION ioctl argument type.
13662306a36Sopenharmony_ci *
13762306a36Sopenharmony_ci * \sa drmGetVersion().
13862306a36Sopenharmony_ci */
13962306a36Sopenharmony_cistruct drm_version {
14062306a36Sopenharmony_ci	int version_major;	  /**< Major version */
14162306a36Sopenharmony_ci	int version_minor;	  /**< Minor version */
14262306a36Sopenharmony_ci	int version_patchlevel;	  /**< Patch level */
14362306a36Sopenharmony_ci	__kernel_size_t name_len;	  /**< Length of name buffer */
14462306a36Sopenharmony_ci	char __user *name;	  /**< Name of driver */
14562306a36Sopenharmony_ci	__kernel_size_t date_len;	  /**< Length of date buffer */
14662306a36Sopenharmony_ci	char __user *date;	  /**< User-space buffer to hold date */
14762306a36Sopenharmony_ci	__kernel_size_t desc_len;	  /**< Length of desc buffer */
14862306a36Sopenharmony_ci	char __user *desc;	  /**< User-space buffer to hold desc */
14962306a36Sopenharmony_ci};
15062306a36Sopenharmony_ci
15162306a36Sopenharmony_ci/*
15262306a36Sopenharmony_ci * DRM_IOCTL_GET_UNIQUE ioctl argument type.
15362306a36Sopenharmony_ci *
15462306a36Sopenharmony_ci * \sa drmGetBusid() and drmSetBusId().
15562306a36Sopenharmony_ci */
15662306a36Sopenharmony_cistruct drm_unique {
15762306a36Sopenharmony_ci	__kernel_size_t unique_len;	  /**< Length of unique */
15862306a36Sopenharmony_ci	char __user *unique;	  /**< Unique name for driver instantiation */
15962306a36Sopenharmony_ci};
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_cistruct drm_list {
16262306a36Sopenharmony_ci	int count;		  /**< Length of user-space structures */
16362306a36Sopenharmony_ci	struct drm_version __user *version;
16462306a36Sopenharmony_ci};
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_cistruct drm_block {
16762306a36Sopenharmony_ci	int unused;
16862306a36Sopenharmony_ci};
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_ci/*
17162306a36Sopenharmony_ci * DRM_IOCTL_CONTROL ioctl argument type.
17262306a36Sopenharmony_ci *
17362306a36Sopenharmony_ci * \sa drmCtlInstHandler() and drmCtlUninstHandler().
17462306a36Sopenharmony_ci */
17562306a36Sopenharmony_cistruct drm_control {
17662306a36Sopenharmony_ci	enum {
17762306a36Sopenharmony_ci		DRM_ADD_COMMAND,
17862306a36Sopenharmony_ci		DRM_RM_COMMAND,
17962306a36Sopenharmony_ci		DRM_INST_HANDLER,
18062306a36Sopenharmony_ci		DRM_UNINST_HANDLER
18162306a36Sopenharmony_ci	} func;
18262306a36Sopenharmony_ci	int irq;
18362306a36Sopenharmony_ci};
18462306a36Sopenharmony_ci
18562306a36Sopenharmony_ci/*
18662306a36Sopenharmony_ci * Type of memory to map.
18762306a36Sopenharmony_ci */
18862306a36Sopenharmony_cienum drm_map_type {
18962306a36Sopenharmony_ci	_DRM_FRAME_BUFFER = 0,	  /**< WC (no caching), no core dump */
19062306a36Sopenharmony_ci	_DRM_REGISTERS = 1,	  /**< no caching, no core dump */
19162306a36Sopenharmony_ci	_DRM_SHM = 2,		  /**< shared, cached */
19262306a36Sopenharmony_ci	_DRM_AGP = 3,		  /**< AGP/GART */
19362306a36Sopenharmony_ci	_DRM_SCATTER_GATHER = 4,  /**< Scatter/gather memory for PCI DMA */
19462306a36Sopenharmony_ci	_DRM_CONSISTENT = 5	  /**< Consistent memory for PCI DMA */
19562306a36Sopenharmony_ci};
19662306a36Sopenharmony_ci
19762306a36Sopenharmony_ci/*
19862306a36Sopenharmony_ci * Memory mapping flags.
19962306a36Sopenharmony_ci */
20062306a36Sopenharmony_cienum drm_map_flags {
20162306a36Sopenharmony_ci	_DRM_RESTRICTED = 0x01,	     /**< Cannot be mapped to user-virtual */
20262306a36Sopenharmony_ci	_DRM_READ_ONLY = 0x02,
20362306a36Sopenharmony_ci	_DRM_LOCKED = 0x04,	     /**< shared, cached, locked */
20462306a36Sopenharmony_ci	_DRM_KERNEL = 0x08,	     /**< kernel requires access */
20562306a36Sopenharmony_ci	_DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */
20662306a36Sopenharmony_ci	_DRM_CONTAINS_LOCK = 0x20,   /**< SHM page that contains lock */
20762306a36Sopenharmony_ci	_DRM_REMOVABLE = 0x40,	     /**< Removable mapping */
20862306a36Sopenharmony_ci	_DRM_DRIVER = 0x80	     /**< Managed by driver */
20962306a36Sopenharmony_ci};
21062306a36Sopenharmony_ci
21162306a36Sopenharmony_cistruct drm_ctx_priv_map {
21262306a36Sopenharmony_ci	unsigned int ctx_id;	 /**< Context requesting private mapping */
21362306a36Sopenharmony_ci	void *handle;		 /**< Handle of map */
21462306a36Sopenharmony_ci};
21562306a36Sopenharmony_ci
21662306a36Sopenharmony_ci/*
21762306a36Sopenharmony_ci * DRM_IOCTL_GET_MAP, DRM_IOCTL_ADD_MAP and DRM_IOCTL_RM_MAP ioctls
21862306a36Sopenharmony_ci * argument type.
21962306a36Sopenharmony_ci *
22062306a36Sopenharmony_ci * \sa drmAddMap().
22162306a36Sopenharmony_ci */
22262306a36Sopenharmony_cistruct drm_map {
22362306a36Sopenharmony_ci	unsigned long offset;	 /**< Requested physical address (0 for SAREA)*/
22462306a36Sopenharmony_ci	unsigned long size;	 /**< Requested physical size (bytes) */
22562306a36Sopenharmony_ci	enum drm_map_type type;	 /**< Type of memory to map */
22662306a36Sopenharmony_ci	enum drm_map_flags flags;	 /**< Flags */
22762306a36Sopenharmony_ci	void *handle;		 /**< User-space: "Handle" to pass to mmap() */
22862306a36Sopenharmony_ci				 /**< Kernel-space: kernel-virtual address */
22962306a36Sopenharmony_ci	int mtrr;		 /**< MTRR slot used */
23062306a36Sopenharmony_ci	/*   Private data */
23162306a36Sopenharmony_ci};
23262306a36Sopenharmony_ci
23362306a36Sopenharmony_ci/*
23462306a36Sopenharmony_ci * DRM_IOCTL_GET_CLIENT ioctl argument type.
23562306a36Sopenharmony_ci */
23662306a36Sopenharmony_cistruct drm_client {
23762306a36Sopenharmony_ci	int idx;		/**< Which client desired? */
23862306a36Sopenharmony_ci	int auth;		/**< Is client authenticated? */
23962306a36Sopenharmony_ci	unsigned long pid;	/**< Process ID */
24062306a36Sopenharmony_ci	unsigned long uid;	/**< User ID */
24162306a36Sopenharmony_ci	unsigned long magic;	/**< Magic */
24262306a36Sopenharmony_ci	unsigned long iocs;	/**< Ioctl count */
24362306a36Sopenharmony_ci};
24462306a36Sopenharmony_ci
24562306a36Sopenharmony_cienum drm_stat_type {
24662306a36Sopenharmony_ci	_DRM_STAT_LOCK,
24762306a36Sopenharmony_ci	_DRM_STAT_OPENS,
24862306a36Sopenharmony_ci	_DRM_STAT_CLOSES,
24962306a36Sopenharmony_ci	_DRM_STAT_IOCTLS,
25062306a36Sopenharmony_ci	_DRM_STAT_LOCKS,
25162306a36Sopenharmony_ci	_DRM_STAT_UNLOCKS,
25262306a36Sopenharmony_ci	_DRM_STAT_VALUE,	/**< Generic value */
25362306a36Sopenharmony_ci	_DRM_STAT_BYTE,		/**< Generic byte counter (1024bytes/K) */
25462306a36Sopenharmony_ci	_DRM_STAT_COUNT,	/**< Generic non-byte counter (1000/k) */
25562306a36Sopenharmony_ci
25662306a36Sopenharmony_ci	_DRM_STAT_IRQ,		/**< IRQ */
25762306a36Sopenharmony_ci	_DRM_STAT_PRIMARY,	/**< Primary DMA bytes */
25862306a36Sopenharmony_ci	_DRM_STAT_SECONDARY,	/**< Secondary DMA bytes */
25962306a36Sopenharmony_ci	_DRM_STAT_DMA,		/**< DMA */
26062306a36Sopenharmony_ci	_DRM_STAT_SPECIAL,	/**< Special DMA (e.g., priority or polled) */
26162306a36Sopenharmony_ci	_DRM_STAT_MISSED	/**< Missed DMA opportunity */
26262306a36Sopenharmony_ci	    /* Add to the *END* of the list */
26362306a36Sopenharmony_ci};
26462306a36Sopenharmony_ci
26562306a36Sopenharmony_ci/*
26662306a36Sopenharmony_ci * DRM_IOCTL_GET_STATS ioctl argument type.
26762306a36Sopenharmony_ci */
26862306a36Sopenharmony_cistruct drm_stats {
26962306a36Sopenharmony_ci	unsigned long count;
27062306a36Sopenharmony_ci	struct {
27162306a36Sopenharmony_ci		unsigned long value;
27262306a36Sopenharmony_ci		enum drm_stat_type type;
27362306a36Sopenharmony_ci	} data[15];
27462306a36Sopenharmony_ci};
27562306a36Sopenharmony_ci
27662306a36Sopenharmony_ci/*
27762306a36Sopenharmony_ci * Hardware locking flags.
27862306a36Sopenharmony_ci */
27962306a36Sopenharmony_cienum drm_lock_flags {
28062306a36Sopenharmony_ci	_DRM_LOCK_READY = 0x01,	     /**< Wait until hardware is ready for DMA */
28162306a36Sopenharmony_ci	_DRM_LOCK_QUIESCENT = 0x02,  /**< Wait until hardware quiescent */
28262306a36Sopenharmony_ci	_DRM_LOCK_FLUSH = 0x04,	     /**< Flush this context's DMA queue first */
28362306a36Sopenharmony_ci	_DRM_LOCK_FLUSH_ALL = 0x08,  /**< Flush all DMA queues first */
28462306a36Sopenharmony_ci	/* These *HALT* flags aren't supported yet
28562306a36Sopenharmony_ci	   -- they will be used to support the
28662306a36Sopenharmony_ci	   full-screen DGA-like mode. */
28762306a36Sopenharmony_ci	_DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */
28862306a36Sopenharmony_ci	_DRM_HALT_CUR_QUEUES = 0x20  /**< Halt all current queues */
28962306a36Sopenharmony_ci};
29062306a36Sopenharmony_ci
29162306a36Sopenharmony_ci/*
29262306a36Sopenharmony_ci * DRM_IOCTL_LOCK, DRM_IOCTL_UNLOCK and DRM_IOCTL_FINISH ioctl argument type.
29362306a36Sopenharmony_ci *
29462306a36Sopenharmony_ci * \sa drmGetLock() and drmUnlock().
29562306a36Sopenharmony_ci */
29662306a36Sopenharmony_cistruct drm_lock {
29762306a36Sopenharmony_ci	int context;
29862306a36Sopenharmony_ci	enum drm_lock_flags flags;
29962306a36Sopenharmony_ci};
30062306a36Sopenharmony_ci
30162306a36Sopenharmony_ci/*
30262306a36Sopenharmony_ci * DMA flags
30362306a36Sopenharmony_ci *
30462306a36Sopenharmony_ci * \warning
30562306a36Sopenharmony_ci * These values \e must match xf86drm.h.
30662306a36Sopenharmony_ci *
30762306a36Sopenharmony_ci * \sa drm_dma.
30862306a36Sopenharmony_ci */
30962306a36Sopenharmony_cienum drm_dma_flags {
31062306a36Sopenharmony_ci	/* Flags for DMA buffer dispatch */
31162306a36Sopenharmony_ci	_DRM_DMA_BLOCK = 0x01,	      /**<
31262306a36Sopenharmony_ci				       * Block until buffer dispatched.
31362306a36Sopenharmony_ci				       *
31462306a36Sopenharmony_ci				       * \note The buffer may not yet have
31562306a36Sopenharmony_ci				       * been processed by the hardware --
31662306a36Sopenharmony_ci				       * getting a hardware lock with the
31762306a36Sopenharmony_ci				       * hardware quiescent will ensure
31862306a36Sopenharmony_ci				       * that the buffer has been
31962306a36Sopenharmony_ci				       * processed.
32062306a36Sopenharmony_ci				       */
32162306a36Sopenharmony_ci	_DRM_DMA_WHILE_LOCKED = 0x02, /**< Dispatch while lock held */
32262306a36Sopenharmony_ci	_DRM_DMA_PRIORITY = 0x04,     /**< High priority dispatch */
32362306a36Sopenharmony_ci
32462306a36Sopenharmony_ci	/* Flags for DMA buffer request */
32562306a36Sopenharmony_ci	_DRM_DMA_WAIT = 0x10,	      /**< Wait for free buffers */
32662306a36Sopenharmony_ci	_DRM_DMA_SMALLER_OK = 0x20,   /**< Smaller-than-requested buffers OK */
32762306a36Sopenharmony_ci	_DRM_DMA_LARGER_OK = 0x40     /**< Larger-than-requested buffers OK */
32862306a36Sopenharmony_ci};
32962306a36Sopenharmony_ci
33062306a36Sopenharmony_ci/*
33162306a36Sopenharmony_ci * DRM_IOCTL_ADD_BUFS and DRM_IOCTL_MARK_BUFS ioctl argument type.
33262306a36Sopenharmony_ci *
33362306a36Sopenharmony_ci * \sa drmAddBufs().
33462306a36Sopenharmony_ci */
33562306a36Sopenharmony_cistruct drm_buf_desc {
33662306a36Sopenharmony_ci	int count;		 /**< Number of buffers of this size */
33762306a36Sopenharmony_ci	int size;		 /**< Size in bytes */
33862306a36Sopenharmony_ci	int low_mark;		 /**< Low water mark */
33962306a36Sopenharmony_ci	int high_mark;		 /**< High water mark */
34062306a36Sopenharmony_ci	enum {
34162306a36Sopenharmony_ci		_DRM_PAGE_ALIGN = 0x01,	/**< Align on page boundaries for DMA */
34262306a36Sopenharmony_ci		_DRM_AGP_BUFFER = 0x02,	/**< Buffer is in AGP space */
34362306a36Sopenharmony_ci		_DRM_SG_BUFFER = 0x04,	/**< Scatter/gather memory buffer */
34462306a36Sopenharmony_ci		_DRM_FB_BUFFER = 0x08,	/**< Buffer is in frame buffer */
34562306a36Sopenharmony_ci		_DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */
34662306a36Sopenharmony_ci	} flags;
34762306a36Sopenharmony_ci	unsigned long agp_start; /**<
34862306a36Sopenharmony_ci				  * Start address of where the AGP buffers are
34962306a36Sopenharmony_ci				  * in the AGP aperture
35062306a36Sopenharmony_ci				  */
35162306a36Sopenharmony_ci};
35262306a36Sopenharmony_ci
35362306a36Sopenharmony_ci/*
35462306a36Sopenharmony_ci * DRM_IOCTL_INFO_BUFS ioctl argument type.
35562306a36Sopenharmony_ci */
35662306a36Sopenharmony_cistruct drm_buf_info {
35762306a36Sopenharmony_ci	int count;		/**< Entries in list */
35862306a36Sopenharmony_ci	struct drm_buf_desc __user *list;
35962306a36Sopenharmony_ci};
36062306a36Sopenharmony_ci
36162306a36Sopenharmony_ci/*
36262306a36Sopenharmony_ci * DRM_IOCTL_FREE_BUFS ioctl argument type.
36362306a36Sopenharmony_ci */
36462306a36Sopenharmony_cistruct drm_buf_free {
36562306a36Sopenharmony_ci	int count;
36662306a36Sopenharmony_ci	int __user *list;
36762306a36Sopenharmony_ci};
36862306a36Sopenharmony_ci
36962306a36Sopenharmony_ci/*
37062306a36Sopenharmony_ci * Buffer information
37162306a36Sopenharmony_ci *
37262306a36Sopenharmony_ci * \sa drm_buf_map.
37362306a36Sopenharmony_ci */
37462306a36Sopenharmony_cistruct drm_buf_pub {
37562306a36Sopenharmony_ci	int idx;		       /**< Index into the master buffer list */
37662306a36Sopenharmony_ci	int total;		       /**< Buffer size */
37762306a36Sopenharmony_ci	int used;		       /**< Amount of buffer in use (for DMA) */
37862306a36Sopenharmony_ci	void __user *address;	       /**< Address of buffer */
37962306a36Sopenharmony_ci};
38062306a36Sopenharmony_ci
38162306a36Sopenharmony_ci/*
38262306a36Sopenharmony_ci * DRM_IOCTL_MAP_BUFS ioctl argument type.
38362306a36Sopenharmony_ci */
38462306a36Sopenharmony_cistruct drm_buf_map {
38562306a36Sopenharmony_ci	int count;		/**< Length of the buffer list */
38662306a36Sopenharmony_ci#ifdef __cplusplus
38762306a36Sopenharmony_ci	void __user *virt;
38862306a36Sopenharmony_ci#else
38962306a36Sopenharmony_ci	void __user *virtual;		/**< Mmap'd area in user-virtual */
39062306a36Sopenharmony_ci#endif
39162306a36Sopenharmony_ci	struct drm_buf_pub __user *list;	/**< Buffer information */
39262306a36Sopenharmony_ci};
39362306a36Sopenharmony_ci
39462306a36Sopenharmony_ci/*
39562306a36Sopenharmony_ci * DRM_IOCTL_DMA ioctl argument type.
39662306a36Sopenharmony_ci *
39762306a36Sopenharmony_ci * Indices here refer to the offset into the buffer list in drm_buf_get.
39862306a36Sopenharmony_ci *
39962306a36Sopenharmony_ci * \sa drmDMA().
40062306a36Sopenharmony_ci */
40162306a36Sopenharmony_cistruct drm_dma {
40262306a36Sopenharmony_ci	int context;			  /**< Context handle */
40362306a36Sopenharmony_ci	int send_count;			  /**< Number of buffers to send */
40462306a36Sopenharmony_ci	int __user *send_indices;	  /**< List of handles to buffers */
40562306a36Sopenharmony_ci	int __user *send_sizes;		  /**< Lengths of data to send */
40662306a36Sopenharmony_ci	enum drm_dma_flags flags;	  /**< Flags */
40762306a36Sopenharmony_ci	int request_count;		  /**< Number of buffers requested */
40862306a36Sopenharmony_ci	int request_size;		  /**< Desired size for buffers */
40962306a36Sopenharmony_ci	int __user *request_indices;	  /**< Buffer information */
41062306a36Sopenharmony_ci	int __user *request_sizes;
41162306a36Sopenharmony_ci	int granted_count;		  /**< Number of buffers granted */
41262306a36Sopenharmony_ci};
41362306a36Sopenharmony_ci
41462306a36Sopenharmony_cienum drm_ctx_flags {
41562306a36Sopenharmony_ci	_DRM_CONTEXT_PRESERVED = 0x01,
41662306a36Sopenharmony_ci	_DRM_CONTEXT_2DONLY = 0x02
41762306a36Sopenharmony_ci};
41862306a36Sopenharmony_ci
41962306a36Sopenharmony_ci/*
42062306a36Sopenharmony_ci * DRM_IOCTL_ADD_CTX ioctl argument type.
42162306a36Sopenharmony_ci *
42262306a36Sopenharmony_ci * \sa drmCreateContext() and drmDestroyContext().
42362306a36Sopenharmony_ci */
42462306a36Sopenharmony_cistruct drm_ctx {
42562306a36Sopenharmony_ci	drm_context_t handle;
42662306a36Sopenharmony_ci	enum drm_ctx_flags flags;
42762306a36Sopenharmony_ci};
42862306a36Sopenharmony_ci
42962306a36Sopenharmony_ci/*
43062306a36Sopenharmony_ci * DRM_IOCTL_RES_CTX ioctl argument type.
43162306a36Sopenharmony_ci */
43262306a36Sopenharmony_cistruct drm_ctx_res {
43362306a36Sopenharmony_ci	int count;
43462306a36Sopenharmony_ci	struct drm_ctx __user *contexts;
43562306a36Sopenharmony_ci};
43662306a36Sopenharmony_ci
43762306a36Sopenharmony_ci/*
43862306a36Sopenharmony_ci * DRM_IOCTL_ADD_DRAW and DRM_IOCTL_RM_DRAW ioctl argument type.
43962306a36Sopenharmony_ci */
44062306a36Sopenharmony_cistruct drm_draw {
44162306a36Sopenharmony_ci	drm_drawable_t handle;
44262306a36Sopenharmony_ci};
44362306a36Sopenharmony_ci
44462306a36Sopenharmony_ci/*
44562306a36Sopenharmony_ci * DRM_IOCTL_UPDATE_DRAW ioctl argument type.
44662306a36Sopenharmony_ci */
44762306a36Sopenharmony_citypedef enum {
44862306a36Sopenharmony_ci	DRM_DRAWABLE_CLIPRECTS
44962306a36Sopenharmony_ci} drm_drawable_info_type_t;
45062306a36Sopenharmony_ci
45162306a36Sopenharmony_cistruct drm_update_draw {
45262306a36Sopenharmony_ci	drm_drawable_t handle;
45362306a36Sopenharmony_ci	unsigned int type;
45462306a36Sopenharmony_ci	unsigned int num;
45562306a36Sopenharmony_ci	unsigned long long data;
45662306a36Sopenharmony_ci};
45762306a36Sopenharmony_ci
45862306a36Sopenharmony_ci/*
45962306a36Sopenharmony_ci * DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type.
46062306a36Sopenharmony_ci */
46162306a36Sopenharmony_cistruct drm_auth {
46262306a36Sopenharmony_ci	drm_magic_t magic;
46362306a36Sopenharmony_ci};
46462306a36Sopenharmony_ci
46562306a36Sopenharmony_ci/*
46662306a36Sopenharmony_ci * DRM_IOCTL_IRQ_BUSID ioctl argument type.
46762306a36Sopenharmony_ci *
46862306a36Sopenharmony_ci * \sa drmGetInterruptFromBusID().
46962306a36Sopenharmony_ci */
47062306a36Sopenharmony_cistruct drm_irq_busid {
47162306a36Sopenharmony_ci	int irq;	/**< IRQ number */
47262306a36Sopenharmony_ci	int busnum;	/**< bus number */
47362306a36Sopenharmony_ci	int devnum;	/**< device number */
47462306a36Sopenharmony_ci	int funcnum;	/**< function number */
47562306a36Sopenharmony_ci};
47662306a36Sopenharmony_ci
47762306a36Sopenharmony_cienum drm_vblank_seq_type {
47862306a36Sopenharmony_ci	_DRM_VBLANK_ABSOLUTE = 0x0,	/**< Wait for specific vblank sequence number */
47962306a36Sopenharmony_ci	_DRM_VBLANK_RELATIVE = 0x1,	/**< Wait for given number of vblanks */
48062306a36Sopenharmony_ci	/* bits 1-6 are reserved for high crtcs */
48162306a36Sopenharmony_ci	_DRM_VBLANK_HIGH_CRTC_MASK = 0x0000003e,
48262306a36Sopenharmony_ci	_DRM_VBLANK_EVENT = 0x4000000,   /**< Send event instead of blocking */
48362306a36Sopenharmony_ci	_DRM_VBLANK_FLIP = 0x8000000,   /**< Scheduled buffer swap should flip */
48462306a36Sopenharmony_ci	_DRM_VBLANK_NEXTONMISS = 0x10000000,	/**< If missed, wait for next vblank */
48562306a36Sopenharmony_ci	_DRM_VBLANK_SECONDARY = 0x20000000,	/**< Secondary display controller */
48662306a36Sopenharmony_ci	_DRM_VBLANK_SIGNAL = 0x40000000	/**< Send signal instead of blocking, unsupported */
48762306a36Sopenharmony_ci};
48862306a36Sopenharmony_ci#define _DRM_VBLANK_HIGH_CRTC_SHIFT 1
48962306a36Sopenharmony_ci
49062306a36Sopenharmony_ci#define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE)
49162306a36Sopenharmony_ci#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \
49262306a36Sopenharmony_ci				_DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS)
49362306a36Sopenharmony_ci
49462306a36Sopenharmony_cistruct drm_wait_vblank_request {
49562306a36Sopenharmony_ci	enum drm_vblank_seq_type type;
49662306a36Sopenharmony_ci	unsigned int sequence;
49762306a36Sopenharmony_ci	unsigned long signal;
49862306a36Sopenharmony_ci};
49962306a36Sopenharmony_ci
50062306a36Sopenharmony_cistruct drm_wait_vblank_reply {
50162306a36Sopenharmony_ci	enum drm_vblank_seq_type type;
50262306a36Sopenharmony_ci	unsigned int sequence;
50362306a36Sopenharmony_ci	long tval_sec;
50462306a36Sopenharmony_ci	long tval_usec;
50562306a36Sopenharmony_ci};
50662306a36Sopenharmony_ci
50762306a36Sopenharmony_ci/*
50862306a36Sopenharmony_ci * DRM_IOCTL_WAIT_VBLANK ioctl argument type.
50962306a36Sopenharmony_ci *
51062306a36Sopenharmony_ci * \sa drmWaitVBlank().
51162306a36Sopenharmony_ci */
51262306a36Sopenharmony_ciunion drm_wait_vblank {
51362306a36Sopenharmony_ci	struct drm_wait_vblank_request request;
51462306a36Sopenharmony_ci	struct drm_wait_vblank_reply reply;
51562306a36Sopenharmony_ci};
51662306a36Sopenharmony_ci
51762306a36Sopenharmony_ci#define _DRM_PRE_MODESET 1
51862306a36Sopenharmony_ci#define _DRM_POST_MODESET 2
51962306a36Sopenharmony_ci
52062306a36Sopenharmony_ci/*
52162306a36Sopenharmony_ci * DRM_IOCTL_MODESET_CTL ioctl argument type
52262306a36Sopenharmony_ci *
52362306a36Sopenharmony_ci * \sa drmModesetCtl().
52462306a36Sopenharmony_ci */
52562306a36Sopenharmony_cistruct drm_modeset_ctl {
52662306a36Sopenharmony_ci	__u32 crtc;
52762306a36Sopenharmony_ci	__u32 cmd;
52862306a36Sopenharmony_ci};
52962306a36Sopenharmony_ci
53062306a36Sopenharmony_ci/*
53162306a36Sopenharmony_ci * DRM_IOCTL_AGP_ENABLE ioctl argument type.
53262306a36Sopenharmony_ci *
53362306a36Sopenharmony_ci * \sa drmAgpEnable().
53462306a36Sopenharmony_ci */
53562306a36Sopenharmony_cistruct drm_agp_mode {
53662306a36Sopenharmony_ci	unsigned long mode;	/**< AGP mode */
53762306a36Sopenharmony_ci};
53862306a36Sopenharmony_ci
53962306a36Sopenharmony_ci/*
54062306a36Sopenharmony_ci * DRM_IOCTL_AGP_ALLOC and DRM_IOCTL_AGP_FREE ioctls argument type.
54162306a36Sopenharmony_ci *
54262306a36Sopenharmony_ci * \sa drmAgpAlloc() and drmAgpFree().
54362306a36Sopenharmony_ci */
54462306a36Sopenharmony_cistruct drm_agp_buffer {
54562306a36Sopenharmony_ci	unsigned long size;	/**< In bytes -- will round to page boundary */
54662306a36Sopenharmony_ci	unsigned long handle;	/**< Used for binding / unbinding */
54762306a36Sopenharmony_ci	unsigned long type;	/**< Type of memory to allocate */
54862306a36Sopenharmony_ci	unsigned long physical;	/**< Physical used by i810 */
54962306a36Sopenharmony_ci};
55062306a36Sopenharmony_ci
55162306a36Sopenharmony_ci/*
55262306a36Sopenharmony_ci * DRM_IOCTL_AGP_BIND and DRM_IOCTL_AGP_UNBIND ioctls argument type.
55362306a36Sopenharmony_ci *
55462306a36Sopenharmony_ci * \sa drmAgpBind() and drmAgpUnbind().
55562306a36Sopenharmony_ci */
55662306a36Sopenharmony_cistruct drm_agp_binding {
55762306a36Sopenharmony_ci	unsigned long handle;	/**< From drm_agp_buffer */
55862306a36Sopenharmony_ci	unsigned long offset;	/**< In bytes -- will round to page boundary */
55962306a36Sopenharmony_ci};
56062306a36Sopenharmony_ci
56162306a36Sopenharmony_ci/*
56262306a36Sopenharmony_ci * DRM_IOCTL_AGP_INFO ioctl argument type.
56362306a36Sopenharmony_ci *
56462306a36Sopenharmony_ci * \sa drmAgpVersionMajor(), drmAgpVersionMinor(), drmAgpGetMode(),
56562306a36Sopenharmony_ci * drmAgpBase(), drmAgpSize(), drmAgpMemoryUsed(), drmAgpMemoryAvail(),
56662306a36Sopenharmony_ci * drmAgpVendorId() and drmAgpDeviceId().
56762306a36Sopenharmony_ci */
56862306a36Sopenharmony_cistruct drm_agp_info {
56962306a36Sopenharmony_ci	int agp_version_major;
57062306a36Sopenharmony_ci	int agp_version_minor;
57162306a36Sopenharmony_ci	unsigned long mode;
57262306a36Sopenharmony_ci	unsigned long aperture_base;	/* physical address */
57362306a36Sopenharmony_ci	unsigned long aperture_size;	/* bytes */
57462306a36Sopenharmony_ci	unsigned long memory_allowed;	/* bytes */
57562306a36Sopenharmony_ci	unsigned long memory_used;
57662306a36Sopenharmony_ci
57762306a36Sopenharmony_ci	/* PCI information */
57862306a36Sopenharmony_ci	unsigned short id_vendor;
57962306a36Sopenharmony_ci	unsigned short id_device;
58062306a36Sopenharmony_ci};
58162306a36Sopenharmony_ci
58262306a36Sopenharmony_ci/*
58362306a36Sopenharmony_ci * DRM_IOCTL_SG_ALLOC ioctl argument type.
58462306a36Sopenharmony_ci */
58562306a36Sopenharmony_cistruct drm_scatter_gather {
58662306a36Sopenharmony_ci	unsigned long size;	/**< In bytes -- will round to page boundary */
58762306a36Sopenharmony_ci	unsigned long handle;	/**< Used for mapping / unmapping */
58862306a36Sopenharmony_ci};
58962306a36Sopenharmony_ci
59062306a36Sopenharmony_ci/*
59162306a36Sopenharmony_ci * DRM_IOCTL_SET_VERSION ioctl argument type.
59262306a36Sopenharmony_ci */
59362306a36Sopenharmony_cistruct drm_set_version {
59462306a36Sopenharmony_ci	int drm_di_major;
59562306a36Sopenharmony_ci	int drm_di_minor;
59662306a36Sopenharmony_ci	int drm_dd_major;
59762306a36Sopenharmony_ci	int drm_dd_minor;
59862306a36Sopenharmony_ci};
59962306a36Sopenharmony_ci
60062306a36Sopenharmony_ci/* DRM_IOCTL_GEM_CLOSE ioctl argument type */
60162306a36Sopenharmony_cistruct drm_gem_close {
60262306a36Sopenharmony_ci	/** Handle of the object to be closed. */
60362306a36Sopenharmony_ci	__u32 handle;
60462306a36Sopenharmony_ci	__u32 pad;
60562306a36Sopenharmony_ci};
60662306a36Sopenharmony_ci
60762306a36Sopenharmony_ci/* DRM_IOCTL_GEM_FLINK ioctl argument type */
60862306a36Sopenharmony_cistruct drm_gem_flink {
60962306a36Sopenharmony_ci	/** Handle for the object being named */
61062306a36Sopenharmony_ci	__u32 handle;
61162306a36Sopenharmony_ci
61262306a36Sopenharmony_ci	/** Returned global name */
61362306a36Sopenharmony_ci	__u32 name;
61462306a36Sopenharmony_ci};
61562306a36Sopenharmony_ci
61662306a36Sopenharmony_ci/* DRM_IOCTL_GEM_OPEN ioctl argument type */
61762306a36Sopenharmony_cistruct drm_gem_open {
61862306a36Sopenharmony_ci	/** Name of object being opened */
61962306a36Sopenharmony_ci	__u32 name;
62062306a36Sopenharmony_ci
62162306a36Sopenharmony_ci	/** Returned handle for the object */
62262306a36Sopenharmony_ci	__u32 handle;
62362306a36Sopenharmony_ci
62462306a36Sopenharmony_ci	/** Returned size of the object */
62562306a36Sopenharmony_ci	__u64 size;
62662306a36Sopenharmony_ci};
62762306a36Sopenharmony_ci
62862306a36Sopenharmony_ci/**
62962306a36Sopenharmony_ci * DRM_CAP_DUMB_BUFFER
63062306a36Sopenharmony_ci *
63162306a36Sopenharmony_ci * If set to 1, the driver supports creating dumb buffers via the
63262306a36Sopenharmony_ci * &DRM_IOCTL_MODE_CREATE_DUMB ioctl.
63362306a36Sopenharmony_ci */
63462306a36Sopenharmony_ci#define DRM_CAP_DUMB_BUFFER		0x1
63562306a36Sopenharmony_ci/**
63662306a36Sopenharmony_ci * DRM_CAP_VBLANK_HIGH_CRTC
63762306a36Sopenharmony_ci *
63862306a36Sopenharmony_ci * If set to 1, the kernel supports specifying a :ref:`CRTC index<crtc_index>`
63962306a36Sopenharmony_ci * in the high bits of &drm_wait_vblank_request.type.
64062306a36Sopenharmony_ci *
64162306a36Sopenharmony_ci * Starting kernel version 2.6.39, this capability is always set to 1.
64262306a36Sopenharmony_ci */
64362306a36Sopenharmony_ci#define DRM_CAP_VBLANK_HIGH_CRTC	0x2
64462306a36Sopenharmony_ci/**
64562306a36Sopenharmony_ci * DRM_CAP_DUMB_PREFERRED_DEPTH
64662306a36Sopenharmony_ci *
64762306a36Sopenharmony_ci * The preferred bit depth for dumb buffers.
64862306a36Sopenharmony_ci *
64962306a36Sopenharmony_ci * The bit depth is the number of bits used to indicate the color of a single
65062306a36Sopenharmony_ci * pixel excluding any padding. This is different from the number of bits per
65162306a36Sopenharmony_ci * pixel. For instance, XRGB8888 has a bit depth of 24 but has 32 bits per
65262306a36Sopenharmony_ci * pixel.
65362306a36Sopenharmony_ci *
65462306a36Sopenharmony_ci * Note that this preference only applies to dumb buffers, it's irrelevant for
65562306a36Sopenharmony_ci * other types of buffers.
65662306a36Sopenharmony_ci */
65762306a36Sopenharmony_ci#define DRM_CAP_DUMB_PREFERRED_DEPTH	0x3
65862306a36Sopenharmony_ci/**
65962306a36Sopenharmony_ci * DRM_CAP_DUMB_PREFER_SHADOW
66062306a36Sopenharmony_ci *
66162306a36Sopenharmony_ci * If set to 1, the driver prefers userspace to render to a shadow buffer
66262306a36Sopenharmony_ci * instead of directly rendering to a dumb buffer. For best speed, userspace
66362306a36Sopenharmony_ci * should do streaming ordered memory copies into the dumb buffer and never
66462306a36Sopenharmony_ci * read from it.
66562306a36Sopenharmony_ci *
66662306a36Sopenharmony_ci * Note that this preference only applies to dumb buffers, it's irrelevant for
66762306a36Sopenharmony_ci * other types of buffers.
66862306a36Sopenharmony_ci */
66962306a36Sopenharmony_ci#define DRM_CAP_DUMB_PREFER_SHADOW	0x4
67062306a36Sopenharmony_ci/**
67162306a36Sopenharmony_ci * DRM_CAP_PRIME
67262306a36Sopenharmony_ci *
67362306a36Sopenharmony_ci * Bitfield of supported PRIME sharing capabilities. See &DRM_PRIME_CAP_IMPORT
67462306a36Sopenharmony_ci * and &DRM_PRIME_CAP_EXPORT.
67562306a36Sopenharmony_ci *
67662306a36Sopenharmony_ci * Starting from kernel version 6.6, both &DRM_PRIME_CAP_IMPORT and
67762306a36Sopenharmony_ci * &DRM_PRIME_CAP_EXPORT are always advertised.
67862306a36Sopenharmony_ci *
67962306a36Sopenharmony_ci * PRIME buffers are exposed as dma-buf file descriptors.
68062306a36Sopenharmony_ci * See :ref:`prime_buffer_sharing`.
68162306a36Sopenharmony_ci */
68262306a36Sopenharmony_ci#define DRM_CAP_PRIME			0x5
68362306a36Sopenharmony_ci/**
68462306a36Sopenharmony_ci * DRM_PRIME_CAP_IMPORT
68562306a36Sopenharmony_ci *
68662306a36Sopenharmony_ci * If this bit is set in &DRM_CAP_PRIME, the driver supports importing PRIME
68762306a36Sopenharmony_ci * buffers via the &DRM_IOCTL_PRIME_FD_TO_HANDLE ioctl.
68862306a36Sopenharmony_ci *
68962306a36Sopenharmony_ci * Starting from kernel version 6.6, this bit is always set in &DRM_CAP_PRIME.
69062306a36Sopenharmony_ci */
69162306a36Sopenharmony_ci#define  DRM_PRIME_CAP_IMPORT		0x1
69262306a36Sopenharmony_ci/**
69362306a36Sopenharmony_ci * DRM_PRIME_CAP_EXPORT
69462306a36Sopenharmony_ci *
69562306a36Sopenharmony_ci * If this bit is set in &DRM_CAP_PRIME, the driver supports exporting PRIME
69662306a36Sopenharmony_ci * buffers via the &DRM_IOCTL_PRIME_HANDLE_TO_FD ioctl.
69762306a36Sopenharmony_ci *
69862306a36Sopenharmony_ci * Starting from kernel version 6.6, this bit is always set in &DRM_CAP_PRIME.
69962306a36Sopenharmony_ci */
70062306a36Sopenharmony_ci#define  DRM_PRIME_CAP_EXPORT		0x2
70162306a36Sopenharmony_ci/**
70262306a36Sopenharmony_ci * DRM_CAP_TIMESTAMP_MONOTONIC
70362306a36Sopenharmony_ci *
70462306a36Sopenharmony_ci * If set to 0, the kernel will report timestamps with ``CLOCK_REALTIME`` in
70562306a36Sopenharmony_ci * struct drm_event_vblank. If set to 1, the kernel will report timestamps with
70662306a36Sopenharmony_ci * ``CLOCK_MONOTONIC``. See ``clock_gettime(2)`` for the definition of these
70762306a36Sopenharmony_ci * clocks.
70862306a36Sopenharmony_ci *
70962306a36Sopenharmony_ci * Starting from kernel version 2.6.39, the default value for this capability
71062306a36Sopenharmony_ci * is 1. Starting kernel version 4.15, this capability is always set to 1.
71162306a36Sopenharmony_ci */
71262306a36Sopenharmony_ci#define DRM_CAP_TIMESTAMP_MONOTONIC	0x6
71362306a36Sopenharmony_ci/**
71462306a36Sopenharmony_ci * DRM_CAP_ASYNC_PAGE_FLIP
71562306a36Sopenharmony_ci *
71662306a36Sopenharmony_ci * If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC.
71762306a36Sopenharmony_ci */
71862306a36Sopenharmony_ci#define DRM_CAP_ASYNC_PAGE_FLIP		0x7
71962306a36Sopenharmony_ci/**
72062306a36Sopenharmony_ci * DRM_CAP_CURSOR_WIDTH
72162306a36Sopenharmony_ci *
72262306a36Sopenharmony_ci * The ``CURSOR_WIDTH`` and ``CURSOR_HEIGHT`` capabilities return a valid
72362306a36Sopenharmony_ci * width x height combination for the hardware cursor. The intention is that a
72462306a36Sopenharmony_ci * hardware agnostic userspace can query a cursor plane size to use.
72562306a36Sopenharmony_ci *
72662306a36Sopenharmony_ci * Note that the cross-driver contract is to merely return a valid size;
72762306a36Sopenharmony_ci * drivers are free to attach another meaning on top, eg. i915 returns the
72862306a36Sopenharmony_ci * maximum plane size.
72962306a36Sopenharmony_ci */
73062306a36Sopenharmony_ci#define DRM_CAP_CURSOR_WIDTH		0x8
73162306a36Sopenharmony_ci/**
73262306a36Sopenharmony_ci * DRM_CAP_CURSOR_HEIGHT
73362306a36Sopenharmony_ci *
73462306a36Sopenharmony_ci * See &DRM_CAP_CURSOR_WIDTH.
73562306a36Sopenharmony_ci */
73662306a36Sopenharmony_ci#define DRM_CAP_CURSOR_HEIGHT		0x9
73762306a36Sopenharmony_ci/**
73862306a36Sopenharmony_ci * DRM_CAP_ADDFB2_MODIFIERS
73962306a36Sopenharmony_ci *
74062306a36Sopenharmony_ci * If set to 1, the driver supports supplying modifiers in the
74162306a36Sopenharmony_ci * &DRM_IOCTL_MODE_ADDFB2 ioctl.
74262306a36Sopenharmony_ci */
74362306a36Sopenharmony_ci#define DRM_CAP_ADDFB2_MODIFIERS	0x10
74462306a36Sopenharmony_ci/**
74562306a36Sopenharmony_ci * DRM_CAP_PAGE_FLIP_TARGET
74662306a36Sopenharmony_ci *
74762306a36Sopenharmony_ci * If set to 1, the driver supports the &DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE and
74862306a36Sopenharmony_ci * &DRM_MODE_PAGE_FLIP_TARGET_RELATIVE flags in
74962306a36Sopenharmony_ci * &drm_mode_crtc_page_flip_target.flags for the &DRM_IOCTL_MODE_PAGE_FLIP
75062306a36Sopenharmony_ci * ioctl.
75162306a36Sopenharmony_ci */
75262306a36Sopenharmony_ci#define DRM_CAP_PAGE_FLIP_TARGET	0x11
75362306a36Sopenharmony_ci/**
75462306a36Sopenharmony_ci * DRM_CAP_CRTC_IN_VBLANK_EVENT
75562306a36Sopenharmony_ci *
75662306a36Sopenharmony_ci * If set to 1, the kernel supports reporting the CRTC ID in
75762306a36Sopenharmony_ci * &drm_event_vblank.crtc_id for the &DRM_EVENT_VBLANK and
75862306a36Sopenharmony_ci * &DRM_EVENT_FLIP_COMPLETE events.
75962306a36Sopenharmony_ci *
76062306a36Sopenharmony_ci * Starting kernel version 4.12, this capability is always set to 1.
76162306a36Sopenharmony_ci */
76262306a36Sopenharmony_ci#define DRM_CAP_CRTC_IN_VBLANK_EVENT	0x12
76362306a36Sopenharmony_ci/**
76462306a36Sopenharmony_ci * DRM_CAP_SYNCOBJ
76562306a36Sopenharmony_ci *
76662306a36Sopenharmony_ci * If set to 1, the driver supports sync objects. See :ref:`drm_sync_objects`.
76762306a36Sopenharmony_ci */
76862306a36Sopenharmony_ci#define DRM_CAP_SYNCOBJ		0x13
76962306a36Sopenharmony_ci/**
77062306a36Sopenharmony_ci * DRM_CAP_SYNCOBJ_TIMELINE
77162306a36Sopenharmony_ci *
77262306a36Sopenharmony_ci * If set to 1, the driver supports timeline operations on sync objects. See
77362306a36Sopenharmony_ci * :ref:`drm_sync_objects`.
77462306a36Sopenharmony_ci */
77562306a36Sopenharmony_ci#define DRM_CAP_SYNCOBJ_TIMELINE	0x14
77662306a36Sopenharmony_ci
77762306a36Sopenharmony_ci/* DRM_IOCTL_GET_CAP ioctl argument type */
77862306a36Sopenharmony_cistruct drm_get_cap {
77962306a36Sopenharmony_ci	__u64 capability;
78062306a36Sopenharmony_ci	__u64 value;
78162306a36Sopenharmony_ci};
78262306a36Sopenharmony_ci
78362306a36Sopenharmony_ci/**
78462306a36Sopenharmony_ci * DRM_CLIENT_CAP_STEREO_3D
78562306a36Sopenharmony_ci *
78662306a36Sopenharmony_ci * If set to 1, the DRM core will expose the stereo 3D capabilities of the
78762306a36Sopenharmony_ci * monitor by advertising the supported 3D layouts in the flags of struct
78862306a36Sopenharmony_ci * drm_mode_modeinfo. See ``DRM_MODE_FLAG_3D_*``.
78962306a36Sopenharmony_ci *
79062306a36Sopenharmony_ci * This capability is always supported for all drivers starting from kernel
79162306a36Sopenharmony_ci * version 3.13.
79262306a36Sopenharmony_ci */
79362306a36Sopenharmony_ci#define DRM_CLIENT_CAP_STEREO_3D	1
79462306a36Sopenharmony_ci
79562306a36Sopenharmony_ci/**
79662306a36Sopenharmony_ci * DRM_CLIENT_CAP_UNIVERSAL_PLANES
79762306a36Sopenharmony_ci *
79862306a36Sopenharmony_ci * If set to 1, the DRM core will expose all planes (overlay, primary, and
79962306a36Sopenharmony_ci * cursor) to userspace.
80062306a36Sopenharmony_ci *
80162306a36Sopenharmony_ci * This capability has been introduced in kernel version 3.15. Starting from
80262306a36Sopenharmony_ci * kernel version 3.17, this capability is always supported for all drivers.
80362306a36Sopenharmony_ci */
80462306a36Sopenharmony_ci#define DRM_CLIENT_CAP_UNIVERSAL_PLANES  2
80562306a36Sopenharmony_ci
80662306a36Sopenharmony_ci/**
80762306a36Sopenharmony_ci * DRM_CLIENT_CAP_ATOMIC
80862306a36Sopenharmony_ci *
80962306a36Sopenharmony_ci * If set to 1, the DRM core will expose atomic properties to userspace. This
81062306a36Sopenharmony_ci * implicitly enables &DRM_CLIENT_CAP_UNIVERSAL_PLANES and
81162306a36Sopenharmony_ci * &DRM_CLIENT_CAP_ASPECT_RATIO.
81262306a36Sopenharmony_ci *
81362306a36Sopenharmony_ci * If the driver doesn't support atomic mode-setting, enabling this capability
81462306a36Sopenharmony_ci * will fail with -EOPNOTSUPP.
81562306a36Sopenharmony_ci *
81662306a36Sopenharmony_ci * This capability has been introduced in kernel version 4.0. Starting from
81762306a36Sopenharmony_ci * kernel version 4.2, this capability is always supported for atomic-capable
81862306a36Sopenharmony_ci * drivers.
81962306a36Sopenharmony_ci */
82062306a36Sopenharmony_ci#define DRM_CLIENT_CAP_ATOMIC	3
82162306a36Sopenharmony_ci
82262306a36Sopenharmony_ci/**
82362306a36Sopenharmony_ci * DRM_CLIENT_CAP_ASPECT_RATIO
82462306a36Sopenharmony_ci *
82562306a36Sopenharmony_ci * If set to 1, the DRM core will provide aspect ratio information in modes.
82662306a36Sopenharmony_ci * See ``DRM_MODE_FLAG_PIC_AR_*``.
82762306a36Sopenharmony_ci *
82862306a36Sopenharmony_ci * This capability is always supported for all drivers starting from kernel
82962306a36Sopenharmony_ci * version 4.18.
83062306a36Sopenharmony_ci */
83162306a36Sopenharmony_ci#define DRM_CLIENT_CAP_ASPECT_RATIO    4
83262306a36Sopenharmony_ci
83362306a36Sopenharmony_ci/**
83462306a36Sopenharmony_ci * DRM_CLIENT_CAP_WRITEBACK_CONNECTORS
83562306a36Sopenharmony_ci *
83662306a36Sopenharmony_ci * If set to 1, the DRM core will expose special connectors to be used for
83762306a36Sopenharmony_ci * writing back to memory the scene setup in the commit. The client must enable
83862306a36Sopenharmony_ci * &DRM_CLIENT_CAP_ATOMIC first.
83962306a36Sopenharmony_ci *
84062306a36Sopenharmony_ci * This capability is always supported for atomic-capable drivers starting from
84162306a36Sopenharmony_ci * kernel version 4.19.
84262306a36Sopenharmony_ci */
84362306a36Sopenharmony_ci#define DRM_CLIENT_CAP_WRITEBACK_CONNECTORS	5
84462306a36Sopenharmony_ci
84562306a36Sopenharmony_ci/* DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */
84662306a36Sopenharmony_cistruct drm_set_client_cap {
84762306a36Sopenharmony_ci	__u64 capability;
84862306a36Sopenharmony_ci	__u64 value;
84962306a36Sopenharmony_ci};
85062306a36Sopenharmony_ci
85162306a36Sopenharmony_ci#define DRM_RDWR O_RDWR
85262306a36Sopenharmony_ci#define DRM_CLOEXEC O_CLOEXEC
85362306a36Sopenharmony_cistruct drm_prime_handle {
85462306a36Sopenharmony_ci	__u32 handle;
85562306a36Sopenharmony_ci
85662306a36Sopenharmony_ci	/** Flags.. only applicable for handle->fd */
85762306a36Sopenharmony_ci	__u32 flags;
85862306a36Sopenharmony_ci
85962306a36Sopenharmony_ci	/** Returned dmabuf file descriptor */
86062306a36Sopenharmony_ci	__s32 fd;
86162306a36Sopenharmony_ci};
86262306a36Sopenharmony_ci
86362306a36Sopenharmony_cistruct drm_syncobj_create {
86462306a36Sopenharmony_ci	__u32 handle;
86562306a36Sopenharmony_ci#define DRM_SYNCOBJ_CREATE_SIGNALED (1 << 0)
86662306a36Sopenharmony_ci	__u32 flags;
86762306a36Sopenharmony_ci};
86862306a36Sopenharmony_ci
86962306a36Sopenharmony_cistruct drm_syncobj_destroy {
87062306a36Sopenharmony_ci	__u32 handle;
87162306a36Sopenharmony_ci	__u32 pad;
87262306a36Sopenharmony_ci};
87362306a36Sopenharmony_ci
87462306a36Sopenharmony_ci#define DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE (1 << 0)
87562306a36Sopenharmony_ci#define DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE (1 << 0)
87662306a36Sopenharmony_cistruct drm_syncobj_handle {
87762306a36Sopenharmony_ci	__u32 handle;
87862306a36Sopenharmony_ci	__u32 flags;
87962306a36Sopenharmony_ci
88062306a36Sopenharmony_ci	__s32 fd;
88162306a36Sopenharmony_ci	__u32 pad;
88262306a36Sopenharmony_ci};
88362306a36Sopenharmony_ci
88462306a36Sopenharmony_cistruct drm_syncobj_transfer {
88562306a36Sopenharmony_ci	__u32 src_handle;
88662306a36Sopenharmony_ci	__u32 dst_handle;
88762306a36Sopenharmony_ci	__u64 src_point;
88862306a36Sopenharmony_ci	__u64 dst_point;
88962306a36Sopenharmony_ci	__u32 flags;
89062306a36Sopenharmony_ci	__u32 pad;
89162306a36Sopenharmony_ci};
89262306a36Sopenharmony_ci
89362306a36Sopenharmony_ci#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)
89462306a36Sopenharmony_ci#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1)
89562306a36Sopenharmony_ci#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2) /* wait for time point to become available */
89662306a36Sopenharmony_cistruct drm_syncobj_wait {
89762306a36Sopenharmony_ci	__u64 handles;
89862306a36Sopenharmony_ci	/* absolute timeout */
89962306a36Sopenharmony_ci	__s64 timeout_nsec;
90062306a36Sopenharmony_ci	__u32 count_handles;
90162306a36Sopenharmony_ci	__u32 flags;
90262306a36Sopenharmony_ci	__u32 first_signaled; /* only valid when not waiting all */
90362306a36Sopenharmony_ci	__u32 pad;
90462306a36Sopenharmony_ci};
90562306a36Sopenharmony_ci
90662306a36Sopenharmony_cistruct drm_syncobj_timeline_wait {
90762306a36Sopenharmony_ci	__u64 handles;
90862306a36Sopenharmony_ci	/* wait on specific timeline point for every handles*/
90962306a36Sopenharmony_ci	__u64 points;
91062306a36Sopenharmony_ci	/* absolute timeout */
91162306a36Sopenharmony_ci	__s64 timeout_nsec;
91262306a36Sopenharmony_ci	__u32 count_handles;
91362306a36Sopenharmony_ci	__u32 flags;
91462306a36Sopenharmony_ci	__u32 first_signaled; /* only valid when not waiting all */
91562306a36Sopenharmony_ci	__u32 pad;
91662306a36Sopenharmony_ci};
91762306a36Sopenharmony_ci
91862306a36Sopenharmony_ci/**
91962306a36Sopenharmony_ci * struct drm_syncobj_eventfd
92062306a36Sopenharmony_ci * @handle: syncobj handle.
92162306a36Sopenharmony_ci * @flags: Zero to wait for the point to be signalled, or
92262306a36Sopenharmony_ci *         &DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE to wait for a fence to be
92362306a36Sopenharmony_ci *         available for the point.
92462306a36Sopenharmony_ci * @point: syncobj timeline point (set to zero for binary syncobjs).
92562306a36Sopenharmony_ci * @fd: Existing eventfd to sent events to.
92662306a36Sopenharmony_ci * @pad: Must be zero.
92762306a36Sopenharmony_ci *
92862306a36Sopenharmony_ci * Register an eventfd to be signalled by a syncobj. The eventfd counter will
92962306a36Sopenharmony_ci * be incremented by one.
93062306a36Sopenharmony_ci */
93162306a36Sopenharmony_cistruct drm_syncobj_eventfd {
93262306a36Sopenharmony_ci	__u32 handle;
93362306a36Sopenharmony_ci	__u32 flags;
93462306a36Sopenharmony_ci	__u64 point;
93562306a36Sopenharmony_ci	__s32 fd;
93662306a36Sopenharmony_ci	__u32 pad;
93762306a36Sopenharmony_ci};
93862306a36Sopenharmony_ci
93962306a36Sopenharmony_ci
94062306a36Sopenharmony_cistruct drm_syncobj_array {
94162306a36Sopenharmony_ci	__u64 handles;
94262306a36Sopenharmony_ci	__u32 count_handles;
94362306a36Sopenharmony_ci	__u32 pad;
94462306a36Sopenharmony_ci};
94562306a36Sopenharmony_ci
94662306a36Sopenharmony_ci#define DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED (1 << 0) /* last available point on timeline syncobj */
94762306a36Sopenharmony_cistruct drm_syncobj_timeline_array {
94862306a36Sopenharmony_ci	__u64 handles;
94962306a36Sopenharmony_ci	__u64 points;
95062306a36Sopenharmony_ci	__u32 count_handles;
95162306a36Sopenharmony_ci	__u32 flags;
95262306a36Sopenharmony_ci};
95362306a36Sopenharmony_ci
95462306a36Sopenharmony_ci
95562306a36Sopenharmony_ci/* Query current scanout sequence number */
95662306a36Sopenharmony_cistruct drm_crtc_get_sequence {
95762306a36Sopenharmony_ci	__u32 crtc_id;		/* requested crtc_id */
95862306a36Sopenharmony_ci	__u32 active;		/* return: crtc output is active */
95962306a36Sopenharmony_ci	__u64 sequence;		/* return: most recent vblank sequence */
96062306a36Sopenharmony_ci	__s64 sequence_ns;	/* return: most recent time of first pixel out */
96162306a36Sopenharmony_ci};
96262306a36Sopenharmony_ci
96362306a36Sopenharmony_ci/* Queue event to be delivered at specified sequence. Time stamp marks
96462306a36Sopenharmony_ci * when the first pixel of the refresh cycle leaves the display engine
96562306a36Sopenharmony_ci * for the display
96662306a36Sopenharmony_ci */
96762306a36Sopenharmony_ci#define DRM_CRTC_SEQUENCE_RELATIVE		0x00000001	/* sequence is relative to current */
96862306a36Sopenharmony_ci#define DRM_CRTC_SEQUENCE_NEXT_ON_MISS		0x00000002	/* Use next sequence if we've missed */
96962306a36Sopenharmony_ci
97062306a36Sopenharmony_cistruct drm_crtc_queue_sequence {
97162306a36Sopenharmony_ci	__u32 crtc_id;
97262306a36Sopenharmony_ci	__u32 flags;
97362306a36Sopenharmony_ci	__u64 sequence;		/* on input, target sequence. on output, actual sequence */
97462306a36Sopenharmony_ci	__u64 user_data;	/* user data passed to event */
97562306a36Sopenharmony_ci};
97662306a36Sopenharmony_ci
97762306a36Sopenharmony_ci#if defined(__cplusplus)
97862306a36Sopenharmony_ci}
97962306a36Sopenharmony_ci#endif
98062306a36Sopenharmony_ci
98162306a36Sopenharmony_ci#include "drm_mode.h"
98262306a36Sopenharmony_ci
98362306a36Sopenharmony_ci#if defined(__cplusplus)
98462306a36Sopenharmony_ciextern "C" {
98562306a36Sopenharmony_ci#endif
98662306a36Sopenharmony_ci
98762306a36Sopenharmony_ci#define DRM_IOCTL_BASE			'd'
98862306a36Sopenharmony_ci#define DRM_IO(nr)			_IO(DRM_IOCTL_BASE,nr)
98962306a36Sopenharmony_ci#define DRM_IOR(nr,type)		_IOR(DRM_IOCTL_BASE,nr,type)
99062306a36Sopenharmony_ci#define DRM_IOW(nr,type)		_IOW(DRM_IOCTL_BASE,nr,type)
99162306a36Sopenharmony_ci#define DRM_IOWR(nr,type)		_IOWR(DRM_IOCTL_BASE,nr,type)
99262306a36Sopenharmony_ci
99362306a36Sopenharmony_ci#define DRM_IOCTL_VERSION		DRM_IOWR(0x00, struct drm_version)
99462306a36Sopenharmony_ci#define DRM_IOCTL_GET_UNIQUE		DRM_IOWR(0x01, struct drm_unique)
99562306a36Sopenharmony_ci#define DRM_IOCTL_GET_MAGIC		DRM_IOR( 0x02, struct drm_auth)
99662306a36Sopenharmony_ci#define DRM_IOCTL_IRQ_BUSID		DRM_IOWR(0x03, struct drm_irq_busid)
99762306a36Sopenharmony_ci#define DRM_IOCTL_GET_MAP               DRM_IOWR(0x04, struct drm_map)
99862306a36Sopenharmony_ci#define DRM_IOCTL_GET_CLIENT            DRM_IOWR(0x05, struct drm_client)
99962306a36Sopenharmony_ci#define DRM_IOCTL_GET_STATS             DRM_IOR( 0x06, struct drm_stats)
100062306a36Sopenharmony_ci#define DRM_IOCTL_SET_VERSION		DRM_IOWR(0x07, struct drm_set_version)
100162306a36Sopenharmony_ci#define DRM_IOCTL_MODESET_CTL           DRM_IOW(0x08, struct drm_modeset_ctl)
100262306a36Sopenharmony_ci/**
100362306a36Sopenharmony_ci * DRM_IOCTL_GEM_CLOSE - Close a GEM handle.
100462306a36Sopenharmony_ci *
100562306a36Sopenharmony_ci * GEM handles are not reference-counted by the kernel. User-space is
100662306a36Sopenharmony_ci * responsible for managing their lifetime. For example, if user-space imports
100762306a36Sopenharmony_ci * the same memory object twice on the same DRM file description, the same GEM
100862306a36Sopenharmony_ci * handle is returned by both imports, and user-space needs to ensure
100962306a36Sopenharmony_ci * &DRM_IOCTL_GEM_CLOSE is performed once only. The same situation can happen
101062306a36Sopenharmony_ci * when a memory object is allocated, then exported and imported again on the
101162306a36Sopenharmony_ci * same DRM file description. The &DRM_IOCTL_MODE_GETFB2 IOCTL is an exception
101262306a36Sopenharmony_ci * and always returns fresh new GEM handles even if an existing GEM handle
101362306a36Sopenharmony_ci * already refers to the same memory object before the IOCTL is performed.
101462306a36Sopenharmony_ci */
101562306a36Sopenharmony_ci#define DRM_IOCTL_GEM_CLOSE		DRM_IOW (0x09, struct drm_gem_close)
101662306a36Sopenharmony_ci#define DRM_IOCTL_GEM_FLINK		DRM_IOWR(0x0a, struct drm_gem_flink)
101762306a36Sopenharmony_ci#define DRM_IOCTL_GEM_OPEN		DRM_IOWR(0x0b, struct drm_gem_open)
101862306a36Sopenharmony_ci#define DRM_IOCTL_GET_CAP		DRM_IOWR(0x0c, struct drm_get_cap)
101962306a36Sopenharmony_ci#define DRM_IOCTL_SET_CLIENT_CAP	DRM_IOW( 0x0d, struct drm_set_client_cap)
102062306a36Sopenharmony_ci
102162306a36Sopenharmony_ci#define DRM_IOCTL_SET_UNIQUE		DRM_IOW( 0x10, struct drm_unique)
102262306a36Sopenharmony_ci#define DRM_IOCTL_AUTH_MAGIC		DRM_IOW( 0x11, struct drm_auth)
102362306a36Sopenharmony_ci#define DRM_IOCTL_BLOCK			DRM_IOWR(0x12, struct drm_block)
102462306a36Sopenharmony_ci#define DRM_IOCTL_UNBLOCK		DRM_IOWR(0x13, struct drm_block)
102562306a36Sopenharmony_ci#define DRM_IOCTL_CONTROL		DRM_IOW( 0x14, struct drm_control)
102662306a36Sopenharmony_ci#define DRM_IOCTL_ADD_MAP		DRM_IOWR(0x15, struct drm_map)
102762306a36Sopenharmony_ci#define DRM_IOCTL_ADD_BUFS		DRM_IOWR(0x16, struct drm_buf_desc)
102862306a36Sopenharmony_ci#define DRM_IOCTL_MARK_BUFS		DRM_IOW( 0x17, struct drm_buf_desc)
102962306a36Sopenharmony_ci#define DRM_IOCTL_INFO_BUFS		DRM_IOWR(0x18, struct drm_buf_info)
103062306a36Sopenharmony_ci#define DRM_IOCTL_MAP_BUFS		DRM_IOWR(0x19, struct drm_buf_map)
103162306a36Sopenharmony_ci#define DRM_IOCTL_FREE_BUFS		DRM_IOW( 0x1a, struct drm_buf_free)
103262306a36Sopenharmony_ci
103362306a36Sopenharmony_ci#define DRM_IOCTL_RM_MAP		DRM_IOW( 0x1b, struct drm_map)
103462306a36Sopenharmony_ci
103562306a36Sopenharmony_ci#define DRM_IOCTL_SET_SAREA_CTX		DRM_IOW( 0x1c, struct drm_ctx_priv_map)
103662306a36Sopenharmony_ci#define DRM_IOCTL_GET_SAREA_CTX 	DRM_IOWR(0x1d, struct drm_ctx_priv_map)
103762306a36Sopenharmony_ci
103862306a36Sopenharmony_ci#define DRM_IOCTL_SET_MASTER            DRM_IO(0x1e)
103962306a36Sopenharmony_ci#define DRM_IOCTL_DROP_MASTER           DRM_IO(0x1f)
104062306a36Sopenharmony_ci
104162306a36Sopenharmony_ci#define DRM_IOCTL_ADD_CTX		DRM_IOWR(0x20, struct drm_ctx)
104262306a36Sopenharmony_ci#define DRM_IOCTL_RM_CTX		DRM_IOWR(0x21, struct drm_ctx)
104362306a36Sopenharmony_ci#define DRM_IOCTL_MOD_CTX		DRM_IOW( 0x22, struct drm_ctx)
104462306a36Sopenharmony_ci#define DRM_IOCTL_GET_CTX		DRM_IOWR(0x23, struct drm_ctx)
104562306a36Sopenharmony_ci#define DRM_IOCTL_SWITCH_CTX		DRM_IOW( 0x24, struct drm_ctx)
104662306a36Sopenharmony_ci#define DRM_IOCTL_NEW_CTX		DRM_IOW( 0x25, struct drm_ctx)
104762306a36Sopenharmony_ci#define DRM_IOCTL_RES_CTX		DRM_IOWR(0x26, struct drm_ctx_res)
104862306a36Sopenharmony_ci#define DRM_IOCTL_ADD_DRAW		DRM_IOWR(0x27, struct drm_draw)
104962306a36Sopenharmony_ci#define DRM_IOCTL_RM_DRAW		DRM_IOWR(0x28, struct drm_draw)
105062306a36Sopenharmony_ci#define DRM_IOCTL_DMA			DRM_IOWR(0x29, struct drm_dma)
105162306a36Sopenharmony_ci#define DRM_IOCTL_LOCK			DRM_IOW( 0x2a, struct drm_lock)
105262306a36Sopenharmony_ci#define DRM_IOCTL_UNLOCK		DRM_IOW( 0x2b, struct drm_lock)
105362306a36Sopenharmony_ci#define DRM_IOCTL_FINISH		DRM_IOW( 0x2c, struct drm_lock)
105462306a36Sopenharmony_ci
105562306a36Sopenharmony_ci/**
105662306a36Sopenharmony_ci * DRM_IOCTL_PRIME_HANDLE_TO_FD - Convert a GEM handle to a DMA-BUF FD.
105762306a36Sopenharmony_ci *
105862306a36Sopenharmony_ci * User-space sets &drm_prime_handle.handle with the GEM handle to export and
105962306a36Sopenharmony_ci * &drm_prime_handle.flags, and gets back a DMA-BUF file descriptor in
106062306a36Sopenharmony_ci * &drm_prime_handle.fd.
106162306a36Sopenharmony_ci *
106262306a36Sopenharmony_ci * The export can fail for any driver-specific reason, e.g. because export is
106362306a36Sopenharmony_ci * not supported for this specific GEM handle (but might be for others).
106462306a36Sopenharmony_ci *
106562306a36Sopenharmony_ci * Support for exporting DMA-BUFs is advertised via &DRM_PRIME_CAP_EXPORT.
106662306a36Sopenharmony_ci */
106762306a36Sopenharmony_ci#define DRM_IOCTL_PRIME_HANDLE_TO_FD    DRM_IOWR(0x2d, struct drm_prime_handle)
106862306a36Sopenharmony_ci/**
106962306a36Sopenharmony_ci * DRM_IOCTL_PRIME_FD_TO_HANDLE - Convert a DMA-BUF FD to a GEM handle.
107062306a36Sopenharmony_ci *
107162306a36Sopenharmony_ci * User-space sets &drm_prime_handle.fd with a DMA-BUF file descriptor to
107262306a36Sopenharmony_ci * import, and gets back a GEM handle in &drm_prime_handle.handle.
107362306a36Sopenharmony_ci * &drm_prime_handle.flags is unused.
107462306a36Sopenharmony_ci *
107562306a36Sopenharmony_ci * If an existing GEM handle refers to the memory object backing the DMA-BUF,
107662306a36Sopenharmony_ci * that GEM handle is returned. Therefore user-space which needs to handle
107762306a36Sopenharmony_ci * arbitrary DMA-BUFs must have a user-space lookup data structure to manually
107862306a36Sopenharmony_ci * reference-count duplicated GEM handles. For more information see
107962306a36Sopenharmony_ci * &DRM_IOCTL_GEM_CLOSE.
108062306a36Sopenharmony_ci *
108162306a36Sopenharmony_ci * The import can fail for any driver-specific reason, e.g. because import is
108262306a36Sopenharmony_ci * only supported for DMA-BUFs allocated on this DRM device.
108362306a36Sopenharmony_ci *
108462306a36Sopenharmony_ci * Support for importing DMA-BUFs is advertised via &DRM_PRIME_CAP_IMPORT.
108562306a36Sopenharmony_ci */
108662306a36Sopenharmony_ci#define DRM_IOCTL_PRIME_FD_TO_HANDLE    DRM_IOWR(0x2e, struct drm_prime_handle)
108762306a36Sopenharmony_ci
108862306a36Sopenharmony_ci#define DRM_IOCTL_AGP_ACQUIRE		DRM_IO(  0x30)
108962306a36Sopenharmony_ci#define DRM_IOCTL_AGP_RELEASE		DRM_IO(  0x31)
109062306a36Sopenharmony_ci#define DRM_IOCTL_AGP_ENABLE		DRM_IOW( 0x32, struct drm_agp_mode)
109162306a36Sopenharmony_ci#define DRM_IOCTL_AGP_INFO		DRM_IOR( 0x33, struct drm_agp_info)
109262306a36Sopenharmony_ci#define DRM_IOCTL_AGP_ALLOC		DRM_IOWR(0x34, struct drm_agp_buffer)
109362306a36Sopenharmony_ci#define DRM_IOCTL_AGP_FREE		DRM_IOW( 0x35, struct drm_agp_buffer)
109462306a36Sopenharmony_ci#define DRM_IOCTL_AGP_BIND		DRM_IOW( 0x36, struct drm_agp_binding)
109562306a36Sopenharmony_ci#define DRM_IOCTL_AGP_UNBIND		DRM_IOW( 0x37, struct drm_agp_binding)
109662306a36Sopenharmony_ci
109762306a36Sopenharmony_ci#define DRM_IOCTL_SG_ALLOC		DRM_IOWR(0x38, struct drm_scatter_gather)
109862306a36Sopenharmony_ci#define DRM_IOCTL_SG_FREE		DRM_IOW( 0x39, struct drm_scatter_gather)
109962306a36Sopenharmony_ci
110062306a36Sopenharmony_ci#define DRM_IOCTL_WAIT_VBLANK		DRM_IOWR(0x3a, union drm_wait_vblank)
110162306a36Sopenharmony_ci
110262306a36Sopenharmony_ci#define DRM_IOCTL_CRTC_GET_SEQUENCE	DRM_IOWR(0x3b, struct drm_crtc_get_sequence)
110362306a36Sopenharmony_ci#define DRM_IOCTL_CRTC_QUEUE_SEQUENCE	DRM_IOWR(0x3c, struct drm_crtc_queue_sequence)
110462306a36Sopenharmony_ci
110562306a36Sopenharmony_ci#define DRM_IOCTL_UPDATE_DRAW		DRM_IOW(0x3f, struct drm_update_draw)
110662306a36Sopenharmony_ci
110762306a36Sopenharmony_ci#define DRM_IOCTL_MODE_GETRESOURCES	DRM_IOWR(0xA0, struct drm_mode_card_res)
110862306a36Sopenharmony_ci#define DRM_IOCTL_MODE_GETCRTC		DRM_IOWR(0xA1, struct drm_mode_crtc)
110962306a36Sopenharmony_ci#define DRM_IOCTL_MODE_SETCRTC		DRM_IOWR(0xA2, struct drm_mode_crtc)
111062306a36Sopenharmony_ci#define DRM_IOCTL_MODE_CURSOR		DRM_IOWR(0xA3, struct drm_mode_cursor)
111162306a36Sopenharmony_ci#define DRM_IOCTL_MODE_GETGAMMA		DRM_IOWR(0xA4, struct drm_mode_crtc_lut)
111262306a36Sopenharmony_ci#define DRM_IOCTL_MODE_SETGAMMA		DRM_IOWR(0xA5, struct drm_mode_crtc_lut)
111362306a36Sopenharmony_ci#define DRM_IOCTL_MODE_GETENCODER	DRM_IOWR(0xA6, struct drm_mode_get_encoder)
111462306a36Sopenharmony_ci#define DRM_IOCTL_MODE_GETCONNECTOR	DRM_IOWR(0xA7, struct drm_mode_get_connector)
111562306a36Sopenharmony_ci#define DRM_IOCTL_MODE_ATTACHMODE	DRM_IOWR(0xA8, struct drm_mode_mode_cmd) /* deprecated (never worked) */
111662306a36Sopenharmony_ci#define DRM_IOCTL_MODE_DETACHMODE	DRM_IOWR(0xA9, struct drm_mode_mode_cmd) /* deprecated (never worked) */
111762306a36Sopenharmony_ci
111862306a36Sopenharmony_ci#define DRM_IOCTL_MODE_GETPROPERTY	DRM_IOWR(0xAA, struct drm_mode_get_property)
111962306a36Sopenharmony_ci#define DRM_IOCTL_MODE_SETPROPERTY	DRM_IOWR(0xAB, struct drm_mode_connector_set_property)
112062306a36Sopenharmony_ci#define DRM_IOCTL_MODE_GETPROPBLOB	DRM_IOWR(0xAC, struct drm_mode_get_blob)
112162306a36Sopenharmony_ci#define DRM_IOCTL_MODE_GETFB		DRM_IOWR(0xAD, struct drm_mode_fb_cmd)
112262306a36Sopenharmony_ci#define DRM_IOCTL_MODE_ADDFB		DRM_IOWR(0xAE, struct drm_mode_fb_cmd)
112362306a36Sopenharmony_ci/**
112462306a36Sopenharmony_ci * DRM_IOCTL_MODE_RMFB - Remove a framebuffer.
112562306a36Sopenharmony_ci *
112662306a36Sopenharmony_ci * This removes a framebuffer previously added via ADDFB/ADDFB2. The IOCTL
112762306a36Sopenharmony_ci * argument is a framebuffer object ID.
112862306a36Sopenharmony_ci *
112962306a36Sopenharmony_ci * Warning: removing a framebuffer currently in-use on an enabled plane will
113062306a36Sopenharmony_ci * disable that plane. The CRTC the plane is linked to may also be disabled
113162306a36Sopenharmony_ci * (depending on driver capabilities).
113262306a36Sopenharmony_ci */
113362306a36Sopenharmony_ci#define DRM_IOCTL_MODE_RMFB		DRM_IOWR(0xAF, unsigned int)
113462306a36Sopenharmony_ci#define DRM_IOCTL_MODE_PAGE_FLIP	DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip)
113562306a36Sopenharmony_ci#define DRM_IOCTL_MODE_DIRTYFB		DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd)
113662306a36Sopenharmony_ci
113762306a36Sopenharmony_ci#define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb)
113862306a36Sopenharmony_ci#define DRM_IOCTL_MODE_MAP_DUMB    DRM_IOWR(0xB3, struct drm_mode_map_dumb)
113962306a36Sopenharmony_ci#define DRM_IOCTL_MODE_DESTROY_DUMB    DRM_IOWR(0xB4, struct drm_mode_destroy_dumb)
114062306a36Sopenharmony_ci#define DRM_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xB5, struct drm_mode_get_plane_res)
114162306a36Sopenharmony_ci#define DRM_IOCTL_MODE_GETPLANE	DRM_IOWR(0xB6, struct drm_mode_get_plane)
114262306a36Sopenharmony_ci#define DRM_IOCTL_MODE_SETPLANE	DRM_IOWR(0xB7, struct drm_mode_set_plane)
114362306a36Sopenharmony_ci#define DRM_IOCTL_MODE_ADDFB2		DRM_IOWR(0xB8, struct drm_mode_fb_cmd2)
114462306a36Sopenharmony_ci#define DRM_IOCTL_MODE_OBJ_GETPROPERTIES	DRM_IOWR(0xB9, struct drm_mode_obj_get_properties)
114562306a36Sopenharmony_ci#define DRM_IOCTL_MODE_OBJ_SETPROPERTY	DRM_IOWR(0xBA, struct drm_mode_obj_set_property)
114662306a36Sopenharmony_ci#define DRM_IOCTL_MODE_CURSOR2		DRM_IOWR(0xBB, struct drm_mode_cursor2)
114762306a36Sopenharmony_ci#define DRM_IOCTL_MODE_ATOMIC		DRM_IOWR(0xBC, struct drm_mode_atomic)
114862306a36Sopenharmony_ci#define DRM_IOCTL_MODE_CREATEPROPBLOB	DRM_IOWR(0xBD, struct drm_mode_create_blob)
114962306a36Sopenharmony_ci#define DRM_IOCTL_MODE_DESTROYPROPBLOB	DRM_IOWR(0xBE, struct drm_mode_destroy_blob)
115062306a36Sopenharmony_ci
115162306a36Sopenharmony_ci#define DRM_IOCTL_SYNCOBJ_CREATE	DRM_IOWR(0xBF, struct drm_syncobj_create)
115262306a36Sopenharmony_ci#define DRM_IOCTL_SYNCOBJ_DESTROY	DRM_IOWR(0xC0, struct drm_syncobj_destroy)
115362306a36Sopenharmony_ci#define DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD	DRM_IOWR(0xC1, struct drm_syncobj_handle)
115462306a36Sopenharmony_ci#define DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE	DRM_IOWR(0xC2, struct drm_syncobj_handle)
115562306a36Sopenharmony_ci#define DRM_IOCTL_SYNCOBJ_WAIT		DRM_IOWR(0xC3, struct drm_syncobj_wait)
115662306a36Sopenharmony_ci#define DRM_IOCTL_SYNCOBJ_RESET		DRM_IOWR(0xC4, struct drm_syncobj_array)
115762306a36Sopenharmony_ci#define DRM_IOCTL_SYNCOBJ_SIGNAL	DRM_IOWR(0xC5, struct drm_syncobj_array)
115862306a36Sopenharmony_ci
115962306a36Sopenharmony_ci#define DRM_IOCTL_MODE_CREATE_LEASE	DRM_IOWR(0xC6, struct drm_mode_create_lease)
116062306a36Sopenharmony_ci#define DRM_IOCTL_MODE_LIST_LESSEES	DRM_IOWR(0xC7, struct drm_mode_list_lessees)
116162306a36Sopenharmony_ci#define DRM_IOCTL_MODE_GET_LEASE	DRM_IOWR(0xC8, struct drm_mode_get_lease)
116262306a36Sopenharmony_ci#define DRM_IOCTL_MODE_REVOKE_LEASE	DRM_IOWR(0xC9, struct drm_mode_revoke_lease)
116362306a36Sopenharmony_ci
116462306a36Sopenharmony_ci#define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT	DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait)
116562306a36Sopenharmony_ci#define DRM_IOCTL_SYNCOBJ_QUERY		DRM_IOWR(0xCB, struct drm_syncobj_timeline_array)
116662306a36Sopenharmony_ci#define DRM_IOCTL_SYNCOBJ_TRANSFER	DRM_IOWR(0xCC, struct drm_syncobj_transfer)
116762306a36Sopenharmony_ci#define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL	DRM_IOWR(0xCD, struct drm_syncobj_timeline_array)
116862306a36Sopenharmony_ci
116962306a36Sopenharmony_ci/**
117062306a36Sopenharmony_ci * DRM_IOCTL_MODE_GETFB2 - Get framebuffer metadata.
117162306a36Sopenharmony_ci *
117262306a36Sopenharmony_ci * This queries metadata about a framebuffer. User-space fills
117362306a36Sopenharmony_ci * &drm_mode_fb_cmd2.fb_id as the input, and the kernels fills the rest of the
117462306a36Sopenharmony_ci * struct as the output.
117562306a36Sopenharmony_ci *
117662306a36Sopenharmony_ci * If the client is DRM master or has &CAP_SYS_ADMIN, &drm_mode_fb_cmd2.handles
117762306a36Sopenharmony_ci * will be filled with GEM buffer handles. Fresh new GEM handles are always
117862306a36Sopenharmony_ci * returned, even if another GEM handle referring to the same memory object
117962306a36Sopenharmony_ci * already exists on the DRM file description. The caller is responsible for
118062306a36Sopenharmony_ci * removing the new handles, e.g. via the &DRM_IOCTL_GEM_CLOSE IOCTL. The same
118162306a36Sopenharmony_ci * new handle will be returned for multiple planes in case they use the same
118262306a36Sopenharmony_ci * memory object. Planes are valid until one has a zero handle -- this can be
118362306a36Sopenharmony_ci * used to compute the number of planes.
118462306a36Sopenharmony_ci *
118562306a36Sopenharmony_ci * Otherwise, &drm_mode_fb_cmd2.handles will be zeroed and planes are valid
118662306a36Sopenharmony_ci * until one has a zero &drm_mode_fb_cmd2.pitches.
118762306a36Sopenharmony_ci *
118862306a36Sopenharmony_ci * If the framebuffer has a format modifier, &DRM_MODE_FB_MODIFIERS will be set
118962306a36Sopenharmony_ci * in &drm_mode_fb_cmd2.flags and &drm_mode_fb_cmd2.modifier will contain the
119062306a36Sopenharmony_ci * modifier. Otherwise, user-space must ignore &drm_mode_fb_cmd2.modifier.
119162306a36Sopenharmony_ci *
119262306a36Sopenharmony_ci * To obtain DMA-BUF FDs for each plane without leaking GEM handles, user-space
119362306a36Sopenharmony_ci * can export each handle via &DRM_IOCTL_PRIME_HANDLE_TO_FD, then immediately
119462306a36Sopenharmony_ci * close each unique handle via &DRM_IOCTL_GEM_CLOSE, making sure to not
119562306a36Sopenharmony_ci * double-close handles which are specified multiple times in the array.
119662306a36Sopenharmony_ci */
119762306a36Sopenharmony_ci#define DRM_IOCTL_MODE_GETFB2		DRM_IOWR(0xCE, struct drm_mode_fb_cmd2)
119862306a36Sopenharmony_ci
119962306a36Sopenharmony_ci#define DRM_IOCTL_SYNCOBJ_EVENTFD	DRM_IOWR(0xCF, struct drm_syncobj_eventfd)
120062306a36Sopenharmony_ci
120162306a36Sopenharmony_ci/*
120262306a36Sopenharmony_ci * Device specific ioctls should only be in their respective headers
120362306a36Sopenharmony_ci * The device specific ioctl range is from 0x40 to 0x9f.
120462306a36Sopenharmony_ci * Generic IOCTLS restart at 0xA0.
120562306a36Sopenharmony_ci *
120662306a36Sopenharmony_ci * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and
120762306a36Sopenharmony_ci * drmCommandReadWrite().
120862306a36Sopenharmony_ci */
120962306a36Sopenharmony_ci#define DRM_COMMAND_BASE                0x40
121062306a36Sopenharmony_ci#define DRM_COMMAND_END			0xA0
121162306a36Sopenharmony_ci
121262306a36Sopenharmony_ci/**
121362306a36Sopenharmony_ci * struct drm_event - Header for DRM events
121462306a36Sopenharmony_ci * @type: event type.
121562306a36Sopenharmony_ci * @length: total number of payload bytes (including header).
121662306a36Sopenharmony_ci *
121762306a36Sopenharmony_ci * This struct is a header for events written back to user-space on the DRM FD.
121862306a36Sopenharmony_ci * A read on the DRM FD will always only return complete events: e.g. if the
121962306a36Sopenharmony_ci * read buffer is 100 bytes large and there are two 64 byte events pending,
122062306a36Sopenharmony_ci * only one will be returned.
122162306a36Sopenharmony_ci *
122262306a36Sopenharmony_ci * Event types 0 - 0x7fffffff are generic DRM events, 0x80000000 and
122362306a36Sopenharmony_ci * up are chipset specific. Generic DRM events include &DRM_EVENT_VBLANK,
122462306a36Sopenharmony_ci * &DRM_EVENT_FLIP_COMPLETE and &DRM_EVENT_CRTC_SEQUENCE.
122562306a36Sopenharmony_ci */
122662306a36Sopenharmony_cistruct drm_event {
122762306a36Sopenharmony_ci	__u32 type;
122862306a36Sopenharmony_ci	__u32 length;
122962306a36Sopenharmony_ci};
123062306a36Sopenharmony_ci
123162306a36Sopenharmony_ci/**
123262306a36Sopenharmony_ci * DRM_EVENT_VBLANK - vertical blanking event
123362306a36Sopenharmony_ci *
123462306a36Sopenharmony_ci * This event is sent in response to &DRM_IOCTL_WAIT_VBLANK with the
123562306a36Sopenharmony_ci * &_DRM_VBLANK_EVENT flag set.
123662306a36Sopenharmony_ci *
123762306a36Sopenharmony_ci * The event payload is a struct drm_event_vblank.
123862306a36Sopenharmony_ci */
123962306a36Sopenharmony_ci#define DRM_EVENT_VBLANK 0x01
124062306a36Sopenharmony_ci/**
124162306a36Sopenharmony_ci * DRM_EVENT_FLIP_COMPLETE - page-flip completion event
124262306a36Sopenharmony_ci *
124362306a36Sopenharmony_ci * This event is sent in response to an atomic commit or legacy page-flip with
124462306a36Sopenharmony_ci * the &DRM_MODE_PAGE_FLIP_EVENT flag set.
124562306a36Sopenharmony_ci *
124662306a36Sopenharmony_ci * The event payload is a struct drm_event_vblank.
124762306a36Sopenharmony_ci */
124862306a36Sopenharmony_ci#define DRM_EVENT_FLIP_COMPLETE 0x02
124962306a36Sopenharmony_ci/**
125062306a36Sopenharmony_ci * DRM_EVENT_CRTC_SEQUENCE - CRTC sequence event
125162306a36Sopenharmony_ci *
125262306a36Sopenharmony_ci * This event is sent in response to &DRM_IOCTL_CRTC_QUEUE_SEQUENCE.
125362306a36Sopenharmony_ci *
125462306a36Sopenharmony_ci * The event payload is a struct drm_event_crtc_sequence.
125562306a36Sopenharmony_ci */
125662306a36Sopenharmony_ci#define DRM_EVENT_CRTC_SEQUENCE	0x03
125762306a36Sopenharmony_ci
125862306a36Sopenharmony_cistruct drm_event_vblank {
125962306a36Sopenharmony_ci	struct drm_event base;
126062306a36Sopenharmony_ci	__u64 user_data;
126162306a36Sopenharmony_ci	__u32 tv_sec;
126262306a36Sopenharmony_ci	__u32 tv_usec;
126362306a36Sopenharmony_ci	__u32 sequence;
126462306a36Sopenharmony_ci	__u32 crtc_id; /* 0 on older kernels that do not support this */
126562306a36Sopenharmony_ci};
126662306a36Sopenharmony_ci
126762306a36Sopenharmony_ci/* Event delivered at sequence. Time stamp marks when the first pixel
126862306a36Sopenharmony_ci * of the refresh cycle leaves the display engine for the display
126962306a36Sopenharmony_ci */
127062306a36Sopenharmony_cistruct drm_event_crtc_sequence {
127162306a36Sopenharmony_ci	struct drm_event	base;
127262306a36Sopenharmony_ci	__u64			user_data;
127362306a36Sopenharmony_ci	__s64			time_ns;
127462306a36Sopenharmony_ci	__u64			sequence;
127562306a36Sopenharmony_ci};
127662306a36Sopenharmony_ci
127762306a36Sopenharmony_ci/* typedef area */
127862306a36Sopenharmony_ci#ifndef __KERNEL__
127962306a36Sopenharmony_citypedef struct drm_clip_rect drm_clip_rect_t;
128062306a36Sopenharmony_citypedef struct drm_drawable_info drm_drawable_info_t;
128162306a36Sopenharmony_citypedef struct drm_tex_region drm_tex_region_t;
128262306a36Sopenharmony_citypedef struct drm_hw_lock drm_hw_lock_t;
128362306a36Sopenharmony_citypedef struct drm_version drm_version_t;
128462306a36Sopenharmony_citypedef struct drm_unique drm_unique_t;
128562306a36Sopenharmony_citypedef struct drm_list drm_list_t;
128662306a36Sopenharmony_citypedef struct drm_block drm_block_t;
128762306a36Sopenharmony_citypedef struct drm_control drm_control_t;
128862306a36Sopenharmony_citypedef enum drm_map_type drm_map_type_t;
128962306a36Sopenharmony_citypedef enum drm_map_flags drm_map_flags_t;
129062306a36Sopenharmony_citypedef struct drm_ctx_priv_map drm_ctx_priv_map_t;
129162306a36Sopenharmony_citypedef struct drm_map drm_map_t;
129262306a36Sopenharmony_citypedef struct drm_client drm_client_t;
129362306a36Sopenharmony_citypedef enum drm_stat_type drm_stat_type_t;
129462306a36Sopenharmony_citypedef struct drm_stats drm_stats_t;
129562306a36Sopenharmony_citypedef enum drm_lock_flags drm_lock_flags_t;
129662306a36Sopenharmony_citypedef struct drm_lock drm_lock_t;
129762306a36Sopenharmony_citypedef enum drm_dma_flags drm_dma_flags_t;
129862306a36Sopenharmony_citypedef struct drm_buf_desc drm_buf_desc_t;
129962306a36Sopenharmony_citypedef struct drm_buf_info drm_buf_info_t;
130062306a36Sopenharmony_citypedef struct drm_buf_free drm_buf_free_t;
130162306a36Sopenharmony_citypedef struct drm_buf_pub drm_buf_pub_t;
130262306a36Sopenharmony_citypedef struct drm_buf_map drm_buf_map_t;
130362306a36Sopenharmony_citypedef struct drm_dma drm_dma_t;
130462306a36Sopenharmony_citypedef union drm_wait_vblank drm_wait_vblank_t;
130562306a36Sopenharmony_citypedef struct drm_agp_mode drm_agp_mode_t;
130662306a36Sopenharmony_citypedef enum drm_ctx_flags drm_ctx_flags_t;
130762306a36Sopenharmony_citypedef struct drm_ctx drm_ctx_t;
130862306a36Sopenharmony_citypedef struct drm_ctx_res drm_ctx_res_t;
130962306a36Sopenharmony_citypedef struct drm_draw drm_draw_t;
131062306a36Sopenharmony_citypedef struct drm_update_draw drm_update_draw_t;
131162306a36Sopenharmony_citypedef struct drm_auth drm_auth_t;
131262306a36Sopenharmony_citypedef struct drm_irq_busid drm_irq_busid_t;
131362306a36Sopenharmony_citypedef enum drm_vblank_seq_type drm_vblank_seq_type_t;
131462306a36Sopenharmony_ci
131562306a36Sopenharmony_citypedef struct drm_agp_buffer drm_agp_buffer_t;
131662306a36Sopenharmony_citypedef struct drm_agp_binding drm_agp_binding_t;
131762306a36Sopenharmony_citypedef struct drm_agp_info drm_agp_info_t;
131862306a36Sopenharmony_citypedef struct drm_scatter_gather drm_scatter_gather_t;
131962306a36Sopenharmony_citypedef struct drm_set_version drm_set_version_t;
132062306a36Sopenharmony_ci#endif
132162306a36Sopenharmony_ci
132262306a36Sopenharmony_ci#if defined(__cplusplus)
132362306a36Sopenharmony_ci}
132462306a36Sopenharmony_ci#endif
132562306a36Sopenharmony_ci
132662306a36Sopenharmony_ci#endif
1327