intel-virtul-output: Double check timestamps
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 12 Feb 2014 14:48:24 +0000 (14:48 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Wed, 12 Feb 2014 14:48:24 +0000 (14:48 +0000)
Compare both res->timestamp and res->configTimestamp for changes in
state.

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

index 2539425..c6b7896 100644 (file)
@@ -85,7 +85,6 @@ struct display {
        Window root;
        Visual *visual;
        Damage damage;
-       long timestamp;
 
        int width;
        int height;
@@ -169,6 +168,9 @@ struct context {
 
        int timer_active;
 
+       long timestamp;
+       long configTimestamp;
+
        Atom singleton;
        char command[1024];
        int command_continuation;
@@ -938,14 +940,20 @@ static int context_update(struct context *ctx)
        if (res == NULL)
                return 0;
 
-       DBG(("%s timestamp %ld (last %ld)\n", DisplayString(dpy), res->timestamp, ctx->display->timestamp));
-       if (res->timestamp == ctx->display->timestamp &&
+       DBG(("%s timestamp %ld (last %ld), config %ld (last %ld)\n",
+            DisplayString(dpy),
+            res->timestamp, ctx->timestamp,
+            res->configTimestamp, ctx->configTimestamp));
+       if (res->timestamp == ctx->timestamp &&
+           res->configTimestamp == ctx->configTimestamp &&
            res->timestamp != res->configTimestamp) { /* mutter be damned */
                XRRFreeScreenResources(res);
                return 0;
        }
 
-       ctx->display->timestamp = res->timestamp;
+       ctx->timestamp = res->timestamp;
+       ctx->configTimestamp = res->configTimestamp;
+
        for (n = 0; n < ctx->nclone; n++) {
                struct output *output = &ctx->clones[n].src;
                XRROutputInfo *o;
@@ -966,7 +974,7 @@ static int context_update(struct context *ctx)
                             output->x, output->y, output->rotation, output->mode.id,
                             c->x, c->y, c->rotation, c->mode));
 
-                       changed |= output->rotation |= c->rotation;
+                       changed |= output->rotation != c->rotation;
                        output->rotation = c->rotation;
 
                        changed |= output->x != c->x;