perf(agc): do not drain for a stencil-only expand without a clear #26360
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/26360"
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 JJenkx on 2026-11-23T20:04:29Z.
What
DepthRenderControlDrainsdecides whether a draw'sDB_RENDER_CONTROLdrains the pipelined draw queue beforeNoteDepthRenderControlruns. Since #16168 a single-sample control, or a clear-only control on any other surface, no longer drains, but every multisampled control withDEPTH_COMPRESS_DISABLEorSTENCIL_COMPRESS_DISABLE(0x60) still does, so a surface that a queued draw has not registered yet is found.NoteDepthRenderControlonly changes a surface'sexpandedstate for a depth expand (0x40, with the stencil expand or no stencil plane) or a clear (0x3). A control with onlySTENCIL_COMPRESS_DISABLE(0x20) and no clear bit sets nothing butrenderControl, which only the "sampled through a descriptor without metadata" diagnostic prints. Such a control no longer drains:Depth expands drain as before, and clears keep the surface lookup of #16168. As before, a control that does not drain is not passed to
NoteDepthRenderControl, so the diagnostic's "last DB_RENDER_CONTROL" now shows the last control that could change a surface.agc_driver_native_depth_expand_gatechecks that a0x20control over the native target does not drain, that0x21(with a depth clear) does, and that a0x40expand at an address without a registered surface does; it then notes a0x20control on the surface and requires that sampling without metadata is still refused, i.e. the surface did not become expanded.Where it matters: Snoopy and the Great Mystery Club (PPSA28795) issues
DB_RENDER_CONTROL0x20over an 8-sample depth target for about a quarter of its draws. A gdb count on Windows saw 2,669NoteDepthRenderControlcalls in the first 37 s, all0x20on the same surface. In the first backyard scene that drained the pipeline about 58,000–60,000 times per 10 s (allDRAW_INDEX_2, opcode0x27), 3.4–3.7 s of every 10 s of the packet thread waiting for the committer.Tested
Windows 11 Enterprise 22621, Ryzen 9 5950X, Radeon RX 6700 XT (AMD driver 26.11.2), WinLibs GCC 15.2 UCRT r7, Release, Ninja. Candidate
5701d91506a(this branch onmainbfcd717ebc5); main controlbfcd717ebc5.GPU tests: every test of
agc_driver_native_multisample_depth_tests(33), 3 runs: 33/33 each run.agc_driver_native_depth_driver_queued_fillskips on this machine in each run (host imports are compared here, not write-watched).agc_driver_native_depth_expand_gateran all 6 cases (4 and 8 samples, with and without a stencil plane). Control:mainbfcd717ebc5with only the new test lines, 3 runs:agc_driver_native_depth_expand_gatefails every run witha stencil-only expand without a clear over the native target drains.Snoopy (PPSA28795,
01.000.002), first backyard scene, the same converted title and runtime, each arm copying its build's libraries in (driver hashes inarm.txt), Cross every 15 s from 30 s, 1920×1080. Both arms carry the uncommittedMultisampleTarget.cppchange of #26338 (aspr26338-src.patch), because without it one of the first two runs of this branch aborted at 9.5 s with that PR's import gate message; the summaries therefore say"dirty":true. The difference between the arms is this PR's commit only.APS5_TRACE_SECONDS=100:20only, arms in main, PR, PR, main order; all four 105 s screenshots show the same frame (gameplay HUD, "Search the backyard for clues."):Every PR run has more presents and a lower p50 than every main run: on average 233.5 against 221.5 presents (+5.4%) and p50 85.8 against 90.8 ms. The gain is modest and the spread is wide (run 2 is close to run 4), so I read it as about 5%, not more. The traces dropped events, so the frame figures come from present timestamps.
APS5_PROFILE_DRAW=1(diagnostic, separate runs, same setup), the backyard 10 s window:0x27Linux, in my run of this head: RX 6650 XT, RADV Mesa 26.3.1, Khronos layer 1.4.363.
^agc_driver_native_(multisample_depth|depth_.*)$|^agc_driver_stencil_plane_memory$(35 tests) passed 35 of 35 in each of 3 runs, with 0VUID-and 0SYNC-HAZARD.agc_driver_native_depth_driver_queued_fill, which skips on the Windows host above, runs and passes there.Independent Windows AMD validation reported by AlfaRojo: AMD Radeon iGPU (gfx1036), Windows 11 Pro 26200, GCC 15.2.0 Release, Khronos layer 1.4.363.
^agc_driver_native_(multisample_depth|depth_.*)$: 32 of 32 pass in each of 3 runs on the merge and onmain.agc_driver_native_depth_bda_clearis a separate target that run did not build, so it shows Not Run on both sides. WithDepthSurface.cpprestored tomain,agc_driver_native_depth_expand_gatefails all 3 runs with "a stencil-only expand without a clear over the native target drains". 0VUID-.Not tested: other titles, macOS, and the Snoopy drain count on Linux.
Traces, summaries, screenshots, profile lines, test logs, the control and scripts, SHA-256
7aa243c6c5b11fc885c60e8e182ae2f1b57d35877a38099b66df5f5dad102908.tools/check_conventions.py --base origin/main: passed.Performance report
Summary lines (
aps5-summary.jsonl), in run order; traces in the release linked above.Summary lines
tools/trace_digest.py, main (run 1)
Incomplete trace: recorded data was lost. Slice-based timings, waits and batch inventories cover retained events only; missing slices are not idle time. Summary statistics are reported separately.
Slowest frames (largest slices inside each, inclusive)
Persistent spikes (frame time above the fastest frame that separates it from a longer frame; one entry per stall, not per frame)
Threads (ms per frame)
Largest slices (ms per frame, inclusive, all threads): batch 41.8, Graphics.Draw 23.0, Driver.Packet 20.4, Graphics.Draw.draw_and_resource_release 16.9, Driver.Packet.draw 15.8
Longest waits
Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)
seconds 100:20 from present 2105: 241 presents, frame p50 82.4 / p90 94.0 / p99 97.8 / max 104.8 ms, GPU busy 48.1 ms per present
AMD Radeon RX 6700 XT, AMD proprietary driver 26.11.2 (AMD proprietary shader compiler), Windows 10.0.22621, 1920x1080, commit
5701d91506(dirty), dropped: yesIncomplete trace: recorded data was lost. Slice-based timings, waits and batch inventories cover retained events only; missing slices are not idle time. Summary statistics are reported separately.
Slowest frames (largest slices inside each, inclusive)
Persistent spikes (frame time above the fastest frame that separates it from a longer frame; one entry per stall, not per frame)
Threads (ms per frame)
Largest slices (ms per frame, inclusive, all threads): batch 48.1, Graphics.Draw 24.7, Recorder.Sync 20.9, Driver.Packet 18.3, Graphics.Draw.draw_and_resource_release 17.2
Longest waits
Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)