diff options
author | agd5f <agd5f> | 2004-02-09 21:17:44 +0000 |
---|---|---|
committer | agd5f <agd5f> | 2004-02-09 21:17:44 +0000 |
commit | d40327ad0eb791374a14af3727bb9760ba66908e (patch) | |
tree | 1e5558c85fcd3be141f3e1393ce654dccad222ef | |
parent | f3cfae33ca58cb7f0bce439f177c87c2330620f3 (diff) |
- Fix text mode (I ended up using the bios since no other method seemed to work)
- Clean up GBD handling
-rw-r--r-- | xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c | 133 | ||||
-rw-r--r-- | xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c | 53 |
2 files changed, 52 insertions, 134 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c index 686f9f4b4..fedf0ab36 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c @@ -11,6 +11,7 @@ * * Created 20/03/97 by Sebastien Marineau for 3.3.6 * Modified 17-Nov-2000 by Tim Roberts for 4.0.1 + * Modified Feb-2004 by Alex Deucher - integrating DRI support * Revision: * */ @@ -348,18 +349,18 @@ SavageInitialize2DEngine(ScrnInfoPtr pScrn) } void -SavageSetGBD( ScrnInfoPtr pScrn ) +SavageSetGBD(ScrnInfoPtr pScrn) { SavagePtr psav = SAVPTR(pScrn); UnProtectCRTC(); UnLockExtRegs(); VerticalRetraceWait(); - + psav->lDelta = pScrn->virtualX * (pScrn->bitsPerPixel >> 3); /* - * we can use Option "DisableTile" "TURE" to disable tile mode + * we can use Option "DisableTile" "TRUE" to disable tile mode * if don't disable tile,we only support tile mode under 16/32bpp */ if ((!psav->bDisableTile) && ((pScrn->bitsPerPixel == 16) || (pScrn->bitsPerPixel == 32))) { @@ -381,8 +382,8 @@ SavageSetGBD( ScrnInfoPtr pScrn ) psav->ulAperturePitch = psav->lDelta; } - /* if you are using linear mode for 2D, 3D still needs to be tiled, linear AperturePitch - seems to be wrong for savagespan */ + /* if you are using linear mode for 2D, 3D still needs to be tiled, linear AperturePitch/Delta + seem to be wrong for savagespan */ if (psav->Chipset == S3_SAVAGE_MX) psav->ul3DAperturePitch = 0x2000; else @@ -499,14 +500,6 @@ void SavageSetGBD_Twister(ScrnInfoPtr pScrn) ulong ulTmp; uchar byte; - /* Disable BCI */ - OUTREG32(0x48C18, INREG32(0x48C18) & 0x3FF0); - /* Setup BCI command overflow buffer */ - OUTREG32(0x48C14, (psav->cobOffset >> 11) | (psav->cobIndex << 29)); - /* Program shadow status update */ - OUTREG32(0x48C10, 0x0e440f04L); - OUTREG32(0x48C0C, 0); - OUTREG32(0x48C18, INREG32(0x48C18) | 0x0C); /* MM81C0 and 81C4 are used to control primary stream. */ OUTREG32(PRI_STREAM_FBUF_ADDR0,0x00000000); @@ -651,16 +644,8 @@ void SavageSetGBD_Savage4(ScrnInfoPtr pScrn) SavagePtr psav = SAVPTR(pScrn); ulong ulTmp; uchar byte; - - /* Disable BCI */ - OUTREG32(0x48C18, INREG32(0x48C18) & 0x3FF0); - /* Setup BCI command overflow buffer */ - OUTREG32(0x48C14, (psav->cobOffset >> 11) | (psav->cobIndex << 29)); - /* Program shadow status update */ - OUTREG32(0x48C10, 0x0e440f04L); - OUTREG32(0x48C0C, 0); - OUTREG32(0x48C18, INREG32(0x48C18) | 0x0C); - + + /* MM81C0 and 81C4 are used to control primary stream. */ OUTREG32(PRI_STREAM_FBUF_ADDR0,0x00000000); OUTREG32(PRI_STREAM_FBUF_ADDR1,0x00000000); @@ -705,12 +690,11 @@ void SavageSetGBD_Savage4(ScrnInfoPtr pScrn) OUTREG32(0x816C, 8 | S3_LITTLE_ENDIAN | S3_BD64); - if (psav->bTiled) { - /* CR50, bit 7,6,0 = 111, Use GBD.*/ - OUTREG8(CRT_ADDRESS_REG,0X50); - byte = INREG8(CRT_DATA_REG) | 0XC1; - OUTREG8(CRT_DATA_REG, byte); - } + /* CR50, bit 7,6,0 = 111, Use GBD.*/ + OUTREG8(CRT_ADDRESS_REG,0X50); + byte = INREG8(CRT_DATA_REG) | 0XC1; + OUTREG8(CRT_DATA_REG, byte); + /* * if MS1NB style linear tiling mode. @@ -811,28 +795,8 @@ void SavageSetGBD_M7(ScrnInfoPtr pScrn) SavagePtr psav = SAVPTR(pScrn); ulong ulTmp; uchar byte; - /* following is the enable case */ - - /* disable BCI and program the COB,and then enable BCI */ - ulTmp= INREG32(S3_OVERFLOW_BUFFER_PTR); /* 0x48c18 */ - OUTREG32(S3_OVERFLOW_BUFFER_PTR, ulTmp & (~(ENABLE_BCI))); - - /* 0x48c14 - * Bits 0-11 = Bits 22-11 of the Command Buffer Offset. - * Bits 12-28 = Total number of entries in the command buffer(Read only). - * Bits 29-31 = COB size, 111 = 32K entries or 128K bytes - * (each entry is 4 bytes). - */ - OUTREG32(S3_OVERFLOW_BUFFER, - psav->cobOffset >> 11 | 0xE0000000); - - ulTmp = INREG32(S3_OVERFLOW_BUFFER_PTR) & (~(ENABLE_BCI | ENABLE_COMMAND_OVERFLOW_BUF)); - - /* Enable BCI, Enable Command buffer. */ - OUTREG32(S3_OVERFLOW_BUFFER_PTR, - (ulTmp | (ENABLE_BCI | ENABLE_COMMAND_OVERFLOW_BUF))); /* SR01:turn off screen */ OUTREG8 (SEQ_ADDRESS_REG,0x01); @@ -920,12 +884,10 @@ void SavageSetGBD_M7(ScrnInfoPtr pScrn) OUTREG32(0x816C, ENABLE_BCI | S3_LITTLE_ENDIAN | S3_BD64); - if (psav->bTiled) { - /* CR50, bit 7,6,0 = 111, Use GBD.*/ - OUTREG8(CRT_ADDRESS_REG,0X50); - byte = INREG8(CRT_DATA_REG) | 0XC1; - OUTREG8(CRT_DATA_REG, byte); - } + /* CR50, bit 7,6,0 = 111, Use GBD.*/ + OUTREG8(CRT_ADDRESS_REG,0X50); + byte = INREG8(CRT_DATA_REG) | 0XC1; + OUTREG8(CRT_DATA_REG, byte); /* * CR78, bit 3 - Block write enabled(1)/disabled(0). @@ -1025,32 +987,6 @@ void SavageSetGBD_PM(ScrnInfoPtr pScrn) uchar byte; /* following is the enable case */ - - /* disable BCI and program the COB,and then enable BCI */ - ulTmp= INREG32(S3_OVERFLOW_BUFFER_PTR); /* 0x48c18 */ - OUTREG32(S3_OVERFLOW_BUFFER_PTR, ulTmp & (~(ENABLE_BCI))); - - /* - * Bits 14-0 = Bits 25-11 of the Command Buffer Offset. - * Bits 28-15 = Total number of entries in the command buffer(Read only). - * Bits 31-29 = COB size, number of entries (each entry is 4 bytes). - * 000 = 8K entries - * 001 = 16K entries - * 010 = 32K entries - * 011 = 64K entries - * 100 = 128K entries - * 101 = 256K entries - * 110 = 512K entries - * 111 = 1M entries - */ - OUTREG32(S3_OVERFLOW_BUFFER, - (psav->cobOffset >> 11) | 0x40000000);/* 128K,32K entries */ - - ulTmp = INREG32(S3_OVERFLOW_BUFFER_PTR) & (ENABLE_BCI | ENABLE_COMMAND_OVERFLOW_BUF); - - /* Enable BCI, Enable Command buffer. */ - OUTREG32(S3_OVERFLOW_BUFFER_PTR, - (ulTmp | (ENABLE_BCI | ENABLE_COMMAND_OVERFLOW_BUF))); /* SR01:turn off screen */ OUTREG8 (SEQ_ADDRESS_REG,0x01); @@ -1132,12 +1068,10 @@ void SavageSetGBD_PM(ScrnInfoPtr pScrn) /* bit 28:block write disable */ OUTREG32(S3_GLB_BD_HIGH,BCI_ENABLE | S3_BD64 | 0x10000000); - if (psav->bTiled) { - /* CR50, bit 7,6,0 = 111, Use GBD.*/ - OUTREG8(CRT_ADDRESS_REG,0X50); - byte = INREG8(CRT_DATA_REG) | 0XC1; - OUTREG8(CRT_DATA_REG, byte); - } + /* CR50, bit 7,6,0 = 111, Use GBD.*/ + OUTREG8(CRT_ADDRESS_REG,0X50); + byte = INREG8(CRT_DATA_REG) | 0XC1; + OUTREG8(CRT_DATA_REG, byte); if (!psav->bTiled) { /* @@ -1178,8 +1112,9 @@ void SavageSetGBD_PM(ScrnInfoPtr pScrn) /* program the GBD */ OUTREG32(S3_GLB_BD_LOW,psav->GlobalBD.bd2.LoPart ); - OUTREG32(S3_GLB_BD_HIGH,(psav->GlobalBD.bd2.HiPart - | S3_LITTLE_ENDIAN | 0x10000000 | S3_BD64)); /* AGD: shouldn't BCI be enabled? */ + OUTREG32(S3_GLB_BD_HIGH,(psav->GlobalBD.bd2.HiPart + | BCI_ENABLE /* AGD: shouldn't BCI be enabled? */ + | S3_LITTLE_ENDIAN | 0x10000000 | S3_BD64)); /* turn on screen */ OUTREG8(SEQ_ADDRESS_REG,0x01); @@ -1187,7 +1122,7 @@ void SavageSetGBD_PM(ScrnInfoPtr pScrn) OUTREG8(SEQ_DATA_REG,byte); } -void SavageSetGBD_2000( ScrnInfoPtr pScrn ) +void SavageSetGBD_2000(ScrnInfoPtr pScrn) { vgaHWPtr hwp = VGAHWPTR(pScrn); SavagePtr psav = SAVPTR(pScrn); @@ -1195,24 +1130,6 @@ void SavageSetGBD_2000( ScrnInfoPtr pScrn ) unsigned int vgaCRReg = hwp->IOBase + 5; unsigned long GlobalBitmapDescriptor; - /* Disable BCI */ - OUTREG32(0x48C18, 0); - /* Setup BCI command overflow buffer */ - OUTREG32(0x48C18, (psav->cobOffset >> 7) | (psav->cobIndex)); - if (psav->ShadowStatus) { - /* Set shadow update threshholds. */ - OUTREG32(0x48C10, 0x6090); - OUTREG32(0x48C14, 0x70A8); - /* Enable shadow status update */ - OUTREG32(0x48A30, psav->ShadowPhysical); - /* Enable BCI, command overflow buffer and shadow status. */ - OUTREG32(0x48C18, INREG32(0x48C18) | 0x00380000); - } else { - /* Disable shadow status update */ - OUTREG32(0x48A30, 0); - /* Enable BCI and command overflow buffer */ - OUTREG32(0x48C18, INREG32(0x48C18) | 0x00280000); - } /* AGD: no idea how to program savage2000 GBD...I suspect it's probably like supersavage (Since they both seem to use the same streams engine), for now default to Tim's method */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c index 3c91309af..3c9e7f605 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c @@ -524,8 +524,7 @@ WaitQueue4( SavagePtr psav, int v ) return ShadowWait(psav); } else - while( ((ALT_STATUS_WORD0 & 0x001fffff) > slots) && (loop++ < MAXLOOP)) - ; + while( ((ALT_STATUS_WORD0 & 0x001fffff) > slots) && (loop++ < MAXLOOP)); return loop >= MAXLOOP; } @@ -564,8 +563,7 @@ WaitIdleEmpty3D(SavagePtr psav) return ShadowWait(psav); } loop &= STATUS_WORD0; - while( ((STATUS_WORD0 & 0x0008ffff) != 0x80000) && (loop++ < MAXLOOP) ) - ; + while( ((STATUS_WORD0 & 0x0008ffff) != 0x80000) && (loop++ < MAXLOOP) ); return loop >= MAXLOOP; } @@ -579,8 +577,9 @@ WaitIdleEmpty4(SavagePtr psav) psav->WaitIdleEmpty = ShadowWait; return ShadowWait(psav); } - while( ((ALT_STATUS_WORD0 & 0x00a1ffff) != 0x00a00000) && (loop++ < MAXLOOP) ) - ; + /* which is right?*/ + /*while( ((ALT_STATUS_WORD0 & 0x00a1ffff) != 0x00a00000) && (loop++ < MAXLOOP) );*/ /* tim */ + while (((ALT_STATUS_WORD0 & 0x00e1ffff) != 0x00e00000) && (loop++ < MAXLOOP)); /* S3 */ return loop >= MAXLOOP; } @@ -595,8 +594,7 @@ WaitIdleEmpty2K(SavagePtr psav) return ShadowWait(psav); } loop &= ALT_STATUS_WORD0; - while( ((ALT_STATUS_WORD0 & 0x009fffff) != 0) && (loop++ < MAXLOOP) ) - ; + while( ((ALT_STATUS_WORD0 & 0x009fffff) != 0) && (loop++ < MAXLOOP) ); if( loop >= MAXLOOP ) ResetBCI2K(psav); return loop >= MAXLOOP; @@ -614,8 +612,7 @@ WaitIdle3D(SavagePtr psav) psav->WaitIdle = ShadowWait; return ShadowWait(psav); } - while( (!(STATUS_WORD0 & 0x00080000)) && (loop++ < MAXLOOP) ) - ; + while( (!(STATUS_WORD0 & 0x00080000)) && (loop++ < MAXLOOP) ); return loop >= MAXLOOP; } @@ -629,8 +626,9 @@ WaitIdle4(SavagePtr psav) psav->WaitIdle = ShadowWait; return ShadowWait(psav); } - while( (!(ALT_STATUS_WORD0 & 0x00800000)) && (loop++ < MAXLOOP) ) - ; + /* which is right?*/ + /*while( (!(ALT_STATUS_WORD0 & 0x00800000)) && (loop++ < MAXLOOP) );*/ /* tim */ + while (((ALT_STATUS_WORD0 & 0x00E00000)!=0x00E00000) && (loop++ < MAXLOOP)); /* S3 */ return loop >= MAXLOOP; } @@ -645,8 +643,7 @@ WaitIdle2K(SavagePtr psav) return ShadowWait(psav); } loop &= ALT_STATUS_WORD0; - while( (ALT_STATUS_WORD0 & 0x00900000) && (loop++ < MAXLOOP) ) - ; + while( (ALT_STATUS_WORD0 & 0x00900000) && (loop++ < MAXLOOP) ); return loop >= MAXLOOP; } @@ -1691,7 +1688,9 @@ static void SavageLeaveVT(int scrnIndex, int flags) #endif SavageWriteMode(pScrn, vgaSavePtr, SavageSavePtr, FALSE); + SavageSetTextMode( psav ); SavageDisableMMIO(pScrn); + } @@ -2025,11 +2024,11 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, VGAOUT8(vgaCRIndex, 0x50); VGAOUT8(vgaCRReg, VGAIN8(vgaCRReg) | 0xC1); - +#if 0 width = (pScrn->displayWidth * (pScrn->bitsPerPixel / 8)) >> 3; VGAOUT16(vgaCRIndex, ((width & 0xff) << 8) | 0x13 ); VGAOUT16(vgaCRIndex, ((width & 0x300) << 4) | 0x51 ); - +#endif /* Some non-S3 BIOSes enable block write even on non-SGRAM devices. */ switch( psav->Chipset ) @@ -2052,13 +2051,11 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, } SavageInitialize2DEngine(pScrn); - SavageSetGBD(pScrn); VGAOUT16(vgaCRIndex, 0x0140); SavageSetGBD(pScrn); - /* SavageEnableMode(pScrn,TRUE); */ #ifdef XF86DRI if (psav->directRenderingEnabled) @@ -2306,7 +2303,6 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, vgaHWProtect(pScrn, FALSE); - /* SavageEnableMode(pScrn,TRUE); */ #ifdef XF86DRI if (psav->directRenderingEnabled) @@ -3015,7 +3011,7 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) new->CR50 = 0x10; else new->CR50 = 0x30; - +#if 0 if (pScrn->displayWidth == 640) new->CR50 |= 0x40; else if (pScrn->displayWidth == 800) @@ -3029,6 +3025,7 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) else if (pScrn->displayWidth == 1600) new->CR50 |= 0x81; else +#endif new->CR50 |= 0xc1; /* Use GBD */ if( S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ) @@ -3044,11 +3041,15 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) new->CR36 = VGAIN8(vgaCRReg); VGAOUT8(vgaCRIndex, 0x68); new->CR68 = VGAIN8(vgaCRReg); - new->CR69 = 0; + + new->CR69 = 0x80; + /*new->CR69 = 0;*/ VGAOUT8(vgaCRIndex, 0x6f); new->CR6F = VGAIN8(vgaCRReg); - VGAOUT8(vgaCRIndex, 0x88); + VGAOUT8(vgaCRIndex, 0x86); new->CR86 = VGAIN8(vgaCRReg) | 0x08; + VGAOUT8(vgaCRIndex, 0x88); + new->CR88 = VGAIN8(vgaCRReg) | DISABLE_BLOCK_WRITE_2D; VGAOUT8(vgaCRIndex, 0xb0); new->CRB0 = VGAIN8(vgaCRReg) | 0x80; } @@ -3097,6 +3098,7 @@ static Bool SavageCloseScreen(int scrnIndex, ScreenPtr pScreen) if (pScrn->vtSema) { SavageWriteMode(pScrn, vgaSavePtr, SavageSavePtr, FALSE); + SavageSetTextMode( psav ); vgaHWLock(hwp); SavageUnmapMem(pScrn, 0); } @@ -3112,7 +3114,7 @@ static Bool SavageSaveScreen(ScreenPtr pScreen, int mode) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; TRACE(("SavageSaveScreen(0x%x)\n", mode)); - +#if 0 if( pScrn->vtSema && SAVPTR(pScrn)->hwcursor ) { if( xf86IsUnblank(mode) ) @@ -3120,7 +3122,7 @@ static Bool SavageSaveScreen(ScreenPtr pScreen, int mode) else SavageHideCursor( pScrn ); } - +#endif return vgaHWSaveScreen(pScreen, mode); } @@ -3454,7 +3456,7 @@ void SavageGEReset(ScrnInfoPtr pScrn, int from_timeout, int line, char *file) OUTREG(MONO_PAT_1, ~0); SavageSetGBD(pScrn); - /* SavageEnableMode(pScrn, TRUE); */ + } @@ -3621,7 +3623,6 @@ SavageDDC1(int scrnIndex) return success; } - static void SavageProbeDDC(ScrnInfoPtr pScrn, int index) { |