unsigned clear;
};
+
+enum fd_perfcntr_type {
+ FD_PERFCNTR_TYPE_UINT64,
+ FD_PERFCNTR_TYPE_UINT,
+ FD_PERFCNTR_TYPE_FLOAT,
+ FD_PERFCNTR_TYPE_PERCENTAGE,
+ FD_PERFCNTR_TYPE_BYTES,
+ FD_PERFCNTR_TYPE_MICROSECONDS,
+ FD_PERFCNTR_TYPE_HZ,
+ FD_PERFCNTR_TYPE_DBM,
+ FD_PERFCNTR_TYPE_TEMPERATURE,
+ FD_PERFCNTR_TYPE_VOLTS,
+ FD_PERFCNTR_TYPE_AMPS,
+ FD_PERFCNTR_TYPE_WATTS,
+};
+
+/* Whether an average value per frame or a cumulative value should be
+ * displayed.
+ */
+enum fd_perfcntr_result_type {
+ FD_PERFCNTR_RESULT_TYPE_AVERAGE,
+ FD_PERFCNTR_RESULT_TYPE_CUMULATIVE,
+};
+
+
/* Describes a single countable: */
struct fd_perfcntr_countable {
const char *name;
unsigned selector;
/* description of the countable: */
- enum pipe_driver_query_type query_type;
- enum pipe_driver_query_result_type result_type;
+ enum fd_perfcntr_type query_type;
+ enum fd_perfcntr_result_type result_type;
};
/* Describes an entire counter group: */
#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, \
+ .query_type = FD_PERFCNTR_TYPE_ ## _query_type, \
+ .result_type = FD_PERFCNTR_RESULT_TYPE_ ## _result_type, \
}
#define GROUP(_name, _counters, _countables) { \
{
}
+static enum pipe_driver_query_type
+query_type(enum fd_perfcntr_type type)
+{
+#define ENUM(t) case FD_PERFCNTR_ ## t: return PIPE_DRIVER_QUERY_ ## t
+ switch (type) {
+ ENUM(TYPE_UINT64);
+ ENUM(TYPE_UINT);
+ ENUM(TYPE_FLOAT);
+ ENUM(TYPE_PERCENTAGE);
+ ENUM(TYPE_BYTES);
+ ENUM(TYPE_MICROSECONDS);
+ ENUM(TYPE_HZ);
+ ENUM(TYPE_DBM);
+ ENUM(TYPE_TEMPERATURE);
+ ENUM(TYPE_VOLTS);
+ ENUM(TYPE_AMPS);
+ ENUM(TYPE_WATTS);
+ default:
+ unreachable("bad type");
+ return 0;
+ }
+}
+
+static enum pipe_driver_query_result_type
+query_result_type(enum fd_perfcntr_result_type type)
+{
+ switch (type) {
+ ENUM(RESULT_TYPE_AVERAGE);
+ ENUM(RESULT_TYPE_CUMULATIVE);
+ default:
+ unreachable("bad type");
+ return 0;
+ }
+}
+
static void
setup_perfcntr_query_info(struct fd_screen *screen)
{
info->name = c->name;
info->query_type = FD_QUERY_FIRST_PERFCNTR + idx;
- info->type = c->query_type;
- info->result_type = c->result_type;
+ info->type = query_type(c->query_type);
+ info->result_type = query_result_type(c->result_type);
info->group_id = i;
info->flags = PIPE_DRIVER_QUERY_FLAG_BATCH;