aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2019-11-19 10:22:44 -0800
committerRob Clark <[email protected]>2019-11-21 20:01:02 +0000
commit3fb6aaf42efe0b61070f39667a2021ee4b3041f7 (patch)
treedd8625b12eb53e0af260984984b9b3c922c24ddb
parentcce07ea83523a8e6b0924fdc9a09050600a3e8bf (diff)
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 <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
-rw-r--r--src/gallium/drivers/freedreno/a2xx/fd2_perfcntr.c23
-rw-r--r--src/gallium/drivers/freedreno/a5xx/fd5_perfcntr.c31
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_perfcntr.c31
-rw-r--r--src/gallium/drivers/freedreno/freedreno_perfcntr.h28
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 <[email protected]>
*/
-#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_ */