61 Commits
Author SHA1 Message Date
David f4f60cf277 test(libSceVideoOut): run the VideoOut flip tests with SDL's windows driver on Windows
ANYPS5_VIDEO_OUT_TEST_DRIVER defaulted to SDL's offscreen driver on every
host. That driver has no Vulkan on Windows, so all thirteen flip tests that
open a display skipped there. Windows now defaults to the windows driver.
A machine without a Vulkan driver makes DisplayWindow report that Vulkan
lacks VK_KHR_surface, so the flip tests also skip on a DisplayWindow error
that names Vulkan, as they do on offscreen's message.
2026-10-22 05:05:28 +01:00
David 0225ae65a7 test(libSceVideoOut): find the pre-vblank event among every queued event
The controls check read exactly two events after subscribing to pre-vblank
and waiting for one vblank, and expected one of them to be PRE_VBLANK_START.
The VideoOut filter queues every vblank of the earlier VBLANK registration,
and the queue returns one registration's events before the next, so when a
second vblank lands between the earlier read and the wait (a real display's
cadence), both events read are VBLANK and the pre-vblank event is the third.
The check now reads up to eight events and requires a VBLANK for the vblank
registration and a PRE_VBLANK_START with its own user data among them.
2026-10-22 05:03:59 +01:00
Adrià ba6abe1fd4 Merge pull request #8418 from hypermoist/feat/videoout-remove-buffer-attribute-option
feat(libSceVideoOut): implement sceVideoOutRemoveBufferAttributeOption
2026-10-21 15:32:40 +02:00
Tomás Ortellado 76aa70e552 test(videoout): split long GPU work into bounded dispatches 2026-10-20 10:44:24 -03:00
hypermistandClaude Opus 5.5 e9bde2a2d4 feat(libSceVideoOut): implement sceVideoOutRemoveBufferAttributeOption
Clear the given bits of the attribute's option field, the inverse of
sceVideoOutAddBufferAttributeOption, as libSceVideoOut does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
2026-10-21 01:28:22 +13:00
Adrià 415cd49fd3 Merge pull request #5913 from JJenkx/test/eop-live-token-filler-current
test(videoout): pin EOP matching across type-2 filler
2026-10-19 10:01:38 +02:00
Adrià c8e3fcb703 Merge pull request #6507 from karanvora2599/perf/videoout-unordered-cpu-flips
perf(videoout): don't hold a flip thread's CPU flips behind queued work
2026-10-19 04:49:51 +02:00
JJenkx 992f4a2d4e test(videoout): keep live EOP tokens in NOP payload after a type2 filler 2026-10-18 21:07:33 -04:00
MarcZX100 75d0e9a7f4 test(videoout): correct first flip pacing assertion 2026-10-18 15:46:12 +00:00
Karan Vora db091f5fbb perf(videoout): don't hold a flip thread's CPU flips behind queued work
sceVideoOutSubmitFlip went through queue 0 as a one-packet command
buffer, so every CPU flip waited until the queue worker had translated
all command buffers submitted before it. The PS5 RADV WSI flips from its
own thread once the frame's fence has signaled. vkQuake keeps two frames
in flight, so by then the next frame's command buffer is already queued,
and the flip waited about 10 ms for the worker to translate it. Presents
came in pairs, about 4.7 ms and 29 ms apart. Meanwhile the title waited
in acquire for the flip to be shown, leaving the worker idle for about
7.5 ms per pair.

A CPU flip from a thread that has never submitted queue-0 work now goes
to the presenter at once, unless a command-buffer or EOP flip ahead of it
has not been reached yet. Such a thread can only know that its frame is
done by waiting for it. A flip from a thread that submits its own frames
still waits for the work submitted ahead of it, because a title that
flips without waiting for its frame relies on that order.
APS5_CPU_FLIP_IN_ORDER=1 orders every CPU flip.

