Add disable-direct-scanout debug flag

This commit is contained in:
Ivan Molodetskikh
2024-04-25 22:10:52 +04:00
parent 9df71bcb5d
commit 8d99e3c015
5 changed files with 43 additions and 0 deletions
+2
View File
@@ -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)]
+7
View File
@@ -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
+14
View File
@@ -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)
}
+9
View File
@@ -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");
+11
View File
@@ -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.