summaryrefslogtreecommitdiffstats
path: root/src/video_core/gpu_thread.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2019-02-09 17:37:11 +0100
committerbunnei <bunneidev@gmail.com>2019-03-07 03:48:57 +0100
commit84ad81ee6798ece6c66016c4581b5fe57ce7b20e (patch)
treea3b4940e25c43a743237e99afa75edc3d3633f67 /src/video_core/gpu_thread.cpp
parentgpu_thread: (HACK) Ignore flush on FlushAndInvalidateRegion. (diff)
downloadyuzu-84ad81ee6798ece6c66016c4581b5fe57ce7b20e.tar
yuzu-84ad81ee6798ece6c66016c4581b5fe57ce7b20e.tar.gz
yuzu-84ad81ee6798ece6c66016c4581b5fe57ce7b20e.tar.bz2
yuzu-84ad81ee6798ece6c66016c4581b5fe57ce7b20e.tar.lz
yuzu-84ad81ee6798ece6c66016c4581b5fe57ce7b20e.tar.xz
yuzu-84ad81ee6798ece6c66016c4581b5fe57ce7b20e.tar.zst
yuzu-84ad81ee6798ece6c66016c4581b5fe57ce7b20e.zip
Diffstat (limited to 'src/video_core/gpu_thread.cpp')
-rw-r--r--src/video_core/gpu_thread.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp
index 4c25380eb..c5bdd2a17 100644
--- a/src/video_core/gpu_thread.cpp
+++ b/src/video_core/gpu_thread.cpp
@@ -40,7 +40,7 @@ static void RunThread(VideoCore::RendererBase& renderer, Tegra::DmaPusher& dma_p
auto WaitForWakeup = [&]() {
std::unique_lock<std::mutex> lock{state.signal_mutex};
- state.signal_condition.wait(lock, [&] { return !state.IsIdle() || !state.is_running; });
+ state.signal_condition.wait(lock, [&] { return !state.is_idle || !state.is_running; });
};
// Wait for first GPU command before acquiring the window context
@@ -70,8 +70,10 @@ static void RunThread(VideoCore::RendererBase& renderer, Tegra::DmaPusher& dma_p
state.pop_queue->pop();
}
+ state.UpdateIdleState();
+
// Signal that the GPU thread has finished processing commands
- if (state.IsIdle()) {
+ if (state.is_idle) {
state.idle_condition.notify_one();
}
@@ -126,13 +128,14 @@ void ThreadManager::PushCommand(CommandData&& command_data, bool wait_for_idle,
{
std::lock_guard<std::mutex> lock{state.signal_mutex};
- if ((allow_on_cpu && state.IsIdle()) || IsGpuThread()) {
+ if ((allow_on_cpu && state.is_idle) || IsGpuThread()) {
// Execute the command synchronously on the current thread
ExecuteCommand(&command_data, renderer, dma_pusher);
return;
}
// Push the command to the GPU thread
+ state.UpdateIdleState();
state.push_queue->emplace(command_data);
}
@@ -142,7 +145,7 @@ void ThreadManager::PushCommand(CommandData&& command_data, bool wait_for_idle,
if (wait_for_idle) {
// Wait for the GPU to be idle (all commands to be executed)
std::unique_lock<std::mutex> lock{state.idle_mutex};
- state.idle_condition.wait(lock, [this] { return state.IsIdle(); });
+ state.idle_condition.wait(lock, [this] { return static_cast<bool>(state.is_idle); });
}
}