feat(ps4): Ajm batch buffer, GCN (Gnm/Agc) command buffers and shaders, Limbo imports, FW 10.71 corroboration #12967

Closed
ntamas94 wants to merge 63 commits from upstream-pr/12967 into main
ntamas94 commented 2026-10-29 17:44:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ntamas94 on 2026-10-29T17:44:03Z.


What

PS4 bring-up work, assembled from several integration branches. This is a multi-topic integration branch, not a single-topic PR (see the checklist); it also carries merges of the dependency PRs it is built on. Main areas:

  • libSceAjm PS4 batch buffer — run PS4 batch-buffer jobs in the console's chunk layout (ConsoleChunkKind: a 4-bit kind plus the buffer-direction bit, not 6 bits), the *BufferRa builders and sceAjmBatchStartBuffer, null / zero-size batch handling, ATRAC9 run results (which side ran out, exact fit, bitrate) and single-frame decode without RUN_MULTIPLE_FRAMES; sceAjmBatchJobInlineBuffer.
  • PS4 GCN command buffers — libSceGnmDriver builds and submits PS4 command buffers; libSceAgcDriver draws PS4 (GCN) command buffers; PM4 filler-packet skipping and malformed-submission rejection.
  • PS4 GCN shaders — decode PS4 (GCN) shaders by re-encoding them to RDNA.
  • Limbo imports — PS4 NpTrophy, save data v1, NpWebApi offline and the title's other imports.
  • relinker / libkernel — guest TLS relocations against the module's own section symbol, jump tables placed after a function's code; read param.sfo when param.json is absent, and load system libraries from their console paths.
  • FW 10.71 firmware corroboration (docs) — the decrypted PS4 firmware 10.71 system libraries confirm or correct several debt entries: the libSceAjm batch header encoding and its /dev/ajm ioctls (0xC0288907/8/9), libSceVideoOut sceVideoOutSetFlipRate delegating the rate to the DCE driver (vaddr 0xbde0), libSceAudioOut sceAudioOutGetLastOutputTime returning a stored per-port timestamp (vaddr 0x2aa0), and a libSceNgs2 correction — the public voice getters return 0x804A03xx codes (0x804A0300 invalid voice, 0x804A0053 null output) and validate output before resolving the voice, not the native 0x804A82xx codes / voice-first order.

Tested

Windows run of this head (8046c90d61), merged onto main bb04a4f1ea (clean merge, local only). Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, WinLibs GCC 15.2.0 UCRT r7, Ninja, Release, BUILD_TESTING=ON, no Vulkan driver visible.

  • This PR: all 5 ctest entries of this PR's test executables (agc_driver_flip, agc_driver_flip_compute, agc_driver_present_mode, agc_driver_worker_failure_log, guest_gnm_driver and 0 more) pass 3 of 3 (ctest --repeat until-fail:3).
  • Negative control: not possible. With this PR's source files (core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp, core/libs/prx/libSceGnmDriver/Export.cpp, core/libs/prx/libSceVideoOut/Unimplemented.cpp, core/libs/prx/libSceVideoOut/include/Buffer.hpp, core/libs/prx/libSceVideoOut/include/VideoOutDriver.hpp, core/libs/prx/libSceVideoOut/src/Buffer.cpp) put back to main's version, and the ones it adds removed, the build fails against the rest of the PR, so there is no source-only control.

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
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5072849940 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12967). Originally posted by [ntamas94](https://github.com/ntamas94) on 2026-10-29T17:44:03Z. --- ### What PS4 bring-up work, assembled from several integration branches. **This is a multi-topic integration branch, not a single-topic PR** (see the checklist); it also carries merges of the dependency PRs it is built on. Main areas: - **libSceAjm PS4 batch buffer** — run PS4 batch-buffer jobs in the console's chunk layout (`ConsoleChunkKind`: a 4-bit kind plus the buffer-direction bit, not 6 bits), the `*BufferRa` builders and `sceAjmBatchStartBuffer`, null / zero-size batch handling, ATRAC9 run results (which side ran out, exact fit, bitrate) and single-frame decode without `RUN_MULTIPLE_FRAMES`; `sceAjmBatchJobInlineBuffer`. - **PS4 GCN command buffers** — libSceGnmDriver builds and submits PS4 command buffers; libSceAgcDriver draws PS4 (GCN) command buffers; PM4 filler-packet skipping and malformed-submission rejection. - **PS4 GCN shaders** — decode PS4 (GCN) shaders by re-encoding them to RDNA. - **Limbo imports** — PS4 NpTrophy, save data v1, NpWebApi offline and the title's other imports. - **relinker / libkernel** — guest TLS relocations against the module's own section symbol, jump tables placed after a function's code; read `param.sfo` when `param.json` is absent, and load system libraries from their console paths. - **FW 10.71 firmware corroboration (docs)** — the decrypted PS4 firmware 10.71 system libraries confirm or correct several debt entries: the libSceAjm batch header encoding and its `/dev/ajm` ioctls (`0xC0288907/8/9`), libSceVideoOut `sceVideoOutSetFlipRate` delegating the rate to the DCE driver (`vaddr 0xbde0`), libSceAudioOut `sceAudioOutGetLastOutputTime` returning a stored per-port timestamp (`vaddr 0x2aa0`), and a libSceNgs2 correction — the public voice getters return `0x804A03xx` codes (`0x804A0300` invalid voice, `0x804A0053` null output) and validate output before resolving the voice, not the native `0x804A82xx` codes / voice-first order. ### Tested Windows run of this head (`8046c90d61`), merged onto `main` `bb04a4f1ea` (clean merge, local only). Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, WinLibs GCC 15.2.0 UCRT r7, Ninja, Release, `BUILD_TESTING=ON`, no Vulkan driver visible. - This PR: all 5 ctest entries of this PR's test executables (`agc_driver_flip`, `agc_driver_flip_compute`, `agc_driver_present_mode`, `agc_driver_worker_failure_log`, `guest_gnm_driver` and 0 more) pass 3 of 3 (`ctest --repeat until-fail:3`). - Negative control: not possible. With this PR's source files (`core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp`, `core/libs/prx/libSceGnmDriver/Export.cpp`, `core/libs/prx/libSceVideoOut/Unimplemented.cpp`, `core/libs/prx/libSceVideoOut/include/Buffer.hpp`, `core/libs/prx/libSceVideoOut/include/VideoOutDriver.hpp`, `core/libs/prx/libSceVideoOut/src/Buffer.cpp`) put back to `main`'s version, and the ones it adds removed, the build fails against the rest of the PR, so there is no source-only control. ### 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 - [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: none - [x] GPUs tested: n/a - [x] AI-assisted: yes

Pull request closed

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!12967
No description provided.