From a42d68da8d3905bc21d426b68519ba0d8356ed7b Mon Sep 17 00:00:00 2001 From: Egbert Eich Date: Tue, 17 May 2005 08:30:00 +0000 Subject: Set the hardware to 8bit CLUT mode in 8 bpp. We used to flag an 8 bit DAC to DDX but did not make sure it actually was running in 8 bit mode. On Savage4 the HW cursor doesn't seem to be truecolor in 8bpp - not even with the streams engine running. Fix SavageProbeDDC() to load vbe module and initialize it before using it (Bugzilla #3309). --- src/savage_cursor.c | 8 ++++++-- src/savage_driver.c | 40 +++++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/savage_cursor.c b/src/savage_cursor.c index ff0136f..be1a6c0 100644 --- a/src/savage_cursor.c +++ b/src/savage_cursor.c @@ -98,8 +98,12 @@ SavageHWCursorInit(ScreenPtr pScreen) ) infoPtr->Flags |= HARDWARE_CURSOR_TRUECOLOR_AT_8BPP; #endif - /* With streams engine the Cursor seems to be ALWAYS TrueColor */ - infoPtr->Flags |= HARDWARE_CURSOR_TRUECOLOR_AT_8BPP; + /* + * With streams engine the Cursor seems to be ALWAYS TrueColor + *except at least the Savage4 + */ + if (psav->Chipset != S3_SAVAGE4) + infoPtr->Flags |= HARDWARE_CURSOR_TRUECOLOR_AT_8BPP; infoPtr->SetCursorColors = SavageSetCursorColors; infoPtr->SetCursorPosition = SavageSetCursorPosition; diff --git a/src/savage_driver.c b/src/savage_driver.c index 08bfc0f..bd335e0 100644 --- a/src/savage_driver.c +++ b/src/savage_driver.c @@ -1089,7 +1089,7 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) xf86CollectOptions(pScrn, NULL); if (pScrn->depth == 8) - pScrn->rgbBits = 8/*6*/; + pScrn->rgbBits = 8; if (!(psav->Options = xalloc(sizeof(SavageOptions)))) return FALSE; @@ -1273,12 +1273,10 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) } psav->EntityIndex = pEnt->index; -#ifdef XFree86LOADER if (xf86LoadSubModule(pScrn, "vbe")) { xf86LoaderReqSymLists(vbeSymbols, NULL); psav->pVbe = VBEInit(NULL, pEnt->index); } -#endif psav->PciInfo = xf86GetPciInfoForEntity(pEnt->index); xf86RegisterResources(pEnt->index, NULL, ResNone); @@ -2362,14 +2360,14 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, VGAOUT8(vgaCRIndex, 0x67); VGAOUT8(vgaCRReg, restore->CR67); - /* Enable gamma correction. */ + /* Enable gamma correction, set CLUT to 8 bit */ VGAOUT8(0x3c4, 0x1b); if( (pScrn->bitsPerPixel == 32) && !psav->DGAactive && ! psav->FBStart2nd ) VGAOUT8(0x3c5, 0x18 ); else - VGAOUT8(0x3c5, 0x00 ); + VGAOUT8(0x3c5, 0x10 ); /* We may need TV/panel fixups here. See s3bios.c line 2904. */ @@ -2668,7 +2666,7 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, VGAOUT8(0x3c5, restore->SR18); VGAOUT8(0x3c4, 0x1b); if( psav->DGAactive ) - VGAOUT8(0x3c5, restore->SR1B & ~0x18); + VGAOUT8(0x3c5, restore->SR1B & ~0x08 ); else VGAOUT8(0x3c5, restore->SR1B); @@ -3445,7 +3443,7 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) TRACE(("SavageModeInit(%dx%d, %dHz)\n", mode->HDisplay, mode->VDisplay, mode->Clock)); - + #if 0 ErrorF("Clock = %d, HDisplay = %d, HSStart = %d\n", mode->Clock, mode->HDisplay, mode->HSyncStart); @@ -3498,11 +3496,13 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) mode->CrtcHDisplay *= 2; mode->CrtcHSyncStart *= 2; mode->CrtcHSyncEnd *= 2; + mode->CrtcHBlankStart *= 2; + mode->CrtcHBlankEnd *= 2; mode->CrtcHTotal *= 2; mode->CrtcHSkew *= 2; mode->CrtcHAdjusted = TRUE; } - + if (!vgaHWInit(pScrn, mode)) return FALSE; @@ -3590,11 +3590,6 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) new->SR15 = 0x03 | 0x80; new->SR18 = 0x00; -/* VGAOUT8(0x3c4, 0x1b); - new->SR1B = VGAIN8(0x3c5); - if( pScrn->depth == 24 ) - new->SR1B |= 0x28; -*/ /* enable gamma correction */ if( pScrn->depth == 24 ) @@ -3602,7 +3597,9 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) else new->SR1B = 0x00; - + /* set 8-bit CLUT */ + new->SR1B |= 0x10; + new->CR43 = new->CR45 = new->CR65 = 0x00; VGAOUT8(vgaCRIndex, 0x40); @@ -3673,7 +3670,7 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) new->CR3B = j & 0xff; i |= (j & 0x100) >> 2; - new->CR3C = (vganew->CRTC[0] + ((i & 0x01) << 8)) / 2; + new->CR3C = (vganew->CRTC[0] + ((i & 0x01) << 8)) / 2 ; new->CR5D = i; new->CR5E = (((mode->CrtcVTotal - 2) & 0x400) >> 10) | (((mode->CrtcVDisplay - 1) & 0x400) >> 9) | @@ -3990,7 +3987,7 @@ void SavageLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, SavagePtr psav = SAVPTR(pScrn); int i, index; int updateKey = -1; - unsigned char byte; + unsigned char byte = 0; /* choose CLUT */ if (psav->IsPrimary) { @@ -4063,7 +4060,6 @@ void SavageLoadPaletteSavage4(ScrnInfoPtr pScrn, int numColors, int *indicies, int i, index; int updateKey = -1; - vgaHWPtr hwp = VGAHWPTR(pScrn); VerticalRetraceWait(); for (i=0; ipVbe, NULL); + vbeInfoPtr pVbe; + + if (xf86LoadSubModule(pScrn, "vbe")) { + xf86LoaderReqSymLists(vbeSymbols, NULL); + pVbe = VBEInit(NULL, index); + ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); + } } static unsigned int -- cgit v1.2.3