rpms/xorg-x11-server/devel xorg-x11-server-1.1.1-mode-sort-kung-fu.patch, NONE, 1.1 xorg-x11-server-1.1.1-infer-virtual.patch, 1.3, 1.4 xorg-x11-server.spec, 1.154, 1.155

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Fri Aug 25 01:21:38 UTC 2006


Author: ajackson

Update of /cvs/dist/rpms/xorg-x11-server/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv20575

Modified Files:
	xorg-x11-server-1.1.1-infer-virtual.patch xorg-x11-server.spec 
Added Files:
	xorg-x11-server-1.1.1-mode-sort-kung-fu.patch 
Log Message:
* Thu Aug 24 2006 Adam Jackson <ajackson at redhat.com> - 1.1.1-28.fc6
- xorg-x11-server-1.1.1-infer-virtual.patch: Only flag modes as preferred
  if the EDID block says to.
- xorg-x11-server-1.1.1-mode-sort-kung-fu.patch: Enforce a sort order on
  modes during lookup: builtin before driver before userdef before other,
  and preferred modes within a class before others in that class.


xorg-x11-server-1.1.1-mode-sort-kung-fu.patch:
 xf86Mode.c |  254 +++++++++++++++++++++++++++++++------------------------------
 1 files changed, 132 insertions(+), 122 deletions(-)

