forge
Explore
Log in

Don't you dare go Hollow

Add disable-direct-scanout debug flag

Browse files at this commit

8d99e3c015fe210acf0e67fa62335688f5e3df15Ivan MolodetskikhParent: 9df71bc
niri-config/src/lib.rsmodified+2 -0
@@ -977,6 +977,8 @@ pub struct DebugConfig {
977 pub enable_overlay_planes: bool,977 pub enable_overlay_planes: bool,
978 #[knuffel(child)]978 #[knuffel(child)]
979 pub disable_cursor_plane: bool,979 pub disable_cursor_plane: bool,
980+ #[knuffel(child)]
981+ pub disable_direct_scanout: bool,
980 #[knuffel(child, unwrap(argument))]982 #[knuffel(child, unwrap(argument))]
981 pub render_drm_device: Option<PathBuf>,983 pub render_drm_device: Option<PathBuf>,
982 #[knuffel(child)]984 #[knuffel(child)]
src/backend/mod.rsmodified+7 -0
@@ -144,6 +144,13 @@ impl Backend {
144 }144 }
145 }145 }
146 146
147+ pub fn on_debug_config_changed(&mut self) {
148+ match self {
149+ Backend::Tty(tty) => tty.on_debug_config_changed(),
150+ Backend::Winit(_) => (),
151+ }
152+ }
153+
147 pub fn tty(&mut self) -> &mut Tty {154 pub fn tty(&mut self) -> &mut Tty {
148 if let Self::Tty(v) = self {155 if let Self::Tty(v) = self {
149 v156 v
src/backend/tty.rsmodified+14 -0
@@ -900,6 +900,7 @@ impl Tty {
900 if self.debug_tint {900 if self.debug_tint {
901 compositor.set_debug_flags(DebugFlags::TINT);901 compositor.set_debug_flags(DebugFlags::TINT);
902 }902 }
903+ compositor.use_direct_scanout(!config.debug.disable_direct_scanout);
903 904
904 let mut dmabuf_feedback = None;905 let mut dmabuf_feedback = None;
905 if let Ok(primary_renderer) = self.gpu_manager.single_renderer(&self.primary_render_node) {906 if let Ok(primary_renderer) = self.gpu_manager.single_renderer(&self.primary_render_node) {
@@ -1717,6 +1718,19 @@ impl Tty {
1717 self.refresh_ipc_outputs(niri);1718 self.refresh_ipc_outputs(niri);
1718 }1719 }
1719 1720
1721+ pub fn on_debug_config_changed(&mut self) {
1722+ let config = self.config.borrow();
1723+ let debug = &config.debug;
1724+ let use_direct_scanout = !debug.disable_direct_scanout;
1725+
1726+ // FIXME: reload other flags if possible?
1727+ for device in self.devices.values_mut() {
1728+ for surface in device.surfaces.values_mut() {
1729+ surface.compositor.use_direct_scanout(use_direct_scanout);
1730+ }
1731+ }
1732+ }
1733+
1720 pub fn get_device_from_node(&mut self, node: DrmNode) -> Option<&mut OutputDevice> {1734 pub fn get_device_from_node(&mut self, node: DrmNode) -> Option<&mut OutputDevice> {
1721 self.devices.get_mut(&node)1735 self.devices.get_mut(&node)
1722 }1736 }
src/niri.rsmodified+9 -0
@@ -852,6 +852,7 @@ impl State {
852 let mut libinput_config_changed = false;852 let mut libinput_config_changed = false;
853 let mut output_config_changed = false;853 let mut output_config_changed = false;
854 let mut window_rules_changed = false;854 let mut window_rules_changed = false;
855+ let mut debug_config_changed = false;
855 let mut old_config = self.niri.config.borrow_mut();856 let mut old_config = self.niri.config.borrow_mut();
856 857
857 // Reload the cursor.858 // Reload the cursor.
@@ -910,6 +911,10 @@ impl State {
910 });911 });
911 }912 }
912 913
914+ if config.debug != old_config.debug {
915+ debug_config_changed = true;
916+ }
917+
913 *old_config = config;918 *old_config = config;
914 919
915 // Release the borrow.920 // Release the borrow.
@@ -978,6 +983,10 @@ impl State {
978 }983 }
979 }984 }
980 985
986+ if debug_config_changed {
987+ self.backend.on_debug_config_changed();
988+ }
989+
981 if window_rules_changed {990 if window_rules_changed {
982 let _span = tracy_client::span!("recompute window rules");991 let _span = tracy_client::span!("recompute window rules");
983 992
wiki/Configuration:-Debug-Options.mdmodified+11 -0
@@ -15,6 +15,7 @@ debug {
15 // preview-render "screen-capture"15 // preview-render "screen-capture"
16 enable-overlay-planes16 enable-overlay-planes
17 disable-cursor-plane17 disable-cursor-plane
18+ disable-direct-scanout
18 render-drm-device "/dev/dri/renderD129"19 render-drm-device "/dev/dri/renderD129"
19 dbus-interfaces-in-non-session-instances20 dbus-interfaces-in-non-session-instances
20 wait-for-frame-completion-before-queueing21 wait-for-frame-completion-before-queueing
@@ -62,6 +63,16 @@ debug {
62 }63 }
63 ```64 ```
64 65
66+### `disable-direct-scanout`
67+
68+Disable direct scanout to both the primary plane and the overlay planes.
69+
70+```
71+debug {
72+ disable-direct-scanout
73+}
74+```
75+
65 ### `render-drm-device`76 ### `render-drm-device`
66 77
67 Override the DRM device that niri will use for all rendering.78 Override the DRM device that niri will use for all rendering.