From 24d29008f0ce00074612b49987e47468db3ef231 Mon Sep 17 00:00:00 2001 From: Timo Strunk Date: Wed, 22 Jul 2026 22:31:41 +0200 Subject: [PATCH] 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 Co-Authored-By: Claude Opus 4.8 --- src/backend/kms/drm_helpers.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/backend/kms/drm_helpers.rs b/src/backend/kms/drm_helpers.rs index 8629c9d7..46659613 100644 --- a/src/backend/kms/drm_helpers.rs +++ b/src/backend/kms/drm_helpers.rs @@ -75,6 +75,7 @@ pub fn display_configuration( // And then cleanup if device.is_atomic() { let mut req = AtomicModeReq::new(); + let mut has_changes = false; let plane_handles = device.plane_handles()?; // 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")?; req.add_property(plane, crtc_id, property::Value::CRTC(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 { for crtc in res_handles.crtcs() { #[allow(deprecated)]