aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers/dri/common/dri_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/drivers/dri/common/dri_util.c')
-rw-r--r--mesalib/src/mesa/drivers/dri/common/dri_util.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c
index 6c78928ee..d6e875fcf 100644
--- a/mesalib/src/mesa/drivers/dri/common/dri_util.c
+++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c
@@ -376,19 +376,17 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
return NULL;
}
- /* The EGL_KHR_create_context spec says:
+ /* The latest version of EGL_KHR_create_context spec says:
*
- * "Flags are only defined for OpenGL context creation, and specifying
- * a flags value other than zero for other types of contexts,
- * including OpenGL ES contexts, will generate an error."
+ * "If the EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR flag bit is set in
+ * EGL_CONTEXT_FLAGS_KHR, then a <debug context> will be created.
+ * [...] This bit is supported for OpenGL and OpenGL ES contexts.
*
- * The GLX_EXT_create_context_es2_profile specification doesn't say
- * anything specific about this case. However, none of the known flags
- * have any meaning in an ES context, so this seems safe.
+ * None of the other flags have any meaning in an ES context, so this seems safe.
*/
if (mesa_api != API_OPENGL_COMPAT
&& mesa_api != API_OPENGL_CORE
- && flags != 0) {
+ && (flags & ~__DRI_CTX_FLAG_DEBUG)) {
*error = __DRI_CTX_ERROR_BAD_FLAG;
return NULL;
}
@@ -569,6 +567,12 @@ static int driUnbindContext(__DRIcontext *pcp)
if (pcp == NULL)
return GL_FALSE;
+ /*
+ ** Call driUnbindContext before checking for valid drawables
+ ** to handle surfaceless contexts properly.
+ */
+ pcp->driScreenPriv->driver->UnbindContext(pcp);
+
pdp = pcp->driDrawablePriv;
prp = pcp->driReadablePriv;
@@ -576,8 +580,6 @@ static int driUnbindContext(__DRIcontext *pcp)
if (!pdp && !prp)
return GL_TRUE;
- pcp->driScreenPriv->driver->UnbindContext(pcp);
-
assert(pdp);
if (pdp->refcount == 0) {
/* ERROR!!! */