[Mesa-dev] egl/main: Fix eglMakeCurrent when releasing context from current thread.

Submitted by Beren Minor on March 20, 2014, 7:36 a.m.

Details

Message ID 1395300994-5240-1-git-send-email-beren.minor+git@gmail.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Beren Minor March 20, 2014, 7:36 a.m.
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.
---
 src/egl/main/eglapi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 219d8e6..5d0a844 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -524,8 +524,8 @@  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)
+      /* surfaces may be NULL if surfaceless, or if context is NO_CONTEXT */
+      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) ||

Comments

Beren, I committed this to master. Thanks for the fix.

On Thu, Mar 20, 2014 at 08:36:34AM +0100, Beren Minor wrote:
> 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.
> ---
>  src/egl/main/eglapi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)