xref: /aosp_15_r20/external/mesa3d/src/freedreno/perfcntrs/freedreno_perfcntr.c (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright © 2019 Rob Clark <[email protected]>
3  * SPDX-License-Identifier: MIT
4  *
5  * Authors:
6  *    Rob Clark <[email protected]>
7  */
8 
9 #include <stddef.h>
10 
11 #include "freedreno_perfcntr.h"
12 
13 extern const struct fd_perfcntr_group a2xx_perfcntr_groups[];
14 extern const unsigned a2xx_num_perfcntr_groups;
15 
16 extern const struct fd_perfcntr_group a5xx_perfcntr_groups[];
17 extern const unsigned a5xx_num_perfcntr_groups;
18 
19 extern const struct fd_perfcntr_group a6xx_perfcntr_groups[];
20 extern const unsigned a6xx_num_perfcntr_groups;
21 
22 extern const struct fd_perfcntr_group a7xx_perfcntr_groups[];
23 extern const unsigned a7xx_num_perfcntr_groups;
24 
25 const struct fd_perfcntr_group *
fd_perfcntrs(const struct fd_dev_id * id,unsigned * count)26 fd_perfcntrs(const struct fd_dev_id *id, unsigned *count)
27 {
28    switch (fd_dev_gen(id)) {
29    case 2:
30       *count = a2xx_num_perfcntr_groups;
31       return a2xx_perfcntr_groups;
32    case 5:
33       *count = a5xx_num_perfcntr_groups;
34       return a5xx_perfcntr_groups;
35    case 6:
36       *count = a6xx_num_perfcntr_groups;
37       return a6xx_perfcntr_groups;
38    case 7:
39       *count = a7xx_num_perfcntr_groups;
40       return a7xx_perfcntr_groups;
41    default:
42       *count = 0;
43       return NULL;
44    }
45 }
46