Play: VICTORY_CARD_CPU_FILE stays off under Wine (opening cutscene lost its first 15 s) #4276

Closed
github-bot wants to merge 11 commits from github-bot/gh-4275 into main AGit
Owner

@⁠Saul5662 on GitHub · 2026-11-30 18:04 UTC · original
Saul5662:fix/cpu-file-wine → main · +787 −822 · 34 files · 11 commits · closed without merging

What it changes

Since c71899d9/39ceb0d3, play turns VICTORY_CARD_CPU_FILE=1 on by default: the CPU mirrors of two-sided GPU buffers become temporary files under cache/cpu-mirrors, mapped with CreateFileMappingW/MapViewOfFile. Under Wine those are mapped files on the Linux file system (ext4 here). With them on, the opening police cutscene loses its first ~15 seconds: the dialogue and subtitles play while the picture shows the player standing in the open world, then it jumps to the coffee shop. About 1.5 GB of mirrors are written during the load.

This change leaves the switch off when on_wine() is true (it prints one line saying so) and notes it in docs/windows-memory.md. Linux has no commit limit for the files to relieve, so nothing is lost there. Windows is unchanged.

How it was tested

  • GPU and profile: RTX 3060 12 GB, Arch Linux, Proton Experimental (Bottles) + vkd3d-proton, Series S, 720p, DLSS off, frame generation off, ray tracing off. Same save each run; screenshots at 1-4 s into the cutscene.
  • Bisected the nine defaults c71899d9 added (CARD_ALL, UAV_FOLD, WAIT_SHARE, QUIET_WAITS, TEXTURE_SOFT_MB, LAZY_COMPARE_MB, LAZY_NARROW, TABLE_SAME, CARD_CPU_FILE): all off renders the cutscene; only VICTORY_CARD_CPU_FILE=0 renders it (3 runs); defaults with it on lose it (3 runs).
  • Same build with cache/cpu-mirrors on tmpfs (file mirrors still on): the cutscene renders. So the file-backed mapping on a Linux disk file system is the trigger. Writeback stayed at 0 (the files are deleted on unmap) while dirty pages peaked at ~1.5 GB; my guess is first-write faults on the sparse file, not proven.
  • Before: player in the world for the cutscene's first ~15 s. After (this change, defaults, VICTORY_CARD_CPU_FILE=1 set by play): the cutscene renders from the first frame; the log has no "CPU mirrors in temporary file-backed memory" lines.
  • cargo test passed for the crates it touches: not run (two-line condition in run.rs plus a doc note); release build checked.

Checked for overlap

  • I searched the open pull requests and issues for CARD_CPU_FILE, file-backed mirrors and cutscene skips. None found.

AI use: Claude Code (Claude Opus 5.5) bisected the defaults, wrote the change and this text. Label: [pr-fix].

🤖 Generated with Claude Code

**@⁠Saul5662** on GitHub · 2026-11-30 18:04 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4275) `Saul5662:fix/cpu-file-wine` → `main` · +787 −822 · 34 files · 11 commits · closed without merging ## What it changes Since `c71899d9`/`39ceb0d3`, `play` turns `VICTORY_CARD_CPU_FILE=1` on by default: the CPU mirrors of two-sided GPU buffers become temporary files under `cache/cpu-mirrors`, mapped with `CreateFileMappingW`/`MapViewOfFile`. Under Wine those are mapped files on the Linux file system (ext4 here). With them on, the opening police cutscene loses its first ~15 seconds: the dialogue and subtitles play while the picture shows the player standing in the open world, then it jumps to the coffee shop. About 1.5 GB of mirrors are written during the load. This change leaves the switch off when `on_wine()` is true (it prints one line saying so) and notes it in `docs/windows-memory.md`. Linux has no commit limit for the files to relieve, so nothing is lost there. Windows is unchanged. ## How it was tested - GPU and profile: RTX 3060 12 GB, Arch Linux, Proton Experimental (Bottles) + vkd3d-proton, Series S, 720p, DLSS off, frame generation off, ray tracing off. Same save each run; screenshots at 1-4 s into the cutscene. - Bisected the nine defaults `c71899d9` added (`CARD_ALL`, `UAV_FOLD`, `WAIT_SHARE`, `QUIET_WAITS`, `TEXTURE_SOFT_MB`, `LAZY_COMPARE_MB`, `LAZY_NARROW`, `TABLE_SAME`, `CARD_CPU_FILE`): all off renders the cutscene; only `VICTORY_CARD_CPU_FILE=0` renders it (3 runs); defaults with it on lose it (3 runs). - Same build with `cache/cpu-mirrors` on tmpfs (file mirrors still on): the cutscene renders. So the file-backed mapping on a Linux disk file system is the trigger. Writeback stayed at 0 (the files are deleted on unmap) while dirty pages peaked at ~1.5 GB; my guess is first-write faults on the sparse file, not proven. - Before: player in the world for the cutscene's first ~15 s. After (this change, defaults, `VICTORY_CARD_CPU_FILE=1` set by play): the cutscene renders from the first frame; the log has no "CPU mirrors in temporary file-backed memory" lines. - `cargo test` passed for the crates it touches: not run (two-line condition in `run.rs` plus a doc note); release build checked. ## Checked for overlap - [x] I searched the open pull requests and issues for `CARD_CPU_FILE`, file-backed mirrors and cutscene skips. None found. AI use: Claude Code (Claude Opus 5.5) bisected the defaults, wrote the change and this text. Label: [pr-fix]. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 18:09:52 +00:00
Author
Owner

@⁠Deilach on GitHub · 2026-11-30 19:45 UTC · original

