feat(libSceGnmDriver): build PS4 command buffers and submit them #9432

Merged
Get-fix merged 6 commits from upstream-pr/9432 into main 2026-11-06 09:44:08 +00:00
Get-fix commented 2026-10-21 21:51:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Get-fix on 2026-10-21T21:51:04Z.


What

Part 4 of the PS4 Limbo stack, split out of #6977 (the whole stack is listed in #6978). Only the last four commits are this PR; the ones below them are #9430 and #9431.

A real libSceGnmDriver for PS4 titles on the AGC executor:

  • The sceGnm shader setters (sceGnmSetPsShader, SetVsShader, SetCsShader and the ES/GS/HS/LS ones), the default hardware state, markers, sceGnmInsertWaitFlipDone and the EOP event calls, with the packets, register offsets and reserved sizes of shadPS4's gnmdriver.cpp (listed as unverified in docs/dev/debt/libSceGnmDriver.md).
  • sceGnmSubmitCommandBuffers, sceGnmSubmitAndFlipCommandBuffers and sceGnmSubmitDone into the AGC executor:
    • PS4 EOP, EOS and SURFACE_SYNC packets are lowered to RELEASE_MEM and ACQUIRE_MEM.
    • Constant engine buffers are merged into the draw buffer with their counters.
    • Type-2 filler packets are dropped from both streams.
    • The CP_DMA prefetch of the PS4 SDK is a NOP.
    • The flip goes through AnyPS5's flip packet; an interrupt flip reservation throws.
    • Malformed submissions return GNM_ERROR_SUBMISSION_FAILED_INVALID_ARGUMENT: a null draw buffer, a byte count that is not a multiple of 4, or a constant byte count without a constant buffer.
  • The first submit switches on GcnGuestShaders() through the AGC driver, so a PS4 title's shaders take the GCN decoder.
  • VideoOut registers tiled PS4 display buffers as GCN display buffers with their pitch padded to 128 pixels, also when a set is changed through sceVideoOutSubmitChangeBufferAttribute2, and accepts the PS4 10-bit display format. sceVideoOutCursorSetHotSpot is declared as not implemented (Limbo imports it; main has the other four cursor calls since #6135).
  • sceGnmAreSubmitsAllowed, sceGnmIsUserPaEnabled, sceGnmDriverCaptureInProgress and sceRazorIsLoaded answer for a host without development tools and are listed under Silent stubs, as shadPS4 answers for retail firmware. sceGnmLogicalCuMaskToPhysicalCuMask and sceGnmLogicalCuIndexToPhysicalCuIndex throw: the console's logical-to-physical compute unit mapping is not documented.

Tested

Windows 11, WinLibs GCC 15.2, NVIDIA GeForce RTX 5060 Ti (driver 610.88), on main 7e2ba73e4 with #9430 and #9431:

  • guest_gnm_driver (new) checks:

    • the packets of the default state, compute shader and marker writers, and the sizes they refuse;
    • each rejected submission;
    • that a type-0 packet still throws;
    • a submission whose draw and constant buffers carry type-2 fillers around the constant engine counters and a WRITE_DATA, with the label checked after the GPU is idle.

    With filler handling switched off, it fails with GnmDriver: unsupported PM4 packet type in the draw command buffer.

  • video_out_flip_ps4 registers a tiled PS4 buffer, refuses tiling mode 2, and changes a PS4 set to tiled and back.

  • The full suite of 1,893 tests: 1,886 pass and 4 skip, the same 4 that skip on main (three for device features this GPU lacks, and guest_video_out_wqhd_detection_no_vulkan). The 3 that fail also fail on main 7e2ba73e4 on this machine: agc_driver_sample_order and its --grid-reference and --recipe-depth-locations cases.

  • Limbo (CUSA01664), converted and run with the whole stack on 22 Oct, GPU otherwise idle: a 60 s scripted run from start into gameplay, with no errors and no not-implemented calls. The frames dumped about every 9 s show the save's checkpoint (the gallows and the crate) rendered correctly, with the boy moving the crate between dumps. sceGnmLogicalCuMaskToPhysicalCuMask is imported but not called.

  • Validation layer: ctest -R "^(agc|video_out|shader|recompiler|gcn)" -V with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Vulkan SDK 1.4.363), on main 7e2ba73e4 and on this PR with #9430 and #9431, same machine and GPU. Both builds use -DANYPS5_VIDEO_OUT_TEST_DRIVER=windows, so the 14 VideoOut flip tests get a real display.

    • Neither log reports the layer missing.
    • main: 913 tests; 907 pass, 3 skip and 3 fail (agc_driver_sample_order and its two cases).
    • This PR: the same 913 tests with the same results, plus agc_gcn_decode and agc_driver_gcn_detile, which pass. All 14 flip tests pass on both.
    • Both logs hold the same 50 VUID- errors in the same 8 existing PS5 tests, with the same IDs and counts test for test (agc_driver_prepared_exports, the three agc_driver_sample_order cases and four others). This PR adds none.

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: #9431 (and #9430 through it)
  • Fixes: none
  • Unblocks: Limbo (CUSA01664) #6978
  • GPUs tested: NVIDIA GeForce RTX 5060 Ti, driver 610.88, Windows 11
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4958852484 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9432). Originally posted by [Get-fix](https://github.com/Get-fix) on 2026-10-21T21:51:04Z. --- ### What Part 4 of the PS4 Limbo stack, split out of #6977 (the whole stack is listed in #6978). Only the last four commits are this PR; the ones below them are #9430 and #9431. A real `libSceGnmDriver` for PS4 titles on the AGC executor: - The `sceGnm` shader setters (`sceGnmSetPsShader`, `SetVsShader`, `SetCsShader` and the ES/GS/HS/LS ones), the default hardware state, markers, `sceGnmInsertWaitFlipDone` and the EOP event calls, with the packets, register offsets and reserved sizes of shadPS4's `gnmdriver.cpp` (listed as unverified in `docs/dev/debt/libSceGnmDriver.md`). - `sceGnmSubmitCommandBuffers`, `sceGnmSubmitAndFlipCommandBuffers` and `sceGnmSubmitDone` into the AGC executor: - PS4 EOP, EOS and SURFACE_SYNC packets are lowered to RELEASE_MEM and ACQUIRE_MEM. - Constant engine buffers are merged into the draw buffer with their counters. - Type-2 filler packets are dropped from both streams. - The CP_DMA prefetch of the PS4 SDK is a NOP. - The flip goes through AnyPS5's flip packet; an interrupt flip reservation throws. - Malformed submissions return `GNM_ERROR_SUBMISSION_FAILED_INVALID_ARGUMENT`: a null draw buffer, a byte count that is not a multiple of 4, or a constant byte count without a constant buffer. - The first submit switches on `GcnGuestShaders()` through the AGC driver, so a PS4 title's shaders take the GCN decoder. - VideoOut registers tiled PS4 display buffers as GCN display buffers with their pitch padded to 128 pixels, also when a set is changed through `sceVideoOutSubmitChangeBufferAttribute2`, and accepts the PS4 10-bit display format. `sceVideoOutCursorSetHotSpot` is declared as not implemented (Limbo imports it; `main` has the other four cursor calls since #6135). - `sceGnmAreSubmitsAllowed`, `sceGnmIsUserPaEnabled`, `sceGnmDriverCaptureInProgress` and `sceRazorIsLoaded` answer for a host without development tools and are listed under Silent stubs, as shadPS4 answers for retail firmware. `sceGnmLogicalCuMaskToPhysicalCuMask` and `sceGnmLogicalCuIndexToPhysicalCuIndex` throw: the console's logical-to-physical compute unit mapping is not documented. ### Tested Windows 11, WinLibs GCC 15.2, NVIDIA GeForce RTX 5060 Ti (driver 610.88), on `main` 7e2ba73e4 with #9430 and #9431: - `guest_gnm_driver` (new) checks: - the packets of the default state, compute shader and marker writers, and the sizes they refuse; - each rejected submission; - that a type-0 packet still throws; - a submission whose draw and constant buffers carry type-2 fillers around the constant engine counters and a `WRITE_DATA`, with the label checked after the GPU is idle. With filler handling switched off, it fails with `GnmDriver: unsupported PM4 packet type in the draw command buffer`. - `video_out_flip_ps4` registers a tiled PS4 buffer, refuses tiling mode 2, and changes a PS4 set to tiled and back. - The full suite of 1,893 tests: 1,886 pass and 4 skip, the same 4 that skip on `main` (three for device features this GPU lacks, and `guest_video_out_wqhd_detection_no_vulkan`). The 3 that fail also fail on `main` 7e2ba73e4 on this machine: `agc_driver_sample_order` and its `--grid-reference` and `--recipe-depth-locations` cases. - Limbo (CUSA01664), converted and run with the whole stack on 22 Oct, GPU otherwise idle: a 60 s scripted run from start into gameplay, with no errors and no not-implemented calls. The frames dumped about every 9 s show the save's checkpoint (the gallows and the crate) rendered correctly, with the boy moving the crate between dumps. `sceGnmLogicalCuMaskToPhysicalCuMask` is imported but not called. - Validation layer: `ctest -R "^(agc|video_out|shader|recompiler|gcn)" -V` with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (Vulkan SDK 1.4.363), on `main` 7e2ba73e4 and on this PR with #9430 and #9431, same machine and GPU. Both builds use `-DANYPS5_VIDEO_OUT_TEST_DRIVER=windows`, so the 14 VideoOut flip tests get a real display. - Neither log reports the layer missing. - `main`: 913 tests; 907 pass, 3 skip and 3 fail (`agc_driver_sample_order` and its two cases). - This PR: the same 913 tests with the same results, plus `agc_gcn_decode` and `agc_driver_gcn_detile`, which pass. All 14 flip tests pass on both. - Both logs hold the same 50 `VUID-` errors in the same 8 existing PS5 tests, with the same IDs and counts test for test (`agc_driver_prepared_exports`, the three `agc_driver_sample_order` cases and four others). This PR adds none. ### Checklist - [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: #9431 (and #9430 through it) - [x] Fixes: none - [x] Unblocks: Limbo (CUSA01664) #6978 - [x] GPUs tested: NVIDIA GeForce RTX 5060 Ti, driver 610.88, Windows 11 - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
oneandonlydean commented 2026-10-22 04:27:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-22T04:27:56Z.


@Get-fix I've read #9432's own commit (on top of #9431). The PS5 flip and present path is unchanged: every new branch is behind group.ps4. One thing blocks it:

  • core/libs/prx/libSceVideoOut/tests/Flip.cpp:159-163 (not touched here) still registers a PS4 buffer with tiling_mode = 0 and expects the exception "tiled display buffers are not implemented". This PR removes that throw (Buffer.cpp now throws only for tiling_mode > 1), so video_out_flip_ps4 will fail on every lane. Could you update that test so it expects a tiled PS4 buffer to register, and keep a refused case for tiling_mode > 1?

One more question, not a blocker: libSceGnmDriver/Export.cpp adds about 570 lines of command-buffer writers with no test of their own, so for now Limbo is their only coverage. If a small submit smoke test is easy (build a short command buffer and check the packets it writes), I'd like one. If not, say so and I'll weigh the Limbo evidence instead.

Once the test is fixed, I'll run the full workflow on the new head.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6332704231 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9432#issuecomment-6332704231). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-22T04:27:56Z. --- @Get-fix I've read #9432's own commit (on top of #9431). The PS5 flip and present path is unchanged: every new branch is behind `group.ps4`. One thing blocks it: - `core/libs/prx/libSceVideoOut/tests/Flip.cpp:159-163` (not touched here) still registers a PS4 buffer with `tiling_mode = 0` and expects the exception "tiled display buffers are not implemented". This PR removes that throw (`Buffer.cpp` now throws only for `tiling_mode > 1`), so `video_out_flip_ps4` will fail on every lane. Could you update that test so it expects a tiled PS4 buffer to register, and keep a refused case for `tiling_mode > 1`? One more question, not a blocker: `libSceGnmDriver/Export.cpp` adds about 570 lines of command-buffer writers with no test of their own, so for now Limbo is their only coverage. If a small submit smoke test is easy (build a short command buffer and check the packets it writes), I'd like one. If not, say so and I'll weigh the Limbo evidence instead. Once the test is fixed, I'll run the full workflow on the new head.
MarcZX10 commented 2026-10-22 04:47:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T04:47:36Z.

Review: CHANGES_REQUESTED


The reported Limbo run and paired Vulkan validation are useful evidence, and the PR correctly records several unverified areas as technical debt. I found a generic command-buffer case that the new parser rejects, plus validation/evidence gaps that should be addressed before merge:

  1. PacketAt rejects every packet whose type is not 3. AMD's Southern Islands programming guide defines type-2 as a one-dword filler packet used to consume unused trailing allocation space, and also permits it in command streams (see PM4 §2.1.3 and §2.1.6, pp. 12–13). A valid PS4 DCB or CCB containing this standard padding will throw before submission. Please accept and preserve/skip type-2 filler packets, and add a command-buffer regression covering one in both the draw and constant streams.

  2. CheckSubmission validates array pointers and byte limits, but not each DCB/CCB element or dword alignment. A nonzero DCB length with dcbs[i] == nullptr reaches PacketAt and dereferences null; a byte length not divisible by four is silently truncated by / 4. Please reject these malformed entries before parsing and cover them with tests. Also make a nonzero CCB length with a null CCB pointer an explicit invalid-argument result rather than silently treating it as an absent CCB.

  3. sceGnmLogicalCuMaskToPhysicalCuMask ignores its GPU argument and returns the logical mask unchanged, but this behavior has no evidence or technical-debt entry. Under the repository rule that a function must implement its behavior or throw, please provide evidence/tests for this mapping or leave it as a throwing unimplemented path with the relevant debt recorded.

  4. The PR comparison is 534 commits behind current main; the described test baseline is cecb540a6. Please rebase onto current main and rerun the affected AGC/shader/VideoOut focused tests with the repository-required validation-layer environment on both main and the change, then refresh conventions, intake, and overlap checks. The current reported paired runs are thorough for that older baseline, but do not validate the current base.

Hosted conventions, eligibility, intake, labels, and report checks pass. Product Linux/Windows and relinker jobs are skipped. I did not run these tests locally because no matching PR checkout/build is available; the existing full /tmp build belongs to a different change.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5609382793 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9432#pullrequestreview-5609382793). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T04:47:36Z. **Review:** CHANGES_REQUESTED --- The reported Limbo run and paired Vulkan validation are useful evidence, and the PR correctly records several unverified areas as technical debt. I found a generic command-buffer case that the new parser rejects, plus validation/evidence gaps that should be addressed before merge: 1. `PacketAt` rejects every packet whose type is not 3. AMD's Southern Islands programming guide defines type-2 as a one-dword filler packet used to consume unused trailing allocation space, and also permits it in command streams (see [PM4 §2.1.3 and §2.1.6](https://www.x.org/docs/AMD/old/si_programming_guide_v2.pdf), pp. 12–13). A valid PS4 DCB or CCB containing this standard padding will throw before submission. Please accept and preserve/skip type-2 filler packets, and add a command-buffer regression covering one in both the draw and constant streams. 2. `CheckSubmission` validates array pointers and byte limits, but not each DCB/CCB element or dword alignment. A nonzero DCB length with `dcbs[i] == nullptr` reaches `PacketAt` and dereferences null; a byte length not divisible by four is silently truncated by `/ 4`. Please reject these malformed entries before parsing and cover them with tests. Also make a nonzero CCB length with a null CCB pointer an explicit invalid-argument result rather than silently treating it as an absent CCB. 3. `sceGnmLogicalCuMaskToPhysicalCuMask` ignores its GPU argument and returns the logical mask unchanged, but this behavior has no evidence or technical-debt entry. Under the repository rule that a function must implement its behavior or throw, please provide evidence/tests for this mapping or leave it as a throwing unimplemented path with the relevant debt recorded. 4. The PR comparison is 534 commits behind current `main`; the described test baseline is `cecb540a6`. Please rebase onto current `main` and rerun the affected AGC/shader/VideoOut focused tests with the repository-required validation-layer environment on both `main` and the change, then refresh conventions, intake, and overlap checks. The current reported paired runs are thorough for that older baseline, but do not validate the current base. Hosted conventions, eligibility, intake, labels, and report checks pass. Product Linux/Windows and relinker jobs are skipped. I did not run these tests locally because no matching PR checkout/build is available; the existing full `/tmp` build belongs to a different change.
Get-fix commented 2026-10-22 11:06:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Get-fix on 2026-10-22T11:06:53Z.


@oneandonlydean @MarcZX10 thanks for the reviews. Rebased onto main 7e2ba73e4 with three new commits on top of the original one:

video_out_flip_ps4 (f2928f44d): the test now registers a PS4 buffer with tiling mode 0 and checks it is described as a GCN display buffer with its pitch padded to 128 pixels, and it keeps a refused case for tiling mode 2 (VIDEO_OUT_ERROR_INVALID_TILING_MODE). The rerun also showed that the test's earlier step, which changes a PS4 set to tiling mode 0 through sceVideoOutSubmitChangeBufferAttribute2, failed with this PR: the changed set kept a PS4 pitch of 0. sceVideoOutSubmitChangeBufferAttribute2 now computes the same padded pitch as the registration, and the test changes the set to tiled, checks it, and changes it back to linear.

Type-2 filler packets (057384487): a type-2 dword in the draw or constant command buffer is dropped instead of throwing, per the SI guide sections you linked. @ntamas94 did the same in #9676 first, so they are credited as co-author.

Malformed submissions (same commit): a null dcbs[i], a draw or constant byte count that is not a multiple of 4, and a nonzero constant byte count with a null constant buffer pointer or array now return GNM_ERROR_SUBMISSION_FAILED_INVALID_ARGUMENT before any packet is read. A zero constant byte count without a constant buffer array is accepted as no constant buffer.

Smoke test (same commit): the new guest_gnm_driver checks:

  • the packets the default state, compute shader and marker writers emit, and the sizes they refuse;
  • every rejected submission above;
  • that a type-0 packet still throws;
  • a submission whose draw and constant buffers carry filler packets around the constant engine counters and a WRITE_DATA, with the label checked after AgcDriverWaitIdle;
  • a second submission with a zero-sized constant buffer.

With filler handling switched off, it fails with GnmDriver: unsupported PM4 packet type in the draw command buffer.

sceGnmLogicalCuMaskToPhysicalCuMask (e2ad553d7): it now throws like sceGnmLogicalCuIndexToPhysicalCuIndex, and both are listed in docs/dev/debt/libSceGnmDriver.md. The console maps logical to physical compute units by the units disabled on its GPU, and I have no evidence of that mapping; shadPS4's identity answer isn't evidence either. Limbo imports the function but did not call it in a 60 s run from start to gameplay.

The tests, the paired validation-layer runs and the Limbo run on the new base are in the description.

AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6339234832 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9432#issuecomment-6339234832). Originally posted by [Get-fix](https://github.com/Get-fix) on 2026-10-22T11:06:53Z. --- @oneandonlydean @MarcZX10 thanks for the reviews. Rebased onto `main` 7e2ba73e4 with three new commits on top of the original one: **`video_out_flip_ps4`** (f2928f44d): the test now registers a PS4 buffer with tiling mode 0 and checks it is described as a GCN display buffer with its pitch padded to 128 pixels, and it keeps a refused case for tiling mode 2 (`VIDEO_OUT_ERROR_INVALID_TILING_MODE`). The rerun also showed that the test's earlier step, which changes a PS4 set to tiling mode 0 through `sceVideoOutSubmitChangeBufferAttribute2`, failed with this PR: the changed set kept a PS4 pitch of 0. `sceVideoOutSubmitChangeBufferAttribute2` now computes the same padded pitch as the registration, and the test changes the set to tiled, checks it, and changes it back to linear. **Type-2 filler packets** (057384487): a type-2 dword in the draw or constant command buffer is dropped instead of throwing, per the SI guide sections you linked. @ntamas94 did the same in #9676 first, so they are credited as co-author. **Malformed submissions** (same commit): a null `dcbs[i]`, a draw or constant byte count that is not a multiple of 4, and a nonzero constant byte count with a null constant buffer pointer or array now return `GNM_ERROR_SUBMISSION_FAILED_INVALID_ARGUMENT` before any packet is read. A zero constant byte count without a constant buffer array is accepted as no constant buffer. **Smoke test** (same commit): the new `guest_gnm_driver` checks: - the packets the default state, compute shader and marker writers emit, and the sizes they refuse; - every rejected submission above; - that a type-0 packet still throws; - a submission whose draw and constant buffers carry filler packets around the constant engine counters and a `WRITE_DATA`, with the label checked after `AgcDriverWaitIdle`; - a second submission with a zero-sized constant buffer. With filler handling switched off, it fails with `GnmDriver: unsupported PM4 packet type in the draw command buffer`. **`sceGnmLogicalCuMaskToPhysicalCuMask`** (e2ad553d7): it now throws like `sceGnmLogicalCuIndexToPhysicalCuIndex`, and both are listed in `docs/dev/debt/libSceGnmDriver.md`. The console maps logical to physical compute units by the units disabled on its GPU, and I have no evidence of that mapping; shadPS4's identity answer isn't evidence either. Limbo imports the function but did not call it in a 60 s run from start to gameplay. The tests, the paired validation-layer runs and the Limbo run on the new base are in the description. AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-29 09:59:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T09:59:37Z.

Review: DISMISSED


Re-review — changes requested

The new head addresses the earlier concrete findings: the PS4 video_out_flip_ps4 case now expects tiling mode 0 to register with the padded GCN pitch and retains a rejected mode-2 case; the tiled sceVideoOutSubmitChangeBufferAttribute2 path also updates its pitch. The PR adds a guest_gnm_driver smoke test, handles type-2 filler packets in draw and constant streams, and rejects malformed DCB/CCB submissions before parsing. BunnyFl’s firmware disassembly report supplies direct support for the CU-mask identity behavior and records the observed engine limits.

The current-main integration is now the blocker. I refreshed upstream main to f7e84c4cf1609cc10bac95a44cd431805e5ebc8a and checked exact head f2928f44d427ff146e00b80683785feabdb5a16e. tools/check_main_sync.py reports six conflicts, including GuestTextureResource.hpp, State.hpp, DepthSurface.cpp, State.cpp, libSceVideoOut/tests/Flip.cpp, and docs/dev/debt/libSceVideoOut.md; 38 paths changed on both sides since merge base a13d01bcc. The reported validation/tests are from the older 7e2ba73e4 integration and do not cover these combined paths.

Please reconcile current main, preserving this PR’s PS4 GNM behavior and regression cases alongside the newer texture, state, and VideoOut changes. Then rerun the focused GNM submission, GCN texture/mip, and VideoOut flip tests with Vulkan validation where applicable. The current merge preview has conflicts; git diff --check passes. Hosted product jobs are skipped, and I did not run the GPU tests locally.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5695893125 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9432#pullrequestreview-5695893125). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T09:59:37Z. **Review:** DISMISSED --- # Re-review — changes requested The new head addresses the earlier concrete findings: the PS4 `video_out_flip_ps4` case now expects tiling mode 0 to register with the padded GCN pitch and retains a rejected mode-2 case; the tiled `sceVideoOutSubmitChangeBufferAttribute2` path also updates its pitch. The PR adds a `guest_gnm_driver` smoke test, handles type-2 filler packets in draw and constant streams, and rejects malformed DCB/CCB submissions before parsing. BunnyFl’s firmware disassembly report supplies direct support for the CU-mask identity behavior and records the observed engine limits. The current-main integration is now the blocker. I refreshed upstream `main` to `f7e84c4cf1609cc10bac95a44cd431805e5ebc8a` and checked exact head `f2928f44d427ff146e00b80683785feabdb5a16e`. `tools/check_main_sync.py` reports six conflicts, including `GuestTextureResource.hpp`, `State.hpp`, `DepthSurface.cpp`, `State.cpp`, `libSceVideoOut/tests/Flip.cpp`, and `docs/dev/debt/libSceVideoOut.md`; 38 paths changed on both sides since merge base `a13d01bcc`. The reported validation/tests are from the older `7e2ba73e4` integration and do not cover these combined paths. Please reconcile current `main`, preserving this PR’s PS4 GNM behavior and regression cases alongside the newer texture, state, and VideoOut changes. Then rerun the focused GNM submission, GCN texture/mip, and VideoOut flip tests with Vulkan validation where applicable. The current merge preview has conflicts; `git diff --check` passes. Hosted product jobs are skipped, and I did not run the GPU tests locally.
XairRrR commented 2026-11-03 22:41:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T22:41:20Z.

Review: DISMISSED


Reviewed — changes requested

The merge with main builds and guest_gnm_driver passes (it also fails when filler handling is switched off), but public_headers fails on the merged tree because libSceGnmDriver has no umbrella header.

What I ran

Head 328a2bca8536896dd8354354429a869c4fab9b36, main 1c8c0efc8c41314402e6966da5bef6ea3d639d10, merged tree 8499d4beb959b79e94e11165ca79428fd2a8ad60 (Release, GCC 14.2.0, Ninja, Debian 13 VM, lavapipe Mesa 26.1.6).

git diff --check 1c8c0efc8c41314402e6966da5bef6ea3d639d10...328a2bca8536896dd8354354429a869c4fab9b36
python3 tools/check_conventions.py --base 1c8c0efc8c41314402e6966da5bef6ea3d639d10
ctest --test-dir build -j4 --output-on-failure -R "^(guest_gnm_driver|video_out_flip_ps4|public_headers|guest_gnm_neo_.*)$"
ctest --test-dir build -V -R "^(video_out_flip_ps4|guest_gnm_driver)$"
# negative control 1: IsFiller() made to return false in libSceGnmDriver/Export.cpp
ninja -C build guest_gnm_driver_tests
ctest --test-dir build --output-on-failure -R "^guest_gnm_driver$"
# restored from the merged tree, rebuilt, reran
# VUID attribution: the four PR VideoOut production files restored from main
ninja -C build agc_driver_image_gather_volume_tests
env VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build -V -R "^agc_driver_image_gather_volume$"
# restored from the merged tree, rebuilt
git status --porcelain

Results

Check Result
git diff --check clean
check_conventions.py All conventions checks passed
Build and libs (script) OK
guest_gnm_driver Passed (0.03 s)
guest_gnm_neo_* (6 tests, same area on main) Passed
public_headers Failed: new failure, not in the main baseline
video_out_flip_ps4 Skipped: no display or Vulkan surface under SDL_VIDEODRIVER=offscreen on this machine
Validation layer (script, 51 tests) Layer loaded in all 51. The only new_vuid entry is agc_driver_image_gather_volume, which was not in the older baseline. It comes from main (see below)
git status --porcelain after the controls empty
public_headers
  File "core/libs/tests/test_public_headers.py", line 111, in audit
    raise RuntimeError("Missing library umbrella headers: " + ", ".join(missing))
RuntimeError: Missing library umbrella headers: core/libs/prx/libSceGnmDriver/libSceGnmDriver.hpp
agc_driver_image_gather_volume with the PR's VideoOut files restored from main
      2 VUID-VkSamplerCreateInfo-addressModeU-01079
      2 VUID-VkSamplerCreateInfo-addressModeU-parameter
      2 VUID-VkSamplerCreateInfo-addressModeV-parameter
      2 VUID-VkSamplerCreateInfo-addressModeW-parameter

These are the same 8 lines the script reports for the merged tree. The PR changes no libSceAgcDriver file, and a main commit after the baseline SHA touches this test. So these VUIDs come from main and are not a finding here.

Negative control

  • Filler handling: I made IsFiller in core/libs/prx/libSceGnmDriver/Export.cpp return false and rebuilt. guest_gnm_driver then failed with GnmDriver: unsupported PM4 packet type in the draw command buffer, as the description says. I restored the merged file, rebuilt, and the test passed again.
  • VideoOut: I also restored the four VideoOut production files from main, but only for the VUID attribution above. I could not use them as a control for the changed video_out_flip_ps4, because that test skips on this machine.

Findings

Blocking

  1. public_headers fails on the merged tree. core/libs/prx/libSceGnmDriver has no libSceGnmDriver.hpp and no header declaring its 45 APS5_VABI exports. Also, core/libs/tests/GuestGnmDriver.cpp:12-22 declares eight exports locally, which CONTRIBUTING.md forbids. ntamas94 and oneandonlydean already reported this; I confirm it with the test output above on the current merge. The merge commit 328a2bca85 brought in main but not the fix. Suggested fix: add the umbrella header and include/Api.hpp with every export (for example by cherry-picking 108fd28b0e as offered), include it from Export.cpp and the test, drop the local declarations, and declare sceVideoOutCursorSetHotSpot in a VideoOut header if the check requires it.

Non-blocking

  1. A VideoOut debt entry is now stale. docs/dev/debt/libSceVideoOut.md:35 still says that the PS4 sceVideoOutRegisterBuffers "accepts only linear A8R8G8B8_SRGB (0x80000000) and A8B8G8R8_SRGB (0x80002200)" and that "tiled PS4 buffers throw". This PR makes tiling mode 0 register and adds 0x88000000 (Buffer.cpp:87). Per the documentation rule, cut that entry to what is still open instead of only adding a new one on line 36.
  2. The 10-bit PS4 format has no test and no recorded source. The mapping 0x88000000 → 0x8100000000000000 is not exercised by video_out_flip_ps4, and nothing records where the PS5 value comes from. Add a registration case to the flip test, and either name the source or note it as unverified in the debt entry.
  3. The CU mapping debt entry is outdated by the discussion. docs/dev/debt/libSceGnmDriver.md:11 says the mapping "is not documented" and that the identity answer is not evidence. BunnyFl's comment reports that firmware 13.42's module returns the mask unchanged and range-checks the index without a table. Keeping the throws is acceptable, as oneandonlydean noted, but the entry should state that firmware evidence and why it is not used.
  4. The test timeout is above the 30 s rule without a reason. core/libs/prx/libSceGnmDriver/CMakeLists.txt:12 sets TIMEOUT 60 for a test that runs in 0.03 s here. CONTRIBUTING.md asks for tests to finish in 30 s and not to raise timeouts. Drop the property or lower it.

Not verified

  • video_out_flip_ps4 skipped on this machine (no display or Vulkan surface under the offscreen SDL driver). So the new tiled-registration and attribute-change checks, and the sceVideoOutSubmitChangeBufferAttribute2 pitch fix, were neither run nor negative-controlled here.
  • I did not exercise the submit-and-flip path (PatchFlip) or the EOP, EOS and SURFACE_SYNC lowering: guest_gnm_driver covers neither.
  • I did not check the PM4 field layouts of the lowered RELEASE_MEM and ACQUIRE_MEM against the AGC executor's parser beyond reading the code.
  • I did not repeat the Limbo run or any test on non-lavapipe GPUs.

To get this to a good state

  1. Add the libSceGnmDriver umbrella header and its export declarations, remove the local declarations from GuestGnmDriver.cpp, and confirm public_headers (and its compile batches) pass on a merge with current main.
  2. Optionally address the non-blocking items: update the stale VideoOut debt entry, cover the 10-bit format, refresh the CU-mapping debt wording, and drop the 60 s timeout.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5760517371 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9432#pullrequestreview-5760517371). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T22:41:20Z. **Review:** DISMISSED --- # Reviewed — changes requested The merge with `main` builds and `guest_gnm_driver` passes (it also fails when filler handling is switched off), but `public_headers` fails on the merged tree because `libSceGnmDriver` has no umbrella header. ## What I ran Head `328a2bca8536896dd8354354429a869c4fab9b36`, `main` `1c8c0efc8c41314402e6966da5bef6ea3d639d10`, merged tree `8499d4beb959b79e94e11165ca79428fd2a8ad60` (Release, GCC 14.2.0, Ninja, Debian 13 VM, lavapipe Mesa 26.1.6). ``` git diff --check 1c8c0efc8c41314402e6966da5bef6ea3d639d10...328a2bca8536896dd8354354429a869c4fab9b36 python3 tools/check_conventions.py --base 1c8c0efc8c41314402e6966da5bef6ea3d639d10 ctest --test-dir build -j4 --output-on-failure -R "^(guest_gnm_driver|video_out_flip_ps4|public_headers|guest_gnm_neo_.*)$" ctest --test-dir build -V -R "^(video_out_flip_ps4|guest_gnm_driver)$" # negative control 1: IsFiller() made to return false in libSceGnmDriver/Export.cpp ninja -C build guest_gnm_driver_tests ctest --test-dir build --output-on-failure -R "^guest_gnm_driver$" # restored from the merged tree, rebuilt, reran # VUID attribution: the four PR VideoOut production files restored from main ninja -C build agc_driver_image_gather_volume_tests env VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build -V -R "^agc_driver_image_gather_volume$" # restored from the merged tree, rebuilt git status --porcelain ``` ## Results | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | All conventions checks passed | | Build and `libs` (script) | OK | | `guest_gnm_driver` | Passed (0.03 s) | | `guest_gnm_neo_*` (6 tests, same area on `main`) | Passed | | `public_headers` | **Failed**: new failure, not in the `main` baseline | | `video_out_flip_ps4` | Skipped: no display or Vulkan surface under `SDL_VIDEODRIVER=offscreen` on this machine | | Validation layer (script, 51 tests) | Layer loaded in all 51. The only `new_vuid` entry is `agc_driver_image_gather_volume`, which was not in the older baseline. It comes from `main` (see below) | | `git status --porcelain` after the controls | empty | <details><summary>public_headers</summary> ``` File "core/libs/tests/test_public_headers.py", line 111, in audit raise RuntimeError("Missing library umbrella headers: " + ", ".join(missing)) RuntimeError: Missing library umbrella headers: core/libs/prx/libSceGnmDriver/libSceGnmDriver.hpp ``` </details> <details><summary>agc_driver_image_gather_volume with the PR's VideoOut files restored from main</summary> ``` 2 VUID-VkSamplerCreateInfo-addressModeU-01079 2 VUID-VkSamplerCreateInfo-addressModeU-parameter 2 VUID-VkSamplerCreateInfo-addressModeV-parameter 2 VUID-VkSamplerCreateInfo-addressModeW-parameter ``` These are the same 8 lines the script reports for the merged tree. The PR changes no `libSceAgcDriver` file, and a `main` commit after the baseline SHA touches this test. So these VUIDs come from `main` and are not a finding here. </details> ## Negative control - **Filler handling:** I made `IsFiller` in `core/libs/prx/libSceGnmDriver/Export.cpp` return `false` and rebuilt. `guest_gnm_driver` then failed with `GnmDriver: unsupported PM4 packet type in the draw command buffer`, as the description says. I restored the merged file, rebuilt, and the test passed again. - **VideoOut:** I also restored the four VideoOut production files from `main`, but only for the VUID attribution above. I could not use them as a control for the changed `video_out_flip_ps4`, because that test skips on this machine. ## Findings ### Blocking 1. **`public_headers` fails on the merged tree.** [core/libs/prx/libSceGnmDriver](https://github.com/boykopovar/AnyPS5/tree/328a2bca8536896dd8354354429a869c4fab9b36/core/libs/prx/libSceGnmDriver) has no `libSceGnmDriver.hpp` and no header declaring its 45 `APS5_VABI` exports. Also, [core/libs/tests/GuestGnmDriver.cpp:12-22](https://github.com/boykopovar/AnyPS5/blob/328a2bca8536896dd8354354429a869c4fab9b36/core/libs/tests/GuestGnmDriver.cpp#L12-L22) declares eight exports locally, which CONTRIBUTING.md forbids. ntamas94 and oneandonlydean already reported this; I confirm it with the test output above on the current merge. The merge commit `328a2bca85` brought in `main` but not the fix. Suggested fix: add the umbrella header and `include/Api.hpp` with every export (for example by cherry-picking `108fd28b0e` as offered), include it from `Export.cpp` and the test, drop the local declarations, and declare `sceVideoOutCursorSetHotSpot` in a VideoOut header if the check requires it. ### Non-blocking 1. **A VideoOut debt entry is now stale.** [docs/dev/debt/libSceVideoOut.md:35](https://github.com/boykopovar/AnyPS5/blob/328a2bca8536896dd8354354429a869c4fab9b36/docs/dev/debt/libSceVideoOut.md#L35) still says that the PS4 `sceVideoOutRegisterBuffers` "accepts only linear A8R8G8B8_SRGB (0x80000000) and A8B8G8R8_SRGB (0x80002200)" and that "tiled PS4 buffers throw". This PR makes tiling mode 0 register and adds 0x88000000 ([Buffer.cpp:87](https://github.com/boykopovar/AnyPS5/blob/328a2bca8536896dd8354354429a869c4fab9b36/core/libs/prx/libSceVideoOut/src/Buffer.cpp#L87)). Per the documentation rule, cut that entry to what is still open instead of only adding a new one on line 36. 2. **The 10-bit PS4 format has no test and no recorded source.** The mapping `0x88000000 → 0x8100000000000000` is not exercised by `video_out_flip_ps4`, and nothing records where the PS5 value comes from. Add a registration case to the flip test, and either name the source or note it as unverified in the debt entry. 3. **The CU mapping debt entry is outdated by the discussion.** [docs/dev/debt/libSceGnmDriver.md:11](https://github.com/boykopovar/AnyPS5/blob/328a2bca8536896dd8354354429a869c4fab9b36/docs/dev/debt/libSceGnmDriver.md#L11) says the mapping "is not documented" and that the identity answer is not evidence. BunnyFl's comment reports that firmware 13.42's module returns the mask unchanged and range-checks the index without a table. Keeping the throws is acceptable, as oneandonlydean noted, but the entry should state that firmware evidence and why it is not used. 4. **The test timeout is above the 30 s rule without a reason.** [core/libs/prx/libSceGnmDriver/CMakeLists.txt:12](https://github.com/boykopovar/AnyPS5/blob/328a2bca8536896dd8354354429a869c4fab9b36/core/libs/prx/libSceGnmDriver/CMakeLists.txt#L12) sets `TIMEOUT 60` for a test that runs in 0.03 s here. CONTRIBUTING.md asks for tests to finish in 30 s and not to raise timeouts. Drop the property or lower it. ## Not verified - `video_out_flip_ps4` skipped on this machine (no display or Vulkan surface under the offscreen SDL driver). So the new tiled-registration and attribute-change checks, and the `sceVideoOutSubmitChangeBufferAttribute2` pitch fix, were neither run nor negative-controlled here. - I did not exercise the submit-and-flip path (`PatchFlip`) or the EOP, EOS and SURFACE_SYNC lowering: `guest_gnm_driver` covers neither. - I did not check the PM4 field layouts of the lowered RELEASE_MEM and ACQUIRE_MEM against the AGC executor's parser beyond reading the code. - I did not repeat the Limbo run or any test on non-lavapipe GPUs. ## To get this to a good state 1. Add the `libSceGnmDriver` umbrella header and its export declarations, remove the local declarations from `GuestGnmDriver.cpp`, and confirm `public_headers` (and its compile batches) pass on a merge with current `main`. 2. Optionally address the non-blocking items: update the stale VideoOut debt entry, cover the 10-bit format, refresh the CU-mapping debt wording, and drop the 60 s timeout. <!-- anyps5-bots job=3669 head=328a2bca8536896dd8354354429a869c4fab9b36 -->
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!9432
No description provided.