docs(agc): record the console's workload packets #8302

Merged
hypermoist merged 5 commits from upstream-pr/8302 into main 2026-10-23 16:21:41 +00:00
hypermoist commented 2026-10-20 09:33:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hypermoist on 2026-10-20T09:33:27Z.


What

Records in docs/dev/debt/libSceAgc.md what the console writes for the six workload calls, taken from the decrypted libSceAgc.sprx and libSceAgcDriver.sprx. No code changes: after review, the registered-stream throw in sceAgcDcbSetWorkloadStreamInactive and the three ACB calls is kept, as #4709 kept it, because no title has been shown stopping on these calls on current main. The DCB active and complete IT_NOP stand-ins (#3789) are unchanged.

What the console writes. The libSceAgc calls reserve sceAgcDriverGet*PacketSize() dwords and call sceAgcDriverSetWorkloadsActive / SetWorkloadComplete / SetWorkloadStreamInactive, passing engine 0 for DCB and 1 for ACB. The driver calls write:

  1. A SET_UCONFIG_REG to 0x342 with a tag: 0xCC000000 | stream for active and inactive, 0xCD000000 + workload * 32 + stream for complete. It carries the first dword of an 8-byte payload (the active mask, or zero for inactive), and a WRITE_DATA to register 0xC343 carries the rest.
  2. For active and complete only, a 9-dword ATOMIC_MEM (control 0x267 or 0x275, bit 30 set on the DCB). It ORs the mask into, or ANDs the cleared bit out of, the stream's 64-bit word in a table the driver allocates at module start.

That gives 18 / 12 / 9 dwords. The executor has no ATOMIC_MEM and no workload table, and an unpredicated SET_UCONFIG_REG is rejected on a compute queue. main now describes the current stand-ins in its own two entries. This PR adds one entry beside them that leads with that gap and stays under the length limit. It includes what orezraey measured on a PS5 at firmware 13.60: the WRITE_DATA dwords, the header low bytes, and the table address. The registration error codes are left to their follow-up.

