From 547198af6fddf804e9d012ce3d56070d6fb765b9 Mon Sep 17 00:00:00 2001 From: Stephen Miller <56742918+StevenMiller123@users.noreply.github.com> Date: Mon, 16 Feb 2026 00:31:35 -0600 Subject: [PATCH] Lib.VideoOut: Fix pending flips limit (#4039) * Hardcoded limit to pending flips Real hardware has a fixed-size queue, and doesn't depend on the number of registered buffers. While the kernel supposedly uses an array of 18 elements, my tests suggest the cap is 16 pending flips. * Assert on trying to flip unregistered buffer I haven't seen anything do this intentionally yet, but I do have cases where games do this unintentionally (do to unimplemented functions). --- src/core/libraries/videoout/driver.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/libraries/videoout/driver.cpp b/src/core/libraries/videoout/driver.cpp index 4951c4f1a..21163119d 100644 --- a/src/core/libraries/videoout/driver.cpp +++ b/src/core/libraries/videoout/driver.cpp @@ -224,7 +224,7 @@ bool VideoOutDriver::SubmitFlip(VideoOutPort* port, s32 index, s64 flip_arg, bool is_eop /*= false*/) { { std::unique_lock lock{port->port_mutex}; - if (index != -1 && port->flip_status.flip_pending_num >= port->NumRegisteredBuffers()) { + if (index != -1 && port->flip_status.flip_pending_num > 16) { LOG_ERROR(Lib_VideoOut, "Flip queue is full"); return false; } @@ -252,6 +252,7 @@ void VideoOutDriver::SubmitFlipInternal(VideoOutPort* port, s32 index, s64 flip_ frame = presenter->PrepareBlankFrame(false); } else { const auto& buffer = port->buffer_slots[index]; + ASSERT_MSG(buffer.group_index >= 0, "Trying to flip an unregistered buffer!"); const auto& group = port->groups[buffer.group_index]; frame = presenter->PrepareFrame(group, buffer.address_left); }