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 {