? Makefile
? savage.4.html
? savage._man
? savage4.patch
? savage4.patch.v2
Index: savage_dri.c
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/Attic/savage_dri.c,v
retrieving revision 1.1.6.2
diff -u -r1.1.6.2 savage_dri.c
--- savage_dri.c	28 Dec 2003 17:05:14 -0000	1.1.6.2
+++ savage_dri.c	9 Jan 2004 20:26:05 -0000
@@ -1305,7 +1305,7 @@
    pSAVAGEDRI->frontbuffer		= psav->FrameBufferBase + 
                                           pSAVAGEDRI->frontOffset;
    pSAVAGEDRI->frontPitch		= pSAVAGEDRIServer->frontPitch;
-   pSAVAGEDRI->IsfrontTiled             = 0;
+   pSAVAGEDRI->IsfrontTiled             = psav->bTiled; /* AGD: was 0 */
    
    if(pSAVAGEDRI->IsfrontTiled)
    {
@@ -1313,19 +1313,29 @@
         TileStride = (pSAVAGEDRI->width+63)&(~63);
       else
         TileStride = (pSAVAGEDRI->width+31)&(~31);
-        
-      pSAVAGEDRI->frontBitmapDesc   	= 0x10000000 |
-                                          ((pSAVAGEDRI->cpp==2)?
-                                             BCI_BD_TILE_16:BCI_BD_TILE_32) |
-                                          (pScrn->bitsPerPixel<<16) |
-                                          TileStride;
-      pSAVAGEDRI->frontPitch 		= TileStride;
+
+      if ((psav->Chipset == S3_TWISTER)
+         || (psav->Chipset == S3_PROSAVAGE)
+         || (psav->Chipset == S3_PROSAVAGEDDR)) 
+      { 
+      		pSAVAGEDRI->backBitmapDesc   	= 0x10000000 |
+                	                          (1<<24) |
+                        	                  (pScrn->bitsPerPixel<<16) |
+                        	                  TileStride;
+      } else {        
+      		pSAVAGEDRI->frontBitmapDesc   	= 0x10000000 | /* block write disabled */
+                	                          ((pSAVAGEDRI->cpp==2)?
+                        	                     BCI_BD_TILE_16:BCI_BD_TILE_32) |
+                        	                  (pScrn->bitsPerPixel<<16) |
+                        	                  TileStride;
+      		pSAVAGEDRI->frontPitch 		= TileStride;
+      }
    }
    else
    {
-      pSAVAGEDRI->frontBitmapDesc	= 0x00000000 |
+      pSAVAGEDRI->frontBitmapDesc	= 0x10000000 | /* AGD: block write should be disabled:  was 0x00000000 */
       					  pScrn->bitsPerPixel<<16 |
-      					  pSAVAGEDRI->width ;
+      					  pSAVAGEDRI->width;
    }
    
    pSAVAGEDRI->backOffset		= pSAVAGEDRIServer->backOffset;
@@ -1339,11 +1349,22 @@
         TileStride = (pSAVAGEDRI->width+63)&(~63);
       else
         TileStride = (pSAVAGEDRI->width+31)&(~31);
-        
-      pSAVAGEDRI->backBitmapDesc   	= 0x10000000 |
-                                          (1<<24) |
-                                          (pScrn->bitsPerPixel<<16) |
-                                          TileStride;
+
+      if ((psav->Chipset == S3_TWISTER)
+         || (psav->Chipset == S3_PROSAVAGE)
+         || (psav->Chipset == S3_PROSAVAGEDDR)) 
+      {   
+      		pSAVAGEDRI->backBitmapDesc   	= 0x10000000 |
+                	                          (1<<24) |
+                	                          (pScrn->bitsPerPixel<<16) |
+                	                          TileStride;
+      } else {
+      		pSAVAGEDRI->backBitmapDesc   	= 0x10000000 |
+                	                          ((pSAVAGEDRI->cpp==2)?
+                	                             BCI_BD_TILE_16:BCI_BD_TILE_32) |
+                	                          (pScrn->bitsPerPixel<<16) |
+                	                          TileStride;
+      }
    }
 
    pSAVAGEDRI->depthOffset		= pSAVAGEDRIServer->depthOffset;
@@ -1357,11 +1378,22 @@
         TileStride = (pSAVAGEDRI->width+63)&(~63);
       else
         TileStride = (pSAVAGEDRI->width+31)&(~31);
