test(videoout): hold the deferred flip behind a GPU wait instead of an output callback the title releases

This commit is contained in:
fma-rc committed 2026-11-03 12:59:28 +01:00
1 parent f9e1ac270c
commit 04f9490487
1 file changed
+7 -10
+7 -10
View File
@@ -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<Gate>();
AgcDriverRegisterVideoOutput_nid_postfix(7, gate);
std::array<uint32_t, 6> 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<uint32_t, 6> flip{0xc004105c, static_cast<uint32_t>(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<std::uintptr_t>(&reached);
std::array<uint32_t, 13> flip{0xc0053c00u, 0x13u, static_cast<uint32_t>(label), static_cast<uint32_t>(label >> 32u), 1u, 0xffffffffu, 0u,
0xc004105c, static_cast<uint32_t>(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<std::byte> 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<std::uint32_t>(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();
}