summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2021-12-28 16:48:17 +0200
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2022-01-19 15:23:26 +0000
commitbff2d61e8a5123ef56a49ac1011078d4607c069a (patch)
tree965e3a7f7cba82834741f1208b3886c1f6ab79fe
parentaf465dc98558a59d199311a9d542382418a7dd69 (diff)
meta-agl-core/recipes-graphics/wayland: Backport two fixes for libweston-8
This backports two small fixes for some potential libweston crashes happening on the DRM backend tear down, or EGL initailization failure paths. Bug-AGL: SPEC-4197 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Reported-by: Scott Murray <scott.murray@konsulko.com> Change-Id: Idc28bb7ef6d8fde8c149bb5eb35a2ba40a25706a Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/27018 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-gl-renderer-Avoid-double-free-on-init-failure.patch33
-rw-r--r--meta-agl-core/recipes-graphics/wayland/weston/0001-libweston-backend-drm-Re-order-gbm-destruction-at-DR.patch51
-rw-r--r--meta-agl-core/recipes-graphics/wayland/weston_8.0_aglcore.inc2
3 files changed, 86 insertions, 0 deletions
diff --git a/meta-agl-core/recipes-graphics/wayland/weston/0001-gl-renderer-Avoid-double-free-on-init-failure.patch b/meta-agl-core/recipes-graphics/wayland/weston/0001-gl-renderer-Avoid-double-free-on-init-failure.patch
new file mode 100644
index 000000000..582a33161
--- /dev/null
+++ b/meta-agl-core/recipes-graphics/wayland/weston/0001-gl-renderer-Avoid-double-free-on-init-failure.patch
@@ -0,0 +1,33 @@
+From d76947b6668e0fabe0a4551ac6c2c978f93768cd Mon Sep 17 00:00:00 2001
+From: Daniel Stone <daniels@collabora.com>
+Upstream-Status: Backport
+Date: Mon, 3 Feb 2020 20:01:21 +0000
+Subject: [PATCH] gl-renderer: Avoid double-free on init failure
+
+If gl-renderer fails its initialisation, we return to compositor
+teardown, which will try to free the renderer if ec->renderer was set.
+This is unfortunate when we've already torn it down whilst failing
+gl-renderer init, so just clear the renderer member so we don't try to
+tear down twice.
+
+Signed-off-by: Daniel Stone <daniels@collabora.com>
+Reported-by: Emil Velikov <emil.velikov@collabora.com>
+---
+ libweston/renderer-gl/gl-renderer.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c
+index a40db3607..79285c008 100644
+--- a/libweston/renderer-gl/gl-renderer.c
++++ b/libweston/renderer-gl/gl-renderer.c
+@@ -3596,6 +3596,7 @@ fail_terminate:
+ eglTerminate(gr->egl_display);
+ fail:
+ free(gr);
++ ec->renderer = NULL;
+ return -1;
+ }
+
+--
+2.33.0
+
diff --git a/meta-agl-core/recipes-graphics/wayland/weston/0001-libweston-backend-drm-Re-order-gbm-destruction-at-DR.patch b/meta-agl-core/recipes-graphics/wayland/weston/0001-libweston-backend-drm-Re-order-gbm-destruction-at-DR.patch
new file mode 100644
index 000000000..e8e324c32
--- /dev/null
+++ b/meta-agl-core/recipes-graphics/wayland/weston/0001-libweston-backend-drm-Re-order-gbm-destruction-at-DR.patch
@@ -0,0 +1,51 @@
+From d171c7b3ba346c4d0bd6494f45ebf0be3c3cc5fb Mon Sep 17 00:00:00 2001
+From: Marius Vlad <marius.vlad@collabora.com>
+Upstream-Status: Backport
+Date: Thu, 1 Apr 2021 00:12:00 +0300
+Subject: [PATCH] libweston/backend-drm: Re-order gbm destruction at
+ DRM-backend tear down
+
+Tearing down the drm-backend when there are no input devices, would call
+for the gbm device destruction before compositor shutdown. The latter
+would call into the renderer detroy function and assume that the
+EGLDisplay, which was created using the before-mentioned gbm device, is
+still available. This patch re-orders the gbm destruction after the
+compositor shutdown when no one would make use of it.
+
+Fixes: #314
+
+Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
+Suggested-by: Daniel Stone <daniel.stone@collabora.com>
+---
+ libweston/backend-drm/drm.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
+index c780c1c16..abfcabd3b 100644
+--- a/libweston/backend-drm/drm.c
++++ b/libweston/backend-drm/drm.c
+@@ -3203,10 +3203,6 @@ err_drm_source:
+ err_udev_input:
+ udev_input_destroy(&b->input);
+ err_sprite:
+-#ifdef BUILD_DRM_GBM
+- if (b->gbm)
+- gbm_device_destroy(b->gbm);
+-#endif
+ destroy_sprites(b);
+ err_create_crtc_list:
+ drmModeFreeResources(res);
+@@ -3218,6 +3214,10 @@ err_launcher:
+ weston_launcher_destroy(compositor->launcher);
+ err_compositor:
+ weston_compositor_shutdown(compositor);
++#ifdef BUILD_DRM_GBM
++ if (b->gbm)
++ gbm_device_destroy(b->gbm);
++#endif
+ free(b);
+ return NULL;
+ }
+--
+2.33.0
+
diff --git a/meta-agl-core/recipes-graphics/wayland/weston_8.0_aglcore.inc b/meta-agl-core/recipes-graphics/wayland/weston_8.0_aglcore.inc
index d5cd5381a..c81b35545 100644
--- a/meta-agl-core/recipes-graphics/wayland/weston_8.0_aglcore.inc
+++ b/meta-agl-core/recipes-graphics/wayland/weston_8.0_aglcore.inc
@@ -2,6 +2,8 @@ FILESEXTRAPATHS:append := ":${THISDIR}/weston"
SRC_URI:append = "\
file://0005-correctly-tear-down-drm-backend.patch \
+ file://0001-libweston-backend-drm-Re-order-gbm-destruction-at-DR.patch \
+ file://0001-gl-renderer-Avoid-double-free-on-init-failure.patch \
"
# Workaround for incorrect upstream definition