[igt-dev] [PATCH i-g-t v4 29/31] lib/i915/perf: Adjust the GPU timestamp for new OA formats

Umesh Nerlige Ramappa umesh.nerlige.ramappa at intel.com
Wed Mar 22 00:05:21 UTC 2023


In some OA formats, gpu_ts is a 64 bit value and the right shift can
result in bit[31] being set. This throws off the correlation and the
timelines. Apply the mask on gpu_ts as well.

Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
---
 lib/i915/perf_data_reader.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/i915/perf_data_reader.c b/lib/i915/perf_data_reader.c
index 332f530e..2272ae2c 100644
--- a/lib/i915/perf_data_reader.c
+++ b/lib/i915/perf_data_reader.c
@@ -216,6 +216,12 @@ correlate_gpu_timestamp(struct intel_perf_data_reader *reader,
 	uint64_t mask = reader->perf->devinfo.oa_timestamp_mask;
 	int corr_idx = -1;
 
+	/* On some OA formats, gpu_ts is a 64 bit value and the shift can
+	 * result in bit[31] being set. This throws off the correlation and the
+	 * timelines. Apply the mask on gpu_ts as well.
+	 */
+	gpu_ts = gpu_ts & mask;
+
 	for (uint32_t i = 0; i < reader->n_correlation_chunks; i++) {
 		if (gpu_ts >= (reader->correlation_chunks[i].gpu_ts_begin & mask) &&
 		    gpu_ts <= (reader->correlation_chunks[i].gpu_ts_end & mask)) {
-- 
2.36.1



More information about the igt-dev mailing list