fix(videoout): wait for flips with the high-resolution condition on Windows #1655
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1655"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by mohdfaour03 on 2026-10-08T15:48:21Z.
What
One of the host waits #1471 lists as still affected:
VideoOutDriver::presentLoopwaits onflipQueue->changed(astd::condition_variable) with a 10 ms timeout while no flip is queued, and pumps SDL events and the pad after each wake. On Windows that wait goes through winpthreads, which ends timed waits onGetTickCount64steps, so the poll ended 11 to 24 ms later instead of 10 ms.WaitForFlipRoomwaits on the same condition with a 60 s bound and has the same granularity.A plain high-resolution sleep is not a replacement here: a flip submitted while the present thread waits must wake it at once. libkernel already has the notify-capable precise wait the guest side uses,
TimedWait::Condition(event plus high-resolution waitable timer per waiting thread,std::condition_variable_anyunderAPS5_COARSE_TIMED_WAITS), and libSceVideoOut already links libkernel. The change makesFlipQueue::changedaTimedWait::Condition, turns the two timed waits intoWaitUntilwith the same bounds and predicates, and the eightnotify_allintoNotifyAll. On LinuxTimedWait::Conditionis thecondition_variable_anypath, so nothing changes there. This is the first use ofTimedWait::Conditionoutside libkernel.Tested
Windows 11 (10.0.26200), WinLibs GCC 15.2.0 (
15.2.0posix-14.0.0-ucrt-r7), Release,BUILD_TESTING=ON.Standalone measurement against the built
libkernel.prx, tick raised to 0.5 ms asTime.cppdoes, 60 iterations each:std::condition_variable::wait_for(10 ms), no notifyTimedWait::Condition::WaitUntil(10 ms), no notifyTimedWait::Condition::WaitUntil(10 ms), notified from another threadstd::condition_variable::wait_for(10 ms), notified from another threadThe notified rows show the wake-on-flip path is unchanged.
cmake --build build --target libSceVideoOut video_out_flip_tests;video_out_flip_tests decodeandvideo_out_flip_tests controlswithSDL_VIDEODRIVER=dummyexit 0 (the modes #1040 reports as passing onmain; the others need aparam.json).python tools/check_conventions.py --base upstream/mainandgit diff --checkpass.No title run; no Linux host here (the Linux path is the unchanged
condition_variable_anyfallback insideTimedWait::Condition).Checklist
main; no other open PR implements the same functions (#1225 and #1601 do not touchpresentLoop; #1472 and #1474 covered the other VideoOut and queue waits)NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt — none added.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T02:22:34Z.
This breaks loading on Linux. With this PR on main (25cc6fae6b),
libSceVideoOut.prximportsTimedWait::DeadlineNanos(_ZN9TimedWait13DeadlineNanosEm), whichlibkernel.prxcontains but doesn't export, so a title stops at load withsymbol lookup error ... undefined symbolandpatched_librariesfails.nm -Don the PR's own build shows the same, so it isn't from main. Could you either export it from libkernel or keep the helper inside libSceVideoOut?Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T07:19:28Z.
Review: CHANGES_REQUESTED
Thanks @oneandonlydean for catching this. Confirmed from the diff:
VideoOutDriver.cppnow callsTimedWait::DeadlineNanos(declared inlibkernel/Time/include/TimedWait.hpp:15), a plain function thatlibkernel.prxcontains but doesn't export.libSceVideoOut.prxtherefore imports an unresolved symbol and the title stops at load.To fix, either:
TimedWaitAPI thatlibSceVideoOutneeds from libkernel (and checkpatched_librariespasses), orlibSceVideoOut(e.g. a localsteady_clock-based deadline) and only use what libkernel already exports.Please also run
patched_libraries(and a load of a module importing it) before pushing; the PR CI no longer builds/runs ctest, so it won't show there.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T09:22:55Z.
Review: APPROVED
Thanks @oneandonlydean for catching this. Confirmed:
libkernel.prxdoesn't exportTimedWait::*, solibSceVideoOut.prxhad an unresolved import.Fixed on the branch:
main(conflict inFlipRequest::FailafterReleaseLocked; the newnotify_allis nowNotifyAll)TimedWait.cpp(self-contained) is compiled intolibSceVideoOut(CMakeLists.txt) instead of being imported from libkernelChecked:
nm -D libSceVideoOut.prxhas noTimedWaitundefined symbol;patched_librariesand the VideoOut ctest group pass (flip modes needing a Vulkan window skip). The Windows timing numbers are the author's and weren't reproduced here. Merging on green CI.