[PATCH 2/3] xf86: if compat_output changes then call xf86SetDDCproperties()

vdb at picaros.org vdb at picaros.org
Thu Jul 18 04:39:10 PDT 2013


http://bugs.freedesktop.org/show_bug.cgi?id=65212
http://lists.x.org/archives/xorg-devel/2013-April/035934.html

xf86SetDDCproperties() must be called after each SetCompatOutput() 
compat_output change for scrn->monitor and scrn->modes consistency.  

Remove the compat_output preset in xf86TargetFallback() since its 
selection differs from the SetCompatOutput() logic.

Signed-off-by: Servaas Vandenberghe
---
 hw/xfree86/modes/xf86Crtc.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index f9ae465..1d15a46 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1832,17 +1832,21 @@ SetCompatOutput(xf86CrtcConfigPtr config)
     }
 
     if (compat >= 0) {
-        config->compat_output = compat;
+        if (compat != config->compat_output) {
+            config->compat_output = compat;
+            /* Set screen scrn->monitor info. */
+            xf86SetDDCproperties(output->scrn, output->MonInfo);
+        }
     }
     else if (config->compat_output >= 0 && config->compat_output < config->num_output) {
         /* Don't change the compat output when no valid outputs found */
         output = config->output[config->compat_output];
     }
-
-    /* All outputs are disconnected, select one to fake */
-    if (!output && config->num_output) {
+    else if (config->num_output > 0) {
+        /* All outputs are disconnected, select one to fake */
         config->compat_output = 0;
         output = config->output[config->compat_output];
+        xf86SetDDCproperties(output->scrn, output->MonInfo);
     }
 
     return output;
@@ -2174,7 +2178,7 @@ xf86TargetFallback(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
     DisplayModePtr target_mode = NULL;
     Rotation target_rotation = RR_Rotate_0;
     DisplayModePtr default_mode;
-    int default_preferred, target_preferred = 0, o;
+    int default_preferred, target_preferred = 0, target_output, o;
 
     /* User preferred > preferred > other modes */
     for (o = -1; nextEnabledOutput(config, enabled, &o);) {
@@ -2189,12 +2193,12 @@ xf86TargetFallback(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
             target_mode = default_mode;
             target_preferred = default_preferred;
             target_rotation = config->output[o]->initial_rotation;
-            config->compat_output = o;
+            target_output = o;
         }
     }
 
     if (target_mode)
-        modes[config->compat_output] = target_mode;
+        modes[target_output] = target_mode;
 
     /* Fill in other output modes */
     for (o = -1; nextEnabledOutput(config, enabled, &o);) {
-- 
1.7.4.5



More information about the xorg-devel mailing list