feat(libSceVideoOut): implement AGC-facing SysGetBus, SysAddSetModeEvent2 and GetPipelineStatus #17914

Merged
akkadbakkad89 merged 1 commit from upstream-pr/17914 into main 2026-11-13 10:18:51 +00:00
akkadbakkad89 commented 2026-11-09 22:22:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-11-09T22:22:34Z.


What

Implements the three libSceVideoOut exports that PPSA31544's bundled AGC-related modules call, from firmware 4.03 libSceVideoOut.sprx disassembly plus the fakelib callsites:

  • sceVideoOutSysGetBus(handle) returns the port's stored busType, VIDEO_OUT_ERROR_INVALID_HANDLE (0x8029000b) when the handle has no live context. Firmware looks the handle up in its context table (handles 1-6, entry id must equal the handle); the bundled libSceAgcDriver.sprx passes the same handle it passes sceVideoOutGetBufferLabelAddress and sceVideoOutSubmitEopFlip, then packs the result into a display command descriptor. Adds VideoOutDriver::GetBusType, an atomic open-port bus read mirroring HasConfig.
  • sceVideoOutSysAddSetModeEvent2(eq, index, udata) accepts index 0 or 1 only (VIDEO_OUT_ERROR_INVALID_VALUE, 0x80290001, otherwise — firmware's translator returns 0x80290001 for anything else) and registers a set-mode event through the existing registerVideoOutEvent path as firmware's shared event body does with kind 0x73. Index i targets port i + 1; an unopened port answers VIDEO_OUT_ERROR_INVALID_HANDLE where firmware would register anyway — recorded in the debt file.
  • sceVideoOutGetPipelineStatus(out, reserved) validates out != nullptr and reserved == 0 (VIDEO_OUT_ERROR_INVALID_ADDRESS, 0x80290002, otherwise), then answers 0x802900FF — firmware reads the active display-pipeline index over the video device (ioctl 0x80208218) and there is no host equivalent; sceVideoOutDriverGetLatestEopHandle already returns the same code for the same reason. out is left untouched on failure as on the error path in firmware. The psml caller only inspects out[0] == 1 after the call.

Removes all three from the debt stub table and documents the measured firmware behaviour and the remaining device-level gaps there.

Tested

Windows 11, MinGW GCC 15.2.0. video_out_flip (28 tests): passes on this branch and on main (31b4aa91e8) with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation — loader log shows adding layers "VK_LAYER_KHRONOS_validation" and Insert instance layer; zero VUID- lines in both runs, so no new validation errors. New labels checks cover SysGetBus on the open main port plus null/unopened/negative/out-of-range handles, SysAddSetModeEvent2 index validation, event delivery and outputModeEvents bookkeeping, and GetPipelineStatus argument validation and the device-failure path leaving out untouched.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: PPSA31544 Final Fantasy Resonance — its bundled libSceAgcDriver.sprx and libScePsml.sprx import these exports
  • GPUs tested: NVIDIA GeForce RTX 3070 (driver 617.42) on Windows 11; Intel UHD Graphics 630 present but not selected
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5232170089 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17914). Originally posted by [akkadbakkad89](https://github.com/akkadbakkad89) on 2026-11-09T22:22:34Z. --- ### What Implements the three `libSceVideoOut` exports that PPSA31544's bundled AGC-related modules call, from firmware 4.03 `libSceVideoOut.sprx` disassembly plus the fakelib callsites: - `sceVideoOutSysGetBus(handle)` returns the port's stored `busType`, `VIDEO_OUT_ERROR_INVALID_HANDLE` (0x8029000b) when the handle has no live context. Firmware looks the handle up in its context table (handles 1-6, entry id must equal the handle); the bundled `libSceAgcDriver.sprx` passes the same handle it passes `sceVideoOutGetBufferLabelAddress` and `sceVideoOutSubmitEopFlip`, then packs the result into a display command descriptor. Adds `VideoOutDriver::GetBusType`, an atomic open-port bus read mirroring `HasConfig`. - `sceVideoOutSysAddSetModeEvent2(eq, index, udata)` accepts index 0 or 1 only (`VIDEO_OUT_ERROR_INVALID_VALUE`, 0x80290001, otherwise — firmware's translator returns 0x80290001 for anything else) and registers a set-mode event through the existing `registerVideoOutEvent` path as firmware's shared event body does with kind `0x73`. Index `i` targets port `i + 1`; an unopened port answers `VIDEO_OUT_ERROR_INVALID_HANDLE` where firmware would register anyway — recorded in the debt file. - `sceVideoOutGetPipelineStatus(out, reserved)` validates `out != nullptr` and `reserved == 0` (`VIDEO_OUT_ERROR_INVALID_ADDRESS`, 0x80290002, otherwise), then answers `0x802900FF` — firmware reads the active display-pipeline index over the video device (`ioctl 0x80208218`) and there is no host equivalent; `sceVideoOutDriverGetLatestEopHandle` already returns the same code for the same reason. `out` is left untouched on failure as on the error path in firmware. The psml caller only inspects `out[0] == 1` after the call. Removes all three from the debt stub table and documents the measured firmware behaviour and the remaining device-level gaps there. ### Tested Windows 11, MinGW GCC 15.2.0. `video_out_flip` (28 tests): passes on this branch and on `main` (`31b4aa91e8`) with `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` — loader log shows `adding layers "VK_LAYER_KHRONOS_validation"` and `Insert instance layer`; zero `VUID-` lines in both runs, so no new validation errors. New `labels` checks cover `SysGetBus` on the open main port plus null/unopened/negative/out-of-range handles, `SysAddSetModeEvent2` index validation, event delivery and `outputModeEvents` bookkeeping, and `GetPipelineStatus` argument validation and the device-failure path leaving `out` untouched. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: PPSA31544 Final Fantasy Resonance — its bundled `libSceAgcDriver.sprx` and `libScePsml.sprx` import these exports - [x] GPUs tested: NVIDIA GeForce RTX 3070 (driver 617.42) on Windows 11; Intel UHD Graphics 630 present but not selected - [x] AI-assisted: yes
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!17914
No description provided.