xlib winsys: use new st_swapbuffers() function
authorBrian Paul <brianp@vmware.com>
Fri, 1 May 2009 18:28:57 +0000 (12:28 -0600)
committerBrian Paul <brianp@vmware.com>
Fri, 1 May 2009 18:54:20 +0000 (12:54 -0600)
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

index a3d1651..79c2230 100644 (file)
@@ -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);