xf86-video-intel: 4 commits - tools/virtual.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Feb 12 17:01:06 CET 2014


 tools/virtual.c |   50 ++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 36 insertions(+), 14 deletions(-)

New commits:
commit 87b9d9f507885ed98d7249940218631b775d30ea
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Feb 12 15:48:20 2014 +0000

    intel-virtual-output: Force an output probe on initial connection to remote display
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/tools/virtual.c b/tools/virtual.c
index 6fa1c99..b891fd0 100644
--- a/tools/virtual.c
+++ b/tools/virtual.c
@@ -2115,7 +2115,8 @@ static int last_display_add_clones__randr(struct context *ctx)
 
 	display_init_randr_hpd(display);
 
-	res = _XRRGetScreenResourcesCurrent(display->dpy, display->root);
+	/* Force a probe of outputs on initial connection */
+	res = XRRGetScreenResources(display->dpy, display->root);
 	if (res == NULL)
 		return -ENOMEM;
 
commit dda57f2e28e01ea254cb2aba9e0846b755c4175a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Feb 12 15:47:00 2014 +0000

    intel-virtual-output: Fix checking for no change in output modes
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/tools/virtual.c b/tools/virtual.c
index 5952186..6fa1c99 100644
--- a/tools/virtual.c
+++ b/tools/virtual.c
@@ -475,6 +475,8 @@ static int clone_update_modes__randr(struct clone *clone)
 	if (to_info == NULL)
 		goto err;
 
+	DBG(("%s: dst.rr_crtc=%ld, now %ld\n",
+	     __func__, (long)clone->dst.rr_crtc, (long)from_info->crtc));
 	if (clone->dst.rr_crtc == from_info->crtc) {
 		for (i = 0; i < to_info->nmode; i++) {
 			XRRModeInfo *mode, *old;
@@ -482,6 +484,11 @@ static int clone_update_modes__randr(struct clone *clone)
 			mode = lookup_mode(to_res, to_info->modes[i]);
 			if (mode == NULL)
 				break;
+
+			DBG(("%s(%s-%s): lookup mode %s\n", __func__,
+			     DisplayString(clone->src.dpy), clone->src.name,
+			     mode->name));
+
 			for (j = 0; j < from_info->nmode; j++) {
 				old = lookup_mode(from_res, from_info->modes[j]);
 				if (old && mode_equal(mode, old)) {
@@ -489,8 +496,12 @@ static int clone_update_modes__randr(struct clone *clone)
 					break;
 				}
 			}
-			if (mode)
+			if (mode) {
+				DBG(("%s(%s-%s): unknown mode %s\n", __func__,
+				     DisplayString(clone->src.dpy), clone->src.name,
+				     mode->name));
 				break;
+			}
 		}
 		if (i == from_info->nmode && i == to_info->nmode) {
 			DBG(("%s(%s-%s): no change in output\n", __func__,
@@ -982,7 +993,7 @@ static int context_update(struct context *ctx)
 			changed |= output->y != c->y;
 			output->y = c->y;
 
-			changed |= output->mode.id != mode;
+			changed |= output->mode.id != c->mode;
 			mode = c->mode;
 			XRRFreeCrtcInfo(c);
 		} else {
@@ -993,6 +1004,9 @@ static int context_update(struct context *ctx)
 		output->rr_crtc = o->crtc;
 		XRRFreeOutputInfo(o);
 
+		DBG(("%s-%s crtc changed? %d\n",
+		     DisplayString(ctx->clones[n].dst.display->dpy), ctx->clones[n].dst.name, changed));
+
 		if (mode) {
 			if (output->mode.id != mode) {
 				for (i = 0; i < res->nmode; i++) {
@@ -1007,7 +1021,7 @@ static int context_update(struct context *ctx)
 			output->mode.id = 0;
 		}
 
-		DBG(("%s-%s changed? %d\n",
+		DBG(("%s-%s output changed? %d\n",
 		     DisplayString(ctx->clones[n].dst.display->dpy), ctx->clones[n].dst.name, changed));
 
 		if (changed)
commit 94e5ca3d5ab33c8e9b86a4f60c712da72df15b3d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Feb 12 15:13:42 2014 +0000

    intel-virtual-output: Always requery modes after OutputNotify
    
    References: https://bugs.freedesktop.org/show_bug.cgi?id=74800
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/tools/virtual.c b/tools/virtual.c
index c6b7896..5952186 100644
--- a/tools/virtual.c
+++ b/tools/virtual.c
@@ -454,7 +454,7 @@ static int clone_update_modes__randr(struct clone *clone)
 	assert(clone->dst.rr_output);
 	assert(clone->dst.display->rr_event);
 
-	from_res = XRRGetScreenResources(clone->dst.dpy, clone->dst.window);
+	from_res = _XRRGetScreenResourcesCurrent(clone->dst.dpy, clone->dst.window);
 	if (from_res == NULL)
 		goto err;
 
@@ -462,11 +462,10 @@ static int clone_update_modes__randr(struct clone *clone)
 	if (from_info == NULL)
 		goto err;
 
-	DBG(("%s(%s-%s): timestamp %ld (last %ld)\n", __func__,
+	DBG(("%s(%s-%s <- %s-%s): timestamp %ld (last %ld)\n", __func__,
 	     DisplayString(clone->src.dpy), clone->src.name,
-	    from_info->timestamp, clone->timestamp));
-	if (from_info->timestamp == clone->timestamp)
-		goto err;
+	     DisplayString(clone->dst.dpy), clone->dst.name,
+	     from_info->timestamp, clone->timestamp));
 
 	to_res = _XRRGetScreenResourcesCurrent(clone->src.dpy, clone->src.window);
 	if (to_res == NULL)
commit d84940cc9d297df00477c838b4f53883c19a1da4
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Feb 12 14:48:24 2014 +0000

    intel-virtul-output: Double check timestamps
    
    Compare both res->timestamp and res->configTimestamp for changes in
    state.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/tools/virtual.c b/tools/virtual.c
index 2539425..c6b7896 100644
--- a/tools/virtual.c
+++ b/tools/virtual.c
@@ -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;


More information about the xorg-commit mailing list