summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeren Minor <beren.minor@gmail.com>2014-03-20 08:36:34 +0100
committerCarl Worth <cworth@cworth.org>2014-06-23 15:37:38 -0700
commitb574944a057ce2dc9340b4abdf89105ff9a8f48b (patch)
treeab4a5e50124a4d7ed204d6e1d5b502160c1f1db9
parent838b0d992838d1ef8717d898430fcd1bf51faefb (diff)
downloadmesa-b574944a057ce2dc9340b4abdf89105ff9a8f48b.tar.gz
egl/main: Fix eglMakeCurrent when releasing context from current thread.
EGL 1.4 Specification says that eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT) can be used to release the current thread's ownership on the surfaces and context. MESA's egl implementation was only accepting the parameters when the KHR_surfaceless_context extension is supported. [chadv] Add quote from the EGL 1.4 spec. Cc: "10,1, 10.2" <mesa-stable@lists.freedesktop.org> Reviewed-by: Chad Versace <chad.versace@linux.intel.com> (cherry picked from commit 0ca0d5743fb42a956289a87efd4c8fcda88cf93a)
-rw-r--r--src/egl/main/eglapi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 59e214c43d2..6d964640994 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -490,8 +490,12 @@ eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read,
if (!context && ctx != EGL_NO_CONTEXT)
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE);
if (!draw_surf || !read_surf) {
- /* surfaces may be NULL if surfaceless */
- if (!disp->Extensions.KHR_surfaceless_context)
+ /* From the EGL 1.4 (20130211) spec:
+ *
+ * To release the current context without assigning a new one, set ctx
+ * to EGL_NO_CONTEXT and set draw and read to EGL_NO_SURFACE.
+ */
+ if (!disp->Extensions.KHR_surfaceless_context && ctx != EGL_NO_CONTEXT)
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
if ((!draw_surf && draw != EGL_NO_SURFACE) ||