[Mesa-dev] [PATCH 1/3] glx: remove glFlush call in glXSwapBuffers

Ian Romanick idr at freedesktop.org
Thu Nov 8 10:59:27 PST 2012


On 11/08/2012 05:48 AM, Marek Olšák wrote:
> Flushing here is unnecessary. The drivers which always flush in dri2Throttle
> or __DRI2flushExtensionRec::flush are just wasting time here.
>
> st/mesa is updated to do what glFlush does.
>
> XXX I guess some other drivers should be updated to flush by themselves
>      if they don't?
> ---
>   src/glx/glxcmds.c                    |    4 ----
>   src/mesa/state_tracker/st_cb_flush.c |    1 +
>   2 files changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
> index 394bf59..22392bc 100644
> --- a/src/glx/glxcmds.c
> +++ b/src/glx/glxcmds.c
> @@ -781,10 +781,6 @@ glXSwapBuffers(Display * dpy, GLXDrawable drawable)
>         __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
>
>         if (pdraw != NULL) {
> -         if (gc && drawable == gc->currentDrawable) {
> -            glFlush();
> -         }
> -

This will completely break if the user has a new libGL with an old 
driver.  Our story for all the DRI1 drivers that we removed from the 
tree was that we'd maintain loader / driver compatibility.

>            (*pdraw->psc->driScreen->swapBuffers)(pdraw, 0, 0, 0);
>            return;
>         }
> diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c
> index b4372ae..7c9f91f 100644
> --- a/src/mesa/state_tracker/st_cb_flush.c
> +++ b/src/mesa/state_tracker/st_cb_flush.c
> @@ -79,6 +79,7 @@ display_front_buffer(struct st_context *st)
>   void st_flush( struct st_context *st,
>                  struct pipe_fence_handle **fence )
>   {
> +   FLUSH_VERTICES(st->ctx, 0);
>      FLUSH_CURRENT(st->ctx, 0);
>
>      st_flush_bitmap_cache(st);
>



More information about the mesa-dev mailing list