GPU: under Wine, write title memory without a wineserver request #256
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/256"
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 fxceless/victory-fork. Originally posted by yayameowmeow on 2026-11-24T23:01:55Z.
Problem
Under Wine (Linux, Proton),
write_mappedsends a wineserver request for every write. It puts shader results back into title memory withNtWriteVirtualMemory, orWriteProcessMemorywithVICTORY_DIRECT_WRITES=0. On Windows that is a kernel copy. Wine implements both as the server requestwrite_process_memory, which writes/proc/<pid>/mem, even when the process writes into itself. wineserver is one thread, and the process's other server calls (mappings, handles, timers) queue behind it.Counted with
WINEDEBUG=+serverin the opening gameplay scene (Wine 11.20, RX 7900 XTX / RADV): 3,400–24,000write_process_memoryrequests per 30 s.Fix
Under Wine (
ntdll!wine_get_versionpresent), the write becomes a read of our own process, from the host copy into the title page:ReadProcessMemory(GetCurrentProcess(), host, title, n).VICTORY_WINE_WRITES=0restores the old call.Verification
write_process_memoryno longer appears among the server requests (same scene,+servercount).map_view/unmap_view. Its per-process view list is searched linearly, which this PR doesn't address. With that also fixed locally, the scene runs at 0.6–0.9 s per frame instead of 2–6 s, but that number belongs to both changes.host::writes::writes_skip_pages_that_are_not_mapped: writes across two committed 64 KiB blocks around an uncommitted one and checks the committed ones got the bytes. Passes under Wine on both paths, the default andVICTORY_WINE_WRITES=0.cargo clippy --workspace --all-targets --locked -- -D warningsand the same with--all-featuresare clean (cross-built with cargo-xwin).cargo test -p victory-gpuunder Wine gives 107 passed, 4 failed. The same 4 fail on unmodifiedmainunder Wine: argument clamp, depth-plane twin, pipeline library, scratch reuse. Those are the Wine shader-compiler issues covered by #20 / #127. I couldn't run the suite on Windows.🤖 Generated with Claude Code
Imported from fxceless/victory-fork. Originally posted by ErRusso on 2026-11-24T23:43:41Z.
Review: APPROVED
Reviewed at
d945776against2119b0e.The Wine path is sound:
ReadProcessMemory(GetCurrentProcess(), host, title, n)copies into the title page in-process, while the existing 64 KiB/4 KiB fallback still leaves unmapped pages alone.VICTORY_WINE_WRITES=0preserves the old call andon_wine()is cached.Verified:
host::writes::writes_skip_pages_that_are_not_mappedpasses under Wine on the new path (the hole is skipped, the committed blocks receive the bytes). The author's server-count and title measurements cover the performance claim.LGTM.
Imported from fxceless/victory-fork. Originally posted by Filip722 on 2026-11-26T01:20:27Z.
I tested
d945776under GE-Proton11-14 on Bazzite 44, vkd3d-protoncae8353ed7959c4+, and an RTX 5060 Laptop GPU with NVIDIA 615.78.08. The local integration is based ondc4c0fcand adds copy-back timing. The mapped–unmapped–mapped writes test passed with each API selected, and the title log confirmedwine_runtime=trueand the expected API in both launches.The two offline Series S runs used the same binary, warm seed, memory/VRAM limits and NVMe caps. Four comparable post-upscale opening frames wrote about 0.8–4.5 MB each. With the legacy
NtWriteVirtualMemorypath their copy-back times were 3.03, 2.98, 9.64 and 10.14 s. With Wine's in-processReadProcessMemorypath the corresponding observations were 0.52, 0.56, 0.67 and 0.45 s. Median copy-back wall time across those four frames fell from 6.33 s to 0.54 s. The control's minimum free-disk reserve was reduced for replay and was inactive through the measured frames.The in-process run returned 58 post-upscale Presents and rendered the opening sequence. It ended on the local NVMe contention guard. This was one run per API and its performance measurements cover copy-back during the opening.
Codex assisted with the integration and tests.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.