vkQuake (PPSA99010) on an RTX 4060: 60 -> 72-74 presents per second,
present-interval standard deviation 12.2 -> 2.1 ms, and intervals over
25 ms 40% -> 1%.
2026-10-17 20:00:58 -04:00
Adrià b1cb3ed43b Merge pull request #5991 from Get-fix/ps4/videoout-ps4-buffers
feat(libSceVideoOut): register PS4 display buffers
2026-10-17 02:44:59 +02:00
Adrià f0a1e3443b Merge pull request #5691 from xXPBSXx/fix/video-out-flip-rate-error-v2
fix(libSceVideoOut): return VIDEO_OUT_ERROR_INVALID_VALUE for a flip rate outside 0..2
2026-10-15 14:59:01 +02:00
Get-fix 901b92c794 feat(libSceVideoOut): register PS4 display buffers
Add the PS4 functions sceVideoOutSetBufferAttribute and
sceVideoOutRegisterBuffers on top of the existing registration. The PS4
call uses the first free attribute set and returns its index. It
accepts linear A8R8G8B8_SRGB and A8B8G8R8_SRGB buffers, which map to the
PS5 B8G8R8A8 and R8G8B8A8 formats. It throws for tiled buffers, whose
PS4 layout differs from the PS5 one. Linear PS4 buffers may be 4 KiB
aligned: the OpenOrbis graphics sample places its second 1920x1080
buffer 8,294,400 bytes after the first. PS5 buffers keep the 64 KiB
rule. A handle with PS4 buffers writes the PS4 flip status (64 bytes)
and vblank status (32 bytes). Writing the 128-byte PS5 flip status into
the sample's stack structure overwrote its saved frame pointer.
2026-10-14 20:52:00 +03:00
Adrià 937cd6cab2 Merge pull request #5539 from JJenkx/feat/videoout-eop-flips
feat(videoout): present reserved flips from tagged GPU completion
2026-10-14 15:04:12 +02:00
JJenkx 8c0c449173 feat(videoout): present reserved flips from tagged GPU completion
Rebased onto main as one commit (conflicts in debt notes, Presentation.cpp includes and Submission.cpp helpers).
2026-10-14 14:22:36 +02:00
xXPBSXxandClaude Sonnet 5.5 a1c56b59e1 fix(libSceVideoOut): return VIDEO_OUT_ERROR_INVALID_VALUE for a flip rate outside 0..2
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-14 08:32:36 +02:00
JJenkx aaa5fd9c60 test(videoout): separate label cases from EOP additions 2026-10-13 20:13:38 -04:00
JJenkx d946b57909 Merge current main into feat/videoout-buffer-labels 2026-10-13 11:57:53 -04:00
JJenkx aef1b2989c feat(videoout): expose buffer labels and release replaced frames 2026-10-12 23:13:18 -04:00
Nicolas FalesyandClaude Opus 5.5 6f284b8298 feat(libSceVideoOut): implement sceVideoOutDeleteVrrActiveStatusEvent
The NID -q-vbO859Tw, declared as sceVideoOutUnknown_q_vbO859Tw for
PPSA02530, hashes to sceVideoOutDeleteVrrActiveStatusEvent. It removes the
handle's VRR status registration from the queue like the other Delete*Event
calls, the counterpart of sceVideoOutAddVrrActiveStatusEvent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017WeVmjnnPPKdxVTpr2Vjtw
2026-10-12 23:04:58 -04:00
PrintOrb 9c007805d6 Merge branch 'main' into fix/videoout-high-frame-rate 2026-10-12 11:15:48 -05:00
Dean f55e1117d4 Merge pull request #4058 from ee6aba54/fix/videoout-event-unopened-port
fix(libSceVideoOut): return INVALID_HANDLE for events on ports that are not open
2026-10-12 23:47:16 +13:00
Dean 5aa0e15a4f Merge pull request #3867 from tv7/fix/videoout-attribute-change-pending-flip
fix(videoout): accept a buffer attribute change while a flip is pending
2026-10-12 17:28:15 +13:00
Simon 43573fd48a fix(libSceVideoOut): return INVALID_HANDLE for events on ports that are not open
Registering a flip or vblank event on a handle that sceVideoOutOpen never
created, or that was closed, threw, which ended titles that register
their flip event before they open the port and ignore the result. The
documented error SCE_VIDEO_OUT_ERROR_INVALID_HANDLE is returned instead,
the same check sceVideoOutSetFlipRate and the other output calls use.

