diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-02-10 15:32:51 +0100 |
---|---|---|
committer | FernandoS27 <fsahmkow27@gmail.com> | 2020-02-10 15:44:54 +0100 |
commit | 8e9a4944dbbb4a22d149bb989faf32db0a979766 (patch) | |
tree | 2c24fc758046e03929dcd8e42c76674580e0a34e /src/video_core/gpu.cpp | |
parent | Maxwell3D: Correct query reporting. (diff) | |
download | yuzu-8e9a4944dbbb4a22d149bb989faf32db0a979766.tar yuzu-8e9a4944dbbb4a22d149bb989faf32db0a979766.tar.gz yuzu-8e9a4944dbbb4a22d149bb989faf32db0a979766.tar.bz2 yuzu-8e9a4944dbbb4a22d149bb989faf32db0a979766.tar.lz yuzu-8e9a4944dbbb4a22d149bb989faf32db0a979766.tar.xz yuzu-8e9a4944dbbb4a22d149bb989faf32db0a979766.tar.zst yuzu-8e9a4944dbbb4a22d149bb989faf32db0a979766.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/gpu.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 062ca83b8..4aca39faf 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp @@ -6,6 +6,7 @@ #include "common/microprofile.h" #include "core/core.h" #include "core/core_timing.h" +#include "core/core_timing_util.h" #include "core/memory.h" #include "video_core/engines/fermi_2d.h" #include "video_core/engines/kepler_compute.h" @@ -122,6 +123,17 @@ bool GPU::CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value) { return true; } +// This values were reversed engineered by fincs from NVN +// The gpu clock is reported in units of 385/625 nanoseconds +constexpr u64 gpu_ticks_num = 384; +constexpr u64 gpu_ticks_den = 625; + +u64 GPU::GetTicks() const { + const u64 cpu_ticks = system.CoreTiming().GetTicks(); + const u64 nanoseconds = Core::Timing::CyclesToNs(cpu_ticks).count(); + return (nanoseconds * gpu_ticks_num) / gpu_ticks_den; +} + void GPU::FlushCommands() { renderer.Rasterizer().FlushCommands(); } @@ -340,7 +352,7 @@ void GPU::ProcessSemaphoreTriggerMethod() { block.sequence = regs.semaphore_sequence; // TODO(Kmather73): Generate a real GPU timestamp and write it here instead of // CoreTiming - block.timestamp = system.CoreTiming().GetTicks(); + block.timestamp = GetTicks(); memory_manager->WriteBlock(regs.semaphore_address.SemaphoreAddress(), &block, sizeof(block)); } else { |