From 04f94904874156111efea0000631c4839fdeb554 Mon Sep 17 00:00:00 2001 From: fma-rc <188743521+fma-rc@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:59:28 +0100 Subject: [PATCH] test(videoout): hold the deferred flip behind a GPU wait instead of an output callback the title releases --- core/libs/prx/libSceVideoOut/tests/Flip.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/core/libs/prx/libSceVideoOut/tests/Flip.cpp b/core/libs/prx/libSceVideoOut/tests/Flip.cpp index 0677ec9012..c15d7647bf 100644 --- a/core/libs/prx/libSceVideoOut/tests/Flip.cpp +++ b/core/libs/prx/libSceVideoOut/tests/Flip.cpp @@ -121,7 +121,6 @@ void testLifetime(bool reopen) { } else { check(expectFailure([&] { sceVideoOutWaitVblank(handle); }).find("closed") != std::string::npos, "closed port accepted a vblank wait"); } - AgcDriverUnregisterVideoOutput_nid_postfix(7, gate); if (reopen) sceVideoOutClose(handle); LibcRunShutdown_nid_postfix(); } @@ -198,13 +197,12 @@ void testPs4Buffers() { void testDeferredBuffer() { const int handle = sceVideoOutOpen(255, 0, 0, nullptr); auto cfg = VideoOutDriver::Get().GetConfig(handle); - auto gate = std::make_shared(); - AgcDriverRegisterVideoOutput_nid_postfix(7, gate); - std::array held{0xc004105c, 7, 0xfffffffeu, 1, 0, 0}; - Packet heldPacket{held.data(), 6, 0, {}}; - check(sceAgcDriverSubmitDcb(&heldPacket) == 0, "the gated flip was not accepted"); - std::array flip{0xc004105c, static_cast(handle), 0, 1, 3, 0}; - Packet flipPacket{flip.data(), 6, 0, {}}; + alignas(8) static std::uint32_t reached = 0; + reached = 0; + const auto label = reinterpret_cast(&reached); + std::array flip{0xc0053c00u, 0x13u, static_cast(label), static_cast(label >> 32u), 1u, 0xffffffffu, 0u, + 0xc004105c, static_cast(handle), 0, 1, 3, 0}; + Packet flipPacket{flip.data(), 13, 0, {}}; check(sceAgcDriverSubmitDcb(&flipPacket) == 0, "a GPU flip of a buffer registered before the GPU reaches it was rejected at submit"); std::vector allocation(65536 + 65535); const auto storage = alignedBuffer(allocation); @@ -212,7 +210,7 @@ void testDeferredBuffer() { VideoOutBufferAttribute2 attribute{}; sceVideoOutSetBufferAttribute2(&attribute, 0x8000000000000000ull, 0, 64, 64, 0, 0, 0); check(sceVideoOutRegisterBuffers2(handle, 0, 0, &buffer, 1, &attribute, 0, nullptr) == 0, "buffer registration failed"); - gate->Release(); + std::atomic_ref(reached).store(1u, std::memory_order_release); { std::unique_lock lock(cfg->mutex); const bool done = cfg->vblankCond.wait_for(lock, std::chrono::seconds(30), [&] { return cfg->failure || cfg->flipStatus.count == 1; }); @@ -223,7 +221,6 @@ void testDeferredBuffer() { AgcDriverWaitIdle_nid_postfix(); sceVideoOutUnregisterBuffers(handle, 0); sceVideoOutClose(handle); - AgcDriverUnregisterVideoOutput_nid_postfix(7, gate); LibcRunShutdown_nid_postfix(); }