The flip test program gains an "unopened" mode.
2026-10-12 00:21:47 +02:00
PrintOrb 665cca43a0 Merge branch 'main' into fix/videoout-high-frame-rate 2026-10-11 17:21:16 -05:00
PrintOrb 63434686bf fix(videoout): support permitted high-frame-rate output 2026-10-11 13:40:31 -05:00
LexroidandClaude Opus 5.5 5cd25dedbd fix(videoout): accept a buffer attribute change while a flip is pending
sceVideoOutSubmitChangeBufferAttribute2 threw when a buffer of the group
had a flip pending, and Marvel's Wolverine makes that call with flips in
the queue. A flip now takes its buffer group when it is reserved, in
submission order, so flips submitted before the change keep the
attributes their buffers were rendered with and later flips use the
new ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 21:06:04 +03:00
omurc4 d40189d707 feat(libSceVideoOut): export sceVideoOutAddBufferAttributeOption
Elden Ring Nightreign (PPSA25380) imports the function, which no library
exported, so the title failed to load. The option is ORed into the buffer
attribute and a null attribute throws. Options other than 0 and 8 still
throw when the buffers are registered.
2026-10-11 13:26:22 -04:00
b6cc4fe7f9 feat(videoout): implement sceVideoOutDeleteOutputModeEvent
Unsubscribe an event queue from the output mode events that
sceVideoOutAddOutputModeEvent registers, the same way the flip and
vblank events are removed. Deleting a registration that does not exist
succeeds, and a null queue or an invalid handle throws.

Co-Authored-By: Gemini 3.8 Flash <noreply@google.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-11 02:36:47 -04:00
XairRrR da642e807b fix(libSceVideoOut): take 64-bit VRR peg arguments and test peg and unpeg 2026-10-11 01:55:16 +02:00
arcwiser e5a81a3ca9 test(videoout): isolate application fixtures
(cherry picked from commit 7e982a521f2ba5fafabcba45c78cb23918fa9007)
2026-10-10 17:10:51 +00:00
XairRrR c9fe124c10 feat(libs): resolve command-buffer flip buffers when the GPU reaches the flip
A flip packet names a buffer index; the buffer was looked up when the
command buffer was submitted, so a title that registers its buffers
after submitting the first frame failed with "flip buffer is not
registered". The buffer is now resolved when the GPU reaches the flip,
as the hardware does. A flip whose buffer is still unregistered then
presents black and completes (see TechnicalDebt).

Uncharted: Legacy of Thieves Collection (PPSA05684) submits its first flip before registering its buffers and stopped with "flip buffer is not registered".
2026-10-10 09:54:29 +02:00
MathiasDevelopesandClaude Opus 5.5 85d1eb2e60 fix(libSceVideoOut): overlay-bus flips no longer replace the main output
A title that opens a main and an overlay port flips both, and every flip
was presented as a whole frame, so the window alternated between the two
buses: PPSA01736 shows its intro on the main bus and an empty overlay,
and the intro blinked black on every other frame. Overlay flips now
complete and signal their events without being shown. Compositing the
overlay over the main output is not implemented.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-10 08:48:03 +02:00
Adrià f3999054bd Merge pull request #1648 from Pedroj-64/fix/videoout-closed-port-flip-cancel
fix(videoout): cancel flips on a port the title closed instead of failing the driver
2026-10-10 08:03:46 +02:00
Dean b57e66fa60 Merge pull request #2152 from MathiasDevelopes/feat/videoout-pre-vblank-start-events
feat(libSceVideoOut): deliver pre-vblank start events
2026-10-10 17:44:23 +13:00
Adrià 85d4bfcf34 Merge pull request #1496 from hugodearaujo/fix/videoout-output-mode-errors
fix(videoout): answer output mode queries with the console's codes
2026-10-10 03:04:33 +02:00
Adrià Franch df270d59eb fix(ci): skip the VideoOut window tests without a display, as check_skips expects
Main's Linux job fails since #1028 and #1714: guest_video_out_resolution_status aborts when SDL's offscreen
driver has no Vulkan window, and check_skips.py rejects the skips of guest_video_out_wqhd_detection and the
flip tests because "no display" is not among the device limitations it accepts.

