niri-config: add keep-max-bpc-unchanged option (#2195)
Browse files at this commit3 changed files +28 -4
- niri-config/src/lib.rs +3 -0
- src/backend/tty.rs +7 -4
- wiki/Configuration:-Debug-Options.md +18 -0
niri-config/src/lib.rsmodified+3 -0
| @@ -2339,6 +2339,8 @@ pub struct DebugConfig { | |||
| 2339 | #[knuffel(child)] | 2339 | #[knuffel(child)] |
| 2340 | pub disable_direct_scanout: bool, | 2340 | pub disable_direct_scanout: bool, |
| 2341 | #[knuffel(child)] | 2341 | #[knuffel(child)] |
| 2342 | + pub keep_max_bpc_unchanged: bool, | ||
| 2343 | + #[knuffel(child)] | ||
| 2342 | pub restrict_primary_scanout_to_matching_format: bool, | 2344 | pub restrict_primary_scanout_to_matching_format: bool, |
| 2343 | #[knuffel(child, unwrap(argument))] | 2345 | #[knuffel(child, unwrap(argument))] |
| 2344 | pub render_drm_device: Option<PathBuf>, | 2346 | pub render_drm_device: Option<PathBuf>, |
| @@ -5434,6 +5436,7 @@ mod tests { | |||
| 5434 | enable_overlay_planes: false, | 5436 | enable_overlay_planes: false, |
| 5435 | disable_cursor_plane: false, | 5437 | disable_cursor_plane: false, |
| 5436 | disable_direct_scanout: false, | 5438 | disable_direct_scanout: false, |
| 5439 | + keep_max_bpc_unchanged: false, | ||
| 5437 | restrict_primary_scanout_to_matching_format: false, | 5440 | restrict_primary_scanout_to_matching_format: false, |
| 5438 | render_drm_device: Some( | 5441 | render_drm_device: Some( |
| 5439 | "/dev/dri/renderD129", | 5442 | "/dev/dri/renderD129", |
src/backend/tty.rsmodified+7 -4
| @@ -857,10 +857,13 @@ impl Tty { | |||
| 857 | } | 857 | } |
| 858 | debug!("picking mode: {mode:?}"); | 858 | debug!("picking mode: {mode:?}"); |
| 859 | 859 | ||
| 860 | - // We only use 8888 RGB formats, so set max bpc to 8 to allow more types of links to run. | 860 | + if !niri.config.borrow().debug.keep_max_bpc_unchanged { |
| 861 | - match set_max_bpc(&device.drm, connector.handle(), 8) { | 861 | + // We only use 8888 RGB formats, so set max bpc to 8 to allow more types of links to |
| 862 | - Ok(bpc) => debug!("set max bpc to {bpc}"), | 862 | + // run. |
| 863 | - Err(err) => debug!("error setting max bpc: {err:?}"), | 863 | + match set_max_bpc(&device.drm, connector.handle(), 8) { |
| 864 | + Ok(bpc) => debug!("set max bpc to {bpc}"), | ||
| 865 | + Err(err) => debug!("error setting max bpc: {err:?}"), | ||
| 866 | + } | ||
| 864 | } | 867 | } |
| 865 | 868 | ||
| 866 | let mut gamma_props = GammaProps::new(&device.drm, crtc) | 869 | let mut gamma_props = GammaProps::new(&device.drm, crtc) |
wiki/Configuration:-Debug-Options.mdmodified+18 -0
| @@ -30,6 +30,7 @@ debug { | |||
| 30 | honor-xdg-activation-with-invalid-serial | 30 | honor-xdg-activation-with-invalid-serial |
| 31 | skip-cursor-only-updates-during-vrr | 31 | skip-cursor-only-updates-during-vrr |
| 32 | deactivate-unfocused-windows | 32 | deactivate-unfocused-windows |
| 33 | + keep-max-bpc-unchanged | ||
| 33 | } | 34 | } |
| 34 | 35 | ||
| 35 | binds { | 36 | binds { |
| @@ -292,6 +293,23 @@ debug { | |||
| 292 | } | 293 | } |
| 293 | ``` | 294 | ``` |
| 294 | 295 | ||
| 296 | +### `keep-max-bpc-unchanged` | ||
| 297 | + | ||
| 298 | +<sup>Since: next release</sup> | ||
| 299 | + | ||
| 300 | +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. | ||
| 301 | +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. | ||
| 302 | + | ||
| 303 | +Apparently, setting max bpc to 8 breaks some displays driven by AMDGPU. | ||
| 304 | +If this happens to you, set this debug flag, which will prevent niri from changing max bpc. | ||
| 305 | +AMDGPU bug report: https://gitlab.freedesktop.org/drm/amd/-/issues/4487. | ||
| 306 | + | ||
| 307 | +```kdl | ||
| 308 | +debug { | ||
| 309 | + keep-max-bpc-unchanged | ||
| 310 | +} | ||
| 311 | +``` | ||
| 312 | + | ||
| 295 | ### Key Bindings | 313 | ### Key Bindings |
| 296 | 314 | ||
| 297 | These are not debug options, but rather key bindings. | 315 | These are not debug options, but rather key bindings. |