diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-04-25 22:10:52 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-04-25 22:10:52 +0400 |
| commit | 8d99e3c015fe210acf0e67fa62335688f5e3df15 (patch) | |
| tree | ef81a9046b2eda190125ced589f7135164911ada | |
| parent | 9df71bcb5d3c9b294314b8e9b309b015a296a1a4 (diff) | |
| download | niri-8d99e3c015fe210acf0e67fa62335688f5e3df15.tar.gz niri-8d99e3c015fe210acf0e67fa62335688f5e3df15.tar.bz2 niri-8d99e3c015fe210acf0e67fa62335688f5e3df15.zip | |
Add disable-direct-scanout debug flag
| -rw-r--r-- | niri-config/src/lib.rs | 2 | ||||
| -rw-r--r-- | src/backend/mod.rs | 7 | ||||
| -rw-r--r-- | src/backend/tty.rs | 14 | ||||
| -rw-r--r-- | src/niri.rs | 9 | ||||
| -rw-r--r-- | wiki/Configuration:-Debug-Options.md | 11 |
5 files changed, 43 insertions, 0 deletions
diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs index 87e2c4a6..ca789528 100644 --- a/niri-config/src/lib.rs +++ b/niri-config/src/lib.rs @@ -977,6 +977,8 @@ pub struct DebugConfig { pub enable_overlay_planes: bool, #[knuffel(child)] pub disable_cursor_plane: bool, + #[knuffel(child)] + pub disable_direct_scanout: bool, #[knuffel(child, unwrap(argument))] pub render_drm_device: Option<PathBuf>, #[knuffel(child)] diff --git a/src/backend/mod.rs b/src/backend/mod.rs index 80986aea..ccdda34d 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -144,6 +144,13 @@ impl Backend { } } + pub fn on_debug_config_changed(&mut self) { + match self { + Backend::Tty(tty) => tty.on_debug_config_changed(), + Backend::Winit(_) => (), + } + } + pub fn tty(&mut self) -> &mut Tty { if let Self::Tty(v) = self { v diff --git a/src/backend/tty.rs b/src/backend/tty.rs index f3787624..3eb75a87 100644 --- a/src/backend/tty.rs +++ b/src/backend/tty.rs @@ -900,6 +900,7 @@ impl Tty { if self.debug_tint { compositor.set_debug_flags(DebugFlags::TINT); } + compositor.use_direct_scanout(!config.debug.disable_direct_scanout); let mut dmabuf_feedback = None; if let Ok(primary_renderer) = self.gpu_manager.single_renderer(&self.primary_render_node) { @@ -1717,6 +1718,19 @@ impl Tty { self.refresh_ipc_outputs(niri); } + pub fn on_debug_config_changed(&mut self) { + let config = self.config.borrow(); + let debug = &config.debug; + let use_direct_scanout = !debug.disable_direct_scanout; + + // FIXME: reload other flags if possible? + for device in self.devices.values_mut() { + for surface in device.surfaces.values_mut() { + surface.compositor.use_direct_scanout(use_direct_scanout); + } + } + } + pub fn get_device_from_node(&mut self, node: DrmNode) -> Option<&mut OutputDevice> { self.devices.get_mut(&node) } diff --git a/src/niri.rs b/src/niri.rs index 03eed6d2..8e2807db 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -852,6 +852,7 @@ impl State { let mut libinput_config_changed = false; let mut output_config_changed = false; let mut window_rules_changed = false; + let mut debug_config_changed = false; let mut old_config = self.niri.config.borrow_mut(); // Reload the cursor. @@ -910,6 +911,10 @@ impl State { }); } + if config.debug != old_config.debug { + debug_config_changed = true; + } + *old_config = config; // Release the borrow. @@ -978,6 +983,10 @@ impl State { } } + if debug_config_changed { + self.backend.on_debug_config_changed(); + } + if window_rules_changed { let _span = tracy_client::span!("recompute window rules"); diff --git a/wiki/Configuration:-Debug-Options.md b/wiki/Configuration:-Debug-Options.md index 13cfe3ca..5da6084f 100644 --- a/wiki/Configuration:-Debug-Options.md +++ b/wiki/Configuration:-Debug-Options.md @@ -15,6 +15,7 @@ debug { // preview-render "screen-capture" enable-overlay-planes disable-cursor-plane + disable-direct-scanout render-drm-device "/dev/dri/renderD129" dbus-interfaces-in-non-session-instances wait-for-frame-completion-before-queueing @@ -62,6 +63,16 @@ debug { } ``` +### `disable-direct-scanout` + +Disable direct scanout to both the primary plane and the overlay planes. + +``` +debug { + disable-direct-scanout +} +``` + ### `render-drm-device` Override the DRM device that niri will use for all rendering. |
