[Mesa-dev] [PATCH] egl: propagate EGL_BAD_ATTRIBUTE during EGLImage attr parsing

Michel Dänzer michel at daenzer.net
Fri Jul 14 09:16:43 UTC 2017


On 14/07/17 04:04 AM, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov at collabora.com>
> 
> Earlier commit refactored/split the parsing into separate hunks.
> While no functional change was intended, it did not attribute that
> different error is set when the attrib. value is incorrect.
> 
> Fixes:  3ee2be4113d ("egl: split _eglParseImageAttribList into per
> extension functions")
> Cc: Michel Dänzer <michel at daenzer.net>
> Reported-by: Michel Dänzer <michel at daenzer.net>
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
> There's at least one other way (tad longer and more extensive) way to
> address this. Considering no other extensions bother with separate
> error, that may be an overkill... for now.
> ---
>  src/egl/main/eglimage.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/egl/main/eglimage.c b/src/egl/main/eglimage.c
> index a96075fe558..72a556e8dbd 100644
> --- a/src/egl/main/eglimage.c
> +++ b/src/egl/main/eglimage.c
> @@ -302,6 +302,13 @@ _eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *dpy,
>        if (err == EGL_SUCCESS)
>            continue;
>  
> +      /* EXT_image_dma_buf_import states that if invalid value is provided for
> +       * its attributes, we should return EGL_BAD_ATTRIBUTE.
> +       * Bail out ASAP, since follow-up calls can return another EGL_BAD error.
> +       */
> +      if (err == EGL_BAD_ATTRIBUTE)
> +          return _eglError(err, __func__);
> +
>        err = _eglParseEXTImageDmaBufImportModifiersAttribs(attrs, dpy, attr, val);
>        if (err == EGL_SUCCESS)
>            continue;
> 

Tested-by: Michel Dänzer <michel.daenzer at amd.com>

Thanks!


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the mesa-dev mailing list