egl: fix error string for dri2_create_image_dma_buf()
authorSimon Ser <contact@emersion.fr>
Wed, 19 Oct 2022 08:27:01 +0000 (10:27 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 21 Oct 2022 14:57:25 +0000 (14:57 +0000)
Using dri2_create_image_khr_texture_error() here prints an error
like so:

    command: eglCreateImageKHR, error: EGL_BAD_ALLOC (0x3003), message: "dri2_create_image_khr_texture"

This is confusing, because dri2_create_image_khr_texture() is
unrelated to this error.

Instead, print a more accurate error manually.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19156>

src/egl/drivers/dri2/egl_dri2.c

index afe9a9c..023c56c 100644 (file)
@@ -2946,6 +2946,7 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext *ctx,
    uint64_t modifier;
    bool has_modifier = false;
    unsigned error;
+   EGLint egl_error;
 
    /**
     * The spec says:
@@ -3033,7 +3034,10 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext *ctx,
             &error,
             NULL);
    }
-   dri2_create_image_khr_texture_error(error);
+
+   egl_error = egl_error_from_dri_image_error(error);
+   if (egl_error != EGL_SUCCESS)
+      _eglError(egl_error, "createImageFromDmaBufs failed");
 
    if (!dri_image)
       return EGL_NO_IMAGE_KHR;