From 9fb0363ba81db5103181a302dc67398c87fce77a Mon Sep 17 00:00:00 2001 From: pablogonz12 Date: Tue, 24 Nov 2026 02:54:55 +0100 Subject: [PATCH] D3D12.X: a timed-out UMA import check keeps what the GPU still uses check_uma_import waits 2 s for its copy out of the coherent window. When the wait ran out it returned and dropped the queue, allocator, list, fence and readback buffer and freed the probe words, with the copy still on the GPU. vkd3d-proton releases them at once; on RADV the GPU then faults on the freed memory (GCVM_L2_PROTECTION_FAULT, client TCP) and the gfx ring times out: the title's device is removed within its first minute. Under Wine the first use of the 4 GiB imported window can take longer than 2 s (1.3 s when it does not), so this happened in some runs only. On a timeout, what the copy uses is now kept (forgotten, once). --- crates/xcl/src/hle/d3d12x/real.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/xcl/src/hle/d3d12x/real.rs b/crates/xcl/src/hle/d3d12x/real.rs index 26019155e9..4c8bdf3e8b 100644 --- a/crates/xcl/src/hle/d3d12x/real.rs +++ b/crates/xcl/src/hle/d3d12x/real.rs @@ -274,11 +274,19 @@ unsafe fn check_uma_import(device: &ID3D12Device, u: &crate::gpu::uma::Uma, bufs readback.Unmap(0, None); Ok(got) }; - let got = run(); + let got = match run() { + Ok(got) => got, + Err(e) => { + // The copy may still be running: what it uses stays (a few KiB, once). Released under + // the GPU, vkd3d-proton frees it at once and the GPU faults (RADV: page faults, then a + // ring timeout) – a slow first use of the imported window is enough to get here. + std::mem::forget((queue, alloc, list, fence, readback)); + return Err(e); + } + }; for &(_, _, p, _) in &probes { u.free(p); } - let got = got?; let wrong: Vec = probes.iter().filter(|&&(_, i, _, c)| got[i] != c).map(|&(k, i, _, c)| format!("window {k}: wrote {c:#x}, the GPU read {:#x}", got[i])).collect(); if !wrong.is_empty() {