Add force-disable-connectors-on-resume debug flag
Browse files at this commitd2fa1f54d474accfe676f07a275edc7a75105980Parent: 26413564 changed files +30 -1
- docs/wiki/Configuration:-Debug-Options.md +14 -0
- niri-config/src/debug.rs +4 -0
- niri-config/src/lib.rs +1 -0
- src/backend/tty.rs +11 -1
docs/wiki/Configuration:-Debug-Options.mdmodified+14 -0
| @@ -17,6 +17,7 @@ debug { | |||
| 17 | disable-cursor-plane | 17 | disable-cursor-plane |
| 18 | disable-direct-scanout | 18 | disable-direct-scanout |
| 19 | restrict-primary-scanout-to-matching-format | 19 | restrict-primary-scanout-to-matching-format |
| 20 | + force-disable-connectors-on-resume | ||
| 20 | render-drm-device "/dev/dri/renderD129" | 21 | render-drm-device "/dev/dri/renderD129" |
| 21 | ignore-drm-device "/dev/dri/renderD128" | 22 | ignore-drm-device "/dev/dri/renderD128" |
| 22 | ignore-drm-device "/dev/dri/renderD130" | 23 | ignore-drm-device "/dev/dri/renderD130" |
| @@ -104,6 +105,19 @@ debug { | |||
| 104 | } | 105 | } |
| 105 | ``` | 106 | ``` |
| 106 | 107 | ||
| 108 | +### `force-disable-connectors-on-resume` | ||
| 109 | + | ||
| 110 | +Force-disables all outputs upon resuming niri (TTY switch or waking up from suspend). | ||
| 111 | +This causes a modeset/screen blank on all outputs. | ||
| 112 | + | ||
| 113 | +If niri rendering is corrupted, or monitors don't light up after a TTY switch, you can try this flag. | ||
| 114 | + | ||
| 115 | +```kdl | ||
| 116 | +debug { | ||
| 117 | + force-disable-connectors-on-resume | ||
| 118 | +} | ||
| 119 | +``` | ||
| 120 | + | ||
| 107 | ### `render-drm-device` | 121 | ### `render-drm-device` |
| 108 | 122 | ||
| 109 | Override the DRM device that niri will use for all rendering. | 123 | Override the DRM device that niri will use for all rendering. |
niri-config/src/debug.rsmodified+4 -0
| @@ -12,6 +12,7 @@ pub struct Debug { | |||
| 12 | pub disable_direct_scanout: bool, | 12 | pub disable_direct_scanout: bool, |
| 13 | pub keep_max_bpc_unchanged: bool, | 13 | pub keep_max_bpc_unchanged: bool, |
| 14 | pub restrict_primary_scanout_to_matching_format: bool, | 14 | pub restrict_primary_scanout_to_matching_format: bool, |
| 15 | + pub force_disable_connectors_on_resume: bool, | ||
| 15 | pub render_drm_device: Option<PathBuf>, | 16 | pub render_drm_device: Option<PathBuf>, |
| 16 | pub ignored_drm_devices: Vec<PathBuf>, | 17 | pub ignored_drm_devices: Vec<PathBuf>, |
| 17 | pub force_pipewire_invalid_modifier: bool, | 18 | pub force_pipewire_invalid_modifier: bool, |
| @@ -44,6 +45,8 @@ pub struct DebugPart { | |||
| 44 | pub keep_max_bpc_unchanged: Option<Flag>, | 45 | pub keep_max_bpc_unchanged: Option<Flag>, |
| 45 | #[knuffel(child)] | 46 | #[knuffel(child)] |
| 46 | pub restrict_primary_scanout_to_matching_format: Option<Flag>, | 47 | pub restrict_primary_scanout_to_matching_format: Option<Flag>, |
| 48 | + #[knuffel(child)] | ||
| 49 | + pub force_disable_connectors_on_resume: Option<Flag>, | ||
| 47 | #[knuffel(child, unwrap(argument))] | 50 | #[knuffel(child, unwrap(argument))] |
| 48 | pub render_drm_device: Option<PathBuf>, | 51 | pub render_drm_device: Option<PathBuf>, |
| 49 | #[knuffel(children(name = "ignore-drm-device"), unwrap(argument))] | 52 | #[knuffel(children(name = "ignore-drm-device"), unwrap(argument))] |
| @@ -81,6 +84,7 @@ impl MergeWith<DebugPart> for Debug { | |||
| 81 | disable_direct_scanout, | 84 | disable_direct_scanout, |
| 82 | keep_max_bpc_unchanged, | 85 | keep_max_bpc_unchanged, |
| 83 | restrict_primary_scanout_to_matching_format, | 86 | restrict_primary_scanout_to_matching_format, |
| 87 | + force_disable_connectors_on_resume, | ||
| 84 | force_pipewire_invalid_modifier, | 88 | force_pipewire_invalid_modifier, |
| 85 | emulate_zero_presentation_time, | 89 | emulate_zero_presentation_time, |
| 86 | disable_resize_throttling, | 90 | disable_resize_throttling, |
niri-config/src/lib.rsmodified+1 -0
| @@ -2134,6 +2134,7 @@ mod tests { | |||
| 2134 | disable_direct_scanout: false, | 2134 | disable_direct_scanout: false, |
| 2135 | keep_max_bpc_unchanged: false, | 2135 | keep_max_bpc_unchanged: false, |
| 2136 | restrict_primary_scanout_to_matching_format: false, | 2136 | restrict_primary_scanout_to_matching_format: false, |
| 2137 | + force_disable_connectors_on_resume: false, | ||
| 2137 | render_drm_device: Some( | 2138 | render_drm_device: Some( |
| 2138 | "/dev/dri/renderD129", | 2139 | "/dev/dri/renderD129", |
| 2139 | ), | 2140 | ), |
src/backend/tty.rsmodified+11 -1
| @@ -646,7 +646,16 @@ impl Tty { | |||
| 646 | 646 | ||
| 647 | // It hasn't been removed, update its state as usual. | 647 | // It hasn't been removed, update its state as usual. |
| 648 | let device = self.devices.get_mut(&node).unwrap(); | 648 | let device = self.devices.get_mut(&node).unwrap(); |
| 649 | - if let Err(err) = device.drm.activate(false) { | 649 | + |
| 650 | + // Someone on an old device hit what seems to be a driver bug without this: | ||
| 651 | + // https://github.com/YaLTeR/niri/issues/3048 | ||
| 652 | + let force_disable = self | ||
| 653 | + .config | ||
| 654 | + .borrow() | ||
| 655 | + .debug | ||
| 656 | + .force_disable_connectors_on_resume; | ||
| 657 | + | ||
| 658 | + if let Err(err) = device.drm.activate(force_disable) { | ||
| 650 | warn!("error activating DRM device: {err:?}"); | 659 | warn!("error activating DRM device: {err:?}"); |
| 651 | } | 660 | } |
| 652 | if let Some(lease_state) = &mut device.drm_lease_state { | 661 | if let Some(lease_state) = &mut device.drm_lease_state { |
| @@ -1055,6 +1064,7 @@ impl Tty { | |||
| 1055 | if let Err(err) = surface.compositor.reset_state() { | 1064 | if let Err(err) = surface.compositor.reset_state() { |
| 1056 | warn!("error resetting DrmCompositor state: {err:?}"); | 1065 | warn!("error resetting DrmCompositor state: {err:?}"); |
| 1057 | } | 1066 | } |
| 1067 | + surface.compositor.reset_buffers(); | ||
| 1058 | } | 1068 | } |
| 1059 | } | 1069 | } |
| 1060 | 1070 | ||