From aac1551835b0b7cb3c3811a179b6039fcb058bd2 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Tue, 11 Aug 2026 19:53:18 +0300 Subject: [PATCH] Add disable-10bit-output debug flag --- docs/wiki/Configuration:-Debug-Options.md | 16 ++++++++++++++ niri-config/src/debug.rs | 4 ++++ niri-config/src/lib.rs | 1 + src/backend/tty.rs | 26 ++++++++++++++--------- 4 files changed, 37 insertions(+), 10 deletions(-) diff --git a/docs/wiki/Configuration:-Debug-Options.md b/docs/wiki/Configuration:-Debug-Options.md index 7f460e06..9825359b 100644 --- a/docs/wiki/Configuration:-Debug-Options.md +++ b/docs/wiki/Configuration:-Debug-Options.md @@ -33,6 +33,7 @@ debug { honor-xdg-activation-with-invalid-serial skip-cursor-only-updates-during-vrr deactivate-unfocused-windows + disable-10bit-output } binds { @@ -324,6 +325,21 @@ debug { } ``` +### `disable-10bit-output` + +Since: next release + +By default, niri will try to output a 10-bit color format to the monitor (before falling back to 8-bit). +However, this can currently cause problems on some Intel + NVIDIA mixed-GPU setups: the screen doesn't light up, or displays only white, etc. + +Until this is fixed in Smithay, you can disable 10-bit color formats by setting this debug flag. + +```kdl +debug { + disable-10bit-output +} +``` + ### Key Bindings These are not debug options, but rather key bindings. diff --git a/niri-config/src/debug.rs b/niri-config/src/debug.rs index 7841ce0e..d95a18e3 100644 --- a/niri-config/src/debug.rs +++ b/niri-config/src/debug.rs @@ -24,6 +24,7 @@ pub struct Debug { pub honor_xdg_activation_with_invalid_serial: bool, pub deactivate_unfocused_windows: bool, pub skip_cursor_only_updates_during_vrr: bool, + pub disable_10bit_output: bool, } #[derive(knuffel::Decode, Debug, Default, PartialEq)] @@ -68,6 +69,8 @@ pub struct DebugPart { pub deactivate_unfocused_windows: Option, #[knuffel(child)] pub skip_cursor_only_updates_during_vrr: Option, + #[knuffel(child)] + pub disable_10bit_output: Option, } impl MergeWith for Debug { @@ -91,6 +94,7 @@ impl MergeWith for Debug { honor_xdg_activation_with_invalid_serial, deactivate_unfocused_windows, skip_cursor_only_updates_during_vrr, + disable_10bit_output, ); merge_clone_opt!((self, part), preview_render, render_drm_device); diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs index 77f07967..d983a7fc 100644 --- a/niri-config/src/lib.rs +++ b/niri-config/src/lib.rs @@ -2271,6 +2271,7 @@ mod tests { honor_xdg_activation_with_invalid_serial: false, deactivate_unfocused_windows: false, skip_cursor_only_updates_during_vrr: false, + disable_10bit_output: false, }, workspaces: [ Workspace { diff --git a/src/backend/tty.rs b/src/backend/tty.rs index bba60296..6dd83492 100644 --- a/src/backend/tty.rs +++ b/src/backend/tty.rs @@ -70,15 +70,13 @@ use crate::render_helpers::renderer::AsGlesRenderer; use crate::render_helpers::{resources, shaders, RenderCtx, RenderTarget}; use crate::utils::{get_monotonic_time, is_laptop_panel, logical_output, PanelOrientation}; -// specific 10-bit formats for multigpu setup, -// i.e. copying from rendering Nvidia dGPU to target iGPU. -// +// When copying from rendering Nvidia dGPU to target iGPU, +// it only understands X/Abgr and not X/Argb. +const SUPPORTED_COLOR_FORMATS_10BIT: [Fourcc; 3] = + [Fourcc::Abgr2101010, Fourcc::Argb8888, Fourcc::Abgr8888]; + // Smithay should fall back to Xrgb/Xbgr automatically if needed. -const SUPPORTED_COLOR_FORMATS: [Fourcc; 3] = [ - Fourcc::Abgr2101010, - Fourcc::Argb8888, - Fourcc::Abgr8888, -]; +const SUPPORTED_COLOR_FORMATS: [Fourcc; 2] = [Fourcc::Argb8888, Fourcc::Abgr8888]; pub struct Tty { config: Rc>, @@ -1439,6 +1437,14 @@ impl Tty { }) .collect::(); + let color_formats = if self.config.borrow().debug.disable_10bit_output { + &SUPPORTED_COLOR_FORMATS[..] + } else { + &SUPPORTED_COLOR_FORMATS_10BIT[..] + } + .iter() + .copied(); + // Create the compositor. let res = DrmCompositor::new( OutputModeSource::Auto(output.downgrade()), @@ -1446,7 +1452,7 @@ impl Tty { None, device.allocator.clone(), GbmFramebufferExporter::new(device.gbm.clone(), device.render_node.into()), - SUPPORTED_COLOR_FORMATS, + color_formats.clone(), // This is only used to pick a good internal format, so it can use the surface's render // formats, even though we only ever render on the primary GPU. render_formats.clone(), @@ -1476,7 +1482,7 @@ impl Tty { None, device.allocator.clone(), GbmFramebufferExporter::new(device.gbm.clone(), device.render_node.into()), - SUPPORTED_COLOR_FORMATS, + color_formats, render_formats, device.drm.cursor_size(), Some(device.gbm.clone()),