From: Frank Binns Date: Fri, 31 Jul 2015 08:11:45 +0000 (+0100) Subject: egl: Add eglQuerySurface surface type check for EGL_LARGEST_PBUFFER attrib X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b2c5986ea1c8e66c4e0a05bcacbcf28c27f5b183;p=mesa.git egl: Add eglQuerySurface surface type check for EGL_LARGEST_PBUFFER attrib Calling eglQuerySurface on a window or pixmap with the EGL_LARGEST_PBUFFER attribute resulted in the contents of the 'value' parameter being modified. This is the wrong behaviour according to the EGL spec, which states: "Querying EGL_LARGEST_PBUFFER for a pbuffer surface returns the same attribute value specified when the surface was created with eglCreatePbufferSurface. For a window or pixmap surface, the contents of value are not modified." Avoid this from happening by checking that the surface type is EGL_PBUFFER_BIT before modifying the contents of the parameter. Cc: Signed-off-by: Frank Binns Reviewed-by: Emil Velikov Reviewed-by: Eric Anholt --- diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c index 541353f9e0a..4fa43f3e2b1 100644 --- a/src/egl/main/eglsurface.c +++ b/src/egl/main/eglsurface.c @@ -326,7 +326,8 @@ _eglQuerySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, *value = surface->Config->ConfigID; break; case EGL_LARGEST_PBUFFER: - *value = surface->LargestPbuffer; + if (surface->Type == EGL_PBUFFER_BIT) + *value = surface->LargestPbuffer; break; case EGL_TEXTURE_FORMAT: /* texture attributes: only for pbuffers, no error otherwise */