Mesa (master): egl: QueryContext on a configless context returns zero

Adam Jackson ajax at kemper.freedesktop.org
Mon Sep 12 15:29:47 UTC 2016


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

Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Sep  9 12:25:33 2016 -0400

egl: QueryContext on a configless context returns zero

MESA_configless_context does not specify the interaction with
QueryContext at all, and the code to generate an error in this case
predates the Mesa extension. Since EGL_NO_CONFIG_{KHR,MESA} are
numerically identical there's no way to distinguish which one the
application asked for, so use the KHR behaviour.

Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>
Reviewed-by: Eric Anholt <eric at anholt.net>
Signed-off-by: Adam Jackson <ajax at redhat.com>

---

 src/egl/main/eglcontext.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
index 58740c3..7eac79a 100644
--- a/src/egl/main/eglcontext.c
+++ b/src/egl/main/eglcontext.c
@@ -538,9 +538,14 @@ _eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *c,
 
    switch (attribute) {
    case EGL_CONFIG_ID:
-      if (!c->Config)
-         return _eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext");
-      *value = c->Config->ConfigID;
+      /*
+       * From EGL_KHR_no_config_context:
+       *
+       *    "Querying EGL_CONFIG_ID returns the ID of the EGLConfig with
+       *     respect to which the context was created, or zero if created
+       *     without respect to an EGLConfig."
+       */
+      *value = c->Config ? c->Config->ConfigID : 0;
       break;
    case EGL_CONTEXT_CLIENT_VERSION:
       *value = c->ClientMajorVersion;




More information about the mesa-commit mailing list