Mesa (main): intel/perf: add a helper to read timestamp from reports
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Nov 22 12:17:08 UTC 2021
Module: Mesa
Branch: main
Commit: 120f24cb3604a324688fe237af2cfca933fca25f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=120f24cb3604a324688fe237af2cfca933fca25f
Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date: Mon Nov 8 00:10:06 2021 +0200
intel/perf: add a helper to read timestamp from reports
On newer HW it will require more work than just reading a dword. It
could also vary depending on the report format.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Antonio Caggiano <antonio.caggiano at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13831>
---
src/intel/perf/intel_perf.c | 19 +++++++++++++++----
src/intel/perf/intel_perf.h | 5 +++++
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/src/intel/perf/intel_perf.c b/src/intel/perf/intel_perf.c
index 231e32b218b..aa06fcc32ee 100644
--- a/src/intel/perf/intel_perf.c
+++ b/src/intel/perf/intel_perf.c
@@ -1027,6 +1027,13 @@ can_use_mi_rpc_bc_counters(const struct intel_device_info *devinfo)
return devinfo->ver <= 11;
}
+uint64_t
+intel_perf_report_timestamp(const struct intel_perf_query_info *query,
+ const uint32_t *report)
+{
+ return report[1];
+}
+
void
intel_perf_query_result_accumulate(struct intel_perf_query_result *result,
const struct intel_perf_query_info *query,
@@ -1040,13 +1047,15 @@ intel_perf_query_result_accumulate(struct intel_perf_query_result *result,
start[2] != INTEL_PERF_INVALID_CTX_ID)
result->hw_id = start[2];
if (result->reports_accumulated == 0)
- result->begin_timestamp = start[1];
+ result->begin_timestamp = intel_perf_report_timestamp(query, start);
result->reports_accumulated++;
switch (query->oa_format) {
case I915_OA_FORMAT_A32u40_A4u32_B8_C8:
- accumulate_uint32(start + 1, end + 1,
- result->accumulator + query->gpu_time_offset); /* timestamp */
+ result->accumulator[query->gpu_time_offset] =
+ intel_perf_report_timestamp(query, end) -
+ intel_perf_report_timestamp(query, start);
+
accumulate_uint32(start + 3, end + 3,
result->accumulator + query->gpu_clock_offset); /* clock */
@@ -1078,7 +1087,9 @@ intel_perf_query_result_accumulate(struct intel_perf_query_result *result,
break;
case I915_OA_FORMAT_A45_B8_C8:
- accumulate_uint32(start + 1, end + 1, result->accumulator); /* timestamp */
+ result->accumulator[query->gpu_time_offset] =
+ intel_perf_report_timestamp(query, end) -
+ intel_perf_report_timestamp(query, start);
for (i = 0; i < 61; i++) {
accumulate_uint32(start + 3 + i, end + 3 + i,
diff --git a/src/intel/perf/intel_perf.h b/src/intel/perf/intel_perf.h
index 8d9bc40008a..f6a498d50f3 100644
--- a/src/intel/perf/intel_perf.h
+++ b/src/intel/perf/intel_perf.h
@@ -454,6 +454,11 @@ void intel_perf_query_result_accumulate(struct intel_perf_query_result *result,
const uint32_t *start,
const uint32_t *end);
+/** Read the timestamp value in a report.
+ */
+uint64_t intel_perf_report_timestamp(const struct intel_perf_query_info *query,
+ const uint32_t *report);
+
/** Accumulate the delta between 2 snapshots of OA perf registers (layout
* should match description specified through intel_perf_query_register_layout).
*/
More information about the mesa-commit
mailing list