Renderer port 1 placed (VICTORY_PORT_PLACED=1, off by default): Linux/RADV without userptr #420
No reviewers
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!420
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-420"
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-27 02:14 UTC · original
jtrudeau1530:feat/port-placed-linux→main· +1257 −9 · 9 files · 2 commits · openRenderer port 1 placed (
VICTORY_PORT_PLACED=1, withVICTORY_PORT_CONSTANTS=1; off by default)What it does
Renderer port 1 opens the section views the title maps into its 32-bit graphics
reservation as a heap from an address (
OpenExistingHeapFromAddress1). WithVICTORY_PORT_PLACED=1, at the title's first mapping of physical pages into thatreservation,
xmembacks it with a D3D12 heap of the card's instead:VkDeviceMemoryfrom vkd3d-proton (ID3D12DXVKInteropDevice3::GetVulkanHeapInfo, offset 0);vkUnmapMemory2,RESERVE);vkMapMemory2,PLACED), and the pages the title had written copied in.From then on the title's mapping calls in the reservation are bookkeeping only,
writes to those pages through
Section::windowgo to the placed memory, and port 1places its buffers in that heap at their offsets. Anything it cannot handle (pages
aliased elsewhere, other pages mapped in,
VirtualFreethere, a failed step) puts thesection views back and port 1 goes on as before. Each failure is logged; the
frame-rate line counts heaps placed, fallbacks and releases.
With the switch unset, nothing changes: every new path is behind
port_placed::on()or a non-empty placed list.
Why
Under Wine the heap port 1 opens is imported host memory, which RADV makes an amdgpu
userptr. Every protection change or unmap in the process then invalidates it. In a
probe, one
mprotecttook 29.5 ms against 1.6 ms while the GPU was busy. With thecard's own allocation mapped at the title's address, protection changes cost what they
cost on any memory.
Results
RX 7900 XT, walking route:
1 heaps placed at the title's address (185 MB), 0 fallbacks.Measured on our branch (upstream
014d52dmerged, the same placed code), Wine 11.18 tree-index, vkd3d-proton master71cae091, RADV, Series X, the same caches; ports 1 and 5 (VICTORY_PORT_CBV=1) on in both arms. Picture correct;VICTORY_PORT_CONSTANTS_ORDER's flicker fix active since port 1 runs. This branch itself is built (diag and release) but not run in game. Not tested on Windows.Reviewer note:
port_placed.rsspells out theID3D12DXVKInteropDevice3vtable order and IID; checked against vkd3d-proton71cae091.Enabling it on Linux
vkd3d-proton's device needs
VK_KHR_map_memory2andVK_EXT_map_memory_placedenabled. The implicit layer in
tools/vk-layer-placed/does that; its README has thebuild line and the manifest install (
~/.local/share/vulkan/implicit_layer.d/). Then:Without the layer the placed mapping is refused, a warning is logged once, and port 1
runs as before.
Refs #163
AI-assisted (Claude Code).
@UwUCammie on GitHub · 2026-11-27 02:25 UTC · original
I’ve staged this on
linux-amd-bestfor the RX 7900 XT. One thing I spotted in the layer while setting up the probe: the existing-feature branch casts awayconstand writesmemoryMapPlacedandmemoryUnmapReserveinto the caller’sVkDeviceCreateInfo::pNext. Could that branch keep the supplied features untouched, and fall back if either flag is already disabled? It would also be worth checking both bits withvkGetPhysicalDeviceFeatures2before injecting the layer-owned struct. Right now the extension names are the only check before enabling both.@UwUCammie on GitHub · 2026-11-27 02:53 UTC · original
The layer test passed on the RX 7900 XT with RADV. Both placement feature bits were available, the layer added both extensions to a generated device request, and Vulkan created the device. I also tried a request that supplied both feature bits disabled. The patched layer passed it through and preserved the caller’s values. The AMD MSVC runtime check passed too.
I’m treating this as a device-creation check. The heap mapping and CPU/GPU round trip are the next runtime tests here. Layer change · Fixture and results
@jtrudeau1530 on GitHub · 2026-11-27 03:06 UTC · original
Thanks, @UwUCammie. Good catch. I took your layer change as is (
92dd8cf). It no longer writes into the caller'spNext, it checks both bits withvkGetPhysicalDeviceFeatures2, and it passes the request through if the caller supplied either bit disabled.Checked on an RX 7900 XT with RADV: the native placed-map test passes with
maintenance5both off and on.vkMapMemory2PLACED lands at the requested address, the old map stays reserved, and the CPU and GPU bytes match. The layer installed here locally is now this version.AI-assisted (Claude Code).
@UwUCammie on GitHub · 2026-11-27 05:03 UTC · original
The D3D12 round trip passed here on the RX 7900 XT with Wine 11.22 and RADV 26.3.1, on both GE
cae8353ed7959c4and71cae091b06571e. I used the placed layer in a scratch prefix. The runtime made the D3D12 heap, reserved its old CPU mapping, placed it at the test address, and used the port to make a buffer across a 64 KiB boundary. The GPU read the bytes the CPU had written, and the CPU saw a fenced GPU write across that boundary. Both runs verified the device and the result. FixtureThat's the heap path with generated data. The saved route still needs to show that the title selects the placed heap and renders with it.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.