xf86-video-intel: test/dri2-swap.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Jun 26 09:39:11 PDT 2012


 test/dri2-swap.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit a072ab506569ecff5b4c57fa90f7a417db69f33b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jun 26 17:24:37 2012 +0100

    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 at chris-wilson.co.uk>

diff --git a/test/dri2-swap.c b/test/dri2-swap.c
index e592cd8..ba6b237 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;
 }


More information about the xorg-commit mailing list