blob: 13eda7c2ea56429bde80f3d61becbc010897f727 [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Ben Cheng655a7c02013-10-16 16:09:24 -07007#ifndef _UAPI_I915_DRM_H_
8#define _UAPI_I915_DRM_H_
Christopher Ferris106b3a82016-08-24 12:15:38 -07009#include "drm.h"
10#ifdef __cplusplus
Christopher Ferris48fe0ae2019-01-10 15:59:33 -080011extern "C" {
Christopher Ferris106b3a82016-08-24 12:15:38 -070012#endif
13#define I915_L3_PARITY_UEVENT "L3_PARITY_ERROR"
Christopher Ferris38062f92014-07-09 15:33:25 -070014#define I915_ERROR_UEVENT "ERROR"
15#define I915_RESET_UEVENT "RESET"
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070016struct i915_user_extension {
17 __u64 next_extension;
18 __u32 name;
19 __u32 flags;
20 __u32 rsvd[4];
21};
Christopher Ferris6a9755d2017-01-13 14:09:31 -080022enum i915_mocs_table_index {
23 I915_MOCS_UNCACHED,
24 I915_MOCS_PTE,
25 I915_MOCS_CACHED,
Christopher Ferris6a9755d2017-01-13 14:09:31 -080026};
Christopher Ferris76a1d452018-06-27 14:12:29 -070027enum drm_i915_gem_engine_class {
28 I915_ENGINE_CLASS_RENDER = 0,
29 I915_ENGINE_CLASS_COPY = 1,
30 I915_ENGINE_CLASS_VIDEO = 2,
31 I915_ENGINE_CLASS_VIDEO_ENHANCE = 3,
Christopher Ferris80ae69d2022-08-02 16:32:21 -070032 I915_ENGINE_CLASS_COMPUTE = 4,
Christopher Ferris76a1d452018-06-27 14:12:29 -070033 I915_ENGINE_CLASS_INVALID = - 1
34};
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070035struct i915_engine_class_instance {
36 __u16 engine_class;
Christopher Ferrisb8a95e22019-10-02 18:29:20 -070037#define I915_ENGINE_CLASS_INVALID_NONE - 1
38#define I915_ENGINE_CLASS_INVALID_VIRTUAL - 2
Christopher Ferris80ae69d2022-08-02 16:32:21 -070039 __u16 engine_instance;
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070040};
Christopher Ferris76a1d452018-06-27 14:12:29 -070041enum drm_i915_pmu_engine_sample {
42 I915_SAMPLE_BUSY = 0,
43 I915_SAMPLE_WAIT = 1,
44 I915_SAMPLE_SEMA = 2
45};
46#define I915_PMU_SAMPLE_BITS (4)
47#define I915_PMU_SAMPLE_MASK (0xf)
48#define I915_PMU_SAMPLE_INSTANCE_BITS (8)
49#define I915_PMU_CLASS_SHIFT (I915_PMU_SAMPLE_BITS + I915_PMU_SAMPLE_INSTANCE_BITS)
Christopher Ferris67d1e5e2023-10-31 13:36:37 -070050#define __I915_PMU_ENGINE(__linux_class,instance,sample) ((__linux_class) << I915_PMU_CLASS_SHIFT | (instance) << I915_PMU_SAMPLE_BITS | (sample))
51#define I915_PMU_ENGINE_BUSY(__linux_class,instance) __I915_PMU_ENGINE(__linux_class, instance, I915_SAMPLE_BUSY)
52#define I915_PMU_ENGINE_WAIT(__linux_class,instance) __I915_PMU_ENGINE(__linux_class, instance, I915_SAMPLE_WAIT)
53#define I915_PMU_ENGINE_SEMA(__linux_class,instance) __I915_PMU_ENGINE(__linux_class, instance, I915_SAMPLE_SEMA)
Christopher Ferris8666d042023-09-06 14:55:31 -070054#define __I915_PMU_GT_SHIFT (60)
55#define ___I915_PMU_OTHER(gt,x) (((__u64) __I915_PMU_ENGINE(0xff, 0xff, 0xf) + 1 + (x)) | ((__u64) (gt) << __I915_PMU_GT_SHIFT))
56#define __I915_PMU_OTHER(x) ___I915_PMU_OTHER(0, x)
Christopher Ferris76a1d452018-06-27 14:12:29 -070057#define I915_PMU_ACTUAL_FREQUENCY __I915_PMU_OTHER(0)
58#define I915_PMU_REQUESTED_FREQUENCY __I915_PMU_OTHER(1)
59#define I915_PMU_INTERRUPTS __I915_PMU_OTHER(2)
60#define I915_PMU_RC6_RESIDENCY __I915_PMU_OTHER(3)
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070061#define I915_PMU_SOFTWARE_GT_AWAKE_TIME __I915_PMU_OTHER(4)
Christopher Ferris76a1d452018-06-27 14:12:29 -070062#define I915_PMU_LAST I915_PMU_RC6_RESIDENCY
Christopher Ferris8666d042023-09-06 14:55:31 -070063#define __I915_PMU_ACTUAL_FREQUENCY(gt) ___I915_PMU_OTHER(gt, 0)
64#define __I915_PMU_REQUESTED_FREQUENCY(gt) ___I915_PMU_OTHER(gt, 1)
65#define __I915_PMU_INTERRUPTS(gt) ___I915_PMU_OTHER(gt, 2)
66#define __I915_PMU_RC6_RESIDENCY(gt) ___I915_PMU_OTHER(gt, 3)
67#define __I915_PMU_SOFTWARE_GT_AWAKE_TIME(gt) ___I915_PMU_OTHER(gt, 4)
Christopher Ferris38062f92014-07-09 15:33:25 -070068#define I915_NR_TEX_REGIONS 255
Ben Cheng655a7c02013-10-16 16:09:24 -070069#define I915_LOG_MIN_TEX_REGION_SIZE 14
70typedef struct _drm_i915_init {
Christopher Ferris6a9755d2017-01-13 14:09:31 -080071 enum {
Tao Baod7db5942015-01-28 10:07:51 -080072 I915_INIT_DMA = 0x01,
73 I915_CLEANUP_DMA = 0x02,
Tao Baod7db5942015-01-28 10:07:51 -080074 I915_RESUME_DMA = 0x03
Christopher Ferris6a9755d2017-01-13 14:09:31 -080075 } func;
Tao Baod7db5942015-01-28 10:07:51 -080076 unsigned int mmio_offset;
77 int sarea_priv_offset;
Tao Baod7db5942015-01-28 10:07:51 -080078 unsigned int ring_start;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080079 unsigned int ring_end;
Tao Baod7db5942015-01-28 10:07:51 -080080 unsigned int ring_size;
81 unsigned int front_offset;
Tao Baod7db5942015-01-28 10:07:51 -080082 unsigned int back_offset;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080083 unsigned int depth_offset;
Tao Baod7db5942015-01-28 10:07:51 -080084 unsigned int w;
85 unsigned int h;
Tao Baod7db5942015-01-28 10:07:51 -080086 unsigned int pitch;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080087 unsigned int pitch_bits;
Tao Baod7db5942015-01-28 10:07:51 -080088 unsigned int back_pitch;
89 unsigned int depth_pitch;
Tao Baod7db5942015-01-28 10:07:51 -080090 unsigned int cpp;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080091 unsigned int chipset;
Ben Cheng655a7c02013-10-16 16:09:24 -070092} drm_i915_init_t;
Ben Cheng655a7c02013-10-16 16:09:24 -070093typedef struct _drm_i915_sarea {
Tao Baod7db5942015-01-28 10:07:51 -080094 struct drm_tex_region texList[I915_NR_TEX_REGIONS + 1];
Christopher Ferris6a9755d2017-01-13 14:09:31 -080095 int last_upload;
Tao Baod7db5942015-01-28 10:07:51 -080096 int last_enqueue;
97 int last_dispatch;
Tao Baod7db5942015-01-28 10:07:51 -080098 int ctxOwner;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080099 int texAge;
Tao Baod7db5942015-01-28 10:07:51 -0800100 int pf_enabled;
101 int pf_active;
Tao Baod7db5942015-01-28 10:07:51 -0800102 int pf_current_page;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800103 int perf_boxes;
Tao Baod7db5942015-01-28 10:07:51 -0800104 int width, height;
105 drm_handle_t front_handle;
Tao Baod7db5942015-01-28 10:07:51 -0800106 int front_offset;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800107 int front_size;
Tao Baod7db5942015-01-28 10:07:51 -0800108 drm_handle_t back_handle;
109 int back_offset;
Tao Baod7db5942015-01-28 10:07:51 -0800110 int back_size;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800111 drm_handle_t depth_handle;
Tao Baod7db5942015-01-28 10:07:51 -0800112 int depth_offset;
113 int depth_size;
Tao Baod7db5942015-01-28 10:07:51 -0800114 drm_handle_t tex_handle;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800115 int tex_offset;
Tao Baod7db5942015-01-28 10:07:51 -0800116 int tex_size;
117 int log_tex_granularity;
Tao Baod7db5942015-01-28 10:07:51 -0800118 int pitch;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800119 int rotation;
Tao Baod7db5942015-01-28 10:07:51 -0800120 int rotated_offset;
121 int rotated_size;
Tao Baod7db5942015-01-28 10:07:51 -0800122 int rotated_pitch;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800123 int virtualX, virtualY;
Tao Baod7db5942015-01-28 10:07:51 -0800124 unsigned int front_tiled;
125 unsigned int back_tiled;
Tao Baod7db5942015-01-28 10:07:51 -0800126 unsigned int depth_tiled;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800127 unsigned int rotated_tiled;
Tao Baod7db5942015-01-28 10:07:51 -0800128 unsigned int rotated2_tiled;
129 int pipeA_x;
Tao Baod7db5942015-01-28 10:07:51 -0800130 int pipeA_y;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800131 int pipeA_w;
Tao Baod7db5942015-01-28 10:07:51 -0800132 int pipeA_h;
133 int pipeB_x;
Tao Baod7db5942015-01-28 10:07:51 -0800134 int pipeB_y;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800135 int pipeB_w;
Tao Baod7db5942015-01-28 10:07:51 -0800136 int pipeB_h;
137 drm_handle_t unused_handle;
Tao Baod7db5942015-01-28 10:07:51 -0800138 __u32 unused1, unused2, unused3;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800139 __u32 front_bo_handle;
Tao Baod7db5942015-01-28 10:07:51 -0800140 __u32 back_bo_handle;
141 __u32 unused_bo_handle;
Tao Baod7db5942015-01-28 10:07:51 -0800142 __u32 depth_bo_handle;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800143} drm_i915_sarea_t;
Ben Cheng655a7c02013-10-16 16:09:24 -0700144#define planeA_x pipeA_x
Ben Cheng655a7c02013-10-16 16:09:24 -0700145#define planeA_y pipeA_y
146#define planeA_w pipeA_w
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800147#define planeA_h pipeA_h
Ben Cheng655a7c02013-10-16 16:09:24 -0700148#define planeB_x pipeB_x
Ben Cheng655a7c02013-10-16 16:09:24 -0700149#define planeB_y pipeB_y
150#define planeB_w pipeB_w
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800151#define planeB_h pipeB_h
Ben Cheng655a7c02013-10-16 16:09:24 -0700152#define I915_BOX_RING_EMPTY 0x1
Ben Cheng655a7c02013-10-16 16:09:24 -0700153#define I915_BOX_FLIP 0x2
154#define I915_BOX_WAIT 0x4
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800155#define I915_BOX_TEXTURE_LOAD 0x8
Ben Cheng655a7c02013-10-16 16:09:24 -0700156#define I915_BOX_LOST_CONTEXT 0x10
Ben Cheng655a7c02013-10-16 16:09:24 -0700157#define DRM_I915_INIT 0x00
158#define DRM_I915_FLUSH 0x01
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800159#define DRM_I915_FLIP 0x02
Ben Cheng655a7c02013-10-16 16:09:24 -0700160#define DRM_I915_BATCHBUFFER 0x03
Ben Cheng655a7c02013-10-16 16:09:24 -0700161#define DRM_I915_IRQ_EMIT 0x04
162#define DRM_I915_IRQ_WAIT 0x05
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800163#define DRM_I915_GETPARAM 0x06
Ben Cheng655a7c02013-10-16 16:09:24 -0700164#define DRM_I915_SETPARAM 0x07
Ben Cheng655a7c02013-10-16 16:09:24 -0700165#define DRM_I915_ALLOC 0x08
166#define DRM_I915_FREE 0x09
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800167#define DRM_I915_INIT_HEAP 0x0a
Ben Cheng655a7c02013-10-16 16:09:24 -0700168#define DRM_I915_CMDBUFFER 0x0b
Ben Cheng655a7c02013-10-16 16:09:24 -0700169#define DRM_I915_DESTROY_HEAP 0x0c
170#define DRM_I915_SET_VBLANK_PIPE 0x0d
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800171#define DRM_I915_GET_VBLANK_PIPE 0x0e
Ben Cheng655a7c02013-10-16 16:09:24 -0700172#define DRM_I915_VBLANK_SWAP 0x0f
Ben Cheng655a7c02013-10-16 16:09:24 -0700173#define DRM_I915_HWS_ADDR 0x11
174#define DRM_I915_GEM_INIT 0x13
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800175#define DRM_I915_GEM_EXECBUFFER 0x14
Ben Cheng655a7c02013-10-16 16:09:24 -0700176#define DRM_I915_GEM_PIN 0x15
Ben Cheng655a7c02013-10-16 16:09:24 -0700177#define DRM_I915_GEM_UNPIN 0x16
178#define DRM_I915_GEM_BUSY 0x17
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800179#define DRM_I915_GEM_THROTTLE 0x18
Ben Cheng655a7c02013-10-16 16:09:24 -0700180#define DRM_I915_GEM_ENTERVT 0x19
Ben Cheng655a7c02013-10-16 16:09:24 -0700181#define DRM_I915_GEM_LEAVEVT 0x1a
182#define DRM_I915_GEM_CREATE 0x1b
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800183#define DRM_I915_GEM_PREAD 0x1c
Ben Cheng655a7c02013-10-16 16:09:24 -0700184#define DRM_I915_GEM_PWRITE 0x1d
Ben Cheng655a7c02013-10-16 16:09:24 -0700185#define DRM_I915_GEM_MMAP 0x1e
186#define DRM_I915_GEM_SET_DOMAIN 0x1f
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800187#define DRM_I915_GEM_SW_FINISH 0x20
Ben Cheng655a7c02013-10-16 16:09:24 -0700188#define DRM_I915_GEM_SET_TILING 0x21
Ben Cheng655a7c02013-10-16 16:09:24 -0700189#define DRM_I915_GEM_GET_TILING 0x22
190#define DRM_I915_GEM_GET_APERTURE 0x23
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800191#define DRM_I915_GEM_MMAP_GTT 0x24
Ben Cheng655a7c02013-10-16 16:09:24 -0700192#define DRM_I915_GET_PIPE_FROM_CRTC_ID 0x25
Ben Cheng655a7c02013-10-16 16:09:24 -0700193#define DRM_I915_GEM_MADVISE 0x26
194#define DRM_I915_OVERLAY_PUT_IMAGE 0x27
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800195#define DRM_I915_OVERLAY_ATTRS 0x28
Ben Cheng655a7c02013-10-16 16:09:24 -0700196#define DRM_I915_GEM_EXECBUFFER2 0x29
Christopher Ferris525ce912017-07-26 13:12:53 -0700197#define DRM_I915_GEM_EXECBUFFER2_WR DRM_I915_GEM_EXECBUFFER2
Ben Cheng655a7c02013-10-16 16:09:24 -0700198#define DRM_I915_GET_SPRITE_COLORKEY 0x2a
199#define DRM_I915_SET_SPRITE_COLORKEY 0x2b
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800200#define DRM_I915_GEM_WAIT 0x2c
Ben Cheng655a7c02013-10-16 16:09:24 -0700201#define DRM_I915_GEM_CONTEXT_CREATE 0x2d
Ben Cheng655a7c02013-10-16 16:09:24 -0700202#define DRM_I915_GEM_CONTEXT_DESTROY 0x2e
203#define DRM_I915_GEM_SET_CACHING 0x2f
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800204#define DRM_I915_GEM_GET_CACHING 0x30
Ben Cheng655a7c02013-10-16 16:09:24 -0700205#define DRM_I915_REG_READ 0x31
Christopher Ferris38062f92014-07-09 15:33:25 -0700206#define DRM_I915_GET_RESET_STATS 0x32
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700207#define DRM_I915_GEM_USERPTR 0x33
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800208#define DRM_I915_GEM_CONTEXT_GETPARAM 0x34
Christopher Ferris05d08e92016-02-04 13:16:38 -0800209#define DRM_I915_GEM_CONTEXT_SETPARAM 0x35
Christopher Ferris525ce912017-07-26 13:12:53 -0700210#define DRM_I915_PERF_OPEN 0x36
Christopher Ferris1308ad32017-11-14 17:32:13 -0800211#define DRM_I915_PERF_ADD_CONFIG 0x37
212#define DRM_I915_PERF_REMOVE_CONFIG 0x38
Christopher Ferris76a1d452018-06-27 14:12:29 -0700213#define DRM_I915_QUERY 0x39
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700214#define DRM_I915_GEM_VM_CREATE 0x3a
215#define DRM_I915_GEM_VM_DESTROY 0x3b
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000216#define DRM_I915_GEM_CREATE_EXT 0x3c
Tao Baod7db5942015-01-28 10:07:51 -0800217#define DRM_IOCTL_I915_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
218#define DRM_IOCTL_I915_FLUSH DRM_IO(DRM_COMMAND_BASE + DRM_I915_FLUSH)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800219#define DRM_IOCTL_I915_FLIP DRM_IO(DRM_COMMAND_BASE + DRM_I915_FLIP)
Tao Baod7db5942015-01-28 10:07:51 -0800220#define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t)
Ben Cheng655a7c02013-10-16 16:09:24 -0700221#define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t)
Tao Baod7db5942015-01-28 10:07:51 -0800222#define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800223#define DRM_IOCTL_I915_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GETPARAM, drm_i915_getparam_t)
Tao Baod7db5942015-01-28 10:07:51 -0800224#define DRM_IOCTL_I915_SETPARAM DRM_IOW(DRM_COMMAND_BASE + DRM_I915_SETPARAM, drm_i915_setparam_t)
Ben Cheng655a7c02013-10-16 16:09:24 -0700225#define DRM_IOCTL_I915_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_ALLOC, drm_i915_mem_alloc_t)
Tao Baod7db5942015-01-28 10:07:51 -0800226#define DRM_IOCTL_I915_FREE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800227#define DRM_IOCTL_I915_INIT_HEAP DRM_IOW(DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t)
Tao Baod7db5942015-01-28 10:07:51 -0800228#define DRM_IOCTL_I915_CMDBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t)
229#define DRM_IOCTL_I915_DESTROY_HEAP DRM_IOW(DRM_COMMAND_BASE + DRM_I915_DESTROY_HEAP, drm_i915_mem_destroy_heap_t)
230#define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800231#define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR(DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700232#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t)
Ben Cheng655a7c02013-10-16 16:09:24 -0700233#define DRM_IOCTL_I915_HWS_ADDR DRM_IOW(DRM_COMMAND_BASE + DRM_I915_HWS_ADDR, struct drm_i915_gem_init)
234#define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800235#define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer)
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700236#define DRM_IOCTL_I915_GEM_EXECBUFFER2 DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2)
Christopher Ferris525ce912017-07-26 13:12:53 -0700237#define DRM_IOCTL_I915_GEM_EXECBUFFER2_WR DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2_WR, struct drm_i915_gem_execbuffer2)
Ben Cheng655a7c02013-10-16 16:09:24 -0700238#define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin)
239#define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800240#define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy)
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700241#define DRM_IOCTL_I915_GEM_SET_CACHING DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_SET_CACHING, struct drm_i915_gem_caching)
Ben Cheng655a7c02013-10-16 16:09:24 -0700242#define DRM_IOCTL_I915_GEM_GET_CACHING DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_GET_CACHING, struct drm_i915_gem_caching)
Tao Baod7db5942015-01-28 10:07:51 -0800243#define DRM_IOCTL_I915_GEM_THROTTLE DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_THROTTLE)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800244#define DRM_IOCTL_I915_GEM_ENTERVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_ENTERVT)
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700245#define DRM_IOCTL_I915_GEM_LEAVEVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_LEAVEVT)
Ben Cheng655a7c02013-10-16 16:09:24 -0700246#define DRM_IOCTL_I915_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct drm_i915_gem_create)
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000247#define DRM_IOCTL_I915_GEM_CREATE_EXT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE_EXT, struct drm_i915_gem_create_ext)
Tao Baod7db5942015-01-28 10:07:51 -0800248#define DRM_IOCTL_I915_GEM_PREAD DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_PREAD, struct drm_i915_gem_pread)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800249#define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite)
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700250#define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap)
Ben Cheng655a7c02013-10-16 16:09:24 -0700251#define DRM_IOCTL_I915_GEM_MMAP_GTT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt)
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700252#define DRM_IOCTL_I915_GEM_MMAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_offset)
Tao Baod7db5942015-01-28 10:07:51 -0800253#define DRM_IOCTL_I915_GEM_SET_DOMAIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800254#define DRM_IOCTL_I915_GEM_SW_FINISH DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish)
Tao Baod7db5942015-01-28 10:07:51 -0800255#define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling)
256#define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling)
257#define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR(DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800258#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)
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700259#define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise)
Ben Cheng655a7c02013-10-16 16:09:24 -0700260#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image)
261#define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800262#define DRM_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800263#define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
Ben Cheng655a7c02013-10-16 16:09:24 -0700264#define DRM_IOCTL_I915_GEM_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_WAIT, struct drm_i915_gem_wait)
Tao Baod7db5942015-01-28 10:07:51 -0800265#define DRM_IOCTL_I915_GEM_CONTEXT_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create)
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700266#define DRM_IOCTL_I915_GEM_CONTEXT_CREATE_EXT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create_ext)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800267#define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy)
Tao Baod7db5942015-01-28 10:07:51 -0800268#define DRM_IOCTL_I915_REG_READ DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read)
269#define DRM_IOCTL_I915_GET_RESET_STATS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_RESET_STATS, struct drm_i915_reset_stats)
270#define DRM_IOCTL_I915_GEM_USERPTR DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_USERPTR, struct drm_i915_gem_userptr)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800271#define DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_GETPARAM, struct drm_i915_gem_context_param)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800272#define DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_SETPARAM, struct drm_i915_gem_context_param)
Christopher Ferris525ce912017-07-26 13:12:53 -0700273#define DRM_IOCTL_I915_PERF_OPEN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_OPEN, struct drm_i915_perf_open_param)
Christopher Ferris1308ad32017-11-14 17:32:13 -0800274#define DRM_IOCTL_I915_PERF_ADD_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_ADD_CONFIG, struct drm_i915_perf_oa_config)
275#define DRM_IOCTL_I915_PERF_REMOVE_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_REMOVE_CONFIG, __u64)
Christopher Ferris76a1d452018-06-27 14:12:29 -0700276#define DRM_IOCTL_I915_QUERY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_QUERY, struct drm_i915_query)
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700277#define DRM_IOCTL_I915_GEM_VM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_VM_CREATE, struct drm_i915_gem_vm_control)
278#define DRM_IOCTL_I915_GEM_VM_DESTROY DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_VM_DESTROY, struct drm_i915_gem_vm_control)
Ben Cheng655a7c02013-10-16 16:09:24 -0700279typedef struct drm_i915_batchbuffer {
Tao Baod7db5942015-01-28 10:07:51 -0800280 int start;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800281 int used;
Tao Baod7db5942015-01-28 10:07:51 -0800282 int DR1;
283 int DR4;
Tao Baod7db5942015-01-28 10:07:51 -0800284 int num_cliprects;
Elliott Hughes0f0c18f2023-03-29 15:53:31 -0700285 struct drm_clip_rect * cliprects;
Christopher Ferris38062f92014-07-09 15:33:25 -0700286} drm_i915_batchbuffer_t;
Ben Cheng655a7c02013-10-16 16:09:24 -0700287typedef struct _drm_i915_cmdbuffer {
Elliott Hughes0f0c18f2023-03-29 15:53:31 -0700288 char * buf;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800289 int sz;
Tao Baod7db5942015-01-28 10:07:51 -0800290 int DR1;
291 int DR4;
Tao Baod7db5942015-01-28 10:07:51 -0800292 int num_cliprects;
Elliott Hughes0f0c18f2023-03-29 15:53:31 -0700293 struct drm_clip_rect * cliprects;
Christopher Ferris38062f92014-07-09 15:33:25 -0700294} drm_i915_cmdbuffer_t;
Ben Cheng655a7c02013-10-16 16:09:24 -0700295typedef struct drm_i915_irq_emit {
Elliott Hughes0f0c18f2023-03-29 15:53:31 -0700296 int * irq_seq;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800297} drm_i915_irq_emit_t;
Christopher Ferris38062f92014-07-09 15:33:25 -0700298typedef struct drm_i915_irq_wait {
Tao Baod7db5942015-01-28 10:07:51 -0800299 int irq_seq;
Ben Cheng655a7c02013-10-16 16:09:24 -0700300} drm_i915_irq_wait_t;
Christopher Ferrisd842e432019-03-07 10:21:59 -0800301#define I915_GEM_PPGTT_NONE 0
302#define I915_GEM_PPGTT_ALIASING 1
303#define I915_GEM_PPGTT_FULL 2
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800304#define I915_PARAM_IRQ_ACTIVE 1
Christopher Ferris38062f92014-07-09 15:33:25 -0700305#define I915_PARAM_ALLOW_BATCHBUFFER 2
Ben Cheng655a7c02013-10-16 16:09:24 -0700306#define I915_PARAM_LAST_DISPATCH 3
307#define I915_PARAM_CHIPSET_ID 4
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800308#define I915_PARAM_HAS_GEM 5
Christopher Ferris38062f92014-07-09 15:33:25 -0700309#define I915_PARAM_NUM_FENCES_AVAIL 6
Ben Cheng655a7c02013-10-16 16:09:24 -0700310#define I915_PARAM_HAS_OVERLAY 7
311#define I915_PARAM_HAS_PAGEFLIPPING 8
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800312#define I915_PARAM_HAS_EXECBUF2 9
Christopher Ferris38062f92014-07-09 15:33:25 -0700313#define I915_PARAM_HAS_BSD 10
Ben Cheng655a7c02013-10-16 16:09:24 -0700314#define I915_PARAM_HAS_BLT 11
315#define I915_PARAM_HAS_RELAXED_FENCING 12
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800316#define I915_PARAM_HAS_COHERENT_RINGS 13
Christopher Ferris38062f92014-07-09 15:33:25 -0700317#define I915_PARAM_HAS_EXEC_CONSTANTS 14
Ben Cheng655a7c02013-10-16 16:09:24 -0700318#define I915_PARAM_HAS_RELAXED_DELTA 15
319#define I915_PARAM_HAS_GEN7_SOL_RESET 16
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800320#define I915_PARAM_HAS_LLC 17
Christopher Ferris38062f92014-07-09 15:33:25 -0700321#define I915_PARAM_HAS_ALIASING_PPGTT 18
Ben Cheng655a7c02013-10-16 16:09:24 -0700322#define I915_PARAM_HAS_WAIT_TIMEOUT 19
323#define I915_PARAM_HAS_SEMAPHORES 20
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800324#define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21
Christopher Ferris38062f92014-07-09 15:33:25 -0700325#define I915_PARAM_HAS_VEBOX 22
Ben Cheng655a7c02013-10-16 16:09:24 -0700326#define I915_PARAM_HAS_SECURE_BATCHES 23
327#define I915_PARAM_HAS_PINNED_BATCHES 24
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800328#define I915_PARAM_HAS_EXEC_NO_RELOC 25
Christopher Ferris38062f92014-07-09 15:33:25 -0700329#define I915_PARAM_HAS_EXEC_HANDLE_LUT 26
330#define I915_PARAM_HAS_WT 27
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700331#define I915_PARAM_CMD_PARSER_VERSION 28
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800332#define I915_PARAM_HAS_COHERENT_PHYS_GTT 29
Christopher Ferris05d08e92016-02-04 13:16:38 -0800333#define I915_PARAM_MMAP_VERSION 30
334#define I915_PARAM_HAS_BSD2 31
Christopher Ferris05d08e92016-02-04 13:16:38 -0800335#define I915_PARAM_REVISION 32
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800336#define I915_PARAM_SUBSLICE_TOTAL 33
Christopher Ferris05d08e92016-02-04 13:16:38 -0800337#define I915_PARAM_EU_TOTAL 34
338#define I915_PARAM_HAS_GPU_RESET 35
Christopher Ferris05d08e92016-02-04 13:16:38 -0800339#define I915_PARAM_HAS_RESOURCE_STREAMER 36
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800340#define I915_PARAM_HAS_EXEC_SOFTPIN 37
Christopher Ferris49f525c2016-12-12 14:55:36 -0800341#define I915_PARAM_HAS_POOLED_EU 38
342#define I915_PARAM_MIN_EU_IN_POOL 39
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800343#define I915_PARAM_MMAP_GTT_VERSION 40
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800344#define I915_PARAM_HAS_SCHEDULER 41
Christopher Ferris934ec942018-01-31 15:29:16 -0800345#define I915_SCHEDULER_CAP_ENABLED (1ul << 0)
346#define I915_SCHEDULER_CAP_PRIORITY (1ul << 1)
347#define I915_SCHEDULER_CAP_PREEMPTION (1ul << 2)
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700348#define I915_SCHEDULER_CAP_SEMAPHORES (1ul << 3)
Christopher Ferris9584fa42019-12-09 15:36:13 -0800349#define I915_SCHEDULER_CAP_ENGINE_BUSY_STATS (1ul << 4)
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700350#define I915_SCHEDULER_CAP_STATIC_PRIORITY_MAP (1ul << 5)
Christopher Ferris525ce912017-07-26 13:12:53 -0700351#define I915_PARAM_HUC_STATUS 42
352#define I915_PARAM_HAS_EXEC_ASYNC 43
353#define I915_PARAM_HAS_EXEC_FENCE 44
Christopher Ferris1308ad32017-11-14 17:32:13 -0800354#define I915_PARAM_HAS_EXEC_CAPTURE 45
355#define I915_PARAM_SLICE_MASK 46
356#define I915_PARAM_SUBSLICE_MASK 47
357#define I915_PARAM_HAS_EXEC_BATCH_FIRST 48
358#define I915_PARAM_HAS_EXEC_FENCE_ARRAY 49
Christopher Ferris76a1d452018-06-27 14:12:29 -0700359#define I915_PARAM_HAS_CONTEXT_ISOLATION 50
360#define I915_PARAM_CS_TIMESTAMP_FREQUENCY 51
Christopher Ferris86a48372019-01-10 14:14:59 -0800361#define I915_PARAM_MMAP_GTT_COHERENT 52
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700362#define I915_PARAM_HAS_EXEC_SUBMIT_FENCE 53
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800363#define I915_PARAM_PERF_REVISION 54
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800364#define I915_PARAM_HAS_EXEC_TIMELINE_FENCES 55
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700365#define I915_PARAM_HAS_USERPTR_PROBE 56
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800366#define I915_PARAM_OA_TIMESTAMP_FREQUENCY 57
Christopher Ferris8666d042023-09-06 14:55:31 -0700367#define I915_PARAM_PXP_STATUS 58
Christopher Ferris7ac54f52024-08-07 21:07:12 +0000368#define I915_PARAM_HAS_CONTEXT_FREQ_HINT 59
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700369struct drm_i915_getparam {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800370 __s32 param;
Elliott Hughes0f0c18f2023-03-29 15:53:31 -0700371 int * value;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700372};
373typedef struct drm_i915_getparam drm_i915_getparam_t;
Ben Cheng655a7c02013-10-16 16:09:24 -0700374#define I915_SETPARAM_USE_MI_BATCHBUFFER_START 1
375#define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY 2
376#define I915_SETPARAM_ALLOW_BATCHBUFFER 3
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800377#define I915_SETPARAM_NUM_USED_FENCES 4
Ben Cheng655a7c02013-10-16 16:09:24 -0700378typedef struct drm_i915_setparam {
Tao Baod7db5942015-01-28 10:07:51 -0800379 int param;
380 int value;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800381} drm_i915_setparam_t;
Ben Cheng655a7c02013-10-16 16:09:24 -0700382#define I915_MEM_REGION_AGP 1
383typedef struct drm_i915_mem_alloc {
Tao Baod7db5942015-01-28 10:07:51 -0800384 int region;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800385 int alignment;
Tao Baod7db5942015-01-28 10:07:51 -0800386 int size;
Elliott Hughes0f0c18f2023-03-29 15:53:31 -0700387 int * region_offset;
Ben Cheng655a7c02013-10-16 16:09:24 -0700388} drm_i915_mem_alloc_t;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800389typedef struct drm_i915_mem_free {
Tao Baod7db5942015-01-28 10:07:51 -0800390 int region;
391 int region_offset;
Ben Cheng655a7c02013-10-16 16:09:24 -0700392} drm_i915_mem_free_t;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800393typedef struct drm_i915_mem_init_heap {
Tao Baod7db5942015-01-28 10:07:51 -0800394 int region;
395 int size;
396 int start;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800397} drm_i915_mem_init_heap_t;
Ben Cheng655a7c02013-10-16 16:09:24 -0700398typedef struct drm_i915_mem_destroy_heap {
Tao Baod7db5942015-01-28 10:07:51 -0800399 int region;
Ben Cheng655a7c02013-10-16 16:09:24 -0700400} drm_i915_mem_destroy_heap_t;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800401#define DRM_I915_VBLANK_PIPE_A 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700402#define DRM_I915_VBLANK_PIPE_B 2
403typedef struct drm_i915_vblank_pipe {
Tao Baod7db5942015-01-28 10:07:51 -0800404 int pipe;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800405} drm_i915_vblank_pipe_t;
Ben Cheng655a7c02013-10-16 16:09:24 -0700406typedef struct drm_i915_vblank_swap {
Tao Baod7db5942015-01-28 10:07:51 -0800407 drm_drawable_t drawable;
408 enum drm_vblank_seq_type seqtype;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800409 unsigned int sequence;
Ben Cheng655a7c02013-10-16 16:09:24 -0700410} drm_i915_vblank_swap_t;
411typedef struct drm_i915_hws_addr {
Tao Baod7db5942015-01-28 10:07:51 -0800412 __u64 addr;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800413} drm_i915_hws_addr_t;
Ben Cheng655a7c02013-10-16 16:09:24 -0700414struct drm_i915_gem_init {
Tao Baod7db5942015-01-28 10:07:51 -0800415 __u64 gtt_start;
416 __u64 gtt_end;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800417};
Ben Cheng655a7c02013-10-16 16:09:24 -0700418struct drm_i915_gem_create {
Tao Baod7db5942015-01-28 10:07:51 -0800419 __u64 size;
420 __u32 handle;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800421 __u32 pad;
Ben Cheng655a7c02013-10-16 16:09:24 -0700422};
423struct drm_i915_gem_pread {
Tao Baod7db5942015-01-28 10:07:51 -0800424 __u32 handle;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800425 __u32 pad;
Tao Baod7db5942015-01-28 10:07:51 -0800426 __u64 offset;
427 __u64 size;
428 __u64 data_ptr;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800429};
Ben Cheng655a7c02013-10-16 16:09:24 -0700430struct drm_i915_gem_pwrite {
Tao Baod7db5942015-01-28 10:07:51 -0800431 __u32 handle;
432 __u32 pad;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800433 __u64 offset;
Tao Baod7db5942015-01-28 10:07:51 -0800434 __u64 size;
435 __u64 data_ptr;
Ben Cheng655a7c02013-10-16 16:09:24 -0700436};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800437struct drm_i915_gem_mmap {
Tao Baod7db5942015-01-28 10:07:51 -0800438 __u32 handle;
439 __u32 pad;
440 __u64 offset;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800441 __u64 size;
Tao Baod7db5942015-01-28 10:07:51 -0800442 __u64 addr_ptr;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800443 __u64 flags;
444#define I915_MMAP_WC 0x1
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800445};
Ben Cheng655a7c02013-10-16 16:09:24 -0700446struct drm_i915_gem_mmap_gtt {
Tao Baod7db5942015-01-28 10:07:51 -0800447 __u32 handle;
448 __u32 pad;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800449 __u64 offset;
Ben Cheng655a7c02013-10-16 16:09:24 -0700450};
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700451struct drm_i915_gem_mmap_offset {
452 __u32 handle;
453 __u32 pad;
454 __u64 offset;
455 __u64 flags;
456#define I915_MMAP_OFFSET_GTT 0
457#define I915_MMAP_OFFSET_WC 1
458#define I915_MMAP_OFFSET_WB 2
459#define I915_MMAP_OFFSET_UC 3
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700460#define I915_MMAP_OFFSET_FIXED 4
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700461 __u64 extensions;
462};
Ben Cheng655a7c02013-10-16 16:09:24 -0700463struct drm_i915_gem_set_domain {
Tao Baod7db5942015-01-28 10:07:51 -0800464 __u32 handle;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800465 __u32 read_domains;
Tao Baod7db5942015-01-28 10:07:51 -0800466 __u32 write_domain;
Ben Cheng655a7c02013-10-16 16:09:24 -0700467};
Ben Cheng655a7c02013-10-16 16:09:24 -0700468struct drm_i915_gem_sw_finish {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800469 __u32 handle;
Ben Cheng655a7c02013-10-16 16:09:24 -0700470};
471struct drm_i915_gem_relocation_entry {
Tao Baod7db5942015-01-28 10:07:51 -0800472 __u32 target_handle;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800473 __u32 delta;
Tao Baod7db5942015-01-28 10:07:51 -0800474 __u64 offset;
Tao Baod7db5942015-01-28 10:07:51 -0800475 __u64 presumed_offset;
476 __u32 read_domains;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800477 __u32 write_domain;
Ben Cheng655a7c02013-10-16 16:09:24 -0700478};
479#define I915_GEM_DOMAIN_CPU 0x00000001
Ben Cheng655a7c02013-10-16 16:09:24 -0700480#define I915_GEM_DOMAIN_RENDER 0x00000002
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800481#define I915_GEM_DOMAIN_SAMPLER 0x00000004
Ben Cheng655a7c02013-10-16 16:09:24 -0700482#define I915_GEM_DOMAIN_COMMAND 0x00000008
483#define I915_GEM_DOMAIN_INSTRUCTION 0x00000010
Ben Cheng655a7c02013-10-16 16:09:24 -0700484#define I915_GEM_DOMAIN_VERTEX 0x00000020
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800485#define I915_GEM_DOMAIN_GTT 0x00000040
Christopher Ferris1308ad32017-11-14 17:32:13 -0800486#define I915_GEM_DOMAIN_WC 0x00000080
Ben Cheng655a7c02013-10-16 16:09:24 -0700487struct drm_i915_gem_exec_object {
Tao Baod7db5942015-01-28 10:07:51 -0800488 __u32 handle;
489 __u32 relocation_count;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800490 __u64 relocs_ptr;
Tao Baod7db5942015-01-28 10:07:51 -0800491 __u64 alignment;
Tao Baod7db5942015-01-28 10:07:51 -0800492 __u64 offset;
Ben Cheng655a7c02013-10-16 16:09:24 -0700493};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800494struct drm_i915_gem_execbuffer {
Tao Baod7db5942015-01-28 10:07:51 -0800495 __u64 buffers_ptr;
Tao Baod7db5942015-01-28 10:07:51 -0800496 __u32 buffer_count;
497 __u32 batch_start_offset;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800498 __u32 batch_len;
Tao Baod7db5942015-01-28 10:07:51 -0800499 __u32 DR1;
Tao Baod7db5942015-01-28 10:07:51 -0800500 __u32 DR4;
501 __u32 num_cliprects;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800502 __u64 cliprects_ptr;
Ben Cheng655a7c02013-10-16 16:09:24 -0700503};
504struct drm_i915_gem_exec_object2 {
Tao Baod7db5942015-01-28 10:07:51 -0800505 __u32 handle;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800506 __u32 relocation_count;
Tao Baod7db5942015-01-28 10:07:51 -0800507 __u64 relocs_ptr;
Tao Baod7db5942015-01-28 10:07:51 -0800508 __u64 alignment;
509 __u64 offset;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800510#define EXEC_OBJECT_NEEDS_FENCE (1 << 0)
Tao Baod7db5942015-01-28 10:07:51 -0800511#define EXEC_OBJECT_NEEDS_GTT (1 << 1)
Tao Baod7db5942015-01-28 10:07:51 -0800512#define EXEC_OBJECT_WRITE (1 << 2)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800513#define EXEC_OBJECT_SUPPORTS_48B_ADDRESS (1 << 3)
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800514#define EXEC_OBJECT_PINNED (1 << 4)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800515#define EXEC_OBJECT_PAD_TO_SIZE (1 << 5)
Christopher Ferris525ce912017-07-26 13:12:53 -0700516#define EXEC_OBJECT_ASYNC (1 << 6)
Christopher Ferris1308ad32017-11-14 17:32:13 -0800517#define EXEC_OBJECT_CAPTURE (1 << 7)
518#define __EXEC_OBJECT_UNKNOWN_FLAGS - (EXEC_OBJECT_CAPTURE << 1)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800519 __u64 flags;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800520 union {
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800521 __u64 rsvd1;
522 __u64 pad_to_size;
523 };
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800524 __u64 rsvd2;
Ben Cheng655a7c02013-10-16 16:09:24 -0700525};
Christopher Ferris1308ad32017-11-14 17:32:13 -0800526struct drm_i915_gem_exec_fence {
527 __u32 handle;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700528 __u32 flags;
Christopher Ferris1308ad32017-11-14 17:32:13 -0800529#define I915_EXEC_FENCE_WAIT (1 << 0)
530#define I915_EXEC_FENCE_SIGNAL (1 << 1)
531#define __I915_EXEC_FENCE_UNKNOWN_FLAGS (- (I915_EXEC_FENCE_SIGNAL << 1))
Christopher Ferris1308ad32017-11-14 17:32:13 -0800532};
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800533struct drm_i915_gem_execbuffer_ext_timeline_fences {
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700534#define DRM_I915_GEM_EXECBUFFER_EXT_TIMELINE_FENCES 0
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800535 struct i915_user_extension base;
536 __u64 fence_count;
537 __u64 handles_ptr;
538 __u64 values_ptr;
539};
Ben Cheng655a7c02013-10-16 16:09:24 -0700540struct drm_i915_gem_execbuffer2 {
Tao Baod7db5942015-01-28 10:07:51 -0800541 __u64 buffers_ptr;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800542 __u32 buffer_count;
Tao Baod7db5942015-01-28 10:07:51 -0800543 __u32 batch_start_offset;
544 __u32 batch_len;
545 __u32 DR1;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800546 __u32 DR4;
Tao Baod7db5942015-01-28 10:07:51 -0800547 __u32 num_cliprects;
548 __u64 cliprects_ptr;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700549 __u64 flags;
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700550#define I915_EXEC_RING_MASK (0x3f)
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800551#define I915_EXEC_DEFAULT (0 << 0)
Tao Baod7db5942015-01-28 10:07:51 -0800552#define I915_EXEC_RENDER (1 << 0)
553#define I915_EXEC_BSD (2 << 0)
554#define I915_EXEC_BLT (3 << 0)
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800555#define I915_EXEC_VEBOX (4 << 0)
Tao Baod7db5942015-01-28 10:07:51 -0800556#define I915_EXEC_CONSTANTS_MASK (3 << 6)
557#define I915_EXEC_CONSTANTS_REL_GENERAL (0 << 6)
558#define I915_EXEC_CONSTANTS_ABSOLUTE (1 << 6)
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800559#define I915_EXEC_CONSTANTS_REL_SURFACE (2 << 6)
Tao Baod7db5942015-01-28 10:07:51 -0800560#define I915_EXEC_GEN7_SOL_RESET (1 << 8)
561#define I915_EXEC_SECURE (1 << 9)
562#define I915_EXEC_IS_PINNED (1 << 10)
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800563#define I915_EXEC_NO_RELOC (1 << 11)
Tao Baod7db5942015-01-28 10:07:51 -0800564#define I915_EXEC_HANDLE_LUT (1 << 12)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700565#define I915_EXEC_BSD_SHIFT (13)
566#define I915_EXEC_BSD_MASK (3 << I915_EXEC_BSD_SHIFT)
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800567#define I915_EXEC_BSD_DEFAULT (0 << I915_EXEC_BSD_SHIFT)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700568#define I915_EXEC_BSD_RING1 (1 << I915_EXEC_BSD_SHIFT)
569#define I915_EXEC_BSD_RING2 (2 << I915_EXEC_BSD_SHIFT)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800570#define I915_EXEC_RESOURCE_STREAMER (1 << 15)
Christopher Ferris525ce912017-07-26 13:12:53 -0700571#define I915_EXEC_FENCE_IN (1 << 16)
572#define I915_EXEC_FENCE_OUT (1 << 17)
Christopher Ferris1308ad32017-11-14 17:32:13 -0800573#define I915_EXEC_BATCH_FIRST (1 << 18)
574#define I915_EXEC_FENCE_ARRAY (1 << 19)
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700575#define I915_EXEC_FENCE_SUBMIT (1 << 20)
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800576#define I915_EXEC_USE_EXTENSIONS (1 << 21)
577#define __I915_EXEC_UNKNOWN_FLAGS (- (I915_EXEC_USE_EXTENSIONS << 1))
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700578 __u64 rsvd1;
579 __u64 rsvd2;
580};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700581#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff)
Tao Baod7db5942015-01-28 10:07:51 -0800582#define i915_execbuffer2_set_context_id(eb2,context) (eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK
583#define i915_execbuffer2_get_context_id(eb2) ((eb2).rsvd1 & I915_EXEC_CONTEXT_ID_MASK)
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800584struct drm_i915_gem_pin {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700585 __u32 handle;
Tao Baod7db5942015-01-28 10:07:51 -0800586 __u32 pad;
587 __u64 alignment;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800588 __u64 offset;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700589};
Ben Cheng655a7c02013-10-16 16:09:24 -0700590struct drm_i915_gem_unpin {
Tao Baod7db5942015-01-28 10:07:51 -0800591 __u32 handle;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800592 __u32 pad;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700593};
Ben Cheng655a7c02013-10-16 16:09:24 -0700594struct drm_i915_gem_busy {
Tao Baod7db5942015-01-28 10:07:51 -0800595 __u32 handle;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800596 __u32 busy;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700597};
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700598struct drm_i915_gem_caching {
599 __u32 handle;
Ben Cheng655a7c02013-10-16 16:09:24 -0700600#define I915_CACHING_NONE 0
Ben Cheng655a7c02013-10-16 16:09:24 -0700601#define I915_CACHING_CACHED 1
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800602#define I915_CACHING_DISPLAY 2
Tao Baod7db5942015-01-28 10:07:51 -0800603 __u32 caching;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800604};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700605#define I915_TILING_NONE 0
Ben Cheng655a7c02013-10-16 16:09:24 -0700606#define I915_TILING_X 1
607#define I915_TILING_Y 2
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800608#define I915_TILING_LAST I915_TILING_Y
Ben Cheng655a7c02013-10-16 16:09:24 -0700609#define I915_BIT_6_SWIZZLE_NONE 0
Christopher Ferris106b3a82016-08-24 12:15:38 -0700610#define I915_BIT_6_SWIZZLE_9 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700611#define I915_BIT_6_SWIZZLE_9_10 2
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800612#define I915_BIT_6_SWIZZLE_9_11 3
Ben Cheng655a7c02013-10-16 16:09:24 -0700613#define I915_BIT_6_SWIZZLE_9_10_11 4
Christopher Ferris106b3a82016-08-24 12:15:38 -0700614#define I915_BIT_6_SWIZZLE_UNKNOWN 5
Ben Cheng655a7c02013-10-16 16:09:24 -0700615#define I915_BIT_6_SWIZZLE_9_17 6
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800616#define I915_BIT_6_SWIZZLE_9_10_17 7
Ben Cheng655a7c02013-10-16 16:09:24 -0700617struct drm_i915_gem_set_tiling {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700618 __u32 handle;
Tao Baod7db5942015-01-28 10:07:51 -0800619 __u32 tiling_mode;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800620 __u32 stride;
Tao Baod7db5942015-01-28 10:07:51 -0800621 __u32 swizzle_mode;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700622};
Ben Cheng655a7c02013-10-16 16:09:24 -0700623struct drm_i915_gem_get_tiling {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800624 __u32 handle;
Tao Baod7db5942015-01-28 10:07:51 -0800625 __u32 tiling_mode;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700626 __u32 swizzle_mode;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800627 __u32 phys_swizzle_mode;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800628};
Ben Cheng655a7c02013-10-16 16:09:24 -0700629struct drm_i915_gem_get_aperture {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700630 __u64 aper_size;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800631 __u64 aper_available_size;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800632};
Ben Cheng655a7c02013-10-16 16:09:24 -0700633struct drm_i915_get_pipe_from_crtc_id {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700634 __u32 crtc_id;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800635 __u32 pipe;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800636};
Ben Cheng655a7c02013-10-16 16:09:24 -0700637#define I915_MADV_WILLNEED 0
Christopher Ferris106b3a82016-08-24 12:15:38 -0700638#define I915_MADV_DONTNEED 1
Christopher Ferris05d08e92016-02-04 13:16:38 -0800639#define __I915_MADV_PURGED 2
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800640struct drm_i915_gem_madvise {
Tao Baod7db5942015-01-28 10:07:51 -0800641 __u32 handle;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700642 __u32 madv;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800643 __u32 retained;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800644};
Ben Cheng655a7c02013-10-16 16:09:24 -0700645#define I915_OVERLAY_TYPE_MASK 0xff
Christopher Ferris106b3a82016-08-24 12:15:38 -0700646#define I915_OVERLAY_YUV_PLANAR 0x01
Christopher Ferris05d08e92016-02-04 13:16:38 -0800647#define I915_OVERLAY_YUV_PACKED 0x02
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800648#define I915_OVERLAY_RGB 0x03
Ben Cheng655a7c02013-10-16 16:09:24 -0700649#define I915_OVERLAY_DEPTH_MASK 0xff00
Christopher Ferris106b3a82016-08-24 12:15:38 -0700650#define I915_OVERLAY_RGB24 0x1000
Christopher Ferris05d08e92016-02-04 13:16:38 -0800651#define I915_OVERLAY_RGB16 0x2000
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800652#define I915_OVERLAY_RGB15 0x3000
Ben Cheng655a7c02013-10-16 16:09:24 -0700653#define I915_OVERLAY_YUV422 0x0100
Christopher Ferris106b3a82016-08-24 12:15:38 -0700654#define I915_OVERLAY_YUV411 0x0200
Christopher Ferris05d08e92016-02-04 13:16:38 -0800655#define I915_OVERLAY_YUV420 0x0300
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800656#define I915_OVERLAY_YUV410 0x0400
Ben Cheng655a7c02013-10-16 16:09:24 -0700657#define I915_OVERLAY_SWAP_MASK 0xff0000
Christopher Ferris106b3a82016-08-24 12:15:38 -0700658#define I915_OVERLAY_NO_SWAP 0x000000
Christopher Ferris05d08e92016-02-04 13:16:38 -0800659#define I915_OVERLAY_UV_SWAP 0x010000
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800660#define I915_OVERLAY_Y_SWAP 0x020000
Ben Cheng655a7c02013-10-16 16:09:24 -0700661#define I915_OVERLAY_Y_AND_UV_SWAP 0x030000
Christopher Ferris106b3a82016-08-24 12:15:38 -0700662#define I915_OVERLAY_FLAGS_MASK 0xff000000
Christopher Ferris05d08e92016-02-04 13:16:38 -0800663#define I915_OVERLAY_ENABLE 0x01000000
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800664struct drm_intel_overlay_put_image {
Tao Baod7db5942015-01-28 10:07:51 -0800665 __u32 flags;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700666 __u32 bo_handle;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800667 __u16 stride_Y;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800668 __u16 stride_UV;
Tao Baod7db5942015-01-28 10:07:51 -0800669 __u32 offset_Y;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700670 __u32 offset_U;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800671 __u32 offset_V;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800672 __u16 src_width;
Tao Baod7db5942015-01-28 10:07:51 -0800673 __u16 src_height;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700674 __u16 src_scan_width;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800675 __u16 src_scan_height;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800676 __u32 crtc_id;
Tao Baod7db5942015-01-28 10:07:51 -0800677 __u16 dst_x;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700678 __u16 dst_y;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800679 __u16 dst_width;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800680 __u16 dst_height;
Ben Cheng655a7c02013-10-16 16:09:24 -0700681};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700682#define I915_OVERLAY_UPDATE_ATTRS (1 << 0)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800683#define I915_OVERLAY_UPDATE_GAMMA (1 << 1)
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800684#define I915_OVERLAY_DISABLE_DEST_COLORKEY (1 << 2)
Ben Cheng655a7c02013-10-16 16:09:24 -0700685struct drm_intel_overlay_attrs {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700686 __u32 flags;
Tao Baod7db5942015-01-28 10:07:51 -0800687 __u32 color_key;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800688 __s32 brightness;
Tao Baod7db5942015-01-28 10:07:51 -0800689 __u32 contrast;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700690 __u32 saturation;
Tao Baod7db5942015-01-28 10:07:51 -0800691 __u32 gamma0;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800692 __u32 gamma1;
Tao Baod7db5942015-01-28 10:07:51 -0800693 __u32 gamma2;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700694 __u32 gamma3;
Tao Baod7db5942015-01-28 10:07:51 -0800695 __u32 gamma4;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800696 __u32 gamma5;
Ben Cheng655a7c02013-10-16 16:09:24 -0700697};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700698#define I915_SET_COLORKEY_NONE (1 << 0)
Tao Baod7db5942015-01-28 10:07:51 -0800699#define I915_SET_COLORKEY_DESTINATION (1 << 1)
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800700#define I915_SET_COLORKEY_SOURCE (1 << 2)
Ben Cheng655a7c02013-10-16 16:09:24 -0700701struct drm_intel_sprite_colorkey {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700702 __u32 plane_id;
Tao Baod7db5942015-01-28 10:07:51 -0800703 __u32 min_value;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800704 __u32 channel_mask;
Tao Baod7db5942015-01-28 10:07:51 -0800705 __u32 max_value;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700706 __u32 flags;
Ben Cheng655a7c02013-10-16 16:09:24 -0700707};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800708struct drm_i915_gem_wait {
Tao Baod7db5942015-01-28 10:07:51 -0800709 __u32 bo_handle;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700710 __u32 flags;
Tao Baod7db5942015-01-28 10:07:51 -0800711 __s64 timeout_ns;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800712};
Ben Cheng655a7c02013-10-16 16:09:24 -0700713struct drm_i915_gem_context_create {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700714 __u32 ctx_id;
Tao Baod7db5942015-01-28 10:07:51 -0800715 __u32 pad;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800716};
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700717struct drm_i915_gem_context_create_ext {
718 __u32 ctx_id;
719 __u32 flags;
720#define I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS (1u << 0)
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700721#define I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE (1u << 1)
722#define I915_CONTEXT_CREATE_FLAGS_UNKNOWN (- (I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE << 1))
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700723 __u64 extensions;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700724#define I915_CONTEXT_CREATE_EXT_SETPARAM 0
725#define I915_CONTEXT_CREATE_EXT_CLONE 1
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700726};
727struct drm_i915_gem_context_param {
728 __u32 ctx_id;
729 __u32 size;
730 __u64 param;
731#define I915_CONTEXT_PARAM_BAN_PERIOD 0x1
732#define I915_CONTEXT_PARAM_NO_ZEROMAP 0x2
733#define I915_CONTEXT_PARAM_GTT_SIZE 0x3
734#define I915_CONTEXT_PARAM_NO_ERROR_CAPTURE 0x4
735#define I915_CONTEXT_PARAM_BANNABLE 0x5
736#define I915_CONTEXT_PARAM_PRIORITY 0x6
737#define I915_CONTEXT_MAX_USER_PRIORITY 1023
738#define I915_CONTEXT_DEFAULT_PRIORITY 0
739#define I915_CONTEXT_MIN_USER_PRIORITY - 1023
740#define I915_CONTEXT_PARAM_SSEU 0x7
741#define I915_CONTEXT_PARAM_RECOVERABLE 0x8
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700742#define I915_CONTEXT_PARAM_VM 0x9
743#define I915_CONTEXT_PARAM_ENGINES 0xa
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800744#define I915_CONTEXT_PARAM_PERSISTENCE 0xb
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700745#define I915_CONTEXT_PARAM_RINGSIZE 0xc
Christopher Ferrisa4792612022-01-10 13:51:15 -0800746#define I915_CONTEXT_PARAM_PROTECTED_CONTENT 0xd
Christopher Ferris7ac54f52024-08-07 21:07:12 +0000747#define I915_CONTEXT_PARAM_LOW_LATENCY 0xe
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700748 __u64 value;
749};
750struct drm_i915_gem_context_param_sseu {
751 struct i915_engine_class_instance engine;
752 __u32 flags;
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700753#define I915_CONTEXT_SSEU_FLAG_ENGINE_INDEX (1u << 0)
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700754 __u64 slice_mask;
755 __u64 subslice_mask;
756 __u16 min_eus_per_subslice;
757 __u16 max_eus_per_subslice;
758 __u32 rsvd;
759};
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700760struct i915_context_engines_load_balance {
761 struct i915_user_extension base;
762 __u16 engine_index;
763 __u16 num_siblings;
764 __u32 flags;
765 __u64 mbz64;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700766 struct i915_engine_class_instance engines[];
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700767} __attribute__((packed));
768#define I915_DEFINE_CONTEXT_ENGINES_LOAD_BALANCE(name__,N__) struct { struct i915_user_extension base; __u16 engine_index; __u16 num_siblings; __u32 flags; __u64 mbz64; struct i915_engine_class_instance engines[N__]; \
769} __attribute__((packed)) name__
770struct i915_context_engines_bond {
771 struct i915_user_extension base;
772 struct i915_engine_class_instance master;
773 __u16 virtual_index;
774 __u16 num_bonds;
775 __u64 flags;
776 __u64 mbz64[4];
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700777 struct i915_engine_class_instance engines[];
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700778} __attribute__((packed));
779#define I915_DEFINE_CONTEXT_ENGINES_BOND(name__,N__) struct { struct i915_user_extension base; struct i915_engine_class_instance master; __u16 virtual_index; __u16 num_bonds; __u64 flags; __u64 mbz64[4]; struct i915_engine_class_instance engines[N__]; \
780} __attribute__((packed)) name__
Christopher Ferrisa4792612022-01-10 13:51:15 -0800781struct i915_context_engines_parallel_submit {
782 struct i915_user_extension base;
783 __u16 engine_index;
784 __u16 width;
785 __u16 num_siblings;
786 __u16 mbz16;
787 __u64 flags;
788 __u64 mbz64[3];
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700789 struct i915_engine_class_instance engines[];
Colin Cross4ac33222022-12-15 15:45:35 -0800790} __attribute__((__packed__));
Christopher Ferrisa4792612022-01-10 13:51:15 -0800791#define I915_DEFINE_CONTEXT_ENGINES_PARALLEL_SUBMIT(name__,N__) struct { struct i915_user_extension base; __u16 engine_index; __u16 width; __u16 num_siblings; __u16 mbz16; __u64 flags; __u64 mbz64[3]; struct i915_engine_class_instance engines[N__]; \
792} __attribute__((packed)) name__
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700793struct i915_context_param_engines {
794 __u64 extensions;
795#define I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE 0
796#define I915_CONTEXT_ENGINES_EXT_BOND 1
Christopher Ferrisa4792612022-01-10 13:51:15 -0800797#define I915_CONTEXT_ENGINES_EXT_PARALLEL_SUBMIT 2
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700798 struct i915_engine_class_instance engines[];
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700799} __attribute__((packed));
800#define I915_DEFINE_CONTEXT_PARAM_ENGINES(name__,N__) struct { __u64 extensions; struct i915_engine_class_instance engines[N__]; \
801} __attribute__((packed)) name__
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700802struct drm_i915_gem_context_create_ext_setparam {
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700803 struct i915_user_extension base;
804 struct drm_i915_gem_context_param param;
805};
Ben Cheng655a7c02013-10-16 16:09:24 -0700806struct drm_i915_gem_context_destroy {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700807 __u32 ctx_id;
Tao Baod7db5942015-01-28 10:07:51 -0800808 __u32 pad;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800809};
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700810struct drm_i915_gem_vm_control {
811 __u64 extensions;
812 __u32 flags;
813 __u32 vm_id;
814};
Ben Cheng655a7c02013-10-16 16:09:24 -0700815struct drm_i915_reg_read {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700816 __u64 offset;
Christopher Ferris934ec942018-01-31 15:29:16 -0800817#define I915_REG_READ_8B_WA (1ul << 0)
Tao Baod7db5942015-01-28 10:07:51 -0800818 __u64 val;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800819};
Christopher Ferris38062f92014-07-09 15:33:25 -0700820struct drm_i915_reset_stats {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700821 __u32 ctx_id;
Tao Baod7db5942015-01-28 10:07:51 -0800822 __u32 flags;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800823 __u32 reset_count;
Tao Baod7db5942015-01-28 10:07:51 -0800824 __u32 batch_active;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700825 __u32 batch_pending;
Tao Baod7db5942015-01-28 10:07:51 -0800826 __u32 pad;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800827};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700828struct drm_i915_gem_userptr {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700829 __u64 user_ptr;
Tao Baod7db5942015-01-28 10:07:51 -0800830 __u64 user_size;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800831 __u32 flags;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700832#define I915_USERPTR_READ_ONLY 0x1
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700833#define I915_USERPTR_PROBE 0x2
Christopher Ferris106b3a82016-08-24 12:15:38 -0700834#define I915_USERPTR_UNSYNCHRONIZED 0x80000000
Tao Baod7db5942015-01-28 10:07:51 -0800835 __u32 handle;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800836};
Christopher Ferris525ce912017-07-26 13:12:53 -0700837enum drm_i915_oa_format {
838 I915_OA_FORMAT_A13 = 1,
839 I915_OA_FORMAT_A29,
840 I915_OA_FORMAT_A13_B8_C8,
841 I915_OA_FORMAT_B4_C8,
842 I915_OA_FORMAT_A45_B8_C8,
843 I915_OA_FORMAT_B4_C8_A16,
844 I915_OA_FORMAT_C4_B8,
Christopher Ferris1308ad32017-11-14 17:32:13 -0800845 I915_OA_FORMAT_A12,
846 I915_OA_FORMAT_A12_B8_C8,
847 I915_OA_FORMAT_A32u40_A4u32_B8_C8,
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800848 I915_OAR_FORMAT_A32u40_A4u32_B8_C8,
849 I915_OA_FORMAT_A24u40_A14u32_B8_C8,
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700850 I915_OAM_FORMAT_MPEC8u64_B8_C8,
851 I915_OAM_FORMAT_MPEC8u32_B8_C8,
Christopher Ferris525ce912017-07-26 13:12:53 -0700852 I915_OA_FORMAT_MAX
853};
854enum drm_i915_perf_property_id {
855 DRM_I915_PERF_PROP_CTX_HANDLE = 1,
856 DRM_I915_PERF_PROP_SAMPLE_OA,
857 DRM_I915_PERF_PROP_OA_METRICS_SET,
858 DRM_I915_PERF_PROP_OA_FORMAT,
859 DRM_I915_PERF_PROP_OA_EXPONENT,
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800860 DRM_I915_PERF_PROP_HOLD_PREEMPTION,
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700861 DRM_I915_PERF_PROP_GLOBAL_SSEU,
862 DRM_I915_PERF_PROP_POLL_OA_PERIOD,
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700863 DRM_I915_PERF_PROP_OA_ENGINE_CLASS,
864 DRM_I915_PERF_PROP_OA_ENGINE_INSTANCE,
Christopher Ferris525ce912017-07-26 13:12:53 -0700865 DRM_I915_PERF_PROP_MAX
866};
867struct drm_i915_perf_open_param {
868 __u32 flags;
869#define I915_PERF_FLAG_FD_CLOEXEC (1 << 0)
870#define I915_PERF_FLAG_FD_NONBLOCK (1 << 1)
871#define I915_PERF_FLAG_DISABLED (1 << 2)
872 __u32 num_properties;
873 __u64 properties_ptr;
874};
875#define I915_PERF_IOCTL_ENABLE _IO('i', 0x0)
876#define I915_PERF_IOCTL_DISABLE _IO('i', 0x1)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800877#define I915_PERF_IOCTL_CONFIG _IO('i', 0x2)
Christopher Ferris525ce912017-07-26 13:12:53 -0700878struct drm_i915_perf_record_header {
879 __u32 type;
880 __u16 pad;
881 __u16 size;
882};
883enum drm_i915_perf_record_type {
884 DRM_I915_PERF_RECORD_SAMPLE = 1,
885 DRM_I915_PERF_RECORD_OA_REPORT_LOST = 2,
886 DRM_I915_PERF_RECORD_OA_BUFFER_LOST = 3,
887 DRM_I915_PERF_RECORD_MAX
888};
Christopher Ferris1308ad32017-11-14 17:32:13 -0800889struct drm_i915_perf_oa_config {
890 char uuid[36];
891 __u32 n_mux_regs;
892 __u32 n_boolean_regs;
893 __u32 n_flex_regs;
Christopher Ferris934ec942018-01-31 15:29:16 -0800894 __u64 mux_regs_ptr;
895 __u64 boolean_regs_ptr;
896 __u64 flex_regs_ptr;
Christopher Ferris1308ad32017-11-14 17:32:13 -0800897};
Christopher Ferris76a1d452018-06-27 14:12:29 -0700898struct drm_i915_query_item {
899 __u64 query_id;
900#define DRM_I915_QUERY_TOPOLOGY_INFO 1
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700901#define DRM_I915_QUERY_ENGINE_INFO 2
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800902#define DRM_I915_QUERY_PERF_CONFIG 3
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000903#define DRM_I915_QUERY_MEMORY_REGIONS 4
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700904#define DRM_I915_QUERY_HWCONFIG_BLOB 5
905#define DRM_I915_QUERY_GEOMETRY_SUBSLICES 6
Christopher Ferris7f4c8372024-06-03 14:22:19 -0700906#define DRM_I915_QUERY_GUC_SUBMISSION_VERSION 7
Christopher Ferris76a1d452018-06-27 14:12:29 -0700907 __s32 length;
908 __u32 flags;
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800909#define DRM_I915_QUERY_PERF_CONFIG_LIST 1
910#define DRM_I915_QUERY_PERF_CONFIG_DATA_FOR_UUID 2
911#define DRM_I915_QUERY_PERF_CONFIG_DATA_FOR_ID 3
Christopher Ferris76a1d452018-06-27 14:12:29 -0700912 __u64 data_ptr;
913};
914struct drm_i915_query {
915 __u32 num_items;
916 __u32 flags;
917 __u64 items_ptr;
918};
919struct drm_i915_query_topology_info {
920 __u16 flags;
921 __u16 max_slices;
922 __u16 max_subslices;
923 __u16 max_eus_per_subslice;
924 __u16 subslice_offset;
925 __u16 subslice_stride;
926 __u16 eu_offset;
927 __u16 eu_stride;
928 __u8 data[];
929};
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700930struct drm_i915_engine_info {
931 struct i915_engine_class_instance engine;
932 __u32 rsvd0;
933 __u64 flags;
Christopher Ferrisa4792612022-01-10 13:51:15 -0800934#define I915_ENGINE_INFO_HAS_LOGICAL_INSTANCE (1 << 0)
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700935 __u64 capabilities;
936#define I915_VIDEO_CLASS_CAPABILITY_HEVC (1 << 0)
937#define I915_VIDEO_AND_ENHANCE_CLASS_CAPABILITY_SFC (1 << 1)
Christopher Ferrisa4792612022-01-10 13:51:15 -0800938 __u16 logical_instance;
939 __u16 rsvd1[3];
940 __u64 rsvd2[3];
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700941};
942struct drm_i915_query_engine_info {
943 __u32 num_engines;
944 __u32 rsvd[3];
945 struct drm_i915_engine_info engines[];
946};
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800947struct drm_i915_query_perf_config {
948 union {
949 __u64 n_configs;
950 __u64 config;
951 char uuid[36];
952 };
953 __u32 flags;
954 __u8 data[];
955};
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000956enum drm_i915_gem_memory_class {
957 I915_MEMORY_CLASS_SYSTEM = 0,
958 I915_MEMORY_CLASS_DEVICE,
959};
960struct drm_i915_gem_memory_class_instance {
961 __u16 memory_class;
962 __u16 memory_instance;
963};
964struct drm_i915_memory_region_info {
965 struct drm_i915_gem_memory_class_instance region;
966 __u32 rsvd0;
967 __u64 probed_size;
968 __u64 unallocated_size;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700969 union {
970 __u64 rsvd1[8];
971 struct {
972 __u64 probed_cpu_visible_size;
973 __u64 unallocated_cpu_visible_size;
974 };
975 };
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000976};
977struct drm_i915_query_memory_regions {
978 __u32 num_regions;
979 __u32 rsvd[3];
980 struct drm_i915_memory_region_info regions[];
981};
Christopher Ferris7f4c8372024-06-03 14:22:19 -0700982struct drm_i915_query_guc_submission_version {
983 __u32 branch;
984 __u32 major;
985 __u32 minor;
986 __u32 patch;
987};
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000988struct drm_i915_gem_create_ext {
989 __u64 size;
990 __u32 handle;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700991#define I915_GEM_CREATE_EXT_FLAG_NEEDS_CPU_ACCESS (1 << 0)
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000992 __u32 flags;
993#define I915_GEM_CREATE_EXT_MEMORY_REGIONS 0
Christopher Ferrisa4792612022-01-10 13:51:15 -0800994#define I915_GEM_CREATE_EXT_PROTECTED_CONTENT 1
Christopher Ferris8666d042023-09-06 14:55:31 -0700995#define I915_GEM_CREATE_EXT_SET_PAT 2
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000996 __u64 extensions;
997};
998struct drm_i915_gem_create_ext_memory_regions {
999 struct i915_user_extension base;
1000 __u32 pad;
1001 __u32 num_regions;
1002 __u64 regions;
1003};
Christopher Ferrisa4792612022-01-10 13:51:15 -08001004struct drm_i915_gem_create_ext_protected_content {
1005 struct i915_user_extension base;
1006 __u32 flags;
1007};
Christopher Ferris8666d042023-09-06 14:55:31 -07001008struct drm_i915_gem_create_ext_set_pat {
1009 struct i915_user_extension base;
1010 __u32 pat_index;
1011 __u32 rsvd;
1012};
Christopher Ferrisa4792612022-01-10 13:51:15 -08001013#define I915_PROTECTED_CONTENT_DEFAULT_SESSION 0xf
Christopher Ferris106b3a82016-08-24 12:15:38 -07001014#ifdef __cplusplus
Christopher Ferris48fe0ae2019-01-10 15:59:33 -08001015}
Ben Cheng655a7c02013-10-16 16:09:24 -07001016#endif
Christopher Ferris48af7cb2017-02-21 12:35:09 -08001017#endif