summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-06-26 17:24:37 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-06-26 17:24:37 +0100
commita072ab506569ecff5b4c57fa90f7a417db69f33b (patch)
tree007b69eb92fc79afe99bc3e5b2689b6539bb61a3 /test
parent96804c74f8f0d19fc1b9db467cf050f4934fe83b (diff)
test: Add client side copy to FakeFront for emulating CopyBuffer correctly
The server manages FakeFront following a flip, but it the client optimises a swap by replacing it with a CopyRegion, it is expected to also update the FakeFront itself. Replicate that behaviour so that the timings for the test case are consistent with mesa. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'test')
-rw-r--r--test/dri2-swap.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/dri2-swap.c b/test/dri2-swap.c
index e592cd8e..ba6b2373 100644
--- a/test/dri2-swap.c
+++ b/test/dri2-swap.c
@@ -41,7 +41,8 @@ static int dri2_open(Display *dpy)
return fd;
}
-static void dri2_copy_swap(Display *dpy, Drawable d, int width, int height)
+static void dri2_copy_swap(Display *dpy, Drawable d,
+ int width, int height, int has_front)
{
XRectangle rect;
XserverRegion region;
@@ -53,6 +54,8 @@ static void dri2_copy_swap(Display *dpy, Drawable d, int width, int height)
region = XFixesCreateRegion(dpy, &rect, 1);
DRI2CopyRegion(dpy, d, region, DRI2BufferFrontLeft, DRI2BufferBackLeft);
+ if (has_front)
+ DRI2CopyRegion(dpy, d, region, DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft);
XFixesDestroyRegion(dpy, region);
}
@@ -114,7 +117,7 @@ static void run(Display *dpy, int width, int height,
xsync(dpy, win);
clock_gettime(CLOCK_MONOTONIC, &start);
for (count = 0; count < COUNT; count++)
- dri2_copy_swap(dpy, win, width, height);
+ dri2_copy_swap(dpy, win, width, height, nattachments == 2);
xsync(dpy, win);
clock_gettime(CLOCK_MONOTONIC, &end);
@@ -165,6 +168,5 @@ int main(void)
run(dpy, width, height, attachments, 1, "windowed");
run(dpy, width, height, attachments, 2, "windowed (with front)");
-
return 0;
}