• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2016 Red Hat.
3  * Copyright © 2016 Bas Nieuwenhuizen
4  * based on amdgpu winsys.
5  * Copyright © 2011 Marek Olšák <maraeo@gmail.com>
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 "ac_linux_drm.h"
20 #include "radv_radeon_winsys.h"
21 
22 #include "vk_sync.h"
23 #include "vk_sync_timeline.h"
24 
25 struct radv_amdgpu_winsys {
26    struct radeon_winsys base;
27    ac_drm_device *dev;
28    int fd;
29 
30    struct radeon_info info;
31 
32    bool debug_all_bos;
33    bool debug_log_bos;
34    bool use_ib_bos;
35    bool zero_all_vram_allocs;
36    bool reserve_vmid;
37    uint64_t perftest;
38 
39    alignas(8) uint64_t allocated_vram;
40    alignas(8) uint64_t allocated_vram_vis;
41    alignas(8) uint64_t allocated_gtt;
42 
43    /* Global BO list */
44    struct {
45       struct radv_amdgpu_winsys_bo **bos;
46       uint32_t count;
47       uint32_t capacity;
48       struct u_rwlock lock;
49    } global_bo_list;
50 
51    /* BO log */
52    struct u_rwlock log_bo_list_lock;
53    struct list_head log_bo_list;
54 
55    const struct vk_sync_type *sync_types[3];
56    struct vk_sync_type syncobj_sync_type;
57    struct vk_sync_timeline_type emulated_timeline_sync_type;
58 
59    uint32_t refcount;
60 };
61 
62 static inline struct radv_amdgpu_winsys *
radv_amdgpu_winsys(struct radeon_winsys * base)63 radv_amdgpu_winsys(struct radeon_winsys *base)
64 {
65    return (struct radv_amdgpu_winsys *)base;
66 }
67 
68 #endif /* RADV_AMDGPU_WINSYS_H */
69