17ec681f3Smrg/*
27ec681f3Smrg * Copyright (C) 2018 Rob Clark <robclark@freedesktop.org>
37ec681f3Smrg *
47ec681f3Smrg * Permission is hereby granted, free of charge, to any person obtaining a
57ec681f3Smrg * copy of this software and associated documentation files (the "Software"),
67ec681f3Smrg * to deal in the Software without restriction, including without limitation
77ec681f3Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
87ec681f3Smrg * and/or sell copies of the Software, and to permit persons to whom the
97ec681f3Smrg * Software is furnished to do so, subject to the following conditions:
107ec681f3Smrg *
117ec681f3Smrg * The above copyright notice and this permission notice (including the next
127ec681f3Smrg * paragraph) shall be included in all copies or substantial portions of the
137ec681f3Smrg * Software.
147ec681f3Smrg *
157ec681f3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
167ec681f3Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
177ec681f3Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
187ec681f3Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
197ec681f3Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
207ec681f3Smrg * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
217ec681f3Smrg * SOFTWARE.
227ec681f3Smrg *
237ec681f3Smrg * Authors:
247ec681f3Smrg *    Rob Clark <robclark@freedesktop.org>
257ec681f3Smrg */
267ec681f3Smrg
277ec681f3Smrg#ifndef FD5_PERFCNTR_H_
287ec681f3Smrg#define FD5_PERFCNTR_H_
297ec681f3Smrg
307ec681f3Smrg#include "util/half_float.h"
317ec681f3Smrg#include "util/u_math.h"
327ec681f3Smrg#include "adreno_common.xml.h"
337ec681f3Smrg#include "a5xx.xml.h"
347ec681f3Smrg
357ec681f3Smrg#define REG(_x) REG_A5XX_ ## _x
367ec681f3Smrg#include "freedreno_perfcntr.h"
377ec681f3Smrg
387ec681f3Smrgstatic const struct fd_perfcntr_counter cp_counters[] = {
397ec681f3Smrg//RESERVED: for kernel
407ec681f3Smrg//    COUNTER(CP_PERFCTR_CP_SEL_0, RBBM_PERFCTR_CP_0_LO, RBBM_PERFCTR_CP_0_HI),
417ec681f3Smrg      COUNTER(CP_PERFCTR_CP_SEL_1, RBBM_PERFCTR_CP_1_LO, RBBM_PERFCTR_CP_1_HI),
427ec681f3Smrg      COUNTER(CP_PERFCTR_CP_SEL_2, RBBM_PERFCTR_CP_2_LO, RBBM_PERFCTR_CP_2_HI),
437ec681f3Smrg      COUNTER(CP_PERFCTR_CP_SEL_3, RBBM_PERFCTR_CP_3_LO, RBBM_PERFCTR_CP_3_HI),
447ec681f3Smrg      COUNTER(CP_PERFCTR_CP_SEL_4, RBBM_PERFCTR_CP_4_LO, RBBM_PERFCTR_CP_4_HI),
457ec681f3Smrg      COUNTER(CP_PERFCTR_CP_SEL_5, RBBM_PERFCTR_CP_5_LO, RBBM_PERFCTR_CP_5_HI),
467ec681f3Smrg      COUNTER(CP_PERFCTR_CP_SEL_6, RBBM_PERFCTR_CP_6_LO, RBBM_PERFCTR_CP_6_HI),
477ec681f3Smrg      COUNTER(CP_PERFCTR_CP_SEL_7, RBBM_PERFCTR_CP_7_LO, RBBM_PERFCTR_CP_7_HI),
487ec681f3Smrg};
497ec681f3Smrg
507ec681f3Smrgstatic const struct fd_perfcntr_countable cp_countables[] = {
517ec681f3Smrg      COUNTABLE(PERF_CP_ALWAYS_COUNT, UINT64, AVERAGE),
527ec681f3Smrg      COUNTABLE(PERF_CP_BUSY_GFX_CORE_IDLE, UINT64, AVERAGE),
537ec681f3Smrg      COUNTABLE(PERF_CP_BUSY_CYCLES, UINT64, AVERAGE),
547ec681f3Smrg      COUNTABLE(PERF_CP_PFP_IDLE, UINT64, AVERAGE),
557ec681f3Smrg      COUNTABLE(PERF_CP_PFP_BUSY_WORKING, UINT64, AVERAGE),
567ec681f3Smrg      COUNTABLE(PERF_CP_PFP_STALL_CYCLES_ANY, UINT64, AVERAGE),
577ec681f3Smrg      COUNTABLE(PERF_CP_PFP_STARVE_CYCLES_ANY, UINT64, AVERAGE),
587ec681f3Smrg      COUNTABLE(PERF_CP_PFP_ICACHE_MISS, UINT64, AVERAGE),
597ec681f3Smrg      COUNTABLE(PERF_CP_PFP_ICACHE_HIT, UINT64, AVERAGE),
607ec681f3Smrg      COUNTABLE(PERF_CP_PFP_MATCH_PM4_PKT_PROFILE, UINT64, AVERAGE),
617ec681f3Smrg      COUNTABLE(PERF_CP_ME_BUSY_WORKING, UINT64, AVERAGE),
627ec681f3Smrg      COUNTABLE(PERF_CP_ME_IDLE, UINT64, AVERAGE),
637ec681f3Smrg      COUNTABLE(PERF_CP_ME_STARVE_CYCLES_ANY, UINT64, AVERAGE),
647ec681f3Smrg      COUNTABLE(PERF_CP_ME_FIFO_EMPTY_PFP_IDLE, UINT64, AVERAGE),
657ec681f3Smrg      COUNTABLE(PERF_CP_ME_FIFO_EMPTY_PFP_BUSY, UINT64, AVERAGE),
667ec681f3Smrg      COUNTABLE(PERF_CP_ME_FIFO_FULL_ME_BUSY, UINT64, AVERAGE),
677ec681f3Smrg      COUNTABLE(PERF_CP_ME_FIFO_FULL_ME_NON_WORKING, UINT64, AVERAGE),
687ec681f3Smrg      COUNTABLE(PERF_CP_ME_STALL_CYCLES_ANY, UINT64, AVERAGE),
697ec681f3Smrg      COUNTABLE(PERF_CP_ME_ICACHE_MISS, UINT64, AVERAGE),
707ec681f3Smrg      COUNTABLE(PERF_CP_ME_ICACHE_HIT, UINT64, AVERAGE),
717ec681f3Smrg      COUNTABLE(PERF_CP_NUM_PREEMPTIONS, UINT64, AVERAGE),
727ec681f3Smrg      COUNTABLE(PERF_CP_PREEMPTION_REACTION_DELAY, UINT64, AVERAGE),
737ec681f3Smrg      COUNTABLE(PERF_CP_PREEMPTION_SWITCH_OUT_TIME, UINT64, AVERAGE),
747ec681f3Smrg      COUNTABLE(PERF_CP_PREEMPTION_SWITCH_IN_TIME, UINT64, AVERAGE),
757ec681f3Smrg      COUNTABLE(PERF_CP_DEAD_DRAWS_IN_BIN_RENDER, UINT64, AVERAGE),
767ec681f3Smrg      COUNTABLE(PERF_CP_PREDICATED_DRAWS_KILLED, UINT64, AVERAGE),
777ec681f3Smrg      COUNTABLE(PERF_CP_MODE_SWITCH, UINT64, AVERAGE),
787ec681f3Smrg      COUNTABLE(PERF_CP_ZPASS_DONE, UINT64, AVERAGE),
797ec681f3Smrg      COUNTABLE(PERF_CP_CONTEXT_DONE, UINT64, AVERAGE),
807ec681f3Smrg      COUNTABLE(PERF_CP_CACHE_FLUSH, UINT64, AVERAGE),
817ec681f3Smrg      COUNTABLE(PERF_CP_LONG_PREEMPTIONS, UINT64, AVERAGE),
827ec681f3Smrg};
837ec681f3Smrg
847ec681f3Smrgstatic const struct fd_perfcntr_counter ccu_counters[] = {
857ec681f3Smrg      COUNTER(RB_PERFCTR_CCU_SEL_0, RBBM_PERFCTR_CCU_0_LO, RBBM_PERFCTR_CCU_0_HI),
867ec681f3Smrg      COUNTER(RB_PERFCTR_CCU_SEL_1, RBBM_PERFCTR_CCU_1_LO, RBBM_PERFCTR_CCU_1_HI),
877ec681f3Smrg      COUNTER(RB_PERFCTR_CCU_SEL_2, RBBM_PERFCTR_CCU_2_LO, RBBM_PERFCTR_CCU_2_HI),
887ec681f3Smrg      COUNTER(RB_PERFCTR_CCU_SEL_3, RBBM_PERFCTR_CCU_3_LO, RBBM_PERFCTR_CCU_3_HI),
897ec681f3Smrg};
907ec681f3Smrg
917ec681f3Smrgstatic const struct fd_perfcntr_countable ccu_countables[] = {
927ec681f3Smrg      COUNTABLE(PERF_CCU_BUSY_CYCLES, UINT64, AVERAGE),
937ec681f3Smrg      COUNTABLE(PERF_CCU_STALL_CYCLES_RB_DEPTH_RETURN, UINT64, AVERAGE),
947ec681f3Smrg      COUNTABLE(PERF_CCU_STALL_CYCLES_RB_COLOR_RETURN, UINT64, AVERAGE),
957ec681f3Smrg      COUNTABLE(PERF_CCU_STARVE_CYCLES_FLAG_RETURN, UINT64, AVERAGE),
967ec681f3Smrg      COUNTABLE(PERF_CCU_DEPTH_BLOCKS, UINT64, AVERAGE),
977ec681f3Smrg      COUNTABLE(PERF_CCU_COLOR_BLOCKS, UINT64, AVERAGE),
987ec681f3Smrg      COUNTABLE(PERF_CCU_DEPTH_BLOCK_HIT, UINT64, AVERAGE),
997ec681f3Smrg      COUNTABLE(PERF_CCU_COLOR_BLOCK_HIT, UINT64, AVERAGE),
1007ec681f3Smrg      COUNTABLE(PERF_CCU_PARTIAL_BLOCK_READ, UINT64, AVERAGE),
1017ec681f3Smrg      COUNTABLE(PERF_CCU_GMEM_READ, UINT64, AVERAGE),
1027ec681f3Smrg      COUNTABLE(PERF_CCU_GMEM_WRITE, UINT64, AVERAGE),
1037ec681f3Smrg      COUNTABLE(PERF_CCU_DEPTH_READ_FLAG0_COUNT, UINT64, AVERAGE),
1047ec681f3Smrg      COUNTABLE(PERF_CCU_DEPTH_READ_FLAG1_COUNT, UINT64, AVERAGE),
1057ec681f3Smrg      COUNTABLE(PERF_CCU_DEPTH_READ_FLAG2_COUNT, UINT64, AVERAGE),
1067ec681f3Smrg      COUNTABLE(PERF_CCU_DEPTH_READ_FLAG3_COUNT, UINT64, AVERAGE),
1077ec681f3Smrg      COUNTABLE(PERF_CCU_DEPTH_READ_FLAG4_COUNT, UINT64, AVERAGE),
1087ec681f3Smrg      COUNTABLE(PERF_CCU_COLOR_READ_FLAG0_COUNT, UINT64, AVERAGE),
1097ec681f3Smrg      COUNTABLE(PERF_CCU_COLOR_READ_FLAG1_COUNT, UINT64, AVERAGE),
1107ec681f3Smrg      COUNTABLE(PERF_CCU_COLOR_READ_FLAG2_COUNT, UINT64, AVERAGE),
1117ec681f3Smrg      COUNTABLE(PERF_CCU_COLOR_READ_FLAG3_COUNT, UINT64, AVERAGE),
1127ec681f3Smrg      COUNTABLE(PERF_CCU_COLOR_READ_FLAG4_COUNT, UINT64, AVERAGE),
1137ec681f3Smrg      COUNTABLE(PERF_CCU_2D_BUSY_CYCLES, UINT64, AVERAGE),
1147ec681f3Smrg      COUNTABLE(PERF_CCU_2D_RD_REQ, UINT64, AVERAGE),
1157ec681f3Smrg      COUNTABLE(PERF_CCU_2D_WR_REQ, UINT64, AVERAGE),
1167ec681f3Smrg      COUNTABLE(PERF_CCU_2D_REORDER_STARVE_CYCLES, UINT64, AVERAGE),
1177ec681f3Smrg      COUNTABLE(PERF_CCU_2D_PIXELS, UINT64, AVERAGE),
1187ec681f3Smrg};
1197ec681f3Smrg
1207ec681f3Smrgstatic const struct fd_perfcntr_counter tse_counters[] = {
1217ec681f3Smrg      COUNTER(GRAS_PERFCTR_TSE_SEL_0, RBBM_PERFCTR_TSE_0_LO, RBBM_PERFCTR_TSE_0_HI),
1227ec681f3Smrg      COUNTER(GRAS_PERFCTR_TSE_SEL_1, RBBM_PERFCTR_TSE_1_LO, RBBM_PERFCTR_TSE_1_HI),
1237ec681f3Smrg      COUNTER(GRAS_PERFCTR_TSE_SEL_2, RBBM_PERFCTR_TSE_2_LO, RBBM_PERFCTR_TSE_2_HI),
1247ec681f3Smrg      COUNTER(GRAS_PERFCTR_TSE_SEL_3, RBBM_PERFCTR_TSE_3_LO, RBBM_PERFCTR_TSE_3_HI),
1257ec681f3Smrg};
1267ec681f3Smrg
1277ec681f3Smrgstatic const struct fd_perfcntr_countable tse_countables[] = {
1287ec681f3Smrg      COUNTABLE(PERF_TSE_BUSY_CYCLES, UINT64, AVERAGE),
1297ec681f3Smrg      COUNTABLE(PERF_TSE_CLIPPING_CYCLES, UINT64, AVERAGE),
1307ec681f3Smrg      COUNTABLE(PERF_TSE_STALL_CYCLES_RAS, UINT64, AVERAGE),
1317ec681f3Smrg      COUNTABLE(PERF_TSE_STALL_CYCLES_LRZ_BARYPLANE, UINT64, AVERAGE),
1327ec681f3Smrg      COUNTABLE(PERF_TSE_STALL_CYCLES_LRZ_ZPLANE, UINT64, AVERAGE),
1337ec681f3Smrg      COUNTABLE(PERF_TSE_STARVE_CYCLES_PC, UINT64, AVERAGE),
1347ec681f3Smrg      COUNTABLE(PERF_TSE_INPUT_PRIM, UINT64, AVERAGE),
1357ec681f3Smrg      COUNTABLE(PERF_TSE_INPUT_NULL_PRIM, UINT64, AVERAGE),
1367ec681f3Smrg      COUNTABLE(PERF_TSE_TRIVAL_REJ_PRIM, UINT64, AVERAGE),
1377ec681f3Smrg      COUNTABLE(PERF_TSE_CLIPPED_PRIM, UINT64, AVERAGE),
1387ec681f3Smrg      COUNTABLE(PERF_TSE_ZERO_AREA_PRIM, UINT64, AVERAGE),
1397ec681f3Smrg      COUNTABLE(PERF_TSE_FACENESS_CULLED_PRIM, UINT64, AVERAGE),
1407ec681f3Smrg      COUNTABLE(PERF_TSE_ZERO_PIXEL_PRIM, UINT64, AVERAGE),
1417ec681f3Smrg      COUNTABLE(PERF_TSE_OUTPUT_NULL_PRIM, UINT64, AVERAGE),
1427ec681f3Smrg      COUNTABLE(PERF_TSE_OUTPUT_VISIBLE_PRIM, UINT64, AVERAGE),
1437ec681f3Smrg      COUNTABLE(PERF_TSE_CINVOCATION, UINT64, AVERAGE),
1447ec681f3Smrg      COUNTABLE(PERF_TSE_CPRIMITIVES, UINT64, AVERAGE),
1457ec681f3Smrg      COUNTABLE(PERF_TSE_2D_INPUT_PRIM, UINT64, AVERAGE),
1467ec681f3Smrg      COUNTABLE(PERF_TSE_2D_ALIVE_CLCLES, UINT64, AVERAGE),
1477ec681f3Smrg};
1487ec681f3Smrg
1497ec681f3Smrgstatic const struct fd_perfcntr_counter ras_counters[] = {
1507ec681f3Smrg      COUNTER(GRAS_PERFCTR_RAS_SEL_0, RBBM_PERFCTR_RAS_0_LO, RBBM_PERFCTR_RAS_0_HI),
1517ec681f3Smrg      COUNTER(GRAS_PERFCTR_RAS_SEL_1, RBBM_PERFCTR_RAS_1_LO, RBBM_PERFCTR_RAS_1_HI),
1527ec681f3Smrg      COUNTER(GRAS_PERFCTR_RAS_SEL_2, RBBM_PERFCTR_RAS_2_LO, RBBM_PERFCTR_RAS_2_HI),
1537ec681f3Smrg      COUNTER(GRAS_PERFCTR_RAS_SEL_3, RBBM_PERFCTR_RAS_3_LO, RBBM_PERFCTR_RAS_3_HI),
1547ec681f3Smrg};
1557ec681f3Smrg
1567ec681f3Smrgstatic const struct fd_perfcntr_countable ras_countables[] = {
1577ec681f3Smrg      COUNTABLE(PERF_RAS_BUSY_CYCLES, UINT64, AVERAGE),
1587ec681f3Smrg      COUNTABLE(PERF_RAS_SUPERTILE_ACTIVE_CYCLES, UINT64, AVERAGE),
1597ec681f3Smrg      COUNTABLE(PERF_RAS_STALL_CYCLES_LRZ, UINT64, AVERAGE),
1607ec681f3Smrg      COUNTABLE(PERF_RAS_STARVE_CYCLES_TSE, UINT64, AVERAGE),
1617ec681f3Smrg      COUNTABLE(PERF_RAS_SUPER_TILES, UINT64, AVERAGE),
1627ec681f3Smrg      COUNTABLE(PERF_RAS_8X4_TILES, UINT64, AVERAGE),
1637ec681f3Smrg      COUNTABLE(PERF_RAS_MASKGEN_ACTIVE, UINT64, AVERAGE),
1647ec681f3Smrg      COUNTABLE(PERF_RAS_FULLY_COVERED_SUPER_TILES, UINT64, AVERAGE),
1657ec681f3Smrg      COUNTABLE(PERF_RAS_FULLY_COVERED_8X4_TILES, UINT64, AVERAGE),
1667ec681f3Smrg      COUNTABLE(PERF_RAS_PRIM_KILLED_INVISILBE, UINT64, AVERAGE),
1677ec681f3Smrg};
1687ec681f3Smrg
1697ec681f3Smrgstatic const struct fd_perfcntr_counter lrz_counters[] = {
1707ec681f3Smrg      COUNTER(GRAS_PERFCTR_LRZ_SEL_0, RBBM_PERFCTR_LRZ_0_LO, RBBM_PERFCTR_LRZ_0_HI),
1717ec681f3Smrg      COUNTER(GRAS_PERFCTR_LRZ_SEL_1, RBBM_PERFCTR_LRZ_1_LO, RBBM_PERFCTR_LRZ_1_HI),
1727ec681f3Smrg      COUNTER(GRAS_PERFCTR_LRZ_SEL_2, RBBM_PERFCTR_LRZ_2_LO, RBBM_PERFCTR_LRZ_2_HI),
1737ec681f3Smrg      COUNTER(GRAS_PERFCTR_LRZ_SEL_3, RBBM_PERFCTR_LRZ_3_LO, RBBM_PERFCTR_LRZ_3_HI),
1747ec681f3Smrg};
1757ec681f3Smrg
1767ec681f3Smrgstatic const struct fd_perfcntr_countable lrz_countables[] = {
1777ec681f3Smrg      COUNTABLE(PERF_LRZ_BUSY_CYCLES, UINT64, AVERAGE),
1787ec681f3Smrg      COUNTABLE(PERF_LRZ_STARVE_CYCLES_RAS, UINT64, AVERAGE),
1797ec681f3Smrg      COUNTABLE(PERF_LRZ_STALL_CYCLES_RB, UINT64, AVERAGE),
1807ec681f3Smrg      COUNTABLE(PERF_LRZ_STALL_CYCLES_VSC, UINT64, AVERAGE),
1817ec681f3Smrg      COUNTABLE(PERF_LRZ_STALL_CYCLES_VPC, UINT64, AVERAGE),
1827ec681f3Smrg      COUNTABLE(PERF_LRZ_STALL_CYCLES_FLAG_PREFETCH, UINT64, AVERAGE),
1837ec681f3Smrg      COUNTABLE(PERF_LRZ_STALL_CYCLES_UCHE, UINT64, AVERAGE),
1847ec681f3Smrg      COUNTABLE(PERF_LRZ_LRZ_READ, UINT64, AVERAGE),
1857ec681f3Smrg      COUNTABLE(PERF_LRZ_LRZ_WRITE, UINT64, AVERAGE),
1867ec681f3Smrg      COUNTABLE(PERF_LRZ_READ_LATENCY, UINT64, AVERAGE),
1877ec681f3Smrg      COUNTABLE(PERF_LRZ_MERGE_CACHE_UPDATING, UINT64, AVERAGE),
1887ec681f3Smrg      COUNTABLE(PERF_LRZ_PRIM_KILLED_BY_MASKGEN, UINT64, AVERAGE),
1897ec681f3Smrg      COUNTABLE(PERF_LRZ_PRIM_KILLED_BY_LRZ, UINT64, AVERAGE),
1907ec681f3Smrg      COUNTABLE(PERF_LRZ_VISIBLE_PRIM_AFTER_LRZ, UINT64, AVERAGE),
1917ec681f3Smrg      COUNTABLE(PERF_LRZ_FULL_8X8_TILES, UINT64, AVERAGE),
1927ec681f3Smrg      COUNTABLE(PERF_LRZ_PARTIAL_8X8_TILES, UINT64, AVERAGE),
1937ec681f3Smrg      COUNTABLE(PERF_LRZ_TILE_KILLED, UINT64, AVERAGE),
1947ec681f3Smrg      COUNTABLE(PERF_LRZ_TOTAL_PIXEL, UINT64, AVERAGE),
1957ec681f3Smrg      COUNTABLE(PERF_LRZ_VISIBLE_PIXEL_AFTER_LRZ, UINT64, AVERAGE),
1967ec681f3Smrg};
1977ec681f3Smrg
1987ec681f3Smrgstatic const struct fd_perfcntr_counter hlsq_counters[] = {
1997ec681f3Smrg      COUNTER(HLSQ_PERFCTR_HLSQ_SEL_0, RBBM_PERFCTR_HLSQ_0_LO, RBBM_PERFCTR_HLSQ_0_HI),
2007ec681f3Smrg      COUNTER(HLSQ_PERFCTR_HLSQ_SEL_1, RBBM_PERFCTR_HLSQ_1_LO, RBBM_PERFCTR_HLSQ_1_HI),
2017ec681f3Smrg      COUNTER(HLSQ_PERFCTR_HLSQ_SEL_2, RBBM_PERFCTR_HLSQ_2_LO, RBBM_PERFCTR_HLSQ_2_HI),
2027ec681f3Smrg      COUNTER(HLSQ_PERFCTR_HLSQ_SEL_3, RBBM_PERFCTR_HLSQ_3_LO, RBBM_PERFCTR_HLSQ_3_HI),
2037ec681f3Smrg      COUNTER(HLSQ_PERFCTR_HLSQ_SEL_4, RBBM_PERFCTR_HLSQ_4_LO, RBBM_PERFCTR_HLSQ_4_HI),
2047ec681f3Smrg      COUNTER(HLSQ_PERFCTR_HLSQ_SEL_5, RBBM_PERFCTR_HLSQ_5_LO, RBBM_PERFCTR_HLSQ_5_HI),
2057ec681f3Smrg      COUNTER(HLSQ_PERFCTR_HLSQ_SEL_6, RBBM_PERFCTR_HLSQ_6_LO, RBBM_PERFCTR_HLSQ_6_HI),
2067ec681f3Smrg      COUNTER(HLSQ_PERFCTR_HLSQ_SEL_7, RBBM_PERFCTR_HLSQ_7_LO, RBBM_PERFCTR_HLSQ_7_HI),
2077ec681f3Smrg};
2087ec681f3Smrg
2097ec681f3Smrgstatic const struct fd_perfcntr_countable hlsq_countables[] = {
2107ec681f3Smrg      COUNTABLE(PERF_HLSQ_BUSY_CYCLES, UINT64, AVERAGE),
2117ec681f3Smrg      COUNTABLE(PERF_HLSQ_STALL_CYCLES_UCHE, UINT64, AVERAGE),
2127ec681f3Smrg      COUNTABLE(PERF_HLSQ_STALL_CYCLES_SP_STATE, UINT64, AVERAGE),
2137ec681f3Smrg      COUNTABLE(PERF_HLSQ_STALL_CYCLES_SP_FS_STAGE, UINT64, AVERAGE),
2147ec681f3Smrg      COUNTABLE(PERF_HLSQ_UCHE_LATENCY_CYCLES, UINT64, AVERAGE),
2157ec681f3Smrg      COUNTABLE(PERF_HLSQ_UCHE_LATENCY_COUNT, UINT64, AVERAGE),
2167ec681f3Smrg      COUNTABLE(PERF_HLSQ_FS_STAGE_32_WAVES, UINT64, AVERAGE),
2177ec681f3Smrg      COUNTABLE(PERF_HLSQ_FS_STAGE_64_WAVES, UINT64, AVERAGE),
2187ec681f3Smrg      COUNTABLE(PERF_HLSQ_QUADS, UINT64, AVERAGE),
2197ec681f3Smrg      COUNTABLE(PERF_HLSQ_SP_STATE_COPY_TRANS_FS_STAGE, UINT64, AVERAGE),
2207ec681f3Smrg      COUNTABLE(PERF_HLSQ_SP_STATE_COPY_TRANS_VS_STAGE, UINT64, AVERAGE),
2217ec681f3Smrg      COUNTABLE(PERF_HLSQ_TP_STATE_COPY_TRANS_FS_STAGE, UINT64, AVERAGE),
2227ec681f3Smrg      COUNTABLE(PERF_HLSQ_TP_STATE_COPY_TRANS_VS_STAGE, UINT64, AVERAGE),
2237ec681f3Smrg      COUNTABLE(PERF_HLSQ_CS_INVOCATIONS, UINT64, AVERAGE),
2247ec681f3Smrg      COUNTABLE(PERF_HLSQ_COMPUTE_DRAWCALLS, UINT64, AVERAGE),
2257ec681f3Smrg};
2267ec681f3Smrg
2277ec681f3Smrgstatic const struct fd_perfcntr_counter pc_counters[] = {
2287ec681f3Smrg      COUNTER(PC_PERFCTR_PC_SEL_0, RBBM_PERFCTR_PC_0_LO, RBBM_PERFCTR_PC_0_HI),
2297ec681f3Smrg      COUNTER(PC_PERFCTR_PC_SEL_1, RBBM_PERFCTR_PC_1_LO, RBBM_PERFCTR_PC_1_HI),
2307ec681f3Smrg      COUNTER(PC_PERFCTR_PC_SEL_2, RBBM_PERFCTR_PC_2_LO, RBBM_PERFCTR_PC_2_HI),
2317ec681f3Smrg      COUNTER(PC_PERFCTR_PC_SEL_3, RBBM_PERFCTR_PC_3_LO, RBBM_PERFCTR_PC_3_HI),
2327ec681f3Smrg      COUNTER(PC_PERFCTR_PC_SEL_4, RBBM_PERFCTR_PC_4_LO, RBBM_PERFCTR_PC_4_HI),
2337ec681f3Smrg      COUNTER(PC_PERFCTR_PC_SEL_5, RBBM_PERFCTR_PC_5_LO, RBBM_PERFCTR_PC_5_HI),
2347ec681f3Smrg      COUNTER(PC_PERFCTR_PC_SEL_6, RBBM_PERFCTR_PC_6_LO, RBBM_PERFCTR_PC_6_HI),
2357ec681f3Smrg      COUNTER(PC_PERFCTR_PC_SEL_7, RBBM_PERFCTR_PC_7_LO, RBBM_PERFCTR_PC_7_HI),
2367ec681f3Smrg};
2377ec681f3Smrg
2387ec681f3Smrgstatic const struct fd_perfcntr_countable pc_countables[] = {
2397ec681f3Smrg      COUNTABLE(PERF_PC_BUSY_CYCLES, UINT64, AVERAGE),
2407ec681f3Smrg      COUNTABLE(PERF_PC_WORKING_CYCLES, UINT64, AVERAGE),
2417ec681f3Smrg      COUNTABLE(PERF_PC_STALL_CYCLES_VFD, UINT64, AVERAGE),
2427ec681f3Smrg      COUNTABLE(PERF_PC_STALL_CYCLES_TSE, UINT64, AVERAGE),
2437ec681f3Smrg      COUNTABLE(PERF_PC_STALL_CYCLES_VPC, UINT64, AVERAGE),
2447ec681f3Smrg      COUNTABLE(PERF_PC_STALL_CYCLES_UCHE, UINT64, AVERAGE),
2457ec681f3Smrg      COUNTABLE(PERF_PC_STALL_CYCLES_TESS, UINT64, AVERAGE),
2467ec681f3Smrg      COUNTABLE(PERF_PC_STALL_CYCLES_TSE_ONLY, UINT64, AVERAGE),
2477ec681f3Smrg      COUNTABLE(PERF_PC_STALL_CYCLES_VPC_ONLY, UINT64, AVERAGE),
2487ec681f3Smrg      COUNTABLE(PERF_PC_PASS1_TF_STALL_CYCLES, UINT64, AVERAGE),
2497ec681f3Smrg      COUNTABLE(PERF_PC_STARVE_CYCLES_FOR_INDEX, UINT64, AVERAGE),
2507ec681f3Smrg      COUNTABLE(PERF_PC_STARVE_CYCLES_FOR_TESS_FACTOR, UINT64, AVERAGE),
2517ec681f3Smrg      COUNTABLE(PERF_PC_STARVE_CYCLES_FOR_VIZ_STREAM, UINT64, AVERAGE),
2527ec681f3Smrg      COUNTABLE(PERF_PC_STARVE_CYCLES_FOR_POSITION, UINT64, AVERAGE),
2537ec681f3Smrg      COUNTABLE(PERF_PC_STARVE_CYCLES_DI, UINT64, AVERAGE),
2547ec681f3Smrg      COUNTABLE(PERF_PC_VIS_STREAMS_LOADED, UINT64, AVERAGE),
2557ec681f3Smrg      COUNTABLE(PERF_PC_INSTANCES, UINT64, AVERAGE),
2567ec681f3Smrg      COUNTABLE(PERF_PC_VPC_PRIMITIVES, UINT64, AVERAGE),
2577ec681f3Smrg      COUNTABLE(PERF_PC_DEAD_PRIM, UINT64, AVERAGE),
2587ec681f3Smrg      COUNTABLE(PERF_PC_LIVE_PRIM, UINT64, AVERAGE),
2597ec681f3Smrg      COUNTABLE(PERF_PC_VERTEX_HITS, UINT64, AVERAGE),
2607ec681f3Smrg      COUNTABLE(PERF_PC_IA_VERTICES, UINT64, AVERAGE),
2617ec681f3Smrg      COUNTABLE(PERF_PC_IA_PRIMITIVES, UINT64, AVERAGE),
2627ec681f3Smrg      COUNTABLE(PERF_PC_GS_PRIMITIVES, UINT64, AVERAGE),
2637ec681f3Smrg      COUNTABLE(PERF_PC_HS_INVOCATIONS, UINT64, AVERAGE),
2647ec681f3Smrg      COUNTABLE(PERF_PC_DS_INVOCATIONS, UINT64, AVERAGE),
2657ec681f3Smrg      COUNTABLE(PERF_PC_VS_INVOCATIONS, UINT64, AVERAGE),
2667ec681f3Smrg      COUNTABLE(PERF_PC_GS_INVOCATIONS, UINT64, AVERAGE),
2677ec681f3Smrg      COUNTABLE(PERF_PC_DS_PRIMITIVES, UINT64, AVERAGE),
2687ec681f3Smrg      COUNTABLE(PERF_PC_VPC_POS_DATA_TRANSACTION, UINT64, AVERAGE),
2697ec681f3Smrg      COUNTABLE(PERF_PC_3D_DRAWCALLS, UINT64, AVERAGE),
2707ec681f3Smrg      COUNTABLE(PERF_PC_2D_DRAWCALLS, UINT64, AVERAGE),
2717ec681f3Smrg      COUNTABLE(PERF_PC_NON_DRAWCALL_GLOBAL_EVENTS, UINT64, AVERAGE),
2727ec681f3Smrg      COUNTABLE(PERF_TESS_BUSY_CYCLES, UINT64, AVERAGE),
2737ec681f3Smrg      COUNTABLE(PERF_TESS_WORKING_CYCLES, UINT64, AVERAGE),
2747ec681f3Smrg      COUNTABLE(PERF_TESS_STALL_CYCLES_PC, UINT64, AVERAGE),
2757ec681f3Smrg      COUNTABLE(PERF_TESS_STARVE_CYCLES_PC, UINT64, AVERAGE),
2767ec681f3Smrg};
2777ec681f3Smrg
2787ec681f3Smrgstatic const struct fd_perfcntr_counter rb_counters[] = {
2797ec681f3Smrg      COUNTER(RB_PERFCTR_RB_SEL_0, RBBM_PERFCTR_RB_0_LO, RBBM_PERFCTR_RB_0_HI),
2807ec681f3Smrg      COUNTER(RB_PERFCTR_RB_SEL_1, RBBM_PERFCTR_RB_1_LO, RBBM_PERFCTR_RB_1_HI),
2817ec681f3Smrg      COUNTER(RB_PERFCTR_RB_SEL_2, RBBM_PERFCTR_RB_2_LO, RBBM_PERFCTR_RB_2_HI),
2827ec681f3Smrg      COUNTER(RB_PERFCTR_RB_SEL_3, RBBM_PERFCTR_RB_3_LO, RBBM_PERFCTR_RB_3_HI),
2837ec681f3Smrg      COUNTER(RB_PERFCTR_RB_SEL_4, RBBM_PERFCTR_RB_4_LO, RBBM_PERFCTR_RB_4_HI),
2847ec681f3Smrg      COUNTER(RB_PERFCTR_RB_SEL_5, RBBM_PERFCTR_RB_5_LO, RBBM_PERFCTR_RB_5_HI),
2857ec681f3Smrg      COUNTER(RB_PERFCTR_RB_SEL_6, RBBM_PERFCTR_RB_6_LO, RBBM_PERFCTR_RB_6_HI),
2867ec681f3Smrg      COUNTER(RB_PERFCTR_RB_SEL_7, RBBM_PERFCTR_RB_7_LO, RBBM_PERFCTR_RB_7_HI),
2877ec681f3Smrg};
2887ec681f3Smrg
2897ec681f3Smrgstatic const struct fd_perfcntr_countable rb_countables[] = {
2907ec681f3Smrg      COUNTABLE(PERF_RB_BUSY_CYCLES, UINT64, AVERAGE),
2917ec681f3Smrg      COUNTABLE(PERF_RB_STALL_CYCLES_CCU, UINT64, AVERAGE),
2927ec681f3Smrg      COUNTABLE(PERF_RB_STALL_CYCLES_HLSQ, UINT64, AVERAGE),
2937ec681f3Smrg      COUNTABLE(PERF_RB_STALL_CYCLES_FIFO0_FULL, UINT64, AVERAGE),
2947ec681f3Smrg      COUNTABLE(PERF_RB_STALL_CYCLES_FIFO1_FULL, UINT64, AVERAGE),
2957ec681f3Smrg      COUNTABLE(PERF_RB_STALL_CYCLES_FIFO2_FULL, UINT64, AVERAGE),
2967ec681f3Smrg      COUNTABLE(PERF_RB_STARVE_CYCLES_SP, UINT64, AVERAGE),
2977ec681f3Smrg      COUNTABLE(PERF_RB_STARVE_CYCLES_LRZ_TILE, UINT64, AVERAGE),
2987ec681f3Smrg      COUNTABLE(PERF_RB_STARVE_CYCLES_CCU, UINT64, AVERAGE),
2997ec681f3Smrg      COUNTABLE(PERF_RB_STARVE_CYCLES_Z_PLANE, UINT64, AVERAGE),
3007ec681f3Smrg      COUNTABLE(PERF_RB_STARVE_CYCLES_BARY_PLANE, UINT64, AVERAGE),
3017ec681f3Smrg      COUNTABLE(PERF_RB_Z_WORKLOAD, UINT64, AVERAGE),
3027ec681f3Smrg      COUNTABLE(PERF_RB_HLSQ_ACTIVE, UINT64, AVERAGE),
3037ec681f3Smrg      COUNTABLE(PERF_RB_Z_READ, UINT64, AVERAGE),
3047ec681f3Smrg      COUNTABLE(PERF_RB_Z_WRITE, UINT64, AVERAGE),
3057ec681f3Smrg      COUNTABLE(PERF_RB_C_READ, UINT64, AVERAGE),
3067ec681f3Smrg      COUNTABLE(PERF_RB_C_WRITE, UINT64, AVERAGE),
3077ec681f3Smrg      COUNTABLE(PERF_RB_TOTAL_PASS, UINT64, AVERAGE),
3087ec681f3Smrg      COUNTABLE(PERF_RB_Z_PASS, UINT64, AVERAGE),
3097ec681f3Smrg      COUNTABLE(PERF_RB_Z_FAIL, UINT64, AVERAGE),
3107ec681f3Smrg      COUNTABLE(PERF_RB_S_FAIL, UINT64, AVERAGE),
3117ec681f3Smrg      COUNTABLE(PERF_RB_BLENDED_FXP_COMPONENTS, UINT64, AVERAGE),
3127ec681f3Smrg      COUNTABLE(PERF_RB_BLENDED_FP16_COMPONENTS, UINT64, AVERAGE),
3137ec681f3Smrg      COUNTABLE(RB_RESERVED, UINT64, AVERAGE),
3147ec681f3Smrg      COUNTABLE(PERF_RB_2D_ALIVE_CYCLES, UINT64, AVERAGE),
3157ec681f3Smrg      COUNTABLE(PERF_RB_2D_STALL_CYCLES_A2D, UINT64, AVERAGE),
3167ec681f3Smrg      COUNTABLE(PERF_RB_2D_STARVE_CYCLES_SRC, UINT64, AVERAGE),
3177ec681f3Smrg      COUNTABLE(PERF_RB_2D_STARVE_CYCLES_SP, UINT64, AVERAGE),
3187ec681f3Smrg      COUNTABLE(PERF_RB_2D_STARVE_CYCLES_DST, UINT64, AVERAGE),
3197ec681f3Smrg      COUNTABLE(PERF_RB_2D_VALID_PIXELS, UINT64, AVERAGE),
3207ec681f3Smrg};
3217ec681f3Smrg
3227ec681f3Smrgstatic const struct fd_perfcntr_counter rbbm_counters[] = {
3237ec681f3Smrg      //RESERVED: for kernel
3247ec681f3Smrg      //	COUNTER(RBBM_PERFCTR_RBBM_SEL_0, RBBM_PERFCTR_RBBM_0_LO, RBBM_PERFCTR_RBBM_0_HI),
3257ec681f3Smrg      COUNTER(RBBM_PERFCTR_RBBM_SEL_1, RBBM_PERFCTR_RBBM_1_LO, RBBM_PERFCTR_RBBM_1_HI),
3267ec681f3Smrg      COUNTER(RBBM_PERFCTR_RBBM_SEL_2, RBBM_PERFCTR_RBBM_2_LO, RBBM_PERFCTR_RBBM_2_HI),
3277ec681f3Smrg      COUNTER(RBBM_PERFCTR_RBBM_SEL_3, RBBM_PERFCTR_RBBM_3_LO, RBBM_PERFCTR_RBBM_3_HI),
3287ec681f3Smrg};
3297ec681f3Smrg
3307ec681f3Smrgstatic const struct fd_perfcntr_countable rbbm_countables[] = {
3317ec681f3Smrg      COUNTABLE(PERF_RBBM_ALWAYS_COUNT, UINT64, AVERAGE),
3327ec681f3Smrg      COUNTABLE(PERF_RBBM_ALWAYS_ON, UINT64, AVERAGE),
3337ec681f3Smrg      COUNTABLE(PERF_RBBM_TSE_BUSY, UINT64, AVERAGE),
3347ec681f3Smrg      COUNTABLE(PERF_RBBM_RAS_BUSY, UINT64, AVERAGE),
3357ec681f3Smrg      COUNTABLE(PERF_RBBM_PC_DCALL_BUSY, UINT64, AVERAGE),
3367ec681f3Smrg      COUNTABLE(PERF_RBBM_PC_VSD_BUSY, UINT64, AVERAGE),
3377ec681f3Smrg      COUNTABLE(PERF_RBBM_STATUS_MASKED, UINT64, AVERAGE),
3387ec681f3Smrg      COUNTABLE(PERF_RBBM_COM_BUSY, UINT64, AVERAGE),
3397ec681f3Smrg      COUNTABLE(PERF_RBBM_DCOM_BUSY, UINT64, AVERAGE),
3407ec681f3Smrg      COUNTABLE(PERF_RBBM_VBIF_BUSY, UINT64, AVERAGE),
3417ec681f3Smrg      COUNTABLE(PERF_RBBM_VSC_BUSY, UINT64, AVERAGE),
3427ec681f3Smrg      COUNTABLE(PERF_RBBM_TESS_BUSY, UINT64, AVERAGE),
3437ec681f3Smrg      COUNTABLE(PERF_RBBM_UCHE_BUSY, UINT64, AVERAGE),
3447ec681f3Smrg      COUNTABLE(PERF_RBBM_HLSQ_BUSY, UINT64, AVERAGE),
3457ec681f3Smrg};
3467ec681f3Smrg
3477ec681f3Smrgstatic const struct fd_perfcntr_counter sp_counters[] = {
3487ec681f3Smrg      //RESERVED: for kernel
3497ec681f3Smrg      //	COUNTER(SP_PERFCTR_SP_SEL_0,  RBBM_PERFCTR_SP_0_LO,  RBBM_PERFCTR_SP_0_HI),
3507ec681f3Smrg      COUNTER(SP_PERFCTR_SP_SEL_1,  RBBM_PERFCTR_SP_1_LO,  RBBM_PERFCTR_SP_1_HI),
3517ec681f3Smrg      COUNTER(SP_PERFCTR_SP_SEL_2,  RBBM_PERFCTR_SP_2_LO,  RBBM_PERFCTR_SP_2_HI),
3527ec681f3Smrg      COUNTER(SP_PERFCTR_SP_SEL_3,  RBBM_PERFCTR_SP_3_LO,  RBBM_PERFCTR_SP_3_HI),
3537ec681f3Smrg      COUNTER(SP_PERFCTR_SP_SEL_4,  RBBM_PERFCTR_SP_4_LO,  RBBM_PERFCTR_SP_4_HI),
3547ec681f3Smrg      COUNTER(SP_PERFCTR_SP_SEL_5,  RBBM_PERFCTR_SP_5_LO,  RBBM_PERFCTR_SP_5_HI),
3557ec681f3Smrg      COUNTER(SP_PERFCTR_SP_SEL_6,  RBBM_PERFCTR_SP_6_LO,  RBBM_PERFCTR_SP_6_HI),
3567ec681f3Smrg      COUNTER(SP_PERFCTR_SP_SEL_7,  RBBM_PERFCTR_SP_7_LO,  RBBM_PERFCTR_SP_7_HI),
3577ec681f3Smrg      COUNTER(SP_PERFCTR_SP_SEL_8,  RBBM_PERFCTR_SP_8_LO,  RBBM_PERFCTR_SP_8_HI),
3587ec681f3Smrg      COUNTER(SP_PERFCTR_SP_SEL_9,  RBBM_PERFCTR_SP_9_LO,  RBBM_PERFCTR_SP_9_HI),
3597ec681f3Smrg      COUNTER(SP_PERFCTR_SP_SEL_10, RBBM_PERFCTR_SP_10_LO, RBBM_PERFCTR_SP_10_HI),
3607ec681f3Smrg      COUNTER(SP_PERFCTR_SP_SEL_11, RBBM_PERFCTR_SP_11_LO, RBBM_PERFCTR_SP_11_HI),
3617ec681f3Smrg};
3627ec681f3Smrg
3637ec681f3Smrgstatic const struct fd_perfcntr_countable sp_countables[] = {
3647ec681f3Smrg      COUNTABLE(PERF_SP_BUSY_CYCLES, UINT64, AVERAGE),
3657ec681f3Smrg      COUNTABLE(PERF_SP_ALU_WORKING_CYCLES, UINT64, AVERAGE),
3667ec681f3Smrg      COUNTABLE(PERF_SP_EFU_WORKING_CYCLES, UINT64, AVERAGE),
3677ec681f3Smrg      COUNTABLE(PERF_SP_STALL_CYCLES_VPC, UINT64, AVERAGE),
3687ec681f3Smrg      COUNTABLE(PERF_SP_STALL_CYCLES_TP, UINT64, AVERAGE),
3697ec681f3Smrg      COUNTABLE(PERF_SP_STALL_CYCLES_UCHE, UINT64, AVERAGE),
3707ec681f3Smrg      COUNTABLE(PERF_SP_STALL_CYCLES_RB, UINT64, AVERAGE),
3717ec681f3Smrg      COUNTABLE(PERF_SP_SCHEDULER_NON_WORKING, UINT64, AVERAGE),
3727ec681f3Smrg      COUNTABLE(PERF_SP_WAVE_CONTEXTS, UINT64, AVERAGE),
3737ec681f3Smrg      COUNTABLE(PERF_SP_WAVE_CONTEXT_CYCLES, UINT64, AVERAGE),
3747ec681f3Smrg      COUNTABLE(PERF_SP_FS_STAGE_WAVE_CYCLES, UINT64, AVERAGE),
3757ec681f3Smrg      COUNTABLE(PERF_SP_FS_STAGE_WAVE_SAMPLES, UINT64, AVERAGE),
3767ec681f3Smrg      COUNTABLE(PERF_SP_VS_STAGE_WAVE_CYCLES, UINT64, AVERAGE),
3777ec681f3Smrg      COUNTABLE(PERF_SP_VS_STAGE_WAVE_SAMPLES, UINT64, AVERAGE),
3787ec681f3Smrg      COUNTABLE(PERF_SP_FS_STAGE_DURATION_CYCLES, UINT64, AVERAGE),
3797ec681f3Smrg      COUNTABLE(PERF_SP_VS_STAGE_DURATION_CYCLES, UINT64, AVERAGE),
3807ec681f3Smrg      COUNTABLE(PERF_SP_WAVE_CTRL_CYCLES, UINT64, AVERAGE),
3817ec681f3Smrg      COUNTABLE(PERF_SP_WAVE_LOAD_CYCLES, UINT64, AVERAGE),
3827ec681f3Smrg      COUNTABLE(PERF_SP_WAVE_EMIT_CYCLES, UINT64, AVERAGE),
3837ec681f3Smrg      COUNTABLE(PERF_SP_WAVE_NOP_CYCLES, UINT64, AVERAGE),
3847ec681f3Smrg      COUNTABLE(PERF_SP_WAVE_WAIT_CYCLES, UINT64, AVERAGE),
3857ec681f3Smrg      COUNTABLE(PERF_SP_WAVE_FETCH_CYCLES, UINT64, AVERAGE),
3867ec681f3Smrg      COUNTABLE(PERF_SP_WAVE_IDLE_CYCLES, UINT64, AVERAGE),
3877ec681f3Smrg      COUNTABLE(PERF_SP_WAVE_END_CYCLES, UINT64, AVERAGE),
3887ec681f3Smrg      COUNTABLE(PERF_SP_WAVE_LONG_SYNC_CYCLES, UINT64, AVERAGE),
3897ec681f3Smrg      COUNTABLE(PERF_SP_WAVE_SHORT_SYNC_CYCLES, UINT64, AVERAGE),
3907ec681f3Smrg      COUNTABLE(PERF_SP_WAVE_JOIN_CYCLES, UINT64, AVERAGE),
3917ec681f3Smrg      COUNTABLE(PERF_SP_LM_LOAD_INSTRUCTIONS, UINT64, AVERAGE),
3927ec681f3Smrg      COUNTABLE(PERF_SP_LM_STORE_INSTRUCTIONS, UINT64, AVERAGE),
3937ec681f3Smrg      COUNTABLE(PERF_SP_LM_ATOMICS, UINT64, AVERAGE),
3947ec681f3Smrg      COUNTABLE(PERF_SP_GM_LOAD_INSTRUCTIONS, UINT64, AVERAGE),
3957ec681f3Smrg      COUNTABLE(PERF_SP_GM_STORE_INSTRUCTIONS, UINT64, AVERAGE),
3967ec681f3Smrg      COUNTABLE(PERF_SP_GM_ATOMICS, UINT64, AVERAGE),
3977ec681f3Smrg      COUNTABLE(PERF_SP_VS_STAGE_TEX_INSTRUCTIONS, UINT64, AVERAGE),
3987ec681f3Smrg      COUNTABLE(PERF_SP_VS_STAGE_CFLOW_INSTRUCTIONS, UINT64, AVERAGE),
3997ec681f3Smrg      COUNTABLE(PERF_SP_VS_STAGE_EFU_INSTRUCTIONS, UINT64, AVERAGE),
4007ec681f3Smrg      COUNTABLE(PERF_SP_VS_STAGE_FULL_ALU_INSTRUCTIONS, UINT64, AVERAGE),
4017ec681f3Smrg      COUNTABLE(PERF_SP_VS_STAGE_HALF_ALU_INSTRUCTIONS, UINT64, AVERAGE),
4027ec681f3Smrg      COUNTABLE(PERF_SP_FS_STAGE_TEX_INSTRUCTIONS, UINT64, AVERAGE),
4037ec681f3Smrg      COUNTABLE(PERF_SP_FS_STAGE_CFLOW_INSTRUCTIONS, UINT64, AVERAGE),
4047ec681f3Smrg      COUNTABLE(PERF_SP_FS_STAGE_EFU_INSTRUCTIONS, UINT64, AVERAGE),
4057ec681f3Smrg      COUNTABLE(PERF_SP_FS_STAGE_FULL_ALU_INSTRUCTIONS, UINT64, AVERAGE),
4067ec681f3Smrg      COUNTABLE(PERF_SP_FS_STAGE_HALF_ALU_INSTRUCTIONS, UINT64, AVERAGE),
4077ec681f3Smrg      COUNTABLE(PERF_SP_FS_STAGE_BARY_INSTRUCTIONS, UINT64, AVERAGE),
4087ec681f3Smrg      COUNTABLE(PERF_SP_VS_INSTRUCTIONS, UINT64, AVERAGE),
4097ec681f3Smrg      COUNTABLE(PERF_SP_FS_INSTRUCTIONS, UINT64, AVERAGE),
4107ec681f3Smrg      COUNTABLE(PERF_SP_ADDR_LOCK_COUNT, UINT64, AVERAGE),
4117ec681f3Smrg      COUNTABLE(PERF_SP_UCHE_READ_TRANS, UINT64, AVERAGE),
4127ec681f3Smrg      COUNTABLE(PERF_SP_UCHE_WRITE_TRANS, UINT64, AVERAGE),
4137ec681f3Smrg      COUNTABLE(PERF_SP_EXPORT_VPC_TRANS, UINT64, AVERAGE),
4147ec681f3Smrg      COUNTABLE(PERF_SP_EXPORT_RB_TRANS, UINT64, AVERAGE),
4157ec681f3Smrg      COUNTABLE(PERF_SP_PIXELS_KILLED, UINT64, AVERAGE),
4167ec681f3Smrg      COUNTABLE(PERF_SP_ICL1_REQUESTS, UINT64, AVERAGE),
4177ec681f3Smrg      COUNTABLE(PERF_SP_ICL1_MISSES, UINT64, AVERAGE),
4187ec681f3Smrg      COUNTABLE(PERF_SP_ICL0_REQUESTS, UINT64, AVERAGE),
4197ec681f3Smrg      COUNTABLE(PERF_SP_ICL0_MISSES, UINT64, AVERAGE),
4207ec681f3Smrg      COUNTABLE(PERF_SP_HS_INSTRUCTIONS, UINT64, AVERAGE),
4217ec681f3Smrg      COUNTABLE(PERF_SP_DS_INSTRUCTIONS, UINT64, AVERAGE),
4227ec681f3Smrg      COUNTABLE(PERF_SP_GS_INSTRUCTIONS, UINT64, AVERAGE),
4237ec681f3Smrg      COUNTABLE(PERF_SP_CS_INSTRUCTIONS, UINT64, AVERAGE),
4247ec681f3Smrg      COUNTABLE(PERF_SP_GPR_READ, UINT64, AVERAGE),
4257ec681f3Smrg      COUNTABLE(PERF_SP_GPR_WRITE, UINT64, AVERAGE),
4267ec681f3Smrg      COUNTABLE(PERF_SP_LM_CH0_REQUESTS, UINT64, AVERAGE),
4277ec681f3Smrg      COUNTABLE(PERF_SP_LM_CH1_REQUESTS, UINT64, AVERAGE),
4287ec681f3Smrg      COUNTABLE(PERF_SP_LM_BANK_CONFLICTS, UINT64, AVERAGE),
4297ec681f3Smrg};
4307ec681f3Smrg
4317ec681f3Smrgstatic const struct fd_perfcntr_counter tp_counters[] = {
4327ec681f3Smrg      COUNTER(TPL1_PERFCTR_TP_SEL_0, RBBM_PERFCTR_TP_0_LO, RBBM_PERFCTR_TP_0_HI),
4337ec681f3Smrg      COUNTER(TPL1_PERFCTR_TP_SEL_1, RBBM_PERFCTR_TP_1_LO, RBBM_PERFCTR_TP_1_HI),
4347ec681f3Smrg      COUNTER(TPL1_PERFCTR_TP_SEL_2, RBBM_PERFCTR_TP_2_LO, RBBM_PERFCTR_TP_2_HI),
4357ec681f3Smrg      COUNTER(TPL1_PERFCTR_TP_SEL_3, RBBM_PERFCTR_TP_3_LO, RBBM_PERFCTR_TP_3_HI),
4367ec681f3Smrg      COUNTER(TPL1_PERFCTR_TP_SEL_4, RBBM_PERFCTR_TP_4_LO, RBBM_PERFCTR_TP_4_HI),
4377ec681f3Smrg      COUNTER(TPL1_PERFCTR_TP_SEL_5, RBBM_PERFCTR_TP_5_LO, RBBM_PERFCTR_TP_5_HI),
4387ec681f3Smrg      COUNTER(TPL1_PERFCTR_TP_SEL_6, RBBM_PERFCTR_TP_6_LO, RBBM_PERFCTR_TP_6_HI),
4397ec681f3Smrg      COUNTER(TPL1_PERFCTR_TP_SEL_7, RBBM_PERFCTR_TP_7_LO, RBBM_PERFCTR_TP_7_HI),
4407ec681f3Smrg};
4417ec681f3Smrg
4427ec681f3Smrgstatic const struct fd_perfcntr_countable tp_countables[] = {
4437ec681f3Smrg      COUNTABLE(PERF_TP_BUSY_CYCLES, UINT64, AVERAGE),
4447ec681f3Smrg      COUNTABLE(PERF_TP_STALL_CYCLES_UCHE, UINT64, AVERAGE),
4457ec681f3Smrg      COUNTABLE(PERF_TP_LATENCY_CYCLES, UINT64, AVERAGE),
4467ec681f3Smrg      COUNTABLE(PERF_TP_LATENCY_TRANS, UINT64, AVERAGE),
4477ec681f3Smrg      COUNTABLE(PERF_TP_FLAG_CACHE_REQUEST_SAMPLES, UINT64, AVERAGE),
4487ec681f3Smrg      COUNTABLE(PERF_TP_FLAG_CACHE_REQUEST_LATENCY, UINT64, AVERAGE),
4497ec681f3Smrg      COUNTABLE(PERF_TP_L1_CACHELINE_REQUESTS, UINT64, AVERAGE),
4507ec681f3Smrg      COUNTABLE(PERF_TP_L1_CACHELINE_MISSES, UINT64, AVERAGE),
4517ec681f3Smrg      COUNTABLE(PERF_TP_SP_TP_TRANS, UINT64, AVERAGE),
4527ec681f3Smrg      COUNTABLE(PERF_TP_TP_SP_TRANS, UINT64, AVERAGE),
4537ec681f3Smrg      COUNTABLE(PERF_TP_OUTPUT_PIXELS, UINT64, AVERAGE),
4547ec681f3Smrg      COUNTABLE(PERF_TP_FILTER_WORKLOAD_16BIT, UINT64, AVERAGE),
4557ec681f3Smrg      COUNTABLE(PERF_TP_FILTER_WORKLOAD_32BIT, UINT64, AVERAGE),
4567ec681f3Smrg      COUNTABLE(PERF_TP_QUADS_RECEIVED, UINT64, AVERAGE),
4577ec681f3Smrg      COUNTABLE(PERF_TP_QUADS_OFFSET, UINT64, AVERAGE),
4587ec681f3Smrg      COUNTABLE(PERF_TP_QUADS_SHADOW, UINT64, AVERAGE),
4597ec681f3Smrg      COUNTABLE(PERF_TP_QUADS_ARRAY, UINT64, AVERAGE),
4607ec681f3Smrg      COUNTABLE(PERF_TP_QUADS_GRADIENT, UINT64, AVERAGE),
4617ec681f3Smrg      COUNTABLE(PERF_TP_QUADS_1D, UINT64, AVERAGE),
4627ec681f3Smrg      COUNTABLE(PERF_TP_QUADS_2D, UINT64, AVERAGE),
4637ec681f3Smrg      COUNTABLE(PERF_TP_QUADS_BUFFER, UINT64, AVERAGE),
4647ec681f3Smrg      COUNTABLE(PERF_TP_QUADS_3D, UINT64, AVERAGE),
4657ec681f3Smrg      COUNTABLE(PERF_TP_QUADS_CUBE, UINT64, AVERAGE),
4667ec681f3Smrg      COUNTABLE(PERF_TP_STATE_CACHE_REQUESTS, UINT64, AVERAGE),
4677ec681f3Smrg      COUNTABLE(PERF_TP_STATE_CACHE_MISSES, UINT64, AVERAGE),
4687ec681f3Smrg      COUNTABLE(PERF_TP_DIVERGENT_QUADS_RECEIVED, UINT64, AVERAGE),
4697ec681f3Smrg      COUNTABLE(PERF_TP_BINDLESS_STATE_CACHE_REQUESTS, UINT64, AVERAGE),
4707ec681f3Smrg      COUNTABLE(PERF_TP_BINDLESS_STATE_CACHE_MISSES, UINT64, AVERAGE),
4717ec681f3Smrg      COUNTABLE(PERF_TP_PRT_NON_RESIDENT_EVENTS, UINT64, AVERAGE),
4727ec681f3Smrg      COUNTABLE(PERF_TP_OUTPUT_PIXELS_POINT, UINT64, AVERAGE),
4737ec681f3Smrg      COUNTABLE(PERF_TP_OUTPUT_PIXELS_BILINEAR, UINT64, AVERAGE),
4747ec681f3Smrg      COUNTABLE(PERF_TP_OUTPUT_PIXELS_MIP, UINT64, AVERAGE),
4757ec681f3Smrg      COUNTABLE(PERF_TP_OUTPUT_PIXELS_ANISO, UINT64, AVERAGE),
4767ec681f3Smrg      COUNTABLE(PERF_TP_OUTPUT_PIXELS_ZERO_LOD, UINT64, AVERAGE),
4777ec681f3Smrg      COUNTABLE(PERF_TP_FLAG_CACHE_REQUESTS, UINT64, AVERAGE),
4787ec681f3Smrg      COUNTABLE(PERF_TP_FLAG_CACHE_MISSES, UINT64, AVERAGE),
4797ec681f3Smrg      COUNTABLE(PERF_TP_L1_5_L2_REQUESTS, UINT64, AVERAGE),
4807ec681f3Smrg      COUNTABLE(PERF_TP_2D_OUTPUT_PIXELS, UINT64, AVERAGE),
4817ec681f3Smrg      COUNTABLE(PERF_TP_2D_OUTPUT_PIXELS_POINT, UINT64, AVERAGE),
4827ec681f3Smrg      COUNTABLE(PERF_TP_2D_OUTPUT_PIXELS_BILINEAR, UINT64, AVERAGE),
4837ec681f3Smrg      COUNTABLE(PERF_TP_2D_FILTER_WORKLOAD_16BIT, UINT64, AVERAGE),
4847ec681f3Smrg      COUNTABLE(PERF_TP_2D_FILTER_WORKLOAD_32BIT, UINT64, AVERAGE),
4857ec681f3Smrg};
4867ec681f3Smrg
4877ec681f3Smrgstatic const struct fd_perfcntr_counter uche_counters[] = {
4887ec681f3Smrg      COUNTER(UCHE_PERFCTR_UCHE_SEL_0, RBBM_PERFCTR_UCHE_0_LO, RBBM_PERFCTR_UCHE_0_HI),
4897ec681f3Smrg      COUNTER(UCHE_PERFCTR_UCHE_SEL_1, RBBM_PERFCTR_UCHE_1_LO, RBBM_PERFCTR_UCHE_1_HI),
4907ec681f3Smrg      COUNTER(UCHE_PERFCTR_UCHE_SEL_2, RBBM_PERFCTR_UCHE_2_LO, RBBM_PERFCTR_UCHE_2_HI),
4917ec681f3Smrg      COUNTER(UCHE_PERFCTR_UCHE_SEL_3, RBBM_PERFCTR_UCHE_3_LO, RBBM_PERFCTR_UCHE_3_HI),
4927ec681f3Smrg      COUNTER(UCHE_PERFCTR_UCHE_SEL_4, RBBM_PERFCTR_UCHE_4_LO, RBBM_PERFCTR_UCHE_4_HI),
4937ec681f3Smrg      COUNTER(UCHE_PERFCTR_UCHE_SEL_5, RBBM_PERFCTR_UCHE_5_LO, RBBM_PERFCTR_UCHE_5_HI),
4947ec681f3Smrg      COUNTER(UCHE_PERFCTR_UCHE_SEL_6, RBBM_PERFCTR_UCHE_6_LO, RBBM_PERFCTR_UCHE_6_HI),
4957ec681f3Smrg      COUNTER(UCHE_PERFCTR_UCHE_SEL_7, RBBM_PERFCTR_UCHE_7_LO, RBBM_PERFCTR_UCHE_7_HI),
4967ec681f3Smrg};
4977ec681f3Smrg
4987ec681f3Smrgstatic const struct fd_perfcntr_countable uche_countables[] = {
4997ec681f3Smrg      COUNTABLE(PERF_UCHE_BUSY_CYCLES, UINT64, AVERAGE),
5007ec681f3Smrg      COUNTABLE(PERF_UCHE_STALL_CYCLES_VBIF, UINT64, AVERAGE),
5017ec681f3Smrg      COUNTABLE(PERF_UCHE_VBIF_LATENCY_CYCLES, UINT64, AVERAGE),
5027ec681f3Smrg      COUNTABLE(PERF_UCHE_VBIF_LATENCY_SAMPLES, UINT64, AVERAGE),
5037ec681f3Smrg      COUNTABLE(PERF_UCHE_VBIF_READ_BEATS_TP, UINT64, AVERAGE),
5047ec681f3Smrg      COUNTABLE(PERF_UCHE_VBIF_READ_BEATS_VFD, UINT64, AVERAGE),
5057ec681f3Smrg      COUNTABLE(PERF_UCHE_VBIF_READ_BEATS_HLSQ, UINT64, AVERAGE),
5067ec681f3Smrg      COUNTABLE(PERF_UCHE_VBIF_READ_BEATS_LRZ, UINT64, AVERAGE),
5077ec681f3Smrg      COUNTABLE(PERF_UCHE_VBIF_READ_BEATS_SP, UINT64, AVERAGE),
5087ec681f3Smrg      COUNTABLE(PERF_UCHE_READ_REQUESTS_TP, UINT64, AVERAGE),
5097ec681f3Smrg      COUNTABLE(PERF_UCHE_READ_REQUESTS_VFD, UINT64, AVERAGE),
5107ec681f3Smrg      COUNTABLE(PERF_UCHE_READ_REQUESTS_HLSQ, UINT64, AVERAGE),
5117ec681f3Smrg      COUNTABLE(PERF_UCHE_READ_REQUESTS_LRZ, UINT64, AVERAGE),
5127ec681f3Smrg      COUNTABLE(PERF_UCHE_READ_REQUESTS_SP, UINT64, AVERAGE),
5137ec681f3Smrg      COUNTABLE(PERF_UCHE_WRITE_REQUESTS_LRZ, UINT64, AVERAGE),
5147ec681f3Smrg      COUNTABLE(PERF_UCHE_WRITE_REQUESTS_SP, UINT64, AVERAGE),
5157ec681f3Smrg      COUNTABLE(PERF_UCHE_WRITE_REQUESTS_VPC, UINT64, AVERAGE),
5167ec681f3Smrg      COUNTABLE(PERF_UCHE_WRITE_REQUESTS_VSC, UINT64, AVERAGE),
5177ec681f3Smrg      COUNTABLE(PERF_UCHE_EVICTS, UINT64, AVERAGE),
5187ec681f3Smrg      COUNTABLE(PERF_UCHE_BANK_REQ0, UINT64, AVERAGE),
5197ec681f3Smrg      COUNTABLE(PERF_UCHE_BANK_REQ1, UINT64, AVERAGE),
5207ec681f3Smrg      COUNTABLE(PERF_UCHE_BANK_REQ2, UINT64, AVERAGE),
5217ec681f3Smrg      COUNTABLE(PERF_UCHE_BANK_REQ3, UINT64, AVERAGE),
5227ec681f3Smrg      COUNTABLE(PERF_UCHE_BANK_REQ4, UINT64, AVERAGE),
5237ec681f3Smrg      COUNTABLE(PERF_UCHE_BANK_REQ5, UINT64, AVERAGE),
5247ec681f3Smrg      COUNTABLE(PERF_UCHE_BANK_REQ6, UINT64, AVERAGE),
5257ec681f3Smrg      COUNTABLE(PERF_UCHE_BANK_REQ7, UINT64, AVERAGE),
5267ec681f3Smrg      COUNTABLE(PERF_UCHE_VBIF_READ_BEATS_CH0, UINT64, AVERAGE),
5277ec681f3Smrg      COUNTABLE(PERF_UCHE_VBIF_READ_BEATS_CH1, UINT64, AVERAGE),
5287ec681f3Smrg      COUNTABLE(PERF_UCHE_GMEM_READ_BEATS, UINT64, AVERAGE),
5297ec681f3Smrg      COUNTABLE(PERF_UCHE_FLAG_COUNT, UINT64, AVERAGE),
5307ec681f3Smrg};
5317ec681f3Smrg
5327ec681f3Smrgstatic const struct fd_perfcntr_counter vfd_counters[] = {
5337ec681f3Smrg      COUNTER(VFD_PERFCTR_VFD_SEL_0, RBBM_PERFCTR_VFD_0_LO, RBBM_PERFCTR_VFD_0_HI),
5347ec681f3Smrg      COUNTER(VFD_PERFCTR_VFD_SEL_1, RBBM_PERFCTR_VFD_1_LO, RBBM_PERFCTR_VFD_1_HI),
5357ec681f3Smrg      COUNTER(VFD_PERFCTR_VFD_SEL_2, RBBM_PERFCTR_VFD_2_LO, RBBM_PERFCTR_VFD_2_HI),
5367ec681f3Smrg      COUNTER(VFD_PERFCTR_VFD_SEL_3, RBBM_PERFCTR_VFD_3_LO, RBBM_PERFCTR_VFD_3_HI),
5377ec681f3Smrg      COUNTER(VFD_PERFCTR_VFD_SEL_4, RBBM_PERFCTR_VFD_4_LO, RBBM_PERFCTR_VFD_4_HI),
5387ec681f3Smrg      COUNTER(VFD_PERFCTR_VFD_SEL_5, RBBM_PERFCTR_VFD_5_LO, RBBM_PERFCTR_VFD_5_HI),
5397ec681f3Smrg      COUNTER(VFD_PERFCTR_VFD_SEL_6, RBBM_PERFCTR_VFD_6_LO, RBBM_PERFCTR_VFD_6_HI),
5407ec681f3Smrg      COUNTER(VFD_PERFCTR_VFD_SEL_7, RBBM_PERFCTR_VFD_7_LO, RBBM_PERFCTR_VFD_7_HI),
5417ec681f3Smrg};
5427ec681f3Smrg
5437ec681f3Smrgstatic const struct fd_perfcntr_countable vfd_countables[] = {
5447ec681f3Smrg      COUNTABLE(PERF_VFD_BUSY_CYCLES, UINT64, AVERAGE),
5457ec681f3Smrg      COUNTABLE(PERF_VFD_STALL_CYCLES_UCHE, UINT64, AVERAGE),
5467ec681f3Smrg      COUNTABLE(PERF_VFD_STALL_CYCLES_VPC_ALLOC, UINT64, AVERAGE),
5477ec681f3Smrg      COUNTABLE(PERF_VFD_STALL_CYCLES_MISS_VB, UINT64, AVERAGE),
5487ec681f3Smrg      COUNTABLE(PERF_VFD_STALL_CYCLES_MISS_Q, UINT64, AVERAGE),
5497ec681f3Smrg      COUNTABLE(PERF_VFD_STALL_CYCLES_SP_INFO, UINT64, AVERAGE),
5507ec681f3Smrg      COUNTABLE(PERF_VFD_STALL_CYCLES_SP_ATTR, UINT64, AVERAGE),
5517ec681f3Smrg      COUNTABLE(PERF_VFD_STALL_CYCLES_VFDP_VB, UINT64, AVERAGE),
5527ec681f3Smrg      COUNTABLE(PERF_VFD_STALL_CYCLES_VFDP_Q, UINT64, AVERAGE),
5537ec681f3Smrg      COUNTABLE(PERF_VFD_DECODER_PACKER_STALL, UINT64, AVERAGE),
5547ec681f3Smrg      COUNTABLE(PERF_VFD_STARVE_CYCLES_UCHE, UINT64, AVERAGE),
5557ec681f3Smrg      COUNTABLE(PERF_VFD_RBUFFER_FULL, UINT64, AVERAGE),
5567ec681f3Smrg      COUNTABLE(PERF_VFD_ATTR_INFO_FIFO_FULL, UINT64, AVERAGE),
5577ec681f3Smrg      COUNTABLE(PERF_VFD_DECODED_ATTRIBUTE_BYTES, UINT64, AVERAGE),
5587ec681f3Smrg      COUNTABLE(PERF_VFD_NUM_ATTRIBUTES, UINT64, AVERAGE),
5597ec681f3Smrg      COUNTABLE(PERF_VFD_INSTRUCTIONS, UINT64, AVERAGE),
5607ec681f3Smrg      COUNTABLE(PERF_VFD_UPPER_SHADER_FIBERS, UINT64, AVERAGE),
5617ec681f3Smrg      COUNTABLE(PERF_VFD_LOWER_SHADER_FIBERS, UINT64, AVERAGE),
5627ec681f3Smrg      COUNTABLE(PERF_VFD_MODE_0_FIBERS, UINT64, AVERAGE),
5637ec681f3Smrg      COUNTABLE(PERF_VFD_MODE_1_FIBERS, UINT64, AVERAGE),
5647ec681f3Smrg      COUNTABLE(PERF_VFD_MODE_2_FIBERS, UINT64, AVERAGE),
5657ec681f3Smrg      COUNTABLE(PERF_VFD_MODE_3_FIBERS, UINT64, AVERAGE),
5667ec681f3Smrg      COUNTABLE(PERF_VFD_MODE_4_FIBERS, UINT64, AVERAGE),
5677ec681f3Smrg      COUNTABLE(PERF_VFD_TOTAL_VERTICES, UINT64, AVERAGE),
5687ec681f3Smrg      COUNTABLE(PERF_VFD_NUM_ATTR_MISS, UINT64, AVERAGE),
5697ec681f3Smrg      COUNTABLE(PERF_VFD_1_BURST_REQ, UINT64, AVERAGE),
5707ec681f3Smrg      COUNTABLE(PERF_VFDP_STALL_CYCLES_VFD, UINT64, AVERAGE),
5717ec681f3Smrg      COUNTABLE(PERF_VFDP_STALL_CYCLES_VFD_INDEX, UINT64, AVERAGE),
5727ec681f3Smrg      COUNTABLE(PERF_VFDP_STALL_CYCLES_VFD_PROG, UINT64, AVERAGE),
5737ec681f3Smrg      COUNTABLE(PERF_VFDP_STARVE_CYCLES_PC, UINT64, AVERAGE),
5747ec681f3Smrg      COUNTABLE(PERF_VFDP_VS_STAGE_32_WAVES, UINT64, AVERAGE),
5757ec681f3Smrg};
5767ec681f3Smrg
5777ec681f3Smrgstatic const struct fd_perfcntr_counter vpc_counters[] = {
5787ec681f3Smrg      COUNTER(VPC_PERFCTR_VPC_SEL_0, RBBM_PERFCTR_VPC_0_LO, RBBM_PERFCTR_VPC_0_HI),
5797ec681f3Smrg      COUNTER(VPC_PERFCTR_VPC_SEL_1, RBBM_PERFCTR_VPC_1_LO, RBBM_PERFCTR_VPC_1_HI),
5807ec681f3Smrg      COUNTER(VPC_PERFCTR_VPC_SEL_2, RBBM_PERFCTR_VPC_2_LO, RBBM_PERFCTR_VPC_2_HI),
5817ec681f3Smrg      COUNTER(VPC_PERFCTR_VPC_SEL_3, RBBM_PERFCTR_VPC_3_LO, RBBM_PERFCTR_VPC_3_HI),
5827ec681f3Smrg};
5837ec681f3Smrg
5847ec681f3Smrgstatic const struct fd_perfcntr_countable vpc_countables[] = {
5857ec681f3Smrg      COUNTABLE(PERF_VPC_BUSY_CYCLES, UINT64, AVERAGE),
5867ec681f3Smrg      COUNTABLE(PERF_VPC_WORKING_CYCLES, UINT64, AVERAGE),
5877ec681f3Smrg      COUNTABLE(PERF_VPC_STALL_CYCLES_UCHE, UINT64, AVERAGE),
5887ec681f3Smrg      COUNTABLE(PERF_VPC_STALL_CYCLES_VFD_WACK, UINT64, AVERAGE),
5897ec681f3Smrg      COUNTABLE(PERF_VPC_STALL_CYCLES_HLSQ_PRIM_ALLOC, UINT64, AVERAGE),
5907ec681f3Smrg      COUNTABLE(PERF_VPC_STALL_CYCLES_PC, UINT64, AVERAGE),
5917ec681f3Smrg      COUNTABLE(PERF_VPC_STALL_CYCLES_SP_LM, UINT64, AVERAGE),
5927ec681f3Smrg      COUNTABLE(PERF_VPC_POS_EXPORT_STALL_CYCLES, UINT64, AVERAGE),
5937ec681f3Smrg      COUNTABLE(PERF_VPC_STARVE_CYCLES_SP, UINT64, AVERAGE),
5947ec681f3Smrg      COUNTABLE(PERF_VPC_STARVE_CYCLES_LRZ, UINT64, AVERAGE),
5957ec681f3Smrg      COUNTABLE(PERF_VPC_PC_PRIMITIVES, UINT64, AVERAGE),
5967ec681f3Smrg      COUNTABLE(PERF_VPC_SP_COMPONENTS, UINT64, AVERAGE),
5977ec681f3Smrg      COUNTABLE(PERF_VPC_SP_LM_PRIMITIVES, UINT64, AVERAGE),
5987ec681f3Smrg      COUNTABLE(PERF_VPC_SP_LM_COMPONENTS, UINT64, AVERAGE),
5997ec681f3Smrg      COUNTABLE(PERF_VPC_SP_LM_DWORDS, UINT64, AVERAGE),
6007ec681f3Smrg      COUNTABLE(PERF_VPC_STREAMOUT_COMPONENTS, UINT64, AVERAGE),
6017ec681f3Smrg      COUNTABLE(PERF_VPC_GRANT_PHASES, UINT64, AVERAGE),
6027ec681f3Smrg};
6037ec681f3Smrg
6047ec681f3Smrgstatic const struct fd_perfcntr_counter vsc_counters[] = {
6057ec681f3Smrg      COUNTER(VSC_PERFCTR_VSC_SEL_0, RBBM_PERFCTR_VSC_0_LO, RBBM_PERFCTR_VSC_0_HI),
6067ec681f3Smrg      COUNTER(VSC_PERFCTR_VSC_SEL_1, RBBM_PERFCTR_VSC_1_LO, RBBM_PERFCTR_VSC_1_HI),
6077ec681f3Smrg};
6087ec681f3Smrg
6097ec681f3Smrgstatic const struct fd_perfcntr_countable vsc_countables[] = {
6107ec681f3Smrg      COUNTABLE(PERF_VSC_BUSY_CYCLES, UINT64, AVERAGE),
6117ec681f3Smrg      COUNTABLE(PERF_VSC_WORKING_CYCLES, UINT64, AVERAGE),
6127ec681f3Smrg      COUNTABLE(PERF_VSC_STALL_CYCLES_UCHE, UINT64, AVERAGE),
6137ec681f3Smrg      COUNTABLE(PERF_VSC_EOT_NUM, UINT64, AVERAGE),
6147ec681f3Smrg};
6157ec681f3Smrg
6167ec681f3Smrg/* VBIF counters probably not too userful for userspace, and they make
6177ec681f3Smrg * frameretrace take many more passes to collect all the metrics, so
6187ec681f3Smrg * for now let's hide them.
6197ec681f3Smrg */
6207ec681f3Smrg#if 0
6217ec681f3Smrg/* VBIF counters break the pattern a bit, with enable and clear regs: */
6227ec681f3Smrgstatic const struct fd_perfcntr_counter vbif_counters[] = {
6237ec681f3Smrg      COUNTER2(VBIF_PERF_CNT_SEL0, VBIF_PERF_CNT_LOW0, VBIF_PERF_CNT_HIGH0, VBIF_PERF_CNT_EN0, VBIF_PERF_CNT_CLR0),
6247ec681f3Smrg      COUNTER2(VBIF_PERF_CNT_SEL1, VBIF_PERF_CNT_LOW1, VBIF_PERF_CNT_HIGH1, VBIF_PERF_CNT_EN1, VBIF_PERF_CNT_CLR1),
6257ec681f3Smrg      COUNTER2(VBIF_PERF_CNT_SEL2, VBIF_PERF_CNT_LOW2, VBIF_PERF_CNT_HIGH2, VBIF_PERF_CNT_EN2, VBIF_PERF_CNT_CLR2),
6267ec681f3Smrg      COUNTER2(VBIF_PERF_CNT_SEL3, VBIF_PERF_CNT_LOW3, VBIF_PERF_CNT_HIGH3, VBIF_PERF_CNT_EN3, VBIF_PERF_CNT_CLR3),
6277ec681f3Smrg};
6287ec681f3Smrg
6297ec681f3Smrgstatic const struct fd_perfcntr_countable vbif_countables[] = {
6307ec681f3Smrg      COUNTABLE(AXI_READ_REQUESTS_ID_0, UINT64, AVERAGE),
6317ec681f3Smrg      COUNTABLE(AXI_READ_REQUESTS_ID_1, UINT64, AVERAGE),
6327ec681f3Smrg      COUNTABLE(AXI_READ_REQUESTS_ID_2, UINT64, AVERAGE),
6337ec681f3Smrg      COUNTABLE(AXI_READ_REQUESTS_ID_3, UINT64, AVERAGE),
6347ec681f3Smrg      COUNTABLE(AXI_READ_REQUESTS_ID_4, UINT64, AVERAGE),
6357ec681f3Smrg      COUNTABLE(AXI_READ_REQUESTS_ID_5, UINT64, AVERAGE),
6367ec681f3Smrg      COUNTABLE(AXI_READ_REQUESTS_ID_6, UINT64, AVERAGE),
6377ec681f3Smrg      COUNTABLE(AXI_READ_REQUESTS_ID_7, UINT64, AVERAGE),
6387ec681f3Smrg      COUNTABLE(AXI_READ_REQUESTS_ID_8, UINT64, AVERAGE),
6397ec681f3Smrg      COUNTABLE(AXI_READ_REQUESTS_ID_9, UINT64, AVERAGE),
6407ec681f3Smrg      COUNTABLE(AXI_READ_REQUESTS_ID_10, UINT64, AVERAGE),
6417ec681f3Smrg      COUNTABLE(AXI_READ_REQUESTS_ID_11, UINT64, AVERAGE),
6427ec681f3Smrg      COUNTABLE(AXI_READ_REQUESTS_ID_12, UINT64, AVERAGE),
6437ec681f3Smrg      COUNTABLE(AXI_READ_REQUESTS_ID_13, UINT64, AVERAGE),
6447ec681f3Smrg      COUNTABLE(AXI_READ_REQUESTS_ID_14, UINT64, AVERAGE),
6457ec681f3Smrg      COUNTABLE(AXI_READ_REQUESTS_ID_15, UINT64, AVERAGE),
6467ec681f3Smrg      COUNTABLE(AXI0_READ_REQUESTS_TOTAL, UINT64, AVERAGE),
6477ec681f3Smrg      COUNTABLE(AXI1_READ_REQUESTS_TOTAL, UINT64, AVERAGE),
6487ec681f3Smrg      COUNTABLE(AXI2_READ_REQUESTS_TOTAL, UINT64, AVERAGE),
6497ec681f3Smrg      COUNTABLE(AXI3_READ_REQUESTS_TOTAL, UINT64, AVERAGE),
6507ec681f3Smrg      COUNTABLE(AXI_READ_REQUESTS_TOTAL, UINT64, AVERAGE),
6517ec681f3Smrg      COUNTABLE(AXI_WRITE_REQUESTS_ID_0, UINT64, AVERAGE),
6527ec681f3Smrg      COUNTABLE(AXI_WRITE_REQUESTS_ID_1, UINT64, AVERAGE),
6537ec681f3Smrg      COUNTABLE(AXI_WRITE_REQUESTS_ID_2, UINT64, AVERAGE),
6547ec681f3Smrg      COUNTABLE(AXI_WRITE_REQUESTS_ID_3, UINT64, AVERAGE),
6557ec681f3Smrg      COUNTABLE(AXI_WRITE_REQUESTS_ID_4, UINT64, AVERAGE),
6567ec681f3Smrg      COUNTABLE(AXI_WRITE_REQUESTS_ID_5, UINT64, AVERAGE),
6577ec681f3Smrg      COUNTABLE(AXI_WRITE_REQUESTS_ID_6, UINT64, AVERAGE),
6587ec681f3Smrg      COUNTABLE(AXI_WRITE_REQUESTS_ID_7, UINT64, AVERAGE),
6597ec681f3Smrg      COUNTABLE(AXI_WRITE_REQUESTS_ID_8, UINT64, AVERAGE),
6607ec681f3Smrg      COUNTABLE(AXI_WRITE_REQUESTS_ID_9, UINT64, AVERAGE),
6617ec681f3Smrg      COUNTABLE(AXI_WRITE_REQUESTS_ID_10, UINT64, AVERAGE),
6627ec681f3Smrg      COUNTABLE(AXI_WRITE_REQUESTS_ID_11, UINT64, AVERAGE),
6637ec681f3Smrg      COUNTABLE(AXI_WRITE_REQUESTS_ID_12, UINT64, AVERAGE),
6647ec681f3Smrg      COUNTABLE(AXI_WRITE_REQUESTS_ID_13, UINT64, AVERAGE),
6657ec681f3Smrg      COUNTABLE(AXI_WRITE_REQUESTS_ID_14, UINT64, AVERAGE),
6667ec681f3Smrg      COUNTABLE(AXI_WRITE_REQUESTS_ID_15, UINT64, AVERAGE),
6677ec681f3Smrg      COUNTABLE(AXI0_WRITE_REQUESTS_TOTAL, UINT64, AVERAGE),
6687ec681f3Smrg      COUNTABLE(AXI1_WRITE_REQUESTS_TOTAL, UINT64, AVERAGE),
6697ec681f3Smrg      COUNTABLE(AXI2_WRITE_REQUESTS_TOTAL, UINT64, AVERAGE),
6707ec681f3Smrg      COUNTABLE(AXI3_WRITE_REQUESTS_TOTAL, UINT64, AVERAGE),
6717ec681f3Smrg      COUNTABLE(AXI_WRITE_REQUESTS_TOTAL, UINT64, AVERAGE),
6727ec681f3Smrg      COUNTABLE(AXI_TOTAL_REQUESTS, UINT64, AVERAGE),
6737ec681f3Smrg      COUNTABLE(AXI_READ_DATA_BEATS_ID_0, UINT64, AVERAGE),
6747ec681f3Smrg      COUNTABLE(AXI_READ_DATA_BEATS_ID_1, UINT64, AVERAGE),
6757ec681f3Smrg      COUNTABLE(AXI_READ_DATA_BEATS_ID_2, UINT64, AVERAGE),
6767ec681f3Smrg      COUNTABLE(AXI_READ_DATA_BEATS_ID_3, UINT64, AVERAGE),
6777ec681f3Smrg      COUNTABLE(AXI_READ_DATA_BEATS_ID_4, UINT64, AVERAGE),
6787ec681f3Smrg      COUNTABLE(AXI_READ_DATA_BEATS_ID_5, UINT64, AVERAGE),
6797ec681f3Smrg      COUNTABLE(AXI_READ_DATA_BEATS_ID_6, UINT64, AVERAGE),
6807ec681f3Smrg      COUNTABLE(AXI_READ_DATA_BEATS_ID_7, UINT64, AVERAGE),
6817ec681f3Smrg      COUNTABLE(AXI_READ_DATA_BEATS_ID_8, UINT64, AVERAGE),
6827ec681f3Smrg      COUNTABLE(AXI_READ_DATA_BEATS_ID_9, UINT64, AVERAGE),
6837ec681f3Smrg      COUNTABLE(AXI_READ_DATA_BEATS_ID_10, UINT64, AVERAGE),
6847ec681f3Smrg      COUNTABLE(AXI_READ_DATA_BEATS_ID_11, UINT64, AVERAGE),
6857ec681f3Smrg      COUNTABLE(AXI_READ_DATA_BEATS_ID_12, UINT64, AVERAGE),
6867ec681f3Smrg      COUNTABLE(AXI_READ_DATA_BEATS_ID_13, UINT64, AVERAGE),
6877ec681f3Smrg      COUNTABLE(AXI_READ_DATA_BEATS_ID_14, UINT64, AVERAGE),
6887ec681f3Smrg      COUNTABLE(AXI_READ_DATA_BEATS_ID_15, UINT64, AVERAGE),
6897ec681f3Smrg      COUNTABLE(AXI0_READ_DATA_BEATS_TOTAL, UINT64, AVERAGE),
6907ec681f3Smrg      COUNTABLE(AXI1_READ_DATA_BEATS_TOTAL, UINT64, AVERAGE),
6917ec681f3Smrg      COUNTABLE(AXI2_READ_DATA_BEATS_TOTAL, UINT64, AVERAGE),
6927ec681f3Smrg      COUNTABLE(AXI3_READ_DATA_BEATS_TOTAL, UINT64, AVERAGE),
6937ec681f3Smrg      COUNTABLE(AXI_READ_DATA_BEATS_TOTAL, UINT64, AVERAGE),
6947ec681f3Smrg      COUNTABLE(AXI_WRITE_DATA_BEATS_ID_0, UINT64, AVERAGE),
6957ec681f3Smrg      COUNTABLE(AXI_WRITE_DATA_BEATS_ID_1, UINT64, AVERAGE),
6967ec681f3Smrg      COUNTABLE(AXI_WRITE_DATA_BEATS_ID_2, UINT64, AVERAGE),
6977ec681f3Smrg      COUNTABLE(AXI_WRITE_DATA_BEATS_ID_3, UINT64, AVERAGE),
6987ec681f3Smrg      COUNTABLE(AXI_WRITE_DATA_BEATS_ID_4, UINT64, AVERAGE),
6997ec681f3Smrg      COUNTABLE(AXI_WRITE_DATA_BEATS_ID_5, UINT64, AVERAGE),
7007ec681f3Smrg      COUNTABLE(AXI_WRITE_DATA_BEATS_ID_6, UINT64, AVERAGE),
7017ec681f3Smrg      COUNTABLE(AXI_WRITE_DATA_BEATS_ID_7, UINT64, AVERAGE),
7027ec681f3Smrg      COUNTABLE(AXI_WRITE_DATA_BEATS_ID_8, UINT64, AVERAGE),
7037ec681f3Smrg      COUNTABLE(AXI_WRITE_DATA_BEATS_ID_9, UINT64, AVERAGE),
7047ec681f3Smrg      COUNTABLE(AXI_WRITE_DATA_BEATS_ID_10, UINT64, AVERAGE),
7057ec681f3Smrg      COUNTABLE(AXI_WRITE_DATA_BEATS_ID_11, UINT64, AVERAGE),
7067ec681f3Smrg      COUNTABLE(AXI_WRITE_DATA_BEATS_ID_12, UINT64, AVERAGE),
7077ec681f3Smrg      COUNTABLE(AXI_WRITE_DATA_BEATS_ID_13, UINT64, AVERAGE),
7087ec681f3Smrg      COUNTABLE(AXI_WRITE_DATA_BEATS_ID_14, UINT64, AVERAGE),
7097ec681f3Smrg      COUNTABLE(AXI_WRITE_DATA_BEATS_ID_15, UINT64, AVERAGE),
7107ec681f3Smrg      COUNTABLE(AXI0_WRITE_DATA_BEATS_TOTAL, UINT64, AVERAGE),
7117ec681f3Smrg      COUNTABLE(AXI1_WRITE_DATA_BEATS_TOTAL, UINT64, AVERAGE),
7127ec681f3Smrg      COUNTABLE(AXI2_WRITE_DATA_BEATS_TOTAL, UINT64, AVERAGE),
7137ec681f3Smrg      COUNTABLE(AXI3_WRITE_DATA_BEATS_TOTAL, UINT64, AVERAGE),
7147ec681f3Smrg      COUNTABLE(AXI_WRITE_DATA_BEATS_TOTAL, UINT64, AVERAGE),
7157ec681f3Smrg      COUNTABLE(AXI_DATA_BEATS_TOTAL, UINT64, AVERAGE),
7167ec681f3Smrg};
7177ec681f3Smrg#endif
7187ec681f3Smrg
7197ec681f3Smrgconst struct fd_perfcntr_group a5xx_perfcntr_groups[] = {
7207ec681f3Smrg      GROUP("CP", cp_counters, cp_countables),
7217ec681f3Smrg      GROUP("CCU", ccu_counters, ccu_countables),
7227ec681f3Smrg      GROUP("TSE", tse_counters, tse_countables),
7237ec681f3Smrg      GROUP("RAS", ras_counters, ras_countables),
7247ec681f3Smrg      GROUP("LRZ", lrz_counters, lrz_countables),
7257ec681f3Smrg      GROUP("HLSQ", hlsq_counters, hlsq_countables),
7267ec681f3Smrg      GROUP("PC", pc_counters, pc_countables),
7277ec681f3Smrg      GROUP("RB", rb_counters, rb_countables),
7287ec681f3Smrg      GROUP("RBBM", rbbm_counters, rbbm_countables),
7297ec681f3Smrg      GROUP("SP", sp_counters, sp_countables),
7307ec681f3Smrg      GROUP("TP", tp_counters, tp_countables),
7317ec681f3Smrg      GROUP("UCHE", uche_counters, uche_countables),
7327ec681f3Smrg      GROUP("VFD", vfd_counters, vfd_countables),
7337ec681f3Smrg      GROUP("VPC", vpc_counters, vpc_countables),
7347ec681f3Smrg      GROUP("VSC", vsc_counters, vsc_countables),
7357ec681f3Smrg      //	GROUP("VBIF", vbif_counters, vbif_countables),
7367ec681f3Smrg};
7377ec681f3Smrg
7387ec681f3Smrgconst unsigned a5xx_num_perfcntr_groups = ARRAY_SIZE(a5xx_perfcntr_groups);
7397ec681f3Smrg
7407ec681f3Smrg#endif /* FD5_PERFCNTR_H_ */
741