From e6fb49fa4bb2864702abcefc14f6bb62eaba7a7e Mon Sep 17 00:00:00 2001 From: Markus Wick <markus@selfnet.de> Date: Wed, 7 Apr 2021 13:57:49 +0200 Subject: video_core/gpu_thread: Keep the write lock for allocating the fence. Else the fence might get submited out-of-order into the queue, which makes testing them pointless. Overhead should be tiny as the mutex is just moved from the queue to the writing code. --- src/video_core/gpu_thread.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/video_core/gpu_thread.cpp') diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp index 6b8f06f780..9488bf5444 100644 --- a/src/video_core/gpu_thread.cpp +++ b/src/video_core/gpu_thread.cpp @@ -151,11 +151,13 @@ void ThreadManager::OnCommandListEnd() { } u64 ThreadManager::PushCommand(CommandData&& command_data) { + std::unique_lock lk(state.write_lock); const u64 fence{++state.last_fence}; state.queue.Push(CommandDataContainer(std::move(command_data), fence)); if (!is_async) { // In synchronous GPU mode, block the caller until the command has executed + lk.unlock(); WaitIdle(); } -- cgit v1.2.3-70-g09d2