The resolution status test now skips with code 77 like its wqhd sibling, the flip tests print the same skip
reason, and check_skips.py accepts "no display" as a device limitation. ANYPS5_REQUIRE_DISPLAY still turns
the skip into a failure.
2026-10-10 02:20:49 +02:00
hugodearaujoandClaude Opus 5.5 cadcbfd3a8 fix(videoout): answer output mode queries with the console's codes
Measured on a PS5 (firmware 13.60) through dlopen of
libSceVideoOut.sprx on a handle the payload opened.
sceVideoOutInitializeOutputOptions writes 0xFF to byte 2 of the 64-byte
options and returns INVALID_ADDRESS for a null pointer.
sceVideoOutIsOutputSupported checks the handle, then the reserved
arguments, then the mode, then the options. It never answers 0: a mode
the display lacks returns UNSUPPORTED_OUTPUT_MODE, and a value that is
not a mode returns 0x8029001E. Options must keep the initialized words,
except word 3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 01:42:40 +02:00
Adrià 58706dc2d9 Merge pull request #1225 from Pedroj-64/fix/video-out-present-shutdown-failure
fix(videoout): report GPU driver shutdown failure from the present thread at Shutdown
2026-10-10 01:10:19 +02:00
Gjon Gojcevic 04dec3ddbc feat(libSceVideoOut): register the VRR status event and accept the VRR status call
LibwuIonIBw registers video out event id 16, which the host never triggers because its VRR state does not change; kP2L8t3j-aM returns 0 without effect.
2026-10-09 23:12:08 +02:00
Pedro a1efdab629 fix(videoout): cancel flips on a port the title closed instead of failing the driver
A flip still queued or in presentation when the title closes its port is discarded, as on hardware, rather than stored as a driver failure. A closed port no longer terminates the presentation thread nor surfaces from Shutdown. The lifetime test now expects cancellation and the reopen mode is registered in ctest.
2026-10-09 09:42:53 -05:00
Pedro 2663699dc5 test(videoout): skip flip tests without a Vulkan window and create param.json
The offscreen SDL driver cannot create a Vulkan window on Windows since
the VideoOut window uses SDL_WINDOW_VULKAN, so the tests that open a port
now exit 77 (skipped) like the other display tests, unless
ANYPS5_REQUIRE_DISPLAY is set. The tests also write app0/sce_sys/param.json,
which AppMetadata now requires.
2026-10-09 06:56:43 -05:00
MathiasDevelopesandClaude Opus 5.5 10f57dea29 feat(libSceVideoOut): deliver pre-vblank start events
sceVideoOutAddPreVblankStartEvent threw "physical pre-vblank timing is
not implemented", so titles that pace on it stopped at startup. It now
registers the event like the vblank event does, and each emulated vblank
tick triggers the pre-vblank start events just before the vblank events,
with the pre-vblank count as data. The console's lead time is unknown.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 12:00:55 +02:00
Dean 3e66276cba Merge pull request #1367 from Raghav314/fix/videoout-window-at-start
fix(videoout): create the window and the device when VideoOut starts
2026-10-09 21:03:10 +13:00
Celegans12 1816aea91c fix(agc): store and read DCC keys over the console's metadata extent
The console's DCC of a single-level 4-byte SW_64KB_R_X surface is
ceil(W/512) * ceil(H/512) * 4096 bytes, 49152 for 1920x1080, but the
driver stored and read one key per 256 surface bytes (34560).
PPSA26344 retiles its render DCC into the displayable copy it
registers (cs_dcc_retile_32bpp); a retile of the stale tail gives the
mixed keys PPSA12544 stops on.

