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);
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.
I've filed following bug for discussion: