aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLionel Landwerlin <[email protected]>2018-06-07 18:18:43 +0100
committerLionel Landwerlin <[email protected]>2019-04-17 14:10:42 +0100
commitf6bba7760f7985e08dccde3472e53d62fa2240d0 (patch)
treebded510fa1a68eca6c73bf744adb31c6f6168366
parent134e750e16bfc53480e0bba6f0ae3e1d2a7fb87c (diff)
i965: move mdapi data structure to intel/perf
We'll want to reuse those structures later on. Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Mark Janes <[email protected]>
-rw-r--r--src/intel/Makefile.sources3
-rw-r--r--src/intel/perf/gen_perf_mdapi.h119
-rw-r--r--src/mesa/drivers/dri/i965/brw_performance_query_mdapi.c103
3 files changed, 128 insertions, 97 deletions
diff --git a/src/intel/Makefile.sources b/src/intel/Makefile.sources
index b5915a0d9a4..2aaa7feee53 100644
--- a/src/intel/Makefile.sources
+++ b/src/intel/Makefile.sources
@@ -333,7 +333,8 @@ GEN_PERF_XML_FILES = \
GEN_PERF_FILES = \
perf/gen_perf.c \
- perf/gen_perf.h
+ perf/gen_perf.h \
+ perf/gen_perf_mdapi.h
GEN_PERF_GENERATED_FILES = \
perf/gen_perf_metrics.c \
diff --git a/src/intel/perf/gen_perf_mdapi.h b/src/intel/perf/gen_perf_mdapi.h
new file mode 100644
index 00000000000..dcaa8c3ebeb
--- /dev/null
+++ b/src/intel/perf/gen_perf_mdapi.h
@@ -0,0 +1,119 @@
+/*
+ * Copyright © 2018 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef GEN_PERF_MDAPI_H
+#define GEN_PERF_MDAPI_H
+
+#include <stdint.h>
+
+/*
+ * Data format expected by MDAPI.
+ */
+
+struct gen7_mdapi_metrics {
+ uint64_t TotalTime;
+
+ uint64_t ACounters[45];
+ uint64_t NOACounters[16];
+
+ uint64_t PerfCounter1;
+ uint64_t PerfCounter2;
+ uint32_t SplitOccured;
+ uint32_t CoreFrequencyChanged;
+ uint64_t CoreFrequency;
+ uint32_t ReportId;
+ uint32_t ReportsCount;
+};
+
+#define GTDI_QUERY_BDW_METRICS_OA_COUNT 36
+#define GTDI_QUERY_BDW_METRICS_OA_40b_COUNT 32
+#define GTDI_QUERY_BDW_METRICS_NOA_COUNT 16
+struct gen8_mdapi_metrics {
+ uint64_t TotalTime;
+ uint64_t GPUTicks;
+ uint64_t OaCntr[GTDI_QUERY_BDW_METRICS_OA_COUNT];
+ uint64_t NoaCntr[GTDI_QUERY_BDW_METRICS_NOA_COUNT];
+ uint64_t BeginTimestamp;
+ uint64_t Reserved1;
+ uint64_t Reserved2;
+ uint32_t Reserved3;
+ uint32_t OverrunOccured;
+ uint64_t MarkerUser;
+ uint64_t MarkerDriver;
+
+ uint64_t SliceFrequency;
+ uint64_t UnsliceFrequency;
+ uint64_t PerfCounter1;
+ uint64_t PerfCounter2;
+ uint32_t SplitOccured;
+ uint32_t CoreFrequencyChanged;
+ uint64_t CoreFrequency;
+ uint32_t ReportId;
+ uint32_t ReportsCount;
+};
+
+#define GTDI_MAX_READ_REGS 16
+
+struct gen9_mdapi_metrics {
+ uint64_t TotalTime;
+ uint64_t GPUTicks;
+ uint64_t OaCntr[GTDI_QUERY_BDW_METRICS_OA_COUNT];
+ uint64_t NoaCntr[GTDI_QUERY_BDW_METRICS_NOA_COUNT];
+ uint64_t BeginTimestamp;
+ uint64_t Reserved1;
+ uint64_t Reserved2;
+ uint32_t Reserved3;
+ uint32_t OverrunOccured;
+ uint64_t MarkerUser;
+ uint64_t MarkerDriver;
+
+ uint64_t SliceFrequency;
+ uint64_t UnsliceFrequency;
+ uint64_t PerfCounter1;
+ uint64_t PerfCounter2;
+ uint32_t SplitOccured;
+ uint32_t CoreFrequencyChanged;
+ uint64_t CoreFrequency;
+ uint32_t ReportId;
+ uint32_t ReportsCount;
+
+ uint64_t UserCntr[GTDI_MAX_READ_REGS];
+ uint32_t UserCntrCfgId;
+ uint32_t Reserved4;
+};
+
+struct mdapi_pipeline_metrics {
+ uint64_t IAVertices;
+ uint64_t IAPrimitives;
+ uint64_t VSInvocations;
+ uint64_t GSInvocations;
+ uint64_t GSPrimitives;
+ uint64_t CInvocations;
+ uint64_t CPrimitives;
+ uint64_t PSInvocations;
+ uint64_t HSInvocations;
+ uint64_t DSInvocations;
+ uint64_t CSInvocations;
+};
+
+#endif /* GEN_PERF_MDAPI_H */
diff --git a/src/mesa/drivers/dri/i965/brw_performance_query_mdapi.c b/src/mesa/drivers/dri/i965/brw_performance_query_mdapi.c
index 0676e868b81..916b14c14ba 100644
--- a/src/mesa/drivers/dri/i965/brw_performance_query_mdapi.c
+++ b/src/mesa/drivers/dri/i965/brw_performance_query_mdapi.c
@@ -25,96 +25,7 @@
#include "brw_performance_query.h"
#include "perf/gen_perf.h"
-
-/**
- * Data format expected by MDAPI.
- */
-
-struct mdapi_gen7_metrics {
- uint64_t TotalTime;
-
- uint64_t ACounters[45];
- uint64_t NOACounters[16];
-
- uint64_t PerfCounter1;
- uint64_t PerfCounter2;
- uint32_t SplitOccured;
- uint32_t CoreFrequencyChanged;
- uint64_t CoreFrequency;
- uint32_t ReportId;
- uint32_t ReportsCount;
-};
-
-#define GTDI_QUERY_BDW_METRICS_OA_COUNT 36
-#define GTDI_QUERY_BDW_METRICS_OA_40b_COUNT 32
-#define GTDI_QUERY_BDW_METRICS_NOA_COUNT 16
-struct mdapi_gen8_metrics {
- uint64_t TotalTime;
- uint64_t GPUTicks;
- uint64_t OaCntr[GTDI_QUERY_BDW_METRICS_OA_COUNT];
- uint64_t NoaCntr[GTDI_QUERY_BDW_METRICS_NOA_COUNT];
- uint64_t BeginTimestamp;
- uint64_t Reserved1;
- uint64_t Reserved2;
- uint32_t Reserved3;
- uint32_t OverrunOccured;
- uint64_t MarkerUser;
- uint64_t MarkerDriver;
-
- uint64_t SliceFrequency;
- uint64_t UnsliceFrequency;
- uint64_t PerfCounter1;
- uint64_t PerfCounter2;
- uint32_t SplitOccured;
- uint32_t CoreFrequencyChanged;
- uint64_t CoreFrequency;
- uint32_t ReportId;
- uint32_t ReportsCount;
-};
-
-#define GTDI_MAX_READ_REGS 16
-
-struct mdapi_gen9_metrics {
- uint64_t TotalTime;
- uint64_t GPUTicks;
- uint64_t OaCntr[GTDI_QUERY_BDW_METRICS_OA_COUNT];
- uint64_t NoaCntr[GTDI_QUERY_BDW_METRICS_NOA_COUNT];
- uint64_t BeginTimestamp;
- uint64_t Reserved1;
- uint64_t Reserved2;
- uint32_t Reserved3;
- uint32_t OverrunOccured;
- uint64_t MarkerUser;
- uint64_t MarkerDriver;
-
- uint64_t SliceFrequency;
- uint64_t UnsliceFrequency;
- uint64_t PerfCounter1;
- uint64_t PerfCounter2;
- uint32_t SplitOccured;
- uint32_t CoreFrequencyChanged;
- uint64_t CoreFrequency;
- uint32_t ReportId;
- uint32_t ReportsCount;
-
- uint64_t UserCntr[GTDI_MAX_READ_REGS];
- uint32_t UserCntrCfgId;
- uint32_t Reserved4;
-};
-
-struct mdapi_pipeline_metrics {
- uint64_t IAVertices;
- uint64_t IAPrimitives;
- uint64_t VSInvocations;
- uint64_t GSInvocations;
- uint64_t GSPrimitives;
- uint64_t CInvocations;
- uint64_t CPrimitives;
- uint64_t PSInvocations;
- uint64_t HSInvocations;
- uint64_t DSInvocations;
- uint64_t CSInvocations;
-};
+#include "perf/gen_perf_mdapi.h"
int
brw_perf_query_get_mdapi_oa_data(struct brw_context *brw,
@@ -126,7 +37,7 @@ brw_perf_query_get_mdapi_oa_data(struct brw_context *brw,
switch (devinfo->gen) {
case 7: {
- struct mdapi_gen7_metrics *mdapi_data = (struct mdapi_gen7_metrics *) data;
+ struct gen7_mdapi_metrics *mdapi_data = (struct gen7_mdapi_metrics *) data;
if (data_size < sizeof(*mdapi_data))
return 0;
@@ -148,7 +59,7 @@ brw_perf_query_get_mdapi_oa_data(struct brw_context *brw,
return sizeof(*mdapi_data);
}
case 8: {
- struct mdapi_gen8_metrics *mdapi_data = (struct mdapi_gen8_metrics *) data;
+ struct gen8_mdapi_metrics *mdapi_data = (struct gen8_mdapi_metrics *) data;
if (data_size < sizeof(*mdapi_data))
return 0;
@@ -174,7 +85,7 @@ brw_perf_query_get_mdapi_oa_data(struct brw_context *brw,
case 9:
case 10:
case 11: {
- struct mdapi_gen9_metrics *mdapi_data = (struct mdapi_gen9_metrics *) data;
+ struct gen9_mdapi_metrics *mdapi_data = (struct gen9_mdapi_metrics *) data;
if (data_size < sizeof(*mdapi_data))
return 0;
@@ -258,7 +169,7 @@ brw_perf_query_register_mdapi_oa_query(struct brw_context *brw)
query = gen_perf_query_append_query_info(perf, 1 + 45 + 16 + 7);
query->oa_format = I915_OA_FORMAT_A45_B8_C8;
- struct mdapi_gen7_metrics metric_data;
+ struct gen7_mdapi_metrics metric_data;
query->data_size = sizeof(metric_data);
MDAPI_QUERY_ADD_COUNTER(query, metric_data, TotalTime, UINT64);
@@ -283,7 +194,7 @@ brw_perf_query_register_mdapi_oa_query(struct brw_context *brw)
query = gen_perf_query_append_query_info(perf, 2 + 36 + 16 + 16);
query->oa_format = I915_OA_FORMAT_A32u40_A4u32_B8_C8;
- struct mdapi_gen8_metrics metric_data;
+ struct gen8_mdapi_metrics metric_data;
query->data_size = sizeof(metric_data);
MDAPI_QUERY_ADD_COUNTER(query, metric_data, TotalTime, UINT64);
@@ -320,7 +231,7 @@ brw_perf_query_register_mdapi_oa_query(struct brw_context *brw)
query = gen_perf_query_append_query_info(perf, 2 + 36 + 16 + 16 + 16 + 2);
query->oa_format = I915_OA_FORMAT_A32u40_A4u32_B8_C8;
- struct mdapi_gen9_metrics metric_data;
+ struct gen9_mdapi_metrics metric_data;
query->data_size = sizeof(metric_data);
MDAPI_QUERY_ADD_COUNTER(query, metric_data, TotalTime, UINT64);