xref: /openbmc/linux/include/uapi/drm/drm.h (revision c900529f3d9161bfde5cca0754f83b4d3c3e0220)
1877c39acSSimon Ser /*
2718dceddSDavid Howells  * Header for the Direct Rendering Manager
3718dceddSDavid Howells  *
4877c39acSSimon Ser  * Author: Rickard E. (Rik) Faith <faith@valinux.com>
5718dceddSDavid Howells  *
6877c39acSSimon Ser  * Acknowledgments:
7877c39acSSimon Ser  * Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic cmpxchg.
8718dceddSDavid Howells  */
9718dceddSDavid Howells 
10718dceddSDavid Howells /*
11718dceddSDavid Howells  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
12718dceddSDavid Howells  * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
13718dceddSDavid Howells  * All rights reserved.
14718dceddSDavid Howells  *
15718dceddSDavid Howells  * Permission is hereby granted, free of charge, to any person obtaining a
16718dceddSDavid Howells  * copy of this software and associated documentation files (the "Software"),
17718dceddSDavid Howells  * to deal in the Software without restriction, including without limitation
18718dceddSDavid Howells  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
19718dceddSDavid Howells  * and/or sell copies of the Software, and to permit persons to whom the
20718dceddSDavid Howells  * Software is furnished to do so, subject to the following conditions:
21718dceddSDavid Howells  *
22718dceddSDavid Howells  * The above copyright notice and this permission notice (including the next
23718dceddSDavid Howells  * paragraph) shall be included in all copies or substantial portions of the
24718dceddSDavid Howells  * Software.
25718dceddSDavid Howells  *
26718dceddSDavid Howells  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27718dceddSDavid Howells  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28718dceddSDavid Howells  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
29718dceddSDavid Howells  * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
30718dceddSDavid Howells  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
31718dceddSDavid Howells  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
32718dceddSDavid Howells  * OTHER DEALINGS IN THE SOFTWARE.
33718dceddSDavid Howells  */
34718dceddSDavid Howells 
35718dceddSDavid Howells #ifndef _DRM_H_
36718dceddSDavid Howells #define _DRM_H_
37718dceddSDavid Howells 
3800c96726SDaniel Vetter #if defined(__KERNEL__)
3900c96726SDaniel Vetter 
4000c96726SDaniel Vetter #include <linux/types.h>
4100c96726SDaniel Vetter #include <asm/ioctl.h>
4200c96726SDaniel Vetter typedef unsigned int drm_handle_t;
4300c96726SDaniel Vetter 
4400c96726SDaniel Vetter #elif defined(__linux__)
45718dceddSDavid Howells 
46718dceddSDavid Howells #include <linux/types.h>
47718dceddSDavid Howells #include <asm/ioctl.h>
48718dceddSDavid Howells typedef unsigned int drm_handle_t;
49718dceddSDavid Howells 
50718dceddSDavid Howells #else /* One of the BSDs */
51718dceddSDavid Howells 
5275b3f1cbSJames Clarke #include <stdint.h>
53718dceddSDavid Howells #include <sys/ioccom.h>
54718dceddSDavid Howells #include <sys/types.h>
55718dceddSDavid Howells typedef int8_t   __s8;
56718dceddSDavid Howells typedef uint8_t  __u8;
57718dceddSDavid Howells typedef int16_t  __s16;
58718dceddSDavid Howells typedef uint16_t __u16;
59718dceddSDavid Howells typedef int32_t  __s32;
60718dceddSDavid Howells typedef uint32_t __u32;
61718dceddSDavid Howells typedef int64_t  __s64;
62718dceddSDavid Howells typedef uint64_t __u64;
631a2a42c8SMikko Rapeli typedef size_t   __kernel_size_t;
64718dceddSDavid Howells typedef unsigned long drm_handle_t;
65718dceddSDavid Howells 
66718dceddSDavid Howells #endif
67718dceddSDavid Howells 
68ebbb0e5cSEmil Velikov #if defined(__cplusplus)
69ebbb0e5cSEmil Velikov extern "C" {
70ebbb0e5cSEmil Velikov #endif
71ebbb0e5cSEmil Velikov 
72718dceddSDavid Howells #define DRM_NAME	"drm"	  /**< Name in kernel, /dev, and /proc */
73718dceddSDavid Howells #define DRM_MIN_ORDER	5	  /**< At least 2^5 bytes = 32 bytes */
74718dceddSDavid Howells #define DRM_MAX_ORDER	22	  /**< Up to 2^22 bytes = 4MB */
75718dceddSDavid Howells #define DRM_RAM_PERCENT 10	  /**< How much system ram can we lock? */
76718dceddSDavid Howells 
77718dceddSDavid Howells #define _DRM_LOCK_HELD	0x80000000U /**< Hardware lock is held */
78718dceddSDavid Howells #define _DRM_LOCK_CONT	0x40000000U /**< Hardware lock is contended */
79718dceddSDavid Howells #define _DRM_LOCK_IS_HELD(lock)	   ((lock) & _DRM_LOCK_HELD)
80718dceddSDavid Howells #define _DRM_LOCK_IS_CONT(lock)	   ((lock) & _DRM_LOCK_CONT)
81718dceddSDavid Howells #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT))
82718dceddSDavid Howells 
83718dceddSDavid Howells typedef unsigned int drm_context_t;
84718dceddSDavid Howells typedef unsigned int drm_drawable_t;
85718dceddSDavid Howells typedef unsigned int drm_magic_t;
86718dceddSDavid Howells 
870e0dc448SSimon Ser /*
88718dceddSDavid Howells  * Cliprect.
89718dceddSDavid Howells  *
90718dceddSDavid Howells  * \warning: If you change this structure, make sure you change
91718dceddSDavid Howells  * XF86DRIClipRectRec in the server as well
92718dceddSDavid Howells  *
93718dceddSDavid Howells  * \note KW: Actually it's illegal to change either for
94718dceddSDavid Howells  * backwards-compatibility reasons.
95718dceddSDavid Howells  */
96718dceddSDavid Howells struct drm_clip_rect {
97718dceddSDavid Howells 	unsigned short x1;
98718dceddSDavid Howells 	unsigned short y1;
99718dceddSDavid Howells 	unsigned short x2;
100718dceddSDavid Howells 	unsigned short y2;
101718dceddSDavid Howells };
102718dceddSDavid Howells 
1030e0dc448SSimon Ser /*
104718dceddSDavid Howells  * Drawable information.
105718dceddSDavid Howells  */
106718dceddSDavid Howells struct drm_drawable_info {
107718dceddSDavid Howells 	unsigned int num_rects;
108718dceddSDavid Howells 	struct drm_clip_rect *rects;
109718dceddSDavid Howells };
110718dceddSDavid Howells 
1110e0dc448SSimon Ser /*
112718dceddSDavid Howells  * Texture region,
113718dceddSDavid Howells  */
114718dceddSDavid Howells struct drm_tex_region {
115718dceddSDavid Howells 	unsigned char next;
116718dceddSDavid Howells 	unsigned char prev;
117718dceddSDavid Howells 	unsigned char in_use;
118718dceddSDavid Howells 	unsigned char padding;
119718dceddSDavid Howells 	unsigned int age;
120718dceddSDavid Howells };
121718dceddSDavid Howells 
1220e0dc448SSimon Ser /*
123718dceddSDavid Howells  * Hardware lock.
124718dceddSDavid Howells  *
125718dceddSDavid Howells  * The lock structure is a simple cache-line aligned integer.  To avoid
126718dceddSDavid Howells  * processor bus contention on a multiprocessor system, there should not be any
127718dceddSDavid Howells  * other data stored in the same cache line.
128718dceddSDavid Howells  */
129718dceddSDavid Howells struct drm_hw_lock {
130718dceddSDavid Howells 	__volatile__ unsigned int lock;		/**< lock variable */
131718dceddSDavid Howells 	char padding[60];			/**< Pad to cache line */
132718dceddSDavid Howells };
133718dceddSDavid Howells 
1340e0dc448SSimon Ser /*
135718dceddSDavid Howells  * DRM_IOCTL_VERSION ioctl argument type.
136718dceddSDavid Howells  *
137718dceddSDavid Howells  * \sa drmGetVersion().
138718dceddSDavid Howells  */
139718dceddSDavid Howells struct drm_version {
140718dceddSDavid Howells 	int version_major;	  /**< Major version */
141718dceddSDavid Howells 	int version_minor;	  /**< Minor version */
142718dceddSDavid Howells 	int version_patchlevel;	  /**< Patch level */
1431a2a42c8SMikko Rapeli 	__kernel_size_t name_len;	  /**< Length of name buffer */
144718dceddSDavid Howells 	char __user *name;	  /**< Name of driver */
1451a2a42c8SMikko Rapeli 	__kernel_size_t date_len;	  /**< Length of date buffer */
146718dceddSDavid Howells 	char __user *date;	  /**< User-space buffer to hold date */
1471a2a42c8SMikko Rapeli 	__kernel_size_t desc_len;	  /**< Length of desc buffer */
148718dceddSDavid Howells 	char __user *desc;	  /**< User-space buffer to hold desc */
149718dceddSDavid Howells };
150718dceddSDavid Howells 
1510e0dc448SSimon Ser /*
152718dceddSDavid Howells  * DRM_IOCTL_GET_UNIQUE ioctl argument type.
153718dceddSDavid Howells  *
154718dceddSDavid Howells  * \sa drmGetBusid() and drmSetBusId().
155718dceddSDavid Howells  */
156718dceddSDavid Howells struct drm_unique {
1571a2a42c8SMikko Rapeli 	__kernel_size_t unique_len;	  /**< Length of unique */
158718dceddSDavid Howells 	char __user *unique;	  /**< Unique name for driver instantiation */
159718dceddSDavid Howells };
160718dceddSDavid Howells 
161718dceddSDavid Howells struct drm_list {
162718dceddSDavid Howells 	int count;		  /**< Length of user-space structures */
163718dceddSDavid Howells 	struct drm_version __user *version;
164718dceddSDavid Howells };
165718dceddSDavid Howells 
166718dceddSDavid Howells struct drm_block {
167718dceddSDavid Howells 	int unused;
168718dceddSDavid Howells };
169718dceddSDavid Howells 
1700e0dc448SSimon Ser /*
171718dceddSDavid Howells  * DRM_IOCTL_CONTROL ioctl argument type.
172718dceddSDavid Howells  *
173718dceddSDavid Howells  * \sa drmCtlInstHandler() and drmCtlUninstHandler().
174718dceddSDavid Howells  */
175718dceddSDavid Howells struct drm_control {
176718dceddSDavid Howells 	enum {
177718dceddSDavid Howells 		DRM_ADD_COMMAND,
178718dceddSDavid Howells 		DRM_RM_COMMAND,
179718dceddSDavid Howells 		DRM_INST_HANDLER,
180718dceddSDavid Howells 		DRM_UNINST_HANDLER
181718dceddSDavid Howells 	} func;
182718dceddSDavid Howells 	int irq;
183718dceddSDavid Howells };
184718dceddSDavid Howells 
1850e0dc448SSimon Ser /*
186718dceddSDavid Howells  * Type of memory to map.
187718dceddSDavid Howells  */
188718dceddSDavid Howells enum drm_map_type {
189718dceddSDavid Howells 	_DRM_FRAME_BUFFER = 0,	  /**< WC (no caching), no core dump */
190718dceddSDavid Howells 	_DRM_REGISTERS = 1,	  /**< no caching, no core dump */
191718dceddSDavid Howells 	_DRM_SHM = 2,		  /**< shared, cached */
192718dceddSDavid Howells 	_DRM_AGP = 3,		  /**< AGP/GART */
193718dceddSDavid Howells 	_DRM_SCATTER_GATHER = 4,  /**< Scatter/gather memory for PCI DMA */
19400fdf360SDaniel Vetter 	_DRM_CONSISTENT = 5	  /**< Consistent memory for PCI DMA */
195718dceddSDavid Howells };
196718dceddSDavid Howells 
1970e0dc448SSimon Ser /*
198718dceddSDavid Howells  * Memory mapping flags.
199718dceddSDavid Howells  */
200718dceddSDavid Howells enum drm_map_flags {
201718dceddSDavid Howells 	_DRM_RESTRICTED = 0x01,	     /**< Cannot be mapped to user-virtual */
202718dceddSDavid Howells 	_DRM_READ_ONLY = 0x02,
203718dceddSDavid Howells 	_DRM_LOCKED = 0x04,	     /**< shared, cached, locked */
204718dceddSDavid Howells 	_DRM_KERNEL = 0x08,	     /**< kernel requires access */
205718dceddSDavid Howells 	_DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */
206718dceddSDavid Howells 	_DRM_CONTAINS_LOCK = 0x20,   /**< SHM page that contains lock */
207718dceddSDavid Howells 	_DRM_REMOVABLE = 0x40,	     /**< Removable mapping */
208718dceddSDavid Howells 	_DRM_DRIVER = 0x80	     /**< Managed by driver */
209718dceddSDavid Howells };
210718dceddSDavid Howells 
211718dceddSDavid Howells struct drm_ctx_priv_map {
212718dceddSDavid Howells 	unsigned int ctx_id;	 /**< Context requesting private mapping */
213718dceddSDavid Howells 	void *handle;		 /**< Handle of map */
214718dceddSDavid Howells };
215718dceddSDavid Howells 
2160e0dc448SSimon Ser /*
217718dceddSDavid Howells  * DRM_IOCTL_GET_MAP, DRM_IOCTL_ADD_MAP and DRM_IOCTL_RM_MAP ioctls
218718dceddSDavid Howells  * argument type.
219718dceddSDavid Howells  *
220718dceddSDavid Howells  * \sa drmAddMap().
221718dceddSDavid Howells  */
222718dceddSDavid Howells struct drm_map {
223718dceddSDavid Howells 	unsigned long offset;	 /**< Requested physical address (0 for SAREA)*/
224718dceddSDavid Howells 	unsigned long size;	 /**< Requested physical size (bytes) */
225718dceddSDavid Howells 	enum drm_map_type type;	 /**< Type of memory to map */
226718dceddSDavid Howells 	enum drm_map_flags flags;	 /**< Flags */
227718dceddSDavid Howells 	void *handle;		 /**< User-space: "Handle" to pass to mmap() */
228718dceddSDavid Howells 				 /**< Kernel-space: kernel-virtual address */
229718dceddSDavid Howells 	int mtrr;		 /**< MTRR slot used */
230718dceddSDavid Howells 	/*   Private data */
231718dceddSDavid Howells };
232718dceddSDavid Howells 
2330e0dc448SSimon Ser /*
234718dceddSDavid Howells  * DRM_IOCTL_GET_CLIENT ioctl argument type.
235718dceddSDavid Howells  */
236718dceddSDavid Howells struct drm_client {
237718dceddSDavid Howells 	int idx;		/**< Which client desired? */
238718dceddSDavid Howells 	int auth;		/**< Is client authenticated? */
239718dceddSDavid Howells 	unsigned long pid;	/**< Process ID */
240718dceddSDavid Howells 	unsigned long uid;	/**< User ID */
241718dceddSDavid Howells 	unsigned long magic;	/**< Magic */
242718dceddSDavid Howells 	unsigned long iocs;	/**< Ioctl count */
243718dceddSDavid Howells };
244718dceddSDavid Howells 
245718dceddSDavid Howells enum drm_stat_type {
246718dceddSDavid Howells 	_DRM_STAT_LOCK,
247718dceddSDavid Howells 	_DRM_STAT_OPENS,
248718dceddSDavid Howells 	_DRM_STAT_CLOSES,
249718dceddSDavid Howells 	_DRM_STAT_IOCTLS,
250718dceddSDavid Howells 	_DRM_STAT_LOCKS,
251718dceddSDavid Howells 	_DRM_STAT_UNLOCKS,
252718dceddSDavid Howells 	_DRM_STAT_VALUE,	/**< Generic value */
253718dceddSDavid Howells 	_DRM_STAT_BYTE,		/**< Generic byte counter (1024bytes/K) */
254718dceddSDavid Howells 	_DRM_STAT_COUNT,	/**< Generic non-byte counter (1000/k) */
255718dceddSDavid Howells 
256718dceddSDavid Howells 	_DRM_STAT_IRQ,		/**< IRQ */
257718dceddSDavid Howells 	_DRM_STAT_PRIMARY,	/**< Primary DMA bytes */
258718dceddSDavid Howells 	_DRM_STAT_SECONDARY,	/**< Secondary DMA bytes */
259718dceddSDavid Howells 	_DRM_STAT_DMA,		/**< DMA */
260718dceddSDavid Howells 	_DRM_STAT_SPECIAL,	/**< Special DMA (e.g., priority or polled) */
261718dceddSDavid Howells 	_DRM_STAT_MISSED	/**< Missed DMA opportunity */
262718dceddSDavid Howells 	    /* Add to the *END* of the list */
263718dceddSDavid Howells };
264718dceddSDavid Howells 
2650e0dc448SSimon Ser /*
266718dceddSDavid Howells  * DRM_IOCTL_GET_STATS ioctl argument type.
267718dceddSDavid Howells  */
268718dceddSDavid Howells struct drm_stats {
269718dceddSDavid Howells 	unsigned long count;
270718dceddSDavid Howells 	struct {
271718dceddSDavid Howells 		unsigned long value;
272718dceddSDavid Howells 		enum drm_stat_type type;
273718dceddSDavid Howells 	} data[15];
274718dceddSDavid Howells };
275718dceddSDavid Howells 
2760e0dc448SSimon Ser /*
277718dceddSDavid Howells  * Hardware locking flags.
278718dceddSDavid Howells  */
279718dceddSDavid Howells enum drm_lock_flags {
280718dceddSDavid Howells 	_DRM_LOCK_READY = 0x01,	     /**< Wait until hardware is ready for DMA */
281718dceddSDavid Howells 	_DRM_LOCK_QUIESCENT = 0x02,  /**< Wait until hardware quiescent */
282718dceddSDavid Howells 	_DRM_LOCK_FLUSH = 0x04,	     /**< Flush this context's DMA queue first */
283718dceddSDavid Howells 	_DRM_LOCK_FLUSH_ALL = 0x08,  /**< Flush all DMA queues first */
284718dceddSDavid Howells 	/* These *HALT* flags aren't supported yet
285718dceddSDavid Howells 	   -- they will be used to support the
286718dceddSDavid Howells 	   full-screen DGA-like mode. */
287718dceddSDavid Howells 	_DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */
288718dceddSDavid Howells 	_DRM_HALT_CUR_QUEUES = 0x20  /**< Halt all current queues */
289718dceddSDavid Howells };
290718dceddSDavid Howells 
2910e0dc448SSimon Ser /*
292718dceddSDavid Howells  * DRM_IOCTL_LOCK, DRM_IOCTL_UNLOCK and DRM_IOCTL_FINISH ioctl argument type.
293718dceddSDavid Howells  *
294718dceddSDavid Howells  * \sa drmGetLock() and drmUnlock().
295718dceddSDavid Howells  */
296718dceddSDavid Howells struct drm_lock {
297718dceddSDavid Howells 	int context;
298718dceddSDavid Howells 	enum drm_lock_flags flags;
299718dceddSDavid Howells };
300718dceddSDavid Howells 
3010e0dc448SSimon Ser /*
302718dceddSDavid Howells  * DMA flags
303718dceddSDavid Howells  *
304718dceddSDavid Howells  * \warning
305718dceddSDavid Howells  * These values \e must match xf86drm.h.
306718dceddSDavid Howells  *
307718dceddSDavid Howells  * \sa drm_dma.
308718dceddSDavid Howells  */
309718dceddSDavid Howells enum drm_dma_flags {
310718dceddSDavid Howells 	/* Flags for DMA buffer dispatch */
311718dceddSDavid Howells 	_DRM_DMA_BLOCK = 0x01,	      /**<
312718dceddSDavid Howells 				       * Block until buffer dispatched.
313718dceddSDavid Howells 				       *
314718dceddSDavid Howells 				       * \note The buffer may not yet have
315718dceddSDavid Howells 				       * been processed by the hardware --
316718dceddSDavid Howells 				       * getting a hardware lock with the
317718dceddSDavid Howells 				       * hardware quiescent will ensure
318718dceddSDavid Howells 				       * that the buffer has been
319718dceddSDavid Howells 				       * processed.
320718dceddSDavid Howells 				       */
321718dceddSDavid Howells 	_DRM_DMA_WHILE_LOCKED = 0x02, /**< Dispatch while lock held */
322718dceddSDavid Howells 	_DRM_DMA_PRIORITY = 0x04,     /**< High priority dispatch */
323718dceddSDavid Howells 
324718dceddSDavid Howells 	/* Flags for DMA buffer request */
325718dceddSDavid Howells 	_DRM_DMA_WAIT = 0x10,	      /**< Wait for free buffers */
326718dceddSDavid Howells 	_DRM_DMA_SMALLER_OK = 0x20,   /**< Smaller-than-requested buffers OK */
327718dceddSDavid Howells 	_DRM_DMA_LARGER_OK = 0x40     /**< Larger-than-requested buffers OK */
328718dceddSDavid Howells };
329718dceddSDavid Howells 
3300e0dc448SSimon Ser /*
331718dceddSDavid Howells  * DRM_IOCTL_ADD_BUFS and DRM_IOCTL_MARK_BUFS ioctl argument type.
332718dceddSDavid Howells  *
333718dceddSDavid Howells  * \sa drmAddBufs().
334718dceddSDavid Howells  */
335718dceddSDavid Howells struct drm_buf_desc {
336718dceddSDavid Howells 	int count;		 /**< Number of buffers of this size */
337718dceddSDavid Howells 	int size;		 /**< Size in bytes */
338718dceddSDavid Howells 	int low_mark;		 /**< Low water mark */
339718dceddSDavid Howells 	int high_mark;		 /**< High water mark */
340718dceddSDavid Howells 	enum {
341718dceddSDavid Howells 		_DRM_PAGE_ALIGN = 0x01,	/**< Align on page boundaries for DMA */
342718dceddSDavid Howells 		_DRM_AGP_BUFFER = 0x02,	/**< Buffer is in AGP space */
343718dceddSDavid Howells 		_DRM_SG_BUFFER = 0x04,	/**< Scatter/gather memory buffer */
344718dceddSDavid Howells 		_DRM_FB_BUFFER = 0x08,	/**< Buffer is in frame buffer */
345718dceddSDavid Howells 		_DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */
346718dceddSDavid Howells 	} flags;
347718dceddSDavid Howells 	unsigned long agp_start; /**<
348718dceddSDavid Howells 				  * Start address of where the AGP buffers are
349718dceddSDavid Howells 				  * in the AGP aperture
350718dceddSDavid Howells 				  */
351718dceddSDavid Howells };
352718dceddSDavid Howells 
3530e0dc448SSimon Ser /*
354718dceddSDavid Howells  * DRM_IOCTL_INFO_BUFS ioctl argument type.
355718dceddSDavid Howells  */
356718dceddSDavid Howells struct drm_buf_info {
357718dceddSDavid Howells 	int count;		/**< Entries in list */
358718dceddSDavid Howells 	struct drm_buf_desc __user *list;
359718dceddSDavid Howells };
360718dceddSDavid Howells 
3610e0dc448SSimon Ser /*
362718dceddSDavid Howells  * DRM_IOCTL_FREE_BUFS ioctl argument type.
363718dceddSDavid Howells  */
364718dceddSDavid Howells struct drm_buf_free {
365718dceddSDavid Howells 	int count;
366718dceddSDavid Howells 	int __user *list;
367718dceddSDavid Howells };
368718dceddSDavid Howells 
3690e0dc448SSimon Ser /*
370718dceddSDavid Howells  * Buffer information
371718dceddSDavid Howells  *
372718dceddSDavid Howells  * \sa drm_buf_map.
373718dceddSDavid Howells  */
374718dceddSDavid Howells struct drm_buf_pub {
375718dceddSDavid Howells 	int idx;		       /**< Index into the master buffer list */
376718dceddSDavid Howells 	int total;		       /**< Buffer size */
377718dceddSDavid Howells 	int used;		       /**< Amount of buffer in use (for DMA) */
378718dceddSDavid Howells 	void __user *address;	       /**< Address of buffer */
379718dceddSDavid Howells };
380718dceddSDavid Howells 
3810e0dc448SSimon Ser /*
382718dceddSDavid Howells  * DRM_IOCTL_MAP_BUFS ioctl argument type.
383718dceddSDavid Howells  */
384718dceddSDavid Howells struct drm_buf_map {
385718dceddSDavid Howells 	int count;		/**< Length of the buffer list */
3864c4925faSDaniel Vetter #ifdef __cplusplus
3874c4925faSDaniel Vetter 	void __user *virt;
3884c4925faSDaniel Vetter #else
389718dceddSDavid Howells 	void __user *virtual;		/**< Mmap'd area in user-virtual */
3904c4925faSDaniel Vetter #endif
391718dceddSDavid Howells 	struct drm_buf_pub __user *list;	/**< Buffer information */
392718dceddSDavid Howells };
393718dceddSDavid Howells 
3940e0dc448SSimon Ser /*
395718dceddSDavid Howells  * DRM_IOCTL_DMA ioctl argument type.
396718dceddSDavid Howells  *
397718dceddSDavid Howells  * Indices here refer to the offset into the buffer list in drm_buf_get.
398718dceddSDavid Howells  *
399718dceddSDavid Howells  * \sa drmDMA().
400718dceddSDavid Howells  */
401718dceddSDavid Howells struct drm_dma {
402718dceddSDavid Howells 	int context;			  /**< Context handle */
403718dceddSDavid Howells 	int send_count;			  /**< Number of buffers to send */
404718dceddSDavid Howells 	int __user *send_indices;	  /**< List of handles to buffers */
405718dceddSDavid Howells 	int __user *send_sizes;		  /**< Lengths of data to send */
406718dceddSDavid Howells 	enum drm_dma_flags flags;	  /**< Flags */
407718dceddSDavid Howells 	int request_count;		  /**< Number of buffers requested */
408718dceddSDavid Howells 	int request_size;		  /**< Desired size for buffers */
409718dceddSDavid Howells 	int __user *request_indices;	  /**< Buffer information */
410718dceddSDavid Howells 	int __user *request_sizes;
411718dceddSDavid Howells 	int granted_count;		  /**< Number of buffers granted */
412718dceddSDavid Howells };
413718dceddSDavid Howells 
414718dceddSDavid Howells enum drm_ctx_flags {
415718dceddSDavid Howells 	_DRM_CONTEXT_PRESERVED = 0x01,
416718dceddSDavid Howells 	_DRM_CONTEXT_2DONLY = 0x02
417718dceddSDavid Howells };
418718dceddSDavid Howells 
4190e0dc448SSimon Ser /*
420718dceddSDavid Howells  * DRM_IOCTL_ADD_CTX ioctl argument type.
421718dceddSDavid Howells  *
422718dceddSDavid Howells  * \sa drmCreateContext() and drmDestroyContext().
423718dceddSDavid Howells  */
424718dceddSDavid Howells struct drm_ctx {
425718dceddSDavid Howells 	drm_context_t handle;
426718dceddSDavid Howells 	enum drm_ctx_flags flags;
427718dceddSDavid Howells };
428718dceddSDavid Howells 
4290e0dc448SSimon Ser /*
430718dceddSDavid Howells  * DRM_IOCTL_RES_CTX ioctl argument type.
431718dceddSDavid Howells  */
432718dceddSDavid Howells struct drm_ctx_res {
433718dceddSDavid Howells 	int count;
434718dceddSDavid Howells 	struct drm_ctx __user *contexts;
435718dceddSDavid Howells };
436718dceddSDavid Howells 
4370e0dc448SSimon Ser /*
438718dceddSDavid Howells  * DRM_IOCTL_ADD_DRAW and DRM_IOCTL_RM_DRAW ioctl argument type.
439718dceddSDavid Howells  */
440718dceddSDavid Howells struct drm_draw {
441718dceddSDavid Howells 	drm_drawable_t handle;
442718dceddSDavid Howells };
443718dceddSDavid Howells 
4440e0dc448SSimon Ser /*
445718dceddSDavid Howells  * DRM_IOCTL_UPDATE_DRAW ioctl argument type.
446718dceddSDavid Howells  */
447718dceddSDavid Howells typedef enum {
44800fdf360SDaniel Vetter 	DRM_DRAWABLE_CLIPRECTS
449718dceddSDavid Howells } drm_drawable_info_type_t;
450718dceddSDavid Howells 
451718dceddSDavid Howells struct drm_update_draw {
452718dceddSDavid Howells 	drm_drawable_t handle;
453718dceddSDavid Howells 	unsigned int type;
454718dceddSDavid Howells 	unsigned int num;
455718dceddSDavid Howells 	unsigned long long data;
456718dceddSDavid Howells };
457718dceddSDavid Howells 
4580e0dc448SSimon Ser /*
459718dceddSDavid Howells  * DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type.
460718dceddSDavid Howells  */
461718dceddSDavid Howells struct drm_auth {
462718dceddSDavid Howells 	drm_magic_t magic;
463718dceddSDavid Howells };
464718dceddSDavid Howells 
4650e0dc448SSimon Ser /*
466718dceddSDavid Howells  * DRM_IOCTL_IRQ_BUSID ioctl argument type.
467718dceddSDavid Howells  *
468718dceddSDavid Howells  * \sa drmGetInterruptFromBusID().
469718dceddSDavid Howells  */
470718dceddSDavid Howells struct drm_irq_busid {
471718dceddSDavid Howells 	int irq;	/**< IRQ number */
472718dceddSDavid Howells 	int busnum;	/**< bus number */
473718dceddSDavid Howells 	int devnum;	/**< device number */
474718dceddSDavid Howells 	int funcnum;	/**< function number */
475718dceddSDavid Howells };
476718dceddSDavid Howells 
477718dceddSDavid Howells enum drm_vblank_seq_type {
478718dceddSDavid Howells 	_DRM_VBLANK_ABSOLUTE = 0x0,	/**< Wait for specific vblank sequence number */
479718dceddSDavid Howells 	_DRM_VBLANK_RELATIVE = 0x1,	/**< Wait for given number of vblanks */
480718dceddSDavid Howells 	/* bits 1-6 are reserved for high crtcs */
481718dceddSDavid Howells 	_DRM_VBLANK_HIGH_CRTC_MASK = 0x0000003e,
482718dceddSDavid Howells 	_DRM_VBLANK_EVENT = 0x4000000,   /**< Send event instead of blocking */
483718dceddSDavid Howells 	_DRM_VBLANK_FLIP = 0x8000000,   /**< Scheduled buffer swap should flip */
484718dceddSDavid Howells 	_DRM_VBLANK_NEXTONMISS = 0x10000000,	/**< If missed, wait for next vblank */
485718dceddSDavid Howells 	_DRM_VBLANK_SECONDARY = 0x20000000,	/**< Secondary display controller */
486718dceddSDavid Howells 	_DRM_VBLANK_SIGNAL = 0x40000000	/**< Send signal instead of blocking, unsupported */
487718dceddSDavid Howells };
488718dceddSDavid Howells #define _DRM_VBLANK_HIGH_CRTC_SHIFT 1
489718dceddSDavid Howells 
490718dceddSDavid Howells #define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE)
491718dceddSDavid Howells #define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \
492718dceddSDavid Howells 				_DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS)
493718dceddSDavid Howells 
494718dceddSDavid Howells struct drm_wait_vblank_request {
495718dceddSDavid Howells 	enum drm_vblank_seq_type type;
496718dceddSDavid Howells 	unsigned int sequence;
497718dceddSDavid Howells 	unsigned long signal;
498718dceddSDavid Howells };
499718dceddSDavid Howells 
500718dceddSDavid Howells struct drm_wait_vblank_reply {
501718dceddSDavid Howells 	enum drm_vblank_seq_type type;
502718dceddSDavid Howells 	unsigned int sequence;
503718dceddSDavid Howells 	long tval_sec;
504718dceddSDavid Howells 	long tval_usec;
505718dceddSDavid Howells };
506718dceddSDavid Howells 
5070e0dc448SSimon Ser /*
508718dceddSDavid Howells  * DRM_IOCTL_WAIT_VBLANK ioctl argument type.
509718dceddSDavid Howells  *
510718dceddSDavid Howells  * \sa drmWaitVBlank().
511718dceddSDavid Howells  */
512718dceddSDavid Howells union drm_wait_vblank {
513718dceddSDavid Howells 	struct drm_wait_vblank_request request;
514718dceddSDavid Howells 	struct drm_wait_vblank_reply reply;
515718dceddSDavid Howells };
516718dceddSDavid Howells 
517718dceddSDavid Howells #define _DRM_PRE_MODESET 1
518718dceddSDavid Howells #define _DRM_POST_MODESET 2
519718dceddSDavid Howells 
5200e0dc448SSimon Ser /*
521718dceddSDavid Howells  * DRM_IOCTL_MODESET_CTL ioctl argument type
522718dceddSDavid Howells  *
523718dceddSDavid Howells  * \sa drmModesetCtl().
524718dceddSDavid Howells  */
525718dceddSDavid Howells struct drm_modeset_ctl {
526718dceddSDavid Howells 	__u32 crtc;
527718dceddSDavid Howells 	__u32 cmd;
528718dceddSDavid Howells };
529718dceddSDavid Howells 
5300e0dc448SSimon Ser /*
531718dceddSDavid Howells  * DRM_IOCTL_AGP_ENABLE ioctl argument type.
532718dceddSDavid Howells  *
533718dceddSDavid Howells  * \sa drmAgpEnable().
534718dceddSDavid Howells  */
535718dceddSDavid Howells struct drm_agp_mode {
536718dceddSDavid Howells 	unsigned long mode;	/**< AGP mode */
537718dceddSDavid Howells };
538718dceddSDavid Howells 
5390e0dc448SSimon Ser /*
540718dceddSDavid Howells  * DRM_IOCTL_AGP_ALLOC and DRM_IOCTL_AGP_FREE ioctls argument type.
541718dceddSDavid Howells  *
542718dceddSDavid Howells  * \sa drmAgpAlloc() and drmAgpFree().
543718dceddSDavid Howells  */
544718dceddSDavid Howells struct drm_agp_buffer {
545718dceddSDavid Howells 	unsigned long size;	/**< In bytes -- will round to page boundary */
546718dceddSDavid Howells 	unsigned long handle;	/**< Used for binding / unbinding */
547718dceddSDavid Howells 	unsigned long type;	/**< Type of memory to allocate */
548718dceddSDavid Howells 	unsigned long physical;	/**< Physical used by i810 */
549718dceddSDavid Howells };
550718dceddSDavid Howells 
5510e0dc448SSimon Ser /*
552718dceddSDavid Howells  * DRM_IOCTL_AGP_BIND and DRM_IOCTL_AGP_UNBIND ioctls argument type.
553718dceddSDavid Howells  *
554718dceddSDavid Howells  * \sa drmAgpBind() and drmAgpUnbind().
555718dceddSDavid Howells  */
556718dceddSDavid Howells struct drm_agp_binding {
557718dceddSDavid Howells 	unsigned long handle;	/**< From drm_agp_buffer */
558718dceddSDavid Howells 	unsigned long offset;	/**< In bytes -- will round to page boundary */
559718dceddSDavid Howells };
560718dceddSDavid Howells 
5610e0dc448SSimon Ser /*
562718dceddSDavid Howells  * DRM_IOCTL_AGP_INFO ioctl argument type.
563718dceddSDavid Howells  *
564718dceddSDavid Howells  * \sa drmAgpVersionMajor(), drmAgpVersionMinor(), drmAgpGetMode(),
565718dceddSDavid Howells  * drmAgpBase(), drmAgpSize(), drmAgpMemoryUsed(), drmAgpMemoryAvail(),
566718dceddSDavid Howells  * drmAgpVendorId() and drmAgpDeviceId().
567718dceddSDavid Howells  */
568718dceddSDavid Howells struct drm_agp_info {
569718dceddSDavid Howells 	int agp_version_major;
570718dceddSDavid Howells 	int agp_version_minor;
571718dceddSDavid Howells 	unsigned long mode;
572718dceddSDavid Howells 	unsigned long aperture_base;	/* physical address */
573718dceddSDavid Howells 	unsigned long aperture_size;	/* bytes */
574718dceddSDavid Howells 	unsigned long memory_allowed;	/* bytes */
575718dceddSDavid Howells 	unsigned long memory_used;
576718dceddSDavid Howells 
577718dceddSDavid Howells 	/* PCI information */
578718dceddSDavid Howells 	unsigned short id_vendor;
579718dceddSDavid Howells 	unsigned short id_device;
580718dceddSDavid Howells };
581718dceddSDavid Howells 
5820e0dc448SSimon Ser /*
583718dceddSDavid Howells  * DRM_IOCTL_SG_ALLOC ioctl argument type.
584718dceddSDavid Howells  */
585718dceddSDavid Howells struct drm_scatter_gather {
586718dceddSDavid Howells 	unsigned long size;	/**< In bytes -- will round to page boundary */
587718dceddSDavid Howells 	unsigned long handle;	/**< Used for mapping / unmapping */
588718dceddSDavid Howells };
589718dceddSDavid Howells 
5900e0dc448SSimon Ser /*
591718dceddSDavid Howells  * DRM_IOCTL_SET_VERSION ioctl argument type.
592718dceddSDavid Howells  */
593718dceddSDavid Howells struct drm_set_version {
594718dceddSDavid Howells 	int drm_di_major;
595718dceddSDavid Howells 	int drm_di_minor;
596718dceddSDavid Howells 	int drm_dd_major;
597718dceddSDavid Howells 	int drm_dd_minor;
598718dceddSDavid Howells };
599718dceddSDavid Howells 
6000e0dc448SSimon Ser /* DRM_IOCTL_GEM_CLOSE ioctl argument type */
601718dceddSDavid Howells struct drm_gem_close {
602718dceddSDavid Howells 	/** Handle of the object to be closed. */
603718dceddSDavid Howells 	__u32 handle;
604718dceddSDavid Howells 	__u32 pad;
605718dceddSDavid Howells };
606718dceddSDavid Howells 
6070e0dc448SSimon Ser /* DRM_IOCTL_GEM_FLINK ioctl argument type */
608718dceddSDavid Howells struct drm_gem_flink {
609718dceddSDavid Howells 	/** Handle for the object being named */
610718dceddSDavid Howells 	__u32 handle;
611718dceddSDavid Howells 
612718dceddSDavid Howells 	/** Returned global name */
613718dceddSDavid Howells 	__u32 name;
614718dceddSDavid Howells };
615718dceddSDavid Howells 
6160e0dc448SSimon Ser /* DRM_IOCTL_GEM_OPEN ioctl argument type */
617718dceddSDavid Howells struct drm_gem_open {
618718dceddSDavid Howells 	/** Name of object being opened */
619718dceddSDavid Howells 	__u32 name;
620718dceddSDavid Howells 
621718dceddSDavid Howells 	/** Returned handle for the object */
622718dceddSDavid Howells 	__u32 handle;
623718dceddSDavid Howells 
624718dceddSDavid Howells 	/** Returned size of the object */
625718dceddSDavid Howells 	__u64 size;
626718dceddSDavid Howells };
627718dceddSDavid Howells 
628b603e810SSimon Ser /**
629b603e810SSimon Ser  * DRM_CAP_DUMB_BUFFER
630b603e810SSimon Ser  *
631b603e810SSimon Ser  * If set to 1, the driver supports creating dumb buffers via the
632b603e810SSimon Ser  * &DRM_IOCTL_MODE_CREATE_DUMB ioctl.
633b603e810SSimon Ser  */
634a99b57dbSDamien Lespiau #define DRM_CAP_DUMB_BUFFER		0x1
635b603e810SSimon Ser /**
636b603e810SSimon Ser  * DRM_CAP_VBLANK_HIGH_CRTC
637b603e810SSimon Ser  *
63826594678SLeandro Ribeiro  * If set to 1, the kernel supports specifying a :ref:`CRTC index<crtc_index>`
63926594678SLeandro Ribeiro  * in the high bits of &drm_wait_vblank_request.type.
640b603e810SSimon Ser  *
641b603e810SSimon Ser  * Starting kernel version 2.6.39, this capability is always set to 1.
642b603e810SSimon Ser  */
643a99b57dbSDamien Lespiau #define DRM_CAP_VBLANK_HIGH_CRTC	0x2
644b603e810SSimon Ser /**
645b603e810SSimon Ser  * DRM_CAP_DUMB_PREFERRED_DEPTH
646b603e810SSimon Ser  *
647b603e810SSimon Ser  * The preferred bit depth for dumb buffers.
648b603e810SSimon Ser  *
649b603e810SSimon Ser  * The bit depth is the number of bits used to indicate the color of a single
650b603e810SSimon Ser  * pixel excluding any padding. This is different from the number of bits per
651b603e810SSimon Ser  * pixel. For instance, XRGB8888 has a bit depth of 24 but has 32 bits per
652b603e810SSimon Ser  * pixel.
653b603e810SSimon Ser  *
654b603e810SSimon Ser  * Note that this preference only applies to dumb buffers, it's irrelevant for
655b603e810SSimon Ser  * other types of buffers.
656b603e810SSimon Ser  */
657a99b57dbSDamien Lespiau #define DRM_CAP_DUMB_PREFERRED_DEPTH	0x3
658b603e810SSimon Ser /**
659b603e810SSimon Ser  * DRM_CAP_DUMB_PREFER_SHADOW
660b603e810SSimon Ser  *
661b603e810SSimon Ser  * If set to 1, the driver prefers userspace to render to a shadow buffer
662b603e810SSimon Ser  * instead of directly rendering to a dumb buffer. For best speed, userspace
663b603e810SSimon Ser  * should do streaming ordered memory copies into the dumb buffer and never
664b603e810SSimon Ser  * read from it.
665b603e810SSimon Ser  *
666b603e810SSimon Ser  * Note that this preference only applies to dumb buffers, it's irrelevant for
667b603e810SSimon Ser  * other types of buffers.
668b603e810SSimon Ser  */
669a99b57dbSDamien Lespiau #define DRM_CAP_DUMB_PREFER_SHADOW	0x4
670b603e810SSimon Ser /**
671b603e810SSimon Ser  * DRM_CAP_PRIME
672b603e810SSimon Ser  *
673b603e810SSimon Ser  * Bitfield of supported PRIME sharing capabilities. See &DRM_PRIME_CAP_IMPORT
674b603e810SSimon Ser  * and &DRM_PRIME_CAP_EXPORT.
675b603e810SSimon Ser  *
676*ad9ee11fSSimon Ser  * Starting from kernel version 6.6, both &DRM_PRIME_CAP_IMPORT and
677*ad9ee11fSSimon Ser  * &DRM_PRIME_CAP_EXPORT are always advertised.
678*ad9ee11fSSimon Ser  *
6799a2eabf4SSimon Ser  * PRIME buffers are exposed as dma-buf file descriptors.
6809a2eabf4SSimon Ser  * See :ref:`prime_buffer_sharing`.
681b603e810SSimon Ser  */
682a99b57dbSDamien Lespiau #define DRM_CAP_PRIME			0x5
683b603e810SSimon Ser /**
684b603e810SSimon Ser  * DRM_PRIME_CAP_IMPORT
685b603e810SSimon Ser  *
686b603e810SSimon Ser  * If this bit is set in &DRM_CAP_PRIME, the driver supports importing PRIME
687b603e810SSimon Ser  * buffers via the &DRM_IOCTL_PRIME_FD_TO_HANDLE ioctl.
688*ad9ee11fSSimon Ser  *
689*ad9ee11fSSimon Ser  * Starting from kernel version 6.6, this bit is always set in &DRM_CAP_PRIME.
690b603e810SSimon Ser  */
691a99b57dbSDamien Lespiau #define  DRM_PRIME_CAP_IMPORT		0x1
692b603e810SSimon Ser /**
693b603e810SSimon Ser  * DRM_PRIME_CAP_EXPORT
694b603e810SSimon Ser  *
695b603e810SSimon Ser  * If this bit is set in &DRM_CAP_PRIME, the driver supports exporting PRIME
696b603e810SSimon Ser  * buffers via the &DRM_IOCTL_PRIME_HANDLE_TO_FD ioctl.
697*ad9ee11fSSimon Ser  *
698*ad9ee11fSSimon Ser  * Starting from kernel version 6.6, this bit is always set in &DRM_CAP_PRIME.
699b603e810SSimon Ser  */
700a99b57dbSDamien Lespiau #define  DRM_PRIME_CAP_EXPORT		0x2
701b603e810SSimon Ser /**
702b603e810SSimon Ser  * DRM_CAP_TIMESTAMP_MONOTONIC
703b603e810SSimon Ser  *
704b603e810SSimon Ser  * If set to 0, the kernel will report timestamps with ``CLOCK_REALTIME`` in
705b603e810SSimon Ser  * struct drm_event_vblank. If set to 1, the kernel will report timestamps with
706b603e810SSimon Ser  * ``CLOCK_MONOTONIC``. See ``clock_gettime(2)`` for the definition of these
707b603e810SSimon Ser  * clocks.
708b603e810SSimon Ser  *
709b603e810SSimon Ser  * Starting from kernel version 2.6.39, the default value for this capability
710b603e810SSimon Ser  * is 1. Starting kernel version 4.15, this capability is always set to 1.
711b603e810SSimon Ser  */
712a99b57dbSDamien Lespiau #define DRM_CAP_TIMESTAMP_MONOTONIC	0x6
713b603e810SSimon Ser /**
714b603e810SSimon Ser  * DRM_CAP_ASYNC_PAGE_FLIP
715b603e810SSimon Ser  *
716b603e810SSimon Ser  * If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC.
717b603e810SSimon Ser  */
718a99b57dbSDamien Lespiau #define DRM_CAP_ASYNC_PAGE_FLIP		0x7
719b603e810SSimon Ser /**
720b603e810SSimon Ser  * DRM_CAP_CURSOR_WIDTH
721b603e810SSimon Ser  *
722b603e810SSimon Ser  * The ``CURSOR_WIDTH`` and ``CURSOR_HEIGHT`` capabilities return a valid
723b603e810SSimon Ser  * width x height combination for the hardware cursor. The intention is that a
724b603e810SSimon Ser  * hardware agnostic userspace can query a cursor plane size to use.
725bfe8b573SLespiau, Damien  *
726bfe8b573SLespiau, Damien  * Note that the cross-driver contract is to merely return a valid size;
727bfe8b573SLespiau, Damien  * drivers are free to attach another meaning on top, eg. i915 returns the
728bfe8b573SLespiau, Damien  * maximum plane size.
729bfe8b573SLespiau, Damien  */
7308716ed4eSAlex Deucher #define DRM_CAP_CURSOR_WIDTH		0x8
731b603e810SSimon Ser /**
732b603e810SSimon Ser  * DRM_CAP_CURSOR_HEIGHT
733b603e810SSimon Ser  *
734b603e810SSimon Ser  * See &DRM_CAP_CURSOR_WIDTH.
735b603e810SSimon Ser  */
7368716ed4eSAlex Deucher #define DRM_CAP_CURSOR_HEIGHT		0x9
737b603e810SSimon Ser /**
738b603e810SSimon Ser  * DRM_CAP_ADDFB2_MODIFIERS
739b603e810SSimon Ser  *
740b603e810SSimon Ser  * If set to 1, the driver supports supplying modifiers in the
741b603e810SSimon Ser  * &DRM_IOCTL_MODE_ADDFB2 ioctl.
742b603e810SSimon Ser  */
743e3eb3250SRob Clark #define DRM_CAP_ADDFB2_MODIFIERS	0x10
744b603e810SSimon Ser /**
745b603e810SSimon Ser  * DRM_CAP_PAGE_FLIP_TARGET
746b603e810SSimon Ser  *
747b603e810SSimon Ser  * If set to 1, the driver supports the &DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE and
748b603e810SSimon Ser  * &DRM_MODE_PAGE_FLIP_TARGET_RELATIVE flags in
749b603e810SSimon Ser  * &drm_mode_crtc_page_flip_target.flags for the &DRM_IOCTL_MODE_PAGE_FLIP
750b603e810SSimon Ser  * ioctl.
751b603e810SSimon Ser  */
752f837297aSMichel Dänzer #define DRM_CAP_PAGE_FLIP_TARGET	0x11
753b603e810SSimon Ser /**
754b603e810SSimon Ser  * DRM_CAP_CRTC_IN_VBLANK_EVENT
755b603e810SSimon Ser  *
756b603e810SSimon Ser  * If set to 1, the kernel supports reporting the CRTC ID in
757b603e810SSimon Ser  * &drm_event_vblank.crtc_id for the &DRM_EVENT_VBLANK and
758b603e810SSimon Ser  * &DRM_EVENT_FLIP_COMPLETE events.
759b603e810SSimon Ser  *
760b603e810SSimon Ser  * Starting kernel version 4.12, this capability is always set to 1.
761b603e810SSimon Ser  */
7625db06a8aSAnder Conselvan de Oliveira #define DRM_CAP_CRTC_IN_VBLANK_EVENT	0x12
763b603e810SSimon Ser /**
764b603e810SSimon Ser  * DRM_CAP_SYNCOBJ
765b603e810SSimon Ser  *
7669a2eabf4SSimon Ser  * If set to 1, the driver supports sync objects. See :ref:`drm_sync_objects`.
767b603e810SSimon Ser  */
768e9083420SDave Airlie #define DRM_CAP_SYNCOBJ		0x13
769b603e810SSimon Ser /**
770b603e810SSimon Ser  * DRM_CAP_SYNCOBJ_TIMELINE
771b603e810SSimon Ser  *
772b603e810SSimon Ser  * If set to 1, the driver supports timeline operations on sync objects. See
7739a2eabf4SSimon Ser  * :ref:`drm_sync_objects`.
774b603e810SSimon Ser  */
775060cebb2SLionel Landwerlin #define DRM_CAP_SYNCOBJ_TIMELINE	0x14
776a99b57dbSDamien Lespiau 
7770e0dc448SSimon Ser /* DRM_IOCTL_GET_CAP ioctl argument type */
778718dceddSDavid Howells struct drm_get_cap {
779718dceddSDavid Howells 	__u64 capability;
780718dceddSDavid Howells 	__u64 value;
781718dceddSDavid Howells };
782718dceddSDavid Howells 
78361d8e328SDamien Lespiau /**
78461d8e328SDamien Lespiau  * DRM_CLIENT_CAP_STEREO_3D
78561d8e328SDamien Lespiau  *
78688938bf3SSimon Ser  * If set to 1, the DRM core will expose the stereo 3D capabilities of the
78761d8e328SDamien Lespiau  * monitor by advertising the supported 3D layouts in the flags of struct
78888938bf3SSimon Ser  * drm_mode_modeinfo. See ``DRM_MODE_FLAG_3D_*``.
7892e290c8dSSimon Ser  *
7902e290c8dSSimon Ser  * This capability is always supported for all drivers starting from kernel
7912e290c8dSSimon Ser  * version 3.13.
79261d8e328SDamien Lespiau  */
79361d8e328SDamien Lespiau #define DRM_CLIENT_CAP_STEREO_3D	1
79461d8e328SDamien Lespiau 
795681e7ec7SMatt Roper /**
796681e7ec7SMatt Roper  * DRM_CLIENT_CAP_UNIVERSAL_PLANES
797681e7ec7SMatt Roper  *
798681e7ec7SMatt Roper  * If set to 1, the DRM core will expose all planes (overlay, primary, and
799681e7ec7SMatt Roper  * cursor) to userspace.
8002e290c8dSSimon Ser  *
8012e290c8dSSimon Ser  * This capability has been introduced in kernel version 3.15. Starting from
8022e290c8dSSimon Ser  * kernel version 3.17, this capability is always supported for all drivers.
803681e7ec7SMatt Roper  */
804681e7ec7SMatt Roper #define DRM_CLIENT_CAP_UNIVERSAL_PLANES  2
805681e7ec7SMatt Roper 
80688a48e29SRob Clark /**
80788a48e29SRob Clark  * DRM_CLIENT_CAP_ATOMIC
80888a48e29SRob Clark  *
809a1b766d1SSimon Ser  * If set to 1, the DRM core will expose atomic properties to userspace. This
810a1b766d1SSimon Ser  * implicitly enables &DRM_CLIENT_CAP_UNIVERSAL_PLANES and
811a1b766d1SSimon Ser  * &DRM_CLIENT_CAP_ASPECT_RATIO.
8122e290c8dSSimon Ser  *
8132e290c8dSSimon Ser  * If the driver doesn't support atomic mode-setting, enabling this capability
8142e290c8dSSimon Ser  * will fail with -EOPNOTSUPP.
8152e290c8dSSimon Ser  *
8162e290c8dSSimon Ser  * This capability has been introduced in kernel version 4.0. Starting from
8172e290c8dSSimon Ser  * kernel version 4.2, this capability is always supported for atomic-capable
8182e290c8dSSimon Ser  * drivers.
81988a48e29SRob Clark  */
82088a48e29SRob Clark #define DRM_CLIENT_CAP_ATOMIC	3
82188a48e29SRob Clark 
8227595bda2SAnkit Nautiyal /**
8237595bda2SAnkit Nautiyal  * DRM_CLIENT_CAP_ASPECT_RATIO
8247595bda2SAnkit Nautiyal  *
8257595bda2SAnkit Nautiyal  * If set to 1, the DRM core will provide aspect ratio information in modes.
82688938bf3SSimon Ser  * See ``DRM_MODE_FLAG_PIC_AR_*``.
8272e290c8dSSimon Ser  *
8282e290c8dSSimon Ser  * This capability is always supported for all drivers starting from kernel
8292e290c8dSSimon Ser  * version 4.18.
8307595bda2SAnkit Nautiyal  */
8317595bda2SAnkit Nautiyal #define DRM_CLIENT_CAP_ASPECT_RATIO    4
8327595bda2SAnkit Nautiyal 
833d67b6a20SLiviu Dudau /**
834d67b6a20SLiviu Dudau  * DRM_CLIENT_CAP_WRITEBACK_CONNECTORS
835d67b6a20SLiviu Dudau  *
836d67b6a20SLiviu Dudau  * If set to 1, the DRM core will expose special connectors to be used for
837bbf4627bSSimon Ser  * writing back to memory the scene setup in the commit. The client must enable
838bbf4627bSSimon Ser  * &DRM_CLIENT_CAP_ATOMIC first.
8392e290c8dSSimon Ser  *
8402e290c8dSSimon Ser  * This capability is always supported for atomic-capable drivers starting from
8412e290c8dSSimon Ser  * kernel version 4.19.
842d67b6a20SLiviu Dudau  */
843d67b6a20SLiviu Dudau #define DRM_CLIENT_CAP_WRITEBACK_CONNECTORS	5
844d67b6a20SLiviu Dudau 
8450e0dc448SSimon Ser /* DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */
8461c0814feSDamien Lespiau struct drm_set_client_cap {
8471c0814feSDamien Lespiau 	__u64 capability;
8481c0814feSDamien Lespiau 	__u64 value;
8491c0814feSDamien Lespiau };
8501c0814feSDamien Lespiau 
851bfe981a0SDaniel Thompson #define DRM_RDWR O_RDWR
852718dceddSDavid Howells #define DRM_CLOEXEC O_CLOEXEC
853718dceddSDavid Howells struct drm_prime_handle {
854718dceddSDavid Howells 	__u32 handle;
855718dceddSDavid Howells 
856718dceddSDavid Howells 	/** Flags.. only applicable for handle->fd */
857718dceddSDavid Howells 	__u32 flags;
858718dceddSDavid Howells 
859718dceddSDavid Howells 	/** Returned dmabuf file descriptor */
860718dceddSDavid Howells 	__s32 fd;
861718dceddSDavid Howells };
862718dceddSDavid Howells 
863e9083420SDave Airlie struct drm_syncobj_create {
864e9083420SDave Airlie 	__u32 handle;
8651fc08218SJason Ekstrand #define DRM_SYNCOBJ_CREATE_SIGNALED (1 << 0)
866e9083420SDave Airlie 	__u32 flags;
867e9083420SDave Airlie };
868e9083420SDave Airlie 
869e9083420SDave Airlie struct drm_syncobj_destroy {
870e9083420SDave Airlie 	__u32 handle;
871e9083420SDave Airlie 	__u32 pad;
872e9083420SDave Airlie };
873e9083420SDave Airlie 
8743ee45a3bSDave Airlie #define DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE (1 << 0)
8753ee45a3bSDave Airlie #define DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE (1 << 0)
876e9083420SDave Airlie struct drm_syncobj_handle {
877e9083420SDave Airlie 	__u32 handle;
878e9083420SDave Airlie 	__u32 flags;
879e9083420SDave Airlie 
880e9083420SDave Airlie 	__s32 fd;
881e9083420SDave Airlie 	__u32 pad;
882e9083420SDave Airlie };
883e9083420SDave Airlie 
884ea569910SChunming Zhou struct drm_syncobj_transfer {
885ea569910SChunming Zhou 	__u32 src_handle;
886ea569910SChunming Zhou 	__u32 dst_handle;
887ea569910SChunming Zhou 	__u64 src_point;
888ea569910SChunming Zhou 	__u64 dst_point;
889ea569910SChunming Zhou 	__u32 flags;
890ea569910SChunming Zhou 	__u32 pad;
891ea569910SChunming Zhou };
892ea569910SChunming Zhou 
8935e60a10eSDave Airlie #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)
894e7aca503SJason Ekstrand #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1)
89501d6c357SChunming Zhou #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2) /* wait for time point to become available */
8965e60a10eSDave Airlie struct drm_syncobj_wait {
8975e60a10eSDave Airlie 	__u64 handles;
8985e60a10eSDave Airlie 	/* absolute timeout */
8995e60a10eSDave Airlie 	__s64 timeout_nsec;
9005e60a10eSDave Airlie 	__u32 count_handles;
9015e60a10eSDave Airlie 	__u32 flags;
9025e60a10eSDave Airlie 	__u32 first_signaled; /* only valid when not waiting all */
9035e60a10eSDave Airlie 	__u32 pad;
9045e60a10eSDave Airlie };
9055e60a10eSDave Airlie 
90601d6c357SChunming Zhou struct drm_syncobj_timeline_wait {
90701d6c357SChunming Zhou 	__u64 handles;
90801d6c357SChunming Zhou 	/* wait on specific timeline point for every handles*/
90901d6c357SChunming Zhou 	__u64 points;
91001d6c357SChunming Zhou 	/* absolute timeout */
91101d6c357SChunming Zhou 	__s64 timeout_nsec;
91201d6c357SChunming Zhou 	__u32 count_handles;
91301d6c357SChunming Zhou 	__u32 flags;
91401d6c357SChunming Zhou 	__u32 first_signaled; /* only valid when not waiting all */
91501d6c357SChunming Zhou 	__u32 pad;
91601d6c357SChunming Zhou };
91701d6c357SChunming Zhou 
918c7a47229SSimon Ser /**
919c7a47229SSimon Ser  * struct drm_syncobj_eventfd
920c7a47229SSimon Ser  * @handle: syncobj handle.
921c7a47229SSimon Ser  * @flags: Zero to wait for the point to be signalled, or
922c7a47229SSimon Ser  *         &DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE to wait for a fence to be
923c7a47229SSimon Ser  *         available for the point.
924c7a47229SSimon Ser  * @point: syncobj timeline point (set to zero for binary syncobjs).
925c7a47229SSimon Ser  * @fd: Existing eventfd to sent events to.
926c7a47229SSimon Ser  * @pad: Must be zero.
927c7a47229SSimon Ser  *
928c7a47229SSimon Ser  * Register an eventfd to be signalled by a syncobj. The eventfd counter will
929c7a47229SSimon Ser  * be incremented by one.
930c7a47229SSimon Ser  */
931c7a47229SSimon Ser struct drm_syncobj_eventfd {
932c7a47229SSimon Ser 	__u32 handle;
933c7a47229SSimon Ser 	__u32 flags;
934c7a47229SSimon Ser 	__u64 point;
935c7a47229SSimon Ser 	__s32 fd;
936c7a47229SSimon Ser 	__u32 pad;
937c7a47229SSimon Ser };
938c7a47229SSimon Ser 
93901d6c357SChunming Zhou 
940aa4035d2SJason Ekstrand struct drm_syncobj_array {
941aa4035d2SJason Ekstrand 	__u64 handles;
942aa4035d2SJason Ekstrand 	__u32 count_handles;
943aa4035d2SJason Ekstrand 	__u32 pad;
944aa4035d2SJason Ekstrand };
945aa4035d2SJason Ekstrand 
9462093dea3SChunming Zhou #define DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED (1 << 0) /* last available point on timeline syncobj */
94727b575a9SChunming Zhou struct drm_syncobj_timeline_array {
94827b575a9SChunming Zhou 	__u64 handles;
94927b575a9SChunming Zhou 	__u64 points;
95027b575a9SChunming Zhou 	__u32 count_handles;
9512093dea3SChunming Zhou 	__u32 flags;
95227b575a9SChunming Zhou };
95327b575a9SChunming Zhou 
95427b575a9SChunming Zhou 
9553064abfaSKeith Packard /* Query current scanout sequence number */
9563064abfaSKeith Packard struct drm_crtc_get_sequence {
9573064abfaSKeith Packard 	__u32 crtc_id;		/* requested crtc_id */
9583064abfaSKeith Packard 	__u32 active;		/* return: crtc output is active */
9593064abfaSKeith Packard 	__u64 sequence;		/* return: most recent vblank sequence */
9603064abfaSKeith Packard 	__s64 sequence_ns;	/* return: most recent time of first pixel out */
9613064abfaSKeith Packard };
9623064abfaSKeith Packard 
9633064abfaSKeith Packard /* Queue event to be delivered at specified sequence. Time stamp marks
9643064abfaSKeith Packard  * when the first pixel of the refresh cycle leaves the display engine
9653064abfaSKeith Packard  * for the display
9663064abfaSKeith Packard  */
9673064abfaSKeith Packard #define DRM_CRTC_SEQUENCE_RELATIVE		0x00000001	/* sequence is relative to current */
9683064abfaSKeith Packard #define DRM_CRTC_SEQUENCE_NEXT_ON_MISS		0x00000002	/* Use next sequence if we've missed */
9693064abfaSKeith Packard 
9703064abfaSKeith Packard struct drm_crtc_queue_sequence {
9713064abfaSKeith Packard 	__u32 crtc_id;
9723064abfaSKeith Packard 	__u32 flags;
9733064abfaSKeith Packard 	__u64 sequence;		/* on input, target sequence. on output, actual sequence */
9743064abfaSKeith Packard 	__u64 user_data;	/* user data passed to event */
9753064abfaSKeith Packard };
9763064abfaSKeith Packard 
977ebbb0e5cSEmil Velikov #if defined(__cplusplus)
978ebbb0e5cSEmil Velikov }
979ebbb0e5cSEmil Velikov #endif
980ebbb0e5cSEmil Velikov 
9810b1ccd49SDaniel Vetter #include "drm_mode.h"
982718dceddSDavid Howells 
983ebbb0e5cSEmil Velikov #if defined(__cplusplus)
984ebbb0e5cSEmil Velikov extern "C" {
985ebbb0e5cSEmil Velikov #endif
986ebbb0e5cSEmil Velikov 
987718dceddSDavid Howells #define DRM_IOCTL_BASE			'd'
988718dceddSDavid Howells #define DRM_IO(nr)			_IO(DRM_IOCTL_BASE,nr)
989718dceddSDavid Howells #define DRM_IOR(nr,type)		_IOR(DRM_IOCTL_BASE,nr,type)
990718dceddSDavid Howells #define DRM_IOW(nr,type)		_IOW(DRM_IOCTL_BASE,nr,type)
991718dceddSDavid Howells #define DRM_IOWR(nr,type)		_IOWR(DRM_IOCTL_BASE,nr,type)
992718dceddSDavid Howells 
993718dceddSDavid Howells #define DRM_IOCTL_VERSION		DRM_IOWR(0x00, struct drm_version)
994718dceddSDavid Howells #define DRM_IOCTL_GET_UNIQUE		DRM_IOWR(0x01, struct drm_unique)
995718dceddSDavid Howells #define DRM_IOCTL_GET_MAGIC		DRM_IOR( 0x02, struct drm_auth)
996718dceddSDavid Howells #define DRM_IOCTL_IRQ_BUSID		DRM_IOWR(0x03, struct drm_irq_busid)
997718dceddSDavid Howells #define DRM_IOCTL_GET_MAP               DRM_IOWR(0x04, struct drm_map)
998718dceddSDavid Howells #define DRM_IOCTL_GET_CLIENT            DRM_IOWR(0x05, struct drm_client)
999718dceddSDavid Howells #define DRM_IOCTL_GET_STATS             DRM_IOR( 0x06, struct drm_stats)
1000718dceddSDavid Howells #define DRM_IOCTL_SET_VERSION		DRM_IOWR(0x07, struct drm_set_version)
1001718dceddSDavid Howells #define DRM_IOCTL_MODESET_CTL           DRM_IOW(0x08, struct drm_modeset_ctl)
1002158350aaSSimon Ser /**
1003158350aaSSimon Ser  * DRM_IOCTL_GEM_CLOSE - Close a GEM handle.
1004158350aaSSimon Ser  *
1005158350aaSSimon Ser  * GEM handles are not reference-counted by the kernel. User-space is
1006158350aaSSimon Ser  * responsible for managing their lifetime. For example, if user-space imports
1007158350aaSSimon Ser  * the same memory object twice on the same DRM file description, the same GEM
1008158350aaSSimon Ser  * handle is returned by both imports, and user-space needs to ensure
1009158350aaSSimon Ser  * &DRM_IOCTL_GEM_CLOSE is performed once only. The same situation can happen
1010158350aaSSimon Ser  * when a memory object is allocated, then exported and imported again on the
1011158350aaSSimon Ser  * same DRM file description. The &DRM_IOCTL_MODE_GETFB2 IOCTL is an exception
1012158350aaSSimon Ser  * and always returns fresh new GEM handles even if an existing GEM handle
1013158350aaSSimon Ser  * already refers to the same memory object before the IOCTL is performed.
1014158350aaSSimon Ser  */
1015718dceddSDavid Howells #define DRM_IOCTL_GEM_CLOSE		DRM_IOW (0x09, struct drm_gem_close)
1016718dceddSDavid Howells #define DRM_IOCTL_GEM_FLINK		DRM_IOWR(0x0a, struct drm_gem_flink)
1017718dceddSDavid Howells #define DRM_IOCTL_GEM_OPEN		DRM_IOWR(0x0b, struct drm_gem_open)
1018718dceddSDavid Howells #define DRM_IOCTL_GET_CAP		DRM_IOWR(0x0c, struct drm_get_cap)
10191c0814feSDamien Lespiau #define DRM_IOCTL_SET_CLIENT_CAP	DRM_IOW( 0x0d, struct drm_set_client_cap)
1020718dceddSDavid Howells 
1021718dceddSDavid Howells #define DRM_IOCTL_SET_UNIQUE		DRM_IOW( 0x10, struct drm_unique)
1022718dceddSDavid Howells #define DRM_IOCTL_AUTH_MAGIC		DRM_IOW( 0x11, struct drm_auth)
1023718dceddSDavid Howells #define DRM_IOCTL_BLOCK			DRM_IOWR(0x12, struct drm_block)
1024718dceddSDavid Howells #define DRM_IOCTL_UNBLOCK		DRM_IOWR(0x13, struct drm_block)
1025718dceddSDavid Howells #define DRM_IOCTL_CONTROL		DRM_IOW( 0x14, struct drm_control)
1026718dceddSDavid Howells #define DRM_IOCTL_ADD_MAP		DRM_IOWR(0x15, struct drm_map)
1027718dceddSDavid Howells #define DRM_IOCTL_ADD_BUFS		DRM_IOWR(0x16, struct drm_buf_desc)
1028718dceddSDavid Howells #define DRM_IOCTL_MARK_BUFS		DRM_IOW( 0x17, struct drm_buf_desc)
1029718dceddSDavid Howells #define DRM_IOCTL_INFO_BUFS		DRM_IOWR(0x18, struct drm_buf_info)
1030718dceddSDavid Howells #define DRM_IOCTL_MAP_BUFS		DRM_IOWR(0x19, struct drm_buf_map)
1031718dceddSDavid Howells #define DRM_IOCTL_FREE_BUFS		DRM_IOW( 0x1a, struct drm_buf_free)
1032718dceddSDavid Howells 
1033718dceddSDavid Howells #define DRM_IOCTL_RM_MAP		DRM_IOW( 0x1b, struct drm_map)
1034718dceddSDavid Howells 
1035718dceddSDavid Howells #define DRM_IOCTL_SET_SAREA_CTX		DRM_IOW( 0x1c, struct drm_ctx_priv_map)
1036718dceddSDavid Howells #define DRM_IOCTL_GET_SAREA_CTX 	DRM_IOWR(0x1d, struct drm_ctx_priv_map)
1037718dceddSDavid Howells 
1038718dceddSDavid Howells #define DRM_IOCTL_SET_MASTER            DRM_IO(0x1e)
1039718dceddSDavid Howells #define DRM_IOCTL_DROP_MASTER           DRM_IO(0x1f)
1040718dceddSDavid Howells 
1041718dceddSDavid Howells #define DRM_IOCTL_ADD_CTX		DRM_IOWR(0x20, struct drm_ctx)
1042718dceddSDavid Howells #define DRM_IOCTL_RM_CTX		DRM_IOWR(0x21, struct drm_ctx)
1043718dceddSDavid Howells #define DRM_IOCTL_MOD_CTX		DRM_IOW( 0x22, struct drm_ctx)
1044718dceddSDavid Howells #define DRM_IOCTL_GET_CTX		DRM_IOWR(0x23, struct drm_ctx)
1045718dceddSDavid Howells #define DRM_IOCTL_SWITCH_CTX		DRM_IOW( 0x24, struct drm_ctx)
1046718dceddSDavid Howells #define DRM_IOCTL_NEW_CTX		DRM_IOW( 0x25, struct drm_ctx)
1047718dceddSDavid Howells #define DRM_IOCTL_RES_CTX		DRM_IOWR(0x26, struct drm_ctx_res)
1048718dceddSDavid Howells #define DRM_IOCTL_ADD_DRAW		DRM_IOWR(0x27, struct drm_draw)
1049718dceddSDavid Howells #define DRM_IOCTL_RM_DRAW		DRM_IOWR(0x28, struct drm_draw)
1050718dceddSDavid Howells #define DRM_IOCTL_DMA			DRM_IOWR(0x29, struct drm_dma)
1051718dceddSDavid Howells #define DRM_IOCTL_LOCK			DRM_IOW( 0x2a, struct drm_lock)
1052718dceddSDavid Howells #define DRM_IOCTL_UNLOCK		DRM_IOW( 0x2b, struct drm_lock)
1053718dceddSDavid Howells #define DRM_IOCTL_FINISH		DRM_IOW( 0x2c, struct drm_lock)
1054718dceddSDavid Howells 
105560687716SSimon Ser /**
105660687716SSimon Ser  * DRM_IOCTL_PRIME_HANDLE_TO_FD - Convert a GEM handle to a DMA-BUF FD.
105760687716SSimon Ser  *
105860687716SSimon Ser  * User-space sets &drm_prime_handle.handle with the GEM handle to export and
105960687716SSimon Ser  * &drm_prime_handle.flags, and gets back a DMA-BUF file descriptor in
106060687716SSimon Ser  * &drm_prime_handle.fd.
106160687716SSimon Ser  *
106260687716SSimon Ser  * The export can fail for any driver-specific reason, e.g. because export is
106360687716SSimon Ser  * not supported for this specific GEM handle (but might be for others).
106460687716SSimon Ser  *
106560687716SSimon Ser  * Support for exporting DMA-BUFs is advertised via &DRM_PRIME_CAP_EXPORT.
106660687716SSimon Ser  */
1067718dceddSDavid Howells #define DRM_IOCTL_PRIME_HANDLE_TO_FD    DRM_IOWR(0x2d, struct drm_prime_handle)
106860687716SSimon Ser /**
106960687716SSimon Ser  * DRM_IOCTL_PRIME_FD_TO_HANDLE - Convert a DMA-BUF FD to a GEM handle.
107060687716SSimon Ser  *
107160687716SSimon Ser  * User-space sets &drm_prime_handle.fd with a DMA-BUF file descriptor to
107260687716SSimon Ser  * import, and gets back a GEM handle in &drm_prime_handle.handle.
107360687716SSimon Ser  * &drm_prime_handle.flags is unused.
107460687716SSimon Ser  *
107560687716SSimon Ser  * If an existing GEM handle refers to the memory object backing the DMA-BUF,
107660687716SSimon Ser  * that GEM handle is returned. Therefore user-space which needs to handle
107760687716SSimon Ser  * arbitrary DMA-BUFs must have a user-space lookup data structure to manually
107860687716SSimon Ser  * reference-count duplicated GEM handles. For more information see
107960687716SSimon Ser  * &DRM_IOCTL_GEM_CLOSE.
108060687716SSimon Ser  *
108160687716SSimon Ser  * The import can fail for any driver-specific reason, e.g. because import is
108260687716SSimon Ser  * only supported for DMA-BUFs allocated on this DRM device.
108360687716SSimon Ser  *
108460687716SSimon Ser  * Support for importing DMA-BUFs is advertised via &DRM_PRIME_CAP_IMPORT.
108560687716SSimon Ser  */
1086718dceddSDavid Howells #define DRM_IOCTL_PRIME_FD_TO_HANDLE    DRM_IOWR(0x2e, struct drm_prime_handle)
1087718dceddSDavid Howells 
1088718dceddSDavid Howells #define DRM_IOCTL_AGP_ACQUIRE		DRM_IO(  0x30)
1089718dceddSDavid Howells #define DRM_IOCTL_AGP_RELEASE		DRM_IO(  0x31)
1090718dceddSDavid Howells #define DRM_IOCTL_AGP_ENABLE		DRM_IOW( 0x32, struct drm_agp_mode)
1091718dceddSDavid Howells #define DRM_IOCTL_AGP_INFO		DRM_IOR( 0x33, struct drm_agp_info)
1092718dceddSDavid Howells #define DRM_IOCTL_AGP_ALLOC		DRM_IOWR(0x34, struct drm_agp_buffer)
1093718dceddSDavid Howells #define DRM_IOCTL_AGP_FREE		DRM_IOW( 0x35, struct drm_agp_buffer)
1094718dceddSDavid Howells #define DRM_IOCTL_AGP_BIND		DRM_IOW( 0x36, struct drm_agp_binding)
1095718dceddSDavid Howells #define DRM_IOCTL_AGP_UNBIND		DRM_IOW( 0x37, struct drm_agp_binding)
1096718dceddSDavid Howells 
1097718dceddSDavid Howells #define DRM_IOCTL_SG_ALLOC		DRM_IOWR(0x38, struct drm_scatter_gather)
1098718dceddSDavid Howells #define DRM_IOCTL_SG_FREE		DRM_IOW( 0x39, struct drm_scatter_gather)
1099718dceddSDavid Howells 
1100718dceddSDavid Howells #define DRM_IOCTL_WAIT_VBLANK		DRM_IOWR(0x3a, union drm_wait_vblank)
1101718dceddSDavid Howells 
11023064abfaSKeith Packard #define DRM_IOCTL_CRTC_GET_SEQUENCE	DRM_IOWR(0x3b, struct drm_crtc_get_sequence)
11033064abfaSKeith Packard #define DRM_IOCTL_CRTC_QUEUE_SEQUENCE	DRM_IOWR(0x3c, struct drm_crtc_queue_sequence)
11043064abfaSKeith Packard 
1105718dceddSDavid Howells #define DRM_IOCTL_UPDATE_DRAW		DRM_IOW(0x3f, struct drm_update_draw)
1106718dceddSDavid Howells 
1107718dceddSDavid Howells #define DRM_IOCTL_MODE_GETRESOURCES	DRM_IOWR(0xA0, struct drm_mode_card_res)
1108718dceddSDavid Howells #define DRM_IOCTL_MODE_GETCRTC		DRM_IOWR(0xA1, struct drm_mode_crtc)
1109718dceddSDavid Howells #define DRM_IOCTL_MODE_SETCRTC		DRM_IOWR(0xA2, struct drm_mode_crtc)
1110718dceddSDavid Howells #define DRM_IOCTL_MODE_CURSOR		DRM_IOWR(0xA3, struct drm_mode_cursor)
1111718dceddSDavid Howells #define DRM_IOCTL_MODE_GETGAMMA		DRM_IOWR(0xA4, struct drm_mode_crtc_lut)
1112718dceddSDavid Howells #define DRM_IOCTL_MODE_SETGAMMA		DRM_IOWR(0xA5, struct drm_mode_crtc_lut)
1113718dceddSDavid Howells #define DRM_IOCTL_MODE_GETENCODER	DRM_IOWR(0xA6, struct drm_mode_get_encoder)
1114718dceddSDavid Howells #define DRM_IOCTL_MODE_GETCONNECTOR	DRM_IOWR(0xA7, struct drm_mode_get_connector)
1115c55b6b3dSVille Syrjälä #define DRM_IOCTL_MODE_ATTACHMODE	DRM_IOWR(0xA8, struct drm_mode_mode_cmd) /* deprecated (never worked) */
1116c55b6b3dSVille Syrjälä #define DRM_IOCTL_MODE_DETACHMODE	DRM_IOWR(0xA9, struct drm_mode_mode_cmd) /* deprecated (never worked) */
1117718dceddSDavid Howells 
1118718dceddSDavid Howells #define DRM_IOCTL_MODE_GETPROPERTY	DRM_IOWR(0xAA, struct drm_mode_get_property)
1119718dceddSDavid Howells #define DRM_IOCTL_MODE_SETPROPERTY	DRM_IOWR(0xAB, struct drm_mode_connector_set_property)
1120718dceddSDavid Howells #define DRM_IOCTL_MODE_GETPROPBLOB	DRM_IOWR(0xAC, struct drm_mode_get_blob)
1121718dceddSDavid Howells #define DRM_IOCTL_MODE_GETFB		DRM_IOWR(0xAD, struct drm_mode_fb_cmd)
1122718dceddSDavid Howells #define DRM_IOCTL_MODE_ADDFB		DRM_IOWR(0xAE, struct drm_mode_fb_cmd)
112317ce9c61SSimon Ser /**
112417ce9c61SSimon Ser  * DRM_IOCTL_MODE_RMFB - Remove a framebuffer.
112517ce9c61SSimon Ser  *
112617ce9c61SSimon Ser  * This removes a framebuffer previously added via ADDFB/ADDFB2. The IOCTL
112717ce9c61SSimon Ser  * argument is a framebuffer object ID.
112817ce9c61SSimon Ser  *
112917ce9c61SSimon Ser  * Warning: removing a framebuffer currently in-use on an enabled plane will
113017ce9c61SSimon Ser  * disable that plane. The CRTC the plane is linked to may also be disabled
113117ce9c61SSimon Ser  * (depending on driver capabilities).
113217ce9c61SSimon Ser  */
1133718dceddSDavid Howells #define DRM_IOCTL_MODE_RMFB		DRM_IOWR(0xAF, unsigned int)
1134718dceddSDavid Howells #define DRM_IOCTL_MODE_PAGE_FLIP	DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip)
1135718dceddSDavid Howells #define DRM_IOCTL_MODE_DIRTYFB		DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd)
1136718dceddSDavid Howells 
1137718dceddSDavid Howells #define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb)
1138718dceddSDavid Howells #define DRM_IOCTL_MODE_MAP_DUMB    DRM_IOWR(0xB3, struct drm_mode_map_dumb)
1139718dceddSDavid Howells #define DRM_IOCTL_MODE_DESTROY_DUMB    DRM_IOWR(0xB4, struct drm_mode_destroy_dumb)
1140718dceddSDavid Howells #define DRM_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xB5, struct drm_mode_get_plane_res)
1141718dceddSDavid Howells #define DRM_IOCTL_MODE_GETPLANE	DRM_IOWR(0xB6, struct drm_mode_get_plane)
1142718dceddSDavid Howells #define DRM_IOCTL_MODE_SETPLANE	DRM_IOWR(0xB7, struct drm_mode_set_plane)
1143718dceddSDavid Howells #define DRM_IOCTL_MODE_ADDFB2		DRM_IOWR(0xB8, struct drm_mode_fb_cmd2)
1144718dceddSDavid Howells #define DRM_IOCTL_MODE_OBJ_GETPROPERTIES	DRM_IOWR(0xB9, struct drm_mode_obj_get_properties)
1145718dceddSDavid Howells #define DRM_IOCTL_MODE_OBJ_SETPROPERTY	DRM_IOWR(0xBA, struct drm_mode_obj_set_property)
11464c813d4dSDave Airlie #define DRM_IOCTL_MODE_CURSOR2		DRM_IOWR(0xBB, struct drm_mode_cursor2)
1147d34f20d6SRob Clark #define DRM_IOCTL_MODE_ATOMIC		DRM_IOWR(0xBC, struct drm_mode_atomic)
1148e2f5d2eaSDaniel Stone #define DRM_IOCTL_MODE_CREATEPROPBLOB	DRM_IOWR(0xBD, struct drm_mode_create_blob)
1149e2f5d2eaSDaniel Stone #define DRM_IOCTL_MODE_DESTROYPROPBLOB	DRM_IOWR(0xBE, struct drm_mode_destroy_blob)
1150718dceddSDavid Howells 
1151e9083420SDave Airlie #define DRM_IOCTL_SYNCOBJ_CREATE	DRM_IOWR(0xBF, struct drm_syncobj_create)
1152e9083420SDave Airlie #define DRM_IOCTL_SYNCOBJ_DESTROY	DRM_IOWR(0xC0, struct drm_syncobj_destroy)
1153e9083420SDave Airlie #define DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD	DRM_IOWR(0xC1, struct drm_syncobj_handle)
1154e9083420SDave Airlie #define DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE	DRM_IOWR(0xC2, struct drm_syncobj_handle)
11555e60a10eSDave Airlie #define DRM_IOCTL_SYNCOBJ_WAIT		DRM_IOWR(0xC3, struct drm_syncobj_wait)
1156aa4035d2SJason Ekstrand #define DRM_IOCTL_SYNCOBJ_RESET		DRM_IOWR(0xC4, struct drm_syncobj_array)
1157ffa9443fSJason Ekstrand #define DRM_IOCTL_SYNCOBJ_SIGNAL	DRM_IOWR(0xC5, struct drm_syncobj_array)
1158e9083420SDave Airlie 
115962884cd3SKeith Packard #define DRM_IOCTL_MODE_CREATE_LEASE	DRM_IOWR(0xC6, struct drm_mode_create_lease)
116062884cd3SKeith Packard #define DRM_IOCTL_MODE_LIST_LESSEES	DRM_IOWR(0xC7, struct drm_mode_list_lessees)
116162884cd3SKeith Packard #define DRM_IOCTL_MODE_GET_LEASE	DRM_IOWR(0xC8, struct drm_mode_get_lease)
116262884cd3SKeith Packard #define DRM_IOCTL_MODE_REVOKE_LEASE	DRM_IOWR(0xC9, struct drm_mode_revoke_lease)
116362884cd3SKeith Packard 
116401d6c357SChunming Zhou #define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT	DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait)
116527b575a9SChunming Zhou #define DRM_IOCTL_SYNCOBJ_QUERY		DRM_IOWR(0xCB, struct drm_syncobj_timeline_array)
1166ea569910SChunming Zhou #define DRM_IOCTL_SYNCOBJ_TRANSFER	DRM_IOWR(0xCC, struct drm_syncobj_transfer)
116750d1ebefSChunming Zhou #define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL	DRM_IOWR(0xCD, struct drm_syncobj_timeline_array)
116827b575a9SChunming Zhou 
116943d5ac7dSSimon Ser /**
117043d5ac7dSSimon Ser  * DRM_IOCTL_MODE_GETFB2 - Get framebuffer metadata.
117143d5ac7dSSimon Ser  *
117243d5ac7dSSimon Ser  * This queries metadata about a framebuffer. User-space fills
117343d5ac7dSSimon Ser  * &drm_mode_fb_cmd2.fb_id as the input, and the kernels fills the rest of the
117443d5ac7dSSimon Ser  * struct as the output.
117543d5ac7dSSimon Ser  *
117643d5ac7dSSimon Ser  * If the client is DRM master or has &CAP_SYS_ADMIN, &drm_mode_fb_cmd2.handles
117761a55f8bSSimon Ser  * will be filled with GEM buffer handles. Fresh new GEM handles are always
117861a55f8bSSimon Ser  * returned, even if another GEM handle referring to the same memory object
117961a55f8bSSimon Ser  * already exists on the DRM file description. The caller is responsible for
118061a55f8bSSimon Ser  * removing the new handles, e.g. via the &DRM_IOCTL_GEM_CLOSE IOCTL. The same
118161a55f8bSSimon Ser  * new handle will be returned for multiple planes in case they use the same
118261a55f8bSSimon Ser  * memory object. Planes are valid until one has a zero handle -- this can be
118361a55f8bSSimon Ser  * used to compute the number of planes.
118443d5ac7dSSimon Ser  *
118543d5ac7dSSimon Ser  * Otherwise, &drm_mode_fb_cmd2.handles will be zeroed and planes are valid
118643d5ac7dSSimon Ser  * until one has a zero &drm_mode_fb_cmd2.pitches.
118743d5ac7dSSimon Ser  *
118843d5ac7dSSimon Ser  * If the framebuffer has a format modifier, &DRM_MODE_FB_MODIFIERS will be set
118943d5ac7dSSimon Ser  * in &drm_mode_fb_cmd2.flags and &drm_mode_fb_cmd2.modifier will contain the
119043d5ac7dSSimon Ser  * modifier. Otherwise, user-space must ignore &drm_mode_fb_cmd2.modifier.
119161a55f8bSSimon Ser  *
119261a55f8bSSimon Ser  * To obtain DMA-BUF FDs for each plane without leaking GEM handles, user-space
119361a55f8bSSimon Ser  * can export each handle via &DRM_IOCTL_PRIME_HANDLE_TO_FD, then immediately
119461a55f8bSSimon Ser  * close each unique handle via &DRM_IOCTL_GEM_CLOSE, making sure to not
119561a55f8bSSimon Ser  * double-close handles which are specified multiple times in the array.
119643d5ac7dSSimon Ser  */
1197455e00f1SDaniel Stone #define DRM_IOCTL_MODE_GETFB2		DRM_IOWR(0xCE, struct drm_mode_fb_cmd2)
1198455e00f1SDaniel Stone 
1199c7a47229SSimon Ser #define DRM_IOCTL_SYNCOBJ_EVENTFD	DRM_IOWR(0xCF, struct drm_syncobj_eventfd)
1200c7a47229SSimon Ser 
12010e0dc448SSimon Ser /*
1202718dceddSDavid Howells  * Device specific ioctls should only be in their respective headers
1203735b9ffaSDamien Lespiau  * The device specific ioctl range is from 0x40 to 0x9f.
1204718dceddSDavid Howells  * Generic IOCTLS restart at 0xA0.
1205718dceddSDavid Howells  *
1206718dceddSDavid Howells  * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and
1207718dceddSDavid Howells  * drmCommandReadWrite().
1208718dceddSDavid Howells  */
1209718dceddSDavid Howells #define DRM_COMMAND_BASE                0x40
1210718dceddSDavid Howells #define DRM_COMMAND_END			0xA0
1211718dceddSDavid Howells 
12122ff4f6d4SSimon Ser /**
12132ff4f6d4SSimon Ser  * struct drm_event - Header for DRM events
12142ff4f6d4SSimon Ser  * @type: event type.
12152ff4f6d4SSimon Ser  * @length: total number of payload bytes (including header).
1216718dceddSDavid Howells  *
12172ff4f6d4SSimon Ser  * This struct is a header for events written back to user-space on the DRM FD.
12182ff4f6d4SSimon Ser  * A read on the DRM FD will always only return complete events: e.g. if the
12192ff4f6d4SSimon Ser  * read buffer is 100 bytes large and there are two 64 byte events pending,
12202ff4f6d4SSimon Ser  * only one will be returned.
12212ff4f6d4SSimon Ser  *
12222ff4f6d4SSimon Ser  * Event types 0 - 0x7fffffff are generic DRM events, 0x80000000 and
12232ff4f6d4SSimon Ser  * up are chipset specific. Generic DRM events include &DRM_EVENT_VBLANK,
12242ff4f6d4SSimon Ser  * &DRM_EVENT_FLIP_COMPLETE and &DRM_EVENT_CRTC_SEQUENCE.
1225718dceddSDavid Howells  */
1226718dceddSDavid Howells struct drm_event {
1227718dceddSDavid Howells 	__u32 type;
1228718dceddSDavid Howells 	__u32 length;
1229718dceddSDavid Howells };
1230718dceddSDavid Howells 
12312ff4f6d4SSimon Ser /**
12322ff4f6d4SSimon Ser  * DRM_EVENT_VBLANK - vertical blanking event
12332ff4f6d4SSimon Ser  *
12342ff4f6d4SSimon Ser  * This event is sent in response to &DRM_IOCTL_WAIT_VBLANK with the
12352ff4f6d4SSimon Ser  * &_DRM_VBLANK_EVENT flag set.
12362ff4f6d4SSimon Ser  *
12372ff4f6d4SSimon Ser  * The event payload is a struct drm_event_vblank.
12382ff4f6d4SSimon Ser  */
1239718dceddSDavid Howells #define DRM_EVENT_VBLANK 0x01
12402ff4f6d4SSimon Ser /**
12412ff4f6d4SSimon Ser  * DRM_EVENT_FLIP_COMPLETE - page-flip completion event
12422ff4f6d4SSimon Ser  *
12432ff4f6d4SSimon Ser  * This event is sent in response to an atomic commit or legacy page-flip with
12442ff4f6d4SSimon Ser  * the &DRM_MODE_PAGE_FLIP_EVENT flag set.
12452ff4f6d4SSimon Ser  *
12462ff4f6d4SSimon Ser  * The event payload is a struct drm_event_vblank.
12472ff4f6d4SSimon Ser  */
1248718dceddSDavid Howells #define DRM_EVENT_FLIP_COMPLETE 0x02
12492ff4f6d4SSimon Ser /**
12502ff4f6d4SSimon Ser  * DRM_EVENT_CRTC_SEQUENCE - CRTC sequence event
12512ff4f6d4SSimon Ser  *
12522ff4f6d4SSimon Ser  * This event is sent in response to &DRM_IOCTL_CRTC_QUEUE_SEQUENCE.
12532ff4f6d4SSimon Ser  *
12542ff4f6d4SSimon Ser  * The event payload is a struct drm_event_crtc_sequence.
12552ff4f6d4SSimon Ser  */
12563064abfaSKeith Packard #define DRM_EVENT_CRTC_SEQUENCE	0x03
1257718dceddSDavid Howells 
1258718dceddSDavid Howells struct drm_event_vblank {
1259718dceddSDavid Howells 	struct drm_event base;
1260718dceddSDavid Howells 	__u64 user_data;
1261718dceddSDavid Howells 	__u32 tv_sec;
1262718dceddSDavid Howells 	__u32 tv_usec;
1263718dceddSDavid Howells 	__u32 sequence;
12645db06a8aSAnder Conselvan de Oliveira 	__u32 crtc_id; /* 0 on older kernels that do not support this */
1265718dceddSDavid Howells };
1266718dceddSDavid Howells 
12673064abfaSKeith Packard /* Event delivered at sequence. Time stamp marks when the first pixel
12683064abfaSKeith Packard  * of the refresh cycle leaves the display engine for the display
12693064abfaSKeith Packard  */
12703064abfaSKeith Packard struct drm_event_crtc_sequence {
12713064abfaSKeith Packard 	struct drm_event	base;
12723064abfaSKeith Packard 	__u64			user_data;
12733064abfaSKeith Packard 	__s64			time_ns;
12743064abfaSKeith Packard 	__u64			sequence;
12753064abfaSKeith Packard };
12763064abfaSKeith Packard 
1277718dceddSDavid Howells /* typedef area */
1278718dceddSDavid Howells #ifndef __KERNEL__
1279718dceddSDavid Howells typedef struct drm_clip_rect drm_clip_rect_t;
1280718dceddSDavid Howells typedef struct drm_drawable_info drm_drawable_info_t;
1281718dceddSDavid Howells typedef struct drm_tex_region drm_tex_region_t;
1282718dceddSDavid Howells typedef struct drm_hw_lock drm_hw_lock_t;
1283718dceddSDavid Howells typedef struct drm_version drm_version_t;
1284718dceddSDavid Howells typedef struct drm_unique drm_unique_t;
1285718dceddSDavid Howells typedef struct drm_list drm_list_t;
1286718dceddSDavid Howells typedef struct drm_block drm_block_t;
1287718dceddSDavid Howells typedef struct drm_control drm_control_t;
1288718dceddSDavid Howells typedef enum drm_map_type drm_map_type_t;
1289718dceddSDavid Howells typedef enum drm_map_flags drm_map_flags_t;
1290718dceddSDavid Howells typedef struct drm_ctx_priv_map drm_ctx_priv_map_t;
1291718dceddSDavid Howells typedef struct drm_map drm_map_t;
1292718dceddSDavid Howells typedef struct drm_client drm_client_t;
1293718dceddSDavid Howells typedef enum drm_stat_type drm_stat_type_t;
1294718dceddSDavid Howells typedef struct drm_stats drm_stats_t;
1295718dceddSDavid Howells typedef enum drm_lock_flags drm_lock_flags_t;
1296718dceddSDavid Howells typedef struct drm_lock drm_lock_t;
1297718dceddSDavid Howells typedef enum drm_dma_flags drm_dma_flags_t;
1298718dceddSDavid Howells typedef struct drm_buf_desc drm_buf_desc_t;
1299718dceddSDavid Howells typedef struct drm_buf_info drm_buf_info_t;
1300718dceddSDavid Howells typedef struct drm_buf_free drm_buf_free_t;
1301718dceddSDavid Howells typedef struct drm_buf_pub drm_buf_pub_t;
1302718dceddSDavid Howells typedef struct drm_buf_map drm_buf_map_t;
1303718dceddSDavid Howells typedef struct drm_dma drm_dma_t;
1304718dceddSDavid Howells typedef union drm_wait_vblank drm_wait_vblank_t;
1305718dceddSDavid Howells typedef struct drm_agp_mode drm_agp_mode_t;
1306718dceddSDavid Howells typedef enum drm_ctx_flags drm_ctx_flags_t;
1307718dceddSDavid Howells typedef struct drm_ctx drm_ctx_t;
1308718dceddSDavid Howells typedef struct drm_ctx_res drm_ctx_res_t;
1309718dceddSDavid Howells typedef struct drm_draw drm_draw_t;
1310718dceddSDavid Howells typedef struct drm_update_draw drm_update_draw_t;
1311718dceddSDavid Howells typedef struct drm_auth drm_auth_t;
1312718dceddSDavid Howells typedef struct drm_irq_busid drm_irq_busid_t;
1313718dceddSDavid Howells typedef enum drm_vblank_seq_type drm_vblank_seq_type_t;
1314718dceddSDavid Howells 
1315718dceddSDavid Howells typedef struct drm_agp_buffer drm_agp_buffer_t;
1316718dceddSDavid Howells typedef struct drm_agp_binding drm_agp_binding_t;
1317718dceddSDavid Howells typedef struct drm_agp_info drm_agp_info_t;
1318718dceddSDavid Howells typedef struct drm_scatter_gather drm_scatter_gather_t;
1319718dceddSDavid Howells typedef struct drm_set_version drm_set_version_t;
1320718dceddSDavid Howells #endif
1321718dceddSDavid Howells 
1322ebbb0e5cSEmil Velikov #if defined(__cplusplus)
1323ebbb0e5cSEmil Velikov }
1324ebbb0e5cSEmil Velikov #endif
1325ebbb0e5cSEmil Velikov 
1326718dceddSDavid Howells #endif
1327