c325f34
--- xf86-video-vesa-1.3.0/src/vesa.c.jx	2007-01-30 10:31:32.000000000 -0500
c325f34
+++ xf86-video-vesa-1.3.0/src/vesa.c	2007-01-30 10:56:15.000000000 -0500
c325f34
@@ -638,8 +638,40 @@
c325f34
 	xf86UnloadSubModule(pDDCModule);
c325f34
     }
c325f34
 
c325f34
-    if ((pScrn->monitor->DDC = pVesa->monitor) != NULL)
c325f34
-	xf86SetDDCproperties(pScrn, pVesa->monitor);
c325f34
+    /* UNCLEAN */
c325f34
+    do {
c325f34
+	Bool had_cfg_ranges, have_ddc_ranges;
c325f34
+
c325f34
+	had_cfg_ranges = (pScrn->monitor->nHsync || pScrn->monitor->nVrefresh);
c325f34
+	if ((pScrn->monitor->DDC = pVesa->monitor) != NULL)
c325f34
+	    xf86SetDDCproperties(pScrn, pVesa->monitor);
c325f34
+	have_ddc_ranges = (pScrn->monitor->nHsync || pScrn->monitor->nVrefresh);
c325f34
+
c325f34
+	if (have_ddc_ranges && !had_cfg_ranges) {
c325f34
+	    int i;
c325f34
+	    for (i = 0; i < DET_TIMINGS; i++) {
c325f34
+		if (pVesa->monitor->det_mon[i].type == DS_RANGES)
c325f34
+		    break;
c325f34
+	    }
c325f34
+	    if (i < DET_TIMINGS)
c325f34
+		break;
c325f34
+
c325f34
+	    /*
c325f34
+	     * DDC added ranges, but they're inferred from the modes, not
c325f34
+	     * copied from a range section.  So in the worst case, where it's
c325f34
+	     * not a range but a single frequency, stretch things out to be
c325f34
+	     * a range.  Panels with only one mode listed in DDC will
c325f34
+	     * otherwise probably not match any VESA modes.  Hooray for
c325f34
+	     * conformance.
c325f34
+	     */
c325f34
+	    if (pScrn->monitor->hsync[0].lo == pScrn->monitor->hsync[0].hi
c325f34
+		 && pScrn->monitor->hsync[0].lo > 31.5)
c325f34
+		pScrn->monitor->hsync[0].lo = 31.5;
c325f34
+	    if (pScrn->monitor->vrefresh[0].lo == pScrn->monitor->vrefresh[0].hi
c325f34
+		 && pScrn->monitor->vrefresh[0].lo > 50.0)
c325f34
+		pScrn->monitor->vrefresh[0].lo = 50;
c325f34
+	}
c325f34
+    } while (0);
c325f34
 
c325f34
     xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DEBUG_VERB,
c325f34
 			"Searching for matching VESA mode(s):\n");