Default to unrestricted primary plane scanout

This commit is contained in:
Ivan Molodetskikh
2025-01-04 13:02:05 +03:00
parent b2ca280c49
commit 4618e4851c
3 changed files with 30 additions and 5 deletions
+2
View File
@@ -1641,6 +1641,8 @@ pub struct DebugConfig {
pub disable_cursor_plane: bool,
#[knuffel(child)]
pub disable_direct_scanout: bool,
#[knuffel(child)]
pub restrict_primary_scanout_to_matching_format: bool,
#[knuffel(child, unwrap(argument))]
pub render_drm_device: Option<PathBuf>,
#[knuffel(child)]
+13 -5
View File
@@ -1336,21 +1336,29 @@ impl Tty {
// Overlay planes are disabled by default as they cause weird performance issues on my
// system.
let mut flags =
FrameFlags::ALLOW_PRIMARY_PLANE_SCANOUT | FrameFlags::ALLOW_CURSOR_PLANE_SCANOUT;
{
let flags = {
let debug = &self.config.borrow().debug;
let primary_scanout_flag = if debug.restrict_primary_scanout_to_matching_format {
FrameFlags::ALLOW_PRIMARY_PLANE_SCANOUT
} else {
FrameFlags::ALLOW_PRIMARY_PLANE_SCANOUT_ANY
};
let mut flags = primary_scanout_flag | FrameFlags::ALLOW_CURSOR_PLANE_SCANOUT;
if debug.enable_overlay_planes {
flags.insert(FrameFlags::ALLOW_OVERLAY_PLANE_SCANOUT);
}
if debug.disable_direct_scanout {
flags.remove(FrameFlags::ALLOW_PRIMARY_PLANE_SCANOUT);
flags.remove(primary_scanout_flag);
flags.remove(FrameFlags::ALLOW_OVERLAY_PLANE_SCANOUT);
}
if debug.disable_cursor_plane {
flags.remove(FrameFlags::ALLOW_CURSOR_PLANE_SCANOUT);
}
}
flags
};
// Hand them over to the DRM.
let drm_compositor = &mut surface.compositor;
+15
View File
@@ -16,6 +16,7 @@ debug {
enable-overlay-planes
disable-cursor-plane
disable-direct-scanout
restrict-primary-scanout-to-matching-format
render-drm-device "/dev/dri/renderD129"
force-pipewire-invalid-modifier
dbus-interfaces-in-non-session-instances
@@ -84,6 +85,20 @@ debug {
}
```
### `restrict-primary-scanout-to-matching-format`
Restricts direct scanout to the primary plane to when the window buffer exactly matches the composition swapchain format.
This flag may prevent unexpected bandwidth changes when going between composition and scanout.
The plan is to make it default in the future, when we implement a way to tell the clients the composition swapchain format.
As is, it may prevent some clients (mpv on my machine) from scanning out to the primary plane.
```kdl
debug {
restrict-primary-scanout-to-matching-format
}
```
### `render-drm-device`
Override the DRM device that niri will use for all rendering.