feat(libSceAgcDriver): execute COND_WRITE #977
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/977"
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 hugodearaujo on 2026-10-06T21:07:23Z.
What
The AGC driver rejected COND_WRITE (opcode 0x45) as "not known in the reference". It now validates and executes it when the poll and the destination are both memory, the case
sceAgcCbCondWritewrites (#975):GuestMemory::Read(range synchronization, read siteWait), compares it withwaitCompares, and on a match writes the data dword throughGuestMemory::Write. Dwords 1-5 of COND_WRITE have the same layout as a 32-bit WAIT_REG_MEM: control, poll address, reference and mask.AccessesMemory. The drain records queued labels and waits for earlier GPU work, so the poll read sees values that earlier packets wrote on the GPU, and the write lands only after earlier GPU work that may read the destination.Pm4Opcodes.hpp.This PR does not depend on #975: the tests build the packets by hand.
Tested
Linux (Arch, GCC), Release with
BUILD_TESTING=ON, on currentmain. Inagc_driver_pm4_tests:testConditionalWrite:AccessesMemory;testConditionalWriteSubmission: throughsceAgcDriverSubmitDcb, a COND_WRITE sees the value an earlier WRITE_DATA of its queue stored, and a COND_WRITE whose comparison fails writes nothing.Mutations: inverted comparison, any write space accepted, 0x45 removed from
AccessesMemory, the mask written instead of the data, the reserved-bits check removed, and the poll read bypassing the synchronization each make the test fail.One mutation is not caught: removing 0x45 from the drain list. Without a Vulkan device, queued labels are written by the CPU between packets, so the order holds anyway in this test. The drain matters when labels are recorded on the GPU. I did not find a device-backed test that covers it; pointers are welcome.
Full
ctest: 362/362 passed. A simulated merge with every open PR shows no conflict; the new tests are placed apart from #898, which adds tests to the same file. Not tested with a title.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by hugodearaujo on 2026-10-06T21:41:44Z.
Usage by titles: the packet comes from
sceAgcCbCondWrite, which OpenAGCgame_compat.clists for New Joe & Mac Caveman Ninja (PPSA02801) and PS5PCEMagc_table.zigbinds for a shipped title (details in #975). Without this change, a title that builds the packet fails when it submits it.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-06T22:02:59Z.
Thanks. The validation mirrors WAIT_REG_MEM and WRITE_DATA well, and it's good that the uncaught drain mutation is stated openly.
Same question as on #975: which title submits COND_WRITE? Since the drain change only matters when labels are recorded on the GPU, a title that emits the packet is the only way to check that part. If you have one, please name it.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-06T22:40:35Z.
Thanks, same as on #975: I asked before I'd seen your note. PPSA02801 building the packet through
sceAgcCbCondWriteis a good enough reason.I'll approve the CI run and check it on Dreaming Sarah together with #975. No changes needed from you for now.