/** * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define KGSL_MEMFLAGS_USE_CPU_MAP 0x10000000ULL #define KGSL_MEMFLAGS_GPUREADONLY 0x01000000U #define KGSL_IOC_TYPE 0x09 #define KGSL_MEMTYPE_COMMAND 16 enum kgsl_user_mem_type { KGSL_USER_MEM_TYPE_PMEM = 0x00000000, KGSL_USER_MEM_TYPE_ASHMEM = 0x00000001, KGSL_USER_MEM_TYPE_ADDR = 0x00000002, KGSL_USER_MEM_TYPE_ION = 0x00000003, KGSL_USER_MEM_TYPE_DMABUF = 0x00000003, KGSL_USER_MEM_TYPE_MAX = 0x00000007, }; struct kgsl_drawctxt_create { unsigned int flags; unsigned int drawctxt_id; }; #define IOCTL_KGSL_DRAWCTXT_CREATE \ _IOWR(KGSL_IOC_TYPE, 0x13, struct kgsl_drawctxt_create) struct kgsl_map_user_mem { int fd; unsigned long gpuaddr; size_t len; size_t offset; unsigned long hostptr; enum kgsl_user_mem_type memtype; unsigned int flags; }; #define IOCTL_KGSL_MAP_USER_MEM \ _IOWR(KGSL_IOC_TYPE, 0x15, struct kgsl_map_user_mem) struct kgsl_sharedmem_free { unsigned long gpuaddr; }; #define IOCTL_KGSL_SHAREDMEM_FREE \ _IOW(KGSL_IOC_TYPE, 0x21, struct kgsl_sharedmem_free) struct kgsl_gpumem_alloc { unsigned long gpuaddr; size_t size; unsigned int flags; }; #define IOCTL_KGSL_GPUMEM_ALLOC \ _IOWR(KGSL_IOC_TYPE, 0x2f, struct kgsl_gpumem_alloc) struct kgsl_gpumem_alloc_id { unsigned int id; unsigned int flags; size_t size; size_t mmapsize; unsigned long gpuaddr; unsigned long __pad[2]; }; #define IOCTL_KGSL_GPUMEM_ALLOC_ID \ _IOWR(KGSL_IOC_TYPE, 0x34, struct kgsl_gpumem_alloc_id) struct kgsl_gpumem_get_info { unsigned long gpuaddr; unsigned int id; unsigned int flags; size_t size; size_t mmapsize; unsigned long useraddr; unsigned long __pad[4]; }; #define IOCTL_KGSL_GPUMEM_GET_INFO \ _IOWR(KGSL_IOC_TYPE, 0x36, struct kgsl_gpumem_get_info)