From 5e63f0700ec087dab67797cf67298e91bbe3b8c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 5 Nov 2017 19:46:42 +0100 Subject: [PATCH] Get rid of the sync around curTickEst --- GPU/GPUCommon.cpp | 8 ++++---- GPU/GPUCommon.h | 32 +------------------------------- 2 files changed, 5 insertions(+), 35 deletions(-) diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index a90c119a6d..dff49ed0bb 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -404,7 +404,7 @@ void GPUCommon::Reinitialize() { busyTicks = 0; timeSpentStepping_ = 0.0; interruptsEnabled_ = true; - UpdateTickEstimate(0); + curTickEst_ = 0; ScheduleEvent(GPU_EVENT_REINITIALIZE); } @@ -1107,7 +1107,7 @@ bool GPUCommon::ProcessDLQueue() { void GPUCommon::ProcessDLQueueInternal() { startingTicks = CoreTiming::GetTicks(); cyclesExecuted = 0; - UpdateTickEstimate(std::max(busyTicks, startingTicks + cyclesExecuted)); + curTickEst_ = std::max(busyTicks, startingTicks + cyclesExecuted); // Seems to be correct behaviour to process the list anyway? if (startingTicks < busyTicks) { @@ -1126,7 +1126,7 @@ void GPUCommon::ProcessDLQueueInternal() { // At the end, we can remove it from the queue and continue. dlQueue.erase(std::remove(dlQueue.begin(), dlQueue.end(), listIndex), dlQueue.end()); } - UpdateTickEstimate(std::max(busyTicks, startingTicks + cyclesExecuted)); + curTickEst_ = std::max(busyTicks, startingTicks + cyclesExecuted); } } @@ -1136,7 +1136,7 @@ void GPUCommon::ProcessDLQueueInternal() { busyTicks = std::max(busyTicks, drawCompleteTicks); __GeTriggerSync(GPU_SYNC_DRAW, 1, drawCompleteTicks); // Since the event is in CoreTiming, we're in sync. Just set 0 now. - UpdateTickEstimate(0); + curTickEst_ = 0; } void GPUCommon::PreExecuteOp(u32 op, u32 diff) { diff --git a/GPU/GPUCommon.h b/GPU/GPUCommon.h index 752264b714..2123a3eea7 100644 --- a/GPU/GPUCommon.h +++ b/GPU/GPUCommon.h @@ -143,17 +143,7 @@ public: inline void Flush(); u64 GetTickEstimate() override { -#if defined(_M_X64) || defined(__ANDROID__) return curTickEst_; -#elif defined(_M_SSE) - __m64 result = *(__m64 *)&curTickEst_; - u64 safeResult = *(u64 *)&result; - _mm_empty(); - return safeResult; -#else - std::lock_guard guard(curTickEstLock_); - return curTickEst_; -#endif } #ifdef USE_CRT_DBG @@ -329,27 +319,7 @@ protected: GEPrimitiveType lastPrim_; private: - - // For CPU/GPU sync. -#ifdef __ANDROID__ - alignas(16) std::atomic curTickEst_; -#else - alignas(16) volatile u64 curTickEst_; - std::mutex curTickEstLock_; -#endif - - inline void UpdateTickEstimate(u64 value) { -#if defined(_M_X64) || defined(__ANDROID__) - curTickEst_ = value; -#elif defined(_M_SSE) - __m64 result = *(__m64 *)&value; - *(__m64 *)&curTickEst_ = result; - _mm_empty(); -#else - std::lock_guard guard(curTickEstLock_); - curTickEst_ = value; -#endif - } + u64 curTickEst_; // Debug stats. double timeSteppingStarted_;