From b33ed5406a9379dba98e2ae1b8ff47fa22e8cb6a Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Thu, 6 Jan 2022 17:44:04 +0100 Subject: [PATCH] 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 Reviewed-by: Adam Jackson Part-of: --- src/egl/drivers/dri2/egl_dri2.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index b1e4a9dfe13..93030adc1e9 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -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;