tty: Add check for vblank on idle
Browse files at this commitaf904d23acc7980fbf3aedf173dc96af1dd580b9Parent: ad84fc11 changed file +10 -0
- src/backend/tty.rs +10 -0
src/backend/tty.rsmodified+10 -0
| @@ -1178,6 +1178,16 @@ impl Tty { | |||
| 1178 | return; | 1178 | return; |
| 1179 | }; | 1179 | }; |
| 1180 | 1180 | ||
| 1181 | + // This happened for someone reconnecting 2 monitors with a KVM switch: | ||
| 1182 | + // https://github.com/YaLTeR/niri/issues/556 | ||
| 1183 | + // | ||
| 1184 | + // Maybe the vblank didn't get cancelled or got reordered weirdly? Either way, we can avoid | ||
| 1185 | + // crashing here. | ||
| 1186 | + if matches!(output_state.redraw_state, RedrawState::Idle) { | ||
| 1187 | + error!("got vblank for an idle output {name}"); | ||
| 1188 | + return; | ||
| 1189 | + } | ||
| 1190 | + | ||
| 1181 | // Mark the last frame as submitted. | 1191 | // Mark the last frame as submitted. |
| 1182 | match surface.compositor.frame_submitted() { | 1192 | match surface.compositor.frame_submitted() { |
| 1183 | Ok(Some((mut feedback, target_presentation_time))) => { | 1193 | Ok(Some((mut feedback, target_presentation_time))) => { |