fix(videoout): create the window and the device when VideoOut starts #1367
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1367"
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 Raghav314 on 2026-10-08T00:27:48Z.
What
The driver created a windowless Vulkan device at the first dispatch and replaced it with a windowed one at the first flip. The replacement built a second device and re-imported the host imports (#284), and the first flip waited for both. #59, #110, #284 and #373 fix problems caused by the replacement.
shadPS4, KytyPS5 and SharpEmu create the window first and build one device with its surface:
emulator.cppcreates the window at startup;gnmdriver.cppRegisterLibcreatesVulkan::Presenter(*g_window).agc.cppInitializecallsWindowInit, which creates the window and the Vulkan device, beforeVideoOutInit.VulkanVideoPresenter.Initializecreates the instance, the surface, the device, then the swapchain.This change does the same at the first VideoOut call. AnyPS5 has no hook before the guest's entry point, and the libraries' static initializers can't create a window (loader lock on Windows).
AgcDriverAttachWindowbefore the call returns. The driver creates its device with that window.Presentno longer creates or replaces a device. A device created by GPU work submitted before VideoOut started is still replaced, now inAttachWindow.Tests that open VideoOut now need a display and a Vulkan device.
guest_video_out_wqhd_detectionwrites aparam.jsonfor the window title and is skipped without a display or Vulkan device unlessANYPS5_REQUIRE_DISPLAYis set.ANYPS5_REQUIRE_VULKANcan't be used: the Linux job sets it, but its SDL is built without X11 and Wayland, so neither CI job can create a Vulkan window and the test is skipped in both.Hades II (PPSA36082) also needs this to load: its 512 MiB upload pool is freed only after a GPU fence, and creating the device at the first dispatch was one of the delays in front of that fence. With this change and some local changes, it gets past loading; without this change it overflows the pool and crashes (2/2 runs).
Tested
Linux (CachyOS), x86-64, GCC, 7800X3D / RTX 4090.
video_out_flip_tests onedevice(new): GPU work, then a flip, leaves one device. Fails on main (two devices); dropping the attach at start fails it.pacingrelied on the first flip creating the device to span several vblanks. It now queues GPU work ahead of the flip and checks thatlastFlipVblankis at least 3 vblanks behind the vblank the presentation finished at, so it doesn't depend on which vblank the flip reaches the presenter at. Moving thelastFlipVblankstore back after the present fails it.unavailablenow expects the failure fromsceVideoOutOpen, and the same failure from a second open (run without a Vulkan driver).onedevice,pacing,aftergpu,present,backtoback,dcc,controls,decode,unavailablepass.unavailablewith Vulkan disabled.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T13:17:46Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libSceVideoOut/CMakeLists.txtL29-33