Mesa (master): egl: Additional attribute validation for eglCreatePbufferSurface

Ben Widawsky bwidawsk at kemper.freedesktop.org
Thu May 26 15:03:07 UTC 2016


Module: Mesa
Branch: master
Commit: a0674ce5c41903ccd161e89abb149621bfbc40d2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a0674ce5c41903ccd161e89abb149621bfbc40d2

Author: Plamena Manolova <plamena.manolova at intel.com>
Date:   Wed May 25 17:29:55 2016 +0100

egl: Additional attribute validation for eglCreatePbufferSurface

eglCreatePbufferSurface should generate an EGL_BAD_MATCH error if:
1: The EGL_TEXTURE_FORMAT attribute is EGL_NO_TEXTURE and EGL_TEXTURE_TARGET
is something other than EGL_NO_TEXTURE
2: EGL_TEXTURE_FORMAT is something other than EGL_NO_TEXTURE and
EGL_TEXTURE_TARGET is EGL_NO_TEXTURE.

This fixes the dEQP-EGL.functional.negative_api.create_pbuffer_surface test.

Signed-off-by: Plamena Manolova <plamena.manolova at intel.com>
Reviewed-by: Ben Widawsky <ben at bwidawsk.net>

---

 src/egl/main/eglsurface.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c
index 2971bb0..17d7907 100644
--- a/src/egl/main/eglsurface.c
+++ b/src/egl/main/eglsurface.c
@@ -71,6 +71,8 @@ _eglParseSurfaceAttribList(_EGLSurface *surf, const EGLint *attrib_list)
    EGLint type = surf->Type;
    EGLint texture_type = EGL_PBUFFER_BIT;
    EGLint i, err = EGL_SUCCESS;
+   EGLint tex_target = -1;
+   EGLint tex_format = -1;
 
    if (!attrib_list)
       return EGL_SUCCESS;
@@ -186,6 +188,8 @@ _eglParseSurfaceAttribList(_EGLSurface *surf, const EGLint *attrib_list)
             err = EGL_BAD_ATTRIBUTE;
             break;
          }
+
+         tex_format = val;
          switch (val) {
          case EGL_TEXTURE_RGB:
          case EGL_TEXTURE_RGBA:
@@ -204,6 +208,8 @@ _eglParseSurfaceAttribList(_EGLSurface *surf, const EGLint *attrib_list)
             err = EGL_BAD_ATTRIBUTE;
             break;
          }
+
+         tex_target = val;
          switch (val) {
          case EGL_TEXTURE_2D:
          case EGL_NO_TEXTURE:
@@ -229,6 +235,13 @@ _eglParseSurfaceAttribList(_EGLSurface *surf, const EGLint *attrib_list)
          break;
       }
 
+      if (type == EGL_PBUFFER_BIT) {
+         if ((tex_target == EGL_NO_TEXTURE && tex_format != EGL_NO_TEXTURE) ||
+             (tex_format == EGL_NO_TEXTURE && tex_target != EGL_NO_TEXTURE)) {
+            err = EGL_BAD_MATCH;
+         }
+      }
+
       if (err != EGL_SUCCESS) {
          _eglLog(_EGL_WARNING, "bad surface attribute 0x%04x", attr);
          break;




More information about the mesa-commit mailing list