fix(agc): reread an invalid indirect register list where its packet executes #7683
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7683"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Longziip on 2026-10-18T22:43:41Z.
What
SET_*_REG_INDIRECTlists are read when the command buffer is submitted (de651c628, for PPSA21402). When that copy holds an offset dword that is no register offset (bits 16-27 set, or the0xffffffffsentinel), the queue worker now reads the list again where the packet executes, as the console PFP does, and uses that copy if it is valid. A list that is valid at submission is used exactly as before.EA SPORTS UFC 6 (PPSA23566) intermittently submits a
SET_CONTEXT_REG_INDIRECTof 181 pairs whose first entry is0x038f038f(value0xc8e9037e), or0x03900390in another run; the other 180 pairs are valid context registers (0x11,0x12, ...). The entry is the same at submission and at execution, so the title stopped withextended register semantics are not implemented (offset dword 0x038f038f)during the intro, in roughly one launch out of three. What the PFP does with such an entry is unknown, so the packet still throws by default;APS5_SKIP_INVALID_INDIRECT_REGISTERS=1skips the invalid entries and writes the others. The behaviour is recorded indocs/dev/debt/libSceAgcDriver.md.Tests in
agc_driver_pm4_tests:testInvalidRegisterListEntries(the UFC 6 entry throws without the switch, and with skipping the valid pairs are written and nothing else) andtestRegisterListReadAgainAtExecution(a list invalid at submission and valid when its packet runs is read again).Tested
Windows 11 Pro (build 26300), AMD Ryzen 7 5700X, NVIDIA GeForce RTX 4060 8 GB (driver 32.0.16.1664), 32 GB RAM, WinLibs GCC 15.2.0, Release.
agc_driver_pm4passes with the two new tests;python tools/check_conventions.py --base origin/mainpasses.register list entry with offset dword 0x03900390 read again where the packet executes; invalid entries are skipped), the title went on to the title screen and later the tutorial fight with no visible difference; before the change the same entry stopped it.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T22:46:11Z.
One edge case in the opt-in skip path:
PacketExecution.cppchooses the execution-time list only when the whole list is valid; otherwise it passes the submission-time copy toExecuteIndirectRegisters(..., skipInvalid=true). If the execution-time list has changed to a mix of valid and invalid entries, the valid entries from that current list are discarded and stale submission values are written instead. Could the skip path pass the current list even when it is partly invalid, then skip only its invalid entries? A regression with a partly updated list would pin down the intended behavior.Imported from boykopovar/AnyPS5. Originally posted by Longziip on 2026-10-18T22:52:34Z.
Thanks, good catch. Fixed in bd4a73501: when the list read at submission is invalid, the worker now always writes the copy read again where the packet executes, and with
APS5_SKIP_INVALID_INDIRECT_REGISTERS=1only that copy's invalid entries are skipped, so the valid entries of a partly updated list win over the stale submission values.Added
testPartlyUpdatedRegisterListSkipsOnlyItsInvalidEntries: the list is invalid at submission (0x038f038f, then register0x11), is changed to0x10 = 77plus an invalid entry before its packet runs, andCOPY_DATAreads register0x10back. It fails on the previous commit (the stale list was written,0x10stayed 74) and passes now. The debt note and theENVIRONMENT.mdrow are updated to match.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T22:54:50Z.
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.
main)docs/dev/debt/libSceAgcDriver.mdL117-118docs/dev/ENVIRONMENT.mdL354docs/dev/debt/libSceAgcDriver.mdL118-119Some 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.
docs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/ENVIRONMENT.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Pm4.cppcore/libs/prx/libSceAgcDriver/tests/Pm4.cppcore/libs/prx/libSceAgcDriver/Execution/include/Pm4.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/Execution/src/Pm4.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/include/Pm4.hppcore/libs/prx/libSceAgcDriver/Execution/src/Pm4.cppcore/libs/prx/libSceAgcDriver/tests/Pm4.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/ENVIRONMENT.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/ENVIRONMENT.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/ENVIRONMENT.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/ENVIRONMENT.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/ENVIRONMENT.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/ENVIRONMENT.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/ENVIRONMENT.mddocs/dev/ENVIRONMENT.mddocs/dev/ENVIRONMENT.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/ENVIRONMENT.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/ENVIRONMENT.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/ENVIRONMENT.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/ENVIRONMENT.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/ENVIRONMENT.mdImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T22:59:51Z.
Thanks for the targeted fix and regression. The new test exercises a mixed list at execution time and confirms that current valid entries are applied while invalid entries are skipped; that addresses the stale-submission-value case I raised.
Imported from boykopovar/AnyPS5. Originally posted by Longziip on 2026-10-18T23:01:46Z.
Thanks for the review!
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-19T03:02:21Z.
Data point from a second title: Puyo Puyo Tetris 2 (PPSA01530) reaches the same packet type with this PR's head
bd4a73501merged ontomainfc623324a, 3 of 3 runs:SET_CONTEXT_REG_INDIRECT at DWORD 2: register list entry with offset dword 0xffffffff read again where the packet executes, followed byindirect register sentinel semantics are not implemented. The entry is invalid at the execution point as well, so the re-read does not change the outcome for this title. WithAPS5_SKIP_INVALID_INDIRECT_REGISTERS=1the next stop isDB_RENDER_CONTROL ... (register 0x0 = 0xa001e001).Windows 10, GCC 15.2.0 Release, no input; 300 s requested, the title stopped by itself after 10-30 s. I have no source for the console's behaviour on such an entry.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-19T07:49:44Z.
Intel and AMD Windows data: with this PR, the 13 tests built from
tests/Pm4.cpppass on an Intel UHD 770 and an AMD RX 9070 XT.Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built,
ANYPS5_NO_SHADER_CACHE=1, serial CTest. Intel UHD Graphics 770 (8086:a780), driver 32.0.101.7088. AMD Radeon RX 9070 XT (1002:7550), driver 32.0.31041.1004, withVkCacheemptied first. This headbd4a73501merged intomain6b8228b2b.agc_driver_pm4,agc_driver_pm4_failure,_failure_inline, theagc_driver_pm4_ring*tests and the stall-watchdog tests (13)The updated
tests/Pm4.cppdoesn't build onmainwithout the rest of the PR, so there is no before-run.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-20T13:19:30Z.
Checked the diff against current
main, the three newagc_driver_pm4tests (each needs the re-read or the partial skip, so it fails onmain), the docs entries (ENVIRONMENT.md,libSceAgcDriver.md), and the third-party Windows runs (Intel UHD 770, RX 9070 XT) plus @MarcZX10's review. Default behaviour still throws; valid lists are untouched; merged.