The Horizon Call of the Mountain thread (#6214) lists the three ACB calls among its stubs, but that title currently stops earlier (sceHmd2ReprojectionSetAllowPositionalReprojection). Once a title is shown stopping on one of these calls, a follow-up can write the stand-in packets.

Tested

Linux (CachyOS, GCC, Release): agc_commands passes unchanged. tools/check_conventions.py is clean.

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: none
  • GPUs tested: n/a (documentation only)
  • AI-assisted: yes (Claude Code), reviewed by the contributor

🤖 Generated with Claude Code

https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4933840269 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8302). Originally posted by [hypermoist](https://github.com/hypermoist) on 2026-10-20T09:33:27Z. --- ### What Records in `docs/dev/debt/libSceAgc.md` what the console writes for the six workload calls, taken from the decrypted `libSceAgc.sprx` and `libSceAgcDriver.sprx`. No code changes: after review, the registered-stream throw in `sceAgcDcbSetWorkloadStreamInactive` and the three ACB calls is kept, as #4709 kept it, because no title has been shown stopping on these calls on current main. The DCB active and complete `IT_NOP` stand-ins (#3789) are unchanged. **What the console writes.** The libSceAgc calls reserve `sceAgcDriverGet*PacketSize()` dwords and call `sceAgcDriverSetWorkloadsActive` / `SetWorkloadComplete` / `SetWorkloadStreamInactive`, passing engine 0 for DCB and 1 for ACB. The driver calls write: 1. A `SET_UCONFIG_REG` to `0x342` with a tag: `0xCC000000 | stream` for active and inactive, `0xCD000000 + workload * 32 + stream` for complete. It carries the first dword of an 8-byte payload (the active mask, or zero for inactive), and a `WRITE_DATA` to register `0xC343` carries the rest. 2. For active and complete only, a 9-dword `ATOMIC_MEM` (control `0x267` or `0x275`, bit 30 set on the DCB). It ORs the mask into, or ANDs the cleared bit out of, the stream's 64-bit word in a table the driver allocates at module start. That gives 18 / 12 / 9 dwords. The executor has no `ATOMIC_MEM` and no workload table, and an unpredicated `SET_UCONFIG_REG` is rejected on a compute queue. `main` now describes the current stand-ins in its own two entries. This PR adds one entry beside them that leads with that gap and stays under the length limit. It includes what orezraey measured on a PS5 at firmware 13.60: the `WRITE_DATA` dwords, the header low bytes, and the table address. The registration error codes are left to their follow-up. The Horizon Call of the Mountain thread (#6214) lists the three ACB calls among its stubs, but that title currently stops earlier (`sceHmd2ReprojectionSetAllowPositionalReprojection`). Once a title is shown stopping on one of these calls, a follow-up can write the stand-in packets. ### Tested Linux (CachyOS, GCC, Release): `agc_commands` passes unchanged. `tools/check_conventions.py` is clean. ### 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: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a (documentation only) - [x] AI-assisted: yes (Claude Code), reviewed by the contributor 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
github-actions[bot] commented 2026-10-20 09:34:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T09:34:15Z.


Progress report (8a7ba4b → 6a4913c)

📈 System libraries: 65.23% (+0.06%, +4 implemented functions)

✅ 4 implemented
Library Name
libSceAgc sceAgcAcbSetWorkloadComplete
libSceAgc sceAgcAcbSetWorkloadStreamInactive
libSceAgc sceAgcAcbSetWorkloadsActive
libSceAgc sceAgcDcbSetWorkloadStreamInactive
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6287953715 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8302#issuecomment-6287953715). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T09:34:15Z. --- <!-- progress-report --> ### Progress report (8a7ba4b → 6a4913c) 📈 **System libraries**: 65.23% (+0.06%, +4 implemented functions) <details> <summary>✅ 4 implemented</summary> | Library | Name | | - | - | | libSceAgc | `sceAgcAcbSetWorkloadComplete` | | libSceAgc | `sceAgcAcbSetWorkloadStreamInactive` | | libSceAgc | `sceAgcAcbSetWorkloadsActive` | | libSceAgc | `sceAgcDcbSetWorkloadStreamInactive` | </details>
nikowolf123 commented 2026-10-20 22:04:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by nikowolf123 on 2026-10-20T22:04:06Z.


Acb/src/Control.cpp L75-85 and DcbState/src/Workload.cpp L59-64 replace the registered-stream throw with a stand-in packet.

Example: after sceAgcDriverRegisterWorkloadStream(1, record), the call sceAgcAcbSetWorkloadsActive(acb, 1, {3, 4}, 2) throws sceAgcAcbSetWorkloadsActive not implemented on main. With this PR it returns an 18-dword IT_NOP (0xC0101000, 1, 0x18, 0, …). The console writes a different sequence: a SET_UCONFIG_REG to 0x342/0x343, a WRITE_DATA to 0xC343 and a 9-dword SET_WORKLOAD (0x1E) packet with the mask for stream 1's slot (OpenAGC acb.c L490-516, agc_workload_packet.c L18-51). The new debt entry says the same thing: "the console packets are not written".

A title probably can't see the difference, because the dropped writes only reach the thread-trace user-data registers and a table the driver owns. Still, this throw was kept on purpose, and the description doesn't say why it can be removed now:

  • #4709 was merged with the comment "The registered-stream throw keeps the unmeasured packet out."
  • The same IT_NOP stand-in for the DCB calls (#3789) was merged only after PPSA29866 was shown stopping on sceAgcDcbSetWorkloadsActive not implemented.
  • #6128 made this same change. Its author closed it because no title had been shown stopping on these calls.
  • Horizon Call of the Mountain (#6214) only imports the ACB calls. It currently stops earlier, on sceHmd2ReprojectionSetAllowPositionalReprojection not implemented.

Could you quote the log line of a title that stops on one of these four calls on current main, as #3789 did, and mention #4709 in the description? Until a title does, I'd keep the throw for a registered stream. For the three ACB calls that means main's RejectUnregisteredWorkloadStream. In Agc::Workload::StreamInactive it would be:

 if (buf == nullptr || !AgcDriverWorkloadStreamRegistered_nid_postfix(streamId)) return nullptr;
 NotImplemented_nid_no_patch(function);
 return nullptr;

Moving the DCB builders into Agc::Workload can stay either way.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6302771363 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8302#issuecomment-6302771363). Originally posted by [nikowolf123](https://github.com/nikowolf123) on 2026-10-20T22:04:06Z. --- [`Acb/src/Control.cpp` L75-85](https://github.com/boykopovar/AnyPS5/blob/6a4913cc7cc6e185f98f6b0c8792bd5c5c70b476/core/libs/prx/libSceAgc/Acb/src/Control.cpp#L75-L85) and [`DcbState/src/Workload.cpp` L59-64](https://github.com/boykopovar/AnyPS5/blob/6a4913cc7cc6e185f98f6b0c8792bd5c5c70b476/core/libs/prx/libSceAgc/DcbState/src/Workload.cpp#L59-L64) replace the registered-stream throw with a stand-in packet. Example: after `sceAgcDriverRegisterWorkloadStream(1, record)`, the call `sceAgcAcbSetWorkloadsActive(acb, 1, {3, 4}, 2)` throws `sceAgcAcbSetWorkloadsActive not implemented` on main. With this PR it returns an 18-dword `IT_NOP` (`0xC0101000, 1, 0x18, 0, …`). The console writes a different sequence: a SET_UCONFIG_REG to 0x342/0x343, a WRITE_DATA to 0xC343 and a 9-dword SET_WORKLOAD (0x1E) packet with the mask for stream 1's slot ([OpenAGC `acb.c` L490-516](https://github.com/OpenAGC/OpenAGC/blob/3c7e8072f0d7684e930454794fd5c02056946d73/src/acb.c#L490-L516), [`agc_workload_packet.c` L18-51](https://github.com/OpenAGC/OpenAGC/blob/3c7e8072f0d7684e930454794fd5c02056946d73/src/agc_workload_packet.c#L18-L51)). The new debt entry says the same thing: "the console packets are not written". A title probably can't see the difference, because the dropped writes only reach the thread-trace user-data registers and a table the driver owns. Still, this throw was kept on purpose, and the description doesn't say why it can be removed now: - #4709 was merged with the comment "The registered-stream throw keeps the unmeasured packet out." - The same `IT_NOP` stand-in for the DCB calls (#3789) was merged only after PPSA29866 was shown stopping on `sceAgcDcbSetWorkloadsActive not implemented`. - #6128 made this same change. Its author closed it because no title had been shown stopping on these calls. - Horizon Call of the Mountain (#6214) only imports the ACB calls. It currently stops earlier, on `sceHmd2ReprojectionSetAllowPositionalReprojection not implemented`. Could you quote the log line of a title that stops on one of these four calls on current main, as #3789 did, and mention #4709 in the description? Until a title does, I'd keep the throw for a registered stream. For the three ACB calls that means main's `RejectUnregisteredWorkloadStream`. In `Agc::Workload::StreamInactive` it would be: ```cpp if (buf == nullptr || !AgcDriverWorkloadStreamRegistered_nid_postfix(streamId)) return nullptr; NotImplemented_nid_no_patch(function); return nullptr; ``` Moving the DCB builders into `Agc::Workload` can stay either way.
hypermoist commented 2026-10-20 23:34:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hypermoist on 2026-10-20T23:34:29Z.


Thanks @nikowolf123, that's fair. I can't point to a title that stops on these four calls on current main: Horizon (#6214) stops earlier, on sceHmd2ReprojectionSetAllowPositionalReprojection. So as of 966018783f the registered-stream throw is back. The ACB calls use main's RejectUnregisteredWorkloadStream and sceAgcDcbSetWorkloadStreamInactive throws again, which reverts Control.cpp, Workload.cpp/.hpp and Commands.cpp to main. With no ACB caller left, I dropped the builder move too.

The PR now only records the firmware's packet layout in docs/dev/debt/libSceAgc.md: the SET_UCONFIG_REG tag at 0x342, the WRITE_DATA to 0xC343, and the ATOMIC_MEM on the driver's per-stream mask. That keeps the evidence for whoever writes the packets once a title needs them. The title and description now mention #4709 and say why the throw stays. agc_commands passes unchanged.

#8318 no longer needs anything from this PR except the neighbouring debt lines.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6304201603 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8302#issuecomment-6304201603). Originally posted by [hypermoist](https://github.com/hypermoist) on 2026-10-20T23:34:29Z. --- Thanks @nikowolf123, that's fair. I can't point to a title that stops on these four calls on current main: Horizon (#6214) stops earlier, on `sceHmd2ReprojectionSetAllowPositionalReprojection`. So as of 966018783f the registered-stream throw is back. The ACB calls use main's `RejectUnregisteredWorkloadStream` and `sceAgcDcbSetWorkloadStreamInactive` throws again, which reverts `Control.cpp`, `Workload.cpp/.hpp` and `Commands.cpp` to main. With no ACB caller left, I dropped the builder move too. The PR now only records the firmware's packet layout in `docs/dev/debt/libSceAgc.md`: the SET_UCONFIG_REG tag at 0x342, the WRITE_DATA to 0xC343, and the ATOMIC_MEM on the driver's per-stream mask. That keeps the evidence for whoever writes the packets once a title needs them. The title and description now mention #4709 and say why the throw stays. `agc_commands` passes unchanged. #8318 no longer needs anything from this PR except the neighbouring debt lines.
orezraey commented 2026-10-21 14:03:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by orezraey on 2026-10-21T14:03:09Z.


I measured these on a retail PS5 (firmware 13.60). A homebrew probe registers a stream and calls the six functions on a plain command buffer; the source and log are in this gist. The packets match what you recorded. These details are not in the entry:

  • WRITE_DATA: dwords 5 to 8 are 0x06010000, 0xc343, 0 and the high half of the mask (0 for inactive).
  • Header low byte: 0x04 on the DCB SET_UCONFIG_REG and WRITE_DATA, 0x00 on the ACB ones. The ATOMIC_MEM header is 0xc0071e00 on both.
  • Table address: in this process it was 0xfe003a000 + 8 * stream (stream 1 0xfe003a008, stream 31 0xfe003a0f8). The pointer passed to sceAgcDriverRegisterWorkloadStream is never written, and a pointer misaligned by 1 or 4 bytes is accepted.
  • Null returns with nothing written:
    • a duplicate id, id 64, a count of 0 or 64, or null ids (a count of 63 is accepted);
    • complete with id 64;
    • a null command buffer;
    • a stream that is not registered, including after unregistering it.
  • Registration and unregistration codes:
    • registering returns 0 for ids 1 to 31;
    • registering returns 0x8a6c0033 for id 0, id 32 or an id already registered, and 0x8a6c0035 for a null stream;
    • unregistering returns 0x8a6c0033 for id 0 or 32, and 0x8a6c003a for a stream that is not registered.

I'll open a separate PR for the registration codes only. It doesn't touch the packets, but it edits the same debt entry.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6318013624 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8302#issuecomment-6318013624). Originally posted by [orezraey](https://github.com/orezraey) on 2026-10-21T14:03:09Z. --- I measured these on a retail PS5 (firmware 13.60). A homebrew probe registers a stream and calls the six functions on a plain command buffer; the source and log are in [this gist](https://gist.github.com/orezraey/befe7632b827421988b47a6c04e89e1d). The packets match what you recorded. These details are not in the entry: - **`WRITE_DATA`**: dwords 5 to 8 are `0x06010000`, `0xc343`, `0` and the high half of the mask (0 for inactive). - **Header low byte**: `0x04` on the DCB `SET_UCONFIG_REG` and `WRITE_DATA`, `0x00` on the ACB ones. The `ATOMIC_MEM` header is `0xc0071e00` on both. - **Table address**: in this process it was `0xfe003a000 + 8 * stream` (stream 1 `0xfe003a008`, stream 31 `0xfe003a0f8`). The pointer passed to `sceAgcDriverRegisterWorkloadStream` is never written, and a pointer misaligned by 1 or 4 bytes is accepted. - **Null returns with nothing written**: - a duplicate id, id 64, a count of 0 or 64, or null ids (a count of 63 is accepted); - complete with id 64; - a null command buffer; - a stream that is not registered, including after unregistering it. - **Registration and unregistration codes**: - registering returns 0 for ids 1 to 31; - registering returns `0x8a6c0033` for id 0, id 32 or an id already registered, and `0x8a6c0035` for a null stream; - unregistering returns `0x8a6c0033` for id 0 or 32, and `0x8a6c003a` for a stream that is not registered. I'll open a separate PR for the registration codes only. It doesn't touch the packets, but it edits the same debt entry.
hypermoist commented 2026-10-22 01:43:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hypermoist on 2026-10-22T01:43:35Z.


@orezraey thank you, that's the console evidence this entry was missing. I merged main and added an entry (in bea151e189 and e8abcba78f) beside main's two current workload entries. It records the firmware sequence and your measurements, linked to your gist:

  • WRITE_DATA dwords 5 to 8;
  • header low byte 0x04 on the DCB and 0x00 on the ACB;
  • ATOMIC_MEM header 0xC0071E00;
  • the table at 0xFE003A000 + 8 * stream;
  • the registration pointer is never written.

I left out the registration and unregistration codes, as you're putting those in your own PR. The null-return cases you list match the checks main's entry already describes (63 accepted, 64 rejected), so I didn't repeat them.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6330652374 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8302#issuecomment-6330652374). Originally posted by [hypermoist](https://github.com/hypermoist) on 2026-10-22T01:43:35Z. --- @orezraey thank you, that's the console evidence this entry was missing. I merged `main` and added an entry (in bea151e189 and e8abcba78f) beside `main`'s two current workload entries. It records the firmware sequence and your measurements, linked to your gist: - `WRITE_DATA` dwords 5 to 8; - header low byte 0x04 on the DCB and 0x00 on the ACB; - `ATOMIC_MEM` header `0xC0071E00`; - the table at `0xFE003A000 + 8 * stream`; - the registration pointer is never written. I left out the registration and unregistration codes, as you're putting those in your own PR. The null-return cases you list match the checks `main`'s entry already describes (63 accepted, 64 rejected), so I didn't repeat them.
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!8302
No description provided.