diff --git a/src/backend/udev.rs b/src/backend/udev.rs index 7fb5e31..7481ca1 100644 --- a/src/backend/udev.rs +++ b/src/backend/udev.rs @@ -767,9 +767,10 @@ struct DrmSurfaceDmabufFeedback { } /// The state of a [`RenderSurface`]. -#[derive(Debug)] +#[derive(Debug, Default)] enum RenderState { /// No render is scheduled. + #[default] Idle, // TODO: remove the token on tty switch or output unplug /// A render has been queued. @@ -1322,12 +1323,15 @@ impl Udev { } }; - let RenderState::WaitingForVblank { dirty } = surface.render_state else { - unreachable!(); + let dirty = match std::mem::take(&mut surface.render_state) { + RenderState::WaitingForVblank { dirty } => dirty, + state => { + debug!("vblank happened but render state was {state:?}",); + self.schedule_render(&pinnacle.loop_handle, &output); + return; + } }; - surface.render_state = RenderState::Idle; - if dirty { self.schedule_render(&pinnacle.loop_handle, &output); } else {