intel-virtual-output: Perform an explicit sync
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 8 Nov 2013 12:54:01 +0000 (12:54 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 8 Nov 2013 12:56:06 +0000 (12:56 +0000)
If we fail to track rendering using ShmCompletionEvents and begin to
drop frames, insert an explicit XSync.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
tools/virtual.c

index 71d18f5..74a03e8 100644 (file)
@@ -1359,8 +1359,14 @@ static int clone_paint(struct clone *c)
                while (XPending(c->dst.dpy))
                        ;
 
-               if (c->dst.serial > LastKnownRequestProcessed(c->dst.dpy))
-                       return EAGAIN;
+               if (c->dst.serial > LastKnownRequestProcessed(c->dst.dpy)) {
+                       if (c->dst.display->send++ == 0)
+                               return EAGAIN;
+
+                       XSync(c->dst.dpy, False);
+                       c->dst.display->flush = 0;
+                       c->dst.display->send = 0;
+               }
        }
 
        if (FORCE_FULL_REDRAW) {