[PATCH v2 09/10] dri2: copy front to fake front in SwapBuffers
Pauli
ext-pauli.nieminen at nokia.com
Tue Feb 8 13:42:55 PST 2011
From: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
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.
v2:
* In blit path copy front to fake before completing the swap
Signed-off-by: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
---
hw/xfree86/dri2/dri2.c | 33 +++++++++++++++++++--------------
1 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index c77ac9b..bfd72ad 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -847,7 +847,6 @@ DRI2SwapComplete2(DRI2DrawablePtr pPriv, int frame,
{
DRI2SwapCompleteDataPtr pSwapData = swap_data;
ClientPtr client = pSwapData->event.client;
- DrawablePtr pDraw = pPriv->drawable;
CARD64 ust = 0;
DRI2DrawableRefPtr ref;
@@ -865,19 +864,6 @@ DRI2SwapComplete2(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);
- }
-
if (swap_complete)
swap_complete(client, pSwapData->data, type, ust, frame,
pPriv->swap_count);
@@ -911,6 +897,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,
@@ -977,6 +980,7 @@ DRI2SwapBuffers(ClientPtr client, DRI2DrawablePtr pPriv, CARD64 target_msc,
pPriv->refcnt++;
(*ds->CopyRegion)(pDraw, ®ion, pDestBuffer, pSrcBuffer);
+ DRI2CopyFrontToFakeFront(pDraw, pPriv);
DRI2SwapComplete2(pPriv, target_msc, 0, 0, DRI2_BLIT_COMPLETE,
func, pSwapData);
return Success;
@@ -1037,6 +1041,7 @@ DRI2SwapBuffers(ClientPtr client, DRI2DrawablePtr pPriv, CARD64 target_msc,
DRI2InvalidateDrawable(pPriv);
+ DRI2CopyFrontToFakeFront(pDraw, pPriv);
return Success;
}
--
1.7.0.4
More information about the xorg-devel
mailing list