From dd7671fedd1d47781f7fd2b3d2c01548348517f4 Mon Sep 17 00:00:00 2001 From: Christoph Pillmayer Date: Thu, 9 Apr 2026 11:42:00 +0200 Subject: [PATCH] pan/perf: Use proper counter category type in config pan_perf_gen.py already writes the enum value instead of an index. Use the enum type instead of a plain int in pan_perf_counter. --- src/panfrost/perf/pan_gen_perf.py | 2 +- src/panfrost/perf/pan_perf.c | 5 ++--- src/panfrost/perf/pan_perf.h | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/panfrost/perf/pan_gen_perf.py b/src/panfrost/perf/pan_gen_perf.py index 43f058aa862..fad0a1c390c 100644 --- a/src/panfrost/perf/pan_gen_perf.py +++ b/src/panfrost/perf/pan_gen_perf.py @@ -173,7 +173,7 @@ def main(): c.write(".symbol_name = \"%s\"," % (counter.underscore_name)) c.write(".units = PAN_PERF_COUNTER_UNITS_%s," % (counter.units.upper())) c.write(".offset = %u," % (counter.offset)) - c.write(".category_index = %s," % CATEGORY_IDX_REMAP[category.name]) + c.write(".category = %s," % CATEGORY_IDX_REMAP[category.name]) c.outdent(tab_size) c.write("}, // counter") diff --git a/src/panfrost/perf/pan_perf.c b/src/panfrost/perf/pan_perf.c index f1905aab02d..2a6c004443b 100644 --- a/src/panfrost/perf/pan_perf.c +++ b/src/panfrost/perf/pan_perf.c @@ -28,8 +28,7 @@ pan_perf_counter_read(const struct pan_perf *perf, assert(perf->session->data != NULL); - const uint32_t category = counter->category_index; - const uint32_t offset = perf->mem_layout.category[category].offset + + const uint32_t offset = perf->mem_layout.category[counter->category].offset + perf->mem_layout.block_stride * block + perf->mem_layout.counter_stride * counter->offset; @@ -44,7 +43,7 @@ pan_perf_counter_read_block_sum(const struct pan_perf_counter *counter, int64_t ret = pan_perf_counter_read(perf, counter, 0); /* If counter belongs to shader core, sum values for all cores. */ - if (counter->category_index == PAN_PERF_COUNTER_CAT_SHADER) { + if (counter->category == PAN_PERF_COUNTER_CAT_SHADER) { uint32_t n_cores = perf->mem_layout.category[PAN_PERF_COUNTER_CAT_SHADER].n_blocks; for (uint32_t core = 1; core < n_cores; ++core) { diff --git a/src/panfrost/perf/pan_perf.h b/src/panfrost/perf/pan_perf.h index 5be5dfd1265..89d665ec407 100644 --- a/src/panfrost/perf/pan_perf.h +++ b/src/panfrost/perf/pan_perf.h @@ -51,7 +51,7 @@ struct pan_perf_counter { enum pan_perf_counter_units units; // Offset of this counter's value within the category uint32_t offset; - unsigned category_index; + enum pan_perf_counter_categories category; }; struct pan_perf_category {