freedreno/perfcntrs: remove gallium dependencies
authorRob Clark <robdclark@chromium.org>
Tue, 19 Nov 2019 18:54:04 +0000 (10:54 -0800)
committerRob Clark <robdclark@gmail.com>
Thu, 21 Nov 2019 20:01:02 +0000 (20:01 +0000)
Prep work to move to a shared location.

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
src/gallium/drivers/freedreno/freedreno_query.c

index c5f37908f3353d51c465ca0fff735b3d0a81812f..06246f398ebf47d639dbf55c29afa33d221ab38e 100644 (file)
@@ -25,7 +25,9 @@
  *    Rob Clark <robclark@freedesktop.org>
  */
 
-#include "freedreno_util.h"
+#include "util/u_half.h"
+#include "adreno_common.xml.h"
+#include "adreno_pm4.xml.h"
 #include "a2xx.xml.h"
 
 #define REG(_x) REG_A2XX_ ## _x
index 93be373a7bdb42365209a04696a8c99ea02018e9..2d0579ca36351568ee069697958386ae447d24e1 100644 (file)
@@ -27,7 +27,9 @@
 #ifndef FD5_PERFCNTR_H_
 #define FD5_PERFCNTR_H_
 
-#include "fd5_format.h"
+#include "util/u_half.h"
+#include "adreno_common.xml.h"
+#include "a5xx.xml.h"
 
 #define REG(_x) REG_A5XX_ ## _x
 #include "freedreno_perfcntr.h"
index 8f23a224a4a551872537ef2f59403a2e8d5d0c58..a3c62d1286f7c7748dce9dc7cc5156c889eb5864 100644 (file)
@@ -27,7 +27,9 @@
 #ifndef FD6_PERFCNTR_H_
 #define FD6_PERFCNTR_H_
 
-#include "fd6_format.h"
+#include "util/u_half.h"
+#include "adreno_common.xml.h"
+#include "a6xx.xml.h"
 
 #define REG(_x) REG_A6XX_ ## _x
 #include "freedreno_perfcntr.h"
index 0cc5485ff126ac6b61fc4dbbcb2a32b4c15373c0..041d84bda54e59cc1483ef133b654874829a2eda 100644 (file)
@@ -48,6 +48,31 @@ struct fd_perfcntr_counter {
        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;
@@ -55,8 +80,8 @@ struct fd_perfcntr_countable {
        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: */
@@ -85,8 +110,8 @@ struct fd_perfcntr_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) {   \
index 1c98f4db15637de4d02950f4e13522fb4f62e46a..852c828fb06873647e0d543d07b7eeb3da39e6f3 100644 (file)
@@ -192,6 +192,41 @@ fd_set_active_query_state(struct pipe_context *pipe, bool enable)
 {
 }
 
+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)
 {
@@ -215,8 +250,8 @@ 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;