egl/wayland: do not try to bind to wl_drm if not advertised
authorLeandro Ribeiro <leandro.ribeiro@collabora.com>
Tue, 30 Nov 2021 15:00:51 +0000 (12:00 -0300)
committerMarge Bot <emma+marge@anholt.net>
Thu, 2 Dec 2021 14:18:55 +0000 (14:18 +0000)
This fixes a bug that was introduced in 89d15b9a "egl/wayland: add
initial dma-buf feedback support".

Sometimes we have to fallback to wl_drm. But do not try to bind to it
when it is not advertised by the compositor.

This issue was found by n3rdopolis and reported here:
https://gitlab.freedesktop.org/mesa/mesa/-/issues/5697

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13985>

src/egl/drivers/dri2/platform_wayland.c

index 87751ad..f714e21 100644 (file)
@@ -2087,6 +2087,9 @@ dri2_initialize_wayland_drm(_EGLDisplay *disp)
    /* We couldn't retrieve a render node from the dma-buf feedback (or the
     * feedback was not advertised at all), so we must fallback to wl_drm. */
    if (dri2_dpy->fd == -1) {
+      /* wl_drm not advertised by compositor, so can't continue */
+      if (dri2_dpy->wl_drm_name == 0)
+         goto cleanup;
       wl_drm_bind(dri2_dpy);
 
       if (dri2_dpy->wl_drm == NULL)