• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef _MSM_KGSL_H
20 #define _MSM_KGSL_H
21 #include <linux/types.h>
22 #include <linux/ioctl.h>
23 #define KGSL_VERSION_MAJOR 3
24 #define KGSL_VERSION_MINOR 14
25 #define KGSL_CONTEXT_SAVE_GMEM 0x00000001
26 #define KGSL_CONTEXT_NO_GMEM_ALLOC 0x00000002
27 #define KGSL_CONTEXT_SUBMIT_IB_LIST 0x00000004
28 #define KGSL_CONTEXT_CTX_SWITCH 0x00000008
29 #define KGSL_CONTEXT_PREAMBLE 0x00000010
30 #define KGSL_CONTEXT_TRASH_STATE 0x00000020
31 #define KGSL_CONTEXT_PER_CONTEXT_TS 0x00000040
32 #define KGSL_CONTEXT_USER_GENERATED_TS 0x00000080
33 #define KGSL_CONTEXT_END_OF_FRAME 0x00000100
34 #define KGSL_CONTEXT_NO_FAULT_TOLERANCE 0x00000200
35 #define KGSL_CONTEXT_SYNC 0x00000400
36 #define KGSL_CONTEXT_PWR_CONSTRAINT 0x00000800
37 #define KGSL_CONTEXT_PRIORITY_MASK 0x0000F000
38 #define KGSL_CONTEXT_PRIORITY_SHIFT 12
39 #define KGSL_CONTEXT_PRIORITY_UNDEF 0
40 #define KGSL_CONTEXT_IFH_NOP 0x00010000
41 #define KGSL_CONTEXT_SECURE 0x00020000
42 #define KGSL_CONTEXT_NO_SNAPSHOT 0x00040000
43 #define KGSL_CONTEXT_SPARSE 0x00080000
44 #define KGSL_CONTEXT_PREEMPT_STYLE_MASK 0x0E000000
45 #define KGSL_CONTEXT_PREEMPT_STYLE_SHIFT 25
46 #define KGSL_CONTEXT_PREEMPT_STYLE_DEFAULT 0x0
47 #define KGSL_CONTEXT_PREEMPT_STYLE_RINGBUFFER 0x1
48 #define KGSL_CONTEXT_PREEMPT_STYLE_FINEGRAIN 0x2
49 #define KGSL_CONTEXT_TYPE_MASK 0x01F00000
50 #define KGSL_CONTEXT_TYPE_SHIFT 20
51 #define KGSL_CONTEXT_TYPE_ANY 0
52 #define KGSL_CONTEXT_TYPE_GL 1
53 #define KGSL_CONTEXT_TYPE_CL 2
54 #define KGSL_CONTEXT_TYPE_C2D 3
55 #define KGSL_CONTEXT_TYPE_RS 4
56 #define KGSL_CONTEXT_TYPE_VK 5
57 #define KGSL_CONTEXT_TYPE_UNKNOWN 0x1E
58 #define KGSL_CONTEXT_INVALIDATE_ON_FAULT 0x10000000
59 #define KGSL_CONTEXT_INVALID 0xffffffff
60 #define KGSL_CMDBATCH_MEMLIST 0x00000001
61 #define KGSL_CMDBATCH_MARKER 0x00000002
62 #define KGSL_CMDBATCH_SUBMIT_IB_LIST KGSL_CONTEXT_SUBMIT_IB_LIST
63 #define KGSL_CMDBATCH_CTX_SWITCH KGSL_CONTEXT_CTX_SWITCH
64 #define KGSL_CMDBATCH_PROFILING 0x00000010
65 #define KGSL_CMDBATCH_PROFILING_KTIME 0x00000020
66 #define KGSL_CMDBATCH_END_OF_FRAME KGSL_CONTEXT_END_OF_FRAME
67 #define KGSL_CMDBATCH_SYNC KGSL_CONTEXT_SYNC
68 #define KGSL_CMDBATCH_PWR_CONSTRAINT KGSL_CONTEXT_PWR_CONSTRAINT
69 #define KGSL_CMDBATCH_SPARSE 0x1000
70 #define KGSL_CMDLIST_IB 0x00000001U
71 #define KGSL_CMDLIST_CTXTSWITCH_PREAMBLE 0x00000002U
72 #define KGSL_CMDLIST_IB_PREAMBLE 0x00000004U
73 #define KGSL_OBJLIST_MEMOBJ 0x00000008U
74 #define KGSL_OBJLIST_PROFILE 0x00000010U
75 #define KGSL_CMD_SYNCPOINT_TYPE_TIMESTAMP 0
76 #define KGSL_CMD_SYNCPOINT_TYPE_FENCE 1
77 #define KGSL_MEMFLAGS_SECURE 0x00000008ULL
78 #define KGSL_MEMFLAGS_GPUREADONLY 0x01000000U
79 #define KGSL_MEMFLAGS_GPUWRITEONLY 0x02000000U
80 #define KGSL_MEMFLAGS_FORCE_32BIT 0x100000000ULL
81 #define KGSL_SPARSE_BIND_MULTIPLE_TO_PHYS 0x400000000ULL
82 #define KGSL_SPARSE_BIND 0x1ULL
83 #define KGSL_SPARSE_UNBIND 0x2ULL
84 #define KGSL_CACHEMODE_MASK 0x0C000000U
85 #define KGSL_CACHEMODE_SHIFT 26
86 #define KGSL_CACHEMODE_WRITECOMBINE 0
87 #define KGSL_CACHEMODE_UNCACHED 1
88 #define KGSL_CACHEMODE_WRITETHROUGH 2
89 #define KGSL_CACHEMODE_WRITEBACK 3
90 #define KGSL_MEMFLAGS_USE_CPU_MAP 0x10000000ULL
91 #define KGSL_MEMFLAGS_SPARSE_PHYS 0x20000000ULL
92 #define KGSL_MEMFLAGS_SPARSE_VIRT 0x40000000ULL
93 #define KGSL_MEMFLAGS_IOCOHERENT 0x80000000ULL
94 #define KGSL_MEMTYPE_MASK 0x0000FF00
95 #define KGSL_MEMTYPE_SHIFT 8
96 #define KGSL_MEMTYPE_OBJECTANY 0
97 #define KGSL_MEMTYPE_FRAMEBUFFER 1
98 #define KGSL_MEMTYPE_RENDERBUFFER 2
99 #define KGSL_MEMTYPE_ARRAYBUFFER 3
100 #define KGSL_MEMTYPE_ELEMENTARRAYBUFFER 4
101 #define KGSL_MEMTYPE_VERTEXARRAYBUFFER 5
102 #define KGSL_MEMTYPE_TEXTURE 6
103 #define KGSL_MEMTYPE_SURFACE 7
104 #define KGSL_MEMTYPE_EGL_SURFACE 8
105 #define KGSL_MEMTYPE_GL 9
106 #define KGSL_MEMTYPE_CL 10
107 #define KGSL_MEMTYPE_CL_BUFFER_MAP 11
108 #define KGSL_MEMTYPE_CL_BUFFER_NOMAP 12
109 #define KGSL_MEMTYPE_CL_IMAGE_MAP 13
110 #define KGSL_MEMTYPE_CL_IMAGE_NOMAP 14
111 #define KGSL_MEMTYPE_CL_KERNEL_STACK 15
112 #define KGSL_MEMTYPE_COMMAND 16
113 #define KGSL_MEMTYPE_2D 17
114 #define KGSL_MEMTYPE_EGL_IMAGE 18
115 #define KGSL_MEMTYPE_EGL_SHADOW 19
116 #define KGSL_MEMTYPE_MULTISAMPLE 20
117 #define KGSL_MEMTYPE_KERNEL 255
118 #define KGSL_MEMALIGN_MASK 0x00FF0000
119 #define KGSL_MEMALIGN_SHIFT 16
120 enum kgsl_user_mem_type {
121   KGSL_USER_MEM_TYPE_PMEM = 0x00000000,
122   KGSL_USER_MEM_TYPE_ASHMEM = 0x00000001,
123   KGSL_USER_MEM_TYPE_ADDR = 0x00000002,
124   KGSL_USER_MEM_TYPE_ION = 0x00000003,
125   KGSL_USER_MEM_TYPE_DMABUF = 0x00000003,
126   KGSL_USER_MEM_TYPE_MAX = 0x00000007,
127 };
128 #define KGSL_MEMFLAGS_USERMEM_MASK 0x000000e0
129 #define KGSL_MEMFLAGS_USERMEM_SHIFT 5
130 #define KGSL_USERMEM_FLAG(x) (((x) + 1) << KGSL_MEMFLAGS_USERMEM_SHIFT)
131 #define KGSL_MEMFLAGS_NOT_USERMEM 0
132 #define KGSL_MEMFLAGS_USERMEM_PMEM KGSL_USERMEM_FLAG(KGSL_USER_MEM_TYPE_PMEM)
133 #define KGSL_MEMFLAGS_USERMEM_ASHMEM KGSL_USERMEM_FLAG(KGSL_USER_MEM_TYPE_ASHMEM)
134 #define KGSL_MEMFLAGS_USERMEM_ADDR KGSL_USERMEM_FLAG(KGSL_USER_MEM_TYPE_ADDR)
135 #define KGSL_MEMFLAGS_USERMEM_ION KGSL_USERMEM_FLAG(KGSL_USER_MEM_TYPE_ION)
136 #define KGSL_FLAGS_NORMALMODE 0x00000000
137 #define KGSL_FLAGS_SAFEMODE 0x00000001
138 #define KGSL_FLAGS_INITIALIZED0 0x00000002
139 #define KGSL_FLAGS_INITIALIZED 0x00000004
140 #define KGSL_FLAGS_STARTED 0x00000008
141 #define KGSL_FLAGS_ACTIVE 0x00000010
142 #define KGSL_FLAGS_RESERVED0 0x00000020
143 #define KGSL_FLAGS_RESERVED1 0x00000040
144 #define KGSL_FLAGS_RESERVED2 0x00000080
145 #define KGSL_FLAGS_SOFT_RESET 0x00000100
146 #define KGSL_FLAGS_PER_CONTEXT_TIMESTAMPS 0x00000200
147 #define KGSL_SYNCOBJ_SERVER_TIMEOUT 2000
148 #define KGSL_UBWC_NONE 0
149 #define KGSL_UBWC_1_0 1
150 #define KGSL_UBWC_2_0 2
151 #define KGSL_UBWC_3_0 3
152 enum kgsl_ctx_reset_stat {
153   KGSL_CTX_STAT_NO_ERROR = 0x00000000,
154   KGSL_CTX_STAT_GUILTY_CONTEXT_RESET_EXT = 0x00000001,
155   KGSL_CTX_STAT_INNOCENT_CONTEXT_RESET_EXT = 0x00000002,
156   KGSL_CTX_STAT_UNKNOWN_CONTEXT_RESET_EXT = 0x00000003
157 };
158 #define KGSL_CONVERT_TO_MBPS(val) (val * 1000 * 1000U)
159 enum kgsl_deviceid {
160   KGSL_DEVICE_3D0 = 0x00000000,
161   KGSL_DEVICE_MAX
162 };
163 struct kgsl_devinfo {
164   unsigned int device_id;
165   unsigned int chip_id;
166   unsigned int mmu_enabled;
167   unsigned long gmem_gpubaseaddr;
168   unsigned int gpu_id;
169   size_t gmem_sizebytes;
170 };
171 struct kgsl_devmemstore {
172   __volatile__ unsigned int soptimestamp;
173   unsigned int sbz;
174   __volatile__ unsigned int eoptimestamp;
175   unsigned int sbz2;
176   __volatile__ unsigned int preempted;
177   unsigned int sbz3;
178   __volatile__ unsigned int ref_wait_ts;
179   unsigned int sbz4;
180   unsigned int current_context;
181   unsigned int sbz5;
182 };
183 #define KGSL_MEMSTORE_OFFSET(ctxt_id,field) ((ctxt_id) * sizeof(struct kgsl_devmemstore) + offsetof(struct kgsl_devmemstore, field))
184 enum kgsl_timestamp_type {
185   KGSL_TIMESTAMP_CONSUMED = 0x00000001,
186   KGSL_TIMESTAMP_RETIRED = 0x00000002,
187   KGSL_TIMESTAMP_QUEUED = 0x00000003,
188 };
189 #define KGSL_PROP_DEVICE_INFO 0x1
190 #define KGSL_PROP_DEVICE_SHADOW 0x2
191 #define KGSL_PROP_DEVICE_POWER 0x3
192 #define KGSL_PROP_SHMEM 0x4
193 #define KGSL_PROP_SHMEM_APERTURES 0x5
194 #define KGSL_PROP_MMU_ENABLE 0x6
195 #define KGSL_PROP_INTERRUPT_WAITS 0x7
196 #define KGSL_PROP_VERSION 0x8
197 #define KGSL_PROP_GPU_RESET_STAT 0x9
198 #define KGSL_PROP_PWRCTRL 0xE
199 #define KGSL_PROP_PWR_CONSTRAINT 0x12
200 #define KGSL_PROP_UCHE_GMEM_VADDR 0x13
201 #define KGSL_PROP_SP_GENERIC_MEM 0x14
202 #define KGSL_PROP_UCODE_VERSION 0x15
203 #define KGSL_PROP_GPMU_VERSION 0x16
204 #define KGSL_PROP_HIGHEST_BANK_BIT 0x17
205 #define KGSL_PROP_DEVICE_BITNESS 0x18
206 #define KGSL_PROP_DEVICE_QDSS_STM 0x19
207 #define KGSL_PROP_MIN_ACCESS_LENGTH 0x1A
208 #define KGSL_PROP_UBWC_MODE 0x1B
209 #define KGSL_PROP_DEVICE_QTIMER 0x20
210 #define KGSL_PROP_L3_PWR_CONSTRAINT 0x22
211 #define KGSL_PROP_SECURE_BUFFER_ALIGNMENT 0x23
212 #define KGSL_PROP_SECURE_CTXT_SUPPORT 0x24
213 #define KGSL_PROP_SPEED_BIN 0x25
214 #define KGSL_PROP_GAMING_BIN 0x26
215 #define KGSL_PROP_CONTEXT_PROPERTY 0x28
216 #define KGSL_PROP_MACROTILING_CHANNELS 0x29
217 struct kgsl_shadowprop {
218   unsigned long gpuaddr;
219   size_t size;
220   unsigned int flags;
221 };
222 struct kgsl_qdss_stm_prop {
223   uint64_t gpuaddr;
224   uint64_t size;
225 };
226 struct kgsl_qtimer_prop {
227   uint64_t gpuaddr;
228   uint64_t size;
229 };
230 struct kgsl_version {
231   unsigned int drv_major;
232   unsigned int drv_minor;
233   unsigned int dev_major;
234   unsigned int dev_minor;
235 };
236 struct kgsl_sp_generic_mem {
237   uint64_t local;
238   uint64_t pvt;
239 };
240 struct kgsl_ucode_version {
241   unsigned int pfp;
242   unsigned int pm4;
243 };
244 struct kgsl_gpmu_version {
245   unsigned int major;
246   unsigned int minor;
247   unsigned int features;
248 };
249 struct kgsl_context_property {
250   __u64 data;
251   __u32 size;
252   __u32 type;
253   __u32 contextid;
254 };
255 struct kgsl_context_property_fault {
256   __s32 faults;
257   __u32 timestamp;
258 };
259 #define KGSL_CONTEXT_PROP_FAULTS 1
260 #define KGSL_PERFCOUNTER_GROUP_CP 0x0
261 #define KGSL_PERFCOUNTER_GROUP_RBBM 0x1
262 #define KGSL_PERFCOUNTER_GROUP_PC 0x2
263 #define KGSL_PERFCOUNTER_GROUP_VFD 0x3
264 #define KGSL_PERFCOUNTER_GROUP_HLSQ 0x4
265 #define KGSL_PERFCOUNTER_GROUP_VPC 0x5
266 #define KGSL_PERFCOUNTER_GROUP_TSE 0x6
267 #define KGSL_PERFCOUNTER_GROUP_RAS 0x7
268 #define KGSL_PERFCOUNTER_GROUP_UCHE 0x8
269 #define KGSL_PERFCOUNTER_GROUP_TP 0x9
270 #define KGSL_PERFCOUNTER_GROUP_SP 0xA
271 #define KGSL_PERFCOUNTER_GROUP_RB 0xB
272 #define KGSL_PERFCOUNTER_GROUP_PWR 0xC
273 #define KGSL_PERFCOUNTER_GROUP_VBIF 0xD
274 #define KGSL_PERFCOUNTER_GROUP_VBIF_PWR 0xE
275 #define KGSL_PERFCOUNTER_GROUP_MH 0xF
276 #define KGSL_PERFCOUNTER_GROUP_PA_SU 0x10
277 #define KGSL_PERFCOUNTER_GROUP_SQ 0x11
278 #define KGSL_PERFCOUNTER_GROUP_SX 0x12
279 #define KGSL_PERFCOUNTER_GROUP_TCF 0x13
280 #define KGSL_PERFCOUNTER_GROUP_TCM 0x14
281 #define KGSL_PERFCOUNTER_GROUP_TCR 0x15
282 #define KGSL_PERFCOUNTER_GROUP_L2 0x16
283 #define KGSL_PERFCOUNTER_GROUP_VSC 0x17
284 #define KGSL_PERFCOUNTER_GROUP_CCU 0x18
285 #define KGSL_PERFCOUNTER_GROUP_LRZ 0x19
286 #define KGSL_PERFCOUNTER_GROUP_CMP 0x1A
287 #define KGSL_PERFCOUNTER_GROUP_ALWAYSON 0x1B
288 #define KGSL_PERFCOUNTER_GROUP_SP_PWR 0x1C
289 #define KGSL_PERFCOUNTER_GROUP_TP_PWR 0x1D
290 #define KGSL_PERFCOUNTER_GROUP_RB_PWR 0x1E
291 #define KGSL_PERFCOUNTER_GROUP_CCU_PWR 0x1F
292 #define KGSL_PERFCOUNTER_GROUP_UCHE_PWR 0x20
293 #define KGSL_PERFCOUNTER_GROUP_CP_PWR 0x21
294 #define KGSL_PERFCOUNTER_GROUP_GPMU_PWR 0x22
295 #define KGSL_PERFCOUNTER_GROUP_ALWAYSON_PWR 0x23
296 #define KGSL_PERFCOUNTER_GROUP_MAX 0x24
297 #define KGSL_PERFCOUNTER_NOT_USED 0xFFFFFFFF
298 #define KGSL_PERFCOUNTER_BROKEN 0xFFFFFFFE
299 struct kgsl_ibdesc {
300   unsigned long gpuaddr;
301   unsigned long __pad;
302   size_t sizedwords;
303   unsigned int ctrl;
304 };
305 struct kgsl_cmdbatch_profiling_buffer {
306   uint64_t wall_clock_s;
307   uint64_t wall_clock_ns;
308   uint64_t gpu_ticks_queued;
309   uint64_t gpu_ticks_submitted;
310   uint64_t gpu_ticks_retired;
311 };
312 #define KGSL_IOC_TYPE 0x09
313 struct kgsl_device_getproperty {
314   unsigned int type;
315   void * value;
316   size_t sizebytes;
317 };
318 #define IOCTL_KGSL_DEVICE_GETPROPERTY _IOWR(KGSL_IOC_TYPE, 0x2, struct kgsl_device_getproperty)
319 struct kgsl_device_waittimestamp {
320   unsigned int timestamp;
321   unsigned int timeout;
322 };
323 #define IOCTL_KGSL_DEVICE_WAITTIMESTAMP _IOW(KGSL_IOC_TYPE, 0x6, struct kgsl_device_waittimestamp)
324 struct kgsl_device_waittimestamp_ctxtid {
325   unsigned int context_id;
326   unsigned int timestamp;
327   unsigned int timeout;
328 };
329 #define IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID _IOW(KGSL_IOC_TYPE, 0x7, struct kgsl_device_waittimestamp_ctxtid)
330 struct kgsl_ringbuffer_issueibcmds {
331   unsigned int drawctxt_id;
332   unsigned long ibdesc_addr;
333   unsigned int numibs;
334   unsigned int timestamp;
335   unsigned int flags;
336 };
337 #define IOCTL_KGSL_RINGBUFFER_ISSUEIBCMDS _IOWR(KGSL_IOC_TYPE, 0x10, struct kgsl_ringbuffer_issueibcmds)
338 struct kgsl_cmdstream_readtimestamp {
339   unsigned int type;
340   unsigned int timestamp;
341 };
342 #define IOCTL_KGSL_CMDSTREAM_READTIMESTAMP_OLD _IOR(KGSL_IOC_TYPE, 0x11, struct kgsl_cmdstream_readtimestamp)
343 #define IOCTL_KGSL_CMDSTREAM_READTIMESTAMP _IOWR(KGSL_IOC_TYPE, 0x11, struct kgsl_cmdstream_readtimestamp)
344 struct kgsl_cmdstream_freememontimestamp {
345   unsigned long gpuaddr;
346   unsigned int type;
347   unsigned int timestamp;
348 };
349 #define IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP _IOW(KGSL_IOC_TYPE, 0x12, struct kgsl_cmdstream_freememontimestamp)
350 #define IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP_OLD _IOR(KGSL_IOC_TYPE, 0x12, struct kgsl_cmdstream_freememontimestamp)
351 struct kgsl_drawctxt_create {
352   unsigned int flags;
353   unsigned int drawctxt_id;
354 };
355 #define IOCTL_KGSL_DRAWCTXT_CREATE _IOWR(KGSL_IOC_TYPE, 0x13, struct kgsl_drawctxt_create)
356 struct kgsl_drawctxt_destroy {
357   unsigned int drawctxt_id;
358 };
359 #define IOCTL_KGSL_DRAWCTXT_DESTROY _IOW(KGSL_IOC_TYPE, 0x14, struct kgsl_drawctxt_destroy)
360 struct kgsl_map_user_mem {
361   int fd;
362   unsigned long gpuaddr;
363   size_t len;
364   size_t offset;
365   unsigned long hostptr;
366   enum kgsl_user_mem_type memtype;
367   unsigned int flags;
368 };
369 #define IOCTL_KGSL_MAP_USER_MEM _IOWR(KGSL_IOC_TYPE, 0x15, struct kgsl_map_user_mem)
370 struct kgsl_cmdstream_readtimestamp_ctxtid {
371   unsigned int context_id;
372   unsigned int type;
373   unsigned int timestamp;
374 };
375 #define IOCTL_KGSL_CMDSTREAM_READTIMESTAMP_CTXTID _IOWR(KGSL_IOC_TYPE, 0x16, struct kgsl_cmdstream_readtimestamp_ctxtid)
376 struct kgsl_cmdstream_freememontimestamp_ctxtid {
377   unsigned int context_id;
378   unsigned long gpuaddr;
379   unsigned int type;
380   unsigned int timestamp;
381 };
382 #define IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP_CTXTID _IOW(KGSL_IOC_TYPE, 0x17, struct kgsl_cmdstream_freememontimestamp_ctxtid)
383 struct kgsl_sharedmem_from_pmem {
384   int pmem_fd;
385   unsigned long gpuaddr;
386   unsigned int len;
387   unsigned int offset;
388 };
389 #define IOCTL_KGSL_SHAREDMEM_FROM_PMEM _IOWR(KGSL_IOC_TYPE, 0x20, struct kgsl_sharedmem_from_pmem)
390 struct kgsl_sharedmem_free {
391   unsigned long gpuaddr;
392 };
393 #define IOCTL_KGSL_SHAREDMEM_FREE _IOW(KGSL_IOC_TYPE, 0x21, struct kgsl_sharedmem_free)
394 struct kgsl_cff_user_event {
395   unsigned char cff_opcode;
396   unsigned int op1;
397   unsigned int op2;
398   unsigned int op3;
399   unsigned int op4;
400   unsigned int op5;
401   unsigned int __pad[2];
402 };
403 #define IOCTL_KGSL_CFF_USER_EVENT _IOW(KGSL_IOC_TYPE, 0x31, struct kgsl_cff_user_event)
404 struct kgsl_gmem_desc {
405   unsigned int x;
406   unsigned int y;
407   unsigned int width;
408   unsigned int height;
409   unsigned int pitch;
410 };
411 struct kgsl_buffer_desc {
412   void * hostptr;
413   unsigned long gpuaddr;
414   int size;
415   unsigned int format;
416   unsigned int pitch;
417   unsigned int enabled;
418 };
419 struct kgsl_bind_gmem_shadow {
420   unsigned int drawctxt_id;
421   struct kgsl_gmem_desc gmem_desc;
422   unsigned int shadow_x;
423   unsigned int shadow_y;
424   struct kgsl_buffer_desc shadow_buffer;
425   unsigned int buffer_id;
426 };
427 #define IOCTL_KGSL_DRAWCTXT_BIND_GMEM_SHADOW _IOW(KGSL_IOC_TYPE, 0x22, struct kgsl_bind_gmem_shadow)
428 struct kgsl_sharedmem_from_vmalloc {
429   unsigned long gpuaddr;
430   unsigned int hostptr;
431   unsigned int flags;
432 };
433 #define IOCTL_KGSL_SHAREDMEM_FROM_VMALLOC _IOWR(KGSL_IOC_TYPE, 0x23, struct kgsl_sharedmem_from_vmalloc)
434 #define IOCTL_KGSL_SHAREDMEM_FLUSH_CACHE _IOW(KGSL_IOC_TYPE, 0x24, struct kgsl_sharedmem_free)
435 struct kgsl_drawctxt_set_bin_base_offset {
436   unsigned int drawctxt_id;
437   unsigned int offset;
438 };
439 #define IOCTL_KGSL_DRAWCTXT_SET_BIN_BASE_OFFSET _IOW(KGSL_IOC_TYPE, 0x25, struct kgsl_drawctxt_set_bin_base_offset)
440 enum kgsl_cmdwindow_type {
441   KGSL_CMDWINDOW_MIN = 0x00000000,
442   KGSL_CMDWINDOW_2D = 0x00000000,
443   KGSL_CMDWINDOW_3D = 0x00000001,
444   KGSL_CMDWINDOW_MMU = 0x00000002,
445   KGSL_CMDWINDOW_ARBITER = 0x000000FF,
446   KGSL_CMDWINDOW_MAX = 0x000000FF,
447 };
448 struct kgsl_cmdwindow_write {
449   enum kgsl_cmdwindow_type target;
450   unsigned int addr;
451   unsigned int data;
452 };
453 #define IOCTL_KGSL_CMDWINDOW_WRITE _IOW(KGSL_IOC_TYPE, 0x2e, struct kgsl_cmdwindow_write)
454 struct kgsl_gpumem_alloc {
455   unsigned long gpuaddr;
456   size_t size;
457   unsigned int flags;
458 };
459 #define IOCTL_KGSL_GPUMEM_ALLOC _IOWR(KGSL_IOC_TYPE, 0x2f, struct kgsl_gpumem_alloc)
460 struct kgsl_cff_syncmem {
461   unsigned long gpuaddr;
462   size_t len;
463   unsigned int __pad[2];
464 };
465 #define IOCTL_KGSL_CFF_SYNCMEM _IOW(KGSL_IOC_TYPE, 0x30, struct kgsl_cff_syncmem)
466 struct kgsl_timestamp_event {
467   int type;
468   unsigned int timestamp;
469   unsigned int context_id;
470   void * priv;
471   size_t len;
472 };
473 #define IOCTL_KGSL_TIMESTAMP_EVENT_OLD _IOW(KGSL_IOC_TYPE, 0x31, struct kgsl_timestamp_event)
474 #define KGSL_TIMESTAMP_EVENT_GENLOCK 1
475 struct kgsl_timestamp_event_genlock {
476   int handle;
477 };
478 #define KGSL_TIMESTAMP_EVENT_FENCE 2
479 struct kgsl_timestamp_event_fence {
480   int fence_fd;
481 };
482 #define IOCTL_KGSL_SETPROPERTY _IOW(KGSL_IOC_TYPE, 0x32, struct kgsl_device_getproperty)
483 #define IOCTL_KGSL_TIMESTAMP_EVENT _IOWR(KGSL_IOC_TYPE, 0x33, struct kgsl_timestamp_event)
484 struct kgsl_gpumem_alloc_id {
485   unsigned int id;
486   unsigned int flags;
487   size_t size;
488   size_t mmapsize;
489   unsigned long gpuaddr;
490   unsigned long __pad[2];
491 };
492 #define IOCTL_KGSL_GPUMEM_ALLOC_ID _IOWR(KGSL_IOC_TYPE, 0x34, struct kgsl_gpumem_alloc_id)
493 struct kgsl_gpumem_free_id {
494   unsigned int id;
495   unsigned int __pad;
496 };
497 #define IOCTL_KGSL_GPUMEM_FREE_ID _IOWR(KGSL_IOC_TYPE, 0x35, struct kgsl_gpumem_free_id)
498 struct kgsl_gpumem_get_info {
499   unsigned long gpuaddr;
500   unsigned int id;
501   unsigned int flags;
502   size_t size;
503   size_t mmapsize;
504   unsigned long useraddr;
505   unsigned long __pad[4];
506 };
507 #define IOCTL_KGSL_GPUMEM_GET_INFO _IOWR(KGSL_IOC_TYPE, 0x36, struct kgsl_gpumem_get_info)
508 struct kgsl_gpumem_sync_cache {
509   unsigned long gpuaddr;
510   unsigned int id;
511   unsigned int op;
512   size_t offset;
513   size_t length;
514 };
515 #define KGSL_GPUMEM_CACHE_CLEAN (1 << 0)
516 #define KGSL_GPUMEM_CACHE_TO_GPU KGSL_GPUMEM_CACHE_CLEAN
517 #define KGSL_GPUMEM_CACHE_INV (1 << 1)
518 #define KGSL_GPUMEM_CACHE_FROM_GPU KGSL_GPUMEM_CACHE_INV
519 #define KGSL_GPUMEM_CACHE_FLUSH (KGSL_GPUMEM_CACHE_CLEAN | KGSL_GPUMEM_CACHE_INV)
520 #define KGSL_GPUMEM_CACHE_RANGE (1 << 31U)
521 #define IOCTL_KGSL_GPUMEM_SYNC_CACHE _IOW(KGSL_IOC_TYPE, 0x37, struct kgsl_gpumem_sync_cache)
522 struct kgsl_perfcounter_get {
523   unsigned int groupid;
524   unsigned int countable;
525   unsigned int offset;
526   unsigned int offset_hi;
527   unsigned int __pad;
528 };
529 #define IOCTL_KGSL_PERFCOUNTER_GET _IOWR(KGSL_IOC_TYPE, 0x38, struct kgsl_perfcounter_get)
530 struct kgsl_perfcounter_put {
531   unsigned int groupid;
532   unsigned int countable;
533   unsigned int __pad[2];
534 };
535 #define IOCTL_KGSL_PERFCOUNTER_PUT _IOW(KGSL_IOC_TYPE, 0x39, struct kgsl_perfcounter_put)
536 struct kgsl_perfcounter_query {
537   unsigned int groupid;
538   unsigned int * countables;
539   unsigned int count;
540   unsigned int max_counters;
541   unsigned int __pad[2];
542 };
543 #define IOCTL_KGSL_PERFCOUNTER_QUERY _IOWR(KGSL_IOC_TYPE, 0x3A, struct kgsl_perfcounter_query)
544 struct kgsl_perfcounter_read_group {
545   unsigned int groupid;
546   unsigned int countable;
547   unsigned long long value;
548 };
549 struct kgsl_perfcounter_read {
550   struct kgsl_perfcounter_read_group * reads;
551   unsigned int count;
552   unsigned int __pad[2];
553 };
554 #define IOCTL_KGSL_PERFCOUNTER_READ _IOWR(KGSL_IOC_TYPE, 0x3B, struct kgsl_perfcounter_read)
555 struct kgsl_gpumem_sync_cache_bulk {
556   unsigned int * id_list;
557   unsigned int count;
558   unsigned int op;
559   unsigned int __pad[2];
560 };
561 #define IOCTL_KGSL_GPUMEM_SYNC_CACHE_BULK _IOWR(KGSL_IOC_TYPE, 0x3C, struct kgsl_gpumem_sync_cache_bulk)
562 struct kgsl_cmd_syncpoint_timestamp {
563   unsigned int context_id;
564   unsigned int timestamp;
565 };
566 struct kgsl_cmd_syncpoint_fence {
567   int fd;
568 };
569 struct kgsl_cmd_syncpoint {
570   int type;
571   void * priv;
572   size_t size;
573 };
574 #define KGSL_IBDESC_MEMLIST 0x1
575 #define KGSL_IBDESC_PROFILING_BUFFER 0x2
576 struct kgsl_submit_commands {
577   unsigned int context_id;
578   unsigned int flags;
579   struct kgsl_ibdesc * cmdlist;
580   unsigned int numcmds;
581   struct kgsl_cmd_syncpoint * synclist;
582   unsigned int numsyncs;
583   unsigned int timestamp;
584   unsigned int __pad[4];
585 };
586 #define IOCTL_KGSL_SUBMIT_COMMANDS _IOWR(KGSL_IOC_TYPE, 0x3D, struct kgsl_submit_commands)
587 struct kgsl_device_constraint {
588   unsigned int type;
589   unsigned int context_id;
590   void * data;
591   size_t size;
592 };
593 #define KGSL_CONSTRAINT_NONE 0
594 #define KGSL_CONSTRAINT_PWRLEVEL 1
595 #define KGSL_CONSTRAINT_L3_NONE 2
596 #define KGSL_CONSTRAINT_L3_PWRLEVEL 3
597 #define KGSL_CONSTRAINT_PWR_MIN 0
598 #define KGSL_CONSTRAINT_PWR_MAX 1
599 struct kgsl_device_constraint_pwrlevel {
600   unsigned int level;
601 };
602 struct kgsl_syncsource_create {
603   unsigned int id;
604   unsigned int __pad[3];
605 };
606 #define IOCTL_KGSL_SYNCSOURCE_CREATE _IOWR(KGSL_IOC_TYPE, 0x40, struct kgsl_syncsource_create)
607 struct kgsl_syncsource_destroy {
608   unsigned int id;
609   unsigned int __pad[3];
610 };
611 #define IOCTL_KGSL_SYNCSOURCE_DESTROY _IOWR(KGSL_IOC_TYPE, 0x41, struct kgsl_syncsource_destroy)
612 struct kgsl_syncsource_create_fence {
613   unsigned int id;
614   int fence_fd;
615   unsigned int __pad[4];
616 };
617 #define IOCTL_KGSL_SYNCSOURCE_CREATE_FENCE _IOWR(KGSL_IOC_TYPE, 0x42, struct kgsl_syncsource_create_fence)
618 struct kgsl_syncsource_signal_fence {
619   unsigned int id;
620   int fence_fd;
621   unsigned int __pad[4];
622 };
623 #define IOCTL_KGSL_SYNCSOURCE_SIGNAL_FENCE _IOWR(KGSL_IOC_TYPE, 0x43, struct kgsl_syncsource_signal_fence)
624 struct kgsl_cff_sync_gpuobj {
625   uint64_t offset;
626   uint64_t length;
627   unsigned int id;
628 };
629 #define IOCTL_KGSL_CFF_SYNC_GPUOBJ _IOW(KGSL_IOC_TYPE, 0x44, struct kgsl_cff_sync_gpuobj)
630 struct kgsl_gpuobj_alloc {
631   uint64_t size;
632   uint64_t flags;
633   uint64_t va_len;
634   uint64_t mmapsize;
635   unsigned int id;
636   unsigned int metadata_len;
637   uint64_t metadata;
638 };
639 #define KGSL_GPUOBJ_ALLOC_METADATA_MAX 64
640 #define IOCTL_KGSL_GPUOBJ_ALLOC _IOWR(KGSL_IOC_TYPE, 0x45, struct kgsl_gpuobj_alloc)
641 struct kgsl_gpuobj_free {
642   uint64_t flags;
643   uint64_t priv;
644   unsigned int id;
645   unsigned int type;
646   unsigned int len;
647 };
648 #define KGSL_GPUOBJ_FREE_ON_EVENT 1
649 #define KGSL_GPU_EVENT_TIMESTAMP 1
650 #define KGSL_GPU_EVENT_FENCE 2
651 struct kgsl_gpu_event_timestamp {
652   unsigned int context_id;
653   unsigned int timestamp;
654 };
655 struct kgsl_gpu_event_fence {
656   int fd;
657 };
658 #define IOCTL_KGSL_GPUOBJ_FREE _IOW(KGSL_IOC_TYPE, 0x46, struct kgsl_gpuobj_free)
659 struct kgsl_gpuobj_info {
660   uint64_t gpuaddr;
661   uint64_t flags;
662   uint64_t size;
663   uint64_t va_len;
664   uint64_t va_addr;
665   unsigned int id;
666 };
667 #define IOCTL_KGSL_GPUOBJ_INFO _IOWR(KGSL_IOC_TYPE, 0x47, struct kgsl_gpuobj_info)
668 struct kgsl_gpuobj_import {
669   uint64_t priv;
670   uint64_t priv_len;
671   uint64_t flags;
672   unsigned int type;
673   unsigned int id;
674 };
675 struct kgsl_gpuobj_import_dma_buf {
676   int fd;
677 };
678 struct kgsl_gpuobj_import_useraddr {
679   uint64_t virtaddr;
680 };
681 #define IOCTL_KGSL_GPUOBJ_IMPORT _IOWR(KGSL_IOC_TYPE, 0x48, struct kgsl_gpuobj_import)
682 struct kgsl_gpuobj_sync_obj {
683   uint64_t offset;
684   uint64_t length;
685   unsigned int id;
686   unsigned int op;
687 };
688 struct kgsl_gpuobj_sync {
689   uint64_t objs;
690   unsigned int obj_len;
691   unsigned int count;
692 };
693 #define IOCTL_KGSL_GPUOBJ_SYNC _IOW(KGSL_IOC_TYPE, 0x49, struct kgsl_gpuobj_sync)
694 struct kgsl_command_object {
695   uint64_t offset;
696   uint64_t gpuaddr;
697   uint64_t size;
698   unsigned int flags;
699   unsigned int id;
700 };
701 struct kgsl_command_syncpoint {
702   uint64_t priv;
703   uint64_t size;
704   unsigned int type;
705 };
706 struct kgsl_gpu_command {
707   uint64_t flags;
708   uint64_t cmdlist;
709   unsigned int cmdsize;
710   unsigned int numcmds;
711   uint64_t objlist;
712   unsigned int objsize;
713   unsigned int numobjs;
714   uint64_t synclist;
715   unsigned int syncsize;
716   unsigned int numsyncs;
717   unsigned int context_id;
718   unsigned int timestamp;
719 };
720 #define IOCTL_KGSL_GPU_COMMAND _IOWR(KGSL_IOC_TYPE, 0x4A, struct kgsl_gpu_command)
721 struct kgsl_preemption_counters_query {
722   uint64_t counters;
723   unsigned int size_user;
724   unsigned int size_priority_level;
725   unsigned int max_priority_level;
726 };
727 #define IOCTL_KGSL_PREEMPTIONCOUNTER_QUERY _IOWR(KGSL_IOC_TYPE, 0x4B, struct kgsl_preemption_counters_query)
728 #define KGSL_GPUOBJ_SET_INFO_METADATA (1 << 0)
729 #define KGSL_GPUOBJ_SET_INFO_TYPE (1 << 1)
730 struct kgsl_gpuobj_set_info {
731   uint64_t flags;
732   uint64_t metadata;
733   unsigned int id;
734   unsigned int metadata_len;
735   unsigned int type;
736 };
737 #define IOCTL_KGSL_GPUOBJ_SET_INFO _IOW(KGSL_IOC_TYPE, 0x4C, struct kgsl_gpuobj_set_info)
738 struct kgsl_sparse_phys_alloc {
739   uint64_t size;
740   uint64_t pagesize;
741   uint64_t flags;
742   unsigned int id;
743 };
744 #define IOCTL_KGSL_SPARSE_PHYS_ALLOC _IOWR(KGSL_IOC_TYPE, 0x50, struct kgsl_sparse_phys_alloc)
745 struct kgsl_sparse_phys_free {
746   unsigned int id;
747 };
748 #define IOCTL_KGSL_SPARSE_PHYS_FREE _IOW(KGSL_IOC_TYPE, 0x51, struct kgsl_sparse_phys_free)
749 struct kgsl_sparse_virt_alloc {
750   uint64_t size;
751   uint64_t pagesize;
752   uint64_t flags;
753   uint64_t gpuaddr;
754   unsigned int id;
755 };
756 #define IOCTL_KGSL_SPARSE_VIRT_ALLOC _IOWR(KGSL_IOC_TYPE, 0x52, struct kgsl_sparse_virt_alloc)
757 struct kgsl_sparse_virt_free {
758   unsigned int id;
759 };
760 #define IOCTL_KGSL_SPARSE_VIRT_FREE _IOW(KGSL_IOC_TYPE, 0x53, struct kgsl_sparse_virt_free)
761 struct kgsl_sparse_binding_object {
762   uint64_t virtoffset;
763   uint64_t physoffset;
764   uint64_t size;
765   uint64_t flags;
766   unsigned int id;
767 };
768 struct kgsl_sparse_bind {
769   uint64_t list;
770   unsigned int id;
771   unsigned int size;
772   unsigned int count;
773 };
774 #define IOCTL_KGSL_SPARSE_BIND _IOW(KGSL_IOC_TYPE, 0x54, struct kgsl_sparse_bind)
775 struct kgsl_gpu_sparse_command {
776   uint64_t flags;
777   uint64_t sparselist;
778   uint64_t synclist;
779   unsigned int sparsesize;
780   unsigned int numsparse;
781   unsigned int syncsize;
782   unsigned int numsyncs;
783   unsigned int context_id;
784   unsigned int timestamp;
785   unsigned int id;
786 };
787 #define IOCTL_KGSL_GPU_SPARSE_COMMAND _IOWR(KGSL_IOC_TYPE, 0x55, struct kgsl_gpu_sparse_command)
788 #endif
789