~mmach/netext73/mesa-haswell

« back to all changes in this revision

Viewing changes to src/virtio/vulkan/vn_device_memory.h

  • Committer: mmach
  • Date: 2022-09-22 19:56:13 UTC
  • Revision ID: netbit73@gmail.com-20220922195613-wtik9mmy20tmor0i
2022-09-22 21:17:09

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright 2019 Google LLC
3
 
 * SPDX-License-Identifier: MIT
4
 
 *
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
9
 
 */
10
 
 
11
 
#ifndef VN_DEVICE_MEMORY_H
12
 
#define VN_DEVICE_MEMORY_H
13
 
 
14
 
#include "vn_common.h"
15
 
 
16
 
struct vn_device_memory_pool {
17
 
   mtx_t mutex;
18
 
   struct vn_device_memory *memory;
19
 
   VkDeviceSize used;
20
 
};
21
 
 
22
 
struct vn_device_memory {
23
 
   struct vn_object_base base;
24
 
 
25
 
   VkDeviceSize size;
26
 
   VkMemoryPropertyFlags flags;
27
 
 
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;
36
 
 
37
 
   VkDeviceSize map_end;
38
 
 
39
 
   /* non-NULL when backed by AHB */
40
 
   struct AHardwareBuffer *ahb;
41
 
};
42
 
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_device_memory,
43
 
                               base.base,
44
 
                               VkDeviceMemory,
45
 
                               VK_OBJECT_TYPE_DEVICE_MEMORY)
46
 
 
47
 
void
48
 
vn_device_memory_pool_fini(struct vn_device *dev, uint32_t mem_type_index);
49
 
 
50
 
VkResult
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,
55
 
                                int fd);
56
 
 
57
 
VkResult
58
 
vn_get_memory_dma_buf_properties(struct vn_device *dev,
59
 
                                 int fd,
60
 
                                 uint64_t *out_alloc_size,
61
 
                                 uint32_t *out_mem_type_bits);
62
 
 
63
 
#endif /* VN_DEVICE_MEMORY_H */