From b8aa0a86e7a0cb3c96b11ed90940ae04e2653542 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Wed, 21 Feb 2024 07:55:10 +0400 Subject: Fix debug tint desync for new outputs --- src/backend/tty.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/backend/tty.rs b/src/backend/tty.rs index 4b45d13e..decfd58f 100644 --- a/src/backend/tty.rs +++ b/src/backend/tty.rs @@ -75,6 +75,8 @@ pub struct Tty { dmabuf_global: Option, // The output config had changed, but the session is paused, so we need to update it on resume. update_output_config_on_resume: bool, + // Whether the debug tinting is enabled. + debug_tint: bool, ipc_outputs: Rc>>, enabled_outputs: Arc>>, } @@ -272,6 +274,7 @@ impl Tty { devices: HashMap::new(), dmabuf_global: None, update_output_config_on_resume: false, + debug_tint: false, ipc_outputs: Rc::new(RefCell::new(HashMap::new())), enabled_outputs: Arc::new(Mutex::new(HashMap::new())), }) @@ -747,7 +750,7 @@ impl Tty { let render_formats = egl_context.dmabuf_render_formats(); // Create the compositor. - let compositor = DrmCompositor::new( + let mut compositor = DrmCompositor::new( OutputModeSource::Auto(output.clone()), surface, Some(planes), @@ -760,6 +763,9 @@ impl Tty { device.drm.cursor_size(), cursor_plane_gbm, )?; + if self.debug_tint { + compositor.set_debug_flags(DebugFlags::TINT); + } let mut dmabuf_feedback = None; if let Ok(primary_renderer) = self.gpu_manager.single_renderer(&self.primary_render_node) { @@ -1171,10 +1177,15 @@ impl Tty { } pub fn toggle_debug_tint(&mut self) { + self.debug_tint = !self.debug_tint; + for device in self.devices.values_mut() { for surface in device.surfaces.values_mut() { let compositor = &mut surface.compositor; - compositor.set_debug_flags(compositor.debug_flags() ^ DebugFlags::TINT); + + let mut flags = compositor.debug_flags(); + flags.set(DebugFlags::TINT, self.debug_tint); + compositor.set_debug_flags(flags); } } } -- cgit