Skip to content

fix(libSceAgc): emit NOP packets for the DCB workload calls - #3789

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
xXPBSXx:fix/agc-workload-nop-packets
Oct 12, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
xXPBSXx:fix/agc-workload-nop-packets

Conversation

@xXPBSXx

@xXPBSXx xXPBSXx commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What

sceAgcDcbSetWorkloadsActive and sceAgcDcbSetWorkloadComplete threw. They now follow KytyPS5 (src/libs/agc.cpp): an 18-dword (active) or 12-dword (complete) IT_NOP packet carrying the stream id, and for active the 64-bit mask of the workload ids, for complete the workload id and the 64-bit clear mask. Both return null for a null command buffer, an unregistered or out-of-range stream (1 to 31), a workload id above 63, and for active a duplicate id or a count of 0 or above 63. sceAgcDriverRegisterWorkloadStream and sceAgcDriverUnregisterWorkloadStream record the stream ids that the DCB calls check; registration still returns 0 for every argument, since the console's error codes for an invalid or repeated registration are unknown. This changes the first version of this PR (a plain two-dword NOP), after review.

Tested

  • Windows 10, MinGW/Ninja build of main a11c8f7 plus this branch: ctest -R "agc_commands|agc_initialization|guest_agc_driver_resources" passes. testWorkloads pins the packet header, stream id, mask, clear mask and the zero tail for ids {3,4} and workload 33, and each null case above, including after unregistration. python tools/check_conventions.py --base upstream/main passes.
  • I did not run the test against the previous version of the implementation. No title was run (PPSA29866 calls sceAgcDcbSetWorkloadsActive). Not tested: Linux, macOS.
  • The packet layouts and the validation come from KytyPS5 alone. The console oracle in prosper (agcbuild.golden.tsv) measures a null return for unregistered streams, not the packet of a registered one; this and the registration behaviour are in TechnicalDebt.

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
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Progress report (bca7a29 → 2a7b38a)

📈 System libraries: 86.53% (+0.06%, +2 implemented functions)

✅ 2 implemented
Library Name
libSceAgc sceAgcDcbSetWorkloadComplete
libSceAgc sceAgcDcbSetWorkloadsActive

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Two problems, both about returning a plausible result where main threw:

  • Workload.cpp:13-19: the packet size and contents are invented. KytyPS5 (src/libs/agc.cpp, AgcDcbSetWorkloadsActive/AgcDcbSetWorkloadComplete) writes an 18-dword (active) / 12-dword (complete) IT_NOP packet carrying the stream id and the workload mask (complete: stream id, workload id, clear mask). A 2-dword NOP is not what any reference emits, and the TechnicalDebt line itself says the real packet is unknown.
  • No argument validation: prosper's console oracle (tests/data/console_oracle/agcbuild.golden.tsv, agcbuild_DcbSetWorkloadsActive_* / agcbuild_DcbSetWorkloadComplete_*) measures a null return on a real console for unregistered streams, and KytyPS5 also returns null for stream id outside 1..31, workload id > 63, duplicate ids, and count 0 or > 63 (active). This PR returns a packet in all those cases, and testWorkloads pins that.

Suggested direction: follow KytyPS5's packet layouts and checks (the workload stream registry comes from sceAgcDriverRegisterWorkloadStream, so that is a prerequisite, or the unregistered case has to throw), pin the values in the test from the reference, and keep unverified parts in TechnicalDebt. Otherwise keep throwing.

@xXPBSXx

xXPBSXx commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, both points are right. Pushed a167cb231: the packets now follow KytyPS5 (18-dword active with stream id and 64-bit workload mask, 12-dword complete with stream id, workload id and 64-bit clear mask), and both calls return null for a null buffer, an unregistered or out-of-range stream, a workload id above 63, and for active a duplicate id or a count of 0 or above 63. The registry is the one you suggested: sceAgcDriverRegisterWorkloadStream / sceAgcDriverUnregisterWorkloadStream record ids 1 to 31, and registration still returns 0 for every argument because I have no source for the console's error codes. testWorkloads pins the values from the reference. The description is updated; the layouts rest on KytyPS5 only (the prosper oracle covers the unregistered case, not a registered packet), which TechnicalDebt now says.

AI-assisted (Claude Code).

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 11, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Conflicts with main in docs/dev/TechnicalDebt.md; please rebase.

No title was run. Please run PPSA29866 on the branch and quote the line where it stops on main and the one where it stops with this.

sceAgcDcbSetWorkloadsActive and sceAgcDcbSetWorkloadComplete threw. They now write a plain two-dword NOP and keep no workload state.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…r unregistered streams

sceAgcDcbSetWorkloadsActive writes an 18-dword IT_NOP packet (stream id, 64-bit workload mask) and sceAgcDcbSetWorkloadComplete a 12-dword one (stream id, workload id, 64-bit clear mask), following KytyPS5. Both return null for a null buffer, an unregistered or out-of-range stream, a workload id above 63, and for active a duplicate id or a count of 0 or above 63. sceAgcDriverRegisterWorkloadStream and sceAgcDriverUnregisterWorkloadStream now record the stream ids the DCB calls check.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@xXPBSXx
xXPBSXx force-pushed the fix/agc-workload-nop-packets branch from a167cb2 to 2a7b38a Compare October 11, 2026 23:46
@xXPBSXx

xXPBSXx commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

@adriadam10 rebased onto current main (bca7a29): the branch conflicted in docs/dev/TechnicalDebt.md only, and I resolved it by keeping main's three entries at the end and placing this PR's entry in front of them, away from the end of the file. The code is unchanged since the review round: the two points from your review (packet layouts and checks after KytyPS5, null for unregistered streams through the driver's workload-stream registry) are answered as in my earlier comment. Built and tested on Windows after the rebase: agc_initialization, agc_commands and guest_agc_driver_resources pass, and tools/check_conventions.py --base upstream/main passes. The branch was force-pushed (own PR branch, --force-with-lease).

AI-assisted (Claude Code).

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

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
#2847 core/libs/prx/libSceAgc/tests/Commands.cpp L210, L561
#4377 docs/dev/TechnicalDebt.md L709
#4382 docs/dev/TechnicalDebt.md L709

@xXPBSXx

xXPBSXx commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

Title run as requested, PPSA29866 (Tomba! 2 SE), Windows, GCC, RTX 4080 SUPER, on current main + #3819 (the title's missing imports):

  • without this PR it stops at: what(): sceAgcDcbSetWorkloadsActive not implemented, then SIGABRT;
  • with this PR (fix(libSceAgc): emit NOP packets for the DCB workload calls #3789 merged locally on top) there is no abort or exception during a 150 s run; the log shows draws, shader disk cache activity and extra threads starting. I did not judge the rendered picture.

Only the workload calls were checked this way; whether the packet contents match a console is not tested (layouts follow KytyPS5 as in the earlier comment).

AI-assisted (Claude Code).

@oneandonlydean oneandonlydean self-assigned this Oct 12, 2026
@oneandonlydean
oneandonlydean dismissed adriadam10’s stale review October 12, 2026 11:44

The points from this review are in the current head.

@oneandonlydean
oneandonlydean merged commit 2dfde65 into boykopovar:main Oct 12, 2026
12 checks passed
hypermoist added a commit to hypermoist/AnyPS5 that referenced this pull request Oct 20, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants