xserver: Branch 'server-1.5-branch'

Adam Jackson ajax at kemper.freedesktop.org
Fri Mar 14 11:25:31 PDT 2008


 hw/xfree86/modes/xf86Crtc.c |   51 +++++++++++++++++++++++---------------------
 1 file changed, 27 insertions(+), 24 deletions(-)

New commits:
commit 43739b9a32cbe45139935bbeb39aecf7b7dd017c
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Mar 14 14:24:21 2008 -0400

    RANDR 1.2: Fix initial mode aspect ratio match in a corner case.
    
    Actually more like in the mainline case, where the ideal mode happens to
    be the very first aspect match on the first monitor.  But let's not
    split hairs.
    (cherry picked from commit 824853772241acf64bc37ac8b85254194741ae13)

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 0bef5b4..2b07421 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1674,14 +1674,19 @@ aspectMatch(float a, float b)
 }
 
 static DisplayModePtr
-nextAspectMode(DisplayModePtr start, float aspect)
+nextAspectMode(xf86OutputPtr o, DisplayModePtr last, float aspect)
 {
-    DisplayModePtr m = start;
+    DisplayModePtr m = NULL;
 
-    if (!m)
+    if (!o)
 	return NULL;
 
-    for (m = m->next; m; m = m->next)
+    if (!last)
+	m = o->probed_modes;
+    else
+	m = last->next;
+
+    for (; m; m = m->next)
 	if (aspectMatch(aspect, (float)m->HDisplay / (float)m->VDisplay))
 	    return m;
 
@@ -1691,31 +1696,29 @@ nextAspectMode(DisplayModePtr start, float aspect)
 static DisplayModePtr
 bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect)
 {
-    int o, p;
-    DisplayModePtr mode, test = NULL, match = NULL;
+    int o = -1, p;
+    DisplayModePtr mode = NULL, test = NULL, match = NULL;
 
-    for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
-	mode = config->output[o]->probed_modes;
-	while ((mode = nextAspectMode(mode, aspect))) {
-	    for (p = o; nextEnabledOutput(config, enabled, &p); ) {
-		test = xf86OutputFindClosestMode(config->output[p], mode);
-		if (!test)
-		    break;
-		if (test->HDisplay != mode->HDisplay ||
+    nextEnabledOutput(config, enabled, &o);
+    while ((mode = nextAspectMode(config->output[o], mode, aspect))) {
+	for (p = o; nextEnabledOutput(config, enabled, &p); ) {
+	    test = xf86OutputFindClosestMode(config->output[p], mode);
+	    if (!test)
+		break;
+	    if (test->HDisplay != mode->HDisplay ||
 		    test->VDisplay != mode->VDisplay) {
-		    test = NULL;
-		    break;
-		}
+		test = NULL;
+		break;
 	    }
+	}
 
-	    /* if we didn't match it on all outputs, try the next one */
-	    if (!test)
-		continue;
+	/* if we didn't match it on all outputs, try the next one */
+	if (!test)
+	    continue;
 
-	    /* if it's bigger than the last one, save it */
-	    if (!match || (test->HDisplay > match->HDisplay))
-		match = test;
-	}
+	/* if it's bigger than the last one, save it */
+	if (!match || (test->HDisplay > match->HDisplay))
+	    match = test;
     }
 
     /* return the biggest one found */


More information about the xorg-commit mailing list