-        
-      pSAVAGEDRI->depthBitmapDesc   	= 0x10000000 |
-      					  (1<<24) |
-                                          (pScrn->bitsPerPixel<<16) |
-                                          TileStride;
+
+      if ((psav->Chipset == S3_TWISTER)
+         || (psav->Chipset == S3_PROSAVAGE)
+         || (psav->Chipset == S3_PROSAVAGEDDR)) 
+      {        
+      		pSAVAGEDRI->depthBitmapDesc   	= 0x10000000 |
+ 	     					  (1<<24) |
+	                                          (pScrn->bitsPerPixel<<16) |
+	                                          TileStride;
+      } else {
+	        pSAVAGEDRI->depthBitmapDesc   	= 0x10000000 |
+                	                          ((pSAVAGEDRI->zpp==2)?
+                	                             BCI_BD_TILE_16:BCI_BD_TILE_32) |
+                	                          (pScrn->bitsPerPixel<<16) |
+                	                          TileStride;
+      }
    }
 
    pSAVAGEDRI->textureOffset	= pSAVAGEDRIServer->textureOffset;
@@ -1420,7 +1452,7 @@
          value |=  (((pSAVAGEDRI->width + 0x1F) & 0xFFE0) >> 5) << 20;
          value |= 3<<30;
       }
-         
+
       OUTREG(0x48C40, value|(pSAVAGEDRI->frontOffset >> 5) );    /* front */ 
       OUTREG(0x48C44, value|(pSAVAGEDRI->backOffset >> 5) );    /* back  */
       OUTREG(0x48C48, value|(pSAVAGEDRI->depthOffset >> 5) );    /* depth */
Index: savage_driver.c
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v
retrieving revision 1.11.4.1
diff -u -r1.11.4.1 savage_driver.c
--- savage_driver.c	3 Nov 2003 15:49:48 -0000	1.11.4.1
+++ savage_driver.c	9 Jan 2004 20:26:07 -0000
@@ -111,15 +111,15 @@
     { S3_TWISTER,	PCI_CHIP_S3TWISTER_P,	RES_SHARED_VGA },
     { S3_TWISTER,	PCI_CHIP_S3TWISTER_K,	RES_SHARED_VGA },
     { S3_PROSAVAGEDDR,	PCI_CHIP_S3PROSAVAGEDDR,	RES_SHARED_VGA },
-    { S3_SUPERSAVAGE,	PCI_CHIP_PM128,RES_SHARED_VGA },
-    { S3_SUPERSAVAGE,	PCI_CHIP_PM64,RES_SHARED_VGA },
-    { S3_SUPERSAVAGE,	PCI_CHIP_PM64C,RES_SHARED_VGA },
-    { S3_SUPERSAVAGE,	PCI_CHIP_PM128IX_SDR,RES_SHARED_VGA },
-    { S3_SUPERSAVAGE,	PCI_CHIP_PM128IX_DDR,RES_SHARED_VGA },
-    { S3_SUPERSAVAGE,	PCI_CHIP_PM64IX_SDR,RES_SHARED_VGA },
-    { S3_SUPERSAVAGE,	PCI_CHIP_PM64IX_DDR,RES_SHARED_VGA },
-    { S3_SUPERSAVAGE,	PCI_CHIP_PM64IXC_SDR,RES_SHARED_VGA },
-    { S3_SUPERSAVAGE,	PCI_CHIP_PM64IXC_DDR,RES_SHARED_VGA },
+    { S3_SUPERSAVAGE,	PCI_CHIP_PM128,		RES_SHARED_VGA },
+    { S3_SUPERSAVAGE,	PCI_CHIP_PM64,		RES_SHARED_VGA },
+    { S3_SUPERSAVAGE,	PCI_CHIP_PM64C,		RES_SHARED_VGA },
+    { S3_SUPERSAVAGE,	PCI_CHIP_PM128IX_SDR,	RES_SHARED_VGA },
+    { S3_SUPERSAVAGE,	PCI_CHIP_PM128IX_DDR,	RES_SHARED_VGA },
+    { S3_SUPERSAVAGE,	PCI_CHIP_PM64IX_SDR,	RES_SHARED_VGA },
+    { S3_SUPERSAVAGE,	PCI_CHIP_PM64IX_DDR,	RES_SHARED_VGA },
+    { S3_SUPERSAVAGE,	PCI_CHIP_PM64IXC_SDR,	RES_SHARED_VGA },
+    { S3_SUPERSAVAGE,	PCI_CHIP_PM64IXC_DDR,	RES_SHARED_VGA },
     { -1,		-1,			RES_UNDEFINED }
 };
 
