1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27#ifndef _UAPI_I915_DRM_H_
28#define _UAPI_I915_DRM_H_
29
30#include "drm.h"
31
32#if defined(__cplusplus)
33extern "C" {
34#endif
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61#define I915_L3_PARITY_UEVENT "L3_PARITY_ERROR"
62#define I915_ERROR_UEVENT "ERROR"
63#define I915_RESET_UEVENT "RESET"
64
65
66
67
68
69enum i915_mocs_table_index {
70
71
72
73
74 I915_MOCS_UNCACHED,
75
76
77
78
79
80 I915_MOCS_PTE,
81
82
83
84
85
86 I915_MOCS_CACHED,
87};
88
89
90
91
92
93
94
95
96enum drm_i915_gem_engine_class {
97 I915_ENGINE_CLASS_RENDER = 0,
98 I915_ENGINE_CLASS_COPY = 1,
99 I915_ENGINE_CLASS_VIDEO = 2,
100 I915_ENGINE_CLASS_VIDEO_ENHANCE = 3,
101
102 I915_ENGINE_CLASS_INVALID = -1
103};
104
105
106
107
108
109
110enum drm_i915_pmu_engine_sample {
111 I915_SAMPLE_BUSY = 0,
112 I915_SAMPLE_WAIT = 1,
113 I915_SAMPLE_SEMA = 2
114};
115
116#define I915_PMU_SAMPLE_BITS (4)
117#define I915_PMU_SAMPLE_MASK (0xf)
118#define I915_PMU_SAMPLE_INSTANCE_BITS (8)
119#define I915_PMU_CLASS_SHIFT \
120 (I915_PMU_SAMPLE_BITS + I915_PMU_SAMPLE_INSTANCE_BITS)
121
122#define __I915_PMU_ENGINE(class, instance, sample) \
123 ((class) << I915_PMU_CLASS_SHIFT | \
124 (instance) << I915_PMU_SAMPLE_BITS | \
125 (sample))
126
127#define I915_PMU_ENGINE_BUSY(class, instance) \
128 __I915_PMU_ENGINE(class, instance, I915_SAMPLE_BUSY)
129
130#define I915_PMU_ENGINE_WAIT(class, instance) \
131 __I915_PMU_ENGINE(class, instance, I915_SAMPLE_WAIT)
132
133#define I915_PMU_ENGINE_SEMA(class, instance) \
134 __I915_PMU_ENGINE(class, instance, I915_SAMPLE_SEMA)
135
136#define __I915_PMU_OTHER(x) (__I915_PMU_ENGINE(0xff, 0xff, 0xf) + 1 + (x))
137
138#define I915_PMU_ACTUAL_FREQUENCY __I915_PMU_OTHER(0)
139#define I915_PMU_REQUESTED_FREQUENCY __I915_PMU_OTHER(1)
140#define I915_PMU_INTERRUPTS __I915_PMU_OTHER(2)
141#define I915_PMU_RC6_RESIDENCY __I915_PMU_OTHER(3)
142
143#define I915_PMU_LAST I915_PMU_RC6_RESIDENCY
144
145
146
147#define I915_NR_TEX_REGIONS 255
148
149#define I915_LOG_MIN_TEX_REGION_SIZE 14
150
151typedef struct _drm_i915_init {
152 enum {
153 I915_INIT_DMA = 0x01,
154 I915_CLEANUP_DMA = 0x02,
155 I915_RESUME_DMA = 0x03
156 } func;
157 unsigned int mmio_offset;
158 int sarea_priv_offset;
159 unsigned int ring_start;
160 unsigned int ring_end;
161 unsigned int ring_size;
162 unsigned int front_offset;
163 unsigned int back_offset;
164 unsigned int depth_offset;
165 unsigned int w;
166 unsigned int h;
167 unsigned int pitch;
168 unsigned int pitch_bits;
169 unsigned int back_pitch;
170 unsigned int depth_pitch;
171 unsigned int cpp;
172 unsigned int chipset;
173} drm_i915_init_t;
174
175typedef struct _drm_i915_sarea {
176 struct drm_tex_region texList[I915_NR_TEX_REGIONS + 1];
177 int last_upload;
178 int last_enqueue;
179 int last_dispatch;
180 int ctxOwner;
181 int texAge;
182 int pf_enabled;
183 int pf_active;
184 int pf_current_page;
185 int perf_boxes;
186 int width, height;
187
188 drm_handle_t front_handle;
189 int front_offset;
190 int front_size;
191
192 drm_handle_t back_handle;
193 int back_offset;
194 int back_size;
195
196 drm_handle_t depth_handle;
197 int depth_offset;
198 int depth_size;
199
200 drm_handle_t tex_handle;
201 int tex_offset;
202 int tex_size;
203 int log_tex_granularity;
204 int pitch;
205 int rotation;
206 int rotated_offset;
207 int rotated_size;
208 int rotated_pitch;
209 int virtualX, virtualY;
210
211 unsigned int front_tiled;
212 unsigned int back_tiled;
213 unsigned int depth_tiled;
214 unsigned int rotated_tiled;
215 unsigned int rotated2_tiled;
216
217 int pipeA_x;
218 int pipeA_y;
219 int pipeA_w;
220 int pipeA_h;
221 int pipeB_x;
222 int pipeB_y;
223 int pipeB_w;
224 int pipeB_h;
225
226
227 drm_handle_t unused_handle;
228 __u32 unused1, unused2, unused3;
229
230
231
232
233 __u32 front_bo_handle;
234 __u32 back_bo_handle;
235 __u32 unused_bo_handle;
236 __u32 depth_bo_handle;
237
238} drm_i915_sarea_t;
239
240
241#define planeA_x pipeA_x
242#define planeA_y pipeA_y
243#define planeA_w pipeA_w
244#define planeA_h pipeA_h
245#define planeB_x pipeB_x
246#define planeB_y pipeB_y
247#define planeB_w pipeB_w
248#define planeB_h pipeB_h
249
250
251
252#define I915_BOX_RING_EMPTY 0x1
253#define I915_BOX_FLIP 0x2
254#define I915_BOX_WAIT 0x4
255#define I915_BOX_TEXTURE_LOAD 0x8
256#define I915_BOX_LOST_CONTEXT 0x10
257
258
259
260
261
262
263
264
265#define DRM_I915_INIT 0x00
266#define DRM_I915_FLUSH 0x01
267#define DRM_I915_FLIP 0x02
268#define DRM_I915_BATCHBUFFER 0x03
269#define DRM_I915_IRQ_EMIT 0x04
270#define DRM_I915_IRQ_WAIT 0x05
271#define DRM_I915_GETPARAM 0x06
272#define DRM_I915_SETPARAM 0x07
273#define DRM_I915_ALLOC 0x08
274#define DRM_I915_FREE 0x09
275#define DRM_I915_INIT_HEAP 0x0a
276#define DRM_I915_CMDBUFFER 0x0b
277#define DRM_I915_DESTROY_HEAP 0x0c
278#define DRM_I915_SET_VBLANK_PIPE 0x0d
279#define DRM_I915_GET_VBLANK_PIPE 0x0e
280#define DRM_I915_VBLANK_SWAP 0x0f
281#define DRM_I915_HWS_ADDR 0x11
282#define DRM_I915_GEM_INIT 0x13
283#define DRM_I915_GEM_EXECBUFFER 0x14
284#define DRM_I915_GEM_PIN 0x15
285#define DRM_I915_GEM_UNPIN 0x16
286#define DRM_I915_GEM_BUSY 0x17
287#define DRM_I915_GEM_THROTTLE 0x18
288#define DRM_I915_GEM_ENTERVT 0x19
289#define DRM_I915_GEM_LEAVEVT 0x1a
290#define DRM_I915_GEM_CREATE 0x1b
291#define DRM_I915_GEM_PREAD 0x1c
292#define DRM_I915_GEM_PWRITE 0x1d
293#define DRM_I915_GEM_MMAP 0x1e
294#define DRM_I915_GEM_SET_DOMAIN 0x1f
295#define DRM_I915_GEM_SW_FINISH 0x20
296#define DRM_I915_GEM_SET_TILING 0x21
297#define DRM_I915_GEM_GET_TILING 0x22
298#define DRM_I915_GEM_GET_APERTURE 0x23
299#define DRM_I915_GEM_MMAP_GTT 0x24
300#define DRM_I915_GET_PIPE_FROM_CRTC_ID 0x25
301#define DRM_I915_GEM_MADVISE 0x26
302#define DRM_I915_OVERLAY_PUT_IMAGE 0x27
303#define DRM_I915_OVERLAY_ATTRS 0x28
304#define DRM_I915_GEM_EXECBUFFER2 0x29
305#define DRM_I915_GEM_EXECBUFFER2_WR DRM_I915_GEM_EXECBUFFER2
306#define DRM_I915_GET_SPRITE_COLORKEY 0x2a
307#define DRM_I915_SET_SPRITE_COLORKEY 0x2b
308#define DRM_I915_GEM_WAIT 0x2c
309#define DRM_I915_GEM_CONTEXT_CREATE 0x2d
310#define DRM_I915_GEM_CONTEXT_DESTROY 0x2e
311#define DRM_I915_GEM_SET_CACHING 0x2f
312#define DRM_I915_GEM_GET_CACHING 0x30
313#define DRM_I915_REG_READ 0x31
314#define DRM_I915_GET_RESET_STATS 0x32
315#define DRM_I915_GEM_USERPTR 0x33
316#define DRM_I915_GEM_CONTEXT_GETPARAM 0x34
317#define DRM_I915_GEM_CONTEXT_SETPARAM 0x35
318#define DRM_I915_PERF_OPEN 0x36
319#define DRM_I915_PERF_ADD_CONFIG 0x37
320#define DRM_I915_PERF_REMOVE_CONFIG 0x38
321#define DRM_I915_QUERY 0x39
322
323#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
324#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
325#define DRM_IOCTL_I915_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLIP)
326#define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t)
327#define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t)
328#define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t)
329#define DRM_IOCTL_I915_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GETPARAM, drm_i915_getparam_t)
330#define DRM_IOCTL_I915_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SETPARAM, drm_i915_setparam_t)
331#define DRM_IOCTL_I915_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_ALLOC, drm_i915_mem_alloc_t)
332#define DRM_IOCTL_I915_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t)
333#define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t)
334#define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t)
335#define DRM_IOCTL_I915_DESTROY_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_DESTROY_HEAP, drm_i915_mem_destroy_heap_t)
336#define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
337#define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
338#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t)
339#define DRM_IOCTL_I915_HWS_ADDR DRM_IOW(DRM_COMMAND_BASE + DRM_I915_HWS_ADDR, struct drm_i915_gem_init)
340#define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init)
341#define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer)
342#define DRM_IOCTL_I915_GEM_EXECBUFFER2 DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2)
343#define DRM_IOCTL_I915_GEM_EXECBUFFER2_WR DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2_WR, struct drm_i915_gem_execbuffer2)
344#define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin)
345#define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin)
346#define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy)
347#define DRM_IOCTL_I915_GEM_SET_CACHING DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_SET_CACHING, struct drm_i915_gem_caching)
348#define DRM_IOCTL_I915_GEM_GET_CACHING DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_GET_CACHING, struct drm_i915_gem_caching)
349#define DRM_IOCTL_I915_GEM_THROTTLE DRM_IO ( DRM_COMMAND_BASE + DRM_I915_GEM_THROTTLE)
350#define DRM_IOCTL_I915_GEM_ENTERVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_ENTERVT)
351#define DRM_IOCTL_I915_GEM_LEAVEVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_LEAVEVT)
352#define DRM_IOCTL_I915_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct drm_i915_gem_create)
353#define DRM_IOCTL_I915_GEM_PREAD DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PREAD, struct drm_i915_gem_pread)
354#define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite)
355#define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap)
356#define DRM_IOCTL_I915_GEM_MMAP_GTT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt)
357#define DRM_IOCTL_I915_GEM_SET_DOMAIN DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain)
358#define DRM_IOCTL_I915_GEM_SW_FINISH DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish)
359#define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling)
360#define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling)
361#define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture)
362#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)
363#define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise)
364#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image)
365#define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs)
366#define DRM_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
367#define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
368#define DRM_IOCTL_I915_GEM_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_WAIT, struct drm_i915_gem_wait)
369#define DRM_IOCTL_I915_GEM_CONTEXT_CREATE DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create)
370#define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy)
371#define DRM_IOCTL_I915_REG_READ DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read)
372#define DRM_IOCTL_I915_GET_RESET_STATS DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GET_RESET_STATS, struct drm_i915_reset_stats)
373#define DRM_IOCTL_I915_GEM_USERPTR DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_USERPTR, struct drm_i915_gem_userptr)
374#define DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_GETPARAM, struct drm_i915_gem_context_param)
375#define DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_SETPARAM, struct drm_i915_gem_context_param)
376#define DRM_IOCTL_I915_PERF_OPEN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_OPEN, struct drm_i915_perf_open_param)
377#define DRM_IOCTL_I915_PERF_ADD_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_ADD_CONFIG, struct drm_i915_perf_oa_config)
378#define DRM_IOCTL_I915_PERF_REMOVE_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_REMOVE_CONFIG, __u64)
379#define DRM_IOCTL_I915_QUERY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_QUERY, struct drm_i915_query)
380
381
382
383
384typedef struct drm_i915_batchbuffer {
385 int start;
386 int used;
387 int DR1;
388 int DR4;
389 int num_cliprects;
390 struct drm_clip_rect __user *cliprects;
391} drm_i915_batchbuffer_t;
392
393
394
395
396typedef struct _drm_i915_cmdbuffer {
397 char __user *buf;
398 int sz;
399 int DR1;
400 int DR4;
401 int num_cliprects;
402 struct drm_clip_rect __user *cliprects;
403} drm_i915_cmdbuffer_t;
404
405
406
407typedef struct drm_i915_irq_emit {
408 int __user *irq_seq;
409} drm_i915_irq_emit_t;
410
411typedef struct drm_i915_irq_wait {
412 int irq_seq;
413} drm_i915_irq_wait_t;
414
415
416
417#define I915_PARAM_IRQ_ACTIVE 1
418#define I915_PARAM_ALLOW_BATCHBUFFER 2
419#define I915_PARAM_LAST_DISPATCH 3
420#define I915_PARAM_CHIPSET_ID 4
421#define I915_PARAM_HAS_GEM 5
422#define I915_PARAM_NUM_FENCES_AVAIL 6
423#define I915_PARAM_HAS_OVERLAY 7
424#define I915_PARAM_HAS_PAGEFLIPPING 8
425#define I915_PARAM_HAS_EXECBUF2 9
426#define I915_PARAM_HAS_BSD 10
427#define I915_PARAM_HAS_BLT 11
428#define I915_PARAM_HAS_RELAXED_FENCING 12
429#define I915_PARAM_HAS_COHERENT_RINGS 13
430#define I915_PARAM_HAS_EXEC_CONSTANTS 14
431#define I915_PARAM_HAS_RELAXED_DELTA 15
432#define I915_PARAM_HAS_GEN7_SOL_RESET 16
433#define I915_PARAM_HAS_LLC 17
434#define I915_PARAM_HAS_ALIASING_PPGTT 18
435#define I915_PARAM_HAS_WAIT_TIMEOUT 19
436#define I915_PARAM_HAS_SEMAPHORES 20
437#define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21
438#define I915_PARAM_HAS_VEBOX 22
439#define I915_PARAM_HAS_SECURE_BATCHES 23
440#define I915_PARAM_HAS_PINNED_BATCHES 24
441#define I915_PARAM_HAS_EXEC_NO_RELOC 25
442#define I915_PARAM_HAS_EXEC_HANDLE_LUT 26
443#define I915_PARAM_HAS_WT 27
444#define I915_PARAM_CMD_PARSER_VERSION 28
445#define I915_PARAM_HAS_COHERENT_PHYS_GTT 29
446#define I915_PARAM_MMAP_VERSION 30
447#define I915_PARAM_HAS_BSD2 31
448#define I915_PARAM_REVISION 32
449#define I915_PARAM_SUBSLICE_TOTAL 33
450#define I915_PARAM_EU_TOTAL 34
451#define I915_PARAM_HAS_GPU_RESET 35
452#define I915_PARAM_HAS_RESOURCE_STREAMER 36
453#define I915_PARAM_HAS_EXEC_SOFTPIN 37
454#define I915_PARAM_HAS_POOLED_EU 38
455#define I915_PARAM_MIN_EU_IN_POOL 39
456#define I915_PARAM_MMAP_GTT_VERSION 40
457
458
459
460
461
462
463
464
465
466
467#define I915_PARAM_HAS_SCHEDULER 41
468#define I915_SCHEDULER_CAP_ENABLED (1ul << 0)
469#define I915_SCHEDULER_CAP_PRIORITY (1ul << 1)
470#define I915_SCHEDULER_CAP_PREEMPTION (1ul << 2)
471
472#define I915_PARAM_HUC_STATUS 42
473
474
475
476
477
478#define I915_PARAM_HAS_EXEC_ASYNC 43
479
480
481
482
483
484
485#define I915_PARAM_HAS_EXEC_FENCE 44
486
487
488
489
490
491#define I915_PARAM_HAS_EXEC_CAPTURE 45
492
493#define I915_PARAM_SLICE_MASK 46
494
495
496
497
498#define I915_PARAM_SUBSLICE_MASK 47
499
500
501
502
503
504#define I915_PARAM_HAS_EXEC_BATCH_FIRST 48
505
506
507
508
509#define I915_PARAM_HAS_EXEC_FENCE_ARRAY 49
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524#define I915_PARAM_HAS_CONTEXT_ISOLATION 50
525
526
527
528
529
530#define I915_PARAM_CS_TIMESTAMP_FREQUENCY 51
531
532typedef struct drm_i915_getparam {
533 __s32 param;
534
535
536
537
538 int __user *value;
539} drm_i915_getparam_t;
540
541
542
543#define I915_SETPARAM_USE_MI_BATCHBUFFER_START 1
544#define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY 2
545#define I915_SETPARAM_ALLOW_BATCHBUFFER 3
546#define I915_SETPARAM_NUM_USED_FENCES 4
547
548typedef struct drm_i915_setparam {
549 int param;
550 int value;
551} drm_i915_setparam_t;
552
553
554
555#define I915_MEM_REGION_AGP 1
556
557typedef struct drm_i915_mem_alloc {
558 int region;
559 int alignment;
560 int size;
561 int __user *region_offset;
562} drm_i915_mem_alloc_t;
563
564typedef struct drm_i915_mem_free {
565 int region;
566 int region_offset;
567} drm_i915_mem_free_t;
568
569typedef struct drm_i915_mem_init_heap {
570 int region;
571 int size;
572 int start;
573} drm_i915_mem_init_heap_t;
574
575
576
577
578typedef struct drm_i915_mem_destroy_heap {
579 int region;
580} drm_i915_mem_destroy_heap_t;
581
582
583
584#define DRM_I915_VBLANK_PIPE_A 1
585#define DRM_I915_VBLANK_PIPE_B 2
586
587typedef struct drm_i915_vblank_pipe {
588 int pipe;
589} drm_i915_vblank_pipe_t;
590
591
592
593typedef struct drm_i915_vblank_swap {
594 drm_drawable_t drawable;
595 enum drm_vblank_seq_type seqtype;
596 unsigned int sequence;
597} drm_i915_vblank_swap_t;
598
599typedef struct drm_i915_hws_addr {
600 __u64 addr;
601} drm_i915_hws_addr_t;
602
603struct drm_i915_gem_init {
604
605
606
607
608 __u64 gtt_start;
609
610
611
612
613 __u64 gtt_end;
614};
615
616struct drm_i915_gem_create {
617
618
619
620
621
622 __u64 size;
623
624
625
626
627
628 __u32 handle;
629 __u32 pad;
630};
631
632struct drm_i915_gem_pread {
633
634 __u32 handle;
635 __u32 pad;
636
637 __u64 offset;
638
639 __u64 size;
640
641
642
643
644
645 __u64 data_ptr;
646};
647
648struct drm_i915_gem_pwrite {
649
650 __u32 handle;
651 __u32 pad;
652
653 __u64 offset;
654
655 __u64 size;
656
657
658
659
660
661 __u64 data_ptr;
662};
663
664struct drm_i915_gem_mmap {
665
666 __u32 handle;
667 __u32 pad;
668
669 __u64 offset;
670
671
672
673
674
675 __u64 size;
676
677
678
679
680
681 __u64 addr_ptr;
682
683
684
685
686
687
688 __u64 flags;
689#define I915_MMAP_WC 0x1
690};
691
692struct drm_i915_gem_mmap_gtt {
693
694 __u32 handle;
695 __u32 pad;
696
697
698
699
700
701 __u64 offset;
702};
703
704struct drm_i915_gem_set_domain {
705
706 __u32 handle;
707
708
709 __u32 read_domains;
710
711
712 __u32 write_domain;
713};
714
715struct drm_i915_gem_sw_finish {
716
717 __u32 handle;
718};
719
720struct drm_i915_gem_relocation_entry {
721
722
723
724
725
726
727
728
729 __u32 target_handle;
730
731
732
733
734
735 __u32 delta;
736
737
738 __u64 offset;
739
740
741
742
743
744
745
746
747
748 __u64 presumed_offset;
749
750
751
752
753 __u32 read_domains;
754
755
756
757
758
759
760
761
762 __u32 write_domain;
763};
764
765
766
767
768
769
770
771
772
773#define I915_GEM_DOMAIN_CPU 0x00000001
774
775#define I915_GEM_DOMAIN_RENDER 0x00000002
776
777#define I915_GEM_DOMAIN_SAMPLER 0x00000004
778
779#define I915_GEM_DOMAIN_COMMAND 0x00000008
780
781#define I915_GEM_DOMAIN_INSTRUCTION 0x00000010
782
783#define I915_GEM_DOMAIN_VERTEX 0x00000020
784
785#define I915_GEM_DOMAIN_GTT 0x00000040
786
787#define I915_GEM_DOMAIN_WC 0x00000080
788
789
790struct drm_i915_gem_exec_object {
791
792
793
794
795 __u32 handle;
796
797
798 __u32 relocation_count;
799
800
801
802
803 __u64 relocs_ptr;
804
805
806 __u64 alignment;
807
808
809
810
811
812 __u64 offset;
813};
814
815struct drm_i915_gem_execbuffer {
816
817
818
819
820
821
822
823
824
825
826 __u64 buffers_ptr;
827 __u32 buffer_count;
828
829
830 __u32 batch_start_offset;
831
832 __u32 batch_len;
833 __u32 DR1;
834 __u32 DR4;
835 __u32 num_cliprects;
836
837 __u64 cliprects_ptr;
838};
839
840struct drm_i915_gem_exec_object2 {
841
842
843
844
845 __u32 handle;
846
847
848 __u32 relocation_count;
849
850
851
852
853 __u64 relocs_ptr;
854
855
856 __u64 alignment;
857
858
859
860
861
862
863
864
865
866 __u64 offset;
867
868#define EXEC_OBJECT_NEEDS_FENCE (1<<0)
869#define EXEC_OBJECT_NEEDS_GTT (1<<1)
870#define EXEC_OBJECT_WRITE (1<<2)
871#define EXEC_OBJECT_SUPPORTS_48B_ADDRESS (1<<3)
872#define EXEC_OBJECT_PINNED (1<<4)
873#define EXEC_OBJECT_PAD_TO_SIZE (1<<5)
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894#define EXEC_OBJECT_ASYNC (1<<6)
895
896
897
898
899
900
901#define EXEC_OBJECT_CAPTURE (1<<7)
902
903#define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_CAPTURE<<1)
904 __u64 flags;
905
906 union {
907 __u64 rsvd1;
908 __u64 pad_to_size;
909 };
910 __u64 rsvd2;
911};
912
913struct drm_i915_gem_exec_fence {
914
915
916
917 __u32 handle;
918
919#define I915_EXEC_FENCE_WAIT (1<<0)
920#define I915_EXEC_FENCE_SIGNAL (1<<1)
921#define __I915_EXEC_FENCE_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SIGNAL << 1))
922 __u32 flags;
923};
924
925struct drm_i915_gem_execbuffer2 {
926
927
928
929 __u64 buffers_ptr;
930 __u32 buffer_count;
931
932
933 __u32 batch_start_offset;
934
935 __u32 batch_len;
936 __u32 DR1;
937 __u32 DR4;
938 __u32 num_cliprects;
939
940
941
942
943
944 __u64 cliprects_ptr;
945#define I915_EXEC_RING_MASK (7<<0)
946#define I915_EXEC_DEFAULT (0<<0)
947#define I915_EXEC_RENDER (1<<0)
948#define I915_EXEC_BSD (2<<0)
949#define I915_EXEC_BLT (3<<0)
950#define I915_EXEC_VEBOX (4<<0)
951
952
953
954
955
956
957
958#define I915_EXEC_CONSTANTS_MASK (3<<6)
959#define I915_EXEC_CONSTANTS_REL_GENERAL (0<<6)
960#define I915_EXEC_CONSTANTS_ABSOLUTE (1<<6)
961#define I915_EXEC_CONSTANTS_REL_SURFACE (2<<6)
962 __u64 flags;
963 __u64 rsvd1;
964 __u64 rsvd2;
965};
966
967
968#define I915_EXEC_GEN7_SOL_RESET (1<<8)
969
970
971
972
973#define I915_EXEC_SECURE (1<<9)
974
975
976
977
978
979
980
981
982#define I915_EXEC_IS_PINNED (1<<10)
983
984
985
986
987
988
989#define I915_EXEC_NO_RELOC (1<<11)
990
991
992
993
994#define I915_EXEC_HANDLE_LUT (1<<12)
995
996
997#define I915_EXEC_BSD_SHIFT (13)
998#define I915_EXEC_BSD_MASK (3 << I915_EXEC_BSD_SHIFT)
999
1000#define I915_EXEC_BSD_DEFAULT (0 << I915_EXEC_BSD_SHIFT)
1001#define I915_EXEC_BSD_RING1 (1 << I915_EXEC_BSD_SHIFT)
1002#define I915_EXEC_BSD_RING2 (2 << I915_EXEC_BSD_SHIFT)
1003
1004
1005
1006
1007#define I915_EXEC_RESOURCE_STREAMER (1<<15)
1008
1009
1010
1011
1012
1013
1014
1015#define I915_EXEC_FENCE_IN (1<<16)
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032#define I915_EXEC_FENCE_OUT (1<<17)
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043#define I915_EXEC_BATCH_FIRST (1<<18)
1044
1045
1046
1047
1048
1049#define I915_EXEC_FENCE_ARRAY (1<<19)
1050
1051#define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_ARRAY<<1))
1052
1053#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff)
1054#define i915_execbuffer2_set_context_id(eb2, context) \
1055 (eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK
1056#define i915_execbuffer2_get_context_id(eb2) \
1057 ((eb2).rsvd1 & I915_EXEC_CONTEXT_ID_MASK)
1058
1059struct drm_i915_gem_pin {
1060
1061 __u32 handle;
1062 __u32 pad;
1063
1064
1065 __u64 alignment;
1066
1067
1068 __u64 offset;
1069};
1070
1071struct drm_i915_gem_unpin {
1072
1073 __u32 handle;
1074 __u32 pad;
1075};
1076
1077struct drm_i915_gem_busy {
1078
1079 __u32 handle;
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125 __u32 busy;
1126};
1127
1128
1129
1130
1131
1132
1133
1134#define I915_CACHING_NONE 0
1135
1136
1137
1138
1139
1140
1141
1142#define I915_CACHING_CACHED 1
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153#define I915_CACHING_DISPLAY 2
1154
1155struct drm_i915_gem_caching {
1156
1157
1158 __u32 handle;
1159
1160
1161
1162
1163
1164
1165
1166 __u32 caching;
1167};
1168
1169#define I915_TILING_NONE 0
1170#define I915_TILING_X 1
1171#define I915_TILING_Y 2
1172#define I915_TILING_LAST I915_TILING_Y
1173
1174#define I915_BIT_6_SWIZZLE_NONE 0
1175#define I915_BIT_6_SWIZZLE_9 1
1176#define I915_BIT_6_SWIZZLE_9_10 2
1177#define I915_BIT_6_SWIZZLE_9_11 3
1178#define I915_BIT_6_SWIZZLE_9_10_11 4
1179
1180#define I915_BIT_6_SWIZZLE_UNKNOWN 5
1181
1182#define I915_BIT_6_SWIZZLE_9_17 6
1183#define I915_BIT_6_SWIZZLE_9_10_17 7
1184
1185struct drm_i915_gem_set_tiling {
1186
1187 __u32 handle;
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201 __u32 tiling_mode;
1202
1203
1204
1205
1206
1207 __u32 stride;
1208
1209
1210
1211
1212
1213 __u32 swizzle_mode;
1214};
1215
1216struct drm_i915_gem_get_tiling {
1217
1218 __u32 handle;
1219
1220
1221
1222
1223
1224 __u32 tiling_mode;
1225
1226
1227
1228
1229
1230 __u32 swizzle_mode;
1231
1232
1233
1234
1235
1236 __u32 phys_swizzle_mode;
1237};
1238
1239struct drm_i915_gem_get_aperture {
1240
1241 __u64 aper_size;
1242
1243
1244
1245
1246
1247 __u64 aper_available_size;
1248};
1249
1250struct drm_i915_get_pipe_from_crtc_id {
1251
1252 __u32 crtc_id;
1253
1254
1255 __u32 pipe;
1256};
1257
1258#define I915_MADV_WILLNEED 0
1259#define I915_MADV_DONTNEED 1
1260#define __I915_MADV_PURGED 2
1261
1262struct drm_i915_gem_madvise {
1263
1264 __u32 handle;
1265
1266
1267
1268
1269 __u32 madv;
1270
1271
1272 __u32 retained;
1273};
1274
1275
1276#define I915_OVERLAY_TYPE_MASK 0xff
1277#define I915_OVERLAY_YUV_PLANAR 0x01
1278#define I915_OVERLAY_YUV_PACKED 0x02
1279#define I915_OVERLAY_RGB 0x03
1280
1281#define I915_OVERLAY_DEPTH_MASK 0xff00
1282#define I915_OVERLAY_RGB24 0x1000
1283#define I915_OVERLAY_RGB16 0x2000
1284#define I915_OVERLAY_RGB15 0x3000
1285#define I915_OVERLAY_YUV422 0x0100
1286#define I915_OVERLAY_YUV411 0x0200
1287#define I915_OVERLAY_YUV420 0x0300
1288#define I915_OVERLAY_YUV410 0x0400
1289
1290#define I915_OVERLAY_SWAP_MASK 0xff0000
1291#define I915_OVERLAY_NO_SWAP 0x000000
1292#define I915_OVERLAY_UV_SWAP 0x010000
1293#define I915_OVERLAY_Y_SWAP 0x020000
1294#define I915_OVERLAY_Y_AND_UV_SWAP 0x030000
1295
1296#define I915_OVERLAY_FLAGS_MASK 0xff000000
1297#define I915_OVERLAY_ENABLE 0x01000000
1298
1299struct drm_intel_overlay_put_image {
1300
1301 __u32 flags;
1302
1303 __u32 bo_handle;
1304
1305 __u16 stride_Y;
1306 __u16 stride_UV;
1307 __u32 offset_Y;
1308 __u32 offset_U;
1309 __u32 offset_V;
1310
1311 __u16 src_width;
1312 __u16 src_height;
1313
1314 __u16 src_scan_width;
1315 __u16 src_scan_height;
1316
1317 __u32 crtc_id;
1318 __u16 dst_x;
1319 __u16 dst_y;
1320 __u16 dst_width;
1321 __u16 dst_height;
1322};
1323
1324
1325#define I915_OVERLAY_UPDATE_ATTRS (1<<0)
1326#define I915_OVERLAY_UPDATE_GAMMA (1<<1)
1327#define I915_OVERLAY_DISABLE_DEST_COLORKEY (1<<2)
1328struct drm_intel_overlay_attrs {
1329 __u32 flags;
1330 __u32 color_key;
1331 __s32 brightness;
1332 __u32 contrast;
1333 __u32 saturation;
1334 __u32 gamma0;
1335 __u32 gamma1;
1336 __u32 gamma2;
1337 __u32 gamma3;
1338 __u32 gamma4;
1339 __u32 gamma5;
1340};
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363#define I915_SET_COLORKEY_NONE (1<<0)
1364
1365
1366#define I915_SET_COLORKEY_DESTINATION (1<<1)
1367#define I915_SET_COLORKEY_SOURCE (1<<2)
1368struct drm_intel_sprite_colorkey {
1369 __u32 plane_id;
1370 __u32 min_value;
1371 __u32 channel_mask;
1372 __u32 max_value;
1373 __u32 flags;
1374};
1375
1376struct drm_i915_gem_wait {
1377
1378 __u32 bo_handle;
1379 __u32 flags;
1380
1381 __s64 timeout_ns;
1382};
1383
1384struct drm_i915_gem_context_create {
1385
1386 __u32 ctx_id;
1387 __u32 pad;
1388};
1389
1390struct drm_i915_gem_context_destroy {
1391 __u32 ctx_id;
1392 __u32 pad;
1393};
1394
1395struct drm_i915_reg_read {
1396
1397
1398
1399
1400
1401
1402 __u64 offset;
1403#define I915_REG_READ_8B_WA (1ul << 0)
1404
1405 __u64 val;
1406};
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416struct drm_i915_reset_stats {
1417 __u32 ctx_id;
1418 __u32 flags;
1419
1420
1421 __u32 reset_count;
1422
1423
1424 __u32 batch_active;
1425
1426
1427 __u32 batch_pending;
1428
1429 __u32 pad;
1430};
1431
1432struct drm_i915_gem_userptr {
1433 __u64 user_ptr;
1434 __u64 user_size;
1435 __u32 flags;
1436#define I915_USERPTR_READ_ONLY 0x1
1437#define I915_USERPTR_UNSYNCHRONIZED 0x80000000
1438
1439
1440
1441
1442
1443 __u32 handle;
1444};
1445
1446struct drm_i915_gem_context_param {
1447 __u32 ctx_id;
1448 __u32 size;
1449 __u64 param;
1450#define I915_CONTEXT_PARAM_BAN_PERIOD 0x1
1451#define I915_CONTEXT_PARAM_NO_ZEROMAP 0x2
1452#define I915_CONTEXT_PARAM_GTT_SIZE 0x3
1453#define I915_CONTEXT_PARAM_NO_ERROR_CAPTURE 0x4
1454#define I915_CONTEXT_PARAM_BANNABLE 0x5
1455#define I915_CONTEXT_PARAM_PRIORITY 0x6
1456#define I915_CONTEXT_MAX_USER_PRIORITY 1023
1457#define I915_CONTEXT_DEFAULT_PRIORITY 0
1458#define I915_CONTEXT_MIN_USER_PRIORITY -1023
1459 __u64 value;
1460};
1461
1462enum drm_i915_oa_format {
1463 I915_OA_FORMAT_A13 = 1,
1464 I915_OA_FORMAT_A29,
1465 I915_OA_FORMAT_A13_B8_C8,
1466 I915_OA_FORMAT_B4_C8,
1467 I915_OA_FORMAT_A45_B8_C8,
1468 I915_OA_FORMAT_B4_C8_A16,
1469 I915_OA_FORMAT_C4_B8,
1470
1471
1472 I915_OA_FORMAT_A12,
1473 I915_OA_FORMAT_A12_B8_C8,
1474 I915_OA_FORMAT_A32u40_A4u32_B8_C8,
1475
1476 I915_OA_FORMAT_MAX
1477};
1478
1479enum drm_i915_perf_property_id {
1480
1481
1482
1483
1484
1485 DRM_I915_PERF_PROP_CTX_HANDLE = 1,
1486
1487
1488
1489
1490
1491 DRM_I915_PERF_PROP_SAMPLE_OA,
1492
1493
1494
1495
1496
1497 DRM_I915_PERF_PROP_OA_METRICS_SET,
1498
1499
1500
1501
1502 DRM_I915_PERF_PROP_OA_FORMAT,
1503
1504
1505
1506
1507
1508
1509
1510
1511 DRM_I915_PERF_PROP_OA_EXPONENT,
1512
1513 DRM_I915_PERF_PROP_MAX
1514};
1515
1516struct drm_i915_perf_open_param {
1517 __u32 flags;
1518#define I915_PERF_FLAG_FD_CLOEXEC (1<<0)
1519#define I915_PERF_FLAG_FD_NONBLOCK (1<<1)
1520#define I915_PERF_FLAG_DISABLED (1<<2)
1521
1522
1523 __u32 num_properties;
1524
1525
1526
1527
1528
1529 __u64 properties_ptr;
1530};
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542#define I915_PERF_IOCTL_ENABLE _IO('i', 0x0)
1543
1544
1545
1546
1547
1548
1549#define I915_PERF_IOCTL_DISABLE _IO('i', 0x1)
1550
1551
1552
1553
1554struct drm_i915_perf_record_header {
1555 __u32 type;
1556 __u16 pad;
1557 __u16 size;
1558};
1559
1560enum drm_i915_perf_record_type {
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581 DRM_I915_PERF_RECORD_SAMPLE = 1,
1582
1583
1584
1585
1586
1587
1588
1589 DRM_I915_PERF_RECORD_OA_REPORT_LOST = 2,
1590
1591
1592
1593
1594 DRM_I915_PERF_RECORD_OA_BUFFER_LOST = 3,
1595
1596 DRM_I915_PERF_RECORD_MAX
1597};
1598
1599
1600
1601
1602struct drm_i915_perf_oa_config {
1603
1604 char uuid[36];
1605
1606 __u32 n_mux_regs;
1607 __u32 n_boolean_regs;
1608 __u32 n_flex_regs;
1609
1610
1611
1612
1613
1614
1615 __u64 mux_regs_ptr;
1616 __u64 boolean_regs_ptr;
1617 __u64 flex_regs_ptr;
1618};
1619
1620struct drm_i915_query_item {
1621 __u64 query_id;
1622#define DRM_I915_QUERY_TOPOLOGY_INFO 1
1623
1624
1625
1626
1627
1628
1629
1630 __s32 length;
1631
1632
1633
1634
1635 __u32 flags;
1636
1637
1638
1639
1640
1641
1642 __u64 data_ptr;
1643};
1644
1645struct drm_i915_query {
1646 __u32 num_items;
1647
1648
1649
1650
1651 __u32 flags;
1652
1653
1654
1655
1656 __u64 items_ptr;
1657};
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686struct drm_i915_query_topology_info {
1687
1688
1689
1690 __u16 flags;
1691
1692 __u16 max_slices;
1693 __u16 max_subslices;
1694 __u16 max_eus_per_subslice;
1695
1696
1697
1698
1699 __u16 subslice_offset;
1700
1701
1702
1703
1704
1705 __u16 subslice_stride;
1706
1707
1708
1709
1710 __u16 eu_offset;
1711
1712
1713
1714
1715 __u16 eu_stride;
1716
1717 __u8 data[];
1718};
1719
1720#if defined(__cplusplus)
1721}
1722#endif
1723
1724#endif
1725