Proton/Linux fixes, orphaned view-guard recovery, Series S target room, and refresh fast-paths #1492

Closed
github-bot wants to merge 1 commit from github-bot/gh-1492 into main AGit
Owner

@⁠Skanetdima on GitHub · 2026-11-28 20:46 UTC · original
linux-proton-opts → main · +1049 −163 · 10 files · 1 commits · closed without merging

Summary

Collected stability, VRAM-budget, CPU-preparation, and Linux/Proton support improvements tested on an 8 GiB RTX 5060 Laptop under GE-Proton11-14-x86_64 (umu-run / vkd3d-proton):

1. Crash & Memory-Guard Fixes (watch.rs, xmem.rs, lib.rs)

  • Orphaned PAGE_READONLY view-guard recovery (watch::recover_orphaned_view_guard): In on_write, if a write faults on a committed MEM_MAPPED PAGE_READONLY block with active xmem physical pages (inplace::pages_of), recover by opening the block and its aliases (unguard_one) and logging diagnostics instead of returning EXCEPTION_CONTINUE_SEARCH. Observed preventing 4 write-fault crashes across a 50-minute playthrough.
  • UnmapViewOfFile2 failure handling (xmem::unmap): If UnmapViewOfFile2 fails, log a warning and call victory_gpu::title_memory_remapped so view guards do not remain orphaned read-only; log non-RW title_virtual_protect calls (rate-limited).
  • Placeholder & write-watch reservation tracking (watch.rs, xmem.rs, lib.rs): Track XMemVirtualAlloc placeholders (title_memory_placeholder / PLACEHOLDER_RESERVED) and MEM_WRITE_WATCH regions (title_memory_write_watch / WRITE_WATCH_RES) to avoid failing/repeated GetWriteWatch + VirtualQuery probes on Wine/Proton and keep ask_ahead merges inside known write-watch reservations.

2. VRAM Budget & Texture Queue (resource.rs)

  • Series S targets_room_kept() reserve (resource.rs): Set the default target reserve most to 1536 << 20 on Console::SeriesS (3072 << 20 on SeriesX, still overridable via VICTORY_CARD_ROOM_FOR_TARGETS_MB). On Series S, render targets plateau around ~1.5 GiB, so the 3072 MiB threshold could keep targets < most / 2 and withhold ~1.5 GiB from texture uploads indefinitely.

3. Write-Watch & Refresh CPU Fast-Paths (watch.rs, shadow.rs, host.rs)

  • AHEAD_KEPT short-circuit & deduplicated ask_rest (watch.rs, host.rs): Skip redundant ranges filtering/sorting in Batch::flush_all, Batch::refresh_front, ask_ahead, ask_ahead_done, and ask_once_end when VICTORY_ASK_ONCE=1 already holds the submission's journal snapshot. Deduplicate/merge leftover (first, last) ranges in ask_rest, take WRITE_WATCH_RES once per batch, and keep j.ahead sorted/coalesced for O(log K) ahead_contains lookups.
  • Single-lock batch nothing_new pre-filter (watch.rs, shadow.rs, host.rs):
    • Combine Shadow::copied and Shadow::ranged under one Mutex<CopiedState>.
    • Add Shadow::pending_len (AtomicUsize) and Shadow::whole_copied_at (AtomicU64) + watch::nothing_new_whole_in so unchanged copies avoid pending, copied, and ranged mutex acquisitions.
    • Pre-filter all refreshes in Batch::refresh_front and Batch::flush_all under one watch::journal_view() before dispatching dirty items (>= 4) to wide_each.

4. MnK & Linux Launch Helpers (gameinput.rs, lifecycle.rs, scripts/)

  • Suppress raw mouse Source::mouse deltas while mnk::enabled() owns cursor centering, and enable mouse capture when mnk::enabled() is active.
  • Add scripts/play-linux.sh (Series S / 8 GiB Proton baseline with VICTORY_LEVELS_ON_DEMAND=1, VICTORY_AMBIENT_ONCE=1, VICTORY_WAIT_RESIDENT=0, VICTORY_WIDE_SPIN=100, VICTORY_CARD_BUFFERS_MIN_KB=1024, VICTORY_TEXTURE_STAGE_MS=8) and scripts/get-nvidia-sdks-linux.sh.

Testing

Cross-compiled with cargo xwin (x86_64-pc-windows-msvc) and executed under GE-Proton11-14-x86_64 (umu-run):

  • cargo xwin build --release --locked -p victory --target x86_64-pc-windows-msvc --xwin-arch x86_64 (0 warnings)
  • watch::tests: 37 passed, 0 failed
  • watch::many_askers_tests::ahead_kept_tracks_ask_once_lifecycle & sort_coalesce_and_ahead_contains: 2 passed, 0 failed
  • host::refresh_tests: 4 passed, 0 failed (2 ignored benchmarks)
  • shadow::land_tests: 2 passed, 0 failed
  • resource::tests: 20 passed, 0 failed
  • ambient::tests: 5 passed, 0 failed
  • xmem::tests: 22 passed, 0 failed, 1 ignored benchmark
**@⁠Skanetdima** on GitHub · 2026-11-28 20:46 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1492) `linux-proton-opts` → `main` · +1049 −163 · 10 files · 1 commits · closed without merging ## Summary Collected stability, VRAM-budget, CPU-preparation, and Linux/Proton support improvements tested on an 8 GiB RTX 5060 Laptop under `GE-Proton11-14-x86_64` (`umu-run` / `vkd3d-proton`): ### 1. Crash & Memory-Guard Fixes (`watch.rs`, `xmem.rs`, `lib.rs`) - **Orphaned `PAGE_READONLY` view-guard recovery (`watch::recover_orphaned_view_guard`)**: In `on_write`, if a write faults on a committed `MEM_MAPPED` `PAGE_READONLY` block with active `xmem` physical pages (`inplace::pages_of`), recover by opening the block and its aliases (`unguard_one`) and logging diagnostics instead of returning `EXCEPTION_CONTINUE_SEARCH`. Observed preventing 4 write-fault crashes across a 50-minute playthrough. - **`UnmapViewOfFile2` failure handling (`xmem::unmap`)**: If `UnmapViewOfFile2` fails, log a warning and call `victory_gpu::title_memory_remapped` so view guards do not remain orphaned read-only; log non-RW `title_virtual_protect` calls (rate-limited). - **Placeholder & write-watch reservation tracking (`watch.rs`, `xmem.rs`, `lib.rs`)**: Track `XMemVirtualAlloc` placeholders (`title_memory_placeholder` / `PLACEHOLDER_RESERVED`) and `MEM_WRITE_WATCH` regions (`title_memory_write_watch` / `WRITE_WATCH_RES`) to avoid failing/repeated `GetWriteWatch` + `VirtualQuery` probes on Wine/Proton and keep `ask_ahead` merges inside known write-watch reservations. ### 2. VRAM Budget & Texture Queue (`resource.rs`) - **Series S `targets_room_kept()` reserve (`resource.rs`)**: Set the default target reserve `most` to `1536 << 20` on `Console::SeriesS` (`3072 << 20` on `SeriesX`, still overridable via `VICTORY_CARD_ROOM_FOR_TARGETS_MB`). On Series S, render targets plateau around ~1.5 GiB, so the 3072 MiB threshold could keep `targets < most / 2` and withhold ~1.5 GiB from texture uploads indefinitely. ### 3. Write-Watch & Refresh CPU Fast-Paths (`watch.rs`, `shadow.rs`, `host.rs`) - **`AHEAD_KEPT` short-circuit & deduplicated `ask_rest` (`watch.rs`, `host.rs`)**: Skip redundant `ranges` filtering/sorting in `Batch::flush_all`, `Batch::refresh_front`, `ask_ahead`, `ask_ahead_done`, and `ask_once_end` when `VICTORY_ASK_ONCE=1` already holds the submission's journal snapshot. Deduplicate/merge leftover `(first, last)` ranges in `ask_rest`, take `WRITE_WATCH_RES` once per batch, and keep `j.ahead` sorted/coalesced for `O(log K)` `ahead_contains` lookups. - **Single-lock batch `nothing_new` pre-filter (`watch.rs`, `shadow.rs`, `host.rs`)**: - Combine `Shadow::copied` and `Shadow::ranged` under one `Mutex<CopiedState>`. - Add `Shadow::pending_len` (`AtomicUsize`) and `Shadow::whole_copied_at` (`AtomicU64`) + `watch::nothing_new_whole_in` so unchanged copies avoid `pending`, `copied`, and `ranged` mutex acquisitions. - Pre-filter all refreshes in `Batch::refresh_front` and `Batch::flush_all` under one `watch::journal_view()` before dispatching dirty items (`>= 4`) to `wide_each`. ### 4. MnK & Linux Launch Helpers (`gameinput.rs`, `lifecycle.rs`, `scripts/`) - Suppress raw mouse `Source::mouse` deltas while `mnk::enabled()` owns cursor centering, and enable mouse capture when `mnk::enabled()` is active. - Add `scripts/play-linux.sh` (Series S / 8 GiB Proton baseline with `VICTORY_LEVELS_ON_DEMAND=1`, `VICTORY_AMBIENT_ONCE=1`, `VICTORY_WAIT_RESIDENT=0`, `VICTORY_WIDE_SPIN=100`, `VICTORY_CARD_BUFFERS_MIN_KB=1024`, `VICTORY_TEXTURE_STAGE_MS=8`) and `scripts/get-nvidia-sdks-linux.sh`. ## Testing Cross-compiled with `cargo xwin` (`x86_64-pc-windows-msvc`) and executed under `GE-Proton11-14-x86_64` (`umu-run`): - `cargo xwin build --release --locked -p victory --target x86_64-pc-windows-msvc --xwin-arch x86_64` (0 warnings) - `watch::tests`: 37 passed, 0 failed - `watch::many_askers_tests::ahead_kept_tracks_ask_once_lifecycle` & `sort_coalesce_and_ahead_contains`: 2 passed, 0 failed - `host::refresh_tests`: 4 passed, 0 failed (2 ignored benchmarks) - `shadow::land_tests`: 2 passed, 0 failed - `resource::tests`: 20 passed, 0 failed - `ambient::tests`: 5 passed, 0 failed - `xmem::tests`: 22 passed, 0 failed, 1 ignored benchmark
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 20:51:35 +00:00
github-bot closed this pull request 2026-11-28 21:31:48 +00:00
Author
Owner

@⁠Skanetdima on GitHub · 2026-11-28 21:30 UTC · original

Closing PR (cleanup).

**@⁠Skanetdima** on GitHub · 2026-11-28 21:30 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1492#issuecomment-7246071914) Closing PR (cleanup).

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!1492
No description provided.