From 2093153ba46848929c2721bd5be51316f6922e95 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Mon, 13 Apr 2026 10:24:03 -0700 Subject: [PATCH] freedreno/registers: Add pipe to perfcntr group With concurrent binning, some counter reads or SEL reg programming needs to happen explicitly on the BR or BV ring. For the most part if there is a "BV_FOO" counter group that should be on the BV ring and the corresponding "FOO" group on the BR ring. There are a few exceptions like "CP" vs "BV_CP" which have different SEL reg offsets for BR vs BV, rather than the same offsets that should be accessed via the appropriate aperture. Signed-off-by: Rob Clark Part-of: --- src/freedreno/perfcntrs/freedreno_perfcntr.h | 7 +++++-- src/freedreno/registers/gen_header.py | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/freedreno/perfcntrs/freedreno_perfcntr.h b/src/freedreno/perfcntrs/freedreno_perfcntr.h index a8bae4e2101..3a1cb42b43a 100644 --- a/src/freedreno/perfcntrs/freedreno_perfcntr.h +++ b/src/freedreno/perfcntrs/freedreno_perfcntr.h @@ -70,6 +70,7 @@ struct fd_perfcntr_countable { /* Describes an entire counter group: */ struct fd_perfcntr_group { const char *name; + int pipe; unsigned num_counters; const struct fd_perfcntr_counter *counters; unsigned num_countables; @@ -78,8 +79,10 @@ struct fd_perfcntr_group { const struct fd_perfcntr_group *fd_perfcntrs(const struct fd_dev_id *id, unsigned *count); -#define GROUP(_name, _counters, _countables) { \ - .name = _name, .num_counters = ARRAY_SIZE(_counters), \ +#define GROUP(_name, _pipe, _counters, _countables) { \ + .name = _name, \ + .pipe = _pipe, \ + .num_counters = ARRAY_SIZE(_counters), \ .counters = _counters, .num_countables = ARRAY_SIZE(_countables), \ .countables = _countables, \ } diff --git a/src/freedreno/registers/gen_header.py b/src/freedreno/registers/gen_header.py index 6328dafd360..c902cd54c86 100644 --- a/src/freedreno/registers/gen_header.py +++ b/src/freedreno/registers/gen_header.py @@ -1149,8 +1149,11 @@ def dump_perfcntrs(args): for group in groups: name = group['name'] name_low = name.lower() + pipe = 'NONE' + if 'pipe' in group: + pipe = group['pipe'] - print(" GROUP(\"%s\", %s_counters, %s_countables)," % (name, name_low, name_low)) + print(" GROUP(\"%s\", PIPE_%s, %s_counters, %s_countables)," % (name, pipe, name_low, name_low)) print("};") print("const unsigned " + chip.lower() + "_num_perfcntr_groups = ARRAY_SIZE(" + chip.lower() + "_perfcntr_groups);")