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.
This commit is contained in:
Christoph Pillmayer 2026-04-09 11:42:00 +02:00
parent 3a1dadf038
commit dd7671fedd
3 changed files with 4 additions and 5 deletions

View file

@ -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")

View file

@ -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) {

View file

@ -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 {