Linux/RADV: VICTORY_PORT_CONSTANTS=1 makes every world frame black (main 39031cb) #163
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX#163
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@jtrudeau1530 on GitHub · 2026-11-26 08:35 UTC · original
Setup: Linux, Wine 11.18 with the tree-index wineserver (#111), vkd3d-proton, RADV, RX 7900 XT, Series X profile. The build is plain
mainat39031cb(diag), with the launcher-equivalent switches (RELAY=2, CARD_STEPS=2, THIN=1, JOIN_PARTS=8, …). Two consecutive 150 s runs into the opening of the story; the only difference isVICTORY_PORT_CONSTANTS.PORT_CONSTANTSunsetPORT_CONSTANTS=1I see the same result on a cool_fox + main merge with our local switches: 21-25 fps reported, ~2,980 draws, every world frame black.
VICTORY_PORT_DESCRIPTORS=1on its own is fine there: normal picture, same speed as without it.The port's own log lines look healthy:
The 32-bit heap reservation is
protection 0x1, kind 0x42000, flags 0x7: 185 MB, last 0x10000+0xb900000. After that the queue warnsa black frame after a frame that was notfor every world frame. No device removal and no exceptions.The switch is documented as off by default and experimental, so this is just a data point for whoever works on renderer port 1. If it works on Windows, the difference may be how Wine places or maps the low 32-bit heap pages (the views moved in address order). Happy to run a diagnostics variant or a
VICTORY_CAPTURE_FRAMEStrace if that helps.(AI-assisted with Claude Code; runs on my machine.)
@UwUCammie on GitHub · 2026-11-26 11:22 UTC · original · edited 2026-11-26 22:14 UTC
I reproduced the black output with renderer port 5 enabled on the Linux branch, using an RX 7900 XT, RADV 26.3.1, vkd3d-proton GE build
cae8353e(reported version 3.2.0) and tree-index Wine 11.22. Both runs used Series X, the same executable and separate copies of the same starting save and caches.With just
VICTORY_PORT_CBV=1the first room was visible by 183 s. The final counter reported zero table constant buffers read in place. AddingVICTORY_PORT_CONSTANTS=1brought that counter to 8,175 per frame in the final interval. At 125, 145, 172 and 183 s the captured game window had a luma range of 0–1 out of 255. The runtime still accepted 262 presents in the complete intervals between 145 and 183 s. Those presents give no usable gameplay rate.I found a second local game session overlapped both runs. The startup VRAM budgets also differed (18,569 vs 10,083 MiB), so these runs establish the image and counters on this visit. A run with the GPU reserved for this test is still needed to isolate the cause. Exact replay source
@Serph91P on GitHub · 2026-11-26 13:57 UTC · original
Cause found on RADV (RX 7900 XTX, Mesa 26.3.1, kernel 7.3, vkd3d-proton 71cae091, Proton Experimental 11.0-20261112): the import is refused and vkd3d-proton silently substitutes fresh memory.
OpenExistingHeapFromAddress1imports the view withVK_EXT_external_memory_host. RADV calls libdrm'samdgpu_create_bo_from_user_mem, which always setsAMDGPU_GEM_USERPTR_ANONONLY. A Wine section view has a file behind it, so the kernel returnsEPERM(amdgpu_ttm_tt_get_user_pages).vkd3d_import_host_memory) logs only a warning and allocates ordinary host-visible memory instead, so the heap opens "successfully" and shaders read zeros.private memory in place: reads true, writes true; the page pool's section in place: reads false, writes false.MAP_SHAREDmemfd view fails withVK_ERROR_INVALID_EXTERNAL_HANDLE; anonymous private memory imports and stays coherent. WithoutANONONLY(anLD_PRELOADshim clearing the flag) the memfd case imports and is coherent both ways, also after the other view is remapped.With the shim, port 1 opens its region (185 MB in place, 0 refused by the host) and the world renders. It was not faster here (63–68 ms a frame without it, 68–77 ms with ports 1+5, picture with defects), so this is about correctness, not speed.
I have a small change that makes port 1 check once under Wine whether a heap on a section view shows the card the view's bytes, and copy as before if not, instead of rendering black. Happy to open a PR.
Not tested: NVIDIA under Proton, other AMD generations. No game data in any of this.
@jtrudeau1530 on GitHub · 2026-11-26 15:43 UTC · original
Independent confirmation of @Serph91P's cause, with a 20-line shim anyone can use.
Setup: RX 7900 XT, Linux, Wine 11.18 with the tree-index wineserver, vkd3d-proton, RADV. Series X profile. Build: avatarmanz main
c9c932cmerged into our local branch. Each run lasts 180 s from the same save and caches.The shim is an
LD_PRELOADioctlhook that clearsAMDGPU_GEM_USERPTR_ANONONLYonDRM_IOCTL_AMDGPU_GEM_USERPTR:Build it with
gcc -O2 -shared -fPIC -I/usr/include/libdrm -o userptr_anyshim.so shim.c -ldl. Then setLD_PRELOAD=/path/userptr_anyshim.soon thewinecommand.Our results match yours:
So the shim is a correctness fix for now. It becomes a speed-up once the copy-back cost comes down.
+1 for your in-engine check that falls back to the copy. It avoids needing an
LD_PRELOAD, and it fails safe on kernels or drivers where the import still refuses.Not tested: NVIDIA, other AMD generations, and long sessions with the shim (a remapped section while the BO lives).
AI-assisted (Claude Code); the runs above were measured on my machine.
@Adiker on GitHub · 2026-11-26 18:05 UTC · original
Independent RX 7800 XT / Proton observation on the same
c9c932cbuild referenced above. This is consistent with #163, but it is not a single-switch reproduction and does not independently verify the proposed host-memory import mechanism.Environment: Ryzen 7 5700X, RX 7800 XT (Navi 32, 16 GB), 32 GB RAM, EndeavourOS / KDE Wayland, Linux 7.3.6, Mesa RADV 26.3.1; Proton Experimental's Wine with bundled vkd3d-proton 3.2.0 (build
2576c0b4adfae4a). Cross-compiledc9c932cbcc38defd8f1683d62dd298187f565031usingcargo xwin build --locked --profile diag -p victory --features diagnostics --target x86_64-pc-windows-msvc. Series S profile, 1920×1080, RT off. The Wine prefix had a native Microsoftd3dcompiler_47.dll;WINEDLLOVERRIDES=d3d12,d3d12core,dxgi,d3dcompiler_47=n,bandVKD3D_CONFIG=descriptor_heap.Observations:
VICTORY_PORT_CONSTANTS=1,VICTORY_PORT_DESCRIPTORS=1,VICTORY_PORT_CBV=1,VICTORY_PORT_GUARD=1,VICTORY_PORT_JOURNAL=1), complex scene frames remained black in the observed screenshots, although the log reported hundreds to thousands of draws per frame. The process reached that phase after about two minutes.VICTORY_PORT_CONSTANTS=0andVICTORY_PORT_CBV=0, a 3D scene and characters appeared. It still had missing geometry and overexposed lighting. Both options were changed together, so this run does not distinguish their individual effects. The captures were not matched frames, the shared copied cache warmed between runs, and each run was observed once; I cannot claim an isolated A/B result.THIN, andUPLOAD_AHEADdisabled also showed a scene. Both later runs usedTHIN=1andUPLOAD_AHEAD=1,RELAY=2,CARD_STEPS=2,JOIN_PARTS=8, and the other launcher-equivalent settings. Copies of the same initial save were used; timed Enter inputs at 30, 60 and 90 seconds were configured.The initial Wine-builtin compiler run separately logged
two-plane composer not made; showing base plane only; that warning disappeared with the native compiler, but the screen was still black in that earlier startup attempt. Prepared cache and automatic inputs were also introduced later, so I cannot attribute the initial startup behavior to a single factor.No source changes, driver shim, game files, saves, or full logs are attached. The reported visible-scene workaround is a configuration result, not a fix for port 1. AI-assisted; observations and measurements were made on this machine.
@jtrudeau1530 on GitHub · 2026-11-27 02:06 UTC · original
A follow-up: ports 1 and 5 now run on RADV without the shim and without userptr, using
VK_EXT_map_memory_placed.The shim from my last comment gets the import accepted, but RADV then makes the view an unpinned amdgpu userptr. Every
mprotector unmap anywhere in the process goes through the MMU notifier and waits for the GPU. In a standalone probe, onemprotectwhile the GPU was busy took 29.5 ms with a userptr against 1.6 ms with placed memory. That's why port 1 renders with the shim but gains no fps, and why in-place texture import collapses to 0.1–4.6 fps.What I did instead (
VICTORY_PORT_PLACED=1, needsVICTORY_PORT_CONSTANTS=1; off by default):VkDeviceMemoryfrom vkd3d-proton withID3D12DXVKInteropDevice3::GetVulkanHeapInfo. The offset must be 0, meaning a whole allocation.vkUnmapMemory2withVK_MEMORY_UNMAP_RESERVE_BIT_EXT.vkMapMemory2andVK_MEMORY_MAP_PLACED_BIT_EXTat the title's address, over placeholders that xmem has committed read-write.The CPU and GPU now share the same pages with no userptr, so a protection change costs what it does on any memory.
Missing piece: vkd3d-proton doesn't enable
VK_EXT_map_memory_placed/VK_KHR_map_memory2, and winevulkan needs the device functions. A small implicit Vulkan layer (about 230 lines of C, gated byENABLE_VICTORY_PLACED=1) does three things:memoryMapPlaced/memoryUnmapReserve.If the layer is missing, the placed map fails, a one-line log is written, and port 1 carries on as before.
Results: RX 7900 XT, Wine 11.18 tree-index, vkd3d-proton 71cae091, RADV, Series X, the same walking route and caches.
c9c932c014d52d1 heaps placed at the title's address (185 MB), 0 fallbacks.VICTORY_PORT_CONSTANTS_ORDER's flicker fix works because port 1 is active now.I'll open a PR against
main. It will add the switch, off by default, and put the layer source undertools/.AI-assisted (Claude Code).
@jtrudeau1530 on GitHub · 2026-11-27 02:15 UTC · original
The PR is up: #420 (
VICTORY_PORT_PLACED=1, off by default, layer undertools/vk-layer-placed/).AI-assisted (Claude Code).