aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2023-05-19 17:19:33 +0300
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2023-05-30 12:29:33 +0000
commitd6919597f5c9a540d5b8a6fe79e5c269e0d1ff65 (patch)
treeaa40eb7825651715e0a4b83f7d6d57c120043036
parent32c215e00604e8489f8754e11a87231f175ae27a (diff)
recipes-graphics/wayland/weston_10.0_aglcore.inc: Backport libweston11 buffer release patch
This is a backport from libweston 11 to would perform a synchronous commit that disables the output. Further more this removes our global state hammer regarding the such that we don't disable a CRTC that has a pending flip. Bug-AGL: SPEC-4772 Change-Id: I2631c818fd3a3192e293436fc4898f4a3de8b85d Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/28906 Tested-by: Jenkins Job builder account ci-image-build: Jenkins Job builder account ci-image-boot-test: Jenkins Job builder account Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
-rw-r--r--meta-agl-core/recipes-graphics/wayland/weston/0001-backend-drm-make-sure-all-buffers-are-released-when-.patch68
-rw-r--r--meta-agl-core/recipes-graphics/wayland/weston_10.0_aglcore.inc3
2 files changed, 70 insertions, 1 deletions
diff --git a/meta-agl-core/recipes-graphics/wayland/weston/0001-backend-drm-make-sure-all-buffers-are-released-when-.patch b/meta-agl-core/recipes-graphics/wayland/weston/0001-backend-drm-make-sure-all-buffers-are-released-when-.patch
new file mode 100644
index 000000000..940088f5c
--- /dev/null
+++ b/meta-agl-core/recipes-graphics/wayland/weston/0001-backend-drm-make-sure-all-buffers-are-released-when-.patch
@@ -0,0 +1,68 @@
+From 6d9e9dfa0479abc0ed7921a4ebf42228c0da7533 Mon Sep 17 00:00:00 2001
+From: Michael Olbrich <m.olbrich@pengutronix.de>
+Date: Wed, 22 Jun 2022 08:58:21 +0200
+Subject: [PATCH] backend-drm: make sure all buffers are released when an
+ output is removed
+
+When an output is destroyed then the output state is freed immediately. In this
+case, the plane state is only partially destroyed because it is the currently
+active state. This includes the buffer reference.
+
+Without the output, the plane will not be updated any more until it is used by a
+different output (if possible) or the output returns and the plane is used
+again.
+As a result, the buffer reference is kept for a long time. This will cause some
+applications to stall because weston now keeps two buffers (the one here and
+another one for a different output where the application is now displayed).
+
+To avoid this, do a synchronous commit that disables the output. The output
+needs to be disabled anyways and this way the current state contains no
+buffers that would remain.
+
+`device->state_invalid = true` in drm_output_detach_crtc() is no longer
+needed, because drm_output_detach_crtc() is called only when initialization
+failed and the crtc was not yet used or in drm_output_deinit() when the
+crtc was already disabled with the new synchronous commit.
+
+Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
+(cherry picked from commit f5a4fb5abcb8aeb6b078b6235834cc4ab6176c26)
+---
+ libweston/backend-drm/drm.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
+index 42787702..8425b0e9 100644
+--- a/libweston/backend-drm/drm.c
++++ b/libweston/backend-drm/drm.c
+@@ -1769,14 +1769,11 @@ drm_output_attach_crtc(struct drm_output *output)
+ static void
+ drm_output_detach_crtc(struct drm_output *output)
+ {
+- struct drm_backend *b = output->backend;
+ struct drm_crtc *crtc = output->crtc;
+
+ crtc->output = NULL;
+ output->crtc = NULL;
+
+- /* Force resetting unused CRTCs */
+- b->state_invalid = true;
+ }
+
+ static int
+@@ -1839,6 +1836,13 @@ drm_output_deinit(struct weston_output *base)
+ {
+ struct drm_output *output = to_drm_output(base);
+ struct drm_backend *b = to_drm_backend(base->compositor);
++ struct drm_pending_state *pending;
++
++ if (!b->shutting_down) {
++ pending = drm_pending_state_alloc(b);
++ drm_output_get_disable_state(pending, output);
++ drm_pending_state_apply_sync(pending);
++ }
+
+ if (b->use_pixman)
+ drm_output_fini_pixman(output);
+--
+2.39.2
+
diff --git a/meta-agl-core/recipes-graphics/wayland/weston_10.0_aglcore.inc b/meta-agl-core/recipes-graphics/wayland/weston_10.0_aglcore.inc
index b0025f5d4..41ec612ee 100644
--- a/meta-agl-core/recipes-graphics/wayland/weston_10.0_aglcore.inc
+++ b/meta-agl-core/recipes-graphics/wayland/weston_10.0_aglcore.inc
@@ -8,4 +8,5 @@ PACKAGECONFIG:append = "${@bb.utils.contains('DISTRO_FEATURES', 'weston-remoting
SRC_URI:append = "file://0001-libweston-Send-name-description-update-wl_output-to-.patch \
file://0001-libweston-desktop-xdg-shell-Add-tiled-orientation-st.patch \
file://0001-simple-touch-Add-maximized-fullscreen-states.patch \
- file://0001-libweston-weston-log-Add-an-iterator-for-going-over-.patch"
+ file://0001-libweston-weston-log-Add-an-iterator-for-going-over-.patch \
+ file://0001-backend-drm-make-sure-all-buffers-are-released-when-.patch "