From af904d23acc7980fbf3aedf173dc96af1dd580b9 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sat, 27 Jul 2024 13:43:27 +0300 Subject: tty: Add check for vblank on idle --- src/backend/tty.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/backend/tty.rs b/src/backend/tty.rs index fa7d4b18..10becafe 100644 --- a/src/backend/tty.rs +++ b/src/backend/tty.rs @@ -1178,6 +1178,16 @@ impl Tty { return; }; + // This happened for someone reconnecting 2 monitors with a KVM switch: + // https://github.com/YaLTeR/niri/issues/556 + // + // Maybe the vblank didn't get cancelled or got reordered weirdly? Either way, we can avoid + // crashing here. + if matches!(output_state.redraw_state, RedrawState::Idle) { + error!("got vblank for an idle output {name}"); + return; + } + // Mark the last frame as submitted. match surface.compositor.frame_submitted() { Ok(Some((mut feedback, target_presentation_time))) => { -- cgit