egl/dri2: Add a couple of missing mutex release in error path
authorSylvain Munaut <tnt@246tNt.com>
Thu, 3 Aug 2023 20:18:36 +0000 (22:18 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 4 Aug 2023 18:34:56 +0000 (18:34 +0000)
This is causing a hang in the intel compute runtime when
trying to cl/gl share an unsupported texture format.

Fixes: f1efe037dfd82d95b025 ("egl/dri2: Add display lock")

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24487>

src/egl/drivers/dri2/egl_dri2.c

index 456cdb1..6b3c6c9 100644 (file)
@@ -2951,7 +2951,8 @@ dri2_export_drm_image_mesa(_EGLDisplay *disp, _EGLImage *img, EGLint *name,
 
    if (name && !dri2_dpy->image->queryImage(dri2_img->dri_image,
                                             __DRI_IMAGE_ATTRIB_NAME, name))
-      return _eglError(EGL_BAD_ALLOC, "dri2_export_drm_image_mesa");
+      return dri2_egl_error_unlock(dri2_dpy, EGL_BAD_ALLOC,
+                                   "dri2_export_drm_image_mesa");
 
    if (handle)
       dri2_dpy->image->queryImage(dri2_img->dri_image,
@@ -3040,8 +3041,10 @@ dri2_export_dma_buf_image_mesa(_EGLDisplay *disp, _EGLImage *img, int *fds,
    struct dri2_egl_image *dri2_img = dri2_egl_image(img);
    EGLint nplanes;
 
-   if (!dri2_can_export_dma_buf_image(disp, img))
+   if (!dri2_can_export_dma_buf_image(disp, img)) {
+      mtx_unlock(&dri2_dpy->lock);
       return EGL_FALSE;
+   }
 
    /* EGL_MESA_image_dma_buf_export spec says:
     *    "If the number of fds is less than the number of planes, then