Module: Mesa
Branch: staging/23.1
Commit: 73aeb45443ef1657aa0687139d1754417248c9ae
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=73aeb45443ef1657aa0687139d1754417248c9ae

Author: Sylvain Munaut <[email protected]>
Date:   Thu Aug  3 22:18:36 2023 +0200

egl/dri2: Add a couple of missing mutex release in error path

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 <[email protected]>
Reviewed-by: Eric Engestrom <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24487>
(cherry picked from commit a0a5d0f02e0dba0df651c3d31ae2c4e5c8d183c0)

---

 .pick_status.json               | 2 +-
 src/egl/drivers/dri2/egl_dri2.c | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 8e751e404e7..c2a1cf9d279 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -8095,7 +8095,7 @@
         "description": "egl/dri2: Add a couple of missing mutex release in 
error path",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "f1efe037dfd82d95b025a3ddf58b669758b8d69a"
     },
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 0ebc46ee845..610022f75d9 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2963,7 +2963,8 @@ dri2_export_drm_image_mesa(_EGLDisplay *disp, _EGLImage 
*img,
 
    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,
@@ -3054,8 +3055,10 @@ dri2_export_dma_buf_image_mesa(_EGLDisplay *disp, 
_EGLImage *img,
    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

Reply via email to