feat(libSceAgc): implement ACB flips and rendering waits #1585

Closed
EdouardSence wants to merge 1 commit from upstream-pr/1585 into main
EdouardSence commented 2026-10-08 13:43:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-08T13:43:39Z.


What

Implements sceAgcAcbSetFlip and sceAgcAcbWaitUntilSafeForRendering. They write the same packets as their DCB counterparts, sceAgcDcbSetFlip and sceAgcDcbWaitUntilSafeForRendering. Both are the driver's flip (NOP 0x17) and rendering wait (NOP 0x06) packets.

The signatures match the existing declarations and SharpProspero: (buffer, videoOutHandle, displayBufferIndex, flipMode, flipArg) and (buffer, videoOutHandle, displayBufferIndex).

Driver change: Pm4.cpp rejected both packets outside queue 0 ("graphics packet in compute queue"). They are now accepted on compute queues. Everything they need runs through the same Submit path for every queue:

  • waitForFlipRoom and reserveOutputs at submit time.
  • The flip and rendering wait execution in PacketExecution.cpp.

Library progress: +2.

Tested

Linux (CachyOS, GCC), RX 9070 XT:

  • agc_driver_flip: the old check expected a flip on queue 0x20 to throw. It is replaced by a positive case: a rendering wait followed by a flip, submitted with sceAgcDriverSubmitAcb(0x20, ...). The test checks that the output captured the wait for the right buffer and presented the flip. The test output now implements CaptureRenderingWait.
  • agc_commands: the ACB packets match the expected words and the DCB flip byte for byte.
  • Full ctest: 458/458.
  • tools/check_conventions.py passes.

Not tested in a title. Astro Bot (PPSA21567), the only title I have, does not import either function. I checked its import NIDs.

The order between a compute-queue flip and graphics work submitted on other queues is left to the title's own synchronization, as for any cross-queue dependency.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes. The code, tests and this description were written by Claude (Claude Code) on my machine.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4787725911 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1585). Originally posted by [EdouardSence](https://github.com/EdouardSence) on 2026-10-08T13:43:39Z. --- ### What Implements `sceAgcAcbSetFlip` and `sceAgcAcbWaitUntilSafeForRendering`. They write the same packets as their DCB counterparts, `sceAgcDcbSetFlip` and `sceAgcDcbWaitUntilSafeForRendering`. Both are the driver's flip (NOP 0x17) and rendering wait (NOP 0x06) packets. The signatures match the existing declarations and [SharpProspero](https://github.com/SvenGDK/SharpProspero/blob/main/src/SharpProspero/Interop/Agc/SceAgc.cs): `(buffer, videoOutHandle, displayBufferIndex, flipMode, flipArg)` and `(buffer, videoOutHandle, displayBufferIndex)`. **Driver change:** `Pm4.cpp` rejected both packets outside queue 0 ("graphics packet in compute queue"). They are now accepted on compute queues. Everything they need runs through the same `Submit` path for every queue: - `waitForFlipRoom` and `reserveOutputs` at submit time. - The flip and rendering wait execution in `PacketExecution.cpp`. Library progress: +2. ### Tested Linux (CachyOS, GCC), RX 9070 XT: - **`agc_driver_flip`:** the old check expected a flip on queue 0x20 to throw. It is replaced by a positive case: a rendering wait followed by a flip, submitted with `sceAgcDriverSubmitAcb(0x20, ...)`. The test checks that the output captured the wait for the right buffer and presented the flip. The test output now implements `CaptureRenderingWait`. - **`agc_commands`:** the ACB packets match the expected words and the DCB flip byte for byte. - **Full `ctest`:** 458/458. - `tools/check_conventions.py` passes. Not tested in a title. Astro Bot (PPSA21567), the only title I have, does not import either function. I checked its import NIDs. The order between a compute-queue flip and graphics work submitted on other queues is left to the title's own synchronization, as for any cross-queue dependency. ### 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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes. The code, tests and this description were written by Claude (Claude Code) on my machine. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-08 13:58:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T13:58:29Z.


Progress report (033a463 → 60f44b7)

📈 System libraries: 84.84% (+0.07%, +2 implemented functions)

✅ 2 implemented
Library Name
libSceAgc sceAgcAcbSetFlip
libSceAgc sceAgcAcbWaitUntilSafeForRendering
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6061497883 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1585#issuecomment-6061497883). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-08T13:58:29Z. --- <!-- progress-report --> ### Progress report (033a463 → 60f44b7) 📈 **System libraries**: 84.84% (+0.07%, +2 implemented functions) <details> <summary>✅ 2 implemented</summary> | Library | Name | | - | - | | libSceAgc | `sceAgcAcbSetFlip` | | libSceAgc | `sceAgcAcbWaitUntilSafeForRendering` | </details>
github-actions[bot] commented 2026-10-08 18:40:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T18:40:07Z.


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.

Pull request Conflicting files (lines on main) Same exports Same new files
#1745 core/libs/prx/libSceAgcDriver/tests/Flip.cpp L82
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6066634300 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1585#issuecomment-6066634300). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-08T18:40:07Z. --- <!-- pr-overlap --> 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**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #1745 | `core/libs/prx/libSceAgcDriver/tests/Flip.cpp` [L82](https://github.com/boykopovar/AnyPS5/blob/f145139676a48306681d3a4d5fabf83938759daf/core/libs/prx/libSceAgcDriver/tests/Flip.cpp#L82) | | |
EdouardSence commented 2026-10-08 20:07:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-08T20:07:58Z.


On the overlap with #1745: the conflict is only in tests/Flip.cpp. Both PRs give the test Output a CaptureRenderingWait override and an IRenderingWait class. The code changes don't overlap.

If #1745 lands first, I'll rebase this PR onto its RenderingGate, which is open by default. I'll add only what the compute-queue case checks: the captured buffer index (waited == 3). If this one lands first, #1745 can do the same in reverse.

Written by Claude (AI assistant) on a contributor's machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6068115811 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1585#issuecomment-6068115811). Originally posted by [EdouardSence](https://github.com/EdouardSence) on 2026-10-08T20:07:58Z. --- On the overlap with #1745: the conflict is only in `tests/Flip.cpp`. Both PRs give the test `Output` a `CaptureRenderingWait` override and an `IRenderingWait` class. The code changes don't overlap. If #1745 lands first, I'll rebase this PR onto its `RenderingGate`, which is open by default. I'll add only what the compute-queue case checks: the captured buffer index (`waited == 3`). If this one lands first, #1745 can do the same in reverse. *Written by Claude (AI assistant) on a contributor's machine.*
oneandonlydean commented 2026-10-09 08:54:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T08:54:53Z.


Closing: no title is shown to reach sceAgcAcbSetFlip or sceAgcAcbWaitUntilSafeForRendering on main (same as #1052). Please reopen with the title ID and the log line if you find one.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6077707263 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1585#issuecomment-6077707263). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-09T08:54:53Z. --- Closing: no title is shown to reach `sceAgcAcbSetFlip` or `sceAgcAcbWaitUntilSafeForRendering` on main (same as #1052). Please reopen with the title ID and the log line if you find one.

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