egl: propagate EGL_BAD_ATTRIBUTE during EGLImage attr parsing
[mesa.git] / src / egl / main / eglimage.c
index a96075fe558daaede54325b32f435e5b9bfc60a2..72a556e8dbdfec44906656d7052a1861571d0f1d 100644 (file)
@@ -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;