fix(agc): import a span's ranges one at a time when Windows refuses its alias #3324
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3324"
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 reyani-dev on 2026-10-11T07:40:02Z.
What
Carries @Silverash-i8's fix from #3320 (the author is under the intake threshold). The commit is theirs, unchanged (
aa653ec5), and merges cleanly onto currentmain.Since #3158, an import covers the whole run of address-adjacent registered ranges. On Windows, a shared mapping in that run needs a read-write alias, and
WindowsMappings::MapAliasrefuses one unless the range is a single contiguous run of views of one section. Ranges that are adjacent in guest address can still be separate views, so the span's alias is refused and the exception escapesimportAllocation. As a result,agc_driver_dcc_keys_first_writefails onmainon Windows:When the alias of a multi-range span is refused, the span's base is recorded in
HostImports::unaliasedSpansandimportRunreturns just the containing range for that span from then on, so the import,runCoversand the refresh check agree. A refused alias for a single range still throws as before. Spans that alias fine, and all of Linux, are unchanged. A buffer that crosses two ranges of a refused span is copied as it was before #3158, which the host-import entry in TechnicalDebt now says.Closes #3320. cc @XairRrR (#3158)
Tested
Windows 11 (10.0.26200), WinLibs GCC 15.2.0 r7, Release, NVIDIA RTX 4070 Laptop GPU (driver 616.92), the commit merged onto
mainb6f649d9, withVK_LOADER_DRIVERS_DISABLE=*dzn*(#3255). This is a second machine next to the author's RTX 5060 run in #3320:main,agc_driver_dcc_keys_first_writefails with the message above.agc_driver_graphics(including #3158'simportCrossingTests/importSpanTests),agc_driver_bda_deviceandagc_driver_bda_span_reads.ctest -R "^agc_|video_out|^shader|recompiler": 366/366.check_conventions.pypasses, andpr_overlap.pyreports no overlap.Not run on Linux; the change only takes effect when Windows refuses an alias.
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 Mouhand-Kaddo on 2026-10-11T07:51:27Z.
Additional platform validation of standalone PR head
aa653ec50e6b516fef73d428e3c358e59d634b66(2026-10-11):Linux: passed — Arch Linux in WSL2 (kernel 6.6.87.2), GCC 16.2.1 20260810; CMake 4.3.1 / Ninja; Release,
BUILD_TESTING=ON.4 checks, 0 failures, 0 CTest skips. Built the selected targets and dependencies; this is focused validation, not a full build or full-suite run.
Checks:
agc_driver_graphics,agc_driver_bda_device,agc_driver_bda_span_reads,agc_driver_dcc_keys_first_write.Command after building:
ctest --test-dir <build> --verbose --no-tests=error --timeout 30 -R "^agc_driver_(graphics|dcc_keys_first_write|bda_device|bda_span_reads)$".Vulkan: Mesa lavapipe 26.2.4 / LLVM 23.1.1 software Vulkan; no native Linux hardware-GPU result.
Internal limitation: heap-mirror subcases returned early because the guest arena was not write-watched in WSL. Zero CTest skips does not include that early return.
These Linux checks cover the portable graphics/import path. The Windows alias-refusal fallback itself is platform-specific and was not exercised by this Linux run; the PR already reports Windows coverage.
No title/gameplay validation. These results cover the standalone head, not a merge with current main.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T08:01:18Z.
Checked on Linux: PR merged onto current main, libSceAgcDriver build and ctest green (the Windows-only path is not reachable there). Code reviewed: the retry after recording the span's base terminates because
importRunthen returns the single containing range, a single-range refusal still throws, and the TechnicalDebt entry matches the behaviour. Windows results from @AchrafReyani (RTX 4070) and @Silverash-i8 (RTX 5060) showagc_driver_dcc_keys_first_writefailing on main and passing with this change; merging.