diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-26 22:49:00 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-26 22:49:00 +0000 |
commit | a465c54ca726966c7eb5f4a33b72c10ff9cc0284 (patch) | |
tree | a91ae0b08ba32dd5da4e7d8063649dde32070d8b | |
parent | a43c68bc5bc9cf42193a8aca56a1faa5d00392b4 (diff) |
merge latest (4.3.99.16) from XFree86 (vendor) branchXEVIE-BASE
-rw-r--r-- | man/trident.man | 12 | ||||
-rw-r--r-- | src/blade_accel.c | 26 | ||||
-rw-r--r-- | src/image_accel.c | 14 | ||||
-rw-r--r-- | src/trident.h | 22 | ||||
-rw-r--r-- | src/trident_accel.c | 15 | ||||
-rw-r--r-- | src/trident_bank.c | 4 | ||||
-rw-r--r-- | src/trident_dac.c | 141 | ||||
-rw-r--r-- | src/trident_dga.c | 25 | ||||
-rw-r--r-- | src/trident_driver.c | 136 | ||||
-rw-r--r-- | src/trident_regs.h | 5 | ||||
-rw-r--r-- | src/trident_video.c | 181 | ||||
-rw-r--r-- | src/tridenthelper.c | 4 | ||||
-rw-r--r-- | src/tridentramdac.c | 4 | ||||
-rw-r--r-- | src/tvga_dac.c | 34 | ||||
-rw-r--r-- | src/xp_accel.c | 15 |
15 files changed, 324 insertions, 314 deletions
diff --git a/man/trident.man b/man/trident.man index a02fa43..b9eeae8 100644 --- a/man/trident.man +++ b/man/trident.man @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.man,v 1.12 2003/01/06 10:15:26 alanh Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.man,v 1.15 2003/07/03 07:52:46 alanh Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH TRIDENT __drivermansuffix__ __vendorversion__ @@ -39,7 +39,7 @@ CyberBlade/e4, CyberBladeXP, CyberBladeAi1/XP, BladeXP .TP 12 .B ISA/VLBus 8900C, 8900D, 9000, 9200CXr, Cyber9320, 9400CXi, 9440AGi -These cards have been ported but need furthur testing and may not work. +These cards have been ported but need further testing and may not work. .SH CONFIGURATION DETAILS Please refer to XF86Config(__filemansuffix__) for general configuration details. This section only covers configuration details specific to this @@ -74,6 +74,14 @@ Enable or disable use of the shadow framebuffer layer. Default: off. This sets the default pixel value for the YUV video overlay key. Default: undefined. .TP +.BI "Option \*qTVChipset\*q \*q" string \*q +This sets the TV chipset. Options are CH7005 or VT1621. +Default: off. +.TP +.BI "Option \*qTVSignal\*q \*q" integer \*q +This sets the TV signalling. Options are 0 for NTSC or 1 for PAL. +Default: undefined. +.TP .BI "Option \*qNoPciBurst\*q \*q" boolean \*q Turn off PCI burst mode, PCI Bursting is on by default. Default: off. diff --git a/src/blade_accel.c b/src/blade_accel.c index e76860d..cf4ccf2 100644 --- a/src/blade_accel.c +++ b/src/blade_accel.c @@ -1,5 +1,5 @@ /* - * Copyright 1997,1998 by Alan Hourihane, Wigan, England. + * Copyright 1997-2003 by Alan Hourihane, North Wales, UK. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -23,7 +23,7 @@ * * Trident Blade3D accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c,v 1.18 2002/10/08 22:14:11 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c,v 1.21 2003/10/30 13:38:01 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -151,16 +151,6 @@ BladeAccelInit(ScreenPtr pScreen) XAAInfoRecPtr infoPtr; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - BoxRec AvailFBArea; - - AvailFBArea.x1 = 0; - AvailFBArea.y1 = 0; - AvailFBArea.x2 = pScrn->displayWidth; - AvailFBArea.y2 = (pTrident->FbMapSize - 4096) / (pScrn->displayWidth * - pScrn->bitsPerPixel / 8); - if (AvailFBArea.y2 > 2047) AvailFBArea.y2 = 2047; - - xf86InitFBManager(pScreen, &AvailFBArea); if (pTrident->NoAccel) return FALSE; @@ -295,13 +285,13 @@ BladeSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, BLADE_OUT(0x2168, transparency_color & 0xffffff); pTrident->BltScanDirection |= 1<<6; } -#endif REPLICATE(planemask); - if (planemask != -1) { + if (planemask != (unsigned int)-1) { BLADE_OUT(0x2184, ~planemask); pTrident->BltScanDirection |= 1<<5; } +#endif BLADE_OUT(0x2148, XAACopyROP[rop]); } @@ -483,11 +473,13 @@ BladeSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, BLADE_OUT(0x2160, color); BLADE_OUT(0x2148, XAACopyROP[rop]); pTrident->BltScanDirection = 0; +#if 0 REPLICATE(planemask); if (planemask != -1) { BLADE_OUT(0x2184, ~planemask); pTrident->BltScanDirection |= 1<<5; } +#endif } static void @@ -559,11 +551,13 @@ BladeSetupForCPUToScreenColorExpand(ScrnInfoPtr pScrn, BLADE_OUT(0x2160, fg); BLADE_OUT(0x2164, bg); } +#if 0 REPLICATE(planemask); if (planemask != -1) { BLADE_OUT(0x2184, ~planemask); pTrident->BltScanDirection |= 1<<5; } +#endif } static void @@ -610,11 +604,13 @@ BladeSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, BLADE_OUT(0x2178, bg); } pTrident->BltScanDirection = 0; +#if 0 REPLICATE(planemask); if (planemask != -1) { BLADE_OUT(0x2184, ~planemask); pTrident->BltScanDirection |= 1<<5; } +#endif } static void @@ -683,11 +679,13 @@ static void BladeSetupForImageWrite( BLADE_OUT(0x2148, XAACopyROP[rop]); pTrident->BltScanDirection = 0; +#if 0 REPLICATE(planemask); if (planemask != -1) { BLADE_OUT(0x2184, ~planemask); pTrident->BltScanDirection |= 1<<5; } +#endif } static void BladeSubsequentImageWriteRect( diff --git a/src/image_accel.c b/src/image_accel.c index 485f455..61017b5 100644 --- a/src/image_accel.c +++ b/src/image_accel.c @@ -1,5 +1,5 @@ /* - * Copyright 1997,1998 by Alan Hourihane, Wigan, England. + * Copyright 1997-2003 by Alan Hourihane, North Wales, UK. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -23,7 +23,7 @@ * * Trident 3DImage' accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/image_accel.c,v 1.24 2001/10/28 03:33:51 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/image_accel.c,v 1.26 2003/10/30 13:38:01 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -134,16 +134,6 @@ ImageAccelInit(ScreenPtr pScreen) XAAInfoRecPtr infoPtr; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - BoxRec AvailFBArea; - - AvailFBArea.x1 = 0; - AvailFBArea.y1 = 0; - AvailFBArea.x2 = pScrn->displayWidth; - AvailFBArea.y2 = (pTrident->FbMapSize - 4096) / (pScrn->displayWidth * - pScrn->bitsPerPixel / 8); - if (AvailFBArea.y2 > 2047) AvailFBArea.y2 = 2047; - - xf86InitFBManager(pScreen, &AvailFBArea); if (pTrident->NoAccel) return FALSE; diff --git a/src/trident.h b/src/trident.h index a73ae53..ddae58e 100644 --- a/src/trident.h +++ b/src/trident.h @@ -1,5 +1,5 @@ /* - * Copyright 1992-2000 by Alan Hourihane <alanh@fairlite.demon.co.uk> + * Copyright 1992-2003 by Alan Hourihane, North Wales, UK. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -21,7 +21,7 @@ * * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h,v 1.56 2002/09/16 18:06:02 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h,v 1.60 2003/10/30 13:38:01 alanh Exp $ */ /*#define VBE_INFO*/ #ifndef _TRIDENT_H_ @@ -49,6 +49,7 @@ typedef struct { unsigned char DacRegs[0x300]; } TRIDENTRegRec, *TRIDENTRegPtr; +#define VGA_REGNUM_ABOUT_TV 19 #define TRIDENTPTR(p) ((TRIDENTPtr)((p)->driverPrivate)) typedef struct { @@ -125,6 +126,7 @@ typedef struct { CARD32 DrawFlag; CARD16 LinePattern; RamDacRecPtr RamDacRec; + int CursorOffset; xf86CursorInfoPtr CursorInfoRec; xf86Int10InfoPtr Int10; vbeInfoPtr pVbe; @@ -140,7 +142,6 @@ typedef struct { CARD8* XAAScanlineColorExpandBuffers[2]; CARD8* XAAImageScanlineBuffer[1]; void (*InitializeAccelerator)(ScrnInfoPtr); -#ifdef XvExtension void (*VideoTimerCallback)(ScrnInfoPtr, Time); XF86VideoAdaptorPtr adaptor; int videoKey; @@ -150,7 +151,6 @@ typedef struct { int vsync_bskew; CARD32 videoFlags; int keyOffset; -#endif int OverrideHsync; int OverrideVsync; int OverrideBskew; @@ -163,6 +163,11 @@ typedef struct { int brightness; double gamma; int FPDelay; /* just for debugging - will go away */ + int TVChipset; /* 0: None 1: VT1621 2: CH7005C*/ + int TVSignalMode; /* 0: NTSC 1: PAL */ + Bool TVRegSet; /* 0: User not customer TV Reg, 1: User customer TV Reg */ + unsigned char TVRegUserSet[2][128]; /*[0][128] for Reg Index, [1][128] for Reg Value */ + unsigned char DefaultTVDependVGASetting[VGA_REGNUM_ABOUT_TV+0x62]; /* VGA_REGNUM_ABOUT_TV: VGA Reg, 0x62: TV Reg */ } TRIDENTRec, *TRIDENTPtr; typedef struct { @@ -250,6 +255,11 @@ void TRIDENTRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox); void TRIDENTRefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox); void TRIDENTRefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void VIA_TVInit(ScrnInfoPtr pScrn); +void VIA_SaveTVDepentVGAReg(ScrnInfoPtr pScrn); +void VIA_RestoreTVDependVGAReg(ScrnInfoPtr pScrn); +void VIA_DumpReg(ScrnInfoPtr pScrn); + /* * Trident Chipset Definitions */ @@ -294,7 +304,8 @@ typedef enum { CYBERBLADEAI1D, CYBERBLADEE4, BLADEXP, - CYBERBLADEXPAI1 + CYBERBLADEXPAI1, + CYBERBLADEXP4 } TRIDENTType; #define UseMMIO (pTrident->NoMMIO == FALSE) @@ -324,6 +335,7 @@ typedef enum { (pTrident->Chipset == CYBERBLADEAI1D) || \ (pTrident->Chipset == BLADE3D) || \ (pTrident->Chipset == CYBERBLADEXPAI1) || \ + (pTrident->Chipset == CYBERBLADEXP4) || \ (pTrident->Chipset == BLADEXP)) /* diff --git a/src/trident_accel.c b/src/trident_accel.c index 256e97e..280bde2 100644 --- a/src/trident_accel.c +++ b/src/trident_accel.c @@ -1,5 +1,5 @@ /* - * Copyright 1992-2000 by Alan Hourihane, Wigan, England. + * Copyright 1992-2003 by Alan Hourihane, North Wales, UK. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -23,7 +23,7 @@ * * Trident accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c,v 1.26 2003/02/12 21:46:42 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c,v 1.28 2003/10/30 13:38:01 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -117,17 +117,6 @@ TridentAccelInit(ScreenPtr pScreen) XAAInfoRecPtr infoPtr; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - BoxRec AvailFBArea; - - AvailFBArea.x1 = 0; - AvailFBArea.y1 = 0; - AvailFBArea.x2 = pScrn->displayWidth; - AvailFBArea.y2 = (pTrident->FbMapSize - 4096) / (pScrn->displayWidth * - pScrn->bitsPerPixel / 8); - - if (AvailFBArea.y2 > 2047) AvailFBArea.y2 = 2047; - - xf86InitFBManager(pScreen, &AvailFBArea); if (pTrident->NoAccel) return FALSE; diff --git a/src/trident_bank.c b/src/trident_bank.c index 056d64a..2b1db07 100644 --- a/src/trident_bank.c +++ b/src/trident_bank.c @@ -1,5 +1,5 @@ /* - * Copyright 1992-2000 by Alan Hourihane, Wigan, England. + * Copyright 1992-2003 by Alan Hourihane, North Wales, UK. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -21,7 +21,7 @@ * * Author: Alan Hourihane, alanh@fairlite.demon.co.uk */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_bank.c,v 1.4 2000/12/07 16:48:04 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_bank.c,v 1.5 2003/09/05 22:07:28 alanh Exp $ */ /* All drivers should typically include these */ #include "xf86.h" diff --git a/src/trident_dac.c b/src/trident_dac.c index 311dd81..0df9f1b 100644 --- a/src/trident_dac.c +++ b/src/trident_dac.c @@ -1,5 +1,5 @@ /* - * Copyright 1992-2000 by Alan Hourihane, Wigan, England. + * Copyright 1992-2003 by Alan Hourihane, North Wales, UK. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -21,7 +21,7 @@ * * Author: Alan Hourihane, alanh@fairlite.demon.co.uk */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c,v 1.70 2003/01/05 18:09:00 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c,v 1.79 2003/11/03 05:11:42 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -237,7 +237,6 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) int clock = pTrident->currentClock; CARD8 protect = 0; Bool fullSize = FALSE; - Bool isShadow = FALSE; vgaHWPtr hwp = VGAHWPTR(pScrn); vgaRegPtr regp = &hwp->ModeReg; @@ -370,8 +369,8 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) pReg->tridentRegs3x4[CRTHiOrd] = LCD[i].shadow_HiOrd; } - fullSize = (pScrn->currentMode->HDisplay == LCD[i].display_x) - && (pScrn->currentMode->VDisplay == LCD[i].display_y); + fullSize = (mode->HDisplay == LCD[i].display_x) + && (mode->VDisplay == LCD[i].display_y); } /* copy over common bits from normal VGA */ @@ -405,7 +404,6 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) || (pReg->tridentRegs3CE[VertStretch] & 1)); pReg->tridentRegs3CE[CyberControl] |= 0x81; xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Shadow on\n"); - isShadow = TRUE; } else { pReg->tridentRegs3CE[CyberControl] &= 0x7E; xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Shadow off\n"); @@ -417,7 +415,6 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) if (pTrident->CyberShadow) { pReg->tridentRegs3CE[CyberControl] &= 0x7E; - isShadow = FALSE; xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Forcing Shadow off\n"); } @@ -457,7 +454,7 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) if (!mul) mul = 1; /* this is what my BIOS does */ - val = (pScrn->currentMode->HDisplay * mul / 8) + 16; + val = (mode->HDisplay * mul / 8) + 16; pReg->tridentRegs3x4[PreEndControl] = ((val >> 8) < 2 ? 2 :0) | ((val >> 8) & 0x01); @@ -472,15 +469,17 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) /* set mode */ if (pTrident->Chipset < BLADEXP) { pReg->tridentRegs3CE[BiosMode] = TridentFindMode( - pScrn->currentMode->HDisplay, - pScrn->currentMode->VDisplay, + mode->HDisplay, + mode->VDisplay, pScrn->depth); xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 1, - "Setting BIOS Mode: %x\n", - pReg->tridentRegs3CE[BiosMode]); + "Setting BIOS Mode: %x for: %ix%i\n", + pReg->tridentRegs3CE[BiosMode], + mode->HDisplay, + mode->VDisplay); } else { - TridentFindNewMode(pScrn->currentMode->HDisplay, - pScrn->currentMode->VDisplay, + TridentFindNewMode(mode->HDisplay, + mode->VDisplay, &pReg->tridentRegs3CE[BiosNewMode1], &pReg->tridentRegs3CE[BiosNewMode2]); xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 1, @@ -504,6 +503,7 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) /* Enable Chipset specific options */ switch (pTrident->Chipset) { + case CYBERBLADEXP4: case CYBERBLADEXPAI1: case BLADEXP: case CYBERBLADEI7: @@ -584,14 +584,16 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) offset = (pScrn->displayWidth * 3) >> 3; pReg->tridentRegs3x4[PixelBusReg] = 0x29; pReg->tridentRegsDAC[0x00] = 0xD0; - if (pTrident->Chipset == CYBERBLADEE4) { + if (pTrident->Chipset == CYBERBLADEXP4 || + pTrident->Chipset == CYBERBLADEE4) { OUTB(vgaIOBase+ 4, New32); pReg->tridentRegs3x4[New32] = INB(vgaIOBase + 5) & 0x7F; } break; case 32: pReg->tridentRegs3CE[MiscExtFunc] |= 0x02; - if (pTrident->Chipset != CYBERBLADEE4 + if (pTrident->Chipset != CYBERBLADEXP4 + && pTrident->Chipset != CYBERBLADEE4 && pTrident->Chipset != CYBERBLADEXPAI1) { /* Clock Division by 2*/ pReg->tridentRegs3CE[MiscExtFunc] |= 0x08; @@ -600,7 +602,8 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) offset = pScrn->displayWidth >> 1; pReg->tridentRegs3x4[PixelBusReg] = 0x09; pReg->tridentRegsDAC[0x00] = 0xD0; - if (pTrident->Chipset == CYBERBLADEE4 + if (pTrident->Chipset == CYBERBLADEXP4 + || pTrident->Chipset == CYBERBLADEE4 || pTrident->Chipset == CYBERBLADEXPAI1) { OUTB(vgaIOBase+ 4, New32); pReg->tridentRegs3x4[New32] = INB(vgaIOBase + 5) | 0x80; @@ -652,7 +655,8 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) pReg->tridentRegs3x4[Performance] |= 0x10; OUTB(vgaIOBase+ 4, DRAMControl); - pReg->tridentRegs3x4[DRAMControl] = INB(vgaIOBase + 5) | 0x10; + if (pTrident->Chipset >= CYBER9388) + pReg->tridentRegs3x4[DRAMControl] = INB(vgaIOBase + 5) | 0x10; if (pTrident->IsCyber && !pTrident->MMIOonly) pReg->tridentRegs3x4[DRAMControl] |= 0x20; @@ -727,6 +731,9 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) OUTB(0x3C4, Protection); OUTB(0x3C5, protect); } + + if (pTrident->Chipset == CYBERBLADEXP4) + pReg->tridentRegs3CE[DisplayEngCont] = 0x08; return(TRUE); } @@ -735,7 +742,6 @@ void TridentRestore(ScrnInfoPtr pScrn, TRIDENTRegPtr tridentReg) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - CARD8 temp; int vgaIOBase; vgaIOBase = VGAHWPTR(pScrn)->IOBase; @@ -750,18 +756,18 @@ TridentRestore(ScrnInfoPtr pScrn, TRIDENTRegPtr tridentReg) #endif /* Goto New Mode */ OUTB(0x3C4, 0x0B); - temp = INB(0x3C5); + (void) INB(0x3C5); /* Unprotect registers */ OUTW(0x3C4, ((0xC0 ^ 0x02) << 8) | NewMode1); - temp = INB(0x3C8); - temp = INB(0x3C6); - temp = INB(0x3C6); - temp = INB(0x3C6); - temp = INB(0x3C6); + (void) INB(0x3C8); + (void) INB(0x3C6); + (void) INB(0x3C6); + (void) INB(0x3C6); + (void) INB(0x3C6); OUTB(0x3C6, tridentReg->tridentRegsDAC[0x00]); - temp = INB(0x3C8); + (void) INB(0x3C8); OUTW_3x4(CRTCModuleTest); OUTW_3x4(LinearAddReg); @@ -800,7 +806,9 @@ TridentRestore(ScrnInfoPtr pScrn, TRIDENTRegPtr tridentReg) } if (pTrident->Chipset >= CYBER9385) OUTW_3x4(Enhancement0); if (pTrident->Chipset >= BLADE3D) OUTW_3x4(RAMDACTiming); - if (pTrident->Chipset == CYBERBLADEE4) OUTW_3x4(New32); + if (pTrident->Chipset == CYBERBLADEXP4 || + pTrident->Chipset == CYBERBLADEE4) OUTW_3x4(New32); + if (pTrident->Chipset == CYBERBLADEXP4) OUTW_3CE(DisplayEngCont); if (pTrident->IsCyber) { CARD8 tmp; @@ -881,13 +889,12 @@ void TridentSave(ScrnInfoPtr pScrn, TRIDENTRegPtr tridentReg) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - CARD8 temp; int vgaIOBase; vgaIOBase = VGAHWPTR(pScrn)->IOBase; /* Goto New Mode */ OUTB(0x3C4, 0x0B); - temp = INB(0x3C5); + (void) INB(0x3C5); INB_3C4(NewMode1); if (pTrident->Chipset > PROVIDIA9685) @@ -931,7 +938,9 @@ TridentSave(ScrnInfoPtr pScrn, TRIDENTRegPtr tridentReg) } if (pTrident->Chipset >= CYBER9385) INB_3x4(Enhancement0); if (pTrident->Chipset >= BLADE3D) INB_3x4(RAMDACTiming); - if (pTrident->Chipset == CYBERBLADEE4) INB_3x4(New32); + if (pTrident->Chipset == CYBERBLADEXP4 || + pTrident->Chipset == CYBERBLADEE4) INB_3x4(New32); + if (pTrident->Chipset == CYBERBLADEXP4) INB_3CE(DisplayEngCont); if (pTrident->IsCyber) { CARD8 tmp; INB_3CE(VertStretch); @@ -973,13 +982,13 @@ TridentSave(ScrnInfoPtr pScrn, TRIDENTRegPtr tridentReg) INB_3CE(MiscExtFunc); INB_3CE(MiscIntContReg); - temp = INB(0x3C8); - temp = INB(0x3C6); - temp = INB(0x3C6); - temp = INB(0x3C6); - temp = INB(0x3C6); + (void) INB(0x3C8); + (void) INB(0x3C6); + (void) INB(0x3C6); + (void) INB(0x3C6); + (void) INB(0x3C6); tridentReg->tridentRegsDAC[0x00] = INB(0x3C6); - temp = INB(0x3C8); + (void) INB(0x3C8); tridentReg->tridentRegsClock[0x00] = INB(0x3CC); if (Is3Dchip) { @@ -1077,14 +1086,15 @@ TridentLoadCursorImage( { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); int vgaIOBase; + int programmed_offset = pTrident->CursorOffset / 1024; vgaIOBase = VGAHWPTR(pScrn)->IOBase; - memcpy((CARD8 *)pTrident->FbBase + (pScrn->videoRam * 1024) - 4096, + memcpy((CARD8 *)pTrident->FbBase + pTrident->CursorOffset, src, pTrident->CursorInfoRec->MaxWidth * pTrident->CursorInfoRec->MaxHeight / 4); - OUTW(vgaIOBase + 4, (((pScrn->videoRam-4) & 0xFF) << 8) | 0x44); - OUTW(vgaIOBase + 4, ((pScrn->videoRam-4) & 0xFF00) | 0x45); + OUTW(vgaIOBase + 4, ((programmed_offset & 0xFF) << 8) | 0x44); + OUTW(vgaIOBase + 4, (programmed_offset & 0xFF00) | 0x45); } static Bool @@ -1100,15 +1110,60 @@ TridentUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) return TRUE; } +#define CURSOR_WIDTH 64 +#define CURSOR_HEIGHT 64 +#define CURSOR_ALIGN(x,bytes) (((x) + ((bytes) - 1)) & ~((bytes) - 1)) + Bool TridentHWCursorInit(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; TRIDENTPtr pTrident = TRIDENTPTR(pScrn); xf86CursorInfoPtr infoPtr; - int memory = pScrn->displayWidth * pScrn->virtualY * pScrn->bitsPerPixel/8; + FBAreaPtr fbarea; + int width; + int width_bytes; + int height; + int size_bytes; + + size_bytes = CURSOR_WIDTH * 4 * CURSOR_HEIGHT; + width = pScrn->displayWidth; + width_bytes = width * (pScrn->bitsPerPixel / 8); + height = (size_bytes + width_bytes - 1) / width_bytes; + fbarea = xf86AllocateOffscreenArea(pScreen, + width, + height, + 1024, + NULL, + NULL, + NULL); + + if (!fbarea) { + pTrident->CursorOffset = 0; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Hardware cursor disabled" + " due to insufficient offscreen memory\n"); + return FALSE; + } else { + pTrident->CursorOffset = CURSOR_ALIGN((fbarea->box.x1 + + fbarea->box.y1 * width) * + pScrn->bitsPerPixel / 8, + 1024); + } + + if ((pTrident->Chipset != CYBER9397DVD) && + (pTrident->Chipset < CYBERBLADEE4)) { + /* Can't deal with an offset more than 4MB - 4096 bytes */ + if (pTrident->CursorOffset >= ((4096*1024) - 4096)) { + pTrident->CursorOffset = 0; + xf86FreeOffscreenArea(fbarea); + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Hardware cursor disabled" + " due to cursor offset constraints.\n"); + return FALSE; + } + } - if (memory > (pScrn->videoRam * 1024 - 4096)) return FALSE; infoPtr = xf86CreateCursorInfoRec(); if(!infoPtr) return FALSE; @@ -1119,7 +1174,8 @@ TridentHWCursorInit(ScreenPtr pScreen) infoPtr->Flags = HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK | HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32 | - ((pTrident->Chipset == CYBERBLADEE4) ? + ((pTrident->Chipset == CYBERBLADEXP4 || + pTrident->Chipset == CYBERBLADEE4) ? HARDWARE_CURSOR_TRUECOLOR_AT_8BPP : 0); infoPtr->SetCursorColors = TridentSetCursorColors; infoPtr->SetCursorPosition = TridentSetCursorPosition; @@ -1197,4 +1253,3 @@ void TridentLoadPalette( DACDelay(hwp); } } - diff --git a/src/trident_dga.c b/src/trident_dga.c index 4045194..eed60f4 100644 --- a/src/trident_dga.c +++ b/src/trident_dga.c @@ -1,4 +1,27 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dga.c,v 1.4 2002/10/08 22:14:11 tsi Exp $ */ +/* + * Copyright 1997-2003 by Alan Hourihane, North Wales, UK. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Alan Hourihane not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Alan Hourihane makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dga.c,v 1.5 2003/09/05 22:07:28 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" diff --git a/src/trident_driver.c b/src/trident_driver.c index a75d4fe..6b23835 100644 --- a/src/trident_driver.c +++ b/src/trident_driver.c @@ -1,5 +1,5 @@ /* - * Copyright 1992-2000 by Alan Hourihane, Wigan, England. + * Copyright 1992-2003 by Alan Hourihane, North Wales, UK. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -28,7 +28,7 @@ * Massimiliano Ghilardi, max@Linuz.sns.it, some fixes to the * clockchip programming code. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c,v 1.176 2003/02/11 03:41:38 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c,v 1.189 2003/11/06 18:38:09 tsi Exp $ */ #include "xf1bpp.h" #include "xf4bpp.h" @@ -64,9 +64,7 @@ #define DPMS_SERVER #include "extensions/dpms.h" -#ifdef XvExtension #include "xf86xv.h" -#endif static const OptionInfoRec * TRIDENTAvailableOptions(int chipid, int busid); static void TRIDENTIdentify(int flags); @@ -81,8 +79,8 @@ static Bool TRIDENTSaveScreen(ScreenPtr pScreen, int mode); /* Optional functions */ static void TRIDENTFreeScreen(int scrnIndex, int flags); -static int TRIDENTValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, - int flags); +static ModeStatus TRIDENTValidMode(int scrnIndex, DisplayModePtr mode, + Bool verbose, int flags); /* Internally used functions */ static Bool TRIDENTMapMem(ScrnInfoPtr pScrn); @@ -168,6 +166,7 @@ static SymTabRec TRIDENTChipsets[] = { { CYBERBLADEAI1D, "cyberbladeAi1d" }, { BLADEXP, "bladeXP" }, { CYBERBLADEXPAI1, "cyberbladeXPAi1" }, + { CYBERBLADEXP4, "cyberbladeXP4" }, { -1, NULL } }; @@ -210,6 +209,7 @@ static PciChipsets TRIDENTPciChipsets[] = { { CYBERBLADEAI1D, PCI_CHIP_8620, RES_SHARED_VGA }, { BLADEXP, PCI_CHIP_9910, RES_SHARED_VGA }, { CYBERBLADEXPAI1, PCI_CHIP_8820, RES_SHARED_VGA }, + { CYBERBLADEXP4, PCI_CHIP_2100, RES_SHARED_VGA }, { -1, -1, RES_UNDEFINED } }; @@ -235,7 +235,9 @@ typedef enum { OPTION_FP_DELAY, OPTION_1400_DISPLAY, OPTION_DISPLAY, - OPTION_GB + OPTION_GB, + OPTION_TV_CHIPSET, + OPTION_TV_SIGNALMODE } TRIDENTOpts; static const OptionInfoRec TRIDENTOptions[] = { @@ -260,6 +262,8 @@ static const OptionInfoRec TRIDENTOptions[] = { { OPTION_1400_DISPLAY, "Display1400", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_DISPLAY, "Display", OPTV_ANYSTR, {0}, FALSE }, { OPTION_GB, "GammaBrightness", OPTV_ANYSTR, {0}, FALSE }, + { OPTION_TV_CHIPSET, "TVChipset", OPTV_ANYSTR, {0}, FALSE }, + { OPTION_TV_SIGNALMODE, "TVSignal", OPTV_INTEGER, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -458,7 +462,7 @@ tridentLCD LCD[] = { { 3,800,600,40000,0x7f,0x82,0x6b,0x1b,0x72,0xf8,0x58,0x8c,0x72,0x08}, { 2,1024,768,65000,0xa3,/*0x6*/0x98,0x8f,0xa0,0x24,0xf5,0x0f,0x24,0x0a,0x08}, { 0,1280,1024,108000,0xce,0x81,0xa6,0x9a,0x27,0x50,0x00,0x03,0x26,0xa8}, - { 0xff,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + { 0xff,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; #else tridentLCD LCD[] = { @@ -467,7 +471,7 @@ tridentLCD LCD[] = { { 2,1024,768,65000,0xa3,0x00,0x84,0x94,0x24,0xf5,0x03,0x09,0x24,0x08}, { 0,1280,1024,108000,0xce,0x91,0xa6,0x14,0x28,0x5a,0x01,0x04,0x28,0xa8}, { 4,1400,1050,122000,0xe6,0xcd,0xba,0x1d,0x38,0x00,0x1c,0x28,0x28,0xf8}, - { 0xff,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + { 0xff,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; #endif #endif @@ -476,10 +480,8 @@ static const char *xaaSymbols[] = { "XAACopyROP", "XAACreateInfoRec", "XAADestroyInfoRec", - "XAAFillSolidRects", "XAAInit", "XAAPatternROP", - "XAAScreenIndex", NULL }; @@ -501,11 +503,13 @@ static const char *vgahwSymbols[] = { NULL }; +#ifdef XFree86LOADER static const char *miscfbSymbols[] = { "xf1bppScreenInit", "xf4bppScreenInit", NULL }; +#endif static const char *fbSymbols[] = { "fbPictureInit", @@ -1109,10 +1113,9 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags) /* * The first thing we should figure out is the depth, bpp, etc. - * Our default depth is 8, so pass it to the helper function. * Our preference for depth 24 is 24bpp, so tell it that too. */ - if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support24bppFb | Support32bppFb | + if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support24bppFb | Support32bppFb | SupportConvert32to24 /*| PreferConvert32to24*/)) { return FALSE; } else { @@ -1446,12 +1449,31 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags) } else { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"%s\" is not a valid" "value for Option \"Rotate\"\n", s); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Valid options are \"CW\" or \"CCW\"\n"); } } } + pTrident->TVChipset = 0; + if ((s = xf86GetOptValString(pTrident->Options, OPTION_TV_CHIPSET))) { + if(!xf86NameCmp(s, "VT1621")) { + pTrident->TVChipset = 1; + xf86DrvMsg(pScrn->scrnIndex,X_CONFIG,"Using VIA VT1621 TV chip\n"); + } else if (!xf86NameCmp(s, "CH7005")) { + pTrident->TVChipset = 2; + xf86DrvMsg(pScrn->scrnIndex,X_CONFIG,"Using Chrontel CH7005 TV chip\n"); + } else + xf86DrvMsg(pScrn->scrnIndex,X_ERROR, + "%s is an unknown TV chipset option\n",s); + } + /* Default : NTSC */ + pTrident->TVSignalMode=0; + if (xf86GetOptValInteger(pTrident->Options, OPTION_TV_SIGNALMODE, + &pTrident->TVSignalMode)) { + ErrorF("TV SignalMode set to %d\n",pTrident->TVSignalMode); + } + /* FIXME ACCELERATION */ if (!UseMMIO) pTrident->NoAccel = TRUE; @@ -1491,7 +1513,7 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags) } xf86DrvMsg(pScrn->scrnIndex,X_PROBED,"IO registers at 0x%lX\n", - pTrident->IOAddress); + (unsigned long)pTrident->IOAddress); } /* Register the PCI-assigned resources. */ @@ -1994,6 +2016,18 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags) pTrident->NewClockCode = TRUE; pTrident->frequency = NTSC; break; + case CYBERBLADEXP4: + pTrident->ddc1Read = Tridentddc1Read; + ramtype = "SGRAM"; + pTrident->HasSGRAM = TRUE; + pTrident->IsCyber = TRUE; + pTrident->shadowNew = TRUE; + pTrident->NoAccel = TRUE; /* for now */ + Support24bpp = TRUE; + chipset = "CyberBladeXP4"; + pTrident->NewClockCode = TRUE; + pTrident->frequency = NTSC; + break; } if (!pScrn->progClock) { @@ -2038,12 +2072,6 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags) if (pTrident->pEnt->device->videoRam != 0) { pScrn->videoRam = pTrident->pEnt->device->videoRam; from = X_CONFIG; - - /* Due to only 12bits of cursor location, if user has overriden - * disable the cursor automatically */ - if (pTrident->Chipset >= CYBER9397 && pTrident->Chipset < CYBERBLADEE4) - if (pTrident->pEnt->device->videoRam > 4096) - pTrident->HWCursor = FALSE; } else { if (pTrident->Chipset == CYBER9525DVD) { pScrn->videoRam = 2560; @@ -2066,19 +2094,7 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags) pScrn->videoRam = 1024; break; case 0x04: - /* - * 8MB, but - hw cursor can't store above 4MB - * This only affects Image series chipsets, but for - * some reason, reports suggest that the 9397DVD isn't - * affected. XXX needs furthur investigation ! - */ - if (pTrident->HWCursor && (pTrident->Chipset != CYBER9397DVD) && - (pTrident->Chipset < CYBERBLADEE4)) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Found 8MB board, using 4MB\n"); - pScrn->videoRam = 4096; - } else - pScrn->videoRam = 8192; + pScrn->videoRam = 8192; break; case 0x06: /* XP */ pScrn->videoRam = 10240; @@ -2118,8 +2134,7 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags) default: pScrn->videoRam = 1024; xf86DrvMsg(pScrn->scrnIndex, from, - "Unable to determine VideoRam, defaulting to 1MB\n", - pScrn->videoRam); + "Unable to determine VideoRam, defaulting to 1MB\n"); break; } } @@ -2569,6 +2584,9 @@ TRIDENTSave(ScrnInfoPtr pScrn) TridentSave(pScrn, tridentReg); else TVGASave(pScrn, tridentReg); + + if (pTrident->TVChipset != 0) + VIA_SaveTVDepentVGAReg(pScrn); } @@ -2585,12 +2603,9 @@ TRIDENTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) vgaRegPtr vgaReg; TRIDENTPtr pTrident = TRIDENTPTR(pScrn); TRIDENTRegPtr tridentReg; - int clock; TridentFindClock(pScrn,mode->Clock); - clock = pTrident->currentClock; - switch (pTrident->Chipset) { case TGUI9660: case TGUI9680: @@ -2612,6 +2627,7 @@ TRIDENTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) case CYBER9397DVD: case BLADEXP: case CYBERBLADEXPAI1: + case CYBERBLADEXP4: /* Get ready for MUX mode */ if (pTrident->MUX && pScrn->bitsPerPixel == 8 && @@ -2678,6 +2694,9 @@ TRIDENTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) if (xf86IsPc98()) PC98TRIDENTEnable(pScrn); + if (pTrident->TVChipset != 0) + VIA_TVInit(pScrn); + return TRUE; } @@ -2707,6 +2726,9 @@ TRIDENTRestore(ScrnInfoPtr pScrn) vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE | VGA_SR_CMAP | (IsPrimaryCard ? VGA_SR_FONTS : 0)); + if (pTrident->TVChipset != 0) + VIA_RestoreTVDependVGAReg(pScrn); + vgaHWProtect(pScrn, FALSE); } @@ -2721,7 +2743,6 @@ TRIDENTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* The vgaHW references will disappear one day */ ScrnInfoPtr pScrn; vgaHWPtr hwp; - int vgaIOBase; TRIDENTPtr pTrident; int ret; VisualPtr visual; @@ -2768,8 +2789,6 @@ TRIDENTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) vgaHWSetMmioFuncs(hwp, pTrident->IOBase, 0); } - vgaIOBase = VGAHWPTR(pScrn)->IOBase; - /* Save the current state */ TRIDENTSave(pScrn); @@ -2946,6 +2965,33 @@ TRIDENTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } } + { + BoxRec AvailFBArea; + + AvailFBArea.x1 = 0; + AvailFBArea.y1 = 0; + AvailFBArea.x2 = pScrn->displayWidth; + AvailFBArea.y2 = pTrident->FbMapSize / (pScrn->displayWidth * + pScrn->bitsPerPixel / 8); + + if (AvailFBArea.y2 > 2047) AvailFBArea.y2 = 2047; + + if (xf86InitFBManager(pScreen, &AvailFBArea)) { + int cpp = pScrn->bitsPerPixel / 8; + int area = AvailFBArea.y2 * pScrn->displayWidth; + int areaoffset = area * cpp; + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Using %i scanlines of offscreen memory for area's \n", + AvailFBArea.y2 - pScrn->virtualY); + + if (xf86InitFBManagerLinear(pScreen, area, ((pTrident->FbMapSize/cpp) - area))) { + xf86DrvMsg(scrnIndex, X_INFO, + "Using %ld bytes of offscreen memory for linear (offset=0x%x)\n", (pTrident->FbMapSize - areaoffset), areaoffset); + } + } + } + if (Is3Dchip) { if ((pTrident->Chipset == CYBERBLADEI7) || (pTrident->Chipset == CYBERBLADEI7D) || @@ -3018,10 +3064,8 @@ TRIDENTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pScrn->memPhysBase = pTrident->FbAddress; pScrn->fbOffset = 0; -#ifdef XvExtension if (pTrident->Chipset >= TGUI9660) TRIDENTInitVideo(pScreen); -#endif pTrident->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = TRIDENTCloseScreen; @@ -3059,12 +3103,10 @@ TRIDENTAdjustFrame(int scrnIndex, int x, int y, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; TRIDENTPtr pTrident; - vgaHWPtr hwp; int base = y * pScrn->displayWidth + x; int vgaIOBase; CARD8 temp; - hwp = VGAHWPTR(pScrn); pTrident = TRIDENTPTR(pScrn); vgaIOBase = VGAHWPTR(pScrn)->IOBase; @@ -3209,7 +3251,7 @@ TRIDENTFreeScreen(int scrnIndex, int flags) /* Checks if a mode is suitable for the selected chipset. */ /* Optional */ -static int +static ModeStatus TRIDENTValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; diff --git a/src/trident_regs.h b/src/trident_regs.h index 3cce902..0ad747a 100644 --- a/src/trident_regs.h +++ b/src/trident_regs.h @@ -1,5 +1,5 @@ /* - * Copyright 1992-2000 by Alan Hourihane, Wigan, England. + * Copyright 1992-2003 by Alan Hourihane, North Wales, UK. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -21,7 +21,7 @@ * * Author: Alan Hourihane, alanh@fairlite.demon.co.uk */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h,v 1.26 2002/09/16 18:06:03 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h,v 1.27 2003/09/05 22:07:29 alanh Exp $ */ #define DEBUG 1 @@ -119,6 +119,7 @@ #define BiosNewMode1 0x5a #define BiosNewMode2 0x5c #define BiosReg 0x5d +#define DisplayEngCont 0xD1 /* Graphics Engine for 9420/9430 */ diff --git a/src/trident_video.c b/src/trident_video.c index 9c29629..5c426d6 100644 --- a/src/trident_video.c +++ b/src/trident_video.c @@ -1,5 +1,5 @@ /* - * Copyright 1992-2000 by Alan Hourihane, Wigan, England. + * Copyright 1992-2003 by Alan Hourihane, North Wales, UK. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -21,7 +21,7 @@ * * Author: Alan Hourihane, alanh@fairlite.demon.co.uk */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_video.c,v 1.31 2002/12/22 18:54:43 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_video.c,v 1.45 2003/11/10 18:22:34 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -67,7 +67,7 @@ static void tridentSetVideoContrast(TRIDENTPtr pTrident,int value); static void tridentSetVideoParameters(TRIDENTPtr pTrident, int brightness, int saturation, int hue); void tridentFixFrame(ScrnInfoPtr pScrn, int *fixFrame); -static void WaitForSync(ScrnInfoPtr pScrn); +static void WaitForVBlank(ScrnInfoPtr pScrn); #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) @@ -85,6 +85,7 @@ void TRIDENTInitVideo(ScreenPtr pScreen) * The following has been tested on: * * 9525 : flags: None + * Image985 : flags: None * Cyber9397(DVD) : flags: VID_ZOOM_NOMINI * CyberBlade/i7: flags: VID_ZOOM_INV | VID_ZOOM_MINI * CyberBlade/i1: flags: VID_ZOOM_INV | VID_ZOOM_MINI @@ -106,8 +107,10 @@ void TRIDENTInitVideo(ScreenPtr pScreen) if (pTrident->Chipset == CYBER9397 || pTrident->Chipset == CYBER9397DVD) pTrident->videoFlags = VID_ZOOM_NOMINI; - if (pTrident->Chipset == CYBER9397DVD || pTrident->Chipset >= CYBER9525DVD) - pTrident->videoFlags |= VID_DOUBLE_LINEBUFFER_FOR_WIDE_SRC; + if (pTrident->Chipset == CYBER9397DVD || + pTrident->Chipset == CYBER9525DVD || + pTrident->Chipset >= BLADE3D) + pTrident->videoFlags |= VID_DOUBLE_LINEBUFFER_FOR_WIDE_SRC; newAdaptor = TRIDENTSetupImageVideo(pScreen); TRIDENTInitOffscreenImages(pScreen); @@ -139,7 +142,7 @@ void TRIDENTInitVideo(ScreenPtr pScreen) if (pTrident->videoFlags) xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,3, - "Trident Video Flags: %s %s %s\n", + "Trident Video Flags: %s %s %s %s\n", pTrident->videoFlags & VID_ZOOM_INV ? "VID_ZOOM_INV" : "", pTrident->videoFlags & VID_ZOOM_MINI ? "VID_ZOOM_MINI" : "", pTrident->videoFlags & VID_OFF_SHIFT_4 ? "VID_OFF_SHIFT_4" : "", @@ -166,11 +169,7 @@ static XF86VideoFormatRec Formats[NUM_FORMATS] = {8, PseudoColor}, {15, TrueColor}, {16, TrueColor}, {24, TrueColor} }; -#ifdef TRIDENT_XV_GAMMA -#define NUM_ATTRIBUTES 6 -#else #define NUM_ATTRIBUTES 5 -#endif static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = { @@ -181,33 +180,10 @@ static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = {XvSettable | XvGettable, 0, 7, "XV_CONTRAST"} }; -#if 0 -# define NUM_IMAGES 4 -#else -# define NUM_IMAGES 4 -#endif +#define NUM_IMAGES 3 static XF86ImageRec Images[NUM_IMAGES] = { -#if 0 - { - 0x35315652, - XvRGB, - LSBFirst, - {'R','V','1','5', - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, - 16, - XvPacked, - 1, - 15, 0x001F, 0x03E0, 0x7C00, - 0, 0, 0, - 0, 0, 0, - 0, 0, 0, - {'R','V','B',0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - XvTopToBottom - }, -#endif { 0x36315652, XvRGB, @@ -255,6 +231,9 @@ void TRIDENTResetVideo(ScrnInfoPtr pScrn) int red, green, blue; int tmp; + WaitForVBlank(pScrn); + OUTW(vgaIOBase + 4, 0x848E); + if (pTrident->Chipset >= CYBER9388) { OUTW(vgaIOBase + 4, 0x80B9); OUTW(vgaIOBase + 4, 0x00BE); @@ -326,8 +305,6 @@ void TRIDENTResetVideo(ScrnInfoPtr pScrn) tridentSetVideoParameters(pTrident,pPriv->Brightness,pPriv->Saturation, pPriv->HUE); } - - OUTW(vgaIOBase + 4, 0x848E); } @@ -383,7 +360,7 @@ TRIDENTSetupImageVideo(ScreenPtr pScreen) pPriv->fixFrame = 100; /* gotta uninit this someplace */ - REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); + REGION_NULL(pScreen, &pPriv->clip); pTrident->adaptor = adapt; @@ -407,37 +384,6 @@ TRIDENTSetupImageVideo(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; -} - -#define DummyScreen screenInfo.screens[0] - static void TRIDENTStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) { @@ -449,9 +395,9 @@ TRIDENTStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) if(shutdown) { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { - OUTW(vgaIOBase + 4, 0x0091); - WaitForSync(pScrn); - OUTW(vgaIOBase + 4, 0x848E); + WaitForVBlank(pScrn); + OUTW(vgaIOBase + 4, 0x848E); + OUTW(vgaIOBase + 4, 0x0091); } if(pPriv->linear) { xf86FreeOffscreenLinear(pPriv->linear); @@ -616,55 +562,6 @@ TRIDENTQueryBestSize( } -static void -TRIDENTCopyData( - unsigned char *src, - unsigned char *dst, - int srcPitch, - int dstPitch, - int h, - int w -){ - w <<= 1; - while(h--) { - memcpy(dst, src, w); - src += srcPitch; - dst += dstPitch; - } -} - -static void -TRIDENTCopyMungedData( - unsigned char *src1, - unsigned char *src2, - unsigned char *src3, - unsigned char *dst1, - int srcPitch, - int srcPitch2, - int dstPitch, - int h, - int w -){ - CARD32 *dst = (CARD32*)dst1; - int i, j; - - dstPitch >>= 2; - w >>= 1; - - for(j = 0; j < h; j++) { - for(i = 0; i < w; i++) { - dst[i] = src1[i << 1] | (src1[(i << 1) + 1] << 16) | - (src3[i] << 8) | (src2[i] << 24); - } - dst += dstPitch; - src1 += srcPitch; - if(j & 1) { - src2 += srcPitch2; - src3 += srcPitch2; - } - } -} - static FBLinearPtr TRIDENTAllocateMemory( ScrnInfoPtr pScrn, @@ -852,7 +749,7 @@ TRIDENTDisplayVideo( } else { OUTW(0x3C4, 0x0097); /* 1x line buffers */ } - OUTW(vgaIOBase + 4, 0x8097); + OUTW(vgaIOBase + 4, 0x0097); OUTW(vgaIOBase + 4, 0x00BA); OUTW(vgaIOBase + 4, 0x00BB); OUTW(vgaIOBase + 4, 0xFFBC); @@ -888,7 +785,7 @@ TRIDENTPutImage( TRIDENTPtr pTrident = TRIDENTPTR(pScrn); INT32 x1, x2, y1, y2; unsigned char *dst_start; - int pitch, new_size, offset, offset2 = 0, offset3 = 0; + int new_size, offset, offset2 = 0, offset3 = 0; int srcPitch, srcPitch2 = 0, dstPitch; int top, left, npixels, nlines, bpp; BoxRec dstBox; @@ -915,7 +812,6 @@ TRIDENTPutImage( dstBox.y2 -= pScrn->frameY0; bpp = pScrn->bitsPerPixel >> 3; - pitch = bpp * pScrn->displayWidth; dstPitch = ((width << 1) + 15) & ~15; new_size = ((dstPitch * height) + bpp - 1) / bpp; @@ -960,23 +856,23 @@ TRIDENTPutImage( offset3 = tmp; } nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top; - TRIDENTCopyMungedData(buf + (top * srcPitch) + (left >> 1), - buf + offset2, buf + offset3, dst_start, - srcPitch, srcPitch2, dstPitch, nlines, npixels); + xf86XVCopyYUV12ToPacked(buf + (top * srcPitch) + (left >> 1), + buf + offset2, buf + offset3, dst_start, + srcPitch, srcPitch2, dstPitch, nlines, npixels); break; case FOURCC_UYVY: case FOURCC_YUY2: default: buf += (top * srcPitch) + left; nlines = ((y2 + 0xffff) >> 16) - top; - TRIDENTCopyData(buf, dst_start, srcPitch, dstPitch, nlines, npixels); + xf86XVCopyPacked(buf, dst_start, srcPitch, dstPitch, nlines, npixels); break; } /* update cliplist */ - if(!RegionsEqual(&pPriv->clip, clipBoxes)) { + if(!REGION_EQUAL(pScrn->pScreen, &pPriv->clip, clipBoxes)) { /* update cliplist */ - REGION_COPY(pScreen, &pPriv->clip, clipBoxes); + REGION_COPY(pScrn->pScreen, &pPriv->clip, clipBoxes); xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes); } @@ -1046,7 +942,7 @@ TRIDENTAllocateSurface( XF86SurfacePtr surface ){ FBLinearPtr linear; - int pitch, fbpitch, size, bpp; + int pitch, size, bpp; OffscreenPrivPtr pPriv; if((w > 1024) || (h > 1024)) @@ -1055,7 +951,6 @@ TRIDENTAllocateSurface( w = (w + 1) & ~1; pitch = ((w << 1) + 15) & ~15; bpp = pScrn->bitsPerPixel >> 3; - fbpitch = bpp * pScrn->displayWidth; size = ((pitch * h) + bpp - 1) / bpp; if(!(linear = TRIDENTAllocateMemory(pScrn, NULL, size))) @@ -1101,10 +996,9 @@ TRIDENTStopSurface( if(pPriv->isOn) { TRIDENTPtr pTrident = TRIDENTPTR(surface->pScrn); int vgaIOBase = VGAHWPTR(surface->pScrn)->IOBase; - - OUTW(vgaIOBase + 4, 0x0091); - WaitForSync(surface->pScrn); + WaitForVBlank(surface->pScrn); OUTW(vgaIOBase + 4, 0x848E); + OUTW(vgaIOBase + 4, 0x0091); pPriv->isOn = FALSE; } @@ -1249,9 +1143,9 @@ TRIDENTVideoTimerCallback(ScrnInfoPtr pScrn, Time time) if(pPriv->videoStatus & TIMER_MASK) { if(pPriv->videoStatus & OFF_TIMER) { if(pPriv->offTime < time) { - OUTW(vgaIOBase + 4, 0x0091); - WaitForSync(pScrn); + WaitForVBlank(pScrn); OUTW(vgaIOBase + 4, 0x848E); + OUTW(vgaIOBase + 4, 0x0091); pPriv->videoStatus = FREE_TIMER; pPriv->freeTime = time + FREE_DELAY; } @@ -1369,7 +1263,10 @@ tridentFixFrame(ScrnInfoPtr pScrn, int *fixFrame) case CYBERBLADEI7D: case CYBERBLADEI1: case CYBERBLADEI1D: - pTrident->hsync -= 8; + if (pScrn->depth == 24) + pTrident->hsync -= 7; + else + pTrident->hsync -= 6; break; case CYBERBLADEAI1: pTrident->hsync -= 7; @@ -1399,10 +1296,18 @@ tridentFixFrame(ScrnInfoPtr pScrn, int *fixFrame) } static void -WaitForSync(ScrnInfoPtr pScrn) +WaitForVBlank(ScrnInfoPtr pScrn) { register vgaHWPtr hwp = VGAHWPTR(pScrn); + /* We have to wait for one full VBlank to let the video engine start/stop. + * So the first may be waiting for too short a period as it may already + * be part way through the video frame. So we wait a second time to ensure + * full vblank has passed. + * - Alan. + */ + while (!(hwp->readST01(hwp)&0x8)) {}; + while (hwp->readST01(hwp)&0x8) {}; while (!(hwp->readST01(hwp)&0x8)) {}; while (hwp->readST01(hwp)&0x8) {}; } diff --git a/src/tridenthelper.c b/src/tridenthelper.c index f8e5905..6398858 100644 --- a/src/tridenthelper.c +++ b/src/tridenthelper.c @@ -1,5 +1,5 @@ /* - * Copyright 1992-2000 by Alan Hourihane, Wigan, England. + * Copyright 1992-2003 by Alan Hourihane, North Wales, UK. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -21,7 +21,7 @@ * * Author: Alan Hourihane, alanh@fairlite.demon.co.uk */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c,v 1.20 2001/10/28 03:33:52 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c,v 1.21 2003/09/05 22:07:29 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" diff --git a/src/tridentramdac.c b/src/tridentramdac.c index f4117b9..80b658b 100644 --- a/src/tridentramdac.c +++ b/src/tridentramdac.c @@ -1,5 +1,5 @@ /* - * Copyright 1992-2000 by Alan Hourihane, Wigan, England. + * Copyright 1992-2003 by Alan Hourihane, North Wales, UK. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -24,7 +24,7 @@ * TridentOutIndReg() and TridentInIndReg() are used to access * the indirect Trident RAMDAC registers only. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/tridentramdac.c,v 1.4 2000/12/07 16:48:06 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/tridentramdac.c,v 1.5 2003/09/05 22:07:29 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" diff --git a/src/tvga_dac.c b/src/tvga_dac.c index 2d5a7ec..43a84f9 100644 --- a/src/tvga_dac.c +++ b/src/tvga_dac.c @@ -1,5 +1,5 @@ /* - * Copyright 1992-1999 by Alan Hourihane, Wigan, England. + * Copyright 1992-2003 by Alan Hourihane, North Wales, UK. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -21,7 +21,7 @@ * * Author: Alan Hourihane, alanh@fairlite.demon.co.uk */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/tvga_dac.c,v 1.6 2002/03/29 18:33:29 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/tvga_dac.c,v 1.8 2003/11/03 05:11:43 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -137,7 +137,6 @@ void TVGARestore(ScrnInfoPtr pScrn, TRIDENTRegPtr tridentReg) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - CARD8 temp; int vgaIOBase; vgaIOBase = VGAHWPTR(pScrn)->IOBase; @@ -149,18 +148,18 @@ TVGARestore(ScrnInfoPtr pScrn, TRIDENTRegPtr tridentReg) /* Goto New Mode */ OUTB(0x3C4, 0x0B); - temp = INB(0x3C5); + (void) INB(0x3C5); /* Unprotect registers */ OUTW(0x3C4, (0x80 << 8) | NewMode1); - temp = INB(0x3C8); - temp = INB(0x3C6); - temp = INB(0x3C6); - temp = INB(0x3C6); - temp = INB(0x3C6); + (void) INB(0x3C8); + (void) INB(0x3C6); + (void) INB(0x3C6); + (void) INB(0x3C6); + (void) INB(0x3C6); OUTB(0x3C6, tridentReg->tridentRegsDAC[0x00]); - temp = INB(0x3C8); + (void) INB(0x3C8); OUTW_3x4(CRTCModuleTest); OUTW_3x4(LinearAddReg); @@ -184,17 +183,16 @@ void TVGASave(ScrnInfoPtr pScrn, TRIDENTRegPtr tridentReg) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - CARD8 temp; int vgaIOBase; vgaIOBase = VGAHWPTR(pScrn)->IOBase; - temp = INB(0x3C8); - temp = INB(0x3C6); - temp = INB(0x3C6); - temp = INB(0x3C6); - temp = INB(0x3C6); + (void) INB(0x3C8); + (void) INB(0x3C6); + (void) INB(0x3C6); + (void) INB(0x3C6); + (void) INB(0x3C6); tridentReg->tridentRegsDAC[0x00] = INB(0x3C6); - temp = INB(0x3C8); + (void) INB(0x3C8); /* Goto Old Mode */ OUTB(0x3C4, 0x0B); @@ -204,7 +202,7 @@ TVGASave(ScrnInfoPtr pScrn, TRIDENTRegPtr tridentReg) /* Goto New Mode */ OUTB(0x3C4, 0x0B); - temp = INB(0x3C5); + (void) INB(0x3C5); INB_3C4(NewMode1); diff --git a/src/xp_accel.c b/src/xp_accel.c index f6f0b63..f543d87 100644 --- a/src/xp_accel.c +++ b/src/xp_accel.c @@ -1,5 +1,5 @@ /* - * Copyright 1992-2002 by Alan Hourihane, Sychdyn, North Wales, UK. + * Copyright 1992-2003 by Alan Hourihane, North Wales, UK. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -23,7 +23,7 @@ * * BladeXP accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/xp_accel.c,v 1.4 2002/10/09 16:38:20 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/xp_accel.c,v 1.6 2003/10/30 13:38:02 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -120,17 +120,6 @@ XPAccelInit(ScreenPtr pScreen) XAAInfoRecPtr infoPtr; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - BoxRec AvailFBArea; - - AvailFBArea.x1 = 0; - AvailFBArea.y1 = 0; - AvailFBArea.x2 = pScrn->displayWidth; - AvailFBArea.y2 = (pTrident->FbMapSize - 4096) / (pScrn->displayWidth * - pScrn->bitsPerPixel / 8); - - if (AvailFBArea.y2 > 2047) AvailFBArea.y2 = 2047; - - xf86InitFBManager(pScreen, &AvailFBArea); if (pTrident->NoAccel) return FALSE; |