fix(agc): keep a fast-clear copy where an import window can stamp watched memory #3372
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3372"
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 alfalfa-star on 2026-10-11T09:21:55Z.
Carried from @milescoviello's branch
fix/fast-clear-snapshot-import-window(commits4a085303and7ec9747b, kept under their name). The intake rule closes PRs opened from their account. The regression comes from my #2699, so I'm carrying the fix.What
Fixes #3179.
agc_driver_dcc_keys_first_writefails again onmainon Linux with NVIDIA (an unchanged pending image was uploaded again). #2699 made the DCC fast-clear upload skip the guest-byte copy (originalValid = false) when the range is write-watched. #2984 then madeRefreshturn aBlockMaybeWrittenunit intoBlockUnchangedonly throughcompareUntracked, which needs that copy. Where a host import leaves its range watched and stamps the imported pages when it is made, the import window stamps the surface, so a pending fast-cleared image counted as changed again.fix(agc): keep a fast-clear copy where an import window can stamp watched memoryHostImportskeeps whether making each kind of import (host pointer, dma-buf) stamped the probe's pages (writtenAtImport).WatchedImportsStampPages(context)decides the device's import watch and reports whether an import that leaves its range watched can stamp it. The fast-clear path skips the copy only when none can. This is the approach @oneandonlydean proposed in #3179.APS5_WRITE_WATCH_IMPORTS=watch) keeps the copy.agc_driver_dcc_keys_first_writenow expects the copy exactly when the range is unwatched or such a stamp is possible.test(agc): reproduce an import window over a pending storage imageRunImportWindow(Linux only) opens an import window itself over a pending storage image withGuestMemory::ImportWatchedand stores the byte already there. That leaves the same stamp as the NVIDIA import without depending on the driver. A store of a new byte inside a window must still be seen. Devices whose imports are compared print that the window is not tested.Not changed: the direct host-import upload path in
StorageTexture::upload(uncompressed keys) also skips the copy when the range is watched. Whether an import window can reach an image uploaded there has not been checked.Tested
By @milescoviello (Linux, RTX 5090 Laptop GPU 610.57.04, and Intel Arrow Lake ANV, Mesa 26.1.8), on
main4f602486:agc_driver_dcc_keys_first_writemain, NVIDIAan unchanged pending image was uploaded againFull
cteston NVIDIA with both commits: 763/763. @oneandonlydean confirmed the failure on an RTX 4090 and that reverting #2699 makes the test pass.By me, on this branch (
main90c152e8+ both commits, cherry-picked unchanged), Linux 7.2.9, GCC, Release, RX 9070 XT (RADV GFX1201):ctest: 813/813 pass (4video_out_flip_*skipped).agc_driver_dcc_keys_first_writepasses 3/3. RADV compares its imports (4 of 4 scratch pages written after a GPU read), so here neither the watched run nor the import window runs. This host doesn't test the fix itself.APS5_WRITE_WATCH_IMPORTS=watchforced on RADV, the import-window check fails (a pending image was uploaded again after an import that stored nothing new). The copy is present (GuestSnapshotValid()is true andWatchedImportsStampPages()is true), and the GPU changed none of the guest bytes. My reading is that RADV's own GPU reads of the import stamp the pages as written, which is why the probe compares imports there. If so, a forced watch on RADV doesn't test the NVIDIA case, but I haven't confirmed which stamp it is.tools/check_conventions.pypasses.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 milescoviello on 2026-10-11T09:26:49Z.
Thanks @alfalfa-star for carrying this and keeping the commits as they are, and @oneandonlydean for the approach.
Since RADV compares its imports, I ran this PR's head (
ee720ee0, onmain90c152e8) on the NVIDIA host (RTX 5090 Laptop GPU, 610.57.04, Linux):agc_driver_dcc_keys_first_write: passes 3/3. It fails 3/3 onmain4f602486without the change.ctest: 813/816. The three failures are theguest_video_out_*tests, which time out here only because this laptop's displays are powered off right now. They don't touch this change.The two commits are byte-identical to my branch (same
git patch-id). Theconventionscheck fails only on the PR template (Fill in the pull request template: fill Depends on with #N or none), so the description's Depends on line just needsnone.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T09:40:12Z.
Checked the diff, build and
libSceAgcDriverctest on Linux (agc_driver_dcc_keys_first_writepasses), plus the NVIDIA/ANV results from @milescoviello and the RTX 4090 confirmation in #3179. Filled the emptyDepends on:line in the description (none) so the conventions check passes; merging once it is green.Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-11T09:40:51Z.
Thanks @adriadam10 for reviewing and merging, @alfalfa-star for carrying it, and @oneandonlydean for the approach and the RTX 4090 check.