diff --git a/src/video/video_driver.cpp b/src/video/video_driver.cpp index 6355cb20ee..aa044630da 100644 --- a/src/video/video_driver.cpp +++ b/src/video/video_driver.cpp @@ -127,6 +127,9 @@ void VideoDriver::Tick() auto now = std::chrono::steady_clock::now(); if (this->HasGUI() && now >= this->next_draw_tick) { + /* Locking video buffer can block (especially with vsync enabled), do it before taking game state lock. */ + this->LockVideoBuffer(); + { /* Tell the game-thread to stop so we can have a go. */ std::lock_guard lock_wait(this->game_thread_wait_mutex); @@ -151,8 +154,6 @@ void VideoDriver::Tick() * new values when-ever we can. */ InteractiveRandom(); - this->LockVideoBuffer(); - this->DrainCommandQueue(); while (this->PollEvent()) {}