DccKeyCount gives that extent. Color target and storage image key
stores cover it when the DCC is pipe-aligned (CB_COLOR_ATTRIB3 bit 30,
T# word 6 bit 19), whose CB keys reach its last meta block, and throw
where it is not writable; unaligned DCC keeps one key per 256 bytes,
as do texture and color target key reads. DisplayBufferKeys reads the
display DCC over the extent, presents only when every key agrees,
names the first differing key's pixels and checks a pending image
against those keys.
2026-10-08 15:24:43 +02:00
raghav314andClaude Opus 5.5 1a2bbc5d3e fix(videoout): create the window and the device when VideoOut starts
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 every host import, and the first flip paid
for it.

VideoOut now creates its window when it starts (the first VideoOut call),
at the default 1920x1080 output, and attaches it to the driver
(AgcDriverAttachWindow) before the call returns. The driver creates its
device with that window, so GPU work and presentation use one device.
Present no longer creates or replaces a device. A device created by GPU
work before VideoOut started is still replaced, now in AttachWindow.

A failure to create the window or the device is thrown from that first
VideoOut call instead of terminating the presentation thread.

Tests:
- video_out_flip_tests onedevice: GPU work, then a flip, leaves one device.
- pacing makes its first presentation span vblanks with GPU work queued
  ahead of the flip; it relied on the device being created at the flip.
- unavailable expects the failure from sceVideoOutOpen.
- guest_video_out_wqhd_detection writes a param.json for the window title
  and is skipped without a display or Vulkan device unless
  ANYPS5_REQUIRE_DISPLAY is set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 05:54:05 +05:30
Gjon Gojcevic e6f4d2c178 fix(libSceVideoOut): ignore the reserved buffer pointers
Titles may leave the reserved pointers of a VideoOutBuffers entry uninitialized, so sceVideoOutRegisterBuffers2 no longer rejects them.
2026-10-07 19:50:12 -04:00
Merijn 4d47b3aac5 Merge branch 'main' of https://github.com/boykopovar/AnyPS5 into fix/videoout-unsupported-output-mode
# Conflicts:
#	docs/dev/TechnicalDebt.md
2026-10-06 09:54:03 +02:00
Celegans12 241faf881e feat(agc): present DCC display buffers whose keys are uncompressed or fast-cleared
sceVideoOutRegisterBuffers2 threw "DCC presentation is not implemented"
for category 1 (DCC-compressed) buffers, which PPSA26344 registers. Such
a buffer now needs DCC metadata and the tiled layout, and dcc_control may
only use the CB_DCC_CONTROL block layout bits 0x10026c.

At a flip the keys are read behind their recorded writers, one byte per
256 bytes as in the driver's DCC model. Uncompressed keys present the
stored texels as before; a uniform clear code presents its color with a
GPU clear of the scaler's source image; a pending storage image is used
when it serves the keys. Mixed or unreadable keys, clear codes the
display format has no DCC encoding for, register-clear keys over a
pending image and a clear color wider than 32 bits throw. Buffers
without DCC take the old path.
2026-10-05 23:45:15 +02:00
MerijnandClaude Opus 5.5 d4eed90b54 fix(videoout): report unavailable output modes instead of throwing
sceVideoOutIsOutputSupported threw VIDEO_OUT_ERROR_UNSUPPORTED_OUTPUT_MODE
for every mode other than the default and 119.88 Hz, and
sceVideoOutConfigureOutput threw for an unavailable 119.88 Hz mode. Titles
probe and request modes the display may lack and handle the result:
PPSA12544 asks for 0xd000000a and falls back to 3840 pixels when it is not
supported, and its sceVideoOutConfigureOutput caller switches on the
returned error codes, including VIDEO_OUT_ERROR_UNAVAILABLE_OUTPUT_MODE.
Every mode except the default now reports 0, and configuring one returns
VIDEO_OUT_ERROR_UNAVAILABLE_OUTPUT_MODE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 22:45:12 +02:00