Path: blob/21.2-virgl/src/broadcom/drm-shim/v3d.h
4560 views
/*1* Copyright © 2018 Broadcom2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20* IN THE SOFTWARE.21*/2223#ifndef DRM_SHIM_V3D_H24#define DRM_SHIM_V3D_H2526#include "broadcom/common/v3d_device_info.h"27#include "util/vma.h"2829struct drm_shim_fd;3031struct v3d_shim_device {32struct v3d_hw *hw;33struct v3d_device_info *devinfo;3435/* Base virtual address of the heap. */36void *mem;37/* Base hardware address of the heap. */38uint32_t mem_base;39/* Size of the heap. */40size_t mem_size;4142/* Allocator for the GPU virtual addresses. */43struct util_vma_heap heap;44};45extern struct v3d_shim_device v3d;4647struct v3d_bo {48struct shim_bo base;49uint64_t offset;50void *sim_vaddr;51void *gem_vaddr;52};5354static inline struct v3d_bo *55v3d_bo(struct shim_bo *bo)56{57return (struct v3d_bo *)bo;58}5960struct v3d_bo *v3d_bo_lookup(struct shim_fd *shim_fd, int handle);61int v3d_ioctl_wait_bo(int fd, unsigned long request, void *arg);62int v3d_ioctl_mmap_bo(int fd, unsigned long request, void *arg);63int v3d_ioctl_get_bo_offset(int fd, unsigned long request, void *arg);6465void v3d33_drm_shim_driver_init(void);66void v3d41_drm_shim_driver_init(void);67void v3d42_drm_shim_driver_init(void);6869#endif /* DRM_SHIM_V3D_H */707172