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