kms: Try to re-open the device on permission errors after resume

This commit is contained in:
Victoria Brekenfeld 2026-05-07 19:34:22 +02:00 committed by Victoria Brekenfeld
parent 23b198f30b
commit 61e677e39f
3 changed files with 453 additions and 158 deletions

View file

@ -394,15 +394,37 @@ impl State {
continue;
}
};
let dh = state.common.display_handle.clone();
if state.backend.kms().drm_devices.contains_key(&drm_node) {
match state.device_changed(dev) {
Ok(outputs) => added.extend(outputs),
Err(err) => {
error!(?err, "Failed to update drm device {}.", path.display(),)
error!(
?err,
"Failed to update drm device {}. Re-opening",
path.display(),
);
match state.reopen_device(dev, path, &dh) {
Ok(outputs) => added.extend(outputs),
Err(err) => {
error!(
?err,
"Failed to re-open drm device {}. Device lost",
path.display(),
);
if let Err(err) = state.device_removed(dev, &dh) {
error!(
?err,
"Failed to close drm device {}.",
path.display(),
);
};
}
}
}
}
} else {
let dh = state.common.display_handle.clone();
match state.device_added(dev, path, &dh) {
Ok(outputs) => added.extend(outputs),
Err(err) => error!(?err, "Failed to add drm device {}.", path.display(),),