d3d12: refuse section-backed imports that RADV silently substitutes #199
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/199"
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 brcly/TuxBox. Originally posted by smith-3 on 2026-11-25T21:11:36Z.
On RADV, every GPU import of XMem physical pages silently reads zeros. XMem pages are section views, which Wine maps as shared memory. RADV refuses shared memory as a host pointer, and vkd3d-proton then allocates unrelated memory while
OpenExistingHeapFromAddressstill succeeds. Strict mode (TUXBOX_REQUIRE_BUFFER_IMPORT=1) does not notice, because a CPUMapof the heap still returns the guest pointer. This matches thebuffer-remapfailure in #189.This PR probes once per device with a GPU copy from an imported section view. When the copy misses the canary, imports of section-backed ranges fail with
E_NOTIMPLand a log line, instead of aliasing nothing. If the probe itself cannot run, the previous behaviour is kept. The first commit only improves thebuffer-remapdiagnostic so it reports every wrong copy.This does not make AMD work. XMem-backed buffers still cannot be imported on RADV. They now fail visibly instead of reading zeros. A real fix needs private (non-shared) backing for guest pages or a different import path, and is out of scope here.
Evidence
Ryzen 7 9700X iGPU (
1002:13c0, RADV 25.2.8) and RTX 4080 SUPER (10de:2702, NVIDIA 570.211.01), same machine, Proton Experimental 11.0-20261014.buffer-remapcontrol:1002:13c010de:2702copy 0: 256/256 wrong, [0]=0 expected 0x12340000; copy 1: 256/256 wrong ...; copy 2: 256/256 wrong, [0]=0 expected 0x98760000PASS words=768/768 identical=1 replacement=1place remapped buffer failed: 0x80004001, plus the log line belowPASS words=768/768 identical=1 replacement=1Wine trace on AMD before the fix:
Native Vulkan probe (
VK_EXT_external_memory_host,vkAllocateMemoryresult).vkGetMemoryHostPointerPropertiesEXTsucceeds in every case, so it cannot predict the failure.Checks
tuxbox.py check.tuxbox.py check(Lanes, shader translator). Proton'ssteam.exeaborts inlsteamclientwhen the Steam client is not running on this machine. The change only affects imports of section-backed memory on drivers that fail the probe, and NVIDIA passes the probe.🤖 Generated with Claude Code
Imported from brcly/TuxBox. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T21:11:49Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Imported from brcly/TuxBox. Originally posted by tsunderejay on 2026-11-25T21:23:33Z.
Static review found a blocking lifetime issue: the fence is created after submission, so CreateFence/Signal/SetEventOnCompletion failure can return and unmap the section while the GPU copy is still running. Create the fence before submission and ensure every post-submit path waits (or retains the mapping/objects). Also add a bounded wait so a stuck probe cannot hang the title. The remap diagnostic counter has a separate bug:
actual != expected && !wrong++stops incrementing after the first mismatch, so it reports 1/256 instead of 256/256.Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-26T14:42:34Z.
Thank you for this, @smith-3. Your approach to finding the problem, probing whether the GPU really reads imported section memory, is now in
mainashost_profile/section_probe.rs, which credits this PR, and you're credited as co-author of that commit (04a560c).I'm closing this because the rest has been overtaken: #200 handles substituted imports with a memory copy, and #218 adds a way to import XMem pages through their backing. If you think refusing a substituted import is still worth having, for example as a strict mode, a small PR on top of the current probe would be welcome. The review point about creating the fence before submitting the copy would be worth keeping in mind there.
Pull request closed