From f3dabe2cea61ce04f31133584263e789c01e4e58 Mon Sep 17 00:00:00 2001 From: Victor Brekenfeld Date: Sun, 3 May 2020 17:54:29 +0200 Subject: [PATCH] atomic: clear broken resources on resume --- src/backend/drm/atomic/session.rs | 14 +++++++++++++- src/backend/drm/atomic/surface.rs | 6 +++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/backend/drm/atomic/session.rs b/src/backend/drm/atomic/session.rs index f5f2b03..47dcb58 100644 --- a/src/backend/drm/atomic/session.rs +++ b/src/backend/drm/atomic/session.rs @@ -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 AtomicDrmDeviceObserver { // 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); } } } diff --git a/src/backend/drm/atomic/surface.rs b/src/backend/drm/atomic/surface.rs index e5f4704..f68bd1e 100644 --- a/src/backend/drm/atomic/surface.rs +++ b/src/backend/drm/atomic/surface.rs @@ -20,9 +20,9 @@ use crate::backend::graphics::CursorBackend; #[derive(Debug, Clone, PartialEq, Eq)] pub struct CursorState { - position: Cell>, - hotspot: Cell<(u32, u32)>, - framebuffer: Cell>, + pub position: Cell>, + pub hotspot: Cell<(u32, u32)>, + pub framebuffer: Cell>, } #[derive(Debug, PartialEq, Eq, Clone)]