forge
Explore
Log in

Don't you dare go Hollow

Add force-pipewire-invalid-modifier debug flag

Browse files at this commit

6b16cc52dbfaa12889cadb93ce19da3e3fde46f2Ivan MolodetskikhParent: d35ad73
niri-config/src/lib.rsmodified+2 -0
@@ -1528,6 +1528,8 @@ pub struct DebugConfig {
1528 #[knuffel(child, unwrap(argument))]1528 #[knuffel(child, unwrap(argument))]
1529 pub render_drm_device: Option<PathBuf>,1529 pub render_drm_device: Option<PathBuf>,
1530 #[knuffel(child)]1530 #[knuffel(child)]
1531+ pub force_pipewire_invalid_modifier: bool,
1532+ #[knuffel(child)]
1531 pub emulate_zero_presentation_time: bool,1533 pub emulate_zero_presentation_time: bool,
1532 #[knuffel(child)]1534 #[knuffel(child)]
1533 pub disable_resize_throttling: bool,1535 pub disable_resize_throttling: bool,
src/niri.rsmodified+13 -1
@@ -1486,6 +1486,8 @@ impl State {
1486 1486
1487 #[cfg(feature = "xdp-gnome-screencast")]1487 #[cfg(feature = "xdp-gnome-screencast")]
1488 pub fn on_screen_cast_msg(&mut self, msg: ScreenCastToNiri) {1488 pub fn on_screen_cast_msg(&mut self, msg: ScreenCastToNiri) {
1489+ use smithay::reexports::gbm::Modifier;
1490+
1489 use crate::dbus::mutter_screen_cast::StreamTargetId;1491 use crate::dbus::mutter_screen_cast::StreamTargetId;
1490 1492
1491 match msg {1493 match msg {
@@ -1560,13 +1562,23 @@ impl State {
1560 }1562 }
1561 };1563 };
1562 1564
1563- let render_formats = self1565+ let mut render_formats = self
1564 .backend1566 .backend
1565 .with_primary_renderer(|renderer| {1567 .with_primary_renderer(|renderer| {
1566 renderer.egl_context().dmabuf_render_formats().clone()1568 renderer.egl_context().dmabuf_render_formats().clone()
1567 })1569 })
1568 .unwrap_or_default();1570 .unwrap_or_default();
1569 1571
1572+ {
1573+ let config = self.niri.config.borrow();
1574+ if config.debug.force_pipewire_invalid_modifier {
1575+ render_formats = render_formats
1576+ .into_iter()
1577+ .filter(|f| f.modifier == Modifier::Invalid)
1578+ .collect();
1579+ }
1580+ }
1581+
1570 let res = pw.start_cast(1582 let res = pw.start_cast(
1571 gbm,1583 gbm,
1572 render_formats,1584 render_formats,
wiki/Configuration:-Debug-Options.mdmodified+15 -0
@@ -17,6 +17,7 @@ debug {
17 disable-cursor-plane17 disable-cursor-plane
18 disable-direct-scanout18 disable-direct-scanout
19 render-drm-device "/dev/dri/renderD129"19 render-drm-device "/dev/dri/renderD129"
20+ force-pipewire-invalid-modifier
20 dbus-interfaces-in-non-session-instances21 dbus-interfaces-in-non-session-instances
21 wait-for-frame-completion-before-queueing22 wait-for-frame-completion-before-queueing
22 emulate-zero-presentation-time23 emulate-zero-presentation-time
@@ -95,6 +96,20 @@ debug {
95 }96 }
96 ```97 ```
97 98
99+### `force-pipewire-invalid-modifier`
100+
101+<sup>Since: next release</sup>
102+
103+Forces PipeWire screencasting to use the invalid modifier, even when DRM offers more modifiers.
104+
105+Useful for testing the invalid modifier code path that is hit by drivers that don't support modifiers.
106+
107+```kdl
108+debug {
109+ force-pipewire-invalid-modifier
110+}
111+```
112+
98 ### `dbus-interfaces-in-non-session-instances`113 ### `dbus-interfaces-in-non-session-instances`
99 114
100 Make niri create its D-Bus interfaces even if it's not running as a `--session`.115 Make niri create its D-Bus interfaces even if it's not running as a `--session`.