Skip to content

Linux: docs/linux.md, scripts/linux and Wine start-up checks for vkd3d-proton and DXVK (#154, #241) - #257

Open
simnJS wants to merge 3 commits into
ivall:mainfrom
simnJS:linux-kit
Open

simnJS wants to merge 3 commits into
ivall:mainfrom
simnJS:linux-kit

Conversation

@simnJS

@simnJS simnJS commented Nov 23, 2026 •

Copy link
Copy Markdown

Running XCL on Linux under Wine + vkd3d-proton: a setup a contributor can follow, built from the findings in #175 and from runs on Linux, and a start-up message for the vkd3d-proton assertion players hit (#241). Part of #154.

What is in it

  • docs/linux.md: cross-build for x86_64-pc-windows-gnu, DXC, which Wine (one with kernel write watches – Proton's – or vkd3d-proton silently gives the GPU its own copy of unified memory), vkd3d-proton v3.1 rebuilt with -Db_ndebug=true plus a 6-line patch to the two from_iface lookups, VKD3D_CONFIG=ignore_shared_fence, DXVK's dxgi / d3d11 / d3d10core, prefix, running, known state.
  • scripts/linux/: vkd3d-proton-xcl.patch, build-vkd3d-proton.sh, setup-prefix.sh, run.sh (XCL_NETWORK=0 by default).
  • crates/xcl/src/preflight.rs: under Wine only, an error when the loaded d3d12core.dll holds vkd3d-proton's iface->lpVtbl == &d3d12_heap_vtbl assertion (VKD3D Assertion - "iface->lpVtbl == &d3d12_heap_vtbl" #241), a warning when dxgi.dll is not DXVK's (presenting crashes in wined3d, Linux (Wine + vkd3d-proton): a retail game reaches what main reaches on Windows; the obstacle is replaced vtables — proposal: proxies #175).
  • tests/testgamedll/Cargo.toml: test = false, doctest = false – its test harness imports kernelx.dll and cannot start on the GNU target; the crate has no tests.
  • scripts/linux/build-opus.sh + an "Opus" section in docs/linux.md (second commit): builds libopus 1.5.2 as the opus.dll that xapu: decode the title's Opus packets and play them on the PC (GTA VI's sound) #294 loads where Windows has no Opus decoder (Wine), checked against its SHA-256.
  • scripts/linux/smoke.sh + a "Regression runs" section in docs/linux.md (third commit): smoke.ps1's regression run and xcl-smoke block under Wine, for contributors without Windows.
  • README.md: one line pointing to docs/linux.md; THIRD_PARTY.md: the patch (LGPL-2.1, patch only, vkd3d-proton is not distributed).

The vkd3d-proton build is a workaround: the fix is proxies for the host's objects (#175), and the doc says so.

Tested

Regression run
Made with scripts/linux/smoke.sh (this PR: smoke.ps1's run and block under Wine), 50 s, on Ubuntu 26.04 / RTX 4080 SUPER, Proton Experimental 11.0's Wine, vkd3d-proton v3.1 + patch, DXVK 3.1.1. In both runs the account prompt was answered by hand with A and the title went to its "Brightness Level" screen; both ended by themselves (exit: 0x0). Under Wine XCL's end takes ~15 s after XCL_RUN_SECONDS (its watchdog: suspending every thread also stops vkd3d-proton's), so the earlier 60 s blocks with a 10 s grace said killed. peak commit reads 0 under Wine.

main at 4017f8f:

xcl-smoke v1
commit: 4017f8ff8faaae6007fd83910d230a027dd85a33
gpu: NVIDIA GeForce RTX 4080 SUPER
title: RockstarGamesInc.28872443D20A7
seconds: 50
exit: 0x0
frames shown: 722 (PresentX 722)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

This PR's head 463e2e1:

xcl-smoke v1
commit: 463e2e18356fbb4f09834aa4da5d8c88f4c1bb61
gpu: NVIDIA GeForce RTX 4080 SUPER
title: RockstarGamesInc.28872443D20A7
seconds: 50
exit: 0x0
frames shown: 725 (PresentX 725)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

Not tested

  • Windows: the test suite and scripts/smoke.ps1 were not run (no Windows machine); the regression blocks above come from smoke.sh under Wine. The preflight change only runs under Wine (util::under_wine); testgamedll has no tests.
  • AMD GPUs, other Wine builds.

AI use

  • Written with an AI coding agent (code, docs, scripts and this description), then read and checked by the author.

@ozimchuk

Copy link
Copy Markdown
Contributor

Thanks for writing this up. Two points from runs here (Ubuntu 24.04 in a container, kernel 7.0, RTX 5060 Ti):

  1. "prebuilt Wine Staging builds do not have it" is too broad. WineHQ's own wine-staging 11.21 packages for Ubuntu 24.04 (wine-staging-amd64 11.21~noble-1) pass the guide's own check (grep -a "Using kernel write watches" on lib/wine/x86_64-unix/ntdll.so → 1), and they work: XCL's test title gives 47 [PASS] with userfaultfd allowed, 40 with Docker's default seccomp blocking it. The builds without it are the ones compiled against kernel headers older than 6.7, e.g. Kron4ek's (made in an Ubuntu 18.04 chroot). Something like "WineHQ's staging packages for current Ubuntu have it; portable builds made against older kernel headers (Kron4ek's) do not" would be accurate.

  2. An audio endpoint is needed. On a machine or container with no sound device at all (Wine's ALSA finds no card), the retail game's audio engine deadlocks about 30 s in: its device setup fails, a device lock is left taken, the engine's frames stop, and a trace buffer fills until the game's own check stops the process. A silent ALSA default device is enough, e.g. ~/.asoundrc:

    pcm.!default {
        type null
    }
    

    With it the game runs on at 30 fps (black, as reported). A desktop with sound never hits this; containers and headless setups do.

AI-assisted (Claude Code, Claude Opus 5.5).

@JGonzalezRodriguez

Copy link
Copy Markdown

Reviewed and live-tested commit c6ab20e on Linux.

Tested

  • Host / stack: CachyOS Linux (kernel 7.2.9-2-cachyos, vm.unprivileged_userfaultfd=0), NVIDIA GeForce RTX 4090 (610.57.4) + AMD Radeon(TM) Graphics (radv 26.2.4), Proton Experimental (11.0-20261112, DXVK 3.1.1), relaxed vkd3d-proton built from upstream master (30b0eb9), cross-built for x86_64-pc-windows-msvc (rustc 1.98.1, clang-cl + lld-link + xwin SDK 10.0.26100).
  • Build: cargo build --release --workspace --target x86_64-pc-windows-msvc and cargo test --no-run --workspace --target x86_64-pc-windows-msvc: 0 errors, 0 warnings (tests/testgamedll/Cargo.toml causes no regressions).
  • Tests under Proton Experimental: preflight:: 6/6 passed; e2e::launcher_uses_configured_exe_in_an_ambiguous_folder 1/1 passed; xcl_testtitle test harness exited 0.
  • Live xcl.exe run startup check matrix (synthetic PE + xcl_testtitle):
    • Stock Proton vkd3d-proton + DXVK: reports ERROR for iface->lpVtbl == &d3d12_heap_vtbl (VKD3D Assertion - "iface->lpVtbl == &d3d12_heap_vtbl" #241), no DXVK warning; xcl_testtitle aborts at vkd3d_private.h:1077 as predicted.
    • Relaxed vkd3d-proton (30b0eb9) + DXVK via setup-prefix.sh + run.sh: no Wine errors/warnings in console or report.json; all D3D12.X / UMA / PresentX / sparse VRAM / RT / DirectStorage / MFPlat checks in xcl_testtitle pass.
    • Wine builtin d3d12,d3d12core,dxgi,d3d11,d3d10core=b: reports no D3D12 device + WARNING: dxgi.dll is Wine's, not DXVK's.
    • Relaxed vkd3d-proton + Wine builtin dxgi=b: GPU probe succeeds, reports only the dxgi.dll WARNING.
    • Stock Proton vkd3d-proton + Wine builtin dxgi=b: reports both the vkd3d-proton ERROR and the dxgi.dll WARNING.
  • Scripts & patch: bash -n scripts/linux/*.sh passes. scripts/linux/vkd3d-proton-xcl.patch matches v3.1 at exact line numbers and also applies cleanly (git apply --check and patch --dry-run --fuzz=0) to upstream master (30b0eb9, hunk 2 offset +280).

Findings

  1. scripts/linux/setup-prefix.sh:38-43 — plain cp follows symlinks in system32/ and can overwrite files outside <prefix>

    • setup-prefix.sh documents updating an existing prefix (<prefix> the prefix to create or update / Only <prefix> is written to.), but GNU cp writes through existing symlinks. Tested live with a symlinked system32/d3d12.dll pointing outside <prefix>: setup-prefix.sh overwrote the external target file in place. If pointed at an existing Steam/Proton, Lutris, or winetricks prefix with symlinked DLLs, it would silently overwrite Proton's shared d3d12*.dll / dxgi.dll with the assertions-off build.
    • Fix: cp --remove-destination (or rm -f the destination DLLs before cp).
  2. scripts/linux/run.sh:22,36 — relative <prefix> path fails immediately

    • setup-prefix.sh:27 canonicalizes prefix=$(cd "$2" && pwd) and run.sh:34 canonicalizes game=$(cd "$game" && pwd), but run.sh:36 exports WINEPREFIX=$prefix without canonicalizing it. Tested live with ./pfx-relaxed:
      wine: invalid directory ./pfx-relaxed in WINEPREFIX: not an absolute path
      
    • Fix: add prefix=$(cd "$prefix" && pwd) after the [ -d "$prefix/drive_c" ] check.
  3. crates/xcl/src/preflight.rs:190-217, 257-328 — scanning writable .data/.bss via from_raw_parts (data-race UB) + missing unit tests

    • image_contains() scans all committed readable regions including PAGE_READWRITE / PAGE_EXECUTE_READWRITE via std::slice::from_raw_parts. Because probe_gpu() has just initialized vkd3d-proton / dxgi (which leave background worker threads such as vkd3d-disk$, vkd3d_fence, vkd3d_queue alive), constructing &[u8] over writable .data/.bss pages risks a Rust data race (UB).
    • Verified in Proton Experimental's d3d12core.dll and dxgi.dll: all target string matches live in .rdata (PAGE_READONLY; 0 matches in .data/.bss). Restricting the scan to non-writable pages (PAGE_READONLY | PAGE_EXECUTE_READ or PAGE_READONLY only — or reading the DLL file via GetModuleFileNameW) avoids the UB and skips unnecessary .data/.bss scanning. (Guarding if needle.is_empty() also avoids a windows(0) panic if reused.)
    • preflight::tests only adds wine: None to found(); please add unit tests covering wine: Some(WineLibs { ... }) (vkd3d_asserts_vtables: Some(true|false) | None, dxgi_is_dxvk: Some(false|true) | None).
  4. Minor script & doc notes

    • scripts/linux/run.sh:38: WINEDLLOVERRIDES=... unconditionally overwrites caller-supplied overrides instead of appending (${WINEDLLOVERRIDES:+$WINEDLLOVERRIDES;}). Also line 42 redirects winepath -w stderr to /dev/null, hiding failures under set -e.
    • scripts/linux/build-vkd3d-proton.sh:32-34: if $src/.git already exists, re-running with a different VKD3D_PROTON_REF (or after an interrupted clone) skips checkout and submodule init.
    • docs/linux.md:50: concurring with @ozimchuk above — distro Wine builds compiled against Linux 6.7+ headers (e.g. CachyOS/Arch system wine-11.19 here) also contain "Using kernel write watches".
    • docs/linux.md:64: vkd3d_private.h has 10 assert(iface->lpVtbl == ...) checks; the 11th is in libs/vkd3d/meta_commands.c:632.
    • docs/linux.md:84-85: DXVK does spoof NVIDIA's DXGI vendor/device ID by default (0x1002/0x73df), and DXVK_CONFIG='dxgi.hideNvidiaGpu = False' disables that, but run.sh doesn't set it, and XCL's own wave32 paths come from D3D12_FEATURE_D3D12_OPTIONS1 rather than DXGI VendorId. Also worth a brief note that v3.1 predates HansKristian-Work/dxil-spirv#372 (NVIDIA 64-bit atomic GPU hang noted in Linux (Wine + vkd3d-proton): a retail game reaches what main reaches on Windows; the obstacle is replaced vtables — proposal: proxies #175).
    • THIRD_PARTY.md:19: vkd3d-proton is LGPL-2.1+ (COPYING / libs/vkd3d/command.c), matching the FFmpeg entry.

Not tested

  • Native Windows (scripts/smoke.ps1, Windows CI)
  • x86_64-pc-windows-gnu build and running build-vkd3d-proton.sh end-to-end (mingw-w64 / shellcheck not installed here)
  • AMD discrete GPU or retail game data

AI use

Reviewed and written with Antigravity (Gemini frontier model); every file/line cited and every live check was directly verified on this host.

@simnJS

simnJS commented Nov 23, 2026

Copy link
Copy Markdown
Author

Thanks, both points are in, squashed into the PR's commit (15d659e, rebased on main):

  1. Wine: the list now says WineHQ's wine-staging packages for current Ubuntu have the kernel write watches (11.21 on 24.04, as you measured), and that Ubuntu's own wine package (10.0 here) and builds made against kernel headers older than 6.7 (Kron4ek's) do not. The grep check stays as the way to tell.
  2. Audio device: new prerequisite and an "Audio device" section: no sound device at all means the retail game deadlocks about 30 s in; a silent ALSA default (pcm.!default { type null } in ~/.asoundrc) is enough, and a desktop with sound does not need it.

@ersinhf

ersinhf commented Nov 23, 2026

Copy link
Copy Markdown

Windows run of head 463e2e18356fbb4f09834aa4da5d8c88f4c1bb61 (the "Windows: the test suite" item under Not tested), clean tree.

Tested

  • NVIDIA GeForce RTX 4070 (Ada), driver 621.14 (32.0.16.2114); AMD Ryzen 5 7500F, 32 GB; Windows 11 build 26200; rustc 1.100.0 stable-x86_64-pc-windows-msvc, debug; DXC 1.9.2602.17 (SDK 10.0.26100.0); XGameRuntime 10.0.26100.9656; no XCL_SAMPLE_* set
  • .\scripts\test.ps1: 652 passed, 0 failed, 40 ignored, the same as main 4017f8f on this machine; SKIPPED 2 (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware. The e2e test (which goes through xcl run and so through preflight::run) passes.
  • image_contains has no test in the PR, so I ran a temporary one in preflight.rs on Windows (local only, removed after): image_contains("kernel32.dll", b"KERNEL32.dll") → Some(true); a needle in no image → Some(false) for kernel32 and ntdll (the whole image is walked without a fault); after probe_gpu("auto") the real d3d12core.dll → Some(false) for the vkd3d assertion text and dxgi.dll → Some(false) for DXVK; a module that is not loaded → None; under_wine() is false and wine_libs() is None. 0.41 s.

Not tested

  • scripts/smoke.ps1 on Windows (no retail title here); the Linux scripts
  • release build

AI use

  • Claude Code with Claude Opus 5.5 ran the build, the suite and the temporary test on this machine and wrote this comment; the person posting it checked each point.

@simnJS

simnJS commented Nov 23, 2026

Copy link
Copy Markdown
Author

@ersinhf thank you – that covers the Windows side I could not run: the whole suite on 463e2e1 and the start-up check doing nothing on a real d3d12core.dll / dxgi.dll. The PR checks failure is the regression blocks: under Wine the title takes ~15 s to end after XCL_RUN_SECONDS (XCL's end watchdog), longer than the grace I gave smoke.sh, so the blocks said killed. I'm redoing both runs so they end by themselves and will update the description.

…3d-proton and DXVK

- docs/linux.md: cross-build, DXC, Wine choice, prefix, patched vkd3d-proton, DXVK, running, known state
- scripts/linux: vkd3d-proton v3.1 patch and build, prefix setup, run
- preflight (Wine only): error when d3d12core.dll holds vkd3d-proton's heap vtable assertion (ivall#241),
  warning when dxgi.dll is not DXVK's
Wine and Proton have no MSOpusDecoder.dll, so with ivall#294 XCL loads libopus
from an opus.dll there. build-opus.sh downloads the official libopus 1.5.2
release, checks its SHA-256 and builds opus.dll with mingw-w64;
docs/linux.md says where to put it (XCL_OPUS_DIR or next to xcl.exe) and
how to tell which decoder xcl.log reports.
scripts/smoke.ps1 needs Windows (Start-Process, Get-CimInstance), so a
contributor on Linux cannot make the xcl-smoke blocks a PR that changes
the runtime needs. smoke.sh runs the title the same way under Proton's
Wine (XCL_RUN_SECONDS, XCL_ACTIVITY, networking off), reads XCL's log
and prints the same block; the GPU name comes from the log, and peak
commit reads 0 under Wine. docs/linux.md says how to use it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants