forge
Explore
Log in

Don't you dare go Hollow

Fix debug tint desync for new outputs

Browse files at this commit

b8aa0a86e7a0cb3c96b11ed90940ae04e2653542Ivan MolodetskikhParent: 82fffde
src/backend/tty.rsmodified+13 -2
@@ -75,6 +75,8 @@ pub struct Tty {
7575 dmabuf_global: Option<DmabufGlobal>,
7676 // The output config had changed, but the session is paused, so we need to update it on resume.
7777 update_output_config_on_resume: bool,
78+ // Whether the debug tinting is enabled.
79+ debug_tint: bool,
7880 ipc_outputs: Rc<RefCell<HashMap<String, niri_ipc::Output>>>,
7981 enabled_outputs: Arc<Mutex<HashMap<String, Output>>>,
8082 }
@@ -272,6 +274,7 @@ impl Tty {
272274 devices: HashMap::new(),
273275 dmabuf_global: None,
274276 update_output_config_on_resume: false,
277+ debug_tint: false,
275278 ipc_outputs: Rc::new(RefCell::new(HashMap::new())),
276279 enabled_outputs: Arc::new(Mutex::new(HashMap::new())),
277280 })
@@ -747,7 +750,7 @@ impl Tty {
747750 let render_formats = egl_context.dmabuf_render_formats();
748751
749752 // Create the compositor.
750- let compositor = DrmCompositor::new(
753+ let mut compositor = DrmCompositor::new(
751754 OutputModeSource::Auto(output.clone()),
752755 surface,
753756 Some(planes),
@@ -760,6 +763,9 @@ impl Tty {
760763 device.drm.cursor_size(),
761764 cursor_plane_gbm,
762765 )?;
766+ if self.debug_tint {
767+ compositor.set_debug_flags(DebugFlags::TINT);
768+ }
763769
764770 let mut dmabuf_feedback = None;
765771 if let Ok(primary_renderer) = self.gpu_manager.single_renderer(&self.primary_render_node) {
@@ -1171,10 +1177,15 @@ impl Tty {
11711177 }
11721178
11731179 pub fn toggle_debug_tint(&mut self) {
1180+ self.debug_tint = !self.debug_tint;
1181+
11741182 for device in self.devices.values_mut() {
11751183 for surface in device.surfaces.values_mut() {
11761184 let compositor = &mut surface.compositor;
1177- compositor.set_debug_flags(compositor.debug_flags() ^ DebugFlags::TINT);
1185+
1186+ let mut flags = compositor.debug_flags();
1187+ flags.set(DebugFlags::TINT, self.debug_tint);
1188+ compositor.set_debug_flags(flags);
11781189 }
11791190 }
11801191 }