From 81e95924ea1411edc5cc82b284e28c56bd236c4a Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Wed, 28 Jun 2017 20:31:18 +0100 Subject: egl: call _eglError within _eglParseImageAttribList As per EGL_KHR_image_base: If an attribute specified in is not one of the attributes listed in Table bbb, the error EGL_BAD_PARAMETER is generated. We should set the error as opposed to simply log it. Currently we have a partial solution, whereby only some of the callers call _eglError(). Since that has proven to be less robust, simply set the error by the function itself and change the return type to EGLBoolean, updating the callers. So now the code is slightly simpler. Plus the follow-up fixes will be easier to manage. Signed-off-by: Emil Velikov Reviewed-by: Eric Engestrom --- src/egl/main/eglimage.c | 21 +++++++++++---------- src/egl/main/eglimage.h | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'src/egl/main') diff --git a/src/egl/main/eglimage.c b/src/egl/main/eglimage.c index 7587a4be4a3..619e1a1e5db 100644 --- a/src/egl/main/eglimage.c +++ b/src/egl/main/eglimage.c @@ -30,14 +30,18 @@ #include #include +#include "eglcurrent.h" #include "eglimage.h" #include "egllog.h" /** - * Parse the list of image attributes and return the proper error code. + * Parse the list of image attributes. + * + * Returns EGL_TRUE on success and EGL_FALSE otherwise. + * Function calls _eglError to set the correct error code. */ -EGLint +EGLBoolean _eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *dpy, const EGLint *attrib_list) { @@ -48,7 +52,7 @@ _eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *dpy, memset(attrs, 0, sizeof(*attrs)); if (!attrib_list) - return err; + return EGL_TRUE; for (i = 0; attrib_list[i] != EGL_NONE; i++) { EGLint attr = attrib_list[i++]; @@ -233,15 +237,12 @@ _eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *dpy, break; default: - /* unknown attrs are ignored */ - break; + return _eglError(EGL_BAD_ATTRIBUTE, __func__); } - if (err != EGL_SUCCESS) { - _eglLog(_EGL_DEBUG, "bad image attribute 0x%04x", attr); - break; - } + if (err != EGL_SUCCESS) + return _eglError(err, __func__); } - return err; + return EGL_TRUE; } diff --git a/src/egl/main/eglimage.h b/src/egl/main/eglimage.h index eef98604e7a..87517921320 100644 --- a/src/egl/main/eglimage.h +++ b/src/egl/main/eglimage.h @@ -91,7 +91,7 @@ struct _egl_image }; -extern EGLint +EGLBoolean _eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *dpy, const EGLint *attrib_list); -- cgit v1.2.3