[PATCH] xrandr: Check if clone's state matches before connecting crtc

Dasith Gunawardhana dasith.gunawardhana at gmail.com
Wed Nov 22 05:01:23 UTC 2017


Fixes bug: If an output's clone has already been connected to a crtc then the
current output will be connected to that crtc without checking
mismatched state (i.e. different positions).

Signed-off-by: Dasith Gunawardhana <dasith.gunawardhana at gmail.com>
---
 xrandr.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/xrandr.c b/xrandr.c
index 2d4cb72..683ffda 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -1957,6 +1957,18 @@ check_crtc_for_output (crtc_t *crtc, output_t *output)
 	/* not on the list, can't clone */
 	if (l == output->output_info->nclone) 
 	    return False;
+
+    /* make sure the state matches the clone's state */
+    if (other->mode_info != output->mode_info)
+        return False;
+    if (other->x != output->x)
+        return False;
+    if (other->y != output->y)
+        return False;
+    if (other->rotation != output->rotation)
+        return False;
+    if (!equal_transform (&other->transform, &output->transform))
+        return False;
     }
 
     if (crtc->noutput)
-- 
2.15.0



More information about the xorg-devel mailing list