GPU: log the TDR settings, and warn when a GPU hang would freeze the PC #1082

Merged
bvtterbroot merged 1 commit from upstream-pr/1082 into main 2026-11-25 00:12:21 +00:00
bvtterbroot commented 2026-11-24 15:34:59 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by bvtterbroot on 2026-11-24T15:34:59Z.


With TdrLevel set to 0, Windows never resets a hung GPU, so a slow or hung world frame freezes the whole PC and the runtime never sees a device removal it could report (#1054). Reports of "the PC froze" don't say whether that setting is in play; this makes the log say it.

Closes #1054.

What

  • New crates/victory-gpu/src/tdr.rs: reads TdrLevel, TdrDelay and TdrDdiDelay from HKLM\SYSTEM\CurrentControlSet\Control\GraphicsDrivers (RegGetValueW, DWORD only; a missing value reads as Windows' default).
  • When the host device is made on a hardware adapter (not under VICTORY_D3D12_WARP), one info line logs the three values, with default where one is not set:
    GPU timeout detection (TdrLevel, TdrDelay, TdrDdiDelay) level=3 delay=8 ddi_delay=default
    
  • A warning for TdrLevel 0 (a hang freezes the PC) and 1 (a timeout is a blue screen), saying to delete TdrLevel or set it to 3 and raise TdrDelay instead. Levels 2 and 3 and an unset value don't warn, and neither does a raised TdrDelay alone.
  • windows-sys in victory-gpu gains the Win32_System_Registry feature; Cargo.lock is unchanged.

This complements #537, which documents raising TdrDelay/TdrDdiDelay in the README; it touches no README lines, so the two don't conflict.

Tested

Windows 11, AMD Radeon RX 7900 XTX, driver 26.11.2, Rust 1.98.1, at ffe310e:

  • cargo test --workspace --locked: all pass, including the 5 new tdr::tests (warnings for 0 and 1; none for unset, 2, 3 or a raised delay alone; a missing value reads as None).
  • cargo clippy --workspace --all-targets --locked -- -D warnings and the same with --all-features: clean.
  • rustfmt --check on tdr.rs: clean.
  • Tdr::read() on this machine gives level: Some(3), delay: Some(8), ddi_delay: None, the same as reg query for that key.

Not tested: a run of the title (I don't have a dump), so the log line has not been seen in a real run's log, and the warning path has not been seen with TdrLevel actually set to 0 (only in unit tests). Not run under Wine, where the key is normally absent and the line logs default for all three.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6585459567 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1082). Originally posted by [bvtterbroot](https://github.com/bvtterbroot) on 2026-11-24T15:34:59Z. --- With `TdrLevel` set to 0, Windows never resets a hung GPU, so a slow or hung world frame freezes the whole PC and the runtime never sees a device removal it could report (#1054). Reports of "the PC froze" don't say whether that setting is in play; this makes the log say it. Closes #1054. ## What - New `crates/victory-gpu/src/tdr.rs`: reads `TdrLevel`, `TdrDelay` and `TdrDdiDelay` from `HKLM\SYSTEM\CurrentControlSet\Control\GraphicsDrivers` (`RegGetValueW`, DWORD only; a missing value reads as Windows' default). - When the host device is made on a hardware adapter (not under `VICTORY_D3D12_WARP`), one info line logs the three values, with `default` where one is not set: ``` GPU timeout detection (TdrLevel, TdrDelay, TdrDdiDelay) level=3 delay=8 ddi_delay=default ``` - A warning for `TdrLevel` 0 (a hang freezes the PC) and 1 (a timeout is a blue screen), saying to delete `TdrLevel` or set it to 3 and raise `TdrDelay` instead. Levels 2 and 3 and an unset value don't warn, and neither does a raised `TdrDelay` alone. - `windows-sys` in `victory-gpu` gains the `Win32_System_Registry` feature; `Cargo.lock` is unchanged. This complements #537, which documents raising `TdrDelay`/`TdrDdiDelay` in the README; it touches no README lines, so the two don't conflict. ## Tested Windows 11, AMD Radeon RX 7900 XTX, driver 26.11.2, Rust 1.98.1, at `ffe310e`: - `cargo test --workspace --locked`: all pass, including the 5 new `tdr::tests` (warnings for 0 and 1; none for unset, 2, 3 or a raised delay alone; a missing value reads as `None`). - `cargo clippy --workspace --all-targets --locked -- -D warnings` and the same with `--all-features`: clean. - `rustfmt --check` on `tdr.rs`: clean. - `Tdr::read()` on this machine gives `level: Some(3), delay: Some(8), ddi_delay: None`, the same as `reg query` for that key. Not tested: a run of the title (I don't have a dump), so the log line has not been seen in a real run's log, and the warning path has not been seen with `TdrLevel` actually set to 0 (only in unit tests). Not run under Wine, where the key is normally absent and the line logs `default` for all three. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Zipettte commented 2026-11-24 17:04:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T16:29:50Z.


Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 42961e8: cargo test -p victory-gpu passes, 55 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7137756464 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1082#issuecomment-7137756464). Originally posted by [Zipettte](https://github.com/Zipettte) on 2026-11-24T16:29:50Z. --- Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 42961e8: `cargo test -p victory-gpu` passes, 55 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
upstream-sync closed this pull request 2026-11-25 01:05:30 +00:00
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
Marvisak/VIctory!1082
No description provided.