Skip to content

GPU: display mode changes and devices added or removed go to the log and to the removal report's trail - #1004

Open
PiloteCode wants to merge 2 commits into
fxceless:mainfrom
PiloteCode:pr/window-changes
Open

PiloteCode wants to merge 2 commits into
fxceless:mainfrom
PiloteCode:pr/window-changes

Conversation

@PiloteCode

@PiloteCode PiloteCode commented Nov 25, 2026 •

Copy link
Copy Markdown

Based on 4c604661 (main). Two commits, two small changes to the window procedure in host.rs: about 20 lines.

Rebuilt on today's main: the two clippy fixes it started with are gone (main is clippy-clean now), and the two commits are re-applied unchanged.

Why

On our test machine, Windows reset the card several times in one day ("Resetting TDR" from the display driver), and each reset ended the run under way with its host device lost. The system's own logs showed what came before: each time, 2.5 to 4.6 s earlier, a remote-desktop host had ended its session and removed its virtual input device. Nothing in our log showed it, so the losses first looked like ours.

What changes

Our window now notes two messages the system sends every top-level window:

  • WM_DISPLAYCHANGE, with the new size and bits per pixel ("the display's mode changed");
  • WM_DEVICECHANGE with DBT_DEVNODES_CHANGED ("a device was added to or removed from the system").

Each goes to the log and to the trail (host::trail). The report of a lost device prints the trail with how long before the loss each entry came, so the report says whether a display or device change preceded the loss.

In every build, with no switch: two log lines per change, which is rare. The window procedure otherwise does as before (DefWindowProcW).

Tested

The branch was checked as it is, on 4c604661, on the software adapter:

  • cargo test -p victory-gpu --features diagnostics -- --test-threads=1 --skip stacks_that_mean_nothing_are_walked_without_a_fault with VICTORY_D3D12_WARP=1: 247 passed, 7 ignored, none failed, as on main. The skipped test ends the test process with an access violation on this machine, on main too.
  • cargo clippy --workspace --all-targets --locked -- -D warnings, and the same with --all-features: clean.
  • cargo build --release -p victory and cargo build --profile diag -p victory --features diagnostics pass.
  • cargo xtask policy fails on main itself: host.rs (534,239 bytes) and emit/lower.rs (546,915) are over the 524,288-byte limit. This branch adds 991 bytes to host.rs and names no other file.

In our tree, these lines have been in every run since they went in. No unit test: the messages come from the system.

Not tested

  • A device loss with this branch (the losses it was written for came from the remote-desktop host).
  • Linux/Proton, where the window messages may differ.

Moon0755 added a commit to Moon0755/victory-fork that referenced this pull request Nov 25, 2026
@PiloteCode

Copy link
Copy Markdown
Author

Merged main (c36971b) into the branch: a merge commit on top of the commits already here (d1d247d), then one lint commit. No conflict: this branch's change is in window_proc, which main's commits since 0b0074e do not touch.

Added after the merge: one lint commit for main's newer code, the same as on our other open branches: map_entry in fpsbox.rs, collapsible_if in pipeline/library.rs, manual_is_multiple_of in queue.rs, shadow.rs, draw.rs and watch.rs. Without it cargo clippy --workspace --all-targets --locked -- -D warnings fails on c36971b, with or without --all-features.

Checked, the branch as it is (66fa13b), every test on the software adapter:

  • cargo clippy --workspace --all-targets --locked -- -D warnings, and the same with --all-features: clean.
  • cargo xtask policy, cargo build --release -p victory and cargo build --profile diag -p victory --features diagnostics: pass.
  • cargo test -p victory-gpu --features diagnostics -- --test-threads=1 with VICTORY_D3D12_WARP=1: 200 passed, 1 failed, 6 ignored, as on main. The failure is depth_bounds_pipeline_loads_and_filters_draws: WARP does not reject the pixels outside the depth bounds.
  • cargo test -p victory-shader -- --test-threads=1 with VICTORY_WARP=1: 212 passed, 4 failed, 3 ignored, the same four as on main on the software adapter.
  • cargo test -p victory-hle -- --test-threads=1: 100 + 1 passed, as on main.
  • cargo test -p victory -p victory-loader: passed.

SPOOKEXE pushed a commit to SPOOKEXE/victory-fork that referenced this pull request Nov 26, 2026
On a test machine Windows reset the card four times in one day (the
display driver's "Resetting TDR"), each 2.5 to 4.6 s after a
remote-desktop host ended a session and removed its virtual input device
(as the system's device log shows), and each reset ended the run under
way with its host device lost; nothing in our log showed what came
before. Our window now notes the messages the system sends every
top-level window: WM_DISPLAYCHANGE with the new size, and
WM_DEVICECHANGE's "devices changed".
…ints

So the report of a lost device says how long before it a device was
added or removed or the display's mode changed (2.5 to 4.6 s for the
four card resets on the test machine that day), next to the sweeps and
library calls.
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.

1 participant