freedreno/perfcntrs: small cleanup
authorRob Clark <robdclark@chromium.org>
Tue, 19 Nov 2019 18:22:44 +0000 (10:22 -0800)
committerRob Clark <robdclark@gmail.com>
Thu, 21 Nov 2019 20:01:02 +0000 (20:01 +0000)
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 <robdclark@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
src/gallium/drivers/freedreno/a2xx/fd2_perfcntr.c
src/gallium/drivers/freedreno/a5xx/fd5_perfcntr.c
src/gallium/drivers/freedreno/a6xx/fd6_perfcntr.c
src/gallium/drivers/freedreno/freedreno_perfcntr.h

index 35f084e1fa9e0010cddb4f780a5d0091b156702e..c5f37908f3353d51c465ca0fff735b3d0a81812f 100644 (file)
  *    Rob Clark <robclark@freedesktop.org>
  */
 
-#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),
index cf5571d54ea55059a648ac4799066dc539787bf3..93be373a7bdb42365209a04696a8c99ea02018e9 100644 (file)
 #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
index b8b13c8df02acaa9b2363f13b4305ee94b65299c..8f23a224a4a551872537ef2f59403a2e8d5d0c58 100644 (file)
 #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
index 79759307a34bdadb5c3ffc9bc683ff81c88f2775..0cc5485ff126ac6b61fc4dbbcb2a32b4c15373c0 100644 (file)
@@ -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_ */