Debian Codegraph @

src/panfrost/vulkan/panvk_priv_bo.h

raw
1 /*
2 * Copyright © 2021 Collabora Ltd.
3 * SPDX-License-Identifier: MIT
4 */
5
6 #ifndef PANVK_PRIV_BO_H
7 #define PANVK_PRIV_BO_H
8
9 #include <vulkan/vulkan_core.h>
10
11 #include "util/list.h"
12 #include "util/u_atomic.h"
13
14 struct panvk_kmod_bo;
15
16 /* Used for internal object allocation. */
17 struct panvk_priv_bo {
18 struct list_head node;
19 uint64_t refcnt;
20 struct panvk_device *dev;
21 struct pan_kmod_bo *bo;
22 struct {
23 uint64_t dev;
24 void *host;
25 } addr;
26 };
27
28 VkResult panvk_priv_bo_create(struct panvk_device *dev, uint64_t size,
29 uint32_t flags, VkSystemAllocationScope scope,
30 struct panvk_priv_bo **out);
31
32 static inline struct panvk_priv_bo *
33 panvk_priv_bo_ref(struct panvk_priv_bo *bo)
34 {
35 assert(p_atomic_read(&bo->refcnt) > 0);
36 p_atomic_inc(&bo->refcnt);
37 return bo;
38 }
39
40 void panvk_priv_bo_flush(struct panvk_priv_bo *bo, size_t offset, size_t size);
41 void panvk_priv_bo_invalidate(struct panvk_priv_bo *bo, size_t offset, size_t size);
42
43 void panvk_priv_bo_unref(struct panvk_priv_bo *bo);
44
45 #endif