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 <robdclark@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
This commit is contained in:
Rob Clark 2019-11-19 10:22:44 -08:00 committed by Rob Clark
parent cce07ea835
commit 3fb6aaf42e
4 changed files with 31 additions and 82 deletions

View file

@ -25,32 +25,11 @@
* 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),

View file

@ -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

View file

@ -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

View 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_ */