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.
This commit is contained in:
Markus Wick 2021-04-07 13:57:49 +02:00
parent 37ae463f9e
commit 48492bbb9b
2 changed files with 4 additions and 1 deletions

View file

@ -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();
}