Author: daniel
Date: 2003-06-20 20:23:54 -0500 (Fri, 20 Jun 2003)
New Revision: 224

Added:
   branches/4.3.0/sid/debian/patches/063_savage_driver_1.1.27t.diff
Modified:
   branches/4.3.0/sid/debian/changelog
Log:
patch #063: add new Savage driver, closing about 18 bugs.


Modified: branches/4.3.0/sid/debian/changelog
==============================================================================
--- branches/4.3.0/sid/debian/changelog 2003-06-20 22:11:54 UTC (rev 223)
+++ branches/4.3.0/sid/debian/changelog 2003-06-21 01:23:54 UTC (rev 224)
@@ -1,5 +1,9 @@
-xfree86 (4.3.0-0pre1v1) unstable; urgency=low
+xfree86 (4.3.0-0ds5) unstable; urgency=low
 
+  * this is branches/sid/4.3.0/debian as of 13:28, 19th July 2003 (UTC). the
+    version number is only here to give people a nice nifty sync point.
+    porters/testers only please. -ds
+
   * new upstream release
     - XFree86 X server now supports ATI Radeon Mobility (Closes: #196810)
     - XFree86 X server now supports SiS 740 chipset (Closes: #196912)
@@ -36,9 +40,12 @@
 
   * patch #061: fix weak dep from libGLU to libGL. (closes: #187365)
 
-  * make libGL -fPICable, and thread-safe: (closes: #190323)
-    - patch #062: new (thanks, Jakub Jelinek and Michel Daenzer).
-
+  * new Savage driver (version 1.1.27t): patch #063. (closes: #110974,
+    #112703, #115223, #128125, #145420, #148008, #152796, #154641, #185443,
+    #194144, #194351, #191915, #197058, #112703, #110974)
+    + new 'Option "ForceInit"' for forcing full initilization of consoles.
+      (closes: #117454, #129216)
+  
   * xlibs-pic package renamed to xlibs-static-pic
     - reintegrate piclib_support.diff (previously patch #046, now patch #909)
 
@@ -60,7 +67,7 @@
   * debian/xlibosmesa4-dbg.install: install the unstripped library in
     /usr/X11R6/lib/debug, not /usr/X11R6/lib
 
- -- Branden Robinson <[EMAIL PROTECTED]>  Sat, 14 Jun 2003 05:38:31 -0500
+ -- Daniel Stone <[EMAIL PROTECTED]>  Thu, 19 Jun 2003 23:29:17 +1000
 
 xfree86 (4.2.1-8) unstable; urgency=high
 

Added: branches/4.3.0/sid/debian/patches/063_savage_driver_1.1.27t.diff
==============================================================================
--- branches/4.3.0/sid/debian/patches/063_savage_driver_1.1.27t.diff    
2003-06-20 22:11:54 UTC (rev 223)
+++ branches/4.3.0/sid/debian/patches/063_savage_driver_1.1.27t.diff    
2003-06-21 01:23:54 UTC (rev 224)
@@ -0,0 +1,787 @@
+diff -urN xc/programs/Xserver/hw/xfree86/drivers/savage.old/Imakefile 
xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile
+--- xc/programs/Xserver/hw/xfree86/drivers/savage.old/Imakefile        
2003-02-18 04:06:44.000000000 +1100
++++ xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile    2002-10-08 
05:19:10.000000000 +1000
+@@ -1,4 +1,4 @@
+-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile,v 1.8 
2003/02/17 17:06:44 dawes Exp $
++XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile,v 1.7 
2002/05/14 20:19:51 alanh Exp $
+ /*
+  *
+  * Copyright 1995-1998 The XFree86 Project, Inc.
+@@ -42,7 +42,7 @@
+            -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \
+            -I$(XF86SRC)/rac -I$(XF86SRC)/int10 -I$(SERVERSRC)/render \
+            -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(FONTINCSRC) \
+-           -I$(EXTINCSRC) -I$(XF86SRC)/vbe -I$(XF86SRC)/shadowfb
++           -I$(EXTINCSRC) -I$(XF86OSSRC)/vbe -I$(XF86SRC)/shadowfb
+ #endif
+ 
+ #if MakeHasPosixVariableSubstitutions
+Binary files 
xc/programs/Xserver/hw/xfree86/drivers/savage.old/savage-1.1.27t.zip and 
xc/programs/Xserver/hw/xfree86/drivers/savage/savage-1.1.27t.zip differ
+diff -urN xc/programs/Xserver/hw/xfree86/drivers/savage.old/savage_accel.c 
xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c
+--- xc/programs/Xserver/hw/xfree86/drivers/savage.old/savage_accel.c   
2002-11-09 05:03:32.000000000 +1100
++++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c       
2002-10-08 05:17:32.000000000 +1000
+@@ -1,4 +1,4 @@
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c,v 
1.18 2002/11/08 18:03:32 alanh Exp $ */
++/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c,v 
1.14 2001/12/13 18:01:50 eich Exp $ */
+ 
+ /*
+  *
+@@ -417,7 +417,7 @@
+ #if 1
+     xaaptr->SetupForScreenToScreenCopy = SavageSetupForScreenToScreenCopy;
+     xaaptr->SubsequentScreenToScreenCopy = SavageSubsequentScreenToScreenCopy;
+-    xaaptr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | NO_PLANEMASK | 
ROP_NEEDS_SOURCE;
++    xaaptr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | ROP_NEEDS_SOURCE;
+ #endif
+ 
+ 
+@@ -438,7 +438,6 @@
+     xaaptr->Mono8x8PatternFillFlags = 0
+       | HARDWARE_PATTERN_PROGRAMMED_BITS 
+       | HARDWARE_PATTERN_SCREEN_ORIGIN
+-      | ROP_NEEDS_SOURCE
+       | BIT_ORDER_IN_BYTE_MSBFIRST
+       ;
+     if( psav->Chipset == S3_SAVAGE4 )
+diff -urN xc/programs/Xserver/hw/xfree86/drivers/savage.old/savage_bci.h 
xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h
+--- xc/programs/Xserver/hw/xfree86/drivers/savage.old/savage_bci.h     
2002-10-03 06:39:54.000000000 +1000
++++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h 2002-10-08 
05:19:04.000000000 +1000
+@@ -1,4 +1,4 @@
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h,v 1.4 
2002/10/02 20:39:54 alanh Exp $ */
++/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h,v 1.2 
2001/10/01 13:44:09 eich Exp $ */
+ 
+ #ifndef _S3BCI_H_
+ #define _S3BCI_H_
+diff -urN xc/programs/Xserver/hw/xfree86/drivers/savage.old/savage_cursor.c 
xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c
+--- xc/programs/Xserver/hw/xfree86/drivers/savage.old/savage_cursor.c  
2003-01-19 02:22:29.000000000 +1100
++++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c      
2002-10-08 05:17:32.000000000 +1000
+@@ -1,4 +1,4 @@
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c,v 
1.9 2003/01/18 15:22:29 eich Exp $ */
++/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c,v 
1.6 2001/11/02 16:24:51 alanh Exp $ */
+ 
+ /*
+  * Hardware cursor support for S3 Savage 4.0 driver. Taken with
+@@ -39,27 +39,6 @@
+                       } 
+ #define MAX_CURS 64
+ 
+-/*
+- * Disable HW Cursor on stretched LCDs. We don't know how to
+- * detect if display is stretched. Therefore we cannot rescale
+- * the HW cursor position.
+- */
+-
+-static Bool
+-SavageUseHWCursor(ScreenPtr pScr, CursorPtr pCurs)
+-{
+-    ScrnInfoPtr pScrn = xf86Screens[pScr->myNum];
+-    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;
+-}
+ 
+ Bool 
+ SavageHWCursorInit(ScreenPtr pScreen)
+@@ -101,12 +80,8 @@
+     infoPtr->LoadCursorImage = SavageLoadCursorImage;
+     infoPtr->HideCursor = SavageHideCursor;
+     infoPtr->ShowCursor = SavageShowCursor;
++    infoPtr->UseHWCursor = NULL;
+ 
+-    if ((S3_SAVAGE_MOBILE_SERIES(psav->Chipset)
+-       || (psav->Chipset == S3_PROSAVAGE)) && !psav->CrtOnly)
+-      infoPtr->UseHWCursor = SavageUseHWCursor;
+-    else
+-      infoPtr->UseHWCursor = NULL;
+     if( !psav->CursorKByte )
+       psav->CursorKByte = pScrn->videoRam - 4;
+ 
+@@ -118,9 +93,8 @@
+ void
+ SavageShowCursor(ScrnInfoPtr pScrn)
+ {
+-    /* Turn cursor on. */
++   /* Turn cursor on. */
+    outCRReg( 0x45, inCRReg(0x45) | 0x01 );
+-   SAVPTR(pScrn)->hwc_on = TRUE;
+ }
+ 
+ 
+@@ -128,12 +102,12 @@
+ SavageHideCursor(ScrnInfoPtr pScrn)
+ {
+     /* Turn cursor off. */
++
+     if( S3_SAVAGE4_SERIES( SAVPTR(pScrn)->Chipset ) )
+     {
+        waitHSync(5);
+     }
+     outCRReg( 0x45, inCRReg(0x45) & 0xfe );
+-    SAVPTR(pScrn)->hwc_on = FALSE;
+ }
+ 
+ static void
+diff -urN xc/programs/Xserver/hw/xfree86/drivers/savage.old/savage_dga.c 
xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c
+--- xc/programs/Xserver/hw/xfree86/drivers/savage.old/savage_dga.c     
2003-01-19 02:22:29.000000000 +1100
++++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c 2002-10-08 
05:17:32.000000000 +1000
+@@ -1,4 +1,4 @@
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c,v 1.6 
2003/01/18 15:22:29 eich Exp $ */
++/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c,v 1.3 
2001/05/18 23:35:32 dawes Exp $ */
+ 
+ /*
+ Copyright (C) 1994-2000 The XFree86 Project, Inc.  All Rights Reserved.
+@@ -275,7 +275,7 @@
+ 
+       psav->DGAactive = FALSE;
+       SavageSwitchMode(index, pScrn->currentMode, 0);
+-      if( psav->hwcursor && psav->hwc_on )
++      if( psav->hwcursor )
+           SavageShowCursor(pScrn);
+     } else {
+       Bool holdBIOS = psav->UseBIOS;
+@@ -289,11 +289,8 @@
+           pMode->bitsPerPixel, pMode->depth);
+ #endif
+ 
+-      if( psav->hwcursor && psav->hwc_on) {
++      if( psav->hwcursor )
+           SavageHideCursor(pScrn);
+-          psav->hwc_on = TRUE;    /* save for later restauration */
+-      }
+-      
+ 
+       if(!psav->DGAactive) {  /* save the old parameters */
+           OldDisplayWidth[index] = pScrn->displayWidth;
+diff -urN xc/programs/Xserver/hw/xfree86/drivers/savage.old/savage_driver.c 
xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c
+--- xc/programs/Xserver/hw/xfree86/drivers/savage.old/savage_driver.c  
2003-06-21 00:05:26.000000000 +1000
++++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c      
2003-01-17 08:25:58.000000000 +1100
+@@ -1,4 +1,4 @@
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v 
1.34 2003/02/25 04:08:21 dawes Exp $ */
++/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v 
1.24 2001/11/02 16:24:51 alanh Exp $ */
+ /*
+  * vim: sw=4 ts=8 ai ic:
+  *
+@@ -82,10 +82,10 @@
+ #define iabs(a)       ((int)(a)>0?(a):(-(a)))
+ 
+ #define DRIVER_NAME   "savage"
+-#define DRIVER_VERSION        "1.1.26"
++#define DRIVER_VERSION        "1.1.27t"
+ #define VERSION_MAJOR 1
+ #define VERSION_MINOR 1
+-#define PATCHLEVEL    26
++#define PATCHLEVEL    27
+ #define SAVAGE_VERSION        ((VERSION_MAJOR << 24) | \
+                        (VERSION_MINOR << 16) | \
+                        PATCHLEVEL)
+@@ -123,8 +123,8 @@
+     { PCI_CHIP_SAVAGE_IX,     "Savage/IX" },
+     { PCI_CHIP_PROSAVAGE_PM,  "ProSavage PM133" },
+     { PCI_CHIP_PROSAVAGE_KM,  "ProSavage KM133" },
+-    { PCI_CHIP_S3TWISTER_P,   "Twister PN133" },
+-    { PCI_CHIP_S3TWISTER_K,   "Twister KN133" },
++    { PCI_CHIP_S3TWISTER_P,   "ProSavage PN133" },
++    { PCI_CHIP_S3TWISTER_K,   "ProSavage KN133" },
+     { PCI_CHIP_SUPSAV_MX128,  "SuperSavage/MX 128" },
+     { PCI_CHIP_SUPSAV_MX64,   "SuperSavage/MX 64" },
+     { PCI_CHIP_SUPSAV_MX64C,  "SuperSavage/MX 64C" },
+@@ -193,6 +193,7 @@
+     ,OPTION_ROTATE
+     ,OPTION_USEBIOS
+     ,OPTION_SHADOW_STATUS
++    ,OPTION_VIDEORAM
+     ,OPTION_CRT_ONLY
+     ,OPTION_TV_ON
+     ,OPTION_TV_PAL
+@@ -210,6 +211,7 @@
+     { OPTION_USEBIOS, "UseBIOS",      OPTV_BOOLEAN, {0}, FALSE },
+     { 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_TV_PAL,    "PAL",          OPTV_BOOLEAN, {0}, FALSE },
+@@ -889,6 +891,13 @@
+     xf86DrvMsg(pScrn->scrnIndex, from, "%ssing video BIOS to set modes\n",
+         psav->UseBIOS ? "U" : "Not u" );
+ 
++    pScrn->videoRam = 0;
++    if( xf86GetOptValInteger(psav->Options, OPTION_VIDEORAM, &pScrn->videoRam 
) )
++    {
++      xf86DrvMsg( pScrn->scrnIndex, X_CONFIG,
++                  "Option: VideoRAM %dkB\n", pScrn->videoRam );
++    }
++
+     psav->LCDClock = 0.0;
+     if( xf86GetOptValFreq( psav->Options, OPTION_LCDCLOCK, OPTUNITS_MHZ, 
&psav->LCDClock ) )
+       xf86DrvMsg( pScrn->scrnIndex, X_CONFIG, 
+@@ -986,9 +995,6 @@
+     } else
+       psav->ChipRev = psav->PciInfo->chipRev;
+ 
+-    if (pEnt->device->videoRam != 0)
+-      pScrn->videoRam = pEnt->device->videoRam;
+-
+     xfree(pEnt);
+ 
+     /* maybe throw in some more sanity checks here */
+@@ -1352,7 +1358,7 @@
+       }
+     }
+   
+-    clockRanges = xnfcalloc(sizeof(ClockRange),1);
++    clockRanges = xnfalloc(sizeof(ClockRange));
+     clockRanges->next = NULL;
+     clockRanges->minClock = psav->minClock;
+     clockRanges->maxClock = psav->maxClock;
+@@ -2833,16 +2839,15 @@
+     ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+     TRACE(("SavageSaveScreen(0x%x)\n", mode));
+ 
+-    if( pScrn->vtSema && SAVPTR(pScrn)->hwcursor && SAVPTR(pScrn)->hwc_on) {
+-
++    if( pScrn->vtSema && SAVPTR(pScrn)->hwcursor )
++    {
+       if( xf86IsUnblank(mode) )
+           SavageShowCursor( pScrn );
+       else
+           SavageHideCursor( pScrn );
+-      SAVPTR(pScrn)->hwc_on = TRUE;
+     }
+ 
+-      return vgaHWSaveScreen(pScreen, mode);
++    return vgaHWSaveScreen(pScreen, mode);
+ }
+ 
+ 
+diff -urN xc/programs/Xserver/hw/xfree86/drivers/savage.old/savage_driver.h 
xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h
+--- xc/programs/Xserver/hw/xfree86/drivers/savage.old/savage_driver.h  
2003-01-19 02:22:30.000000000 +1100
++++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h      
2003-01-17 12:10:04.000000000 +1100
+@@ -1,4 +1,4 @@
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h,v 
1.16 2003/01/18 15:22:30 eich Exp $ */
++/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h,v 
1.11 2001/08/09 19:14:13 dawes Exp $ */
+ 
+ #ifndef SAVAGE_VGAHWMMIO_H
+ #define SAVAGE_VGAHWMMIO_H
+@@ -118,7 +118,6 @@
+     Bool              fifo_moderate;
+     Bool              fifo_aggressive;
+     Bool              hwcursor;
+-    Bool              hwc_on;
+     Bool              NoAccel;
+     Bool              shadowFB;
+     Bool              UseBIOS;
+@@ -140,11 +139,9 @@
+     int                       YFactor;        /* overlay Y factor */
+     int                       displayXoffset; /* overlay X offset */
+     int                       displayYoffset; /* overlay Y offset */
+-    int                       XExpansion;     /* expansion factor in x */
+-    int                       XExp1;
++    int                       XExp1;          /* expansion ratio in x */
+     int                       XExp2;
+-    int                       YExpansion;     /* expansion factor in x */
+-    int                       YExp1;
++    int                       YExp1;          /* expansion ratio in x */
+     int                       YExp2;
+     int                       cxScreen;
+     int                       TVSizeX;
+@@ -213,15 +210,6 @@
+ 
+ #define SAVPTR(p)     ((SavagePtr)((p)->driverPrivate))
+ 
+-/* Make the names of these externals driver-unique */
+-#define gpScrn savagegpScrn
+-#define myOUTREG savageOUTREG
+-#define readdw savagereaddw
+-#define readfb savagereadfb
+-#define writedw savagewritedw
+-#define writefb savagewritefb
+-#define writescan savagewritescan
+-
+ /* Prototypes. */
+ 
+ extern void SavageCommonCalcClock(long freq, int min_m, int min_n1,
+diff -urN xc/programs/Xserver/hw/xfree86/drivers/savage.old/savage_i2c.c 
xc/programs/Xserver/hw/xfree86/drivers/savage/savage_i2c.c
+--- xc/programs/Xserver/hw/xfree86/drivers/savage.old/savage_i2c.c     
2002-10-03 06:39:55.000000000 +1000
++++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_i2c.c 2002-10-08 
05:17:32.000000000 +1000
+@@ -1,4 +1,4 @@
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_i2c.c,v 1.3 
2002/10/02 20:39:55 alanh Exp $ */
++/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_i2c.c,v 1.1 
2001/02/13 21:15:19 dawes Exp $ */
+ 
+ /*
+ Copyright (C) 1994-2000 The XFree86 Project, Inc.  All Rights Reserved.
+diff -urN xc/programs/Xserver/hw/xfree86/drivers/savage.old/savage_regs.h 
xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h
+--- xc/programs/Xserver/hw/xfree86/drivers/savage.old/savage_regs.h    
2003-06-21 00:05:26.000000000 +1000
++++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h        
2003-01-17 10:45:06.000000000 +1100
+@@ -1,8 +1,32 @@
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h,v 
1.12 2002/10/02 20:39:55 alanh Exp $ */
++/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h,v 
1.10 2001/11/04 22:17:48 alanh Exp $ */
+ 
+ #ifndef _SAVAGE_REGS_H
+ #define _SAVAGE_REGS_H
+ 
++/* These are here until xf86PciInfo.h is updated. */
++
++#ifndef PCI_CHIP_S3TWISTER_P
++#define PCI_CHIP_S3TWISTER_P  0x8d01
++#endif
++#ifndef PCI_CHIP_S3TWISTER_K
++#define PCI_CHIP_S3TWISTER_K  0x8d02
++#endif
++#ifndef PCI_CHIP_SUPSAV_MX128
++#define PCI_CHIP_SUPSAV_MX128         0x8c22
++#define PCI_CHIP_SUPSAV_MX64          0x8c24
++#define PCI_CHIP_SUPSAV_MX64C         0x8c26
++#define PCI_CHIP_SUPSAV_IX128SDR      0x8c2a
++#define PCI_CHIP_SUPSAV_IX128DDR      0x8c2b
++#define PCI_CHIP_SUPSAV_IX64SDR               0x8c2c
++#define PCI_CHIP_SUPSAV_IX64DDR               0x8c2d
++#define PCI_CHIP_SUPSAV_IXCSDR                0x8c2e
++#define PCI_CHIP_SUPSAV_IXCDDR                0x8c2f
++#endif
++#ifndef PCI_CHIP_PROSAVAGE_DDR
++#define PCI_CHIP_PROSAVAGE_DDR        0x8d03
++#define PCI_CHIP_PROSAVAGE_DDRK       0x8d04
++#endif
++
+ #define S3_SAVAGE3D_SERIES(chip)  ((chip>=S3_SAVAGE3D) && 
(chip<=S3_SAVAGE_MX))
+ 
+ #define S3_SAVAGE4_SERIES(chip)   ((chip==S3_SAVAGE4) || (chip==S3_PROSAVAGE))
+@@ -192,7 +216,15 @@
+     VGAOUT8(psav->vgaIOBase + 5, a);          \
+ }
+  
++#define HZEXP_COMP_1          0x54
++#define HZEXP_BORDER          0x58
+ #define HZEXP_FACTOR_IGA1     0x59
++
++#define VTEXP_COMP_1          0x56
++#define VTEXP_BORDER          0x5a
+ #define VTEXP_FACTOR_IGA1     0x5b
+ 
++#define EC1_CENTER_ON 0x10
++#define EC1_EXPAND_ON 0x0c
++
+ #endif /* _SAVAGE_REGS_H */
+diff -urN xc/programs/Xserver/hw/xfree86/drivers/savage.old/savage_vbe.c 
xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c
+--- xc/programs/Xserver/hw/xfree86/drivers/savage.old/savage_vbe.c     
2002-10-03 06:39:55.000000000 +1000
++++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c 2003-01-17 
08:33:52.000000000 +1100
+@@ -1,4 +1,4 @@
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c,v 
1.12 2002/10/02 20:39:55 alanh Exp $ */
++/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c,v 1.9 
2001/05/19 02:05:55 dawes Exp $ */
+ 
+ #include "savage_driver.h"
+ #include "savage_vbe.h"
+@@ -72,7 +72,7 @@
+     SavageClearVM86Regs( psav->pInt10 );
+     psav->pInt10->ax = 0x4f14;        /* S3 extensions */
+     psav->pInt10->bx = 0x0001;        /* Set default refresh rate */
+-    psav->pInt10->cx = n;
++    psav->pInt10->cx = n & 0x3fff;
+     psav->pInt10->di = Refresh & 0xffff;
+ 
+     xf86ExecX86int10( psav->pInt10 );
+diff -urN xc/programs/Xserver/hw/xfree86/drivers/savage.old/savage_video.c 
xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c
+--- xc/programs/Xserver/hw/xfree86/drivers/savage.old/savage_video.c   
2003-01-12 14:55:49.000000000 +1100
++++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c       
2003-01-17 12:16:16.000000000 +1100
+@@ -1,4 +1,4 @@
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c,v 
1.11 2003/01/12 03:55:49 tsi Exp $ */
++/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c,v 
1.7 2001/11/21 22:43:01 dawes Exp $ */
+ 
+ #include "Xv.h"
+ #include "dix.h"
+@@ -79,7 +79,7 @@
+ ) = NULL;
+ 
+ static void OverlayParamInit(ScrnInfoPtr pScrn);
+-static void InitStreamsForExpansion(SavagePtr psav);
++static void InitStreamsForExpansion(ScrnInfoPtr pScrn);
+ 
+ /*static void SavageBlockHandler(int, pointer, pointer, pointer);*/
+ 
+@@ -421,7 +421,6 @@
+ 
+     /* Sequence stolen from streams.c in M7 NT driver */
+ 
+-
+     xf86EnableIO();
+ 
+     /* Unlock extended registers. */
+@@ -430,10 +429,17 @@
+     VGAOUT16(vgaCRIndex, 0xa039);
+     VGAOUT16(0x3c4, 0x0608);
+ 
++    if( 
++      S3_SAVAGE_MOBILE_SERIES(psav->Chipset) && 
++      !psav->CrtOnly && 
++      !psav->TvOn 
++    ) {
++      OverlayParamInit( pScrn );
++    }
++
+     VGAOUT8( vgaCRIndex, EXT_MISC_CTRL2 );
+ 
+     if( S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ||
+-        (psav->Chipset == S3_SUPERSAVAGE) ||
+         (psav->Chipset == S3_SAVAGE2000) )
+     {
+       jStreamsControl = VGAIN8( vgaCRReg ) | ENABLE_STREAM1;
+@@ -869,10 +875,10 @@
+ 
+     psav->adaptor = adapt;
+ 
+-#if 0
++    #if 0
+     psav->BlockHandler = pScreen->BlockHandler;
+     pScreen->BlockHandler = SavageBlockHandler;
+-#endif
++    #endif
+ 
+     return adapt;
+ }
+@@ -992,9 +998,8 @@
+ 
+     REGION_EMPTY(pScrn->pScreen, &pPriv->clip);   
+ 
+-    SavageStreamsOff( pScrn );
+-
+     if(shutdown) {
++      SavageStreamsOff( pScrn );
+       if(pPriv->area) {
+           xf86FreeOffscreenArea(pPriv->area);
+           pPriv->area = NULL;
+@@ -1283,9 +1288,11 @@
+     ssControl |= (1 << 24);
+     OUTREG(SSTREAM_CONTROL_REG, ssControl);
+ 
++#if 0
+     /* Set color key on primary. */
+ 
+     SavageSetColorKey( pScrn );
++#endif
+ 
+     /* Set FIFO L2 on second stream. */
+ 
+@@ -1358,10 +1365,10 @@
+           !psav->CrtOnly &&
+           !psav->TvOn
+       ) {
+-          drw_w = (float)(drw_w * psav->XExp1)/(float)psav->XExp2 + 1;
+-          drw_h = (float)(drw_h * psav->YExp1)/(float)psav->YExp2 + 1;
+-          dstBox->x1 = (float)(dstBox->x1 * psav->XExp1)/(float)psav->XExp2;
+-          dstBox->y1 = (float)(dstBox->y1 * psav->YExp1)/(float)psav->YExp2;
++          drw_w = (drw_w * psav->XExp1)/psav->XExp2 + 1;
++          drw_h = (drw_h * psav->YExp1)/psav->YExp2 + 1;
++          dstBox->x1 = (dstBox->x1 * psav->XExp1)/psav->XExp2;
++          dstBox->y1 = (dstBox->y1 * psav->YExp1)/psav->YExp2;
+           dstBox->x1 += psav->displayXoffset;
+           dstBox->y1 += psav->displayYoffset;
+       }
+@@ -1378,14 +1385,16 @@
+      * are 2 bytes/pixel.
+      */
+ 
+-    OUTREG(SEC_STREAM_FBUF_ADDR0, (offset + (x1>>15)) & 0x3ffff0 );
++    OUTREG(SEC_STREAM_FBUF_ADDR0, (offset + (x1>>15)) & 0x7ffff0 );
+     OUTREG(SEC_STREAM_STRIDE, pitch & 0xfff );
+     OUTREG(SEC_STREAM_WINDOW_START, ((dstBox->x1+1) << 16) | (dstBox->y1+1) );
+     OUTREG(SEC_STREAM_WINDOW_SZ, ((drw_w) << 16) | drw_h );
+ 
++#if 0
+     /* Set color key on primary. */
+ 
+     SavageSetColorKey( pScrn );
++#endif
+ 
+     /* Set FIFO L2 on second stream. */
+ 
+@@ -1424,6 +1433,20 @@
+     int top, left, npixels, nlines;
+     BoxRec dstBox;
+     CARD32 tmp;
++/*    xf86ErrorFVerb(XVTRACE,"SavagePutImage\n"); */
++
++    if( psav->cxScreen != pScrn->currentMode->HDisplay )
++    {
++      /* The mode has changed.  Recompute the offsets. */
++
++      if( 
++          S3_SAVAGE_MOBILE_SERIES(psav->Chipset) && 
++          !psav->CrtOnly && 
++          !psav->TvOn 
++      ) {
++          OverlayParamInit( pScrn );
++      }
++    }
+ 
+     if(drw_w > 16384) drw_w = 16384;
+ 
+@@ -1519,6 +1542,12 @@
+       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. */
++
++    SavageDisplayVideo(pScrn, id, offset, width, height, dstPitch,
++           x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h);
+ 
+     /* update cliplist */
+     if(!RegionsEqual(&pPriv->clip, clipBoxes)) {
+@@ -1528,9 +1557,6 @@
+                                       REGION_NUM_RECTS(clipBoxes),
+                                       REGION_RECTS(clipBoxes));
+     }
+-   
+-    SavageDisplayVideo(pScrn, id, offset, width, height, dstPitch,
+-           x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h);
+ 
+     pPriv->videoStatus = CLIENT_VIDEO_ON;
+ 
+@@ -1692,6 +1718,7 @@
+     XF86SurfacePtr surface
+ ){
+     OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr;
++    xf86ErrorFVerb(XVTRACE,"SavageStopSurface\n");
+ 
+     if(pPriv->isOn) {
+       /*SavagePtr psav = SAVPTR(surface->pScrn);*/
+@@ -1754,6 +1781,7 @@
+     SavagePortPrivPtr portPriv = GET_PORT_PRIVATE(pScrn);
+     INT32 x1, y1, x2, y2;
+     BoxRec dstBox;
++    xf86ErrorFVerb(XVTRACE,"SavageDisplaySurface\n");
+ 
+     x1 = src_x;
+     x2 = src_x + src_w;
+@@ -1777,14 +1805,14 @@
+     dstBox.y1 -= pScrn->frameY0;
+     dstBox.y2 -= pScrn->frameY0;
+ 
+-    XAAFillSolidRects(pScrn, portPriv->colorKey, GXcopy, ~0, 
+-                                        REGION_NUM_RECTS(clipBoxes),
+-                                        REGION_RECTS(clipBoxes));
+-
+     SavageDisplayVideo(pScrn, surface->id, surface->offsets[0], 
+            surface->width, surface->height, surface->pitches[0],
+            x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h);
+ 
++    XAAFillSolidRects(pScrn, portPriv->colorKey, GXcopy, ~0, 
++                                        REGION_NUM_RECTS(clipBoxes),
++                                        REGION_RECTS(clipBoxes));
++
+     pPriv->isOn = TRUE;
+ #if 0
+     if(portPriv->videoStatus & CLIENT_VIDEO_ON) {
+@@ -1839,144 +1867,89 @@
+     SavagePtr psav = SAVPTR(pScrn);
+ 
+     psav = SAVPTR(pScrn);
+-    psav->cxScreen = psav->iResX;
+-    InitStreamsForExpansion(psav);
++    psav->cxScreen = pScrn->currentMode->HDisplay;
++    InitStreamsForExpansion(pScrn);
+ }
+ 
+-/* Function to calculate lcd expansion x,yfactor and offset for overlay
++/* Function to calculate lcd expansion x,y factor and offset for overlay
+  */
+-static void InitStreamsForExpansion(SavagePtr psav)
++static void InitStreamsForExpansion(ScrnInfoPtr pScrn)
+ {
++    SavagePtr psav = SAVPTR(pScrn);
+     int               PanelSizeX,PanelSizeY;
+     int               ViewPortWidth,ViewPortHeight;
++    int               XExpansion, YExpansion;
+     int               XFactor, YFactor;
++    int               Hstate, Vstate;
++
++    static CARD32 Xfactors[] = {
++      0x00010001,
++      0x00010001, /* 1 */
++      0,
++      0x00090008, /* 3 */
++      0x00050004, /* 4 */
++      0,
++      0x00030002, /* 6 */
++      0x00020001  /* 7 */
++    };
++
++    static CARD32 Yfactors[] = {
++      0x00010001,     0x00010001,
++      0,              0x00060005,
++      0x00050004,     0x00040003,
++      0,              0x00030002,
++      0x00020001,     0x00050002,
++      0x000C0005,     0x00080003,
++      0x00090004,     0,
++      0x00030001,     0x00040001,
++    };
++
++
+ 
+     PanelSizeX = psav->PanelX;
+     PanelSizeY = psav->PanelY;
+-    ViewPortWidth = psav->iResX;
+-    ViewPortHeight = psav->iResY;
++    ViewPortWidth = pScrn->currentMode->HDisplay;
++    ViewPortHeight = pScrn->currentMode->VDisplay;
++
+     if( PanelSizeX == 1408 )
+       PanelSizeX = 1400;
+-    psav->XExpansion = 0x00010001;
+-    psav->YExpansion = 0x00010001;
++
++    XExpansion = 0x00010001;
++    YExpansion = 0x00010001;
++
+     psav->displayXoffset = 0;
+     psav->displayYoffset = 0;
+ 
++    VGAOUT8(0x3C4, HZEXP_COMP_1);
++    Hstate = VGAIN8(0x3C5);
++    VGAOUT8(0x3C4, VTEXP_COMP_1);
++    Vstate = VGAIN8(0x3C5);
+     VGAOUT8(0x3C4, HZEXP_FACTOR_IGA1);
+-    XFactor = VGAIN8(0x3C5) >> 4;
++    XFactor = VGAIN8(0x3C5);
+     VGAOUT8(0x3C4, VTEXP_FACTOR_IGA1);
+-    YFactor = VGAIN8(0x3C5) >> 4;
++    YFactor = VGAIN8(0x3C5);
+ 
+-    switch( XFactor )
++    if( Hstate & EC1_EXPAND_ON )
+     {
+-      case 1:
+-          psav->XExpansion = 0x00010001;
+-          psav->displayXoffset = 
+-              (((PanelSizeX - ViewPortWidth) / 2) + 0x7) & 0xFFF8;
+-          break;
++      XExpansion = Xfactors[XFactor>>4];
++    }
+ 
+-      case 3:
+-          psav->XExpansion = 0x00090008;
+-          psav->displayXoffset = 
+-              (((PanelSizeX - ((9 * ViewPortWidth)/8)) / 2) + 0x7) & 0xFFF8;
+-          break;
++    if( Vstate & EC1_EXPAND_ON )
++    {
++      YExpansion = Yfactors[YFactor>>4];
++    }
+ 
+-      case 4:
+-          psav->XExpansion = 0x00050004;
++    psav->XExp1 = XExpansion >> 16;
++    psav->XExp2 = XExpansion & 0xFFFF;
+ 
+-          if ((psav->cxScreen == 800) && (PanelSizeX !=1400))
+-          {
+-              psav->displayXoffset = 
+-                  (((PanelSizeX - ((5 * ViewPortWidth)/4)) / 2) ) & 0xFFF8; 
+-          }
+-          else
+-          {
+-              psav->displayXoffset = 
+-                  (((PanelSizeX - ((5 * ViewPortWidth)/4)) / 2) +0x7) & 
0xFFF8;
+-          }
+-          break;
++    psav->YExp1 = YExpansion >> 16;
++    psav->YExp2 = YExpansion & 0xFFFF;
+ 
+-      case 6:
+-          psav->XExpansion = 0x00030002;
+-          psav->displayXoffset = 
+-              (((PanelSizeX - ((3 * ViewPortWidth)/2)) / 2) + 0x7) & 0xFFF8;
+-          break;
++    psav->displayXoffset = 
++       ((PanelSizeX - (psav->XExp1 * ViewPortWidth) / psav->XExp2) / 2 + 7) & 
0xfff8;
++    psav->displayYoffset = 
++       ((PanelSizeY - (psav->YExp1 * ViewPortHeight) / psav->YExp2) / 2);
+ 
+-      case 7:
+-          psav->XExpansion = 0x00020001;
+-          psav->displayXoffset = 
+-              (((PanelSizeX - (2 * ViewPortWidth)) / 2) + 0x7) & 0xFFF8;
+-          break;
+-    }
+-      
+-    switch( YFactor )
+-    {
+-      case 0:
+-          psav->YExpansion = 0x00010001;
+-          psav->displayYoffset = (PanelSizeY - ViewPortHeight) / 2;
+-          break;
+-      case 1:
+-          psav->YExpansion = 0x00010001;
+-          psav->displayYoffset = (PanelSizeY - ViewPortHeight) / 2;
+-          break;
+-      case 2:
+-          psav->YExpansion = 0x00040003;
+-          psav->displayYoffset = (PanelSizeY - ((4 * ViewPortHeight)/3)) / 2;
+-          break;
+-      case 4:
+-          psav->YExpansion = 0x00050004;
+-          psav->displayYoffset = (PanelSizeY - ((5 * ViewPortHeight)/4)) / 2;
+-          break;
+-      case 5:
+-          psav->YExpansion = 0x00040003;
+-
+-          if((psav->cxScreen == 1024)&&(PanelSizeX ==1400))
+-          {
+-              psav->displayYoffset = 
+-                  ((PanelSizeY - ((4 * ViewPortHeight)/3)) / 2) - 0x1 ;
+-          }
+-          else
+-          {
+-              psav->displayYoffset = (PanelSizeY - ((4 * ViewPortHeight)/3)) 
/ 2;
+-          }
+-          break;
+-      case 6:
+-          psav->YExpansion = 0x00050004;
+-          psav->displayYoffset = (PanelSizeY - ((5 * ViewPortHeight)/4)) / 2;
+-          break;
+-      case 7:
+-          psav->YExpansion = 0x00030002;
+-          psav->displayYoffset = (PanelSizeY - ((3 * ViewPortHeight)/2)) / 2;
+-          break;
+-      case 8:
+-          psav->YExpansion = 0x00020001;
+-          psav->displayYoffset = (PanelSizeY - (2 * ViewPortHeight)) /2;
+-          break;
+-      case 9:
+-          psav->YExpansion = 0x00090004;
+-          psav->displayYoffset = (PanelSizeY - ((9 * ViewPortHeight)/4)) /2;
+-          break;
+-      case 11:
+-          psav->YExpansion = 0x00110005;
+-          psav->displayYoffset = (PanelSizeY - ((11 * ViewPortHeight)/5)) /2;
+-          break;
+-      case 12:
+-          psav->YExpansion = 0x00070003;
+-          psav->displayYoffset = (PanelSizeY - ((7 * ViewPortHeight)/3)) /2;
+-          break;
+-      case 14:
+-          psav->YExpansion = 0x00050002;
+-          psav->displayYoffset = (PanelSizeY - ((5 * ViewPortHeight)/2)) /2;
+-          break;
+-      case 15:
+-          psav->YExpansion = 0x00040001;
+-          psav->displayYoffset = (PanelSizeY - (4 * ViewPortHeight)) /2;
+-          break;
+-    }
+-    psav->XExp1 = psav->XExpansion >> 16;
+-    psav->XExp2 = psav->XExpansion & 0xFFFF;
+-    psav->YExp1 = psav->YExpansion >> 16;
+-    psav->YExp2 = psav->YExpansion & 0xFFFF;
+ }  /* InitStreamsForExpansionPM */
+ 
+ #endif /* XvExtension */

Reply via email to