niri-config: add keep-max-bpc-unchanged option (#2195)

* niri-config: add disable-set-bpc option
setting bpc to 8 bricks some OLED displays driven by amdgpu

* change to keep-max-bpc-unchanged and add to wiki

* fmt

* Update wiki/Configuration:-Debug-Options.md

---------

Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com>
This commit is contained in:
BB
2025-08-07 14:06:11 -04:00
committed by GitHub
parent 055a94de3d
commit f74d83dcca
3 changed files with 28 additions and 4 deletions
+3
View File
@@ -2339,6 +2339,8 @@ pub struct DebugConfig {
#[knuffel(child)]
pub disable_direct_scanout: bool,
#[knuffel(child)]
pub keep_max_bpc_unchanged: bool,
#[knuffel(child)]
pub restrict_primary_scanout_to_matching_format: bool,
#[knuffel(child, unwrap(argument))]
pub render_drm_device: Option<PathBuf>,
@@ -5434,6 +5436,7 @@ mod tests {
enable_overlay_planes: false,
disable_cursor_plane: false,
disable_direct_scanout: false,
keep_max_bpc_unchanged: false,
restrict_primary_scanout_to_matching_format: false,
render_drm_device: Some(
"/dev/dri/renderD129",
+7 -4
View File
@@ -857,10 +857,13 @@ impl Tty {
}
debug!("picking mode: {mode:?}");
// We only use 8888 RGB formats, so set max bpc to 8 to allow more types of links to run.
match set_max_bpc(&device.drm, connector.handle(), 8) {
Ok(bpc) => debug!("set max bpc to {bpc}"),
Err(err) => debug!("error setting max bpc: {err:?}"),
if !niri.config.borrow().debug.keep_max_bpc_unchanged {
// We only use 8888 RGB formats, so set max bpc to 8 to allow more types of links to
// run.
match set_max_bpc(&device.drm, connector.handle(), 8) {
Ok(bpc) => debug!("set max bpc to {bpc}"),
Err(err) => debug!("error setting max bpc: {err:?}"),
}
}
let mut gamma_props = GammaProps::new(&device.drm, crtc)
+18
View File
@@ -30,6 +30,7 @@ debug {
honor-xdg-activation-with-invalid-serial
skip-cursor-only-updates-during-vrr
deactivate-unfocused-windows
keep-max-bpc-unchanged
}
binds {
@@ -292,6 +293,23 @@ debug {
}
```
### `keep-max-bpc-unchanged`
<sup>Since: next release</sup>
When connecting monitors, niri sets their max bpc to 8 in order to reduce display bandwidth and to potentially allow more monitors to be connected at once.
Restricting bpc to 8 is not a problem since we don't support HDR or color management yet and can't really make use of higher bpc.
Apparently, setting max bpc to 8 breaks some displays driven by AMDGPU.
If this happens to you, set this debug flag, which will prevent niri from changing max bpc.
AMDGPU bug report: https://gitlab.freedesktop.org/drm/amd/-/issues/4487.
```kdl
debug {
keep-max-bpc-unchanged
}
```
### Key Bindings
These are not debug options, but rather key bindings.