From ae3d7a697c3e8b137f6cf5f9208cc9dd132f541c Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 16 Oct 2023 13:10:11 +0200 Subject: [PATCH] backend/drm: use DRM_IOCTL_MODE_CLOSEFB instead of RMFB RMFB implicitly performs a modeset to turn off any CRTC which is using the FB. This prevents seamless transitions between two DRM masters from working. Use the new CLOSEFB IOCTL which doesn't turn off anything and leave it up to the compositor to turn off outputs on shutdown if it wants to. --- backend/drm/renderer.c | 8 ++++++-- meson.build | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c index dbaa55b7..29903f19 100644 --- a/backend/drm/renderer.c +++ b/backend/drm/renderer.c @@ -394,8 +394,12 @@ void drm_fb_destroy(struct wlr_drm_fb *fb) { wl_list_remove(&fb->link); wlr_addon_finish(&fb->addon); - if (drmModeRmFB(drm->fd, fb->id) != 0) { - wlr_log(WLR_ERROR, "drmModeRmFB failed"); + int ret = drmModeCloseFB(drm->fd, fb->id); + if (ret == -EINVAL) { + ret = drmModeRmFB(drm->fd, fb->id); + } + if (ret != 0) { + wlr_log(WLR_ERROR, "Failed to close FB: %s", strerror(-ret)); } free(fb); diff --git a/meson.build b/meson.build index c6bc434a..682d6962 100644 --- a/meson.build +++ b/meson.build @@ -109,7 +109,7 @@ wayland_server = dependency('wayland-server', ) drm = dependency('libdrm', - version: '>=2.4.114', + version: '>=2.4.118', fallback: 'libdrm', default_options: [ 'intel=disabled',