summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Binns <[email protected]>2015-07-31 09:11:45 +0100
committerEmil Velikov <[email protected]>2015-08-06 16:49:47 +0100
commit1f6798a70a6d7e6db636decc6af752f9a7714906 (patch)
treec97a5bd57d965cad6f73f9cf34cf96816a89cd75
parent84ef345dffec02d790db13fd6257e2c08eb0d56a (diff)
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: <[email protected]> Signed-off-by: Frank Binns <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Anholt <[email protected]> (cherry picked from commit b2c5986ea1c8e66c4e0a05bcacbcf28c27f5b183)
-rw-r--r--src/egl/main/eglsurface.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c
index 76c60e940dc..013b2eb34c8 100644
--- a/src/egl/main/eglsurface.c
+++ b/src/egl/main/eglsurface.c
@@ -309,7 +309,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 */