forge
Explore
Log in

Don't you dare go Hollow

Add disable-10bit-output debug flag

Browse files at this commit

aac1551835b0b7cb3c3811a179b6039fcb058bd2Ivan MolodetskikhParent: ebd94a7
docs/wiki/Configuration:-Debug-Options.mdmodified+16 -0
@@ -33,6 +33,7 @@ debug {
33 honor-xdg-activation-with-invalid-serial33 honor-xdg-activation-with-invalid-serial
34 skip-cursor-only-updates-during-vrr34 skip-cursor-only-updates-during-vrr
35 deactivate-unfocused-windows35 deactivate-unfocused-windows
36+ disable-10bit-output
36 }37 }
37 38
38 binds {39 binds {
@@ -324,6 +325,21 @@ debug {
324 }325 }
325 ```326 ```
326 327
328+### `disable-10bit-output`
329+
330+<sup>Since: next release</sup>
331+
332+By default, niri will try to output a 10-bit color format to the monitor (before falling back to 8-bit).
333+However, this can currently cause problems on some Intel + NVIDIA mixed-GPU setups: the screen doesn't light up, or displays only white, etc.
334+
335+Until this is fixed in Smithay, you can disable 10-bit color formats by setting this debug flag.
336+
337+```kdl
338+debug {
339+ disable-10bit-output
340+}
341+```
342+
327 ### Key Bindings343 ### Key Bindings
328 344
329 These are not debug options, but rather key bindings.345 These are not debug options, but rather key bindings.
niri-config/src/debug.rsmodified+4 -0
@@ -24,6 +24,7 @@ pub struct Debug {
24 pub honor_xdg_activation_with_invalid_serial: bool,24 pub honor_xdg_activation_with_invalid_serial: bool,
25 pub deactivate_unfocused_windows: bool,25 pub deactivate_unfocused_windows: bool,
26 pub skip_cursor_only_updates_during_vrr: bool,26 pub skip_cursor_only_updates_during_vrr: bool,
27+ pub disable_10bit_output: bool,
27 }28 }
28 29
29 #[derive(knuffel::Decode, Debug, Default, PartialEq)]30 #[derive(knuffel::Decode, Debug, Default, PartialEq)]
@@ -68,6 +69,8 @@ pub struct DebugPart {
68 pub deactivate_unfocused_windows: Option<Flag>,69 pub deactivate_unfocused_windows: Option<Flag>,
69 #[knuffel(child)]70 #[knuffel(child)]
70 pub skip_cursor_only_updates_during_vrr: Option<Flag>,71 pub skip_cursor_only_updates_during_vrr: Option<Flag>,
72+ #[knuffel(child)]
73+ pub disable_10bit_output: Option<Flag>,
71 }74 }
72 75
73 impl MergeWith<DebugPart> for Debug {76 impl MergeWith<DebugPart> for Debug {
@@ -91,6 +94,7 @@ impl MergeWith<DebugPart> for Debug {
91 honor_xdg_activation_with_invalid_serial,94 honor_xdg_activation_with_invalid_serial,
92 deactivate_unfocused_windows,95 deactivate_unfocused_windows,
93 skip_cursor_only_updates_during_vrr,96 skip_cursor_only_updates_during_vrr,
97+ disable_10bit_output,
94 );98 );
95 99
96 merge_clone_opt!((self, part), preview_render, render_drm_device);100 merge_clone_opt!((self, part), preview_render, render_drm_device);
niri-config/src/lib.rsmodified+1 -0
@@ -2271,6 +2271,7 @@ mod tests {
2271 honor_xdg_activation_with_invalid_serial: false,2271 honor_xdg_activation_with_invalid_serial: false,
2272 deactivate_unfocused_windows: false,2272 deactivate_unfocused_windows: false,
2273 skip_cursor_only_updates_during_vrr: false,2273 skip_cursor_only_updates_during_vrr: false,
2274+ disable_10bit_output: false,
2274 },2275 },
2275 workspaces: [2276 workspaces: [
2276 Workspace {2277 Workspace {
src/backend/tty.rsmodified+16 -10
@@ -70,15 +70,13 @@ use crate::render_helpers::renderer::AsGlesRenderer;
70 use crate::render_helpers::{resources, shaders, RenderCtx, RenderTarget};70 use crate::render_helpers::{resources, shaders, RenderCtx, RenderTarget};
71 use crate::utils::{get_monotonic_time, is_laptop_panel, logical_output, PanelOrientation};71 use crate::utils::{get_monotonic_time, is_laptop_panel, logical_output, PanelOrientation};
72 72
73-// specific 10-bit formats for multigpu setup,73+// When copying from rendering Nvidia dGPU to target iGPU,
74-// i.e. copying from rendering Nvidia dGPU to target iGPU.74+// it only understands X/Abgr and not X/Argb.
75-//75+const SUPPORTED_COLOR_FORMATS_10BIT: [Fourcc; 3] =
76+ [Fourcc::Abgr2101010, Fourcc::Argb8888, Fourcc::Abgr8888];
77+
76 // Smithay should fall back to Xrgb/Xbgr automatically if needed.78 // Smithay should fall back to Xrgb/Xbgr automatically if needed.
77-const SUPPORTED_COLOR_FORMATS: [Fourcc; 3] = [79+const SUPPORTED_COLOR_FORMATS: [Fourcc; 2] = [Fourcc::Argb8888, Fourcc::Abgr8888];
78- Fourcc::Abgr2101010,
79- Fourcc::Argb8888,
80- Fourcc::Abgr8888,
81-];
82 80
83 pub struct Tty {81 pub struct Tty {
84 config: Rc<RefCell<Config>>,82 config: Rc<RefCell<Config>>,
@@ -1439,6 +1437,14 @@ impl Tty {
1439 })1437 })
1440 .collect::<FormatSet>();1438 .collect::<FormatSet>();
1441 1439
1440+ let color_formats = if self.config.borrow().debug.disable_10bit_output {
1441+ &SUPPORTED_COLOR_FORMATS[..]
1442+ } else {
1443+ &SUPPORTED_COLOR_FORMATS_10BIT[..]
1444+ }
1445+ .iter()
1446+ .copied();
1447+
1442 // Create the compositor.1448 // Create the compositor.
1443 let res = DrmCompositor::new(1449 let res = DrmCompositor::new(
1444 OutputModeSource::Auto(output.downgrade()),1450 OutputModeSource::Auto(output.downgrade()),
@@ -1446,7 +1452,7 @@ impl Tty {
1446 None,1452 None,
1447 device.allocator.clone(),1453 device.allocator.clone(),
1448 GbmFramebufferExporter::new(device.gbm.clone(), device.render_node.into()),1454 GbmFramebufferExporter::new(device.gbm.clone(), device.render_node.into()),
1449- SUPPORTED_COLOR_FORMATS,1455+ color_formats.clone(),
1450 // This is only used to pick a good internal format, so it can use the surface's render1456 // This is only used to pick a good internal format, so it can use the surface's render
1451 // formats, even though we only ever render on the primary GPU.1457 // formats, even though we only ever render on the primary GPU.
1452 render_formats.clone(),1458 render_formats.clone(),
@@ -1476,7 +1482,7 @@ impl Tty {
1476 None,1482 None,
1477 device.allocator.clone(),1483 device.allocator.clone(),
1478 GbmFramebufferExporter::new(device.gbm.clone(), device.render_node.into()),1484 GbmFramebufferExporter::new(device.gbm.clone(), device.render_node.into()),
1479- SUPPORTED_COLOR_FORMATS,1485+ color_formats,
1480 render_formats,1486 render_formats,
1481 device.drm.cursor_size(),1487 device.drm.cursor_size(),
1482 Some(device.gbm.clone()),1488 Some(device.gbm.clone()),