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>
This commit is contained in:
Chris Wilson 2012-06-26 17:24:37 +01:00
parent 96804c74f8
commit a072ab5065
1 changed files with 5 additions and 3 deletions

View File

@ -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;
}