mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2024-12-25 09:59:21 +01:00
Don't panic when render state is unexpected
Crashed after waking from sleep, hopefully this fixes that
This commit is contained in:
parent
c597ff6cce
commit
d5343cab92
1 changed files with 9 additions and 5 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue