From 287ecd434f62f8d2f8f502706af49f72ac7df773 Mon Sep 17 00:00:00 2001 From: DanielSvoboda Date: Mon, 29 Jul 2024 19:10:01 -0300 Subject: [PATCH] GetGpuClock64 some game requested it (3), but GetGpuClock64 is correct? What exactly should it return? --- src/video_core/amdgpu/pm4_cmds.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/video_core/amdgpu/pm4_cmds.h b/src/video_core/amdgpu/pm4_cmds.h index 9b44da024..614baf6f8 100644 --- a/src/video_core/amdgpu/pm4_cmds.h +++ b/src/video_core/amdgpu/pm4_cmds.h @@ -312,6 +312,13 @@ struct PM4CmdEventWriteEop { return data_lo | u64(data_hi) << 32; } + uint64_t GetGpuClock64() const { + auto now = std::chrono::high_resolution_clock::now(); + auto duration = now.time_since_epoch(); + auto ticks = std::chrono::duration_cast(duration).count(); + return static_cast(ticks); + } + void SignalFence() const { switch (data_sel.Value()) { case DataSelect::None: { @@ -325,6 +332,10 @@ struct PM4CmdEventWriteEop { *Address() = DataQWord(); break; } + case DataSelect::GpuClock64: { + *Address() = GetGpuClock64(); + break; + } case DataSelect::PerfCounter: { *Address() = Common::FencedRDTSC(); break;