Mesa (master): xlib winsys: use new st_swapbuffers() function

Brian Paul brianp at kemper.freedesktop.org
Fri May 1 22:44:59 UTC 2009


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

Author: Brian Paul <brianp at vmware.com>
Date:   Fri May  1 12:28:57 2009 -0600

xlib winsys: use new st_swapbuffers() function

The front/back buffer pointers are truly swapped (when there is an actual
front buffer).

This fixes some issues seen with apps/tests that draw to both the front
and back color buffers.  The true swap allows us to avoid the (potentially)
slow surface_copy() call in update_framebuffer_state() and is cleaner
overall.

---

 src/gallium/state_trackers/glx/xlib/xm_api.c |   21 +++++++--------------
 1 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index a3d1651..79c2230 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -1100,26 +1100,19 @@ XMesaContext XMesaGetCurrentContext( void )
 
 
 
-
-
-
-/*
- * Copy the back buffer to the front buffer.  If there's no back buffer
- * this is a no-op.
+/**
+ * Swap front and back color buffers and have winsys display front buffer.
+ * If there's no front color buffer no swap actually occurs.
  */
 PUBLIC
 void XMesaSwapBuffers( XMesaBuffer b )
 {
-   struct pipe_surface *surf;
+   struct pipe_surface *frontLeftSurf;
 
-   /* If we're swapping the buffer associated with the current context
-    * we have to flush any pending rendering commands first.
-    */
-   st_notify_swapbuffers(b->stfb);
+   st_swapbuffers(b->stfb, &frontLeftSurf, NULL);
 
-   st_get_framebuffer_surface(b->stfb, ST_SURFACE_BACK_LEFT, &surf);
-   if (surf) {
-      driver.display_surface(b, surf);
+   if (frontLeftSurf) {
+      driver.display_surface(b, frontLeftSurf);
    }
 
    xmesa_check_and_update_buffer_size(NULL, b);




More information about the mesa-commit mailing list