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 #include "panfrost-job.h" 15 16 struct panvk_kmod_bo; 17 18 /* Used for internal object allocation. */ 19 struct panvk_priv_bo { 20 struct list_head node; 21 uint64_t refcnt; 22 struct panvk_device *dev; 23 struct pan_kmod_bo *bo; 24 struct { 25 mali_ptr dev; 26 void *host; 27 } addr; 28 }; 29 30 struct panvk_priv_bo *panvk_priv_bo_create(struct panvk_device *dev, 31 size_t size, uint32_t flags, 32 VkSystemAllocationScope scope); 33 34 static inline struct panvk_priv_bo * panvk_priv_bo_ref(struct panvk_priv_bo * bo)35panvk_priv_bo_ref(struct panvk_priv_bo *bo) 36 { 37 assert(p_atomic_read(&bo->refcnt) > 0); 38 p_atomic_inc(&bo->refcnt); 39 return bo; 40 } 41 42 void panvk_priv_bo_unref(struct panvk_priv_bo *bo); 43 44 #endif 45