Repository navigation
feat(agc): implement PM4 CONTEXT_REG_RMW - #16878
Conversation
Decode opcode 0x51 using the four-dword layout and masked update specified by PAL c5e800072a32f68b6ccc4422936d96167c6e0728 BuildContextRegRmw and PM4_ME_CONTEXT_REG_RMW. Reuse context-register writes and reject unknown prior values. Cover masks, readback, fingerprints, reset values, packet sizes and queue restrictions in a registered focused test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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.
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.
|
|
Ran
AI-assisted: yes. |
Reviewed PM4 CONTEXT_REG_RMW — no blocking findingsThe decoding (offset, mask, data) and the read-modify-write order are correct and go through the same register path as SET_CONTEXT_REG; I found nothing that must change, only two questions. What I ranHead reviewed: No build or test was run here; this review is from reading the code only. The test results in the description are the author's. Results
FindingsBlockingNone. Non-blocking
Not verified
To get this to a good stateNothing is required. Optionally answer question 1 (or add AI-assisted: yes (code read with Claude Code; no build or test run). |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review.
|
|
Checked the RMW formula and mask/data order, the write path shared with SET_CONTEXT_REG, validation (graphics only, size 4, reserved offset bits), the throw for registers without a value and its debt entry, and that each new test case fails without the change; merged. |
What
The PM4 packet
CONTEXT_REG_RMW(type-3 opcode0x51) wasn't in the AGC driver's reference catalogue, so a command buffer containing it failed validation withopcode is not known in the reference. This PR implements it from PAL at c5e80007, the revision my #16184 (COND_WRITE) and #16345 (DMA_DATA) cite:BuildContextRegRmw;The packet has four dwords: the header, the context-register offset (16 bits, upper 16 reserved), a mask and data. Its effect is
new = (old & ~mask) | (data & mask). PAL emits it for colour and depth state ingfx9UniversalCmdBuffer.cpp.SET_CONTEXT_REGis. It must be exactly four dwords, and set reserved offset bits are rejected.SET_CONTEXT_REGuses, so later reads,COPY_DATAfrom the register and the register fingerprint all see it;CONTEXT_REG_RMWentry indocs/dev/debt/libSceAgcDriver.mdrecords the throw for a register with no known value. Of the registers PAL modifies with this packet,CB_COLORn_DCC_CONTROL,DB_COUNT_CONTROLandDB_RESERVED_REG_2have no reset value in the model. Console behaviour is unmeasured, as for the other PM4 packets.Tested
New test:
agc_driver_pm4_context_reg_rmw(also run insideagc_driver_pm4) covers:COPY_DATAreadback of the register;Linux x86-64 (Ubuntu 26.04, GCC 15, Release, lavapipe with
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation):main,agc_driver_pm4_context_reg_rmwfails withopcode is not known in the reference;agc_driver_pm4andagc_driver_pm4_context_reg_rmwpass 2/2;VUID-errors and no missing-layer warning.Windows 11, RTX 3060: (build 26300, WinLibs MinGW-w64 GCC 15.2.0 UCRT, Release, NVIDIA driver 610.88, Vulkan SDK 1.4.363, same validation environment):
agc_driver_pm4*tests pass at 6cec611;main'sPm4.cppandPm4Opcodes.hpp,agc_driver_pm4_context_reg_rmwfails withopcode is not known in the reference, andagc_driver_pm4withreference opcode catalog is incomplete;VUID-lines and no missing-layer warning in either run;The PM4 tests validate and execute packets on the CPU and create no Vulkan device. So the validation environment shows nothing breaks, but it doesn't exercise GPU validation.
Mutation check: dropping
& maskon the data fails withCONTEXT_REG_RMW used data outside the mask.python3 tools/check_conventions.py --base origin/main: all checks passed.Overlap: trial merges with my feat(agc): poll and write registers in PM4 COND_WRITE #16184 (COND_WRITE) and fix(agc): accept GDS DMA_DATA register address controls #16345 (DMA_DATA GDS controls), which also edit
Pm4.cppandtests/Pm4.cpp, are clean.pr_overlap.pycouldn't compare 12 PRs that conflict withmain, so I read their diffs by hand: fix(agc): keep CPU stores made after a deferred DCC key store was recorded #6186, perf(agc): compile uncached draws ahead of queue 0 #6188, fix(agc): COPY_DATA to and from GDS #6549, feat(agc): look up table images at run time through a device image table on the GPU heap (APS5_GPU_PATH) #7642, feat(agc): write RELEASE_MEM DATA_SEL 4 for PS4 guests as an 800 MHz count #9893, feat(agc): serve lane-keyed, pointer and runtime image-table columns #10193, fix: define decoded AGC state and bound size arithmetic #10249, feat(agc): resolve table samplers through device image keys #13928, feat(agc): resolve runtime sampler addresses through device image keys #13929, fix(agc): preserve proven base formatted buffer read extents #14944, feat(agc): read frame capture deltas with the title's work in flight #15136 and fix(agc): validate host imports against their recorded backing #16751. They change other packets, memory handling or test registration; none addsCONTEXT_REG_RMW.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)🤖 Generated with Claude Code