egl/dri2: remove superfluous flush when changing the context

The flush of the outgoing GL context, as required by the EGL spec for
eglMakeCurrent and extended by KHR_context_flush_control, is already
performed in the unbindContext call. There is no need to pierce through
the layers and unconditionally call glFlush() here.

Getting the out-fence FD for explicit fencing needs to move behind the
unbindContext, to make sure we are getting the fence for the most
recently flushed commands.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14379>
This commit is contained in:
Lucas Stach 2022-01-06 17:44:04 +01:00 committed by Marge Bot
parent 88f1918919
commit b33ed5406a
1 changed files with 3 additions and 6 deletions

View File

@ -1788,12 +1788,6 @@ dri2_make_current(_EGLDisplay *disp, _EGLSurface *dsurf,
old_disp = old_ctx->Resource.Display;
old_dri2_dpy = dri2_egl_display(old_disp);
/* flush before context switch */
dri2_gl_flush();
if (old_dsurf)
dri2_surf_update_fence_fd(old_ctx, disp, old_dsurf);
/* Disable shared buffer mode */
if (old_dsurf && _eglSurfaceInSharedBufferMode(old_dsurf) &&
old_dri2_dpy->vtbl->set_shared_buffer_mode) {
@ -1801,6 +1795,9 @@ dri2_make_current(_EGLDisplay *disp, _EGLSurface *dsurf,
}
dri2_dpy->core->unbindContext(old_cctx);
if (old_dsurf)
dri2_surf_update_fence_fd(old_ctx, disp, old_dsurf);
}
ddraw = (dsurf) ? dri2_dpy->vtbl->get_dri_drawable(dsurf) : NULL;