[Spice-devel] [PATCH linux vdagent 02/10] Fix confusion between output index and crtc index

Jonathon Jongsma jjongsma at redhat.com
Thu Dec 13 22:46:24 UTC 2018


Get the CRTC ID from the output struct rather than using the
output_index as an index into the array of crtcs
---
 src/vdagent/x11-randr.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/vdagent/x11-randr.c b/src/vdagent/x11-randr.c
index 88f723f..802af5c 100644
--- a/src/vdagent/x11-randr.c
+++ b/src/vdagent/x11-randr.c
@@ -399,8 +399,15 @@ static void xrandr_disable_output(struct vdagent_x11 *x11, int output)
         return;
     }
 
+    XRROutputInfo *oinfo = x11->randr.outputs[output];
+    if (oinfo->ncrtc == 0) {
+        syslog(LOG_WARNING, "Output index %i doesn't have any associated CRTCs", output);
+        return;
+    }
+
+    // assume output only has a single crtc
     s = XRRSetCrtcConfig(x11->display, x11->randr.res,
-                         x11->randr.res->crtcs[output],
+                         oinfo->crtcs[0],
                          CurrentTime, 0, 0, None, RR_Rotate_0,
                          NULL, 0);
 
-- 
2.17.2



More information about the Spice-devel mailing list