From 2cc15aba0bbb540f5562f04a0d39af1dd8dc7ce8 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Tue, 23 Nov 2004 05:21:02 +0000 Subject: - fix and enable HW Cursor on crtc2 - enable independant CLUT access --- src/savage_cursor.c | 22 +++++++++++++--------- src/savage_driver.c | 29 +++++++++++++++++++++-------- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/src/savage_cursor.c b/src/savage_cursor.c index a6acdad..ff0136f 100644 --- a/src/savage_cursor.c +++ b/src/savage_cursor.c @@ -120,11 +120,6 @@ SavageHWCursorInit(ScreenPtr pScreen) return xf86InitCursor(pScreen, infoPtr); } -/* - * Supposedly bit 2 of CR45 enables cursor two (rest of the cursor regs are shadowed via SR26), - * but I can't seem to enable it. For now it's disabled. - AGD - */ - void SavageShowCursor(ScrnInfoPtr pScrn) { @@ -132,7 +127,9 @@ SavageShowCursor(ScrnInfoPtr pScrn) /* Turn cursor on. */ if (psav->IsSecondary) { - outCRReg( 0x45, inCRReg(0x45) | 0x04 ); /* cursor2 bit 2*/ + SelectIGA2(); + outCRReg( 0x45, inCRReg(0x45) | 0x01 ); + SelectIGA1(); } else { outCRReg( 0x45, inCRReg(0x45) | 0x01 ); } @@ -152,7 +149,9 @@ SavageHideCursor(ScrnInfoPtr pScrn) waitHSync(5); } if (psav->IsSecondary) { - outCRReg( 0x45, inCRReg(0x45) & 0xfb ); /* cursor2 */ + SelectIGA2(); + outCRReg( 0x45, inCRReg(0x45) & 0xfe ); /* cursor2 */ + SelectIGA1(); } else { outCRReg( 0x45, inCRReg(0x45) & 0xfe ); } @@ -198,7 +197,7 @@ SavageSetCursorPosition( int y) { SavagePtr psav = SAVPTR(pScrn); - unsigned char xoff, yoff; + unsigned char xoff, yoff, byte; if( S3_SAVAGE4_SERIES( SAVPTR(pScrn)->Chipset ) ) { @@ -251,6 +250,11 @@ SavageSetCursorPosition( outCRReg( 0x4f, yoff ); outCRReg( 0x48, (y & 0xff00)>>8 ); } + + /* fix for HW cursor on crtc2 */ + byte = inCRReg( 0x46 ); + outCRReg( 0x46, byte ); + } @@ -281,8 +285,8 @@ SavageSetCursorColors( if (psav->IsSecondary) { /* cursor 2 */ /* Reset the cursor color stack pointer */ - inCRReg(0x45); SelectIGA2(); + inCRReg(0x45); /* Write low, mid, high bytes - foreground */ outCRReg(0x4a, fg); outCRReg(0x4a, fg >> 8); diff --git a/src/savage_driver.c b/src/savage_driver.c index cdcd097..a76bb26 100644 --- a/src/savage_driver.c +++ b/src/savage_driver.c @@ -1419,12 +1419,6 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) psav->HasCRTC2 = FALSE; } - /* until I figure out why cursor2 doesn't work, disable it for crtc2. -- AGD */ - if (psav->IsSecondary) { - psav->hwcursor = FALSE; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "HWCursor currently disabled for crtc2.\n"); - } - if ((psav->IsSecondary || psav->IsPrimary) && !psav->UseBIOS) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "BIOS currently required for Dualhead mode setting.\n"); @@ -1806,8 +1800,8 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, NULL, - 256, 4095, 16 * pScrn->bitsPerPixel, - 128, 4095, + 256, 2048, 16 * pScrn->bitsPerPixel, + 128, 2048, pScrn->virtualX, pScrn->virtualY, psav->videoRambytes, LOOKUP_BEST_REFRESH); @@ -3767,6 +3761,18 @@ void SavageLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, SavagePtr psav = SAVPTR(pScrn); int i, index; int updateKey = -1; + unsigned char byte; + + /* choose CLUT */ + if (psav->IsPrimary) { + VGAOUT8(0x3c4, 0x47); + byte = VGAIN8(0x3c5); + VGAOUT8(0x3c5, (byte & ~0x03) | 0x01); /* CLUT 1 */ + } else if (psav->IsSecondary) { + VGAOUT8(0x3c4, 0x47); + byte = VGAIN8(0x3c5); + VGAOUT8(0x3c5, (byte & ~0x03) | 0x02); /* CLUT 2 */ + } for (i=0; iIsPrimary || psav->IsSecondary) { + VGAOUT8(0x3c4, 0x47); + VGAOUT8(0x3c5, byte); + } + if (updateKey != -1) SavageUpdateKey(pScrn, colors[updateKey].red, colors[updateKey].green, colors[updateKey].blue); -- cgit v1.2.3