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.
This commit is contained in:
Brian Paul 2009-05-01 12:28:57 -06:00
parent 3f52a853f7
commit b57b6c2d2c

View 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);