From f369196c9f80610d1de96a645caef5d3f07037f5 Mon Sep 17 00:00:00 2001 From: James Rowe Date: Mon, 16 Dec 2019 20:02:01 -0700 Subject: [PATCH] Remove wait for free buffer Previously we would first attempt to use any buffer that was free, meaning whichever buffer has already been displayed. This has poor interactions when the operating system throttles the update rate of the window, so if there isn't any free buffers available, just reuse the oldest frame instead. --- src/video_core/renderer_opengl/renderer_opengl.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 4526330d10..7b7c734831 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -77,7 +77,6 @@ public: std::scoped_lock lock(swap_chain_lock); std::queue().swap(free_queue); present_queue.clear(); - free_cv.notify_all(); present_cv.notify_all(); } @@ -126,10 +125,6 @@ public: Frontend::Frame* GetRenderFrame() override { std::unique_lock lock(swap_chain_lock); - // wait for new entries in the free_queue - // we want to break at some point to prevent a softlock on close if the presentation thread - // stops consuming buffers - free_cv.wait_for(lock, std::chrono::milliseconds(100), [&] { return !free_queue.empty(); }); // If theres no free frames, we will reuse the oldest render frame if (free_queue.empty()) { @@ -162,7 +157,6 @@ public: // free the previous frame and add it back to the free queue if (previous_frame) { free_queue.push(previous_frame); - free_cv.notify_one(); } // the newest entries are pushed to the front of the queue @@ -172,7 +166,6 @@ public: for (auto f : present_queue) { free_queue.push(f); } - free_cv.notify_one(); present_queue.clear(); previous_frame = frame; return frame;