Add force-disable-connectors-on-resume debug flag

This commit is contained in:
Ivan Molodetskikh
2025-12-18 07:37:49 +03:00
parent 2641356d41
commit d2fa1f54d4
4 changed files with 30 additions and 1 deletions
+14
View File
@@ -17,6 +17,7 @@ debug {
disable-cursor-plane
disable-direct-scanout
restrict-primary-scanout-to-matching-format
force-disable-connectors-on-resume
render-drm-device "/dev/dri/renderD129"
ignore-drm-device "/dev/dri/renderD128"
ignore-drm-device "/dev/dri/renderD130"
@@ -104,6 +105,19 @@ debug {
}
```
### `force-disable-connectors-on-resume`
Force-disables all outputs upon resuming niri (TTY switch or waking up from suspend).
This causes a modeset/screen blank on all outputs.
If niri rendering is corrupted, or monitors don't light up after a TTY switch, you can try this flag.
```kdl
debug {
force-disable-connectors-on-resume
}
```
### `render-drm-device`
Override the DRM device that niri will use for all rendering.
+4
View File
@@ -12,6 +12,7 @@ pub struct Debug {
pub disable_direct_scanout: bool,
pub keep_max_bpc_unchanged: bool,
pub restrict_primary_scanout_to_matching_format: bool,
pub force_disable_connectors_on_resume: bool,
pub render_drm_device: Option<PathBuf>,
pub ignored_drm_devices: Vec<PathBuf>,
pub force_pipewire_invalid_modifier: bool,
@@ -44,6 +45,8 @@ pub struct DebugPart {
pub keep_max_bpc_unchanged: Option<Flag>,
#[knuffel(child)]
pub restrict_primary_scanout_to_matching_format: Option<Flag>,
#[knuffel(child)]
pub force_disable_connectors_on_resume: Option<Flag>,
#[knuffel(child, unwrap(argument))]
pub render_drm_device: Option<PathBuf>,
#[knuffel(children(name = "ignore-drm-device"), unwrap(argument))]
@@ -81,6 +84,7 @@ impl MergeWith<DebugPart> for Debug {
disable_direct_scanout,
keep_max_bpc_unchanged,
restrict_primary_scanout_to_matching_format,
force_disable_connectors_on_resume,
force_pipewire_invalid_modifier,
emulate_zero_presentation_time,
disable_resize_throttling,
+1
View File
@@ -2134,6 +2134,7 @@ mod tests {
disable_direct_scanout: false,
keep_max_bpc_unchanged: false,
restrict_primary_scanout_to_matching_format: false,
force_disable_connectors_on_resume: false,
render_drm_device: Some(
"/dev/dri/renderD129",
),
+11 -1
View File
@@ -646,7 +646,16 @@ impl Tty {
// It hasn't been removed, update its state as usual.
let device = self.devices.get_mut(&node).unwrap();
if let Err(err) = device.drm.activate(false) {
// Someone on an old device hit what seems to be a driver bug without this:
// https://github.com/YaLTeR/niri/issues/3048
let force_disable = self
.config
.borrow()
.debug
.force_disable_connectors_on_resume;
if let Err(err) = device.drm.activate(force_disable) {
warn!("error activating DRM device: {err:?}");
}
if let Some(lease_state) = &mut device.drm_lease_state {
@@ -1055,6 +1064,7 @@ impl Tty {
if let Err(err) = surface.compositor.reset_state() {
warn!("error resetting DrmCompositor state: {err:?}");
}
surface.compositor.reset_buffers();
}
}