Bug 106377

Summary: eglWaitClient() doesn't work for surfaceless contexts
Product: Mesa Reporter: Mike Gorchak <mgorchak>
Component: EGLAssignee: mesa-dev
Status: RESOLVED MOVED QA Contact: mesa-dev
Severity: major    
Priority: medium    
Version: 18.0   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Mike Gorchak 2018-05-03 13:23:07 UTC
When surfaceless contexts are in use (for example, for FBO rendering), eglWaitClient return an error EGL_BAD_CURRENT_SURFACE. According to spec it should do glFinish()-like behavior disregarding if it has bound surface to the context or not.

In case of using DRI2 backend it happens that in case of surfaceless context dri2_wait_client() is not called at all and aborted at _eglWaitClientCommon() function with following check:

   /* let bad current context imply bad current surface */
   if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT ||
       _eglGetSurfaceHandle(ctx->DrawSurface) == EGL_NO_SURFACE)
      RETURN_EGL_ERROR(disp, EGL_BAD_CURRENT_SURFACE, EGL_FALSE);
Comment 1 Tapani Pälli 2018-05-04 06:33:21 UTC
EGL spec says following:

"If a surface associated with the calling thread’s current context is no longer
valid, an EGL_BAD_CURRENT_SURFACE error is generated."

Having zero mention of surfaceless context here seems like a spec bug to me. When surfaceless was brought part of spec it seems it only touched MakeCurrent.
Comment 2 Tapani Pälli 2018-05-04 06:50:52 UTC
I've filed following bug for discussion:

https://gitlab.khronos.org/egl/API/issues/12
Comment 3 GitLab Migration User 2019-09-18 18:07:35 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/163.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.