Independent confirmation from a different setup (RX 9070 XT 16 GB, RADV, CachyOS, GE-Proton11-15, 32 GB RAM, cache on btrfs on a QLC NVMe SSD, Intel 660p), on v2026.11.30.02, Series S profile, driving in the open world. Same build and settings; the only intended difference was where the cpu-mirrors folder was (a symlink to /dev/shm for the RAM run). It is one person driving roughly the same road, not a scripted route, and the runs are 4-5 minutes long.

From 60 s on, frame times by MangoHud:

files on the SSD, run 1 files on the SSD, run 2 files on tmpfs
average fps 14.7 15.0 16.5
1% low 1.4 2.5 6.1
p99 frame time 215 ms 189 ms 105 ms
spikes over 2x their neighbours, per minute 19.2 17.4 3.8
frames over 500 ms 16 7 1

In run 2 I recorded writes to that SSD (the whole drive, /proc/diskstats): 19 to 33 MB/s on average per minute, up to 213 MB/s, with up to 372 MB of dirty pages. In the tmpfs run it was about 0.1 MB/s. (Run 1 has no write figures.) Run 1 had freezes of 0.5 to 1.9 s; in the two seconds with a freeze that I looked at, the submitting thread's refresh step averaged 151 and 204 ms a frame (32 ms just before) for about the same number of refreshes, and the process's CPU use was lower at the freezes, so it looks like waiting rather than work. I have not traced the kernel side, so this is strong correlation, not proof of the mechanism.

I have not tested the variant in this PR (the switch off under Wine), only the files on tmpfs. The runs also had frame pacing (a local pick of #3851) and VICTORY_PORT_CONSTANTS=1 (a local pick of #2455) on in all three drives, and two local patches (unaligned raw twins, raw typed loads).

AI use: Claude Code ran the analysis and wrote this text.

🤖 Generated with Claude Code

**@⁠Deilach** on GitHub · 2026-11-30 19:45 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4275#issuecomment-7289881702) Independent confirmation from a different setup (RX 9070 XT 16 GB, RADV, CachyOS, GE-Proton11-15, 32 GB RAM, `cache` on btrfs on a QLC NVMe SSD, Intel 660p), on v2026.11.30.02, Series S profile, driving in the open world. Same build and settings; the only intended difference was where the `cpu-mirrors` folder was (a symlink to /dev/shm for the RAM run). It is one person driving roughly the same road, not a scripted route, and the runs are 4-5 minutes long. From 60 s on, frame times by MangoHud: | | files on the SSD, run 1 | files on the SSD, run 2 | files on tmpfs | |---|---|---|---| | average fps | 14.7 | 15.0 | 16.5 | | 1% low | 1.4 | 2.5 | 6.1 | | p99 frame time | 215 ms | 189 ms | 105 ms | | spikes over 2x their neighbours, per minute | 19.2 | 17.4 | 3.8 | | frames over 500 ms | 16 | 7 | 1 | In run 2 I recorded writes to that SSD (the whole drive, /proc/diskstats): 19 to 33 MB/s on average per minute, up to 213 MB/s, with up to 372 MB of dirty pages. In the tmpfs run it was about 0.1 MB/s. (Run 1 has no write figures.) Run 1 had freezes of 0.5 to 1.9 s; in the two seconds with a freeze that I looked at, the submitting thread's refresh step averaged 151 and 204 ms a frame (32 ms just before) for about the same number of refreshes, and the process's CPU use was lower at the freezes, so it looks like waiting rather than work. I have not traced the kernel side, so this is strong correlation, not proof of the mechanism. I have not tested the variant in this PR (the switch off under Wine), only the files on tmpfs. The runs also had frame pacing (a local pick of #3851) and `VICTORY_PORT_CONSTANTS=1` (a local pick of #2455) on in all three drives, and two local patches (unaligned raw twins, raw typed loads). AI use: Claude Code ran the analysis and wrote this text. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-12-01 11:19 UTC · original

I cherry-picked your 39d06a59 onto current main 5fabb46e as 2113dcf58f56bf08f93fd6a760319d612e3336cf, preserving your Git authorship. The patch ID matches. This reduces the PR to the two intended files instead of bringing in the divergent base history.

The Wine check stays in run, so it covers the native victory play path and launchers that call victory run. The script defaults proposed in #4842 complement that and leave the native command unchanged.

cargo xtask policy --staged passed for both files. I did not rerun the opening on Proton. Your original result and the separate Proton report cover the runtime symptom. The rebased commit is ready for you to adopt here.

AI-assisted with OpenAI Codex.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-12-01 11:19 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4275#issuecomment-7309477271) I cherry-picked your `39d06a59` onto current `main` `5fabb46e` as [`2113dcf58f56bf08f93fd6a760319d612e3336cf`](https://github.com/andrewpozdnakov7-jpg/VIctory-NVIDIA/commit/2113dcf58f56bf08f93fd6a760319d612e3336cf), preserving your Git authorship. The patch ID matches. This reduces the PR to the two intended files instead of bringing in the divergent base history. The Wine check stays in `run`, so it covers the native `victory play` path and launchers that call `victory run`. The script defaults proposed in #4842 complement that and leave the native command unchanged. `cargo xtask policy --staged` passed for both files. I did not rerun the opening on Proton. [Your original result and the separate Proton report](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/pulls/4276) cover the runtime symptom. The rebased commit is ready for you to adopt here. AI-assisted with OpenAI Codex.
github-bot closed this pull request 2026-12-01 18:50:17 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:44 UTC · original

Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

**@⁠trustno1-coder** on GitHub · 2026-12-01 18:44 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4275#issuecomment-7321463667) Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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/trustno1-coder--VIctory-NVIDIA!4276
No description provided.