diff --git a/wlroots-0.14.0-backend-drm-dont-clear-pending-cursor-FB-on-failed-commit.patch b/wlroots-0.14.0-backend-drm-dont-clear-pending-cursor-FB-on-failed-commit.patch new file mode 100644 index 0000000..be8380d --- /dev/null +++ b/wlroots-0.14.0-backend-drm-dont-clear-pending-cursor-FB-on-failed-commit.patch @@ -0,0 +1,65 @@ +From 28f738ed10bf67bdaf340f9438d7fac25a5d7f8f Mon Sep 17 00:00:00 2001 +From: Simon Ser +Date: Mon, 5 Jul 2021 10:57:33 +0200 +Subject: [PATCH 1/2] Revert "backend/drm: populate cursor plane's current_fb" + +This reverts commit 6c3d080e25e56404228ad7704eed43e40fa0c623. + +Populating wlr_drm_plane.current_fb messes up the buffer's locking. +The previous buffer is released while it's still being displayed +on-screen. +--- + backend/drm/drm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/backend/drm/drm.c b/backend/drm/drm.c +index 6cfdb64889..7700bd2d59 100644 +--- a/backend/drm/drm.c ++++ b/backend/drm/drm.c +@@ -933,7 +933,7 @@ static bool drm_connector_set_cursor(struct wlr_output *output, + local_buf = wlr_buffer_lock(buffer); + } + +- bool ok = drm_fb_import(&plane->current_fb, drm, local_buf, ++ bool ok = drm_fb_import(&plane->pending_fb, drm, local_buf, + &plane->formats); + wlr_buffer_unlock(local_buf); + if (!ok) { + +From fd21b0d4328fb4f4cc0aafe1ec8b2f3d6125011f Mon Sep 17 00:00:00 2001 +From: Simon Ser +Date: Mon, 5 Jul 2021 11:04:02 +0200 +Subject: [PATCH 2/2] backend/drm: don't clear pending cursor FB on failed + commit + +The previous fix tried to side-step cursor->pending_fb completely. +However that messes up our buffer locking mechanism. + +Instead, stop clearing the pending cursor FB on a failed commit. The +pending cursor FB will remain for the next commit. + +Fixes: 6c3d080e25e5 ("backend/drm: populate cursor plane's current_fb") +--- + backend/drm/drm.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/backend/drm/drm.c b/backend/drm/drm.c +index 7700bd2d59..b6b4baf6a2 100644 +--- a/backend/drm/drm.c ++++ b/backend/drm/drm.c +@@ -355,9 +355,12 @@ static bool drm_crtc_commit(struct wlr_drm_connector *conn, + } + } else { + drm_fb_clear(&crtc->primary->pending_fb); +- if (crtc->cursor != NULL) { +- drm_fb_clear(&crtc->cursor->pending_fb); +- } ++ // The set_cursor() hook is a bit special: it's not really synchronized ++ // to commit() or test(). Once set_cursor() returns true, the new ++ // cursor is effectively committed. So don't roll it back here, or we ++ // risk ending up in a state where we don't have a cursor FB but ++ // wlr_drm_connector.cursor_enabled is true. ++ // TODO: fix our output interface to avoid this issue. + } + return ok; + } diff --git a/wlroots.spec b/wlroots.spec index 27f061a..78abd8c 100644 --- a/wlroots.spec +++ b/wlroots.spec @@ -3,7 +3,7 @@ Name: wlroots Version: 0.14.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A modular Wayland compositor library # Source files/overall project licensed as MIT, but @@ -27,6 +27,8 @@ Source2: https://emersion.fr/.well-known/openpgpkey/hu/dj3498u4hyyarh35rk Source3: examples.meson.build # Disappearing cursor on scaled outputs, swaywm/sway#6352 Patch0: %{url}/commit/1c4b5bc.patch#/wlroots-0.14.0-surface-accept-commits-with-buffer-size-not-divisibl.patch +# Fixes multiple issues with cursors and multi-GPU setups +Patch1: %{url}/pull/3021.patch#/wlroots-0.14.0-backend-drm-dont-clear-pending-cursor-FB-on-failed-commit.patch BuildRequires: gcc BuildRequires: gnupg2 @@ -123,6 +125,9 @@ install -pm0644 -D '%{SOURCE3}' '%{buildroot}/%{_pkgdocdir}/examples/meson.build %changelog +* Wed Jul 07 2021 Aleksei Bavshin - 0.14.0-2 +- Add patch for a few more issues with cursors, multi-GPUs and nouveau + * Wed Jun 23 2021 Aleksei Bavshin - 0.14.0-1 - Update to 0.14.0 - Add upstream patch for cursor issues on scaled outputs