fix(kms): skip empty DRM cleanup commit in display_configuration
display_configuration() issued an ALLOW_MODESET atomic commit on every udev event, even when no planes needed detaching. The empty commit is a no-op modeset that interferes with in-flight commits on the render thread, and it fails with EPERM whenever we don't hold DRM master (e.g. a render-only secondary GPU), aborting device enumeration. Track whether any property was added and skip the commit when there is nothing to do. A commit that does have changes still propagates its error as before, so a genuine failure to apply cleanup is not silently swallowed. https://github.com/pop-os/cosmic-comp/issues/2375 Authored by Claude Opus 4.8 Reviewed by Timo Strunk <Timo.Strunk@gmail.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
53a8d0bea2
commit
24d29008f0
1 changed files with 7 additions and 1 deletions
|
|
@ -75,6 +75,7 @@ pub fn display_configuration(
|
||||||
// And then cleanup
|
// And then cleanup
|
||||||
if device.is_atomic() {
|
if device.is_atomic() {
|
||||||
let mut req = AtomicModeReq::new();
|
let mut req = AtomicModeReq::new();
|
||||||
|
let mut has_changes = false;
|
||||||
let plane_handles = device.plane_handles()?;
|
let plane_handles = device.plane_handles()?;
|
||||||
|
|
||||||
// We cannot just shortcut and use the legacy api for all cleanups because of this.
|
// We cannot just shortcut and use the legacy api for all cleanups because of this.
|
||||||
|
|
@ -95,10 +96,15 @@ pub fn display_configuration(
|
||||||
let fb_id = get_prop(device, plane, "FB_ID")?;
|
let fb_id = get_prop(device, plane, "FB_ID")?;
|
||||||
req.add_property(plane, crtc_id, property::Value::CRTC(None));
|
req.add_property(plane, crtc_id, property::Value::CRTC(None));
|
||||||
req.add_property(plane, fb_id, property::Value::Framebuffer(None));
|
req.add_property(plane, fb_id, property::Value::Framebuffer(None));
|
||||||
|
has_changes = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
device.atomic_commit(AtomicCommitFlags::ALLOW_MODESET, req)?;
|
// Skip an empty commit: a no-op modeset that also fails with EPERM
|
||||||
|
// without DRM master (e.g. a render-only secondary GPU).
|
||||||
|
if has_changes {
|
||||||
|
device.atomic_commit(AtomicCommitFlags::ALLOW_MODESET, req)?;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
for crtc in res_handles.crtcs() {
|
for crtc in res_handles.crtcs() {
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue