diff options
author | Luc Verhaegen <libv@skynet.be> | 2005-12-19 10:33:43 +0000 |
---|---|---|
committer | Luc Verhaegen <libv@skynet.be> | 2005-12-19 10:33:43 +0000 |
commit | 1a695ccb88445d75d48c3795dabd8241a5b93537 (patch) | |
tree | acb3efd0569d9af877fd5db0434b0b91c2645fc8 | |
parent | ab8672209c8597859e33ceb4d5bbc4ad4fd103d3 (diff) |
[devel-SetOverScan] Set overscan colour.
-rw-r--r-- | src/via_mode.c | 64 |
1 files changed, 45 insertions, 19 deletions
diff --git a/src/via_mode.c b/src/via_mode.c index 1b6be95..6219f08 100644 --- a/src/via_mode.c +++ b/src/via_mode.c @@ -930,7 +930,6 @@ ViaModeSecondaryVGAValid(ScrnInfoPtr pScrn, DisplayModePtr mode) return MODE_OK; } - /* * */ @@ -982,6 +981,44 @@ ViaValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) return MODE_OK; } +/* + * If we don't do this, then some modes, which have too long a blanking + * range, will have a blue band or should not be allowed by validation. + */ +static void +ViaVGAOverscanSet(ScrnInfoPtr pScrn) +{ + vgaHWPtr hwp = VGAHWPTR(pScrn); + CARD8 Red, Green, Blue; + int i; + + VIAFUNC(pScrn->scrnIndex); + + hwp->enablePalette(hwp); + hwp->writeDacMask(hwp, 0xFF); + + hwp->writeDacReadAddr(hwp, 0x00); + for (i = 0; i <= 0xFF; i++) { + Red = hwp->readDacData(hwp); + Green = hwp->readDacData(hwp); + Blue = hwp->readDacData(hwp); + + if (!Red && !Green && !Blue) + break; + } + + if (i > 0xFF) { /* Black not found */ + hwp->writeDacWriteAddr(hwp, 0x0F); + + hwp->writeDacData(hwp, 0x00); + hwp->writeDacData(hwp, 0x00); + hwp->writeDacData(hwp, 0x00); + + i = 0x0F;hwp->writeAttr(hwp, 0x11, 0x0F); + } + + hwp->writeAttr(hwp, 0x11, i); +} /* * @@ -1084,6 +1121,8 @@ ViaModePrimaryVGA(ScrnInfoPtr pScrn, DisplayModePtr mode) hwp->writeAttr(hwp, 0x13, 0x00); hwp->writeAttr(hwp, 0x14, 0x00); + ViaVGAOverscanSet(pScrn); + /* Crtc registers */ /* horizontal total : 4100 */ ViaDebug(pScrn->scrnIndex, "CrtcHTotal: 0x%03X\n", mode->CrtcHTotal); @@ -1098,19 +1137,12 @@ ViaModePrimaryVGA(ScrnInfoPtr pScrn, DisplayModePtr mode) /* horizontal blanking start : 2048 */ ViaDebug(pScrn->scrnIndex, "CrtcHBlankStart: 0x%03X\n", mode->CrtcHBlankStart); - if (mode->CrtcHBlankStart != mode->CrtcHDisplay) /* FIX ME */ - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Caught X working around an old VGA " - "limitation (HBlankStart).\n"); - temp = (mode->CrtcHDisplay >> 3) - 1; + temp = (mode->CrtcHBlankStart >> 3) - 1; hwp->writeCrtc(hwp, 0x02, temp & 0xFF); - /* If HblankStart has more bits anywhere, add them here */ /* horizontal blanking end : start + 1025 */ ViaDebug(pScrn->scrnIndex, "CrtcHBlankEnd: 0x%03X\n", mode->CrtcHBlankEnd); - if (mode->CrtcHBlankEnd != mode->CrtcHTotal) /* FIX ME */ - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Caught X working around an old VGA " - "limitation (HBlankEnd).\n"); - temp = (mode->CrtcHTotal >> 3) - 1; + temp = (mode->CrtcHBlankEnd >> 3) - 1; ViaCrtcMask(hwp, 0x03, temp, 0x1F); ViaCrtcMask(hwp, 0x05, temp << 2, 0x80); ViaCrtcMask(hwp, 0x33, temp >> 1, 0x20); @@ -1148,7 +1180,7 @@ ViaModePrimaryVGA(ScrnInfoPtr pScrn, DisplayModePtr mode) hwp->writeCrtc(hwp, 0x0C, 0x00); hwp->writeCrtc(hwp, 0x0D, 0x00); hwp->writeCrtc(hwp, 0x34, 0x00); - ViaCrtcMask(hwp, 0x48, 0x00, 0x03); /* is this even possible on VT3122A ? */ + ViaCrtcMask(hwp, 0x48, 0x00, 0x03); /* vertical sync start : 2047 */ ViaDebug(pScrn->scrnIndex, "CrtcVSyncStart: 0x%03X\n", mode->CrtcVSyncStart); @@ -1175,10 +1207,7 @@ ViaModePrimaryVGA(ScrnInfoPtr pScrn, DisplayModePtr mode) /* vertical blanking start : 2048 */ ViaDebug(pScrn->scrnIndex, "CrtcVBlankStart: 0x%03X\n", mode->CrtcVBlankStart); - if (mode->CrtcVBlankStart != mode->CrtcVDisplay) /* FIX ME */ - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Caught X working around an old VGA " - "limitation (VBlankStart).\n"); - temp = mode->CrtcVDisplay - 1; + temp = mode->CrtcVBlankStart - 1; hwp->writeCrtc(hwp, 0x15, temp & 0xFF); ViaCrtcMask(hwp, 0x07, temp >> 5, 0x08); ViaCrtcMask(hwp, 0x09, temp >> 4, 0x20); @@ -1186,10 +1215,7 @@ ViaModePrimaryVGA(ScrnInfoPtr pScrn, DisplayModePtr mode) /* vertical blanking end : start + 129 */ ViaDebug(pScrn->scrnIndex, "CrtcVBlankEnd: 0x%03X\n", mode->CrtcVBlankEnd); - if (mode->CrtcVBlankEnd != mode->CrtcVTotal) /* FIX ME */ - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Caught X working around an old VGA " - "limitation (VBlankEnd).\n"); - temp = mode->CrtcVTotal - 1; + temp = mode->CrtcVBlankEnd - 1; hwp->writeCrtc(hwp, 0x16, temp & 0x7F); /* some leftovers */ |