diff options
author | Pauli Nieminen <ext-pauli.nieminen@nokia.com> | 2011-02-02 01:48:12 +0200 |
---|---|---|
committer | Pauli Nieminen <ext-pauli.nieminen@nokia.com> | 2011-02-04 17:36:05 +0200 |
commit | ff78fd53dc8d66db991ce9220460b59199ab2fa5 (patch) | |
tree | f035cad0ebff5ef8c19fc1401858ea03002919e6 | |
parent | dd9d1840e9c091c066c3e165e81c3ab14069a73e (diff) |
dri2: copy front to fake front in SwapBuffers
DRI2SwapComplete is too late for front to fake front copy if swap is
completed asynchronously. Client could be able to use fake front already
before swap completes.
Moving front to fake front solves the problem but requires that driver
is capable to copy from new front to fake front immediately after
ScheduleSwap hook returns.
Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
-rw-r--r-- | hw/xfree86/dri2/dri2.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 15d2e7a2e..72fd1cba1 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -813,7 +813,6 @@ DRI2SwapComplete(int client_index, DRI2DrawablePtr pPriv, int frame, ClientPtr client = clients[client_index]; DRI2SwapCompleteDataPtr pSwapData = swap_data; DRI2DrawableRefPtr ref = DRI2LookupClientDrawableRef(pPriv, client, 0); - DrawablePtr pDraw = pPriv->drawable; CARD64 ust = 0; pPriv->swapsPending--; @@ -823,19 +822,6 @@ DRI2SwapComplete(int client_index, DRI2DrawablePtr pPriv, int frame, if (ref == NULL) goto out; - if (pDraw) { - BoxRec box; - RegionRec region; - - box.x1 = 0; - box.y1 = 0; - box.x2 = pDraw->width; - box.y2 = pDraw->height; - RegionInit(®ion, &box, 0); - DRI2CopyRegion(pPriv, ®ion, DRI2BufferFakeFrontLeft, - DRI2BufferFrontLeft); - } - ust = ((CARD64)tv_sec * 1000000) + tv_usec; if (swap_complete) swap_complete(client, pSwapData->data, type, ust, frame, @@ -870,6 +856,23 @@ DRI2WaitSwap(ClientPtr client, DRI2DrawablePtr pPriv) return FALSE; } +static void +DRI2CopyFrontToFakeFront(DrawablePtr pDraw, DRI2DrawablePtr pPriv) +{ + if (pDraw) { + BoxRec box; + RegionRec region; + + box.x1 = 0; + box.y1 = 0; + box.x2 = pDraw->width; + box.y2 = pDraw->height; + RegionInit(®ion, &box, 0); + DRI2CopyRegion(pPriv, ®ion, DRI2BufferFakeFrontLeft, + DRI2BufferFrontLeft); + } +} + int DRI2SwapBuffers(ClientPtr client, DRI2DrawablePtr pPriv, CARD64 target_msc, CARD64 divisor, CARD64 remainder, CARD64 *swap_target, @@ -935,6 +938,8 @@ DRI2SwapBuffers(ClientPtr client, DRI2DrawablePtr pPriv, CARD64 target_msc, (*ds->CopyRegion)(pDraw, ®ion, pDestBuffer, pSrcBuffer); DRI2SwapComplete(client->index, pPriv, target_msc, 0, 0, DRI2_BLIT_COMPLETE, func, pSwapData); + + DRI2CopyFrontToFakeFront(pDraw, pPriv); return Success; } @@ -993,6 +998,7 @@ DRI2SwapBuffers(ClientPtr client, DRI2DrawablePtr pPriv, CARD64 target_msc, DRI2InvalidateDrawable(pPriv); + DRI2CopyFrontToFakeFront(pDraw, pPriv); return Success; } |