aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-graphics/wayland/weston/0001-libweston-backend-drm-Re-order-gbm-destruction-at-DR.patch
blob: db6400550a7615958a5aedc05c9987c08c9be403 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From 4be82f75a47bd456452ab713d7d57a75d844f42a Mon Sep 17 00:00:00 2001
From: Marius Vlad <marius.vlad@collabora.com>
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>

Upstream-Status: Backport [https://gitlab.freedesktop.org/wayland/weston/-/commit/d171c7b3ba346c4d0bd6494f45ebf0be3c3cc5fb]
---
 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 9d3b5dcc..67834d3e 100644
--- a/libweston/backend-drm/drm.c
+++ b/libweston/backend-drm/drm.c
@@ -3402,10 +3402,6 @@ err_drm_source:
 	wl_event_source_remove(b->drm_source);
 err_udev_input:
 	udev_input_destroy(&b->input);
-#ifdef BUILD_DRM_GBM
-	if (b->gbm)
-		gbm_device_destroy(b->gbm);
-#endif
 	destroy_sprites(b);
 err_udev_dev:
 	udev_device_unref(drm_device);
@@ -3415,6 +3411,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.17.1