summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-09-02 15:13:44 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-09-02 15:13:44 +0100
commitdd5f17ed3adf0c4e7c642f685f61766d12247c0e (patch)
tree6a6220cccdfc9210e75a89aad16e3a2d5d74e186 /tools
parent529db4d5edf396757f4f10a2b3aac55ad7e0bbc1 (diff)
intel-virtual-output: Decouple the fake mode before deleting
When we install a fake mode on the output, we have to perform a round-trip for a reprobe. During that time, some other client (such as gnome-shell) will be notify of the change in output status and may attempt to configure it. This leaves us unable to delete the mode as it is currently active - so first disable the new head and then delete the mode. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tools')
-rw-r--r--tools/virtual.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/tools/virtual.c b/tools/virtual.c
index 5d2932a6..ffac700b 100644
--- a/tools/virtual.c
+++ b/tools/virtual.c
@@ -386,6 +386,7 @@ static RROutput claim_virtual(struct display *display, const char *name)
char buf[] = "ClaimVirtualHead";
Display *dpy = display->dpy;
XRRScreenResources *res;
+ XRROutputInfo *output;
XRRModeInfo mode;
RRMode id;
RROutput rr_output;
@@ -398,10 +399,14 @@ static RROutput claim_virtual(struct display *display, const char *name)
return 0;
for (i = rr_output = 0; rr_output == 0 && i < res->noutput; i++) {
- XRROutputInfo *o = XRRGetOutputInfo(dpy, res, res->outputs[i]);
- if (strcmp(o->name, name) == 0)
+ output = XRRGetOutputInfo(dpy, res, res->outputs[i]);
+ if (output == NULL)
+ continue;
+
+ if (strcmp(output->name, name) == 0)
rr_output = res->outputs[i];
- XRRFreeOutputInfo(o);
+
+ XRRFreeOutputInfo(output);
}
for (i = id = 0; id == 0 && i < res->nmode; i++) {
if (strcmp(res->modes[i].name, buf) == 0)
@@ -428,6 +433,15 @@ static RROutput claim_virtual(struct display *display, const char *name)
res = XRRGetScreenResources(dpy, display->root);
if (res == NULL)
return 0;
+
+ /* Some else may have interrupted us and installed that new mode! */
+ output = XRRGetOutputInfo(dpy, res, rr_output);
+ if (output) {
+ if (output->crtc)
+ XRRSetCrtcConfig(dpy, res, output->crtc, CurrentTime,
+ 0, 0, None, RR_Rotate_0, NULL, 0);
+ XRRFreeOutputInfo(output);
+ }
XRRFreeScreenResources(res);
XRRDeleteOutputMode(dpy, rr_output, id);