From feae70f608236096b91b145b4967ebc917833773 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Fri, 1 Sep 2023 10:18:16 +0300 Subject: [PATCH] intel/ds: use improved timestamp correlation if available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lionel Landwerlin Reviewed-by: José Roberto de Souza Part-of: --- src/intel/ds/intel_driver_ds.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/intel/ds/intel_driver_ds.cc b/src/intel/ds/intel_driver_ds.cc index 8ee894bea89..1b2963b6a20 100644 --- a/src/intel/ds/intel_driver_ds.cc +++ b/src/intel/ds/intel_driver_ds.cc @@ -130,10 +130,17 @@ static void sync_timestamp(IntelRenderpassDataSource::TraceContext &ctx, struct intel_ds_device *device) { - uint64_t cpu_ts = perfetto::base::GetBootTimeNs().count(); - uint64_t gpu_ts; - intel_gem_read_render_timestamp(device->fd, device->info.kmd_type, - &gpu_ts); + uint64_t cpu_ts, gpu_ts; + + if (!intel_gem_read_correlate_cpu_gpu_timestamp(device->fd, + device->info.kmd_type, + INTEL_ENGINE_CLASS_RENDER, 0, + CLOCK_BOOTTIME, + &cpu_ts, &gpu_ts, NULL)) { + cpu_ts = perfetto::base::GetBootTimeNs().count(); + intel_gem_read_render_timestamp(device->fd, device->info.kmd_type, + &gpu_ts); + } gpu_ts = intel_device_info_timebase_scale(&device->info, gpu_ts); if (cpu_ts < device->next_clock_sync_ns)