xref: /openbmc/linux/include/uapi/drm/i915_drm.h (revision 648a9bc5)
1718dceddSDavid Howells /*
2718dceddSDavid Howells  * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
3718dceddSDavid Howells  * All Rights Reserved.
4718dceddSDavid Howells  *
5718dceddSDavid Howells  * Permission is hereby granted, free of charge, to any person obtaining a
6718dceddSDavid Howells  * copy of this software and associated documentation files (the
7718dceddSDavid Howells  * "Software"), to deal in the Software without restriction, including
8718dceddSDavid Howells  * without limitation the rights to use, copy, modify, merge, publish,
9718dceddSDavid Howells  * distribute, sub license, and/or sell copies of the Software, and to
10718dceddSDavid Howells  * permit persons to whom the Software is furnished to do so, subject to
11718dceddSDavid Howells  * the following conditions:
12718dceddSDavid Howells  *
13718dceddSDavid Howells  * The above copyright notice and this permission notice (including the
14718dceddSDavid Howells  * next paragraph) shall be included in all copies or substantial portions
15718dceddSDavid Howells  * of the Software.
16718dceddSDavid Howells  *
17718dceddSDavid Howells  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18718dceddSDavid Howells  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19718dceddSDavid Howells  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20718dceddSDavid Howells  * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
21718dceddSDavid Howells  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22718dceddSDavid Howells  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23718dceddSDavid Howells  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24718dceddSDavid Howells  *
25718dceddSDavid Howells  */
26718dceddSDavid Howells 
27718dceddSDavid Howells #ifndef _UAPI_I915_DRM_H_
28718dceddSDavid Howells #define _UAPI_I915_DRM_H_
29718dceddSDavid Howells 
30718dceddSDavid Howells #include <drm/drm.h>
31718dceddSDavid Howells 
32718dceddSDavid Howells /* Please note that modifications to all structs defined here are
33718dceddSDavid Howells  * subject to backwards-compatibility constraints.
34718dceddSDavid Howells  */
35718dceddSDavid Howells 
36cce723edSBen Widawsky /**
37cce723edSBen Widawsky  * DOC: uevents generated by i915 on it's device node
38cce723edSBen Widawsky  *
39cce723edSBen Widawsky  * I915_L3_PARITY_UEVENT - Generated when the driver receives a parity mismatch
40cce723edSBen Widawsky  *	event from the gpu l3 cache. Additional information supplied is ROW,
4135a85ac6SBen Widawsky  *	BANK, SUBBANK, SLICE of the affected cacheline. Userspace should keep
4235a85ac6SBen Widawsky  *	track of these events and if a specific cache-line seems to have a
4335a85ac6SBen Widawsky  *	persistent error remap it with the l3 remapping tool supplied in
4435a85ac6SBen Widawsky  *	intel-gpu-tools.  The value supplied with the event is always 1.
45cce723edSBen Widawsky  *
46cce723edSBen Widawsky  * I915_ERROR_UEVENT - Generated upon error detection, currently only via
47cce723edSBen Widawsky  *	hangcheck. The error detection event is a good indicator of when things
48cce723edSBen Widawsky  *	began to go badly. The value supplied with the event is a 1 upon error
49cce723edSBen Widawsky  *	detection, and a 0 upon reset completion, signifying no more error
50cce723edSBen Widawsky  *	exists. NOTE: Disabling hangcheck or reset via module parameter will
51cce723edSBen Widawsky  *	cause the related events to not be seen.
52cce723edSBen Widawsky  *
53cce723edSBen Widawsky  * I915_RESET_UEVENT - Event is generated just before an attempt to reset the
54cce723edSBen Widawsky  *	the GPU. The value supplied with the event is always 1. NOTE: Disable
55cce723edSBen Widawsky  *	reset via module parameter will cause this event to not be seen.
56cce723edSBen Widawsky  */
57cce723edSBen Widawsky #define I915_L3_PARITY_UEVENT		"L3_PARITY_ERROR"
58cce723edSBen Widawsky #define I915_ERROR_UEVENT		"ERROR"
59cce723edSBen Widawsky #define I915_RESET_UEVENT		"RESET"
60718dceddSDavid Howells 
61718dceddSDavid Howells /* Each region is a minimum of 16k, and there are at most 255 of them.
62718dceddSDavid Howells  */
63718dceddSDavid Howells #define I915_NR_TEX_REGIONS 255	/* table size 2k - maximum due to use
64718dceddSDavid Howells 				 * of chars for next/prev indices */
65718dceddSDavid Howells #define I915_LOG_MIN_TEX_REGION_SIZE 14
66718dceddSDavid Howells 
67718dceddSDavid Howells typedef struct _drm_i915_init {
68718dceddSDavid Howells 	enum {
69718dceddSDavid Howells 		I915_INIT_DMA = 0x01,
70718dceddSDavid Howells 		I915_CLEANUP_DMA = 0x02,
71718dceddSDavid Howells 		I915_RESUME_DMA = 0x03
72718dceddSDavid Howells 	} func;
73718dceddSDavid Howells 	unsigned int mmio_offset;
74718dceddSDavid Howells 	int sarea_priv_offset;
75718dceddSDavid Howells 	unsigned int ring_start;
76718dceddSDavid Howells 	unsigned int ring_end;
77718dceddSDavid Howells 	unsigned int ring_size;
78718dceddSDavid Howells 	unsigned int front_offset;
79718dceddSDavid Howells 	unsigned int back_offset;
80718dceddSDavid Howells 	unsigned int depth_offset;
81718dceddSDavid Howells 	unsigned int w;
82718dceddSDavid Howells 	unsigned int h;
83718dceddSDavid Howells 	unsigned int pitch;
84718dceddSDavid Howells 	unsigned int pitch_bits;
85718dceddSDavid Howells 	unsigned int back_pitch;
86718dceddSDavid Howells 	unsigned int depth_pitch;
87718dceddSDavid Howells 	unsigned int cpp;
88718dceddSDavid Howells 	unsigned int chipset;
89718dceddSDavid Howells } drm_i915_init_t;
90718dceddSDavid Howells 
91718dceddSDavid Howells typedef struct _drm_i915_sarea {
92718dceddSDavid Howells 	struct drm_tex_region texList[I915_NR_TEX_REGIONS + 1];
93718dceddSDavid Howells 	int last_upload;	/* last time texture was uploaded */
94718dceddSDavid Howells 	int last_enqueue;	/* last time a buffer was enqueued */
95718dceddSDavid Howells 	int last_dispatch;	/* age of the most recently dispatched buffer */
96718dceddSDavid Howells 	int ctxOwner;		/* last context to upload state */
97718dceddSDavid Howells 	int texAge;
98718dceddSDavid Howells 	int pf_enabled;		/* is pageflipping allowed? */
99718dceddSDavid Howells 	int pf_active;
100718dceddSDavid Howells 	int pf_current_page;	/* which buffer is being displayed? */
101718dceddSDavid Howells 	int perf_boxes;		/* performance boxes to be displayed */
102718dceddSDavid Howells 	int width, height;      /* screen size in pixels */
103718dceddSDavid Howells 
104718dceddSDavid Howells 	drm_handle_t front_handle;
105718dceddSDavid Howells 	int front_offset;
106718dceddSDavid Howells 	int front_size;
107718dceddSDavid Howells 
108718dceddSDavid Howells 	drm_handle_t back_handle;
109718dceddSDavid Howells 	int back_offset;
110718dceddSDavid Howells 	int back_size;
111718dceddSDavid Howells 
112718dceddSDavid Howells 	drm_handle_t depth_handle;
113718dceddSDavid Howells 	int depth_offset;
114718dceddSDavid Howells 	int depth_size;
115718dceddSDavid Howells 
116718dceddSDavid Howells 	drm_handle_t tex_handle;
117718dceddSDavid Howells 	int tex_offset;
118718dceddSDavid Howells 	int tex_size;
119718dceddSDavid Howells 	int log_tex_granularity;
120718dceddSDavid Howells 	int pitch;
121718dceddSDavid Howells 	int rotation;           /* 0, 90, 180 or 270 */
122718dceddSDavid Howells 	int rotated_offset;
123718dceddSDavid Howells 	int rotated_size;
124718dceddSDavid Howells 	int rotated_pitch;
125718dceddSDavid Howells 	int virtualX, virtualY;
126718dceddSDavid Howells 
127718dceddSDavid Howells 	unsigned int front_tiled;
128718dceddSDavid Howells 	unsigned int back_tiled;
129718dceddSDavid Howells 	unsigned int depth_tiled;
130718dceddSDavid Howells 	unsigned int rotated_tiled;
131718dceddSDavid Howells 	unsigned int rotated2_tiled;
132718dceddSDavid Howells 
133718dceddSDavid Howells 	int pipeA_x;
134718dceddSDavid Howells 	int pipeA_y;
135718dceddSDavid Howells 	int pipeA_w;
136718dceddSDavid Howells 	int pipeA_h;
137718dceddSDavid Howells 	int pipeB_x;
138718dceddSDavid Howells 	int pipeB_y;
139718dceddSDavid Howells 	int pipeB_w;
140718dceddSDavid Howells 	int pipeB_h;
141718dceddSDavid Howells 
142718dceddSDavid Howells 	/* fill out some space for old userspace triple buffer */
143718dceddSDavid Howells 	drm_handle_t unused_handle;
144718dceddSDavid Howells 	__u32 unused1, unused2, unused3;
145718dceddSDavid Howells 
146718dceddSDavid Howells 	/* buffer object handles for static buffers. May change
147718dceddSDavid Howells 	 * over the lifetime of the client.
148718dceddSDavid Howells 	 */
149718dceddSDavid Howells 	__u32 front_bo_handle;
150718dceddSDavid Howells 	__u32 back_bo_handle;
151718dceddSDavid Howells 	__u32 unused_bo_handle;
152718dceddSDavid Howells 	__u32 depth_bo_handle;
153718dceddSDavid Howells 
154718dceddSDavid Howells } drm_i915_sarea_t;
155718dceddSDavid Howells 
156718dceddSDavid Howells /* due to userspace building against these headers we need some compat here */
157718dceddSDavid Howells #define planeA_x pipeA_x
158718dceddSDavid Howells #define planeA_y pipeA_y
159718dceddSDavid Howells #define planeA_w pipeA_w
160718dceddSDavid Howells #define planeA_h pipeA_h
161718dceddSDavid Howells #define planeB_x pipeB_x
162718dceddSDavid Howells #define planeB_y pipeB_y
163718dceddSDavid Howells #define planeB_w pipeB_w
164718dceddSDavid Howells #define planeB_h pipeB_h
165718dceddSDavid Howells 
166718dceddSDavid Howells /* Flags for perf_boxes
167718dceddSDavid Howells  */
168718dceddSDavid Howells #define I915_BOX_RING_EMPTY    0x1
169718dceddSDavid Howells #define I915_BOX_FLIP          0x2
170718dceddSDavid Howells #define I915_BOX_WAIT          0x4
171718dceddSDavid Howells #define I915_BOX_TEXTURE_LOAD  0x8
172718dceddSDavid Howells #define I915_BOX_LOST_CONTEXT  0x10
173718dceddSDavid Howells 
17421631f10SDamien Lespiau /*
17521631f10SDamien Lespiau  * i915 specific ioctls.
17621631f10SDamien Lespiau  *
17721631f10SDamien Lespiau  * The device specific ioctl range is [DRM_COMMAND_BASE, DRM_COMMAND_END) ie
17821631f10SDamien Lespiau  * [0x40, 0xa0) (a0 is excluded). The numbers below are defined as offset
17921631f10SDamien Lespiau  * against DRM_COMMAND_BASE and should be between [0x0, 0x60).
180718dceddSDavid Howells  */
181718dceddSDavid Howells #define DRM_I915_INIT		0x00
182718dceddSDavid Howells #define DRM_I915_FLUSH		0x01
183718dceddSDavid Howells #define DRM_I915_FLIP		0x02
184718dceddSDavid Howells #define DRM_I915_BATCHBUFFER	0x03
185718dceddSDavid Howells #define DRM_I915_IRQ_EMIT	0x04
186718dceddSDavid Howells #define DRM_I915_IRQ_WAIT	0x05
187718dceddSDavid Howells #define DRM_I915_GETPARAM	0x06
188718dceddSDavid Howells #define DRM_I915_SETPARAM	0x07
189718dceddSDavid Howells #define DRM_I915_ALLOC		0x08
190718dceddSDavid Howells #define DRM_I915_FREE		0x09
191718dceddSDavid Howells #define DRM_I915_INIT_HEAP	0x0a
192718dceddSDavid Howells #define DRM_I915_CMDBUFFER	0x0b
193718dceddSDavid Howells #define DRM_I915_DESTROY_HEAP	0x0c
194718dceddSDavid Howells #define DRM_I915_SET_VBLANK_PIPE	0x0d
195718dceddSDavid Howells #define DRM_I915_GET_VBLANK_PIPE	0x0e
196718dceddSDavid Howells #define DRM_I915_VBLANK_SWAP	0x0f
197718dceddSDavid Howells #define DRM_I915_HWS_ADDR	0x11
198718dceddSDavid Howells #define DRM_I915_GEM_INIT	0x13
199718dceddSDavid Howells #define DRM_I915_GEM_EXECBUFFER	0x14
200718dceddSDavid Howells #define DRM_I915_GEM_PIN	0x15
201718dceddSDavid Howells #define DRM_I915_GEM_UNPIN	0x16
202718dceddSDavid Howells #define DRM_I915_GEM_BUSY	0x17
203718dceddSDavid Howells #define DRM_I915_GEM_THROTTLE	0x18
204718dceddSDavid Howells #define DRM_I915_GEM_ENTERVT	0x19
205718dceddSDavid Howells #define DRM_I915_GEM_LEAVEVT	0x1a
206718dceddSDavid Howells #define DRM_I915_GEM_CREATE	0x1b
207718dceddSDavid Howells #define DRM_I915_GEM_PREAD	0x1c
208718dceddSDavid Howells #define DRM_I915_GEM_PWRITE	0x1d
209718dceddSDavid Howells #define DRM_I915_GEM_MMAP	0x1e
210718dceddSDavid Howells #define DRM_I915_GEM_SET_DOMAIN	0x1f
211718dceddSDavid Howells #define DRM_I915_GEM_SW_FINISH	0x20
212718dceddSDavid Howells #define DRM_I915_GEM_SET_TILING	0x21
213718dceddSDavid Howells #define DRM_I915_GEM_GET_TILING	0x22
214718dceddSDavid Howells #define DRM_I915_GEM_GET_APERTURE 0x23
215718dceddSDavid Howells #define DRM_I915_GEM_MMAP_GTT	0x24
216718dceddSDavid Howells #define DRM_I915_GET_PIPE_FROM_CRTC_ID	0x25
217718dceddSDavid Howells #define DRM_I915_GEM_MADVISE	0x26
218718dceddSDavid Howells #define DRM_I915_OVERLAY_PUT_IMAGE	0x27
219718dceddSDavid Howells #define DRM_I915_OVERLAY_ATTRS	0x28
220718dceddSDavid Howells #define DRM_I915_GEM_EXECBUFFER2	0x29
221718dceddSDavid Howells #define DRM_I915_GET_SPRITE_COLORKEY	0x2a
222718dceddSDavid Howells #define DRM_I915_SET_SPRITE_COLORKEY	0x2b
223718dceddSDavid Howells #define DRM_I915_GEM_WAIT	0x2c
224718dceddSDavid Howells #define DRM_I915_GEM_CONTEXT_CREATE	0x2d
225718dceddSDavid Howells #define DRM_I915_GEM_CONTEXT_DESTROY	0x2e
226718dceddSDavid Howells #define DRM_I915_GEM_SET_CACHING	0x2f
227718dceddSDavid Howells #define DRM_I915_GEM_GET_CACHING	0x30
228718dceddSDavid Howells #define DRM_I915_REG_READ		0x31
229b6359918SMika Kuoppala #define DRM_I915_GET_RESET_STATS	0x32
2305cc9ed4bSChris Wilson #define DRM_I915_GEM_USERPTR		0x33
231c9dc0f35SChris Wilson #define DRM_I915_GEM_CONTEXT_GETPARAM	0x34
232c9dc0f35SChris Wilson #define DRM_I915_GEM_CONTEXT_SETPARAM	0x35
233718dceddSDavid Howells 
234718dceddSDavid Howells #define DRM_IOCTL_I915_INIT		DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
235718dceddSDavid Howells #define DRM_IOCTL_I915_FLUSH		DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
236718dceddSDavid Howells #define DRM_IOCTL_I915_FLIP		DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLIP)
237718dceddSDavid Howells #define DRM_IOCTL_I915_BATCHBUFFER	DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t)
238718dceddSDavid Howells #define DRM_IOCTL_I915_IRQ_EMIT         DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t)
239718dceddSDavid Howells #define DRM_IOCTL_I915_IRQ_WAIT         DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t)
240718dceddSDavid Howells #define DRM_IOCTL_I915_GETPARAM         DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GETPARAM, drm_i915_getparam_t)
241718dceddSDavid Howells #define DRM_IOCTL_I915_SETPARAM         DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SETPARAM, drm_i915_setparam_t)
242718dceddSDavid Howells #define DRM_IOCTL_I915_ALLOC            DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_ALLOC, drm_i915_mem_alloc_t)
243718dceddSDavid Howells #define DRM_IOCTL_I915_FREE             DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t)
244718dceddSDavid Howells #define DRM_IOCTL_I915_INIT_HEAP        DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t)
245718dceddSDavid Howells #define DRM_IOCTL_I915_CMDBUFFER	DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t)
246718dceddSDavid Howells #define DRM_IOCTL_I915_DESTROY_HEAP	DRM_IOW( DRM_COMMAND_BASE + DRM_I915_DESTROY_HEAP, drm_i915_mem_destroy_heap_t)
247718dceddSDavid Howells #define DRM_IOCTL_I915_SET_VBLANK_PIPE	DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
248718dceddSDavid Howells #define DRM_IOCTL_I915_GET_VBLANK_PIPE	DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
249718dceddSDavid Howells #define DRM_IOCTL_I915_VBLANK_SWAP	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t)
250718dceddSDavid Howells #define DRM_IOCTL_I915_HWS_ADDR		DRM_IOW(DRM_COMMAND_BASE + DRM_I915_HWS_ADDR, struct drm_i915_gem_init)
251718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_INIT		DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init)
252718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_EXECBUFFER	DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer)
253718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_EXECBUFFER2	DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2)
254718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_PIN		DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin)
255718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_UNPIN	DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin)
256718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_BUSY		DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy)
257718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_SET_CACHING		DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_SET_CACHING, struct drm_i915_gem_caching)
258718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_GET_CACHING		DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_GET_CACHING, struct drm_i915_gem_caching)
259718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_THROTTLE	DRM_IO ( DRM_COMMAND_BASE + DRM_I915_GEM_THROTTLE)
260718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_ENTERVT	DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_ENTERVT)
261718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_LEAVEVT	DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_LEAVEVT)
262718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_CREATE	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct drm_i915_gem_create)
263718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_PREAD	DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PREAD, struct drm_i915_gem_pread)
264718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_PWRITE	DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite)
265718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_MMAP		DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap)
266718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_MMAP_GTT	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt)
267718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_SET_DOMAIN	DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain)
268718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_SW_FINISH	DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish)
269718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_SET_TILING	DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling)
270718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_GET_TILING	DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling)
271718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_GET_APERTURE	DRM_IOR  (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture)
272718dceddSDavid Howells #define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_i915_get_pipe_from_crtc_id)
273718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_MADVISE	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise)
274718dceddSDavid Howells #define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE	DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image)
275718dceddSDavid Howells #define DRM_IOCTL_I915_OVERLAY_ATTRS	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs)
276718dceddSDavid Howells #define DRM_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
2772c60fae1STommi Rantala #define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
278718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_WAIT		DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_WAIT, struct drm_i915_gem_wait)
279718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_CONTEXT_CREATE	DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create)
280718dceddSDavid Howells #define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY	DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy)
281718dceddSDavid Howells #define DRM_IOCTL_I915_REG_READ			DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read)
282b6359918SMika Kuoppala #define DRM_IOCTL_I915_GET_RESET_STATS		DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GET_RESET_STATS, struct drm_i915_reset_stats)
2835cc9ed4bSChris Wilson #define DRM_IOCTL_I915_GEM_USERPTR			DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_USERPTR, struct drm_i915_gem_userptr)
284c9dc0f35SChris Wilson #define DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM	DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_GETPARAM, struct drm_i915_gem_context_param)
285c9dc0f35SChris Wilson #define DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM	DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_SETPARAM, struct drm_i915_gem_context_param)
286718dceddSDavid Howells 
287718dceddSDavid Howells /* Allow drivers to submit batchbuffers directly to hardware, relying
288718dceddSDavid Howells  * on the security mechanisms provided by hardware.
289718dceddSDavid Howells  */
290718dceddSDavid Howells typedef struct drm_i915_batchbuffer {
291718dceddSDavid Howells 	int start;		/* agp offset */
292718dceddSDavid Howells 	int used;		/* nr bytes in use */
293718dceddSDavid Howells 	int DR1;		/* hw flags for GFX_OP_DRAWRECT_INFO */
294718dceddSDavid Howells 	int DR4;		/* window origin for GFX_OP_DRAWRECT_INFO */
295718dceddSDavid Howells 	int num_cliprects;	/* mulitpass with multiple cliprects? */
296718dceddSDavid Howells 	struct drm_clip_rect __user *cliprects;	/* pointer to userspace cliprects */
297718dceddSDavid Howells } drm_i915_batchbuffer_t;
298718dceddSDavid Howells 
299718dceddSDavid Howells /* As above, but pass a pointer to userspace buffer which can be
300718dceddSDavid Howells  * validated by the kernel prior to sending to hardware.
301718dceddSDavid Howells  */
302718dceddSDavid Howells typedef struct _drm_i915_cmdbuffer {
303718dceddSDavid Howells 	char __user *buf;	/* pointer to userspace command buffer */
304718dceddSDavid Howells 	int sz;			/* nr bytes in buf */
305718dceddSDavid Howells 	int DR1;		/* hw flags for GFX_OP_DRAWRECT_INFO */
306718dceddSDavid Howells 	int DR4;		/* window origin for GFX_OP_DRAWRECT_INFO */
307718dceddSDavid Howells 	int num_cliprects;	/* mulitpass with multiple cliprects? */
308718dceddSDavid Howells 	struct drm_clip_rect __user *cliprects;	/* pointer to userspace cliprects */
309718dceddSDavid Howells } drm_i915_cmdbuffer_t;
310718dceddSDavid Howells 
311718dceddSDavid Howells /* Userspace can request & wait on irq's:
312718dceddSDavid Howells  */
313718dceddSDavid Howells typedef struct drm_i915_irq_emit {
314718dceddSDavid Howells 	int __user *irq_seq;
315718dceddSDavid Howells } drm_i915_irq_emit_t;
316718dceddSDavid Howells 
317718dceddSDavid Howells typedef struct drm_i915_irq_wait {
318718dceddSDavid Howells 	int irq_seq;
319718dceddSDavid Howells } drm_i915_irq_wait_t;
320718dceddSDavid Howells 
321718dceddSDavid Howells /* Ioctl to query kernel params:
322718dceddSDavid Howells  */
323718dceddSDavid Howells #define I915_PARAM_IRQ_ACTIVE            1
324718dceddSDavid Howells #define I915_PARAM_ALLOW_BATCHBUFFER     2
325718dceddSDavid Howells #define I915_PARAM_LAST_DISPATCH         3
326718dceddSDavid Howells #define I915_PARAM_CHIPSET_ID            4
327718dceddSDavid Howells #define I915_PARAM_HAS_GEM               5
328718dceddSDavid Howells #define I915_PARAM_NUM_FENCES_AVAIL      6
329718dceddSDavid Howells #define I915_PARAM_HAS_OVERLAY           7
330718dceddSDavid Howells #define I915_PARAM_HAS_PAGEFLIPPING	 8
331718dceddSDavid Howells #define I915_PARAM_HAS_EXECBUF2          9
332718dceddSDavid Howells #define I915_PARAM_HAS_BSD		 10
333718dceddSDavid Howells #define I915_PARAM_HAS_BLT		 11
334718dceddSDavid Howells #define I915_PARAM_HAS_RELAXED_FENCING	 12
335718dceddSDavid Howells #define I915_PARAM_HAS_COHERENT_RINGS	 13
336718dceddSDavid Howells #define I915_PARAM_HAS_EXEC_CONSTANTS	 14
337718dceddSDavid Howells #define I915_PARAM_HAS_RELAXED_DELTA	 15
338718dceddSDavid Howells #define I915_PARAM_HAS_GEN7_SOL_RESET	 16
339718dceddSDavid Howells #define I915_PARAM_HAS_LLC     	 	 17
340718dceddSDavid Howells #define I915_PARAM_HAS_ALIASING_PPGTT	 18
341718dceddSDavid Howells #define I915_PARAM_HAS_WAIT_TIMEOUT	 19
342718dceddSDavid Howells #define I915_PARAM_HAS_SEMAPHORES	 20
343718dceddSDavid Howells #define I915_PARAM_HAS_PRIME_VMAP_FLUSH	 21
344a1f2cc73SXiang, Haihao #define I915_PARAM_HAS_VEBOX		 22
345c2fb7916SDaniel Vetter #define I915_PARAM_HAS_SECURE_BATCHES	 23
346b45305fcSDaniel Vetter #define I915_PARAM_HAS_PINNED_BATCHES	 24
347ed5982e6SDaniel Vetter #define I915_PARAM_HAS_EXEC_NO_RELOC	 25
348eef90ccbSChris Wilson #define I915_PARAM_HAS_EXEC_HANDLE_LUT   26
349651d794fSChris Wilson #define I915_PARAM_HAS_WT     	 	 27
350d728c8efSBrad Volkin #define I915_PARAM_CMD_PARSER_VERSION	 28
3516a2c4232SChris Wilson #define I915_PARAM_HAS_COHERENT_PHYS_GTT 29
3521816f923SAkash Goel #define I915_PARAM_MMAP_VERSION          30
35308e16dc8SZhipeng Gong #define I915_PARAM_HAS_BSD2		 31
35427cd4461SNeil Roberts #define I915_PARAM_REVISION              32
355a1559ffeSJeff McGee #define I915_PARAM_SUBSLICE_TOTAL	 33
356a1559ffeSJeff McGee #define I915_PARAM_EU_TOTAL		 34
357718dceddSDavid Howells 
358718dceddSDavid Howells typedef struct drm_i915_getparam {
359718dceddSDavid Howells 	int param;
360718dceddSDavid Howells 	int __user *value;
361718dceddSDavid Howells } drm_i915_getparam_t;
362718dceddSDavid Howells 
363718dceddSDavid Howells /* Ioctl to set kernel params:
364718dceddSDavid Howells  */
365718dceddSDavid Howells #define I915_SETPARAM_USE_MI_BATCHBUFFER_START            1
366718dceddSDavid Howells #define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY             2
367718dceddSDavid Howells #define I915_SETPARAM_ALLOW_BATCHBUFFER                   3
368718dceddSDavid Howells #define I915_SETPARAM_NUM_USED_FENCES                     4
369718dceddSDavid Howells 
370718dceddSDavid Howells typedef struct drm_i915_setparam {
371718dceddSDavid Howells 	int param;
372718dceddSDavid Howells 	int value;
373718dceddSDavid Howells } drm_i915_setparam_t;
374718dceddSDavid Howells 
375718dceddSDavid Howells /* A memory manager for regions of shared memory:
376718dceddSDavid Howells  */
377718dceddSDavid Howells #define I915_MEM_REGION_AGP 1
378718dceddSDavid Howells 
379718dceddSDavid Howells typedef struct drm_i915_mem_alloc {
380718dceddSDavid Howells 	int region;
381718dceddSDavid Howells 	int alignment;
382718dceddSDavid Howells 	int size;
383718dceddSDavid Howells 	int __user *region_offset;	/* offset from start of fb or agp */
384718dceddSDavid Howells } drm_i915_mem_alloc_t;
385718dceddSDavid Howells 
386718dceddSDavid Howells typedef struct drm_i915_mem_free {
387718dceddSDavid Howells 	int region;
388718dceddSDavid Howells 	int region_offset;
389718dceddSDavid Howells } drm_i915_mem_free_t;
390718dceddSDavid Howells 
391718dceddSDavid Howells typedef struct drm_i915_mem_init_heap {
392718dceddSDavid Howells 	int region;
393718dceddSDavid Howells 	int size;
394718dceddSDavid Howells 	int start;
395718dceddSDavid Howells } drm_i915_mem_init_heap_t;
396718dceddSDavid Howells 
397718dceddSDavid Howells /* Allow memory manager to be torn down and re-initialized (eg on
398718dceddSDavid Howells  * rotate):
399718dceddSDavid Howells  */
400718dceddSDavid Howells typedef struct drm_i915_mem_destroy_heap {
401718dceddSDavid Howells 	int region;
402718dceddSDavid Howells } drm_i915_mem_destroy_heap_t;
403718dceddSDavid Howells 
404718dceddSDavid Howells /* Allow X server to configure which pipes to monitor for vblank signals
405718dceddSDavid Howells  */
406718dceddSDavid Howells #define	DRM_I915_VBLANK_PIPE_A	1
407718dceddSDavid Howells #define	DRM_I915_VBLANK_PIPE_B	2
408718dceddSDavid Howells 
409718dceddSDavid Howells typedef struct drm_i915_vblank_pipe {
410718dceddSDavid Howells 	int pipe;
411718dceddSDavid Howells } drm_i915_vblank_pipe_t;
412718dceddSDavid Howells 
413718dceddSDavid Howells /* Schedule buffer swap at given vertical blank:
414718dceddSDavid Howells  */
415718dceddSDavid Howells typedef struct drm_i915_vblank_swap {
416718dceddSDavid Howells 	drm_drawable_t drawable;
417718dceddSDavid Howells 	enum drm_vblank_seq_type seqtype;
418718dceddSDavid Howells 	unsigned int sequence;
419718dceddSDavid Howells } drm_i915_vblank_swap_t;
420718dceddSDavid Howells 
421718dceddSDavid Howells typedef struct drm_i915_hws_addr {
422718dceddSDavid Howells 	__u64 addr;
423718dceddSDavid Howells } drm_i915_hws_addr_t;
424718dceddSDavid Howells 
425718dceddSDavid Howells struct drm_i915_gem_init {
426718dceddSDavid Howells 	/**
427718dceddSDavid Howells 	 * Beginning offset in the GTT to be managed by the DRM memory
428718dceddSDavid Howells 	 * manager.
429718dceddSDavid Howells 	 */
430718dceddSDavid Howells 	__u64 gtt_start;
431718dceddSDavid Howells 	/**
432718dceddSDavid Howells 	 * Ending offset in the GTT to be managed by the DRM memory
433718dceddSDavid Howells 	 * manager.
434718dceddSDavid Howells 	 */
435718dceddSDavid Howells 	__u64 gtt_end;
436718dceddSDavid Howells };
437718dceddSDavid Howells 
438718dceddSDavid Howells struct drm_i915_gem_create {
439718dceddSDavid Howells 	/**
440718dceddSDavid Howells 	 * Requested size for the object.
441718dceddSDavid Howells 	 *
442718dceddSDavid Howells 	 * The (page-aligned) allocated size for the object will be returned.
443718dceddSDavid Howells 	 */
444718dceddSDavid Howells 	__u64 size;
445718dceddSDavid Howells 	/**
446718dceddSDavid Howells 	 * Returned handle for the object.
447718dceddSDavid Howells 	 *
448718dceddSDavid Howells 	 * Object handles are nonzero.
449718dceddSDavid Howells 	 */
450718dceddSDavid Howells 	__u32 handle;
451718dceddSDavid Howells 	__u32 pad;
452718dceddSDavid Howells };
453718dceddSDavid Howells 
454718dceddSDavid Howells struct drm_i915_gem_pread {
455718dceddSDavid Howells 	/** Handle for the object being read. */
456718dceddSDavid Howells 	__u32 handle;
457718dceddSDavid Howells 	__u32 pad;
458718dceddSDavid Howells 	/** Offset into the object to read from */
459718dceddSDavid Howells 	__u64 offset;
460718dceddSDavid Howells 	/** Length of data to read */
461718dceddSDavid Howells 	__u64 size;
462718dceddSDavid Howells 	/**
463718dceddSDavid Howells 	 * Pointer to write the data into.
464718dceddSDavid Howells 	 *
465718dceddSDavid Howells 	 * This is a fixed-size type for 32/64 compatibility.
466718dceddSDavid Howells 	 */
467718dceddSDavid Howells 	__u64 data_ptr;
468718dceddSDavid Howells };
469718dceddSDavid Howells 
470718dceddSDavid Howells struct drm_i915_gem_pwrite {
471718dceddSDavid Howells 	/** Handle for the object being written to. */
472718dceddSDavid Howells 	__u32 handle;
473718dceddSDavid Howells 	__u32 pad;
474718dceddSDavid Howells 	/** Offset into the object to write to */
475718dceddSDavid Howells 	__u64 offset;
476718dceddSDavid Howells 	/** Length of data to write */
477718dceddSDavid Howells 	__u64 size;
478718dceddSDavid Howells 	/**
479718dceddSDavid Howells 	 * Pointer to read the data from.
480718dceddSDavid Howells 	 *
481718dceddSDavid Howells 	 * This is a fixed-size type for 32/64 compatibility.
482718dceddSDavid Howells 	 */
483718dceddSDavid Howells 	__u64 data_ptr;
484718dceddSDavid Howells };
485718dceddSDavid Howells 
486718dceddSDavid Howells struct drm_i915_gem_mmap {
487718dceddSDavid Howells 	/** Handle for the object being mapped. */
488718dceddSDavid Howells 	__u32 handle;
489718dceddSDavid Howells 	__u32 pad;
490718dceddSDavid Howells 	/** Offset in the object to map. */
491718dceddSDavid Howells 	__u64 offset;
492718dceddSDavid Howells 	/**
493718dceddSDavid Howells 	 * Length of data to map.
494718dceddSDavid Howells 	 *
495718dceddSDavid Howells 	 * The value will be page-aligned.
496718dceddSDavid Howells 	 */
497718dceddSDavid Howells 	__u64 size;
498718dceddSDavid Howells 	/**
499718dceddSDavid Howells 	 * Returned pointer the data was mapped at.
500718dceddSDavid Howells 	 *
501718dceddSDavid Howells 	 * This is a fixed-size type for 32/64 compatibility.
502718dceddSDavid Howells 	 */
503718dceddSDavid Howells 	__u64 addr_ptr;
5041816f923SAkash Goel 
5051816f923SAkash Goel 	/**
5061816f923SAkash Goel 	 * Flags for extended behaviour.
5071816f923SAkash Goel 	 *
5081816f923SAkash Goel 	 * Added in version 2.
5091816f923SAkash Goel 	 */
5101816f923SAkash Goel 	__u64 flags;
5111816f923SAkash Goel #define I915_MMAP_WC 0x1
512718dceddSDavid Howells };
513718dceddSDavid Howells 
514718dceddSDavid Howells struct drm_i915_gem_mmap_gtt {
515718dceddSDavid Howells 	/** Handle for the object being mapped. */
516718dceddSDavid Howells 	__u32 handle;
517718dceddSDavid Howells 	__u32 pad;
518718dceddSDavid Howells 	/**
519718dceddSDavid Howells 	 * Fake offset to use for subsequent mmap call
520718dceddSDavid Howells 	 *
521718dceddSDavid Howells 	 * This is a fixed-size type for 32/64 compatibility.
522718dceddSDavid Howells 	 */
523718dceddSDavid Howells 	__u64 offset;
524718dceddSDavid Howells };
525718dceddSDavid Howells 
526718dceddSDavid Howells struct drm_i915_gem_set_domain {
527718dceddSDavid Howells 	/** Handle for the object */
528718dceddSDavid Howells 	__u32 handle;
529718dceddSDavid Howells 
530718dceddSDavid Howells 	/** New read domains */
531718dceddSDavid Howells 	__u32 read_domains;
532718dceddSDavid Howells 
533718dceddSDavid Howells 	/** New write domain */
534718dceddSDavid Howells 	__u32 write_domain;
535718dceddSDavid Howells };
536718dceddSDavid Howells 
537718dceddSDavid Howells struct drm_i915_gem_sw_finish {
538718dceddSDavid Howells 	/** Handle for the object */
539718dceddSDavid Howells 	__u32 handle;
540718dceddSDavid Howells };
541718dceddSDavid Howells 
542718dceddSDavid Howells struct drm_i915_gem_relocation_entry {
543718dceddSDavid Howells 	/**
544718dceddSDavid Howells 	 * Handle of the buffer being pointed to by this relocation entry.
545718dceddSDavid Howells 	 *
546718dceddSDavid Howells 	 * It's appealing to make this be an index into the mm_validate_entry
547718dceddSDavid Howells 	 * list to refer to the buffer, but this allows the driver to create
548718dceddSDavid Howells 	 * a relocation list for state buffers and not re-write it per
549718dceddSDavid Howells 	 * exec using the buffer.
550718dceddSDavid Howells 	 */
551718dceddSDavid Howells 	__u32 target_handle;
552718dceddSDavid Howells 
553718dceddSDavid Howells 	/**
554718dceddSDavid Howells 	 * Value to be added to the offset of the target buffer to make up
555718dceddSDavid Howells 	 * the relocation entry.
556718dceddSDavid Howells 	 */
557718dceddSDavid Howells 	__u32 delta;
558718dceddSDavid Howells 
559718dceddSDavid Howells 	/** Offset in the buffer the relocation entry will be written into */
560718dceddSDavid Howells 	__u64 offset;
561718dceddSDavid Howells 
562718dceddSDavid Howells 	/**
563718dceddSDavid Howells 	 * Offset value of the target buffer that the relocation entry was last
564718dceddSDavid Howells 	 * written as.
565718dceddSDavid Howells 	 *
566718dceddSDavid Howells 	 * If the buffer has the same offset as last time, we can skip syncing
567718dceddSDavid Howells 	 * and writing the relocation.  This value is written back out by
568718dceddSDavid Howells 	 * the execbuffer ioctl when the relocation is written.
569718dceddSDavid Howells 	 */
570718dceddSDavid Howells 	__u64 presumed_offset;
571718dceddSDavid Howells 
572718dceddSDavid Howells 	/**
573718dceddSDavid Howells 	 * Target memory domains read by this operation.
574718dceddSDavid Howells 	 */
575718dceddSDavid Howells 	__u32 read_domains;
576718dceddSDavid Howells 
577718dceddSDavid Howells 	/**
578718dceddSDavid Howells 	 * Target memory domains written by this operation.
579718dceddSDavid Howells 	 *
580718dceddSDavid Howells 	 * Note that only one domain may be written by the whole
581718dceddSDavid Howells 	 * execbuffer operation, so that where there are conflicts,
582718dceddSDavid Howells 	 * the application will get -EINVAL back.
583718dceddSDavid Howells 	 */
584718dceddSDavid Howells 	__u32 write_domain;
585718dceddSDavid Howells };
586718dceddSDavid Howells 
587718dceddSDavid Howells /** @{
588718dceddSDavid Howells  * Intel memory domains
589718dceddSDavid Howells  *
590718dceddSDavid Howells  * Most of these just align with the various caches in
591718dceddSDavid Howells  * the system and are used to flush and invalidate as
592718dceddSDavid Howells  * objects end up cached in different domains.
593718dceddSDavid Howells  */
594718dceddSDavid Howells /** CPU cache */
595718dceddSDavid Howells #define I915_GEM_DOMAIN_CPU		0x00000001
596718dceddSDavid Howells /** Render cache, used by 2D and 3D drawing */
597718dceddSDavid Howells #define I915_GEM_DOMAIN_RENDER		0x00000002
598718dceddSDavid Howells /** Sampler cache, used by texture engine */
599718dceddSDavid Howells #define I915_GEM_DOMAIN_SAMPLER		0x00000004
600718dceddSDavid Howells /** Command queue, used to load batch buffers */
601718dceddSDavid Howells #define I915_GEM_DOMAIN_COMMAND		0x00000008
602718dceddSDavid Howells /** Instruction cache, used by shader programs */
603718dceddSDavid Howells #define I915_GEM_DOMAIN_INSTRUCTION	0x00000010
604718dceddSDavid Howells /** Vertex address cache */
605718dceddSDavid Howells #define I915_GEM_DOMAIN_VERTEX		0x00000020
606718dceddSDavid Howells /** GTT domain - aperture and scanout */
607718dceddSDavid Howells #define I915_GEM_DOMAIN_GTT		0x00000040
608718dceddSDavid Howells /** @} */
609718dceddSDavid Howells 
610718dceddSDavid Howells struct drm_i915_gem_exec_object {
611718dceddSDavid Howells 	/**
612718dceddSDavid Howells 	 * User's handle for a buffer to be bound into the GTT for this
613718dceddSDavid Howells 	 * operation.
614718dceddSDavid Howells 	 */
615718dceddSDavid Howells 	__u32 handle;
616718dceddSDavid Howells 
617718dceddSDavid Howells 	/** Number of relocations to be performed on this buffer */
618718dceddSDavid Howells 	__u32 relocation_count;
619718dceddSDavid Howells 	/**
620718dceddSDavid Howells 	 * Pointer to array of struct drm_i915_gem_relocation_entry containing
621718dceddSDavid Howells 	 * the relocations to be performed in this buffer.
622718dceddSDavid Howells 	 */
623718dceddSDavid Howells 	__u64 relocs_ptr;
624718dceddSDavid Howells 
625718dceddSDavid Howells 	/** Required alignment in graphics aperture */
626718dceddSDavid Howells 	__u64 alignment;
627718dceddSDavid Howells 
628718dceddSDavid Howells 	/**
629718dceddSDavid Howells 	 * Returned value of the updated offset of the object, for future
630718dceddSDavid Howells 	 * presumed_offset writes.
631718dceddSDavid Howells 	 */
632718dceddSDavid Howells 	__u64 offset;
633718dceddSDavid Howells };
634718dceddSDavid Howells 
635718dceddSDavid Howells struct drm_i915_gem_execbuffer {
636718dceddSDavid Howells 	/**
637718dceddSDavid Howells 	 * List of buffers to be validated with their relocations to be
638718dceddSDavid Howells 	 * performend on them.
639718dceddSDavid Howells 	 *
640718dceddSDavid Howells 	 * This is a pointer to an array of struct drm_i915_gem_validate_entry.
641718dceddSDavid Howells 	 *
642718dceddSDavid Howells 	 * These buffers must be listed in an order such that all relocations
643718dceddSDavid Howells 	 * a buffer is performing refer to buffers that have already appeared
644718dceddSDavid Howells 	 * in the validate list.
645718dceddSDavid Howells 	 */
646718dceddSDavid Howells 	__u64 buffers_ptr;
647718dceddSDavid Howells 	__u32 buffer_count;
648718dceddSDavid Howells 
649718dceddSDavid Howells 	/** Offset in the batchbuffer to start execution from. */
650718dceddSDavid Howells 	__u32 batch_start_offset;
651718dceddSDavid Howells 	/** Bytes used in batchbuffer from batch_start_offset */
652718dceddSDavid Howells 	__u32 batch_len;
653718dceddSDavid Howells 	__u32 DR1;
654718dceddSDavid Howells 	__u32 DR4;
655718dceddSDavid Howells 	__u32 num_cliprects;
656718dceddSDavid Howells 	/** This is a struct drm_clip_rect *cliprects */
657718dceddSDavid Howells 	__u64 cliprects_ptr;
658718dceddSDavid Howells };
659718dceddSDavid Howells 
660718dceddSDavid Howells struct drm_i915_gem_exec_object2 {
661718dceddSDavid Howells 	/**
662718dceddSDavid Howells 	 * User's handle for a buffer to be bound into the GTT for this
663718dceddSDavid Howells 	 * operation.
664718dceddSDavid Howells 	 */
665718dceddSDavid Howells 	__u32 handle;
666718dceddSDavid Howells 
667718dceddSDavid Howells 	/** Number of relocations to be performed on this buffer */
668718dceddSDavid Howells 	__u32 relocation_count;
669718dceddSDavid Howells 	/**
670718dceddSDavid Howells 	 * Pointer to array of struct drm_i915_gem_relocation_entry containing
671718dceddSDavid Howells 	 * the relocations to be performed in this buffer.
672718dceddSDavid Howells 	 */
673718dceddSDavid Howells 	__u64 relocs_ptr;
674718dceddSDavid Howells 
675718dceddSDavid Howells 	/** Required alignment in graphics aperture */
676718dceddSDavid Howells 	__u64 alignment;
677718dceddSDavid Howells 
678718dceddSDavid Howells 	/**
679718dceddSDavid Howells 	 * Returned value of the updated offset of the object, for future
680718dceddSDavid Howells 	 * presumed_offset writes.
681718dceddSDavid Howells 	 */
682718dceddSDavid Howells 	__u64 offset;
683718dceddSDavid Howells 
684718dceddSDavid Howells #define EXEC_OBJECT_NEEDS_FENCE (1<<0)
685ed5982e6SDaniel Vetter #define EXEC_OBJECT_NEEDS_GTT	(1<<1)
686ed5982e6SDaniel Vetter #define EXEC_OBJECT_WRITE	(1<<2)
687ed5982e6SDaniel Vetter #define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_WRITE<<1)
688718dceddSDavid Howells 	__u64 flags;
689ed5982e6SDaniel Vetter 
690718dceddSDavid Howells 	__u64 rsvd1;
691718dceddSDavid Howells 	__u64 rsvd2;
692718dceddSDavid Howells };
693718dceddSDavid Howells 
694718dceddSDavid Howells struct drm_i915_gem_execbuffer2 {
695718dceddSDavid Howells 	/**
696718dceddSDavid Howells 	 * List of gem_exec_object2 structs
697718dceddSDavid Howells 	 */
698718dceddSDavid Howells 	__u64 buffers_ptr;
699718dceddSDavid Howells 	__u32 buffer_count;
700718dceddSDavid Howells 
701718dceddSDavid Howells 	/** Offset in the batchbuffer to start execution from. */
702718dceddSDavid Howells 	__u32 batch_start_offset;
703718dceddSDavid Howells 	/** Bytes used in batchbuffer from batch_start_offset */
704718dceddSDavid Howells 	__u32 batch_len;
705718dceddSDavid Howells 	__u32 DR1;
706718dceddSDavid Howells 	__u32 DR4;
707718dceddSDavid Howells 	__u32 num_cliprects;
708718dceddSDavid Howells 	/** This is a struct drm_clip_rect *cliprects */
709718dceddSDavid Howells 	__u64 cliprects_ptr;
710718dceddSDavid Howells #define I915_EXEC_RING_MASK              (7<<0)
711718dceddSDavid Howells #define I915_EXEC_DEFAULT                (0<<0)
712718dceddSDavid Howells #define I915_EXEC_RENDER                 (1<<0)
713718dceddSDavid Howells #define I915_EXEC_BSD                    (2<<0)
714718dceddSDavid Howells #define I915_EXEC_BLT                    (3<<0)
71582f91b6eSXiang, Haihao #define I915_EXEC_VEBOX                  (4<<0)
716718dceddSDavid Howells 
717718dceddSDavid Howells /* Used for switching the constants addressing mode on gen4+ RENDER ring.
718718dceddSDavid Howells  * Gen6+ only supports relative addressing to dynamic state (default) and
719718dceddSDavid Howells  * absolute addressing.
720718dceddSDavid Howells  *
721718dceddSDavid Howells  * These flags are ignored for the BSD and BLT rings.
722718dceddSDavid Howells  */
723718dceddSDavid Howells #define I915_EXEC_CONSTANTS_MASK 	(3<<6)
724718dceddSDavid Howells #define I915_EXEC_CONSTANTS_REL_GENERAL (0<<6) /* default */
725718dceddSDavid Howells #define I915_EXEC_CONSTANTS_ABSOLUTE 	(1<<6)
726718dceddSDavid Howells #define I915_EXEC_CONSTANTS_REL_SURFACE (2<<6) /* gen4/5 only */
727718dceddSDavid Howells 	__u64 flags;
728718dceddSDavid Howells 	__u64 rsvd1; /* now used for context info */
729718dceddSDavid Howells 	__u64 rsvd2;
730718dceddSDavid Howells };
731718dceddSDavid Howells 
732718dceddSDavid Howells /** Resets the SO write offset registers for transform feedback on gen7. */
733718dceddSDavid Howells #define I915_EXEC_GEN7_SOL_RESET	(1<<8)
734718dceddSDavid Howells 
735c2fb7916SDaniel Vetter /** Request a privileged ("secure") batch buffer. Note only available for
736c2fb7916SDaniel Vetter  * DRM_ROOT_ONLY | DRM_MASTER processes.
737c2fb7916SDaniel Vetter  */
738c2fb7916SDaniel Vetter #define I915_EXEC_SECURE		(1<<9)
739c2fb7916SDaniel Vetter 
740b45305fcSDaniel Vetter /** Inform the kernel that the batch is and will always be pinned. This
741b45305fcSDaniel Vetter  * negates the requirement for a workaround to be performed to avoid
742b45305fcSDaniel Vetter  * an incoherent CS (such as can be found on 830/845). If this flag is
743b45305fcSDaniel Vetter  * not passed, the kernel will endeavour to make sure the batch is
744b45305fcSDaniel Vetter  * coherent with the CS before execution. If this flag is passed,
745b45305fcSDaniel Vetter  * userspace assumes the responsibility for ensuring the same.
746b45305fcSDaniel Vetter  */
747b45305fcSDaniel Vetter #define I915_EXEC_IS_PINNED		(1<<10)
748b45305fcSDaniel Vetter 
749c3d19d3cSGeert Uytterhoeven /** Provide a hint to the kernel that the command stream and auxiliary
750ed5982e6SDaniel Vetter  * state buffers already holds the correct presumed addresses and so the
751ed5982e6SDaniel Vetter  * relocation process may be skipped if no buffers need to be moved in
752ed5982e6SDaniel Vetter  * preparation for the execbuffer.
753ed5982e6SDaniel Vetter  */
754ed5982e6SDaniel Vetter #define I915_EXEC_NO_RELOC		(1<<11)
755ed5982e6SDaniel Vetter 
756eef90ccbSChris Wilson /** Use the reloc.handle as an index into the exec object array rather
757eef90ccbSChris Wilson  * than as the per-file handle.
758eef90ccbSChris Wilson  */
759eef90ccbSChris Wilson #define I915_EXEC_HANDLE_LUT		(1<<12)
760eef90ccbSChris Wilson 
7618d360dffSZhipeng Gong /** Used for switching BSD rings on the platforms with two BSD rings */
7628d360dffSZhipeng Gong #define I915_EXEC_BSD_MASK		(3<<13)
7638d360dffSZhipeng Gong #define I915_EXEC_BSD_DEFAULT		(0<<13) /* default ping-pong mode */
7648d360dffSZhipeng Gong #define I915_EXEC_BSD_RING1		(1<<13)
7658d360dffSZhipeng Gong #define I915_EXEC_BSD_RING2		(2<<13)
7668d360dffSZhipeng Gong 
7678d360dffSZhipeng Gong #define __I915_EXEC_UNKNOWN_FLAGS -(1<<15)
768ed5982e6SDaniel Vetter 
769718dceddSDavid Howells #define I915_EXEC_CONTEXT_ID_MASK	(0xffffffff)
770718dceddSDavid Howells #define i915_execbuffer2_set_context_id(eb2, context) \
771718dceddSDavid Howells 	(eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK
772718dceddSDavid Howells #define i915_execbuffer2_get_context_id(eb2) \
773718dceddSDavid Howells 	((eb2).rsvd1 & I915_EXEC_CONTEXT_ID_MASK)
774718dceddSDavid Howells 
775718dceddSDavid Howells struct drm_i915_gem_pin {
776718dceddSDavid Howells 	/** Handle of the buffer to be pinned. */
777718dceddSDavid Howells 	__u32 handle;
778718dceddSDavid Howells 	__u32 pad;
779718dceddSDavid Howells 
780718dceddSDavid Howells 	/** alignment required within the aperture */
781718dceddSDavid Howells 	__u64 alignment;
782718dceddSDavid Howells 
783718dceddSDavid Howells 	/** Returned GTT offset of the buffer. */
784718dceddSDavid Howells 	__u64 offset;
785718dceddSDavid Howells };
786718dceddSDavid Howells 
787718dceddSDavid Howells struct drm_i915_gem_unpin {
788718dceddSDavid Howells 	/** Handle of the buffer to be unpinned. */
789718dceddSDavid Howells 	__u32 handle;
790718dceddSDavid Howells 	__u32 pad;
791718dceddSDavid Howells };
792718dceddSDavid Howells 
793718dceddSDavid Howells struct drm_i915_gem_busy {
794718dceddSDavid Howells 	/** Handle of the buffer to check for busy */
795718dceddSDavid Howells 	__u32 handle;
796718dceddSDavid Howells 
797718dceddSDavid Howells 	/** Return busy status (1 if busy, 0 if idle).
798718dceddSDavid Howells 	 * The high word is used to indicate on which rings the object
799718dceddSDavid Howells 	 * currently resides:
800718dceddSDavid Howells 	 *  16:31 - busy (r or r/w) rings (16 render, 17 bsd, 18 blt, etc)
801718dceddSDavid Howells 	 */
802718dceddSDavid Howells 	__u32 busy;
803718dceddSDavid Howells };
804718dceddSDavid Howells 
80535c7ab42SDaniel Vetter /**
80635c7ab42SDaniel Vetter  * I915_CACHING_NONE
80735c7ab42SDaniel Vetter  *
80835c7ab42SDaniel Vetter  * GPU access is not coherent with cpu caches. Default for machines without an
80935c7ab42SDaniel Vetter  * LLC.
81035c7ab42SDaniel Vetter  */
811718dceddSDavid Howells #define I915_CACHING_NONE		0
81235c7ab42SDaniel Vetter /**
81335c7ab42SDaniel Vetter  * I915_CACHING_CACHED
81435c7ab42SDaniel Vetter  *
81535c7ab42SDaniel Vetter  * GPU access is coherent with cpu caches and furthermore the data is cached in
81635c7ab42SDaniel Vetter  * last-level caches shared between cpu cores and the gpu GT. Default on
81735c7ab42SDaniel Vetter  * machines with HAS_LLC.
81835c7ab42SDaniel Vetter  */
819718dceddSDavid Howells #define I915_CACHING_CACHED		1
82035c7ab42SDaniel Vetter /**
82135c7ab42SDaniel Vetter  * I915_CACHING_DISPLAY
82235c7ab42SDaniel Vetter  *
82335c7ab42SDaniel Vetter  * Special GPU caching mode which is coherent with the scanout engines.
82435c7ab42SDaniel Vetter  * Transparently falls back to I915_CACHING_NONE on platforms where no special
82535c7ab42SDaniel Vetter  * cache mode (like write-through or gfdt flushing) is available. The kernel
82635c7ab42SDaniel Vetter  * automatically sets this mode when using a buffer as a scanout target.
82735c7ab42SDaniel Vetter  * Userspace can manually set this mode to avoid a costly stall and clflush in
82835c7ab42SDaniel Vetter  * the hotpath of drawing the first frame.
82935c7ab42SDaniel Vetter  */
83035c7ab42SDaniel Vetter #define I915_CACHING_DISPLAY		2
831718dceddSDavid Howells 
832718dceddSDavid Howells struct drm_i915_gem_caching {
833718dceddSDavid Howells 	/**
834718dceddSDavid Howells 	 * Handle of the buffer to set/get the caching level of. */
835718dceddSDavid Howells 	__u32 handle;
836718dceddSDavid Howells 
837718dceddSDavid Howells 	/**
838718dceddSDavid Howells 	 * Cacheing level to apply or return value
839718dceddSDavid Howells 	 *
840718dceddSDavid Howells 	 * bits0-15 are for generic caching control (i.e. the above defined
841718dceddSDavid Howells 	 * values). bits16-31 are reserved for platform-specific variations
842718dceddSDavid Howells 	 * (e.g. l3$ caching on gen7). */
843718dceddSDavid Howells 	__u32 caching;
844718dceddSDavid Howells };
845718dceddSDavid Howells 
846718dceddSDavid Howells #define I915_TILING_NONE	0
847718dceddSDavid Howells #define I915_TILING_X		1
848718dceddSDavid Howells #define I915_TILING_Y		2
849718dceddSDavid Howells 
850718dceddSDavid Howells #define I915_BIT_6_SWIZZLE_NONE		0
851718dceddSDavid Howells #define I915_BIT_6_SWIZZLE_9		1
852718dceddSDavid Howells #define I915_BIT_6_SWIZZLE_9_10		2
853718dceddSDavid Howells #define I915_BIT_6_SWIZZLE_9_11		3
854718dceddSDavid Howells #define I915_BIT_6_SWIZZLE_9_10_11	4
855718dceddSDavid Howells /* Not seen by userland */
856718dceddSDavid Howells #define I915_BIT_6_SWIZZLE_UNKNOWN	5
857718dceddSDavid Howells /* Seen by userland. */
858718dceddSDavid Howells #define I915_BIT_6_SWIZZLE_9_17		6
859718dceddSDavid Howells #define I915_BIT_6_SWIZZLE_9_10_17	7
860718dceddSDavid Howells 
861718dceddSDavid Howells struct drm_i915_gem_set_tiling {
862718dceddSDavid Howells 	/** Handle of the buffer to have its tiling state updated */
863718dceddSDavid Howells 	__u32 handle;
864718dceddSDavid Howells 
865718dceddSDavid Howells 	/**
866718dceddSDavid Howells 	 * Tiling mode for the object (I915_TILING_NONE, I915_TILING_X,
867718dceddSDavid Howells 	 * I915_TILING_Y).
868718dceddSDavid Howells 	 *
869718dceddSDavid Howells 	 * This value is to be set on request, and will be updated by the
870718dceddSDavid Howells 	 * kernel on successful return with the actual chosen tiling layout.
871718dceddSDavid Howells 	 *
872718dceddSDavid Howells 	 * The tiling mode may be demoted to I915_TILING_NONE when the system
873718dceddSDavid Howells 	 * has bit 6 swizzling that can't be managed correctly by GEM.
874718dceddSDavid Howells 	 *
875718dceddSDavid Howells 	 * Buffer contents become undefined when changing tiling_mode.
876718dceddSDavid Howells 	 */
877718dceddSDavid Howells 	__u32 tiling_mode;
878718dceddSDavid Howells 
879718dceddSDavid Howells 	/**
880718dceddSDavid Howells 	 * Stride in bytes for the object when in I915_TILING_X or
881718dceddSDavid Howells 	 * I915_TILING_Y.
882718dceddSDavid Howells 	 */
883718dceddSDavid Howells 	__u32 stride;
884718dceddSDavid Howells 
885718dceddSDavid Howells 	/**
886718dceddSDavid Howells 	 * Returned address bit 6 swizzling required for CPU access through
887718dceddSDavid Howells 	 * mmap mapping.
888718dceddSDavid Howells 	 */
889718dceddSDavid Howells 	__u32 swizzle_mode;
890718dceddSDavid Howells };
891718dceddSDavid Howells 
892718dceddSDavid Howells struct drm_i915_gem_get_tiling {
893718dceddSDavid Howells 	/** Handle of the buffer to get tiling state for. */
894718dceddSDavid Howells 	__u32 handle;
895718dceddSDavid Howells 
896718dceddSDavid Howells 	/**
897718dceddSDavid Howells 	 * Current tiling mode for the object (I915_TILING_NONE, I915_TILING_X,
898718dceddSDavid Howells 	 * I915_TILING_Y).
899718dceddSDavid Howells 	 */
900718dceddSDavid Howells 	__u32 tiling_mode;
901718dceddSDavid Howells 
902718dceddSDavid Howells 	/**
903718dceddSDavid Howells 	 * Returned address bit 6 swizzling required for CPU access through
904718dceddSDavid Howells 	 * mmap mapping.
905718dceddSDavid Howells 	 */
906718dceddSDavid Howells 	__u32 swizzle_mode;
90770f2f5c7SChris Wilson 
90870f2f5c7SChris Wilson 	/**
90970f2f5c7SChris Wilson 	 * Returned address bit 6 swizzling required for CPU access through
91070f2f5c7SChris Wilson 	 * mmap mapping whilst bound.
91170f2f5c7SChris Wilson 	 */
91270f2f5c7SChris Wilson 	__u32 phys_swizzle_mode;
913718dceddSDavid Howells };
914718dceddSDavid Howells 
915718dceddSDavid Howells struct drm_i915_gem_get_aperture {
916718dceddSDavid Howells 	/** Total size of the aperture used by i915_gem_execbuffer, in bytes */
917718dceddSDavid Howells 	__u64 aper_size;
918718dceddSDavid Howells 
919718dceddSDavid Howells 	/**
920718dceddSDavid Howells 	 * Available space in the aperture used by i915_gem_execbuffer, in
921718dceddSDavid Howells 	 * bytes
922718dceddSDavid Howells 	 */
923718dceddSDavid Howells 	__u64 aper_available_size;
924718dceddSDavid Howells };
925718dceddSDavid Howells 
926718dceddSDavid Howells struct drm_i915_get_pipe_from_crtc_id {
927718dceddSDavid Howells 	/** ID of CRTC being requested **/
928718dceddSDavid Howells 	__u32 crtc_id;
929718dceddSDavid Howells 
930718dceddSDavid Howells 	/** pipe of requested CRTC **/
931718dceddSDavid Howells 	__u32 pipe;
932718dceddSDavid Howells };
933718dceddSDavid Howells 
934718dceddSDavid Howells #define I915_MADV_WILLNEED 0
935718dceddSDavid Howells #define I915_MADV_DONTNEED 1
936718dceddSDavid Howells #define __I915_MADV_PURGED 2 /* internal state */
937718dceddSDavid Howells 
938718dceddSDavid Howells struct drm_i915_gem_madvise {
939718dceddSDavid Howells 	/** Handle of the buffer to change the backing store advice */
940718dceddSDavid Howells 	__u32 handle;
941718dceddSDavid Howells 
942718dceddSDavid Howells 	/* Advice: either the buffer will be needed again in the near future,
943718dceddSDavid Howells 	 *         or wont be and could be discarded under memory pressure.
944718dceddSDavid Howells 	 */
945718dceddSDavid Howells 	__u32 madv;
946718dceddSDavid Howells 
947718dceddSDavid Howells 	/** Whether the backing store still exists. */
948718dceddSDavid Howells 	__u32 retained;
949718dceddSDavid Howells };
950718dceddSDavid Howells 
951718dceddSDavid Howells /* flags */
952718dceddSDavid Howells #define I915_OVERLAY_TYPE_MASK 		0xff
953718dceddSDavid Howells #define I915_OVERLAY_YUV_PLANAR 	0x01
954718dceddSDavid Howells #define I915_OVERLAY_YUV_PACKED 	0x02
955718dceddSDavid Howells #define I915_OVERLAY_RGB		0x03
956718dceddSDavid Howells 
957718dceddSDavid Howells #define I915_OVERLAY_DEPTH_MASK		0xff00
958718dceddSDavid Howells #define I915_OVERLAY_RGB24		0x1000
959718dceddSDavid Howells #define I915_OVERLAY_RGB16		0x2000
960718dceddSDavid Howells #define I915_OVERLAY_RGB15		0x3000
961718dceddSDavid Howells #define I915_OVERLAY_YUV422		0x0100
962718dceddSDavid Howells #define I915_OVERLAY_YUV411		0x0200
963718dceddSDavid Howells #define I915_OVERLAY_YUV420		0x0300
964718dceddSDavid Howells #define I915_OVERLAY_YUV410		0x0400
965718dceddSDavid Howells 
966718dceddSDavid Howells #define I915_OVERLAY_SWAP_MASK		0xff0000
967718dceddSDavid Howells #define I915_OVERLAY_NO_SWAP		0x000000
968718dceddSDavid Howells #define I915_OVERLAY_UV_SWAP		0x010000
969718dceddSDavid Howells #define I915_OVERLAY_Y_SWAP		0x020000
970718dceddSDavid Howells #define I915_OVERLAY_Y_AND_UV_SWAP	0x030000
971718dceddSDavid Howells 
972718dceddSDavid Howells #define I915_OVERLAY_FLAGS_MASK		0xff000000
973718dceddSDavid Howells #define I915_OVERLAY_ENABLE		0x01000000
974718dceddSDavid Howells 
975718dceddSDavid Howells struct drm_intel_overlay_put_image {
976718dceddSDavid Howells 	/* various flags and src format description */
977718dceddSDavid Howells 	__u32 flags;
978718dceddSDavid Howells 	/* source picture description */
979718dceddSDavid Howells 	__u32 bo_handle;
980718dceddSDavid Howells 	/* stride values and offsets are in bytes, buffer relative */
981718dceddSDavid Howells 	__u16 stride_Y; /* stride for packed formats */
982718dceddSDavid Howells 	__u16 stride_UV;
983718dceddSDavid Howells 	__u32 offset_Y; /* offset for packet formats */
984718dceddSDavid Howells 	__u32 offset_U;
985718dceddSDavid Howells 	__u32 offset_V;
986718dceddSDavid Howells 	/* in pixels */
987718dceddSDavid Howells 	__u16 src_width;
988718dceddSDavid Howells 	__u16 src_height;
989718dceddSDavid Howells 	/* to compensate the scaling factors for partially covered surfaces */
990718dceddSDavid Howells 	__u16 src_scan_width;
991718dceddSDavid Howells 	__u16 src_scan_height;
992718dceddSDavid Howells 	/* output crtc description */
993718dceddSDavid Howells 	__u32 crtc_id;
994718dceddSDavid Howells 	__u16 dst_x;
995718dceddSDavid Howells 	__u16 dst_y;
996718dceddSDavid Howells 	__u16 dst_width;
997718dceddSDavid Howells 	__u16 dst_height;
998718dceddSDavid Howells };
999718dceddSDavid Howells 
1000718dceddSDavid Howells /* flags */
1001718dceddSDavid Howells #define I915_OVERLAY_UPDATE_ATTRS	(1<<0)
1002718dceddSDavid Howells #define I915_OVERLAY_UPDATE_GAMMA	(1<<1)
1003ea9da4e4SChris Wilson #define I915_OVERLAY_DISABLE_DEST_COLORKEY	(1<<2)
1004718dceddSDavid Howells struct drm_intel_overlay_attrs {
1005718dceddSDavid Howells 	__u32 flags;
1006718dceddSDavid Howells 	__u32 color_key;
1007718dceddSDavid Howells 	__s32 brightness;
1008718dceddSDavid Howells 	__u32 contrast;
1009718dceddSDavid Howells 	__u32 saturation;
1010718dceddSDavid Howells 	__u32 gamma0;
1011718dceddSDavid Howells 	__u32 gamma1;
1012718dceddSDavid Howells 	__u32 gamma2;
1013718dceddSDavid Howells 	__u32 gamma3;
1014718dceddSDavid Howells 	__u32 gamma4;
1015718dceddSDavid Howells 	__u32 gamma5;
1016718dceddSDavid Howells };
1017718dceddSDavid Howells 
1018718dceddSDavid Howells /*
1019718dceddSDavid Howells  * Intel sprite handling
1020718dceddSDavid Howells  *
1021718dceddSDavid Howells  * Color keying works with a min/mask/max tuple.  Both source and destination
1022718dceddSDavid Howells  * color keying is allowed.
1023718dceddSDavid Howells  *
1024718dceddSDavid Howells  * Source keying:
1025718dceddSDavid Howells  * Sprite pixels within the min & max values, masked against the color channels
1026718dceddSDavid Howells  * specified in the mask field, will be transparent.  All other pixels will
1027718dceddSDavid Howells  * be displayed on top of the primary plane.  For RGB surfaces, only the min
1028718dceddSDavid Howells  * and mask fields will be used; ranged compares are not allowed.
1029718dceddSDavid Howells  *
1030718dceddSDavid Howells  * Destination keying:
1031718dceddSDavid Howells  * Primary plane pixels that match the min value, masked against the color
1032718dceddSDavid Howells  * channels specified in the mask field, will be replaced by corresponding
1033718dceddSDavid Howells  * pixels from the sprite plane.
1034718dceddSDavid Howells  *
1035718dceddSDavid Howells  * Note that source & destination keying are exclusive; only one can be
1036718dceddSDavid Howells  * active on a given plane.
1037718dceddSDavid Howells  */
1038718dceddSDavid Howells 
1039718dceddSDavid Howells #define I915_SET_COLORKEY_NONE		(1<<0) /* disable color key matching */
1040718dceddSDavid Howells #define I915_SET_COLORKEY_DESTINATION	(1<<1)
1041718dceddSDavid Howells #define I915_SET_COLORKEY_SOURCE	(1<<2)
1042718dceddSDavid Howells struct drm_intel_sprite_colorkey {
1043718dceddSDavid Howells 	__u32 plane_id;
1044718dceddSDavid Howells 	__u32 min_value;
1045718dceddSDavid Howells 	__u32 channel_mask;
1046718dceddSDavid Howells 	__u32 max_value;
1047718dceddSDavid Howells 	__u32 flags;
1048718dceddSDavid Howells };
1049718dceddSDavid Howells 
1050718dceddSDavid Howells struct drm_i915_gem_wait {
1051718dceddSDavid Howells 	/** Handle of BO we shall wait on */
1052718dceddSDavid Howells 	__u32 bo_handle;
1053718dceddSDavid Howells 	__u32 flags;
1054718dceddSDavid Howells 	/** Number of nanoseconds to wait, Returns time remaining. */
1055718dceddSDavid Howells 	__s64 timeout_ns;
1056718dceddSDavid Howells };
1057718dceddSDavid Howells 
1058718dceddSDavid Howells struct drm_i915_gem_context_create {
1059718dceddSDavid Howells 	/*  output: id of new context*/
1060718dceddSDavid Howells 	__u32 ctx_id;
1061718dceddSDavid Howells 	__u32 pad;
1062718dceddSDavid Howells };
1063718dceddSDavid Howells 
1064718dceddSDavid Howells struct drm_i915_gem_context_destroy {
1065718dceddSDavid Howells 	__u32 ctx_id;
1066718dceddSDavid Howells 	__u32 pad;
1067718dceddSDavid Howells };
1068718dceddSDavid Howells 
1069718dceddSDavid Howells struct drm_i915_reg_read {
1070718dceddSDavid Howells 	__u64 offset;
1071718dceddSDavid Howells 	__u64 val; /* Return value */
1072718dceddSDavid Howells };
1073648a9bc5SChris Wilson /* Known registers:
1074648a9bc5SChris Wilson  *
1075648a9bc5SChris Wilson  * Render engine timestamp - 0x2358 + 64bit - gen7+
1076648a9bc5SChris Wilson  * - Note this register returns an invalid value if using the default
1077648a9bc5SChris Wilson  *   single instruction 8byte read, in order to workaround that use
1078648a9bc5SChris Wilson  *   offset (0x2538 | 1) instead.
1079648a9bc5SChris Wilson  *
1080648a9bc5SChris Wilson  */
1081b6359918SMika Kuoppala 
1082b6359918SMika Kuoppala struct drm_i915_reset_stats {
1083b6359918SMika Kuoppala 	__u32 ctx_id;
1084b6359918SMika Kuoppala 	__u32 flags;
1085b6359918SMika Kuoppala 
1086b6359918SMika Kuoppala 	/* All resets since boot/module reload, for all contexts */
1087b6359918SMika Kuoppala 	__u32 reset_count;
1088b6359918SMika Kuoppala 
1089b6359918SMika Kuoppala 	/* Number of batches lost when active in GPU, for this context */
1090b6359918SMika Kuoppala 	__u32 batch_active;
1091b6359918SMika Kuoppala 
1092b6359918SMika Kuoppala 	/* Number of batches lost pending for execution, for this context */
1093b6359918SMika Kuoppala 	__u32 batch_pending;
1094b6359918SMika Kuoppala 
1095b6359918SMika Kuoppala 	__u32 pad;
1096b6359918SMika Kuoppala };
1097b6359918SMika Kuoppala 
10985cc9ed4bSChris Wilson struct drm_i915_gem_userptr {
10995cc9ed4bSChris Wilson 	__u64 user_ptr;
11005cc9ed4bSChris Wilson 	__u64 user_size;
11015cc9ed4bSChris Wilson 	__u32 flags;
11025cc9ed4bSChris Wilson #define I915_USERPTR_READ_ONLY 0x1
11035cc9ed4bSChris Wilson #define I915_USERPTR_UNSYNCHRONIZED 0x80000000
11045cc9ed4bSChris Wilson 	/**
11055cc9ed4bSChris Wilson 	 * Returned handle for the object.
11065cc9ed4bSChris Wilson 	 *
11075cc9ed4bSChris Wilson 	 * Object handles are nonzero.
11085cc9ed4bSChris Wilson 	 */
11095cc9ed4bSChris Wilson 	__u32 handle;
11105cc9ed4bSChris Wilson };
11115cc9ed4bSChris Wilson 
1112c9dc0f35SChris Wilson struct drm_i915_gem_context_param {
1113c9dc0f35SChris Wilson 	__u32 ctx_id;
1114c9dc0f35SChris Wilson 	__u32 size;
1115c9dc0f35SChris Wilson 	__u64 param;
1116c9dc0f35SChris Wilson #define I915_CONTEXT_PARAM_BAN_PERIOD 0x1
1117c9dc0f35SChris Wilson 	__u64 value;
1118c9dc0f35SChris Wilson };
1119c9dc0f35SChris Wilson 
1120718dceddSDavid Howells #endif /* _UAPI_I915_DRM_H_ */
1121