2
* Copyright 2019 Google LLC
3
* SPDX-License-Identifier: MIT
5
* based in part on anv and radv which are:
6
* Copyright © 2015 Intel Corporation
7
* Copyright © 2016 Red Hat.
8
* Copyright © 2016 Bas Nieuwenhuizen
11
#ifndef VN_DEVICE_MEMORY_H
12
#define VN_DEVICE_MEMORY_H
14
#include "vn_common.h"
16
struct vn_device_memory_pool {
18
struct vn_device_memory *memory;
22
struct vn_device_memory {
23
struct vn_object_base base;
26
VkMemoryPropertyFlags flags;
28
/* non-NULL when suballocated */
29
struct vn_device_memory *base_memory;
30
/* non-NULL when mappable or external */
31
struct vn_renderer_bo *base_bo;
32
/* enforce kernel and ring ordering between memory export and free */
33
bool bo_roundtrip_seqno_valid;
34
uint32_t bo_roundtrip_seqno;
35
VkDeviceSize base_offset;
39
/* non-NULL when backed by AHB */
40
struct AHardwareBuffer *ahb;
42
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_device_memory,
45
VK_OBJECT_TYPE_DEVICE_MEMORY)
48
vn_device_memory_pool_fini(struct vn_device *dev, uint32_t mem_type_index);
51
vn_device_memory_import_dma_buf(struct vn_device *dev,
52
struct vn_device_memory *mem,
53
const VkMemoryAllocateInfo *alloc_info,
54
bool force_unmappable,
58
vn_get_memory_dma_buf_properties(struct vn_device *dev,
60
uint64_t *out_alloc_size,
61
uint32_t *out_mem_type_bits);
63
#endif /* VN_DEVICE_MEMORY_H */