atomic: clear broken resources on resume

This commit is contained in:
Victor Brekenfeld 2020-05-03 17:54:29 +02:00
parent 9bbd9edb0c
commit f3dabe2cea
2 changed files with 16 additions and 4 deletions

View File

@ -16,7 +16,7 @@ use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use super::{AtomicDrmDevice, AtomicDrmSurfaceInternal, Dev};
use crate::backend::drm::{common::Error, DevPath};
use crate::backend::drm::{common::Error, DevPath, Surface};
use crate::backend::session::{AsSessionObserver, SessionObserver};
/// [`SessionObserver`](SessionObserver)
@ -164,6 +164,18 @@ impl<A: AsRawFd + 'static> AtomicDrmDeviceObserver<A> {
// lets force a non matching state
current.connectors.clear();
current.mode = unsafe { std::mem::zeroed() };
// recreate property blob
let mode = {
let pending = surface.pending.read().unwrap();
pending.mode.clone()
};
surface.use_mode(mode)?;
// drop cursor state
surface.cursor.position.set(None);
surface.cursor.hotspot.set((0,0));
surface.cursor.framebuffer.set(None);
}
}
}

View File

@ -20,9 +20,9 @@ use crate::backend::graphics::CursorBackend;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct CursorState {
position: Cell<Option<(u32, u32)>>,
hotspot: Cell<(u32, u32)>,
framebuffer: Cell<Option<framebuffer::Handle>>,
pub position: Cell<Option<(u32, u32)>>,
pub hotspot: Cell<(u32, u32)>,
pub framebuffer: Cell<Option<framebuffer::Handle>>,
}
#[derive(Debug, PartialEq, Eq, Clone)]