xref: /aosp_15_r20/external/mesa3d/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright © 2016 Red Hat.
3  * Copyright © 2016 Bas Nieuwenhuizen
4  * based on amdgpu winsys.
5  * Copyright © 2011 Marek Olšák <[email protected]>
6  * Copyright © 2015 Advanced Micro Devices, Inc.
7  *
8  * SPDX-License-Identifier: MIT
9  */
10 
11 #ifndef RADV_AMDGPU_WINSYS_H
12 #define RADV_AMDGPU_WINSYS_H
13 
14 #include <amdgpu.h>
15 #include <pthread.h>
16 #include "util/list.h"
17 #include "util/rwlock.h"
18 #include "ac_gpu_info.h"
19 #include "radv_radeon_winsys.h"
20 
21 #include "vk_sync.h"
22 #include "vk_sync_timeline.h"
23 
24 struct radv_amdgpu_winsys {
25    struct radeon_winsys base;
26    amdgpu_device_handle dev;
27 
28    struct radeon_info info;
29    struct ac_addrlib *addrlib;
30 
31    bool debug_all_bos;
32    bool debug_log_bos;
33    bool use_ib_bos;
34    bool zero_all_vram_allocs;
35    bool reserve_vmid;
36    uint64_t perftest;
37 
38    alignas(8) uint64_t allocated_vram;
39    alignas(8) uint64_t allocated_vram_vis;
40    alignas(8) uint64_t allocated_gtt;
41 
42    /* Global BO list */
43    struct {
44       struct radv_amdgpu_winsys_bo **bos;
45       uint32_t count;
46       uint32_t capacity;
47       struct u_rwlock lock;
48    } global_bo_list;
49 
50    /* BO log */
51    struct u_rwlock log_bo_list_lock;
52    struct list_head log_bo_list;
53 
54    const struct vk_sync_type *sync_types[3];
55    struct vk_sync_type syncobj_sync_type;
56    struct vk_sync_timeline_type emulated_timeline_sync_type;
57 
58    uint32_t refcount;
59 };
60 
61 static inline struct radv_amdgpu_winsys *
radv_amdgpu_winsys(struct radeon_winsys * base)62 radv_amdgpu_winsys(struct radeon_winsys *base)
63 {
64    return (struct radv_amdgpu_winsys *)base;
65 }
66 
67 #endif /* RADV_AMDGPU_WINSYS_H */
68