From 725304094eec2985f7e3b48efa0055171b1e7397 Mon Sep 17 00:00:00 2001
From: bunnei <bunneidev@gmail.com>
Date: Fri, 9 Feb 2018 22:17:31 -0500
Subject: [PATCH] nvflinger: (Hack) Use first available buffer if none are
 found.

---
 src/core/hle/service/nvflinger/buffer_queue.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/core/hle/service/nvflinger/buffer_queue.cpp b/src/core/hle/service/nvflinger/buffer_queue.cpp
index c7206a6831..f90c7ca518 100644
--- a/src/core/hle/service/nvflinger/buffer_queue.cpp
+++ b/src/core/hle/service/nvflinger/buffer_queue.cpp
@@ -40,7 +40,11 @@ u32 BufferQueue::DequeueBuffer(u32 pixel_format, u32 width, u32 height) {
         return igbp_buffer.format == pixel_format && igbp_buffer.width == width &&
                igbp_buffer.height == height;
     });
-    ASSERT(itr != queue.end());
+    if (itr == queue.end()) {
+        LOG_CRITICAL(Service_NVDRV, "no free buffers for pixel_format=%d, width=%d, height=%d",
+                     pixel_format, width, height);
+        itr = queue.begin();
+    }
 
     itr->status = Buffer::Status::Dequeued;
     return itr->slot;
-- 
GitLab