From 75f0571eb3d5a67db3d447c97b065c87b4674b01 Mon Sep 17 00:00:00 2001 From: "Leon M. Busch-George" Date: Mon, 8 Jun 2026 14:16:51 +0200 Subject: [PATCH] drm_lease_v1: avoid waking GPU when creating lease device This is a slight downgrade to the check since it's technically possible for the FD returned by open to be a DRM master and policy preventing the downgrade. With this patch, it's only noticed afterwards. In typical modern environments, all FDs should be non-master right away. Signed-off-by: Leon M. Busch-George --- types/wlr_drm_lease_v1.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/types/wlr_drm_lease_v1.c b/types/wlr_drm_lease_v1.c index 14846f21d..109ef9c5d 100644 --- a/types/wlr_drm_lease_v1.c +++ b/types/wlr_drm_lease_v1.c @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -586,15 +587,15 @@ static void drm_lease_device_v1_create(struct wlr_drm_lease_v1_manager *manager, struct wlr_backend *backend) { struct wlr_drm_backend *drm_backend = get_drm_backend_from_backend(backend); - // Make sure we can get a non-master FD for the DRM backend. On some setups - // we don't have the permission for this. - int fd = wlr_drm_backend_get_non_master_fd(backend); - if (fd < 0) { - wlr_log(WLR_INFO, "Skipping %s: failed to get read-only DRM FD", + // Make sure we can access the device without opening it to avoid + // potentially waking the GPU from suspend. + // A non-master FD is required later which is what open should already + // yield on modern systems. + if (faccessat(AT_FDCWD, drm_backend->name, R_OK|W_OK, 0) < 0) { + wlr_log(WLR_INFO, "Skipping %s: cannot access DRM device", drm_backend->name); return; } - close(fd); wlr_log(WLR_DEBUG, "Creating wlr_drm_lease_device_v1 for %s", drm_backend->name);