summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2009-02-05 16:09:32 -0500
committerAdam Jackson <ajax@redhat.com>2009-02-05 16:15:11 -0500
commit817fb65fc3a95d6c34952f241c92ba2d3760968e (patch)
tree8367f390fd25628da85be23abcd92dbe6e74fc2e
parent5522f06c2305d52b12d6934133f46f7b7927ebf7 (diff)
downloadxorg-driver-xf86-video-vesa-817fb65fc3a95d6c34952f241c92ba2d3760968e.tar.gz
Add yet another pass to mode validation.
Now it's: exact intersection, range based, optimistic range based. The final pass tries to stretch out the bottom of the sync ranges to fit down to 640x480. We'll skip the last pass if the sync range is already that optimistic though.
-rw-r--r--src/vesa.c54
1 files changed, 40 insertions, 14 deletions
diff --git a/src/vesa.c b/src/vesa.c
index 2e1b2f7..aee5018 100644
--- a/src/vesa.c
+++ b/src/vesa.c
@@ -536,6 +536,22 @@ VESAFreeRec(ScrnInfoPtr pScrn)
pScrn->driverPrivate = NULL;
}
+static int
+VESAValidateModes(ScrnInfoPtr pScrn)
+{
+ VESAPtr pVesa = VESAGetRec(pScrn);
+ DisplayModePtr mode;
+
+ for (mode = pScrn->monitor->Modes; mode; mode = mode->next)
+ mode->status = MODE_OK;
+
+ return VBEValidateModes(pScrn, NULL, pScrn->display->modes,
+ NULL, NULL, 0, 2048, 1, 0, 2048,
+ pScrn->display->virtualX,
+ pScrn->display->virtualY,
+ pVesa->mapSize, LOOKUP_BEST_REFRESH);
+}
+
/*
* This function is called once for each screen at the start of the first
* server generation to initialise the screen for all server generations.
@@ -682,27 +698,37 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags)
VBESetModeNames(pScrn->modePool);
pVesa->strict_validation = TRUE;
- i = VBEValidateModes(pScrn, NULL, pScrn->display->modes,
- NULL, NULL, 0, 2048, 1, 0, 2048,
- pScrn->display->virtualX,
- pScrn->display->virtualY,
- pVesa->mapSize, LOOKUP_BEST_REFRESH);
+ i = VESAValidateModes(pScrn);
if (i <= 0) {
- DisplayModePtr mode;
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "No valid modes left. Trying less strict filter...\n");
- for (mode = pScrn->monitor->Modes; mode; mode = mode->next)
- mode->status = MODE_OK;
+ "No valid modes left. Trying less strict filter...\n");
pVesa->strict_validation = FALSE;
- i = VBEValidateModes(pScrn, NULL, pScrn->display->modes,
- NULL, NULL, 0, 2048, 1, 0, 2048,
- pScrn->display->virtualX,
- pScrn->display->virtualY,
- pVesa->mapSize, LOOKUP_BEST_REFRESH);
+ i = VESAValidateModes(pScrn);
}
+ if (i <= 0) do {
+ Bool changed = FALSE;
+ /* maybe there's more modes at the bottom... */
+ if (pScrn->monitor->vrefresh[0].lo > 50) {
+ changed = TRUE;
+ pScrn->monitor->vrefresh[0].lo = 50;
+ }
+ if (pScrn->monitor->hsync[0].lo > 31.5) {
+ changed = TRUE;
+ pScrn->monitor->hsync[0].lo = 31.5;
+ }
+
+ if (!changed)
+ break;
+
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "No valid modes left. Trying aggressive sync range...\n");
+ i = VESAValidateModes(pScrn);
+ } while (0);
+
if (i <= 0) {
+ /* alright, i'm out of ideas */
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes\n");
vbeFree(pVesa->pVbe);
return (FALSE);