diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-25 19:28:38 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-25 19:28:38 +0000 |
commit | 148230e83c55136a893bc7861d2c8d12d1b7dfd8 (patch) | |
tree | 11c69c4fc3c48f604f6cfc369a10f6727dfc1142 | |
parent | 1b535877d4c7045ff4cf45f3e3c00734b61797d2 (diff) |
XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folksxf86-4_3_99_902xf86-4_3_99_901xf86-4_3_99_16
-rw-r--r-- | man/savage.man | 5 | ||||
-rw-r--r-- | src/savage_accel.c | 23 | ||||
-rw-r--r-- | src/savage_driver.c | 98 | ||||
-rw-r--r-- | src/savage_driver.h | 8 | ||||
-rw-r--r-- | src/savage_regs.h | 10 | ||||
-rw-r--r-- | src/savage_vbe.c | 5 | ||||
-rw-r--r-- | src/savage_video.c | 314 |
7 files changed, 206 insertions, 257 deletions
diff --git a/man/savage.man b/man/savage.man index cfd00ae..41cc1aa 100644 --- a/man/savage.man +++ b/man/savage.man @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man,v 1.6 2002/05/14 20:19:51 alanh Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man,v 1.7 2003/11/09 20:43:57 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH SAVAGE __drivermansuffix__ __vendorversion__ @@ -81,8 +81,7 @@ forces the ShadowFB option on, and disables acceleration. Default: no rotation. .TP .BI "Option \*qShadowFB\*q \*q" boolean \*q -Enable or disable use of the shadow framebuffer layer. See -shadowfb(__drivermansuffix__) for further information. This option +Enable or disable use of the shadow framebuffer layer. This option disables acceleration. Default: off. .TP .BI "Option \*qLCDClock\*q \*q" frequency \*q diff --git a/src/savage_accel.c b/src/savage_accel.c index 0ffc863..6e16895 100644 --- a/src/savage_accel.c +++ b/src/savage_accel.c @@ -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.22 2003/11/03 05:11:29 tsi Exp $ */ /* * @@ -457,9 +457,13 @@ SavageInitAccel(ScreenPtr pScreen) * We could double the width ourselves into a reserved frame buffer * section, but since I went 18 months with only ONE report of this * error, it seems hardly worth the trouble. + * Savage4 seems to have problems with 8x8 color patterns. + * Not sending the pattern offsetsfixes the lockup but the + * drawing problems remain. + * Until further investigation we have to disable this. */ -#if 1 +#if 0 if( (psav->Chipset == S3_SAVAGE3D) || (psav->Chipset == S3_SAVAGE4) ) { xaaptr->SetupForColor8x8PatternFill = @@ -468,8 +472,8 @@ SavageInitAccel(ScreenPtr pScreen) SavageSubsequentColor8x8PatternFillRect; xaaptr->Color8x8PatternFillFlags = 0 | NO_TRANSPARENCY - | HARDWARE_PATTERN_PROGRAMMED_BITS - | HARDWARE_PATTERN_PROGRAMMED_ORIGIN + | HARDWARE_PATTERN_SCREEN_ORIGIN + | ROP_NEEDS_SOURCE ; } #endif @@ -477,7 +481,7 @@ SavageInitAccel(ScreenPtr pScreen) /* Solid lines */ #if 1 - xaaptr->SolidLineFlags = NO_PLANEMASK; + xaaptr->SolidLineFlags = NO_PLANEMASK | ROP_NEEDS_SOURCE; xaaptr->SetupForSolidLine = SavageSetupForSolidFill; xaaptr->SubsequentSolidBresenhamLine = SavageSubsequentSolidBresenhamLine; xaaptr->SubsequentSolidTwoPointLine = SavageSubsequentSolidTwoPointLine; @@ -496,6 +500,7 @@ SavageInitAccel(ScreenPtr pScreen) | SCANLINE_PAD_DWORD | BIT_ORDER_IN_BYTE_MSBFIRST | LEFT_EDGE_CLIPPING + | ROP_NEEDS_SOURCE ; xaaptr->SetupForImageWrite = SavageSetupForImageWrite; xaaptr->SubsequentImageWriteRect = SavageSubsequentImageWriteRect; @@ -506,7 +511,7 @@ SavageInitAccel(ScreenPtr pScreen) /* WriteBitmap color expand */ #if 0 - xaaptr->WriteBitmapFlags = NO_PLANEMASK; + xaaptr->WriteBitmapFlags = NO_PLANEMASK | ROP_NEEDS_SOURCE; xaaptr->WriteBitmap = SavageWriteBitmapCPUToScreenColorExpand; #endif @@ -996,7 +1001,6 @@ SavageSetupForColor8x8PatternFill( SavagePtr psav = SAVPTR(pScrn); int cmd; - int mix; unsigned int bd; int pat_offset; @@ -1008,7 +1012,7 @@ SavageSetupForColor8x8PatternFill( cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP | BCI_CMD_DEST_GBD | BCI_CMD_PAT_PBD_COLOR_NEW; - mix = XAAHelpSolidROP( pScrn, &trans_col, planemask, &rop ); + (void) XAAHelpSolidROP( pScrn, &trans_col, planemask, &rop ); BCI_CMD_SET_ROP(cmd, rop); bd = BCI_BD_BW_DISABLE; @@ -1038,11 +1042,10 @@ SavageSubsequentColor8x8PatternFillRect( if( !w || !h ) return; - psav->WaitQueue(psav,6); + psav->WaitQueue(psav,5); BCI_SEND(psav->SavedBciCmd); BCI_SEND(psav->SavedSbdOffset); BCI_SEND(psav->SavedSbd); - BCI_SEND(BCI_X_Y(patternx,patterny)); BCI_SEND(BCI_X_Y(x, y)); BCI_SEND(BCI_W_H(w, h)); } diff --git a/src/savage_driver.c b/src/savage_driver.c index cdfe256..439587d 100644 --- a/src/savage_driver.c +++ b/src/savage_driver.c @@ -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.49 2003/11/06 18:38:06 tsi Exp $ */ /* * vim: sw=4 ts=8 ai ic: * @@ -19,16 +19,12 @@ #define DPMS_SERVER #include "extensions/dpms.h" -#ifdef XvExtension #include "xf86xv.h" -#endif #include "savage_driver.h" #include "savage_bci.h" - - /* * prototypes */ @@ -82,10 +78,10 @@ extern ScrnInfoPtr gpScrn; #define iabs(a) ((int)(a)>0?(a):(-(a))) #define DRIVER_NAME "savage" -#define DRIVER_VERSION "1.1.26" +#define DRIVER_VERSION "1.1.27" #define VERSION_MAJOR 1 #define VERSION_MINOR 1 -#define PATCHLEVEL 26 +#define PATCHLEVEL 27 #define SAVAGE_VERSION ((VERSION_MAJOR << 24) | \ (VERSION_MINOR << 16) | \ PATCHLEVEL) @@ -260,6 +256,7 @@ static const char *vbeSymbols[] = { NULL }; +#ifdef XFree86LOADER static const char *vbeOptSymbols[] = { "vbeModeInit", "VBESetVBEMode", @@ -267,6 +264,7 @@ static const char *vbeOptSymbols[] = { "VBEFreeVBEInfo", NULL }; +#endif static const char *ddcSymbols[] = { "xf86DoEDID_DDC1", @@ -287,11 +285,9 @@ static const char *xaaSymbols[] = { "XAACopyROP_PM", "XAACreateInfoRec", "XAADestroyInfoRec", - "XAAFillSolidRects", "XAAHelpPatternROP", "XAAHelpSolidROP", "XAAInit", - "XAAScreenIndex", NULL }; @@ -377,7 +373,8 @@ ResetBCI2K( SavagePtr psav ) ! (ALT_STATUS_WORD0 & 0x00200000) ) { - ErrorF( "Resetting BCI, stat = %08x...\n", ALT_STATUS_WORD0); + ErrorF( "Resetting BCI, stat = %08lx...\n", + (unsigned long) ALT_STATUS_WORD0); /* Turn off BCI */ OUTREG( 0x48c18, cob & ~8 ); usleep(10000); @@ -627,9 +624,12 @@ static Bool SavageProbe(DriverPtr drv, int flags) /* sanity checks */ if ((numDevSections = xf86MatchDevice("savage", &devSections)) <= 0) - return FALSE; - if (xf86GetPciVideoInfo() == NULL) - return FALSE; + return FALSE; + if (xf86GetPciVideoInfo() == NULL) { + if (devSections) + xfree(devSections); + return FALSE; + } numUsed = xf86MatchPciInstances("SAVAGE", PCI_VENDOR_S3, SavageChipsets, SavagePciChipsets, @@ -647,7 +647,7 @@ static Bool SavageProbe(DriverPtr drv, int flags) for (i=0; i<numUsed; i++) { ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0); - pScrn->driverVersion = (int)DRIVER_VERSION; + pScrn->driverVersion = SAVAGE_VERSION; pScrn->driverName = DRIVER_NAME; pScrn->name = "SAVAGE"; pScrn->Probe = SavageProbe; @@ -725,7 +725,7 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) * We support bpp of 8, 16, and 32. */ - if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support32bppFb)) + if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support32bppFb)) return FALSE; else { int requiredBpp; @@ -1000,6 +1000,7 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) if (!SavageMapMMIO(pScrn)) { + SavageFreeRec(pScrn); vbeFree(psav->pVbe); return FALSE; } @@ -1031,6 +1032,7 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) if (!xf86SetGamma(pScrn, zeros)) { vbeFree(psav->pVbe); + SavageFreeRec(pScrn); return FALSE; } } @@ -1250,10 +1252,9 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) psav->dacSpeedBpp = pScrn->clock[3]; else if (pScrn->bitsPerPixel >= 24) psav->dacSpeedBpp = pScrn->clock[2]; - else if ((pScrn->bitsPerPixel > 8) && (pScrn->bitsPerPixel < 24)) + else if (pScrn->bitsPerPixel > 8) psav->dacSpeedBpp = pScrn->clock[1]; - else if (pScrn->bitsPerPixel <= 8) - psav->dacSpeedBpp = pScrn->clock[0]; + else psav->dacSpeedBpp = pScrn->clock[0]; } /* Set ramdac limits */ @@ -1683,7 +1684,7 @@ static void SavageSave(ScrnInfoPtr pScrn) static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, SavageRegPtr restore, Bool Entering) { - unsigned char tmp, cr3a, cr66, cr67; + unsigned char tmp, cr3a, cr66; vgaHWPtr hwp = VGAHWPTR(pScrn); SavagePtr psav = SAVPTR(pScrn); int vgaCRIndex, vgaCRReg, vgaIOBase; @@ -1848,6 +1849,20 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, break; } + /* set the correct clock for some BIOSes */ + VGAOUT8(VGA_MISC_OUT_W, + VGAIN8(VGA_MISC_OUT_R) | 0x0C); + /* Some BIOSes turn on clock doubling on non-doubled modes */ + if (pScrn->bitsPerPixel < 24) { + VGAOUT8(vgaCRIndex, 0x67); + if (!(VGAIN8(vgaCRReg) & 0x10)) { + VGAOUT8(0x3c4, 0x15); + VGAOUT8(0x3c5, VGAIN8(0x3C5) & ~0x10); + VGAOUT8(0x3c4, 0x18); + VGAOUT8(0x3c5, VGAIN8(0x3c5) & ~0x80); + } + } + SavageInitialize2DEngine(pScrn); SavageSetGBD(pScrn); @@ -1885,7 +1900,7 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, } VGAOUT8(vgaCRIndex, 0x67); - cr67 = VGAIN8(vgaCRReg); + (void) VGAIN8(vgaCRReg); VGAOUT8(vgaCRReg, restore->CR67 & ~0x0c); /* no STREAMS yet */ /* restore extended regs */ @@ -2090,9 +2105,19 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, VGAOUT8(vgaCRIndex, 0x3a); VGAOUT8(vgaCRReg, cr3a); - if( Entering ) + if( Entering ) { + /* We reinit the engine here just as in the UseBIOS case + * as otherwise we lose performance because the engine + * isn't setup properly (Alan Hourihane - alanh@fairlite.demon.co.uk). + */ + SavageInitialize2DEngine(pScrn); SavageSetGBD(pScrn); + VGAOUT16(vgaCRIndex, 0x0140); + + SavageSetGBD(pScrn); + } + vgaHWProtect(pScrn, FALSE); return; @@ -2117,7 +2142,7 @@ static Bool SavageMapMMIO(ScrnInfoPtr pScrn) } xf86DrvMsg( pScrn->scrnIndex, X_PROBED, - "mapping MMIO @ 0x%x with size 0x%x\n", + "mapping MMIO @ 0x%lx with size 0x%x\n", psav->MmioBase, SAVAGE_NEWMMIO_REGSIZE); psav->MapBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, psav->PciTag, @@ -2151,7 +2176,7 @@ static Bool SavageMapFB(ScrnInfoPtr pScrn) TRACE(("SavageMapFB()\n")); xf86DrvMsg( pScrn->scrnIndex, X_PROBED, - "mapping framebuffer @ 0x%x with size 0x%x\n", + "mapping framebuffer @ 0x%lx with size 0x%x\n", psav->FrameBufferBase, psav->videoRambytes); if (psav->videoRambytes) { @@ -2237,8 +2262,8 @@ static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen, (psav->FBBase + psav->CursorKByte*1024 + 4096 - 32); xf86DrvMsg( pScrn->scrnIndex, X_PROBED, - "Shadow area physical %08x, linear %08x\n", - psav->ShadowPhysical, psav->ShadowVirtual ); + "Shadow area physical %08lx, linear %p\n", + psav->ShadowPhysical, (void *)psav->ShadowVirtual ); psav->WaitQueue = ShadowWait1; psav->WaitIdle = ShadowWait; @@ -2363,10 +2388,8 @@ static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen, if (xf86DPMSInit(pScreen, SavageDPMS, 0) == FALSE) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "DPMS initialization failed\n"); -#ifdef XvExtension if( !psav->NoAccel && !SavagePanningCheck(pScrn) ) SavageInitVideo( pScreen ); -#endif if (serverGeneration == 1) xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); @@ -2489,22 +2512,7 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) - 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->CrtcHTotal *= 2; - mode->CrtcHSkew *= 2; - mode->CrtcHAdjusted = TRUE; - } + psav->HorizScaleFactor = 1; if (!vgaHWInit(pScrn, mode)) return FALSE; @@ -2958,10 +2966,6 @@ void SavageLoadPaletteSavage4(ScrnInfoPtr pScrn, int numColors, int *indicies, int i, index; vgaHWPtr hwp = VGAHWPTR(pScrn); - int vgaCRIndex, vgaCRReg, vgaIOBase; - vgaIOBase = hwp->IOBase; - vgaCRIndex = vgaIOBase + 4; - vgaCRReg = vgaIOBase + 5; VerticalRetraceWait(psav); for (i=0; i<numColors; i++) { diff --git a/src/savage_driver.h b/src/savage_driver.h index 2311396..b25fc56 100644 --- a/src/savage_driver.h +++ b/src/savage_driver.h @@ -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.17 2003/04/23 14:18:37 eich Exp $ */ #ifndef SAVAGE_VGAHWMMIO_H #define SAVAGE_VGAHWMMIO_H @@ -140,11 +140,9 @@ typedef struct _Savage { 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; diff --git a/src/savage_regs.h b/src/savage_regs.h index 602d2bc..8913f95 100644 --- a/src/savage_regs.h +++ b/src/savage_regs.h @@ -1,4 +1,4 @@ -/* $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.13 2003/04/23 14:18:37 eich Exp $ */ #ifndef _SAVAGE_REGS_H #define _SAVAGE_REGS_H @@ -216,7 +216,15 @@ enum S3CHIPTAGS { 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 --git a/src/savage_vbe.c b/src/savage_vbe.c index f0a0edc..cf8f417 100644 --- a/src/savage_vbe.c +++ b/src/savage_vbe.c @@ -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.14 2003/06/18 16:17:40 eich Exp $ */ #include "savage_driver.h" #include "savage_vbe.h" @@ -72,7 +72,7 @@ SavageSetVESAMode( SavagePtr psav, int n, int Refresh ) 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 ); @@ -150,6 +150,7 @@ SavageFreeBIOSModeTable( SavagePtr psav, SavageModeTablePtr* ppTable ) xfree( pMode->RefreshRate ); pMode->RefreshRate = NULL; } + pMode++; } xfree( *ppTable ); diff --git a/src/savage_video.c b/src/savage_video.c index 38c2cc3..7773e99 100644 --- a/src/savage_video.c +++ b/src/savage_video.c @@ -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.18 2003/11/10 18:22:26 tsi Exp $ */ #include "Xv.h" #include "dix.h" @@ -17,11 +17,6 @@ #define TIMER_MASK (OFF_TIMER | FREE_TIMER) -#ifndef XvExtension -void SavageInitVideo(ScreenPtr pScreen) {} -void SavageResetVideo(ScrnInfoPtr pScrn) {} -#else - void myOUTREG( SavagePtr psav, unsigned long offset, unsigned long value ); static XF86VideoAdaptorPtr SavageSetupImageVideo(ScreenPtr); @@ -79,7 +74,7 @@ static void (*SavageDisplayVideo)( ) = NULL; static void OverlayParamInit(ScrnInfoPtr pScrn); -static void InitStreamsForExpansion(SavagePtr psav); +static void InitStreamsForExpansion(ScrnInfoPtr pScrn); /*static void SavageBlockHandler(int, pointer, pointer, pointer);*/ @@ -303,10 +298,10 @@ unsigned int GetBlendForFourCC( int id ) void myOUTREG( SavagePtr psav, unsigned long offset, unsigned long value ) { - ErrorF( "MMIO %04x, was %08x, want %08x,", - offset, MMIO_IN32( psav->MapBase, offset ), value ); + ErrorF( "MMIO %04lx, was %08lx, want %08lx,", + offset, (unsigned long)MMIO_IN32( psav->MapBase, offset ), value ); MMIO_OUT32( psav->MapBase, offset, value ); - ErrorF( " now %08x\n", MMIO_IN32( psav->MapBase, offset ) ); + ErrorF( " now %08lx\n", (unsigned long)MMIO_IN32( psav->MapBase, offset ) ); } void SavageInitStreamsOld(ScrnInfoPtr pScrn) @@ -421,7 +416,6 @@ void SavageStreamsOn(ScrnInfoPtr pScrn, int id) /* Sequence stolen from streams.c in M7 NT driver */ - xf86EnableIO(); /* Unlock extended registers. */ @@ -430,10 +424,20 @@ void SavageStreamsOn(ScrnInfoPtr pScrn, int id) 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) || +#if 0 /* I don't think commenting this out is correct (EE) */ + (psav->Chipset == S3_SUPERSAVAGE) || +#endif (psav->Chipset == S3_SAVAGE2000) ) { jStreamsControl = VGAIN8( vgaCRReg ) | ENABLE_STREAM1; @@ -447,7 +451,7 @@ void SavageStreamsOn(ScrnInfoPtr pScrn, int id) VGAOUT16( vgaCRIndex, (jStreamsControl << 8) | EXT_MISC_CTRL2 ); psav->blendBase = GetBlendForFourCC( id ) << 9; - xf86ErrorFVerb(XVTRACE+1,"Format %4.4s, blend is %08x\n", &id, psav->blendBase ); + xf86ErrorFVerb(XVTRACE+1,"Format %4.4s, blend is %08x\n", (char *)&id, psav->blendBase ); OUTREG( BLEND_CONTROL, psav->blendBase | 0x08 ); /* These values specify brightness, contrast, saturation and hue. */ @@ -701,7 +705,7 @@ void SavageSetColorOld( ScrnInfoPtr pScrn ) SavagePortPrivPtr pPriv = psav->adaptor->pPortPrivates[0].ptr; xf86ErrorFVerb(XVTRACE, "bright %d, contrast %d, saturation %d, hue %d\n", - pPriv->brightness, pPriv->contrast, pPriv->saturation, pPriv->hue ); + pPriv->brightness, (int)pPriv->contrast, (int)pPriv->saturation, pPriv->hue ); if( (psav->videoFourCC == FOURCC_RV15) || @@ -743,7 +747,7 @@ void SavageSetColorNew( ScrnInfoPtr pScrn ) unsigned long assembly; xf86ErrorFVerb(XVTRACE, "bright %d, contrast %d, saturation %d, hue %d\n", - pPriv->brightness, pPriv->contrast, pPriv->saturation, pPriv->hue ); + pPriv->brightness, (int)pPriv->contrast, (int)pPriv->saturation, pPriv->hue ); if( psav->videoFourCC == FOURCC_Y211 ) k = 1.0; /* YUV */ @@ -771,20 +775,20 @@ void SavageSetColorNew( ScrnInfoPtr pScrn ) k2 = (int)(dk2+0.5) & 0x1ff; k3 = (int)(dk3+0.5) & 0x1ff; assembly = (k3<<18) | (k2<<9) | k1; - xf86ErrorFVerb(XVTRACE+1, "CC1 = %08x ", assembly ); + xf86ErrorFVerb(XVTRACE+1, "CC1 = %08lx ", assembly ); OUTREG( SEC_STREAM_COLOR_CONVERT1, assembly ); k4 = (int)(dk4+0.5) & 0x1ff; k5 = (int)(dk5+0.5) & 0x1ff; k6 = (int)(dk6+0.5) & 0x1ff; assembly = (k6<<18) | (k5<<9) | k4; - xf86ErrorFVerb(XVTRACE+1, "CC2 = %08x ", assembly ); + xf86ErrorFVerb(XVTRACE+1, "CC2 = %08lx ", assembly ); OUTREG( SEC_STREAM_COLOR_CONVERT2, assembly ); k7 = (int)(dk7+0.5) & 0x1ff; kb = (int)(dkb+0.5) & 0xffff; assembly = (kb<<9) | k7; - xf86ErrorFVerb(XVTRACE+1, "CC3 = %08x\n", assembly ); + xf86ErrorFVerb(XVTRACE+1, "CC3 = %08lx\n", assembly ); OUTREG( SEC_STREAM_COLOR_CONVERT3, assembly ); } @@ -865,7 +869,7 @@ SavageSetupImageVideo(ScreenPtr pScreen) pPriv->lastKnownPitch = 0; /* gotta uninit this someplace */ - REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); + REGION_NULL(pScreen, &pPriv->clip); psav->adaptor = adapt; @@ -878,36 +882,6 @@ SavageSetupImageVideo(ScreenPtr pScreen) } -static Bool -RegionsEqual(RegionPtr A, RegionPtr B) -{ - int *dataA, *dataB; - int num; - - num = REGION_NUM_RECTS(A); - if(num != REGION_NUM_RECTS(B)) - return FALSE; - - if((A->extents.x1 != B->extents.x1) || - (A->extents.x2 != B->extents.x2) || - (A->extents.y1 != B->extents.y1) || - (A->extents.y2 != B->extents.y2)) - return FALSE; - - dataA = (int*)REGION_RECTS(A); - dataB = (int*)REGION_RECTS(B); - - while(num--) { - if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) - return FALSE; - dataA += 2; - dataB += 2; - } - - return TRUE; -} - - /* SavageClipVideo - Takes the dst box in standard X BoxRec form (top and left @@ -992,9 +966,8 @@ SavageStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) REGION_EMPTY(pScrn->pScreen, &pPriv->clip); - SavageStreamsOff( pScrn ); - if(shutdown) { + SavageStreamsOff( pScrn ); if(pPriv->area) { xf86FreeOffscreenArea(pPriv->area); pPriv->area = NULL; @@ -1266,16 +1239,15 @@ SavageDisplayVideoOld( if( src_w > (drw_w << 1) ) { - /* BUGBUG shouldn't this be >=? */ if( src_w <= (drw_w << 2) ) ssControl |= HDSCALE_4; - else if( src_w > (drw_w << 3) ) + else if( src_w <= (drw_w << 3) ) ssControl |= HDSCALE_8; - else if( src_w > (drw_w << 4) ) + else if( src_w <= (drw_w << 4) ) ssControl |= HDSCALE_16; - else if( src_w > (drw_w << 5) ) + else if( src_w <= (drw_w << 5) ) ssControl |= HDSCALE_32; - else if( src_w > (drw_w << 6) ) + else if( src_w <= (drw_w << 6) ) ssControl |= HDSCALE_64; } @@ -1283,9 +1255,11 @@ SavageDisplayVideoOld( 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 +1332,10 @@ SavageDisplayVideoNew( !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 +1352,16 @@ SavageDisplayVideoNew( * 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. */ @@ -1417,6 +1393,7 @@ SavagePutImage( ){ SavagePortPrivPtr pPriv = (SavagePortPrivPtr)data; SavagePtr psav = SAVPTR(pScrn); + ScreenPtr pScreen = pScrn->pScreen; INT32 x1, x2, y1, y2; unsigned char *dst_start; int pitch, new_h, offset, offsetV=0, offsetU=0; @@ -1424,6 +1401,20 @@ SavagePutImage( 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,18 +1510,19 @@ 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. */ + + 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)) { + if(!REGION_EQUAL(pScreen, &pPriv->clip, clipBoxes)) { REGION_COPY(pScreen, &pPriv->clip, clipBoxes); /* draw these */ - XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0, - REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); + xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, 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 +1684,7 @@ SavageStopSurface( XF86SurfacePtr surface ){ OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; + xf86ErrorFVerb(XVTRACE,"SavageStopSurface\n"); if(pPriv->isOn) { /*SavagePtr psav = SAVPTR(surface->pScrn);*/ @@ -1751,9 +1744,11 @@ SavageDisplaySurface( ){ OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; ScrnInfoPtr pScrn = surface->pScrn; + ScreenPtr pScreen = pScrn->pScreen; 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,18 +1772,16 @@ SavageDisplaySurface( 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); + xf86XVFillKeyHelper(pScrn->pScreen, portPriv->colorKey, clipBoxes); + pPriv->isOn = TRUE; #if 0 if(portPriv->videoStatus & CLIENT_VIDEO_ON) { - REGION_EMPTY(pScrn->pScreen, &portPriv->clip); + REGION_EMPTY(pScreen, &portPriv->clip); UpdateCurrentTime(); portPriv->videoStatus = FREE_TIMER; portPriv->freeTime = currentTime.milliseconds + FREE_DELAY; @@ -1839,144 +1832,87 @@ static void OverlayParamInit(ScrnInfoPtr pScrn) 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 */ |