From 3fb6aaf42efe0b61070f39667a2021ee4b3041f7 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Tue, 19 Nov 2019 10:22:44 -0800 Subject: [PATCH] freedreno/perfcntrs: small cleanup When we had one gen supporting performance counters, it made sense to have these builder macros in the .c file with the table. But time has come to de-duplicate. Signed-off-by: Rob Clark Reviewed-by: Kristian H. Kristensen --- .../drivers/freedreno/a2xx/fd2_perfcntr.c | 23 +------------- .../drivers/freedreno/a5xx/fd5_perfcntr.c | 31 +------------------ .../drivers/freedreno/a6xx/fd6_perfcntr.c | 31 +------------------ .../drivers/freedreno/freedreno_perfcntr.h | 28 +++++++++++++++++ 4 files changed, 31 insertions(+), 82 deletions(-) diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_perfcntr.c b/src/gallium/drivers/freedreno/a2xx/fd2_perfcntr.c index 35f084e1fa9..c5f37908f33 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_perfcntr.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_perfcntr.c @@ -25,32 +25,11 @@ * Rob Clark */ -#include "freedreno_perfcntr.h" #include "freedreno_util.h" #include "a2xx.xml.h" #define REG(_x) REG_A2XX_ ## _x - -#define COUNTER(_sel, _lo, _hi) { \ - .select_reg = REG(_sel), \ - .counter_reg_lo = REG(_lo), \ - .counter_reg_hi = REG(_hi), \ -} - -#define COUNTABLE(_selector, _query_type, _result_type) { \ - .name = #_selector, \ - .selector = _selector, \ - .query_type = PIPE_DRIVER_QUERY_TYPE_ ## _query_type, \ - .result_type = PIPE_DRIVER_QUERY_RESULT_TYPE_ ## _result_type, \ -} - -#define GROUP(_name, _counters, _countables) { \ - .name = _name, \ - .num_counters = ARRAY_SIZE(_counters), \ - .counters = _counters, \ - .num_countables = ARRAY_SIZE(_countables), \ - .countables = _countables, \ -} +#include "freedreno_perfcntr.h" static const struct fd_perfcntr_countable pa_su_countables[] = { COUNTABLE(PERF_PAPC_PASX_REQ, UINT64, AVERAGE), diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_perfcntr.c b/src/gallium/drivers/freedreno/a5xx/fd5_perfcntr.c index cf5571d54ea..93be373a7bd 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_perfcntr.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_perfcntr.c @@ -27,39 +27,10 @@ #ifndef FD5_PERFCNTR_H_ #define FD5_PERFCNTR_H_ -#include "freedreno_perfcntr.h" #include "fd5_format.h" #define REG(_x) REG_A5XX_ ## _x - -#define COUNTER(_sel, _lo, _hi) { \ - .select_reg = REG(_sel), \ - .counter_reg_lo = REG(_lo), \ - .counter_reg_hi = REG(_hi), \ -} - -#define COUNTER2(_sel, _lo, _hi, _en, _clr) { \ - .select_reg = REG(_sel), \ - .counter_reg_lo = REG(_lo), \ - .counter_reg_hi = REG(_hi), \ - .enable = REG(_en), \ - .clear = REG(_clr), \ -} - -#define COUNTABLE(_selector, _query_type, _result_type) { \ - .name = #_selector, \ - .selector = _selector, \ - .query_type = PIPE_DRIVER_QUERY_TYPE_ ## _query_type, \ - .result_type = PIPE_DRIVER_QUERY_RESULT_TYPE_ ## _result_type, \ -} - -#define GROUP(_name, _counters, _countables) { \ - .name = _name, \ - .num_counters = ARRAY_SIZE(_counters), \ - .counters = _counters, \ - .num_countables = ARRAY_SIZE(_countables), \ - .countables = _countables, \ -} +#include "freedreno_perfcntr.h" static const struct fd_perfcntr_counter cp_counters[] = { //RESERVED: for kernel diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_perfcntr.c b/src/gallium/drivers/freedreno/a6xx/fd6_perfcntr.c index b8b13c8df02..8f23a224a4a 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_perfcntr.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_perfcntr.c @@ -27,39 +27,10 @@ #ifndef FD6_PERFCNTR_H_ #define FD6_PERFCNTR_H_ -#include "freedreno_perfcntr.h" #include "fd6_format.h" #define REG(_x) REG_A6XX_ ## _x - -#define COUNTER(_sel, _lo, _hi) { \ - .select_reg = REG(_sel), \ - .counter_reg_lo = REG(_lo), \ - .counter_reg_hi = REG(_hi), \ -} - -#define COUNTER2(_sel, _lo, _hi, _en, _clr) { \ - .select_reg = REG(_sel), \ - .counter_reg_lo = REG(_lo), \ - .counter_reg_hi = REG(_hi), \ - .enable = REG(_en), \ - .clear = REG(_clr), \ -} - -#define COUNTABLE(_selector, _query_type, _result_type) { \ - .name = #_selector, \ - .selector = _selector, \ - .query_type = PIPE_DRIVER_QUERY_TYPE_ ## _query_type, \ - .result_type = PIPE_DRIVER_QUERY_RESULT_TYPE_ ## _result_type, \ -} - -#define GROUP(_name, _counters, _countables) { \ - .name = _name, \ - .num_counters = ARRAY_SIZE(_counters), \ - .counters = _counters, \ - .num_countables = ARRAY_SIZE(_countables), \ - .countables = _countables, \ -} +#include "freedreno_perfcntr.h" static const struct fd_perfcntr_counter cp_counters[] = { //RESERVED: for kernel diff --git a/src/gallium/drivers/freedreno/freedreno_perfcntr.h b/src/gallium/drivers/freedreno/freedreno_perfcntr.h index 79759307a34..0cc5485ff12 100644 --- a/src/gallium/drivers/freedreno/freedreno_perfcntr.h +++ b/src/gallium/drivers/freedreno/freedreno_perfcntr.h @@ -68,5 +68,33 @@ struct fd_perfcntr_group { const struct fd_perfcntr_countable *countables; }; +#define COUNTER(_sel, _lo, _hi) { \ + .select_reg = REG(_sel), \ + .counter_reg_lo = REG(_lo), \ + .counter_reg_hi = REG(_hi), \ +} + +#define COUNTER2(_sel, _lo, _hi, _en, _clr) { \ + .select_reg = REG(_sel), \ + .counter_reg_lo = REG(_lo), \ + .counter_reg_hi = REG(_hi), \ + .enable = REG(_en), \ + .clear = REG(_clr), \ +} + +#define COUNTABLE(_selector, _query_type, _result_type) { \ + .name = #_selector, \ + .selector = _selector, \ + .query_type = PIPE_DRIVER_QUERY_TYPE_ ## _query_type, \ + .result_type = PIPE_DRIVER_QUERY_RESULT_TYPE_ ## _result_type, \ +} + +#define GROUP(_name, _counters, _countables) { \ + .name = _name, \ + .num_counters = ARRAY_SIZE(_counters), \ + .counters = _counters, \ + .num_countables = ARRAY_SIZE(_countables), \ + .countables = _countables, \ +} #endif /* FREEDRENO_PERFCNTR_H_ */ -- 2.30.2