egl: Move an error check earlier in EGL_BUFFER_AGE_EXT query

I can't think of any good reason to call down to the driver and _then_
check whether your calling context was already bad.

Reviewed-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18214>
This commit is contained in:
Adam Jackson
2022-08-22 15:46:42 -04:00
committed by Marge Bot
parent 7662a5e9d3
commit 168fdb5a91
+4 -4
View File
@@ -559,14 +559,14 @@ _eglQuerySurface(_EGLDisplay *disp, _EGLSurface *surface,
return _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
_EGLContext *ctx = _eglGetCurrentContext();
EGLint result = disp->Driver->QueryBufferAge(disp, surface);
/* error happened */
if (result < 0)
return EGL_FALSE;
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT ||
ctx->DrawSurface != surface)
return _eglError(EGL_BAD_SURFACE, "eglQuerySurface");
EGLint result = disp->Driver->QueryBufferAge(disp, surface);
if (result < 0)
return EGL_FALSE;
*value = result;
surface->BufferAgeRead = EGL_TRUE;
break;