From 0da3adba9a181c364b465b0212133c9ebded13c7 Mon Sep 17 00:00:00 2001 From: DanielSvoboda Date: Fri, 2 Aug 2024 21:18:53 -0300 Subject: [PATCH] GpuClock64 --- src/video_core/amdgpu/pm4_cmds.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/video_core/amdgpu/pm4_cmds.h b/src/video_core/amdgpu/pm4_cmds.h index 7f5ebb603..57f78df8a 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: { @@ -336,7 +343,7 @@ struct PM4CmdEventWriteEop { switch (int_sel.Value()) { case InterruptSelect::None: { - // No interrupt + *Address() = GetGpuClock64(); break; } case InterruptSelect::IrqOnly: