Mesa (main): egl/dri2: remove superfluous flush when changing the context

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jan 17 10:58:10 UTC 2022


Module: Mesa
Branch: main
Commit: b33ed5406a9379dba98e2ae1b8ff47fa22e8cb6a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b33ed5406a9379dba98e2ae1b8ff47fa22e8cb6a

Author: Lucas Stach <l.stach at pengutronix.de>
Date:   Thu Jan  6 17:44:04 2022 +0100

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 at pengutronix.de>
Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14379>

---

 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;



More information about the mesa-commit mailing list