Linux/RADV: VICTORY_PORT_CONSTANTS=1 makes every world frame black (main 39031cb) #163

Open
opened 2026-11-26 08:37:36 +00:00 by github-bot · 6 comments
Owner

@⁠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 main at 39031cb (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 is VICTORY_PORT_CONSTANTS.

PORT_CONSTANTS unset PORT_CONSTANTS=1
world picture normal (mean luma of the last captured frames 12-52) black: mean luma 0.4 in every world frame; title cards ("NINE MONTHS AGO", "PROLOGUE") still show
draws/frame (last meter line) 1,087 2,962
fps 3.4 3.6

I 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=1 on its own is fine there: normal picture, same speed as without it.

The port's own log lines look healthy:

renderer port 1: the title's 32-bit graphics pages given their section's slices in address order at=0x2610000 pages=752 moved=752 all=752 not_fresh=0
renderer port 1: the title's 32-bit graphics pages given their section's slices in address order at=0x5510000 pages=1600 moved=1600 all=2352 not_fresh=0

The 32-bit heap reservation is protection 0x1, kind 0x42000, flags 0x7: 185 MB, last 0x10000+0xb900000. After that the queue warns a black frame after a frame that was not for 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_FRAMES trace if that helps.

(AI-assisted with Claude Code; runs on my machine.)

**@⁠jtrudeau1530** on GitHub · 2026-11-26 08:35 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/163) **Setup:** Linux, Wine 11.18 with the tree-index wineserver (#111), vkd3d-proton, RADV, RX 7900 XT, Series X profile. The build is plain `main` at `39031cb` (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 is `VICTORY_PORT_CONSTANTS`. | | `PORT_CONSTANTS` unset | `PORT_CONSTANTS=1` | |---|---|---| | world picture | normal (mean luma of the last captured frames 12-52) | **black: mean luma 0.4 in every world frame**; title cards ("NINE MONTHS AGO", "PROLOGUE") still show | | draws/frame (last meter line) | 1,087 | 2,962 | | fps | 3.4 | 3.6 | I 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=1` on its own is fine there: normal picture, same speed as without it. The port's own log lines look healthy: ``` renderer port 1: the title's 32-bit graphics pages given their section's slices in address order at=0x2610000 pages=752 moved=752 all=752 not_fresh=0 renderer port 1: the title's 32-bit graphics pages given their section's slices in address order at=0x5510000 pages=1600 moved=1600 all=2352 not_fresh=0 ``` The 32-bit heap reservation is `protection 0x1, kind 0x42000, flags 0x7: 185 MB, last 0x10000+0xb900000`. After that the queue warns `a black frame after a frame that was not` for 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_FRAMES` trace if that helps. (AI-assisted with Claude Code; runs on my machine.)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:37:36 +00:00
Author
Owner

@⁠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=1 the first room was visible by 183 s. The final counter reported zero table constant buffers read in place. Adding VICTORY_PORT_CONSTANTS=1 brought 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

**@⁠UwUCammie** on GitHub · 2026-11-26 11:22 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/163#issuecomment-7190646388) · 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=1` the first room was visible by 183 s. The final counter reported zero table constant buffers read in place. Adding `VICTORY_PORT_CONSTANTS=1` brought 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](https://github.com/UwUCammie/VIctory-7900XTX/tree/3d55339a)
Author
Owner

@⁠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.

  • OpenExistingHeapFromAddress1 imports the view with VK_EXT_external_memory_host. RADV calls libdrm's amdgpu_create_bo_from_user_mem, which always sets AMDGPU_GEM_USERPTR_ANONONLY. A Wine section view has a file behind it, so the kernel returns EPERM (amdgpu_ttm_tt_get_user_pages).
  • vkd3d-proton (vkd3d_import_host_memory) logs only a warning and allocates ordinary host-visible memory instead, so the heap opens "successfully" and shaders read zeros.
  • The layer's own probe already shows it: private memory in place: reads true, writes true; the page pool's section in place: reads false, writes false.
  • Proved with a standalone Vulkan program on the same card: a MAP_SHARED memfd view fails with VK_ERROR_INVALID_EXTERNAL_HANDLE; anonymous private memory imports and stays coherent. Without ANONONLY (an LD_PRELOAD shim 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.

**@⁠Serph91P** on GitHub · 2026-11-26 13:57 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/163#issuecomment-7194071259) **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.** - `OpenExistingHeapFromAddress1` imports the view with `VK_EXT_external_memory_host`. RADV calls libdrm's `amdgpu_create_bo_from_user_mem`, which always sets `AMDGPU_GEM_USERPTR_ANONONLY`. A Wine section view has a file behind it, so the kernel returns `EPERM` (`amdgpu_ttm_tt_get_user_pages`). - vkd3d-proton (`vkd3d_import_host_memory`) logs only a warning and allocates ordinary host-visible memory instead, so the heap opens "successfully" and shaders read zeros. - The layer's own probe already shows it: `private memory in place: reads true, writes true; the page pool's section in place: reads false, writes false`. - Proved with a standalone Vulkan program on the same card: a `MAP_SHARED` memfd view fails with `VK_ERROR_INVALID_EXTERNAL_HANDLE`; anonymous private memory imports and stays coherent. Without `ANONONLY` (an `LD_PRELOAD` shim 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.
Author
Owner

@⁠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 c9c932c merged into our local branch. Each run lasts 180 s from the same save and caches.

The shim is an LD_PRELOAD ioctl hook that clears AMDGPU_GEM_USERPTR_ANONONLY on DRM_IOCTL_AMDGPU_GEM_USERPTR:

#define _GNU_SOURCE
#include <dlfcn.h>
#include <stdarg.h>
#include <libdrm/amdgpu_drm.h>
#include <drm/drm.h>
static int (*real_ioctl)(int, unsigned long, ...);
int ioctl(int fd, unsigned long req, ...) {
    va_list ap; va_start(ap, req); void *arg = va_arg(ap, void *); va_end(ap);
    if (!real_ioctl) real_ioctl = dlsym(RTLD_NEXT, "ioctl");
    if (req == DRM_IOCTL_AMDGPU_GEM_USERPTR && arg)
        ((struct drm_amdgpu_gem_userptr *)arg)->flags &= ~AMDGPU_GEM_USERPTR_ANONONLY;
    return real_ioctl(fd, req, arg);
}

Build it with gcc -O2 -shared -fPIC -I/usr/include/libdrm -o userptr_anyshim.so shim.c -ldl. Then set LD_PRELOAD=/path/userptr_anyshim.so on the wine command.

Run Ports Picture fps mean preparing ms copying back ms
26002 none ok 16.9 30.8 35.0
26003 6+7 ok 17.4 28.1 35.2
26006 shim, 1+5 ok (port 1: 185 MB in place) 16.1 18.4 35.0
26007 shim, 5 only ok, but 0 CBVs in place without port 1 15.6 25.3 32.4
26008 shim, 1+2+5+6+7 ok, faces fine 16.7 17.1 33.6

Our results match yours:

  • With the shim, ports 1 and 5 render correctly on RADV instead of black.
  • The preparing thread's work drops by about 12 ms a frame.
  • fps does not improve here, because on Linux the frame is set by the relay's copy back (about 34 ms a frame) rather than by preparing.

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.

**@⁠jtrudeau1530** on GitHub · 2026-11-26 15:43 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/163#issuecomment-7196673691) **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 `c9c932c` merged into our local branch. Each run lasts 180 s from the same save and caches. The shim is an `LD_PRELOAD` `ioctl` hook that clears `AMDGPU_GEM_USERPTR_ANONONLY` on `DRM_IOCTL_AMDGPU_GEM_USERPTR`: ```c #define _GNU_SOURCE #include <dlfcn.h> #include <stdarg.h> #include <libdrm/amdgpu_drm.h> #include <drm/drm.h> static int (*real_ioctl)(int, unsigned long, ...); int ioctl(int fd, unsigned long req, ...) { va_list ap; va_start(ap, req); void *arg = va_arg(ap, void *); va_end(ap); if (!real_ioctl) real_ioctl = dlsym(RTLD_NEXT, "ioctl"); if (req == DRM_IOCTL_AMDGPU_GEM_USERPTR && arg) ((struct drm_amdgpu_gem_userptr *)arg)->flags &= ~AMDGPU_GEM_USERPTR_ANONONLY; return real_ioctl(fd, req, arg); } ``` Build it with `gcc -O2 -shared -fPIC -I/usr/include/libdrm -o userptr_anyshim.so shim.c -ldl`. Then set `LD_PRELOAD=/path/userptr_anyshim.so` on the `wine` command. | Run | Ports | Picture | fps mean | preparing ms | copying back ms | |---|---|---|---|---|---| | 26002 | none | ok | 16.9 | 30.8 | 35.0 | | 26003 | 6+7 | ok | 17.4 | 28.1 | 35.2 | | 26006 | shim, 1+5 | **ok** (port 1: 185 MB in place) | 16.1 | **18.4** | 35.0 | | 26007 | shim, 5 only | ok, but 0 CBVs in place without port 1 | 15.6 | 25.3 | 32.4 | | 26008 | shim, 1+2+5+6+7 | **ok**, faces fine | 16.7 | **17.1** | 33.6 | Our results match yours: - With the shim, ports 1 and 5 render correctly on RADV instead of black. - The preparing thread's work drops by about 12 ms a frame. - fps does not improve here, because on Linux the frame is set by the relay's copy back (about 34 ms a frame) rather than by preparing. 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._
Author
Owner

@⁠Adiker on GitHub · 2026-11-26 18:05 UTC · original

Independent RX 7800 XT / Proton observation on the same c9c932c build 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-compiled c9c932cbcc38defd8f1683d62dd298187f565031 using cargo 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 Microsoft d3dcompiler_47.dll; WINEDLLOVERRIDES=d3d12,d3d12core,dxgi,d3dcompiler_47=n,b and VKD3D_CONFIG=descriptor_heap.

Observations:

  • With renderer ports 1, 2, 5, 6 and 7 enabled together (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.
  • In a later run with the same group except both VICTORY_PORT_CONSTANTS=0 and VICTORY_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.
  • A separate earlier control run with all five ports, THIN, and UPLOAD_AHEAD disabled also showed a scene. Both later runs used THIN=1 and UPLOAD_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.
  • In the visible-scene run, 10 periodic log intervals with at least 1,500 draws/frame had a median of 488.8 ms/frame (about 2 fps), with displayed interval rates 0.3–2.6 fps. This is a short loading/intro scene sample, not a steady-state gameplay benchmark; the log still reported dropped draws for unavailable pipelines. The native host pipeline library was not created, as described in #136. Memory pressure was also present: swap free fell below 1 GiB during the final run.

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.

**@⁠Adiker** on GitHub · 2026-11-26 18:05 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/163#issuecomment-7200038212) Independent RX 7800 XT / Proton observation on the same `c9c932c` build 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-compiled `c9c932cbcc38defd8f1683d62dd298187f565031` using `cargo 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 Microsoft `d3dcompiler_47.dll`; `WINEDLLOVERRIDES=d3d12,d3d12core,dxgi,d3dcompiler_47=n,b` and `VKD3D_CONFIG=descriptor_heap`. **Observations:** - With renderer ports 1, 2, 5, 6 and 7 enabled together (`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. - In a later run with the same group **except both `VICTORY_PORT_CONSTANTS=0` and `VICTORY_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. - A separate earlier control run with all five ports, `THIN`, and `UPLOAD_AHEAD` disabled also showed a scene. Both later runs used `THIN=1` and `UPLOAD_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. - In the visible-scene run, 10 periodic log intervals with at least 1,500 draws/frame had a median of **488.8 ms/frame** (about 2 fps), with displayed interval rates 0.3–2.6 fps. This is a short loading/intro scene sample, not a steady-state gameplay benchmark; the log still reported dropped draws for unavailable pipelines. The native host pipeline library was not created, as described in #136. Memory pressure was also present: swap free fell below 1 GiB during the final run. 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.
Author
Owner

@⁠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 mprotect or unmap anywhere in the process goes through the MMU notifier and waits for the GPU. In a standalone probe, one mprotect while 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, needs VICTORY_PORT_CONSTANTS=1; off by default):

  1. At the title's first physical mapping into its 32-bit graphics reservation, make a D3D12 heap the size of the reservation: custom, write-back, L0, buffers only.
  2. Get its VkDeviceMemory from vkd3d-proton with ID3D12DXVKInteropDevice3::GetVulkanHeapInfo. The offset must be 0, meaning a whole allocation.
  3. Release vkd3d's own CPU mapping but keep the range reserved: vkUnmapMemory2 with VK_MEMORY_UNMAP_RESERVE_BIT_EXT.
  4. Map the memory with vkMapMemory2 and VK_MEMORY_MAP_PLACED_BIT_EXT at the title's address, over placeholders that xmem has committed read-write.
  5. Place port 1's buffers and windows in that heap at their offsets, as before.

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 by ENABLE_VICTORY_PLACED=1) does three things:

  • raises the instance API to 1.4;
  • appends both extensions;
  • turns on 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.

build without placed (ports 1 + 5)
our branch + c9c932c 20.9 fps, prep 29.8 ms 22.2 fps, prep 23.8 ms
our branch + 014d52d 18.5 fps, prep 33.3 ms 19.2–19.9 fps, prep 24.0–24.3 ms
  • The log reports 1 heaps placed at the title's address (185 MB), 0 fallbacks.
  • The picture is correct, and VICTORY_PORT_CONSTANTS_ORDER's flicker fix works because port 1 is active now.
  • This covers only the 185 MB constants region so far. Texture memory still goes through copies.

I'll open a PR against main. It will add the switch, off by default, and put the layer source under tools/.

AI-assisted (Claude Code).

**@⁠jtrudeau1530** on GitHub · 2026-11-27 02:06 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/163#issuecomment-7207842902) **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 `mprotect` or unmap anywhere in the process goes through the MMU notifier and waits for the GPU. In a standalone probe, one `mprotect` while 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`, needs `VICTORY_PORT_CONSTANTS=1`; off by default):** 1. At the title's first physical mapping into its 32-bit graphics reservation, make a D3D12 heap the size of the reservation: custom, write-back, L0, buffers only. 2. Get its `VkDeviceMemory` from vkd3d-proton with `ID3D12DXVKInteropDevice3::GetVulkanHeapInfo`. The offset must be 0, meaning a whole allocation. 3. Release vkd3d's own CPU mapping but keep the range reserved: `vkUnmapMemory2` with `VK_MEMORY_UNMAP_RESERVE_BIT_EXT`. 4. Map the memory with `vkMapMemory2` and `VK_MEMORY_MAP_PLACED_BIT_EXT` at the title's address, over placeholders that xmem has committed read-write. 5. Place port 1's buffers and windows in that heap at their offsets, as before. 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 by `ENABLE_VICTORY_PLACED=1`) does three things: - raises the instance API to 1.4; - appends both extensions; - turns on `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. | build | without | placed (ports 1 + 5) | |---|---|---| | our branch + `c9c932c` | 20.9 fps, prep 29.8 ms | **22.2 fps, prep 23.8 ms** | | our branch + `014d52d` | 18.5 fps, prep 33.3 ms | **19.2–19.9 fps, prep 24.0–24.3 ms** | - The log reports `1 heaps placed at the title's address (185 MB), 0 fallbacks`. - The picture is correct, and `VICTORY_PORT_CONSTANTS_ORDER`'s flicker fix works because port 1 is active now. - This covers only the 185 MB constants region so far. Texture memory still goes through copies. I'll open a PR against `main`. It will add the switch, off by default, and put the layer source under `tools/`. *AI-assisted (Claude Code).*
Author
Owner

@⁠jtrudeau1530 on GitHub · 2026-11-27 02:15 UTC · original

The PR is up: #420 (VICTORY_PORT_PLACED=1, off by default, layer under tools/vk-layer-placed/).

AI-assisted (Claude Code).

**@⁠jtrudeau1530** on GitHub · 2026-11-27 02:15 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/163#issuecomment-7207961132) The PR is up: #420 (`VICTORY_PORT_PLACED=1`, off by default, layer under `tools/vk-layer-placed/`). *AI-assisted (Claude Code).*
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/avatarmanz--VIctory-7900XTX#163
No description provided.