From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 54BD610E2BC for ; Wed, 22 Mar 2023 00:05:35 +0000 (UTC) From: Umesh Nerlige Ramappa To: igt-dev@lists.freedesktop.org, Ashutosh Dixit , kamil.konieczny@linux.intel.com Date: Tue, 21 Mar 2023 17:05:21 -0700 Message-Id: <20230322000523.3310187-30-umesh.nerlige.ramappa@intel.com> In-Reply-To: <20230322000523.3310187-1-umesh.nerlige.ramappa@intel.com> References: <20230322000523.3310187-1-umesh.nerlige.ramappa@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [igt-dev] [PATCH i-g-t v4 29/31] lib/i915/perf: Adjust the GPU timestamp for new OA formats List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lionel G Landwerlin Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: 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 --- 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