[Mesa-dev] [PATCH] egl: Fix for not setting EGL_BAD_MATCH by eglCreatePbufferSurface.

Pielech, Adrian adrian.pielech at intel.com
Fri Mar 4 14:06:27 UTC 2016



This is fix for not setting EGL_BAD_MATCH when calling eglCreatePbufferSurface with invalid setting of EGL_TEXTURE_FORMAT and EGL_TEXTURE_TARGET.
According to EGL spec the following combination should generate EGL_BAD_MATCH:
EGL_TEXTURE_FORMAT == EGL_NO_TEXTURE and EGL_TEXTURE_TARGET !=  EGL_NO_TEXTURE,
EGL_TEXTURE_FORMAT != EGL_NO_TEXTURE and EGL_TEXTURE_TARGET ==  EGL_NO_TEXTURE


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

diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c
index d42737e..b79e3c6 100644
--- a/src/egl/main/eglsurface.c
+++ b/src/egl/main/eglsurface.c
@@ -223,6 +223,14 @@ _eglParseSurfaceAttribList(_EGLSurface *surf, const EGLint *attrib_list)
      }
    }
+   //if surface is Pbuffer type and [(EGL_TEXTURE_FORMAT == EGL_NO_TEXTURE and EGL_TEXTURE_TARGET != EGL_NO_TEXTURE) or (EGL_TEXTURE_FORMAT != EGL_NO_TEXTURE and EGL_TEXTURE_TARGET == EGL_NO_TEXTURE)] then the EGL_BAD_MATCH should be set
+   if ((surf->TextureFormat == EGL_NO_TEXTURE && surf->TextureTarget != EGL_NO_TEXTURE ||
+           surf->TextureFormat != EGL_NO_TEXTURE && surf->TextureTarget == EGL_NO_TEXTURE) &&
+           (surf->Type & EGL_PBUFFER_BIT))
+   {
+       err = EGL_BAD_MATCH;
+   }
+
    return err;
}
--
2.7.0.rc3
--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160304/23b85402/attachment.html>


More information about the mesa-dev mailing list