--- NEW FILE xorg-x11-server-1.1.1-mode-sort-kung-fu.patch ---
--- xorg-server-1.1.1/hw/xfree86/common/xf86Mode.c.jx	2006-08-22 13:07:49.000000000 -0400
+++ xorg-server-1.1.1/hw/xfree86/common/xf86Mode.c	2006-08-24 17:09:36.000000000 -0400
@@ -429,6 +429,17 @@ xf86LookupMode(ScrnInfoPtr scrp, Display
     ModeStatus status = MODE_NOMODE;
     Bool allowDiv2 = (strategy & LOOKUP_CLKDIV2) != 0;
     Bool haveBuiltin;
+    int n;
+    const int types[] = {
+	M_T_BUILTIN | M_T_PREFERRED,
+	M_T_BUILTIN,
+	M_T_USERDEF | M_T_PREFERRED,
+	M_T_USERDEF,
+	M_T_DRIVER | M_T_PREFERRED,
+	M_T_DRIVER,
+	0
+    };
+    const int ntypes = sizeof(types) / sizeof(int);
 
     strategy &= ~(LOOKUP_CLKDIV2 | LOOKUP_OPTIONAL_TOLERANCES);
 
@@ -448,143 +459,141 @@ xf86LookupMode(ScrnInfoPtr scrp, Display
 	cp->ClockMulFactor = max(1, cp->ClockMulFactor);
     }
 
-    haveBuiltin = FALSE;
     /* Scan the mode pool for matching names */
-    for (p = scrp->modePool; p != NULL; p = p->next) {
-	if (strcmp(p->name, modep->name) == 0) {
-	    /*
-	     * Requested mode is a built-in mode. Don't let the user
-	     * override it.
-	     * Since built-in modes always come before user specified
-	     * modes it will always be found first.  
-	     */
-	    if (p->type & M_T_BUILTIN) {
-		haveBuiltin = TRUE;
-	    }
+    for (n = 0; n < ntypes; n++) {
+	int type = types[n];
+	for (p = scrp->modePool; p != NULL; p = p->next) {
 
-	    if (haveBuiltin && !(p->type & M_T_BUILTIN))
+	    /* scan through the modes in the sort order above */
+	    if ((p->type & type) != type)
 		continue;
 
-	    /* Skip over previously rejected modes */
-	    if (p->status != MODE_OK) {
-		if (!found)
-		    status = p->status;
-		continue;
-	    }
-		
-	    /* Skip over previously considered modes */
-	    if (p->prev)
-		continue;
+	    if (strcmp(p->name, modep->name) == 0) {
 
-	    if (p->type & M_T_BUILTIN) {
-		return xf86HandleBuiltinMode(scrp, p,modep, clockRanges,
-					     allowDiv2);
-	    }
+		/* Skip over previously rejected modes */
+		if (p->status != MODE_OK) {
+		    if (!found)
+			status = p->status;
+		    continue;
+		}
 
-	    /* Check clock is in range */
-	    cp = xf86FindClockRangeForMode(clockRanges, p);
-	    if (cp == NULL) {
-		/*
-		 * XXX Could do more here to provide a more detailed
-		 * reason for not finding a mode.
-		 */
-		p->status = MODE_CLOCK_RANGE;
-		if (!found)
-		    status = MODE_CLOCK_RANGE;
-		continue;
-	    }
+		/* Skip over previously considered modes */
+		if (p->prev)
+		    continue;
 
-	    /*
-	     * If programmable clock and strategy is not LOOKUP_BEST_REFRESH,
-	     * the required mode has been found, otherwise record the refresh
-	     * and continue looking.
-	     */
-	    if (scrp->progClock) {
-		found = TRUE;
-		if (strategy != LOOKUP_BEST_REFRESH) {
-		    bestMode = p;
-		    DivFactor = cp->ClockDivFactor;
-		    MulFactor = cp->ClockMulFactor;
-		    ModePrivFlags = cp->PrivFlags;
-		    break;
+		if (p->type & M_T_BUILTIN) {
+		    return xf86HandleBuiltinMode(scrp, p,modep, clockRanges,
+			    allowDiv2);
 		}
-		refresh = ModeVRefresh(p);
-		if (p->Flags & V_INTERLACE)
-		    refresh /= INTERLACE_REFRESH_WEIGHT;
-		if (refresh > bestRefresh) {
-		    bestMode = p;
-		    DivFactor = cp->ClockDivFactor;
-		    MulFactor = cp->ClockMulFactor;
-		    ModePrivFlags = cp->PrivFlags;
-		    bestRefresh = refresh;
+
+		/* Check clock is in range */
+		cp = xf86FindClockRangeForMode(clockRanges, p);
+		if (cp == NULL) {
+		    /*
+		     * XXX Could do more here to provide a more detailed
+		     * reason for not finding a mode.
+		     */
+		    p->status = MODE_CLOCK_RANGE;
+		    if (!found)
+			status = MODE_CLOCK_RANGE;
+		    continue;
 		}
-		continue;
-	    }
 
-	    /*
-	     * Clock is in range, so if it is not a programmable clock, find
-	     * a matching clock.
-	     */
+		/*
+		 * If programmable clock and strategy is not
+		 * LOOKUP_BEST_REFRESH, the required mode has been found,
+		 * otherwise record the refresh and continue looking.
+		 */
+		if (scrp->progClock) {
+		    found = TRUE;
+		    if (strategy != LOOKUP_BEST_REFRESH) {
+			bestMode = p;
+			DivFactor = cp->ClockDivFactor;
+			MulFactor = cp->ClockMulFactor;
+			ModePrivFlags = cp->PrivFlags;
+			break;
+		    }
+		    refresh = ModeVRefresh(p);
+		    if (p->Flags & V_INTERLACE)
+			refresh /= INTERLACE_REFRESH_WEIGHT;
+		    if (refresh > bestRefresh) {
+			bestMode = p;
+			DivFactor = cp->ClockDivFactor;
+			MulFactor = cp->ClockMulFactor;
+			ModePrivFlags = cp->PrivFlags;
+			bestRefresh = refresh;
+		    }
+		    continue;
+		}
 
-	    i = xf86GetNearestClock(scrp, p->Clock, allowDiv2,
-		cp->ClockDivFactor, cp->ClockMulFactor, &k);
-	    /*
-	     * If the clock is too far from the requested clock, this
-	     * mode is no good.
-	     */
-	    if (k & V_CLKDIV2)
-		gap = abs((p->Clock * 2) -
-		    ((scrp->clock[i] * cp->ClockDivFactor) / cp->ClockMulFactor));
-	    else
-		gap = abs(p->Clock -
-		    ((scrp->clock[i] * cp->ClockDivFactor) / cp->ClockMulFactor));
-	    if (gap > minimumGap) {
-		p->status = MODE_NOCLOCK;
-		if (!found)
-		    status = MODE_NOCLOCK;
-		continue;
-	    }
-	    found = TRUE;
+		/*
+		 * Clock is in range, so if it is not a programmable clock, find
+		 * a matching clock.
+		 */
 
-	    if (strategy == LOOKUP_BEST_REFRESH) {
-		refresh = ModeVRefresh(p);
-		if (p->Flags & V_INTERLACE)
-		    refresh /= INTERLACE_REFRESH_WEIGHT;
-		if (refresh > bestRefresh) {
-		    bestMode = p;
-		    DivFactor = cp->ClockDivFactor;
-		    MulFactor = cp->ClockMulFactor;
-		    ModePrivFlags = cp->PrivFlags;
-		    extraFlags = k;
-		    clockIndex = i;
-		    bestRefresh = refresh;
+		i = xf86GetNearestClock(scrp, p->Clock, allowDiv2,
+			cp->ClockDivFactor, cp->ClockMulFactor, &k);
+		/*
+		 * If the clock is too far from the requested clock, this
+		 * mode is no good.
+		 */
+		if (k & V_CLKDIV2)
+		    gap = abs((p->Clock * 2) -
+			    ((scrp->clock[i] * cp->ClockDivFactor) /
+				cp->ClockMulFactor));
+		else
+		    gap = abs(p->Clock -
+			    ((scrp->clock[i] * cp->ClockDivFactor) /
+				cp->ClockMulFactor));
+		if (gap > minimumGap) {
+		    p->status = MODE_NOCLOCK;
+		    if (!found)
+			status = MODE_NOCLOCK;
+		    continue;
 		}
-		continue;
-	    }
-	    if (strategy == LOOKUP_CLOSEST_CLOCK) {
-		if (gap < minimumGap) {
-		    bestMode = p;
-		    DivFactor = cp->ClockDivFactor;
-		    MulFactor = cp->ClockMulFactor;
-		    ModePrivFlags = cp->PrivFlags;
-		    extraFlags = k;
-		    clockIndex = i;
-		    minimumGap = gap;
+		found = TRUE;
+
+		if (strategy == LOOKUP_BEST_REFRESH) {
+		    refresh = ModeVRefresh(p);
+		    if (p->Flags & V_INTERLACE)
+			refresh /= INTERLACE_REFRESH_WEIGHT;
+		    if (refresh > bestRefresh) {
+			bestMode = p;
+			DivFactor = cp->ClockDivFactor;
+			MulFactor = cp->ClockMulFactor;
+			ModePrivFlags = cp->PrivFlags;
+			extraFlags = k;
+			clockIndex = i;
+			bestRefresh = refresh;
+		    }
+		    continue;
 		}
-		continue;
+		if (strategy == LOOKUP_CLOSEST_CLOCK) {
+		    if (gap < minimumGap) {
+			bestMode = p;
+			DivFactor = cp->ClockDivFactor;
+			MulFactor = cp->ClockMulFactor;
+			ModePrivFlags = cp->PrivFlags;
+			extraFlags = k;
+			clockIndex = i;
+			minimumGap = gap;
+		    }
+		    continue;
+		}
+		/*
+		 * If strategy is neither LOOKUP_BEST_REFRESH or
+		 * LOOKUP_CLOSEST_CLOCK the required mode has been found.
+		 */
+		bestMode = p;
+		DivFactor = cp->ClockDivFactor;
+		MulFactor = cp->ClockMulFactor;
+		ModePrivFlags = cp->PrivFlags;
+		extraFlags = k;
+		clockIndex = i;
+		break;
 	    }
-	    /*
-	     * If strategy is neither LOOKUP_BEST_REFRESH or
-	     * LOOKUP_CLOSEST_CLOCK the required mode has been found.
-	     */
-	    bestMode = p;
-	    DivFactor = cp->ClockDivFactor;
-	    MulFactor = cp->ClockMulFactor;
-	    ModePrivFlags = cp->PrivFlags;
-	    extraFlags = k;
-	    clockIndex = i;
-	    break;
 	}
+	if (found) break;
     }
     if (!found || bestMode == NULL)
 	return status;
@@ -595,7 +604,8 @@ xf86LookupMode(ScrnInfoPtr scrp, Display
 	modep->ClockIndex	= -1;
 	modep->SynthClock	= (modep->Clock * MulFactor) / DivFactor;
     } else {
-	modep->Clock		= (scrp->clock[clockIndex] * DivFactor) / MulFactor;
+	modep->Clock		= (scrp->clock[clockIndex] * DivFactor) /
+				    MulFactor;
 	modep->ClockIndex	= clockIndex;
 	modep->SynthClock	= scrp->clock[clockIndex];
 	if (extraFlags & V_CLKDIV2) {

xorg-x11-server-1.1.1-infer-virtual.patch:
 common/xf86Mode.c |  135 +++++++++++++++++++++++++++++++++---------------------
 common/xf86str.h  |    2 
 ddc/ddcProperty.c |   23 ++++++---
 3 files changed, 101 insertions(+), 59 deletions(-)

Index: xorg-x11-server-1.1.1-infer-virtual.patch
===================================================================
RCS file: /cvs/dist/rpms/xorg-x11-server/devel/xorg-x11-server-1.1.1-infer-virtual.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- xorg-x11-server-1.1.1-infer-virtual.patch	18 Aug 2006 00:52:50 -0000	1.3
+++ xorg-x11-server-1.1.1-infer-virtual.patch	25 Aug 2006 01:21:32 -0000	1.4
@@ -1,6 +1,6 @@
---- xorg-server-1.1.1/hw/xfree86/common/xf86str.h.infer-virtual	2006-08-17 16:55:43.000000000 -0400
-+++ xorg-server-1.1.1/hw/xfree86/common/xf86str.h	2006-08-17 16:55:43.000000000 -0400
-@@ -125,8 +125,10 @@
+--- xorg-server-1.1.1/hw/xfree86/common/xf86str.h.infer-virtual	2006-08-24 19:05:24.000000000 -0400
++++ xorg-server-1.1.1/hw/xfree86/common/xf86str.h	2006-08-24 19:05:24.000000000 -0400
+@@ -125,8 +125,10 @@ typedef enum {
  # define M_T_CRTC_C  (0x04 | M_T_BUILTIN) /* built-in mode - configure CRTC  */
  # define M_T_CLOCK_CRTC_C  (M_T_CLOCK_C | M_T_CRTC_C)
                                 /* built-in mode - configure CRTC and clock */
@@ -11,8 +11,8 @@
  
  /* Video mode */
  typedef struct _DisplayModeRec {
---- xorg-server-1.1.1/hw/xfree86/common/xf86Mode.c.infer-virtual	2006-08-17 16:55:43.000000000 -0400
-+++ xorg-server-1.1.1/hw/xfree86/common/xf86Mode.c	2006-08-17 17:13:50.000000000 -0400
+--- xorg-server-1.1.1/hw/xfree86/common/xf86Mode.c.infer-virtual	2006-08-24 19:05:24.000000000 -0400
++++ xorg-server-1.1.1/hw/xfree86/common/xf86Mode.c	2006-08-24 19:05:24.000000000 -0400
 @@ -47,6 +47,7 @@
  #include "globals.h"
  #include "xf86.h"
@@ -21,7 +21,7 @@
  
  /*
   * xf86GetNearestClock --
-@@ -1163,6 +1164,77 @@
+@@ -1163,6 +1164,77 @@ xf86CheckModeForDriver(ScrnInfoPtr scrp,
      return MODE_OK;
  }
  
@@ -99,7 +99,7 @@
  /*
   * xf86ValidateModes
   *
-@@ -1426,6 +1498,12 @@
+@@ -1426,6 +1498,12 @@ xf86ValidateModes(ScrnInfoPtr scrp, Disp
  	virtX = virtualX;
  	virtY = virtualY;
  	scrp->virtualFrom = X_CONFIG;
@@ -112,7 +112,7 @@
      }
  
      /* Print clock ranges and scaled clocks */
-@@ -1442,7 +1520,7 @@
+@@ -1442,7 +1520,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, Disp
  	for (p = availModes; p != NULL; p = p->next) {
  	    status = xf86InitialCheckModeForDriver(scrp, p, clockRanges,
  						   strategy, maxPitch,
@@ -121,7 +121,7 @@
  
  	    if (status == MODE_OK) {
  		status = xf86CheckModeForMonitor(p, scrp->monitor);
-@@ -1462,18 +1540,7 @@
+@@ -1462,18 +1540,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, Disp
  		q->name = xnfstrdup(p->name);
  	        q->status = MODE_OK;
  	    } else {
@@ -141,7 +141,7 @@
  	    }
  	}
  
-@@ -1615,18 +1682,7 @@
+@@ -1615,18 +1682,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, Disp
  	repeat = FALSE;
      lookupNext:
  	if (repeat && ((status = p->status) != MODE_OK)) {
@@ -161,7 +161,7 @@
  	}
  	saveType = p->type;
  	status = xf86LookupMode(scrp, p, clockRanges, strategy);
-@@ -1634,18 +1690,7 @@
+@@ -1634,18 +1690,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, Disp
  	    continue;
  	}
  	if (status != MODE_OK) {
@@ -181,7 +181,7 @@
  	}
  	if (status == MODE_ERROR) {
  	    ErrorF("xf86ValidateModes: "
-@@ -1841,20 +1886,6 @@
+@@ -1841,20 +1886,6 @@ xf86PruneDriverModes(ScrnInfoPtr scrp)
  	    return;
  	n = p->next;
  	if (p->status != MODE_OK) {
@@ -202,7 +202,7 @@
  	    xf86DeleteMode(&(scrp->modes), p);
  	}
  	p = n;
-@@ -1991,6 +2022,8 @@
+@@ -1991,6 +2022,8 @@ xf86PrintModes(ScrnInfoPtr scrp)
  	    prefix = "Built-in mode";
  	else if (p->type & M_T_DEFAULT)
  	    prefix = "Default mode";
@@ -211,9 +211,9 @@
  	else
  	    prefix = "Mode";
  	if (p->type & M_T_USERDEF)
---- xorg-server-1.1.1/hw/xfree86/ddc/ddcProperty.c.infer-virtual	2006-08-17 16:55:43.000000000 -0400
-+++ xorg-server-1.1.1/hw/xfree86/ddc/ddcProperty.c	2006-08-17 16:55:43.000000000 -0400
-@@ -127,9 +127,8 @@
+--- xorg-server-1.1.1/hw/xfree86/ddc/ddcProperty.c.infer-virtual	2006-08-24 19:05:24.000000000 -0400
++++ xorg-server-1.1.1/hw/xfree86/ddc/ddcProperty.c	2006-08-24 19:06:44.000000000 -0400
+@@ -127,9 +127,8 @@ PrintModeline(int scrnIndex,DisplayModeP
  /*
   * TODO:
   *  - for those with access to the VESA DMT standard; review please.
@@ -224,7 +224,7 @@
  #define MODESUFFIX   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0
  
  DisplayModeRec DDCEstablishedModes[17] = {
-@@ -182,6 +181,7 @@
+@@ -182,6 +181,7 @@ DDCModesFromStandardTiming(int scrnIndex
          if (timing[i].hsize && timing[i].vsize && timing[i].refresh) {
              Mode =  xf86CVTMode(timing[i].hsize, timing[i].vsize,
                                  timing[i].refresh, FALSE, FALSE);
@@ -232,7 +232,7 @@
              Modes = xf86ModesAdd(Modes, Mode);
          }
  
-@@ -192,7 +192,8 @@
+@@ -192,7 +192,8 @@ DDCModesFromStandardTiming(int scrnIndex
   *
   */
  static DisplayModePtr
@@ -242,7 +242,7 @@
  {
      DisplayModePtr Mode;
  
-@@ -205,9 +206,8 @@
+@@ -205,9 +206,8 @@ DDCModeFromDetailedTiming(int scrnIndex,
      
      /* We only do seperate sync currently */
      if (timing->sync != 0x03) {
@@ -254,7 +254,7 @@
      }
      
      Mode = xnfalloc(sizeof(DisplayModeRec));
-@@ -217,7 +217,9 @@
+@@ -217,7 +217,9 @@ DDCModeFromDetailedTiming(int scrnIndex,
      xf86snprintf(Mode->name, 20, "%dx%d", timing->h_active,
                   timing->v_active);
      
@@ -265,15 +265,23 @@
      
      Mode->Clock = timing->clock / 1000.0;
      
-@@ -302,6 +304,7 @@
+@@ -302,12 +304,15 @@ xf86DDCMonitorSet(int scrnIndex, MonPtr 
      DisplayModePtr Modes = NULL, Mode;
      int i, clock;
      Bool have_hsync = FALSE, have_vrefresh = FALSE;
-+    int preferred = 1;
++    int preferred;
      
      if (!Monitor || !DDC)
          return;
-@@ -382,7 +385,9 @@
+ 
+     Monitor->DDC = DDC;
+ 
++    preferred = PREFERRED_TIMING_MODE(DDC->features.msc);
++
+     /*
+      * Don't want to fill this in yet, drivers will (wrongly!) set their
+      * gamma ramp based on this info.
+@@ -382,7 +387,9 @@ xf86DDCMonitorSet(int scrnIndex, MonPtr 
              break;
          case DT:
              Mode = DDCModeFromDetailedTiming(scrnIndex, 


Index: xorg-x11-server.spec
===================================================================
RCS file: /cvs/dist/rpms/xorg-x11-server/devel/xorg-x11-server.spec,v
retrieving revision 1.154
retrieving revision 1.155
diff -u -r1.154 -r1.155
--- xorg-x11-server.spec	22 Aug 2006 18:27:22 -0000	1.154
+++ xorg-x11-server.spec	25 Aug 2006 01:21:32 -0000	1.155
@@ -68,6 +68,7 @@
 Patch3012:  xorg-x11-server-1.1.1-always-mouse-thyself.patch
 Patch3013:  xorg-x11-server-1.1.1-fix-default-mouse-device-yet-again.patch
 Patch3014:  xorg-x11-server-1.1.1-infer-virtual.patch
+Patch3015:  xorg-x11-server-1.1.1-mode-sort-kung-fu.patch
 
 %define moduledir	%{_libdir}/xorg/modules
 %define drimoduledir	%{_libdir}/dri
@@ -372,6 +373,7 @@
 %patch3012 -p1 -b .mouse-thyself
 %patch3013 -p1 -b .mouse-device
 %patch3014 -p1 -b .infer-virtual
+%patch3015 -p1 -b .sort-modes
 
 %build
 #FONTDIR="${datadir}/X11/fonts"
@@ -701,6 +703,13 @@
 # -------------------------------------------------------------------
 
 %changelog
+* Thu Aug 24 2006 Adam Jackson <ajackson at redhat.com> - 1.1.1-28.fc6
+- xorg-x11-server-1.1.1-infer-virtual.patch: Only flag modes as preferred
+  if the EDID block says to.
+- xorg-x11-server-1.1.1-mode-sort-kung-fu.patch: Enforce a sort order on
+  modes during lookup: builtin before driver before userdef before other,
+  and preferred modes within a class before others in that class.
+
 * Tue Aug 22 2006 Adam Jackson <ajackson at redhat.com> - 1.1.1-27.fc6
 - xorg-x11-server-1.1.1-edid-quirks-list.patch: Don't set an arbitrary
   pixclock limit if the monitor didn't claim to have one.




More information about the fedora-cvs-commits mailing list