Skip to content

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

Merged
adriadam10 merged 5 commits into
boykopovar:mainfrom
hypermoist:feat/agc-acb-workload-packets
Oct 23, 2026
Merged

adriadam10 merged 5 commits into
boykopovar:mainfrom
hypermoist:feat/agc-acb-workload-packets

Conversation

@hypermoist

@hypermoist hypermoist commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

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

…stream

sceAgcAcbSetWorkloadsActive, sceAgcAcbSetWorkloadComplete and
sceAgcAcbSetWorkloadStreamInactive build the same packets as the DCB calls,
and sceAgcDcbSetWorkloadStreamInactive writes a 9-dword IT_NOP with the
stream id, the size of the console's user-data packet. The debt entry now
records the console layout read from libSceAgcDriver.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
@github-actions

Copy link
Copy Markdown

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

@nikowolf123

Copy link
Copy Markdown
Contributor

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:

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.

hypermoist and others added 2 commits October 21, 2026 12:12
Review on boykopovar#8302: the ACB workload calls and the DCB stream-inactive call
throw again for a registered stream until a title is shown stopping on
them (as boykopovar#3789 did for the DCB calls, and as boykopovar#4709 kept). The debt
entry keeps the firmware's packet layout as the record of what is
missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
@hypermoist hypermoist changed the title feat(agc): write the workload packets on the ACB and for an inactive stream docs(agc): record the console's workload packets Oct 20, 2026
@hypermoist

Copy link
Copy Markdown
Contributor Author

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 9660187 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.

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1060 docs/dev/debt/libSceAgc.md

@orezraey

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 21, 2026
hypermoist and others added 2 commits October 22, 2026 14:43
…ad-packets

# Conflicts:
#	docs/dev/debt/libSceAgc.md
@hypermoist

Copy link
Copy Markdown
Contributor Author

@orezraey thank you, that's the console evidence this entry was missing. I merged main and added an entry (in bea151e and e8abcba) 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.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 22, 2026
@adriadam10 adriadam10 self-assigned this Oct 23, 2026
@adriadam10
adriadam10 merged commit 1e1c355 into boykopovar:main Oct 23, 2026
10 of 11 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the new debt entry against main (no ATOMIC_MEM in the executor, entry placed beside the two existing workload entries) and against orezraey's console measurements; conventions check passes; merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants