feat(victory-gpu): opt-in display-driver event watch before TDR (VICTORY_DRIVER_WATCH=1) #578

Open
Vladimir-Human wants to merge 1 commit from upstream-pr/578 into main
Vladimir-Human commented 2026-11-28 07:56:32 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by Vladimir-Human on 2026-11-28T07:56:32Z.


Summary

Opt-in (default OFF, VICTORY_DRIVER_WATCH=1) Windows System EventLog watcher ported from fxceless/victory-fork commits a253706 / a7ee5df onto current main (132da61).

Why

Display driver resets (TDR) are frequently preceded by logged System EventLog warnings/errors from nvlddmkm (e.g. Event 153), amdkmdag, amdwddmg, igfx, igfxn, or Display (excluding Windows 11 Auto HDR Event 4125 noise). Subscribing to these System log events logs each event timestamp alongside host diagnostics and latches drvwatch::tripped() so risky indirect-window fast paths can fall back cleanly.

Defaults & Scope

  • Strictly opt-in (default OFF): Unless VICTORY_DRIVER_WATCH is 1/true/on, start() subscribes to nothing, opens no EventLog handles, tripped() stays false, and errors() stays 0.
  • third_party/victory/crates/victory-gpu/Cargo.toml: adds only "Win32_System_EventLog" to the existing windows-sys feature list; Cargo.lock is untouched (--locked clean).
  • drvwatch.rs is 271 lines (<= 400); test subscription/event handles clean up with EvtClose / DeregisterEventSource.
  • Zero conflict with #347, #350, #354, #555, or #577.
  • Benchmark note: Does not claim an FPS gain (stability/diagnostic guard; in-game TDR avoidance unmeasured on AnyXboxX).

Verification

Verified locally on Windows 11 (third_party/victory workspace) after the final edit:

  • cargo xtask policy (378 files ok)
  • Hunk-accurate cargo clippy --no-deps -p victory-gpu --locked --all-targets (default & --features diagnostics: 0 errors, 0 own warnings, 10 pre-existing upstream warnings)
  • Both HW (VICTORY_D3D12_WARP=0) and WARP (VICTORY_D3D12_WARP=1, default env):
    • drvwatch::tests (default & --features diagnostics): 4/4 passed (1 manual Application-log ignored)
    • draw::tests: 3/3 passed
    • host::: 178/178 passed (19 ignored)

Checklist

  • Neutral naming (0 game, character, or console strings)
  • Rule 10 credits (Source: / Co-authored-by: trailers + THIRD_PARTY.md row)
  • Strictly opt-in (VICTORY_DRIVER_WATCH=1 off by default) + zero Cargo.lock diff
  • In-game soak validation (unmeasured)
<!-- greyfinch-sync:LooperSalty/AnyXboxX:issue:5538096463 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/578). Originally posted by [Vladimir-Human](https://github.com/Vladimir-Human) on 2026-11-28T07:56:32Z. --- ## Summary Opt-in (**default OFF**, `VICTORY_DRIVER_WATCH=1`) Windows System EventLog watcher ported from `fxceless/victory-fork` commits [`a253706`](https://github.com/fxceless/victory-fork/commit/a253706) / [`a7ee5df`](https://github.com/fxceless/victory-fork/commit/a7ee5df) onto current `main` (`132da61`). ### Why Display driver resets (TDR) are frequently preceded by logged System EventLog warnings/errors from `nvlddmkm` (e.g. Event 153), `amdkmdag`, `amdwddmg`, `igfx`, `igfxn`, or `Display` (excluding Windows 11 Auto HDR Event 4125 noise). Subscribing to these System log events logs each event timestamp alongside host diagnostics and latches `drvwatch::tripped()` so risky indirect-window fast paths can fall back cleanly. ### Defaults & Scope - **Strictly opt-in (default OFF):** Unless `VICTORY_DRIVER_WATCH` is `1`/`true`/`on`, `start()` subscribes to nothing, opens no EventLog handles, `tripped()` stays `false`, and `errors()` stays `0`. - `third_party/victory/crates/victory-gpu/Cargo.toml`: adds only `"Win32_System_EventLog"` to the existing `windows-sys` feature list; `Cargo.lock` is untouched (`--locked` clean). - `drvwatch.rs` is `271` lines (`<= 400`); test subscription/event handles clean up with `EvtClose` / `DeregisterEventSource`. - Zero conflict with `#347`, `#350`, `#354`, `#555`, or `#577`. - **Benchmark note:** Does not claim an FPS gain (stability/diagnostic guard; in-game TDR avoidance unmeasured on `AnyXboxX`). ## Verification Verified locally on Windows 11 (`third_party/victory` workspace) after the final edit: - `cargo xtask policy` (378 files ok) - Hunk-accurate `cargo clippy --no-deps -p victory-gpu --locked --all-targets` (default & `--features diagnostics`: 0 errors, 0 own warnings, 10 pre-existing upstream warnings) - Both HW (`VICTORY_D3D12_WARP=0`) and WARP (`VICTORY_D3D12_WARP=1`, default env): - `drvwatch::tests` (default & `--features diagnostics`): 4/4 passed (1 manual Application-log ignored) - `draw::tests`: 3/3 passed - `host::`: 178/178 passed (19 ignored) ## Checklist - [x] Neutral naming (0 game, character, or console strings) - [x] Rule 10 credits (`Source:` / `Co-authored-by:` trailers + `THIRD_PARTY.md` row) - [x] Strictly opt-in (`VICTORY_DRIVER_WATCH=1` off by default) + zero `Cargo.lock` diff - [ ] In-game soak validation (unmeasured)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/578:upstream-pr/578'
git switch 'upstream-pr/578'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/578'
git switch 'upstream-pr/578'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/578'
git switch 'upstream-pr/578'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/578'
git switch 'main'
git merge --squash 'upstream-pr/578'
git switch 'main'
git merge --ff-only 'upstream-pr/578'
git switch 'main'
git merge 'upstream-pr/578'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
LooperSalty/AnyXboxX!578
No description provided.