Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | #ifndef _MSM_KGSL_H |
| 2 | #define _MSM_KGSL_H |
| 3 | |
| 4 | #define KGSL_VERSION_MAJOR 3 |
Jordan Crouse | f7370f8 | 2012-04-18 09:31:07 -0600 | [diff] [blame] | 5 | #define KGSL_VERSION_MINOR 11 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 6 | |
| 7 | /*context flags */ |
Carter Cooper | 7e7f02e | 2012-02-15 09:36:31 -0700 | [diff] [blame] | 8 | #define KGSL_CONTEXT_SAVE_GMEM 0x00000001 |
| 9 | #define KGSL_CONTEXT_NO_GMEM_ALLOC 0x00000002 |
| 10 | #define KGSL_CONTEXT_SUBMIT_IB_LIST 0x00000004 |
| 11 | #define KGSL_CONTEXT_CTX_SWITCH 0x00000008 |
| 12 | #define KGSL_CONTEXT_PREAMBLE 0x00000010 |
| 13 | #define KGSL_CONTEXT_TRASH_STATE 0x00000020 |
| 14 | #define KGSL_CONTEXT_PER_CONTEXT_TS 0x00000040 |
| 15 | |
| 16 | #define KGSL_CONTEXT_INVALID 0xffffffff |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 17 | |
| 18 | /* Memory allocayion flags */ |
| 19 | #define KGSL_MEMFLAGS_GPUREADONLY 0x01000000 |
| 20 | |
| 21 | /* generic flag values */ |
| 22 | #define KGSL_FLAGS_NORMALMODE 0x00000000 |
| 23 | #define KGSL_FLAGS_SAFEMODE 0x00000001 |
| 24 | #define KGSL_FLAGS_INITIALIZED0 0x00000002 |
| 25 | #define KGSL_FLAGS_INITIALIZED 0x00000004 |
| 26 | #define KGSL_FLAGS_STARTED 0x00000008 |
| 27 | #define KGSL_FLAGS_ACTIVE 0x00000010 |
| 28 | #define KGSL_FLAGS_RESERVED0 0x00000020 |
| 29 | #define KGSL_FLAGS_RESERVED1 0x00000040 |
| 30 | #define KGSL_FLAGS_RESERVED2 0x00000080 |
| 31 | #define KGSL_FLAGS_SOFT_RESET 0x00000100 |
Carter Cooper | 7e7f02e | 2012-02-15 09:36:31 -0700 | [diff] [blame] | 32 | #define KGSL_FLAGS_PER_CONTEXT_TIMESTAMPS 0x00000200 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 33 | |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame] | 34 | /* Clock flags to show which clocks should be controled by a given platform */ |
| 35 | #define KGSL_CLK_SRC 0x00000001 |
| 36 | #define KGSL_CLK_CORE 0x00000002 |
| 37 | #define KGSL_CLK_IFACE 0x00000004 |
| 38 | #define KGSL_CLK_MEM 0x00000008 |
| 39 | #define KGSL_CLK_MEM_IFACE 0x00000010 |
| 40 | #define KGSL_CLK_AXI 0x00000020 |
| 41 | |
Shubhraprakash Das | 2dfe5dd | 2012-02-10 13:49:53 -0700 | [diff] [blame] | 42 | /* |
| 43 | * Reset status values for context |
| 44 | */ |
| 45 | enum kgsl_ctx_reset_stat { |
| 46 | KGSL_CTX_STAT_NO_ERROR = 0x00000000, |
| 47 | KGSL_CTX_STAT_GUILTY_CONTEXT_RESET_EXT = 0x00000001, |
| 48 | KGSL_CTX_STAT_INNOCENT_CONTEXT_RESET_EXT = 0x00000002, |
| 49 | KGSL_CTX_STAT_UNKNOWN_CONTEXT_RESET_EXT = 0x00000003 |
| 50 | }; |
| 51 | |
Suman Tatiraju | 0123d18 | 2011-09-30 14:59:06 -0700 | [diff] [blame] | 52 | #define KGSL_CONVERT_TO_MBPS(val) \ |
| 53 | (val*1000*1000U) |
| 54 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 55 | /* device id */ |
| 56 | enum kgsl_deviceid { |
| 57 | KGSL_DEVICE_3D0 = 0x00000000, |
| 58 | KGSL_DEVICE_2D0 = 0x00000001, |
| 59 | KGSL_DEVICE_2D1 = 0x00000002, |
| 60 | KGSL_DEVICE_MAX = 0x00000003 |
| 61 | }; |
| 62 | |
| 63 | enum kgsl_user_mem_type { |
| 64 | KGSL_USER_MEM_TYPE_PMEM = 0x00000000, |
| 65 | KGSL_USER_MEM_TYPE_ASHMEM = 0x00000001, |
Jordan Crouse | 8eab35a | 2011-10-12 16:57:48 -0600 | [diff] [blame] | 66 | KGSL_USER_MEM_TYPE_ADDR = 0x00000002, |
| 67 | KGSL_USER_MEM_TYPE_ION = 0x00000003, |
Lynus Vaz | 31b5290e | 2012-01-18 19:20:24 +0530 | [diff] [blame] | 68 | KGSL_USER_MEM_TYPE_MAX = 0x00000004, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 69 | }; |
| 70 | |
| 71 | struct kgsl_devinfo { |
| 72 | |
| 73 | unsigned int device_id; |
| 74 | /* chip revision id |
| 75 | * coreid:8 majorrev:8 minorrev:8 patch:8 |
| 76 | */ |
| 77 | unsigned int chip_id; |
| 78 | unsigned int mmu_enabled; |
| 79 | unsigned int gmem_gpubaseaddr; |
| 80 | /* |
| 81 | * This field contains the adreno revision |
| 82 | * number 200, 205, 220, etc... |
| 83 | */ |
| 84 | unsigned int gpu_id; |
| 85 | unsigned int gmem_sizebytes; |
| 86 | }; |
| 87 | |
| 88 | /* this structure defines the region of memory that can be mmap()ed from this |
| 89 | driver. The timestamp fields are volatile because they are written by the |
| 90 | GPU |
| 91 | */ |
| 92 | struct kgsl_devmemstore { |
| 93 | volatile unsigned int soptimestamp; |
| 94 | unsigned int sbz; |
| 95 | volatile unsigned int eoptimestamp; |
| 96 | unsigned int sbz2; |
| 97 | volatile unsigned int ts_cmp_enable; |
| 98 | unsigned int sbz3; |
| 99 | volatile unsigned int ref_wait_ts; |
| 100 | unsigned int sbz4; |
| 101 | unsigned int current_context; |
| 102 | unsigned int sbz5; |
| 103 | }; |
| 104 | |
Carter Cooper | 7e7f02e | 2012-02-15 09:36:31 -0700 | [diff] [blame] | 105 | #define KGSL_MEMSTORE_OFFSET(ctxt_id, field) \ |
| 106 | ((ctxt_id)*sizeof(struct kgsl_devmemstore) + \ |
| 107 | offsetof(struct kgsl_devmemstore, field)) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 108 | |
| 109 | /* timestamp id*/ |
| 110 | enum kgsl_timestamp_type { |
| 111 | KGSL_TIMESTAMP_CONSUMED = 0x00000001, /* start-of-pipeline timestamp */ |
| 112 | KGSL_TIMESTAMP_RETIRED = 0x00000002, /* end-of-pipeline timestamp*/ |
Jordan Crouse | c659f38 | 2012-04-16 11:10:41 -0600 | [diff] [blame] | 113 | KGSL_TIMESTAMP_QUEUED = 0x00000003, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 114 | }; |
| 115 | |
| 116 | /* property types - used with kgsl_device_getproperty */ |
| 117 | enum kgsl_property_type { |
| 118 | KGSL_PROP_DEVICE_INFO = 0x00000001, |
| 119 | KGSL_PROP_DEVICE_SHADOW = 0x00000002, |
| 120 | KGSL_PROP_DEVICE_POWER = 0x00000003, |
| 121 | KGSL_PROP_SHMEM = 0x00000004, |
| 122 | KGSL_PROP_SHMEM_APERTURES = 0x00000005, |
| 123 | KGSL_PROP_MMU_ENABLE = 0x00000006, |
| 124 | KGSL_PROP_INTERRUPT_WAITS = 0x00000007, |
| 125 | KGSL_PROP_VERSION = 0x00000008, |
Jordan Crouse | f7370f8 | 2012-04-18 09:31:07 -0600 | [diff] [blame] | 126 | KGSL_PROP_GPU_RESET_STAT = 0x00000009, |
| 127 | KGSL_PROP_PWRCTRL = 0x0000000E, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 128 | }; |
| 129 | |
| 130 | struct kgsl_shadowprop { |
| 131 | unsigned int gpuaddr; |
| 132 | unsigned int size; |
| 133 | unsigned int flags; /* contains KGSL_FLAGS_ values */ |
| 134 | }; |
| 135 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 136 | struct kgsl_version { |
| 137 | unsigned int drv_major; |
| 138 | unsigned int drv_minor; |
| 139 | unsigned int dev_major; |
| 140 | unsigned int dev_minor; |
| 141 | }; |
| 142 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 143 | /* structure holds list of ibs */ |
| 144 | struct kgsl_ibdesc { |
| 145 | unsigned int gpuaddr; |
| 146 | void *hostptr; |
| 147 | unsigned int sizedwords; |
| 148 | unsigned int ctrl; |
| 149 | }; |
| 150 | |
| 151 | /* ioctls */ |
| 152 | #define KGSL_IOC_TYPE 0x09 |
| 153 | |
| 154 | /* get misc info about the GPU |
| 155 | type should be a value from enum kgsl_property_type |
| 156 | value points to a structure that varies based on type |
| 157 | sizebytes is sizeof() that structure |
| 158 | for KGSL_PROP_DEVICE_INFO, use struct kgsl_devinfo |
| 159 | this structure contaings hardware versioning info. |
| 160 | for KGSL_PROP_DEVICE_SHADOW, use struct kgsl_shadowprop |
| 161 | this is used to find mmap() offset and sizes for mapping |
| 162 | struct kgsl_memstore into userspace. |
| 163 | */ |
| 164 | struct kgsl_device_getproperty { |
| 165 | unsigned int type; |
| 166 | void *value; |
| 167 | unsigned int sizebytes; |
| 168 | }; |
| 169 | |
| 170 | #define IOCTL_KGSL_DEVICE_GETPROPERTY \ |
| 171 | _IOWR(KGSL_IOC_TYPE, 0x2, struct kgsl_device_getproperty) |
| 172 | |
Harsh Vardhan Dwivedi | b6cebfe | 2012-03-15 18:20:59 -0600 | [diff] [blame] | 173 | /* IOCTL_KGSL_DEVICE_READ (0x3) - removed 03/2012 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 174 | */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 175 | |
| 176 | /* block until the GPU has executed past a given timestamp |
| 177 | * timeout is in milliseconds. |
| 178 | */ |
| 179 | struct kgsl_device_waittimestamp { |
| 180 | unsigned int timestamp; |
| 181 | unsigned int timeout; |
| 182 | }; |
| 183 | |
| 184 | #define IOCTL_KGSL_DEVICE_WAITTIMESTAMP \ |
| 185 | _IOW(KGSL_IOC_TYPE, 0x6, struct kgsl_device_waittimestamp) |
| 186 | |
Carter Cooper | 7e7f02e | 2012-02-15 09:36:31 -0700 | [diff] [blame] | 187 | struct kgsl_device_waittimestamp_ctxtid { |
| 188 | unsigned int context_id; |
| 189 | unsigned int timestamp; |
| 190 | unsigned int timeout; |
| 191 | }; |
| 192 | |
| 193 | #define IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID \ |
| 194 | _IOW(KGSL_IOC_TYPE, 0x7, struct kgsl_device_waittimestamp_ctxtid) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 195 | |
| 196 | /* issue indirect commands to the GPU. |
| 197 | * drawctxt_id must have been created with IOCTL_KGSL_DRAWCTXT_CREATE |
| 198 | * ibaddr and sizedwords must specify a subset of a buffer created |
| 199 | * with IOCTL_KGSL_SHAREDMEM_FROM_PMEM |
| 200 | * flags may be a mask of KGSL_CONTEXT_ values |
| 201 | * timestamp is a returned counter value which can be passed to |
| 202 | * other ioctls to determine when the commands have been executed by |
| 203 | * the GPU. |
| 204 | */ |
| 205 | struct kgsl_ringbuffer_issueibcmds { |
| 206 | unsigned int drawctxt_id; |
| 207 | unsigned int ibdesc_addr; |
| 208 | unsigned int numibs; |
| 209 | unsigned int timestamp; /*output param */ |
| 210 | unsigned int flags; |
| 211 | }; |
| 212 | |
| 213 | #define IOCTL_KGSL_RINGBUFFER_ISSUEIBCMDS \ |
| 214 | _IOWR(KGSL_IOC_TYPE, 0x10, struct kgsl_ringbuffer_issueibcmds) |
| 215 | |
| 216 | /* read the most recently executed timestamp value |
| 217 | * type should be a value from enum kgsl_timestamp_type |
| 218 | */ |
| 219 | struct kgsl_cmdstream_readtimestamp { |
| 220 | unsigned int type; |
| 221 | unsigned int timestamp; /*output param */ |
| 222 | }; |
| 223 | |
Jason Varbedian | 80ba33d | 2011-07-11 17:29:05 -0700 | [diff] [blame] | 224 | #define IOCTL_KGSL_CMDSTREAM_READTIMESTAMP_OLD \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 225 | _IOR(KGSL_IOC_TYPE, 0x11, struct kgsl_cmdstream_readtimestamp) |
| 226 | |
Jason Varbedian | 80ba33d | 2011-07-11 17:29:05 -0700 | [diff] [blame] | 227 | #define IOCTL_KGSL_CMDSTREAM_READTIMESTAMP \ |
| 228 | _IOWR(KGSL_IOC_TYPE, 0x11, struct kgsl_cmdstream_readtimestamp) |
| 229 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 230 | /* free memory when the GPU reaches a given timestamp. |
| 231 | * gpuaddr specify a memory region created by a |
| 232 | * IOCTL_KGSL_SHAREDMEM_FROM_PMEM call |
| 233 | * type should be a value from enum kgsl_timestamp_type |
| 234 | */ |
| 235 | struct kgsl_cmdstream_freememontimestamp { |
| 236 | unsigned int gpuaddr; |
| 237 | unsigned int type; |
| 238 | unsigned int timestamp; |
| 239 | }; |
| 240 | |
| 241 | #define IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP \ |
| 242 | _IOW(KGSL_IOC_TYPE, 0x12, struct kgsl_cmdstream_freememontimestamp) |
| 243 | |
| 244 | /* Previous versions of this header had incorrectly defined |
| 245 | IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP as a read-only ioctl instead |
| 246 | of a write only ioctl. To ensure binary compatability, the following |
| 247 | #define will be used to intercept the incorrect ioctl |
| 248 | */ |
| 249 | |
| 250 | #define IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP_OLD \ |
| 251 | _IOR(KGSL_IOC_TYPE, 0x12, struct kgsl_cmdstream_freememontimestamp) |
| 252 | |
| 253 | /* create a draw context, which is used to preserve GPU state. |
| 254 | * The flags field may contain a mask KGSL_CONTEXT_* values |
| 255 | */ |
| 256 | struct kgsl_drawctxt_create { |
| 257 | unsigned int flags; |
| 258 | unsigned int drawctxt_id; /*output param */ |
| 259 | }; |
| 260 | |
| 261 | #define IOCTL_KGSL_DRAWCTXT_CREATE \ |
| 262 | _IOWR(KGSL_IOC_TYPE, 0x13, struct kgsl_drawctxt_create) |
| 263 | |
| 264 | /* destroy a draw context */ |
| 265 | struct kgsl_drawctxt_destroy { |
| 266 | unsigned int drawctxt_id; |
| 267 | }; |
| 268 | |
| 269 | #define IOCTL_KGSL_DRAWCTXT_DESTROY \ |
| 270 | _IOW(KGSL_IOC_TYPE, 0x14, struct kgsl_drawctxt_destroy) |
| 271 | |
| 272 | /* add a block of pmem, fb, ashmem or user allocated address |
| 273 | * into the GPU address space */ |
| 274 | struct kgsl_map_user_mem { |
| 275 | int fd; |
| 276 | unsigned int gpuaddr; /*output param */ |
| 277 | unsigned int len; |
| 278 | unsigned int offset; |
| 279 | unsigned int hostptr; /*input param */ |
| 280 | enum kgsl_user_mem_type memtype; |
| 281 | unsigned int reserved; /* May be required to add |
| 282 | params for another mem type */ |
| 283 | }; |
| 284 | |
| 285 | #define IOCTL_KGSL_MAP_USER_MEM \ |
| 286 | _IOWR(KGSL_IOC_TYPE, 0x15, struct kgsl_map_user_mem) |
| 287 | |
Carter Cooper | 7e7f02e | 2012-02-15 09:36:31 -0700 | [diff] [blame] | 288 | struct kgsl_cmdstream_readtimestamp_ctxtid { |
| 289 | unsigned int context_id; |
| 290 | unsigned int type; |
| 291 | unsigned int timestamp; /*output param */ |
| 292 | }; |
| 293 | |
| 294 | #define IOCTL_KGSL_CMDSTREAM_READTIMESTAMP_CTXTID \ |
| 295 | _IOWR(KGSL_IOC_TYPE, 0x16, struct kgsl_cmdstream_readtimestamp_ctxtid) |
| 296 | |
| 297 | struct kgsl_cmdstream_freememontimestamp_ctxtid { |
| 298 | unsigned int context_id; |
| 299 | unsigned int gpuaddr; |
| 300 | unsigned int type; |
| 301 | unsigned int timestamp; |
| 302 | }; |
| 303 | |
| 304 | #define IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP_CTXTID \ |
| 305 | _IOW(KGSL_IOC_TYPE, 0x17, \ |
| 306 | struct kgsl_cmdstream_freememontimestamp_ctxtid) |
| 307 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 308 | /* add a block of pmem or fb into the GPU address space */ |
| 309 | struct kgsl_sharedmem_from_pmem { |
| 310 | int pmem_fd; |
| 311 | unsigned int gpuaddr; /*output param */ |
| 312 | unsigned int len; |
| 313 | unsigned int offset; |
| 314 | }; |
| 315 | |
| 316 | #define IOCTL_KGSL_SHAREDMEM_FROM_PMEM \ |
| 317 | _IOWR(KGSL_IOC_TYPE, 0x20, struct kgsl_sharedmem_from_pmem) |
| 318 | |
| 319 | /* remove memory from the GPU's address space */ |
| 320 | struct kgsl_sharedmem_free { |
| 321 | unsigned int gpuaddr; |
| 322 | }; |
| 323 | |
| 324 | #define IOCTL_KGSL_SHAREDMEM_FREE \ |
| 325 | _IOW(KGSL_IOC_TYPE, 0x21, struct kgsl_sharedmem_free) |
| 326 | |
Sushmita Susheelendra | 41f8fa3 | 2011-05-11 17:15:58 -0600 | [diff] [blame] | 327 | struct kgsl_cff_user_event { |
| 328 | unsigned char cff_opcode; |
| 329 | unsigned int op1; |
| 330 | unsigned int op2; |
| 331 | unsigned int op3; |
| 332 | unsigned int op4; |
| 333 | unsigned int op5; |
| 334 | unsigned int __pad[2]; |
| 335 | }; |
| 336 | |
| 337 | #define IOCTL_KGSL_CFF_USER_EVENT \ |
| 338 | _IOW(KGSL_IOC_TYPE, 0x31, struct kgsl_cff_user_event) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 339 | |
| 340 | struct kgsl_gmem_desc { |
| 341 | unsigned int x; |
| 342 | unsigned int y; |
| 343 | unsigned int width; |
| 344 | unsigned int height; |
| 345 | unsigned int pitch; |
| 346 | }; |
| 347 | |
| 348 | struct kgsl_buffer_desc { |
| 349 | void *hostptr; |
| 350 | unsigned int gpuaddr; |
| 351 | int size; |
| 352 | unsigned int format; |
| 353 | unsigned int pitch; |
| 354 | unsigned int enabled; |
| 355 | }; |
| 356 | |
| 357 | struct kgsl_bind_gmem_shadow { |
| 358 | unsigned int drawctxt_id; |
| 359 | struct kgsl_gmem_desc gmem_desc; |
| 360 | unsigned int shadow_x; |
| 361 | unsigned int shadow_y; |
| 362 | struct kgsl_buffer_desc shadow_buffer; |
| 363 | unsigned int buffer_id; |
| 364 | }; |
| 365 | |
| 366 | #define IOCTL_KGSL_DRAWCTXT_BIND_GMEM_SHADOW \ |
| 367 | _IOW(KGSL_IOC_TYPE, 0x22, struct kgsl_bind_gmem_shadow) |
| 368 | |
| 369 | /* add a block of memory into the GPU address space */ |
Jordan Crouse | c600510 | 2012-09-11 16:38:14 -0600 | [diff] [blame] | 370 | |
| 371 | /* |
| 372 | * IOCTL_KGSL_SHAREDMEM_FROM_VMALLOC deprecated 09/2012 |
| 373 | * use IOCTL_KGSL_GPUMEM_ALLOC instead |
| 374 | */ |
| 375 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 376 | struct kgsl_sharedmem_from_vmalloc { |
| 377 | unsigned int gpuaddr; /*output param */ |
| 378 | unsigned int hostptr; |
| 379 | unsigned int flags; |
| 380 | }; |
| 381 | |
| 382 | #define IOCTL_KGSL_SHAREDMEM_FROM_VMALLOC \ |
| 383 | _IOWR(KGSL_IOC_TYPE, 0x23, struct kgsl_sharedmem_from_vmalloc) |
| 384 | |
| 385 | #define IOCTL_KGSL_SHAREDMEM_FLUSH_CACHE \ |
| 386 | _IOW(KGSL_IOC_TYPE, 0x24, struct kgsl_sharedmem_free) |
| 387 | |
| 388 | struct kgsl_drawctxt_set_bin_base_offset { |
| 389 | unsigned int drawctxt_id; |
| 390 | unsigned int offset; |
| 391 | }; |
| 392 | |
| 393 | #define IOCTL_KGSL_DRAWCTXT_SET_BIN_BASE_OFFSET \ |
| 394 | _IOW(KGSL_IOC_TYPE, 0x25, struct kgsl_drawctxt_set_bin_base_offset) |
| 395 | |
| 396 | enum kgsl_cmdwindow_type { |
| 397 | KGSL_CMDWINDOW_MIN = 0x00000000, |
| 398 | KGSL_CMDWINDOW_2D = 0x00000000, |
| 399 | KGSL_CMDWINDOW_3D = 0x00000001, /* legacy */ |
| 400 | KGSL_CMDWINDOW_MMU = 0x00000002, |
| 401 | KGSL_CMDWINDOW_ARBITER = 0x000000FF, |
| 402 | KGSL_CMDWINDOW_MAX = 0x000000FF, |
| 403 | }; |
| 404 | |
| 405 | /* write to the command window */ |
| 406 | struct kgsl_cmdwindow_write { |
| 407 | enum kgsl_cmdwindow_type target; |
| 408 | unsigned int addr; |
| 409 | unsigned int data; |
| 410 | }; |
| 411 | |
| 412 | #define IOCTL_KGSL_CMDWINDOW_WRITE \ |
| 413 | _IOW(KGSL_IOC_TYPE, 0x2e, struct kgsl_cmdwindow_write) |
| 414 | |
| 415 | struct kgsl_gpumem_alloc { |
| 416 | unsigned long gpuaddr; |
| 417 | size_t size; |
| 418 | unsigned int flags; |
| 419 | }; |
| 420 | |
| 421 | #define IOCTL_KGSL_GPUMEM_ALLOC \ |
| 422 | _IOWR(KGSL_IOC_TYPE, 0x2f, struct kgsl_gpumem_alloc) |
| 423 | |
Jeremy Gebben | a7423e4 | 2011-04-18 15:11:21 -0600 | [diff] [blame] | 424 | struct kgsl_cff_syncmem { |
| 425 | unsigned int gpuaddr; |
| 426 | unsigned int len; |
| 427 | unsigned int __pad[2]; /* For future binary compatibility */ |
| 428 | }; |
| 429 | |
| 430 | #define IOCTL_KGSL_CFF_SYNCMEM \ |
| 431 | _IOW(KGSL_IOC_TYPE, 0x30, struct kgsl_cff_syncmem) |
| 432 | |
Jordan Crouse | d4bc9d2 | 2011-11-17 13:39:21 -0700 | [diff] [blame] | 433 | /* |
| 434 | * A timestamp event allows the user space to register an action following an |
| 435 | * expired timestamp. |
| 436 | */ |
| 437 | |
| 438 | struct kgsl_timestamp_event { |
| 439 | int type; /* Type of event (see list below) */ |
| 440 | unsigned int timestamp; /* Timestamp to trigger event on */ |
| 441 | unsigned int context_id; /* Context for the timestamp */ |
| 442 | void *priv; /* Pointer to the event specific blob */ |
| 443 | size_t len; /* Size of the event specific blob */ |
| 444 | }; |
| 445 | |
| 446 | #define IOCTL_KGSL_TIMESTAMP_EVENT \ |
| 447 | _IOW(KGSL_IOC_TYPE, 0x31, struct kgsl_timestamp_event) |
| 448 | |
| 449 | /* A genlock timestamp event releases an existing lock on timestamp expire */ |
| 450 | |
| 451 | #define KGSL_TIMESTAMP_EVENT_GENLOCK 1 |
| 452 | |
| 453 | struct kgsl_timestamp_event_genlock { |
| 454 | int handle; /* Handle of the genlock lock to release */ |
| 455 | }; |
| 456 | |
Jordan Crouse | ed7dd7f | 2012-03-29 13:16:02 -0600 | [diff] [blame] | 457 | /* |
| 458 | * Set a property within the kernel. Uses the same structure as |
| 459 | * IOCTL_KGSL_GETPROPERTY |
| 460 | */ |
| 461 | |
| 462 | #define IOCTL_KGSL_SETPROPERTY \ |
| 463 | _IOW(KGSL_IOC_TYPE, 0x32, struct kgsl_device_getproperty) |
| 464 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 465 | #ifdef __KERNEL__ |
| 466 | #ifdef CONFIG_MSM_KGSL_DRM |
| 467 | int kgsl_gem_obj_addr(int drm_fd, int handle, unsigned long *start, |
| 468 | unsigned long *len); |
| 469 | #else |
| 470 | #define kgsl_gem_obj_addr(...) 0 |
| 471 | #endif |
| 472 | #endif |
| 473 | #endif /* _MSM_KGSL_H */ |