summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-03-14 15:55:41 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2014-03-14 15:55:41 +0000
commit8cc1f005c69786243ac69f6505087071787e6f87 (patch)
treef582c826df4d366af3ba2877ae1d49e26c6dfe65
parenta55bbe3b598616ef4464e50cb9364c8cdf0b513a (diff)
intel-virtual-output: Iterate over remote outputs in the same order as listed
If we walk the output lists in the same order as they are listed by RandR, we are more likely to hit favourable priority sorting. E.g. the user is likely to setup the outputs in the same order as listed, meaning fewer CRTC transitions etc. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--tools/virtual.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/virtual.c b/tools/virtual.c
index cf383156..c9945743 100644
--- a/tools/virtual.c
+++ b/tools/virtual.c
@@ -2163,6 +2163,20 @@ static struct display *last_display(struct context *ctx)
return &ctx->display[ctx->ndisplay-1];
}
+static void reverse_clone_list(struct display *display)
+{
+ struct clone *list = NULL;
+
+ while (display->clone) {
+ struct clone *clone = display->clone;
+ display->clone = clone->next;
+ clone->next = list;
+ list = clone;
+ }
+
+ display->clone = list;
+}
+
static int last_display_add_clones__randr(struct context *ctx)
{
struct display *display = last_display(ctx);
@@ -2236,6 +2250,8 @@ static int last_display_add_clones__randr(struct context *ctx)
XRRFreeOutputInfo(o);
}
XRRFreeScreenResources(res);
+
+ reverse_clone_list(display);
return 0;
}
@@ -2309,6 +2325,8 @@ static int last_display_add_clones__xinerama(struct context *ctx)
ctx->active = clone;
}
XFree(xi);
+
+ reverse_clone_list(display);
return 0;
}