From 5db031bf3ea3e37983f3ab17f2b550e1949d95a9 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Fri, 15 Mar 2019 11:58:16 +0000 Subject: [PATCH] egl: return correct error for EGL_KHR_image_pixmap EGL_KHR_image_pixmap says: > If is EGL_NATIVE_PIXMAP_KHR, and is not EGL_NO_CONTEXT, > the error EGL_BAD_PARAMETER is generated. Reported-by: Rohan Garg Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/166 Fixes: a1c4a8a3c855d52fbfef "egl: Add support for EGL_KHR_image." Signed-off-by: Eric Engestrom Reviewed-by: Emma Anholt Part-of: --- src/egl/main/eglapi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 8830b40..be9e5c5 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -1865,6 +1865,13 @@ _eglCreateImageCommon(_EGLDisplay *disp, EGLContext ctx, EGLenum target, RETURN_EGL_EVAL(disp, EGL_NO_IMAGE_KHR); if (!context && ctx != EGL_NO_CONTEXT) RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_IMAGE_KHR); + + /* "If is EGL_NATIVE_PIXMAP_KHR, and is not EGL_NO_CONTEXT, + * the error EGL_BAD_PARAMETER is generated." + */ + if (target == EGL_NATIVE_PIXMAP_KHR && ctx != EGL_NO_CONTEXT) + RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR); + /* "If is EGL_LINUX_DMA_BUF_EXT, must be a valid display, * must be EGL_NO_CONTEXT..." */ -- 2.7.4