diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 41006da..133b9cb 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -217,6 +217,19 @@ find_attachment(DRI2DrawablePtr pPriv, unsigned attachment) return -1; } +static void +get_drawable_region(DrawablePtr draw, RegionPtr region) +{ + BoxRec box; + + box.x1 = 0; + box.y1 = 0; + box.x2 = draw->width; + box.y2 = draw->height; + + REGION_INIT(draw->pScreen, region, &box, 0); +} + static Bool allocate_or_reuse_buffer(DrawablePtr pDraw, DRI2ScreenPtr ds, DRI2DrawablePtr pPriv, @@ -344,15 +357,9 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height, * applications that call glXWaitX before calling glDrawBuffer. */ if (have_fake_front && buffers_changed) { - BoxRec box; RegionRec region; - box.x1 = 0; - box.y1 = 0; - box.x2 = pPriv->width; - box.y2 = pPriv->height; - REGION_INIT(pDraw->pScreen, ®ion, &box, 0); - + get_drawable_region(pDraw, ®ion); DRI2CopyRegion(pDraw, ®ion, DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft); } @@ -605,6 +612,7 @@ DRI2SwapComplete(ClientPtr client, DrawablePtr pDraw, int frame, ScreenPtr pScreen = pDraw->pScreen; DRI2DrawablePtr pPriv; CARD64 ust = 0; + RegionRec region; pPriv = DRI2GetDrawable(pDraw); if (pPriv == NULL) { @@ -628,6 +636,12 @@ DRI2SwapComplete(ClientPtr client, DrawablePtr pDraw, int frame, pPriv->swap_count++; DRI2WakeClient(client, pDraw, frame, tv_sec, tv_usec); + + /* If we're using a fake front, update it with the front buffer + * contents. */ + get_drawable_region(pDraw, ®ion); + DRI2CopyRegion(pDraw, ®ion, DRI2BufferFakeFrontLeft, + DRI2BufferFrontLeft); } Bool @@ -682,18 +696,13 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, /* Old DDX, just blit */ if (!ds->ScheduleSwap) { - BoxRec box; RegionRec region; - box.x1 = 0; - box.y1 = 0; - box.x2 = pDraw->width; - box.y2 = pDraw->height; - REGION_INIT(pScreen, ®ion, &box, 0); - pPriv->swapsPending++; + get_drawable_region(pDraw, ®ion); (*ds->CopyRegion)(pDraw, ®ion, pDestBuffer, pSrcBuffer); + DRI2SwapComplete(client, pDraw, target_msc, 0, 0, DRI2_BLIT_COMPLETE, func, data); return Success;