@@ -160,6 +160,7 @@
     { OPTION_LCDCLOCK,	"LCDClock",	OPTV_FREQ,    {0}, FALSE },
     { OPTION_SHADOW_STATUS, "ShadowStatus", OPTV_BOOLEAN, {0}, FALSE },
     { OPTION_VIDEORAM,  "VideoRAM",     OPTV_INTEGER, {0}, FALSE },
+    { OPTION_CRT_ONLY,  "CrtOnly",      OPTV_BOOLEAN, {0}, FALSE },
     { OPTION_TV_ON,     "TvOn",         OPTV_BOOLEAN, {0}, FALSE },
     { OPTION_SAA7111,	"SAA7111",	OPTV_BOOLEAN, {0}, FALSE  },
     /* add by peterzhu*/
@@ -772,6 +773,8 @@
 #ifdef XF86DRI
     if ((psav->Chipset == S3_TWISTER)
         || (psav->Chipset == S3_PROSAVAGE)
+        || (psav->Chipset == S3_SAVAGE4)
+        || (psav->Chipset == S3_SAVAGE_MX)
         || (psav->Chipset == S3_PROSAVAGEDDR)) {
         /* Setup DRI after visuals have been established */
         psav->directRenderingEnabled = SAVAGEDRIScreenInit(pScreen);
@@ -1096,10 +1099,11 @@
             return MODE_BAD;
     }
 
-    if ((psav->DisplayOutsActive & UT_DEVICE_LCD)
+    if (((psav->DisplayOutsActive & UT_DEVICE_LCD)
          && psav->PanelX
          && ((pMode->HDisplay > psav->PanelX)
-             ||(pMode->VDisplay > psav->PanelY))) {
+             ||(pMode->VDisplay > psav->PanelY)))
+			&& (!psav->CrtOnly)) {
 	    return MODE_PANEL;
     }
 
@@ -1251,6 +1255,11 @@
     if (psav->shadowFB) {
         xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: shadow FB enabled\n");
     }
+
+    psav->CrtOnly = FALSE;
+    if( xf86GetOptValBool(SavageOptions, OPTION_CRT_ONLY, &psav->CrtOnly))
+	xf86DrvMsg( pScrn->scrnIndex, X_CONFIG,
+		    "Option: CrtOnly enabled\n" );
     
     if ((s = xf86GetOptValString(SavageOptions, OPTION_ROTATE))) {
         if(!xf86NameCmp(s, "CW")) {
@@ -1374,10 +1383,12 @@
     }
 
     /* we can use Option "DisableTile TRUE" to disable tile mode */
-    psav->bDisableTile = FALSE;
+    psav->bDisableTile = TRUE; /* AGD: was FALSE; however, I gain about 30 fps 
+				  defaulting to linear mode, and it seems to render
+				  the same either way */
     if (xf86GetOptValBool(SavageOptions, OPTION_DISABLE_TILE,&psav->bDisableTile)) {
         xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
-                   "Option: %s Tile Mode and Programe it \n",(psav->bDisableTile?"Disable":"Enable"));
+                   "Option: %s Tile Mode and Program it \n",(psav->bDisableTile?"Disable":"Enable"));
     }
 }
 
@@ -1670,9 +1681,10 @@
     pScrn->virtualY = pScrn->display->virtualY;
 
     /* Check LCD panel information */
