xref: /aosp_15_r20/external/mesa3d/src/amd/vulkan/radv_perfcounter.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright © 2016 Red Hat.
3  * Copyright © 2016 Bas Nieuwenhuizen
4  *
5  * based in part on anv driver which is:
6  * Copyright © 2015 Intel Corporation
7  *
8  * SPDX-License-Identifier: MIT
9  */
10 
11 #ifndef RADV_PERFCOUNTER_H
12 #define RADV_PERFCOUNTER_H
13 
14 #include "radv_radeon_winsys.h"
15 
16 #include "radv_query.h"
17 
18 struct radv_physical_device;
19 struct radv_device;
20 
21 struct radv_pc_query_pool {
22    struct radv_query_pool b;
23 
24    uint32_t *pc_regs;
25    unsigned num_pc_regs;
26 
27    unsigned num_passes;
28 
29    unsigned num_counters;
30    struct radv_perfcounter_impl *counters;
31 };
32 
33 void radv_perfcounter_emit_shaders(struct radv_device *device, struct radeon_cmdbuf *cs, unsigned shaders);
34 
35 void radv_perfcounter_emit_spm_reset(struct radeon_cmdbuf *cs);
36 
37 void radv_perfcounter_emit_spm_start(struct radv_device *device, struct radeon_cmdbuf *cs, int family);
38 
39 void radv_perfcounter_emit_spm_stop(struct radv_device *device, struct radeon_cmdbuf *cs, int family);
40 
41 void radv_pc_deinit_query_pool(struct radv_pc_query_pool *pool);
42 
43 VkResult radv_pc_init_query_pool(struct radv_physical_device *pdev, const VkQueryPoolCreateInfo *pCreateInfo,
44                                  struct radv_pc_query_pool *pool);
45 
46 void radv_pc_begin_query(struct radv_cmd_buffer *cmd_buffer, struct radv_pc_query_pool *pool, uint64_t va);
47 
48 void radv_pc_end_query(struct radv_cmd_buffer *cmd_buffer, struct radv_pc_query_pool *pool, uint64_t va);
49 
50 void radv_pc_get_results(const struct radv_pc_query_pool *pc_pool, const uint64_t *data, void *out);
51 
52 #endif /* RADV_PERFCOUNTER_H */
53