Path: blob/21.2-virgl/src/virtio/vulkan/vn_device_memory.h
4560 views
/*1* Copyright 2019 Google LLC2* SPDX-License-Identifier: MIT3*4* based in part on anv and radv which are:5* Copyright © 2015 Intel Corporation6* Copyright © 2016 Red Hat.7* Copyright © 2016 Bas Nieuwenhuizen8*/910#ifndef VN_DEVICE_MEMORY_H11#define VN_DEVICE_MEMORY_H1213#include "vn_common.h"1415struct vn_device_memory_pool {16mtx_t mutex;17struct vn_device_memory *memory;18VkDeviceSize used;19};2021struct vn_device_memory {22struct vn_object_base base;2324VkDeviceSize size;2526/* non-NULL when suballocated */27struct vn_device_memory *base_memory;28/* non-NULL when mappable or external */29struct vn_renderer_bo *base_bo;30VkDeviceSize base_offset;3132VkDeviceSize map_end;3334/* non-NULL when backed by AHB */35struct AHardwareBuffer *ahb;36};37VK_DEFINE_NONDISP_HANDLE_CASTS(vn_device_memory,38base.base,39VkDeviceMemory,40VK_OBJECT_TYPE_DEVICE_MEMORY)4142void43vn_device_memory_pool_fini(struct vn_device *dev, uint32_t mem_type_index);4445VkResult46vn_device_memory_import_dma_buf(struct vn_device *dev,47struct vn_device_memory *mem,48const VkMemoryAllocateInfo *alloc_info,49int fd);5051VkResult52vn_get_memory_dma_buf_properties(struct vn_device *dev,53int fd,54uint64_t *out_alloc_size,55uint32_t *out_mem_type_bits);5657#endif /* VN_DEVICE_MEMORY_H */585960