citra-emu
/
citra-canary
Archived
1
0
Fork 0

Merge pull request #5030 from jroweboy/reorder-queue-acquire

Remove wait for free buffer
This commit is contained in:
James Rowe 2019-12-18 16:07:52 -07:00 committed by GitHub
commit 020cd56ad8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 7 deletions

View File

@ -77,7 +77,6 @@ public:
std::scoped_lock lock(swap_chain_lock); std::scoped_lock lock(swap_chain_lock);
std::queue<Frontend::Frame*>().swap(free_queue); std::queue<Frontend::Frame*>().swap(free_queue);
present_queue.clear(); present_queue.clear();
free_cv.notify_all();
present_cv.notify_all(); present_cv.notify_all();
} }
@ -126,10 +125,6 @@ public:
Frontend::Frame* GetRenderFrame() override { Frontend::Frame* GetRenderFrame() override {
std::unique_lock<std::mutex> lock(swap_chain_lock); std::unique_lock<std::mutex> 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 theres no free frames, we will reuse the oldest render frame
if (free_queue.empty()) { if (free_queue.empty()) {
@ -162,7 +157,6 @@ public:
// free the previous frame and add it back to the free queue // free the previous frame and add it back to the free queue
if (previous_frame) { if (previous_frame) {
free_queue.push(previous_frame); free_queue.push(previous_frame);
free_cv.notify_one();
} }
// the newest entries are pushed to the front of the queue // the newest entries are pushed to the front of the queue
@ -172,7 +166,6 @@ public:
for (auto f : present_queue) { for (auto f : present_queue) {
free_queue.push(f); free_queue.push(f);
} }
free_cv.notify_one();
present_queue.clear(); present_queue.clear();
previous_frame = frame; previous_frame = frame;
return frame; return frame;