-    if ((psav->DisplayOutsActive & UT_DEVICE_LCD) 
+    if (((psav->DisplayOutsActive & UT_DEVICE_LCD) 
         && (S3_SAVAGE_MOBILE_SERIES(psav->Chipset)
             || S3_MOBILE_TWISTER_SERIES(psav->Chipset))
+			&& (!psav->CrtOnly))
         ) {
         unsigned char cr6b = hwp->readCrtc( hwp, 0x6b );
 
@@ -2032,6 +2044,7 @@
     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);
@@ -2223,6 +2236,12 @@
 
     ulTmp = INREG32(S3_OVERFLOW_BUFFER_PTR) & (~(ENABLE_BCI | ENABLE_COMMAND_OVERFLOW_BUF));
     
+#if 0
+    if (psav->Chipset == S3_SAVAGE4) 
+    /* AGD: Enable BCI, disable Command buffer. coherency problems on savage4? */
+    OUTREG32(0x48C18, INREG32(0x48C18) | 0x08);
+    else
+#endif
     /* Enable BCI, Enable  Command buffer. */
     OUTREG32(S3_OVERFLOW_BUFFER_PTR,
              (ulTmp | (ENABLE_BCI | ENABLE_COMMAND_OVERFLOW_BUF)));
@@ -2396,12 +2415,15 @@
     /* 8: bci enable */
     OUTREG32(S3_GLB_BD_HIGH,(psav->GlobalBD.bd2.HiPart
                              | 8 | S3_LITTLE_ENDIAN | S3_BD64));
-    
+
+ /* AGD: DRI seems to use PBD for front/back/depth buffers, 
+    but writing to them here doesn't seem to hurt anything so... */
     OUTREG32(S3_PRI_BD_LOW,psav->GlobalBD.bd2.LoPart);
     OUTREG32(S3_PRI_BD_HIGH,psav->GlobalBD.bd2.HiPart);
     OUTREG32(S3_SEC_BD_LOW,psav->GlobalBD.bd2.LoPart);
     OUTREG32(S3_SEC_BD_HIGH,psav->GlobalBD.bd2.HiPart);
-    
+
+
     /* turn on screen */
     OUTREG8(SEQ_ADDRESS_REG,0x01);
     byte = INREG8(SEQ_DATA_REG) & ~0X20;
@@ -2548,7 +2570,7 @@
     OUTREG32(0x8128, 0xFFFFFFFFL);
     OUTREG32(0x812C, 0xFFFFFFFFL);
     
-    /* bit 28:block write disalbe */
+    /* bit 28:block write disable */
     OUTREG32(S3_GLB_BD_HIGH,BCI_ENABLE | S3_BD64 | 0x10000000);
     
     if (psav->bTiled) {
@@ -2618,9 +2640,10 @@
         switch (psav->Chipset) {
             case S3_SAVAGE3D:
             case S3_SAVAGE_MX:
+            case S3_SAVAGE4:
                 SavageEnableMode_M7(pScrn,FALSE);
                 break;
-            case S3_SAVAGE4:
+/*            case S3_SAVAGE4: */
             case S3_TWISTER:
             case S3_PROSAVAGE:            
             case S3_PROSAVAGEDDR:
@@ -2706,9 +2729,10 @@
     switch (psav->Chipset) {
         case S3_SAVAGE3D:
         case S3_SAVAGE_MX:
+        case S3_SAVAGE4: 
             SavageEnableMode_M7(pScrn,TRUE);            
             break;
-        case S3_SAVAGE4:
+/*        case S3_SAVAGE4: */
         case S3_TWISTER:
         case S3_PROSAVAGE:            
         case S3_PROSAVAGEDDR:
@@ -3091,6 +3115,11 @@
         psav->FPExpansion = TRUE;
     else
         psav->FPExpansion = FALSE;
+
+    if (psav->CrtOnly) {
+	psav->FPExpansion = FALSE;
+	psav->Panning = FALSE;
+    }
 }
 
 /*
Index: savage_driver.h
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h,v
retrieving revision 1.9.4.1
diff -u -r1.9.4.1 savage_driver.h
--- savage_driver.h	3 Nov 2003 15:49:49 -0000	1.9.4.1
+++ savage_driver.h	9 Jan 2004 20:26:07 -0000
@@ -260,6 +260,7 @@
     int			rotate;
     double		LCDClock;
     Bool		ShadowStatus;
+    Bool		CrtOnly;
 
     Bool		LcdOn;
     Bool		TvOn;
Index: savage_vbe.c
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c,v
retrieving revision 1.2.4.1
diff -u -r1.2.4.1 savage_vbe.c
--- savage_vbe.c	3 Nov 2003 15:49:49 -0000	1.2.4.1
+++ savage_vbe.c	9 Jan 2004 20:26:07 -0000
@@ -198,6 +198,9 @@
 
         psav->DisplayOutsConnected = connection;
 
+	if (psav->CrtOnly)
+	    psav->DisplayOutsConnected = UT_DEVICE_CRT1;
+
         return TRUE;
     }
 
