forge
Explore
Log in

Don't you dare go Hollow

Default to unrestricted primary plane scanout

Browse files at this commit

4618e4851ccac8b5d6e708ea926a25a1c22a3e27Ivan MolodetskikhParent: b2ca280
niri-config/src/lib.rsmodified+2 -0
@@ -1641,6 +1641,8 @@ pub struct DebugConfig {
1641 pub disable_cursor_plane: bool,1641 pub disable_cursor_plane: bool,
1642 #[knuffel(child)]1642 #[knuffel(child)]
1643 pub disable_direct_scanout: bool,1643 pub disable_direct_scanout: bool,
1644+ #[knuffel(child)]
1645+ pub restrict_primary_scanout_to_matching_format: bool,
1644 #[knuffel(child, unwrap(argument))]1646 #[knuffel(child, unwrap(argument))]
1645 pub render_drm_device: Option<PathBuf>,1647 pub render_drm_device: Option<PathBuf>,
1646 #[knuffel(child)]1648 #[knuffel(child)]
src/backend/tty.rsmodified+13 -5
@@ -1336,21 +1336,29 @@ impl Tty {
1336 1336
1337 // Overlay planes are disabled by default as they cause weird performance issues on my1337 // Overlay planes are disabled by default as they cause weird performance issues on my
1338 // system.1338 // system.
1339- let mut flags =1339+ let flags = {
1340- FrameFlags::ALLOW_PRIMARY_PLANE_SCANOUT | FrameFlags::ALLOW_CURSOR_PLANE_SCANOUT;
1341- {
1342 let debug = &self.config.borrow().debug;1340 let debug = &self.config.borrow().debug;
1341+
1342+ let primary_scanout_flag = if debug.restrict_primary_scanout_to_matching_format {
1343+ FrameFlags::ALLOW_PRIMARY_PLANE_SCANOUT
1344+ } else {
1345+ FrameFlags::ALLOW_PRIMARY_PLANE_SCANOUT_ANY
1346+ };
1347+ let mut flags = primary_scanout_flag | FrameFlags::ALLOW_CURSOR_PLANE_SCANOUT;
1348+
1343 if debug.enable_overlay_planes {1349 if debug.enable_overlay_planes {
1344 flags.insert(FrameFlags::ALLOW_OVERLAY_PLANE_SCANOUT);1350 flags.insert(FrameFlags::ALLOW_OVERLAY_PLANE_SCANOUT);
1345 }1351 }
1346 if debug.disable_direct_scanout {1352 if debug.disable_direct_scanout {
1347- flags.remove(FrameFlags::ALLOW_PRIMARY_PLANE_SCANOUT);1353+ flags.remove(primary_scanout_flag);
1348 flags.remove(FrameFlags::ALLOW_OVERLAY_PLANE_SCANOUT);1354 flags.remove(FrameFlags::ALLOW_OVERLAY_PLANE_SCANOUT);
1349 }1355 }
1350 if debug.disable_cursor_plane {1356 if debug.disable_cursor_plane {
1351 flags.remove(FrameFlags::ALLOW_CURSOR_PLANE_SCANOUT);1357 flags.remove(FrameFlags::ALLOW_CURSOR_PLANE_SCANOUT);
1352 }1358 }
1353- }1359+
1360+ flags
1361+ };
1354 1362
1355 // Hand them over to the DRM.1363 // Hand them over to the DRM.
1356 let drm_compositor = &mut surface.compositor;1364 let drm_compositor = &mut surface.compositor;
wiki/Configuration:-Debug-Options.mdmodified+15 -0
@@ -16,6 +16,7 @@ debug {
16 enable-overlay-planes16 enable-overlay-planes
17 disable-cursor-plane17 disable-cursor-plane
18 disable-direct-scanout18 disable-direct-scanout
19+ restrict-primary-scanout-to-matching-format
19 render-drm-device "/dev/dri/renderD129"20 render-drm-device "/dev/dri/renderD129"
20 force-pipewire-invalid-modifier21 force-pipewire-invalid-modifier
21 dbus-interfaces-in-non-session-instances22 dbus-interfaces-in-non-session-instances
@@ -84,6 +85,20 @@ debug {
84 }85 }
85 ```86 ```
86 87
88+### `restrict-primary-scanout-to-matching-format`
89+
90+Restricts direct scanout to the primary plane to when the window buffer exactly matches the composition swapchain format.
91+
92+This flag may prevent unexpected bandwidth changes when going between composition and scanout.
93+The plan is to make it default in the future, when we implement a way to tell the clients the composition swapchain format.
94+As is, it may prevent some clients (mpv on my machine) from scanning out to the primary plane.
95+
96+```kdl
97+debug {
98+ restrict-primary-scanout-to-matching-format
99+}
100+```
101+
87 ### `render-drm-device`102 ### `render-drm-device`
88 103
89 Override the DRM device that niri will use for all rendering.104 Override the DRM device that niri will use for all rendering.