Wine/Proton: one-page MapViewOfFile3 calls get slower with every view (the stop at +0x4dcbc9d reported here was the no-audio-device case, see #222) #834

Open
opened 2026-11-26 04:14:02 +00:00 by github-bot · 17 comments
Owner

@⁠ghmfreitas on GitHub · 2026-11-24 11:53 UTC · original

Correction (2026-11-24, 13:22 UTC). The stop reported below was not caused by the mapping time. The sandbox had no audio output device, and that is what makes the title trap at +0x4dcbc9d (see #222 and ivall/xcl#695). The "null ALSA device" under Ruled out never actually opened. With a working null device the title runs past this point with the mapping unchanged: #834. The MapViewOfFile3 measurements themselves stand. The original text follows as written.

Host

  • Linux (Ubuntu 26.04, kernel 7.0), Intel i7-11800H, NVIDIA RTX 3070 Laptop 8 GB (driver 595.99.02), 32 GB RAM
  • Proton 11.0 (wine-11.0), vkd3d-proton loaded as native d3d12.dll / d3d12core.dll; rootful Xwayland window at 60 Hz; no network
  • VIctory ffe310e plus 3 local cfg(windows) test-only commits, cargo build --profile diag -p victory --features diagnostics --target x86_64-pc-windows-msvc cross-built on Linux
  • Title 1.0.2.1, Series X profile, victory run <exe> --execute, no input

Symptom (12 of 12 runs)

All 587 imports bind (0 missing), the device is created on the RTX 3070, frames are presented at 15 to 20 fps with 3 draws each, and every frame VIctory captures (1, 2, 4 ... 64) is black. After 82 frames or a few dozen more, about 19 s into the title's own running time, the title hits a breakpoint on its main thread and writes its own crash report:

VIctory: unhandled exception 0x80000003 at victory-image-b99f876b…dll+0x4dcbc9d
  #0 +0x4dcbc9d  #1 +0x4e52a83  #2 +0x4e529c4  #3 +0x5ab13ed  #4 +0x21b70b1  #5 +0x1d83996

What the threads are doing

With VICTORY_STACKS=10,14,18 the three dumps are identical (92 threads). The main thread waits in +0x5ab130a (called from +0x21b70b1), the same function the breakpoint path leaves from (+0x5ab13ed). One title thread sits in XMemMapPhysicalPages → xmem::map (xmem.rs:621 and :715, symbolized from victory.pdb); the others are in waits.

Where the time goes

Shortly before, the title reserves 3,542,286,336 bytes (54,051 pages of 64 KiB); the xmem::map calls that follow are one 64 KiB page each. With a local timer around the two host calls in xmem::map (my own instrumentation, not in the tree):

calls so far time inside MapViewOfFile3 cost per call
3,900 0.19 s ~52 µs
26,500 2.77 s ~192 µs
53,100 11.47 s ~442 µs

53,900 calls took 18.2 s, 11.85 s of it inside MapViewOfFile3. The VirtualFree that splits the placeholder adds 0.41 s in total. The stop comes about 40,000 calls after the last pause in the call stream, so before 54,051 pages could be mapped (I did not log addresses; that count is an estimate).

The stop does not wait for the mapping

Adding a 150 µs spin to each call makes the title stop with 42,900 calls done instead of 53,000. In three runs the stop comes 13.1 to 13.9 s after call 11,000. That fits a bounded wait on the main thread. I have not shown the deadline directly, nor that the title goes on when the mapping is fast.

Reproduction without the title

A test that allocates 54,051 physical pages, reserves one range with XMemVirtualAlloc(MEM_RESERVE | PAGES_64K) and calls XMemMapPhysicalPages(at, 1, …) once per page takes 17.9 s and 18.2 s under wine-11.0 (two runs, test profile). Cost per call grows in a straight line, from 62 µs in the first 6,000 calls to 627–672 µs in the last 6,000. The CPU time is in wineserver: 10.7 s of user time there against about 2 s in the test process at the last sample. I did not read what wineserver does per view.

I have no Windows number for the same test. It is about 30 lines in xmem.rs's test module; I can post it or open a PR with it marked #[ignore] if that helps.

Ruled out here

  • vkd3d-proton version: 3.0 (Proton 11.0), the official 3.1 release and 3.2.0 (from Proton Experimental) all give the same stop at the same address.
  • Audio: no audio device against a null ALSA device, same stop; no xaudio2 call is traced before it.
  • Synchronisation: server-side against WINEFSYNC=1 (fsync: up and running), same stop and the same time inside MapViewOfFile3.
  • --console series-s: same address.
  • The refused 2560x1440 format 86 texture of #797 comes 7 s earlier and the title keeps creating textures after it.

Not known

How Linux testers who reach the menus (#752, #144) get past this point: a faster core for wineserver, a different Wine, or a different path. Whether fewer, larger views under Wine would be safe in xmem (#234 touches the same area).

Side note for Linux testers

With Xvfb as the X server the run dies earlier, with 0xc0000094 in dxgi.dll+0x1c7cc (DXVK's dxgi from Proton 11.0) right after Creating swapchain. Xvfb reports a 0 Hz mode; a rootful Xwayland window (60 Hz) does not hit it.

**@⁠ghmfreitas** on GitHub · 2026-11-24 11:53 UTC · [original](https://github.com/Marvisak/VIctory/issues/834) > **Correction (2026-11-24, 13:22 UTC).** The stop reported below was not caused by the mapping time. The sandbox had no audio output device, and that is what makes the title trap at `+0x4dcbc9d` (see #222 and ivall/xcl#695). The "null ALSA device" under *Ruled out* never actually opened. With a working null device the title runs past this point with the mapping unchanged: https://git.gtahub.st/github/Marvisak--VIctory/issues/834. The `MapViewOfFile3` measurements themselves stand. The original text follows as written. ### Host - Linux (Ubuntu 26.04, kernel 7.0), Intel i7-11800H, NVIDIA RTX 3070 Laptop 8 GB (driver 595.99.02), 32 GB RAM - Proton 11.0 (wine-11.0), vkd3d-proton loaded as native `d3d12.dll` / `d3d12core.dll`; rootful Xwayland window at 60 Hz; no network - VIctory `ffe310e` plus 3 local `cfg(windows)` test-only commits, `cargo build --profile diag -p victory --features diagnostics --target x86_64-pc-windows-msvc` cross-built on Linux - Title 1.0.2.1, Series X profile, `victory run <exe> --execute`, no input ### Symptom (12 of 12 runs) All 587 imports bind (0 missing), the device is created on the RTX 3070, frames are presented at 15 to 20 fps with 3 draws each, and every frame VIctory captures (1, 2, 4 ... 64) is black. After 82 frames or a few dozen more, about 19 s into the title's own running time, the title hits a breakpoint on its main thread and writes its own crash report: ``` VIctory: unhandled exception 0x80000003 at victory-image-b99f876b…dll+0x4dcbc9d #0 +0x4dcbc9d #1 +0x4e52a83 #2 +0x4e529c4 #3 +0x5ab13ed #4 +0x21b70b1 #5 +0x1d83996 ``` ### What the threads are doing With `VICTORY_STACKS=10,14,18` the three dumps are identical (92 threads). The main thread waits in `+0x5ab130a` (called from `+0x21b70b1`), the same function the breakpoint path leaves from (`+0x5ab13ed`). One title thread sits in `XMemMapPhysicalPages` → `xmem::map` (`xmem.rs:621` and `:715`, symbolized from `victory.pdb`); the others are in waits. ### Where the time goes Shortly before, the title reserves 3,542,286,336 bytes (54,051 pages of 64 KiB); the `xmem::map` calls that follow are one 64 KiB page each. With a local timer around the two host calls in `xmem::map` (my own instrumentation, not in the tree): | calls so far | time inside `MapViewOfFile3` | cost per call | |---|---|---| | 3,900 | 0.19 s | ~52 µs | | 26,500 | 2.77 s | ~192 µs | | 53,100 | 11.47 s | ~442 µs | 53,900 calls took 18.2 s, 11.85 s of it inside `MapViewOfFile3`. The `VirtualFree` that splits the placeholder adds 0.41 s in total. The stop comes about 40,000 calls after the last pause in the call stream, so before 54,051 pages could be mapped (I did not log addresses; that count is an estimate). ### The stop does not wait for the mapping Adding a 150 µs spin to each call makes the title stop with 42,900 calls done instead of 53,000. In three runs the stop comes 13.1 to 13.9 s after call 11,000. That fits a bounded wait on the main thread. I have not shown the deadline directly, nor that the title goes on when the mapping is fast. ### Reproduction without the title A test that allocates 54,051 physical pages, reserves one range with `XMemVirtualAlloc(MEM_RESERVE | PAGES_64K)` and calls `XMemMapPhysicalPages(at, 1, …)` once per page takes 17.9 s and 18.2 s under wine-11.0 (two runs, test profile). Cost per call grows in a straight line, from 62 µs in the first 6,000 calls to 627–672 µs in the last 6,000. The CPU time is in `wineserver`: 10.7 s of user time there against about 2 s in the test process at the last sample. I did not read what `wineserver` does per view. I have no Windows number for the same test. It is about 30 lines in `xmem.rs`'s test module; I can post it or open a PR with it marked `#[ignore]` if that helps. ### Ruled out here - vkd3d-proton version: 3.0 (Proton 11.0), the official 3.1 release and 3.2.0 (from Proton Experimental) all give the same stop at the same address. - Audio: no audio device against a null ALSA device, same stop; no `xaudio2` call is traced before it. - Synchronisation: server-side against `WINEFSYNC=1` (`fsync: up and running`), same stop and the same time inside `MapViewOfFile3`. - `--console series-s`: same address. - The refused 2560x1440 format 86 texture of #797 comes 7 s earlier and the title keeps creating textures after it. ### Not known How Linux testers who reach the menus (#752, #144) get past this point: a faster core for `wineserver`, a different Wine, or a different path. Whether fewer, larger views under Wine would be safe in `xmem` (#234 touches the same area). ### Side note for Linux testers With Xvfb as the X server the run dies earlier, with `0xc0000094` in `dxgi.dll+0x1c7cc` (DXVK's dxgi from Proton 11.0) right after `Creating swapchain`. Xvfb reports a 0 Hz mode; a rootful Xwayland window (60 Hz) does not hit it.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:14:02 +00:00
Author
Owner

@⁠pushkarreddyy on GitHub · 2026-11-24 12:06 UTC · original

Claiming this issue for investigation and resolution.

Architectural Analysis & Proposed Optimization

In crates/victory-hle/src/modules/xmem.rs, XMemMapPhysicalPages processes physical page arrays by issuing an individual MapViewOfFile3 call for each 64 KiB page. When titles reserve ~3.5 GB (54,051 pages), making 54,051 distinct system calls incurs massive wineserver IPC context switching under Proton/Wine (~18 seconds), triggering internal title watchdogs/deadlines.

By scanning the physical page descriptors for contiguous runs of physical pages mapped to contiguous virtual addresses, we can coalesce runs into single multi-page MapViewOfFile3 calls (or batch adjacent mappings). For typical contiguous allocations, this reduces system calls by orders of magnitude (from 54,000+ to under 100).

Preparing an optimization branch on fork.

**@⁠pushkarreddyy** on GitHub · 2026-11-24 12:06 UTC · [original](https://github.com/Marvisak/VIctory/issues/834#issuecomment-7130986825) Claiming this issue for investigation and resolution. ### Architectural Analysis & Proposed Optimization In `crates/victory-hle/src/modules/xmem.rs`, `XMemMapPhysicalPages` processes physical page arrays by issuing an individual `MapViewOfFile3` call for each 64 KiB page. When titles reserve ~3.5 GB (54,051 pages), making 54,051 distinct system calls incurs massive `wineserver` IPC context switching under Proton/Wine (~18 seconds), triggering internal title watchdogs/deadlines. By scanning the physical page descriptors for contiguous runs of physical pages mapped to contiguous virtual addresses, we can coalesce runs into single multi-page `MapViewOfFile3` calls (or batch adjacent mappings). For typical contiguous allocations, this reduces system calls by orders of magnitude (from 54,000+ to under 100). Preparing an optimization branch on fork.
Author
Owner

@⁠MichaelSmithAI on GitHub · 2026-11-24 12:52 UTC · original

Bruce measured the one-page case through VIctory's guest XMem API. The source-built Win64 fixture made 54,051 separate calls, one 64 KiB page each. It used the same executable and Wine 11.22 client for all four runs. Only the wineserver changed, using a private build with the view-tree patch discussed in #340.

Run order Stock View tree View tree Stock
Total mapping time 5.37 s 1.55 s 2.16 s 8.35 s

On stock, the last 6,000 calls took 0.91–1.42 s. With the tree, they took 0.19–0.23 s. The first and last mapped slots retained their expected values in all four runs. This gives a measured improvement even when each guest call contains just one page, as in your trace. These timings cover the mapping loop on our Wine 11.22 setup. Whether that change affects the title's wait on your Proton 11.0 setup remains open.

**@⁠MichaelSmithAI** on GitHub · 2026-11-24 12:52 UTC · [original](https://github.com/Marvisak/VIctory/issues/834#issuecomment-7132030053) Bruce measured the one-page case through VIctory's guest XMem API. The source-built Win64 fixture made 54,051 separate calls, one 64 KiB page each. It used the same executable and Wine 11.22 client for all four runs. Only the wineserver changed, using a private build with the view-tree patch discussed in #340. | Run order | Stock | View tree | View tree | Stock | |---|---:|---:|---:|---:| | Total mapping time | 5.37 s | 1.55 s | 2.16 s | 8.35 s | On stock, the last 6,000 calls took 0.91–1.42 s. With the tree, they took 0.19–0.23 s. The first and last mapped slots retained their expected values in all four runs. This gives a measured improvement even when each guest call contains just one page, as in your trace. These timings cover the mapping loop on our Wine 11.22 setup. Whether that change affects the title's wait on your Proton 11.0 setup remains open.
Author
Owner

@⁠pushkarreddyy on GitHub · 2026-11-24 12:55 UTC · original

Updated Fix: Cross-Call Page Coalescing with Demand-Paging VEH

Thank you @⁠ghmfreitas for the sharp diagnosis and call-count telemetry! Your profiling pinpointed the exact bottleneck: the title initializes bulk memory by issuing XMemMapPhysicalPages(addr, 1, page) in a sequential loop where 44,660+ calls are contiguous across calls, causing wineserver to allocate and track 50,000+ individual 64 KiB views.

I have updated the branch with commit 546d9b0 (on branch perf/xmem-coalesce-page-maps):

Architectural Solution (crates/victory-hle/src/modules/xmem.rs):

  1. Cross-Call Run Detection:
    When subsequent calls on the same thread continue the active run (addr == pending.base + pending.n * PAGE within the same section and index run), XMemMapPhysicalPages increments pending.n += n and returns immediately without issuing VirtualFree or MapViewOfFile3.
  2. Single Syscall Flushes:
    When the run ends (non-contiguous address, section change, unmap, query, or other HLE memory calls), flush_pending executes a single VirtualFree and MapViewOfFile3 for the entire multi-thousand-page run at once. This collapses the 44,660+ individual views and syscalls down to a single view.
  3. Demand-Paging Vectored Exception Handler (VEH):
    Registered on_map_fault via AddVectoredExceptionHandler. If title CPU code touches memory in the pending placeholder window before another HLE API is invoked, the VEH intercepts the access violation, flushes the mapping, and returns EXCEPTION_CONTINUE_EXECUTION for seamless transparent resumption.
  4. Unit Test Verification:
    Added physical_pages_coalesce_across_individual_calls asserting that sequential 1-page invocations coalesce into a single view (assert_eq!(view, Some(10 * PAGE))) with verified read/write accessibility.

Tested with rustfmt --edition 2024 --check and zero Rule #1 asset violations. @⁠ghmfreitas, please try commit 546d9b0 when you have a chance!

**@⁠pushkarreddyy** on GitHub · 2026-11-24 12:55 UTC · [original](https://github.com/Marvisak/VIctory/issues/834#issuecomment-7132103281) ### Updated Fix: Cross-Call Page Coalescing with Demand-Paging VEH Thank you @⁠ghmfreitas for the sharp diagnosis and call-count telemetry! Your profiling pinpointed the exact bottleneck: the title initializes bulk memory by issuing `XMemMapPhysicalPages(addr, 1, page)` in a sequential loop where 44,660+ calls are contiguous across calls, causing wineserver to allocate and track 50,000+ individual 64 KiB views. I have updated the branch with commit [`546d9b0`](https://github.com/pushkarreddyy/VIctory/commit/546d9b0) (on branch [`perf/xmem-coalesce-page-maps`](https://github.com/pushkarreddyy/VIctory/tree/perf/xmem-coalesce-page-maps)): #### Architectural Solution (`crates/victory-hle/src/modules/xmem.rs`): 1. **Cross-Call Run Detection**: When subsequent calls on the same thread continue the active run (`addr == pending.base + pending.n * PAGE` within the same section and index run), `XMemMapPhysicalPages` increments `pending.n += n` and returns immediately without issuing `VirtualFree` or `MapViewOfFile3`. 2. **Single Syscall Flushes**: When the run ends (non-contiguous address, section change, unmap, query, or other HLE memory calls), `flush_pending` executes a single `VirtualFree` and `MapViewOfFile3` for the entire multi-thousand-page run at once. This collapses the 44,660+ individual views and syscalls down to a single view. 3. **Demand-Paging Vectored Exception Handler (VEH)**: Registered `on_map_fault` via `AddVectoredExceptionHandler`. If title CPU code touches memory in the pending placeholder window before another HLE API is invoked, the VEH intercepts the access violation, flushes the mapping, and returns `EXCEPTION_CONTINUE_EXECUTION` for seamless transparent resumption. 4. **Unit Test Verification**: Added `physical_pages_coalesce_across_individual_calls` asserting that sequential 1-page invocations coalesce into a single view (`assert_eq!(view, Some(10 * PAGE))`) with verified read/write accessibility. Tested with `rustfmt --edition 2024 --check` and zero Rule #1 asset violations. @⁠ghmfreitas, please try commit `546d9b0` when you have a chance!
Author
Owner

@⁠vladbondarenko97 on GitHub · 2026-11-24 13:03 UTC · original

This looks like the "no audio output device" case rather than page-mapping cost. Same trap, same address: +0x4dcbc9d is the title's assert when a 96 KiB per-thread audio command stream fills up. When the host has no playback device, the title's audio setup leaves a lock held, and the audio thread never drains those streams. The full chain, with RVAs, is in ivall/xcl#695; #222 here describes the Wine side (no sound driver → stops ~15 s in).

Evidence from another machine: on an RTX 3080 Ti PC with no active Windows render endpoint, VIctory and xcl both trap at +0x4dcbc9d. xcl with its silent-endpoint PR (ivall/xcl#887) runs past it: https://github.com/ivall/xcl/pull/887#issuecomment-7132280693.

Quick check for this report: does the Proton prefix have a working audio driver (winecfg → Audio, or WINEDLLOVERRIDES without winepulse/wineoss)? If not, enable one (or a null sink such as pactl load-module module-null-sink) and see whether the trap goes away before changing XMemMapPhysicalPages.

AI use: Claude Code (Claude Opus 5.5) drafted this from our test runs; I reviewed it.

**@⁠vladbondarenko97** on GitHub · 2026-11-24 13:03 UTC · [original](https://github.com/Marvisak/VIctory/issues/834#issuecomment-7132288867) This looks like the "no audio output device" case rather than page-mapping cost. Same trap, same address: `+0x4dcbc9d` is the title's assert when a 96 KiB per-thread audio command stream fills up. When the host has no playback device, the title's audio setup leaves a lock held, and the audio thread never drains those streams. The full chain, with RVAs, is in ivall/xcl#695; #222 here describes the Wine side (no sound driver → stops ~15 s in). Evidence from another machine: on an RTX 3080 Ti PC with no active Windows render endpoint, VIctory and xcl both trap at `+0x4dcbc9d`. xcl with its silent-endpoint PR (ivall/xcl#887) runs past it: https://github.com/ivall/xcl/pull/887#issuecomment-7132280693. Quick check for this report: does the Proton prefix have a working audio driver (`winecfg` → Audio, or `WINEDLLOVERRIDES` without `winepulse`/`wineoss`)? If not, enable one (or a null sink such as `pactl load-module module-null-sink`) and see whether the trap goes away before changing `XMemMapPhysicalPages`. *AI use: Claude Code (Claude Opus 5.5) drafted this from our test runs; I reviewed it.*
Author
Owner

@⁠Sunkiller-qc on GitHub · 2026-11-24 13:13 UTC · original

This isn't Wine-only. The same int3 at +0x4dcbc9d, at the same title frame 82, shows up on native Windows too:

  • #698, Tanju42's runs (RTX 5060 Laptop, Win11 26300): real GPU and WARP both stop at +0x4dcbc9d on frame 82, with the same stack (+0x4e52a83, +0x4e529c4, +0x5ab13ed, +0x21b70b1, +0x1d83996, +0x81afb9).
  • #872 (RTX 3090, Win11): once in 13 boots, frame 82, identical first six frames.
  • #49, dougmb: the same int3 on the append-to-buffer check.

So it's the title's shared 96 KiB buffer filling up before its consumer drains it. It happens every time under Wine, sometimes on Windows, and every time in Tanju42's setup. Your slow one-page MapViewOfFile3 calls would make it worse, but they're probably not the only thing that triggers it.

**@⁠Sunkiller-qc** on GitHub · 2026-11-24 13:13 UTC · [original](https://github.com/Marvisak/VIctory/issues/834#issuecomment-7132524238) This isn't Wine-only. The same `int3` at `+0x4dcbc9d`, at the same title frame 82, shows up on native Windows too: - #698, Tanju42's runs (RTX 5060 Laptop, Win11 26300): real GPU and WARP both stop at `+0x4dcbc9d` on frame 82, with the same stack (`+0x4e52a83`, `+0x4e529c4`, `+0x5ab13ed`, `+0x21b70b1`, `+0x1d83996`, `+0x81afb9`). - #872 (RTX 3090, Win11): once in 13 boots, frame 82, identical first six frames. - #49, dougmb: the same `int3` on the append-to-buffer check. So it's the title's shared 96 KiB buffer filling up before its consumer drains it. It happens every time under Wine, sometimes on Windows, and every time in Tanju42's setup. Your slow one-page `MapViewOfFile3` calls would make it worse, but they're probably not the only thing that triggers it.
Author
Owner

@⁠Sunkiller-qc on GitHub · 2026-11-24 13:46 UTC · original

Thanks for checking. That changes my reading too: I took the Windows hits as proof that the trap didn't depend on Wine, but the no-audio-device explanation would cover them as well. On #872, MichaelSmithAI pointed to an XCL report on Windows that got past the same offset on a PC with no active playback device, plus the Fedora/Wine case in #222.

So it would help to know whether the native Windows stops at +0x4dcbc9d had a working playback device at the time: @⁠Tanju42 (#698, real GPU and WARP) and @⁠JFIREonFIRE (#872, 1 boot in 13). If they didn't, all of these are #222, and this issue is left with just the Wine mapping cost, as your new title says.

**@⁠Sunkiller-qc** on GitHub · 2026-11-24 13:46 UTC · [original](https://github.com/Marvisak/VIctory/issues/834#issuecomment-7133308578) Thanks for checking. That changes my reading too: I took the Windows hits as proof that the trap didn't depend on Wine, but the no-audio-device explanation would cover them as well. On #872, MichaelSmithAI pointed to an XCL report on Windows that got past the same offset on a PC with no active playback device, plus the Fedora/Wine case in #222. So it would help to know whether the native Windows stops at `+0x4dcbc9d` had a working playback device at the time: @⁠Tanju42 (#698, real GPU and WARP) and @⁠JFIREonFIRE (#872, 1 boot in 13). If they didn't, all of these are #222, and this issue is left with just the Wine mapping cost, as your new title says.
Author
Owner

@⁠vladbondarenko97 on GitHub · 2026-11-24 13:53 UTC · original

A fix for this, tested on the retail title. PR creation is limited to collaborators right now, so here is the branch: https://github.com/vladbondarenko97/VIctory/tree/audio/silent-endpoint (one commit, d80294f, on main ffe310e; compare: https://github.com/Marvisak/VIctory/compare/main...vladbondarenko97:VIctory:audio/silent-endpoint). If a PR is preferred once that is open again, I'll open one.

What is in it

  • modules/audio/silent.rs overrides the title's CoCreateInstance (ole32.dll, api-ms-win-core-com-l1-*; the retail exe imports it from api-ms-win-core-com-l1-1-0.dll and has no CoCreateInstanceEx/CoGetClassObject import). The host call always runs first. Only a successful MMDeviceEnumerator/IMMDeviceEnumerator creation without aggregation is looked at.
  • If the host has an ACTIVE render endpoint (or counting fails), the native enumerator is returned untouched, so PCs with audio see no change. Otherwise render flow shows one silent ACTIVE device; capture flow, other GetDevice ids and notifications go to the host.
  • The silent device's ISpatialAudioClient accepts 48 kHz float. Its ISpatialAudioObjectRenderStream signals the title's event every 10 ms while started, hands out 480-frame buffers and discards them. Start/Stop/Reset can be repeated, and dynamic objects are counted and capped. One info line is logged when it is used.
  • windows/windows-core become plain cfg(windows) dependencies (they were diagnostics-only).
  • Implemented independently, following the behaviour described in ivall/xcl#695 / #887; no xcl code was used (xcl is GPL-2.0).

Tested

  • Retail title 1.0.2.1 (package hashes verified) on a PC with no active playback device (every render endpoint Unknown). RTX 3080 Ti (driver 32.0.16.1060), i7-12700KF, 32 GB, Windows 11 Pro 26300, --profile diag --features diagnostics, this branch merged onto main ffe310e, scripted keys (VICTORY_KEYS) through the first-run menus.
    • Log: no active playback device: the title gets a silent audio endpoint at start; 30.0 fps throughout; no +0x4dcbc9d trap. Captures show the intro key art (frame 1024) and the Rockstar legal terms screen with the Privacy Policy box ticked at frame 5400 (~3 min). Without this change, main and xcl main both trap at +0x4dcbc9d on this PC (~20–30 s).
    • The process ended by itself at ~4 min 15 s, with no error or exception in its output (stderr ends with the usual copy statistics). I have not found out why yet; it happened after the point this PR is about.
  • cargo clippy --workspace --all-targets --locked -- -D warnings and with --all-features: clean.
  • cargo test -p victory-hle --locked: 99 passed, 1 failed. The failure is modules::display::tests::sdr_and_display_deferrals (0x80070032), which fails the same way on clean main on this machine. The 6 new tests pass: routing native vs silent, the 48 kHz float format accepted / 44.1 kHz rejected, 20 buffer cycles → Stop (no signal) → Start → 20 more, dynamic object counting, and a real CoCreateInstance call (skips itself without an audio service).
  • cargo test -p xtask --locked: 4 passed.

Not tested

  • A PC with a playback device on the retail title (that path returns the host's enumerator unchanged; covered by the routing test only).
  • Linux/Wine with no sound driver (#222's case). The fix should apply there too, but I haven't run it.
  • AMD/Intel GPUs. The 10 ms / 480-frame period and the object counts are reasoned from the ISpatialAudio API, not observed from the title.

AI use: Claude Code (Claude Sonnet 5.5) implemented the change and tests; Claude Opus 5.5 reviewed it, ran the retail test on my machine and wrote this description. I reviewed it.

**@⁠vladbondarenko97** on GitHub · 2026-11-24 13:53 UTC · [original](https://github.com/Marvisak/VIctory/issues/834#issuecomment-7133493803) **A fix for this, tested on the retail title. PR creation is limited to collaborators right now, so here is the branch:** https://github.com/vladbondarenko97/VIctory/tree/audio/silent-endpoint (one commit, `d80294f`, on `main` `ffe310e`; compare: https://github.com/Marvisak/VIctory/compare/main...vladbondarenko97:VIctory:audio/silent-endpoint). If a PR is preferred once that is open again, I'll open one. **What is in it** - `modules/audio/silent.rs` overrides the title's `CoCreateInstance` (`ole32.dll`, `api-ms-win-core-com-l1-*`; the retail exe imports it from `api-ms-win-core-com-l1-1-0.dll` and has no `CoCreateInstanceEx`/`CoGetClassObject` import). The host call always runs first. Only a successful `MMDeviceEnumerator`/`IMMDeviceEnumerator` creation without aggregation is looked at. - If the host has an ACTIVE render endpoint (or counting fails), the native enumerator is returned untouched, so PCs with audio see no change. Otherwise render flow shows one silent ACTIVE device; capture flow, other `GetDevice` ids and notifications go to the host. - The silent device's `ISpatialAudioClient` accepts 48 kHz float. Its `ISpatialAudioObjectRenderStream` signals the title's event every 10 ms while started, hands out 480-frame buffers and discards them. Start/Stop/Reset can be repeated, and dynamic objects are counted and capped. One info line is logged when it is used. - `windows`/`windows-core` become plain `cfg(windows)` dependencies (they were diagnostics-only). - Implemented independently, following the behaviour described in ivall/xcl#695 / #887; no xcl code was used (xcl is GPL-2.0). **Tested** - Retail title 1.0.2.1 (package hashes verified) on a PC with **no active playback device** (every render endpoint `Unknown`). RTX 3080 Ti (driver 32.0.16.1060), i7-12700KF, 32 GB, Windows 11 Pro 26300, `--profile diag --features diagnostics`, this branch merged onto `main` `ffe310e`, scripted keys (`VICTORY_KEYS`) through the first-run menus. - Log: `no active playback device: the title gets a silent audio endpoint` at start; 30.0 fps throughout; **no `+0x4dcbc9d` trap**. Captures show the intro key art (frame 1024) and the **Rockstar legal terms screen with the Privacy Policy box ticked** at frame 5400 (~3 min). Without this change, `main` and xcl `main` both trap at `+0x4dcbc9d` on this PC (~20–30 s). - The process ended by itself at ~4 min 15 s, with no error or exception in its output (stderr ends with the usual copy statistics). I have not found out why yet; it happened after the point this PR is about. - `cargo clippy --workspace --all-targets --locked -- -D warnings` and with `--all-features`: clean. - `cargo test -p victory-hle --locked`: 99 passed, 1 failed. The failure is `modules::display::tests::sdr_and_display_deferrals` (0x80070032), which fails the same way on clean `main` on this machine. The 6 new tests pass: routing native vs silent, the 48 kHz float format accepted / 44.1 kHz rejected, 20 buffer cycles → Stop (no signal) → Start → 20 more, dynamic object counting, and a real `CoCreateInstance` call (skips itself without an audio service). - `cargo test -p xtask --locked`: 4 passed. **Not tested** - A PC *with* a playback device on the retail title (that path returns the host's enumerator unchanged; covered by the routing test only). - Linux/Wine with no sound driver (#222's case). The fix should apply there too, but I haven't run it. - AMD/Intel GPUs. The 10 ms / 480-frame period and the object counts are reasoned from the ISpatialAudio API, not observed from the title. **AI use:** Claude Code (Claude Sonnet 5.5) implemented the change and tests; Claude Opus 5.5 reviewed it, ran the retail test on my machine and wrote this description. I reviewed it.
Author
Owner

@⁠pushkarreddyy on GitHub · 2026-11-24 14:13 UTC · original

Thanks @⁠vladbondarenko97 for the detailed investigation into the audio endpoint assert!

It's great to have both angles resolved:

  1. Audio endpoint starvation: Your silent audio device on udio/silent-endpoint prevents the title's 96 KiB audio command buffer from overflowing when no physical audio output is present.
  2. Page-mapping scaling freeze: Our branch perf/xmem-coalesce-page-maps (commit 546d9b0) solves the 44,660+ sequential one-page MapViewOfFile3 syscall bottleneck by coalescing contiguous physical page runs and providing demand-paging VEH fallback.

Both fixes complement each other cleanly to ensure stable boots across Wine/Proton and native Windows environments.

**@⁠pushkarreddyy** on GitHub · 2026-11-24 14:13 UTC · [original](https://github.com/Marvisak/VIctory/issues/834#issuecomment-7134034511) Thanks @⁠vladbondarenko97 for the detailed investigation into the audio endpoint assert! It's great to have both angles resolved: 1. **Audio endpoint starvation:** Your silent audio device on udio/silent-endpoint prevents the title's 96 KiB audio command buffer from overflowing when no physical audio output is present. 2. **Page-mapping scaling freeze:** Our branch [perf/xmem-coalesce-page-maps](https://github.com/pushkarreddyy/VIctory/tree/perf/xmem-coalesce-page-maps) (commit [546d9b0](https://github.com/pushkarreddyy/VIctory/commit/546d9b0)) solves the 44,660+ sequential one-page MapViewOfFile3 syscall bottleneck by coalescing contiguous physical page runs and providing demand-paging VEH fallback. Both fixes complement each other cleanly to ensure stable boots across Wine/Proton and native Windows environments.
Author
Owner

@⁠mkslzk on GitHub · 2026-11-24 14:21 UTC · original

Reproduction on a different GPU, with the same shape as your measurement.

Stack: CachyOS kernel 7.3.5, RX 7900 XT (RDNA3, RADV), Mesa 26.3.1, Wine 11.22,
vkd3d-proton 3.2.0, build ffe310e plus the proton-fixes branch (#844).

In the world, per frame:

0.1 to 0.2 fps, 5266 to 6999 ms/frame
copies 4166 to 5147 ms for 46 to 168 MB per frame

54 MB in 7.35 s is 7 MB/s. That is not bandwidth, it is per-call overhead, and it confirms your
analysis of one MapViewOfFile3 per 64 KiB page and the wineserver round trips that come with it.
The cost also scales with the number of views rather than with the byte count (46 MB took 774 ms in
one frame, 54 MB took 7350 ms in another), which is the signature you describe rather than a
throughput limit.

We have your perf/xmem-coalesce-page-maps commit (47b1f3b) cherry-picked onto proton-fixes and
are measuring the same run with it now. If the copies collapse as expected, I will add the numbers
here, so the patch has a second data point on RDNA3 next to your RTX 3070.

One detail that may matter for the coalescing: our reservations are large (vm.vma.size 137 438 953 344
in the title's crash report, so 128 GiB of address space) while the physical pages actually mapped per
frame are small. If the run coalesces by contiguous virtual run, as your patch does, that should be
exactly the right axis.

**@⁠mkslzk** on GitHub · 2026-11-24 14:21 UTC · [original](https://github.com/Marvisak/VIctory/issues/834#issuecomment-7134233979) Reproduction on a different GPU, with the same shape as your measurement. **Stack:** CachyOS kernel 7.3.5, RX 7900 XT (RDNA3, RADV), Mesa 26.3.1, Wine 11.22, vkd3d-proton 3.2.0, build `ffe310e` plus the `proton-fixes` branch (#844). In the world, per frame: ``` 0.1 to 0.2 fps, 5266 to 6999 ms/frame copies 4166 to 5147 ms for 46 to 168 MB per frame ``` 54 MB in 7.35 s is 7 MB/s. That is not bandwidth, it is per-call overhead, and it confirms your analysis of one `MapViewOfFile3` per 64 KiB page and the `wineserver` round trips that come with it. The cost also scales with the number of views rather than with the byte count (46 MB took 774 ms in one frame, 54 MB took 7350 ms in another), which is the signature you describe rather than a throughput limit. We have your `perf/xmem-coalesce-page-maps` commit (`47b1f3b`) cherry-picked onto `proton-fixes` and are measuring the same run with it now. If the copies collapse as expected, I will add the numbers here, so the patch has a second data point on RDNA3 next to your RTX 3070. One detail that may matter for the coalescing: our reservations are large (`vm.vma.size` 137 438 953 344 in the title's crash report, so 128 GiB of address space) while the physical pages actually mapped per frame are small. If the run coalesces by contiguous virtual run, as your patch does, that should be exactly the right axis.
Author
Owner

@⁠pushkarreddyy on GitHub · 2026-11-24 12:15 UTC · original · edited 2026-11-24 14:22 UTC

Verified Patch Ready on Fork

The optimization coalescing page mappings is ready on my fork:

Changes (crates/victory-hle/src/modules/xmem.rs):

  • map_alias: Replaced page-by-page mapping loop with view slice run coalescing (view_avail.min(len - k)), mapping contiguous ranges in single map / MapViewOfFile3 invocations.
  • XMemMapPhysicalPagesScatter: Added adjacent address and page run detection, coalescing contiguous blocks into single multi-page XMemMapPhysicalPages(addr, run, page_ptr) calls instead of iterating one page at a time.
  • Drastically cuts system call volume during title startup and pool-to-tiled-heap migrations on Linux/Wine and Windows.

Verification:

  • Formatted with rustfmt --edition 2024.
  • Rule #1 asset policy compliant (cargo xtask policy clean).
  • ready for review or merge when PR permissions reopen.
**@⁠pushkarreddyy** on GitHub · 2026-11-24 12:15 UTC · [original](https://github.com/Marvisak/VIctory/issues/834#issuecomment-7131193206) · edited 2026-11-24 14:22 UTC ### Verified Patch Ready on Fork The optimization coalescing page mappings is ready on my fork: - **Branch:** https://github.com/pushkarreddyy/VIctory/tree/perf/xmem-coalesce-page-maps - **Commit:** [`47b1f3b`](https://github.com/pushkarreddyy/VIctory/commit/47b1f3b) based on `main` (`ffe310e`) #### Changes (`crates/victory-hle/src/modules/xmem.rs`): - **`map_alias`**: Replaced page-by-page mapping loop with view slice run coalescing (`view_avail.min(len - k)`), mapping contiguous ranges in single `map` / `MapViewOfFile3` invocations. - **`XMemMapPhysicalPagesScatter`**: Added adjacent address and page run detection, coalescing contiguous blocks into single multi-page `XMemMapPhysicalPages(addr, run, page_ptr)` calls instead of iterating one page at a time. - Drastically cuts system call volume during title startup and pool-to-tiled-heap migrations on Linux/Wine and Windows. #### Verification: - Formatted with `rustfmt --edition 2024`. - Rule #1 asset policy compliant (`cargo xtask policy` clean). - ready for review or merge when PR permissions reopen.
Author
Owner

@⁠sander110419 on GitHub · 2026-11-24 16:43 UTC · original

A Linux/Wine data point from the world. It adds view counts, a wineserver profile and a test of 546d9b0; it does not include a fix. AI-assisted: Claude Opus 5.5 (Anthropic), running as an agent on my machine, did the measuring and wrote this. Every number below comes from real runs.

Setup: Pop!_OS, kernel 7.2.15, Ryzen 9 9955HX, RTX 5070 Laptop 8 GB (driver 595.104.02), 30 GB RAM, GE-Proton11-11 (wine-11.0 staging), vkd3d-proton master ec207194 as native d3d12/d3d12core. VIctory ffe310e plus the #844 proton-fixes commits, #1010 and local diagnostics, built with --profile diag --features diagnostics (cross-built with cargo-xwin). Title: the newer retail game.

Views in the world. A counter in XMemMapPhysicalPages walks Physical::views every 10,000 calls:

calls views views that continue the one before (same section, next slice, next address) 64 KiB pages mapped
50,000 29,499 29,092 96,085
90,000 52,770 48,468 119,356
120,000 94,436 79,426 161,022
150,000 98,987 79,077 165,573

About 80% of the views could merge into the view before them, which would leave about 20,000 views instead of about 99,000. The calls keep coming after loading: about 435 a second while the title draws 800 to 6,000 draws per frame.

What wineserver spends its time on. wineserver uses 85 to 96% of one core the whole time. Of 8 s of perf samples on it, 69.6% are in is_valid_view_addr and 29.0% in req_unmap_view. Both walk the process->views list in server/mapping.c, which is still a list on Wine master.

One title thread was waiting for a server reply in 27 of 40 samples taken 100 ms apart. In 4 s that thread blocked in 5,293 server calls: 2,457 were get_mapping_info under virtual_map_section, 423 were virtual_map_section itself and 384 were unmap_view_of_section.

A frame takes 2.4 to 6.2 s; 1.2 to 4.9 s of that is copies.

Skipping unchanged mappings does not help. I tried leaving alone the pages that already show the requested slice, in XMemMapPhysicalPages, XMemMapPhysicalPagesScatter and map_alias. Not one of 225,607 requested pages was already in place. The title moves pages to new addresses; it does not map the same page at the same address again.

546d9b0 on top of this tree: the title stops at startup in 2 of 2 runs. About 15 s in, two deferred runs fail to map, and the title then writes into the first page of the second one:

WARN victory_hle::modules::xmem: mapping physical pages failed (not a placeholder?) address=0x1df60000 len=154140672 error=Invalid address. (os error 487)
WARN victory_hle::modules::xmem: mapping physical pages failed (not a placeholder?) address=0x1b960000 len=39845888 error=Invalid address. (os error 487)
VIctory: unhandled exception 0xc0000005 at victory-image-…dll+0x555e3b1 (write 0x1b960000: reserved, never committed)

The calls that queued these pages had already returned success, so the title had no way to know the pages were not mapped.

My guess, not verified: the merged range covers more than one placeholder, and MapViewOfFile3 with MEM_REPLACE_PLACEHOLDER needs exactly one. The extra placeholders could be 64 KiB ones left by earlier one-page unmaps, or two reservations that sit next to each other. A fix would need to do one of these when it flushes:

  • join the placeholders first with MEM_COALESCE_PLACEHOLDERS (this only works within one reservation);
  • split the run at placeholder boundaries;
  • fall back to one view per page.

In every case, a call should not return success before its pages are mapped.

The view-tree change measured above, on the server side, should cut the cost of all these server calls here too. With about 99,000 views in the process, every map and unmap walks a list that long.

**@⁠sander110419** on GitHub · 2026-11-24 16:43 UTC · [original](https://github.com/Marvisak/VIctory/issues/834#issuecomment-7138108062) A Linux/Wine data point from the world. It adds view counts, a wineserver profile and a test of `546d9b0`; it does not include a fix. AI-assisted: Claude Opus 5.5 (Anthropic), running as an agent on my machine, did the measuring and wrote this. Every number below comes from real runs. **Setup:** Pop!_OS, kernel 7.2.15, Ryzen 9 9955HX, RTX 5070 Laptop 8 GB (driver 595.104.02), 30 GB RAM, GE-Proton11-11 (wine-11.0 staging), vkd3d-proton master `ec207194` as native `d3d12`/`d3d12core`. VIctory `ffe310e` plus the #844 proton-fixes commits, #1010 and local diagnostics, built with `--profile diag --features diagnostics` (cross-built with cargo-xwin). Title: the newer retail game. **Views in the world.** A counter in `XMemMapPhysicalPages` walks `Physical::views` every 10,000 calls: | calls | views | views that continue the one before (same section, next slice, next address) | 64 KiB pages mapped | |---:|---:|---:|---:| | 50,000 | 29,499 | 29,092 | 96,085 | | 90,000 | 52,770 | 48,468 | 119,356 | | 120,000 | 94,436 | 79,426 | 161,022 | | 150,000 | 98,987 | 79,077 | 165,573 | About 80% of the views could merge into the view before them, which would leave about 20,000 views instead of about 99,000. The calls keep coming after loading: about 435 a second while the title draws 800 to 6,000 draws per frame. **What wineserver spends its time on.** wineserver uses 85 to 96% of one core the whole time. Of 8 s of `perf` samples on it, 69.6% are in `is_valid_view_addr` and 29.0% in `req_unmap_view`. Both walk the `process->views` list in `server/mapping.c`, which is still a list on Wine master. One title thread was waiting for a server reply in 27 of 40 samples taken 100 ms apart. In 4 s that thread blocked in 5,293 server calls: 2,457 were `get_mapping_info` under `virtual_map_section`, 423 were `virtual_map_section` itself and 384 were `unmap_view_of_section`. A frame takes 2.4 to 6.2 s; 1.2 to 4.9 s of that is copies. **Skipping unchanged mappings does not help.** I tried leaving alone the pages that already show the requested slice, in `XMemMapPhysicalPages`, `XMemMapPhysicalPagesScatter` and `map_alias`. Not one of 225,607 requested pages was already in place. The title moves pages to new addresses; it does not map the same page at the same address again. **`546d9b0` on top of this tree: the title stops at startup in 2 of 2 runs.** About 15 s in, two deferred runs fail to map, and the title then writes into the first page of the second one: ``` WARN victory_hle::modules::xmem: mapping physical pages failed (not a placeholder?) address=0x1df60000 len=154140672 error=Invalid address. (os error 487) WARN victory_hle::modules::xmem: mapping physical pages failed (not a placeholder?) address=0x1b960000 len=39845888 error=Invalid address. (os error 487) VIctory: unhandled exception 0xc0000005 at victory-image-…dll+0x555e3b1 (write 0x1b960000: reserved, never committed) ``` The calls that queued these pages had already returned success, so the title had no way to know the pages were not mapped. My guess, not verified: the merged range covers more than one placeholder, and `MapViewOfFile3` with `MEM_REPLACE_PLACEHOLDER` needs exactly one. The extra placeholders could be 64 KiB ones left by earlier one-page unmaps, or two reservations that sit next to each other. A fix would need to do one of these when it flushes: - join the placeholders first with `MEM_COALESCE_PLACEHOLDERS` (this only works within one reservation); - split the run at placeholder boundaries; - fall back to one view per page. In every case, a call should not return success before its pages are mapped. The view-tree change measured above, on the server side, should cut the cost of all these server calls here too. With about 99,000 views in the process, every map and unmap walks a list that long.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 03:49 UTC · original · edited 2026-11-26 06:43 UTC

Automated triage for the maintainers. As the corrected title says, the stop at +0x4dcbc9d is the no-audio-device case. Open PR #929 (silent playback endpoint) and PR #222 address it. What remains here is the Wine cost of many one-page views. On main (63bcca4), XMemMapPhysicalPages in crates/victory-hle/src/modules/xmem.rs still makes one MapViewOfFile3 view per contiguous run within a call. The title maps one page per call, so the process ends up with tens of thousands of views (about 99,000 to 135,000 in the world in the comments), and wineserver walks a list of them on each map and unmap. The wineserver side is discussed in #340. Related open PRs: #234 (persistent section views), #1224 and #1264.

Three independent A/B runs replaced only wineserver with one built with the view-tree change (Wine bug 60868), with no change to the layer:

  • RX 9070 on a fork-based tree (Proton Experimental): world frame from about 3 s to under 1 s, texture refresh from about 1.2 s to about 20 ms per frame.
  • RX 9060 XT on unmodified main 63bcca4: time to the first busy frame from 65–72 s to 38 s, wineserver CPU from about 70 % to 3 % of a core; remap cost at 100,000 views from 328 µs to 18 µs.
  • New since the last triage: RX 9070 XT on GE-Proton11-14 (a third-party tree, not main): opening-sequence frame from about 4.5 s to about 0.53 s with GPU time unchanged; one run each. The commenter has also proposed the server change to GE-Proton upstream.

Layer-side alternatives tried in the comments (narrower lock, joining or coalescing GPU mappings, private copies) did not help or were wrong, so the main lever is on the Wine side; on the VIctory side, any coalescing change still needs each call's pages mapped before it returns (the fork branch 546d9b0 did not, and stopped the title in 2 of 2 runs).


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 03:49 UTC · [original](https://github.com/Marvisak/VIctory/issues/834#issuecomment-7152272323) · edited 2026-11-26 06:43 UTC <!-- victory-issue-triage v1 verdict=tracked seen=2026-11-26T05:25:51Z at=2026-11-26T06:50:30Z --> Automated triage for the maintainers. As the corrected title says, the stop at `+0x4dcbc9d` is the no-audio-device case. Open PR #929 (silent playback endpoint) and PR #222 address it. What remains here is the Wine cost of many one-page views. On `main` (63bcca4), `XMemMapPhysicalPages` in `crates/victory-hle/src/modules/xmem.rs` still makes one `MapViewOfFile3` view per contiguous run within a call. The title maps one page per call, so the process ends up with tens of thousands of views (about 99,000 to 135,000 in the world in the comments), and wineserver walks a list of them on each map and unmap. The wineserver side is discussed in #340. Related open PRs: #234 (persistent section views), #1224 and #1264. Three independent A/B runs replaced only wineserver with one built with the view-tree change (Wine bug 60868), with no change to the layer: - RX 9070 on a fork-based tree (Proton Experimental): world frame from about 3 s to under 1 s, texture refresh from about 1.2 s to about 20 ms per frame. - RX 9060 XT on unmodified `main` 63bcca4: time to the first busy frame from 65–72 s to 38 s, wineserver CPU from about 70 % to 3 % of a core; remap cost at 100,000 views from 328 µs to 18 µs. - **New since the last triage:** RX 9070 XT on GE-Proton11-14 (a third-party tree, not `main`): opening-sequence frame from about 4.5 s to about 0.53 s with GPU time unchanged; one run each. The commenter has also proposed the server change to GE-Proton upstream. Layer-side alternatives tried in the comments (narrower lock, joining or coalescing GPU mappings, private copies) did not help or were wrong, so the main lever is on the Wine side; on the VIctory side, any coalescing change still needs each call's pages mapped before it returns (the fork branch `546d9b0` did not, and stopped the title in 2 of 2 runs). --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Beqren on GitHub · 2026-11-25 09:52 UTC · original

AMD/RADV data point: the wineserver view tree under Valve's Proton Experimental, and four layer-side alternatives that did not work

With only wineserver replaced by one built with the view-tree patch (CachyOS/wine-cachyos#50, Wine bug 60868), a world frame here went from about 3 s to under 1 s. Texture refreshes went from about 1.2 s a frame to about 20 ms, and the world was reached in 33-37 s instead of about 86 s. Everything I tried in the layer instead either did not help or was wrong; details below.

Setup: CachyOS, kernel 7.3.3, RX 9070 (RADV, Mesa 26.2.6), Ryzen 7 9800X3D, 60 GB RAM. Proton Experimental experimental-11.0-20261112 (Wine 11.0, its own vkd3d-proton 2576c0b4), Microsoft's d3dcompiler_47.dll in the prefix. The layer is a local branch based on myokex/victory-amd 070df42, diagnostics build, run off-screen for 240 s per run. Stock and patched runs alternated, and /proc/<pid>/exe of each run's wineserver showed which binary served it.

Per world frame (medians of the world summary lines, ms):

run lines frame preparing copies textures on GPU copying back dropped, no pipeline
stock 1 23 2862 2063 889 1247 147 215 1060
stock 2 23 3206 2911 1193 1223 136 293 1080
patched 1 20 982 383 198 21 250 287 598
patched 2 (first 30 s of world only) 6 324 122 50 7 136 66 449
patched 3 (on-screen session) 26 708 333 171 15 182 185 596
  • Draws per frame were similar, and the patched runs dropped fewer draws, so the speed-up is not skipped work. None of the five runs logged an error or a refused pipeline.
  • wineserver used about 79 ticks/s stock (most of a core) and about 7 ticks/s patched.
  • The texture time was almost all waiting. Remaps held the layer's title-memory mapping lock for 1.2-3.1 s a frame, and with the patch that wait is gone.

Microbenchmark (one run per point, 300 repetitions each). Each step unmaps a one-page section view to its placeholder, splits the placeholder and maps another page there, which is what the layer does per remapped 64 KiB page. Note that this is not the same operation as neonbyte1's map/unmap pair in #340.

views alive stock patched
100 63.8 µs* 9.3 µs
10,000 113.6 µs 11.5 µs
50,000 249.8 µs 12.0 µs
125,000 520.9 µs 12.2 µs

* Noisy: earlier stock runs of the same bench gave 14-24 µs at 100 views. Don't read this row as a patch effect. The point is that the patched cost stays flat in the number of views.

In the world this process held 123,000-135,000 views, 43,000-48,000 of them the GPU's page mappings (CopyPageMappingsBatchX). The title remapped 1,000-4,000 single 64 KiB pages a frame, at 0.6-0.9 ms per memory call on the stock server.

What did not work in the layer (all stock server):

  1. A narrower mapping lock. The lock was taken by address range, so a read waits only for remaps of its own range. The reads' wait fell from 85-377 ms a frame to 0, and none of them had actually met a remap of their range. The frame did not improve (median 2402 ms without it, 2436 ms with it), because it waits on the remaps themselves.
  2. Joining a GPU mapping to the neighbouring view. Views fell from 123-126k to 98-100k, and each remap call went from 0.57-0.80 ms to 0.43-0.57 ms. The frame median went from 2742 to 2283 ms, which is within these runs' noise (about 30%). So it is not a demonstrated win.
  3. Coalescing the GPU's mappings. Every one of them maps a single source page. Over the logged runs there were 0 pages in runs, and the page numbers step by 16 in this tree, so a check like 47b1f3b's next_page == start_page + run never matched. This applies to the GPU's alias mappings only. It does not contradict sander110419's count for XMemMapPhysicalPages views.
  4. Private copies instead of views for the GPU's mappings. This is fast but wrong. The frame went from 1830 ms to 840 ms median (views 122-129k down to 83-86k), but 34-622 copies a frame no longer matched their page when they were dropped. The title or the GPU writes through one side and reads through the other, so snapshot copies are not an emulation.

The same holds as in sander110419's runs: 0 of 2,000-3,700 remapped pages a frame were already mapped as asked.

Mapping behind Wine's back is not available from the Windows side either. Wine 11 turns on syscall user dispatch for every thread, so a raw syscall from PE code is serviced as an NT system call: getpid returned 0xC0000005 and memfd_create returned 0xC000001C. The clean routes are a unix-side helper called through __wine_unix_call, which would have to ship matched to each Proton build, or the server fix. The server fix needs no change to the layer.

One caveat about the patched runs. All three patched runs ended early, at 64, 148 and 182 s, with dstorage: request failed: copying options=0x0 ... hr=0x800703e6 followed by the title's breakpoint. That failure also happens on the stock server. It is a race in the layer: a kernel ReadFile lands in a page that another thread has just guarded again. A fix for the fork is proposed in myokex/victory-amd#2; ours is a different one, described in my comment there. After our fix, two 10-minute runs on the patched server had no failure, with median world frames of 349 and 401 ms. Those runs used a later build, so they are not part of the A/B above. How the server was built for Valve's Proton Experimental is in my comment on PR #2082.

No game data; counts and timings only.

Measured and written with an AI coding assistant (Claude Code) working on my machine; the numbers are from the runs described above.

**@⁠Beqren** on GitHub · 2026-11-25 09:52 UTC · [original](https://github.com/Marvisak/VIctory/issues/834#issuecomment-7158918844) **AMD/RADV data point: the wineserver view tree under Valve's Proton Experimental, and four layer-side alternatives that did not work** With only `wineserver` replaced by one built with the view-tree patch (CachyOS/wine-cachyos#50, Wine bug 60868), a world frame here went from about 3 s to under 1 s. Texture refreshes went from about 1.2 s a frame to about 20 ms, and the world was reached in 33-37 s instead of about 86 s. Everything I tried in the layer instead either did not help or was wrong; details below. **Setup:** CachyOS, kernel 7.3.3, RX 9070 (RADV, Mesa 26.2.6), Ryzen 7 9800X3D, 60 GB RAM. Proton Experimental `experimental-11.0-20261112` (Wine 11.0, its own vkd3d-proton `2576c0b4`), Microsoft's `d3dcompiler_47.dll` in the prefix. The layer is a local branch based on myokex/victory-amd `070df42`, diagnostics build, run off-screen for 240 s per run. Stock and patched runs alternated, and `/proc/<pid>/exe` of each run's wineserver showed which binary served it. **Per world frame** (medians of the world summary lines, ms): | run | lines | frame | preparing | copies | textures | on GPU | copying back | dropped, no pipeline | |---|---:|---:|---:|---:|---:|---:|---:|---:| | stock 1 | 23 | 2862 | 2063 | 889 | 1247 | 147 | 215 | 1060 | | stock 2 | 23 | 3206 | 2911 | 1193 | 1223 | 136 | 293 | 1080 | | patched 1 | 20 | 982 | 383 | 198 | 21 | 250 | 287 | 598 | | patched 2 (first 30 s of world only) | 6 | 324 | 122 | 50 | 7 | 136 | 66 | 449 | | patched 3 (on-screen session) | 26 | 708 | 333 | 171 | 15 | 182 | 185 | 596 | - Draws per frame were similar, and the patched runs dropped fewer draws, so the speed-up is not skipped work. None of the five runs logged an error or a refused pipeline. - wineserver used about 79 ticks/s stock (most of a core) and about 7 ticks/s patched. - The texture time was almost all waiting. Remaps held the layer's title-memory mapping lock for 1.2-3.1 s a frame, and with the patch that wait is gone. **Microbenchmark** (one run per point, 300 repetitions each). Each step unmaps a one-page section view to its placeholder, splits the placeholder and maps another page there, which is what the layer does per remapped 64 KiB page. Note that this is not the same operation as neonbyte1's map/unmap pair in #340. | views alive | stock | patched | |---:|---:|---:| | 100 | 63.8 µs* | 9.3 µs | | 10,000 | 113.6 µs | 11.5 µs | | 50,000 | 249.8 µs | 12.0 µs | | 125,000 | 520.9 µs | 12.2 µs | \* Noisy: earlier stock runs of the same bench gave 14-24 µs at 100 views. Don't read this row as a patch effect. The point is that the patched cost stays flat in the number of views. In the world this process held 123,000-135,000 views, 43,000-48,000 of them the GPU's page mappings (`CopyPageMappingsBatchX`). The title remapped 1,000-4,000 single 64 KiB pages a frame, at 0.6-0.9 ms per memory call on the stock server. **What did not work in the layer** (all stock server): 1. **A narrower mapping lock.** The lock was taken by address range, so a read waits only for remaps of its own range. The reads' wait fell from 85-377 ms a frame to 0, and none of them had actually met a remap of their range. The frame did not improve (median 2402 ms without it, 2436 ms with it), because it waits on the remaps themselves. 2. **Joining a GPU mapping to the neighbouring view.** Views fell from 123-126k to 98-100k, and each remap call went from 0.57-0.80 ms to 0.43-0.57 ms. The frame median went from 2742 to 2283 ms, which is within these runs' noise (about 30%). So it is not a demonstrated win. 3. **Coalescing the GPU's mappings.** Every one of them maps a single source page. Over the logged runs there were 0 pages in runs, and the page numbers step by 16 in this tree, so a check like 47b1f3b's `next_page == start_page + run` never matched. This applies to the GPU's alias mappings only. It does not contradict sander110419's count for `XMemMapPhysicalPages` views. 4. **Private copies instead of views for the GPU's mappings.** This is fast but wrong. The frame went from 1830 ms to 840 ms median (views 122-129k down to 83-86k), but 34-622 copies a frame no longer matched their page when they were dropped. The title or the GPU writes through one side and reads through the other, so snapshot copies are not an emulation. The same holds as in sander110419's runs: 0 of 2,000-3,700 remapped pages a frame were already mapped as asked. Mapping behind Wine's back is not available from the Windows side either. Wine 11 turns on syscall user dispatch for every thread, so a raw `syscall` from PE code is serviced as an NT system call: `getpid` returned `0xC0000005` and `memfd_create` returned `0xC000001C`. The clean routes are a unix-side helper called through `__wine_unix_call`, which would have to ship matched to each Proton build, or the server fix. The server fix needs no change to the layer. **One caveat about the patched runs.** All three patched runs ended early, at 64, 148 and 182 s, with `dstorage: request failed: copying options=0x0 ... hr=0x800703e6` followed by the title's breakpoint. That failure also happens on the stock server. It is a race in the layer: a kernel `ReadFile` lands in a page that another thread has just guarded again. A fix for the fork is proposed in myokex/victory-amd#2; ours is a different one, described in my comment there. After our fix, two 10-minute runs on the patched server had no failure, with median world frames of 349 and 401 ms. Those runs used a later build, so they are not part of the A/B above. How the server was built for Valve's Proton Experimental is in my comment on PR #2082. No game data; counts and timings only. *Measured and written with an AI coding assistant (Claude Code) working on my machine; the numbers are from the runs described above.*
Author
Owner

@⁠necrobytes on GitHub · 2026-11-26 01:26 UTC · original

I repeated the wineserver view-tree comparison on stock VIctory 63bcca43 after reading the RX 9070 result. Fedora 45, Ryzen 5 9600X, RX 9060 XT, RADV 26.2.7. I used the same Proton Experimental 11.0 client, vkd3d-proton, working audio device, starting profile and warm-cache snapshot for all four launches. The only binary changed was the wineserver, built from the same Valve Wine revision with or without the CachyOS view-tree change.

Launch order Time to first frame with at least 500 draws Wineserver CPU, % of one core Mean FPS
Stock 72.1 s 67.7% 0.79
Patched 38.1 s 3.3% 1.04
Patched 38.1 s 3.3% 1.09
Stock 65.1 s 73.0% 0.56

CPU and FPS cover the first 40 seconds after that marker. I calculated CPU from the active wineserver process’s CPU time and FPS from consecutive presents. One patched run exited about 42 seconds after the marker. All four covered the reported window. The opening sequence progressed at different rates, so I wouldn’t use these runs to estimate a general gameplay FPS multiplier.

With a separate synthetic 64 KiB remap test and 100,000 existing views, median time per remap on Proton fell from 328.25 to 18.19 µs. With zero existing views it was 18.30 vs 18.03 µs. That lines up with the startup and CPU improvements on unmodified VIctory. Frame rate on this machine still hovered around one FPS after the change.

AI-assisted with Codex.

**@⁠necrobytes** on GitHub · 2026-11-26 01:26 UTC · [original](https://github.com/Marvisak/VIctory/issues/834#issuecomment-7179770690) I repeated the wineserver view-tree comparison on stock VIctory `63bcca43` after reading [the RX 9070 result](https://git.gtahub.st/github/Marvisak--VIctory/issues/834). Fedora 45, Ryzen 5 9600X, RX 9060 XT, RADV 26.2.7. I used the same Proton Experimental 11.0 client, vkd3d-proton, working audio device, starting profile and warm-cache snapshot for all four launches. The only binary changed was the wineserver, built from the same Valve Wine revision with or without the [CachyOS view-tree change](https://github.com/CachyOS/wine-cachyos/commit/fd66dbca8eb0754839ca974e45b5ea446ca62d2f). | Launch order | Time to first frame with at least 500 draws | Wineserver CPU, % of one core | Mean FPS | |---|---:|---:|---:| | Stock | 72.1 s | 67.7% | 0.79 | | Patched | 38.1 s | 3.3% | 1.04 | | Patched | 38.1 s | 3.3% | 1.09 | | Stock | 65.1 s | 73.0% | 0.56 | CPU and FPS cover the first 40 seconds after that marker. I calculated CPU from the active wineserver process’s CPU time and FPS from consecutive presents. One patched run exited about 42 seconds after the marker. All four covered the reported window. The opening sequence progressed at different rates, so I wouldn’t use these runs to estimate a general gameplay FPS multiplier. With a separate synthetic 64 KiB remap test and 100,000 existing views, median time per remap on Proton fell from 328.25 to 18.19 µs. With zero existing views it was 18.30 vs 18.03 µs. That lines up with the startup and CPU improvements on unmodified VIctory. Frame rate on this machine still hovered around one FPS after the change. AI-assisted with Codex.
Author
Owner

@⁠Foxiquek on GitHub · 2026-11-26 04:45 UTC · original

A third A/B with only wineserver swapped, the first on GE-Proton: CachyOS/wine-cachyos@fd66dbc built from GE-Proton11-14's source. The tree is LooperSalty/AnyXboxX's copy of VIctory (Neptune base), not this repo's main.

Setup: RX 9070 XT, RADV, Linux Mint 22.3, GE-Proton11-14. AnyXboxX main (c4c93bd) plus Marvisak/VIctory#1885, with the launcher's tuned set plus the Linux changes from docs/running-gta6.md, and a warm shader cache.

I built wineserver from GE-Proton11-14's own source (its Wine patches applied, protocol 938) with and without fd66dbc, and swapped only that binary. The source-built server without the patch started fine with GE's client.

Opening sequence, median of the frame lines with at least 1,000 draws:

stock GE wineserver with view tree
ms/frame 4,534 531
preparing 2,778 168
textures 1,501 8.5
copies 487 105
copying back 520 104
on the GPU 112 114
wineserver CPU ~100% of one core 10-20%

Caveats: one run each, and the patched run is shorter (10 frame lines over 1 minute, against 37 over 6 minutes). Both are from the opening in-engine sequence, not gameplay, and the numbers are for that scene only. Still, an 8.5x gap with unchanged GPU time is hard to put down to noise.

Building it: clone proton-ge-custom at the tag with the wine and wine-staging submodules, run the Wine section of patches/protonprep-valve-staging.sh, then tools/make_requests, tools/make_specfiles, dlls/winevulkan/make_vulkan and autoreconf -f. Apply fd66dbc (clean, with offsets), configure, and run make server/wineserver. Replace files/bin/wineserver in the GE install and keep the original. It must come from the same source: GE-Proton11-14's protocol is 938, not stock 11.0's 930.

**@⁠Foxiquek** on GitHub · 2026-11-26 04:45 UTC · [original](https://github.com/Marvisak/VIctory/issues/834#issuecomment-7182875084) A third A/B with only wineserver swapped, the first on GE-Proton: [CachyOS/wine-cachyos@fd66dbc](https://github.com/CachyOS/wine-cachyos/commit/fd66dbca8eb0754839ca974e45b5ea446ca62d2f) built from GE-Proton11-14's source. The tree is LooperSalty/AnyXboxX's copy of VIctory (Neptune base), not this repo's `main`. Setup: RX 9070 XT, RADV, Linux Mint 22.3, GE-Proton11-14. AnyXboxX `main` (`c4c93bd`) plus Marvisak/VIctory#1885, with the launcher's tuned set plus the Linux changes from `docs/running-gta6.md`, and a warm shader cache. I built `wineserver` from GE-Proton11-14's own source (its Wine patches applied, protocol 938) with and without `fd66dbc`, and swapped only that binary. The source-built server without the patch started fine with GE's client. Opening sequence, median of the frame lines with at least 1,000 draws: | | stock GE wineserver | with view tree | |---|---:|---:| | ms/frame | 4,534 | 531 | | preparing | 2,778 | 168 | | textures | 1,501 | 8.5 | | copies | 487 | 105 | | copying back | 520 | 104 | | on the GPU | 112 | 114 | | wineserver CPU | ~100% of one core | 10-20% | Caveats: one run each, and the patched run is shorter (10 frame lines over 1 minute, against 37 over 6 minutes). Both are from the opening in-engine sequence, not gameplay, and the numbers are for that scene only. Still, an 8.5x gap with unchanged GPU time is hard to put down to noise. Building it: clone `proton-ge-custom` at the tag with the `wine` and `wine-staging` submodules, run the Wine section of `patches/protonprep-valve-staging.sh`, then `tools/make_requests`, `tools/make_specfiles`, `dlls/winevulkan/make_vulkan` and `autoreconf -f`. Apply `fd66dbc` (clean, with offsets), configure, and run `make server/wineserver`. Replace `files/bin/wineserver` in the GE install and keep the original. It must come from the same source: GE-Proton11-14's protocol is 938, not stock 11.0's 930.
Author
Owner

@⁠Foxiquek on GitHub · 2026-11-26 05:25 UTC · original

I've proposed the view-tree patch to GE-Proton so it can ship there without a local build: GloriousEggroll/proton-ge-custom#1016.

**@⁠Foxiquek** on GitHub · 2026-11-26 05:25 UTC · [original](https://github.com/Marvisak/VIctory/issues/834#issuecomment-7183478338) I've proposed the view-tree patch to GE-Proton so it can ship there without a local build: GloriousEggroll/proton-ge-custom#1016.
Author
Owner

@⁠anon31-006459 on GitHub · 2026-11-26 17:07 UTC · original

NVIDIA data point for the view-tree wineserver, and two pitfalls when building it yourself.

Setup: Pop!_OS 24.04, kernel 7.2.15, RTX 3070 Ti 8 GB (NVIDIA 595.104.02, open kernel module), Ryzen 7 3700X, 32 GB RAM. Proton Experimental 11.0-20261112 (its own vkd3d-proton), started through files/bin/wine directly. VIctory: fxceless/victory-fork main + the #1820 recipe, MinGW cross-build, Series S. wineserver built from ValveSoftware/wine experimental_11.0 at 5b557605 (the protocol matches that Proton build) with the CachyOS view-tree commit fd66dbca applied, and nothing else changed.

Result, same save and scene, frame-log means over 40 readings:

wineserver remapping per frame frame
Proton's own 244 calls, 275 ms (typical world frame: 767 calls, 650 ms of a 664 ms frame) ~1.6 fps
view-tree 20 calls, 7.8 ms 7.5–7.9 fps in the first rooms (together with a lower VICTORY_PIPELINE_WAIT_MS, see fork #1181)

The submitting thread went from 616 ms "at work" per frame (80 ms of it on the CPU, the rest blocked) to 123 ms.

Pitfall 1: Proton ignores WINESERVER. Proton's ntdll runs the wineserver next to its own binaries before it looks at $WINESERVER, so setting the variable silently keeps the stock server. It does connect to a server already running for the prefix, so we start the patched one first: WINEPREFIX=... ./wineserver-viewtree -p10, then launch.

Pitfall 2: build it with MFD_EXEC defined, or mappings go to disk. create_temp_file() in server/mapping.c only uses memfd_create #if defined(HAVE_MEMFD_CREATE) && defined(MFD_EXEC). Older headers (we built in a Debian 12 container) don't define MFD_EXEC, so the server silently falls back to unlinked tmpmap-* files in /tmp/.wine-$UID/server-*/. The title's physical memory sections then get written back to disk: here 60 MB/s, the NVMe 100 % busy, and 3 to 13 s frames with the card idle. Building with CFLAGS="-O2 -DMFD_EXEC=0x0010U" (the value from linux/memfd.h; the kernel needs to be 6.3 or newer) fixes it. Check with ls -l /proc/$(pgrep -f wineserver)/fd | grep -c memfd:wine-mapping (non-zero is right; tmpmap entries mean the fallback).

AI-assisted (Claude Code, Claude Opus 5.5); all numbers are from runs on my machine. No game data.

**@⁠anon31-006459** on GitHub · 2026-11-26 17:07 UTC · [original](https://github.com/Marvisak/VIctory/issues/834#issuecomment-7198543904) **NVIDIA data point for the view-tree wineserver, and two pitfalls when building it yourself.** **Setup:** Pop!_OS 24.04, kernel 7.2.15, RTX 3070 Ti 8 GB (NVIDIA 595.104.02, open kernel module), Ryzen 7 3700X, 32 GB RAM. Proton Experimental 11.0-20261112 (its own vkd3d-proton), started through `files/bin/wine` directly. VIctory: `fxceless/victory-fork` main + the #1820 recipe, MinGW cross-build, Series S. wineserver built from `ValveSoftware/wine` `experimental_11.0` at `5b557605` (the protocol matches that Proton build) with the CachyOS view-tree commit `fd66dbca` applied, and nothing else changed. **Result, same save and scene, frame-log means over 40 readings:** | wineserver | remapping per frame | frame | |---|---|---| | Proton's own | 244 calls, **275 ms** (typical world frame: 767 calls, 650 ms of a 664 ms frame) | ~1.6 fps | | view-tree | 20 calls, **7.8 ms** | 7.5–7.9 fps in the first rooms (together with a lower `VICTORY_PIPELINE_WAIT_MS`, see fork #1181) | The submitting thread went from 616 ms "at work" per frame (80 ms of it on the CPU, the rest blocked) to 123 ms. **Pitfall 1: Proton ignores `WINESERVER`.** Proton's ntdll runs the `wineserver` next to its own binaries before it looks at `$WINESERVER`, so setting the variable silently keeps the stock server. It does connect to a server already running for the prefix, so we start the patched one first: `WINEPREFIX=... ./wineserver-viewtree -p10`, then launch. **Pitfall 2: build it with `MFD_EXEC` defined, or mappings go to disk.** `create_temp_file()` in `server/mapping.c` only uses `memfd_create` `#if defined(HAVE_MEMFD_CREATE) && defined(MFD_EXEC)`. Older headers (we built in a Debian 12 container) don't define `MFD_EXEC`, so the server silently falls back to unlinked `tmpmap-*` files in `/tmp/.wine-$UID/server-*/`. The title's physical memory sections then get written back to disk: here **60 MB/s, the NVMe 100 % busy, and 3 to 13 s frames** with the card idle. Building with `CFLAGS="-O2 -DMFD_EXEC=0x0010U"` (the value from `linux/memfd.h`; the kernel needs to be 6.3 or newer) fixes it. Check with `ls -l /proc/$(pgrep -f wineserver)/fd | grep -c memfd:wine-mapping` (non-zero is right; `tmpmap` entries mean the fallback). *AI-assisted (Claude Code, Claude Opus 5.5); all numbers are from runs on my machine. No game data.*
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/Marvisak--VIctory#834
No description provided.