diff options
Diffstat (limited to 'src/video_core/gpu.cpp')
| -rw-r--r-- | src/video_core/gpu.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 4aca39faf..4419ab735 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -123,15 +123,17 @@ bool GPU::CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value) { | |||
| 123 | return true; | 123 | return true; |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | // This values were reversed engineered by fincs from NVN | ||
| 127 | // The gpu clock is reported in units of 385/625 nanoseconds | ||
| 128 | constexpr u64 gpu_ticks_num = 384; | ||
| 129 | constexpr u64 gpu_ticks_den = 625; | ||
| 130 | |||
| 131 | u64 GPU::GetTicks() const { | 126 | u64 GPU::GetTicks() const { |
| 127 | // This values were reversed engineered by fincs from NVN | ||
| 128 | // The gpu clock is reported in units of 385/625 nanoseconds | ||
| 129 | constexpr u64 gpu_ticks_num = 384; | ||
| 130 | constexpr u64 gpu_ticks_den = 625; | ||
| 131 | |||
| 132 | const u64 cpu_ticks = system.CoreTiming().GetTicks(); | 132 | const u64 cpu_ticks = system.CoreTiming().GetTicks(); |
| 133 | const u64 nanoseconds = Core::Timing::CyclesToNs(cpu_ticks).count(); | 133 | const u64 nanoseconds = Core::Timing::CyclesToNs(cpu_ticks).count(); |
| 134 | return (nanoseconds * gpu_ticks_num) / gpu_ticks_den; | 134 | const u64 nanoseconds_num = nanoseconds / gpu_ticks_den; |
| 135 | const u64 nanoseconds_rem = nanoseconds % gpu_ticks_den; | ||
| 136 | return nanoseconds_num * gpu_ticks_num + (nanoseconds_rem * gpu_ticks_num) / gpu_ticks_den; | ||
| 135 | } | 137 | } |
| 136 | 138 | ||
| 137 | void GPU::FlushCommands() { | 139 | void GPU::FlushCommands() { |