[PATCH] xrandr: Preserve current mode when switching crtcs

Keith Packard keithp at keithp.com
Sat Aug 6 19:10:48 PDT 2011


When switching output crtcs, preserve any current mode in preference
to selecting whatever mode is currently in use on that crtc.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 xrandr.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/xrandr.c b/xrandr.c
index 62b32d1..d35e451 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -1074,7 +1074,13 @@ set_output_info (output_t *output, RROutput xid, XRROutputInfo *output_info)
     /* set mode name and info */
     if (!(output->changes & changes_mode))
     {
-	if (output->crtc_info)
+	crtc_t	*crtc = NULL;
+	
+	if (output_info->crtc)
+	    crtc = find_crtc_by_xid(output_info->crtc);
+	if (crtc && crtc->crtc_info)
+	    set_name_xid (&output->mode, crtc->crtc_info->mode);
+	else if (output->crtc_info)
 	    set_name_xid (&output->mode, output->crtc_info->crtc_info->mode);
 	else
 	    set_name_xid (&output->mode, None);
-- 
1.7.5.4



More information about the xorg-devel mailing list