weston: update patch to remove fuzz
[AGL/meta-agl.git] / meta-agl-core / recipes-graphics / wayland / weston / 0001-libweston-backend-drm-Re-order-gbm-destruction-at-DR.patch
1 From bd108ca84767a339c274ad0b56d74b46b3888c38 Mon Sep 17 00:00:00 2001
2 From: Marius Vlad <marius.vlad@collabora.com>
3 Date: Thu, 1 Apr 2021 00:12:00 +0300
4 Subject: [PATCH] libweston/backend-drm: Re-order gbm destruction at
5  DRM-backend tear down
6
7 Tearing down the drm-backend when there are no input devices, would call
8 for the gbm device destruction before compositor shutdown. The latter
9 would call into the renderer detroy function and assume that the
10 EGLDisplay, which was created using the before-mentioned gbm device, is
11 still available. This patch re-orders the gbm destruction after the
12 compositor shutdown when no one would make use of it.
13
14 Fixes: #314
15
16 Upstream-Status: Backport
17 Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
18 Suggested-by: Daniel Stone <daniel.stone@collabora.com>
19
20 ---
21  libweston/backend-drm/drm.c | 8 ++++----
22  1 file changed, 4 insertions(+), 4 deletions(-)
23
24 diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
25 index be2570b..3cb41bf 100644
26 --- a/libweston/backend-drm/drm.c
27 +++ b/libweston/backend-drm/drm.c
28 @@ -2992,10 +2992,6 @@ err_drm_source:
29  err_udev_input:
30         udev_input_destroy(&b->input);
31  err_sprite:
32 -#ifdef BUILD_DRM_GBM
33 -       if (b->gbm)
34 -               gbm_device_destroy(b->gbm);
35 -#endif
36         destroy_sprites(b);
37  err_udev_dev:
38         udev_device_unref(drm_device);
39 @@ -3005,6 +3001,10 @@ err_launcher:
40         weston_launcher_destroy(compositor->launcher);
41  err_compositor:
42         weston_compositor_shutdown(compositor);
43 +#ifdef BUILD_DRM_GBM
44 +       if (b->gbm)
45 +               gbm_device_destroy(b->gbm);
46 +#endif
47         free(b);
48         return NULL;
49  }