[Mesa-dev] [PATCH] egl: Fix eglMakeCurrent behaviour when used with EGL_NO_SURFACE and EGL_NO_CONTEXT.

Chia-I Wu olvaffe at gmail.com
Sun Mar 16 19:30:40 PDT 2014


On Sun, Mar 16, 2014 at 5:20 AM, Beren Minor <beren.minor at gmail.com> 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 | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
> index 950c447..a5def55 100644
> --- a/src/egl/main/eglapi.c
> +++ b/src/egl/main/eglapi.c
> @@ -486,7 +486,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 both be EGL_NO_SURFACE and context be EGL_NO_CONTEXT,
> +      releasing the current thread's ownership on the resources
> +      (EGL 1.4 Specification, Section 3.7.3) */
> +   if ((draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE || ctx != EGL_NO_CONTEXT) &&
> +       (!draw_surf || !read_surf)) {
Intead of changing this if condition, ...
>        /* surfaces may be NULL if surfaceless */
>        if (!disp->Extensions.KHR_surfaceless_context)
isn't it enough to change this one to

  if (ctx && !disp->Extensions.KHR_surfaceless_context)

?
>           RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
> --
> 1.9.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev



-- 
olv at LunarG.com


More information about the mesa-dev mailing list