xf86-video-intel: tools/virtual.c

Chris Wilson ickle at kemper.freedesktop.org
Sun Jan 3 01:56:13 PST 2016


 tools/virtual.c |   32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

New commits:
commit 082a57e6eb3b364aad681f137364a34988c4af5d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Jan 2 21:29:58 2016 +0000

    tools/intel-virtual-output: Respond to expose events on target displays
    
    If the destination screen is exposed (for example screensavers), we need
    to redraw. So enable the ExposeEvent on the target and synthesize
    damage to any clones on that display in order to trigger a redraw.
    
    Reported-by: Raffael Herzog <herzog at raffael.ch>
    References: https://bugs.freedesktop.org/show_bug.cgi?id=93562
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/tools/virtual.c b/tools/virtual.c
index ffda54a..7bf6ee8 100644
--- a/tools/virtual.c
+++ b/tools/virtual.c
@@ -2037,8 +2037,9 @@ static void clone_damage(struct clone *c, const XRectangle *rec)
 	if ((v = (int)rec->y + rec->height) > c->damaged.y2)
 		c->damaged.y2 = v;
 
-	DBG(DAMAGE, ("%s-%s damaged: (%d, %d), (%d, %d)\n",
+	DBG(DAMAGE, ("%s-%s damaged: +(%d,%d)x(%d, %d) -> (%d, %d), (%d, %d)\n",
 	     DisplayString(c->dst.display->dpy), c->dst.name,
+	     rec->x, rec->y, rec->width, rec->height,
 	     c->damaged.x1, c->damaged.y1,
 	     c->damaged.x2, c->damaged.y2));
 }
@@ -2382,6 +2383,8 @@ static int add_display(struct context *ctx, Display *dpy)
 	display->depth = DefaultDepth(dpy, DefaultScreen(dpy));
 	display->visual = DefaultVisual(dpy, DefaultScreen(dpy));
 
+	XSelectInput(dpy, display->root, ExposureMask);
+
 	display->has_shm = can_use_shm(dpy, display->root,
 				       &display->shm_event,
 				       &display->shm_opcode,
@@ -3526,7 +3529,32 @@ int main(int argc, char **argv)
 				XNextEvent(ctx.display[i].dpy, &e);
 
 				DBG(POLL, ("%s received event %d\n", DisplayString(ctx.display[i].dpy), e.type));
-				if (ctx.display[i].rr_active && e.type == ctx.display[i].rr_event + RRNotify) {
+				if (e.type == Expose) {
+					XExposeEvent *xe = (XExposeEvent *)&e;
+					struct clone *clone;
+					int damaged = 0;
+
+					DBG(DAMAGE, ("%s exposed: (%d, %d)x(%d, %d)\n",
+					     DisplayString(ctx.display[i].dpy),
+					     xe->x, xe->y, xe->width, xe->height));
+
+					for (clone = ctx.active; clone; clone = clone->active) {
+						XRectangle r;
+
+						if (clone->dst.display != &ctx.display[i])
+							continue;
+
+						r.x = clone->src.x + xe->x;
+						r.y = clone->src.y + xe->y;
+						r.width  = xe->width;
+						r.height = xe->height;
+						clone_damage(clone, &r);
+						damaged++;
+					}
+
+					if (damaged)
+						context_enable_timer(&ctx);
+				} else if (ctx.display[i].rr_active && e.type == ctx.display[i].rr_event + RRNotify) {
 					XRRNotifyEvent *re = (XRRNotifyEvent *)&e;
 
 					DBG(XRR, ("%s received RRNotify, type %d\n", DisplayString(ctx.display[i].dpy), re->subtype));


More information about the xorg-commit mailing list