summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/savage_accel.c167
-rw-r--r--src/savage_cursor.c112
-rw-r--r--src/savage_dga.c10
-rw-r--r--src/savage_dri.c151
-rw-r--r--src/savage_driver.c139
-rw-r--r--src/savage_driver.h15
-rw-r--r--src/savage_drm.h7
-rw-r--r--src/savage_exa.c89
-rw-r--r--src/savage_streams.c93
-rw-r--r--src/savage_video.c257
10 files changed, 114 insertions, 926 deletions
diff --git a/src/savage_accel.c b/src/savage_accel.c
index 7ab80a4..dd9fbe5 100644
--- a/src/savage_accel.c
+++ b/src/savage_accel.c
@@ -130,7 +130,6 @@ SavageInitialize2DEngine(ScrnInfoPtr pScrn)
OUTREG(0x48C18, INREG(0x48C18) & 0x3FF0);
/* Setup BCI command overflow buffer */
OUTREG(0x48C14, (psav->cobOffset >> 11) | (psav->cobIndex << 29)); /* tim */
- /*OUTREG(S3_OVERFLOW_BUFFER, psav->cobOffset >> 11 | 0xE0000000);*/ /* S3 */
/* Program shadow status update. */
{
unsigned long thresholds = ((psav->bciThresholdLo & 0xffff) << 16) |
@@ -169,8 +168,6 @@ SavageInitialize2DEngine(ScrnInfoPtr pScrn)
((psav->bciThresholdHi & 0x1fffe0) >> 5);
OUTREG(0x48C10, thresholds);
}
- /*OUTREG(0x48C10, 0x00700040);*/ /* tim */
- /*OUTREG(0x48C10, 0x0e440f04L);*/ /* S3 */
if( psav->ShadowStatus )
{
OUTREG(0x48C0C, psav->ShadowPhysical | 1 );
@@ -201,8 +198,6 @@ SavageInitialize2DEngine(ScrnInfoPtr pScrn)
if( psav->ShadowStatus )
{
/* Set shadow update thresholds. */
- /*OUTREG(0x48C10, 0x6090 );
- OUTREG(0x48C14, 0x70A8 );*/
OUTREG(0x48C10, psav->bciThresholdLo >> 2);
OUTREG(0x48C14, psav->bciThresholdHi >> 2);
/* Enable shadow status update */
@@ -235,7 +230,7 @@ void
SavageSetGBD(ScrnInfoPtr pScrn)
{
SavagePtr psav = SAVPTR(pScrn);
-
+
UnProtectCRTC();
UnLockExtRegs();
VerticalRetraceWait();
@@ -250,7 +245,7 @@ SavageSetGBD(ScrnInfoPtr pScrn)
/* tileing in 16/32 BPP */
psav->bTiled = TRUE;
psav->lDelta = ((psav->lDelta + 127) >> 7) << 7;
-
+
if (S3_SAVAGE3D_SERIES(psav->Chipset))
psav->ulAperturePitch = 0x2000;
else if (psav->Chipset == S3_SAVAGE2000)
@@ -259,7 +254,7 @@ SavageSetGBD(ScrnInfoPtr pScrn)
psav->lDelta);
else
psav->ulAperturePitch = GetTileAperturePitch(pScrn->virtualX,pScrn->bitsPerPixel);
-
+
/* Use the aperture for linear screen */
psav->FBStart = psav->ApertureMap;
} else {
@@ -268,14 +263,14 @@ SavageSetGBD(ScrnInfoPtr pScrn)
psav->lDelta = ((psav->lDelta + 31) >> 5) << 5;
psav->ulAperturePitch = psav->lDelta;
}
-
+
psav->Bpp = pScrn->bitsPerPixel >> 3;
psav->cxMemory = psav->lDelta / (psav->Bpp);
psav->cyMemory = psav->endfb / psav->lDelta - 1;
/* ??????????? */
if (psav->cyMemory > 2048)
psav->cyMemory = 2048;
-
+
/*
* If tiling, adjust down psav->cyMemory to the last multiple
* of a tileheight, so that we don't try to use partial tiles.
@@ -283,7 +278,7 @@ SavageSetGBD(ScrnInfoPtr pScrn)
if (psav->bTiled) {
psav->cyMemory -= (psav->cyMemory % 16);
}
-
+
/*
* Initialization per GX-3.
*
@@ -346,11 +341,11 @@ void SavageSetGBD_Twister(ScrnInfoPtr pScrn)
tile16 = TILE_DESTINATION;
tile32 = TILE_DESTINATION;
}
-
+
/* MM81C0 and 81C4 are used to control primary stream. */
OUTREG32(PSTREAM_FBADDR0_REG,0x00000000);
OUTREG32(PSTREAM_FBADDR1_REG,0x00000000);
-
+
/*
* Program Primary Stream Stride Register.
*
@@ -446,13 +441,13 @@ void SavageSetGBD_Twister(ScrnInfoPtr pScrn)
}
else if (pScrn->bitsPerPixel == 16) {
psav->GlobalBD.bd1.HighPart.ResBWTile = tile16; /* 16 bpp/destination tiling format */
-
+
ulTmp = (((pScrn->virtualX + 0x3F) & 0x0000FFC0) >> 6) << 20;
OUTREG32(TILED_SURFACE_REGISTER_0,ulTmp | TILED_SURF_BPP16);
}
else if (pScrn->bitsPerPixel == 32) {
psav->GlobalBD.bd1.HighPart.ResBWTile = tile32; /* 32 bpp/destination tiling format */
-
+
ulTmp = ( ((pScrn->virtualX + 0x1F) & 0x0000FFE0) >> 5) << 20;
OUTREG32(TILED_SURFACE_REGISTER_0,ulTmp | TILED_SURF_BPP32);
}
@@ -462,7 +457,6 @@ void SavageSetGBD_Twister(ScrnInfoPtr pScrn)
psav->GlobalBD.bd1.HighPart.Stride = (unsigned short) psav->lDelta / (pScrn->bitsPerPixel >> 3);
psav->GlobalBD.bd1.HighPart.Bpp = (unsigned char) (pScrn->bitsPerPixel);
psav->GlobalBD.bd1.Offset = pScrn->fbOffset;
-
/*
* CR88, bit 4 - Block write enabled/disabled.
@@ -488,7 +482,7 @@ void SavageSetGBD_Twister(ScrnInfoPtr pScrn)
OUTREG8(SEQ_ADDRESS_REG,0x01);
byte = INREG8(SEQ_DATA_REG) & ~0x20;
OUTREG8(SEQ_DATA_REG,byte);
-
+
/* program the GBD and SBD's */
OUTREG32(S3_GLB_BD_LOW,psav->GlobalBD.bd2.LoPart);
OUTREG32(S3_GLB_BD_HIGH,psav->GlobalBD.bd2.HiPart | bci_enable | S3_LITTLE_ENDIAN | S3_BD64);
@@ -508,11 +502,11 @@ void SavageSetGBD_3D(ScrnInfoPtr pScrn)
bci_enable = BCI_ENABLE;
tile16 = TILE_FORMAT_16BPP;
tile32 = TILE_FORMAT_32BPP;
-
+
/* MM81C0 and 81C4 are used to control primary stream. */
OUTREG32(PSTREAM_FBADDR0_REG,0x00000000);
OUTREG32(PSTREAM_FBADDR1_REG,0x00000000);
-
+
/*
* Program Primary Stream Stride Register.
*
@@ -598,13 +592,13 @@ void SavageSetGBD_3D(ScrnInfoPtr pScrn)
}
else if (pScrn->bitsPerPixel == 16) {
psav->GlobalBD.bd1.HighPart.ResBWTile = tile16; /* 16 bpp/destination tiling format */
-
+
ulTmp = (((pScrn->virtualX + 0x3F) & 0x0000FFC0) >> 6) << 24;
OUTREG32(TILED_SURFACE_REGISTER_0,ulTmp | TILED_SURF_BPP16);
}
else if (pScrn->bitsPerPixel == 32) {
psav->GlobalBD.bd1.HighPart.ResBWTile = tile32; /* 32 bpp/destination tiling format */
-
+
ulTmp = ( ((pScrn->virtualX + 0x1F) & 0x0000FFE0) >> 5) << 24;
OUTREG32(TILED_SURFACE_REGISTER_0,ulTmp | TILED_SURF_BPP32);
}
@@ -614,7 +608,6 @@ void SavageSetGBD_3D(ScrnInfoPtr pScrn)
psav->GlobalBD.bd1.HighPart.Stride = (unsigned short) psav->lDelta / (pScrn->bitsPerPixel >> 3);
psav->GlobalBD.bd1.HighPart.Bpp = (unsigned char) (pScrn->bitsPerPixel);
psav->GlobalBD.bd1.Offset = pScrn->fbOffset;
-
/*
* CR88, bit 4 - Block write enabled/disabled.
@@ -640,7 +633,7 @@ void SavageSetGBD_3D(ScrnInfoPtr pScrn)
OUTREG8(SEQ_ADDRESS_REG,0x01);
byte = INREG8(SEQ_DATA_REG) & ~0x20;
OUTREG8(SEQ_DATA_REG,byte);
-
+
/* program the GBD and SBD's */
OUTREG32(S3_GLB_BD_LOW,psav->GlobalBD.bd2.LoPart);
OUTREG32(S3_GLB_BD_HIGH,psav->GlobalBD.bd2.HiPart | bci_enable | S3_LITTLE_ENDIAN | S3_BD64);
@@ -704,18 +697,6 @@ void SavageSetGBD_M7(ScrnInfoPtr pScrn)
OUTREG8(CRT_ADDRESS_REG, MEMORY_CTRL0_REG);/* CRCA */
byte = INREG8(CRT_DATA_REG) & ~(MEM_PS1 + MEM_PS2) ;
OUTREG8(CRT_DATA_REG,byte);
-#if 0
- /*
- * if we have 8MB of frame buffer here then we must really be a 16MB
- * card and that means that the second device is always in the upper
- * bank of memory (MHS)
- */
- if (psav->videoRambytes >= 0x800000) {
- /* 16MB Video Memory cursor is at the end in Bank 1 */
- byte |= 0x3;
- OUTREG16(CRT_ADDRESS_REG, (byte << 8) | MEMORY_CTRL0_REG);
- }
-#endif
/* MM81C0 and 81C4 are used to control primary stream. */
if (psav->IsPrimary) {
@@ -802,7 +783,7 @@ void SavageSetGBD_M7(ScrnInfoPtr pScrn)
if (!psav->IsSecondary)
OUTREG32(S3_BCI_GLB_BD_HIGH, bci_enable | S3_LITTLE_ENDIAN | S3_BD64);
-
+
/* CR50, bit 7,6,0 = 111, Use GBD.*/
OUTREG8(CRT_ADDRESS_REG,0x50);
byte = INREG8(CRT_DATA_REG) | 0xC1;
@@ -816,10 +797,9 @@ void SavageSetGBD_M7(ScrnInfoPtr pScrn)
* write should only be enabled for certain types of SGRAM.
*/
OUTREG8(CRT_ADDRESS_REG,0x78);
- /*byte = INREG8(CRT_DATA_REG) & ~0x0C;*/
byte = INREG8(CRT_DATA_REG) | 0xfb;
OUTREG8(CRT_DATA_REG,byte);
-
+
/*
* Tiled Surface 0 Registers MM48C40:
* bit 0~23: tile surface 0 frame buffer offset
@@ -868,7 +848,7 @@ void SavageSetGBD_M7(ScrnInfoPtr pScrn)
else
OUTREG32(TILED_SURFACE_REGISTER_0,ulTmp | TILED_SURF_BPP32 | pScrn->fbOffset);
}
-
+
psav->GlobalBD.bd1.HighPart.ResBWTile |= 0x10;/* disable block write */
/* HW uses width */
psav->GlobalBD.bd1.HighPart.Stride = (unsigned short)(psav->lDelta / (pScrn->bitsPerPixel >> 3));
@@ -881,11 +861,6 @@ void SavageSetGBD_M7(ScrnInfoPtr pScrn)
* bit 0 = 1, Enable 8 Mbytes of display memory thru 64K window
* at A000:0.
*/
-#if 0
- OUTREG8(CRT_ADDRESS_REG,MEMORY_CONFIG_REG); /* cr31 */
- byte = INREG8(CRT_DATA_REG) & (~(ENABLE_CPUA_BASE_A0000));
- OUTREG8(CRT_DATA_REG,byte);
-#endif
OUTREG8(CRT_ADDRESS_REG,MEMORY_CONFIG_REG); /* cr31 */
byte = (INREG8(CRT_DATA_REG) | 0x04) & 0xFE;
OUTREG8(CRT_DATA_REG,byte);
@@ -907,22 +882,20 @@ void SavageSetGBD_M7(ScrnInfoPtr pScrn)
byte = INREG8(SEQ_DATA_REG) & ~0X20;
OUTREG8(SEQ_DATA_REG,byte);
}
-
+
void SavageSetGBD_PM(ScrnInfoPtr pScrn)
{
SavagePtr psav = SAVPTR(pScrn);
unsigned long ulTmp;
unsigned char byte;
int bci_enable, tile16, tile32;
-
bci_enable = BCI_ENABLE_TWISTER;
tile16 = TILE_DESTINATION;
tile32 = TILE_DESTINATION;
-
/* following is the enable case */
-
+
/* SR01:turn off screen */
OUTREG8 (SEQ_ADDRESS_REG,0x01);
byte = INREG8(SEQ_DATA_REG) | 0x20;
@@ -946,7 +919,7 @@ void SavageSetGBD_PM(ScrnInfoPtr pScrn)
OUTREG8(CRT_ADDRESS_REG,0x67);
byte = INREG8(CRT_DATA_REG) | 0x08;
OUTREG8(CRT_DATA_REG,byte);
-
+
OUTREG16(SEQ_ADDRESS_REG,SELECT_IGA1);
} else {
OUTREG8(CRT_ADDRESS_REG,0x67);
@@ -958,7 +931,7 @@ void SavageSetGBD_PM(ScrnInfoPtr pScrn)
OUTREG8(CRT_ADDRESS_REG,0x67);
byte = INREG8(CRT_DATA_REG) | 0x08;
OUTREG8(CRT_DATA_REG,byte);
-
+
OUTREG16(SEQ_ADDRESS_REG,SELECT_IGA1);
}
@@ -969,7 +942,7 @@ void SavageSetGBD_PM(ScrnInfoPtr pScrn)
OUTREG8(CRT_ADDRESS_REG,0x65);
byte = INREG8(CRT_DATA_REG) | 0x03;
OUTREG8(CRT_DATA_REG,byte);
-
+
/*
* Program Primary Stream Stride Register.
*
@@ -1034,7 +1007,7 @@ void SavageSetGBD_PM(ScrnInfoPtr pScrn)
| 0xC0000000 | (psav->lDelta & 0x00001fff));
}
}
-
+
/* MM81C0 and 81C4 are used to control primary stream. */
if (psav->IsPrimary) {
OUTREG32(PRI_STREAM_FBUF_ADDR0,pScrn->fbOffset);
@@ -1048,14 +1021,14 @@ void SavageSetGBD_PM(ScrnInfoPtr pScrn)
OUTREG32(PRI_STREAM2_FBUF_ADDR0,(pScrn->fbOffset & 0xfffffffc) | 0x80000000);
OUTREG32(PRI_STREAM2_FBUF_ADDR1,pScrn->fbOffset & 0xffffffc);
}
-
+
OUTREG32(0x8128, 0xFFFFFFFFL);
OUTREG32(0x812C, 0xFFFFFFFFL);
-
+
if (!psav->IsSecondary)
/* bit 28:block write disable */
OUTREG32(S3_GLB_BD_HIGH, bci_enable | S3_BD64 | 0x10000000);
-
+
/* CR50, bit 7,6,0 = 111, Use GBD.*/
OUTREG8(CRT_ADDRESS_REG,0x50);
byte = INREG8(CRT_DATA_REG) | 0xC1;
@@ -1068,11 +1041,10 @@ void SavageSetGBD_PM(ScrnInfoPtr pScrn)
* type of SGRAM for which block_write can be used.
*/
psav->GlobalBD.bd1.HighPart.ResBWTile = TILE_FORMAT_LINEAR;/* linear */
-
}
else if (pScrn->bitsPerPixel == 16) {
psav->GlobalBD.bd1.HighPart.ResBWTile = tile16;/* tile format destination */
-
+
ulTmp = (((pScrn->virtualX + 0x3f) & 0x0000ffc0) >> 6) << 20;
if (psav->IsSecondary)
OUTREG32(TILED_SURFACE_REGISTER_1,ulTmp | TILED_SURF_BPP16 | (pScrn->fbOffset>>6));
@@ -1088,7 +1060,7 @@ void SavageSetGBD_PM(ScrnInfoPtr pScrn)
else
OUTREG32(TILED_SURFACE_REGISTER_0,ulTmp | TILED_SURF_BPP32 | (pScrn->fbOffset>>6));
}
-
+
psav->GlobalBD.bd1.HighPart.ResBWTile |= 0x10;/* disable block write */
/* HW uses width */
psav->GlobalBD.bd1.HighPart.Stride = (unsigned short)(psav->lDelta / (pScrn->bitsPerPixel >> 3));
@@ -1103,7 +1075,7 @@ void SavageSetGBD_PM(ScrnInfoPtr pScrn)
OUTREG8(CRT_ADDRESS_REG,MEMORY_CONFIG_REG);
byte = INREG8(CRT_DATA_REG) & (~(ENABLE_CPUA_BASE_A0000));
OUTREG8(CRT_DATA_REG,byte);
-
+
if (!psav->IsSecondary) {
/* program the GBD and SBDs */
OUTREG32(S3_GLB_BD_LOW,psav->GlobalBD.bd2.LoPart );
@@ -1127,7 +1099,7 @@ void SavageSetGBD_2000(ScrnInfoPtr pScrn)
unsigned long ulTmp, ulYRange;
unsigned char byte;
int bci_enable, tile16, tile32;
-
+
bci_enable = BCI_ENABLE_TWISTER;
tile16 = TILE_DESTINATION;
tile32 = TILE_DESTINATION;
@@ -1137,20 +1109,17 @@ void SavageSetGBD_2000(ScrnInfoPtr pScrn)
else
ulYRange = 0x20000000;
-
/* following is the enable case */
-
+
/* SR01:turn off screen */
OUTREG8 (SEQ_ADDRESS_REG,0x01);
byte = INREG8(SEQ_DATA_REG) | 0x20;
OUTREG8(SEQ_DATA_REG,byte);
-
/* MM81C0 and 81B0 are used to control primary stream. */
OUTREG32(PRI_STREAM_FBUF_ADDR0, pScrn->fbOffset);
OUTREG32(PRI_STREAM2_FBUF_ADDR0, pScrn->fbOffset);
-
/*
* Program Primary Stream Stride Register.
*
@@ -1185,13 +1154,12 @@ void SavageSetGBD_2000(ScrnInfoPtr pScrn)
byte = INREG8(CRT_DATA_REG) | 0x08;
OUTREG8(CRT_DATA_REG,byte);
-
OUTREG32(0x8128, 0xFFFFFFFFL);
OUTREG32(0x812C, 0xFFFFFFFFL);
-
+
/* bit 28:block write disable */
OUTREG32(S3_GLB_BD_HIGH, bci_enable | S3_BD64 | 0x10000000);
-
+
/* CR50, bit 7,6,0 = 111, Use GBD.*/
OUTREG8(CRT_ADDRESS_REG,0x50);
byte = INREG8(CRT_DATA_REG) | 0xC1;
@@ -1209,7 +1177,6 @@ void SavageSetGBD_2000(ScrnInfoPtr pScrn)
* type of SGRAM for which block_write can be used.
*/
psav->GlobalBD.bd1.HighPart.ResBWTile = TILE_FORMAT_LINEAR;/* linear */
-
}
else if (pScrn->bitsPerPixel == 16) {
psav->GlobalBD.bd1.HighPart.ResBWTile = tile16;/* tile format destination */
@@ -1227,7 +1194,7 @@ void SavageSetGBD_2000(ScrnInfoPtr pScrn)
OUTREG32(PRI_STREAM_STRIDE, ((ulTmp >> 19) & 0x03f0) | 0x80000000);
OUTREG32(PRI_STREAM2_STRIDE, ((ulTmp >> 19) & 0x03f0) | 0x80000000);
}
-
+
psav->GlobalBD.bd1.HighPart.ResBWTile |= 0x10;/* disable block write */
/* HW uses width */
psav->GlobalBD.bd1.HighPart.Stride = (unsigned short)(psav->lDelta / (pScrn->bitsPerPixel >> 3));
@@ -1242,7 +1209,7 @@ void SavageSetGBD_2000(ScrnInfoPtr pScrn)
OUTREG8(CRT_ADDRESS_REG,MEMORY_CONFIG_REG);
byte = INREG8(CRT_DATA_REG) & (~(ENABLE_CPUA_BASE_A0000));
OUTREG8(CRT_DATA_REG,byte);
-
+
/* program the GBD and SBDs */
OUTREG32(S3_GLB_BD_LOW,psav->GlobalBD.bd2.LoPart );
OUTREG32(S3_GLB_BD_HIGH,(psav->GlobalBD.bd2.HiPart
@@ -1258,18 +1225,6 @@ void SavageSetGBD_2000(ScrnInfoPtr pScrn)
OUTREG8(SEQ_DATA_REG,byte);
}
-#if 0
-static
-void SavageRestoreAccelState(ScrnInfoPtr pScrn)
-{
- SavagePtr psav = SAVPTR(pScrn);
-
- psav->WaitIdleEmpty(psav);
-
- return;
-}
-#endif
-
/* Acceleration init function, sets up pointers to our accelerated functions */
Bool
@@ -1290,7 +1245,7 @@ SavageInitAccel(ScreenPtr pScreen)
pSAVAGEDRIServer->frontbufferSize = bufferSize;
tiledwidthBytes = psav->lDelta;
tiledWidth = tiledwidthBytes / cpp;
-
+
if (cpp == 2) {
tiledBufferSize = ((pScrn->virtualX+63)/64)*((pScrn->virtualY+15)/16)
*2048;
@@ -1298,13 +1253,8 @@ SavageInitAccel(ScreenPtr pScreen)
tiledBufferSize = ((pScrn->virtualX+31)/32)*((pScrn->virtualY+15)/16)
*2048;
}
- /*set Depth buffer to 32bpp*/
- /*tiledwidthBytes_Z = ((pScrn->virtualX + 31)& ~0x0000001F)*4;
- tiledBufferSize_Z = ((pScrn->virtualX+31)/32)*((pScrn->virtualY+15)/16)
- *2048;*/
pSAVAGEDRIServer->backbufferSize = tiledBufferSize;
- /*pSAVAGEDRIServer->depthbufferSize = tiledBufferSize_Z;*/
pSAVAGEDRIServer->depthbufferSize = tiledBufferSize;
xf86DrvMsg(pScrn->scrnIndex,X_INFO,
@@ -1327,10 +1277,6 @@ SavageInitAccel(ScreenPtr pScreen)
* pixmap cache. Should be enough for a fullscreen background
* image plus some leftovers.
*/
- /* pSAVAGEDRIServer->textureSize = psav->videoRambytes -
- tiledBufferSize -
- tiledBufferSize_Z -
- -0x602000;*/
pSAVAGEDRIServer->textureSize = psav->videoRambytes -
4096 - /* hw cursor*/
psav->cobSize - /*COB*/
@@ -1347,27 +1293,6 @@ SavageInitAccel(ScreenPtr pScreen)
"textureSize:0x%08x \n",
pSAVAGEDRIServer->textureSize);
- /* If that gives us less than half the available memory, let's
- * be greedy and grab some more. Sorry, I care more about 3D
- * performance than playing nicely, and you'll get around a full
- * framebuffer's worth of pixmap cache anyway.
- */
-#if 0
- if ( pSAVAGEDRIServer->textureSize < (int)psav->FbMapSize / 2 ) {
- pSAVAGEDRIServer->textureSize = psav->FbMapSize - 4 * bufferSize;
- }
-#endif
- /* Check to see if there is more room available after the maximum
- * scanline for textures.
- */
-#if 0
- if ( (int)psav->FbMapSize - maxlines * widthBytes - bufferSize * 2
- > pSAVAGEDRIServer->textureSize ) {
- pSAVAGEDRIServer->textureSize = (psav->FbMapSize -
- maxlines * widthBytes -
- bufferSize * 2);
- }
-#endif
/* Set a minimum usable local texture heap size. This will fit
* two 256x256x32bpp textures.
*/
@@ -1381,7 +1306,6 @@ SavageInitAccel(ScreenPtr pScreen)
pSAVAGEDRIServer->textureSize);
/* Reserve space for textures */
- /* if (pSAVAGEDRIServer->textureSize)*/
pSAVAGEDRIServer->textureOffset = (psav->videoRambytes -
4096 - /* hw cursor*/
psav->cobSize - /*COB*/
@@ -1392,12 +1316,8 @@ SavageInitAccel(ScreenPtr pScreen)
pSAVAGEDRIServer->textureOffset);
/* Reserve space for the shared depth buffer */
- /*pSAVAGEDRIServer->depthOffset = (pSAVAGEDRIServer->textureOffset -
- tiledBufferSize_Z + SAVAGE_BUFFER_ALIGN) & ~SAVAGE_BUFFER_ALIGN;
- */
pSAVAGEDRIServer->depthOffset = (pSAVAGEDRIServer->textureOffset -
tiledBufferSize) & ~SAVAGE_BUFFER_ALIGN;
- /*pSAVAGEDRIServer->depthPitch = tiledwidthBytes_Z;*/
pSAVAGEDRIServer->depthPitch = tiledwidthBytes;
xf86DrvMsg( pScrn->scrnIndex, X_INFO,
@@ -1452,8 +1372,6 @@ SavageInitAccel(ScreenPtr pScreen)
tiledWidth;
}
- /*scanlines = pSAVAGEDRIServer->backOffset / widthBytes - 1;*/
- /*if ( scanlines > maxlines ) scanlines = maxlines;*/
/* CR47983, XvMC do not work on system with frame buffer less than 32MB.
* VBE reports frame buffer size a little less than 16MB, this makes the condition
* turns out FALSE.
@@ -1483,13 +1401,6 @@ SavageInitAccel(ScreenPtr pScreen)
* hwmc used xserver's memory, now xserver will get less memory.
* Both 3D and hwmc's memory usage are considered now.
*/
-#if 0
- if (pSAVAGEDRIServer->backOffset < psav->hwmcOffset )
- psav->cyMemory = pSAVAGEDRIServer->backOffset / widthBytes - 1;
- else
- psav->cyMemory = psav->hwmcOffset / widthBytes -1;
-#endif
-
psav->cyMemory = pSAVAGEDRIServer->backOffset / widthBytes - 1;
if (psav->cyMemory > 0x7FFF) {
psav->cyMemory = 0x7FFF;
@@ -1540,7 +1451,6 @@ SavageInitAccel(ScreenPtr pScreen)
}
int SavageGetCopyROP(int rop) {
-
int ALUCopyROP[16] =
{
0x00, /*ROP_0 GXclear */
@@ -1562,7 +1472,6 @@ int SavageGetCopyROP(int rop) {
};
return (ALUCopyROP[rop]);
-
}
/* The sync function for the GE */
diff --git a/src/savage_cursor.c b/src/savage_cursor.c
index 8ef9753..7b959df 100644
--- a/src/savage_cursor.c
+++ b/src/savage_cursor.c
@@ -56,9 +56,6 @@ static void SavageSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg);
#define outCRReg(reg, val) (VGAHWPTR(pScrn))->writeCrtc( VGAHWPTR(pScrn), reg, val )
#define inSRReg(reg) (VGAHWPTR(pScrn))->readSeq( VGAHWPTR(pScrn), reg )
#define outSRReg(reg, val) (VGAHWPTR(pScrn))->writeSeq( VGAHWPTR(pScrn), reg, val )
-#if 0
-#define inStatus1() (VGAHWPTR(pScrn))->readST01( VGAHWPTR(pScrn) )
-#endif
/*
* certain HW cursor operations seem
@@ -79,24 +76,6 @@ static void SavageSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg);
* the HW cursor position.
*/
-#if 0
-static Bool
-SavageUseHWCursor(ScreenPtr pScr, CursorPtr pCurs)
-{
- ScrnInfoPtr pScrn = xf86ScreenToScrn(pScr);
- SavagePtr psav = SAVPTR(pScrn);
-
- if (psav->PanelX != pScrn->currentMode->HDisplay
- || psav->PanelY != pScrn->currentMode->VDisplay) {
- /* BIT 1 : CRT is active, BIT 2 : LCD is active */
- unsigned char cr6d = inCRReg( 0x6d );
- if (cr6d & 0x02)
- return FALSE;
- }
- return TRUE;
-}
-#endif
-
Bool
SavageHWCursorInit(ScreenPtr pScreen)
{
@@ -107,7 +86,7 @@ SavageHWCursorInit(ScreenPtr pScreen)
infoPtr = xf86CreateCursorInfoRec();
if(!infoPtr)
return FALSE;
-
+
psav->CursorInfoRec = infoPtr;
infoPtr->MaxWidth = MAX_CURS;
@@ -117,18 +96,6 @@ SavageHWCursorInit(ScreenPtr pScreen)
HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
HARDWARE_CURSOR_INVERT_MASK;
-#if 0
- /*
- * The /MX family is apparently unique among the Savages, in that
- * the cursor color is always straight RGB. The rest of the Savages
- * use palettized values at 8-bit when not clock doubled.
- */
-
- if (((psav->Chipset != S3_SAVAGE4)
- && (inSRReg(0x18) & 0x80) && (inSRReg(0x15) & 0x50))
- || S3_SAVAGE_MOBILE_SERIES(psav->Chipset))
- infoPtr->Flags |= HARDWARE_CURSOR_TRUECOLOR_AT_8BPP;
-#endif
/*
* With streams engine the Cursor seems to be ALWAYS TrueColor
*except at least the Savage4
@@ -142,13 +109,7 @@ SavageHWCursorInit(ScreenPtr pScreen)
infoPtr->HideCursor = SavageHideCursor;
infoPtr->ShowCursor = SavageShowCursor;
infoPtr->UseHWCursor = NULL;
-#if 0 /*AGD: HW cursor seems to work fine even with expansion... */
- if ((S3_SAVAGE_MOBILE_SERIES(psav->Chipset)
- || (S3_MOBILE_TWISTER_SERIES(psav->Chipset))) && !psav->CrtOnly)
- infoPtr->UseHWCursor = SavageUseHWCursor;
- else
- infoPtr->UseHWCursor = NULL;
-#endif
+
if( !psav->CursorKByte )
psav->CursorKByte = pScrn->videoRam - 4;
@@ -292,7 +253,6 @@ SavageSetCursorPosition(
}
-
static void
SavageSetCursorColors(
ScrnInfoPtr pScrn,
@@ -300,26 +260,10 @@ SavageSetCursorColors(
int fg)
{
SavagePtr psav = SAVPTR(pScrn);
-#if 0
- Bool bNeedExtra = FALSE;
-#endif
/* Clock doubled modes need an extra cursor stack write. */
-#if 0
- bNeedExtra =
- (psav->CursorInfoRec->Flags & HARDWARE_CURSOR_TRUECOLOR_AT_8BPP);
-#endif
-
/* With the streams engine on HW Cursor seems to be 24bpp ALWAYS */
- if( 1
-#if 0
- || S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ||
- (pScrn->depth == 24) ||
- ((pScrn->depth == 8) && bNeedExtra)
-#endif
- )
- {
/* Do it straight, full 24 bit color. */
if (psav->IsSecondary) {
/* cursor 2 */
@@ -352,56 +296,4 @@ SavageSetCursorColors(
outCRReg(0x4b, bg >> 16);
}
return;
- }
-#if 0
- else if( (pScrn->depth == 15) || (pScrn->depth == 16) )
- {
- if (pScrn->depth == 15) {
- fg = ((fg & 0xf80000) >> 9) |
- ((fg & 0xf800) >> 6) |
- ((fg & 0xf8) >> 3);
- bg = ((bg & 0xf80000) >> 9) |
- ((bg & 0xf800) >> 6) |
- ((bg & 0xf8) >> 3);
- } else {
- fg = ((fg & 0xf80000) >> 8) |
- ((fg & 0xfc00) >> 5) |
- ((fg & 0xf8) >> 3);
- bg = ((bg & 0xf80000) >> 8) |
- ((bg & 0xfc00) >> 5) |
- ((bg & 0xf8) >> 3);
- }
- /* Reset the cursor color stack pointer */
- inCRReg( 0x45 );
- outCRReg( 0x4a, fg );
- outCRReg( 0x4a, fg>>8 );
- if( bNeedExtra )
- {
- outCRReg( 0x4a, fg );
- outCRReg( 0x4a, fg>>8 );
- }
- /* Reset the cursor color stack pointer */
- inCRReg( 0x45 );
- outCRReg( 0x4b, bg );
- outCRReg( 0x4b, bg>>8 );
- if( bNeedExtra )
- {
- outCRReg( 0x4b, bg );
- outCRReg( 0x4b, bg>>8 );
- }
- }
- else if( pScrn->depth == 8 )
- {
- /* Reset the cursor color stack pointer */
- inCRReg(0x45);
- /* Write foreground */
- outCRReg(0x4a, fg);
- outCRReg(0x4a, fg);
- /* Reset the cursor color stack pointer */
- inCRReg(0x45);
- /* Write background */
- outCRReg(0x4b, bg);
- outCRReg(0x4b, bg);
- }
-#endif
}
diff --git a/src/savage_dga.c b/src/savage_dga.c
index 3acf7fe..0ee4f4d 100644
--- a/src/savage_dga.c
+++ b/src/savage_dga.c
@@ -274,20 +274,10 @@ Savage_SetMode(
} else {
Bool holdBIOS = psav->UseBIOS;
-#if 0
- ErrorF(
- "pScrn->bitsPerPixel %d, pScrn->depth %d\n",
- pScrn->bitsPerPixel, pScrn->depth);
- ErrorF(
- " want bitsPerPixel %d, want depth %d\n",
- pMode->bitsPerPixel, pMode->depth);
-#endif
-
if( psav->hwcursor && psav->hwc_on) {
SavageHideCursor(pScrn);
psav->hwc_on = TRUE; /* save for later restoration */
}
-
if(!psav->DGAactive) { /* save the old parameters */
OldDisplayWidth[index] = pScrn->displayWidth;
diff --git a/src/savage_dri.c b/src/savage_dri.c
index 08185d0..6b58301 100644
--- a/src/savage_dri.c
+++ b/src/savage_dri.c
@@ -112,12 +112,6 @@ static void SAVAGEWakeupHandler(WAKEUPHANDLER_ARGS_DECL)
psav->LockHeld = 1;
if (psav->ShadowStatus) {
/* fetch the global shadow counter */
-#if 0
- if (psav->ShadowCounter != (psav->ShadowVirtual[1023] & 0xffff))
- xf86DrvMsg( pScrn->scrnIndex, X_INFO,
- "[dri] WakeupHandler: shadowCounter adjusted from %04x to %04lx\n",
- psav->ShadowCounter, psav->ShadowVirtual[1023] & 0xffff);
-#endif
psav->ShadowCounter = psav->ShadowVirtual[1023] & 0xffff;
}
if (psav->useEXA)
@@ -135,13 +129,6 @@ static void SAVAGEBlockHandler(BLOCKHANDLER_ARGS_DECL)
CARD32 globalShadowCounter = psav->ShadowVirtual[1023];
globalShadowCounter = (globalShadowCounter & 0xffff0000) |
((CARD32)psav->ShadowCounter & 0x0000ffff);
-
-#if 0
- if (globalShadowCounter != psav->ShadowVirtual[1023])
- xf86DrvMsg( pScrn->scrnIndex, X_INFO,
- "[dri] BlockHandler: shadowCounter adjusted from %08lx to %08x\n",
- psav->ShadowVirtual[1023], globalShadowCounter);
-#endif
psav->ShadowVirtual[1023] = globalShadowCounter;
}
psav->LockHeld = 0;
@@ -158,7 +145,7 @@ static void SAVAGESelectBuffer( ScrnInfoPtr pScrn, int which )
psav->WaitIdleEmpty(psav);
OUTREG(0x48C18,INREG(0x48C18)&(~0x00000008));
-
+
switch ( which ) {
case SAVAGE_BACK:
OUTREG( 0x8170, pSAVAGEDRIServer->backOffset );
@@ -179,7 +166,6 @@ static void SAVAGESelectBuffer( ScrnInfoPtr pScrn, int which )
}
-
static unsigned int mylog2( unsigned int n )
{
unsigned int log2 = 1;
@@ -319,19 +305,6 @@ static Bool SAVAGEDRIAgpInit(ScreenPtr pScreen)
xf86DrvMsg( pScreen->myNum, X_INFO,
"[agp] command DMA handle = 0x%08lx\n",
(unsigned long)pSAVAGEDRIServer->cmdDma.handle );
- /* not needed in the server
- if ( drmMap( psav->drmFD,
- pSAVAGEDRIServer->cmdDma.handle,
- pSAVAGEDRIServer->cmdDma.size,
- &pSAVAGEDRIServer->cmdDma.map ) < 0 ) {
- xf86DrvMsg( pScreen->myNum, X_ERROR,
- "[agp] Could not map command DMA\n" );
- return FALSE;
- }
- xf86DrvMsg( pScreen->myNum, X_INFO,
- "[agp] command DMA mapped at 0x%08lx\n",
- (unsigned long)pSAVAGEDRIServer->cmdDma.map );
- */
} else if ( psav->VertexDMA ) {
if ( drmAddMap( psav->drmFD,
pSAVAGEDRIServer->buffers.offset,
@@ -345,19 +318,6 @@ static Bool SAVAGEDRIAgpInit(ScreenPtr pScreen)
xf86DrvMsg( pScreen->myNum, X_INFO,
"[agp] DMA buffers handle = 0x%08lx\n",
(unsigned long)pSAVAGEDRIServer->buffers.handle );
- /* not needed in the server
- if ( drmMap( psav->drmFD,
- pSAVAGEDRIServer->buffers.handle,
- pSAVAGEDRIServer->buffers.size,
- &pSAVAGEDRIServer->buffers.map ) < 0 ) {
- xf86DrvMsg( pScreen->myNum, X_ERROR,
- "[agp] Could not map DMA buffers\n" );
- return FALSE;
- }
- xf86DrvMsg( pScreen->myNum, X_INFO,
- "[agp] DMA buffers mapped at 0x%08lx\n",
- (unsigned long)pSAVAGEDRIServer->buffers.map );
- */
}
}
@@ -391,26 +351,10 @@ static Bool SAVAGEDRIAgpInit(ScreenPtr pScreen)
"[agp] Could not add agpTextures \n" );
return FALSE;
}
- /* pSAVAGEDRIServer->agp_offset=pSAVAGEDRIServer->agpTexture.size;*/
xf86DrvMsg( pScreen->myNum, X_INFO,
"[agp] agpTextures handle = 0x%08lx\n",
(unsigned long)pSAVAGEDRIServer->agpTextures.handle );
- /* not needed in the server
- if ( drmMap( psav->drmFD,
- pSAVAGEDRIServer->agpTextures.handle,
- pSAVAGEDRIServer->agpTextures.size,
- &pSAVAGEDRIServer->agpTextures.map ) < 0 ) {
- xf86DrvMsg( pScreen->myNum, X_ERROR,
- "[agp] Could not map agpTextures \n" );
- return FALSE;
- }
-
- xf86DrvMsg( pScreen->myNum, X_INFO,
- "[agp] agpTextures mapped at 0x%08lx\n",
- (unsigned long)pSAVAGEDRIServer->agpTextures.map );
- */
-
return TRUE;
}
@@ -431,9 +375,9 @@ static Bool SAVAGEDRIMapInit( ScreenPtr pScreen )
"[drm] Could not add MMIO registers mapping\n" );
return FALSE;
}
-
+
pSAVAGEDRIServer->aperture.size = 5 * 0x01000000;
-
+
if ( drmAddMap( psav->drmFD,
(drm_handle_t)(psav->ApertureRegion.base),
pSAVAGEDRIServer->aperture.size,
@@ -443,22 +387,11 @@ static Bool SAVAGEDRIMapInit( ScreenPtr pScreen )
"[drm] Could not add aperture mapping\n" );
return FALSE;
}
-
+
xf86DrvMsg( pScreen->myNum, X_INFO,
"[drm] aperture handle = 0x%08lx\n",
(unsigned long)pSAVAGEDRIServer->aperture.handle );
- /*if(drmMap(psav->drmFD,
- pSAVAGEDRIServer->registers.handle,
- pSAVAGEDRIServer->registers.size,
- &pSAVAGEDRIServer->registers.map)<0)
- {
- xf86DrvMsg( pScreen->myNum, X_ERROR,
- "[drm] Could not map MMIO registers region to virtual\n" );
- return FALSE;
-
- }*/
-
if ( !psav->AgpDMA && psav->CommandDMA ) {
pSAVAGEDRIServer->cmdDma.size = SAVAGE_CMDDMA_SIZE;
if ( drmAddMap( psav->drmFD, 0, pSAVAGEDRIServer->cmdDma.size,
@@ -549,18 +482,6 @@ static Bool SAVAGEDRIBuffersInit( ScreenPtr pScreen )
"[drm] Added %d %d byte DMA buffers\n",
count, SAVAGE_BUFFER_SIZE );
- /* not needed in the server
- pSAVAGEDRIServer->drmBuffers = drmMapBufs( psav->drmFD );
- if ( !pSAVAGEDRIServer->drmBuffers ) {
- xf86DrvMsg( pScreen->myNum, X_ERROR,
- "[drm] Failed to map DMA buffers list\n" );
- return FALSE;
- }
- xf86DrvMsg( pScreen->myNum, X_INFO,
- "[drm] Mapped %d DMA buffers\n",
- pSAVAGEDRIServer->drmBuffers->count );
- */
-
return TRUE;
}
@@ -852,11 +773,6 @@ static void SAVAGEDRISetupTiledSurfaceRegs( SavagePtr psav )
OUTREG(0x850C,(INREG(0x850C) | 0x00008000)); /* AGD: I don't think this does anything on 3D/MX/IX */
/* maybe savage4 too... */
- /* we don't use Y range flag,so comment it */
- /*
- if(pSAVAGEDRI->width <= 1024)
- value |= (1<<29);
- */
if ((psav->Chipset == S3_SAVAGE_MX) /* 3D/MX/IX seem to set up the tile stride differently */
|| (psav->Chipset == S3_SAVAGE3D)) {
if(pSAVAGEDRI->cpp == 2)
@@ -896,7 +812,7 @@ Bool SAVAGEDRIFinishScreenInit( ScreenPtr pScreen )
SAVAGEDRIServerPrivatePtr pSAVAGEDRIServer = psav->DRIServerInfo;
SAVAGEDRIPtr pSAVAGEDRI = (SAVAGEDRIPtr)psav->pDRIInfo->devPrivate;
int i;
-
+
if ( !psav->pDRIInfo )
return FALSE;
@@ -959,12 +875,12 @@ Bool SAVAGEDRIFinishScreenInit( ScreenPtr pScreen )
pSAVAGEDRI->apertureHandle = pSAVAGEDRIServer->aperture.handle;
pSAVAGEDRI->apertureSize = pSAVAGEDRIServer->aperture.size;
pSAVAGEDRI->aperturePitch = psav->ulAperturePitch;
-
+
pSAVAGEDRI->statusHandle = pSAVAGEDRIServer->status.handle;
pSAVAGEDRI->statusSize = pSAVAGEDRIServer->status.size;
pSAVAGEDRI->sarea_priv_offset = sizeof(XF86DRISAREARec);
-
+
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers]pSAVAGEDRIServer:\n" );
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] reserved_map_agpstart:0x%08x\n",pSAVAGEDRIServer->reserved_map_agpstart);
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] reserved_map_idx:0x%08x\n",pSAVAGEDRIServer->reserved_map_idx);
@@ -989,17 +905,17 @@ Bool SAVAGEDRIFinishScreenInit( ScreenPtr pScreen )
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] agp:offset:0x%08x\n",pSAVAGEDRIServer->agp.offset);
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] agp:size:0x%08x\n",pSAVAGEDRIServer->agp.size);
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] agp:map:0x%08lx\n",(unsigned long)pSAVAGEDRIServer->agp.map);
-
+
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] registers:handle:0x%08lx\n",(unsigned long)pSAVAGEDRIServer->registers.handle);
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] registers:offset:0x%08x\n",pSAVAGEDRIServer->registers.offset);
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] registers:size:0x%08x\n",pSAVAGEDRIServer->registers.size);
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] registers:map:0x%08lx\n",(unsigned long)pSAVAGEDRIServer->registers.map);
-
+
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] status:handle:0x%08lx\n",(unsigned long)pSAVAGEDRIServer->status.handle);
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] status:offset:0x%08x\n",pSAVAGEDRIServer->status.offset);
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] status:size:0x%08x\n",pSAVAGEDRIServer->status.size);
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] status:map:0x%08lx\n",(unsigned long)pSAVAGEDRIServer->status.map);
-
+
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] agpTextures:handle:0x%08lx\n",(unsigned long)pSAVAGEDRIServer->agpTextures.handle);
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] agpTextures:offset:0x%08x\n",pSAVAGEDRIServer->agpTextures.offset);
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] agpTextures:size:0x%08x\n",pSAVAGEDRIServer->agpTextures.size);
@@ -1023,20 +939,20 @@ Bool SAVAGEDRIFinishScreenInit( ScreenPtr pScreen )
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] agpMode:%d\n",pSAVAGEDRI->agpMode );
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] bufferSize:%u\n",pSAVAGEDRI->bufferSize );
-
+
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] frontbufferSize:0x%08x\n",pSAVAGEDRI->frontbufferSize);
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] frontOffset:0x%08x\n",pSAVAGEDRI->frontOffset );
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] backbufferSize:0x%08x\n",pSAVAGEDRI->backbufferSize);
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] backOffset:0x%08x\n",pSAVAGEDRI->backOffset );
-
+
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] depthbufferSize:0x%08x\n",pSAVAGEDRI->depthbufferSize);
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] depthOffset:0x%08x\n",pSAVAGEDRI->depthOffset );
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] textureOffset:0x%08x\n",pSAVAGEDRI->textureOffset );
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] textureSize:0x%08x\n",pSAVAGEDRI->textureSize );
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] logTextureGranularity:0x%08x\n",pSAVAGEDRI->logTextureGranularity );
-
+
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] agpTextureHandle:0x%08lx\n",(unsigned long)pSAVAGEDRI->agpTextureHandle );
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] agpTextureSize:0x%08x\n",pSAVAGEDRI->agpTextureSize );
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] logAgpTextureGranularity:0x%08x\n",pSAVAGEDRI->logAgpTextureGranularity );
@@ -1049,7 +965,7 @@ Bool SAVAGEDRIFinishScreenInit( ScreenPtr pScreen )
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] statusSize:0x%08x\n",pSAVAGEDRI->statusSize);
xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] sarea_priv_offset:0x%08x\n",pSAVAGEDRI->sarea_priv_offset);
-
+
SAVAGEDRISetupTiledSurfaceRegs( psav );
return TRUE;
}
@@ -1134,7 +1050,7 @@ void SAVAGEDRICloseScreen( ScreenPtr pScreen )
}
DRICloseScreen( pScreen );
-
+
/* Don't use shadow status any more. If this happens due to failed
* DRI initialization then SavageScreenInit will do the real
* cleanup and restore ShadowStatus to sane settings. */
@@ -1433,42 +1349,36 @@ SAVAGEDRIOpenFullScreen(ScreenPtr pScreen)
unsigned int TileStride;
unsigned int WidthinTiles;
unsigned int depth;
-
+
OUTREG(0x48C18, INREG(0x48C18) & 0xFFFFFFF7);
- /*VGAOUT8(vgaCRIndex,0x66);
- VGAOUT8(vgaCRReg, VGAIN8(vgaCRReg)|0x10);*/
+
VGAOUT8(vgaCRIndex,0x69);
VGAOUT8(vgaCRReg, 0x80);
-
+
depth = pScrn->bitsPerPixel;
-
+
if(depth == 16)
{
WidthinTiles = (pSAVAGEDRI->width+63)>>6;
TileStride = (pSAVAGEDRI->width+63)&(~63);
-
}
else
{
WidthinTiles = (pSAVAGEDRI->width+31)>>5;
TileStride = (pSAVAGEDRI->width+31)&(~31);
-
}
-
/* set primary stream stride */
{
unsigned int value;
-
- /*value = 0x80000000|(WidthinTiles<<24)|(TileStride*depth/8);*/
+
value = 0x80000000|(WidthinTiles<<24);
if(depth == 32)
value |= 0x40000000;
-
+
OUTREG(PRI_STREAM_STRIDE, value);
-
}
-
+
/* set global bitmap descriptor */
{
unsigned int value;
@@ -1476,13 +1386,11 @@ SAVAGEDRIOpenFullScreen(ScreenPtr pScreen)
0x00000009|
0x01000000|
(depth<<16) | TileStride;
-
+
OUTREG(0x816C,value);
-
}
-
+
OUTREG(0x48C18, INREG(0x48C18) | 0x8);
-
return TRUE;
}
@@ -1501,10 +1409,10 @@ SAVAGEDRICloseFullScreen(ScreenPtr pScreen)
/* MM81C0 and 81C4 are used to control primary stream. */
OUTREG32(PRI_STREAM_FBUF_ADDR0,0x00000000);
OUTREG32(PRI_STREAM_FBUF_ADDR1,0x00000000);
-
+
/* FIFO control */
OUTREG32(0X81EC,0Xffffffff);
-
+
if (!psav->bTiled) {
OUTREG32(PRI_STREAM_STRIDE,
(((psav->lDelta * 2) << 16) & 0x3FFFE000) |
@@ -1521,17 +1429,14 @@ SAVAGEDRICloseFullScreen(ScreenPtr pScreen)
(((psav->lDelta * 2) << 16) & 0x3FFFE000)
| 0xC0000000 | (psav->lDelta & 0x00001fff));
}
-
-
}
-
+
/* set global bitmap descriptor */
{
OUTREG32(S3_GLB_BD_LOW,psav->GlobalBD.bd2.LoPart );
OUTREG32(S3_GLB_BD_HIGH,psav->GlobalBD.bd2.HiPart | BCI_ENABLE | S3_LITTLE_ENDIAN | S3_BD64);
-
}
-
+
OUTREG(0x48C18, INREG(0x48C18) | 0x8);
return TRUE;
}
diff --git a/src/savage_driver.c b/src/savage_driver.c
index 5eb665d..bd26a8d 100644
--- a/src/savage_driver.c
+++ b/src/savage_driver.c
@@ -610,8 +610,6 @@ WaitIdle4(SavagePtr psav)
psav->WaitIdle = ShadowWait;
return ShadowWait(psav);
}
- /* which is right?*/
- /*while( (!(ALT_STATUS_WORD0 & 0x00800000)) && (loop++ < MAXLOOP) );*/ /* tim */
while (((ALT_STATUS_WORD0 & 0x00E00000)!=0x00E00000) && (loop++ < MAXLOOP)); /* S3 */
return loop >= MAXLOOP;
}
@@ -849,7 +847,6 @@ static Bool SavageProbe(DriverPtr drv, int flags)
free(pEnt);
}
-
free(usedChips);
return foundScreen;
}
@@ -1005,7 +1002,6 @@ static void SavageGetPanelInfo(ScrnInfoPtr pScrn)
* I should come back to this.
*/
-
if( (hwp->readSeq( hwp, 0x39 ) & 0x03) == 0 )
{
sTechnology = "TFT";
@@ -1071,7 +1067,6 @@ static void SavageGetPanelInfo(ScrnInfoPtr pScrn)
}
}
-
static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags)
{
EntityInfoPtr pEnt;
@@ -1101,13 +1096,6 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags)
if (!vgaHWGetHWRec(pScrn))
return FALSE;
-#if 0
- /* Here we can alter the number of registers saved and restored by the
- * standard vgaHWSave and Restore routines.
- */
- vgaHWSetRegCounts( pScrn, VGA_NUM_CRTC, VGA_NUM_SEQ, VGA_NUM_GFX, VGA_NUM_ATTR );
-#endif
-
pScrn->monitor = pScrn->confScreen->monitor;
/*
@@ -1613,7 +1601,6 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags)
if (!psav->IsPCI) {
from = X_DEFAULT;
psav->agpMode = SAVAGE_DEFAULT_AGP_MODE;
- /*psav->agpMode = SAVAGE_MAX_AGP_MODE;*/
psav->agpSize = 16;
if (xf86GetOptValInteger(psav->Options,
@@ -1719,8 +1706,6 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags)
#endif
/* Add more options here. */
-
-
psav = SAVPTR(pScrn);
psav->IsSecondary = FALSE;
psav->IsPrimary = FALSE;
@@ -1934,10 +1919,10 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags)
psav->bciThresholdHi = psav->cobSize/4 + 32 - 2560;
psav->bciThresholdLo = psav->bciThresholdHi - 2560;
}
-
+
/* align cob to 128k */
psav->cobOffset = (psav->videoRambytes - psav->cobSize) & ~0x1ffff;
-
+
/* The cursor must be aligned on a 4k boundary. */
psav->CursorKByte = (psav->cobOffset >> 10) - 4;
psav->endfb = (psav->CursorKByte << 10) - 1;
@@ -1956,7 +1941,6 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags)
if(psav->IsSecondary)
{
pScrn->videoRam /= 2;
- /*psav->videoRambytes = pScrn->videoRam * 1024;*/
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Using %dk of videoram for secondary head\n",
pScrn->videoRam);
@@ -2041,18 +2025,7 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags)
/* DisplayType will be reset if panel is not active */
if(psav->DisplayType == MT_LCD)
SavageAddPanelMode(pScrn);
-
-#if 0
- if (psav->CrtOnly && !psav->UseBIOS) {
- VGAOUT8(0x3c4, 0x31); /* SR31 bit 4 - FP enable */
- VGAOUT8(0x3c5, VGAIN8(0x3c5) & ~0x10); /* disable FP */
- if (S3_SAVAGE_MOBILE_SERIES(psav->Chipset) /*||
- S3_MOBILE_TWISTER_SERIES(psav->Chipset)*/) { /* not sure this works on mobile prosavage */
- VGAOUT8(0x3c4, 0x31);
- VGAOUT8(0x3c5, VGAIN8(0x3c5) & ~0x04); /* make sure crtc1 is crt source */
- }
- }
-#endif
+
if( psav->UseBIOS )
{
@@ -2427,15 +2400,9 @@ static void SavageSave(ScrnInfoPtr pScrn)
psav->ModeStructInit = TRUE;
}
-#if 0
- if (xf86GetVerbosity() > 1)
- SavagePrintRegs(pScrn);
-#endif
-
return;
}
-
static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr,
SavageRegPtr restore, Bool Entering)
{
@@ -2489,13 +2456,6 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr,
/* Unlock the extended registers. */
-#if 0
- /* Which way is better? */
- hwp->writeCrtc( hwp, 0x38, 0x48 );
- hwp->writeCrtc( hwp, 0x39, 0xa0 );
- hwp->writeSeq( hwp, 0x08, 0x06 );
-#endif
-
VGAOUT16(vgaCRIndex, 0x4838);
VGAOUT16(vgaCRIndex, 0xA039);
VGAOUT16(0x3c4, 0x0608);
@@ -2681,7 +2641,6 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr,
VGAOUT8(vgaCRIndex, 0x67);
(void) VGAIN8(vgaCRReg);
- /*VGAOUT8(vgaCRReg, restore->CR67 & ~0x0c);*/ /* no STREAMS yet */
VGAOUT8(vgaCRReg, restore->CR67 & ~0x0e); /* no STREAMS yet old and new */
/* restore extended regs */
@@ -2745,7 +2704,6 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr,
/* restore the desired video mode with cr67 */
VGAOUT8(vgaCRIndex, 0x67);
- /*VGAOUT8(vgaCRReg, restore->CR67 & ~0x0c);*/ /* no STREAMS yet */
VGAOUT8(vgaCRReg, restore->CR67 & ~0x0e); /* no streams for new and old streams engines */
/* other mode timing and extended regs */
@@ -2846,11 +2804,6 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr,
/* now write out cr67 in full, possibly starting STREAMS */
VerticalRetraceWait();
VGAOUT8(vgaCRIndex, 0x67);
-#if 0
- VGAOUT8(vgaCRReg, 0x50);
- usleep(10000);
- VGAOUT8(vgaCRIndex, 0x67);
-#endif
VGAOUT8(vgaCRReg, restore->CR67);
VGAOUT8(vgaCRIndex, 0x66);
@@ -2875,15 +2828,6 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr,
/* If we're going into graphics mode and acceleration was enabled, */
/* go set up the BCI buffer and the global bitmap descriptor. */
-#if 0
- if( Entering && (!psav->NoAccel) )
- {
- VGAOUT8(vgaCRIndex, 0x50);
- VGAOUT8(vgaCRReg, VGAIN8(vgaCRReg) | 0xC1);
- SavageInitialize2DEngine(pScrn);
- }
-#endif
-
VGAOUT8(vgaCRIndex, 0x66);
VGAOUT8(vgaCRReg, cr66);
VGAOUT8(vgaCRIndex, 0x3a);
@@ -3535,8 +3479,7 @@ static int SavageInternalScreenInit(ScreenPtr pScreen)
width = pScrn->virtualX;
height = pScrn->virtualY;
}
-
-
+
if(psav->shadowFB) {
psav->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width);
psav->ShadowPtr = malloc(psav->ShadowPitch * height);
@@ -3659,25 +3602,6 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
TRACE(("SavageModeInit(%dx%d, %dkHz)\n",
mode->HDisplay, mode->VDisplay, mode->Clock));
-
-#if 0
- ErrorF("Clock = %d, HDisplay = %d, HSStart = %d\n",
- mode->Clock, mode->HDisplay, mode->HSyncStart);
- ErrorF("HSEnd = %d, HSkew = %d\n",
- mode->HSyncEnd, mode->HSkew);
- ErrorF("VDisplay - %d, VSStart = %d, VSEnd = %d\n",
- mode->VDisplay, mode->VSyncStart, mode->VSyncEnd);
- ErrorF("VTotal = %d\n",
- mode->VTotal);
- ErrorF("HDisplay = %d, HSStart = %d\n",
- mode->CrtcHDisplay, mode->CrtcHSyncStart);
- ErrorF("HSEnd = %d, HSkey = %d\n",
- mode->CrtcHSyncEnd, mode->CrtcHSkew);
- ErrorF("VDisplay - %d, VSStart = %d, VSEnd = %d\n",
- mode->CrtcVDisplay, mode->CrtcVSyncStart, mode->CrtcVSyncEnd);
- ErrorF("VTotal = %d\n",
- mode->CrtcVTotal);
-#endif
if (psav->IsSecondary) {
int refresh = SavageGetRefresh(mode);
@@ -3700,30 +3624,8 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
return TRUE;
}
-
-#if 0
- if (pScrn->bitsPerPixel == 8)
- psav->HorizScaleFactor = 1;
- else if (pScrn->bitsPerPixel == 16)
- psav->HorizScaleFactor = 1; /* I don't think we ever want 2 */
- else
- psav->HorizScaleFactor = 1;
-
- if (psav->HorizScaleFactor == 2)
- if (!mode->CrtcHAdjusted) {
- mode->CrtcHDisplay *= 2;
- mode->CrtcHSyncStart *= 2;
- mode->CrtcHSyncEnd *= 2;
- mode->CrtcHBlankStart *= 2;
- mode->CrtcHBlankEnd *= 2;
- mode->CrtcHTotal *= 2;
- mode->CrtcHSkew *= 2;
- mode->CrtcHAdjusted = TRUE;
- }
-#else
psav->HorizScaleFactor = 1;
-#endif
-
+
if (!vgaHWInit(pScrn, mode))
return FALSE;
@@ -3801,17 +3703,9 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
new->CR58 = VGAIN8(vgaCRReg) & 0x80;
new->CR58 |= 0x13;
-#if 0
- VGAOUT8(vgaCRIndex, 0x55);
- new->CR55 = VGAIN8(vgaCRReg);
- if (psav->hwcursor)
- new->CR55 |= 0x10;
-#endif
-
new->SR15 = 0x03 | 0x80;
new->SR18 = 0x00;
-
/* enable gamma correction */
if( pScrn->depth == 24 )
new->SR1B = 0x18;
@@ -4046,7 +3940,6 @@ void SavageAdjustFrame(ScrnInfoPtr pScrn, int x, int y)
} else {
SavageDoAdjustFrame(pScrn, x, y, FALSE);
}
-
}
void
@@ -4080,7 +3973,7 @@ SavageDoAdjustFrame(ScrnInfoPtr pScrn, int x, int y, int crtc2)
address = top * psav->lDelta + left * tile_size / TILEWIDTH_32BPP;
}
}
-
+
address += pScrn->fbOffset;
if (psav->Chipset == S3_SAVAGE_MX) {
@@ -4109,7 +4002,7 @@ SavageDoAdjustFrame(ScrnInfoPtr pScrn, int x, int y, int crtc2)
OUTREG32(PRI_STREAM_FBUF_ADDR0,address | 0xFFFFFFFC);
OUTREG32(PRI_STREAM_FBUF_ADDR1,address | 0x80000000);
}
-
+
return;
}
@@ -4272,17 +4165,13 @@ SavageUpdateKey(ScrnInfoPtr pScrn, int r, int g, int b)
}
}
-#if 0
-#define inStatus1() (hwp->readST01( hwp ))
-#endif
-
void SavageLoadPaletteSavage4(ScrnInfoPtr pScrn, int numColors, int *indices,
LOCO *colors, VisualPtr pVisual)
{
SavagePtr psav = SAVPTR(pScrn);
int index;
int updateKey = -1;
-
+
VerticalRetraceWait();
for (int n = 0; n < numColors; n++) {
@@ -4447,8 +4336,6 @@ void SavageGEReset(ScrnInfoPtr pScrn, int from_timeout,
}
-
-
/* This function is used to debug, it prints out the contents of s3 regs */
void
@@ -4548,7 +4435,7 @@ static void
SavageProbeDDC(ScrnInfoPtr pScrn, int index)
{
vbeInfoPtr pVbe;
-
+
if (xf86LoadSubModule(pScrn, "vbe")) {
pVbe = VBEInit(NULL, index);
ConfiguredMonitor = vbeDoEDID(pVbe, NULL);
@@ -4585,7 +4472,7 @@ SavageDDC1(ScrnInfoPtr pScrn)
xf86MonPtr pMon;
UnLockExtRegs();
-
+
/* initialize chipset */
InI2CREG(byte,psav->I2CPort);
OutI2CREG(byte | 0x12,psav->I2CPort);
@@ -4593,9 +4480,9 @@ SavageDDC1(ScrnInfoPtr pScrn)
pMon = xf86DoEDID_DDC1(pScrn, SavageDDC1SetSpeed, SavageDDC1Read);
if (!pMon)
return FALSE;
-
+
xf86PrintEDID(pMon);
-
+
if (!psav->IgnoreEDID)
xf86SetDDCproperties(pScrn,pMon);
@@ -4618,7 +4505,6 @@ SavageGetTvMaxSize(SavagePtr psav)
}
}
-
static Bool
SavagePanningCheck(ScrnInfoPtr pScrn, DisplayModePtr pMode)
{
@@ -4692,5 +4578,4 @@ SavageResetStreams(ScrnInfoPtr pScrn)
default:
break;
}
-
}
diff --git a/src/savage_driver.h b/src/savage_driver.h
index d4ed859..65c0d51 100644
--- a/src/savage_driver.h
+++ b/src/savage_driver.h
@@ -464,11 +464,6 @@ typedef struct _Savage {
ScreenWakeupHandlerProcPtr coreWakeupHandler;
ScreenBlockHandlerProcPtr coreBlockHandler;
-#if 0
- Bool haveQuiescense;
- void (*GetQuiescence)(ScrnInfoPtr pScrn);
-#endif
-
Bool IsPCI;
Bool AgpDMA;
Bool VertexDMA;
@@ -476,7 +471,7 @@ typedef struct _Savage {
int agpMode;
drmSize agpSize;
FBLinearPtr reserved;
-
+
unsigned int surfaceAllocation[7];
unsigned int xvmcContext;
unsigned int DRIrunning;
@@ -512,7 +507,7 @@ typedef struct _Savage {
* out of the cyMemory calculation.
*/
int cxMemory,cyMemory;
-
+
StatInfoRec StatInfo; /* save the SVGA state */
/* for dvi option */
@@ -586,7 +581,6 @@ void SavageInitialize2DEngine(ScrnInfoPtr);
int SavageGetCopyROP(int rop);
void SavageSetGBD(ScrnInfoPtr);
void SavageAccelSync(ScrnInfoPtr);
-/*int SavageHelpSolidROP(ScrnInfoPtr pScrn, int *fg, int pm, int *rop);*/
/* EXA */
Bool SavageEXAInit(ScreenPtr);
@@ -633,17 +627,14 @@ void SavageInitStreamsOld(ScrnInfoPtr pScrn);
void SavageInitStreamsNew(ScrnInfoPtr pScrn);
void SavageInitStreams2000(ScrnInfoPtr pScrn);
-
#if (MODE_24 == 32)
-# define BYTES_PP24 4
+# define BYTES_PP24 4
#else
# define BYTES_PP24 3
#endif
-
#define DEPTH_BPP(depth) (depth == 24 ? (BYTES_PP24 << 3) : (depth + 7) & ~0x7)
#define DEPTH_2ND(pScrn) (pScrn->depth > 8 ? pScrn->depth\
: SAVPTR(pScrn)->overlayDepth)
#endif /* SAVAGE_DRIVER_H */
-
diff --git a/src/savage_drm.h b/src/savage_drm.h
index 277afec..b1ab267 100644
--- a/src/savage_drm.h
+++ b/src/savage_drm.h
@@ -191,13 +191,6 @@ typedef struct drm_savage_init {
unsigned long fb_offset;
unsigned long mmio_offset;
unsigned long status_offset;
-#if 0
-/*============================================================*/
- unsigned long warp_offset;
- unsigned long primary_offset;
- unsigned long buffers_offset;
-/*============================================================*/
-#endif /*end #if 0 */
} drm_savage_init_t;
typedef struct drm_savage_fullscreen {
diff --git a/src/savage_exa.c b/src/savage_exa.c
index 25e0cf6..27419ea 100644
--- a/src/savage_exa.c
+++ b/src/savage_exa.c
@@ -45,29 +45,8 @@ SavageDoneCopy(PixmapPtr pDstPixmap);
Bool
SavageUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src, int src_pitch);
-#if 1
Bool
SavageDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, char *dst, int dst_pitch);
-#endif
-
-#if 0
-#define GXclear 0x00
-#define GXand 0x88
-#define GXandReverse 0x44
-#define GXcopy 0xCC
-#define GXandInverted 0x22
-#define GXnoop 0xAA
-#define GXxor 0x66
-#define GXor 0xEE
-#define GXnor 0x11
-#define GXequiv 0x99
-#define GXinvert 0x55
-#define GXorReverse 0xDD
-#define GXcopyInverted 0x33
-#define GXorInverted 0xBB
-#define GXnand 0x77
-#define GXset 0xFF
-#endif
static int SavageGetSolidROP(int rop) {
@@ -93,7 +72,6 @@ static int SavageGetSolidROP(int rop) {
};
return (ALUSolidROP[rop]);
-
}
Bool
@@ -108,11 +86,9 @@ SavageEXAInit(ScreenPtr pScreen)
return FALSE;
}
- /*ErrorF("in SavageEXAinit\n");*/
-
psav->EXADriverPtr->exa_major = 2;
psav->EXADriverPtr->exa_minor = 0;
-
+
/* use the linear aperture */
psav->EXADriverPtr->memoryBase = psav->FBBase + pScrn->fbOffset;
@@ -157,7 +133,7 @@ SavageEXAInit(ScreenPtr pScreen)
/* Sync */
psav->EXADriverPtr->WaitMarker = SavageEXASync;
-#if 1
+
/* Solid fill */
psav->EXADriverPtr->PrepareSolid = SavagePrepareSolid;
psav->EXADriverPtr->Solid = SavageSolid;
@@ -167,17 +143,12 @@ SavageEXAInit(ScreenPtr pScreen)
psav->EXADriverPtr->PrepareCopy = SavagePrepareCopy;
psav->EXADriverPtr->Copy = SavageCopy;
psav->EXADriverPtr->DoneCopy = SavageDoneCopy;
-#endif
+
/* Composite not implemented yet */
/* savage3d series only have one tmu */
-#if 1
/* host data blit */
psav->EXADriverPtr->UploadToScreen = SavageUploadToScreen;
-#endif
-#if 0
- psav->EXADriverPtr->DownloadFromScreen = SavageDownloadFromScreen;
-#endif
if(!exaDriverInit(pScreen, psav->EXADriverPtr)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -259,38 +230,8 @@ SavagePrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
| BCI_CMD_DEST_PBD /*BCI_CMD_DEST_PBD_NEW*/
| BCI_CMD_SRC_SOLID;
-#if 0
- if (alu == 3 /*GXcopy*/) {
- if (fg == 0)
- alu = 0 /*GXclear*/;
- else if (fg == planemask)
- alu = 15 /*GXset*/;
- }
-
- if (EXA_PM_IS_SOLID(&pPixmap->drawable, planemask)) {
- if (!((alu == 5 /*GXnoop*/) || (alu == 15 /*GXset*/) || (alu == 0 /*GXclear*/) || (alu == 10 /*GXinvert*/)))
- cmd |= BCI_CMD_SEND_COLOR;
- rop = SavageGetCopyROP(alu);
- } else {
- switch(alu) {
- case 5 /*GXnoop*/:
- break;
- case 15 /*GXset*/:
- case 0 /*GXclear*/:
- case 10 /*GXinvert*/:
- cmd |= BCI_CMD_SEND_COLOR;
- fg = planemask;
- break;
- default:
- cmd |= BCI_CMD_SEND_COLOR;
- break;
- }
- rop = SavageGetSolidROP(alu);
- }
-#else
cmd |= BCI_CMD_SEND_COLOR;
rop = SavageGetSolidROP(alu);
-#endif
BCI_CMD_SET_ROP( cmd, rop );
@@ -328,16 +269,9 @@ SavageSolid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
/* yes, it has to be done this way... */
psav->WaitQueue(psav,4);
BCI_SEND(psav->SavedBciCmd);
- /*BCI_SEND(psav->pbd_offset);
- BCI_SEND(psav->pbd_high);*/
-#if 0
- if ( psav->SavedBciCmd & BCI_CMD_SEND_COLOR )
- BCI_SEND(psav->SavedFgColor);
-#endif
BCI_SEND(psav->SavedFgColor);
BCI_SEND(BCI_X_Y(x1, y1));
BCI_SEND(BCI_W_H(w, h));
-
}
static void
@@ -354,8 +288,6 @@ SavagePrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, int ydir
int cmd;
BCI_GET_PTR;
- /*ErrorF("in preparecopy\n");*/
-
cmd = BCI_CMD_RECT | BCI_CMD_DEST_PBD | BCI_CMD_SRC_SBD_COLOR;
BCI_CMD_SET_ROP( cmd, SavageGetCopyROP(alu) );
@@ -421,7 +353,6 @@ SavageCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY, int wid
BCI_SEND(BCI_X_Y(srcX, srcY));
BCI_SEND(BCI_X_Y(dstX, dstY));
BCI_SEND(BCI_W_H(width, height));
-
}
static void
@@ -443,7 +374,7 @@ SavageUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src, int
unsigned int dst_yoffset;
int agp_possible;
#endif
-
+
exaWaitSync(pDst->drawable.pScreen);
Bpp = pDst->drawable.bitsPerPixel / 8;
@@ -470,7 +401,7 @@ SavageUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src, int
pSAVAGEDRIServer->agpXVideo.handle,
pSAVAGEDRIServer->agpXVideo.size,
&pSAVAGEDRIServer->agpXVideo.map)) {
-
+
unsigned char * agpMap = pSAVAGEDRIServer->agpXVideo.map;
unsigned int agpOffset = drmAgpBase(psav->drmFD) + pSAVAGEDRIServer->agpXVideo.offset;
unsigned int bytesTotal = dst_pitch * h;
@@ -484,7 +415,7 @@ SavageUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src, int
/* Copy source into AGP buffer */
memcpy(agpMap, src, bytesTransfer);
-
+
psav->WaitQueue(psav,6);
BCI_SEND(BCI_SET_REGISTER | BCI_SET_REGISTER_COUNT(2) | 0x51);
BCI_SEND(agpOffset | 3); /* Source buffer in AGP memory */
@@ -519,8 +450,6 @@ SavageUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src, int
BCI_CMD_SET_ROP( cmd, 0xCC ); /* GXcopy */
- /*ErrorF("in UTS\n");*/
-
psav->WaitQueue(psav, 6);
BCI_SEND(cmd);
@@ -531,7 +460,7 @@ SavageUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src, int
BCI_SEND(BCI_CLIP_LR(x, x+w-1));
BCI_SEND(BCI_X_Y(x, y));
BCI_SEND(BCI_W_H(w, h));
-
+
queue = 120 * 1024;
dwords = (((w * Bpp) + 3) >> 2);
for (i = 0; i < h; i++) {
@@ -555,12 +484,10 @@ SavageUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src, int
src += src_pitch;
}
- /*exaWaitSync(pDst->drawable.pScreen);*/
exaMarkSync(pDst->drawable.pScreen);
return TRUE;
}
-#if 1
Bool
SavageDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, char *dst, int dst_pitch)
{
@@ -581,5 +508,3 @@ SavageDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, char *dst,
}
return TRUE;
}
-
-#endif
diff --git a/src/savage_streams.c b/src/savage_streams.c
index c959da6..3748cf6 100644
--- a/src/savage_streams.c
+++ b/src/savage_streams.c
@@ -72,7 +72,7 @@ SavageInitSecondaryStreamOld(ScrnInfoPtr pScrn)
OUTREG(SSTREAM_VINITIAL_REG, 0 );
OUTREG(SSTREAM_FBADDR0_REG, offset & 0x1ffffff & ~BASE_PAD);
OUTREG(SSTREAM_FBADDR1_REG, 0 );
-
+
OUTREG(SSTREAM_STRIDE_REG, pitch);
OUTREG(SSTREAM_WINDOW_START_REG, OS_XY(0,0));
OUTREG(SSTREAM_WINDOW_SIZE_REG,
@@ -124,7 +124,7 @@ SavageInitSecondaryStreamNew(ScrnInfoPtr pScrn)
OUTREG(SEC_STREAM_WINDOW_START, OS_XY(0,0));
/* ? width may need to be increased by 1 */
OUTREG(SEC_STREAM_WINDOW_SZ, OS_WH(pScrn->displayWidth, pScrn->virtualY));
-
+
pitch = (pitch + 7) / 8;
VGAOUT8(vgaCRIndex, 0x92);
cr92 = VGAIN8(vgaCRReg);
@@ -148,7 +148,6 @@ SavageInitSecondaryStream(ScrnInfoPtr pScrn)
void SavageInitStreamsOld(ScrnInfoPtr pScrn)
{
SavagePtr psav = SAVPTR(pScrn);
- /*unsigned long jDelta;*/
unsigned long format = 0;
/*
@@ -167,7 +166,6 @@ void SavageInitStreamsOld(ScrnInfoPtr pScrn)
OUTREG( PSTREAM_FBADDR0_REG, pScrn->fbOffset );
OUTREG( PSTREAM_FBADDR1_REG, 0 );
} else {
- /*jDelta = pScrn->displayWidth * (pScrn->bitsPerPixel + 7) / 8;*/
switch( pScrn->depth ) {
case 8: format = 0 << 24; break;
case 15: format = 3 << 24; break;
@@ -179,15 +177,10 @@ void SavageInitStreamsOld(ScrnInfoPtr pScrn)
}
OUTREG(FIFO_CONTROL, 0x18ffeL);
-
+
OUTREG( PSTREAM_WINDOW_START_REG, OS_XY(0,0) );
OUTREG( PSTREAM_WINDOW_SIZE_REG, OS_WH(pScrn->displayWidth, pScrn->virtualY) );
-/* OUTREG( PSTREAM_FBADDR0_REG, pScrn->fbOffset );
- OUTREG( PSTREAM_FBADDR1_REG, 0 ); */
- /*OUTREG( PSTREAM_STRIDE_REG, jDelta );*/
OUTREG( PSTREAM_CONTROL_REG, format );
- /*OUTREG( PSTREAM_FBSIZE_REG, jDelta * pScrn->virtualY >> 3 );*/
-
OUTREG( COL_CHROMA_KEY_CONTROL_REG, 0 );
OUTREG( SSTREAM_CONTROL_REG, 0 );
OUTREG( CHROMA_KEY_UPPER_BOUND_REG, 0 );
@@ -236,10 +229,6 @@ void SavageInitStreamsNew(ScrnInfoPtr pScrn)
} else {
OUTREG(PRI_STREAM_BUFFERSIZE,
pScrn->virtualX * pScrn->virtualY * (pScrn->bitsPerPixel >> 3));
-#if 0
- OUTREG(PRI_STREAM2_BUFFERSIZE,
- pScrn->virtualX * pScrn->virtualY * (pScrn->bitsPerPixel >> 3));
-#endif
}
if (psav->FBStart2nd) {
@@ -260,7 +249,6 @@ void SavageInitStreamsNew(ScrnInfoPtr pScrn)
OUTREG( SEC_STREAM2_FBUF_ADDR2, 0 );
OUTREG( SEC_STREAM2_WINDOW_START, 0 );
OUTREG( SEC_STREAM2_WINDOW_SZ, 0 );
-/* OUTREG( SEC_STREAM2_BUFFERSIZE, 0 ); */
OUTREG( SEC_STREAM2_OPAQUE_OVERLAY, 0 );
OUTREG( SEC_STREAM2_STRIDE_LPB, 0 );
@@ -279,7 +267,6 @@ void SavageInitStreamsNew(ScrnInfoPtr pScrn)
OUTREG( SEC_STREAM_FBUF_ADDR2, 0 );
OUTREG( SEC_STREAM_WINDOW_START, 0 );
OUTREG( SEC_STREAM_WINDOW_SZ, 0 );
-/* OUTREG( SEC_STREAM_BUFFERSIZE, 0 ); */
OUTREG( SEC_STREAM_TILE_OFF, 0 );
OUTREG( SEC_STREAM_OPAQUE_OVERLAY, 0 );
OUTREG( SEC_STREAM_STRIDE, 0 );
@@ -299,7 +286,6 @@ void SavageInitStreamsNew(ScrnInfoPtr pScrn)
OUTREG( SEC_STREAM_FBUF_ADDR2, 0 );
OUTREG( SEC_STREAM_WINDOW_START, 0 );
OUTREG( SEC_STREAM_WINDOW_SZ, 0 );
-/* OUTREG( SEC_STREAM_BUFFERSIZE, 0 ); */
OUTREG( SEC_STREAM_TILE_OFF, 0 );
OUTREG( SEC_STREAM_OPAQUE_OVERLAY, 0 );
OUTREG( SEC_STREAM_STRIDE, 0 );
@@ -308,34 +294,12 @@ void SavageInitStreamsNew(ScrnInfoPtr pScrn)
OUTREG( SEC_STREAM_COLOR_CONVERT1, 0x0000C892 );
OUTREG( SEC_STREAM_COLOR_CONVERT2, 0x00039F9A );
OUTREG( SEC_STREAM_COLOR_CONVERT3, 0x01F1547E );
-#if 0
- sleep(1);
- OUTREG( SEC_STREAM2_CKEY_LOW, 0 );
- OUTREG( SEC_STREAM2_CKEY_UPPER, 0 );
- OUTREG( SEC_STREAM2_HSCALING, 0 );
- OUTREG( SEC_STREAM2_VSCALING, 0 );
- OUTREG( BLEND_CONTROL, 0 );
- OUTREG( SEC_STREAM2_FBUF_ADDR0, 0 );
- OUTREG( SEC_STREAM2_FBUF_ADDR1, 0 );
- OUTREG( SEC_STREAM2_FBUF_ADDR2, 0 );
- OUTREG( SEC_STREAM2_WINDOW_START, 0 );
- OUTREG( SEC_STREAM2_WINDOW_SZ, 0 );
-/* OUTREG( SEC_STREAM2_BUFFERSIZE, 0 ); */
- OUTREG( SEC_STREAM2_OPAQUE_OVERLAY, 0 );
- OUTREG( SEC_STREAM2_STRIDE_LPB, 0 );
-
- /* These values specify brightness, contrast, saturation and hue. */
- OUTREG( SEC_STREAM2_COLOR_CONVERT1, 0x0000C892 );
- OUTREG( SEC_STREAM2_COLOR_CONVERT2, 0x00039F9A );
- OUTREG( SEC_STREAM2_COLOR_CONVERT3, 0x01F1547E );
-#endif
}
}
void SavageInitStreams2000(ScrnInfoPtr pScrn)
{
SavagePtr psav = SAVPTR(pScrn);
- /*unsigned long jDelta;*/
xf86ErrorFVerb(STREAMS_TRACE, "SavageInitStreams\n" );
@@ -344,7 +308,6 @@ void SavageInitStreams2000(ScrnInfoPtr pScrn)
OUTREG(PRI_STREAM2_BUFFERSIZE,
pScrn->virtualX * pScrn->virtualY * (pScrn->bitsPerPixel >> 3));
-
if (psav->FBStart2nd) {
unsigned long jDelta = pScrn->displayWidth;
OUTREG( PRI_STREAM_BUFFERSIZE, jDelta * pScrn->virtualY >> 3 );
@@ -352,7 +315,6 @@ void SavageInitStreams2000(ScrnInfoPtr pScrn)
OUTREG( PRI_STREAM_STRIDE, jDelta );
}
-
OUTREG( SEC_STREAM_CKEY_LOW, (4L << 29) );
OUTREG( SEC_STREAM_CKEY_UPPER, 0 );
OUTREG( SEC_STREAM_HSCALING, 0 );
@@ -364,7 +326,6 @@ void SavageInitStreams2000(ScrnInfoPtr pScrn)
OUTREG( SEC_STREAM_FBUF_ADDR2, 0 );
OUTREG( SEC_STREAM_WINDOW_START, 0 );
OUTREG( SEC_STREAM_WINDOW_SZ, 0 );
-/* OUTREG( SEC_STREAM_BUFFERSIZE, 0 ); */
OUTREG( SEC_STREAM_TILE_OFF, 0 );
OUTREG( SEC_STREAM_OPAQUE_OVERLAY, 0 );
OUTREG( SEC_STREAM_STRIDE, 0 );
@@ -395,7 +356,7 @@ void SavageInitStreams2000(ScrnInfoPtr pScrn)
static void OverlayTwisterInit(ScrnInfoPtr pScrn)
{
SavagePtr psav = SAVPTR(pScrn);
-
+
psav->cxScreen = psav->iResX;
InitStreamsForExpansion(pScrn);
PatchEnableSPofPanel(pScrn);
@@ -417,9 +378,9 @@ static
void PatchEnableSPofPanel(ScrnInfoPtr pScrn)
{
SavagePtr psav = SAVPTR(pScrn);
-
+
UnLockExtRegs();
-
+
if (pScrn->bitsPerPixel == 8) {
OUTREG8(CRT_ADDRESS_REG,0x90);
OUTREG8(CRT_DATA_REG,INREG8(CRT_DATA_REG)|0x40);
@@ -428,9 +389,9 @@ void PatchEnableSPofPanel(ScrnInfoPtr pScrn)
OUTREG8(CRT_ADDRESS_REG,0x90);
OUTREG8(CRT_DATA_REG,INREG8(CRT_DATA_REG)|0x48);
}
-
+
VerticalRetraceWait();
-
+
OUTREG8(CRT_ADDRESS_REG,0x67);
OUTREG8(CRT_DATA_REG,(INREG8(CRT_DATA_REG)&0xf3)|0x04);
@@ -444,11 +405,8 @@ void PatchEnableSPofPanel(ScrnInfoPtr pScrn)
}
OUTREG32(PSTREAM_WINDOW_SIZE_REG, 0x0);
- /*OUTREG32(PSTREAM_WINDOW_SIZE_REG, OS_WH(pScrn->displayWidth, pScrn->virtualY));*/
-
}
-
/* Function to calculate lcd expansion x,y factor and offset for overlay
*/
static void InitStreamsForExpansion(ScrnInfoPtr pScrn)
@@ -482,8 +440,6 @@ static void InitStreamsForExpansion(ScrnInfoPtr pScrn)
0x00030001, 0x00040001,
};
-
-
PanelSizeX = psav->PanelX;
PanelSizeY = psav->PanelY;
ViewPortWidth = pScrn->currentMode->HDisplay;
@@ -527,8 +483,7 @@ static void InitStreamsForExpansion(ScrnInfoPtr pScrn)
((PanelSizeX - (psav->XExp1 * ViewPortWidth) / psav->XExp2) / 2 + 7) & 0xfff8;
psav->displayYoffset =
((PanelSizeY - (psav->YExp1 * ViewPortHeight) / psav->YExp2) / 2);
-
-} /* InitStreamsForExpansionPM */
+}
void
SavageStreamsOn(ScrnInfoPtr pScrn)
@@ -541,8 +496,6 @@ SavageStreamsOn(ScrnInfoPtr pScrn)
xf86ErrorFVerb(STREAMS_TRACE, "SavageStreamsOn\n" );
/* Sequence stolen from streams.c in M7 NT driver */
-
-
xf86EnableIO();
/* Unlock extended registers. */
@@ -584,24 +537,10 @@ SavageStreamsOn(ScrnInfoPtr pScrn)
VerticalRetraceWait();
/* Fire up streams! */
VGAOUT16( vgaCRIndex, (jStreamsControl << 8) | EXT_MISC_CTRL2 );
-#if 0
- SelectIGA2();
- /* Wait for VBLANK. */
- VerticalRetraceWait();
- /* Fire up streams! */
- VGAOUT16( vgaCRIndex, (jStreamsControl << 8) | EXT_MISC_CTRL2 );
- SelectIGA1();
-#endif
/* These values specify brightness, contrast, saturation and hue. */
OUTREG( SEC_STREAM_COLOR_CONVERT1, 0x0000C892 );
OUTREG( SEC_STREAM_COLOR_CONVERT2, 0x00039F9A );
OUTREG( SEC_STREAM_COLOR_CONVERT3, 0x01F1547E );
-#if 0
- sleep(1);
- OUTREG( SEC_STREAM2_COLOR_CONVERT1, 0x0000C892 );
- OUTREG( SEC_STREAM2_COLOR_CONVERT2, 0x00039F9A );
- OUTREG( SEC_STREAM2_COLOR_CONVERT3, 0x01F1547E );
-#endif
}
}
else if (psav->Chipset == S3_SAVAGE2000)
@@ -625,18 +564,16 @@ SavageStreamsOn(ScrnInfoPtr pScrn)
jStreamsControl = VGAIN8( vgaCRReg ) | ENABLE_STREAMS_OLD;
/* Wait for VBLANK. */
-
VerticalRetraceWait();
/* Fire up streams! */
-
VGAOUT16( vgaCRIndex, (jStreamsControl << 8) | EXT_MISC_CTRL2 );
SavageInitStreamsOld( pScrn );
}
/* Wait for VBLANK. */
-
+
VerticalRetraceWait();
/* Turn on secondary stream TV flicker filter, once we support TV. */
@@ -644,7 +581,6 @@ SavageStreamsOn(ScrnInfoPtr pScrn)
/* SR70 |= 0x10 */
psav->videoFlags |= VF_STREAMS_ON;
-
}
void
@@ -656,7 +592,7 @@ SavageStreamsOff(ScrnInfoPtr pScrn)
unsigned short vgaCRReg = psav->vgaIOBase + 5;
xf86ErrorFVerb(STREAMS_TRACE, "SavageStreamsOff\n" );
-
+
xf86EnableIO();
/* Unlock extended registers. */
@@ -685,11 +621,6 @@ SavageStreamsOff(ScrnInfoPtr pScrn)
VGAOUT16( vgaCRIndex, (jStreamsControl << 8) | EXT_MISC_CTRL2 );
} else {
VGAOUT16( vgaCRIndex, (jStreamsControl << 8) | EXT_MISC_CTRL2 );
-#if 0
- SelectIGA2();
- VGAOUT16( vgaCRIndex, (jStreamsControl << 8) | EXT_MISC_CTRL2 );
- SelectIGA1();
-#endif
}
VGAOUT16( vgaCRIndex, 0x0093 );
@@ -697,6 +628,4 @@ SavageStreamsOff(ScrnInfoPtr pScrn)
VGAOUT8( vgaCRReg, VGAIN8(vgaCRReg) & 0x40 );
psav->videoFlags &= ~VF_STREAMS_ON;
-
}
-
diff --git a/src/savage_video.c b/src/savage_video.c
index b127192..7757883 100644
--- a/src/savage_video.c
+++ b/src/savage_video.c
@@ -164,7 +164,6 @@ static XF86AttributeRec Attributes[NUM_ATTRIBUTES] =
* I420, planar 4:1:1, Y plane HxW, U plane H/2xW/2, V plane H/2xW/2
* (I420 is also known as IYUV)
*/
-
static XF86ImageRec Images[] =
{
@@ -233,7 +232,6 @@ typedef struct {
int hue; /* -128 .. 127 */
Bool interpolation; /* on/off */
- /*FBAreaPtr area;*/
RegionRec clip;
CARD32 colorKey;
CARD32 videoStatus;
@@ -246,7 +244,7 @@ typedef struct {
void *video_planarmem; /* opaque memory management information structure */
CARD32 video_planarbuf; /* offset in video memory of planar YV12 buffer */
-
+
#ifdef SAVAGEDRI
Bool tried_agp; /* TRUE if AGP allocation has been tried */
CARD32 agpBase; /* Physical address of aperture base */
@@ -300,7 +298,6 @@ unsigned int GetBlendForFourCC2000( int id )
}
}
-
void savageOUTREG( SavagePtr psav, unsigned long offset, unsigned long value )
{
ErrorF( "MMIO %08lx, was %08lx, want %08lx,",
@@ -309,33 +306,6 @@ void savageOUTREG( SavagePtr psav, unsigned long offset, unsigned long value )
ErrorF( " now %08lx\n", (unsigned long)MMIO_IN32( psav->MapBase, offset ) );
}
-#if 0
-static void
-SavageClipVWindow(ScrnInfoPtr pScrn)
-{
- SavagePtr psav = SAVPTR(pScrn);
-
- if( (psav->Chipset == S3_SAVAGE_MX) ||
- (psav->Chipset == S3_SUPERSAVAGE) ) {
- if (psav->IsSecondary) {
- OUTREG(SEC_STREAM2_WINDOW_SZ, 0);
- } else if (psav->IsPrimary) {
- OUTREG(SEC_STREAM_WINDOW_SZ, 0);
- } else {
- OUTREG(SEC_STREAM_WINDOW_SZ, 0);
-#if 0
- OUTREG(SEC_STREAM2_WINDOW_SZ, 0);
-#endif
- }
- } else if (psav->Chipset == S3_SAVAGE2000) {
- OUTREG(SEC_STREAM_WINDOW_SZ, 0);
- } else {
- OUTREG( SSTREAM_WINDOW_SIZE_REG, 1);
- OUTREG( SSTREAM_WINDOW_START_REG, 0x03ff03ff);
- }
-}
-#endif
-
void SavageInitVideo(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
@@ -375,9 +345,9 @@ void SavageInitVideo(ScreenPtr pScreen)
SavageSetColorKey = SavageSetColorKeyOld;
SavageDisplayVideo = SavageDisplayVideoOld;
}
-
+
num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors);
-
+
if(newAdaptor) {
if(!num_adaptors) {
num_adaptors = 1;
@@ -394,7 +364,7 @@ void SavageInitVideo(ScreenPtr pScreen)
}
}
}
-
+
if(num_adaptors)
xf86XVScreenInit(pScreen, adaptors, num_adaptors);
@@ -407,7 +377,6 @@ void SavageInitVideo(ScreenPtr pScreen)
}
}
-
void SavageSetColorKeyOld(ScrnInfoPtr pScrn)
{
SavagePtr psav = SAVPTR(pScrn);
@@ -483,12 +452,6 @@ void SavageSetColorKeyNew(ScrnInfoPtr pScrn)
OUTREG( SEC_STREAM_CKEY_LOW, 0 );
OUTREG( SEC_STREAM_CKEY_UPPER, 0 );
OUTREG( BLEND_CONTROL, (INREG32(BLEND_CONTROL) | (psav->blendBase << 9) | 0x08 ));
-#if 0
- sleep(1);
- OUTREG( SEC_STREAM2_CKEY_LOW, 0 );
- OUTREG( SEC_STREAM2_CKEY_UPPER, 0 );
- OUTREG( BLEND_CONTROL, (INREG32(BLEND_CONTROL) | (psav->blendBase << 17) | (8 << 12) ));
-#endif
}
}
else {
@@ -509,12 +472,6 @@ void SavageSetColorKeyNew(ScrnInfoPtr pScrn)
0x47000000 | (pPriv->colorKey & 0xFF) );
OUTREG( SEC_STREAM_CKEY_UPPER,
0x47000000 | (pPriv->colorKey & 0xFF) );
-#if 0
- OUTREG( SEC_STREAM2_CKEY_LOW,
- 0x47000000 | (pPriv->colorKey & 0xFF) );
- OUTREG( SEC_STREAM2_CKEY_UPPER,
- 0x47000000 | (pPriv->colorKey & 0xFF) );
-#endif
}
break;
case 15:
@@ -533,12 +490,6 @@ void SavageSetColorKeyNew(ScrnInfoPtr pScrn)
0x45000000 | (red<<19) | (green<<11) | (blue<<3) );
OUTREG( SEC_STREAM_CKEY_UPPER,
0x45000000 | (red<<19) | (green<<11) | (blue<<3) );
-#if 0
- OUTREG( SEC_STREAM2_CKEY_LOW,
- 0x45000000 | (red<<19) | (green<<11) | (blue<<3) );
- OUTREG( SEC_STREAM2_CKEY_UPPER,
- 0x45000000 | (red<<19) | (green<<11) | (blue<<3) );
-#endif
}
break;
case 16:
@@ -557,12 +508,6 @@ void SavageSetColorKeyNew(ScrnInfoPtr pScrn)
0x46000000 | (red<<19) | (green<<10) | (blue<<3) );
OUTREG( SEC_STREAM_CKEY_UPPER,
0x46020002 | (red<<19) | (green<<10) | (blue<<3) );
-#if 0
- OUTREG( SEC_STREAM2_CKEY_LOW,
- 0x46000000 | (red<<19) | (green<<10) | (blue<<3) );
- OUTREG( SEC_STREAM2_CKEY_UPPER,
- 0x46020002 | (red<<19) | (green<<10) | (blue<<3) );
-#endif
}
break;
case 24:
@@ -581,12 +526,6 @@ void SavageSetColorKeyNew(ScrnInfoPtr pScrn)
0x47000000 | (red<<16) | (green<<8) | (blue) );
OUTREG( SEC_STREAM_CKEY_UPPER,
0x47000000 | (red<<16) | (green<<8) | (blue) );
-#if 0
- OUTREG( SEC_STREAM2_CKEY_LOW,
- 0x47000000 | (red<<16) | (green<<8) | (blue) );
- OUTREG( SEC_STREAM2_CKEY_UPPER,
- 0x47000000 | (red<<16) | (green<<8) | (blue) );
-#endif
}
break;
}
@@ -598,9 +537,6 @@ void SavageSetColorKeyNew(ScrnInfoPtr pScrn)
OUTREG( BLEND_CONTROL, (INREG32(BLEND_CONTROL) | (psav->blendBase << 9) | 0x08 ));
} else {
OUTREG( BLEND_CONTROL, (INREG32(BLEND_CONTROL) | (psav->blendBase << 9) | 0x08 ));
-#if 0
- OUTREG( BLEND_CONTROL, (INREG32(BLEND_CONTROL) | (psav->blendBase << 17) | (8 << 12) ));
-#endif
}
}
}
@@ -756,12 +692,6 @@ void SavageSetColorNew( ScrnInfoPtr pScrn )
OUTREG( SEC_STREAM_COLOR_CONVERT3, assembly1 );
OUTREG( SEC_STREAM_COLOR_CONVERT3, assembly2 );
OUTREG( SEC_STREAM_COLOR_CONVERT3, assembly3 );
-#if 0
- sleep(1);
- OUTREG( SEC_STREAM2_COLOR_CONVERT1, assembly1 );
- OUTREG( SEC_STREAM2_COLOR_CONVERT2, assembly2 );
- OUTREG( SEC_STREAM2_COLOR_CONVERT3, assembly3 );
-#endif
}
}
@@ -852,18 +782,10 @@ void SavageSetColor2000( ScrnInfoPtr pScrn )
kb = (int)(dkb /*+0.5*/) & 0xffff;
assembly4 = (kb<<16) | k7;
-#if 0
- assembly1 = 0x640092;
- assembly2 = 0x19a0000;
- assembly3 = 0x001cf;
- assembly4 = 0xf8ca007e;
-#endif
-
OUTREG( SEC_STREAM_COLOR_CONVERT0_2000, assembly1 );
OUTREG( SEC_STREAM_COLOR_CONVERT1_2000, assembly2 );
OUTREG( SEC_STREAM_COLOR_CONVERT2_2000, assembly3 );
OUTREG( SEC_STREAM_COLOR_CONVERT3_2000, assembly4 );
-
}
void SavageResetVideo(ScrnInfoPtr pScrn)
@@ -873,7 +795,6 @@ void SavageResetVideo(ScrnInfoPtr pScrn)
SavageSetColorKey( pScrn );
}
-
static XF86VideoAdaptorPtr
SavageSetupImageVideo(ScreenPtr pScreen)
{
@@ -931,15 +852,6 @@ SavageSetupImageVideo(ScreenPtr pScreen)
pPriv->brightness = 0;
pPriv->contrast = 128;
pPriv->saturation = 128;
-#if 0
- /*
- * The S3 driver has these values for some of the chips. I have yet
- * to find any Savage where these make sense.
- */
- pPriv->brightness = 64;
- pPriv->contrast = 16;
- pPriv->saturation = 128;
-#endif
pPriv->hue = 0;
pPriv->lastKnownPitch = 0;
@@ -950,11 +862,6 @@ SavageSetupImageVideo(ScreenPtr pScreen)
psav->adaptor = adapt;
- #if 0
- psav->BlockHandler = pScreen->BlockHandler;
- pScreen->BlockHandler = SavageBlockHandler;
- #endif
-
return adapt;
}
@@ -1046,7 +953,6 @@ SavageStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
REGION_EMPTY(pScrn->pScreen, &pPriv->clip);
if(shutdown) {
- /*SavageClipVWindow(pScrn);*/
SavageStreamsOff( pScrn );
#ifdef SAVAGEDRI
@@ -1081,7 +987,6 @@ SavageStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
}
}
-
static int
SavageSetPortAttribute(
ScrnInfoPtr pScrn,
@@ -1140,7 +1045,6 @@ SavageSetPortAttribute(
return Success;
}
-
static int
SavageGetPortAttribute(
ScrnInfoPtr pScrn,
@@ -1216,7 +1120,7 @@ SavageCopyPlanarDataBCI(
unsigned long offsetU = offsetV + srcPitch2 * (h>>1);
unsigned long dstOffset = (unsigned long)dst - (unsigned long)psav->FBBase;
unsigned char memType;
-
+
BCI_GET_PTR;
/* copy Y planar */
@@ -1306,13 +1210,8 @@ SavageCopyPlanarData(
for(j = 0; j < h; j++) {
for(i = 0; i < w; i++) {
/* Shouldn't this be 'if LITTLEENDIAN'? */
-#if 1
dst[i] = src1[i << 1] | (src1[(i << 1) + 1] << 16) |
(src3[i] << 8) | (src2[i] << 24);
-#else
- dst[i] = (src1[i << 1] << 24) | (src1[(i << 1) + 1] << 8) |
- (src3[i] << 0) | (src2[i] << 16);
-#endif
}
dst += dstPitch;
src1 += srcPitch;
@@ -1445,9 +1344,6 @@ SavageSetBlend(ScrnInfoPtr pScrn, int id)
OUTREG( BLEND_CONTROL, (INREG32(BLEND_CONTROL) | (psav->blendBase << 9) | 0x08 ));
} else {
OUTREG( BLEND_CONTROL, (INREG32(BLEND_CONTROL) | (psav->blendBase << 9) | 0x08 ));
-#if 0
- OUTREG( BLEND_CONTROL, (INREG32(BLEND_CONTROL) | (psav->blendBase << 17) | (8 << 12) ));
-#endif
}
} else if (psav->Chipset == S3_SAVAGE2000) {
psav->blendBase = GetBlendForFourCC2000( id );
@@ -1478,21 +1374,14 @@ SavageDisplayVideoOld(
SavagePtr psav = SAVPTR(pScrn);
vgaHWPtr hwp = VGAHWPTR(pScrn);
SavagePortPrivPtr pPriv = psav->adaptor->pPortPrivates[0].ptr;
- /*DisplayModePtr mode = pScrn->currentMode;*/
int vgaCRIndex, vgaCRReg, vgaIOBase;
CARD32 ssControl;
int scalratio;
-
vgaIOBase = hwp->IOBase;
vgaCRIndex = vgaIOBase + 4;
vgaCRReg = vgaIOBase + 5;
-#if 0
- if ( psav->videoFourCC != id ) {
- SavageSetBlend(pScrn,id);
- SavageResetVideo(pScrn);
- }
-#endif
+
if( psav->videoFourCC != id )
SavageStreamsOff(pScrn);
@@ -1552,26 +1441,21 @@ SavageDisplayVideoOld(
scalratio = HSCALING(src_w,drw_w);
ssControl |= src_w;
- /*ssControl |= (1 << 24);*/
ssControl |= (GetBlendForFourCC(psav->videoFourCC) << 24);
-#if 0
- /* Wait for VBLANK. */
- VerticalRetraceWait();
-#endif
+
OUTREG(SSTREAM_CONTROL_REG, ssControl);
if (scalratio)
OUTREG(SSTREAM_STRETCH_REG,scalratio);
/* Calculate vertical scale factor. */
OUTREG(SSTREAM_VINITIAL_REG, 0 );
- /*OUTREG(SSTREAM_VSCALE_REG, (src_h << 15) / drw_h );*/
OUTREG(SSTREAM_VSCALE_REG, VSCALING(src_h,drw_h));
/* Set surface location and stride. */
OUTREG(SSTREAM_FBADDR0_REG, (offset + (x1>>15)) & (0x1ffffff & ~BASE_PAD) );
OUTREG(SSTREAM_FBADDR1_REG, 0);
OUTREG(SSTREAM_STRIDE_REG, pitch & 0xfff );
-
+
OUTREG(SSTREAM_WINDOW_START_REG, OS_XY(dstBox->x1, dstBox->y1) );
OUTREG(SSTREAM_WINDOW_SIZE_REG, OS_WH(dstBox->x2-dstBox->x1,
dstBox->y2-dstBox->y1));
@@ -1597,12 +1481,6 @@ SavageDisplayVideoOld(
OUTREG(SSTREAM_LINES_REG, src_h );
}
-#if 0
- /* Set color key on primary. */
-
- SavageSetColorKey( pScrn );
-#endif
-
/* Set FIFO L2 on second stream. */
if( pPriv->lastKnownPitch != pitch )
@@ -1637,20 +1515,13 @@ SavageDisplayVideoNew(
){
SavagePtr psav = SAVPTR(pScrn);
vgaHWPtr hwp = VGAHWPTR(pScrn);
- /*DisplayModePtr mode = pScrn->currentMode;*/
SavagePortPrivPtr pPriv = psav->adaptor->pPortPrivates[0].ptr;
int vgaCRIndex, vgaCRReg, vgaIOBase;
-
vgaIOBase = hwp->IOBase;
vgaCRIndex = vgaIOBase + 4;
vgaCRReg = vgaIOBase + 5;
-#if 0
- if ( psav->videoFourCC != id ) {
- SavageSetBlend(pScrn,id);
- SavageResetVideo(pScrn);
- }
-#endif
+
if( psav->videoFourCC != id )
SavageStreamsOff(pScrn);
@@ -1699,13 +1570,6 @@ SavageDisplayVideoNew(
/* BUGBUG need to add 00040000 if src stride > 2048 */
OUTREG(SEC_STREAM_VSCALING,
((src_h&0xfff)<<20) | ((65536 * src_h / drw_h) & 0x1FFFF ));
-#if 0
- OUTREG(SEC_STREAM2_HSCALING,
- ((src_w&0xfff)<<20) | ((65536 * src_w / drw_w) & 0x1FFFF ));
- /* BUGBUG need to add 00040000 if src stride > 2048 */
- OUTREG(SEC_STREAM2_VSCALING,
- ((src_h&0xfff)<<20) | ((65536 * src_h / drw_h) & 0x1FFFF ));
-#endif
}
/*
@@ -1734,22 +1598,8 @@ SavageDisplayVideoNew(
OUTREG(SEC_STREAM_WINDOW_START, ((dstBox->x1+1) << 16) | (dstBox->y1+1) );
OUTREG(SEC_STREAM_WINDOW_SZ, ((dstBox->x2-dstBox->x1) << 16)
| (dstBox->y2 - dstBox->y1) );
-#if 0
- OUTREG(SEC_STREAM2_FBUF_ADDR0, (offset + (x1>>15))
- & (0x7ffffff & ~BASE_PAD));
- OUTREG(SEC_STREAM2_STRIDE_LPB, pitch & 0xfff );
- OUTREG(SEC_STREAM2_WINDOW_START, ((dstBox->x1+1) << 16) | (dstBox->y1+1) );
- OUTREG(SEC_STREAM2_WINDOW_SZ, ((dstBox->x2-dstBox->x1) << 16)
- | (dstBox->y2 - dstBox->y1) );
-#endif
}
-#if 0
- /* Set color key on primary. */
-
- SavageSetColorKey( pScrn );
-#endif
-
/* Set FIFO L2 on second stream. */
/* Is CR92 shadowed for crtc2? -- AGD */
if( pPriv->lastKnownPitch != pitch )
@@ -1779,29 +1629,12 @@ SavageDisplayVideo2000(
short drw_w, short drw_h
){
SavagePtr psav = SAVPTR(pScrn);
-#if 0
- vgaHWPtr hwp = VGAHWPTR(pScrn);
-#endif
- /*DisplayModePtr mode = pScrn->currentMode;*/
SavagePortPrivPtr pPriv = psav->adaptor->pPortPrivates[0].ptr;
-#if 0
- int vgaCRIndex, vgaCRReg, vgaIOBase;
-#endif
CARD32 addr0;
-#if 0
- CARD32 addr1, addr2;
-#endif
-
-#if 0
- vgaIOBase = hwp->IOBase;
- vgaCRIndex = vgaIOBase + 4;
- vgaCRReg = vgaIOBase + 5;
-#endif
-
if( psav->videoFourCC != id )
SavageStreamsOff(pScrn);
-
+
if( !(psav->videoFlags & VF_STREAMS_ON) )
{
SavageSetBlend(pScrn,id);
@@ -1815,15 +1648,8 @@ SavageDisplayVideo2000(
else
OUTREG(SEC_STREAM_SRC_START_2000, SRCSTART(x1, y1));
- /*OUTREG(SEC_STREAM_SRC_SIZE_2000, SRCSIZE(src_w, src_h));*/
OUTREG(SEC_STREAM_SRC_SIZE_2000,
- SRCSIZE((dstBox->x2-dstBox->x1), (dstBox->y2-dstBox->y1)));
- /*
- buffersize = (src_w * src_h * 2) / 4096;
- OUTREG(SEC_STREAM_BUFFERSIZE_2000, (buffersize & 0xffffff) << 12);
- */
-
- /*SavageResetVideo(pScrn);*/
+ SRCSIZE((dstBox->x2-dstBox->x1), (dstBox->y2-dstBox->y1)));
if( src_w > drw_w )
OUTREG(SEC_STREAM_HSCALE_NORMALIZE, HSCALING_NORMALIZE(drw_w,src_w));
@@ -1844,48 +1670,12 @@ SavageDisplayVideo2000(
*/
addr0 = offset + (x1>>15); /* Y in YCbCr420 */
-#if 0
- addr1 = addr0 + (width * height); /* Cb in in YCbCr420 */
- addr2 = addr1 + ((width * height) / 4); /* Cr in in YCbCr420 */
-#endif
OUTREG(SEC_STREAM_FBUF_ADDR0, (addr0) & (0x3fffff & ~BASE_PAD));
-#if 0
- OUTREG(SEC_STREAM_FBUF_ADDR1, (addr1) & (0x3fffff & ~BASE_PAD));
- OUTREG(SEC_STREAM_FBUF_ADDR2, (addr2) & (0x3fffff & ~BASE_PAD));
-#endif
OUTREG(SEC_STREAM_WINDOW_START, XY_2000(dstBox->x1,dstBox->y1));
OUTREG(SEC_STREAM_WINDOW_SZ,
WH_2000((dstBox->x2-dstBox->x1),(dstBox->y2-dstBox->y1)));
-
- /*pitch = width * 2;*/
OUTREG(SEC_STREAM_STRIDE, pitch & 0xfff);
-#if 0
- /* Y stride + CbCr stride in YCbCr420 */
- OUTREG(SEC_STREAM_STRIDE, (pitch & 0xfff) + ((pitch & 0xfff) << 15));
-#endif
-
-#if 0
- /* Set color key on primary. */
-
- SavageSetColorKey2000( pScrn );
-#endif
-
-#if 0
- /* Set FIFO L2 on second stream. */
- if( pPriv->lastKnownPitch != pitch )
- {
- unsigned char cr92;
-
- pPriv->lastKnownPitch = pitch;
- pitch = (pitch + 7) / 8 - 4;
- VGAOUT8(vgaCRIndex, 0x92);
- cr92 = VGAIN8(vgaCRReg);
- VGAOUT8(vgaCRReg, (cr92 & 0x40) | (pitch >> 8) | 0x80);
- VGAOUT8(vgaCRIndex, 0x93);
- VGAOUT8(vgaCRReg, pitch);
- }
-#endif
}
static void
@@ -1920,7 +1710,6 @@ SavagePutImage(
int top, left, npixels, nlines;
BoxRec dstBox;
CARD32 tmp;
-/* xf86ErrorFVerb(XVTRACE,"SavagePutImage\n"); */
if(drw_w > 16384) drw_w = 16384;
/* Clip */
@@ -2006,11 +1795,6 @@ SavagePutImage(
pPriv->agpBufferMap = pSAVAGEDRIServer->agpXVideo.map;
pPriv->agpBufferOffset = pSAVAGEDRIServer->agpXVideo.offset;
pPriv->agpBase = drmAgpBase(psav->drmFD);
-#if 0
- xf86DrvMsg( pScreen->myNum, X_INFO,
- "[agp] agpXVideo mapped at 0x%08lx aperture=0x%08x offset=0x%08lx\n",
- (unsigned long)pPriv->agpBufferMap, pPriv->agpBase, pPriv->agpBufferOffset);
-#endif
}
} else {
/* This situation is expected if AGPforXv is disabled, otherwise report. */
@@ -2025,7 +1809,6 @@ SavagePutImage(
}
#endif /* SAVAGEDRI */
-
/* Buffer for final packed frame */
pPriv->video_offset = SavageAllocateMemory(
pScrn, &pPriv->video_memory,
@@ -2113,7 +1896,7 @@ SavagePutImage(
SavageCopyData(buf, dst_start, srcPitch, dstPitch, nlines, npixels);
break;
}
-
+
/* We need to enable the video before we draw the chroma color.
Otherwise, we get blue flashes. */
@@ -2255,8 +2038,6 @@ SavageStopSurface(
xf86ErrorFVerb(XVTRACE,"SavageStopSurface\n");
if(pPriv->isOn) {
- /*SavagePtr psav = SAVPTR(surface->pScrn);*/
- /*SavageClipVWindow(surface->pScrn);*/
SavageStreamsOff( surface->pScrn );
pPriv->isOn = FALSE;
}
@@ -2264,7 +2045,6 @@ SavageStopSurface(
return Success;
}
-
static int
SavageFreeSurface(
XF86SurfacePtr surface
@@ -2302,7 +2082,6 @@ SavageSetSurfaceAttribute(
(pointer)(GET_PORT_PRIVATE(pScrn)));
}
-
static int
SavageDisplaySurface(
XF86SurfacePtr surface,
@@ -2349,19 +2128,10 @@ SavageDisplaySurface(
xf86XVFillKeyHelper(pScreen, portPriv->colorKey, clipBoxes);
pPriv->isOn = TRUE;
-#if 0
- if(portPriv->videoStatus & CLIENT_VIDEO_ON) {
- REGION_EMPTY(pScreen, &portPriv->clip);
- UpdateCurrentTime();
- portPriv->videoStatus = FREE_TIMER;
- portPriv->freeTime = currentTime.milliseconds + FREE_DELAY;
- }
-#endif
return Success;
}
-
static void
SavageInitOffscreenImages(ScreenPtr pScreen)
{
@@ -2390,7 +2160,6 @@ SavageInitOffscreenImages(ScreenPtr pScreen)
offscreenImages[0].max_height = 1024;
offscreenImages[0].num_attributes = NUM_ATTRIBUTES;
offscreenImages[0].attributes = Attributes;
-
+
xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1);
}
-