diff options
author | Luc Verhaegen <libv@skynet.be> | 2005-02-06 07:12:43 +0000 |
---|---|---|
committer | Luc Verhaegen <libv@skynet.be> | 2005-02-06 07:12:43 +0000 |
commit | 210c5926ae1843a8a1f30fabc961149e7893814b (patch) | |
tree | 837ce06165a5a53663f2f3b8cccb01407cc728bd | |
parent | 29fe4ed58be5b1dd9fa9995d4b795c7c9a798e3c (diff) |
Sync with latest unichrome releases: Release 30: Fixes YUV2 alloc/freeXORG-6_8_99_3XORG-6_8_99_2XORG-6_8_99_1
issues, increased overlay height to
1200, disable ScreenToScreenColorExpand Acceleration, abstract vt162x and
clean up standard modetable. Release 29: Further cleanups to Xv, move
gpioi2c into xf86I2C, sanely handle output activation (primary only).
Fixes many Xv and accel bugs, stops VT switching hardlock with certain
dotclocks. Release 28: Major Xv cleanup. Add Xv cropping. Add support
for new XvMC info infrastructure. Tuner dropped. AGP ring-buffer
support is now an option. Virtual range extended. (Kenneth Aafløy,
Thomas Hellström, Felipe Rodriguez, Terry Lewis, Andreas Robinson, Luc
Verhaegen)
-rw-r--r-- | man/via.man | 32 | ||||
-rw-r--r-- | src/via.h | 1 | ||||
-rw-r--r-- | src/via_accel.c | 14 | ||||
-rw-r--r-- | src/via_bandwidth.c | 17 | ||||
-rw-r--r-- | src/via_bios.h | 141 | ||||
-rw-r--r-- | src/via_cursor.c | 1 | ||||
-rw-r--r-- | src/via_dga.c | 1 | ||||
-rw-r--r-- | src/via_dri.c | 1 | ||||
-rw-r--r-- | src/via_dri.h | 1 | ||||
-rw-r--r-- | src/via_driver.c | 625 | ||||
-rw-r--r-- | src/via_driver.h | 167 | ||||
-rw-r--r-- | src/via_i2c.c | 643 | ||||
-rw-r--r-- | src/via_id.c | 114 | ||||
-rw-r--r-- | src/via_id.h | 11 | ||||
-rw-r--r-- | src/via_memory.c | 3 | ||||
-rw-r--r-- | src/via_mode.c | 2423 | ||||
-rw-r--r-- | src/via_mode.h | 635 | ||||
-rw-r--r-- | src/via_priv.h | 16 | ||||
-rw-r--r-- | src/via_regs.h | 1 | ||||
-rw-r--r-- | src/via_shadow.c | 19 | ||||
-rw-r--r-- | src/via_swov.c | 2440 | ||||
-rw-r--r-- | src/via_swov.h | 5 | ||||
-rw-r--r-- | src/via_vgahw.c | 17 | ||||
-rw-r--r-- | src/via_vgahw.h | 3 | ||||
-rw-r--r-- | src/via_video.c | 388 | ||||
-rw-r--r-- | src/via_video.h | 24 | ||||
-rw-r--r-- | src/via_vt162x.c | 795 | ||||
-rw-r--r-- | src/via_vt162x.h | 884 | ||||
-rw-r--r-- | src/via_xvmc.c | 105 | ||||
-rw-r--r-- | src/via_xvmc.h | 4 | ||||
-rw-r--r-- | src/via_xvpriv.h | 52 |
31 files changed, 4524 insertions, 5059 deletions
diff --git a/man/via.man b/man/via.man index 352543b..d1cadba 100644 --- a/man/via.man +++ b/man/via.man @@ -1,4 +1,3 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via.man,v 1.4 2003/12/19 22:00:46 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH VIA __drivermansuffix__ __vendorversion__ @@ -69,10 +68,9 @@ Rotate the display either clockwise ("CW") or counter clockwise ("CCW"). Rotation is only supported unaccelerated. .TP .BI "Option \*qActiveDevice\*q \*q" string \*q -Specify the active device combination. The choices are "CRT,TV", -"CRT,LCD", "CRT,DFP", "TV,DFP", "CRT", "LCD", or "DFP", for the various -supported combinations of VGA CRT output, LCD panel output, DFP output and -TV output. +Specify the active device combination. Any string containing "CRT", "LCD", "TV" +should be possible. The default is to use what is detected. The driver is +currently unable to use LCD and TV simultaneously, and will favour the LCD. .TP .BI "Option \*qLCDDualEdge\*q \*q" boolean \*q Use dual edge mode to set the LCD. @@ -106,23 +104,23 @@ Specify whether to underscan the TV image (bordering it with black), or overscan it (losing the edges of the picture). Possible values are "under" (not currently functional) and "over". .TP -.BI "Option \*qTVHScale\*q \*q" string \*q -Not yet implemented. -.TP .BI "Option \*qDisableVQ\*q \*q" boolean \*q Disable or enable the use of VQ. VQ is enabled by default. .TP -.BI "Option \*qCap0Deinterlace\*q \*q" string \*q -Set the capture 0 port interlace mode to either "Bob" or "Weave". -.TP -.BI "Option \*qCap1Deinterlace\*q \*q" string \*q -Set the capture 1 port interlace mode to either "Bob" or "Weave". -.TP -.BI "Option \*qCap0FieldSwap\*q \*q" string \*q -Perform field swapping on capture port 0. -.TP .BI "Option \*qDRIXINERAMA\*q \*q" boolean \*q Set DRI Xinerama mode. Currently unsupported. +.TP +.BI "Option \*qEnableAGPDMA\*q \*q" boolean \*q +Enable the AGP DMA functionality in DRM. This requires that DRI is enabled +and will force 2D acceleration to use AGP DMA. The XvMC DRI client will also +make use of this to consume much less CPU. This does not work with the current +3D driver, though. Therefore it is off by default. It is also mutually exclusive +with option \*qAllowInsecureDRI\*q, so if that option is enabled, AGP DMA +will be turned off. +.TP +.BI "Option \*qNoAGPFor2D\*q \*q" boolean \*q +With this option on, 2D acceleration will not use AGP DMA even if it is enabled. + .SH "BUGS" Switching virtual terminals when an OpenGL DRI client is running may cause subsequent rendering errors or server crash. XvMC DRI does not suffer from this. @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via.h,v 1.5 2004/01/05 00:34:17 dawes Exp $ */ /* * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. diff --git a/src/via_accel.c b/src/via_accel.c index 6125335..03d55ff 100644 --- a/src/via_accel.c +++ b/src/via_accel.c @@ -21,12 +21,11 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_accel.c,v 1.11 2004/01/29 03:13:24 dawes Exp $ */ /************************************************************************* * * File: via_accel.c - * Content: 2D acceleration function for VIA/S3G UniChrom + * Content: 2D acceleration function for VIA/S3G UniChrome * ************************************************************************/ @@ -121,6 +120,7 @@ static void VIASubsequentScanlineCPUToScreenColorExpandFill( int h, int skipleft); +#if 0 /* Buggy. Temporarily disabled 2005-01-23 */ static void VIASetupForScreenToScreenColorExpand( ScrnInfoPtr pScrn, int bg, @@ -137,6 +137,8 @@ static void VIASubsequentScreenToScreenColorExpand( int srcx, int srcy, int offset); +#endif + static void VIASetupForImageWrite( ScrnInfoPtr pScrn, @@ -484,9 +486,8 @@ VIAInitAccel(ScreenPtr pScreen) HARDWARE_PATTERN_PROGRAMMED_ORIGIN | 0; - /*=* This function is only used in drawing check box when use RedHat 7.2 - * Raleigh Theme. The behavior is a little strange, so we temporarily - * disable this function. *=*/ +#if 0 /* Buggy. Temporarily disabled 2005-01-23 */ + /* Screen to Screen color expansion. */ xaaptr->SetupForScreenToScreenColorExpandFill = VIASetupForScreenToScreenColorExpand; @@ -496,6 +497,7 @@ VIAInitAccel(ScreenPtr pScreen) BIT_ORDER_IN_BYTE_MSBFIRST | ROP_NEEDS_SOURCE | 0; +#endif /* Solid lines */ xaaptr->SetupForSolidLine = VIASetupForSolidLine; @@ -985,6 +987,7 @@ VIASubsequentScanlineCPUToScreenColorExpandFill( } +#if 0 /* Buggy. Temporarily disabled 2005-01-23 */ static void VIASetupForScreenToScreenColorExpand( ScrnInfoPtr pScrn, @@ -1068,6 +1071,7 @@ VIASubsequentScreenToScreenColorExpand( dispatchCBufferAGP(pVia, buf); } +#endif static void VIASetupForImageWrite( diff --git a/src/via_bandwidth.c b/src/via_bandwidth.c index dcc9cfb..c3b4484 100644 --- a/src/via_bandwidth.c +++ b/src/via_bandwidth.c @@ -1,6 +1,5 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_bandwidth.c,v 1.3 2004/01/05 00:34:17 dawes Exp $ */ /* - * Copyright 2004 The Unichrome Project [unichrome.sf.net] + * Copyright 2004-2005 The Unichrome Project [unichrome.sf.net] * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. * @@ -145,6 +144,20 @@ ViaSetPrimaryFIFO(ScrnInfoPtr pScrn, DisplayModePtr mode) DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaSetPrimaryFIFO\n")); + /* standard values */ + ViaSeqMask(hwp, 0x17, 0x1F, 0xFF); + + if (mode->CrtcHDisplay >= 1600) { + ViaSeqMask(hwp, 0x16, 0x0F, 0xBF); + ViaSeqMask(hwp, 0x18, 0x4F, 0xFF); + } else if (mode->CrtcHDisplay >= 1024) { + ViaSeqMask(hwp, 0x16, 0x0C, 0xBF); + ViaSeqMask(hwp, 0x18, 0x4C, 0xFF); + } else { + ViaSeqMask(hwp, 0x16, 0x08, 0xBF); + ViaSeqMask(hwp, 0x18, 0x4E, 0xFF); + } + switch(pVia->Chipset) { case VIA_CLE266: if (CLE266_REV_IS_CX(pVia->ChipRev)) { diff --git a/src/via_bios.h b/src/via_bios.h index c9b3f72..f4f060f 100644 --- a/src/via_bios.h +++ b/src/via_bios.h @@ -1,5 +1,5 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_bios.h,v 1.4 2003/12/31 05:42:04 dawes Exp $ */ /* + * Copyright 2004-2005 The Unichrome Project [unichrome.sf.net] * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. * @@ -26,34 +26,6 @@ #ifndef _VIA_BIOS_H_ #define _VIA_BIOS_H_ 1 -#define VIA_RES_640X480 0 -#define VIA_RES_800X600 1 -#define VIA_RES_1024X768 2 -#define VIA_RES_1152X864 3 -#define VIA_RES_1280X1024 4 -#define VIA_RES_1600X1200 5 -#define VIA_RES_1440X1050 6 -#define VIA_RES_1280X768 7 -#define VIA_RES_1280X960 8 -#define VIA_RES_1920X1440 9 -#define VIA_RES_848X480 10 -#define VIA_RES_1400X1050 11 -#define VIA_RES_720X480 12 -#define VIA_RES_720X576 13 -#define VIA_RES_1024X512 14 -#define VIA_RES_856X480 15 -#define VIA_RES_1024X576 16 -#define VIA_RES_INVALID 255 - -#define VIA_TVRES_640X480 0 -#define VIA_TVRES_800X600 1 -#define VIA_TVRES_1024X768 2 -#define VIA_TVRES_848X480 3 -#define VIA_TVRES_720X480 4 -#define VIA_TVRES_720X576 5 -#define VIA_TVRES_INVALID 255 - -#define VIA_NUM_REFRESH_RATE 5 #define VIA_PANEL6X4 0 #define VIA_PANEL8X6 1 #define VIA_PANEL10X7 2 @@ -63,15 +35,6 @@ #define VIA_PANEL16X12 6 #define VIA_PANEL_INVALID 255 -#define VIA_NONEDVI 0x00 -#define VIA_VT3191 0x01 -#define VIA_TTLTYPE 0x07 -#define VIA_VT3192 0x09 -#define VIA_VT3193 0x0A -#define VIA_SIL164 0x0B -#define VIA_SIL168 0x0C -#define VIA_Hardwired 0x0F - #define TVTYPE_NONE 0x00 #define TVTYPE_NTSC 0x01 #define TVTYPE_PAL 0x02 @@ -86,66 +49,51 @@ #define VIA_NONETV 0 #define VIA_VT1621 1 /* TV2PLUS */ #define VIA_VT1622 2 /* TV3 */ -#define VIA_VT1622A 7 -#define VIA_VT1623 9 +#define VIA_VT1623 3 /* also VT1622A */ #define VIA_TVNORMAL 0 #define VIA_TVOVER 1 -#define VIA_NO_TVHSCALE 0 -#define VIA_TVHSCALE0 0 -#define VIA_TVHSCALE1 1 -#define VIA_TVHSCALE2 2 -#define VIA_TVHSCALE3 3 -#define VIA_TVHSCALE4 4 -#define VIA_TV_NUM_HSCALE_LEVEL 8 -#define VIA_TV_NUM_HSCALE_REG 16 #define VIA_DEVICE_NONE 0x00 -#define VIA_DEVICE_CRT1 0x01 +#define VIA_DEVICE_CRT 0x01 #define VIA_DEVICE_LCD 0x02 #define VIA_DEVICE_TV 0x04 #define VIA_DEVICE_DFP 0x08 -#define VIA_DEVICE_CRT2 0x10 -#define VIA_DEVICE_CRT VIA_DEVICE_CRT1 /* System Memory CLK */ -#define VIA_MEM_SDR66 0x00 -#define VIA_MEM_SDR100 0x01 -#define VIA_MEM_SDR133 0x02 -#define VIA_MEM_DDR200 0x03 -#define VIA_MEM_DDR266 0x04 -#define VIA_MEM_DDR333 0x05 -#define VIA_MEM_DDR400 0x06 +#define VIA_MEM_SDR66 0x00 +#define VIA_MEM_SDR100 0x01 +#define VIA_MEM_SDR133 0x02 +#define VIA_MEM_DDR200 0x03 +#define VIA_MEM_DDR266 0x04 +#define VIA_MEM_DDR333 0x05 +#define VIA_MEM_DDR400 0x06 +#define VIA_MEM_NONE 0xFF /* Digital Output Bus Width */ #define VIA_DI_12BIT 0x00 #define VIA_DI_24BIT 0x01 -#define CAP_WEAVE 0x0 -#define CAP_BOB 0x1 - typedef struct _VIABIOSINFO { int scrnIndex; + Bool CrtPresent; + Bool CrtActive; + CARD16 ModeIndex; CARD16 ResolutionIndex; - CARD16 RefreshIndex; + CARD16 Refresh; + CARD16 Clock; /* register value for the dotclock */ - CARD8 ConnectedDevice; - CARD8 ActiveDevice; - CARD8 DefaultActiveDevice; - /* Panel/LCD entries */ - CARD8 TMDS; - CARD8 LVDS; + Bool PanelPresent; + Bool PanelActive; + Bool ForcePanel; + int PanelIndex; + int PanelSize; Bool LCDDualEdge; /* mean add-on card is 2CH or Dual or DDR */ - Bool DVIAttach; - Bool LCDAttach; Bool Center; CARD8 BusWidth; /* Digital Output Bus Width */ - int PanelSize; - int PanelIndex; - Bool ForcePanel; Bool SetDVI; /* LCD Simultaneous Expand Mode HWCursor Y Scale */ Bool scaleY; @@ -155,45 +103,54 @@ typedef struct _VIABIOSINFO { /* TV entries */ int TVEncoder; + int TVOutput; + Bool TVActive; + I2CDevPtr TVI2CDev; + CARD16 TVIndex; int TVType; Bool TVDotCrawl; - int TVOutput; int TVVScan; - int TVHScale; - CARD16 TVIndex; - CARD8 TVI2CAddr; - Bool TVUseGpioI2c; - I2CDevPtr TVI2CDev; int TVDeflicker; + CARD8 TVRegs[0xFF]; + + /* TV Callbacks */ + void (*TVSave) (ScrnInfoPtr pScrn); + void (*TVRestore) (ScrnInfoPtr pScrn); + Bool (*TVDACSense) (ScrnInfoPtr pScrn); + Bool (*TVModeValid) (ScrnInfoPtr pScrn, DisplayModePtr mode); + void (*TVModeI2C) (ScrnInfoPtr pScrn); + void (*TVModeCrtc) (ScrnInfoPtr pScrn); + void (*TVPower) (ScrnInfoPtr pScrn, Bool On); } VIABIOSInfoRec, *VIABIOSInfoPtr; /* Function prototypes */ /* via_bios.c */ -CARD8 ViaVBEGetActiveDevice(ScrnInfoPtr pScrn); -CARD16 ViaVBEGetDisplayDeviceInfo(ScrnInfoPtr pScrn, CARD8 *numDevice); void ViaVBEPrintBIOSVersion(ScrnInfoPtr pScrn); void ViaVBEPrintBIOSDate(ScrnInfoPtr pScrn); #ifdef HAVE_DEBUG +CARD8 ViaVBEGetActiveDevice(ScrnInfoPtr pScrn); void ViaDumpVGAROM(ScrnInfoPtr pScrn); #endif /* HAVE_DEBUG */ /* via_mode.c */ -void VIATVDetect(ScrnInfoPtr pScrn); -CARD8 VIAGetActiveDisplay(ScrnInfoPtr pScrn); -Bool VIAPostDVI(ScrnInfoPtr pScrn); -CARD8 VIAGetDeviceDetect(ScrnInfoPtr pScrn); -Bool VIAFindModeUseBIOSTable(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool Final); -void VIASetModeUseBIOSTable(ScrnInfoPtr pScrn, DisplayModePtr mode); -void VIASetModeForMHS(ScrnInfoPtr pScrn, DisplayModePtr mode); -void VIALoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, - LOCO *colors, VisualPtr pVisual); -void VIAEnableLCD(ScrnInfoPtr pScrn); -void VIADisableLCD(ScrnInfoPtr pScrn); +void ViaOutputsDetect(ScrnInfoPtr pScrn); +Bool ViaOutputsSelect(ScrnInfoPtr pScrn); +Bool ViaModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool Final); +void ViaModePrimary(ScrnInfoPtr pScrn, DisplayModePtr mode); +void ViaModeSecondary(ScrnInfoPtr pScrn, DisplayModePtr mode); +void ViaLCDPower(ScrnInfoPtr pScrn, Bool On); +void ViaTVPower(ScrnInfoPtr pScrn, Bool On); +void ViaTVSave(ScrnInfoPtr pScrn); +void ViaTVRestore(ScrnInfoPtr pScrn); /* in via_bandwidth.c */ void ViaSetPrimaryFIFO(ScrnInfoPtr pScrn, DisplayModePtr mode); void ViaSetSecondaryFIFO(ScrnInfoPtr pScrn, DisplayModePtr mode); void ViaDisablePrimaryFIFO(ScrnInfoPtr pScrn); +/* via_vt162x.c */ +I2CDevPtr ViaVT162xDetect(ScrnInfoPtr pScrn, I2CBusPtr pBus, CARD8 Address); +void ViaVT162xInit(ScrnInfoPtr pScrn); + #endif /* _VIA_BIOS_H_ */ diff --git a/src/via_cursor.c b/src/via_cursor.c index a303599..0ca5b3d 100644 --- a/src/via_cursor.c +++ b/src/via_cursor.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_cursor.c,v 1.3 2003/08/27 15:16:08 tsi Exp $ */ /* * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. diff --git a/src/via_dga.c b/src/via_dga.c index 8481c3a..1e11d6f 100644 --- a/src/via_dga.c +++ b/src/via_dga.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_dga.c,v 1.4 2003/08/27 15:16:08 tsi Exp $ */ /* * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. diff --git a/src/via_dri.c b/src/via_dri.c index 92988ca..ec789bd 100644 --- a/src/via_dri.c +++ b/src/via_dri.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_dri.c,v 1.9 2004/02/08 17:57:10 tsi Exp $ */ /* * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. diff --git a/src/via_dri.h b/src/via_dri.h index 8764d9f..020ea97 100644 --- a/src/via_dri.h +++ b/src/via_dri.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_dri.h,v 1.2 2003/08/27 15:16:08 tsi Exp $ */ /* * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. diff --git a/src/via_driver.c b/src/via_driver.c index a0f4e9e..1f94236 100644 --- a/src/via_driver.c +++ b/src/via_driver.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_driver.c,v 1.29 2004/02/20 21:46:35 dawes Exp $ */ /* * Copyright 2004 The Unichrome Project [unichrome.sf.net] * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. @@ -72,14 +71,9 @@ static ModeStatus VIAValidMode(int index, DisplayModePtr mode, static void VIADPMS(ScrnInfoPtr pScrn, int mode, int flags); static const OptionInfoRec * VIAAvailableOptions(int chipid, int busid); - -static void VIAEnableMMIO(ScrnInfoPtr pScrn); -static void VIADisableMMIO(ScrnInfoPtr pScrn); static Bool VIAMapMMIO(ScrnInfoPtr pScrn); static Bool VIAMapFB(ScrnInfoPtr pScrn); static void VIAUnmapMem(ScrnInfoPtr pScrn); -Bool VIADeviceSelection(ScrnInfoPtr pScrn); -Bool VIADeviceDispatch(ScrnInfoPtr pScrn); #ifdef XF86DRI void VIAInitialize3DEngine(ScrnInfoPtr pScrn); @@ -124,6 +118,7 @@ typedef enum { OPTION_DUMPVGAROM, OPTION_PRINTVGAREGS, OPTION_PRINTTVREGS, + OPTION_I2CSCAN, #endif /* HAVE_DEBUG */ OPTION_PCI_BURST, OPTION_PCI_RETRY, @@ -143,11 +138,7 @@ typedef enum { OPTION_TVTYPE, OPTION_TVOUTPUT, OPTION_TVVSCAN, - OPTION_TVHSCALE, OPTION_DISABLEVQ, - OPTION_CAP0_DEINTERLACE, - OPTION_CAP1_DEINTERLACE, - OPTION_CAP0_FIELDSWAP, OPTION_DRIXINERAMA, OPTION_DISABLEIRQ, OPTION_TVDEFLICKER, @@ -162,6 +153,7 @@ static OptionInfoRec VIAOptions[] = {OPTION_DUMPVGAROM, "DumpVGAROM", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_PRINTVGAREGS, "PrintVGARegs", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_PRINTTVREGS, "PrintTVRegs", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_I2CSCAN, "I2CScan", OPTV_BOOLEAN, {0}, FALSE}, #endif /* HAVE_DEBUG */ {OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_HWCURSOR, "HWCursor", OPTV_BOOLEAN, {0}, FALSE}, @@ -180,11 +172,7 @@ static OptionInfoRec VIAOptions[] = {OPTION_TVTYPE, "TVType", OPTV_ANYSTR, {0}, FALSE}, {OPTION_TVOUTPUT, "TVOutput", OPTV_ANYSTR, {0}, FALSE}, {OPTION_TVVSCAN, "TVVScan", OPTV_ANYSTR, {0}, FALSE}, - {OPTION_TVHSCALE, "TVHScale", OPTV_ANYSTR, {0}, FALSE}, {OPTION_DISABLEVQ, "DisableVQ", OPTV_BOOLEAN, {0}, FALSE}, - {OPTION_CAP0_DEINTERLACE, "Cap0Deinterlace", OPTV_ANYSTR, {0}, FALSE}, - {OPTION_CAP1_DEINTERLACE, "Cap1Deinterlace", OPTV_ANYSTR, {0}, FALSE}, - {OPTION_CAP0_FIELDSWAP, "Cap0FieldSwap", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_DRIXINERAMA, "DRIXINERAMA", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_DISABLEIRQ, "DisableIRQ", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_AGP_DMA, "EnableAGPDMA", OPTV_BOOLEAN, {0}, FALSE}, @@ -243,6 +231,8 @@ static const char *i2cSymbols[] = { "xf86I2CWriteRead", "xf86I2CProbeAddress", "xf86DestroyI2CDevRec", + "xf86I2CReadByte", + "xf86I2CWriteByte", NULL }; @@ -353,9 +343,6 @@ static pointer VIASetup(pointer module, pointer opts, int *errmaj, int *errmin) vbeSymbols, i2cSymbols, ddcSymbols, - /* - mpegSymbols, - */ #ifdef XF86DRI drmSymbols, driSymbols, @@ -407,7 +394,6 @@ static void VIAFreeRec(ScrnInfoPtr pScrn) if (((VIARec *)(pScrn->driverPrivate))->pBIOSInfo->TVI2CDev) xf86DestroyI2CDevRec((((VIARec *)(pScrn->driverPrivate))->pBIOSInfo->TVI2CDev), TRUE); xfree(((VIARec *)(pScrn->driverPrivate))->pBIOSInfo); - ViaTunerDestroy(pScrn); VIAUnmapMem(pScrn); @@ -891,53 +877,16 @@ static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags) } /* ActiveDevice Option for device selection */ - pBIOSInfo->ActiveDevice = 0x00; + pVia->ActiveDevice = 0x00; if ((s = xf86GetOptValString(VIAOptions, OPTION_ACTIVEDEVICE))) { - if (!xf86NameCmp(s, "CRT,TV") || !xf86NameCmp(s, "TV,CRT")) { - pBIOSInfo->ActiveDevice = VIA_DEVICE_CRT1 | VIA_DEVICE_TV; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Active Device is CRT and TV.\n"); - } - else if(!xf86NameCmp(s, "CRT,LCD") || !xf86NameCmp(s, "LCD,CRT")) { - pBIOSInfo->ActiveDevice = VIA_DEVICE_CRT1 | VIA_DEVICE_LCD; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Active Device is CRT and LCD.\n"); - } - else if(!xf86NameCmp(s, "CRT,DFP") || !xf86NameCmp(s, "DFP,CRT") - || !xf86NameCmp(s, "CRT,DVI") || !xf86NameCmp(s, "DVI,CRT")) { - pBIOSInfo->ActiveDevice = VIA_DEVICE_CRT1 | VIA_DEVICE_DFP; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Active Device is CRT and DFP.\n"); - } - else if(!xf86NameCmp(s, "TV,DFP") || !xf86NameCmp(s, "DFP,TV") - || !xf86NameCmp(s, "TV,DVI") || !xf86NameCmp(s, "DVI,TV")) { - pBIOSInfo->ActiveDevice = VIA_DEVICE_TV | VIA_DEVICE_DFP; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Active Device is TV and DFP.\n"); - } -#if 0 - else if(!xf86NameCmp(s, "DFP,LCD") || !xf86NameCmp(s, "LCD,DFP") - || !xf86NameCmp(s, "LCD,DVI") || !xf86NameCmp(s, "DVI,LCD")) { - pBIOSInfo->ActiveDevice = VIA_DEVICE_DFP | VIA_DEVICE_LCD; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Active Device is DFP and LCD.\n"); - } -#endif - else if(!xf86NameCmp(s, "CRT") || !xf86NameCmp(s, "CRT ONLY")) { - pBIOSInfo->ActiveDevice = VIA_DEVICE_CRT1; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Active Device is CRT Only.\n"); - } - else if(!xf86NameCmp(s, "LCD") || !xf86NameCmp(s, "LCD ONLY")) { - pBIOSInfo->ActiveDevice = VIA_DEVICE_LCD; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Active Device is LCD Only.\n"); - } - else if(!xf86NameCmp(s, "TV") || !xf86NameCmp(s, "TV ONLY")) { - pBIOSInfo->ActiveDevice = VIA_DEVICE_TV; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Active Device is TV Only.\n"); - } - else if(!xf86NameCmp(s, "DFP") || !xf86NameCmp(s, "DFP ONLY") - || !xf86NameCmp(s, "DVI") || !xf86NameCmp(s, "DVI ONLY")) { - pBIOSInfo->ActiveDevice = VIA_DEVICE_DFP; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Active Device is DFP Only.\n"); - } - else { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option \"%s\" can't recognize!, Active Device by default.\n", s); - } + if (xf86strstr(s, "CRT")) + pVia->ActiveDevice |= VIA_DEVICE_CRT; + if (xf86strstr(s, "LCD")) + pVia->ActiveDevice |= VIA_DEVICE_LCD; + if (xf86strstr(s, "DFP")) /* just treat this the same as LCD */ + pVia->ActiveDevice |= VIA_DEVICE_LCD; + if (xf86strstr(s, "TV")) + pVia->ActiveDevice |= VIA_DEVICE_TV; } /* LCDDualEdge Option */ @@ -1079,27 +1028,6 @@ static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags) } } - pBIOSInfo->TVHScale = VIA_NO_TVHSCALE; - if ((s = xf86GetOptValString(VIAOptions, OPTION_TVHSCALE))) { -#if 0 - if (!xf86NameCmp(s, "0")) { - pBIOSInfo->TVHScale = VIA_TVHSCALE0; - } - else if (!xf86NameCmp(s, "1")) { - pBIOSInfo->TVHScale = VIA_TVHSCALE1; - } - else if(!xf86NameCmp(s, "2")) { - pBIOSInfo->TVHScale = VIA_TVHSCALE2; - } - else if (!xf86NameCmp(s, "3")) { - pBIOSInfo->TVHScale = VIA_TVHSCALE3; - } - else if (!xf86NameCmp(s, "4")) { - pBIOSInfo->TVHScale = VIA_TVHSCALE4; - } -#endif - } - if (xf86LoadSubModule(pScrn, "vbe")) { xf86LoaderReqSymLists(vbeSymbols, NULL); pVia->pVbe = VBEInit(NULL, pVia->EntityIndex); @@ -1209,6 +1137,11 @@ static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags) /* Do this as early as possible */ if (pVia->PrintVGARegs) ViaVgahwPrint(VGAHWPTR(pScrn)); + + if (xf86ReturnOptValBool(VIAOptions, OPTION_I2CSCAN, FALSE)) + pVia->I2CScan = TRUE; + else + pVia->I2CScan = FALSE; #endif /* HAVE_DEBUG */ if (pVia->Chipset == VIA_CLE266) @@ -1292,7 +1225,7 @@ static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags) } else { xf86LoaderReqSymLists(i2cSymbols,NULL); - VIAI2CInit(pScrn); + ViaI2CInit(pScrn); } if (!xf86LoadSubModule(pScrn, "ddc")) { @@ -1311,20 +1244,11 @@ static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags) } } - VIATVDetect(pScrn); - - /* Detect TMDS/LVDS Encoder */ - VIAPostDVI(pScrn); - pBIOSInfo->ConnectedDevice = VIAGetDeviceDetect(pScrn); - - VIADeviceSelection(pScrn); - if (pVia->IsSecondary) { - if (pVia->SAMM) - VIADeviceDispatch(pScrn); - else { - VIAFreeRec(pScrn); - return FALSE; - } + ViaOutputsDetect(pScrn); + if (!ViaOutputsSelect(pScrn)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No outputs possible.\n"); + VIAFreeRec(pScrn); + return FALSE; } /* @@ -1431,44 +1355,6 @@ static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags) xf86LoaderReqSymLists(shadowSymbols, NULL); } - /* Capture option parameter */ - pVia->Cap0_Deinterlace = CAP_BOB; - if ((s = xf86GetOptValString(VIAOptions, OPTION_CAP0_DEINTERLACE))) { - if (!xf86NameCmp(s, "Bob")) { - pVia->Cap0_Deinterlace = CAP_BOB; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Capture 0 de-interlace mode is Bob\n"); - } - else if(!xf86NameCmp(s, "Weave")) { - pVia->Cap0_Deinterlace = CAP_WEAVE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Capture 0 de-interlace mode is Weave\n"); - } - } - - pVia->Cap1_Deinterlace = CAP_BOB; - if ((s = xf86GetOptValString(VIAOptions, OPTION_CAP1_DEINTERLACE))) { - if (!xf86NameCmp(s, "Bob")) { - pVia->Cap1_Deinterlace = CAP_BOB; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Capture 1 de-interlace mode is Bob\n"); - } - else if(!xf86NameCmp(s, "Weave")) { - pVia->Cap1_Deinterlace = CAP_WEAVE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Capture 1 de-interlace mode is Weave\n"); - } - } - - if (xf86ReturnOptValBool(VIAOptions, OPTION_CAP0_FIELDSWAP, FALSE)) { - pVia->Cap0_FieldSwap = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Option: Cap0_FieldSwap Enabled\n"); - } - else { - pVia->Cap0_FieldSwap = FALSE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Option: Cap0_FieldSwap Disabled\n"); - } - - /* xf86LoaderReqSymLists(mpegSymbols, NULL); */ - VIAUnmapMem(pScrn); return TRUE; @@ -1552,7 +1438,7 @@ VIASave(ScrnInfoPtr pScrn) VIAPtr pVia = VIAPTR(pScrn); VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; VIARegPtr Regs = &pVia->SavedReg; - int i; + int i; DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIASave\n")); @@ -1619,33 +1505,8 @@ VIASave(ScrnInfoPtr pScrn) Regs->CR35 = hwp->readCrtc(hwp, 0x35); Regs->CR36 = hwp->readCrtc(hwp, 0x36); - /* Saving TV register status before set mode */ - switch (pBIOSInfo->TVEncoder) { - case VIA_VT1621: - case VIA_VT1622: - case VIA_VT1622A: - case VIA_VT1623: - if (pBIOSInfo->TVUseGpioI2c) { - CARD8 R_Buffer[1]; - - VIAGPIOI2C_Initial(&(pVia->GpioI2c), pBIOSInfo->TVI2CAddr); - for (i = 0; i < 0x6C; i++) { - VIAGPIOI2C_ReadByte(&(pVia->GpioI2c), i, R_Buffer); - Regs->TVRegs[i] = R_Buffer[0]; - /*DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Save TV Register[%d]0x%X\n", i, Regs->TVRegs[i]));*/ - } - } else { - CARD8 W_Buffer[1], TVRegs[0xFF]; - - W_Buffer[0] = 0; - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,1, TVRegs, 0xFF); - for (i = 0; i < 0xFF; i++) - Regs->TVRegs[i] = TVRegs[i]; - } - break; - default: - break; - } + if (pBIOSInfo->TVI2CDev) + ViaTVSave(pScrn); /* Save LCD control regs */ for (i = 0; i < 68; i++) @@ -1677,30 +1538,8 @@ VIARestore(ScrnInfoPtr pScrn) hwp->writeCrtc(hwp, 0x6B, 0x00); hwp->writeCrtc(hwp, 0x6C, 0x00); - switch (pBIOSInfo->TVEncoder) { - case VIA_VT1621: - case VIA_VT1622: - case VIA_VT1622A: - case VIA_VT1623: - if (pBIOSInfo->TVUseGpioI2c) { - VIAGPIOI2C_Initial(&(pVia->GpioI2c), pBIOSInfo->TVI2CAddr); - for (i = 0; i < 0x6C; i++) { - VIAGPIOI2C_Write(&(pVia->GpioI2c), i, Regs->TVRegs[i]); - /*DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Write Back Register[%d]:0x%X\n", i, Regs->TVRegs[i]));*/ - } - } else { - CARD8 W_Buffer[3]; - - for (i = 0; i < 0xFF; i++) { - W_Buffer[0] = (CARD8)(i); - W_Buffer[1] = (CARD8)(Regs->TVRegs[i]); - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer, 2, NULL,0); - } - } - break; - default: - break; - } + if (pBIOSInfo->TVI2CDev) + ViaTVRestore(pScrn); /* restore the standard vga regs */ if (xf86IsPrimaryPci(pVia->PciInfo)) @@ -1740,6 +1579,10 @@ VIARestore(ScrnInfoPtr pScrn) hwp->writeSeq(hwp, 0x46, Regs->SR46); hwp->writeSeq(hwp, 0x47, Regs->SR47); + /* reset dotclocks */ + ViaSeqMask(hwp, 0x40, 0x06, 0x06); + ViaSeqMask(hwp, 0x40, 0x00, 0x06); + hwp->writeCrtc(hwp, 0x13, Regs->CR13); hwp->writeCrtc(hwp, 0x32, Regs->CR32); hwp->writeCrtc(hwp, 0x33, Regs->CR33); @@ -1751,8 +1594,8 @@ VIARestore(ScrnInfoPtr pScrn) for (i = 0; i < 68; i++) hwp->writeCrtc(hwp, i + 0x50, Regs->CRTCRegs[i]); - if (pBIOSInfo->DefaultActiveDevice & VIA_DEVICE_LCD) - VIAEnableLCD(pScrn); + if (pBIOSInfo->PanelActive) + ViaLCDPower(pScrn, TRUE); ViaDisablePrimaryFIFO(pScrn); @@ -1763,58 +1606,8 @@ VIARestore(ScrnInfoPtr pScrn) vgaHWProtect(pScrn, FALSE); } -void VIAEnableMMIO(ScrnInfoPtr pScrn) -{ - vgaHWPtr hwp = VGAHWPTR(pScrn); - VIAPtr pVia = VIAPTR(pScrn); - unsigned char val; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAEnableMMIO\n")); - -#if 0 - /* will not happen in the wild. commercial versions of the unichrome have - all been part of the northbridge and therefor will never encounter - _another_ northbridge - default to using MMIO -- Luc */ - if (xf86IsPrimaryPci(pVia->PciInfo)) { - /* If we are primary card, we still use std vga port. If we use - * MMIO, system will hang in vgaHWSave when our card used in - * PLE and KLE (integrated Trident MVP4) - */ - vgaHWSetStdFuncs(hwp); - } - else -#endif - { - vgaHWSetMmioFuncs(hwp, pVia->MapBase, 0x8000); - } - - val = hwp->readEnable(hwp); - hwp->writeEnable(hwp, val | 0x01); - - val = hwp->readMiscOut(hwp); - hwp->writeMiscOut(hwp, val | 0x01); - - /* Unlock Extended IO Space */ - hwp->writeSeq(hwp, 0x10, 0x01); - - /* Enable MMIO */ - if(!pVia->IsSecondary) { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "primary val = %x\n", hwp->readSeq(hwp, 0x1A))); - ViaSeqMask(hwp, 0x1A, 0x68, 0x68); - } - else { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "secondary val = %x\n", hwp->readSeq(hwp, 0x1A))); - ViaSeqMask(hwp, 0x1A, 0x38, 0x38); - } -} - - -void VIADisableMMIO(ScrnInfoPtr pScrn) -{ - ViaSeqMask(VGAHWPTR(pScrn), 0x1A, 0x00, 0x68); -} - -static Bool VIAMapMMIO(ScrnInfoPtr pScrn) +static Bool +VIAMapMMIO(ScrnInfoPtr pScrn) { VIAPtr pVia = VIAPTR(pScrn); @@ -1828,8 +1621,7 @@ static Bool VIAMapMMIO(ScrnInfoPtr pScrn) pVia->MmioBase, VIA_MMIO_REGSIZE); pVia->MapBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pVia->PciTag, - pVia->MmioBase, - VIA_MMIO_REGSIZE); + pVia->MmioBase, VIA_MMIO_REGSIZE); xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "mapping BitBlt MMIO @ 0x%lx with size 0x%x\n", @@ -1850,10 +1642,31 @@ static Bool VIAMapMMIO(ScrnInfoPtr pScrn) /* Memory mapped IO for Mpeg Engine */ pVia->MpegMapBase = pVia->MapBase + 0xc00; - VIAEnableMMIO(pScrn); - vgaHWGetIOBase(VGAHWPTR(pScrn)); + /* Set up MMIO vgaHW */ + { + vgaHWPtr hwp = VGAHWPTR(pScrn); + CARD8 val; + + vgaHWSetMmioFuncs(hwp, pVia->MapBase, 0x8000); + + val = hwp->readEnable(hwp); + hwp->writeEnable(hwp, val | 0x01); + + val = hwp->readMiscOut(hwp); + hwp->writeMiscOut(hwp, val | 0x01); + + /* Unlock Extended IO Space */ + hwp->writeSeq(hwp, 0x10, 0x01); + + /* Enable MMIO */ + if (pVia->IsSecondary) + ViaSeqMask(hwp, 0x1A, 0x38, 0x38); + else + ViaSeqMask(hwp, 0x1A, 0x68, 0x68); + + vgaHWGetIOBase(hwp); + } - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "vgaHW MMIOBase: 0x%X, MMIOOffset: 0x%X\n", (unsigned) VGAHWPTR(pScrn)->MMIOBase, VGAHWPTR(pScrn)->MMIOOffset)); return TRUE; } @@ -1896,14 +1709,13 @@ static Bool VIAMapFB(ScrnInfoPtr pScrn) return FALSE; } - pVia->FBStart = pVia->FBBase; pVia->FBFreeStart = (pScrn->displayWidth * pScrn->bitsPerPixel >> 3) * pScrn->virtualY; pVia->FBFreeEnd = pVia->videoRambytes; xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Frame buffer start: %p, free start: 0x%x end: 0x%x\n", - pVia->FBStart, pVia->FBFreeStart, pVia->FBFreeEnd); + pVia->FBBase, pVia->FBFreeStart, pVia->FBFreeEnd); } pScrn->memPhysBase = pVia->PciInfo->memBase[0]; @@ -1914,37 +1726,86 @@ static Bool VIAMapFB(ScrnInfoPtr pScrn) } -static void VIAUnmapMem(ScrnInfoPtr pScrn) +static void +VIAUnmapMem(ScrnInfoPtr pScrn) +{ + VIAPtr pVia = VIAPTR(pScrn); + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAUnmapMem\n")); + + /* Disable MMIO */ + ViaSeqMask(VGAHWPTR(pScrn), 0x1A, 0x00, 0x60); + + if (pVia->MapBase) + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pVia->MapBase, VIA_MMIO_REGSIZE); + + if (pVia->BltBase) + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pVia->BltBase, VIA_MMIO_BLTSIZE); + + if (pVia->FBBase) + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pVia->FBBase, pVia->videoRambytes); +} + +/* + * + */ +static void +VIALoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, + LOCO *colors, VisualPtr pVisual) { - VIAPtr pVia; + vgaHWPtr hwp = VGAHWPTR(pScrn); + VIAPtr pVia = VIAPTR(pScrn); + int i, index; + int SR1A, SR1B, CR67, CR6A; - pVia = VIAPTR(pScrn); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIALoadPalette\n")); - VIADisableMMIO(pScrn); + if (pScrn->bitsPerPixel != 8) + return; - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAUnmapMem\n")); + SR1A = hwp->readSeq(hwp, 0x1A); + SR1B = hwp->readSeq(hwp, 0x1B); + CR67 = hwp->readCrtc(hwp, 0x67); + CR6A = hwp->readCrtc(hwp, 0x6A); - if (pVia->MapBase) { - xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pVia->MapBase, - VIA_MMIO_REGSIZE); + if (pVia->IsSecondary) { + ViaSeqMask(hwp, 0x1A, 0x01, 0x01); + ViaSeqMask(hwp, 0x1B, 0x80, 0x80); + ViaCrtcMask(hwp, 0x67, 0x00, 0xC0); + ViaCrtcMask(hwp, 0x6A, 0xC0, 0xC0); } - - if (pVia->BltBase) { - xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pVia->BltBase, - VIA_MMIO_BLTSIZE); + + for (i = 0; i < numColors; i++) { + index = indices[i]; + hwp->writeDacWriteAddr(hwp, index); + hwp->writeDacData(hwp, colors[index].red); + hwp->writeDacData(hwp, colors[index].green); + hwp->writeDacData(hwp, colors[index].blue); } - if (pVia->FBBase) { - xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pVia->FBBase, - pVia->videoRambytes); - } + if (pVia->IsSecondary) { + hwp->writeSeq(hwp, 0x1A, SR1A); + hwp->writeSeq(hwp, 0x1B, SR1B); + hwp->writeCrtc(hwp, 0x67, CR67); + hwp->writeCrtc(hwp, 0x6A, CR6A); - return; + /* Screen 0 palette was changed by mode setting of Screen 1, + * so load again */ + for (i = 0; i < numColors; i++) { + index = indices[i]; + hwp->writeDacWriteAddr(hwp, index); + hwp->writeDacData(hwp, colors[index].red); + hwp->writeDacData(hwp, colors[index].green); + hwp->writeDacData(hwp, colors[index].blue); + } + } } - -static Bool VIAScreenInit(int scrnIndex, ScreenPtr pScreen, - int argc, char **argv) +/* + * + */ +static Bool +VIAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; vgaHWPtr hwp = VGAHWPTR(pScrn); @@ -1964,11 +1825,15 @@ static Bool VIAScreenInit(int scrnIndex, ScreenPtr pScreen, vgaHWBlankScreen(pScrn, FALSE); + pVia->FirstInit = TRUE; + if (!VIAWriteMode(pScrn, pScrn->currentMode)) { vgaHWBlankScreen(pScrn, TRUE); return FALSE; } + pVia->FirstInit = FALSE; + /* Darken the screen for aesthetic reasons and set the viewport */ VIASaveScreen(pScreen, SCREEN_SAVER_ON); pScrn->AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); @@ -2113,26 +1978,25 @@ static Bool VIAScreenInit(int scrnIndex, ScreenPtr pScreen, DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Color maps etc. set up\n")); #ifdef XF86DRI - if (pVia->directRenderingEnabled) { - pVia->directRenderingEnabled = VIADRIFinishScreenInit(pScreen); - } - if (pVia->directRenderingEnabled) { + if (pVia->directRenderingEnabled) + pVia->directRenderingEnabled = VIADRIFinishScreenInit(pScreen); + + if (pVia->directRenderingEnabled) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering enabled\n"); - } else { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering disabled\n"); - } - if (!pVia->directRenderingEnabled) VIAInitLinear(pScreen); + } #else VIAInitLinear(pScreen); #endif - + viaInitVideo(pScreen); + #ifdef XF86DRI pVia->XvMCEnabled = 0; - if(pVia->Chipset == VIA_CLE266) - ViaInitXVMC(pScreen); + if (pVia->Chipset == VIA_CLE266) + ViaInitXVMC(pScreen); #endif if (serverGeneration == 1) @@ -2177,7 +2041,7 @@ static int VIAInternalScreenInit(int scrnIndex, ScreenPtr pScreen) } else { pVia->ShadowPtr = NULL; - FBStart = pVia->FBStart; + FBStart = pVia->FBBase; } return fbScreenInit(pScreen, FBStart, width, height, pScrn->xDpi, @@ -2190,7 +2054,7 @@ static ModeStatus VIAValidMode(int scrnIndex, DisplayModePtr mode, { DEBUG(xf86DrvMsg(scrnIndex, X_INFO, "VIAValidMode\n")); - if (!VIAFindModeUseBIOSTable(xf86Screens[scrnIndex], mode, FALSE)) + if (!ViaModeInit(xf86Screens[scrnIndex], mode, FALSE)) return MODE_BAD; return MODE_OK; } @@ -2201,12 +2065,12 @@ VIAWriteMode(ScrnInfoPtr pScrn, DisplayModePtr mode) VIAPtr pVia = VIAPTR(pScrn); vgaHWPtr hwp = VGAHWPTR(pScrn); - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAWriteMode\n")); - if (!VIAFindModeUseBIOSTable(pScrn, mode, TRUE)) { + pVia->OverlaySupported = FALSE; + + if (!ViaModeInit(pScrn, mode, TRUE)) return FALSE; - } if (!vgaHWInit(pScrn, mode)) return FALSE; @@ -2215,11 +2079,9 @@ VIAWriteMode(ScrnInfoPtr pScrn, DisplayModePtr mode) /* FIXME - need DRI lock for this bit - see i810 */ if (!pVia->IsSecondary) - VIASetModeUseBIOSTable(pScrn, mode); + ViaModePrimary(pScrn, mode); else - VIASetModeForMHS(pScrn, mode); - - pVia->FirstInit = FALSE; + ViaModeSecondary(pScrn, mode); /* Enable the graphics engine. */ if (!pVia->NoAccel) @@ -2329,8 +2191,7 @@ void VIAAdjustFrame(int scrnIndex, int x, int y, int flags) ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; vgaHWPtr hwp = VGAHWPTR(pScrn); VIAPtr pVia = VIAPTR(pScrn); - int Base; - DDLOCK ddLock; + CARD32 Base; DEBUG(xf86DrvMsg(scrnIndex, X_INFO, "VIAAdjustFrame\n")); @@ -2348,21 +2209,20 @@ void VIAAdjustFrame(int scrnIndex, int x, int y, int flags) hwp->writeCrtc(hwp, 0x0C, (Base & 0xFF00) >> 8); hwp->writeCrtc(hwp, 0x0D, Base & 0xFF); hwp->writeCrtc(hwp, 0x34, (Base & 0xFF0000) >> 16); +#if 0 + /* The CLE266A doesn't have this implemented, it seems. -- Luc */ + ViaCrtcMask(hwp, 0x48, Base >> 24, 0x03); +#endif } - { /* Pass Panning (x, y) info to V4L */ - ADJUSTFRAME AdjustFrame; - - AdjustFrame.x = x; - AdjustFrame.y = y; - - VIAVidAdjustFrame(pScrn,&AdjustFrame); - } + /* Pass Panning (x, y) info to V4L */ + VIAVidAdjustFrame(pScrn, x, y); /* Check if HW mpeg engine active */ - if (pVia->Video.VideoStatus & SW_VIDEO_ON) /* SW video case */ + if (pVia->VideoStatus & VIDEO_SWOV_ON) /* SW video case */ { DDUPDATEOVERLAY UpdateOverlay; + DDLOCK ddLock; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, " Call SW MPEG UpdateOverlay at panning mode.\n"); @@ -2385,21 +2245,6 @@ void VIAAdjustFrame(int scrnIndex, int x, int y, int flags) VIAVidUpdateOverlay(pScrn, &UpdateOverlay); } - else if (VIAGETREG(0x310) & 0x1) /* capture 0 (TV0) case */ - { - ddLock.dwFourCC = FOURCC_TV0; - - VIAVidLockSurface(pScrn, &ddLock); - } - - if (VIAGETREG(0x354) & 0x1) /* capture 1 (TV1) case */ - { - ddLock.dwFourCC = FOURCC_TV1; - - VIAVidLockSurface(pScrn, &ddLock); - } - - return; } @@ -2448,70 +2293,29 @@ static void VIADPMS(ScrnInfoPtr pScrn, int mode, int flags) /* Clear DPMS setting */ val = hwp->readCrtc(hwp, 0x36); val &= 0xCF; + /* Turn Off CRT, if user doesn't want crt on */ - if (!pVia->IsSecondary && !(pBIOSInfo->ActiveDevice & VIA_DEVICE_CRT1)) { + if (!pVia->IsSecondary && !pBIOSInfo->CrtActive) val |= 0x30; - } switch (mode) { case DPMSModeOn: - if (pBIOSInfo->ActiveDevice & (VIA_DEVICE_DFP | VIA_DEVICE_LCD)) - VIAEnableLCD(pScrn); - - if (pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) { - switch (pBIOSInfo->TVEncoder) { - case VIA_VT1621: - case VIA_VT1622: - case VIA_VT1622A: - case VIA_VT1623: - if (pBIOSInfo->TVUseGpioI2c) { - VIAGPIOI2C_Initial(&(pVia->GpioI2c), pBIOSInfo->TVI2CAddr); - VIAGPIOI2C_Write(&(pVia->GpioI2c), 0x0E, 0); - } else { - CARD8 W_Buffer[2]; - - W_Buffer[0] = 0x0E; - W_Buffer[1] = 0x0; - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,2, NULL,0); - } - break; - default: - break; - } - } + if (pBIOSInfo->PanelActive) + ViaLCDPower(pScrn, TRUE); + + if (pBIOSInfo->TVActive) + ViaTVPower(pScrn, TRUE); + hwp->writeCrtc(hwp, 0x36, val); break; case DPMSModeStandby: case DPMSModeSuspend: case DPMSModeOff: - if (pBIOSInfo->ActiveDevice & (VIA_DEVICE_DFP | VIA_DEVICE_LCD)) - VIADisableLCD(pScrn); - - if (pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) { - CARD8 W_Buffer[2]; - - switch (pBIOSInfo->TVEncoder) { - case VIA_VT1621: - W_Buffer[0] = 0x0E; - W_Buffer[1] = 0x03; - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,2, NULL,0); - break; - case VIA_VT1622: - case VIA_VT1622A: - case VIA_VT1623: - if (pBIOSInfo->TVUseGpioI2c) { - VIAGPIOI2C_Initial(&(pVia->GpioI2c), pBIOSInfo->TVI2CAddr); - VIAGPIOI2C_Write(&(pVia->GpioI2c), 0x0E, 0x0F); - } else { - W_Buffer[0] = 0x0E; - W_Buffer[1] = 0x0F; - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,2, NULL,0); - } - break; - default: - break; - } - } + if (pBIOSInfo->PanelActive) + ViaLCDPower(pScrn, FALSE); + + if (pBIOSInfo->TVActive) + ViaTVPower(pScrn, FALSE); val |= 0x30; hwp->writeCrtc(hwp, 0x36, val); @@ -2523,87 +2327,6 @@ static void VIADPMS(ScrnInfoPtr pScrn, int mode, int flags) return; } - -/* Active Device according connected status */ -Bool VIADeviceSelection(ScrnInfoPtr pScrn) -{ - VIAPtr pVia = VIAPTR(pScrn); - VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - /*unsigned int i; - unsigned char numDevice;*/ - pVia->SAMM = FALSE; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIADeviceSelection\n")); - pBIOSInfo->DefaultActiveDevice = ViaVBEGetActiveDevice(pScrn); - /* if XF86Config Option "ActiveDevice" hasn't set, active device according CMOS */ - if (!pBIOSInfo->ActiveDevice) { - pBIOSInfo->ActiveDevice = pBIOSInfo->DefaultActiveDevice; - } - /* if XF86Config-4 set SAMM, and only active one device, active device according CMOS */ - else if (pVia->IsSecondary && (pBIOSInfo->ActiveDevice == VIA_DEVICE_CRT1 || - pBIOSInfo->ActiveDevice == VIA_DEVICE_LCD || - pBIOSInfo->ActiveDevice == VIA_DEVICE_TV || - pBIOSInfo->ActiveDevice == VIA_DEVICE_DFP || - pBIOSInfo->ActiveDevice == VIA_DEVICE_CRT2)){ - pBIOSInfo->ActiveDevice = pBIOSInfo->DefaultActiveDevice; - } - if (((pBIOSInfo->ActiveDevice & pBIOSInfo->ConnectedDevice) == pBIOSInfo->ActiveDevice) - && (pVia->IsSecondary)) { - pVia->SAMM = TRUE; - } - pBIOSInfo->ActiveDevice &= pBIOSInfo->ConnectedDevice; - pVia->ActiveDevice = pBIOSInfo->ActiveDevice; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Connected Device is %d\n", pBIOSInfo->ConnectedDevice)); - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Active Device is %d\n", pBIOSInfo->ActiveDevice)); - - return TRUE; -} - -/* SAMM device dispatch */ -Bool VIADeviceDispatch(ScrnInfoPtr pScrn) -{ - DevUnion* pPriv = xf86GetEntityPrivate(pScrn->entityList[0], gVIAEntityIndex); - VIAEntPtr pVIAEnt = pPriv->ptr; - VIAPtr pVia1 = VIAPTR(pScrn), pVia0 = VIAPTR(pVIAEnt->pPrimaryScrn); - VIABIOSInfoPtr pBIOSInfo1 = pVia1->pBIOSInfo, pBIOSInfo0 = pVia0->pBIOSInfo; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIADeviceDispatch\n")); - pVia0->SAMM = TRUE; - switch (pBIOSInfo1->ActiveDevice) { - case (VIA_DEVICE_CRT1 | VIA_DEVICE_LCD) : /* If CRT + LCD, CRT is IGA1 */ - pBIOSInfo0->ActiveDevice = VIA_DEVICE_CRT1; - pBIOSInfo1->ActiveDevice = VIA_DEVICE_LCD; - break; - case (VIA_DEVICE_CRT1 | VIA_DEVICE_TV) : /* If CRT + TV, CRT is IGA1 */ - pBIOSInfo0->ActiveDevice = VIA_DEVICE_CRT1; - pBIOSInfo1->ActiveDevice = VIA_DEVICE_TV; - break; - case (VIA_DEVICE_CRT1 | VIA_DEVICE_DFP) : /* If CRT + DFP, CRT is IGA1 */ - pBIOSInfo0->ActiveDevice = VIA_DEVICE_CRT1; - pBIOSInfo1->ActiveDevice = VIA_DEVICE_DFP; - break; - case (VIA_DEVICE_LCD | VIA_DEVICE_TV) : /* If LCD + TV, TV is IGA1 */ - pBIOSInfo0->ActiveDevice = VIA_DEVICE_TV; - pBIOSInfo1->ActiveDevice = VIA_DEVICE_LCD; - break; - case (VIA_DEVICE_LCD | VIA_DEVICE_DFP) : /* If LCD + DFP, DFP is IGA1 */ - pBIOSInfo0->ActiveDevice = VIA_DEVICE_DFP; - pBIOSInfo1->ActiveDevice = VIA_DEVICE_LCD; - break; - case (VIA_DEVICE_TV | VIA_DEVICE_DFP) : /* If TV + DFP, TV is IGA1 */ - pBIOSInfo0->ActiveDevice = VIA_DEVICE_TV; - pBIOSInfo1->ActiveDevice = VIA_DEVICE_DFP; - break; - default : - return FALSE; - break; - } - DEBUG(xf86DrvMsg(pVIAEnt->pPrimaryScrn->scrnIndex, X_INFO, "Active Device is %d\n", pBIOSInfo0->ActiveDevice)); - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Active Device is %d\n", pBIOSInfo1->ActiveDevice)); - return TRUE; -} - #ifdef XF86DRI void VIAInitialize3DEngine(ScrnInfoPtr pScrn) diff --git a/src/via_driver.h b/src/via_driver.h index 0383769..fcddeb1 100644 --- a/src/via_driver.h +++ b/src/via_driver.h @@ -1,5 +1,5 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_driver.h,v 1.13 2004/02/08 17:57:10 tsi Exp $ */ /* + * Copyright 2004 The Unichrome Project [unichrome.sf.net] * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. * @@ -52,10 +52,8 @@ #include "xaa.h" #include "via_regs.h" -#include "via_i2c.h" #include "via_bios.h" #include "via_priv.h" -/* #include "ginfo.h" */ #include "via_swov.h" #ifdef XF86DRI @@ -69,7 +67,7 @@ #define DRIVER_NAME "via" #define VERSION_MAJOR 0 #define VERSION_MINOR 1 -#define PATCHLEVEL 27 +#define PATCHLEVEL 30 #define VIA_VERSION ((VERSION_MAJOR<<24) | (VERSION_MINOR<<16) | PATCHLEVEL) #define VIA_MAX_ACCEL_X (2047) @@ -80,60 +78,24 @@ #define VIA_CBUFFERSIZE 512 typedef struct { - unsigned char SR08, SR0A, SR0F; + CARD8 SR08, SR0A, SR0F; /* extended Sequencer registers */ - unsigned char SR10, SR11, SR12, SR13,SR14,SR15,SR16; - unsigned char SR17, SR18, SR19, SR1A,SR1B,SR1C,SR1D,SR1E; - unsigned char SR1F, SR20, SR21, SR22,SR23,SR24,SR25,SR26; - unsigned char SR27, SR28, SR29, SR2A,SR2B,SR2C,SR2D,SR2E; - unsigned char SR2F, SR30, SR31, SR32,SR33,SR34,SR40,SR41; - unsigned char SR42, SR43, SR44, SR45,SR46,SR47; + CARD8 SR10, SR11, SR12, SR13,SR14,SR15,SR16; + CARD8 SR17, SR18, SR19, SR1A,SR1B,SR1C,SR1D,SR1E; + CARD8 SR1F, SR20, SR21, SR22,SR23,SR24,SR25,SR26; + CARD8 SR27, SR28, SR29, SR2A,SR2B,SR2C,SR2D,SR2E; + CARD8 SR2F, SR30, SR31, SR32,SR33,SR34,SR40,SR41; + CARD8 SR42, SR43, SR44, SR45,SR46,SR47; /* extended CRTC registers */ - unsigned char CR13, CR30, CR31, CR32, CR33, CR34, CR35, CR36; - unsigned char CR37, CR38, CR39, CR3A, CR40, CR41, CR42, CR43; - unsigned char CR44, CR45, CR46, CR47, CR48, CR49, CR4A; - unsigned char CRTCRegs[68]; - unsigned char TVRegs[0xFF]; -/* unsigned char LCDRegs[0x40];*/ + CARD8 CR13, CR30, CR31, CR32, CR33, CR34, CR35, CR36; + CARD8 CR37, CR38, CR39, CR3A, CR40, CR41, CR42, CR43; + CARD8 CR44, CR45, CR46, CR47, CR48, CR49, CR4A; + CARD8 CRTCRegs[68]; +/* CARD8 LCDRegs[0x40];*/ } VIARegRec, *VIARegPtr; -/*Definition for CapturePortID*/ -#define PORT0 0 /* Capture Port 0*/ -#define PORT1 1 /* Capture Port 1*/ - -typedef struct __viaVideoControl { - CARD16 PORTID; - CARD32 dwCompose; - CARD32 dwHighQVDO; - CARD32 VideoStatus; - CARD32 dwAction; -#define ACTION_SET_PORTID 0 -#define ACTION_SET_COMPOSE 1 -#define ACTION_SET_HQV 2 -#define ACTION_SET_BOB 4 -#define ACTION_SET_VIDEOSTATUS 8 - Bool Cap0OnScreen1; /* True: Capture0 On Screen1 ; False: Capture0 On Screen0 */ - Bool Cap1OnScreen1; /* True: Capture1 On Screen1 ; False: Capture1 On Screen0 */ - Bool MPEGOnScreen1; /* True: MPEG On Screen1 ; False: MPEG On Screen0 */ -} VIAVideoControlRec, VIAVideoControlPtr; - -/* VIA Tuners */ -typedef struct -{ - int decoderType; /* Decoder I2C Type */ -#define SAA7108H 0 -#define SAA7113H 1 -#define SAA7114H 2 - I2CDevPtr I2C; /* Decoder I2C */ - I2CDevPtr FMI2C; /* FM Tuner I2C */ - - /* Not yet used */ - int autoDetect; /* Autodetect mode */ - int tunerMode; /* Fixed mode */ -} ViaTunerRec, *ViaTunerPtr; - /* * varables that need to be shared among different screens. */ @@ -207,7 +169,6 @@ typedef struct _VIA { unsigned char* BltBase; unsigned char* MapBaseDense; unsigned char* FBBase; - unsigned char* FBStart; CARD8 MemClk; /* Private memory pool management */ @@ -267,24 +228,15 @@ typedef struct _VIA { /* I2C & DDC */ I2CBusPtr pI2CBus1; I2CBusPtr pI2CBus2; - I2CBusPtr pI2CBus3; /* Future implementation: now gpioi2c */ + I2CBusPtr pI2CBus3; xf86MonPtr DDC1; xf86MonPtr DDC2; - GpioI2cRec GpioI2c; /* should be weened off, but we have no info, - no hardware that this code is known to - work with (properly) */ /* MHS */ Bool IsSecondary; Bool HasSecondary; Bool SAMM; - /* Capture de-interlace Mode */ - CARD32 Cap0_Deinterlace; - CARD32 Cap1_Deinterlace; - - Bool Cap0_FieldSwap; - #ifdef XF86DRI Bool directRenderingEnabled; Bool XvMCEnabled; @@ -315,31 +267,28 @@ typedef struct _VIA { /* Video */ swovRec swov; - VIAVideoControlRec Video; + CARD32 VideoStatus; VIAHWDiff HWDiff; unsigned long dwV1, dwV3; unsigned long OverlaySupported; unsigned long dwFrameNum; - pointer VidReg; - unsigned long gdwVidRegCounter; + CARD32* VidRegBuffer; /* Temporary buffer for video overlay registers. */ + unsigned long VidRegCursor; /* Write cursor for VidRegBuffer. */ + unsigned long old_dwUseExtendedFIFO; - /* Overlay TV Tuners */ - ViaTunerPtr Tuner[2]; - I2CDevPtr CXA2104S; - int AudioMode; - int AudioMute; - ViaSharedPtr sharedData; #ifdef HAVE_DEBUG Bool DumpVGAROM; Bool PrintVGARegs; Bool PrintTVRegs; + Bool I2CScan; #endif /* HAVE_DEBUG */ } VIARec, *VIAPtr; +#define VIAPTR(p) ((VIAPtr)((p)->driverPrivate)) typedef struct { @@ -354,19 +303,11 @@ typedef struct ScrnInfoPtr pSecondaryScrn; ScrnInfoPtr pPrimaryScrn; -}VIAEntRec, *VIAEntPtr; - - -/* Shortcuts. These depend on a local symbol "pVia". */ - -#define WaitIdle() pVia->myWaitIdle(pVia) -#define VIAPTR(p) ((VIAPtr)((p)->driverPrivate)) - +} VIAEntRec, *VIAEntPtr; /* Prototypes. */ void VIAAdjustFrame(int scrnIndex, int y, int x, int flags); Bool VIASwitchMode(int scrnIndex, DisplayModePtr mode, int flags); -void ViaWaitIdle(ScrnInfoPtr pScrn); /* In via_cursor.c. */ Bool VIAHWCursorInit(ScreenPtr pScreen); @@ -408,18 +349,40 @@ void viaSetColorSpace(VIAPtr pVia, int hue, int saturation, int brightness, int Bool reset); /* in via_overlay.c */ -unsigned long viaOverlayHQVCalcZoomHeight (VIAPtr pVia, unsigned long srcHeight,unsigned long dstHeight, - unsigned long * lpzoomCtl, unsigned long * lpminiCtl, unsigned long * lpHQVfilterCtl, unsigned long * lpHQVminiCtl,unsigned long * lpHQVzoomflag); -unsigned long viaOverlayGetSrcStartAddress (VIAPtr pVia, unsigned long dwVideoFlag,RECTL rSrc,RECTL rDest, unsigned long dwSrcPitch,LPDDPIXELFORMAT lpDPF,unsigned long * lpHQVoffset ); -void viaOverlayGetDisplayCount(VIAPtr pVIa, unsigned long dwVideoFlag,LPDDPIXELFORMAT lpDPF,unsigned long dwSrcWidth,unsigned long * lpDisplayCountW); -unsigned long viaOverlayHQVCalcZoomWidth(VIAPtr pVia, unsigned long dwVideoFlag, unsigned long srcWidth , unsigned long dstWidth, - unsigned long * lpzoomCtl, unsigned long * lpminiCtl, unsigned long * lpHQVfilterCtl, unsigned long * lpHQVminiCtl,unsigned long * lpHQVzoomflag); -void viaOverlayGetV1Format(VIAPtr pVia, unsigned long dwVideoFlag,LPDDPIXELFORMAT lpDPF, unsigned long * lpdwVidCtl,unsigned long * lpdwHQVCtl ); -void viaOverlayGetV3Format(VIAPtr pVia, unsigned long dwVideoFlag,LPDDPIXELFORMAT lpDPF, unsigned long * lpdwVidCtl,unsigned long * lpdwHQVCtl ); + +BOOL viaOverlayGetV1V3Format(VIAPtr pVia, int vport, + unsigned long videoFlag, LPDDPIXELFORMAT pPF, + unsigned long * pVidCtl, unsigned long * pHQVCtl); + +unsigned long viaOverlayGetSrcStartAddress(VIAPtr pVia, unsigned long videoFlag, + RECTL rSrc, RECTL rDest, unsigned long srcPitch, + LPDDPIXELFORMAT pPF,unsigned long * pHQVoffset); + +unsigned long viaOverlayHQVCalcZoomWidth(VIAPtr pVia, + unsigned long videoFlag, + unsigned long srcWidth, + unsigned long dstWidth, + unsigned long * pZoomCtl, + unsigned long * pMiniCtl, + unsigned long * pHQVfilterCtl, + unsigned long * pHQVminiCtl, + unsigned long * lpHQVzoomflag); + +unsigned long viaOverlayHQVCalcZoomHeight(VIAPtr pVia, + unsigned long srcHeight, + unsigned long dstHeight, + unsigned long * pZoomCtl, + unsigned long * pMiniCtl, + unsigned long * pHQVfilterCtl, + unsigned long * pHQVminiCtl, + unsigned long * pHQVzoomflag); + +void viaOverlayGetDisplayCount(VIAPtr pVia, unsigned long videoFlag, LPDDPIXELFORMAT pPF, + unsigned long srcWidth, unsigned long * pDisplayCountW); void viaCalculateVideoColor(VIAPtr pVia, int hue, int saturation, - int brightness, int contrast,Bool reset, - CARD32 *col1,CARD32 *col2); + int brightness, int contrast,Bool reset, + CARD32 *col1,CARD32 *col2); @@ -428,26 +391,6 @@ void VIAFreeLinear(VIAMemPtr); unsigned long VIAAllocLinear(VIAMemPtr, ScrnInfoPtr, unsigned long); void VIAInitLinear(ScreenPtr pScreen); -/* In via_tuner.c */ -void ViaTunerStandard(ViaTunerPtr, int); -void ViaTunerBrightness(ViaTunerPtr, int); -void ViaTunerContrast(ViaTunerPtr, int); -void ViaTunerHue(ViaTunerPtr, int); -void ViaTunerLuminance(ViaTunerPtr, int); -void ViaTunerSaturation(ViaTunerPtr, int); -void ViaTunerInput(ViaTunerPtr, int); -#define MODE_TV 0 -#define MODE_SVIDEO 1 -#define MODE_COMPOSITE 2 - -void ViaTunerChannel(ViaTunerPtr, int, int); -void ViaAudioSelect(ScrnInfoPtr pScrn, int tuner); -void ViaAudioInit(VIAPtr pVia); -void ViaAudioMode(VIAPtr pVia, int mode); -void ViaAudioMute(VIAPtr pVia, int mute); -void ViaTunerProbe(ScrnInfoPtr pScrn); -void ViaTunerDestroy(ScrnInfoPtr pScrn); - /* In via_xwmc.c */ #ifdef XF86DRI @@ -467,5 +410,7 @@ int viaXvMCInterceptXvGetAttribute(ScrnInfoPtr pScrn, Atom attribute, #endif +/* via_i2c.c */ +void ViaI2CInit(ScrnInfoPtr pScrn); #endif /* _VIA_DRIVER_H_ */ diff --git a/src/via_i2c.c b/src/via_i2c.c index 3474df2..571e34c 100644 --- a/src/via_i2c.c +++ b/src/via_i2c.c @@ -1,5 +1,5 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_i2c.c,v 1.4 2003/12/31 05:42:05 dawes Exp $ */ /* + * Copyright 2004 The Unichrome Project [unichrome.sf.net] * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. * @@ -22,30 +22,18 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ - - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "xf86_ansic.h" -#include "compiler.h" - -#include "xf86Pci.h" -#include "xf86PciInfo.h" - -#include "vgaHW.h" - +/* + * Implements three i2c busses through registers SR26, SR2c and SR31 + */ #include "via_driver.h" #include "via_vgahw.h" -/* - * DDC2 support requires DDC_SDA_MASK and DDC_SCL_MASK - */ -#define DDC_SDA_READ_MASK 0x04 -#define DDC_SCL_READ_MASK 0x08 -#define DDC_SDA_WRITE_MASK 0x10 -#define DDC_SCL_WRITE_MASK 0x20 +#define SDA_READ 0x04 +#define SCL_READ 0x08 +#define SDA_WRITE 0x10 +#define SCL_WRITE 0x20 -/* +/* * * CRT I2C * @@ -54,32 +42,31 @@ * */ static void -VIAI2C1PutBits(I2CBusPtr Bus, int clock, int data) +ViaI2C1PutBits(I2CBusPtr Bus, int clock, int data) { vgaHWPtr hwp = VGAHWPTR(xf86Screens[Bus->scrnIndex]); - CARD8 value = 0x01; /* Enable DDC */ + CARD8 value = 0x01; /* Enable */ if (clock) - value |= DDC_SCL_WRITE_MASK; + value |= SCL_WRITE; if (data) - value |= DDC_SDA_WRITE_MASK; + value |= SDA_WRITE; - ViaSeqMask(hwp, 0x26, value, - 0x01 | DDC_SCL_WRITE_MASK | DDC_SDA_WRITE_MASK); + ViaSeqMask(hwp, 0x26, value, 0x01 | SCL_WRITE | SDA_WRITE); } /* * */ static void -VIAI2C1GetBits(I2CBusPtr Bus, int *clock, int *data) +ViaI2C1GetBits(I2CBusPtr Bus, int *clock, int *data) { vgaHWPtr hwp = VGAHWPTR(xf86Screens[Bus->scrnIndex]); CARD8 value = hwp->readSeq(hwp, 0x26); - *clock = (value & DDC_SCL_READ_MASK) != 0; - *data = (value & DDC_SDA_READ_MASK) != 0; + *clock = (value & SCL_READ) != 0; + *data = (value & SDA_READ) != 0; } /* @@ -97,8 +84,8 @@ ViaI2CBus1Init(int scrnIndex) pI2CBus->BusName = "I2C bus 1"; pI2CBus->scrnIndex = scrnIndex; - pI2CBus->I2CPutBits = VIAI2C1PutBits; - pI2CBus->I2CGetBits = VIAI2C1GetBits; + pI2CBus->I2CPutBits = ViaI2C1PutBits; + pI2CBus->I2CGetBits = ViaI2C1GetBits; if (!xf86I2CBusInit(pI2CBus)) { xf86DestroyI2CBusRec(pI2CBus, TRUE, FALSE); @@ -117,32 +104,31 @@ ViaI2CBus1Init(int scrnIndex) * */ static void -VIAI2C2PutBits(I2CBusPtr Bus, int clock, int data) +ViaI2C2PutBits(I2CBusPtr Bus, int clock, int data) { vgaHWPtr hwp = VGAHWPTR(xf86Screens[Bus->scrnIndex]); - CARD8 value = 0x01; /* Enable DDC */ + CARD8 value = 0x01; /* Enable */ if (clock) - value |= DDC_SCL_WRITE_MASK; + value |= SCL_WRITE; if (data) - value |= DDC_SDA_WRITE_MASK; + value |= SDA_WRITE; - ViaSeqMask(hwp, 0x31, value, - 0x01 | DDC_SCL_WRITE_MASK | DDC_SDA_WRITE_MASK); + ViaSeqMask(hwp, 0x31, value, 0x01 | SCL_WRITE | SDA_WRITE); } /* * */ static void -VIAI2C2GetBits(I2CBusPtr Bus, int *clock, int *data) +ViaI2C2GetBits(I2CBusPtr Bus, int *clock, int *data) { vgaHWPtr hwp = VGAHWPTR(xf86Screens[Bus->scrnIndex]); CARD8 value = hwp->readSeq(hwp, 0x31); - *clock = (value & DDC_SCL_READ_MASK) != 0; - *data = (value & DDC_SDA_READ_MASK) != 0; + *clock = (value & SCL_READ) != 0; + *data = (value & SDA_READ) != 0; } /* @@ -160,8 +146,8 @@ ViaI2CBus2Init(int scrnIndex) pI2CBus->BusName = "I2C bus 2"; pI2CBus->scrnIndex = scrnIndex; - pI2CBus->I2CPutBits = VIAI2C2PutBits; - pI2CBus->I2CGetBits = VIAI2C2GetBits; + pI2CBus->I2CPutBits = ViaI2C2PutBits; + pI2CBus->I2CGetBits = ViaI2C2GetBits; if (!xf86I2CBusInit(pI2CBus)) { xf86DestroyI2CBusRec(pI2CBus, TRUE, FALSE); @@ -172,489 +158,230 @@ ViaI2CBus2Init(int scrnIndex) } /* - * - * If we ever get some life in the gpioi2c code, work it into - * xf86I2C, here. + * A third I2C bus implemented by a few IO pins. + * Requires higher level functions to be used properly. + * Former via_gpioi2c. * */ /* * */ -static I2CBusPtr -ViaI2CBus3Init(int scrnIndex) +static Bool +ViaI2C3Start(I2CBusPtr b, int timeout) { - DEBUG(xf86DrvMsg(scrnIndex, X_INFO, "ViaI2CBus3Init\n")); + vgaHWPtr hwp = VGAHWPTR(xf86Screens[b->scrnIndex]); -#if 0 - { - I2CBusPtr pI2CBus = xf86CreateI2CBusRec(); - - if (!pI2CBus) - return NULL; - - pI2CBus->BusName = "I2C bus 3"; - pI2CBus->scrnIndex = scrnIndex; - pI2CBus->I2CPutBits = VIAI2C3PutBits; - pI2CBus->I2CGetBits = VIAI2C3GetBits; - - if (!xf86I2CBusInit(pI2CBus)) { - xf86DestroyI2CBusRec(pI2CBus, TRUE, FALSE); - return NULL; - } - - return pI2CBus; - } -#else - xf86DrvMsg(scrnIndex, X_INFO, "Warning: Third I2C Bus not" - " implemented.\n"); + ViaSeqMask(hwp, 0x2C, 0xF0, 0xF0); + b->I2CUDelay(b, b->RiseFallTime); - return NULL; -#endif + ViaSeqMask(hwp, 0x2C, 0x00, 0x10); + b->I2CUDelay(b, b->HoldTime); + ViaSeqMask(hwp, 0x2C, 0x00, 0x20); + b->I2CUDelay(b, b->HoldTime); + + return TRUE; } /* * - * Ye Olde GPIOI2C code. -evil- - * */ +static Bool +ViaI2C3Address(I2CDevPtr d, I2CSlaveAddr addr) +{ + I2CBusPtr b = d->pI2CBus; -#define VIA_GPIOI2C_PORT 0x2C - -#define GPIOI2C_MASKD 0xC0 -#define GPIOI2C_SCL_MASK 0x80 -#define GPIOI2C_SCL_WRITE 0x80 -#define GPIOI2C_SCL_READ 0x80 -#define GPIOI2C_SDA_MASK 0x40 -#define GPIOI2C_SDA_WRITE 0x40 -#define GPIOI2C_SDA_READ 0x00 /* wouldnt this be 0x40? */ - -#define I2C_SDA_SCL_MASK 0x30 -#define I2C_SDA_SCL 0x30 -#define I2C_OUTPUT_CLOCK 0x20 -#define I2C_OUTPUT_DATA 0x10 -#define I2C_INPUT_CLOCK 0x08 -#define I2C_INPUT_DATA 0x04 - -#define READ_MAX_RETRIES 20 -#define WRITE_MAX_RETRIES 20 + if (b->I2CStart(d->pI2CBus, d->StartTimeout)) { + if (b->I2CPutByte(d, addr & 0xFF)) { + if ((addr & 0xF8) != 0xF0 && + (addr & 0xFE) != 0x00) + return TRUE; -static void -ViaGpioI2CInit(GpioI2cPtr pDev, vgaHWPtr hwp, - void (*Delay)(I2CBusPtr pBus, int usec)) -{ - DEBUG(xf86DrvMsg(hwp->pScrn->scrnIndex, X_INFO, "ViaGpioI2cInit\n")); - - pDev->scrnIndex = hwp->pScrn->scrnIndex; - pDev->hwp = hwp; - pDev->RiseFallTime = 5; - pDev->StartTimeout = 5; - pDev->BitTimeout = 5; - pDev->ByteTimeout = 5; - pDev->HoldTimeout = 5; - pDev->Delay = Delay; -} + if (b->I2CPutByte(d, (addr >> 8) & 0xFF)) + return TRUE; + } -void -VIAGPIOI2C_Initial(GpioI2cPtr pDev, CARD8 Slave) -{ - DEBUG(xf86DrvMsg(pDev->scrnIndex, X_INFO, "GPIOI2C_Initial\n")); - - if (Slave == 0xA0 || Slave == 0xA2) { - pDev->RiseFallTime = 40; - pDev->StartTimeout = 550; - pDev->ByteTimeout = 2200; - } else { - pDev->RiseFallTime = 5; - pDev->StartTimeout = 5; - pDev->ByteTimeout = 5; + b->I2CStop(d); } - pDev->Address = Slave; + return FALSE; } /* * */ static void -ViaGpioI2c_Release(GpioI2cPtr pDev) +ViaI2C3Stop(I2CDevPtr d) { - ViaSeqMask(pDev->hwp, VIA_GPIOI2C_PORT, 0x00, GPIOI2C_MASKD); -} + I2CBusPtr b = d->pI2CBus; + vgaHWPtr hwp = VGAHWPTR(xf86Screens[b->scrnIndex]); -/* - * - */ -static void -ViaGpioI2c_SCLWrite(GpioI2cPtr pDev, CARD8 Data) -{ - if (Data) - ViaSeqMask(pDev->hwp, VIA_GPIOI2C_PORT, - GPIOI2C_SCL_WRITE | I2C_OUTPUT_CLOCK, - GPIOI2C_SCL_MASK | I2C_OUTPUT_CLOCK); - else - ViaSeqMask(pDev->hwp, VIA_GPIOI2C_PORT, GPIOI2C_SCL_WRITE, - GPIOI2C_SCL_MASK | I2C_OUTPUT_CLOCK); -} + ViaSeqMask(hwp, 0x2C, 0xC0, 0xF0); + b->I2CUDelay(b, b->RiseFallTime); -/* - * - */ -#ifdef UNUSED -static void -ViaGpioI2c_SCLRead(GpioI2cPtr pDev) -{ - ViaSeqMask(pDev->hwp, VIA_GPIOI2C_PORT, GPIOI2C_SCL_READ, GPIOI2C_SCL_MASK); -} -#endif + ViaSeqMask(hwp, 0x2C, 0x20, 0x20); + b->I2CUDelay(b, b->HoldTime); + + ViaSeqMask(hwp, 0x2C, 0x10, 0x10); + b->I2CUDelay(b, b->HoldTime); -/* - * - */ -static void -ViaGpioI2c_SDAWrite(GpioI2cPtr pDev, CARD8 Data) -{ - if (Data) - ViaSeqMask(pDev->hwp, VIA_GPIOI2C_PORT, - GPIOI2C_SDA_WRITE | I2C_OUTPUT_DATA, - GPIOI2C_SDA_MASK | I2C_OUTPUT_DATA); - else - ViaSeqMask(pDev->hwp, VIA_GPIOI2C_PORT, GPIOI2C_SDA_WRITE, - GPIOI2C_SDA_MASK | I2C_OUTPUT_DATA); + ViaSeqMask(hwp, 0x2C, 0x00, 0x20); + b->I2CUDelay(b, b->HoldTime); } /* - * GGPIOI2C_SCL_READ ??? + * */ static void -ViaGpioI2c_SDARead(GpioI2cPtr pDev) +ViaI2C3PutBit(I2CBusPtr b, Bool sda, int timeout) { - ViaSeqMask(pDev->hwp, VIA_GPIOI2C_PORT, GPIOI2C_SCL_READ, GPIOI2C_SDA_MASK); -} + vgaHWPtr hwp = VGAHWPTR(xf86Screens[b->scrnIndex]); -/* Set SCL */ -static void -HWGPIOI2C_SetSCL(GpioI2cPtr pDev, CARD8 flag) -{ - ViaGpioI2c_SCLWrite(pDev, flag); - if (flag) - pDev->Delay(NULL, pDev->RiseFallTime); - pDev->Delay(NULL, pDev->RiseFallTime); -} - -/* Set SDA */ -static void -HWGPIOI2C_SetSDA(GpioI2cPtr pDev, CARD8 flag) -{ - ViaGpioI2c_SDAWrite(pDev, flag); - pDev->Delay(NULL, pDev->RiseFallTime); -} - -/* Get SDA */ -static CARD8 -HWGPIOI2C_GetSDA(GpioI2cPtr pDev) -{ - vgaHWPtr hwp = pDev->hwp; - - if (hwp->readSeq(hwp, 0x2C) & I2C_INPUT_DATA) - return 1; + if (sda) + ViaSeqMask(hwp, 0x2C, 0x50, 0x50); else - return 0; -} + ViaSeqMask(hwp, 0x2C, 0x40, 0x50); + b->I2CUDelay(b, b->RiseFallTime/5); -/* START Condition */ -static void -GPIOI2C_START(GpioI2cPtr pDev) -{ - HWGPIOI2C_SetSDA(pDev, 1); - HWGPIOI2C_SetSCL(pDev, 1); - pDev->Delay(NULL, pDev->StartTimeout); - HWGPIOI2C_SetSDA(pDev, 0); - HWGPIOI2C_SetSCL(pDev, 0); -} - -/* STOP Condition */ -static void -GPIOI2C_STOP(GpioI2cPtr pDev) -{ - HWGPIOI2C_SetSDA(pDev, 0); - HWGPIOI2C_SetSCL(pDev, 1); - HWGPIOI2C_SetSDA(pDev, 1); - ViaGpioI2c_Release(pDev); - /* to make the differentiation of next START condition */ - pDev->Delay(NULL, pDev->RiseFallTime); -} - -/* Check ACK */ -static Bool -GPIOI2C_ACKNOWLEDGE(GpioI2cPtr pDev) -{ - CARD8 Status; - - ViaGpioI2c_SDARead(pDev); - pDev->Delay(NULL, pDev->RiseFallTime); - HWGPIOI2C_SetSCL(pDev, 1); - Status = HWGPIOI2C_GetSDA(pDev); - /* eh? SDAWrite before writing SCL? */ - ViaGpioI2c_SDAWrite(pDev, Status); - HWGPIOI2C_SetSCL(pDev, 0); - pDev->Delay(NULL, pDev->RiseFallTime); - - if(Status) - return FALSE; - else - return TRUE; -} - -/* Send ACK */ -static Bool -GPIOI2C_SENDACKNOWLEDGE(GpioI2cPtr pDev) -{ - HWGPIOI2C_SetSDA(pDev, 0); - HWGPIOI2C_SetSCL(pDev, 1); - HWGPIOI2C_SetSCL(pDev, 0); - pDev->Delay(NULL, pDev->RiseFallTime); - - return TRUE; -} + ViaSeqMask(hwp, 0x2C, 0xA0, 0xA0); + b->I2CUDelay(b, b->HoldTime); + b->I2CUDelay(b, timeout); -/* Send NACK */ -static Bool -GPIOI2C_SENDNACKNOWLEDGE(GpioI2cPtr pDev) -{ - HWGPIOI2C_SetSDA(pDev, 1); - HWGPIOI2C_SetSCL(pDev, 1); - HWGPIOI2C_SetSCL(pDev, 0); - pDev->Delay(NULL, pDev->RiseFallTime); - - return TRUE; + ViaSeqMask(hwp, 0x2C, 0x80, 0xA0); + b->I2CUDelay(b, b->RiseFallTime/5); } -static Bool -GPIOI2C_WriteBit(GpioI2cPtr pDev, int sda, int timeout) -{ - Bool ret = TRUE; - - HWGPIOI2C_SetSDA(pDev, sda); - pDev->Delay(NULL, pDev->RiseFallTime/5); - HWGPIOI2C_SetSCL(pDev, 1); - pDev->Delay(NULL, pDev->HoldTimeout); - pDev->Delay(NULL, timeout); - HWGPIOI2C_SetSCL(pDev, 0); - pDev->Delay(NULL, pDev->RiseFallTime/5); - - return ret; -} - -/* Write Data(Bit by Bit) to I2C */ -static Bool -GPIOI2C_WriteData(GpioI2cPtr pDev, CARD8 Data) +/* + * + */ +static Bool +ViaI2C3PutByte(I2CDevPtr d, I2CByte data) { + I2CBusPtr b = d->pI2CBus; + vgaHWPtr hwp = VGAHWPTR(xf86Screens[b->scrnIndex]); + Bool ret; int i; - if (!GPIOI2C_WriteBit(pDev, (Data >> 7) & 1, pDev->ByteTimeout)) - return FALSE; - - for (i = 6; i >= 0; i--) - if (!GPIOI2C_WriteBit(pDev, (Data >> i) & 1, pDev->BitTimeout)) - return FALSE; + for (i = 7; i >= 0; i--) + ViaI2C3PutBit(b, (data >> i) & 0x01, b->BitTimeout); - return GPIOI2C_ACKNOWLEDGE(pDev); -} + /* raise first to avoid false positives */ + ViaSeqMask(hwp, 0x2C, 0x50, 0x50); + ViaSeqMask(hwp, 0x2C, 0x00, 0x40); + b->I2CUDelay(b, b->RiseFallTime); + ViaSeqMask(hwp, 0x2C, 0xA0, 0xA0); -static Bool -GPIOI2C_ReadBit(GpioI2cPtr pDev, int *psda, int timeout) -{ - Bool ret = TRUE; + if (hwp->readSeq(hwp, 0x2C) & 0x04) + ret = FALSE; + else + ret = TRUE; - ViaGpioI2c_SDARead(pDev); - pDev->Delay(NULL, pDev->RiseFallTime/5); - HWGPIOI2C_SetSCL(pDev, 1); - pDev->Delay(NULL, pDev->HoldTimeout); - pDev->Delay(NULL, timeout); - *psda = HWGPIOI2C_GetSDA(pDev); - HWGPIOI2C_SetSCL(pDev, 0); - pDev->Delay(NULL, pDev->RiseFallTime/5); + ViaSeqMask(hwp, 0x2C, 0x80, 0xA0); + b->I2CUDelay(b, b->RiseFallTime); return ret; } -/* Read Data(Bit by Bit) from I2C */ -static CARD8 -GPIOI2C_ReadData(GpioI2cPtr pDev) -{ - int i, sda; - CARD8 data; - - if(!GPIOI2C_ReadBit(pDev, &sda, pDev->ByteTimeout)) - return 0; - - data = (sda > 0) << 7; - for (i = 6; i >= 0; i--) - if (!GPIOI2C_ReadBit(pDev, &sda, pDev->BitTimeout)) - return 0; - else - data |= (sda > 0) << i; - - return data; -} - -/* Write Data(one Byte) to Desired Device on I2C */ -Bool -VIAGPIOI2C_Write(GpioI2cPtr pDev, CARD8 SubAddress, CARD8 Data) +/* + * + */ +static Bool +ViaI2C3GetBit(I2CBusPtr b, int timeout) { - int Retry; - Bool Done = FALSE; - - DEBUG(xf86DrvMsg(pDev->scrnIndex, X_INFO, "VIAGPIOI2C_Write\n")); - - for(Retry = 1; Retry <= WRITE_MAX_RETRIES; Retry++) - { - GPIOI2C_START(pDev); + vgaHWPtr hwp = VGAHWPTR(xf86Screens[b->scrnIndex]); + Bool ret; - if(!GPIOI2C_WriteData(pDev, pDev->Address)) { - - GPIOI2C_STOP(pDev); - continue; - } - if(!GPIOI2C_WriteData(pDev, (CARD8)(SubAddress))) { - - GPIOI2C_STOP(pDev); - continue; - } + ViaSeqMask(hwp, 0x2C, 0x00, 0x40); + b->I2CUDelay(b, b->RiseFallTime/5); - if(!GPIOI2C_WriteData(pDev, Data)) { + ViaSeqMask(hwp, 0x2C, 0xA0, 0xA0); - GPIOI2C_STOP(pDev); - continue; - } - Done = TRUE; - break; - } + if (hwp->readSeq(hwp, 0x2C) & 0x04) + ret = TRUE; + else + ret = FALSE; - GPIOI2C_STOP(pDev); + ViaSeqMask(hwp, 0x2C, 0x80, 0xA0); + b->I2CUDelay(b, b->RiseFallTime/5); - return Done; + return ret; } -/* Read Data from Desired Device on I2C */ -Bool -VIAGPIOI2C_Read(GpioI2cPtr pDev, CARD8 SubAddress, CARD8 *Buffer, int BufferLen) +/* + * + */ +static Bool +ViaI2C3GetByte(I2CDevPtr d, I2CByte *data, Bool last) { - int i, Retry; - - DEBUG(xf86DrvMsg(pDev->scrnIndex, X_INFO, "VIAGPIOI2C_Read\n")); - - for(Retry = 1; Retry <= READ_MAX_RETRIES; Retry++) - { - GPIOI2C_START(pDev); - if(!GPIOI2C_WriteData(pDev, pDev->Address & 0xFE)) { - - GPIOI2C_STOP(pDev); - continue; - } - if(!GPIOI2C_WriteData(pDev, (CARD8)(SubAddress))) { - - GPIOI2C_STOP(pDev); - continue; - } + I2CBusPtr b = d->pI2CBus; + vgaHWPtr hwp = VGAHWPTR(xf86Screens[b->scrnIndex]); + int i; - break; - } + *data = 0x00; - if (Retry > READ_MAX_RETRIES) - return FALSE; + for (i = 7; i >= 0; i--) + if (ViaI2C3GetBit(b, b->BitTimeout)) + *data |= 0x01 << i; - for(Retry = 1; Retry <= READ_MAX_RETRIES; Retry++) - { - GPIOI2C_START(pDev); - if(!GPIOI2C_WriteData(pDev, pDev->Address | 0x01)) { + if (last) /* send NACK */ + ViaSeqMask(hwp, 0x2C, 0x50, 0x50); + else /* send ACK */ + ViaSeqMask(hwp, 0x2C, 0x40, 0x50); - GPIOI2C_STOP(pDev); - continue; - } - for(i = 0; i < BufferLen; i++) { - - *Buffer = GPIOI2C_ReadData(pDev); - Buffer ++; - if(BufferLen == 1) - /*GPIOI2C_SENDACKNOWLEDGE(pDev);*/ /* send ACK for normal operation */ - GPIOI2C_SENDNACKNOWLEDGE(pDev); /* send NACK for VT3191/VT3192 only */ - else if(i < BufferLen - 1) - GPIOI2C_SENDACKNOWLEDGE(pDev); /* send ACK */ - else - GPIOI2C_SENDNACKNOWLEDGE(pDev); /* send NACK */ - } - GPIOI2C_STOP(pDev); - break; - } + ViaSeqMask(hwp, 0x2C, 0xA0, 0xA0); + b->I2CUDelay(b, b->HoldTime); + + ViaSeqMask(hwp, 0x2C, 0x80, 0xA0); - if (Retry > READ_MAX_RETRIES) - return FALSE; - else - return TRUE; + return TRUE; } -/* Read Data(one Byte) from Desired Device on I2C */ -Bool -VIAGPIOI2C_ReadByte(GpioI2cPtr pDev, CARD8 SubAddress, CARD8 *Buffer) +/* + * + */ +static I2CBusPtr +ViaI2CBus3Init(int scrnIndex) { - int Retry; - - DEBUG(xf86DrvMsg(pDev->scrnIndex, X_INFO, "VIAGPIOI2C_ReadByte\n")); - - for(Retry = 1; Retry <= READ_MAX_RETRIES; Retry++) - { - GPIOI2C_START(pDev); - if(!GPIOI2C_WriteData(pDev, pDev->Address & 0xFE)) { - - GPIOI2C_STOP(pDev); - continue; - } - if(!GPIOI2C_WriteData(pDev, (CARD8)(SubAddress))) { - - GPIOI2C_STOP(pDev); - continue; - } - - break; - } - - if (Retry > READ_MAX_RETRIES) - return FALSE; - - for(Retry = 1; Retry <= READ_MAX_RETRIES; Retry++) { - - GPIOI2C_START(pDev); - - if(!GPIOI2C_WriteData(pDev, pDev->Address | 0x01)) { - - GPIOI2C_STOP(pDev); - continue; - } - - *Buffer = GPIOI2C_ReadData(pDev); - - GPIOI2C_STOP(pDev); - break; + I2CBusPtr pI2CBus = xf86CreateI2CBusRec(); + + DEBUG(xf86DrvMsg(scrnIndex, X_INFO, "ViaI2CBus3Init\n")); + + if (!pI2CBus) + return NULL; + + pI2CBus->BusName = "I2C bus 3"; + pI2CBus->scrnIndex = scrnIndex; + pI2CBus->I2CAddress = ViaI2C3Address; + pI2CBus->I2CStart = ViaI2C3Start; + pI2CBus->I2CStop = ViaI2C3Stop; + pI2CBus->I2CPutByte = ViaI2C3PutByte; + pI2CBus->I2CGetByte = ViaI2C3GetByte; + + if (!xf86I2CBusInit(pI2CBus)) { + xf86DestroyI2CBusRec(pI2CBus, TRUE, FALSE); + return NULL; } - - if (Retry > READ_MAX_RETRIES) - return FALSE; - else - return TRUE; + + return pI2CBus; } +#ifdef HAVE_DEBUG /* * */ -Bool -ViaGpioI2c_Probe(GpioI2cPtr pDev, CARD8 Address) +static void +ViaI2CScan(I2CBusPtr Bus) { - DEBUG(xf86DrvMsg(pDev->scrnIndex, X_INFO, "VIAGPIOI2C_Probe\n")); - - GPIOI2C_START(pDev); - return GPIOI2C_WriteData(pDev, Address); + CARD8 i; + + xf86DrvMsg(Bus->scrnIndex, X_INFO, "ViaI2CScan: Scanning %s\n", + Bus->BusName); + + for (i = 0x10; i < 0xF0; i += 2) + if (xf86I2CProbeAddress(Bus, i)) + xf86DrvMsg(Bus->scrnIndex, X_PROBED, "Found slave on %s " + "- 0x%02X\n", Bus->BusName, i); } +#endif /* * @@ -662,16 +389,22 @@ ViaGpioI2c_Probe(GpioI2cPtr pDev, CARD8 Address) * */ void -VIAI2CInit(ScrnInfoPtr pScrn) +ViaI2CInit(ScrnInfoPtr pScrn) { VIAPtr pVia = VIAPTR(pScrn); - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAI2CInit\n")); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaI2CInit\n")); pVia->pI2CBus1 = ViaI2CBus1Init(pScrn->scrnIndex); pVia->pI2CBus2 = ViaI2CBus2Init(pScrn->scrnIndex); pVia->pI2CBus3 = ViaI2CBus3Init(pScrn->scrnIndex); - ViaGpioI2CInit(&(pVia->GpioI2c), VGAHWPTR(pScrn), - pVia->pI2CBus1->I2CUDelay); +#ifdef HAVE_DEBUG + if (pVia->I2CScan) { + if (pVia->pI2CBus2) + ViaI2CScan(pVia->pI2CBus2); + if (pVia->pI2CBus3) + ViaI2CScan(pVia->pI2CBus3); + } +#endif } diff --git a/src/via_id.c b/src/via_id.c index 0e71218..22fad69 100644 --- a/src/via_id.c +++ b/src/via_id.c @@ -1,5 +1,5 @@ /* - * Copyright 2004 The Unichrome Project [unichrome.sf.net] + * Copyright 2004-2005 The Unichrome Project [unichrome.sf.net] * * * Permission is hereby granted, free of charge, to any person obtaining a @@ -15,10 +15,10 @@ * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ @@ -36,35 +36,93 @@ * There's no reason for this to be known outside of via_id.o * Only a pointer to an single entry will ever be used outside. * - * The .tw trend is all too apparent and is bound to make anyone - * prejudist. This isn't just VIA alone. -- Luc. + */ +/* + * Known missing devices: + * cle266: + * Biostar M6VLQ Grand + * Biostar M6VLQ Pro + * PcChips M789CLU (with C3 onboard) + * PcChips M791G + * Soltek SL-B6A-F800 (C3 800Mhz onboard) + * Soltek SL-B6A-F1000 (Qbic IQ3601 | C3 1Ghz onboard) + * + loads of semi-embedded devices. + * + * km400: + * Abit VA-20: ? km400 vs km400a ? + * ECS KM400-M + * ECS KM400-M2 + * ECS KM400A-M2 + * PcChips M851G + * PcChips M851AG + * Soltek SL-B7C-FGR (Qbic EQ3704 | km400a) + * Soyo SY-K7VMP + * Soyo SY-K7VMP2 + * + * k8m800: + * Abit KV8-MAX3 + * Abit KV8 + * Biostar Ideq 210V (km400a) + * Biostar M7VIZ + * Chaintech MK8M800 + * ECS k8m800-m2 + * Epox EP-8KMM5I (km400a) + * MSI K8M Neo-V + * PcChips M861G + * Soltek SL-B9C-FGR (Qbic EQ3802-300P) + * Soltek SL-K8M800I-R + * + * pm800: + * Asrock P4VM8 + * Biostar Ideq 210M + * Biostar P4VMA-M + * Biostar P4M80-M7 (is this even a unichrome?) + * Chaintech MPM800 + * Gigabyte 8VM800M + * PcChips M955G + * PcChips M957G + * Soltek SL-PM800I + * Soltek SL-PM800I-R + * Soltek SL-PM800 + * Soyo SY-P4VM800 * */ struct ViaCardIdStruct ViaCardId[] = { /* CLE266 */ - {"ECS G320", VIA_CLE266, 0x1019, 0xB320, VIA_DEVICE_CRT | VIA_DEVICE_LCD, VIA_DEVICE_LCD}, - {"VIA EPIA M/MII/...", VIA_CLE266, 0x1106, 0x3122, VIA_DEVICE_CRT | VIA_DEVICE_TV, VIA_DEVICE_NONE}, + {"ECS G320", VIA_CLE266, 0x1019, 0xB320, VIA_DEVICE_CRT | VIA_DEVICE_LCD}, + {"VIA EPIA M/MII/...", VIA_CLE266, 0x1106, 0x3122, VIA_DEVICE_CRT | VIA_DEVICE_TV}, /* KM400 */ - {"Acer Aspire 135x", VIA_KM400, 0x1025, 0x0033, VIA_DEVICE_CRT | VIA_DEVICE_LCD | VIA_DEVICE_TV, VIA_DEVICE_LCD}, - {"Asustek A7V8X-MX", VIA_KM400, 0x1043, 0x80ED, VIA_DEVICE_CRT, VIA_DEVICE_NONE}, - {"Asustek A7V8X-MX SE", VIA_KM400, 0x1043, 0x8118, VIA_DEVICE_CRT, VIA_DEVICE_NONE}, - {"Soltek SL-75MIV2", VIA_KM400, 0x1106, 0x0000, VIA_DEVICE_CRT, VIA_DEVICE_NONE}, /* VIA/0x0000 -- soltek is .tw */ - {"Shuttle FX43", VIA_KM400, 0x1297, 0xF643, VIA_DEVICE_CRT | VIA_DEVICE_TV, VIA_DEVICE_NONE}, - {"Giga-byte 7VM400", VIA_KM400, 0x1458, 0xD000, VIA_DEVICE_CRT, VIA_DEVICE_NONE}, /* 7VM400M-RZ, GA-7VM400AMF */ - {"DFI KM400-MLV", VIA_KM400, 0x1462, 0x7061, VIA_DEVICE_CRT, VIA_DEVICE_NONE}, /* ??? MSI ??? */ - {"Averatec 322x", VIA_KM400, 0x14FF, 0x030D, VIA_DEVICE_CRT | VIA_DEVICE_LCD, VIA_DEVICE_LCD}, - {"Gericom Hummer Advance", VIA_KM400, 0x1584, 0x800A, VIA_DEVICE_CRT | VIA_DEVICE_LCD | VIA_DEVICE_TV, VIA_DEVICE_LCD}, - {"ASRock Inc. K7VM4", VIA_KM400, 0x1849, 0x7205, VIA_DEVICE_CRT, VIA_DEVICE_NONE}, - {"Soyo K7VME", VIA_KM400, 0xA723, 0x10FD, VIA_DEVICE_CRT, VIA_DEVICE_NONE}, + {"Acer Aspire 135x", VIA_KM400, 0x1025, 0x0033, VIA_DEVICE_CRT | VIA_DEVICE_LCD | VIA_DEVICE_TV}, + {"Asustek A7V8X-MX", VIA_KM400, 0x1043, 0x80ED, VIA_DEVICE_CRT}, + {"Asustek A7V8X-MX SE/A7V400-MX", VIA_KM400, 0x1043, 0x8118, VIA_DEVICE_CRT}, + {"Mitac 8375X", VIA_KM400, 0x1071, 0x8375, VIA_DEVICE_CRT | VIA_DEVICE_LCD | VIA_DEVICE_TV}, /* aka UMAX 585T */ + {"Soltek SL-75MIV2", VIA_KM400, 0x1106, 0x0000, VIA_DEVICE_CRT}, /* VIA/0x0000 */ + {"Biostar iDEQ 200V/Chaintech 7VIF4", VIA_KM400, 0x1106, 0x7205, VIA_DEVICE_CRT}, /* VIA/KM400 -- 2 distinct devices */ + {"Shuttle FX43", VIA_KM400, 0x1297, 0xF643, VIA_DEVICE_CRT | VIA_DEVICE_TV}, + {"Giga-byte 7VM400(A)M", VIA_KM400, 0x1458, 0xD000, VIA_DEVICE_CRT}, /* 7VM400M, GA-7VM400AM */ + {"MSI KM4(A)M-V", VIA_KM400, 0x1462, 0x7061, VIA_DEVICE_CRT}, /* aka "DFI KM400-MLV" */ + {"MSI KM4(A)M-L", VIA_KM400, 0x1462, 0x7348, VIA_DEVICE_CRT}, + {"Abit VA-10 (1)", VIA_KM400, 0x147B, 0x140B, VIA_DEVICE_CRT}, + {"Abit VA-10 (2)", VIA_KM400, 0x147B, 0x140C, VIA_DEVICE_CRT}, /* VA-10/VA-20 id difference is not confirmed */ + {"Averatec 322x", VIA_KM400, 0x14FF, 0x030D, VIA_DEVICE_CRT | VIA_DEVICE_LCD}, + {"Uniwill 755CI", VIA_KM400, 0x1584, 0x800A, VIA_DEVICE_CRT | VIA_DEVICE_LCD | VIA_DEVICE_TV}, /* aka "Gericom hummer advance", "Maxdata M-Book 1200X" */ + {"Epox EP-8KMM3I", VIA_KM400, 0x1695, 0x9023, VIA_DEVICE_CRT}, + {"ASRock Inc. K7VM2/3/4", VIA_KM400, 0x1849, 0x7205, VIA_DEVICE_CRT}, + {"Soyo K7VME", VIA_KM400, 0xA723, 0x10FD, VIA_DEVICE_CRT}, /* K8M800 */ - {"Acer Aspire 136x", VIA_K8M800, 0x1025, 0x006E, VIA_DEVICE_CRT | VIA_DEVICE_LCD | VIA_DEVICE_TV, VIA_DEVICE_LCD}, - {"Mitac 8399/Pogolinux Konabook 3100", VIA_K8M800, 0x1071, 0x8399, VIA_DEVICE_CRT | VIA_DEVICE_LCD | VIA_DEVICE_TV, VIA_DEVICE_LCD}, - {"Giga-byte GA-K8VM800M", VIA_K8M800, 0x1106, 0x3108, VIA_DEVICE_CRT, VIA_DEVICE_NONE}, /* VIA/K8M800 -- giga-byte is .tw */ - {"Shuttle FX83", VIA_K8M800, 0x1297, 0xF683, VIA_DEVICE_CRT | VIA_DEVICE_TV, VIA_DEVICE_NONE}, + {"Acer Aspire 136x", VIA_K8M800, 0x1025, 0x006E, VIA_DEVICE_CRT | VIA_DEVICE_LCD | VIA_DEVICE_TV}, + {"Mitac 8399", VIA_K8M800, 0x1071, 0x8399, VIA_DEVICE_CRT | VIA_DEVICE_LCD | VIA_DEVICE_TV}, /* aka "pogolinux konabook 3100" */ + {"DFI K8M800-MLVF", VIA_K8M800, 0x1106, 0x3108, VIA_DEVICE_CRT}, /* VIA/K8M800 -- ??? PciInfo Alignment issue ??? */ + {"Shuttle FX83", VIA_K8M800, 0x1297, 0xF683, VIA_DEVICE_CRT | VIA_DEVICE_TV}, + {"Sharp Actius AL27", VIA_K8M800, 0x13BD, 0x1044, VIA_DEVICE_CRT | VIA_DEVICE_LCD}, + {"Giga-byte GA-K8VM800M", VIA_K8M800, 0x1458, 0xD000, VIA_DEVICE_CRT}, + {"MSI K8MM-ILSR", VIA_K8M800, 0x1462, 0x7410, VIA_DEVICE_CRT}, + {"Biostar K8VGA-M", VIA_K8M800, 0x1565, 0x1203, VIA_DEVICE_CRT}, /* PM800 */ - {"Biostar P4VMA-M", VIA_PM800, 0x1565, 0x1202, VIA_DEVICE_CRT, VIA_DEVICE_NONE}, + {"Biostar P4VMA-M", VIA_PM800, 0x1565, 0x1202, VIA_DEVICE_CRT}, + {"ECS PM800-M2", VIA_PM800, 0x1106, 0x3118, VIA_DEVICE_CRT}, /* VIA/PM800 */ /* keep this */ - {NULL, VIA_UNKNOWN, 0x0000, 0x0000, VIA_DEVICE_NONE} + {NULL, VIA_UNKNOWN, 0x0000, 0x0000, VIA_DEVICE_NONE} }; /* @@ -102,6 +160,10 @@ ViaCheckCardId(ScrnInfoPtr pScrn) struct ViaCardIdStruct *Id; VIAPtr pVia = VIAPTR(pScrn); + if ((pVia->PciInfo->subsysVendor == pVia->PciInfo->vendor) && + (pVia->PciInfo->subsysCard == pVia->PciInfo->chipType)) + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Manufacturer plainly copied main PCI" + " ids to Subsystem/Card ids.\n"); for (Id = ViaCardId; Id->String; Id++) { if ((Id->Chip == pVia->Chipset) && diff --git a/src/via_id.h b/src/via_id.h index 75d7334..61ee771 100644 --- a/src/via_id.h +++ b/src/via_id.h @@ -1,5 +1,5 @@ /* - * Copyright 2004 The Unichrome Project [unichrome.sf.net] + * Copyright 2004-2005 The Unichrome Project [unichrome.sf.net] * * * Permission is hereby granted, free of charge, to any person obtaining a @@ -15,10 +15,10 @@ * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifndef _VIA_ID_H_ @@ -90,7 +90,6 @@ struct ViaCardIdStruct { CARD16 Vendor; /* PCI Card/Subsystem vendor id */ CARD16 Device; /* PCI Card/Subsystem device id */ CARD8 Outputs; /* ORed list of VIA_DEVICE_CRT, VIA_DEVICE_LCD, VIA_DEVICE_TV */ - CARD8 Force; /* See Outputs -- laptops need the LCD forced */ }; void ViaDoubleCheckCLE266Revision(ScrnInfoPtr pScrn); diff --git a/src/via_memory.c b/src/via_memory.c index 2062d7a..ded7a23 100644 --- a/src/via_memory.c +++ b/src/via_memory.c @@ -20,15 +20,12 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_memory.c,v 1.5 2004/01/29 03:13:25 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" #include "xf86fbman.h" -#include "via_compose.h" -#include "via_capture.h" #include "via.h" #ifdef XF86DRI #include "xf86drm.h" diff --git a/src/via_mode.c b/src/via_mode.c index 5938ade..5446b91 100644 --- a/src/via_mode.c +++ b/src/via_mode.c @@ -1,5 +1,5 @@ /* - * Copyright 2004 The Unichrome Project [unichrome.sf.net] + * Copyright 2004-2005 The Unichrome Project [unichrome.sf.net] * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. * @@ -31,7 +31,6 @@ */ #include "via_driver.h" -#include "via_refresh.h" #include "via_vgahw.h" #include "via_id.h" @@ -40,709 +39,343 @@ * */ #include "via_mode.h" -#include "via_tv2.h" -#include "via_tv3.h" -#include "via_vt1622a.h" - -/* plain and simple lookuptable for TV/PanelIndex selection */ -struct { - int Index; - int TVIndex; - int PanelIndex; - int X; - int Y; -} ViaResolutionTable[] = { - {VIA_RES_640X480, VIA_TVRES_640X480, VIA_PANEL6X4, 640, 480}, - {VIA_RES_800X600, VIA_TVRES_800X600, VIA_PANEL8X6, 800, 600}, - {VIA_RES_1024X768, VIA_TVRES_1024X768, VIA_PANEL10X7, 1024, 768}, - {VIA_RES_1152X864, VIA_TVRES_INVALID, VIA_PANEL_INVALID, 1152, 864}, - {VIA_RES_1280X1024, VIA_TVRES_INVALID, VIA_PANEL12X10, 1280, 1024}, - {VIA_RES_1600X1200, VIA_TVRES_INVALID, VIA_PANEL16X12, 1600, 1200}, - {VIA_RES_1440X1050, VIA_TVRES_INVALID, VIA_PANEL_INVALID, 1440, 1050}, - {VIA_RES_1280X768, VIA_TVRES_INVALID, VIA_PANEL12X7, 1280, 768}, - {VIA_RES_1280X960, VIA_TVRES_INVALID, VIA_PANEL_INVALID, 1280, 960}, - /* {VIA_RES_1920X1440, VIA_TVRES_INVALID, VIA_PANEL_INVALID, 1920, 1140}, */ - {VIA_RES_848X480, VIA_TVRES_848X480, VIA_PANEL_INVALID, 848, 480}, - {VIA_RES_1400X1050, VIA_TVRES_INVALID, VIA_PANEL14X10, 1400, 1050}, - {VIA_RES_720X480, VIA_TVRES_720X480, VIA_PANEL_INVALID, 720, 480}, - {VIA_RES_720X576, VIA_TVRES_720X576, VIA_PANEL_INVALID, 720, 576}, - {VIA_RES_1024X512, VIA_TVRES_INVALID, VIA_PANEL_INVALID, 1024, 512}, - {VIA_RES_856X480, VIA_TVRES_INVALID, VIA_PANEL_INVALID, 856, 480}, - {VIA_RES_1024X576, VIA_TVRES_INVALID, VIA_PANEL_INVALID, 1024, 576}, - {VIA_RES_INVALID, VIA_TVRES_INVALID, VIA_PANEL_INVALID, 0, 0} -}; -#ifdef HAVE_DEBUG /* - * Print the content of the I2C registers of a detected TV encoder + * + * TV specific code. * */ -static void -ViaPrintTVRegs(ScrnInfoPtr pScrn) -{ - VIAPtr pVia = VIAPTR(pScrn); - VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - int i; - CARD8 R_Buffer[1]; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaPrintTVRegs\n")); - - if (pBIOSInfo->TVUseGpioI2c) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Printing registers for GPIOI2C 0x%02X\n", - pVia->GpioI2c.Address); - - VIAGPIOI2C_Initial(&(pVia->GpioI2c), pBIOSInfo->TVI2CAddr); - - for (i = 0; i < 0xFF; i++) { - VIAGPIOI2C_Read(&(pVia->GpioI2c), i, R_Buffer, 1); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "TV%02X: 0x%02X\n", i, R_Buffer[0]); - } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "End of TV registers.\n"); - } else if (pBIOSInfo->TVI2CDev) { - CARD8 W_Buffer[1]; - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Printing registers for %s\n", - pBIOSInfo->TVI2CDev->DevName); - for (i = 0; i < 0xFF; i++) { - W_Buffer[0] = i; - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,1, R_Buffer,1); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "TV%02X: 0x%02X\n", i, R_Buffer[0]); - } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "End of TV registers.\n"); - } -} -#endif /* HAVE_DEBUG */ /* - * We currently only support a single TV encoder and only know the VT162x - * + * */ -void -VIATVDetect(ScrnInfoPtr pScrn) +static Bool +ViaTVDetect(ScrnInfoPtr pScrn) { VIAPtr pVia = VIAPTR(pScrn); VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - CARD8 W_Buffer[1]; - CARD8 R_Buffer[1]; DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIATVDetect\n")); - /* preset some pBIOSInfo TV related values */ + /* preset some pBIOSInfo TV related values -- move up */ pBIOSInfo->TVEncoder = VIA_NONETV; - pBIOSInfo->TVI2CAddr = 0x00; - pBIOSInfo->TVUseGpioI2c = FALSE; pBIOSInfo->TVI2CDev = NULL; + pBIOSInfo->TVSave = NULL; + pBIOSInfo->TVRestore = NULL; + pBIOSInfo->TVDACSense = NULL; + pBIOSInfo->TVModeValid = NULL; + pBIOSInfo->TVModeI2C = NULL; + pBIOSInfo->TVModeCrtc = NULL; + pBIOSInfo->TVPower = NULL; + + if (pVia->pI2CBus2 && xf86I2CProbeAddress(pVia->pI2CBus2, 0x40)) + pBIOSInfo->TVI2CDev = ViaVT162xDetect(pScrn, pVia->pI2CBus2, 0x40); + else if (pVia->pI2CBus3 && xf86I2CProbeAddress(pVia->pI2CBus3, 0x40)) + pBIOSInfo->TVI2CDev = ViaVT162xDetect(pScrn, pVia->pI2CBus3, 0x40); + + if (pBIOSInfo->TVI2CDev) + return TRUE; + return FALSE; +} - /* Check For TV2/TV3 */ - if (xf86I2CProbeAddress(pVia->pI2CBus2, 0x40)) { - pBIOSInfo->TVI2CDev = xf86CreateI2CDevRec(); - pBIOSInfo->TVI2CDev->DevName = "VT162x"; - pBIOSInfo->TVI2CDev->SlaveAddr = 0x40; - pBIOSInfo->TVI2CDev->pI2CBus = pVia->pI2CBus2; - - if (xf86I2CDevInit(pBIOSInfo->TVI2CDev)) { - W_Buffer[0] = 0x1B; - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,1, R_Buffer,1); - switch (R_Buffer[0]) { - case 2: - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected VIA Technologies VT1621 TV Encoder\n"); - pBIOSInfo->TVEncoder = VIA_VT1621; - pBIOSInfo->TVI2CAddr = 0x40; - break; - case 3: - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected VIA Technologies VT1622 TV Encoder\n"); - pBIOSInfo->TVEncoder = VIA_VT1622; - pBIOSInfo->TVI2CAddr = 0x40; - break; - case 16: - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected VIA Technologies VT1622A/VT1623 TV Encoder\n"); - pBIOSInfo->TVEncoder = VIA_VT1622A; - pBIOSInfo->TVI2CAddr = 0x40; - break; - default: - pBIOSInfo->TVEncoder = VIA_NONETV; - break; - } - } +/* + * + */ +static Bool +ViaTVInit(ScrnInfoPtr pScrn) +{ + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; - if (pBIOSInfo->TVEncoder == VIA_NONETV) { - xf86DestroyI2CDevRec(pBIOSInfo->TVI2CDev,TRUE); - pBIOSInfo->TVI2CDev = NULL; - } - } + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaTVInit\n")); - if (pBIOSInfo->TVEncoder == VIA_NONETV) { - VIAGPIOI2C_Initial(&(pVia->GpioI2c), 0x40); - if (VIAGPIOI2C_Read(&(pVia->GpioI2c), 0x1B, R_Buffer, 1)) { - switch (R_Buffer[0]) { - case 16: - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected VIA Technologies VT1622A/VT1623 TV Encoder (GPIOI2c)\n"); - pBIOSInfo->TVEncoder = VIA_VT1623; - pBIOSInfo->TVUseGpioI2c = TRUE; - pBIOSInfo->TVI2CAddr = 0x40; - break; - default: - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Unknown TVEncoder: %02X!\n", R_Buffer[0])); - break; - } - } + switch (pBIOSInfo->TVEncoder){ + case VIA_VT1621: + case VIA_VT1622: + case VIA_VT1623: + ViaVT162xInit(pScrn); + break; + default: + return FALSE; + break; } -#ifdef HAVE_DEBUG - /* superfluous check: prints only when TVI2CDev or TVUseGpioI2c */ - if (pVia->PrintTVRegs && (pBIOSInfo->TVEncoder != VIA_NONETV)) - ViaPrintTVRegs(pScrn); -#endif /* HAVE_DEBUG */ -} + if (!pBIOSInfo->TVSave || !pBIOSInfo->TVRestore || + !pBIOSInfo->TVDACSense || !pBIOSInfo->TVModeValid || + !pBIOSInfo->TVModeI2C || !pBIOSInfo->TVModeCrtc || + !pBIOSInfo->TVPower) { -/*=* - * - * CARD8 VIAGetActiveDisplay(VIABIOSInfoPtr, CARD8) - * - * - Get Active Display Device - * - * Return Type: CARD8 - * - * The Definition of Input Value: - * - * VIABIOSInfoPtr - * - * The Definition of Return Value: - * - * Bit[7] 2nd Path - * Bit[6] 1/0 MHS Enable/Disable - * Bit[5] 0 = Bypass Callback, 1 = Enable Callback - * Bit[4] 0 = Hot-Key Sequence Control (OEM Specific) - * Bit[3] LCD - * Bit[2] TV - * Bit[1] CRT - * Bit[0] DVI - *=*/ -CARD8 -VIAGetActiveDisplay(ScrnInfoPtr pScrn) -{ - vgaHWPtr hwp = VGAHWPTR(pScrn); - CARD8 tmp; + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ViaTVInit: TVEncoder was not " + "properly initialised."); - tmp = (hwp->readCrtc(hwp, 0x3E) >> 4); - tmp |= ((hwp->readCrtc(hwp, 0x3B) & 0x18) << 3); + xf86DestroyI2CDevRec(pBIOSInfo->TVI2CDev, TRUE); + pBIOSInfo->TVI2CDev = NULL; + pBIOSInfo->TVOutput = TVOUTPUT_NONE; + pBIOSInfo->TVEncoder = VIA_NONETV; + pBIOSInfo->TVI2CDev = NULL; + pBIOSInfo->TVSave = NULL; + pBIOSInfo->TVRestore = NULL; + pBIOSInfo->TVDACSense = NULL; + pBIOSInfo->TVModeValid = NULL; + pBIOSInfo->TVModeI2C = NULL; + pBIOSInfo->TVModeCrtc = NULL; + pBIOSInfo->TVPower = NULL; - return tmp; + return FALSE; + } + return TRUE; } -/* - * Detects if the type of connection attached to the VT162x TV encoder. - * Returns TRUE if anything is connected. - * - */ -static Bool -VIAVT162xDACDetect(ScrnInfoPtr pScrn) +void +ViaTVSave(ScrnInfoPtr pScrn) { - VIAPtr pVia = VIAPTR(pScrn); - VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - CARD8 save, sense; - CARD8 W_Buffer[2]; - CARD8 R_Buffer[1]; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAVT162xDACDetect\n")); - - if (pBIOSInfo->TVUseGpioI2c) { - /* when we finally get GPIOI2C sorted out, we can plainly remove this block */ - VIAGPIOI2C_Initial(&(pVia->GpioI2c), pBIOSInfo->TVI2CAddr); - VIAGPIOI2C_Read(&(pVia->GpioI2c), 0x0E, R_Buffer, 1); - save = R_Buffer[0]; - W_Buffer[0] = 0; - VIAGPIOI2C_Write(&(pVia->GpioI2c), 0x0E, W_Buffer[0]); - W_Buffer[0] = 0x80; - VIAGPIOI2C_Write(&(pVia->GpioI2c), 0x0E, W_Buffer[0]); - W_Buffer[0] = 0; - VIAGPIOI2C_Write(&(pVia->GpioI2c), 0x0E, W_Buffer[0]); - VIAGPIOI2C_Read(&(pVia->GpioI2c), 0x0F, R_Buffer, 1); - sense = R_Buffer[0] & 0x0F; - W_Buffer[0] = save; - VIAGPIOI2C_Write(&(pVia->GpioI2c), 0x0E, W_Buffer[0]); - } else { - W_Buffer[0] = 0x0E; - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,1, R_Buffer,1); - save = R_Buffer[0]; - W_Buffer[1] = 0; - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,2, NULL,0); - W_Buffer[1] = 0x80; - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,2, NULL,0); - W_Buffer[1] = 0; - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x0F; - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,1, R_Buffer,1); - sense = R_Buffer[0] & 0x0F; - W_Buffer[0] = 0x0E; - W_Buffer[1] = save; - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,2, NULL,0); - } + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; - if (pBIOSInfo->TVEncoder == VIA_VT1621) { - /* VT1621 only knows composite and s-video */ - switch (sense) { - case 0x00: - pBIOSInfo->TVOutput = TVOUTPUT_SC; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT162x: S-Video & Composite connected.\n"); - return TRUE; - case 0x01: - pBIOSInfo->TVOutput = TVOUTPUT_COMPOSITE; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT162x: Composite connected.\n"); - return TRUE; - case 0x02: - pBIOSInfo->TVOutput = TVOUTPUT_SVIDEO; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT162x: S-Video connected.\n"); - return TRUE; - case 0x03: - pBIOSInfo->TVOutput = TVOUTPUT_NONE; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT162x: Nothing connected.\n"); - return FALSE; - default: - pBIOSInfo->TVOutput = TVOUTPUT_NONE; - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "VT162x: Unknown cable combination: 0x0%2X.\n", - sense); - return FALSE; - } - } else { - /* VT1622, VT1622A and VT1623 know composite, s-video, RGB and YCBCR */ - switch (sense) { - case 0x00: /* DAC A,B,C,D */ - pBIOSInfo->TVOutput = TVOUTPUT_RGB; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT162x: RGB connected.\n"); - return TRUE; - case 0x01: /* DAC A,B,C */ - pBIOSInfo->TVOutput = TVOUTPUT_SC; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT162x: S-Video & Composite connected.\n"); - return TRUE; - case 0x07: /* DAC A */ - pBIOSInfo->TVOutput = TVOUTPUT_COMPOSITE; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT162x: Composite connected.\n"); - return TRUE; - case 0x08: /* DAC B,C,D */ - pBIOSInfo->TVOutput = TVOUTPUT_YCBCR; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT162x: YcBcR connected.\n"); - return TRUE; - case 0x09: /* DAC B,C */ - pBIOSInfo->TVOutput = TVOUTPUT_SVIDEO; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT162x: S-Video connected.\n"); - return TRUE; - case 0x0F: - pBIOSInfo->TVOutput = TVOUTPUT_NONE; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT162x: Nothing connected.\n"); - return FALSE; - default: - pBIOSInfo->TVOutput = TVOUTPUT_NONE; - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "VT162x: Unknown cable combination: 0x0%2X.\n", - sense); - return FALSE; - } - } + if (pBIOSInfo->TVSave) + pBIOSInfo->TVSave(pScrn); } -/*=* - * - * Bool VIASensorDVI(pBIOSInfo) - * - * - Sense DVI Connector - * - * Return Type: Bool - * - * The Definition of Input Value: - * - * VIABIOSInfoPtr - * - * The Definition of Return Value: - * - * DVI Attached - TRUE - * DVI Not Attached - FALSE - *=*/ -static Bool -VIASensorDVI(ScrnInfoPtr pScrn) +void +ViaTVRestore(ScrnInfoPtr pScrn) { - vgaHWPtr hwp = VGAHWPTR(pScrn); - VIAPtr pVia = VIAPTR(pScrn); - VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - CARD8 SlaveAddr, cr6c, cr93; - Bool ret = FALSE; - I2CDevPtr dev; - CARD8 W_Buffer[1]; - CARD8 R_Buffer[1]; + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIASensorDVI\n")); + if (pBIOSInfo->TVRestore) + pBIOSInfo->TVRestore(pScrn); +} - /* Enable DI0, DI1 */ - cr6c = hwp->readCrtc(hwp, 0x6C); - ViaCrtcMask(hwp, 0x6C, 0x21, 0x21); +static Bool +ViaTVDACSense(ScrnInfoPtr pScrn) +{ + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; - cr93 = hwp->readCrtc(hwp, 0x93); - /* check for CLE266 first!!! */ - if (CLE266_REV_IS_CX(pVia->ChipRev)) - hwp->writeCrtc(hwp, 0x93, 0xA3); - else - hwp->writeCrtc(hwp, 0x93, 0xBF); + if (pBIOSInfo->TVDACSense) + return pBIOSInfo->TVDACSense(pScrn); + return FALSE; +} - /* Enable LCD */ - VIAEnableLCD(pScrn); - - switch (pBIOSInfo->TMDS) { - case VIA_SIL164: - SlaveAddr = 0x70; - break; - case VIA_VT3192: - SlaveAddr = 0x10; - break; - default: - return ret; - break; - } +static void +ViaTVSetMode(ScrnInfoPtr pScrn) +{ + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; - if (xf86I2CProbeAddress(pVia->pI2CBus2, SlaveAddr)) { - dev = xf86CreateI2CDevRec(); - dev->DevName = "TMDS"; - dev->SlaveAddr = SlaveAddr; - dev->pI2CBus = pVia->pI2CBus2; - - if (xf86I2CDevInit(dev)) { - W_Buffer[0] = 0x09; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); - xf86DestroyI2CDevRec(dev,TRUE); - if (R_Buffer[0] & 0x04) - ret = TRUE; - } - else - xf86DestroyI2CDevRec(dev,TRUE); - } + if (pBIOSInfo->TVModeI2C) + pBIOSInfo->TVModeI2C(pScrn); - if (pVia->Chipset != VIA_CLE266) { - VIAGPIOI2C_Initial(&(pVia->GpioI2c), SlaveAddr); - VIAGPIOI2C_Read(&(pVia->GpioI2c), 0x09, R_Buffer, 1); - if (R_Buffer[0] & 0x04) - ret = TRUE; - } + if (pBIOSInfo->TVModeCrtc) + pBIOSInfo->TVModeCrtc(pScrn); +} - /* Disable LCD */ - VIADisableLCD(pScrn); +void +ViaTVPower(ScrnInfoPtr pScrn, Bool On) +{ + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; - /* Restore DI0, DI1 status */ - hwp->writeCrtc(hwp, 0x6C, cr6c); - hwp->writeCrtc(hwp, 0x93, cr93); +#ifdef HAVE_DEBUG + if (On) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaTVPower: On.\n"); + else + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaTVPower: Off.\n"); +#endif - return ret; -} + if (pBIOSInfo->TVPower) + pBIOSInfo->TVPower(pScrn, On); +} -Bool -VIAPostDVI(ScrnInfoPtr pScrn) +/* + * + */ +static Bool +ViaTVGetIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) { - vgaHWPtr hwp = VGAHWPTR(pScrn); - VIAPtr pVia = VIAPTR(pScrn); - VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - CARD8 cr6c, cr93; - Bool ret = FALSE; - I2CDevPtr dev; - CARD8 W_Buffer[2]; - CARD8 R_Buffer[4]; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAPostDVI\n")); + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; + int i; - /* Enable DI0, DI1 */ - cr6c = hwp->readCrtc(hwp, 0x6C); - ViaCrtcMask(hwp, 0x6C, 0x21, 0x21); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaTVGetIndex\n")); - cr93 = hwp->readCrtc(hwp, 0x93); - /* check for CLE266 first!!! */ - if (CLE266_REV_IS_CX(pVia->ChipRev)) - hwp->writeCrtc(hwp, 0x93, 0xA3); - else - hwp->writeCrtc(hwp, 0x93, 0xBF); + pBIOSInfo->TVIndex = VIA_TVRES_INVALID; - /* Enable LCD */ - VIAEnableLCD(pScrn); - - if (xf86I2CProbeAddress(pVia->pI2CBus2, 0x70)) { - dev = xf86CreateI2CDevRec(); - dev->DevName = "TMDS"; - dev->SlaveAddr = 0x70; - dev->pI2CBus = pVia->pI2CBus2; - if (xf86I2CDevInit(dev)) { - W_Buffer[0] = 0x00; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,4); - if (R_Buffer[0] == 0x06 && R_Buffer[1] == 0x11) { /* This is VT3191 */ - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Found VIA LVDS Transmiter!\n")); - if (R_Buffer[2] == 0x91 && R_Buffer[3] == 0x31) { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "VIA: VT1631!\n")); - pBIOSInfo->LVDS = VIA_VT3191; - W_Buffer[0] = 0x08; - if (pBIOSInfo->BusWidth == VIA_DI_24BIT && pBIOSInfo->LCDDualEdge) - W_Buffer[1] = 0x0D; - else - W_Buffer[1] = 0x09; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - xf86DestroyI2CDevRec(dev,TRUE); - ret = TRUE; - } - else { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "VIA: Unknow Chip!!\n")); - xf86DestroyI2CDevRec(dev,TRUE); - } - } - else if (R_Buffer[0] == 0x01 && R_Buffer[1] == 0x00) { /* This is Sil164 */ - W_Buffer[0] = 0x02; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,2); - if (R_Buffer[0] && R_Buffer[1]) { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Found TMDS Transmiter Silicon164.\n")); - pBIOSInfo->TMDS = VIA_SIL164; - W_Buffer[0] = 0x08; - if (pBIOSInfo->BusWidth == VIA_DI_24BIT) { - if (pBIOSInfo->LCDDualEdge) - W_Buffer[1] = 0x3F; - else - W_Buffer[1] = 0x37; - } - else /* 12Bit Only has Single Mode */ - W_Buffer[1] = 0x3B; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - W_Buffer[0] = 0x0C; - W_Buffer[1] = 0x09; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - xf86DestroyI2CDevRec(dev,TRUE); - ret = TRUE; - } - else { - xf86DestroyI2CDevRec(dev,TRUE); - } - } - else { - xf86DestroyI2CDevRec(dev,TRUE); - } - } - else { - xf86DestroyI2CDevRec(dev,TRUE); - } + if (pBIOSInfo->Refresh != 60){ + xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "ViaTVGetIndex:" + " TV requires 60Hz refresh rate.\n"); + return FALSE; } - /* Check VT3192 TMDS Exist or not?*/ - if (!pBIOSInfo->TMDS) { - if (xf86I2CProbeAddress(pVia->pI2CBus2, 0x10)) { - dev = xf86CreateI2CDevRec(); - dev->DevName = "TMDS"; - dev->SlaveAddr = 0x10; - dev->pI2CBus = pVia->pI2CBus2; - if (xf86I2CDevInit(dev)) { - W_Buffer[0] = 0x00; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,4); - - if (R_Buffer[0] == 0x06 && R_Buffer[1] == 0x11) { /* This is VT3192 */ - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Found VIA TMDS Transmiter!\n")); - pBIOSInfo->TMDS = VIA_VT3192; - if (R_Buffer[2] == 0x92 && R_Buffer[3] == 0x31) { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "VIA: VT1632!\n")); - pBIOSInfo->TMDS = VIA_VT3192; - W_Buffer[0] = 0x08; - if (pBIOSInfo->BusWidth == VIA_DI_24BIT) { - if (pBIOSInfo->LCDDualEdge) - W_Buffer[1] = 0x3F; - else - W_Buffer[1] = 0x37; - } - else - W_Buffer[1] = 0x3B; - xf86I2CWriteRead(dev, W_Buffer,2, NULL,0); - xf86DestroyI2CDevRec(dev,TRUE); - ret = TRUE; - } - else { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "VIA: Unknow Chip!!\n")); - xf86DestroyI2CDevRec(dev,TRUE); - } - } - else { - xf86DestroyI2CDevRec(dev,TRUE); - } - } - else { - xf86DestroyI2CDevRec(dev,TRUE); - } - } + /* check encoder */ + if (!pBIOSInfo->TVModeValid || !pBIOSInfo->TVModeValid(pScrn, mode)) + return FALSE; + + /* check tv standard */ + if (pBIOSInfo->ResolutionIndex == VIA_RES_720X480) { + if (pBIOSInfo->TVType == TVTYPE_PAL) + return FALSE; + } else if (pBIOSInfo->ResolutionIndex == VIA_RES_720X576) { + if (pBIOSInfo->TVType == TVTYPE_NTSC) + return FALSE; } - /* GPIO Sense */ - if (pVia->Chipset != VIA_CLE266) { - VIAGPIOI2C_Initial(&(pVia->GpioI2c), 0x70); - if (VIAGPIOI2C_Read(&(pVia->GpioI2c), 0, R_Buffer, 2)) { - if (R_Buffer[0] == 0x06 && R_Buffer[1] == 0x11) { /* VIA LVDS */ - VIAGPIOI2C_Read(&(pVia->GpioI2c), 2, R_Buffer, 2); - if (R_Buffer[0] == 0x91 && R_Buffer[1] == 0x31) { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Found LVDS Transmiter VT1631.\n")); - pBIOSInfo->LVDS = VIA_VT3191; - if (pBIOSInfo->BusWidth == VIA_DI_24BIT && pBIOSInfo->LCDDualEdge) - VIAGPIOI2C_Write(&(pVia->GpioI2c), 0x08, 0x0D); - else - VIAGPIOI2C_Write(&(pVia->GpioI2c), 0x08, 0x09); - ret = TRUE; - } - } - else if (R_Buffer[0] == 0x01 && R_Buffer[1] == 0x0) {/* Silicon TMDS */ - VIAGPIOI2C_Read(&(pVia->GpioI2c), 2, R_Buffer, 2); - if (R_Buffer[0] && R_Buffer[1]) { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Found TMDS Transmiter Silicon164.\n")); - pBIOSInfo->TMDS = VIA_SIL164; - if (pBIOSInfo->BusWidth == VIA_DI_24BIT) { - if (pBIOSInfo->LCDDualEdge) - VIAGPIOI2C_Write(&(pVia->GpioI2c), 0x08, 0x3F); - else - VIAGPIOI2C_Write(&(pVia->GpioI2c), 0x08, 0x37); - } - else { - VIAGPIOI2C_Write(&(pVia->GpioI2c), 0x08, 0x3B); - } - VIAGPIOI2C_Write(&(pVia->GpioI2c), 0x0C, 0x09); - ret = TRUE; - } - } - } - VIAGPIOI2C_Initial(&(pVia->GpioI2c), 0x10); - if (VIAGPIOI2C_Read(&(pVia->GpioI2c), 0, R_Buffer, 2)) { - if (R_Buffer[0] == 0x06 && R_Buffer[1] == 0x11) { /* VIA TMDS */ - VIAGPIOI2C_Read(&(pVia->GpioI2c), 2, R_Buffer, 2); - if (R_Buffer[0] == 0x92 && R_Buffer[1] == 0x31) { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Found TMDS Transmiter VT1632.\n")); - pBIOSInfo->TMDS = VIA_VT3192; - if (pBIOSInfo->BusWidth == VIA_DI_24BIT) { - if (pBIOSInfo->LCDDualEdge) - VIAGPIOI2C_Write(&(pVia->GpioI2c), 0x08, 0x3F); - else - VIAGPIOI2C_Write(&(pVia->GpioI2c), 0x08, 0x37); - } - else { - VIAGPIOI2C_Write(&(pVia->GpioI2c), 0x08, 0x3B); - } - ret = TRUE; - } - } + for (i = 0; ViaResolutionTable[i].Index != VIA_RES_INVALID; i++) + if (ViaResolutionTable[i].Index == pBIOSInfo->ResolutionIndex) { + if (ViaResolutionTable[i].TVIndex == VIA_TVRES_INVALID) + return FALSE; + + pBIOSInfo->TVIndex = ViaResolutionTable[i].TVIndex; + DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "ViaTVGetIndex:" + " %d\n", pBIOSInfo->TVIndex)); + return TRUE; } - } + return FALSE; +} - /* Disable LCD */ - VIADisableLCD(pScrn); +/* + * + */ +void +ViaOutputsDetect(ScrnInfoPtr pScrn) +{ + VIAPtr pVia = VIAPTR(pScrn); + VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - /* Restore DI0, DI1 status */ - hwp->writeCrtc(hwp, 0x6C, cr6c); - hwp->writeCrtc(hwp, 0x93, cr93); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaOutputsDetect\n")); - if (pBIOSInfo->LVDS && pBIOSInfo->PanelSize == VIA_PANEL_INVALID) { - pBIOSInfo->PanelSize = hwp->readCrtc(hwp, 0x3F) >> 4; - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Get PanelID From Scratch Pad is %d\n", pBIOSInfo->PanelSize)); + /* Panel */ + if (pBIOSInfo->ForcePanel) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Enabling panel from config.\n"); + pBIOSInfo->PanelPresent = TRUE; + } else if (pVia->Id && (pVia->Id->Outputs & VIA_DEVICE_LCD)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Enabling panel from" + " PCI-Subsystem Id information.\n"); + pBIOSInfo->PanelPresent = TRUE; + } + + /* Crt */ + if (pVia->DDC1) + pBIOSInfo->CrtPresent = TRUE; + /* If any of the unichromes support this, add CRT detection here */ + else if (!pBIOSInfo->PanelPresent) { + /* Make sure that at least CRT is enabled. */ + if (!pVia->Id || (pVia->Id->Outputs & VIA_DEVICE_CRT)) + pBIOSInfo->CrtPresent = TRUE; + } + + /* TV encoder */ + if (ViaTVDetect(pScrn) && ViaTVInit(pScrn)) { + if (!pBIOSInfo->TVOutput) /* Config might've set this already */ + ViaTVDACSense(pScrn); + } else if (pVia->Id && (pVia->Id->Outputs & VIA_DEVICE_TV)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "This device is supposed to have a" + " TV encoder but we are unable to detect it (support missing?).\n"); + pBIOSInfo->TVOutput = 0; } - - return ret; } -/* remove this prototype at some stage */ -static void VIAGetPanelSize(ScrnInfoPtr pScrn); +#ifdef HAVE_DEBUG +/* + * Returns: + * Bit[7] 2nd Path + * Bit[6] 1/0 MHS Enable/Disable + * Bit[5] 0 = Bypass Callback, 1 = Enable Callback + * Bit[4] 0 = Hot-Key Sequence Control (OEM Specific) + * Bit[3] LCD + * Bit[2] TV + * Bit[1] CRT + * Bit[0] DVI + */ +static CARD8 +VIAGetActiveDisplay(ScrnInfoPtr pScrn) +{ + vgaHWPtr hwp = VGAHWPTR(pScrn); + CARD8 tmp; -/*=* - * - * CARD8 VIAGetDeviceDetect(VIABIOSInfoPtr) - * - * - Get Display Device Attched - * - * Return Type: CARD8 - * - * The Definition of Input Value: - * - * VIABIOSInfoPtr - * - * The Definition of Return Value: + tmp = (hwp->readCrtc(hwp, 0x3E) >> 4); + tmp |= ((hwp->readCrtc(hwp, 0x3B) & 0x18) << 3); + + return tmp; +} +#endif /* HAVE_DEBUG */ + +/* * - * Bit[7] Reserved ------------ 2nd TV Connector - * Bit[6] Reserved ------------ 1st TV Connector - * Bit[5] Reserved - * Bit[4] CRT2 - * Bit[3] DFP - * Bit[2] TV - * Bit[1] LCD - * Bit[0] CRT - *=*/ -CARD8 -VIAGetDeviceDetect(ScrnInfoPtr pScrn) + */ +Bool +ViaOutputsSelect(ScrnInfoPtr pScrn) { VIAPtr pVia = VIAPTR(pScrn); VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - CARD8 tmp; - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAGetDeviceDetect\n")); + if (pVia->IsSecondary) { /* we just abort for now */ + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ViaOutputsSelect:" + " Not handling secondary.\n"); + return FALSE; + } - tmp = VIA_DEVICE_CRT1; /* Default assume color CRT attached */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaOutputsSelect\n")); - if (pBIOSInfo->LVDS) { - pBIOSInfo->LCDAttach = TRUE; - tmp |= VIA_DEVICE_LCD; - } + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaOutputsSelect: X" + " Configuration: 0x%02x\n", pVia->ActiveDevice)); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaOutputsSelect: BIOS" + " Initialised register: 0x%02x\n", + VIAGetActiveDisplay(pScrn))); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaOutputsSelect: VBE" + " OEM: 0x%02x\n", ViaVBEGetActiveDevice(pScrn))); - switch (pBIOSInfo->TVEncoder) { - case VIA_VT1621: - case VIA_VT1622: - case VIA_VT1622A: - case VIA_VT1623: - if (pBIOSInfo->TVOutput || VIAVT162xDACDetect(pScrn)) - tmp |= VIA_DEVICE_TV; - break; - default: - break; - } + pBIOSInfo->PanelActive = FALSE; + pBIOSInfo->CrtActive = FALSE; + pBIOSInfo->TVActive = FALSE; - if (pBIOSInfo->TMDS) { - if (VIASensorDVI(pScrn)) { - tmp |= VIA_DEVICE_DFP; - pBIOSInfo->DVIAttach = TRUE; - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "DVI has Attachment.\n")); - if (pBIOSInfo->PanelSize == VIA_PANEL_INVALID) - VIAGetPanelSize(pScrn); - } - else { - pBIOSInfo->DVIAttach = FALSE; - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "DVI hasn't Attachment.\n")); - } - } + if (!pVia->ActiveDevice) { + /* always enable the panel when present */ + if (pBIOSInfo->PanelPresent) + pBIOSInfo->PanelActive = TRUE; + else if (pBIOSInfo->TVOutput != TVOUTPUT_NONE) /* cable is attached! */ + pBIOSInfo->TVActive = TRUE; - if (pBIOSInfo->ForcePanel) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Forcing panel.\n"); - tmp |= VIA_DEVICE_LCD; - } + /* CRT can be used with everything when present */ + if (pBIOSInfo->CrtPresent) + pBIOSInfo->CrtActive = TRUE; + } else { + if (pVia->ActiveDevice & VIA_DEVICE_LCD) { + if (pBIOSInfo->PanelPresent) + pBIOSInfo->PanelActive = TRUE; + else + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Unable to activate" + " panel: no panel is present.\n"); + } - if ((pVia->Id) && (pVia->Id->Force != VIA_DEVICE_NONE)) { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Forcing %d (from PCI subsystem ID information).\n", - pVia->Id->Force)); - tmp |= pVia->Id->Force; + if (pVia->ActiveDevice & VIA_DEVICE_TV) { + if (!pBIOSInfo->TVI2CDev) + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Unable to activate" + " TV encoder: no TV encoder present.\n"); + else if (pBIOSInfo->TVOutput == TVOUTPUT_NONE) + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Unable to activate" + " TV encoder: no cable attached.\n"); + else if (pBIOSInfo->PanelActive) + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Unable to activate" + " TV encoder and panel simultaneously. Not using" + " TV encoder.\n"); + else + pBIOSInfo->TVActive = TRUE; + } + + if ((pVia->ActiveDevice & VIA_DEVICE_CRT) || + (!pBIOSInfo->PanelActive && !pBIOSInfo->TVActive)) { + pBIOSInfo->CrtPresent = TRUE; + pBIOSInfo->CrtActive = TRUE; + } } - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Returning %d.\n", tmp)); - return tmp; +#ifdef HAVE_DEBUG + if (pBIOSInfo->CrtActive) + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaOutputsSelect: CRT.\n")); + if (pBIOSInfo->PanelActive) + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaOutputsSelect: Panel.\n")); + if (pBIOSInfo->TVActive) + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaOutputsSelect: TV.\n")); +#endif + return TRUE; /* !Secondary always has at least CRT */ } /* - * * Try to interprete EDID ourselves. - * */ static Bool ViaGetPanelSizeFromEDID(ScrnInfoPtr pScrn, xf86MonPtr pMon, int *size) @@ -852,8 +485,7 @@ VIAGetPanelSizeFromDDCv2(ScrnInfoPtr pScrn, int *size) return FALSE; } - W_Buffer[0] = 0; - xf86I2CWriteRead(dev, W_Buffer,1, R_Buffer,1); + xf86I2CReadByte(dev, 0x00, R_Buffer); if (R_Buffer[0] != 0x20) { xf86DestroyI2CDevRec(dev,TRUE); return FALSE; @@ -928,9 +560,7 @@ VIAGetPanelSize(ScrnInfoPtr pScrn) } /* - * Sadly, we need to enforce these 17 modes, hard. - * At least until we can decide if we are able to use - * a given refresh algorithmically. + * */ static Bool ViaGetResolutionIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) @@ -967,10 +597,10 @@ ViaGetModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaGetModeIndex\n")); - for (i = 0; i < NumModes; i++) - if ((Modes[i].Bpp == pScrn->bitsPerPixel) && - (Modes[i].Width == mode->CrtcHDisplay) && - (Modes[i].Height == mode->CrtcVDisplay)) { + for (i = 0; ViaModes[i].Width; i++) + if ((ViaModes[i].Width == mode->CrtcHDisplay) && + (ViaModes[i].Height == mode->CrtcVDisplay) && + (ViaModes[i].Refresh == pBIOSInfo->Refresh)) { pBIOSInfo->ModeIndex = i; DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaGetModeIndex:" " %d\n", pBIOSInfo->ModeIndex)); @@ -982,21 +612,59 @@ ViaGetModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) /* * + */ +static int +ViaGetVesaMode(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + int i; + + for (i = 0; ViaVesaModes[i].Width; i++) + if ((ViaVesaModes[i].Width == mode->CrtcHDisplay) && + (ViaVesaModes[i].Height == mode->CrtcVDisplay)) { + switch (pScrn->bitsPerPixel) { + case 8: + return ViaVesaModes[i].mode_8b; + case 16: + return ViaVesaModes[i].mode_16b; + case 24: + case 32: + return ViaVesaModes[i].mode_32b; + default: + return 0xFFFF; + } + } + return 0xFFFF; +} + + +/* + * * ViaModeIndexTable[i].PanelIndex is pBIOSInfo->PanelSize * pBIOSInfo->PanelIndex is the index to lcdTable. * */ static Bool -ViaPanelGetIndex(VIABIOSInfoPtr pBIOSInfo) +ViaPanelGetIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) { + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; int i; + - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "ViaPanelGetIndex\n")); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaPanelGetIndex\n")); pBIOSInfo->PanelIndex = VIA_BIOS_NUM_PANEL; - if (pBIOSInfo->PanelSize == VIA_PANEL_INVALID){ - xf86DrvMsg(pBIOSInfo->scrnIndex, X_ERROR, "ViaPanelGetIndex: PanelSize not set.\n"); + if (pBIOSInfo->PanelSize == VIA_PANEL_INVALID) { + VIAGetPanelSize(pScrn); + if (pBIOSInfo->PanelSize == VIA_PANEL_INVALID) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ViaPanelGetIndex: PanelSize not set.\n"); + return FALSE; + } + } + + if (pBIOSInfo->Refresh != 60){ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaPanelGetIndex:" + " Panel requires 60Hz refresh rate.\n"); return FALSE; } @@ -1008,7 +676,7 @@ ViaPanelGetIndex(VIABIOSInfoPtr pBIOSInfo) } if (ViaResolutionTable[i].Index == VIA_RES_INVALID) { - xf86DrvMsg(pBIOSInfo->scrnIndex, X_ERROR, "ViaPanelGetIndex: Unable" + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ViaPanelGetIndex: Unable" " to find matching PanelSize in ViaResolutionTable.\n"); return FALSE; } @@ -1018,23 +686,28 @@ ViaPanelGetIndex(VIABIOSInfoPtr pBIOSInfo) if (lcdTable[i].fpSize == pBIOSInfo->PanelSize) { int modeNum, tmp; - modeNum = (int)Modes[pBIOSInfo->ModeIndex].Mode; + modeNum = ViaGetVesaMode(pScrn, mode); + if (modeNum == 0xFFFF) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ViaPanelGetIndex: " + "Unable to determine matching VESA modenumber.\n"); + return FALSE; + } tmp = 0x01 << (modeNum & 0xF); if ((CARD16)(tmp) & lcdTable[i].SuptMode[(modeNum >> 4)]) { pBIOSInfo->PanelIndex = i; - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "ViaPanelGetIndex:" + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaPanelGetIndex:" "index: %d (%dx%d)\n", pBIOSInfo->PanelIndex, pBIOSInfo->panelX, pBIOSInfo->panelY)); return TRUE; } - xf86DrvMsg(pBIOSInfo->scrnIndex, X_ERROR, "ViaPanelGetIndex: Unable" + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaPanelGetIndex: Unable" " to match given mode with this PanelSize.\n"); return FALSE; } - xf86DrvMsg(pBIOSInfo->scrnIndex, X_ERROR, "ViaPanelGetIndex: Unable" + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ViaPanelGetIndex: Unable" " to match PanelSize with an lcdTable entry.\n"); return FALSE; } @@ -1050,7 +723,6 @@ ViaGetNearestRefresh(ScrnInfoPtr pScrn, DisplayModePtr mode) DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaGetNearestRefresh\n")); - /* use the monitor information & round */ refresh = (mode->VRefresh + 0.5); DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaGetNearestRefresh: " @@ -1058,110 +730,52 @@ ViaGetNearestRefresh(ScrnInfoPtr pScrn, DisplayModePtr mode) /* get closest matching refresh index */ if (refresh < supportRef[0]) - pBIOSInfo->RefreshIndex = 0; + pBIOSInfo->Refresh = supportRef[0]; else { for (i = 0; (i < VIA_NUM_REFRESH_RATE) && (refresh >= supportRef[i]); i++) ; - pBIOSInfo->RefreshIndex = i - 1; + pBIOSInfo->Refresh = supportRef[i - 1]; } - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaGetNearestRefresh: Refresh:" - " %d (index: %d)\n", supportRef[pBIOSInfo->RefreshIndex], - pBIOSInfo->RefreshIndex)); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaGetNearestRefresh: " + "Refresh: %d\n", pBIOSInfo->Refresh)); } /* * */ static Bool -ViaRefreshAllowed(ScrnInfoPtr pScrn) +ViaRefreshAllowed(ScrnInfoPtr pScrn, DisplayModePtr mode) { VIAPtr pVia = VIAPTR(pScrn); VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - int bppIndex; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaRefreshAllowed\n")); - - /* does the memory bandwidth support this refresh rate? */ - switch (pScrn->bitsPerPixel) { - case 8: - bppIndex = 0; - break; - case 16: - bppIndex = 1; - break; - case 24: - case 32: - bppIndex = 2; - break; - default: - bppIndex = 0; - } - - switch (pVia->MemClk) { - case VIA_MEM_SDR133: - if (SDR133[bppIndex][pBIOSInfo->ResolutionIndex][pBIOSInfo->RefreshIndex]) - return TRUE; - else - return FALSE; - case VIA_MEM_DDR200: - if (DDR200[bppIndex][pBIOSInfo->ResolutionIndex][pBIOSInfo->RefreshIndex]) - return TRUE; - else - return FALSE; - case VIA_MEM_DDR266: - case VIA_MEM_DDR333: - case VIA_MEM_DDR400: - if (DDR266[bppIndex][pBIOSInfo->ResolutionIndex][pBIOSInfo->RefreshIndex]) - return TRUE; - else - return FALSE; - - case VIA_MEM_SDR66: - case VIA_MEM_SDR100: - default: - if (SDR100[bppIndex][pBIOSInfo->ResolutionIndex][pBIOSInfo->RefreshIndex]) - return TRUE; - else - return FALSE; - } -} - -/* - * - */ -static Bool -ViaTVGetIndex(VIABIOSInfoPtr pBIOSInfo) -{ int i; - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "ViaTVGetIndex\n")); - - for (i = 0; ViaResolutionTable[i].Index != VIA_RES_INVALID; i++) - if (ViaResolutionTable[i].Index == pBIOSInfo->ResolutionIndex) { - if (ViaResolutionTable[i].TVIndex == VIA_TVRES_INVALID) - break; - - /* check tv standard */ - if ((pBIOSInfo->ResolutionIndex == VIA_TVRES_720X480) && - (pBIOSInfo->TVType == TVTYPE_PAL)) - break; - if ((pBIOSInfo->ResolutionIndex == VIA_TVRES_720X576) && - (pBIOSInfo->TVType == TVTYPE_NTSC)) - break; - - /* check encoder */ - if ((pBIOSInfo->TVEncoder == VIA_VT1621) && - ((pBIOSInfo->ResolutionIndex != VIA_RES_640X480) && - (pBIOSInfo->ResolutionIndex != VIA_RES_800X600))) - break; + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaRefreshAllowed\n")); - pBIOSInfo->TVIndex = ViaResolutionTable[i].TVIndex; - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "ViaTVGetIndex:" - " %d\n", pBIOSInfo->TVIndex)); - return TRUE; + for (i = 0; ViaRefreshAllowedTable[i].Width; i++) { + if ((ViaRefreshAllowedTable[i].Width == mode->CrtcHDisplay) && + (ViaRefreshAllowedTable[i].Height == mode->CrtcVDisplay) && + (ViaRefreshAllowedTable[i].Refresh == pBIOSInfo->Refresh)) { + switch (pScrn->bitsPerPixel) { + case 8: + if (ViaRefreshAllowedTable[i].MemClk_8b <= pVia->MemClk) + return TRUE; + return FALSE; + case 16: + if (ViaRefreshAllowedTable[i].MemClk_16b <= pVia->MemClk) + return TRUE; + return FALSE; + case 24: + case 32: + if (ViaRefreshAllowedTable[i].MemClk_32b <= pVia->MemClk) + return TRUE; + return FALSE; + default: + return FALSE; + } } - pBIOSInfo->TVIndex = VIA_TVRES_INVALID; + } return FALSE; } @@ -1169,60 +783,48 @@ ViaTVGetIndex(VIABIOSInfoPtr pBIOSInfo) * */ Bool -VIAFindModeUseBIOSTable(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool Final) +ViaModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool Final) { VIAPtr pVia = VIAPTR(pScrn); VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; int level; - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAFindModeUseBIOSTable\n")); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaModeInit\n")); if (Final) level = X_ERROR; else level = X_INFO; - if (!ViaGetModeIndex(pScrn, mode) || !ViaGetResolutionIndex(pScrn, mode)) { - xf86DrvMsg(pScrn->scrnIndex, level, "Mode \"%s\" not supported by driver.\n", - mode->name); - return FALSE; - } - ViaGetNearestRefresh(pScrn, mode); - if (!ViaRefreshAllowed(pScrn)) { + if (!ViaRefreshAllowed(pScrn, mode)) { xf86DrvMsg(pScrn->scrnIndex, level, "Refreshrate (%fHz) for \"%s\" too" " high for available memory bandwidth.\n", mode->VRefresh, mode->name); return FALSE; } - if (!pBIOSInfo->ActiveDevice) - pBIOSInfo->ActiveDevice = VIAGetDeviceDetect(pScrn); - - /* TV + LCD/DVI has no simultaneous, block it */ - if ((pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) - && (pBIOSInfo->ActiveDevice & (VIA_DEVICE_LCD | VIA_DEVICE_DFP))) - pBIOSInfo->ActiveDevice = VIA_DEVICE_TV; + if (!ViaGetModeIndex(pScrn, mode) || !ViaGetResolutionIndex(pScrn, mode)) { + xf86DrvMsg(pScrn->scrnIndex, level, "Mode \"%s\" not supported by driver.\n", + mode->name); + return FALSE; + } - if ((pBIOSInfo->ActiveDevice & VIA_DEVICE_TV)) { - if (!ViaTVGetIndex(pBIOSInfo)) { + if (pBIOSInfo->TVActive) { + if (!ViaTVGetIndex(pScrn, mode)) { xf86DrvMsg(pScrn->scrnIndex, level, "Mode \"%s\" not supported by" " TV encoder.\n", mode->name); return FALSE; } } - if (pBIOSInfo->ActiveDevice & (VIA_DEVICE_DFP | VIA_DEVICE_LCD)) { - if (pBIOSInfo->PanelSize == VIA_PANEL_INVALID) - VIAGetPanelSize(pScrn); - - if (!ViaPanelGetIndex(pBIOSInfo)) { + if (pBIOSInfo->PanelActive) { + if (!ViaPanelGetIndex(pScrn, mode)) { xf86DrvMsg(pScrn->scrnIndex, level, "Mode \"%s\" not supported by" " LCD/DFP.\n", mode->name); return FALSE; } } - return TRUE; } @@ -1234,6 +836,7 @@ VIAFindModeUseBIOSTable(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool Final) /* * Standard vga call really. + * Should be removed now that this is set in ViaModePrimaryVGA */ static void VIASetUseExternalClock(vgaHWPtr hwp) @@ -1254,13 +857,9 @@ VIASetPrimaryClock(vgaHWPtr hwp, CARD16 clock) { DEBUG(xf86DrvMsg(hwp->pScrn->scrnIndex, X_INFO, "VIASetPrimaryClock to 0x%X\n", clock)); - ViaCrtcMask(hwp, 0x17, 0x00, 0x80); /* desync */ - hwp->writeSeq(hwp, 0x46, clock >> 8); hwp->writeSeq(hwp, 0x47, clock & 0xFF); - ViaCrtcMask(hwp, 0x17, 0x80, 0x80); /* sync */ - ViaSeqMask(hwp, 0x40, 0x02, 0x02); ViaSeqMask(hwp, 0x40, 0x00, 0x02); } @@ -1273,17 +872,16 @@ VIASetSecondaryClock(vgaHWPtr hwp, CARD16 clock) { DEBUG(xf86DrvMsg(hwp->pScrn->scrnIndex, X_INFO, "VIASetSecondaryClock to 0x%X\n", clock)); - ViaCrtcMask(hwp, 0x17, 0x00, 0x80); /* desync */ - hwp->writeSeq(hwp, 0x44, clock >> 8); hwp->writeSeq(hwp, 0x45, clock & 0xFF); - ViaCrtcMask(hwp, 0x17, 0x80, 0x80); /* sync */ - ViaSeqMask(hwp, 0x40, 0x04, 0x04); ViaSeqMask(hwp, 0x40, 0x00, 0x04); } +/* + * Broken, only does native mode decently. I (Luc) personally broke this. + */ static void VIASetLCDMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { @@ -1306,13 +904,21 @@ VIASetLCDMode(ScrnInfoPtr pScrn, DisplayModePtr mode) /* Set LCD InitTb Regs */ if (pBIOSInfo->BusWidth == VIA_DI_12BIT) { - if (!pVia->IsSecondary) - VIASetPrimaryClock(hwp, Table.InitTb.VClk_12Bit); - VIASetSecondaryClock(hwp, Table.InitTb.LCDClk_12Bit); + if (pVia->IsSecondary) + pBIOSInfo->Clock = Table.InitTb.LCDClk_12Bit; + else { + pBIOSInfo->Clock = Table.InitTb.VClk_12Bit; + /* for some reason still to be defined this is neccessary */ + VIASetSecondaryClock(hwp, Table.InitTb.LCDClk_12Bit); + } } else { - if (!pVia->IsSecondary) - VIASetPrimaryClock(hwp, Table.InitTb.VClk); - VIASetSecondaryClock(hwp, Table.InitTb.LCDClk); + if (pVia->IsSecondary) + pBIOSInfo->Clock = Table.InitTb.LCDClk; + else { + pBIOSInfo->Clock = Table.InitTb.VClk; + VIASetSecondaryClock(hwp, Table.InitTb.LCDClk); + } + } VIASetUseExternalClock(hwp); @@ -1328,6 +934,7 @@ VIASetLCDMode(ScrnInfoPtr pScrn, DisplayModePtr mode) (mode->CrtcVDisplay != pBIOSInfo->panelY)) { VIALCDModeEntryPtr Main; VIALCDMPatchEntryPtr Patch1, Patch2; + int numPatch1, numPatch2; resIdx = VIA_RES_INVALID; @@ -1373,13 +980,17 @@ VIASetLCDMode(ScrnInfoPtr pScrn, DisplayModePtr mode) if (pBIOSInfo->Center) { Main = &(Table.MCtr[resIdx]); Patch1 = Table.MPatchDP1Ctr; + numPatch1 = Table.numMPatchDP1Ctr; Patch2 = Table.MPatchDP2Ctr; + numPatch2 = Table.numMPatchDP2Ctr; } else { /* expand! */ /* LCD Expand Mode Y Scale Flag */ pBIOSInfo->scaleY = TRUE; Main = &(Table.MExp[resIdx]); Patch1 = Table.MPatchDP1Exp; + numPatch1 = Table.numMPatchDP1Exp; Patch2 = Table.MPatchDP2Exp; + numPatch2 = Table.numMPatchDP2Exp; } /* Set Main LCD Registers */ @@ -1389,24 +1000,32 @@ VIASetLCDMode(ScrnInfoPtr pScrn, DisplayModePtr mode) } if (pBIOSInfo->BusWidth == VIA_DI_12BIT) { - if (!pVia->IsSecondary) - VIASetPrimaryClock(hwp, Main->VClk_12Bit); - VIASetSecondaryClock(hwp, Main->LCDClk_12Bit); + if (pVia->IsSecondary) + pBIOSInfo->Clock = Main->LCDClk_12Bit; + else + pBIOSInfo->Clock = Main->VClk_12Bit; } else { - if (!pVia->IsSecondary) - VIASetPrimaryClock(hwp, Main->VClk); - VIASetSecondaryClock(hwp, Main->LCDClk); + if (pVia->IsSecondary) + pBIOSInfo->Clock = Main->LCDClk; + else + pBIOSInfo->Clock = Main->VClk; } + j = ViaGetVesaMode(pScrn, mode); + if (j == 0xFFFF) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "VIASetLCDMode: " + "Unable to determine matching VESA modenumber.\n"); + return; + } for (i = 0; i < modeFix.numEntry; i++) { - if (modeFix.reqMode[i] == (CARD8)(Modes[pBIOSInfo->ModeIndex].Mode)) { + if (modeFix.reqMode[i] == j) { modeNum = modeFix.fixMode[i]; break; } } /* Set LCD Mode patch registers. */ - for (i = 0; i < Table.numMPatchDP2Exp; i++, Patch2++) { + for (i = 0; i < numPatch2; i++, Patch2++) { if (Patch2->Mode == modeNum) { if (!pBIOSInfo->Center && (mode->CrtcHDisplay == pBIOSInfo->panelX)) pBIOSInfo->scaleY = FALSE; @@ -1417,13 +1036,15 @@ VIASetLCDMode(ScrnInfoPtr pScrn, DisplayModePtr mode) } if (pBIOSInfo->BusWidth == VIA_DI_12BIT) { - if (!pVia->IsSecondary) - VIASetPrimaryClock(hwp, Patch2->VClk_12Bit); - VIASetSecondaryClock(hwp, Patch2->LCDClk_12Bit); + if (pVia->IsSecondary) + pBIOSInfo->Clock = Patch2->LCDClk_12Bit; + else + pBIOSInfo->Clock = Patch2->VClk_12Bit; } else { - if (!pVia->IsSecondary) - VIASetPrimaryClock (hwp, Patch2->VClk); - VIASetSecondaryClock(hwp, Patch2->LCDClk); + if (pVia->IsSecondary) + pBIOSInfo->Clock = Patch2->LCDClk; + else + pBIOSInfo->Clock = Patch2->VClk; } break; } @@ -1432,7 +1053,7 @@ VIASetLCDMode(ScrnInfoPtr pScrn, DisplayModePtr mode) /* Set LCD Secondary Mode Patch registers. */ if (pVia->IsSecondary) { - for (i = 0; i < Table.numMPatchDP1Ctr; i++, Patch1++) { + for (i = 0; i < numPatch1; i++, Patch1++) { if (Patch1->Mode == modeNum) { for (j = 0; j < Patch1->numEntry; j++) { ViaVgahwWrite(hwp, 0x300 + Patch1->port[j], Patch1->offset[j], @@ -1444,8 +1065,6 @@ VIASetLCDMode(ScrnInfoPtr pScrn, DisplayModePtr mode) } } - VIASetUseExternalClock(hwp); - /* LCD patch 3D5.02 */ misc = hwp->readCrtc(hwp, 0x01); hwp->writeCrtc(hwp, 0x02, misc); @@ -1489,908 +1108,397 @@ VIASetLCDMode(ScrnInfoPtr pScrn, DisplayModePtr mode) } } -static void -VIAPreSetTV2Mode(VIAPtr pVia) -{ - VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - VIABIOSTV2TableRec Table; - VIABIOSTVMASKTableRec Mask; - CARD8 *TV; - CARD16 *Patch2; - int i, j; - CARD8 W_Buffer[VIA_BIOS_MAX_NUM_TV_REG+1]; - CARD8 W_Other[2]; - CARD8 R_Buffer[1]; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPreSetTV2Mode\n")); - - if (pBIOSInfo->TVVScan == VIA_TVOVER) - Table = tv2OverTable[pBIOSInfo->TVIndex]; - else /* VIA_TVNORMAL */ - Table = tv2Table[pBIOSInfo->TVIndex]; - Mask = tv2MaskTable; - - if (pBIOSInfo->TVType == TVTYPE_PAL) { - Patch2 = Table.PatchPAL2; - if (pBIOSInfo->TVOutput == TVOUTPUT_COMPOSITE) - TV = Table.TVPALC; - else /* S-video */ - TV = Table.TVPALS; - } else { /* TVTYPE_NTSC */ - Patch2 = Table.PatchNTSC2; - if (pBIOSInfo->TVOutput == TVOUTPUT_COMPOSITE) - TV = Table.TVNTSCC; - else /* S-video */ - TV = Table.TVNTSCS; - } - - W_Buffer[0] = 0; - for (i = 0, j = 0; (j < Mask.numTV) && (i < VIA_BIOS_MAX_NUM_TV_REG); i++) { - if (Mask.TV[i] == 0xFF) { - W_Buffer[i + 1] = TV[i]; - j++; - } else - W_Buffer[i + 1] = pVia->SavedReg.TVRegs[i]; - } - - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer, i + 1, NULL,0); - - /* Turn on all Composite and S-Video output */ - W_Other[0] = 0x0E; - W_Other[1] = 0; - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Other,2, NULL,0); - - if ((pBIOSInfo->TVType == TVTYPE_NTSC) && pBIOSInfo->TVDotCrawl) { - CARD16 *DotCrawl = Table.DotCrawlNTSC; - - for (i = 1; i < (DotCrawl[0] + 1); i++) { - W_Other[0] = (CARD8)(DotCrawl[i] & 0xFF); - - if (W_Other[0] == 0x11) { - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Other,1, R_Buffer,1); - W_Other[1] = R_Buffer[0] | (CARD8)(DotCrawl[i] >> 8); - } else - W_Other[1] = (CARD8)(DotCrawl[i] >> 8); - - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Other,2, NULL,0); - } - } - - if (pVia->IsSecondary) { /* Patch as setting 2nd path */ - int numPatch = (int)(Mask.misc2 >> 5); - - for (i = 0; i < numPatch; i++) { - W_Other[0] = (CARD8)(Patch2[i] & 0xFF); - W_Other[1] = (CARD8)(Patch2[i] >> 8); - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Other,2, NULL,0); - } - } -} - -static void -VIAPreSetVT1623ModeGpioI2c(VIAPtr pVia) -{ - VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - VIABIOSTV3TableRec Table; - VIABIOSTVMASKTableRec Mask; - CARD8 *TV; - CARD16 *RGB, *YCbCr, *Patch2; - int i, j; - CARD8 W_Buffer[2]; - CARD8 R_Buffer[1]; - GpioI2cPtr pDev = &(pVia->GpioI2c); - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPreSetVT1623ModeGpioI2c\n")); - - if (pBIOSInfo->TVVScan == VIA_TVOVER) - Table = vt1622aOverTable[pBIOSInfo->TVIndex]; - else /* VIA_TVNORMAL */ - Table = vt1622aTable[pBIOSInfo->TVIndex]; - Mask = vt1622aMaskTable; - - if (pBIOSInfo->TVType == TVTYPE_PAL) { - TV = Table.TVPAL; - RGB = Table.RGBPAL; - YCbCr = Table.YCbCrPAL; - Patch2 = Table.PatchPAL2; - } else { - TV = Table.TVNTSC; - RGB = Table.RGBNTSC; - YCbCr = Table.YCbCrNTSC; - Patch2 = Table.PatchNTSC2; - } - - VIAGPIOI2C_Initial(pDev, pBIOSInfo->TVI2CAddr); - - /* TV Reset */ - VIAGPIOI2C_Write(pDev, 0x1D, 0x0); - VIAGPIOI2C_Write(pDev, 0x1D, 0x80); - - VIAGPIOI2C_Write(pDev, 0, 0); - for (i = 1, j = 0; (j < Mask.numTV) && (i < VIA_BIOS_MAX_NUM_TV_REG); i++) { - if (Mask.TV[i] == 0xFF) { - VIAGPIOI2C_Write(pDev, i + 1, TV[j]); - j++; - } else - VIAGPIOI2C_Write(pDev, i + 1, pVia->SavedReg.TVRegs[j]); - } - - /* Turn on all Composite and S-Video output */ - VIAGPIOI2C_Write(pDev, 0x0E, 0x0); - - if ((pBIOSInfo->TVType == TVTYPE_NTSC) && pBIOSInfo->TVDotCrawl) { - CARD16 *DotCrawl = Table.DotCrawlNTSC; - - for (i = 1; i < (DotCrawl[0] + 1); i++) { - W_Buffer[0] = (CARD8)(DotCrawl[i] & 0xFF); - if (W_Buffer[0] == 0x11) { - VIAGPIOI2C_Read(pDev, 0x11, R_Buffer, 1); - W_Buffer[1] = R_Buffer[0] | (CARD8)(DotCrawl[i] >> 8); - } - else { - W_Buffer[1] = (CARD8)(DotCrawl[i] >> 8); - } - VIAGPIOI2C_Write(pDev, W_Buffer[0], W_Buffer[1]); - } - } - - if (pBIOSInfo->TVOutput == TVOUTPUT_RGB) { - for (i = 1; i < (RGB[0] + 1); i++) { - W_Buffer[0] = (CARD8)(RGB[i] & 0xFF); - W_Buffer[1] = (CARD8)(RGB[i] >> 8); - VIAGPIOI2C_Write(pDev, W_Buffer[0], W_Buffer[1]); - } - - } else if (pBIOSInfo->TVOutput == TVOUTPUT_YCBCR) { - for (i = 1; i < (YCbCr[0] + 1); i++) { - W_Buffer[0] = (CARD8)(YCbCr[i] & 0xFF); - W_Buffer[1] = (CARD8)(YCbCr[i] >> 8); - VIAGPIOI2C_Write(pDev, W_Buffer[0], W_Buffer[1]); - } - - } - - if (pVia->IsSecondary) { /* Patch as setting 2nd path */ - int numPatch = (int)(Mask.misc2 >> 5); - - for (i = 0; i < numPatch; i++) { - W_Buffer[0] = (CARD8)(Patch2[i] & 0xFF); - W_Buffer[1] = (CARD8)(Patch2[i] >> 8); - VIAGPIOI2C_Write(pDev, W_Buffer[0], W_Buffer[1]); - } - } -} - -static void -VIAPostSetTV2Mode(ScrnInfoPtr pScrn) -{ - vgaHWPtr hwp = VGAHWPTR(pScrn); - VIAPtr pVia = VIAPTR(pScrn); - VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - VIABIOSTV2TableRec Table; - VIABIOSTVMASKTableRec Mask; - CARD8 *CRTC, *Misc; - int i, j; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAPostSetTV2Mode\n")); - - if (pBIOSInfo->TVVScan == VIA_TVOVER) - Table = tv2OverTable[pBIOSInfo->TVIndex]; - else /* VIA_TVNORMAL */ - Table = tv2Table[pBIOSInfo->TVIndex]; - Mask = tv2MaskTable; - - if (pVia->IsSecondary) { - if (pBIOSInfo->TVType == TVTYPE_PAL) { - switch (pScrn->bitsPerPixel) { - case 16: - CRTC = Table.CRTCPAL2_16BPP; - break; - case 24: - case 32: - CRTC = Table.CRTCPAL2_32BPP; - break; - case 8: - default: - CRTC = Table.CRTCPAL2_8BPP; - break; - } - Misc = Table.MiscPAL2; - } else { - switch (pScrn->bitsPerPixel) { - case 16: - CRTC = Table.CRTCNTSC2_16BPP; - break; - case 24: - case 32: - CRTC = Table.CRTCNTSC2_32BPP; - break; - case 8: - default: - CRTC = Table.CRTCNTSC2_8BPP; - break; - } - Misc = Table.MiscNTSC2; - } - - for (i = 0, j = 0; i < Mask.numCRTC2; j++) { - if (Mask.CRTC2[j] == 0xFF) { - hwp->writeCrtc(hwp, j + 0x50, CRTC[j]); - i++; - } - } - - if (Mask.misc2 & 0x18) { - VIASetSecondaryClock(hwp, (Misc[3] << 8) | Misc[4]); - VIASetUseExternalClock(hwp); - } - - ViaCrtcMask(hwp, 0x6A, 0xC0, 0xC0); - ViaCrtcMask(hwp, 0x6B, 0x01, 0x01); - ViaCrtcMask(hwp, 0x6C, 0x01, 0x01); - - /* Disable LCD Scaling */ - if (!pVia->SAMM || pVia->FirstInit) - hwp->writeCrtc(hwp, 0x79, 0x00); - - } else { - if (pBIOSInfo->TVType == TVTYPE_PAL) { - CRTC = Table.CRTCPAL1; - Misc = Table.MiscPAL1; - } else { - CRTC = Table.CRTCNTSC1; - Misc = Table.MiscNTSC1; - } - - for (i = 0, j = 0; i < Mask.numCRTC1; j++) { - if (Mask.CRTC1[j] == 0xFF) { - hwp->writeCrtc(hwp, j, CRTC[j]); - i++; - } - } - - ViaCrtcMask(hwp, 0x33, Misc[0], 0x20); - hwp->writeCrtc(hwp, 0x6A, Misc[1]); - hwp->writeCrtc(hwp, 0x6B, Misc[2] | 0x01); - hwp->writeCrtc(hwp, 0x6C, Misc[3] | 0x01); /* ? */ - - if (Mask.misc1 & 0x30) { - VIASetPrimaryClock(hwp, (Misc[4] << 8) | Misc[5]); - VIASetUseExternalClock(hwp); - } - } -} - -static void -VIAPreSetTV3Mode(VIAPtr pVia) -{ - VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - VIABIOSTV3TableRec Table; - VIABIOSTVMASKTableRec Mask; - CARD8 *TV; - CARD16 *RGB, *YCbCr, *Patch2; - int i, j; - CARD8 W_Buffer[VIA_BIOS_MAX_NUM_TV_REG + 1]; - CARD8 W_Other[2]; - CARD8 R_Buffer[1]; - - DEBUG(xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "VIAPreSetTV3Mode\n")); - - if (pBIOSInfo->TVEncoder == VIA_VT1622) { - if (pBIOSInfo->TVVScan == VIA_TVOVER) - Table = tv3OverTable[pBIOSInfo->TVIndex]; - else /* VIA_TVNORMAL */ - Table = tv3Table[pBIOSInfo->TVIndex]; - Mask = tv3MaskTable; - } else { /* VT1622A */ - if (pBIOSInfo->TVVScan == VIA_TVOVER) - Table = vt1622aOverTable[pBIOSInfo->TVIndex]; - else /* VIA_TVNORMAL */ - Table = vt1622aTable[pBIOSInfo->TVIndex]; - Mask = vt1622aMaskTable; - } - - if (pBIOSInfo->TVType == TVTYPE_PAL) { - TV = Table.TVPAL; - RGB = Table.RGBPAL; - YCbCr = Table.YCbCrPAL; - Patch2 = Table.PatchPAL2; - } else { - TV = Table.TVNTSC; - RGB = Table.RGBNTSC; - YCbCr = Table.YCbCrNTSC; - Patch2 = Table.PatchNTSC2; - } - - W_Buffer[0] = 0; - for (i = 0, j = 0; (j < Mask.numTV) && (i < VIA_BIOS_MAX_NUM_TV_REG); i++) { - if (Mask.TV[i] == 0xFF) { - W_Buffer[i + 1] = TV[i]; - j++; - } else - W_Buffer[i + 1] = pVia->SavedReg.TVRegs[i]; - } - - /* TV Reset */ - W_Other[0] = 0x1D; - W_Other[1] = 0; - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Other,2, NULL,0); - W_Other[0] = 0x1D; - W_Other[1] = 0x80; - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Other,2, NULL,0); - - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer, i + 1, NULL,0); - - /* Turn on all Composite and S-Video output */ - W_Other[0] = 0x0E; - W_Other[1] = 0; - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Other,2, NULL,0); - - if ((pBIOSInfo->TVType == TVTYPE_NTSC) && pBIOSInfo->TVDotCrawl) { - CARD16 *DotCrawl = Table.DotCrawlNTSC; - - for (i = 1; i < (DotCrawl[0] + 1); i++) { - W_Other[0] = (CARD8)(DotCrawl[i] & 0xFF); - if (W_Other[0] == 0x11) { - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Other,1, R_Buffer,1); - W_Other[1] = R_Buffer[0] | (CARD8)(DotCrawl[i] >> 8); - } - else { - W_Other[1] = (CARD8)(DotCrawl[i] >> 8); - } - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Other,2, NULL,0); - } - } - - if (pBIOSInfo->TVOutput == TVOUTPUT_RGB) { - for (i = 1; i < (RGB[0] + 1); i++) { - W_Other[0] = (CARD8)(RGB[i] & 0xFF); - W_Other[1] = (CARD8)(RGB[i] >> 8); - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Other,2, NULL,0); - } - } else if (pBIOSInfo->TVOutput == TVOUTPUT_YCBCR) { - for (i = 1; i < (YCbCr[0] + 1); i++) { - W_Other[0] = (CARD8)(YCbCr[i] & 0xFF); - W_Other[1] = (CARD8)(YCbCr[i] >> 8); - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Other,2, NULL,0); - } - } - - if (pVia->IsSecondary) { /* Patch as setting 2nd path */ - int numPatch = (int)(Mask.misc2 >> 5); - - for (i = 0; i < numPatch; i++) { - W_Other[0] = (CARD8)(Patch2[i] & 0xFF); - W_Other[1] = (CARD8)(Patch2[i] >> 8); - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Other,2, NULL,0); - } - } - - /* Configure flicker filter */ - W_Other[0] = 3; - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Other,1, R_Buffer,1); - W_Other[1] = R_Buffer[0] & 0xFC; - if(pBIOSInfo->TVDeflicker == 1) - W_Other[1] |= 0x01; - else if(pBIOSInfo->TVDeflicker == 2) - W_Other[1] |= 0x02; - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Other,2, NULL,0); -} - -static void -VIAPostSetTV3Mode(ScrnInfoPtr pScrn) -{ - vgaHWPtr hwp = VGAHWPTR(pScrn); - VIAPtr pVia = VIAPTR(pScrn); - VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - VIABIOSTV3TableRec Table; - VIABIOSTVMASKTableRec Mask; - CARD8 *CRTC, *Misc; - int i, j; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAPostSetTV3Mode\n")); - - if (pBIOSInfo->TVEncoder == VIA_VT1622) { - if (pBIOSInfo->TVVScan == VIA_TVOVER) - Table = tv3OverTable[pBIOSInfo->TVIndex]; - else /* VIA_TVNORMAL */ - Table = tv3Table[pBIOSInfo->TVIndex]; - Mask = tv3MaskTable; - } else { /* VT1622A */ - if (pBIOSInfo->TVVScan == VIA_TVOVER) - Table = vt1622aOverTable[pBIOSInfo->TVIndex]; - else /* VIA_TVNORMAL */ - Table = vt1622aTable[pBIOSInfo->TVIndex]; - Mask = vt1622aMaskTable; - } - - if (pVia->IsSecondary) { - if (pBIOSInfo->TVType == TVTYPE_PAL) { - switch (pScrn->bitsPerPixel) { - case 16: - CRTC = Table.CRTCPAL2_16BPP; - break; - case 24: - case 32: - CRTC = Table.CRTCPAL2_32BPP; - break; - case 8: - default: - CRTC = Table.CRTCPAL2_8BPP; - break; - } - Misc = Table.MiscPAL2; - } else { - switch (pScrn->bitsPerPixel) { - case 16: - CRTC = Table.CRTCNTSC2_16BPP; - break; - case 24: - case 32: - CRTC = Table.CRTCNTSC2_32BPP; - break; - case 8: - default: - CRTC = Table.CRTCNTSC2_8BPP; - break; - } - Misc = Table.MiscNTSC2; - } - - for (i = 0, j = 0; i < Mask.numCRTC2; j++) { - if (Mask.CRTC2[j] == 0xFF) { - hwp->writeCrtc(hwp, j + 0x50, CRTC[j]); - i++; - } - } - - if (Mask.misc2 & 0x18) { - /* CLE266Ax use 2x XCLK */ - if ((pVia->Chipset == VIA_CLE266) && - CLE266_REV_IS_AX(pVia->ChipRev)) { - ViaCrtcMask(hwp, 0x6B, 0x20, 0x20); - - /* Fix TV clock Polarity for CLE266A2 */ - if (pVia->ChipRev == 0x02) - ViaCrtcMask(hwp, 0x6C, 0x1C, 0x1C); - - VIASetSecondaryClock(hwp, 0x471C); - } else - VIASetSecondaryClock(hwp, (Misc[3] << 8) | Misc[4]); - - VIASetUseExternalClock(hwp); - } - - ViaCrtcMask(hwp, 0x6A, 0xC0, 0xC0); - ViaCrtcMask(hwp, 0x6B, 0x01, 0x01); - ViaCrtcMask(hwp, 0x6C, 0x01, 0x01); - - /* Disable LCD Scaling */ - if (!pVia->SAMM || pVia->FirstInit) - hwp->writeCrtc(hwp, 0x79, 0x00); - } else { - if (pBIOSInfo->TVType == TVTYPE_PAL) { - CRTC = Table.CRTCPAL1; - Misc = Table.MiscPAL1; - } else { - CRTC = Table.CRTCNTSC1; - Misc = Table.MiscNTSC1; - } - - for (i = 0, j = 0; i < Mask.numCRTC1; j++) { - if (Mask.CRTC1[j] == 0xFF) { - hwp->writeCrtc(hwp, j, CRTC[j]); - i++; - } - } - - ViaCrtcMask(hwp, 0x33, Misc[0], 0x20); - hwp->writeCrtc(hwp, 0x6A, Misc[1]); - - if ((pVia->Chipset == VIA_CLE266) && - CLE266_REV_IS_AX(pVia->ChipRev)) { - hwp->writeCrtc(hwp, 0x6B, Misc[2] | 0x81); - /* Fix TV clock Polarity for CLE266A2 */ - if (pVia->ChipRev == 0x02) - hwp->writeCrtc(hwp, 0x6C, Misc[3] | 0x01); - } else - hwp->writeCrtc(hwp, 0x6B, Misc[2] | 0x01); - - if (Mask.misc1 & 0x30) { - /* CLE266Ax use 2x XCLK */ - if ((pVia->Chipset == VIA_CLE266) && - CLE266_REV_IS_AX(pVia->ChipRev)) - VIASetPrimaryClock(hwp, 0x471C); - else - VIASetPrimaryClock(hwp, (Misc[4] << 8) | Misc[5]); - - VIASetUseExternalClock(hwp); - } - - ViaCrtcMask(hwp, 0x6A, 0x40, 0x40); - ViaCrtcMask(hwp, 0x6B, 0x01, 0x01); - ViaCrtcMask(hwp, 0x6C, 0x01, 0x01); - } - - ViaSeqMask(hwp, 0x1E, 0xC0, 0xC0); /* Enable DI0/DVP0 */ -} - /* * */ static void -ViaTVModePreset(ScrnInfoPtr pScrn) +ViaModePrimaryVGA(ScrnInfoPtr pScrn, DisplayModePtr mode) { + vgaHWPtr hwp = VGAHWPTR(pScrn); VIAPtr pVia = VIAPTR(pScrn); VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - - switch (pBIOSInfo->TVEncoder) { - case VIA_VT1621: - VIAPreSetTV2Mode(pVia); - break; - case VIA_VT1622: - case VIA_VT1622A: - case VIA_VT1623: - if (pBIOSInfo->TVUseGpioI2c) - VIAPreSetVT1623ModeGpioI2c(pVia); - else - VIAPreSetTV3Mode(pVia); - break; - default: - break; - } - -#ifdef HAVE_DEBUG - if (pVia->PrintTVRegs) - ViaPrintTVRegs(pScrn); -#endif /* HAVE_DEBUG */ -} - -/* - * - */ -static void -ViaTVClose(VIAPtr pVia) -{ - VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - CARD8 W_Buffer[2]; + struct ViaModeLine ViaMode = ViaModes[pBIOSInfo->ModeIndex]; + CARD16 temp; + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaModePrimaryVGA\n")); + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAModePrimary: Setting up " + "%4dx%4d@%2d\n", ViaMode.Width, ViaMode.Height, ViaMode.Refresh)); + + ViaCrtcMask(hwp, 0x11, 0x00, 0x80); /* modify starting address */ + ViaCrtcMask(hwp, 0x03, 0x80, 0x80); /* enable vertical retrace access */ + hwp->writeSeq(hwp, 0x10, 0x01); /* unlock extended registers */ + ViaCrtcMask(hwp, 0x47, 0x00, 0x01); /* unlock CRT registers */ + + /* Set Misc Register */ + temp = 0x23; + if (!ViaMode.HSyncPos) + temp |= 0x40; + if (!ViaMode.VSyncPos) + temp |= 0x80; + temp |= 0x0C; /* Undefined/external clock */ + hwp->writeMiscOut(hwp, temp); + + /* Sequence registers */ + hwp->writeSeq(hwp, 0x00, 0x00); + + /* if (mode->Flags & V_CLKDIV2) + hwp->writeSeq(hwp, 0x01, 0x09); + else */ + hwp->writeSeq(hwp, 0x01, 0x01); + + hwp->writeSeq(hwp, 0x02, 0x0F); + hwp->writeSeq(hwp, 0x03, 0x00); + hwp->writeSeq(hwp, 0x04, 0x0E); - switch (pBIOSInfo->TVEncoder) { - case VIA_VT1621: - W_Buffer[0] = 0x0E; - W_Buffer[1] = 0x03; - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,2, NULL,0); - break; - case VIA_VT1622: - case VIA_VT1622A: - case VIA_VT1623: - if (pBIOSInfo->TVUseGpioI2c) { - VIAGPIOI2C_Initial(&(pVia->GpioI2c), pBIOSInfo->TVI2CAddr); - VIAGPIOI2C_Write(&(pVia->GpioI2c), 0x0E, 0x0F); - } else { - W_Buffer[0] = 0x0E; - W_Buffer[1] = 0x0F; - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,2, NULL,0); - } - break; - default: - break; - } -} - -/* - * - */ -static void -ViaTVModePostSet(ScrnInfoPtr pScrn) -{ - - switch (VIAPTR(pScrn)->pBIOSInfo->TVEncoder) { - case VIA_VT1621: - VIAPostSetTV2Mode(pScrn); - break; - case VIA_VT1622: - case VIA_VT1622A: - case VIA_VT1623: - VIAPostSetTV3Mode(pScrn); - break; - } -} + ViaSeqMask(hwp, 0x15, 0x02, 0x02); -/* - * Fetch count was moved to ViaSetPrimaryFetchCount (via_bandwidth.c) - * "Fix bandwidth problem when using virtual desktop" - * - */ -static void -ViaSetPrimaryOffset(ScrnInfoPtr pScrn) -{ - vgaHWPtr hwp = VGAHWPTR(pScrn); - int Offset = (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3)) >> 3; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaSetPrimaryOffset\n")); - - /* Make sure that this is 32byte aligned */ - if (Offset & 0x03) { - Offset += 0x03; - Offset &= ~0x03; - } - hwp->writeCrtc(hwp, 0x13, Offset & 0xFF); - ViaCrtcMask(hwp, 0x35, Offset >> 3, 0xE0); -} - -/* - * Patch for horizontal blanking end bit6 - */ -static void -ViaSetBlankingEndOverflow(vgaHWPtr hwp) -{ - CARD8 start, end; + /* bpp */ + switch (pScrn->bitsPerPixel) { + case 8: + ViaSeqMask(hwp, 0x15, 0x20, 0xFC); + break; + case 16: + ViaSeqMask(hwp, 0x15, 0xB4, 0xFC); + break; + case 24: + case 32: + ViaSeqMask(hwp, 0x15, 0xAC, 0xFC); + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unhandled bitdepth: %d\n", + pScrn->bitsPerPixel); + break; + } + + ViaSeqMask(hwp, 0x16, 0x08, 0xBF); + ViaSeqMask(hwp, 0x17, 0x1F, 0xFF); + ViaSeqMask(hwp, 0x18, 0x4E, 0xFF); + ViaSeqMask(hwp, 0x1A, 0x08, 0xFD); + + /* graphics registers */ + hwp->writeGr(hwp, 0x00, 0x00); + hwp->writeGr(hwp, 0x01, 0x00); + hwp->writeGr(hwp, 0x02, 0x00); + hwp->writeGr(hwp, 0x03, 0x00); + hwp->writeGr(hwp, 0x04, 0x00); + hwp->writeGr(hwp, 0x05, 0x40); + hwp->writeGr(hwp, 0x06, 0x05); + hwp->writeGr(hwp, 0x07, 0x0F); + hwp->writeGr(hwp, 0x08, 0xFF); + + ViaGrMask(hwp, 0x20, 0, 0xFF); + ViaGrMask(hwp, 0x21, 0, 0xFF); + ViaGrMask(hwp, 0x22, 0, 0xFF); - DEBUG(xf86DrvMsg(hwp->pScrn->scrnIndex, X_INFO, "ViaSetBlankingEndOverflow\n")); + /* attribute registers */ + hwp->writeAttr(hwp, 0x00, 0x00); + hwp->writeAttr(hwp, 0x01, 0x01); + hwp->writeAttr(hwp, 0x02, 0x02); + hwp->writeAttr(hwp, 0x03, 0x03); + hwp->writeAttr(hwp, 0x04, 0x04); + hwp->writeAttr(hwp, 0x05, 0x05); + hwp->writeAttr(hwp, 0x06, 0x06); + hwp->writeAttr(hwp, 0x07, 0x07); + hwp->writeAttr(hwp, 0x08, 0x08); + hwp->writeAttr(hwp, 0x09, 0x09); + hwp->writeAttr(hwp, 0x0A, 0x0A); + hwp->writeAttr(hwp, 0x0B, 0x0B); + hwp->writeAttr(hwp, 0x0C, 0x0C); + hwp->writeAttr(hwp, 0x0D, 0x0D); + hwp->writeAttr(hwp, 0x0E, 0x0E); + hwp->writeAttr(hwp, 0x0F, 0x0F); + hwp->writeAttr(hwp, 0x10, 0x41); + hwp->writeAttr(hwp, 0x11, 0xFF); + hwp->writeAttr(hwp, 0x12, 0x0F); + hwp->writeAttr(hwp, 0x13, 0x00); + hwp->writeAttr(hwp, 0x14, 0x00); + + /* Crtc registers */ + /* horizontal total */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHTotal: 0x%03X -- 0x%03X\n", + mode->CrtcHTotal, ViaMode.HTotal)); + temp = (ViaMode.HTotal >> 3) - 5; + hwp->writeCrtc(hwp, 0x00, temp & 0xFF); + ViaCrtcMask(hwp, 0x36, temp >> 5, 0x08); - start = hwp->readCrtc(hwp, 0x02); /* Save Blanking Start */ - - end = hwp->readCrtc(hwp, 0x03) & 0x1F; /* Save Blanking End bit[4:0] */ - end |= ((hwp->readCrtc(hwp, 0x05) & 0x80) >> 2); /* Blanking End bit[5:0] */ + /* horizontal address */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHDisplay: 0x%02X\n", + mode->CrtcHDisplay)); + temp = (mode->CrtcHDisplay >> 3) - 1; + hwp->writeCrtc(hwp, 0x01, temp & 0xFF); + + /* horizontal blanking start */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHBlankStart: 0x%02X -- 0x%02X\n", + mode->CrtcHBlankStart, ViaMode.HBlankStart)); + /* TODO: Limit to 2048 in ViaValidMode */ + temp = (ViaMode.HBlankStart >> 3) - 1; + hwp->writeCrtc(hwp, 0x02, temp & 0xFF); + /* If HblankStart has more bits anywhere, add them here */ + + /* horizontal blanking end */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHBlankEnd: 0x%02X -- 0x%02X\n", + mode->CrtcHBlankEnd, ViaMode.HBlankEnd)); + temp = (ViaMode.HBlankEnd >> 3) - 1; + ViaCrtcMask(hwp, 0x03, temp, 0x1F); + ViaCrtcMask(hwp, 0x05, temp << 2, 0x80); + ViaCrtcMask(hwp, 0x33, temp >> 1, 0x20); + + /* CrtcHSkew ??? */ + + /* horizontal sync start */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHSyncStart: 0x%03X -- 0x%03X\n", + mode->CrtcHSyncStart, ViaMode.HSyncStart)); + temp = ViaMode.HSyncStart >> 3; + hwp->writeCrtc(hwp, 0x04, temp & 0xFF); + ViaCrtcMask(hwp, 0x33, temp >> 4, 0x10); + + /* horizontal sync end */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHSyncEnd: 0x%03X -- 0x%03X\n", + mode->CrtcHSyncEnd, ViaMode.HSyncEnd)); + temp = ViaMode.HSyncEnd >> 3; + ViaCrtcMask(hwp, 0x05, temp, 0x1F); + + /* vertical total */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVTotal: 0x%03X -- 0x%03X\n", + mode->CrtcVTotal, ViaMode.VTotal)); + temp = ViaMode.VTotal - 2; + hwp->writeCrtc(hwp, 0x06, temp & 0xFF); + ViaCrtcMask(hwp, 0x07, temp >> 8, 0x01); + ViaCrtcMask(hwp, 0x07, temp >> 4, 0x20); + ViaCrtcMask(hwp, 0x35, temp >> 10, 0x01); + + /* vertical address */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVDisplay: 0x%03X\n", + mode->CrtcVDisplay)); + temp = mode->CrtcVDisplay - 1; + hwp->writeCrtc(hwp, 0x12, temp & 0xFF); + ViaCrtcMask(hwp, 0x07, temp >> 7, 0x02); + ViaCrtcMask(hwp, 0x07, temp >> 3, 0x40); + ViaCrtcMask(hwp, 0x35, temp >> 8, 0x04); + + /* Primary starting address -> 0x00, adjustframe does the rest */ + hwp->writeCrtc(hwp, 0x0C, 0x00); + hwp->writeCrtc(hwp, 0x0D, 0x00); + hwp->writeCrtc(hwp, 0x34, 0x00); + ViaCrtcMask(hwp, 0x48, 0x00, 0x03); /* is this even possible on CLE266A ? */ + + /* vertical sync start */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVSyncStart: 0x%03X -- 0x%03X\n", + mode->CrtcVSyncStart, ViaMode.VSyncStart)); + temp = ViaMode.VSyncStart; + hwp->writeCrtc(hwp, 0x10, temp & 0xFF); + ViaCrtcMask(hwp, 0x07, temp >> 6, 0x04); + ViaCrtcMask(hwp, 0x07, temp >> 2, 0x80); + ViaCrtcMask(hwp, 0x35, temp >> 9, 0x02); + + /* vertical sync end */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVSyncEnd: 0x%01X -- 0x%01X\n", + mode->CrtcVSyncEnd, ViaMode.VSyncEnd)); + ViaCrtcMask(hwp, 0x11, ViaMode.VSyncEnd, 0x0F); + + /* line compare: We are not doing splitscreen so 0x3FFF */ + hwp->writeCrtc(hwp, 0x18, 0xFF); + ViaCrtcMask(hwp, 0x07, 0x10, 0x10); + ViaCrtcMask(hwp, 0x09, 0x40, 0x40); + ViaCrtcMask(hwp, 0x33, 0x07, 0x06); + ViaCrtcMask(hwp, 0x35, 0x10, 0x10); + + /* zero Maximum scan line */ + ViaCrtcMask(hwp, 0x09, 0x00, 0x1F); + hwp->writeCrtc(hwp, 0x14, 0x00); + + /* vertical blanking start */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVBlankStart: 0x%03X -- 0x%03X\n", + mode->CrtcVBlankStart, ViaMode.VBlankStart)); + temp = ViaMode.VBlankStart - 1; + hwp->writeCrtc(hwp, 0x15, temp & 0xFF); + ViaCrtcMask(hwp, 0x07, temp >> 5, 0x08); + ViaCrtcMask(hwp, 0x09, temp >> 4, 0x20); + ViaCrtcMask(hwp, 0x35, temp >> 7, 0x08); + + /* vertical blanking end */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVBlankEnd: 0x%03X -- 0x%03X\n", + mode->CrtcVBlankEnd, ViaMode.VBlankEnd)); + temp = ViaMode.VBlankEnd - 1; + hwp->writeCrtc(hwp, 0x16, temp); + + /* some leftovers */ + hwp->writeCrtc(hwp, 0x08, 0x00); + ViaCrtcMask(hwp, 0x32, 0, 0xFF); /* ? */ + ViaCrtcMask(hwp, 0x33, 0, 0xC8); - if ((start & 0x3f) > end) { /* Is Blanking End overflow ? */ - if (start & 0x40) /* Blanking Start bit6 = ? */ - ViaCrtcMask(hwp, 0x33, 0x00, 0x20); /* bit6 = 1, Blanking End bit6 = 0 */ - else - ViaCrtcMask(hwp, 0x33, 0x20, 0x20); /* bit6 = 0, Blanking End bit6 = 1 */ - } else { - if (start & 0x40) /* Blanking Start bit6 = ? */ - ViaCrtcMask(hwp, 0x33, 0x20, 0x20); /* bit6 = 1, Blanking End bit6 = 1 */ - else - ViaCrtcMask(hwp, 0x33, 0x00, 0x20); /* bit6 = 0, Blanking End bit6 = 0 */ - } + /* offset */ + temp = (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3)) >> 3; + if (temp & 0x03) { /* Make sure that this is 32byte aligned */ + temp += 0x03; + temp &= ~0x03; + } + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Offset: 0x%03X\n", temp)); + hwp->writeCrtc(hwp, 0x13, temp & 0xFF); + ViaCrtcMask(hwp, 0x35, temp >> 3, 0xE0); + + /* some leftovers */ + ViaCrtcMask(hwp, 0x32, 0, 0xFF); + ViaCrtcMask(hwp, 0x33, 0, 0xC8); } /* * */ -static Bool -ViaPrimaryRefreshPatch(vgaHWPtr hwp, int Refresh, VIABIOSRefreshTablePtr Table) +static CARD16 +ViaModeDotClockTranslate(ScrnInfoPtr pScrn, int DotClock) { - int index; - - for (index = 0; index < VIA_NUM_REFRESH_RATE; index++) { - if (Table[index].refresh == Refresh) { - VIABIOSRefreshTableRec entry = Table[index]; - VIASetPrimaryClock(hwp, entry.VClk); - - hwp->writeCrtc(hwp, 0x00, entry.CR[0]); - - hwp->writeCrtc(hwp, 0x02, entry.CR[1]); - hwp->writeCrtc(hwp, 0x03, entry.CR[2]); - hwp->writeCrtc(hwp, 0x04, entry.CR[3]); - hwp->writeCrtc(hwp, 0x05, entry.CR[4]); - hwp->writeCrtc(hwp, 0x06, entry.CR[5]); - hwp->writeCrtc(hwp, 0x07, entry.CR[6]); - - hwp->writeCrtc(hwp, 0x10, entry.CR[7]); - hwp->writeCrtc(hwp, 0x11, entry.CR[8]); - - hwp->writeCrtc(hwp, 0x15, entry.CR[9]); - hwp->writeCrtc(hwp, 0x16, entry.CR[10]); + int i; - VIASetUseExternalClock(hwp); - return TRUE; - } - } - return FALSE; + for (i = 0; ViaDotClocks[i].DotClock; i++) + if (ViaDotClocks[i].DotClock == DotClock) + return ViaDotClocks[i].UniChrome; + + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ViaModeDotClockTranslate: %d not " + "found in table.\n", DotClock); + return 0x0000; } /* * */ void -VIASetModeUseBIOSTable(ScrnInfoPtr pScrn, DisplayModePtr mode) +ViaModePrimary(ScrnInfoPtr pScrn, DisplayModePtr mode) { vgaHWPtr hwp = VGAHWPTR(pScrn); VIAPtr pVia = VIAPTR(pScrn); VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - int port, offset, mask, data; - int i; - Bool SetTV = FALSE; - VIAModeEntry Mode = Modes[pBIOSInfo->ModeIndex]; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIASetModeUseBIOSTable\n")); + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaModePrimary\n")); + /* Turn off Screen */ ViaCrtcMask(hwp, 0x17, 0x00, 0x80); - + /* Clean Second Path Status */ hwp->writeCrtc(hwp, 0x6A, 0x00); hwp->writeCrtc(hwp, 0x6B, 0x00); hwp->writeCrtc(hwp, 0x6C, 0x00); hwp->writeCrtc(hwp, 0x93, 0x00); - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Active Device is %d\n", - pBIOSInfo->ActiveDevice)); - - if ((pBIOSInfo->ActiveDevice & VIA_DEVICE_TV)) { - if (pBIOSInfo->TVIndex != VIA_TVRES_INVALID) { - SetTV = TRUE; - ViaTVModePreset(pScrn); - } else { - if (!pVia->SAMM) /* from via code */ - ViaTVClose(pVia); - } - } - - /* Get Standard VGA Regs */ - /* Set Sequences regs */ - for (i = 1; i < 5; i++) - hwp->writeSeq(hwp, i , Mode.stdVgaTable.SR[i]); - - /* Set Misc reg */ - hwp->writeMiscOut(hwp, Mode.stdVgaTable.misc); - - /* Set CRTC regs */ - for (i = 0; i < 25; i++) - hwp->writeCrtc(hwp, i, Mode.stdVgaTable.CR[i]); - - /* Set attribute regs */ - for (i = 0; i < 20; i++) - hwp->writeAttr(hwp, i, Mode.stdVgaTable.AR[i]); - - for (i = 0; i < 9; i++) - hwp->writeGr(hwp, i, Mode.stdVgaTable.GR[i]); - - /* Unlock Extended regs */ - hwp->writeSeq(hwp, 0x10, 0x01); - - /* Set Commmon Ext. Regs */ - for (i = 0; i < commExtTable.numEntry; i++) { - port = commExtTable.port[i]; - offset = commExtTable.offset[i]; - mask = commExtTable.mask[i]; - data = commExtTable.data[i] & mask; - ViaVgahwWrite(hwp, 0x300+port, offset, 0x301+port, data); - } - - if (Mode.Mode <= 0x13) { - /* Set Standard Mode-Spec. Extend Regs */ - for (i = 0; i < stdModeExtTable.numEntry; i++) { - port = stdModeExtTable.port[i]; - offset = stdModeExtTable.offset[i]; - mask = stdModeExtTable.mask[i]; - data = stdModeExtTable.data[i] & mask; - ViaVgahwWrite(hwp, 0x300+port, offset, 0x301+port, data); - } - } else { - /* Set Extended Mode-Spec. Extend Regs */ - for (i = 0; i < Mode.extModeExtTable.numEntry; i++) { - port = Mode.extModeExtTable.port[i]; - offset = Mode.extModeExtTable.offset[i]; - mask = Mode.extModeExtTable.mask[i]; - data = Mode.extModeExtTable.data[i] & mask; - ViaVgahwWrite(hwp, 0x300+port, offset, 0x301+port, data); - } - } - - /* ugly; we should set the standard modeclock if we don't need - to patch for the refresh rate */ - /* ResMode & RefreshIndex should be correct at this stage. */ - if (((pBIOSInfo->ResolutionIndex == VIA_RES_INVALID) || - (pBIOSInfo->RefreshIndex == 0xFF) || SetTV - || !ViaPrimaryRefreshPatch(hwp, supportRef[pBIOSInfo->RefreshIndex], - (VIABIOSRefreshTablePtr) refreshTable[pBIOSInfo->ResolutionIndex])) - && (Mode.VClk != 0)) { - VIASetPrimaryClock(hwp, Mode.VClk); - VIASetUseExternalClock(hwp); - } - - ViaSetPrimaryOffset(pScrn); + ViaModePrimaryVGA(pScrn, mode); + pBIOSInfo->Clock = ViaModeDotClockTranslate(pScrn, ViaModes[pBIOSInfo->ModeIndex].DotClock); + /* Don't do this before the Sequencer is set: locks up KM400 and K8M800 */ + if (pVia->FirstInit) + memset(pVia->FBBase, 0x00, pVia->videoRambytes); + /* Enable MMIO & PCI burst (1 wait state) */ ViaSeqMask(hwp, 0x1A, 0x06, 0x06); + + if (!pBIOSInfo->CrtActive) + ViaCrtcMask(hwp, 0x36, 0x30, 0x30); - /* Enable modify CRTC starting address */ - ViaCrtcMask(hwp, 0x11, 0x00, 0x80); - - ViaSetBlankingEndOverflow(hwp); - - /* LCD Simultaneous Set Mode */ - if ((pBIOSInfo->ActiveDevice & (VIA_DEVICE_DFP | VIA_DEVICE_LCD)) - && (pBIOSInfo->PanelIndex != VIA_BIOS_NUM_PANEL)) { + if (pBIOSInfo->PanelActive && (pBIOSInfo->PanelIndex != VIA_BIOS_NUM_PANEL)) { VIASetLCDMode(pScrn, mode); - VIAEnableLCD(pScrn); - } - else if ((pBIOSInfo->ConnectedDevice & (VIA_DEVICE_DFP | VIA_DEVICE_LCD)) && - (!pVia->HasSecondary)) { - VIADisableLCD(pScrn); - } - - if (SetTV) - ViaTVModePostSet(pScrn); + ViaLCDPower(pScrn, TRUE); + } else if (pBIOSInfo->PanelPresent) + ViaLCDPower(pScrn, FALSE); + + if (pBIOSInfo->TVActive && (pBIOSInfo->TVIndex != VIA_TVRES_INVALID)) + ViaTVSetMode(pScrn); + else + ViaTVPower(pScrn, FALSE); ViaSetPrimaryFIFO(pScrn, mode); + VIASetPrimaryClock(hwp, pBIOSInfo->Clock); + VIASetUseExternalClock(hwp); + /* Enable CRT Controller (3D5.17 Hardware Reset) */ ViaCrtcMask(hwp, 0x17, 0x80, 0x80); - /* Turn off CRT, if user doesn't want crt on */ - if (!(pBIOSInfo->ActiveDevice & VIA_DEVICE_CRT1)) - ViaCrtcMask(hwp, 0x36, 0x30, 0x30); - - /* Open Screen */ /* -- wrong -- this is your bogstandard vga palette disable */ hwp->disablePalette(hwp); - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "-- VIASetModeUseBIOSTable Done!\n")); } /* * */ static void -ViaSetSecondaryOffset(ScrnInfoPtr pScrn) +ViaModeSecondaryVGA(ScrnInfoPtr pScrn, DisplayModePtr mode) { vgaHWPtr hwp = VGAHWPTR(pScrn); - CARD16 Offset = (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3)) >> 3; + CARD16 tmp; - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaSetSecondaryOffset\n")); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaModeSecondaryVGA\n")); + + /* bpp */ + switch (pScrn->bitsPerPixel) { + case 8: + ViaCrtcMask(hwp, 0x67, 0x00, 0xC0); + break; + case 16: + ViaCrtcMask(hwp, 0x67, 0x40, 0xC0); + break; + case 24: + case 32: + ViaCrtcMask(hwp, 0x67, 0x80, 0xC0); + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unhandled bitdepth: %d\n", + pScrn->bitsPerPixel); + break; + } - /* Make sure that this is 32byte aligned */ - if (Offset & 0x03) { - Offset += 0x03; - Offset &= ~0x03; + /* offset */ + tmp = (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3)) >> 3; + if (tmp & 0x03) { /* Make sure that this is 32byte aligned */ + tmp += 0x03; + tmp &= ~0x03; } - hwp->writeCrtc(hwp, 0x66, Offset & 0xFF); - ViaCrtcMask(hwp, 0x67, Offset >> 8, 0x03); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "offset: 0x%03X\n", tmp)); + hwp->writeCrtc(hwp, 0x66, tmp & 0xFF); + ViaCrtcMask(hwp, 0x67, tmp >> 8, 0x03); } +/* + * + */ void -VIASetModeForMHS(ScrnInfoPtr pScrn, DisplayModePtr mode) +ViaModeSecondary(ScrnInfoPtr pScrn, DisplayModePtr mode) { vgaHWPtr hwp = VGAHWPTR(pScrn); VIAPtr pVia = VIAPTR(pScrn); VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIASetModeForMHS\n")); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaModeSecondary\n")); + /* Turn off Screen */ ViaCrtcMask(hwp, 0x17, 0x00, 0x80); - if (pBIOSInfo->ActiveDevice & VIA_DEVICE_TV) { - if (pBIOSInfo->TVIndex != VIA_TVRES_INVALID) { - ViaTVModePreset(pScrn); - ViaTVModePostSet(pScrn); - } else { - if (!pVia->SAMM) /* from via code */ - ViaTVClose(pVia); - } - } + ViaModeSecondaryVGA(pScrn, mode); + + if (pBIOSInfo->TVActive && (pBIOSInfo->TVIndex != VIA_TVRES_INVALID)) + ViaTVSetMode(pScrn); /* CLE266A2 apparently doesn't like this */ if ((pVia->Chipset != VIA_CLE266) || (pVia->ChipRev != 0x02)) ViaCrtcMask(hwp, 0x6C, 0x00, 0x1E); - if ((pBIOSInfo->ActiveDevice & (VIA_DEVICE_DFP | VIA_DEVICE_LCD)) - && (pBIOSInfo->PanelIndex != VIA_BIOS_NUM_PANEL)) { + if (pBIOSInfo->PanelActive && (pBIOSInfo->PanelIndex != VIA_BIOS_NUM_PANEL)) { pBIOSInfo->SetDVI = TRUE; VIASetLCDMode(pScrn, mode); - VIAEnableLCD(pScrn); - } - else if (pBIOSInfo->ConnectedDevice & (VIA_DEVICE_DFP | VIA_DEVICE_LCD)) { - VIADisableLCD(pScrn); - } + ViaLCDPower(pScrn, TRUE); + } else if (pBIOSInfo->PanelPresent) + ViaLCDPower(pScrn, FALSE); ViaSetSecondaryFIFO(pScrn, mode); - ViaSetSecondaryOffset(pScrn); - /* via code: 8bit = 0x00, 16bit = 0x40, 24 & 32bit = 0x80 */ - /* with this arithmetic 32bit becomes 0xC0 */ - ViaCrtcMask(hwp, 0x67, (pScrn->bitsPerPixel - 0x01) << 3, 0xC0); + VIASetSecondaryClock(hwp, pBIOSInfo->Clock); + VIASetUseExternalClock(hwp); + + ViaCrtcMask(hwp, 0x17, 0x80, 0x80); - /* Open Screen */ /* -- wrong -- this is your bogstandard vga palette disable */ hwp->disablePalette(hwp); - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "-- VIASetModeForMHS Done!\n")); } /* - * All of via lacks consistency. + * */ static void ViaLCDPowerSequence(vgaHWPtr hwp, VIALCDPowerSeqRec Sequence) @@ -2405,18 +1513,29 @@ ViaLCDPowerSequence(vgaHWPtr hwp, VIALCDPowerSeqRec Sequence) } } +/* + * + */ void -VIAEnableLCD(ScrnInfoPtr pScrn) +ViaLCDPower(ScrnInfoPtr pScrn, Bool On) { vgaHWPtr hwp = VGAHWPTR(pScrn); VIAPtr pVia = VIAPTR(pScrn); VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; int i; - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VIAEnableLCD\n")); +#ifdef HAVE_DEBUG + if (On) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaLCDPower: On.\n"); + else + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaLCDPower: Off.\n"); +#endif /* Enable LCD */ - ViaCrtcMask(hwp, 0x6A, 0x08, 0x08); + if (On) + ViaCrtcMask(hwp, 0x6A, 0x08, 0x08); + else + ViaCrtcMask(hwp, 0x6A, 0x00, 0x08); /* Find Panel Size Index for PowerSeq Table */ if (pVia->Chipset == VIA_CLE266) { @@ -2431,83 +1550,9 @@ VIAEnableLCD(ScrnInfoPtr pScrn) i = 2; usleep(1); - ViaLCDPowerSequence(hwp, powerOn[i]); + if (On) + ViaLCDPowerSequence(hwp, powerOn[i]); + else + ViaLCDPowerSequence(hwp, powerOff[i]); usleep(1); } - -void -VIADisableLCD(ScrnInfoPtr pScrn) -{ - vgaHWPtr hwp = VGAHWPTR(pScrn); - VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; - int i; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VIADisableLCD\n")); - - /* Disable LCD */ - ViaCrtcMask(hwp, 0x6A, 0x00, 0x08); - - for (i = 0; i < NumPowerOn; i++) { - if (lcdTable[pBIOSInfo->PanelIndex].powerSeq == powerOn[i].powerSeq) - break; - } - - ViaLCDPowerSequence(hwp, powerOff[i]); -} - -/* - * - * All palette. - * - */ -void -VIALoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, - LOCO *colors, VisualPtr pVisual) -{ - vgaHWPtr hwp = VGAHWPTR(pScrn); - VIAPtr pVia = VIAPTR(pScrn); - int i, index; - int SR1A, SR1B, CR67, CR6A; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIALoadPalette\n")); - - if (pScrn->bitsPerPixel != 8) - return; - - SR1A = hwp->readSeq(hwp, 0x1A); - SR1B = hwp->readSeq(hwp, 0x1B); - CR67 = hwp->readCrtc(hwp, 0x67); - CR6A = hwp->readCrtc(hwp, 0x6A); - - if (pVia->IsSecondary) { - ViaSeqMask(hwp, 0x1A, 0x01, 0x01); - ViaSeqMask(hwp, 0x1B, 0x80, 0x80); - ViaCrtcMask(hwp, 0x67, 0x00, 0xC0); - ViaCrtcMask(hwp, 0x6A, 0xC0, 0xC0); - } - - for (i = 0; i < numColors; i++) { - index = indices[i]; - hwp->writeDacWriteAddr(hwp, index); - hwp->writeDacData(hwp, colors[index].red); - hwp->writeDacData(hwp, colors[index].green); - hwp->writeDacData(hwp, colors[index].blue); - } - - if (pVia->IsSecondary) { - hwp->writeSeq(hwp, 0x1A, SR1A); - hwp->writeSeq(hwp, 0x1B, SR1B); - hwp->writeCrtc(hwp, 0x67, CR67); - hwp->writeCrtc(hwp, 0x6A, CR6A); - - /* Screen 0 palette was changed by mode setting of Screen 1, - * so load again */ - for (i = 0; i < numColors; i++) { - index = indices[i]; - hwp->writeDacWriteAddr(hwp, index); - hwp->writeDacData(hwp, colors[index].red); - hwp->writeDacData(hwp, colors[index].green); - hwp->writeDacData(hwp, colors[index].blue); - } - } -} diff --git a/src/via_mode.h b/src/via_mode.h index 20a4a2d..a0b4936 100644 --- a/src/via_mode.h +++ b/src/via_mode.h @@ -1,5 +1,5 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_mode.h,v 1.4 2004/02/09 01:45:23 dawes Exp $ */ /* + * Copyright 2004-2005 The Unichrome Project [unichrome.sf.net] * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. * @@ -26,70 +26,247 @@ #ifndef _VIA_MODE_H_ #define _VIA_MODE_H_ 1 -/* - * First some structs and defines that used to sit in via_bios.h +#define VIA_RES_640X480 0 +#define VIA_RES_800X600 1 +#define VIA_RES_1024X768 2 +#define VIA_RES_1152X864 3 +#define VIA_RES_1280X1024 4 +#define VIA_RES_1600X1200 5 +#define VIA_RES_1440X1050 6 +#define VIA_RES_1280X768 7 +#define VIA_RES_1280X960 8 +#define VIA_RES_1920X1440 9 +#define VIA_RES_848X480 10 +#define VIA_RES_1400X1050 11 +#define VIA_RES_720X480 12 +#define VIA_RES_720X576 13 +#define VIA_RES_1024X512 14 +#define VIA_RES_856X480 15 +#define VIA_RES_1024X576 16 +#define VIA_RES_INVALID 0xFF + +#define VIA_TVRES_640X480 0 +#define VIA_TVRES_800X600 1 +#define VIA_TVRES_1024X768 2 +#define VIA_TVRES_848X480 3 +#define VIA_TVRES_720X480 4 +#define VIA_TVRES_720X576 5 +#define VIA_TVRES_INVALID VIA_RES_INVALID + +/* + * simple lookuptable for TV/PanelIndex selection + */ + +struct { + int Index; + int TVIndex; + int PanelIndex; + int X; + int Y; +} ViaResolutionTable[] = { + {VIA_RES_640X480, VIA_TVRES_640X480, VIA_PANEL6X4, 640, 480}, + {VIA_RES_800X600, VIA_TVRES_800X600, VIA_PANEL8X6, 800, 600}, + {VIA_RES_1024X768, VIA_TVRES_1024X768, VIA_PANEL10X7, 1024, 768}, + {VIA_RES_1152X864, VIA_TVRES_INVALID, VIA_PANEL_INVALID, 1152, 864}, + {VIA_RES_1280X1024, VIA_TVRES_INVALID, VIA_PANEL12X10, 1280, 1024}, + {VIA_RES_1600X1200, VIA_TVRES_INVALID, VIA_PANEL16X12, 1600, 1200}, + {VIA_RES_1440X1050, VIA_TVRES_INVALID, VIA_PANEL_INVALID, 1440, 1050}, + {VIA_RES_1280X768, VIA_TVRES_INVALID, VIA_PANEL12X7, 1280, 768}, + {VIA_RES_1280X960, VIA_TVRES_INVALID, VIA_PANEL_INVALID, 1280, 960}, + /* {VIA_RES_1920X1440, VIA_TVRES_INVALID, VIA_PANEL_INVALID, 1920, 1140}, */ + {VIA_RES_848X480, VIA_TVRES_848X480, VIA_PANEL_INVALID, 848, 480}, + {VIA_RES_1400X1050, VIA_TVRES_INVALID, VIA_PANEL14X10, 1400, 1050}, + {VIA_RES_720X480, VIA_TVRES_720X480, VIA_PANEL_INVALID, 720, 480}, + {VIA_RES_720X576, VIA_TVRES_720X576, VIA_PANEL_INVALID, 720, 576}, + {VIA_RES_1024X512, VIA_TVRES_INVALID, VIA_PANEL_INVALID, 1024, 512}, + {VIA_RES_856X480, VIA_TVRES_INVALID, VIA_PANEL_INVALID, 856, 480}, + {VIA_RES_1024X576, VIA_TVRES_INVALID, VIA_PANEL_INVALID, 1024, 576}, + {VIA_RES_INVALID, VIA_TVRES_INVALID, VIA_PANEL_INVALID, 0, 0} +}; + +/* + * Refresh rates + */ +#define VIA_NUM_REFRESH_RATE 5 +static const int supportRef[VIA_NUM_REFRESH_RATE] = { 60, 75, 85, 100, 120 }; + +struct { + CARD16 Width; + CARD16 Height; + CARD8 Refresh; + CARD8 MemClk_8b; + CARD8 MemClk_16b; + CARD8 MemClk_32b; +} ViaRefreshAllowedTable[] = { + { 640, 480, 60, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 640, 480, 75, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 640, 480, 85, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 640, 480, 100, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 640, 480, 120, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 800, 600, 60, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 800, 600, 75, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 800, 600, 85, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 800, 600, 100, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 800, 600, 120, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_NONE }, + { 1024, 768, 60, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 1024, 768, 75, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 1024, 768, 85, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 1024, 768, 100, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_NONE }, + { 1152, 864, 60, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 1152, 864, 75, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 1280, 1024, 60, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 1280, 1024, 75, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR133 }, + { 1280, 1024, 85, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_DDR266 }, + { 1600, 1200, 60, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_DDR266 }, + { 1600, 1200, 75, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_NONE }, + { 1600, 1200, 85, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_NONE }, + { 1440, 1050, 60, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 1280, 768, 60, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 1280, 960, 60, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 848, 480, 60, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 1400, 1050, 60, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 720, 480, 60, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 720, 576, 60, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 1024, 512, 60, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 856, 480, 60, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 1024, 576, 60, VIA_MEM_SDR100, VIA_MEM_SDR100, VIA_MEM_SDR100 }, + { 0, 0, 0, VIA_MEM_NONE, VIA_MEM_NONE, VIA_MEM_NONE } +}; + +struct ViaModeLine { + int Width; + int Height; + int Refresh; + int DotClock; + int HBlankStart; + int HSyncStart; + int HSyncEnd; + int HBlankEnd; + int HTotal; + int VBlankStart; + int VSyncStart; + int VSyncEnd; + int VBlankEnd; + int VTotal; + Bool HSyncPos; + Bool VSyncPos; +} ViaModes[] = { + { 640, 480, 60, 25312, 640, 656, 752, 800, 800, 480, 489, 491, 525, 525, FALSE, FALSE }, + { 640, 480, 75, 31619, 640, 656, 720, 840, 840, 480, 480, 483, 500, 500, FALSE, FALSE }, + { 640, 480, 85, 36153, 640, 696, 752, 832, 832, 480, 480, 483, 509, 509, FALSE, FALSE }, + { 640, 480, 100, 43312, 640, 680, 744, 848, 848, 480, 480, 483, 509, 509, FALSE, FALSE }, + { 640, 480, 120, 52350, 640, 680, 744, 848, 848, 480, 480, 483, 515, 515, FALSE, FALSE }, + { 800, 600, 60, 39822, 800, 840, 968, 1056, 1056, 600, 600, 604, 628, 628, TRUE , TRUE }, + { 800, 600, 75, 49516, 800, 816, 896, 1056, 1056, 600, 600, 603, 625, 625, TRUE , TRUE }, + { 800, 600, 85, 56249, 800, 832, 896, 1048, 1048, 600, 600, 603, 631, 631, TRUE , TRUE }, + { 800, 600, 100, 68011, 800, 848, 936, 1072, 1072, 600, 600, 603, 636, 636, TRUE , TRUE }, + { 800, 600, 120, 83863, 800, 856, 944, 1088, 1088, 600, 600, 603, 643, 643, TRUE , TRUE }, + { 1024, 768, 60, 65028, 1024, 1048, 1184, 1344, 1344, 768, 770, 776, 806, 806, FALSE, FALSE }, + { 1024, 768, 75, 78749, 1024, 1040, 1136, 1312, 1312, 768, 768, 771, 800, 800, FALSE, FALSE }, + { 1024, 768, 85, 94499, 1024, 1072, 1168, 1376, 1376, 768, 768, 771, 808, 808, FALSE, FALSE }, + { 1024, 768, 100, 113351, 1024, 1096, 1208, 1392, 1392, 768, 768, 771, 814, 814, FALSE, FALSE }, + { 1152, 864, 60, 81613, 1152, 1216, 1336, 1520, 1520, 864, 864, 867, 895, 895, TRUE , TRUE }, + { 1152, 864, 75, 108408, 1152, 1216, 1344, 1600, 1600, 864, 864, 867, 900, 900, TRUE , TRUE }, + { 1280, 1024, 60, 108280, 1280, 1328, 1440, 1688, 1688, 1024, 1024, 1027, 1066, 1066, TRUE , TRUE }, + { 1280, 1024, 75, 134589, 1280, 1296, 1440, 1688, 1688, 1024, 1024, 1027, 1066, 1066, TRUE , TRUE }, + { 1280, 1024, 85, 157498, 1280, 1344, 1504, 1728, 1728, 1024, 1024, 1027, 1072, 1072, TRUE , TRUE }, + { 1600, 1200, 60, 161793, 1600, 1664, 1856, 2160, 2160, 1200, 1200, 1203, 1250, 1250, TRUE , TRUE }, + { 1600, 1200, 75, 202497, 1600, 1664, 1856, 2160, 2160, 1200, 1200, 1203, 1250, 1250, TRUE , TRUE }, + { 1600, 1200, 85, 229088, 1600, 1664, 1856, 2160, 2160, 1200, 1200, 1203, 1250, 1250, TRUE , TRUE }, + { 1280, 768, 60, 81135, 1280, 1328, 1440, 1688, 1688, 768, 770, 776, 802, 802, TRUE , FALSE }, + { 1280, 960, 60, 108280, 1280, 1376, 1488, 1800, 1800, 960, 960, 963, 1000, 1000, TRUE , TRUE }, + { 848, 480, 60, 33750, 848, 864, 976, 1088, 1088, 480, 485, 493, 517, 517, TRUE , TRUE }, + { 1400, 1050, 60, 122726, 1400, 1488, 1640, 1880, 1880, 1050, 1050, 1053, 1087, 1087, FALSE, TRUE }, + { 720, 480, 60, 26591, 720, 736, 808, 896, 896, 480, 480, 483, 497, 497, FALSE, TRUE }, + { 720, 576, 60, 32663, 720, 744, 816, 912, 912, 576, 576, 579, 597, 597, FALSE, TRUE }, + { 1024, 512, 60, 41164, 1024, 1056, 1160, 1296, 1296, 512, 512, 515, 531, 531, FALSE, TRUE }, + { 856, 480, 60, 31704, 856, 872, 960, 1064, 1064, 480, 480, 483, 497, 497, FALSE, TRUE }, + { 1024, 576, 60, 46981, 1024, 1064, 1168, 1312, 1312, 576, 576, 579, 597, 597, FALSE, TRUE }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, FALSE, FALSE } +}; + +struct ViaDotClock { + int DotClock; + CARD16 UniChrome; + /* CARD32 UniChromePro; */ +} ViaDotClocks[] = { + { 25312, 0xC763 }, + { 26591, 0x471A }, + { 31619, 0xC335 }, + { 31704, 0x471F }, + { 32663, 0xC449 }, + { 33750, 0x4721 }, + { 36153, 0xC565 }, + { 39822, 0xC459 }, + { 41164, 0x4417 }, + { 43312, 0x8A79 }, + { 46981, 0x5069 }, + { 49516, 0x8653 }, + { 52350, 0x8875 }, + { 56249, 0x4737 }, + { 65028, 0x866D }, + { 68011, 0x0413 }, + { 78749, 0x4321 }, + { 81135, 0x0622 }, + { 81613, 0x4539 }, + { 83863, 0x0729 }, + { 94499, 0x0521 }, + { 108280, 0x4879 }, + { 108280, 0x4879 }, + { 108408, 0x476A }, + { 113351, 0x465F }, + { 122726, 0x073C }, + { 134589, 0x455E }, + { 157498, 0x0537 }, + { 161793, 0x4571 }, + { 202497, 0x0763 }, + { 229088, 0x0550 }, + { 0, 0 }, +}; + +/* + * + * Panel * */ -#define VIA_BIOS_REG_TABLE_MAX_NUM 32 +struct { + CARD16 Width; + CARD16 Height; + CARD8 mode_8b; + CARD8 mode_16b; + CARD8 mode_32b; +} ViaVesaModes[] = { + { 400, 300, 0x22, 0x23, 0x24 }, + { 512, 384, 0x25, 0x26, 0x27 }, + { 640, 400, 0x30, 0x2E, 0x2F }, + { 640, 480, 0x31, 0x33, 0x34 }, + { 800, 600, 0x36, 0x38, 0x39 }, + { 1024, 768, 0x3B, 0x3D, 0x3E }, + { 1152, 864, 0x40, 0x42, 0x43 }, + { 1280, 1024, 0x45, 0x47, 0x48 }, + { 1600, 1200, 0x4A, 0x4C, 0x4D }, + { 1440, 1050, 0x50, 0x52, 0x53 }, + { 1280, 768, 0x54, 0x56, 0x57 }, + { 1280, 960, 0x58, 0x5A, 0x5B }, + { 320, 200, 0x5C, 0x5D, 0x5E }, + { 1920, 1440, 0x60, 0x61, 0x62 }, + { 848, 480, 0x63, 0x64, 0x65 }, + { 1400, 1050, 0x66, 0x67, 0x68 }, + { 720, 480, 0x70, 0x71, 0x72 }, + { 720, 576, 0x73, 0x74, 0x75 }, + { 1024, 512, 0x76, 0x77, 0x78 }, + { 856, 480, 0x79, 0x7A, 0x7B }, + { 320, 240, 0x7C, 0x7D, 0x7E }, + { 0, 0, 0, 0, 0 }, +}; + #define VIA_BIOS_REG_LCD_MAX_NUM 48 -#define VIA_BIOS_NUM_RES 17 -#define VIA_BIOS_NUM_REFRESH 5 #define VIA_BIOS_NUM_LCD_SUPPORT_MASK 8 -#define VIA_BIOS_NUM_LCD_POWER_SEQ 4 #define VIA_BIOS_NUM_PANEL 7 #define VIA_BIOS_MAX_NUM_MPATCH2 18 #define VIA_BIOS_MAX_NUM_MPATCH1 9 #define VIA_BIOS_MAX_NUM_CTREXP 5 -#define VIA_BIOS_MAX_NUM_TV_REG 144 /* 00 - 8F, tv2,tv3 are the same */ -#define VIA_BIOS_MAX_NUM_TV_CRTC 32 -#define VIA_BIOS_NUM_TV_SPECIAL_REG 8 -#define VIA_BIOS_MAX_NUM_TV_PATCH 8 -#define VIA_BIOS_NUM_TV_OTHER 16 -#define VIA_BIOS_NUM_TV2 2 -#define VIA_BIOS_NUM_TV3 6 - -typedef struct _VIABIOSSTDVGATABLE { - CARD8 columns; - CARD8 rows; - CARD8 fontHeight; - CARD16 pageSize; - CARD8 SR[5]; - CARD8 misc; - CARD8 CR[25]; - CARD8 AR[20]; - CARD8 GR[9]; -} VIABIOSStdVGATableRec, *VIABIOSStdVGATablePtr; - - -typedef struct _VIABIOSREFRESHTABLE { - CARD8 refresh; - CARD16 VClk; - CARD8 CR[14]; -} VIABIOSRefreshTableRec, *VIABIOSRefreshTablePtr; - - -typedef struct _VIABIOSREGTABLE { - CARD8 port[VIA_BIOS_REG_TABLE_MAX_NUM]; - CARD8 offset[VIA_BIOS_REG_TABLE_MAX_NUM]; - CARD8 mask[VIA_BIOS_REG_TABLE_MAX_NUM]; - CARD8 data[VIA_BIOS_REG_TABLE_MAX_NUM]; - int numEntry; -} VIABIOSRegTableRec, *VIABIOSRegTablePtr; - - -typedef struct _VIAVMODEENTRY { - unsigned short Width; - unsigned short Height; - unsigned short Bpp; - unsigned short Mode; - unsigned short MemNeed; - unsigned short MClk; - unsigned short VClk; - VIABIOSStdVGATableRec stdVgaTable; - VIABIOSRegTableRec extModeExtTable; -} VIAModeEntry, *VIAModeEntryPtr; - typedef struct _VIALCDMODEENTRY { CARD16 LCDClk; @@ -116,24 +293,6 @@ typedef struct _VIALCDMPATCHENTRY { } VIALCDMPatchEntry, *VIALCDMPatchEntryPtr; -typedef struct _VIALCDMODEFIX { - CARD8 reqMode[32]; - CARD8 fixMode[32]; - int numEntry; -} VIALCDModeFixRec, *VIALCDModeFixRecPtr; - - -typedef struct _VIALCDPOWERSEQUENCE { - CARD8 powerSeq; - CARD8 port[4]; - CARD8 offset[4]; - CARD8 mask[4]; - CARD8 data[4]; - CARD16 delay[4]; - int numEntry; -} VIALCDPowerSeqRec, *VIALCDPowerSeqRecPtr; - - typedef struct _VIALCDMODETABLE { CARD8 fpIndex; CARD8 fpSize; @@ -155,312 +314,6 @@ typedef struct _VIALCDMODETABLE { VIALCDModeEntry MExp[VIA_BIOS_MAX_NUM_CTREXP]; } VIALCDModeTableRec, *VIALCDModePtr; - -typedef struct _VIATVMASKTABLE { - CARD8 TV[VIA_BIOS_MAX_NUM_TV_REG]; - CARD8 CRTC1[VIA_BIOS_MAX_NUM_TV_CRTC]; - CARD8 CRTC2[VIA_BIOS_MAX_NUM_TV_CRTC]; - CARD8 misc1; - CARD8 misc2; - int numTV; - int numCRTC1; - int numCRTC2; -} VIABIOSTVMASKTableRec, *VIABIOSTVMASKTablePtr; - -typedef struct _VIATVMODETABLE { - CARD8 TVNTSCC[VIA_BIOS_MAX_NUM_TV_REG]; - CARD8 TVNTSCS[VIA_BIOS_MAX_NUM_TV_REG]; - CARD8 CRTCNTSC1[VIA_BIOS_MAX_NUM_TV_CRTC]; - CARD8 MiscNTSC1[VIA_BIOS_NUM_TV_SPECIAL_REG]; - CARD8 MiscNTSC2[VIA_BIOS_NUM_TV_SPECIAL_REG]; - CARD8 CRTCNTSC2_8BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; - CARD8 CRTCNTSC2_16BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; - CARD8 CRTCNTSC2_32BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; - CARD16 PatchNTSC2[VIA_BIOS_MAX_NUM_TV_PATCH]; - CARD16 DotCrawlNTSC[VIA_BIOS_NUM_TV_OTHER]; - CARD8 TVPALC[VIA_BIOS_MAX_NUM_TV_REG]; - CARD8 TVPALS[VIA_BIOS_MAX_NUM_TV_REG]; - CARD8 CRTCPAL1[VIA_BIOS_MAX_NUM_TV_CRTC]; - CARD8 MiscPAL1[VIA_BIOS_NUM_TV_SPECIAL_REG]; - CARD8 MiscPAL2[VIA_BIOS_NUM_TV_SPECIAL_REG]; - CARD8 CRTCPAL2_8BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; - CARD8 CRTCPAL2_16BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; - CARD8 CRTCPAL2_32BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; - CARD16 PatchPAL2[VIA_BIOS_MAX_NUM_TV_PATCH]; -} VIABIOSTV2TableRec, *VIABIOSTV2TablePtr; - - -typedef struct _VIATV3MODETABLE { - CARD8 TVNTSC[VIA_BIOS_MAX_NUM_TV_REG]; - CARD8 CRTCNTSC1[VIA_BIOS_MAX_NUM_TV_CRTC]; - CARD8 MiscNTSC1[VIA_BIOS_NUM_TV_SPECIAL_REG]; - CARD8 MiscNTSC2[VIA_BIOS_NUM_TV_SPECIAL_REG]; - CARD8 CRTCNTSC2_8BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; - CARD8 CRTCNTSC2_16BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; - CARD8 CRTCNTSC2_32BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; - CARD16 PatchNTSC2[VIA_BIOS_MAX_NUM_TV_PATCH]; - CARD16 RGBNTSC[VIA_BIOS_NUM_TV_OTHER]; - CARD16 YCbCrNTSC[VIA_BIOS_NUM_TV_OTHER]; - CARD16 SDTV_RGBNTSC[VIA_BIOS_NUM_TV_OTHER]; - CARD16 SDTV_YCbCrNTSC[VIA_BIOS_NUM_TV_OTHER]; - CARD16 DotCrawlNTSC[VIA_BIOS_NUM_TV_OTHER]; - CARD8 TVPAL[VIA_BIOS_MAX_NUM_TV_REG]; - CARD8 CRTCPAL1[VIA_BIOS_MAX_NUM_TV_CRTC]; - CARD8 MiscPAL1[VIA_BIOS_NUM_TV_SPECIAL_REG]; - CARD8 MiscPAL2[VIA_BIOS_NUM_TV_SPECIAL_REG]; - CARD8 CRTCPAL2_8BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; - CARD8 CRTCPAL2_16BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; - CARD8 CRTCPAL2_32BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; - CARD16 PatchPAL2[VIA_BIOS_MAX_NUM_TV_PATCH]; - CARD16 RGBPAL[VIA_BIOS_NUM_TV_OTHER]; - CARD16 YCbCrPAL[VIA_BIOS_NUM_TV_OTHER]; - CARD16 SDTV_RGBPAL[VIA_BIOS_NUM_TV_OTHER]; - CARD16 SDTV_YCbCrPAL[VIA_BIOS_NUM_TV_OTHER]; -} VIABIOSTV3TableRec, *VIABIOSTV3TablePtr; - -/* - * Former via_mode.h tables - * - */ -static const unsigned short BIOSVer = 0X10; -/* Date: 04/15/03 */ -/* static char BIOSDate[] = - { 0X30, 0X34, 0X2F, 0X31, 0X35, 0X2F, 0X30, 0X33, 0 }; */ - -static const unsigned short NumModes = 97; - -static const int NumPowerOn = 2; - -static const int NumPowerOff = 2; - -static VIAModeEntry Modes[] = { - { 0, 0, 4, 0, 0, 0, 0, { 40, 24, 8, 0X800, { 0, 0X9, 0X3, 0, 0X2 }, 0X63, { 0X2D, 0X27, 0X28, 0X90, 0X2B, 0XA0, 0XBF, 0X1F, 0, 0XC7, 0X6, 0X7, 0, 0, 0, 0, 0X9C, 0X6E, 0X8F, 0X14, 0X1F, 0X96, 0XB9, 0XA3, 0XFF }, { 0, 0X1, 0X2, 0X3, 0X4, 0X5, 0X6, 0X7, 0X10, 0X11, 0X12, 0X13, 0X14, 0X15, 0X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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0XFE, 0XFD, 0XFF, 0X3, 0X7, 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, 0X58, 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 }, 5 }; - -static const VIABIOSRefreshTableRec refreshTable[17][5] = { - { - { 75, 0XC3B5, { 0X64, 0X4F, 0X88, 0X52, 0X9A, 0XF2, 0X1F, 0XE0, 0X3, 0XDF, 0XF3, 0, 0, 0 } }, - { 85, 0XC5E5, { 0X63, 0X4F, 0X87, 0X57, 0X9E, 0XFB, 0X1F, 0XE0, 0X3, 0XDF, 0XFC, 0, 0, 0 } }, - { 100, 0XC579, { 0X65, 0X4F, 0X89, 0X55, 0X9D, 0XFB, 0X1F, 0XE0, 0X3, 0XDF, 0XFC, 0, 0, 0 } }, - { 120, 0XC475, { 0X65, 0X4F, 0X89, 0X55, 0X9D, 0X1, 0X3E, 0XE0, 0X3, 0XDF, 0X2, 0, 0, 0 } }, - { 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - }, - { - { 75, 0X8653, { 0X7F, 0X63, 0X83, 0X66, 0X10, 0X6F, 0XF0, 0X58, 0XB, 0X57, 0X70, 0, 0, 0 } }, - { 85, 0X47B7, { 0X7E, 0X63, 0X82, 0X68, 0X10, 0X75, 0XF0, 0X58, 0XB, 0X57, 0X76, 0, 0, 0 } }, - { 100, 0X413, { 0X81, 0X63, 0X85, 0X6A, 0X15, 0X7A, 0XF0, 0X58, 0XB, 0X57, 0X7B, 0, 0, 0 } }, - { 120, 0X729, { 0X83, 0X63, 0X87, 0X6B, 0X16, 0X81, 0XF0, 0X58, 0XB, 0X57, 0X82, 0, 0, 0 } }, - { 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - }, - { - { 75, 0X4321, { 0X9F, 0X7F, 0X83, 0X82, 0X8E, 0X1E, 0XF5, 0, 0X3, 0XFF, 0X1F, 0, 0, 0 } }, - { 85, 0X521, { 0XA7, 0X7F, 0X8B, 0X86, 0X92, 0X26, 0XF5, 0, 0X3, 0XFF, 0X27, 0, 0, 0 } }, - { 100, 0X465F, { 0XA9, 0X7F, 0XD, 0X89, 0X97, 0X2C, 0XF5, 0, 0X3, 0XFF, 0X2D, 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, 0, 0, 0, 0, 0, 0 } }, - }, - { - { 75, 0X47EA, { 0XC3, 0X8F, 0X87, 0X98, 0X8, 0X82, 0XFF, 0X60, 0X3, 0X5F, 0X83, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - }, - { - { 75, 0X455E, { 0XCE, 0X9F, 0X92, 0XA2, 0X14, 0X28, 0X5A, 0, 0X3, 0XFF, 0X29, 0, 0, 0 } }, - { 85, 0X5B7, { 0XD3, 0X9F, 0X97, 0XA8, 0X1C, 0X2E, 0X5A, 0, 0X3, 0XFF, 0X2F, 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, 0, 0, 0, 0, 0, 0 } }, - { 0, 0, { 0, 0, 0, 0,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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, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0 } } - } -}; - static const VIALCDModeTableRec lcdTable[] = { { 0, 0, 0X1, 13, 13, 5, 5, { 0XE0FF, 0XF, 0XC0FC, 0X1B, 0, 0X7000, 0, 0X7000 }, @@ -1045,6 +898,22 @@ static const VIALCDModeTableRec lcdTable[] = { } }; +static const int NumPowerOn = 2; + +static const int NumPowerOff = 2; + +typedef struct _VIALCDPOWERSEQUENCE { + CARD8 powerSeq; + CARD8 port[4]; + CARD8 offset[4]; + CARD8 mask[4]; + CARD8 data[4]; + CARD16 delay[4]; + int numEntry; +} VIALCDPowerSeqRec, *VIALCDPowerSeqRecPtr; + +#define VIA_BIOS_NUM_LCD_POWER_SEQ 4 + static const VIALCDPowerSeqRec powerOn[] = { { 0, { 0XD4, 0XD4, 0, 0 }, { 0X91, 0X91, 0, 0 }, { 0X10, 0X8, 0, 0 }, { 0X10, 0X8, 0, 0 }, { 0X19, 0X64, 0, 0 }, 2 }, { 1, { 0XD4, 0XD4, 0XD4, 0 }, { 0X91, 0X91, 0X91, 0 }, { 0X10, 0X8, 0X6, 0 }, { 0X10, 0X8, 0X6, 0 }, { 0X19, 0X1FE, 0X1, 0 }, 3 }, @@ -1059,6 +928,12 @@ static const VIALCDPowerSeqRec powerOff[] = { { 0, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0 } }; +typedef struct _VIALCDMODEFIX { + CARD8 reqMode[32]; + CARD8 fixMode[32]; + int numEntry; +} VIALCDModeFixRec, *VIALCDModeFixRecPtr; + static const VIALCDModeFixRec modeFix = { { 0X1, 0X3, 0X7, 0X5, 0X2E, 0X2F, 0X52, 0X53, 0X56, 0X57, 0X5A, 0X5B, 0X67, 0X68, 0X5D, 0X5E, 0X7D, 0X7E, 0X23, 0X24, 0X26, 0X27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0X2, 0X2, 0X4, 0X30, 0X30, 0X50, 0X50, 0X54, 0X54, 0X58, 0X58, 0X66, 0X66, 0X5C, 0X5C, 0X7C, 0X7C, 0X22, 0X22, 0X25, 0X25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 22 }; diff --git a/src/via_priv.h b/src/via_priv.h index 633f375..7bafdde 100644 --- a/src/via_priv.h +++ b/src/via_priv.h @@ -1,31 +1,20 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_priv.h,v 1.4 2003/12/17 18:57:18 dawes Exp $ */ - #ifndef _VIA_PRIV_H_ #define _VIA_PRIV_H_ 1 #ifdef XF86DRI #include "via_common.h" #endif -#include "via_capture.h" /* * Alignment macro functions */ -#define ALIGN_TO_32_BYTES(f) (((f) + 31) & ~31) -#define ALIGN_TO_16_BYTES(f) (((f) + 15) & ~15) -#define ALIGN_TO_256_BITS(f) (((f) + 255) & ~255) -#define ALIGN_TO_8_BYTES(f) (((f) + 7) & ~7) -#define ALIGN_TO_64_BITS(f) (((f) + 63) & ~63) -#define ENG_ALIGN_BYTE ALIGN_TO_32_BYTES -#define ENG_ALIGN_BIT ALIGN_TO_256_BITS +#define ALIGN_TO(f, alignment) (((f) + ((alignment)-1)) & ~((alignment)-1)) /* * FOURCC definitions */ #define FOURCC_VIA 0x4E4B4C57 /*VIA*/ -#define FOURCC_TV0 0x00325654 /*TV0*/ -#define FOURCC_TV1 0x00315654 /*TV1*/ /* * Structures for create surface @@ -106,8 +95,6 @@ typedef struct _DDLOCK unsigned long dwVersion; unsigned long dwFourCC; unsigned long dwPhysicalBase; - CAPDEVICE Capdev_TV0; - CAPDEVICE Capdev_TV1; SWDEVICE SWDevice; } DDLOCK; typedef DDLOCK * LPDDLOCK; @@ -241,7 +228,6 @@ typedef VIAMem *VIAMemPtr; typedef struct { - unsigned long gdwVideoFlagTV1; unsigned long gdwVideoFlagSW; unsigned long gdwVideoFlagMPEG; unsigned long gdwAlphaEnabled; /* For Alpha blending use*/ diff --git a/src/via_regs.h b/src/via_regs.h index d84ca0c..5c2d359 100644 --- a/src/via_regs.h +++ b/src/via_regs.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_regs.h,v 1.3 2003/08/27 15:16:13 tsi Exp $ */ /* * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. diff --git a/src/via_shadow.c b/src/via_shadow.c index 5ad738f..2265d7b 100644 --- a/src/via_shadow.c +++ b/src/via_shadow.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_shadow.c,v 1.3 2003/08/27 15:16:13 tsi Exp $ */ /* * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. @@ -43,7 +42,7 @@ VIARefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) height = pbox->y2 - pbox->y1; src = pVia->ShadowPtr + (pbox->y1 * pVia->ShadowPitch) + (pbox->x1 * Bpp); - dst = pVia->FBStart + (pbox->y1 * FBPitch) + (pbox->x1 * Bpp); + dst = pVia->FBBase + (pbox->y1 * FBPitch) + (pbox->x1 * Bpp); while (height--) { memcpy(dst, src, width); @@ -95,12 +94,12 @@ VIARefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox) height = (y2 - y1) >> 2; /* in dwords */ if (pVia->rotate == 1) { - dstPtr = pVia->FBStart + (pbox->x1 * dstPitch) + + dstPtr = pVia->FBBase + (pbox->x1 * dstPitch) + pScrn->virtualX - y2; srcPtr = pVia->ShadowPtr + ((1 - y2) * srcPitch) + pbox->x1; } else { - dstPtr = pVia->FBStart + + dstPtr = pVia->FBBase + ((pScrn->virtualY - pbox->x2) * dstPitch) + y1; srcPtr = pVia->ShadowPtr + (y1 * srcPitch) + pbox->x2 - 1; } @@ -144,13 +143,13 @@ VIARefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox) height = (y2 - y1) >> 1; /* in dwords */ if (pVia->rotate == 1) { - dstPtr = (CARD16*)pVia->FBStart + + dstPtr = (CARD16*)pVia->FBBase + (pbox->x1 * dstPitch) + pScrn->virtualX - y2; srcPtr = (CARD16*)pVia->ShadowPtr + ((1 - y2) * srcPitch) + pbox->x1; } else { - dstPtr = (CARD16*)pVia->FBStart + + dstPtr = (CARD16*)pVia->FBBase + ((pScrn->virtualY - pbox->x2) * dstPitch) + y1; srcPtr = (CARD16*)pVia->ShadowPtr + (y1 * srcPitch) + pbox->x2 - 1; @@ -194,12 +193,12 @@ VIARefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox) height = (y2 - y1) >> 2; /* blocks of 3 dwords */ if (pVia->rotate == 1) { - dstPtr = pVia->FBStart + + dstPtr = pVia->FBBase + (pbox->x1 * dstPitch) + ((pScrn->virtualX - y2) * 3); srcPtr = pVia->ShadowPtr + ((1 - y2) * srcPitch) + (pbox->x1 * 3); } else { - dstPtr = pVia->FBStart + + dstPtr = pVia->FBBase + ((pScrn->virtualY - pbox->x2) * dstPitch) + (y1 * 3); srcPtr = pVia->ShadowPtr + (y1 * srcPitch) + (pbox->x2 * 3) - 3; } @@ -245,13 +244,13 @@ VIARefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox) height = pbox->y2 - pbox->y1; if (pVia->rotate == 1) { - dstPtr = (CARD32*)pVia->FBStart + + dstPtr = (CARD32*)pVia->FBBase + (pbox->x1 * dstPitch) + pScrn->virtualX - pbox->y2; srcPtr = (CARD32*)pVia->ShadowPtr + ((1 - pbox->y2) * srcPitch) + pbox->x1; } else { - dstPtr = (CARD32*)pVia->FBStart + + dstPtr = (CARD32*)pVia->FBBase + ((pScrn->virtualY - pbox->x2) * dstPitch) + pbox->y1; srcPtr = (CARD32*)pVia->ShadowPtr + (pbox->y1 * srcPitch) + pbox->x2 - 1; diff --git a/src/via_swov.c b/src/via_swov.c index ab07390..35f4f50 100644 --- a/src/via_swov.c +++ b/src/via_swov.c @@ -1,5 +1,5 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_swov.c,v 1.11 2004/02/04 04:15:09 dawes Exp $ */ /* + * Copyright 2004 The Unichrome Project [unichrome.sf.net] * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. * @@ -28,9 +28,6 @@ #include "xf86_ansic.h" #include "xf86fbman.h" -#include "via_compose.h" -#include "via_capture.h" - #include "via.h" #ifdef XF86DRI #include "xf86drm.h" @@ -78,144 +75,130 @@ VIAVidHWDiffInit(ScrnInfoPtr pScrn) VIAPtr pVia = VIAPTR(pScrn); VIAHWDiff *HWDiff = &pVia->HWDiff; - switch(pVia->Chipset) { + switch(pVia->Chipset) + { case VIA_CLE266: - if (CLE266_REV_IS_AX(pVia->ChipRev)) { - HWDiff->dwThreeHQVBuffer = VID_HWDIFF_FALSE; - HWDiff->dwHQVFetchByteUnit = VID_HWDIFF_FALSE; - HWDiff->dwSupportTwoColorKey = VID_HWDIFF_FALSE; - HWDiff->dwHQVInitPatch = VID_HWDIFF_TRUE; - HWDiff->dwHQVDisablePatch = VID_HWDIFF_FALSE; - } else { - HWDiff->dwThreeHQVBuffer = VID_HWDIFF_TRUE; - HWDiff->dwHQVFetchByteUnit = VID_HWDIFF_TRUE; - HWDiff->dwSupportTwoColorKey = VID_HWDIFF_TRUE; - HWDiff->dwHQVInitPatch = VID_HWDIFF_FALSE; - HWDiff->dwHQVDisablePatch = VID_HWDIFF_TRUE; - } - break; + if (CLE266_REV_IS_AX(pVia->ChipRev)) { + HWDiff->dwThreeHQVBuffer = VID_HWDIFF_FALSE; + HWDiff->dwHQVFetchByteUnit = VID_HWDIFF_FALSE; + HWDiff->dwSupportTwoColorKey = VID_HWDIFF_FALSE; + HWDiff->dwHQVInitPatch = VID_HWDIFF_TRUE; + HWDiff->dwHQVDisablePatch = VID_HWDIFF_FALSE; + } else { + HWDiff->dwThreeHQVBuffer = VID_HWDIFF_TRUE; + HWDiff->dwHQVFetchByteUnit = VID_HWDIFF_TRUE; + HWDiff->dwSupportTwoColorKey = VID_HWDIFF_TRUE; + HWDiff->dwHQVInitPatch = VID_HWDIFF_FALSE; + HWDiff->dwHQVDisablePatch = VID_HWDIFF_TRUE; + } + break; case VIA_KM400: - HWDiff->dwThreeHQVBuffer = VID_HWDIFF_TRUE; - HWDiff->dwHQVFetchByteUnit = VID_HWDIFF_TRUE; - HWDiff->dwSupportTwoColorKey = VID_HWDIFF_FALSE; - HWDiff->dwHQVInitPatch = VID_HWDIFF_FALSE; - HWDiff->dwHQVDisablePatch = VID_HWDIFF_TRUE; - break; + HWDiff->dwThreeHQVBuffer = VID_HWDIFF_TRUE; + HWDiff->dwHQVFetchByteUnit = VID_HWDIFF_TRUE; + HWDiff->dwSupportTwoColorKey = VID_HWDIFF_FALSE; + HWDiff->dwHQVInitPatch = VID_HWDIFF_FALSE; + HWDiff->dwHQVDisablePatch = VID_HWDIFF_TRUE; + break; #ifdef HAVE_K8M800 case VIA_K8M800: - HWDiff->dwThreeHQVBuffer = VID_HWDIFF_TRUE; - HWDiff->dwHQVFetchByteUnit = VID_HWDIFF_TRUE; - HWDiff->dwSupportTwoColorKey = VID_HWDIFF_FALSE; - HWDiff->dwHQVInitPatch = VID_HWDIFF_FALSE; - HWDiff->dwHQVDisablePatch = VID_HWDIFF_TRUE; - break; + HWDiff->dwThreeHQVBuffer = VID_HWDIFF_TRUE; + HWDiff->dwHQVFetchByteUnit = VID_HWDIFF_TRUE; + HWDiff->dwSupportTwoColorKey = VID_HWDIFF_FALSE; + HWDiff->dwHQVInitPatch = VID_HWDIFF_FALSE; + HWDiff->dwHQVDisablePatch = VID_HWDIFF_TRUE; + break; #endif /* HAVE_K8M800 */ #ifdef HAVE_PM800 case VIA_PM800: - HWDiff->dwThreeHQVBuffer = VID_HWDIFF_TRUE; - HWDiff->dwHQVFetchByteUnit = VID_HWDIFF_TRUE; - HWDiff->dwSupportTwoColorKey = VID_HWDIFF_TRUE; - HWDiff->dwHQVInitPatch = VID_HWDIFF_FALSE; - HWDiff->dwHQVDisablePatch = VID_HWDIFF_FALSE; - break; + HWDiff->dwThreeHQVBuffer = VID_HWDIFF_TRUE; + HWDiff->dwHQVFetchByteUnit = VID_HWDIFF_TRUE; + HWDiff->dwSupportTwoColorKey = VID_HWDIFF_TRUE; + HWDiff->dwHQVInitPatch = VID_HWDIFF_FALSE; + HWDiff->dwHQVDisablePatch = VID_HWDIFF_FALSE; + break; #endif /* HAVE_PM800 */ default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "VIAVidHWDiffInit: Unhandled ChipSet.\n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "VIAVidHWDiffInit: Unhandled ChipSet.\n"); } } void viaSetColorSpace(VIAPtr pVia, int hue, int saturation, int brightness, int contrast, - Bool reset) - + Bool reset) { - CARD32 - col1,col2; + CARD32 col1,col2; viaCalculateVideoColor(pVia,hue,saturation,brightness, contrast,reset,&col1,&col2); switch ( pVia->ChipId ) { case PCI_CHIP_VT3205: - VIDOutD(V3_ColorSpaceReg_1, col1); - VIDOutD(V3_ColorSpaceReg_2, col2); - DBG_DD(ErrorF("000002C4 %08x\n",col1)); - DBG_DD(ErrorF("000002C8 %08x\n",col2)); - break; + VIDOutD(V3_ColorSpaceReg_1, col1); + VIDOutD(V3_ColorSpaceReg_2, col2); + DBG_DD(ErrorF("000002C4 %08x\n",col1)); + DBG_DD(ErrorF("000002C8 %08x\n",col2)); + break; case PCI_CHIP_CLE3122: - VIDOutD(V1_ColorSpaceReg_2, col2); - VIDOutD(V1_ColorSpaceReg_1, col1); - DBG_DD(ErrorF("00000288 %08x\n",col2)); - DBG_DD(ErrorF("00000284 %08x\n",col1)); - break; + VIDOutD(V1_ColorSpaceReg_2, col2); + VIDOutD(V1_ColorSpaceReg_1, col1); + VIDOutD(V3_ColorSpaceReg_2, col2); + VIDOutD(V3_ColorSpaceReg_1, col1); + + DBG_DD(ErrorF("00000288 %08x\n",col2)); + DBG_DD(ErrorF("00000284 %08x\n",col1)); + break; default: - DBG_DD(ErrorF("Unknown DeviceID\n")); - break; + DBG_DD(ErrorF("Unknown DeviceID\n")); + break; } } - static unsigned long ViaInitVideoStatusFlag(VIAPtr pVia) { switch ( pVia->ChipId ) { case PCI_CHIP_VT3205: - return VIDEO_HQV_INUSE | SW_USE_HQV | VIDEO_3_INUSE; + return VIDEO_HQV_INUSE | SW_USE_HQV | VIDEO_3_INUSE; case PCI_CHIP_CLE3122: - return VIDEO_HQV_INUSE | SW_USE_HQV | VIDEO_1_INUSE; + return VIDEO_HQV_INUSE | SW_USE_HQV | VIDEO_1_INUSE; default: - DBG_DD(ErrorF("Unknown DeviceID\n")); - break; + DBG_DD(ErrorF("Unknown DeviceID\n")); + break; } return 0UL; } -static unsigned long ViaSetVidCtl(VIAPtr pVia) +static unsigned long ViaSetVidCtl(VIAPtr pVia, unsigned int videoFlag) { - switch ( pVia->ChipId ) { - case PCI_CHIP_VT3205: - return(V3_ENABLE|V3_EXPIRE_NUM_3205); - case PCI_CHIP_CLE3122: - if (CLE266_REV_IS_CX(pVia->ChipRev)) - return (V3_ENABLE|V3_EXPIRE_NUM_F); - else - return (V3_ENABLE|V3_EXPIRE_NUM); - break; - default: - DBG_DD(ErrorF("Unknown DeviceID\n")); - break; + if (videoFlag & VIDEO_1_INUSE) { + /*=* Modify for C1 FIFO *=*/ + /* WARNING: not checking Chipset! */ + if (CLE266_REV_IS_CX(pVia->ChipRev)) + return V1_ENABLE | V1_EXPIRE_NUM_F; + else { + /* Overlay source format for V1 */ + if (pVia->swov.gdwUseExtendedFIFO) + return V1_ENABLE | V1_EXPIRE_NUM_A | V1_FIFO_EXTENDED; + else + return V1_ENABLE | V1_EXPIRE_NUM; + } } - return 0; -}/*End of DeviceID*/ + else { + switch (pVia->ChipId) + { + case PCI_CHIP_VT3205: + return V3_ENABLE | V3_EXPIRE_NUM_3205; -static void ViaVideoRegWrite(VIAPtr pVia) -{ - switch ( pVia-> ChipId ) { - case PCI_CHIP_VT3205: - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, ALPHA_V3_FIFO_CONTROL, - (VIDInD(ALPHA_V3_FIFO_CONTROL)&ALPHA_FIFO_MASK)| V3_FIFO_DEPTH32 | - V3_FIFO_THRESHOLD29); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, ALPHA_V3_PREFIFO_CONTROL , - V3_FIFO_PRETHRESHOLD29 | - ( VIDInD(ALPHA_V3_PREFIFO_CONTROL)& (~V3_FIFO_MASK)) ); - break; - case PCI_CHIP_CLE3122: - if (CLE266_REV_IS_CX(pVia->ChipRev)) { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, ALPHA_V3_FIFO_CONTROL, - (VIDInD(ALPHA_V3_FIFO_CONTROL)&ALPHA_FIFO_MASK)|V3_FIFO_DEPTH64 | - V3_FIFO_THRESHOLD56); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, ALPHA_V3_PREFIFO_CONTROL , - V3_FIFO_PRETHRESHOLD56 | - ( VIDInD(ALPHA_V3_PREFIFO_CONTROL)& (~V3_FIFO_MASK)) ); - } else { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, ALPHA_V3_FIFO_CONTROL, - (VIDInD(ALPHA_V3_FIFO_CONTROL)&ALPHA_FIFO_MASK)|V3_FIFO_DEPTH16 | - V3_FIFO_THRESHOLD8); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, ALPHA_V3_PREFIFO_CONTROL , - (V3_FIFO_THRESHOLD16>>8) | - ( VIDInD(ALPHA_V3_PREFIFO_CONTROL)& (~V3_FIFO_MASK)) ); - } - break; - default: - break; + case PCI_CHIP_CLE3122: + if (CLE266_REV_IS_CX(pVia->ChipRev)) + return V3_ENABLE | V3_EXPIRE_NUM_F; + else + return V3_ENABLE | V3_EXPIRE_NUM; + break; + + default: + DBG_DD(ErrorF("Unknown DeviceID\n")); + break; + } } -} + return 0; +}/*End of DeviceID*/ /* * Fill the buffer with 0x8000 (YUV2 black) @@ -227,246 +210,150 @@ ViaYUVFillBlack(VIAPtr pVia, int offset, int num) while(num-- > 0) #if X_BYTE_ORDER == X_LITTLE_ENDIAN - *ptr++ = 0x0080; + *ptr++ = 0x0080; #else *ptr++ = 0x8000; #endif } -/************************************************************************* - Function : VIAVidCreateSurface - Create overlay surface depend on FOURCC -*************************************************************************/ -unsigned long VIAVidCreateSurface(ScrnInfoPtr pScrn, LPDDSURFACEDESC lpDDSurfaceDesc) +/* + * Add an HQV surface to an existing FOURCC surface. + * numbuf: number of buffers, 1, 2 or 3 + * fourcc: FOURCC code of the current (already existing) surface + */ +static long AddHQVSurface(ScrnInfoPtr pScrn, unsigned int numbuf, CARD32 fourcc) { - VIAPtr pVia = VIAPTR(pScrn); - unsigned long dwWidth, dwHeight, dwPitch=0; - unsigned long size; - unsigned long dwAddr; - unsigned long HQVFBSIZE = 0, SWFBSIZE = 0; - VIAHWDiff *hwDiff = &pVia->HWDiff; + unsigned int i, width, height, pitch, fbsize, addr; unsigned long retCode; - - DBG_DD(ErrorF("//VIAVidCreateSurface: \n")); + BOOL isplanar; - if ( lpDDSurfaceDesc == NULL ) - return BadAccess; - - DBG_DD(ErrorF("Creating 0x%08X surface\n", lpDDSurfaceDesc->dwFourCC)); + VIAPtr pVia = VIAPTR(pScrn); + CARD32 AddrReg[3] = {HQV_DST_STARTADDR0, HQV_DST_STARTADDR1, HQV_DST_STARTADDR2}; - switch (lpDDSurfaceDesc->dwFourCC) - { - case FOURCC_YUY2 : - pVia->swov.DPFsrc.dwFlags = DDPF_FOURCC; - pVia->swov.DPFsrc.dwFourCC = FOURCC_YUY2; - - /* init Video status flag*/ - pVia->swov.gdwVideoFlagSW = ViaInitVideoStatusFlag(pVia); - - /*write Color Space Conversion param.*/ - /* ViaSetColorspace(pVia);*/ - - dwWidth = lpDDSurfaceDesc->dwWidth; - dwHeight = lpDDSurfaceDesc->dwHeight; - dwPitch = ALIGN_TO_32_BYTES(dwWidth)*2; - DBG_DD(ErrorF(" srcWidth= %ld \n", dwWidth)); - DBG_DD(ErrorF(" srcHeight= %ld \n", dwHeight)); - - SWFBSIZE = dwPitch*dwHeight; /*YUYV*/ - - VIAFreeLinear(&pVia->swov.SWOVMem); - if(Success != (retCode = VIAAllocLinear(&pVia->swov.SWOVMem, pScrn, SWFBSIZE * 2))) - return retCode; - - dwAddr = pVia->swov.SWOVMem.base; - - ViaYUVFillBlack(pVia, dwAddr, SWFBSIZE); - - pVia->swov.SWDevice.dwSWPhysicalAddr[0] = dwAddr; - pVia->swov.SWDevice.lpSWOverlaySurface[0] = pVia->FBBase+dwAddr; - - pVia->swov.SWDevice.dwSWPhysicalAddr[1] = pVia->swov.SWDevice.dwSWPhysicalAddr[0] + SWFBSIZE; - pVia->swov.SWDevice.lpSWOverlaySurface[1] = pVia->swov.SWDevice.lpSWOverlaySurface[0] + SWFBSIZE; - - DBG_DD(ErrorF("pVia->swov.SWDevice.dwSWPhysicalAddr[0] %08lx\n", dwAddr)); - DBG_DD(ErrorF("pVia->swov.SWDevice.dwSWPhysicalAddr[1] %08lx\n", dwAddr + SWFBSIZE)); - - pVia->swov.SWDevice.gdwSWSrcWidth = dwWidth; - pVia->swov.SWDevice.gdwSWSrcHeight= dwHeight; - pVia->swov.SWDevice.dwPitch = dwPitch; - - /* Fill image data in overlay record*/ - pVia->swov.overlayRecordV1.dwV1OriWidth = dwWidth; - pVia->swov.overlayRecordV1.dwV1OriHeight = dwHeight; - pVia->swov.overlayRecordV1.dwV1OriPitch = dwPitch; - if (!(pVia->swov.gdwVideoFlagSW & SW_USE_HQV)) - break; - - case FOURCC_HQVSW : - DBG_DD(ErrorF("//Create HQV_SW Surface\n")); - dwWidth = pVia->swov.SWDevice.gdwSWSrcWidth; - dwHeight = pVia->swov.SWDevice.gdwSWSrcHeight; - dwPitch = pVia->swov.SWDevice.dwPitch; - - HQVFBSIZE = dwPitch * dwHeight; - - if(hwDiff->dwThreeHQVBuffer) /* CLE_C0 */ - size = HQVFBSIZE*3; - else - size = HQVFBSIZE*2; - - VIAFreeLinear(&pVia->swov.HQVMem); - if(Success != (retCode = VIAAllocLinear(&pVia->swov.HQVMem, pScrn, size))) - return retCode; - dwAddr = pVia->swov.HQVMem.base; -/* dwAddr = pVia->swov.SWOVlinear->offset * depth + SWOVFBSIZE; */ - - pVia->swov.overlayRecordV1.dwHQVAddr[0] = dwAddr; - pVia->swov.overlayRecordV1.dwHQVAddr[1] = dwAddr + HQVFBSIZE; - - if ( hwDiff->dwThreeHQVBuffer ) /*CLE_C0*/ - pVia->swov.overlayRecordV1.dwHQVAddr[2] = dwAddr + 2 * HQVFBSIZE; - - ViaYUVFillBlack(pVia, dwAddr, HQVFBSIZE); - - VIDOutD(HQV_DST_STARTADDR1,pVia->swov.overlayRecordV1.dwHQVAddr[1]); - VIDOutD(HQV_DST_STARTADDR0,pVia->swov.overlayRecordV1.dwHQVAddr[0]); - - DBG_DD(ErrorF("000003F0 %08lx\n",VIDInD(HQV_DST_STARTADDR1) )); - DBG_DD(ErrorF("000003EC %08lx\n",VIDInD(HQV_DST_STARTADDR0) )); - - if ( hwDiff->dwThreeHQVBuffer ) /*CLE_C0*/ - { - VIDOutD(HQV_DST_STARTADDR2,pVia->swov.overlayRecordV1.dwHQVAddr[2]); - DBG_DD(ErrorF("000003FC %08lx\n", (unsigned long)VIDInD(HQV_DST_STARTADDR2)) ); - } - - break; + isplanar = ((fourcc == FOURCC_YV12) || (fourcc == FOURCC_VIA)); - case FOURCC_YV12 : - case FOURCC_VIA: - DBG_DD(ErrorF(" Create SW YV12 Surface: \n")); - pVia->swov.DPFsrc.dwFlags = DDPF_FOURCC; - pVia->swov.DPFsrc.dwFourCC = lpDDSurfaceDesc->dwFourCC; + width = pVia->swov.SWDevice.gdwSWSrcWidth; + height = pVia->swov.SWDevice.gdwSWSrcHeight; + pitch = pVia->swov.SWDevice.dwPitch; + fbsize = pitch * height * (isplanar ? 2 : 1); + VIAFreeLinear(&pVia->swov.HQVMem); + retCode = VIAAllocLinear(&pVia->swov.HQVMem, pScrn, fbsize * numbuf); + if(retCode != Success) return retCode; + addr = pVia->swov.HQVMem.base; - /* init Video status flag */ - pVia->swov.gdwVideoFlagSW = ViaInitVideoStatusFlag(pVia); + ViaYUVFillBlack(pVia, addr, fbsize); - /* pVia->swov.gdwVideoFlagSW = VIDEO_1_INUSE; */ + for (i = 0; i < numbuf; i++) { + pVia->swov.overlayRecordV1.dwHQVAddr[i] = addr; + VIDOutD(AddrReg[i], addr); + addr += fbsize; + } + + return Success; +} - /* if (pVia->swov.gdwVideoFlagTV1 & VIDEO_HQV_INUSE) */ -/* - if (gdwVideoFlagTV0 & VIDEO_HQV_INUSE) - { - lpNewVidCtrl->dwHighQVDO = VW_HIGHQVDO_OFF; - VIADriverProc( HQVCONTROL , lpNewVidCtrl ); - } -*/ - /* write Color Space Conversion param. */ - /*ViaSetColorspace(pVia);*/ - - dwWidth = lpDDSurfaceDesc->dwWidth; - dwHeight = lpDDSurfaceDesc->dwHeight; - dwPitch = ALIGN_TO_32_BYTES(dwWidth); - DBG_DD(ErrorF(" srcWidth= %ld \n", dwWidth)); - DBG_DD(ErrorF(" srcHeight= %ld \n", dwHeight)); - - SWFBSIZE = dwPitch * dwHeight * 1.5; /* 1.5 bytes per pixel */ - - VIAFreeLinear(&pVia->swov.SWfbMem); - if (FOURCC_VIA != lpDDSurfaceDesc->dwFourCC) { - if(Success != (retCode = VIAAllocLinear(&pVia->swov.SWfbMem, pScrn, 2 * SWFBSIZE))) - return retCode; - - dwAddr = pVia->swov.SWfbMem.base; - - DEBUG(ErrorF("dwAddr for SWfbMem is %lu\n", dwAddr)); - - ViaYUVFillBlack(pVia, dwAddr, SWFBSIZE); - - pVia->swov.SWDevice.dwSWPhysicalAddr[0] = dwAddr; - pVia->swov.SWDevice.dwSWCrPhysicalAddr[0] = pVia->swov.SWDevice.dwSWPhysicalAddr[0] - + (dwPitch*dwHeight); - pVia->swov.SWDevice.dwSWCbPhysicalAddr[0] = pVia->swov.SWDevice.dwSWCrPhysicalAddr[0] - + ((dwPitch>>1)*(dwHeight>>1)); - pVia->swov.SWDevice.lpSWOverlaySurface[0] = pVia->FBBase+dwAddr; - - pVia->swov.SWDevice.dwSWPhysicalAddr[1] = dwAddr + SWFBSIZE; - pVia->swov.SWDevice.dwSWCrPhysicalAddr[1] = pVia->swov.SWDevice.dwSWPhysicalAddr[1] - + (dwPitch*dwHeight); - pVia->swov.SWDevice.dwSWCbPhysicalAddr[1] = pVia->swov.SWDevice.dwSWCrPhysicalAddr[1] - + ((dwPitch>>1)*(dwHeight>>1)); - pVia->swov.SWDevice.lpSWOverlaySurface[1] = pVia->swov.SWDevice.lpSWOverlaySurface[0] + SWFBSIZE; - - DBG_DD(ErrorF("pVia->swov.SWDevice.dwSWPhysicalAddr[0] %08lx\n", dwAddr)); - DBG_DD(ErrorF("pVia->swov.SWDevice.dwSWPhysicalAddr[1] %08lx\n", dwAddr + SWFBSIZE)); - } - pVia->swov.SWDevice.gdwSWSrcWidth = dwWidth; - pVia->swov.SWDevice.gdwSWSrcHeight= dwHeight; - pVia->swov.SWDevice.dwPitch = dwPitch; - - /* Fill image data in overlay record */ - pVia->swov.overlayRecordV1.dwV1OriWidth = dwWidth; - pVia->swov.overlayRecordV1.dwV1OriHeight = dwHeight; - pVia->swov.overlayRecordV1.dwV1OriPitch = dwPitch; /* -if (!(pVia->swov.gdwVideoFlagSW & SW_USE_HQV)) - break; - case FOURCC_HQVSW : -*/ - /* - * if sw video use HQV dwpitch should changed - */ - DBG_DD(ErrorF("//Create HQV_SW Surface\n")); -/* pVia->swov.DPFsrc.dwFourCC = FOURCC_YUY2; */ - dwWidth = pVia->swov.SWDevice.gdwSWSrcWidth; - dwHeight = pVia->swov.SWDevice.gdwSWSrcHeight; - dwPitch = pVia->swov.SWDevice.dwPitch; + * Create a FOURCC surface (Supported: YUY2, YV12 or VIA) + * doalloc: set true to actually allocate memory for the framebuffers + */ +static long CreateSurface(ScrnInfoPtr pScrn, LPDDSURFACEDESC surfaceDesc, BOOL doalloc) +{ + VIAPtr pVia = VIAPTR(pScrn); + unsigned long width, height, pitch, fbsize, addr; + unsigned long retCode; + BOOL isplanar; + + pVia->swov.DPFsrc.dwFlags = DDPF_FOURCC; + pVia->swov.DPFsrc.dwFourCC = surfaceDesc->dwFourCC; + pVia->swov.gdwVideoFlagSW = ViaInitVideoStatusFlag(pVia); + + isplanar = ((surfaceDesc->dwFourCC == FOURCC_YV12) || + (surfaceDesc->dwFourCC == FOURCC_VIA)); + + width = surfaceDesc->dwWidth; + height = surfaceDesc->dwHeight; + pitch = ALIGN_TO(width, 32) * (isplanar ? 1 : 2); + fbsize = pitch * height * (isplanar ? 1.5 : 1.0); + + VIAFreeLinear(&pVia->swov.SWfbMem); + + if (doalloc) { + retCode = VIAAllocLinear(&pVia->swov.SWfbMem, pScrn, fbsize * 2); + if(retCode != Success) return retCode; + addr = pVia->swov.SWfbMem.base; + + ViaYUVFillBlack(pVia, addr, fbsize); + + pVia->swov.SWDevice.dwSWPhysicalAddr[0] = addr; + pVia->swov.SWDevice.dwSWPhysicalAddr[1] = addr + fbsize; + pVia->swov.SWDevice.lpSWOverlaySurface[0] = pVia->FBBase + addr; + pVia->swov.SWDevice.lpSWOverlaySurface[1] = + pVia->swov.SWDevice.lpSWOverlaySurface[0] + fbsize; + + if (isplanar) { + pVia->swov.SWDevice.dwSWCrPhysicalAddr[0] = + pVia->swov.SWDevice.dwSWPhysicalAddr[0] + (pitch*height); + pVia->swov.SWDevice.dwSWCrPhysicalAddr[1] = + pVia->swov.SWDevice.dwSWPhysicalAddr[1] + (pitch*height); + pVia->swov.SWDevice.dwSWCbPhysicalAddr[0] = + pVia->swov.SWDevice.dwSWCrPhysicalAddr[0] + ((pitch>>1)*(height>>1)); + pVia->swov.SWDevice.dwSWCbPhysicalAddr[1] = + pVia->swov.SWDevice.dwSWCrPhysicalAddr[1] + ((pitch>>1)*(height>>1)); + } + } - HQVFBSIZE = dwPitch * dwHeight * 2; + pVia->swov.SWDevice.gdwSWSrcWidth = width; + pVia->swov.SWDevice.gdwSWSrcHeight = height; + pVia->swov.SWDevice.dwPitch = pitch; - if ( hwDiff->dwThreeHQVBuffer ) /* CLE_C0 */ - size = HQVFBSIZE * 3; - else - size = HQVFBSIZE * 2; - - VIAFreeLinear(&pVia->swov.HQVMem); - if(Success != (retCode = VIAAllocLinear(&pVia->swov.HQVMem, pScrn, size))) - return retCode; - - dwAddr = pVia->swov.HQVMem.base; - DEBUG(ErrorF("dwAddr for HQV is %lu\n", dwAddr)); - DBG_DD(ErrorF("HQV dwAddr = 0x%x!!!! \n",dwAddr)); - - pVia->swov.overlayRecordV1.dwHQVAddr[0] = dwAddr; - pVia->swov.overlayRecordV1.dwHQVAddr[1] = dwAddr + HQVFBSIZE; - - if ( hwDiff->dwThreeHQVBuffer ) /*CLE_C0*/ - pVia->swov.overlayRecordV1.dwHQVAddr[2] = dwAddr + 2 * HQVFBSIZE; - - /* FIXME: Check if should fill 3 on C0 */ - ViaYUVFillBlack(pVia, dwAddr, HQVFBSIZE); - - VIDOutD(HQV_DST_STARTADDR1,pVia->swov.overlayRecordV1.dwHQVAddr[1]); - VIDOutD(HQV_DST_STARTADDR0,pVia->swov.overlayRecordV1.dwHQVAddr[0]); - - DBG_DD(ErrorF("000003F0 %08lx\n",VIDInD(HQV_DST_STARTADDR1) )); - DBG_DD(ErrorF("000003EC %08lx\n",VIDInD(HQV_DST_STARTADDR0) )); - - if ( hwDiff->dwThreeHQVBuffer ) /*CLE_C0*/ - { - VIDOutD(HQV_DST_STARTADDR2,pVia->swov.overlayRecordV1.dwHQVAddr[2]); - DBG_DD(ErrorF("000003FC %08lx\n", (unsigned long)VIDInD(HQV_DST_STARTADDR2)) ); - } - - break; + pVia->swov.overlayRecordV1.dwV1OriWidth = width; + pVia->swov.overlayRecordV1.dwV1OriHeight = height; + pVia->swov.overlayRecordV1.dwV1OriPitch = pitch; - default : - break; + return Success; +} + +/************************************************************************* + Function : VIAVidCreateSurface + Create overlay surface depend on FOURCC +*************************************************************************/ +unsigned long VIAVidCreateSurface(ScrnInfoPtr pScrn, LPDDSURFACEDESC surfaceDesc) +{ + VIAPtr pVia = VIAPTR(pScrn); + unsigned long retCode = Success; + int numbuf = pVia->HWDiff.dwThreeHQVBuffer ? 3 : 2; + + if (surfaceDesc == NULL) return BadAccess; + + switch (surfaceDesc->dwFourCC) + { + case FOURCC_YUY2: + retCode = CreateSurface(pScrn, surfaceDesc, TRUE); + if (retCode != Success) break; + if (!(pVia->swov.gdwVideoFlagSW & SW_USE_HQV)) break; + + case FOURCC_HQVSW: + retCode = AddHQVSurface(pScrn, numbuf, FOURCC_YUY2); + break; + + case FOURCC_YV12: + retCode = CreateSurface(pScrn, surfaceDesc, TRUE); + if (retCode == Success) + retCode = AddHQVSurface(pScrn, numbuf, FOURCC_YV12); + break; + + case FOURCC_VIA: + retCode = CreateSurface(pScrn, surfaceDesc, FALSE); + if (retCode == Success) + retCode = AddHQVSurface(pScrn, numbuf, FOURCC_VIA); + break; + + default: + break; } - return Success; + return retCode; } /*VIAVidCreateSurface*/ @@ -480,14 +367,13 @@ unsigned long VIAVidLockSurface(ScrnInfoPtr pScrn, LPDDLOCK lpLock) switch (lpLock->dwFourCC) { - case FOURCC_YUY2 : - case FOURCC_YV12 : - case FOURCC_VIA : - lpLock->SWDevice = pVia->swov.SWDevice ; - lpLock->dwPhysicalBase = pVia->FrameBufferBase; - + case FOURCC_YUY2: + case FOURCC_YV12: + case FOURCC_VIA: + lpLock->SWDevice = pVia->swov.SWDevice; + lpLock->dwPhysicalBase = pVia->FrameBufferBase; } - + return PI_OK; } /*VIAVidLockSurface*/ @@ -503,1036 +389,899 @@ unsigned long VIAVidDestroySurface(ScrnInfoPtr pScrn, LPDDSURFACEDESC lpDDSurfa switch (lpDDSurfaceDesc->dwFourCC) { - case FOURCC_YUY2 : - pVia->swov.DPFsrc.dwFlags = 0; - pVia->swov.DPFsrc.dwFourCC = 0; - - VIAFreeLinear(&pVia->swov.SWOVMem); - if (!(pVia->swov.gdwVideoFlagSW & SW_USE_HQV)) - { - pVia->swov.gdwVideoFlagSW = 0; - break; - } + case FOURCC_YUY2: + pVia->swov.DPFsrc.dwFlags = 0; + pVia->swov.DPFsrc.dwFourCC = 0; - case FOURCC_HQVSW : - VIAFreeLinear(&pVia->swov.HQVMem); + VIAFreeLinear(&pVia->swov.SWfbMem); + if (!(pVia->swov.gdwVideoFlagSW & SW_USE_HQV)) + { pVia->swov.gdwVideoFlagSW = 0; -/* if (pVia->swov.gdwVideoFlagTV1 != 0) - { - DBG_DD(ErrorF(" Assign HQV to TV1 \n")); - lpNewVidCtrl->dwHighQVDO = VW_HIGHQVDO_TV1; - DriverProc( HQVCONTROL , lpNewVidCtrl ); - } -*/ break; + } - case FOURCC_YV12 : + case FOURCC_HQVSW: + VIAFreeLinear(&pVia->swov.HQVMem); + pVia->swov.gdwVideoFlagSW = 0; + break; + + case FOURCC_YV12: case FOURCC_VIA: - pVia->swov.DPFsrc.dwFlags = 0; - pVia->swov.DPFsrc.dwFourCC = 0; - - VIAFreeLinear(&pVia->swov.SWfbMem); - VIAFreeLinear(&pVia->swov.HQVMem); - pVia->swov.gdwVideoFlagSW = 0; - break; + pVia->swov.DPFsrc.dwFlags = 0; + pVia->swov.DPFsrc.dwFourCC = 0; + + VIAFreeLinear(&pVia->swov.SWfbMem); + VIAFreeLinear(&pVia->swov.HQVMem); + pVia->swov.gdwVideoFlagSW = 0; + break; } - DBG_DD(ErrorF("\n//VIAVidDestroySurface : OK!!\n")); return PI_OK; } /*VIAVidDestroySurface*/ +static void SetFIFO_V1(VIAPtr pVia, CARD8 depth, CARD8 prethreshold, CARD8 threshold) +{ + SaveVideoRegister(pVia, V_FIFO_CONTROL, ((depth-1) & 0x7f) | + ((prethreshold & 0x7f) << 24) | ((threshold & 0x7f) << 8)); +} -/**************************************************************************** - * - * Upd_Video() - * - ***************************************************************************/ -static unsigned long Upd_Video(ScrnInfoPtr pScrn, unsigned long dwVideoFlag,unsigned long dwStartAddr,RECTL rSrc,RECTL rDest,unsigned long dwSrcPitch, - unsigned long dwOriSrcWidth,unsigned long dwOriSrcHeight,LPDDPIXELFORMAT lpDPFsrc, - unsigned long dwDeinterlaceMode,unsigned long dwColorKey,unsigned long dwChromaKey, - unsigned long dwKeyLow,unsigned long dwKeyHigh,unsigned long dwChromaLow,unsigned long dwChromaHigh, unsigned long dwFlags) +static void SetFIFO_V3(VIAPtr pVia, CARD8 depth, CARD8 prethreshold, CARD8 threshold) { - VIAPtr pVia = VIAPTR(pScrn); - vgaHWPtr hwp = VGAHWPTR(pScrn); - unsigned long dwVidCtl=0, dwCompose=(VIDInD(V_COMPOSE_MODE)&~(SELECT_VIDEO_IF_COLOR_KEY|V1_COMMAND_FIRE|V3_COMMAND_FIRE))|V_COMMAND_LOAD_VBI; - unsigned long srcWidth, srcHeight,dstWidth,dstHeight; - unsigned long zoomCtl=0, miniCtl=0; - unsigned long dwHQVCtl=0; - unsigned long dwHQVfilterCtl=0,dwHQVminiCtl=0; - unsigned long dwHQVzoomflagH=0,dwHQVzoomflagV=0; - unsigned long dwHQVsrcWidth=0,dwHQVdstWidth=0; - unsigned long dwHQVsrcFetch = 0,dwHQVoffset=0; - unsigned long dwOffset=0,dwFetch=0,dwTmp=0; - unsigned long dwDisplayCountW=0; - VIAHWDiff *hwDiff = &pVia->HWDiff; + SaveVideoRegister(pVia, ALPHA_V3_FIFO_CONTROL, + (VIDInD(ALPHA_V3_FIFO_CONTROL) & ALPHA_FIFO_MASK) | + ((depth - 1) & 0xff) | ((threshold & 0xff) << 8)); + SaveVideoRegister(pVia, ALPHA_V3_PREFIFO_CONTROL, + (VIDInD(ALPHA_V3_PREFIFO_CONTROL) & ~V3_FIFO_MASK) | + (prethreshold & 0x7f)); +} - DBG_DD(ErrorF("// Upd_Video:\n")); - DBG_DD(ErrorF("Modified rSrc X (%ld,%ld) Y (%ld,%ld)\n", - rSrc.left, rSrc.right,rSrc.top, rSrc.bottom)); - DBG_DD(ErrorF("Modified rDest X (%ld,%ld) Y (%ld,%ld)\n", - rDest.left, rDest.right,rDest.top, rDest.bottom)); +static void SetFIFO_64or32(VIAPtr pVia) +{ + /*=* Modify for C1 FIFO *=*/ + /* WARNING: not checking Chipset! */ + if (CLE266_REV_IS_CX(pVia->ChipRev)) + SetFIFO_V1(pVia, 64, 56, 56); + else + SetFIFO_V1(pVia, 32, 29, 16); +} - if (dwVideoFlag & VIDEO_SHOW) - { - pVia->swov.overlayRecordV1.dwWidth=dstWidth = rDest.right - rDest.left; - pVia->swov.overlayRecordV1.dwHeight=dstHeight = rDest.bottom - rDest.top; - srcWidth = (unsigned long)rSrc.right - rSrc.left; - srcHeight = (unsigned long)rSrc.bottom - rSrc.top; - DBG_DD(ErrorF("===srcWidth= %ld \n", srcWidth)); - DBG_DD(ErrorF("===srcHeight= %ld \n", srcHeight)); +static void SetFIFO_64or16(VIAPtr pVia) +{ + /*=* Modify for C1 FIFO *=*/ + /* WARNING: not checking Chipset! */ + if (CLE266_REV_IS_CX(pVia->ChipRev)) + SetFIFO_V1(pVia, 64, 56, 56); + else + SetFIFO_V1(pVia, 16, 12, 8); +} - if (dwVideoFlag & VIDEO_1_INUSE) - { - /*=* Modify for C1 FIFO *=*/ - /* WARNING: not checking Chipset! */ - if (CLE266_REV_IS_CX(pVia->ChipRev)) - dwVidCtl = (V1_ENABLE|V1_EXPIRE_NUM_F); - else { - /* Overlay source format for V1*/ - if (pVia->swov.gdwUseExtendedFIFO) - dwVidCtl = (V1_ENABLE|V1_EXPIRE_NUM_A|V1_FIFO_EXTENDED); - else - dwVidCtl = (V1_ENABLE|V1_EXPIRE_NUM); - } - - viaOverlayGetV1Format(pVia, dwVideoFlag,lpDPFsrc,&dwVidCtl,&dwHQVCtl); - viaOverlayGetV1Format(pVia, dwVideoFlag,lpDPFsrc,&dwVidCtl,&dwHQVCtl); - } +static void SetFIFO_64or48or32(VIAPtr pVia) +{ + /*=* Modify for C1 FIFO *=*/ + /* WARNING: not checking Chipset! */ + if (CLE266_REV_IS_CX(pVia->ChipRev)) + SetFIFO_V1(pVia, 64, 56, 56); + else { + if (pVia->swov.gdwUseExtendedFIFO) + SetFIFO_V1(pVia, 48, 40, 40); else - { - dwVidCtl = ViaSetVidCtl(pVia); - viaOverlayGetV3Format(pVia, dwVideoFlag,lpDPFsrc,&dwVidCtl,&dwHQVCtl); - } + SetFIFO_V1(pVia, 32, 29, 16); + } +} - if ( hwDiff->dwThreeHQVBuffer ) /*CLE_C0*/ - { - /* HQV support 3 HQV buffer */ - dwHQVCtl &= ~HQV_SW_FLIP; - dwHQVCtl |= HQV_TRIPLE_BUFF | HQV_FLIP_STATUS; - } +static void SetFIFO_V3_64or32or32(VIAPtr pVia) +{ + switch (pVia->ChipId) + { + case PCI_CHIP_VT3205: + SetFIFO_V3(pVia, 32, 29, 29); + break; - /* Starting address of source and Source offset*/ - dwOffset = viaOverlayGetSrcStartAddress (pVia, dwVideoFlag,rSrc,rDest,dwSrcPitch,lpDPFsrc,&dwHQVoffset ); - DBG_DD(ErrorF("===dwOffset= 0x%lx \n", dwOffset)); + case PCI_CHIP_CLE3122: + if (CLE266_REV_IS_CX(pVia->ChipRev)) + SetFIFO_V3(pVia, 64, 56, 56); + else + SetFIFO_V3(pVia, 32, 16, 16); + break; - pVia->swov.overlayRecordV1.dwOffset = dwOffset; + default: + break; + } +} + +static void SetFIFO_V3_64or32or16(VIAPtr pVia) +{ + switch (pVia->ChipId) + { + case PCI_CHIP_VT3205: + SetFIFO_V3(pVia, 32, 29, 29); + break; - if (pVia->swov.DPFsrc.dwFourCC == FOURCC_YV12 - || pVia->swov.DPFsrc.dwFourCC == FOURCC_VIA) + case PCI_CHIP_CLE3122: + if (CLE266_REV_IS_CX(pVia->ChipRev)) + SetFIFO_V3(pVia, 64, 56, 56); + else + SetFIFO_V3(pVia, 16, 16, 8); + break; + + default: + break; + } +} + +static void +SetupFIFOs(VIAPtr pVia, unsigned long videoFlag, unsigned long miniCtl, + unsigned long srcWidth) +{ + if (miniCtl & V1_Y_INTERPOLY) + { + if (pVia->swov.DPFsrc.dwFourCC == FOURCC_YV12 || + pVia->swov.DPFsrc.dwFourCC == FOURCC_VIA) { - YCBCRREC YCbCr; - if (dwVideoFlag & VIDEO_HQV_INUSE) + if (videoFlag & VIDEO_HQV_INUSE) { - dwHQVsrcWidth=(unsigned long)rSrc.right - rSrc.left; - dwHQVdstWidth=(unsigned long)rDest.right - rDest.left; - if (dwHQVsrcWidth>dwHQVdstWidth) - { - dwOffset = dwOffset * dwHQVdstWidth / dwHQVsrcWidth; - } - - if (dwVideoFlag & VIDEO_1_INUSE) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V1_STARTADDR_0, pVia->swov.overlayRecordV1.dwHQVAddr[0]+dwOffset); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V1_STARTADDR_1, pVia->swov.overlayRecordV1.dwHQVAddr[1]+dwOffset); - - if ( hwDiff->dwThreeHQVBuffer ) /*CLE_C0*/ - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V1_STARTADDR_2, pVia->swov.overlayRecordV1.dwHQVAddr[2]+dwOffset); - } + if (videoFlag & VIDEO_1_INUSE) + SetFIFO_64or32(pVia); else - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V3_STARTADDR_0, pVia->swov.overlayRecordV1.dwHQVAddr[0]+dwOffset); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V3_STARTADDR_1, pVia->swov.overlayRecordV1.dwHQVAddr[1]+dwOffset); - - if ( hwDiff->dwThreeHQVBuffer ) /*CLE_C0*/ - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V3_STARTADDR_2, pVia->swov.overlayRecordV1.dwHQVAddr[2]+dwOffset); - } - YCbCr = viaOverlayGetYCbCrStartAddress(dwVideoFlag,dwStartAddr,pVia->swov.overlayRecordV1.dwOffset,pVia->swov.overlayRecordV1.dwUVoffset,dwSrcPitch,dwOriSrcHeight); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, HQV_SRC_STARTADDR_Y, YCbCr.dwY); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, HQV_SRC_STARTADDR_U, YCbCr.dwCR); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, HQV_SRC_STARTADDR_V, YCbCr.dwCB); + SetFIFO_V3_64or32or16(pVia); } else { - YCbCr = viaOverlayGetYCbCrStartAddress(dwVideoFlag,dwStartAddr,pVia->swov.overlayRecordV1.dwOffset,pVia->swov.overlayRecordV1.dwUVoffset,dwSrcPitch,dwOriSrcHeight); - if (dwVideoFlag & VIDEO_1_INUSE) + /* Minified video will be skewed without this workaround. */ + if (srcWidth <= 80) /* Fetch count <= 5 */ { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V1_STARTADDR_0, YCbCr.dwY); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V1_STARTADDR_CB0, YCbCr.dwCR); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V1_STARTADDR_CR0, YCbCr.dwCB); + if (videoFlag & VIDEO_1_INUSE) + SetFIFO_V1(pVia, 16, 0, 0); + else + SetFIFO_V3(pVia, 16, 16, 0); } else { - DBG_DD(ErrorF("Upd_Video() : We do not support YV12 with V3!\n")); + if (videoFlag & VIDEO_1_INUSE) + SetFIFO_64or16(pVia); + else + SetFIFO_V3_64or32or16(pVia); } } } else { - if (dwVideoFlag & VIDEO_HQV_INUSE) - { - dwHQVsrcWidth=(unsigned long)rSrc.right - rSrc.left; - dwHQVdstWidth=(unsigned long)rDest.right - rDest.left; - if (dwHQVsrcWidth>dwHQVdstWidth) - { - dwOffset = dwOffset * dwHQVdstWidth / dwHQVsrcWidth; - } - - if (dwVideoFlag & VIDEO_1_INUSE) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V1_STARTADDR_0, pVia->swov.overlayRecordV1.dwHQVAddr[0]+dwHQVoffset); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V1_STARTADDR_1, pVia->swov.overlayRecordV1.dwHQVAddr[1]+dwHQVoffset); - - if ( hwDiff->dwThreeHQVBuffer ) /*CLE_C0*/ - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V1_STARTADDR_2, pVia->swov.overlayRecordV1.dwHQVAddr[2]+dwHQVoffset); - } - else - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V3_STARTADDR_0, pVia->swov.overlayRecordV1.dwHQVAddr[0]+dwHQVoffset); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V3_STARTADDR_1, pVia->swov.overlayRecordV1.dwHQVAddr[1]+dwHQVoffset); - - if ( hwDiff->dwThreeHQVBuffer ) /*CLE_C0*/ - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V3_STARTADDR_2, pVia->swov.overlayRecordV1.dwHQVAddr[2]+dwHQVoffset); - } - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, HQV_SRC_STARTADDR_Y, dwStartAddr); - } + if (videoFlag & VIDEO_1_INUSE) + SetFIFO_64or48or32(pVia); else { - dwStartAddr += dwOffset; - - if (dwVideoFlag & VIDEO_1_INUSE) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V1_STARTADDR_0, dwStartAddr); - } + /* Fix V3 bug. */ + if (srcWidth <= 8) + SetFIFO_V3(pVia, 1, 0, 0); else - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V3_STARTADDR_0, dwStartAddr); - } - } - } - - dwFetch = viaOverlayGetFetch(dwVideoFlag,lpDPFsrc,srcWidth,dstWidth,dwOriSrcWidth,&dwHQVsrcFetch); - DBG_DD(ErrorF("===dwFetch= 0x%lx \n", dwFetch)); -/* - //For DCT450 test-BOB INTERLEAVE - if ( (dwDeinterlaceMode & DDOVER_INTERLEAVED) && (dwDeinterlaceMode & DDOVER_BOB ) ) - { - if (dwVideoFlag & VIDEO_HQV_INUSE) - { - dwHQVCtl |= HQV_FIELD_2_FRAME|HQV_FRAME_2_FIELD|HQV_DEINTERLACE; - } - else - { - dwVidCtl |= (V1_BOB_ENABLE | V1_FRAME_BASE); - } - } - else if (dwDeinterlaceMode & DDOVER_BOB ) - { - if (dwVideoFlag & VIDEO_HQV_INUSE) - { - //The HQV source data line count should be two times of the original line count - dwHQVCtl |= HQV_FIELD_2_FRAME|HQV_DEINTERLACE; - } - else - { - dwVidCtl |= V1_BOB_ENABLE; + SetFIFO_V3_64or32or32(pVia); } } -*/ - if (dwVideoFlag & VIDEO_HQV_INUSE) + } + else + { + if (pVia->swov.DPFsrc.dwFourCC == FOURCC_YV12 || + pVia->swov.DPFsrc.dwFourCC == FOURCC_VIA) { - if ( !(dwDeinterlaceMode & DDOVER_INTERLEAVED) && (dwDeinterlaceMode & DDOVER_BOB ) ) + if (videoFlag & VIDEO_HQV_INUSE) { - if ( hwDiff->dwHQVFetchByteUnit ) /* CLE_C0 */ - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, HQV_SRC_FETCH_LINE, (((dwHQVsrcFetch)-1)<<16)|((dwOriSrcHeight<<1)-1)); + if (videoFlag & VIDEO_1_INUSE) + SetFIFO_64or32(pVia); else - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, HQV_SRC_FETCH_LINE, (((dwHQVsrcFetch>>3)-1)<<16)|((dwOriSrcHeight<<1)-1)); + SetFIFO_V3_64or32or16(pVia); } else { - if ( hwDiff->dwHQVFetchByteUnit ) /* CLE_C0 */ - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, HQV_SRC_FETCH_LINE, (((dwHQVsrcFetch)-1)<<16)|(dwOriSrcHeight-1)); - else - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, HQV_SRC_FETCH_LINE, (((dwHQVsrcFetch>>3)-1)<<16)|(dwOriSrcHeight-1)); - } - if (pVia->swov.DPFsrc.dwFourCC == FOURCC_YV12 - || pVia->swov.DPFsrc.dwFourCC == FOURCC_VIA) - { - if (dwVideoFlag & VIDEO_1_INUSE) + /* Minified video will be skewed without this workaround. */ + if (srcWidth <= 80) /* Fetch count <= 5 */ { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V1_STRIDE, dwSrcPitch<<1); + if (videoFlag & VIDEO_1_INUSE) + SetFIFO_V1(pVia, 16, 0, 0); + else + SetFIFO_V3(pVia, 16, 16, 0); } else - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V3_STRIDE, dwSrcPitch<<1); - } - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, HQV_SRC_STRIDE, ((dwSrcPitch>>1)<<16)|dwSrcPitch); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, HQV_DST_STRIDE, (dwSrcPitch<<1)); - } - else - { - if (dwVideoFlag & VIDEO_1_INUSE) { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V1_STRIDE, dwSrcPitch); - } - else - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V3_STRIDE, dwSrcPitch); + if (videoFlag & VIDEO_1_INUSE) + SetFIFO_64or16(pVia); + else + SetFIFO_V3_64or32or16(pVia); } - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, HQV_SRC_STRIDE, dwSrcPitch); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, HQV_DST_STRIDE, dwSrcPitch); } - } else { - if (dwVideoFlag & VIDEO_1_INUSE) - { -/* viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V1_STRIDE, dwSrcPitch | (dwSrcPitch <<15) );*/ - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V1_STRIDE, dwSrcPitch ); - } + if (videoFlag & VIDEO_1_INUSE) + SetFIFO_64or48or32(pVia); else { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V3_STRIDE, dwSrcPitch | (dwSrcPitch <<15) ); + /* Fix V3 bug. */ + if (srcWidth <= 8) + SetFIFO_V3(pVia, 1, 0, 0); + else + SetFIFO_V3_64or32or32(pVia); } } + } +} - DBG_DD(ErrorF("rSrc X (%ld,%ld) Y (%ld,%ld)\n", - rSrc.left, rSrc.right,rSrc.top, rSrc.bottom)); - DBG_DD(ErrorF("rDest X (%ld,%ld) Y (%ld,%ld)\n", - rDest.left, rDest.right,rDest.top, rDest.bottom)); +static CARD32 SetColorKey(VIAPtr pVia, unsigned long videoFlag, + CARD32 keyLow, CARD32 keyHigh, CARD32 compose) +{ + keyLow &= 0x00FFFFFF; + /*SaveVideoRegister(pVia, V_COLOR_KEY, keyLow);*/ + + if (videoFlag & VIDEO_1_INUSE) { + SaveVideoRegister(pVia, V_COLOR_KEY, keyLow); + } + else { + if (pVia->HWDiff.dwSupportTwoColorKey ) /*CLE_C0*/ + SaveVideoRegister(pVia, V3_COLOR_KEY, keyLow); + } + + /*compose = (compose & ~0x0f) | SELECT_VIDEO_IF_COLOR_KEY;*/ + /*CLE_C0*/ + compose = (compose & ~0x0f) | SELECT_VIDEO_IF_COLOR_KEY | SELECT_VIDEO3_IF_COLOR_KEY; + /*compose = (compose & ~0x0f) ;*/ - /* Destination window key*/ + return compose; +} + + +static CARD32 SetChromaKey(VIAPtr pVia, unsigned long videoFlag, + CARD32 chromaLow, CARD32 chromaHigh, + CARD32 miniCtl, CARD32 compose) +{ + unsigned long lowR, lowG, lowB, lowC; /* Low RGB and chroma. */ + unsigned long highR, highG, highB, highC; /* High RGB and chroma. */ + + chromaLow &= CHROMA_KEY_LOW; + chromaHigh &= CHROMA_KEY_HIGH; - if (dwVideoFlag & VIDEO_1_INUSE) + chromaLow |= (VIDInD(V_CHROMAKEY_LOW) & ~CHROMA_KEY_LOW); + chromaHigh |= (VIDInD(V_CHROMAKEY_HIGH)& ~CHROMA_KEY_HIGH); + + /*Added by Scottie[2001.12.5] for Chroma Key*/ + if (pVia->swov.DPFsrc.dwFlags & DDPF_FOURCC) + { + switch (pVia->swov.DPFsrc.dwFourCC) { - /*modify for HW DVI limitation, - //When we enable the CRT and DVI both, then change resolution. - //If the resolution small than the panel physical size, the video display in Y direction will be cut. - //So, we need to adjust the Y top and bottom position. */ - if (pVia->pBIOSInfo->SetDVI && pVia->pBIOSInfo->scaleY) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V1_WIN_END_Y, - ((rDest.right-1)<<16) + (rDest.bottom * pVia->pBIOSInfo->panelY / pScrn->currentMode->VDisplay)); - if (rDest.top > 0) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V1_WIN_START_Y, - (rDest.left<<16) + (rDest.top * pVia->pBIOSInfo->panelY / pScrn->currentMode->VDisplay)); - } - else - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V1_WIN_START_Y,(rDest.left<<16)); - } - } - else - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V1_WIN_END_Y, ((rDest.right-1)<<16) + (rDest.bottom-1)); - if (rDest.top > 0) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V1_WIN_START_Y, (rDest.left<<16) + rDest.top ); - } - else - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V1_WIN_START_Y, (rDest.left<<16)); - } - } + case FOURCC_YV12: + case FOURCC_VIA: + /*to be continued...*/ + break; + case FOURCC_YUY2: + /*to be continued...*/ + break; + default: + /*TOINT3;*/ + break; } - else + } + else if (pVia->swov.DPFsrc.dwFlags & DDPF_RGB) + { + switch (pVia->swov.DPFsrc.dwRGBBitCount) { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V3_WIN_END_Y, ((rDest.right-1)<<16) + (rDest.bottom-1)); - if (rDest.top > 0) + case 16: + if (pVia->swov.DPFsrc.dwGBitMask==0x07E0) /*RGB16(5:6:5)*/ { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V3_WIN_START_Y, (rDest.left<<16) + rDest.top ); + lowR = (((chromaLow >> 11) << 3) | ((chromaLow >> 13) & 0x07)) & 0xFF; + lowG = (((chromaLow >> 5) << 2) | ((chromaLow >> 9) & 0x03)) & 0xFF; + + highR = (((chromaHigh >> 11) << 3) | ((chromaHigh >> 13) & 0x07)) & 0xFF; + highG = (((chromaHigh >> 5) << 2) | ((chromaHigh >> 9) & 0x03)) & 0xFF; } - else + else /*RGB15(5:5:5)*/ { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V3_WIN_START_Y, (rDest.left<<16)); + lowR = (((chromaLow >> 10) << 3) | ((chromaLow >> 12) & 0x07)) & 0xFF; + lowG = (((chromaLow >> 5) << 3) | ((chromaLow >> 7) & 0x07)) & 0xFF; + + highR = (((chromaHigh >> 10) << 3) | ((chromaHigh >> 12) & 0x07)) & 0xFF; + highG = (((chromaHigh >> 5) << 3) | ((chromaHigh >> 7) & 0x07)) & 0xFF; } + lowB = (((chromaLow << 3) | (chromaLow >> 2)) & 0x07) & 0xFF; + lowC = (lowG << 16) | (lowR << 8) | lowB; + chromaLow = ((chromaLow >> 24) << 24) | lowC; + + highB = (((chromaHigh << 3) | (chromaHigh >> 2)) & 0x07) & 0xFF; + highC = (highG << 16) | (highR << 8) | highB; + chromaHigh = ((chromaHigh >> 24) << 24) | highC; + break; + + case 32: /*32 bit RGB*/ + lowR = (chromaLow >> 16) & 0xFF; + lowG = (chromaLow >> 8) & 0xFF; + lowB = chromaLow & 0xFF; + lowC = (lowG << 16) | (lowR << 8) | lowB; + chromaLow = ((chromaLow >> 24) << 24) | lowC; + + highR = (chromaHigh >> 16) & 0xFF; + highG = (chromaHigh >> 8) & 0xFF; + highB = chromaHigh & 0xFF; + highC = (highG << 16) | (highR << 8) | highB; + chromaHigh = ((chromaHigh >> 24) << 24) | highC; + break; + + default: + /*TOINT3;*/ + break; } + }/*End of DDPF_FOURCC*/ + + SaveVideoRegister(pVia, V_CHROMAKEY_HIGH, chromaHigh); + if (videoFlag & VIDEO_1_INUSE) + { + SaveVideoRegister(pVia, V_CHROMAKEY_LOW, chromaLow); + /*Temporarily solve the H/W Interpolation error when using Chroma Key*/ + SaveVideoRegister(pVia, V1_MINI_CONTROL, miniCtl & 0xFFFFFFF8); + } + else + { + SaveVideoRegister(pVia, V_CHROMAKEY_LOW, chromaLow | V_CHROMAKEY_V3); + SaveVideoRegister(pVia, V3_MINI_CONTROL, miniCtl & 0xFFFFFFF8); + } - dwCompose |= ALWAYS_SELECT_VIDEO; + /*Modified by Scottie[2001.12.5] for select video if (color key & chroma key)*/ + if (compose == SELECT_VIDEO_IF_COLOR_KEY) + compose = SELECT_VIDEO_IF_COLOR_KEY | SELECT_VIDEO_IF_CHROMA_KEY; + else + compose = (compose & ~0x0f) | SELECT_VIDEO_IF_CHROMA_KEY; + return compose; +} - /* Setup X zoom factor*/ - pVia->swov.overlayRecordV1.dwFetchAlignment = 0; +static void SetVideoStart(VIAPtr pVia, unsigned long videoFlag, + unsigned int numbufs, CARD32 a1, CARD32 a2, CARD32 a3) +{ + CARD32 V1Addr[3] = {V1_STARTADDR_0, V1_STARTADDR_1, V1_STARTADDR_2}; + CARD32 V3Addr[3] = {V3_STARTADDR_0, V3_STARTADDR_1, V3_STARTADDR_2}; + CARD32* VideoAddr = (videoFlag & VIDEO_1_INUSE) ? V1Addr : V3Addr; - if ( viaOverlayHQVCalcZoomWidth(pVia, dwVideoFlag, srcWidth , dstWidth, - &zoomCtl, &miniCtl, &dwHQVfilterCtl, &dwHQVminiCtl,&dwHQVzoomflagH) == PI_ERR ) - { - /* too small to handle*/ - dwFetch <<= 20; - if (dwVideoFlag & VIDEO_1_INUSE) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V12_QWORD_PER_LINE, dwFetch); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V_COMPOSE_MODE , dwCompose|V1_COMMAND_FIRE ); - } - else - { - dwFetch |=(VIDInD(V3_ALPHA_QWORD_PER_LINE)&(~V3_FETCH_COUNT)); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V3_ALPHA_QWORD_PER_LINE, dwFetch); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V_COMPOSE_MODE , dwCompose|V3_COMMAND_FIRE ); - - } - viaMacro_VidREGFlush(pVia); - return PI_ERR; + SaveVideoRegister(pVia, VideoAddr[0], a1); + if (numbufs > 1) SaveVideoRegister(pVia, VideoAddr[1], a2); + if (numbufs > 2) SaveVideoRegister(pVia, VideoAddr[2], a3); +} + +static void SetHQVFetch(VIAPtr pVia, CARD32 srcFetch, unsigned long srcHeight) +{ + if (!pVia->HWDiff.dwHQVFetchByteUnit) { /* CLE_C0 */ + srcFetch >>= 3; /* fetch unit is 8-byte */ + } + SaveVideoRegister(pVia, HQV_SRC_FETCH_LINE, ((srcFetch - 1) << 16) | (srcHeight - 1)); +} + +static void SetFetch(VIAPtr pVia, unsigned long videoFlag, CARD32 fetch) +{ + fetch <<= 20; + if (videoFlag & VIDEO_1_INUSE) { + SaveVideoRegister(pVia, V12_QWORD_PER_LINE, fetch); + } + else { + fetch |= VIDInD(V3_ALPHA_QWORD_PER_LINE) & ~V3_FETCH_COUNT; + SaveVideoRegister(pVia, V3_ALPHA_QWORD_PER_LINE, fetch); + } +} + +static void SetDisplayCount(VIAPtr pVia, unsigned long videoFlag, + unsigned long srcHeight, CARD32 displayCountW) +{ + if (videoFlag & VIDEO_1_INUSE) + SaveVideoRegister(pVia, V1_SOURCE_HEIGHT, (srcHeight << 16) | displayCountW); + else + SaveVideoRegister(pVia, V3_SOURCE_WIDTH, displayCountW); +} + +static void SetMiniAndZoom(VIAPtr pVia, unsigned long videoFlag, + CARD32 miniCtl, CARD32 zoomCtl) +{ + if (videoFlag & VIDEO_1_INUSE) { + SaveVideoRegister(pVia, V1_MINI_CONTROL, miniCtl); + SaveVideoRegister(pVia, V1_ZOOM_CONTROL, zoomCtl); + } + else { + SaveVideoRegister(pVia, V3_MINI_CONTROL, miniCtl); + SaveVideoRegister(pVia, V3_ZOOM_CONTROL, zoomCtl); + } +} + +static void SetVideoControl(VIAPtr pVia, unsigned long videoFlag, CARD32 vidCtl) +{ + if (videoFlag & VIDEO_1_INUSE) + SaveVideoRegister(pVia, V1_CONTROL, vidCtl); + else + SaveVideoRegister(pVia, V3_CONTROL, vidCtl); +} + +static void FireVideoCommand(VIAPtr pVia, unsigned long videoFlag, CARD32 compose) +{ + if (videoFlag & VIDEO_1_INUSE) + SaveVideoRegister(pVia, V_COMPOSE_MODE, compose | V1_COMMAND_FIRE); + else + SaveVideoRegister(pVia, V_COMPOSE_MODE, compose | V3_COMMAND_FIRE); +} + +static void SetVideoWindow(VIAPtr pVia, unsigned long videoFlag, + int left, int top, int right, int bottom) +{ + if (top < 0) top = 0; + if (bottom < 0) bottom = 0; + if (left < 0) left = 0; + if (right < 0) right = 0; + + if (top > 2047) top = 2047; + if (bottom > 2047) bottom = 2047; + if (left > 2047) left = 2047; + if (right > 2047) right = 2047; + + if (videoFlag & VIDEO_1_INUSE) { + SaveVideoRegister(pVia, V1_WIN_END_Y, (right << 16) | bottom); + SaveVideoRegister(pVia, V1_WIN_START_Y, (left << 16) | top); + } + else { + SaveVideoRegister(pVia, V3_WIN_END_Y, (right << 16) | bottom); + SaveVideoRegister(pVia, V3_WIN_START_Y, (left << 16) | top); + } +} + + + +/**************************************************************************** + * + * Upd_Video() + * + ***************************************************************************/ +static unsigned long Upd_Video(ScrnInfoPtr pScrn, unsigned long videoFlag, + unsigned long startAddr, RECTL rSrc, RECTL rDest, + unsigned long srcPitch, + unsigned long oriSrcWidth, unsigned long oriSrcHeight, + LPDDPIXELFORMAT pPFsrc, + unsigned long deinterlaceMode, + unsigned long haveColorKey, unsigned long haveChromaKey, + unsigned long colorKeyLow, unsigned long colorKeyHigh, + unsigned long chromaKeyLow, unsigned long chromaKeyHigh, + unsigned long flags) +{ + VIAPtr pVia = VIAPTR(pScrn); + vgaHWPtr hwp = VGAHWPTR(pScrn); + VIAHWDiff *hwDiff = &pVia->HWDiff; + + int i, j; + unsigned long vidCtl = 0, compose; + unsigned long srcWidth, srcHeight, dstWidth, dstHeight; + unsigned long zoomCtl = 0, miniCtl = 0; + unsigned long hqvCtl = 0; + unsigned long hqvFilterCtl = 0, hqvMiniCtl = 0; + unsigned long haveHQVzoomH = 0, haveHQVzoomV = 0; + unsigned long hqvSrcWidth = 0, hqvDstWidth = 0; + unsigned long hqvSrcFetch = 0, hqvOffset = 0; + unsigned long dwOffset = 0,fetch = 0,tmp = 0; + unsigned long displayCountW = 0; + + compose = (VIDInD(V_COMPOSE_MODE) & + ~(SELECT_VIDEO_IF_COLOR_KEY | V1_COMMAND_FIRE | V3_COMMAND_FIRE)) | V_COMMAND_LOAD_VBI; + + DBG_DD(ErrorF("// Upd_Video:\n")); + DBG_DD(ErrorF("Modified rSrc X (%ld,%ld) Y (%ld,%ld)\n", + rSrc.left, rSrc.right,rSrc.top, rSrc.bottom)); + DBG_DD(ErrorF("Modified rDest X (%ld,%ld) Y (%ld,%ld)\n", + rDest.left, rDest.right,rDest.top, rDest.bottom)); + + if (videoFlag & VIDEO_SHOW) + { + pVia->swov.overlayRecordV1.dwWidth = dstWidth = rDest.right - rDest.left; + pVia->swov.overlayRecordV1.dwHeight = dstHeight = rDest.bottom - rDest.top; + srcWidth = (unsigned long) rSrc.right - rSrc.left; + srcHeight = (unsigned long) rSrc.bottom - rSrc.top; + DBG_DD(ErrorF("===srcWidth= %ld \n", srcWidth)); + DBG_DD(ErrorF("===srcHeight= %ld \n", srcHeight)); + + vidCtl = ViaSetVidCtl(pVia, videoFlag); + viaOverlayGetV1V3Format(pVia, (videoFlag & VIDEO_1_INUSE) ? 1 : 3, + videoFlag, pPFsrc, &vidCtl, &hqvCtl); + + if (hwDiff->dwThreeHQVBuffer) { /* CLE_C0: HQV supports triple-buffering */ + hqvCtl &= ~HQV_SW_FLIP; + hqvCtl |= HQV_TRIPLE_BUFF | HQV_FLIP_STATUS; } - dwFetch <<= 20; - if (dwVideoFlag & VIDEO_1_INUSE) + /* Starting address of source and Source offset*/ + dwOffset = viaOverlayGetSrcStartAddress(pVia, videoFlag, + rSrc, rDest, srcPitch, pPFsrc, &hqvOffset); + DBG_DD(ErrorF("===dwOffset= 0x%lx \n", dwOffset)); + + pVia->swov.overlayRecordV1.dwOffset = dwOffset; + + if (pVia->swov.DPFsrc.dwFourCC == FOURCC_YV12 || + pVia->swov.DPFsrc.dwFourCC == FOURCC_VIA) { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V12_QWORD_PER_LINE, dwFetch); + YCBCRREC YCbCr; + if (videoFlag & VIDEO_HQV_INUSE) { + hqvSrcWidth = (unsigned long) rSrc.right - rSrc.left; + hqvDstWidth = (unsigned long) rDest.right - rDest.left; + + SetVideoStart(pVia, videoFlag, + hwDiff->dwThreeHQVBuffer ? 3 : 2, + pVia->swov.overlayRecordV1.dwHQVAddr[0]+dwOffset, + pVia->swov.overlayRecordV1.dwHQVAddr[1]+dwOffset, + pVia->swov.overlayRecordV1.dwHQVAddr[2]+dwOffset); + + YCbCr = viaOverlayGetYCbCrStartAddress(videoFlag, + startAddr,pVia->swov.overlayRecordV1.dwOffset, + pVia->swov.overlayRecordV1.dwUVoffset, + srcPitch,oriSrcHeight); + + SaveVideoRegister(pVia, HQV_SRC_STARTADDR_Y, YCbCr.dwY); + SaveVideoRegister(pVia, HQV_SRC_STARTADDR_U, YCbCr.dwCR); + SaveVideoRegister(pVia, HQV_SRC_STARTADDR_V, YCbCr.dwCB); + } + else { + YCbCr = viaOverlayGetYCbCrStartAddress(videoFlag, + startAddr, pVia->swov.overlayRecordV1.dwOffset, + pVia->swov.overlayRecordV1.dwUVoffset, + srcPitch, oriSrcHeight); + + if (videoFlag & VIDEO_1_INUSE) { + SaveVideoRegister(pVia, V1_STARTADDR_0, YCbCr.dwY); + SaveVideoRegister(pVia, V1_STARTADDR_CB0, YCbCr.dwCR); + SaveVideoRegister(pVia, V1_STARTADDR_CR0, YCbCr.dwCB); + } + else { + DBG_DD(ErrorF("Upd_Video() : We do not support YV12 with V3!\n")); + } + } } else { - dwFetch |=(VIDInD(V3_ALPHA_QWORD_PER_LINE)&(~V3_FETCH_COUNT)); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V3_ALPHA_QWORD_PER_LINE, dwFetch); - } + if (videoFlag & VIDEO_HQV_INUSE) { + hqvSrcWidth = (unsigned long) rSrc.right - rSrc.left; + hqvDstWidth = (unsigned long) rDest.right - rDest.left; - /* - // Setup Y zoom factor - */ + if (hqvSrcWidth > hqvDstWidth) { + dwOffset = dwOffset * hqvDstWidth / hqvSrcWidth; + } - /*For DCT450 test-BOB INTERLEAVE*/ - if ( (dwDeinterlaceMode & DDOVER_INTERLEAVED) && (dwDeinterlaceMode & DDOVER_BOB)) + SetVideoStart(pVia, videoFlag, + hwDiff->dwThreeHQVBuffer ? 3 : 2, + pVia->swov.overlayRecordV1.dwHQVAddr[0] + hqvOffset, + pVia->swov.overlayRecordV1.dwHQVAddr[1] + hqvOffset, + pVia->swov.overlayRecordV1.dwHQVAddr[2] + hqvOffset); + + SaveVideoRegister(pVia, HQV_SRC_STARTADDR_Y, startAddr); + } + else { + startAddr += dwOffset; + SetVideoStart(pVia, videoFlag, 1, startAddr, 0, 0); + } + } + + fetch = viaOverlayGetFetch(videoFlag, pPFsrc, + srcWidth, dstWidth, oriSrcWidth, &hqvSrcFetch); + DBG_DD(ErrorF("===fetch= 0x%lx \n", fetch)); +/* + //For DCT450 test-BOB INTERLEAVE + if ((deinterlaceMode & DDOVER_INTERLEAVED) && (deinterlaceMode & DDOVER_BOB)) { - if (!(dwVideoFlag & VIDEO_HQV_INUSE)) - { - srcHeight /=2; - if (dwVideoFlag & VIDEO_1_INUSE) - { - dwVidCtl |= (V1_BOB_ENABLE | V1_FRAME_BASE); - } - else - { - dwVidCtl |= (V3_BOB_ENABLE | V3_FRAME_BASE); - } + if (videoFlag & VIDEO_HQV_INUSE) { + hqvCtl |= HQV_FIELD_2_FRAME | HQV_FRAME_2_FIELD | HQV_DEINTERLACE; } - else + else { + vidCtl |= V1_BOB_ENABLE | V1_FRAME_BASE; + } + } + else if (deinterlaceMode & DDOVER_BOB) { + if (videoFlag & VIDEO_HQV_INUSE) { - dwHQVCtl |= HQV_FIELD_2_FRAME|HQV_FRAME_2_FIELD|HQV_DEINTERLACE; + //The HQV source data line count should be two times of the original line count + hqvCtl |= HQV_FIELD_2_FRAME | HQV_DEINTERLACE; + } + else { + vidCtl |= V1_BOB_ENABLE; } } - else if (dwDeinterlaceMode & DDOVER_BOB ) +*/ + if (videoFlag & VIDEO_HQV_INUSE) { - if (dwVideoFlag & VIDEO_HQV_INUSE) + if (!(deinterlaceMode & DDOVER_INTERLEAVED) && (deinterlaceMode & DDOVER_BOB)) + SetHQVFetch(pVia, hqvSrcFetch, oriSrcHeight << 1); + else + SetHQVFetch(pVia, hqvSrcFetch, oriSrcHeight); + + if (pVia->swov.DPFsrc.dwFourCC == FOURCC_YV12 || + pVia->swov.DPFsrc.dwFourCC == FOURCC_VIA) { - srcHeight <<=1; - dwHQVCtl |= HQV_FIELD_2_FRAME|HQV_DEINTERLACE; + if (videoFlag & VIDEO_1_INUSE) + SaveVideoRegister(pVia, V1_STRIDE, srcPitch << 1); + else + SaveVideoRegister(pVia, V3_STRIDE, srcPitch << 1); + + SaveVideoRegister(pVia, HQV_SRC_STRIDE, ((srcPitch >> 1) << 16) | srcPitch); + SaveVideoRegister(pVia, HQV_DST_STRIDE, (srcPitch << 1)); } else { - if (dwVideoFlag & VIDEO_1_INUSE) - { - dwVidCtl |= V1_BOB_ENABLE; - } + if (videoFlag & VIDEO_1_INUSE) + SaveVideoRegister(pVia, V1_STRIDE, srcPitch); else - { - dwVidCtl |= V3_BOB_ENABLE; - } + SaveVideoRegister(pVia, V3_STRIDE, srcPitch); + + SaveVideoRegister(pVia, HQV_SRC_STRIDE, srcPitch); + SaveVideoRegister(pVia, HQV_DST_STRIDE, srcPitch); } - } - viaOverlayGetDisplayCount(pVia, dwVideoFlag,lpDPFsrc,srcWidth,&dwDisplayCountW); - - if (dwVideoFlag & VIDEO_1_INUSE) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V1_SOURCE_HEIGHT, (srcHeight<<16)|dwDisplayCountW); } else { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V3_SOURCE_WIDTH, dwDisplayCountW); + if (videoFlag & VIDEO_1_INUSE) + SaveVideoRegister(pVia, V1_STRIDE, srcPitch | (srcPitch << 15)); + else + SaveVideoRegister(pVia, V3_STRIDE, srcPitch | (srcPitch << 15)); } - - if ( viaOverlayHQVCalcZoomHeight(pVia, srcHeight,dstHeight,&zoomCtl,&miniCtl, &dwHQVfilterCtl, &dwHQVminiCtl ,&dwHQVzoomflagV) == PI_ERR ) + + DBG_DD(ErrorF("rSrc X (%ld,%ld) Y (%ld,%ld)\n", + rSrc.left, rSrc.right,rSrc.top, rSrc.bottom)); + DBG_DD(ErrorF("rDest X (%ld,%ld) Y (%ld,%ld)\n", + rDest.left, rDest.right,rDest.top, rDest.bottom)); + + /* Set destination window */ + + i = rDest.top; + j = rDest.bottom - 1; + + if (videoFlag & VIDEO_1_INUSE) { - if (dwVideoFlag & VIDEO_1_INUSE) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V_COMPOSE_MODE , dwCompose|V1_COMMAND_FIRE ); - } - else - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V_COMPOSE_MODE , dwCompose|V3_COMMAND_FIRE ); + /* modify for HW DVI limitation, + * When we enable the CRT and DVI both, then change resolution. + * If the resolution small than the panel physical size, + * the video display in Y direction will be cut. + * So, we need to adjust the Y top and bottom position. + */ + if (pVia->pBIOSInfo->SetDVI && pVia->pBIOSInfo->scaleY) { + i = rDest.top * pVia->pBIOSInfo->panelY / pScrn->currentMode->VDisplay; + j = rDest.bottom * pVia->pBIOSInfo->panelY / pScrn->currentMode->VDisplay; } + } + if (rDest.top < 0) i = 0; + SetVideoWindow(pVia, videoFlag, rDest.left, i, rDest.right - 1, j); + + compose |= ALWAYS_SELECT_VIDEO; - viaMacro_VidREGFlush(pVia); + /* Setup X zoom factor*/ + + pVia->swov.overlayRecordV1.dwFetchAlignment = 0; + + if (viaOverlayHQVCalcZoomWidth(pVia, videoFlag, srcWidth, dstWidth, + &zoomCtl, &miniCtl, &hqvFilterCtl, &hqvMiniCtl, &haveHQVzoomH) == FALSE) + { + /* Need to scale (minify) too much - can't handle it. */ + SetFetch(pVia, videoFlag, fetch); + FireVideoCommand(pVia, videoFlag, compose); + FlushVidRegBuffer(pVia); return PI_ERR; } - if (miniCtl & V1_Y_INTERPOLY) + SetFetch(pVia, videoFlag, fetch); + + /* Setup Y zoom factor */ + + /*For DCT450 test-BOB INTERLEAVE*/ + if ((deinterlaceMode & DDOVER_INTERLEAVED) && (deinterlaceMode & DDOVER_BOB)) { - if (pVia->swov.DPFsrc.dwFourCC == FOURCC_YV12 - || pVia->swov.DPFsrc.dwFourCC == FOURCC_VIA) - { - if (dwVideoFlag & VIDEO_HQV_INUSE) - { - if (dwVideoFlag & VIDEO_1_INUSE) - { - /*=* Modify for C1 FIFO *=*/ - /* WARNING: not checking Chipset! */ - if (CLE266_REV_IS_CX(pVia->ChipRev)) - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL, - V1_FIFO_DEPTH64 | V1_FIFO_PRETHRESHOLD56 | V1_FIFO_THRESHOLD56); - else - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL, - V1_FIFO_DEPTH32 | V1_FIFO_PRETHRESHOLD29 | V1_FIFO_THRESHOLD16); - } - else - { - ViaVideoRegWrite(pVia); - } - } + if (!(videoFlag & VIDEO_HQV_INUSE)) { + srcHeight /= 2; + if (videoFlag & VIDEO_1_INUSE) + vidCtl |= V1_BOB_ENABLE | V1_FRAME_BASE; else - { - /*Minified Video will be skewed if not work around*/ - if (srcWidth <= 80) /*Fetch count <= 5*/ - { - if (dwVideoFlag & VIDEO_1_INUSE) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL,V1_FIFO_DEPTH16 ); - } - else - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, ALPHA_V3_FIFO_CONTROL, - (VIDInD(ALPHA_V3_FIFO_CONTROL)&ALPHA_FIFO_MASK)|V3_FIFO_DEPTH16 ); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, ALPHA_V3_PREFIFO_CONTROL ,(V3_FIFO_THRESHOLD16>>8) | - ( VIDInD(ALPHA_V3_PREFIFO_CONTROL)& (~V3_FIFO_MASK)) ); - } - } - else - { - if (dwVideoFlag & VIDEO_1_INUSE) - { - /*=* Modify for C1 FIFO *=*/ - /* WARNING: not checking Chipset! */ - if (CLE266_REV_IS_CX(pVia->ChipRev)) - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL, - V1_FIFO_DEPTH64 | V1_FIFO_PRETHRESHOLD56 | V1_FIFO_THRESHOLD56); - else - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL, - V1_FIFO_DEPTH16 | V1_FIFO_PRETHRESHOLD12 | V1_FIFO_THRESHOLD8); - } - else - { - ViaVideoRegWrite(pVia); - } - } - } + vidCtl |= V3_BOB_ENABLE | V3_FRAME_BASE; } - else - { - if (dwVideoFlag & VIDEO_1_INUSE) - { - /*=* Modify for C1 FIFO *=*/ - /* WARNING: not checking Chipset! */ - if (CLE266_REV_IS_CX(pVia->ChipRev)) - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL, - V1_FIFO_DEPTH64 | V1_FIFO_PRETHRESHOLD56 | V1_FIFO_THRESHOLD56); - else { - if (pVia->swov.gdwUseExtendedFIFO) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL, - V1_FIFO_DEPTH48 | V1_FIFO_PRETHRESHOLD40 | V1_FIFO_THRESHOLD40); - } - else - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL, - V1_FIFO_DEPTH32 | V1_FIFO_PRETHRESHOLD29 | V1_FIFO_THRESHOLD16); - } - } - } - else - { - /*Fix V3 bug*/ - if (srcWidth <= 8) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, ALPHA_V3_FIFO_CONTROL, - (VIDInD(ALPHA_V3_FIFO_CONTROL)&ALPHA_FIFO_MASK)); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, ALPHA_V3_PREFIFO_CONTROL , - ( VIDInD(ALPHA_V3_PREFIFO_CONTROL)& (~V3_FIFO_MASK)) ); - } - else - { - ViaVideoRegWrite(pVia); - } - } + else { + hqvCtl |= HQV_FIELD_2_FRAME | HQV_FRAME_2_FIELD | HQV_DEINTERLACE; } } - else + else if (deinterlaceMode & DDOVER_BOB) { - if (pVia->swov.DPFsrc.dwFourCC == FOURCC_YV12 - || pVia->swov.DPFsrc.dwFourCC == FOURCC_VIA) - { - if (dwVideoFlag & VIDEO_HQV_INUSE) - { - if (dwVideoFlag & VIDEO_1_INUSE) - { - /*=* Modify for C1 FIFO *=*/ - /* WARNING: not checking Chipset! */ - if (CLE266_REV_IS_CX(pVia->ChipRev)) - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL, - V1_FIFO_DEPTH64 | V1_FIFO_PRETHRESHOLD56 | V1_FIFO_THRESHOLD56); - else - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL, - V1_FIFO_DEPTH32 | V1_FIFO_PRETHRESHOLD29 | V1_FIFO_THRESHOLD16); - } - else - { - ViaVideoRegWrite( pVia ); - } - } - else - { - /*Minified Video will be skewed if not work around*/ - if (srcWidth <= 80) /*Fetch count <= 5*/ - { - if (dwVideoFlag & VIDEO_1_INUSE) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL,V1_FIFO_DEPTH16 ); - } - else - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, ALPHA_V3_FIFO_CONTROL, - (VIDInD(ALPHA_V3_FIFO_CONTROL)&ALPHA_FIFO_MASK)|V3_FIFO_DEPTH16 ); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, ALPHA_V3_PREFIFO_CONTROL ,(V3_FIFO_THRESHOLD16>>8) | - ( VIDInD(ALPHA_V3_PREFIFO_CONTROL)& (~V3_FIFO_MASK)) ); - } - } - else - { - if (dwVideoFlag & VIDEO_1_INUSE) - { - /*=* Modify for C1 FIFO *=*/ - /* WARNING: not checking Chipset! */ - if (CLE266_REV_IS_CX(pVia->ChipRev)) - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL, - V1_FIFO_DEPTH64 | V1_FIFO_PRETHRESHOLD56 | V1_FIFO_THRESHOLD56); - else - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL, - V1_FIFO_DEPTH16 | V1_FIFO_PRETHRESHOLD12 | V1_FIFO_THRESHOLD8); - } - else - { - ViaVideoRegWrite(pVia); - } - } - } + if (videoFlag & VIDEO_HQV_INUSE) { + srcHeight <<= 1; + hqvCtl |= HQV_FIELD_2_FRAME | HQV_DEINTERLACE; } - else - { - if (dwVideoFlag & VIDEO_1_INUSE) - { - /*=* Modify for C1 FIFO *=*/ - /* WARNING: not checking Chipset! */ - if (CLE266_REV_IS_CX(pVia->ChipRev)) - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL, - V1_FIFO_DEPTH64 | V1_FIFO_PRETHRESHOLD56 | V1_FIFO_THRESHOLD56); - else { - if (pVia->swov.gdwUseExtendedFIFO) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL, - V1_FIFO_DEPTH48 | V1_FIFO_PRETHRESHOLD40 | V1_FIFO_THRESHOLD40); - } - else - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, V_FIFO_CONTROL, - V1_FIFO_DEPTH32 | V1_FIFO_PRETHRESHOLD29 | V1_FIFO_THRESHOLD16); - } - } - } + else { + if (videoFlag & VIDEO_1_INUSE) + vidCtl |= V1_BOB_ENABLE; else - { - /*Fix V3 bug*/ - if (srcWidth <= 8) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, ALPHA_V3_FIFO_CONTROL, - (VIDInD(ALPHA_V3_FIFO_CONTROL)&ALPHA_FIFO_MASK)); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, ALPHA_V3_PREFIFO_CONTROL , - ( VIDInD(ALPHA_V3_PREFIFO_CONTROL)& (~V3_FIFO_MASK)) ); - } - else - { - ViaVideoRegWrite(pVia); - } - } + vidCtl |= V3_BOB_ENABLE; } } - if (dwVideoFlag & VIDEO_HQV_INUSE) + viaOverlayGetDisplayCount(pVia, videoFlag, pPFsrc, srcWidth, &displayCountW); + SetDisplayCount(pVia, videoFlag, srcHeight, displayCountW); + + if (viaOverlayHQVCalcZoomHeight(pVia, srcHeight, dstHeight, + &zoomCtl, &miniCtl, &hqvFilterCtl, &hqvMiniCtl ,&haveHQVzoomV) == FALSE) + { + /* Need to scale (minify) too much - can't handle it. */ + FireVideoCommand(pVia, videoFlag, compose); + FlushVidRegBuffer(pVia); + return PI_ERR; + } + + SetupFIFOs(pVia, videoFlag, miniCtl, srcWidth); + + if (videoFlag & VIDEO_HQV_INUSE) { miniCtl=0; - if (dwHQVzoomflagH||dwHQVzoomflagV) - { - dwTmp = 0; - if (dwHQVzoomflagH) - { + if (haveHQVzoomH || haveHQVzoomV) { + tmp = 0; + if (haveHQVzoomH) { miniCtl = V1_X_INTERPOLY; - dwTmp = (zoomCtl&0xffff0000); + tmp = zoomCtl & 0xffff0000; } - - if (dwHQVzoomflagV) - { - miniCtl |= (V1_Y_INTERPOLY | V1_YCBCR_INTERPOLY); - dwTmp |= (zoomCtl&0x0000ffff); - dwHQVfilterCtl &= 0xfffdffff; + if (haveHQVzoomV) { + miniCtl |= V1_Y_INTERPOLY | V1_YCBCR_INTERPOLY; + tmp |= zoomCtl & 0x0000ffff; + hqvFilterCtl &= 0xfffdffff; } - - /*Temporarily fix for 2D bandwidth problem. 2002/08/01*/ - if ((pVia->swov.gdwUseExtendedFIFO)) - { + + /* Temporary fix for 2D bandwidth problem. 2002/08/01*/ + if (pVia->swov.gdwUseExtendedFIFO) { miniCtl &= ~V1_Y_INTERPOLY; } - - if (dwVideoFlag & VIDEO_1_INUSE) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V1_MINI_CONTROL, miniCtl); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V1_ZOOM_CONTROL, dwTmp); - } - else - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V3_MINI_CONTROL, miniCtl); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V3_ZOOM_CONTROL, dwTmp); - } + + SetMiniAndZoom(pVia, videoFlag, miniCtl, tmp); } - else - { - if (srcHeight==dstHeight) - { - dwHQVfilterCtl &= 0xfffdffff; - } - if (dwVideoFlag & VIDEO_1_INUSE) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V1_MINI_CONTROL, 0); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V1_ZOOM_CONTROL, 0); - } - else - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V3_MINI_CONTROL, 0); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V3_ZOOM_CONTROL, 0); + else { + if (srcHeight == dstHeight) { + hqvFilterCtl &= 0xfffdffff; } + SetMiniAndZoom(pVia, videoFlag, 0, 0); } - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,HQV_MINIFY_CONTROL, dwHQVminiCtl); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,HQV_FILTER_CONTROL, dwHQVfilterCtl); + SaveVideoRegister(pVia, HQV_MINIFY_CONTROL, hqvMiniCtl); + SaveVideoRegister(pVia, HQV_FILTER_CONTROL, hqvFilterCtl); } - else - { - if (dwVideoFlag & VIDEO_1_INUSE) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V1_MINI_CONTROL, miniCtl); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V1_ZOOM_CONTROL, zoomCtl); - } - else - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V3_MINI_CONTROL, miniCtl); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V3_ZOOM_CONTROL, zoomCtl); - } + else { + SetMiniAndZoom(pVia, videoFlag, miniCtl, zoomCtl); } - - /* Colorkey*/ - if (dwColorKey) { - DBG_DD(ErrorF("Overlay colorkey= low:%08lx high:%08lx\n", dwKeyLow, dwKeyHigh)); - - dwKeyLow &= 0x00FFFFFF; - /*viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V_COLOR_KEY, dwKeyLow);*/ - - if (dwVideoFlag & VIDEO_1_INUSE) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V_COLOR_KEY, dwKeyLow); - } - else - { - if ( hwDiff->dwSupportTwoColorKey ) /*CLE_C0*/ - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V3_COLOR_KEY, dwKeyLow); - } - - /*dwCompose = (dwCompose & ~0x0f) | SELECT_VIDEO_IF_COLOR_KEY;*/ - /*CLE_C0*/ - dwCompose = (dwCompose & ~0x0f) | SELECT_VIDEO_IF_COLOR_KEY | SELECT_VIDEO3_IF_COLOR_KEY; - /*dwCompose = (dwCompose & ~0x0f) ;*/ + if (haveColorKey) { + compose = SetColorKey(pVia, videoFlag, colorKeyLow, colorKeyHigh, compose); } - if (dwChromaKey) { - DBG_DD(ErrorF("Overlay Chromakey= low:%08lx high:%08lx\n", dwKeyLow, dwKeyHigh)); - - dwChromaLow &= CHROMA_KEY_LOW; - dwChromaHigh &= CHROMA_KEY_HIGH; - - dwChromaLow |= (VIDInD(V_CHROMAKEY_LOW)&(~CHROMA_KEY_LOW)); - dwChromaHigh |= (VIDInD(V_CHROMAKEY_HIGH)&(~CHROMA_KEY_HIGH)); - - /*Added by Scottie[2001.12.5] for Chroma Key*/ - if (pVia->swov.DPFsrc.dwFlags & DDPF_FOURCC) - { - switch (pVia->swov.DPFsrc.dwFourCC) { - case FOURCC_YV12: - case FOURCC_VIA: - /*to be continued...*/ - break; - case FOURCC_YUY2: - /*to be continued...*/ - break; - default: - /*TOINT3;*/ - break; - } - } - else if (pVia->swov.DPFsrc.dwFlags & DDPF_RGB) - { - unsigned long dwtmpLowR; - unsigned long dwtmpLowG; - unsigned long dwtmpLowB; - unsigned long dwtmpChromaLow; - unsigned long dwtmpHighR; - unsigned long dwtmpHighG; - unsigned long dwtmpHighB; - unsigned long dwtmpChromaHigh; - - switch (pVia->swov.DPFsrc.dwRGBBitCount) { - case 16: - if (pVia->swov.DPFsrc.dwGBitMask==0x07E0) /*RGB16(5:6:5)*/ - { - dwtmpLowR = (((dwChromaLow >> 11) << 3) | ((dwChromaLow >> 13) & 0x07)) & 0xFF; - dwtmpLowG = (((dwChromaLow >> 5) << 2) | ((dwChromaLow >> 9) & 0x03)) & 0xFF; - - dwtmpHighR = (((dwChromaHigh >> 11) << 3) | ((dwChromaHigh >> 13) & 0x07)) & 0xFF; - dwtmpHighG = (((dwChromaHigh >> 5) << 2) | ((dwChromaHigh >> 9) & 0x03)) & 0xFF; - } - else /*RGB15(5:5:5)*/ - { - dwtmpLowR = (((dwChromaLow >> 10) << 3) | ((dwChromaLow >> 12) & 0x07)) & 0xFF; - dwtmpLowG = (((dwChromaLow >> 5) << 3) | ((dwChromaLow >> 7) & 0x07)) & 0xFF; - - dwtmpHighR = (((dwChromaHigh >> 10) << 3) | ((dwChromaHigh >> 12) & 0x07)) & 0xFF; - dwtmpHighG = (((dwChromaHigh >> 5) << 3) | ((dwChromaHigh >> 7) & 0x07)) & 0xFF; - } - dwtmpLowB = (((dwChromaLow << 3) | (dwChromaLow >> 2)) & 0x07) & 0xFF; - dwtmpChromaLow = (dwtmpLowG << 16) | (dwtmpLowR << 8) | dwtmpLowB; - dwChromaLow = ((dwChromaLow >> 24) << 24) | dwtmpChromaLow; - - dwtmpHighB = (((dwChromaHigh << 3) | (dwChromaHigh >> 2)) & 0x07) & 0xFF; - dwtmpChromaHigh = (dwtmpHighG << 16) | (dwtmpHighR << 8) | dwtmpHighB; - dwChromaHigh = ((dwChromaHigh >> 24) << 24) | dwtmpChromaHigh; - break; - - case 32: /*32 bit RGB*/ - dwtmpLowR = (dwChromaLow >> 16) & 0xFF; - dwtmpLowG = (dwChromaLow >> 8) & 0xFF; - dwtmpLowB = dwChromaLow & 0xFF; - dwtmpChromaLow = (dwtmpLowG << 16) | (dwtmpLowR << 8) | dwtmpLowB; - dwChromaLow = ((dwChromaLow >> 24) << 24) | dwtmpChromaLow; - - dwtmpHighR = (dwChromaHigh >> 16) & 0xFF; - dwtmpHighG = (dwChromaHigh >> 8) & 0xFF; - dwtmpHighB = dwChromaHigh & 0xFF; - dwtmpChromaHigh = (dwtmpHighG << 16) | (dwtmpHighR << 8) | dwtmpHighB; - dwChromaHigh = ((dwChromaHigh >> 24) << 24) | dwtmpChromaHigh; - break; - - default: - /*TOINT3;*/ - break; - } - }/*End of DDPF_FOURCC*/ - - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V_CHROMAKEY_HIGH,dwChromaHigh); - if (dwVideoFlag & VIDEO_1_INUSE) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V_CHROMAKEY_LOW, dwChromaLow); - /*Temporarily solve the H/W Interpolation error when using Chroma Key*/ - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V1_MINI_CONTROL, miniCtl & 0xFFFFFFF8); - } - else - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V_CHROMAKEY_LOW, dwChromaLow|V_CHROMAKEY_V3); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V3_MINI_CONTROL, miniCtl & 0xFFFFFFF8); - } - - /*Modified by Scottie[2001.12.5] for select video if (color key & chroma key)*/ - if (dwCompose==SELECT_VIDEO_IF_COLOR_KEY) - dwCompose = SELECT_VIDEO_IF_COLOR_KEY | SELECT_VIDEO_IF_CHROMA_KEY; - else - dwCompose = (dwCompose & ~0x0f) | SELECT_VIDEO_IF_CHROMA_KEY; + if (haveChromaKey) { + compose = SetChromaKey(pVia, videoFlag, + chromaKeyLow, chromaKeyHigh, miniCtl, compose); } - + /* determine which video stream is on top */ /* - DBG_DD(ErrorF(" dwFlags= 0x%08lx\n", dwFlags)); - if (dwFlags & DDOVER_CLIP) - dwCompose |= COMPOSE_V3_TOP; + DBG_DD(ErrorF(" flags= 0x%08lx\n", flags)); + if (flags & DDOVER_CLIP) + compose |= COMPOSE_V3_TOP; else - dwCompose |= COMPOSE_V1_TOP; + compose |= COMPOSE_V1_TOP; */ - DBG_DD(ErrorF(" pVia->Video.dwCompose 0x%lx\n", pVia->Video.dwCompose)); - - if (pVia->Video.dwCompose & (VW_TV1_TOP | VW_TV_TOP) ) - dwCompose |= COMPOSE_V3_TOP; - else if (pVia->Video.dwCompose & (VW_TV0_TOP | VW_DVD_TOP) ) - dwCompose &= ~COMPOSE_V3_TOP; - - DBG_DD(ErrorF(" dwCompose 0x%8lx\n", dwCompose)); /* Setup video control*/ - if (dwVideoFlag & VIDEO_HQV_INUSE) - { + if (videoFlag & VIDEO_HQV_INUSE) { if (!pVia->swov.SWVideo_ON) - /*if (0)*/ + /*if (0)*/ { - DBG_DD(ErrorF(" First HQV\n")); - - viaMacro_VidREGFlush(pVia); - + DBG_DD(ErrorF(" First HQV\n")); + + FlushVidRegBuffer(pVia); + DBG_DD(ErrorF(" Wait flips")); - if ( hwDiff->dwHQVInitPatch ) - { - DBG_DD(ErrorF(" Wait flips 1")); - viaWaitHQVFlipClear(pVia, ((dwHQVCtl&~HQV_SW_FLIP)|HQV_FLIP_STATUS)&~HQV_ENABLE); - VIDOutD(HQV_CONTROL, dwHQVCtl); - DBG_DD(ErrorF(" Wait flips2")); - viaWaitHQVFlip(pVia); - DBG_DD(ErrorF(" Wait flips 3")); - viaWaitHQVFlipClear(pVia, ((dwHQVCtl&~HQV_SW_FLIP)|HQV_FLIP_STATUS)&~HQV_ENABLE); - VIDOutD(HQV_CONTROL, dwHQVCtl); - DBG_DD(ErrorF(" Wait flips4")); - viaWaitHQVFlip(pVia); + + if (hwDiff->dwHQVInitPatch) { + DBG_DD(ErrorF(" Initializing HQV twice ...")); + for (i = 0; i < 2; i++) { + viaWaitHQVFlipClear(pVia, + ((hqvCtl & ~HQV_SW_FLIP) | HQV_FLIP_STATUS) & ~HQV_ENABLE); + VIDOutD(HQV_CONTROL, hqvCtl); + viaWaitHQVFlip(pVia); + } + DBG_DD(ErrorF(" done.\n")); } else /* CLE_C0 */ { - /* check HQV is idle */ - { - CARD32 volatile *pdwState = (CARD32 volatile *) (pVia->VidMapBase+HQV_CONTROL); - DBG_DD(ErrorF("HQV control wf - %08x\n", *pdwState)); - - while(!(*pdwState & HQV_IDLE)) - { - DBG_DD(ErrorF("HQV control busy - %08x\n", *pdwState)); - usleep(1); - } - } - - VIDOutD(HQV_CONTROL, dwHQVCtl & ~HQV_SW_FLIP); - VIDOutD(HQV_CONTROL, dwHQVCtl | HQV_SW_FLIP); + CARD32 volatile *HQVCtrl = + (CARD32 volatile *) (pVia->VidMapBase + HQV_CONTROL); - { - CARD32 volatile *pdwState = (CARD32 volatile *) (pVia->VidMapBase+HQV_CONTROL); - int i = 50; - - DBG_DD(ErrorF("HQV control wf5 - %08x\n", *pdwState)); - - DBG_DD(ErrorF(" Wait flips5")); + /* check HQV is idle */ - while (!(*pdwState & HQV_FLIP_STATUS)) - { - DBG_DD(ErrorF(" HQV wait %d %08x\n",i, *pdwState)); + DBG_DD(ErrorF("HQV control wf - %08x\n", *HQVCtrl)); + while(!(*HQVCtrl & HQV_IDLE)) { + DBG_DD(ErrorF("HQV control busy - %08x\n", *HQVCtrl)); + usleep(1); + } - *pdwState |= HQV_SW_FLIP|HQV_FLIP_STATUS; + VIDOutD(HQV_CONTROL, hqvCtl & ~HQV_SW_FLIP); + VIDOutD(HQV_CONTROL, hqvCtl | HQV_SW_FLIP); - usleep(1); + DBG_DD(ErrorF("HQV control wf5 - %08x\n", *HQVCtrl)); + DBG_DD(ErrorF(" Wait flips5")); - if (!i--) - break; - } + for (i = 0; (i < 50) && !(*HQVCtrl & HQV_FLIP_STATUS); i++) { + DBG_DD(ErrorF(" HQV wait %d %08x\n",i, *HQVCtrl)); + *HQVCtrl |= HQV_SW_FLIP | HQV_FLIP_STATUS; + usleep(1); + } #if 0 - viaWaitHQVFlip(pVia); + viaWaitHQVFlip(pVia); #endif - DBG_DD(ErrorF(" Wait flips6")); - } + DBG_DD(ErrorF(" Wait flips6")); } - - if (dwVideoFlag & VIDEO_1_INUSE) + + if (videoFlag & VIDEO_1_INUSE) { - VIDOutD(V1_CONTROL, dwVidCtl); - VIDOutD(V_COMPOSE_MODE, (dwCompose|V1_COMMAND_FIRE )); + VIDOutD(V1_CONTROL, vidCtl); + VIDOutD(V_COMPOSE_MODE, compose | V1_COMMAND_FIRE); if (pVia->swov.gdwUseExtendedFIFO) { /*Set Display FIFO*/ - DBG_DD(ErrorF(" Wait flips7")); + DBG_DD(ErrorF(" Wait flips7")); viaWaitVBI(pVia); - DBG_DD(ErrorF(" Wait flips 8")); - hwp->writeSeq(hwp, 0x17, 0x2F); - ViaSeqMask(hwp, 0x16, 0x14, 0x1F); - hwp->writeSeq(hwp, 0x18, 0x56); - DBG_DD(ErrorF(" Wait flips 9")); + DBG_DD(ErrorF(" Wait flips 8")); + hwp->writeSeq(hwp, 0x17, 0x2F); + ViaSeqMask(hwp, 0x16, 0x14, 0x1F); + hwp->writeSeq(hwp, 0x18, 0x56); + DBG_DD(ErrorF(" Wait flips 9")); } } else { - DBG_DD(ErrorF(" Wait flips 10")); - VIDOutD(V3_CONTROL, dwVidCtl); - VIDOutD(V_COMPOSE_MODE, (dwCompose|V3_COMMAND_FIRE )); + DBG_DD(ErrorF(" Wait flips 10")); + VIDOutD(V3_CONTROL, vidCtl); + VIDOutD(V_COMPOSE_MODE, compose | V3_COMMAND_FIRE); } - DBG_DD(ErrorF(" Done flips")); + DBG_DD(ErrorF(" Done flips")); } else { DBG_DD(ErrorF(" Normal called\n")); - if (dwVideoFlag & VIDEO_1_INUSE) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V1_CONTROL, dwVidCtl); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V_COMPOSE_MODE, (dwCompose|V1_COMMAND_FIRE )); - } - else - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V3_CONTROL, dwVidCtl); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V_COMPOSE_MODE, (dwCompose|V3_COMMAND_FIRE )); - } - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER, HQV_CONTROL, dwHQVCtl|HQV_FLIP_STATUS); + SetVideoControl(pVia, videoFlag, vidCtl); + FireVideoCommand(pVia, videoFlag, compose); + SaveVideoRegister(pVia, HQV_CONTROL, hqvCtl | HQV_FLIP_STATUS); viaWaitHQVDone(pVia); - viaMacro_VidREGFlush(pVia); + FlushVidRegBuffer(pVia); } } else { - if (dwVideoFlag & VIDEO_1_INUSE) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V1_CONTROL, dwVidCtl); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V_COMPOSE_MODE, (dwCompose|V1_COMMAND_FIRE )); - } - else - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V3_CONTROL, dwVidCtl); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V_COMPOSE_MODE, (dwCompose|V3_COMMAND_FIRE )); - } + SetVideoControl(pVia, videoFlag, vidCtl); + FireVideoCommand(pVia, videoFlag, compose); viaWaitHQVDone(pVia); - viaMacro_VidREGFlush(pVia); + FlushVidRegBuffer(pVia); } - pVia->swov.SWVideo_ON = TRUE; + pVia->swov.SWVideo_ON = TRUE; } else { - /*Hide overlay*/ - - if ( hwDiff->dwHQVDisablePatch ) /*CLE_C0*/ - ViaSeqMask(hwp, 0x2E, 0x00, 0x10); - - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V_FIFO_CONTROL,V1_FIFO_PRETHRESHOLD12 | - V1_FIFO_THRESHOLD8 |V1_FIFO_DEPTH16); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,ALPHA_V3_FIFO_CONTROL, ALPHA_FIFO_THRESHOLD4 - | ALPHA_FIFO_DEPTH8 | V3_FIFO_THRESHOLD24 | V3_FIFO_DEPTH32 ); + /* Hide overlay */ - if (dwVideoFlag&VIDEO_HQV_INUSE) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,HQV_CONTROL, (VIDInD(HQV_CONTROL) & (~HQV_ENABLE))); - } + if (hwDiff->dwHQVDisablePatch) /*CLE_C0*/ + ViaSeqMask(hwp, 0x2E, 0x00, 0x10); - if (dwVideoFlag&VIDEO_1_INUSE) - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V1_CONTROL, (VIDInD(V1_CONTROL) & (~V1_ENABLE))); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V_COMPOSE_MODE, (VIDInD(V_COMPOSE_MODE)|V1_COMMAND_FIRE)); - } + SaveVideoRegister(pVia, V_FIFO_CONTROL, V1_FIFO_PRETHRESHOLD12 | + V1_FIFO_THRESHOLD8 | V1_FIFO_DEPTH16); + SaveVideoRegister(pVia, ALPHA_V3_FIFO_CONTROL, ALPHA_FIFO_THRESHOLD4 + | ALPHA_FIFO_DEPTH8 | V3_FIFO_THRESHOLD24 | V3_FIFO_DEPTH32); + + if (videoFlag & VIDEO_HQV_INUSE) + SaveVideoRegister(pVia, HQV_CONTROL, VIDInD(HQV_CONTROL) & ~HQV_ENABLE); + + if (videoFlag & VIDEO_1_INUSE) + SaveVideoRegister(pVia, V1_CONTROL, VIDInD(V1_CONTROL) & ~V1_ENABLE); else - { - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V3_CONTROL, (VIDInD(V3_CONTROL) & (~V3_ENABLE))); - viaMacro_VidREGRec(pVia, VIDREGREC_SAVE_REGISTER,V_COMPOSE_MODE, (VIDInD(V_COMPOSE_MODE)|V3_COMMAND_FIRE)); - } + SaveVideoRegister(pVia, V3_CONTROL, VIDInD(V3_CONTROL) & ~V3_ENABLE); - viaMacro_VidREGFlush(pVia); - - if ( hwDiff->dwHQVDisablePatch ) /*CLE_C0*/ - ViaSeqMask(hwp, 0x2E, 0x10, 0x10); - } + FireVideoCommand(pVia, videoFlag, VIDInD(V_COMPOSE_MODE)); + FlushVidRegBuffer(pVia); + + if (hwDiff->dwHQVDisablePatch) /*CLE_C0*/ + ViaSeqMask(hwp, 0x2E, 0x10, 0x10); + } DBG_DD(ErrorF(" Done Upd_Video")); - return PI_OK; - + return PI_OK; + } /* Upd_Video */ /************************************************************************* @@ -1540,216 +1289,194 @@ static unsigned long Upd_Video(ScrnInfoPtr pScrn, unsigned long dwVideoFlag,unsi * Parameters: src rectangle, dst rectangle, colorkey... * Return Value: unsigned long of state * note: Update the overlay image param. -*************************************************************************/ -unsigned long VIAVidUpdateOverlay(ScrnInfoPtr pScrn, LPDDUPDATEOVERLAY lpUpdate) + *************************************************************************/ +unsigned long VIAVidUpdateOverlay(ScrnInfoPtr pScrn, LPDDUPDATEOVERLAY pUpdate) { VIAPtr pVia = VIAPTR(pScrn); vgaHWPtr hwp = VGAHWPTR(pScrn); - unsigned long dwFlags = lpUpdate->dwFlags; - unsigned long dwKeyLow=0, dwKeyHigh=0; - unsigned long dwChromaLow=0, dwChromaHigh=0; - unsigned long dwVideoFlag=0; - unsigned long dwColorKey=0, dwChromaKey=0; - /*DDUPDATEOVERLAY UpdateOverlayTemp;*/ - int nDstTop, nDstBottom, nDstLeft, nDstRight; - - DBG_DD(ErrorF("// VIAVidUpdateOverlay: %08lx\n", dwFlags)); - + OVERLAYRECORD* ovlV1 = &pVia->swov.overlayRecordV1; + + unsigned long flags = pUpdate->dwFlags; + unsigned long videoFlag = 0; + unsigned long startAddr = 0; + unsigned long deinterlaceMode=0; + + unsigned long haveColorKey = 0, haveChromaKey = 0; + unsigned long colorKeyLow = 0, colorKeyHigh = 0; + unsigned long chromaKeyLow = 0, chromaKeyHigh = 0; + + + unsigned long scrnWidth, scrnHeight; + int dstTop, dstBottom, dstLeft, dstRight; + int panDX,panDY; /* Panning delta */ + + + panDX = pVia->swov.panning_x - pVia->swov.panning_old_x; + panDY = pVia->swov.panning_y - pVia->swov.panning_old_y; + /* Adjust to fix panning mode bug */ - lpUpdate->rDest.left = lpUpdate->rDest.left - (pVia->swov.panning_x - pVia->swov.panning_old_x); - lpUpdate->rDest.top = lpUpdate->rDest.top - (pVia->swov.panning_y - pVia->swov.panning_old_y); - lpUpdate->rDest.right = lpUpdate->rDest.right - (pVia->swov.panning_x - pVia->swov.panning_old_x); - lpUpdate->rDest.bottom = lpUpdate->rDest.bottom - (pVia->swov.panning_y - pVia->swov.panning_old_y); + + pUpdate->rDest.left -= panDX; + pUpdate->rDest.top -= panDY; + pUpdate->rDest.right -= panDX; + pUpdate->rDest.bottom -= panDY; DBG_DD(ErrorF("Raw rSrc X (%ld,%ld) Y (%ld,%ld)\n", - lpUpdate->rSrc.left, lpUpdate->rSrc.right, lpUpdate->rSrc.top, lpUpdate->rSrc.bottom)); + pUpdate->rSrc.left, pUpdate->rSrc.right, + pUpdate->rSrc.top, pUpdate->rSrc.bottom)); DBG_DD(ErrorF("Raw rDest X (%ld,%ld) Y (%ld,%ld)\n", - lpUpdate->rDest.left, lpUpdate->rDest.right, lpUpdate->rDest.top, lpUpdate->rDest.bottom)); + pUpdate->rDest.left, pUpdate->rDest.right, + pUpdate->rDest.top, pUpdate->rDest.bottom)); -/* if (pVia->swov.gdwVideoFlagTV1 && !gdwOverlaySupport) - return PI_OK; -*/ - if ( (pVia->swov.DPFsrc.dwFourCC == FOURCC_YUY2)||( pVia->swov.DPFsrc.dwFourCC == FOURCC_YV12 ) || ( pVia->swov.DPFsrc.dwFourCC == FOURCC_VIA)) - dwVideoFlag = pVia->swov.gdwVideoFlagSW; + if ((pVia->swov.DPFsrc.dwFourCC == FOURCC_YUY2) || + (pVia->swov.DPFsrc.dwFourCC == FOURCC_YV12) || + (pVia->swov.DPFsrc.dwFourCC == FOURCC_VIA)) + { + videoFlag = pVia->swov.gdwVideoFlagSW; + } - dwFlags |= DDOVER_INTERLEAVED; + flags |= DDOVER_INTERLEAVED; - /* For Alpha windows setting */ + /* Disable destination color keying if the alpha window is in use. */ if (pVia->swov.gdwAlphaEnabled) - dwFlags &= ~DDOVER_KEYDEST; + flags &= ~DDOVER_KEYDEST; - viaMacro_VidREGRec(pVia, VIDREGREC_RESET_COUNTER, 0,0); + ResetVidRegBuffer(pVia); - if ( dwFlags & DDOVER_HIDE ) + if (flags & DDOVER_HIDE) { - DBG_DD(ErrorF("// :DDOVER_HIDE \n")); - - dwVideoFlag &= ~VIDEO_SHOW; - if (Upd_Video(pScrn, dwVideoFlag,0,lpUpdate->rSrc,lpUpdate->rDest,0,0,0,&pVia->swov.DPFsrc,0, - 0,0,0,0,0,0, dwFlags)== PI_ERR) + videoFlag &= ~VIDEO_SHOW; + if (Upd_Video(pScrn, videoFlag,0,pUpdate->rSrc,pUpdate->rDest,0,0,0, + &pVia->swov.DPFsrc,0,0,0,0,0,0,0, flags)== PI_ERR) { - return PI_ERR; + return PI_ERR; } pVia->swov.SWVideo_ON = FALSE; - pVia->swov.UpdateOverlayBackup.rDest.left = 0; - pVia->swov.UpdateOverlayBackup.rDest.top = 0; - pVia->swov.UpdateOverlayBackup.rDest.right = 0; - pVia->swov.UpdateOverlayBackup.rDest.bottom = 0; if (pVia->swov.gdwUseExtendedFIFO) { /*Restore Display fifo*/ - hwp->writeSeq(hwp, 0x16, pVia->swov.Save_3C4_16); - hwp->writeSeq(hwp, 0x17, pVia->swov.Save_3C4_17); - hwp->writeSeq(hwp, 0x18, pVia->swov.Save_3C4_18); - DBG_DD(ErrorF("Restore 3c4.16 : %08x \n", hwp->readSeq(hwp, 0x16))); - DBG_DD(ErrorF(" 3c4.17 : %08x \n", hwp->readSeq(hwp, 0x17))); - DBG_DD(ErrorF(" 3c4.18 : %08x \n", hwp->readSeq(hwp, 0x18))); + hwp->writeSeq(hwp, 0x16, pVia->swov.Save_3C4_16); + hwp->writeSeq(hwp, 0x17, pVia->swov.Save_3C4_17); + hwp->writeSeq(hwp, 0x18, pVia->swov.Save_3C4_18); + DBG_DD(ErrorF("Restore 3c4.16 : %08x \n", hwp->readSeq(hwp, 0x16))); + DBG_DD(ErrorF(" 3c4.17 : %08x \n", hwp->readSeq(hwp, 0x17))); + DBG_DD(ErrorF(" 3c4.18 : %08x \n", hwp->readSeq(hwp, 0x18))); pVia->swov.gdwUseExtendedFIFO = 0; - } + } return PI_OK; } - /* - if ( (pVia->swov.UpdateOverlayBackup.rDest.left == lpUpdate->rDest.left) && - (pVia->swov.UpdateOverlayBackup.rDest.top == lpUpdate->rDest.top) && - (pVia->swov.UpdateOverlayBackup.rDest.right == lpUpdate->rDest.right) && - (pVia->swov.UpdateOverlayBackup.rDest.bottom == lpUpdate->rDest.bottom) ) - return PI_OK; */ - pVia->swov.UpdateOverlayBackup = * (LPDDUPDATEOVERLAY) lpUpdate; - - if ( dwFlags & DDOVER_KEYDEST ) - { - DBG_DD(ErrorF("// :DDOVER_KEYDEST \n")); - - dwColorKey = 1; - dwKeyLow = lpUpdate->dwColorSpaceLowValue; - } - - if (dwFlags & DDOVER_SHOW) + if (flags & DDOVER_SHOW) { - unsigned long dwStartAddr=0, dwDeinterlaceMode=0; - unsigned long dwScnWidth, dwScnHeight; - - DBG_DD(ErrorF("// :DDOVER_SHOW \n")); - /*for SW decode HW overlay use*/ - dwStartAddr = VIDInD(HQV_SRC_STARTADDR_Y); - DBG_DD(ErrorF("dwStartAddr= 0x%lx\n", dwStartAddr)); + startAddr = VIDInD(HQV_SRC_STARTADDR_Y); - if (dwFlags & DDOVER_INTERLEAVED) - { - dwDeinterlaceMode |= DDOVER_INTERLEAVED; - DBG_DD(ErrorF("DDOVER_INTERLEAVED\n")); + if (flags & DDOVER_KEYDEST) { + haveColorKey = 1; + colorKeyLow = pUpdate->dwColorSpaceLowValue; } - if (dwFlags & DDOVER_BOB) - { - dwDeinterlaceMode |= DDOVER_BOB; - DBG_DD(ErrorF("DDOVER_BOB\n")); + if (flags & DDOVER_INTERLEAVED) { + deinterlaceMode |= DDOVER_INTERLEAVED; + } + if (flags & DDOVER_BOB) { + deinterlaceMode |= DDOVER_BOB; } - if (pVia->ChipId == PCI_CHIP_CLE3122) { - if ((pScrn->currentMode->HDisplay > 1024)) - { - DBG_DD(ErrorF("UseExtendedFIFO\n")); - pVia->swov.gdwUseExtendedFIFO = 1; - } - - /* - else - { - //Set Display FIFO - ViaSeqMask(hwp, 0x16, 0x0C, 0xE0); - DBG_DD(ErrorF("set 3c4.16 : %08x \n",hwp->readSeq(hwp, 0x16))); - hwp->writeSeq(hwp, 0x18, 0x4c); - DBG_DD(ErrorF(" 3c4.18 : %08x \n",hwp->readSeq(hwp, 0x18))); - } - */ - } else { - pVia->swov.gdwUseExtendedFIFO = 0; - } - - dwVideoFlag |= VIDEO_SHOW; + if (pVia->ChipId == PCI_CHIP_CLE3122) { + if ((pScrn->currentMode->HDisplay > 1024)) + { + DBG_DD(ErrorF("UseExtendedFIFO\n")); + pVia->swov.gdwUseExtendedFIFO = 1; + } - /* - * Figure out actual rSrc rectangle - * Coz the Src rectangle AP sent is always original, ex:size(720,480) at (0,0) - * so the driver need to re-calc - * - * transfer unsigned long to signed int for calc - */ - nDstLeft = lpUpdate->rDest.left; - nDstTop = lpUpdate->rDest.top; - nDstRight= lpUpdate->rDest.right; - nDstBottom=lpUpdate->rDest.bottom; - - dwScnWidth = pScrn->currentMode->HDisplay; - dwScnHeight = pScrn->currentMode->VDisplay; - - if (nDstLeft<0) - lpUpdate->rSrc.left = (((-nDstLeft) * pVia->swov.overlayRecordV1.dwV1OriWidth) + ((nDstRight-nDstLeft)>>1)) / (nDstRight-nDstLeft); - else - lpUpdate->rSrc.left = 0; - - if (nDstRight>dwScnWidth) - lpUpdate->rSrc.right = (((dwScnWidth-nDstLeft) * pVia->swov.overlayRecordV1.dwV1OriWidth) + ((nDstRight-nDstLeft)>>1)) / (nDstRight-nDstLeft); - else - lpUpdate->rSrc.right = pVia->swov.overlayRecordV1.dwV1OriWidth; - - if (nDstTop<0) - lpUpdate->rSrc.top = (((-nDstTop) * pVia->swov.overlayRecordV1.dwV1OriHeight) + ((nDstBottom-nDstTop)>>1))/ (nDstBottom-nDstTop); - else - lpUpdate->rSrc.top = 0; + /* + else + { + //Set Display FIFO + ViaSeqMask(hwp, 0x16, 0x0C, 0xE0); + DBG_DD(ErrorF("set 3c4.16 : %08x \n",hwp->readSeq(hwp, 0x16))); + hwp->writeSeq(hwp, 0x18, 0x4c); + DBG_DD(ErrorF(" 3c4.18 : %08x \n",hwp->readSeq(hwp, 0x18))); + } + */ + } else { + pVia->swov.gdwUseExtendedFIFO = 0; + } - if (nDstBottom >dwScnHeight) - lpUpdate->rSrc.bottom = (((dwScnHeight-nDstTop) * pVia->swov.overlayRecordV1.dwV1OriHeight) + ((nDstBottom-nDstTop)>>1)) / (nDstBottom-nDstTop); - else - lpUpdate->rSrc.bottom = pVia->swov.overlayRecordV1.dwV1OriHeight; + videoFlag |= VIDEO_SHOW; - /* save modified src & original dest rectangle param.*/ + /* Figure out actual rSrc rectangle */ - if ( (pVia->swov.DPFsrc.dwFourCC == FOURCC_YUY2)||( pVia->swov.DPFsrc.dwFourCC == FOURCC_YV12 ) || ( pVia->swov.DPFsrc.dwFourCC == FOURCC_VIA)) - { - pVia->swov.SWDevice.gdwSWDstLeft = lpUpdate->rDest.left + (pVia->swov.panning_x - pVia->swov.panning_old_x); - pVia->swov.SWDevice.gdwSWDstTop = lpUpdate->rDest.top + (pVia->swov.panning_y - pVia->swov.panning_old_y); - pVia->swov.SWDevice.gdwSWDstWidth = lpUpdate->rDest.right - lpUpdate->rDest.left; - pVia->swov.SWDevice.gdwSWDstHeight = lpUpdate->rDest.bottom - lpUpdate->rDest.top; + dstLeft = pUpdate->rDest.left; + dstTop = pUpdate->rDest.top; + dstRight = pUpdate->rDest.right; + dstBottom = pUpdate->rDest.bottom; + + scrnWidth = pScrn->currentMode->HDisplay; + scrnHeight = pScrn->currentMode->VDisplay; + + if (dstLeft < 0) { + pUpdate->rSrc.left = (((-dstLeft) * ovlV1->dwV1OriWidth) + + ((dstRight - dstLeft) >> 1)) / (dstRight - dstLeft); + } + if (dstRight > scrnWidth) { + pUpdate->rSrc.right = (((scrnWidth - dstLeft) * ovlV1->dwV1OriWidth) + + ((dstRight - dstLeft) >> 1)) / (dstRight - dstLeft); + } + if (dstTop < 0) { + pUpdate->rSrc.top = (((-dstTop) * ovlV1->dwV1OriHeight) + + ((dstBottom - dstTop) >> 1)) / (dstBottom - dstTop); + } + if (dstBottom > scrnHeight) { + pUpdate->rSrc.bottom = (((scrnHeight - dstTop) * ovlV1->dwV1OriHeight) + + ((dstBottom - dstTop) >> 1)) / (dstBottom - dstTop); + } + + /* Save modified src & original dest rectangle param. */ - pVia->swov.SWDevice.gdwSWSrcWidth = pVia->swov.overlayRecordV1.dwV1SrcWidth = lpUpdate->rSrc.right - lpUpdate->rSrc.left; - pVia->swov.SWDevice.gdwSWSrcHeight = pVia->swov.overlayRecordV1.dwV1SrcHeight = lpUpdate->rSrc.bottom - lpUpdate->rSrc.top; + if ((pVia->swov.DPFsrc.dwFourCC == FOURCC_YUY2) || + (pVia->swov.DPFsrc.dwFourCC == FOURCC_YV12) || + (pVia->swov.DPFsrc.dwFourCC == FOURCC_VIA)) + { + pVia->swov.SWDevice.gdwSWDstLeft = pUpdate->rDest.left + panDX; + pVia->swov.SWDevice.gdwSWDstTop = pUpdate->rDest.top + panDY; + pVia->swov.SWDevice.gdwSWDstWidth = pUpdate->rDest.right - pUpdate->rDest.left; + pVia->swov.SWDevice.gdwSWDstHeight = pUpdate->rDest.bottom - pUpdate->rDest.top; + + pVia->swov.SWDevice.gdwSWSrcWidth = + ovlV1->dwV1SrcWidth = pUpdate->rSrc.right - pUpdate->rSrc.left; + pVia->swov.SWDevice.gdwSWSrcHeight = + ovlV1->dwV1SrcHeight = pUpdate->rSrc.bottom - pUpdate->rSrc.top; } - pVia->swov.overlayRecordV1.dwV1SrcLeft = lpUpdate->rSrc.left; - pVia->swov.overlayRecordV1.dwV1SrcRight = lpUpdate->rSrc.right; - pVia->swov.overlayRecordV1.dwV1SrcTop = lpUpdate->rSrc.top; - pVia->swov.overlayRecordV1.dwV1SrcBot = lpUpdate->rSrc.bottom; + ovlV1->dwV1SrcLeft = pUpdate->rSrc.left; + ovlV1->dwV1SrcRight = pUpdate->rSrc.right; + ovlV1->dwV1SrcTop = pUpdate->rSrc.top; + ovlV1->dwV1SrcBot = pUpdate->rSrc.bottom; - /* - // Figure out actual rDest rectangle - */ - lpUpdate->rDest.left= nDstLeft<0 ? 0 : nDstLeft; - lpUpdate->rDest.top= nDstTop<0 ? 0 : nDstTop; - if ( lpUpdate->rDest.top >= dwScnHeight) - lpUpdate->rDest.top = dwScnHeight-1; - /*lpUpdate->rDest.top= top>=dwScnHeight ? dwScnHeight-1: top;*/ - lpUpdate->rDest.right= nDstRight>dwScnWidth ? dwScnWidth: nDstRight; - lpUpdate->rDest.bottom= nDstBottom>dwScnHeight ? dwScnHeight: nDstBottom; - - /* - * Check which update func. (upd_MPEG, upd_video, - * upd_capture) to call - */ - if (Upd_Video(pScrn, dwVideoFlag,dwStartAddr,lpUpdate->rSrc,lpUpdate->rDest,pVia->swov.SWDevice.dwPitch, - pVia->swov.overlayRecordV1.dwV1OriWidth,pVia->swov.overlayRecordV1.dwV1OriHeight,&pVia->swov.DPFsrc, - dwDeinterlaceMode,dwColorKey,dwChromaKey, - dwKeyLow,dwKeyHigh,dwChromaLow,dwChromaHigh, dwFlags)== PI_ERR) - { - return PI_ERR; - } - pVia->swov.SWVideo_ON = FALSE; + /* Figure out actual rDest rectangle */ + + pUpdate->rDest.left = (dstLeft < 0) ? 0 : dstLeft; + pUpdate->rDest.top = (dstTop < 0) ? 0 : dstTop; + if (pUpdate->rDest.top >= scrnHeight) pUpdate->rDest.top = scrnHeight-1; + pUpdate->rDest.right = (dstRight > scrnWidth) ? scrnWidth : dstRight; + pUpdate->rDest.bottom = (dstBottom > scrnHeight) ? scrnHeight : dstBottom; + + /* Update the overlay */ + + if (Upd_Video(pScrn, videoFlag, startAddr, pUpdate->rSrc, pUpdate->rDest, + pVia->swov.SWDevice.dwPitch, ovlV1->dwV1OriWidth, + ovlV1->dwV1OriHeight, &pVia->swov.DPFsrc, + deinterlaceMode, haveColorKey, haveChromaKey, + colorKeyLow, colorKeyHigh, chromaKeyLow, chromaKeyHigh, flags) == PI_ERR) + { + return PI_ERR; + } + pVia->swov.SWVideo_ON = FALSE; return PI_OK; - + } /*end of DDOVER_SHOW*/ pVia->swov.panning_old_x = pVia->swov.panning_x; @@ -1760,19 +1487,12 @@ unsigned long VIAVidUpdateOverlay(ScrnInfoPtr pScrn, LPDDUPDATEOVERLAY lpUpdate) } /*VIAVidUpdateOverlay*/ - /************************************************************************* * ADJUST FRAME -*************************************************************************/ -unsigned long VIAVidAdjustFrame(ScrnInfoPtr pScrn, LPADJUSTFRAME lpAdjustFrame) + *************************************************************************/ +void VIAVidAdjustFrame(ScrnInfoPtr pScrn, int x, int y) { VIAPtr pVia = VIAPTR(pScrn); - DBG_DD(ErrorF("//VIAVidAdjustFrame\n")); - - pVia->swov.panning_x = lpAdjustFrame->x; - pVia->swov.panning_y = lpAdjustFrame->y; - - return PI_OK; + pVia->swov.panning_x = x; + pVia->swov.panning_y = y; } - - diff --git a/src/via_swov.h b/src/via_swov.h index 1b73799..b841aa9 100644 --- a/src/via_swov.h +++ b/src/via_swov.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_swov.h,v 1.4 2003/08/27 15:16:13 tsi Exp $ */ /* * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. @@ -76,7 +75,7 @@ void VIAVidHWDiffInit(ScrnInfoPtr pScrn); unsigned long VIAVidCreateSurface(ScrnInfoPtr pScrn, LPDDSURFACEDESC lpDDSurfaceDesc); unsigned long VIAVidLockSurface(ScrnInfoPtr pScrn, LPDDLOCK lpLock); unsigned long VIAVidDestroySurface(ScrnInfoPtr pScrn, LPDDSURFACEDESC lpDDSurfaceDesc); -unsigned long VIAVidUpdateOverlay(ScrnInfoPtr pScrn, LPDDUPDATEOVERLAY lpUpdate); -unsigned long VIAVidAdjustFrame(ScrnInfoPtr pScr, LPADJUSTFRAME lpAdjustFrame); +unsigned long VIAVidUpdateOverlay(ScrnInfoPtr pScrn, LPDDUPDATEOVERLAY pUpdate); +void VIAVidAdjustFrame(ScrnInfoPtr pScrn, int x, int y); #endif /* _VIA_SWOV_H_ */ diff --git a/src/via_vgahw.c b/src/via_vgahw.c index a856325..45ab601 100644 --- a/src/via_vgahw.c +++ b/src/via_vgahw.c @@ -1,5 +1,5 @@ /* - * Copyright 2004 The Unichrome Project [unichrome.sf.net] + * Copyright 2004-2005 The Unichrome Project [unichrome.sf.net] * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -143,6 +143,21 @@ ViaSeqMask(vgaHWPtr hwp, CARD8 index, CARD8 value, CARD8 mask) /* * */ +void +ViaGrMask(vgaHWPtr hwp, CARD8 index, CARD8 value, CARD8 mask) +{ + CARD8 tmp; + + tmp = hwp->readGr(hwp, index); + tmp &= ~mask; + tmp |= (value & mask); + + hwp->writeGr(hwp, index, tmp); +} + +/* + * + */ #ifdef HAVE_DEBUG void ViaVgahwPrint(vgaHWPtr hwp) diff --git a/src/via_vgahw.h b/src/via_vgahw.h index 4198987..41d2a1c 100644 --- a/src/via_vgahw.h +++ b/src/via_vgahw.h @@ -1,5 +1,5 @@ /* - * Copyright 2004 The Unichrome Project [unichrome.sf.net] + * Copyright 2004-2005 The Unichrome Project [unichrome.sf.net] * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -42,6 +42,7 @@ void ViaVgahwMask(vgaHWPtr hwp, int indexaddress, CARD8 index, void ViaCrtcMask(vgaHWPtr hwp, CARD8 index, CARD8 value, CARD8 mask); void ViaSeqMask(vgaHWPtr hwp, CARD8 index, CARD8 value, CARD8 mask); +void ViaGrMask(vgaHWPtr hwp, CARD8 index, CARD8 value, CARD8 mask); #ifdef HAVE_DEBUG void ViaVgahwPrint(vgaHWPtr hwp); diff --git a/src/via_video.c b/src/via_video.c index 0e41d34..289b2e9 100644 --- a/src/via_video.c +++ b/src/via_video.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_video.c,v 1.17 2004/02/04 04:15:09 dawes Exp $ */ /* * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. @@ -38,7 +37,6 @@ #include "via_driver.h" #include "via_video.h" -#include "via_capture.h" #include "via.h" #include "xf86xv.h" @@ -63,25 +61,14 @@ #define FREE_TIMER 0x02 #define TIMER_MASK (OFF_TIMER | FREE_TIMER) #define VIA_MAX_XVIMAGE_X 1920 -#define VIA_MAX_XVIMAGE_Y 1080 +#define VIA_MAX_XVIMAGE_Y 1200 #define LOW_BAND 0x0CB0 #define MID_BAND 0x1f10 #define XV_IMAGE 0 -#define NTSC_COMPOSITE 1 -#define NTSC_TUNER 2 -#define NTSC_SVIDEO 3 -#define PAL_SVIDEO 4 -#define PAL_60_COMPOSITE 5 -#define PAL_60_TUNER 6 -#define PAL_60_SVIDEO 7 #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) -#define IN_FLIP ( viaVidEng->ramtab & 0x00000003) -#define IN_DISPLAY ( viaVidEng->interruptflag & 0x00000200) -#define IN_VBLANK ( !IN_DISPLAY ) - #ifndef XvExtension void viaInitVideo(ScreenPtr pScreen) {} #else @@ -103,24 +90,15 @@ static int viaPutVideo(ScrnInfoPtr , static int viaQueryImageAttributesG(ScrnInfoPtr, int, unsigned short *, unsigned short *, int *, int *); -static Atom xvBrightness, xvContrast, xvColorKey, xvHue, xvSaturation, xvPort, - xvCompose, xvEncoding, xvMute, xvVolume, xvFreq, xvAudioCtrl, - xvHQV, xvBOB, xvExitTV, xvAutoPaint; +static Atom xvBrightness, xvContrast, xvColorKey, xvHue, xvSaturation, xvAutoPaint; /* * S T R U C T S */ /* client libraries expect an encoding */ -static XF86VideoEncodingRec DummyEncoding[8] = +static XF86VideoEncodingRec DummyEncoding[1] = { { XV_IMAGE , "XV_IMAGE",VIA_MAX_XVIMAGE_X,VIA_MAX_XVIMAGE_Y,{1, 1}}, - { NTSC_COMPOSITE , "ntsc-composite",720, 480, { 1001, 60000 }}, - { NTSC_TUNER , "ntsc-tuner",720, 480, { 1001, 60000 }}, - { NTSC_SVIDEO , "ntsc-svideo",720, 480, { 1001, 60000 }}, - { PAL_SVIDEO , "pal-svideo",720, 576, { 1, 50 }}, - { PAL_60_COMPOSITE, "pal_60-composite", 704, 576, { 1, 50 }}, - { PAL_60_TUNER , "pal_60-tuner", 720, 576, { 1, 50 }}, - { PAL_60_SVIDEO , "pal_60-svideo",720, 576, { 1, 50 }} }; #define NUM_FORMATS_G 9 @@ -138,7 +116,7 @@ static XF86VideoFormatRec FormatsG[NUM_FORMATS_G] = {24, DirectColor} }; -#define NUM_ATTRIBUTES_G 18 +#define NUM_ATTRIBUTES_G 6 static XF86AttributeRec AttributesG[NUM_ATTRIBUTES_G] = { @@ -147,18 +125,6 @@ static XF86AttributeRec AttributesG[NUM_ATTRIBUTES_G] = {XvSettable | XvGettable, 0, 20000, "XV_CONTRAST"}, {XvSettable | XvGettable, 0, 20000,"XV_SATURATION"}, {XvSettable | XvGettable,-180,180,"XV_HUE"}, - {XvSettable | XvGettable,0,255,"XV_MUTE"}, - {XvSettable | XvGettable,0,255,"XV_VOLUME"}, - {XvSettable,0,2,"XV_PORT"}, - {XvSettable,0,2,"XV_COMPOSE"}, - {XvSettable,0,2,"XV_SVIDEO"}, - {XvSettable | XvGettable,0, 255,"XV_ENCODING"}, - {XvSettable | XvGettable,0, 255, "XV_CHANNEL"}, - {XvSettable,0,-1,"XV_FREQ"}, - {XvSettable,0,2,"XV_AUDIOCTRL"}, - {XvSettable,0,2,"XV_HIGHQVDO"}, - {XvSettable,0,2,"XV_BOB"}, - {XvSettable,0,2,"XV_EXITTV"}, {XvSettable | XvGettable,0,1,"XV_AUTOPAINT_COLORKEY"} }; @@ -196,29 +162,12 @@ static XF86ImageRec ImagesG[NUM_IMAGES_G] = static char * XVPORTNAME[XV_PORT_NUM] = { "XV_SWOV", - "XV_TV0" , - "XV_TV1" , "XV_DUMMY" }; /* * F U N C T I O N */ -static __inline void waitVBLANK(vmmtr viaVidEng) -{ - while (IN_DISPLAY); -} - -static __inline void waitIfFlip(vmmtr viaVidEng) -{ - while( IN_FLIP ); -} - - -static __inline void waitDISPLAYBEGIN(vmmtr viaVidEng) -{ - while (IN_VBLANK); -} /* * Decide if the mode support video overlay. This depends on the bandwidth @@ -316,8 +265,7 @@ static Bool DecideOverlaySupport(ScrnInfoPtr pScrn) height = mode->VDisplay; refresh = mode->VRefresh; - if ((pBIOSInfo->ActiveDevice == VIA_DEVICE_LCD) || - (pBIOSInfo->ActiveDevice == VIA_DEVICE_DFP) ) { + if (pBIOSInfo->PanelActive) { width = pBIOSInfo->panelX; height = pBIOSInfo->panelY; if ((width == 1400) && (height == 1050)) { @@ -325,7 +273,7 @@ static Bool DecideOverlaySupport(ScrnInfoPtr pScrn) height = 1024; refresh = 60; } - } else if (pBIOSInfo->ActiveDevice == VIA_DEVICE_TV ) { + } else if (pBIOSInfo->TVActive) { bTV = 1; } @@ -380,7 +328,8 @@ void viaResetVideo(ScrnInfoPtr pScrn) viaVidEng->video3_ctl = 0; viaVidEng->compose = 0x80000000; viaVidEng->compose = 0x40000000; - + viaVidEng->color_key = 0x821; + viaVidEng->snd_color_key = 0x821; } @@ -443,17 +392,15 @@ void viaInitVideo(ScreenPtr pScreen) viaFastVidCpy = viaVidCopyInit("video", pScreen); - if ( (pVia->Chipset == VIA_CLE266) || - (pVia->Chipset == VIA_KM400) ) { - newAdaptor = viaSetupImageVideoG(pScreen); - num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); + if ( (pVia->Chipset == VIA_CLE266) || (pVia->Chipset == VIA_KM400) ) { + newAdaptor = viaSetupImageVideoG(pScreen); + num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); } else { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "[Xv] Unsupported Chipset. X video functionality disabled.\n"); - num_adaptors=0; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "[Xv] Unsupported Chipset. X video functionality disabled.\n"); + num_adaptors=0; } - DBG_DD(ErrorF(" via_video.c : num_adaptors : %d\n",num_adaptors)); if(newAdaptor) { if(!num_adaptors) { @@ -464,8 +411,7 @@ void viaInitVideo(ScreenPtr pScreen) newAdaptors = /* need to free this someplace */ xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); if(newAdaptors) { - memcpy(newAdaptors, adaptors, num_adaptors * - sizeof(XF86VideoAdaptorPtr)); + memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr)); newAdaptors[num_adaptors] = newAdaptor; adaptors = newAdaptors; num_adaptors++; @@ -480,8 +426,6 @@ void viaInitVideo(ScreenPtr pScreen) if(newAdaptors) xfree(newAdaptors); - - } @@ -489,34 +433,19 @@ XF86VideoAdaptorPtr viaSetupImageVideoG(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - /* XF86VideoAdaptorPtr viaAdaptPtr[XV_PORT_NUM]; */ viaPortPrivRec *gviaPortPriv[XV_PORT_NUM]; DevUnion * pdevUnion[XV_PORT_NUM]; int i; DBG_DD(ErrorF(" via_video.c : viaSetupImageVideoG: \n")); - /* Look for available devices */ - ViaTunerProbe(pScrn); - xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); xvContrast = MAKE_ATOM("XV_CONTRAST"); xvColorKey = MAKE_ATOM("XV_COLORKEY"); xvHue = MAKE_ATOM("XV_HUE"); xvSaturation = MAKE_ATOM("XV_SATURATION"); - xvMute = MAKE_ATOM("XV_MUTE"); - xvVolume = MAKE_ATOM("XV_VOLUME"); - xvPort = MAKE_ATOM("XV_PORT"); - xvCompose = MAKE_ATOM("XV_COMPOSE"); - xvEncoding = MAKE_ATOM("XV_ENCODING"); - xvFreq = MAKE_ATOM("XV_FREQ"); - xvAudioCtrl = MAKE_ATOM("XV_AUDIOCTRL"); - xvHQV = MAKE_ATOM("XV_HIGHQVDO"); - xvBOB = MAKE_ATOM("XV_BOB"); - xvExitTV = MAKE_ATOM("XV_EXITTV"); xvAutoPaint = MAKE_ATOM("XV_AUTOPAINT_COLORKEY"); - /* AllocatePortPriv();*/ for ( i = 0; i < XV_PORT_NUM; i ++ ) { if(!(viaAdaptPtr[i] = xf86XVAllocateVideoAdaptorRec(pScrn))) return NULL; @@ -526,7 +455,8 @@ viaSetupImageVideoG(ScreenPtr pScreen) if(i == XV_PORT_SWOV) /* Overlay engine */ { - viaAdaptPtr[i]->type = XvInputMask | XvWindowMask | XvImageMask | XvVideoMask | XvStillMask; + viaAdaptPtr[i]->type = XvInputMask | XvWindowMask | XvImageMask | + XvVideoMask | XvStillMask; viaAdaptPtr[i]->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; } else @@ -535,7 +465,7 @@ viaSetupImageVideoG(ScreenPtr pScreen) viaAdaptPtr[i]->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; } viaAdaptPtr[i]->name = XVPORTNAME[i]; - viaAdaptPtr[i]->nEncodings = 8; + viaAdaptPtr[i]->nEncodings = 1; viaAdaptPtr[i]->pEncodings = DummyEncoding; viaAdaptPtr[i]->nFormats = sizeof(FormatsG) / sizeof(FormatsG[0]); viaAdaptPtr[i]->pFormats = FormatsG; @@ -618,7 +548,7 @@ static int CreateSWOVSurface(ScrnInfoPtr pScrn, viaPortPrivPtr pPriv, int fourcc LPDDSURFACEDESC lpSurfaceDesc = &pPriv->SurfaceDesc; unsigned long retCode; - if (pVia->Video.VideoStatus & SWOV_SURFACE_CREATED) + if (pVia->VideoStatus & VIDEO_SWOV_SURFACE_CREATED) return Success; lpSurfaceDesc->dwWidth = (unsigned long)width; @@ -640,8 +570,7 @@ static int CreateSWOVSurface(ScrnInfoPtr pScrn, viaPortPrivPtr pPriv, int fourcc DBG_DD(ErrorF(" lpSWOverlaySurface[0]: %p\n", pPriv->ddLock.SWDevice.lpSWOverlaySurface[0])); DBG_DD(ErrorF(" lpSWOverlaySurface[1]: %p\n", pPriv->ddLock.SWDevice.lpSWOverlaySurface[1])); - pVia->Video.VideoStatus |= SWOV_SURFACE_CREATED|SW_VIDEO_ON; - pVia->Video.dwAction = ACTION_SET_VIDEOSTATUS; + pVia->VideoStatus |= VIDEO_SWOV_SURFACE_CREATED | VIDEO_SWOV_ON; return Success; } @@ -653,22 +582,21 @@ static void DestroySWOVSurface(ScrnInfoPtr pScrn, viaPortPrivPtr pPriv) DBG_DD(ErrorF(" via_video.c : Destroy SW Overlay Surface, fourcc =0x%08x : \n", lpSurfaceDesc->dwFourCC)); - if (pVia->Video.VideoStatus & SWOV_SURFACE_CREATED) + if (pVia->VideoStatus & VIDEO_SWOV_SURFACE_CREATED) { DBG_DD(ErrorF(" via_video.c : Destroy SW Overlay Surface, VideoStatus =0x%08x : \n", - pVia->Video.VideoStatus)); + pVia->VideoStatus)); } else { DBG_DD(ErrorF(" via_video.c : No SW Overlay Surface Destroyed, VideoStatus =0x%08x : \n", - pVia->Video.VideoStatus)); + pVia->VideoStatus)); return; } VIAVidDestroySurface(pScrn, lpSurfaceDesc); - pVia->Video.VideoStatus &= ~SWOV_SURFACE_CREATED; - pVia->Video.dwAction = ACTION_SET_VIDEOSTATUS; + pVia->VideoStatus &= ~VIDEO_SWOV_SURFACE_CREATED; } @@ -678,8 +606,7 @@ void viaStopSWOVerlay(ScrnInfoPtr pScrn) LPDDUPDATEOVERLAY lpUpdateOverlay = &UpdateOverlay_Video; VIAPtr pVia = VIAPTR(pScrn); - pVia->Video.VideoStatus &= ~SW_VIDEO_ON; - pVia->Video.dwAction = ACTION_SET_VIDEOSTATUS; + pVia->VideoStatus &= ~VIDEO_SWOV_ON; lpUpdateOverlay->dwFlags = DDOVER_HIDE; VIAVidUpdateOverlay(pScrn, lpUpdateOverlay); @@ -706,65 +633,6 @@ viaStopVideoG(ScrnInfoPtr pScrn, pointer data, Bool exit) } } -/* App "xawtv" attribute from -1000 to 1000 */ -/* But SAA7113H needs 0 to 255 */ -#define Attr_Mapping(x) x = ( (x + 1000) >> 3 ) - - -/**************************************************************************** - * SetTunerChannel * - * Function: Sets the tuner to a requested channel * - * Inputs: CARD16 channel - the tuner channel to be set. * - * Outputs: NONE * - ****************************************************************************/ -static void SetTunerChannel (ViaTunerPtr pTuner, viaPortPrivPtr pChanPriv, INT32 frequency) -{ - int control; - short divider = 0; - - switch(pChanPriv->dwEncoding) - { - case PAL_60_COMPOSITE : - case PAL_60_TUNER : - case PAL_60_SVIDEO : - divider = 633 + (short)frequency; - break; - case NTSC_COMPOSITE : - case NTSC_TUNER : - case NTSC_SVIDEO : - divider = 733 + (short)frequency; - break; - default: - divider = frequency; - } - - control = 0x8E00; - - if ( divider <= LOW_BAND ) - control |= 0xA0; - else if ( divider <= MID_BAND ) - control |= 0x90; - else - control |= 0x30; - - DBG_DD(ErrorF(" via_video.c : SetTunerChannel : Divider = 0x%08x, Control= 0x%08x, \n", divider,control)); - - if(pTuner) - ViaTunerChannel(pTuner, divider, control); - -} /* SetTunerChannel ()... */ - -/* Tuner uses range 0 - 256 (?); Xv uses low - high */ - -static int -xv_to_tuner(int val,int low, int high) { - val = val * 256 / (high - low); - if (val < -0) val = 0; - if (val > 256) val = 256; - return val; -} - - int viaSetPortAttributeG( ScrnInfoPtr pScrn, @@ -776,16 +644,9 @@ viaSetPortAttributeG( vmmtr viaVidEng = (vmmtr) pVia->VidMapBase; viaPortPrivPtr pPriv = (viaPortPrivPtr)data; int attr, avalue; - ViaTunerPtr pTuner = NULL; - - if(pPriv->xv_portnum == XV_PORT_TV0) - pTuner = pVia->Tuner[0]; - else if(pPriv->xv_portnum == XV_PORT_TV1) - pTuner = pVia->Tuner[1]; - ; + DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : \n")); - pVia->OverlaySupported = DecideOverlaySupport(pScrn); /* Color Key */ if(attribute == xvColorKey) { @@ -801,7 +662,7 @@ viaSetPortAttributeG( } else if (attribute == xvAutoPaint) { pPriv->autoPaint = value; - DBG_DD(ErrorF(" xvColorKey = %08x\n",value)); + DBG_DD(ErrorF(" xvAutoPaint = %08x\n",value)); /* Color Control */ } else if (attribute == xvBrightness || attribute == xvContrast || @@ -811,83 +672,24 @@ viaSetPortAttributeG( { DBG_DD(ErrorF(" xvBrightness = %08d\n",value)); pPriv->brightness = value; - if(pTuner) - ViaTunerBrightness(pTuner, xv_to_tuner(value,0,5000)); } if (attribute == xvContrast) { DBG_DD(ErrorF(" xvContrast = %08d\n",value)); pPriv->contrast = value; - if(pTuner) - ViaTunerContrast(pTuner, xv_to_tuner(value,0,20000)); } if (attribute == xvSaturation) { DBG_DD(ErrorF(" xvSaturation = %08d\n",value)); pPriv->saturation = value; - if(pTuner) - ViaTunerSaturation(pTuner, xv_to_tuner(value,0,20000)); } if (attribute == xvHue) { DBG_DD(ErrorF(" xvHue = %08d\n",value)); pPriv->hue = value; - if(pTuner) - ViaTunerHue(pTuner, xv_to_tuner(value,-180,180)); - } - if (!pTuner); - viaSetColorSpace(pVia, pPriv->hue, pPriv->saturation, pPriv->brightness, - pPriv->contrast,FALSE); - - /* Audio control */ - } else if (attribute == xvMute){ - DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvMute = %08d\n",value)); - if(value) - value = 1; - ViaAudioMute(pVia, value); - } else if (attribute == xvVolume){ - DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvVolume = %08d\n",value)); - pPriv->Volume = value; - attr = ATTR_VOLUME; - avalue = value; - /* FIXME */ - /* Tuner control. Channel switch */ - } else if (attribute == xvFreq){ - DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvFreq = %08x\n",value)); - SetTunerChannel(pTuner, pPriv, value ); - /* Video decoder control. NTSC/PAL, SVIDEO/COMPOSITIVE/TV */ - } else if (attribute == xvEncoding){ - DBG_DD(ErrorF(" xvEncoding = %d. \n",value)); - pPriv->dwEncoding = value; - if(pTuner) - ViaTunerStandard(pTuner, value); - /* VIA Proprietary Attribute for Video control */ - } else if (attribute == xvPort ){ - DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvPort=%d\n", value)); - - } else if (attribute == xvCompose){ - DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvCompose=%08x\n",value)); - - } else if (attribute == xvHQV){ - DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvHQV=%08x\n",value)); - - } else if (attribute == xvBOB){ - DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvBOB=%08x\n",value)); - - } else if (attribute == xvExitTV){ - DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvExitTV=%08x\n",value)); - - /* VIA Proprietary Attribute for AUDIO control */ - } else if (attribute == xvAudioCtrl ){ - DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : xvAudioSwitch=%d\n", value)); - if(pTuner) - { - ViaAudioMode(pVia, value); - if(pPriv->xv_portnum == XV_PORT_TV0) - ViaAudioSelect(pScrn,0); - else - ViaAudioSelect(pScrn, 1); } + viaSetColorSpace(pVia, pPriv->hue, pPriv->saturation, + pPriv->brightness, pPriv->contrast, FALSE); }else{ DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : is not supported the attribute")); return BadMatch; @@ -993,85 +795,6 @@ static void Flip(VIAPtr pVia, viaPortPrivPtr pPriv, int fourcc, unsigned long Di } } -#ifdef UNUSED -static void CopyDataYUV422( - ScrnInfoPtr pScrn, - VIAPtr pVia, - unsigned char * src, - unsigned char * dst, - int srcPitch, - int dstPitch, - int h, - int w ) -{ - int count; - - /* copy YUY2 data to video memory, - * do 32 bits alignment. - */ - - w <<= 1; /* Each pixel is YU or YV - 16 bits */ - srcPitch <<= 1; - - count = h; - while(count--) { - memcpy(dst, src, w); - src += srcPitch; - dst += dstPitch; - } -} -#endif /* UNUSED */ - -#ifdef UNUSED -static void -CopyDataYUV420( - ScrnInfoPtr pScrn, - VIAPtr pVia, - unsigned char *src1, - unsigned char *src2, - unsigned char *src3, - unsigned char *dst1, - unsigned char *dst2, - unsigned char *dst3, - int srcPitch, - int dstPitch, - int h, - int w -){ - int count; - - /* copy Y component to video memory */ - count = h; - while(count--) { - memcpy(dst1, src1, w); - src1 += srcPitch; - dst1 += dstPitch; - } - - /* UV component is 1/4 of Y */ - w >>= 1; - h >>= 1; - srcPitch >>= 1; - dstPitch >>= 1; - - /* copy V(Cr) component to video memory */ - count = h; - while(count--) { - memcpy(dst2, src2, w); - src2 += srcPitch; - dst2 += dstPitch; - } - - /* copy U(Cb) component to video memory */ - count = h; - while(count--) { - memcpy(dst3, src3, w); - src3 += srcPitch; - dst3 += dstPitch; - } -} -#endif /* UNUSED */ - int viaPutImageG( ScrnInfoPtr pScrn, @@ -1099,11 +822,6 @@ viaPutImageG( switch ( pPriv->xv_portnum ) { - case XV_PORT_TV0: - case XV_PORT_TV1: - DBG_DD(ErrorF(" via_video.c : : Shall not happen! \n")); - break; - case XV_PORT_SWOV: case XV_PORT_DUMMY: { @@ -1145,20 +863,25 @@ viaPutImageG( } /* If there is bandwidth issue, block the H/W overlay */ - if (!pVia->OverlaySupported) + + if (!pVia->OverlaySupported && + !(pVia->OverlaySupported = DecideOverlaySupport(pScrn))) { + DBG_DD(ErrorF(" via_video.c : Xv Overlay rejected due to insufficient " + "memory bandwidth.\n")); return BadAlloc; + } /* * fill video overlay parameter */ lpUpdateOverlay->rSrc.left = src_x; lpUpdateOverlay->rSrc.top = src_y; - lpUpdateOverlay->rSrc.right = src_x + width; - lpUpdateOverlay->rSrc.bottom = src_y + height; + lpUpdateOverlay->rSrc.right = src_x + src_w; + lpUpdateOverlay->rSrc.bottom = src_y + src_h; lpUpdateOverlay->rDest.left = drw_x; lpUpdateOverlay->rDest.top = drw_y; - lpUpdateOverlay->rDest.right = lpUpdateOverlay->rDest.left + drw_w; + lpUpdateOverlay->rDest.right = drw_x + drw_w; lpUpdateOverlay->rDest.bottom = drw_y + drw_h; lpUpdateOverlay->dwFlags = DDOVER_SHOW | DDOVER_KEYDEST; @@ -1194,24 +917,26 @@ viaPutImageG( unless the surface clipping has changed */ if ( (pPriv->old_drw_x == drw_x) && (pPriv->old_drw_y == drw_y) && (pPriv->old_drw_w == drw_w) && (pPriv->old_drw_h == drw_h) + && (pPriv->old_src_x == src_x) && (pPriv->old_src_y == src_y) && (pPriv->old_src_w == src_w) && (pPriv->old_src_h == src_h) && (pVia->old_dwUseExtendedFIFO == dwUseExtendedFIFO) - && (pVia->Video.VideoStatus & SW_VIDEO_ON) && + && (pVia->VideoStatus & VIDEO_SWOV_ON) && RegionsEqual(&pPriv->clip, clipBoxes)) { return Success; } + pPriv->old_src_x = src_x; + pPriv->old_src_y = src_y; + pPriv->old_src_w = src_w; + pPriv->old_src_h = src_h; + pPriv->old_drw_x = drw_x; pPriv->old_drw_y = drw_y; pPriv->old_drw_w = drw_w; pPriv->old_drw_h = drw_h; pVia->old_dwUseExtendedFIFO = dwUseExtendedFIFO; - pVia->Video.VideoStatus |= SW_VIDEO_ON; - - /* add to judge if need to re-create surface */ - pPriv->old_src_w = src_w; - pPriv->old_src_h = src_h; + pVia->VideoStatus |= VIDEO_SWOV_ON; /* BitBlt: Draw the colorkey rectangle */ if(!RegionsEqual(&pPriv->clip, clipBoxes)) { @@ -1261,7 +986,7 @@ viaQueryImageAttributesG( if(*w > VIA_MAX_XVIMAGE_X) *w = VIA_MAX_XVIMAGE_X; if(*h > VIA_MAX_XVIMAGE_Y) *h = VIA_MAX_XVIMAGE_Y; - *w = (*w + 7) & ~7; + *w = (*w + 1) & ~1; if(offsets) offsets[0] = 0; @@ -1322,6 +1047,8 @@ viaPutVideo(ScrnInfoPtr pScrn, { viaPortPrivPtr pPriv=(viaPortPrivPtr)data; + VIAPtr pVia = VIAPTR(pScrn); + #ifdef XV_DEBUG ErrorF(" via_video.c : viaPutVideo : Src %dx%d, %d, %d, %p\n",src_w,src_h,src_x,src_y,clipBoxes); @@ -1338,16 +1065,17 @@ viaPutVideo(ScrnInfoPtr pScrn, REGION_RECTS(clipBoxes)); } + /* If there is bandwidth issue, block the H/W overlay */ + + if (!pVia->OverlaySupported && + !(pVia->OverlaySupported = DecideOverlaySupport(pScrn))) { + DBG_DD(ErrorF(" via_video.c : Xv Overlay rejected due to insufficient " + "memory bandwidth.\n")); + return BadAlloc; + } + switch ( pPriv->xv_portnum ) { - case XV_PORT_TV0: - case XV_PORT_TV1: - pPriv->yuv_win.x = drw_x; - pPriv->yuv_win.y = drw_y; - pPriv->yuv_win.width = drw_w; - pPriv->yuv_win.height = drw_h; - pPriv->yuv_win.chromakey = pPriv->colorKey; - break; case XV_PORT_SWOV: case XV_PORT_DUMMY: DBG_DD(ErrorF(" via_video.c : This port doesn't support PutVideo.\n")); diff --git a/src/via_video.h b/src/via_video.h index f8f4c0d..ebbad5a 100644 --- a/src/via_video.h +++ b/src/via_video.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_video.h,v 1.3 2003/08/27 15:16:14 tsi Exp $ */ /* * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. @@ -30,7 +29,7 @@ * I N C L U D E S */ -/* #define XV_DEBUG 1 */ /* write log msg to /var/log/XFree86.0.log */ +/* #define XV_DEBUG 1 */ /* write log msg to /var/log/XFree86.0.log */ #define COLOR_KEY 1 /* set color key value from driver layer*/ #ifdef XV_DEBUG @@ -41,25 +40,10 @@ #define HW_3123 -#define TRUE 1 -#define FALSE 0 - /* Definition for VideoStatus */ -#define VIDEO_NULL 0x00000000 -#define TV0SURFACE_CREATED 0x00000001 -#define TV1SURFACE_CREATED 0x00000002 -#define SWOV_SURFACE_CREATED 0x00000004 -#define HW_MPEG_ON 0x00000010 -#define TV0_VIDEO_ON 0x00000020 -#define TV1_VIDEO_ON 0x00000040 -#define SW_VIDEO_ON 0x00000080 - -typedef struct { - unsigned long dwWidth; /* On screen Width */ - unsigned long dwHeight; /* On screen Height */ - unsigned long dwBPP; /* Bits Per Pixel */ - unsigned long dwRefreshRate; /* Refresh rate of the mode */ -}MODEINFO, * LPMODEINFO; +#define VIDEO_NULL 0x00000000 +#define VIDEO_SWOV_SURFACE_CREATED 0x00000001 +#define VIDEO_SWOV_ON 0x00000002 #define SDR100 1 #define SDR133 2 diff --git a/src/via_vt162x.c b/src/via_vt162x.c new file mode 100644 index 0000000..1c6ef4f --- /dev/null +++ b/src/via_vt162x.c @@ -0,0 +1,795 @@ +/* + * Copyright 2004-2005 The Unichrome Project [unichrome.sf.net] + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "via_driver.h" +#include "via_vgahw.h" +#include "via_vt162x.h" +#include "via_id.h" + +#ifdef HAVE_DEBUG +/* + * + */ +static void +VT162xPrintRegs(ScrnInfoPtr pScrn) +{ + VIAPtr pVia = VIAPTR(pScrn); + VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; + CARD8 i, buf; + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Printing registers for %s\n", + pBIOSInfo->TVI2CDev->DevName); + + for (i = 0; i < VIA_BIOS_MAX_NUM_TV_REG; i++) { + xf86I2CReadByte(pBIOSInfo->TVI2CDev, i, &buf); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "TV%02X: 0x%02X\n", i, buf); + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "End of TV registers.\n"); +} +#endif /* HAVE_DEBUG */ + +/* + * + */ +I2CDevPtr +ViaVT162xDetect(ScrnInfoPtr pScrn, I2CBusPtr pBus, CARD8 Address) +{ + CARD8 buf; + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; + I2CDevPtr pDev = xf86CreateI2CDevRec(); + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT162xDetect\n")); + + pDev->DevName = "VT162x"; + pDev->SlaveAddr = Address; + pDev->pI2CBus = pBus; + + if (!xf86I2CDevInit(pDev)) { + xf86DestroyI2CDevRec(pDev, TRUE); + return NULL; + } + + if (!xf86I2CReadByte(pDev, 0x1B, &buf)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unable to read from %s Slave %d.\n", + pBus->BusName, Address); + xf86DestroyI2CDevRec(pDev, TRUE); + return NULL; + } + + switch (buf) { + case 2: + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected VIA Technologies VT1621 TV Encoder\n"); + pBIOSInfo->TVEncoder = VIA_VT1621; + pDev->DevName = "VT1621"; + break; + case 3: + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected VIA Technologies VT1622 TV Encoder\n"); + pBIOSInfo->TVEncoder = VIA_VT1622; + pDev->DevName = "VT1622"; + break; + case 16: + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected VIA Technologies VT1622A/VT1623 TV Encoder\n"); + pBIOSInfo->TVEncoder = VIA_VT1623; + pDev->DevName = "VT1623"; + break; + default: + pBIOSInfo->TVEncoder = VIA_NONETV; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Unknown TV Encoder found at %s %X.\n", pBus->BusName, Address); + xf86DestroyI2CDevRec(pDev,TRUE); + pDev = NULL; + } + +#ifdef HAVE_DEBUG + if (VIAPTR(pScrn)->PrintTVRegs && pDev) + VT162xPrintRegs(pScrn); +#endif + + return pDev; +} + +/* + * + */ +static void +ViaVT162xSave(ScrnInfoPtr pScrn) +{ + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; + CARD8 buf = 0x00; + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT162xSave\n")); + + xf86I2CWriteRead(pBIOSInfo->TVI2CDev, &buf,1, pBIOSInfo->TVRegs, + VIA_BIOS_MAX_NUM_TV_REG); +} + +/* + * + */ +static void +ViaVT162xRestore(ScrnInfoPtr pScrn) +{ + int i; + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT162xRestore\n")); + + for (i = 0; i < VIA_BIOS_MAX_NUM_TV_REG; i++) + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, i, pBIOSInfo->TVRegs[i]); +} + +/* + * the same for VT1621 as for VT1622/VT1622A/VT1623, result is different though + */ +static CARD8 +ViaVT162xDACSenseI2C(I2CDevPtr pDev) +{ + CARD8 save, sense; + + xf86I2CReadByte(pDev, 0x0E, &save); + xf86I2CWriteByte(pDev, 0x0E, 0x00); + xf86I2CWriteByte(pDev, 0x0E, 0x80); + xf86I2CWriteByte(pDev, 0x0E, 0x00); + xf86I2CReadByte(pDev, 0x0F, &sense); + xf86I2CWriteByte(pDev, 0x0E, save); + + return (sense & 0x0F); +} + +/* + * VT1621 only knows composite and s-video + */ +static Bool +ViaVT1621DACSense(ScrnInfoPtr pScrn) +{ + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; + CARD8 sense; + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT1621DACDetect\n")); + + if (!pBIOSInfo->TVI2CDev) + return FALSE; + + sense = ViaVT162xDACSenseI2C(pBIOSInfo->TVI2CDev); + switch (sense) { + case 0x00: + pBIOSInfo->TVOutput = TVOUTPUT_SC; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT1621: S-Video & Composite connected.\n"); + return TRUE; + case 0x01: + pBIOSInfo->TVOutput = TVOUTPUT_COMPOSITE; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT1621: Composite connected.\n"); + return TRUE; + case 0x02: + pBIOSInfo->TVOutput = TVOUTPUT_SVIDEO; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT1621: S-Video connected.\n"); + return TRUE; + case 0x03: + pBIOSInfo->TVOutput = TVOUTPUT_NONE; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT1621: Nothing connected.\n"); + return FALSE; + default: + pBIOSInfo->TVOutput = TVOUTPUT_NONE; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "VT1621: Unknown cable combination: 0x0%2X.\n", + sense); + return FALSE; + } +} + + +/* + * VT1622, VT1622A and VT1623 know composite, s-video, RGB and YCBCR + */ +static Bool +ViaVT1622DACSense(ScrnInfoPtr pScrn) +{ + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; + CARD8 sense; + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT1622DACDetect\n")); + + if (!pBIOSInfo->TVI2CDev) + return FALSE; + + sense = ViaVT162xDACSenseI2C(pBIOSInfo->TVI2CDev); + switch (sense) { + case 0x00: /* DAC A,B,C,D */ + pBIOSInfo->TVOutput = TVOUTPUT_RGB; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT162x: RGB connected.\n"); + return TRUE; + case 0x01: /* DAC A,B,C */ + pBIOSInfo->TVOutput = TVOUTPUT_SC; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT162x: S-Video & Composite connected.\n"); + return TRUE; + case 0x07: /* DAC A */ + pBIOSInfo->TVOutput = TVOUTPUT_COMPOSITE; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT162x: Composite connected.\n"); + return TRUE; + case 0x08: /* DAC B,C,D */ + pBIOSInfo->TVOutput = TVOUTPUT_YCBCR; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT162x: YcBcR connected.\n"); + return TRUE; + case 0x09: /* DAC B,C */ + pBIOSInfo->TVOutput = TVOUTPUT_SVIDEO; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT162x: S-Video connected.\n"); + return TRUE; + case 0x0F: + pBIOSInfo->TVOutput = TVOUTPUT_NONE; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT162x: Nothing connected.\n"); + return FALSE; + default: + pBIOSInfo->TVOutput = TVOUTPUT_NONE; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "VT162x: Unknown cable combination: 0x0%2X.\n", + sense); + return FALSE; + } +} + + +/* + * + */ +static Bool +ViaVT1621ModeValid(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT1621ModeValid\n")); + + switch (mode->CrtcHDisplay) { + case 640: + if (mode->CrtcVDisplay == 480) + return TRUE; + return FALSE; + case 800: + if (mode->CrtcVDisplay == 600) + return TRUE; + return FALSE; + default: + return FALSE; + } +} + +/* + * + */ +static Bool +ViaVT1622ModeValid(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT1622ModeValid\n")); + + switch (mode->CrtcHDisplay) { + case 640: + if (mode->CrtcVDisplay == 480) + return TRUE; + return FALSE; + case 720: + if (mode->CrtcVDisplay == 480) + return TRUE; + if (mode->CrtcVDisplay == 576) + return TRUE; + return FALSE; + case 800: + if (mode->CrtcVDisplay == 600) + return TRUE; + return FALSE; + case 848: + if (mode->CrtcVDisplay == 480) + return TRUE; + return FALSE; + case 1024: + if (mode->CrtcVDisplay == 768) + return TRUE; + return FALSE; + default: + return FALSE; + } +} + +/* + * + */ +static void +ViaVT1621ModeI2C(ScrnInfoPtr pScrn) +{ + VIAPtr pVia = VIAPTR(pScrn); + VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; + VIAVT1621TableRec Table; + VIATVMASKTableRec Mask; + CARD8 *TV; + CARD16 *Patch2; + CARD8 i, j; + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT1621ModeI2C\n")); + + if (pBIOSInfo->TVVScan == VIA_TVOVER) + Table = VT1621OverTable[pBIOSInfo->TVIndex]; + else /* VIA_TVNORMAL */ + Table = VT1621Table[pBIOSInfo->TVIndex]; + Mask = VT1621MaskTable; + + if (pBIOSInfo->TVType == TVTYPE_PAL) { + Patch2 = Table.PatchPAL2; + if (pBIOSInfo->TVOutput == TVOUTPUT_COMPOSITE) + TV = Table.TVPALC; + else /* S-video */ + TV = Table.TVPALS; + } else { /* TVTYPE_NTSC */ + Patch2 = Table.PatchNTSC2; + if (pBIOSInfo->TVOutput == TVOUTPUT_COMPOSITE) + TV = Table.TVNTSCC; + else /* S-video */ + TV = Table.TVNTSCS; + } + + for (i = 0, j = 0; (j < Mask.numTV) && (i < VIA_BIOS_MAX_NUM_TV_REG); i++) { + if (Mask.TV[i] == 0xFF) { + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, i, TV[i]); + j++; + } else + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, i, pBIOSInfo->TVRegs[i]); + } + + /* Turn on all Composite and S-Video output */ + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x0E, 0x00); + + if ((pBIOSInfo->TVType == TVTYPE_NTSC) && pBIOSInfo->TVDotCrawl) { + CARD16 *DotCrawl = Table.DotCrawlNTSC; + CARD8 address, save; + + for (i = 1; i < (DotCrawl[0] + 1); i++) { + address = (CARD8)(DotCrawl[i] & 0xFF); + + if (address == 0x11) { + xf86I2CReadByte(pBIOSInfo->TVI2CDev, 0x11, &save); + save |= (CARD8)(DotCrawl[i] >> 8); + } else + save = (CARD8)(DotCrawl[i] >> 8); + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, address, save); + } + } + + if (pVia->IsSecondary) { /* Patch as setting 2nd path */ + j = (CARD8)(Mask.misc2 >> 5); + for (i = 0; i < j; i++) + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, Patch2[i] & 0xFF, Patch2[i] >> 8); + } + +#ifdef HAVE_DEBUG + if (pVia->PrintTVRegs) + VT162xPrintRegs(pScrn); +#endif /* HAVE_DEBUG */ +} + +/* + * + */ +static void +ViaVT1621ModeCrtc(ScrnInfoPtr pScrn) +{ + vgaHWPtr hwp = VGAHWPTR(pScrn); + VIAPtr pVia = VIAPTR(pScrn); + VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; + VIAVT1621TableRec Table; + VIATVMASKTableRec Mask; + CARD8 *CRTC, *Misc; + int i, j; + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT1621ModeCrtc\n")); + + if (pBIOSInfo->TVVScan == VIA_TVOVER) + Table = VT1621OverTable[pBIOSInfo->TVIndex]; + else /* VIA_TVNORMAL */ + Table = VT1621Table[pBIOSInfo->TVIndex]; + Mask = VT1621MaskTable; + + if (pVia->IsSecondary) { + if (pBIOSInfo->TVType == TVTYPE_PAL) { + switch (pScrn->bitsPerPixel) { + case 16: + CRTC = Table.CRTCPAL2_16BPP; + break; + case 24: + case 32: + CRTC = Table.CRTCPAL2_32BPP; + break; + case 8: + default: + CRTC = Table.CRTCPAL2_8BPP; + break; + } + Misc = Table.MiscPAL2; + } else { + switch (pScrn->bitsPerPixel) { + case 16: + CRTC = Table.CRTCNTSC2_16BPP; + break; + case 24: + case 32: + CRTC = Table.CRTCNTSC2_32BPP; + break; + case 8: + default: + CRTC = Table.CRTCNTSC2_8BPP; + break; + } + Misc = Table.MiscNTSC2; + } + + for (i = 0, j = 0; i < Mask.numCRTC2; j++) { + if (Mask.CRTC2[j] == 0xFF) { + hwp->writeCrtc(hwp, j + 0x50, CRTC[j]); + i++; + } + } + + if (Mask.misc2 & 0x18) + pBIOSInfo->Clock = (Misc[3] << 8) | Misc[4]; + + ViaCrtcMask(hwp, 0x6A, 0xC0, 0xC0); + ViaCrtcMask(hwp, 0x6B, 0x01, 0x01); + ViaCrtcMask(hwp, 0x6C, 0x01, 0x01); + + /* Disable LCD Scaling */ + if (!pVia->SAMM || pVia->FirstInit) + hwp->writeCrtc(hwp, 0x79, 0x00); + + } else { + if (pBIOSInfo->TVType == TVTYPE_PAL) { + CRTC = Table.CRTCPAL1; + Misc = Table.MiscPAL1; + } else { + CRTC = Table.CRTCNTSC1; + Misc = Table.MiscNTSC1; + } + + for (i = 0, j = 0; i < Mask.numCRTC1; j++) { + if (Mask.CRTC1[j] == 0xFF) { + hwp->writeCrtc(hwp, j, CRTC[j]); + i++; + } + } + + ViaCrtcMask(hwp, 0x33, Misc[0], 0x20); + hwp->writeCrtc(hwp, 0x6A, Misc[1]); + hwp->writeCrtc(hwp, 0x6B, Misc[2] | 0x01); + hwp->writeCrtc(hwp, 0x6C, Misc[3] | 0x01); /* ? */ + + if (Mask.misc1 & 0x30) + pBIOSInfo->Clock = (Misc[4] << 8) | Misc[5]; + } +} + +/* + * also suited for VT1622A, VT1623 + */ +static void +ViaVT1622ModeI2C(ScrnInfoPtr pScrn) +{ + VIAPtr pVia = VIAPTR(pScrn); + VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; + VIAVT162XTableRec Table; + VIATVMASKTableRec Mask; + CARD8 *TV; + CARD16 *RGB, *YCbCr, *Patch2; + CARD8 save, i, j; + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT1622ModeI2C\n")); + + if (pBIOSInfo->TVEncoder == VIA_VT1622) { + if (pBIOSInfo->TVVScan == VIA_TVOVER) + Table = VT1622OverTable[pBIOSInfo->TVIndex]; + else /* VIA_TVNORMAL */ + Table = VT1622Table[pBIOSInfo->TVIndex]; + Mask = VT1622MaskTable; + } else { /* VT1622A/VT1623 */ + if (pBIOSInfo->TVVScan == VIA_TVOVER) + Table = VT1623OverTable[pBIOSInfo->TVIndex]; + else /* VIA_TVNORMAL */ + Table = VT1623Table[pBIOSInfo->TVIndex]; + Mask = VT1623MaskTable; + } + + if (pBIOSInfo->TVType == TVTYPE_PAL) { + TV = Table.TVPAL; + RGB = Table.RGBPAL; + YCbCr = Table.YCbCrPAL; + Patch2 = Table.PatchPAL2; + } else { + TV = Table.TVNTSC; + RGB = Table.RGBNTSC; + YCbCr = Table.YCbCrNTSC; + Patch2 = Table.PatchNTSC2; + } + + /* TV Reset */ + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x1D, 0x00); + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x1D, 0x80); + + for (i = 0, j = 0; (j < Mask.numTV) && (i < VIA_BIOS_MAX_NUM_TV_REG); i++) { + if (Mask.TV[i] == 0xFF) { + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, i, TV[i]); + j++; + } else + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, i, pBIOSInfo->TVRegs[i]); + } + + /* Turn on all Composite and S-Video output */ + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x0E, 0x00); + + if ((pBIOSInfo->TVType == TVTYPE_NTSC) && pBIOSInfo->TVDotCrawl) { + CARD16 *DotCrawl = Table.DotCrawlNTSC; + CARD8 address; + + for (i = 1; i < (DotCrawl[0] + 1); i++) { + address = (CARD8)(DotCrawl[i] & 0xFF); + + if (address == 0x11) { + xf86I2CReadByte(pBIOSInfo->TVI2CDev, 0x11, &save); + save |= (CARD8)(DotCrawl[i] >> 8); + } else + save = (CARD8)(DotCrawl[i] >> 8); + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, address, save); + } + } + + if (pBIOSInfo->TVOutput == TVOUTPUT_RGB) + for (i = 1; i < (RGB[0] + 1); i++) + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, RGB[i] & 0xFF, RGB[i] >> 8); + else if (pBIOSInfo->TVOutput == TVOUTPUT_YCBCR) + for (i = 1; i < (YCbCr[0] + 1); i++) + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, YCbCr[i] & 0xFF, YCbCr[i] >> 8); + + if (pVia->IsSecondary) { /* Patch as setting 2nd path */ + j = (CARD8)(Mask.misc2 >> 5); + + for (i = 0; i < j; i++) + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, Patch2[i] & 0xFF, Patch2[i] >> 8); + } + + /* Configure flicker filter */ + xf86I2CReadByte(pBIOSInfo->TVI2CDev, 0x03, &save); + save &= 0xFC; + if(pBIOSInfo->TVDeflicker == 1) + save |= 0x01; + else if(pBIOSInfo->TVDeflicker == 2) + save |= 0x02; + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x03, save); + +#ifdef HAVE_DEBUG + if (pVia->PrintTVRegs) + VT162xPrintRegs(pScrn); +#endif /* HAVE_DEBUG */ +} + +/* + * Also suited for VT1622A, VT1623 + */ +static void +ViaVT1622ModeCrtc(ScrnInfoPtr pScrn) +{ + vgaHWPtr hwp = VGAHWPTR(pScrn); + VIAPtr pVia = VIAPTR(pScrn); + VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; + VIAVT162XTableRec Table; + VIATVMASKTableRec Mask; + CARD8 *CRTC, *Misc; + int i, j; + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT1622ModeCrtc\n")); + + if (pBIOSInfo->TVEncoder == VIA_VT1622) { + if (pBIOSInfo->TVVScan == VIA_TVOVER) + Table = VT1622OverTable[pBIOSInfo->TVIndex]; + else /* VIA_TVNORMAL */ + Table = VT1622Table[pBIOSInfo->TVIndex]; + Mask = VT1622MaskTable; + } else { /* VT1622A/VT1623 */ + if (pBIOSInfo->TVVScan == VIA_TVOVER) + Table = VT1623OverTable[pBIOSInfo->TVIndex]; + else /* VIA_TVNORMAL */ + Table = VT1623Table[pBIOSInfo->TVIndex]; + Mask = VT1623MaskTable; + } + + if (pVia->IsSecondary) { + if (pBIOSInfo->TVType == TVTYPE_PAL) { + switch (pScrn->bitsPerPixel) { + case 16: + CRTC = Table.CRTCPAL2_16BPP; + break; + case 24: + case 32: + CRTC = Table.CRTCPAL2_32BPP; + break; + case 8: + default: + CRTC = Table.CRTCPAL2_8BPP; + break; + } + Misc = Table.MiscPAL2; + } else { + switch (pScrn->bitsPerPixel) { + case 16: + CRTC = Table.CRTCNTSC2_16BPP; + break; + case 24: + case 32: + CRTC = Table.CRTCNTSC2_32BPP; + break; + case 8: + default: + CRTC = Table.CRTCNTSC2_8BPP; + break; + } + Misc = Table.MiscNTSC2; + } + + for (i = 0, j = 0; i < Mask.numCRTC2; j++) { + if (Mask.CRTC2[j] == 0xFF) { + hwp->writeCrtc(hwp, j + 0x50, CRTC[j]); + i++; + } + } + + if (Mask.misc2 & 0x18) { + /* CLE266Ax use 2x XCLK */ + if ((pVia->Chipset == VIA_CLE266) && + CLE266_REV_IS_AX(pVia->ChipRev)) { + ViaCrtcMask(hwp, 0x6B, 0x20, 0x20); + + /* Fix TV clock Polarity for CLE266A2 */ + if (pVia->ChipRev == 0x02) + ViaCrtcMask(hwp, 0x6C, 0x1C, 0x1C); + + pBIOSInfo->Clock = 0x471C; + } else + pBIOSInfo->Clock = (Misc[3] << 8) | Misc[4]; + } + + ViaCrtcMask(hwp, 0x6A, 0xC0, 0xC0); + ViaCrtcMask(hwp, 0x6B, 0x01, 0x01); + ViaCrtcMask(hwp, 0x6C, 0x01, 0x01); + + /* Disable LCD Scaling */ + if (!pVia->SAMM || pVia->FirstInit) + hwp->writeCrtc(hwp, 0x79, 0x00); + } else { + if (pBIOSInfo->TVType == TVTYPE_PAL) { + CRTC = Table.CRTCPAL1; + Misc = Table.MiscPAL1; + } else { + CRTC = Table.CRTCNTSC1; + Misc = Table.MiscNTSC1; + } + + for (i = 0, j = 0; i < Mask.numCRTC1; j++) { + if (Mask.CRTC1[j] == 0xFF) { + hwp->writeCrtc(hwp, j, CRTC[j]); + i++; + } + } + + ViaCrtcMask(hwp, 0x33, Misc[0], 0x20); + hwp->writeCrtc(hwp, 0x6A, Misc[1]); + + if ((pVia->Chipset == VIA_CLE266) && + CLE266_REV_IS_AX(pVia->ChipRev)) { + hwp->writeCrtc(hwp, 0x6B, Misc[2] | 0x81); + /* Fix TV clock Polarity for CLE266A2 */ + if (pVia->ChipRev == 0x02) + hwp->writeCrtc(hwp, 0x6C, Misc[3] | 0x01); + } else + hwp->writeCrtc(hwp, 0x6B, Misc[2] | 0x01); + + if (Mask.misc1 & 0x30) { + /* CLE266Ax use 2x XCLK */ + if ((pVia->Chipset == VIA_CLE266) && + CLE266_REV_IS_AX(pVia->ChipRev)) + pBIOSInfo->Clock = 0x471C; + else + pBIOSInfo->Clock = (Misc[4] << 8) | Misc[5]; + } + + ViaCrtcMask(hwp, 0x6A, 0x40, 0x40); + ViaCrtcMask(hwp, 0x6B, 0x01, 0x01); + ViaCrtcMask(hwp, 0x6C, 0x01, 0x01); + } + + ViaSeqMask(hwp, 0x1E, 0xC0, 0xC0); /* Enable DI0/DVP0 */ +} + +/* + * + */ +static void +ViaVT1621Power(ScrnInfoPtr pScrn, Bool On) +{ + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT1621Power\n")); + + if (On) + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x00, 0x03); + else + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x0E, 0x03); +} + +/* + * + */ +static void +ViaVT1622Power(ScrnInfoPtr pScrn, Bool On) +{ + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT1622Power\n")); + + if (On) + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x00, 0x03); + else + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x0E, 0x0F); +} + +/* + * + */ +void +ViaVT162xInit(ScrnInfoPtr pScrn) +{ + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT162xInit\n")); + + switch (pBIOSInfo->TVEncoder) { + case VIA_VT1621: + pBIOSInfo->TVSave = ViaVT162xSave; + pBIOSInfo->TVRestore = ViaVT162xRestore; + pBIOSInfo->TVDACSense = ViaVT1621DACSense; + pBIOSInfo->TVModeValid = ViaVT1621ModeValid; + pBIOSInfo->TVModeI2C = ViaVT1621ModeI2C; + pBIOSInfo->TVModeCrtc = ViaVT1621ModeCrtc; + pBIOSInfo->TVPower = ViaVT1621Power; + break; + case VIA_VT1622: + case VIA_VT1623: + pBIOSInfo->TVSave = ViaVT162xSave; + pBIOSInfo->TVRestore = ViaVT162xRestore; + pBIOSInfo->TVDACSense = ViaVT1622DACSense; + pBIOSInfo->TVModeValid = ViaVT1622ModeValid; + pBIOSInfo->TVModeI2C = ViaVT1622ModeI2C; + pBIOSInfo->TVModeCrtc = ViaVT1622ModeCrtc; + pBIOSInfo->TVPower = ViaVT1622Power; + break; + default: + break; + } + + /* Save before continuing */ + if (pBIOSInfo->TVSave) + pBIOSInfo->TVSave(pScrn); +} diff --git a/src/via_vt162x.h b/src/via_vt162x.h new file mode 100644 index 0000000..26c0d59 --- /dev/null +++ b/src/via_vt162x.h @@ -0,0 +1,884 @@ +/* + * Copyright 2004 The Unichrome Project [unichrome.sf.net] + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +#ifndef _VIA_VT162X_H_ +#define _VIA_VT162X_H_ 1 + +/* + * General defines. + */ +#define VIA_BIOS_MAX_NUM_TV_REG 0x90 /* 0x00 - 0x8F */ +#define VIA_BIOS_MAX_NUM_TV_CRTC 32 +#define VIA_BIOS_NUM_TV_SPECIAL_REG 8 +#define VIA_BIOS_MAX_NUM_TV_PATCH 8 +#define VIA_BIOS_NUM_TV_OTHER 16 + +typedef struct _VIATVMASKTABLE { + CARD8 TV[VIA_BIOS_MAX_NUM_TV_REG]; + CARD8 CRTC1[VIA_BIOS_MAX_NUM_TV_CRTC]; + CARD8 CRTC2[VIA_BIOS_MAX_NUM_TV_CRTC]; + CARD8 misc1; + CARD8 misc2; + int numTV; + int numCRTC1; + int numCRTC2; +} VIATVMASKTableRec, *VIATVMASKTablePtr; + +typedef struct _VIAVT1621TABLE { + CARD8 TVNTSCC[VIA_BIOS_MAX_NUM_TV_REG]; + CARD8 TVNTSCS[VIA_BIOS_MAX_NUM_TV_REG]; + CARD8 CRTCNTSC1[VIA_BIOS_MAX_NUM_TV_CRTC]; + CARD8 MiscNTSC1[VIA_BIOS_NUM_TV_SPECIAL_REG]; + CARD8 MiscNTSC2[VIA_BIOS_NUM_TV_SPECIAL_REG]; + CARD8 CRTCNTSC2_8BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; + CARD8 CRTCNTSC2_16BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; + CARD8 CRTCNTSC2_32BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; + CARD16 PatchNTSC2[VIA_BIOS_MAX_NUM_TV_PATCH]; + CARD16 DotCrawlNTSC[VIA_BIOS_NUM_TV_OTHER]; + CARD8 TVPALC[VIA_BIOS_MAX_NUM_TV_REG]; + CARD8 TVPALS[VIA_BIOS_MAX_NUM_TV_REG]; + CARD8 CRTCPAL1[VIA_BIOS_MAX_NUM_TV_CRTC]; + CARD8 MiscPAL1[VIA_BIOS_NUM_TV_SPECIAL_REG]; + CARD8 MiscPAL2[VIA_BIOS_NUM_TV_SPECIAL_REG]; + CARD8 CRTCPAL2_8BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; + CARD8 CRTCPAL2_16BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; + CARD8 CRTCPAL2_32BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; + CARD16 PatchPAL2[VIA_BIOS_MAX_NUM_TV_PATCH]; +} VIAVT1621TableRec, *VIAVT1621TablePtr; + + +typedef struct _VIAVT162XTABLE { + CARD8 TVNTSC[VIA_BIOS_MAX_NUM_TV_REG]; + CARD8 CRTCNTSC1[VIA_BIOS_MAX_NUM_TV_CRTC]; + CARD8 MiscNTSC1[VIA_BIOS_NUM_TV_SPECIAL_REG]; + CARD8 MiscNTSC2[VIA_BIOS_NUM_TV_SPECIAL_REG]; + CARD8 CRTCNTSC2_8BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; + CARD8 CRTCNTSC2_16BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; + CARD8 CRTCNTSC2_32BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; + CARD16 PatchNTSC2[VIA_BIOS_MAX_NUM_TV_PATCH]; + CARD16 RGBNTSC[VIA_BIOS_NUM_TV_OTHER]; + CARD16 YCbCrNTSC[VIA_BIOS_NUM_TV_OTHER]; + CARD16 SDTV_RGBNTSC[VIA_BIOS_NUM_TV_OTHER]; + CARD16 SDTV_YCbCrNTSC[VIA_BIOS_NUM_TV_OTHER]; + CARD16 DotCrawlNTSC[VIA_BIOS_NUM_TV_OTHER]; + CARD8 TVPAL[VIA_BIOS_MAX_NUM_TV_REG]; + CARD8 CRTCPAL1[VIA_BIOS_MAX_NUM_TV_CRTC]; + CARD8 MiscPAL1[VIA_BIOS_NUM_TV_SPECIAL_REG]; + CARD8 MiscPAL2[VIA_BIOS_NUM_TV_SPECIAL_REG]; + CARD8 CRTCPAL2_8BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; + CARD8 CRTCPAL2_16BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; + CARD8 CRTCPAL2_32BPP[VIA_BIOS_MAX_NUM_TV_CRTC]; + CARD16 PatchPAL2[VIA_BIOS_MAX_NUM_TV_PATCH]; + CARD16 RGBPAL[VIA_BIOS_NUM_TV_OTHER]; + CARD16 YCbCrPAL[VIA_BIOS_NUM_TV_OTHER]; + CARD16 SDTV_RGBPAL[VIA_BIOS_NUM_TV_OTHER]; + CARD16 SDTV_YCbCrPAL[VIA_BIOS_NUM_TV_OTHER]; +} VIAVT162XTableRec, *VIAVT162XTablePtr; + +/* + * + * VT1621 modetables + * + */ +static const VIATVMASKTableRec VT1621MaskTable = { + { 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF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 0, 0, 0, 0, 0, 0X48, 0XFB, 0X4, 0XFB, 0X7, 0XF8, 0X9, 0XF6, 0XA, 0X74, 0X6, 0XF8, 0XB, 0XF2, 0X10, 0X6F, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0X73, 0X63, 0X63, 0X97, 0X67, 0X91, 0XEC, 0XF0, 0, 0X60, 0, 0, 0, 0, 0, 0, 0X5C, 0, 0X57, 0, 0, 0X57, 0XED, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0X20, 0X40, 0X80, 0X4, 0X47, 0X1C, 0, 0 }, + { 0, 0, 0, 0X47, 0X1C, 0, 0, 0 }, + { 0XBF, 0X1F, 0X1F, 0XBF, 0XDB, 0X33, 0X38, 0X88, 0XED, 0X57, 0X57, 0XED, 0X52, 0X12, 0X5C, 0X51, 0, 0, 0, 0, 0, 0X32, 0X64, 0, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 }, + { 0XBF, 0X1F, 0X1F, 0XBF, 0XDB, 0X33, 0X38, 0X88, 0XED, 0X57, 0X57, 0XED, 0X52, 0X12, 0X5C, 0X51, 0, 0, 0, 0, 0, 0X64, 0XC8, 0X40, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 }, + { 0XBF, 0X1F, 0X1F, 0XBF, 0XDB, 0X33, 0X38, 0X88, 0XED, 0X57, 0X57, 0XED, 0X52, 0X12, 0X5C, 0X51, 0, 0, 0, 0, 0, 0XC8, 0X90, 0X81, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 }, + { 0X8607, 0, 0, 0, 0, 0, 0, 0 } + } +}; + +static const VIAVT1621TableRec VT1621OverTable[] = { + { + { 0X64, 0X3, 0X2, 0X33, 0X43, 0, 0X10, 0X7D, 0X72, 0X5, 0X99, 0X17, 0X93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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0X48, 0XFB, 0X4, 0XFB, 0X7, 0XF8, 0X9, 0XF6, 0XA, 0X74, 0X6, 0XF8, 0XB, 0XF2, 0X10, 0X6F, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0X71, 0X63, 0X63, 0X95, 0X67, 0X90, 0X6F, 0XF0, 0, 0X60, 0, 0, 0, 0, 0, 0, 0X57, 0, 0X57, 0, 0, 0X57, 0X70, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0X20, 0X40, 0X80, 0X1, 0X47, 0X1C, 0, 0 }, + { 0, 0, 0, 0X47, 0X1C, 0, 0, 0 }, + { 0XAF, 0X1F, 0X1F, 0XAF, 0XDB, 0X33, 0X35, 0X7D, 0X70, 0X57, 0X57, 0X70, 0X52, 0X12, 0X58, 0X5B, 0, 0, 0, 0, 0, 0X32, 0X64, 0, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 }, + { 0XAF, 0X1F, 0X1F, 0XAF, 0XDB, 0X33, 0X35, 0X7D, 0X70, 0X57, 0X57, 0X70, 0X52, 0X12, 0X58, 0X5B, 0, 0, 0, 0, 0, 0X64, 0XC8, 0X40, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 }, + { 0XAF, 0X1F, 0X1F, 0XAF, 0XDB, 0X33, 0X35, 0X7D, 0X70, 0X57, 0X57, 0X70, 0X52, 0X12, 0X58, 0X5B, 0, 0, 0, 0, 0, 0XC8, 0X90, 0X81, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 }, + { 0X7E07, 0, 0, 0, 0, 0, 0, 0 } + } +}; + +/* + * + * VT1622 modetables + * + */ +static const VIATVMASKTableRec V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 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0X40, 0, 0, 0X87, 0X1C, 0, 0 }, + { 0, 0, 0, 0X87, 0X1C, 0, 0, 0 }, + { 0X37, 0X1F, 0X1F, 0X37, 0XE3, 0X34, 0X4A, 0X8B, 0X98, 0X57, 0X57, 0X98, 0X52, 0X12, 0X59, 0X48, 0, 0, 0, 0, 0, 0X32, 0X64, 0, 0, 0, 0X80, 0, 0X80, 0, 0, 0 }, + { 0X37, 0X1F, 0X1F, 0X37, 0XE3, 0X34, 0X4A, 0X8B, 0X98, 0X57, 0X57, 0X98, 0X52, 0X12, 0X59, 0X48, 0, 0, 0, 0, 0, 0X64, 0XC8, 0X40, 0, 0, 0X80, 0, 0X80, 0, 0, 0 }, + { 0X37, 0X1F, 0X1F, 0X37, 0XE3, 0X34, 0X4A, 0X8B, 0X98, 0X57, 0X57, 0X98, 0X52, 0X12, 0X59, 0X48, 0, 0, 0, 0, 0, 0XC8, 0X90, 0X81, 0, 0, 0X80, 0, 0X80, 0, 0, 0 }, + { 0XF107, 0, 0, 0, 0, 0, 0, 0 }, + { 0X4, 0X2A02, 0X9365, 0X9066, 0X9067, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0X4, 0X302, 0X4265, 0X4566, 0X4567, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0X3, 0X811, 0X1416, 0XC717, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0X84, 0, 0, 0XA0, 0, 0, 0X19, 0XA6, 0X9F, 0X38, 0X60, 0, 0X57, 0X45, 0XF, 0, 0, 0, 0XC8, 0X12, 0X8F, 0X1C, 0X57, 0X8D, 0XE9, 0X27, 0XE, 0X3, 0X3, 0X80, 0, 0X85, 0X10, 0XC, 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}, + { 0XE7, 0XCF, 0XCF, 0XE7, 0X9A, 0X23, 0XD7, 0XC, 0X57, 0X3F, 0X3F, 0X57, 0X52, 0X12, 0X40, 0X43, 0, 0, 0, 0, 0, 0X5A, 0XB4, 0X40, 0, 0, 0X80, 0, 0X80, 0, 0, 0 }, + { 0XE7, 0XCF, 0XCF, 0XE7, 0X9A, 0X23, 0XD7, 0XC, 0X57, 0X3F, 0X3F, 0X57, 0X52, 0X12, 0X40, 0X43, 0, 0, 0, 0, 0, 0XB4, 0X68, 0X81, 0, 0, 0X80, 0, 0X80, 0, 0, 0 }, + { 0XF07, 0, 0, 0, 0, 0, 0, 0 }, + { 0X6, 0X2A02, 0XBA65, 0XB866, 0XB867, 0X9027, 0X992B, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0X4, 0X302, 0X5865, 0X4866, 0X4967, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + } +}; + +/* + * + * VT1622A/VT1623 modetables + * + */ +static const VIATVMASKTableRec VT1623MaskTable = { + { 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 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, 0XFF, 0XFF, 0XFF, 0X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F, 0XED, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0X20, 0X40, 0, 0, 0X87, 0X1C, 0, 0 }, + { 0, 0, 0, 0X87, 0X1C, 0, 0, 0 }, + { 0XF7, 0XCF, 0XCF, 0XF7, 0X92, 0X22, 0XDE, 0XE8, 0XED, 0X3F, 0X3F, 0XED, 0X12, 0X12, 0X7F, 0X47, 0, 0, 0, 0, 0, 0X2D, 0X5A, 0, 0, 0, 0X80, 0, 0X80, 0, 0, 0 }, + { 0XF7, 0XCF, 0XCF, 0XF7, 0X92, 0X22, 0XDE, 0XE8, 0XED, 0X3F, 0X3F, 0XED, 0X12, 0X12, 0X7F, 0X47, 0, 0, 0, 0, 0, 0X5A, 0XB4, 0X40, 0, 0, 0X80, 0, 0X80, 0, 0, 0 }, + { 0XF7, 0XCF, 0XCF, 0XF7, 0X92, 0X22, 0XDE, 0XE8, 0XED, 0X3F, 0X3F, 0XED, 0X12, 0X12, 0X7F, 0X47, 0, 0, 0, 0, 0, 0XB4, 0X68, 0X81, 0, 0, 0X80, 0, 0X80, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0X4, 0X2A02, 0X6A65, 0X6266, 0X6567, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0X4, 0X302, 0X5965, 0X4D66, 0X4A67, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + } +}; + +static const VIAVT162XTableRec VT1623OverTable[] = { + { + { 0X4, 0, 0, 0X6, 0X3, 0, 0X20, 0X10, 0X76, 0XA, 0X56, 0X5, 0X50, 0X3B, 0XF, 0, 0, 0, 0XED, 0X23, 0XC0, 0X34, 0X5E, 0XAA, 0XEA, 0X25, 0XE5, 0X10, 0X2, 0X80, 0, 0X11, 0X17, 0X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, 0, 0, 0, 0 }, + { 0X20, 0X40, 0, 0, 0X87, 0X1C, 0, 0 }, + { 0, 0, 0, 0X87, 0X1C, 0, 0, 0 }, + { 0XE7, 0X1F, 0X1F, 0XE7, 0XDB, 0X33, 0X73, 0XAF, 0X89, 0X57, 0X57, 0X89, 0X52, 0X12, 0X58, 0X5A, 0, 0, 0, 0, 0, 0X32, 0X64, 0, 0, 0, 0X80, 0, 0X80, 0, 0, 0 }, + { 0XE7, 0X1F, 0X1F, 0XE7, 0XDB, 0X33, 0X73, 0XAF, 0X89, 0X57, 0X57, 0X89, 0X52, 0X12, 0X58, 0X5A, 0, 0, 0, 0, 0, 0X64, 0XC8, 0X40, 0, 0, 0X80, 0, 0X80, 0, 0, 0 }, + { 0XE7, 0X1F, 0X1F, 0XE7, 0XDB, 0X33, 0X73, 0XAF, 0X89, 0X57, 0X57, 0X89, 0X52, 0X12, 0X58, 0X5A, 0, 0, 0, 0, 0, 0XC8, 0X90, 0X81, 0, 0, 0X80, 0, 0X80, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0X6, 0X2A02, 0X6A65, 0X6266, 0X6567, 0X9027, 0X992B, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0X4, 0X302, 0X5865, 0X4866, 0X4867, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + }, + { + { 0X84, 0, 0, 0X4, 0X3, 0, 0X20, 0X52, 0XAE, 0X9, 0X50, 0, 0X50, 0X39, 0XF, 0, 0, 0, 0XE8, 0X33, 0XD, 0X15, 0XE, 0X44, 0X44, 0X18, 0X66, 0X10, 0X3, 0X80, 0, 0X55, 0XF, 0X5, 0XF1, 0X73, 0X8, 0X56, 0X4A, 0X90, 0X79, 0, 0, 0XA3, 0X29, 0X9B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--git a/src/via_xvmc.c b/src/via_xvmc.c index 4bd5543..b900081 100644 --- a/src/via_xvmc.c +++ b/src/via_xvmc.c @@ -1,7 +1,7 @@ /***************************************************************************** * VIA Unichrome XvMC extension X server driver. * - * Copyright (c) 2004 Thomas Hellström. All rights reserved. + * Copyright (c) 2004 The Unichrome Project. All rights reserved. * Copyright (c) 2000 Intel Corporation. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -38,6 +38,7 @@ #include "via.h" #include "via_dri.h" #include "via_driver.h" +#include "via_id.h" #include "xf86xv.h" #include "fourcc.h" @@ -192,9 +193,33 @@ static XF86MCSurfaceInfoRec Via_YV12_mpg2_surface = &yv12_subpicture_list }; -/* - * FIXME: It remains to be checked whether the hardware can really do mpeg1. - */ +static XF86MCSurfaceInfoRec Via_YV12_mocomp_mpg12_surface = +{ + FOURCC_YV12, + XVMC_CHROMA_FORMAT_420, + 0, + 1024, + 1024, + 1024, + 1024, + XVMC_MPEG_1 | XVMC_MPEG_2 | XVMC_MOCOMP, + XVMC_OVERLAID_SURFACE | XVMC_BACKEND_SUBPICTURE, + &yv12_subpicture_list +}; + +static XF86MCSurfaceInfoRec Via_YV12_idct_mpg12_surface = +{ + FOURCC_YV12, + XVMC_CHROMA_FORMAT_420, + 0, + 1024, + 1024, + 1024, + 1024, + XVMC_MPEG_1 | XVMC_MPEG_2 | XVMC_IDCT, + XVMC_OVERLAID_SURFACE | XVMC_BACKEND_SUBPICTURE, + &yv12_subpicture_list +}; static XF86MCSurfaceInfoRec Via_YV12_mpg1_surface = { @@ -216,6 +241,13 @@ static XF86MCSurfaceInfoPtr ppSI[2] = (XF86MCSurfaceInfoPtr)&Via_YV12_mpg1_surface }; +static XF86MCSurfaceInfoPtr ppSI_mocomp[2] = +{ + (XF86MCSurfaceInfoPtr)&Via_YV12_mocomp_mpg12_surface, + (XF86MCSurfaceInfoPtr)&Via_YV12_idct_mpg12_surface +}; + + /* List of subpicture types that we support */ static XF86ImageRec ia44_subpicture = XVIMAGE_IA44; static XF86ImageRec ai44_subpicture = XVIMAGE_AI44; @@ -250,7 +282,23 @@ static XF86MCAdaptorRec pAdapt = (xf86XvMCDestroySubpictureProcPtr)ViaXvMCDestroySubpicture }; +static XF86MCAdaptorRec pAdapt_mocomp = +{ + "XV_SWOV", /* name */ + 2, /* num_surfaces */ + ppSI_mocomp, /* surfaces */ + 2, /* num_subpictures */ + Via_subpicture_list, /* subpictures */ + (xf86XvMCCreateContextProcPtr)ViaXvMCCreateContext, + (xf86XvMCDestroyContextProcPtr)ViaXvMCDestroyContext, + (xf86XvMCCreateSurfaceProcPtr)ViaXvMCCreateSurface, + (xf86XvMCDestroySurfaceProcPtr)ViaXvMCDestroySurface, + (xf86XvMCCreateSubpictureProcPtr)ViaXvMCCreateSubpicture, + (xf86XvMCDestroySubpictureProcPtr)ViaXvMCDestroySubpicture +}; + static XF86MCAdaptorPtr ppAdapt[1] = {(XF86MCAdaptorPtr)&pAdapt}; +static XF86MCAdaptorPtr ppAdapt_mocomp[1] = {(XF86MCAdaptorPtr)&pAdapt_mocomp}; static void mpegDisable(VIAPtr pVia,CARD32 val) @@ -268,7 +316,9 @@ void ViaInitXVMC(ScreenPtr pScreen) char *bID; drmVersionPtr drmVer; - pVia->XvMCEnabled = 0; + if (pVia->XvMCEnabled) + return; + if(!pVia->directRenderingEnabled) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "[XvMC] Cannot use XvMC without DRI!\n"); @@ -280,12 +330,12 @@ void ViaInitXVMC(ScreenPtr pScreen) "[XvMC] Could not get drm version. Disabling XvMC\n"); return; } - if (((drmVer->version_major <= 2) && (drmVer->version_minor < 0))) { + if (((drmVer->version_major <= 2) && (drmVer->version_minor < 4))) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "[XvMC] Kernel drm is not compatible with XvMC.\n"); xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "[XvMC] Kernel drm version: %d.%d.%d " - "and need at least version 2.0.0.\n", + "and need at least version 2.4.0.\n", drmVer->version_major,drmVer->version_minor, drmVer->version_patchlevel); xf86DrvMsg(pScrn->scrnIndex, X_WARNING, @@ -322,13 +372,23 @@ void ViaInitXVMC(ScreenPtr pScreen) initViaXvMC(vXvMC); - if (! xf86XvMCScreenInit(pScreen, 1, ppAdapt)) { + if (! xf86XvMCScreenInit(pScreen, 1, + (pVia->Chipset == VIA_KM400) ? + ppAdapt_mocomp : ppAdapt)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[XvMC] XvMCScreenInit failed. Disabling XvMC.\n"); drmRmMap(pVia->drmFD,vXvMC->fbBase); return; } - + +#if (XvMCVersion > 1) || (XvMCRevision > 0) + { + DRIInfoPtr pDRIInfo = pVia->pDRIInfo; + xf86XvMCRegisterDRInfo(pScreen, "viaXvMC",pDRIInfo->busIdString, + VIAXVMC_MAJOR, VIAXVMC_MINOR, VIAXVMC_PL); + } +#endif + vXvMC->activePorts = 0; saPriv=(ViaXvMCSAreaPriv *) DRIGetSAREAPrivate(pScreen); saPriv->XvMCCtxNoGrabbed = ~0; @@ -529,7 +589,7 @@ int ViaXvMCCreateSurface (ScrnInfoPtr pScrn, XvMCSurfacePtr pSurf, } (*priv)[1] = numBuffers; - (*priv)[2] = sPriv->offsets[0] = ALIGN_TO_32_BYTES(sPriv->memory_ref.base); + (*priv)[2] = sPriv->offsets[0] = ALIGN_TO(sPriv->memory_ref.base, 32); for (i = 1; i < numBuffers; ++i) { (*priv)[i+2] = sPriv->offsets[i] = sPriv->offsets[i-1] + bufSize; } @@ -602,7 +662,7 @@ int ViaXvMCCreateSubpicture (ScrnInfoPtr pScrn, XvMCSubpicturePtr pSubp, "framebuffer memory!\n"); return BadAlloc; } - (*priv)[1] = sPriv->offsets[0] = ALIGN_TO_32_BYTES(sPriv->memory_ref.base); + (*priv)[1] = sPriv->offsets[0] = ALIGN_TO(sPriv->memory_ref.base, 32); vXvMC->sPrivs[srfNo] = sPriv; vXvMC->surfaces[srfNo] = pSubp->subpicture_id; @@ -625,11 +685,6 @@ static void ViaXvMCDestroyContext (ScrnInfoPtr pScrn, XvMCContextPtr pContext) for(i=0; i < VIA_XVMC_MAX_CONTEXTS; i++) { if(vXvMC->contexts[i] == pContext->context_id) { - /* - * Check if the context to be destroyed currently holds the decoder. - * In that case, release the decoder. - */ - context = vXvMC->cPrivs[i]->drmCtx; sAPriv=(ViaXvMCSAreaPriv *) DRIGetSAREAPrivate(pScrn->pScreen); portPriv = (XvPortRecPrivatePtr) pContext->port_priv; @@ -641,24 +696,6 @@ static void ViaXvMCDestroyContext (ScrnInfoPtr pScrn, XvMCContextPtr pContext) vx->ctxDisplaying = 0; } - if ((XVMC_DECODER_FUTEX(sAPriv)->lock & ~DRM_LOCK_CONT) == - (context | DRM_LOCK_HELD)) { - DRM_CAS_RESULT(__ret); - sAPriv->XvMCCtxNoGrabbed = ~0; - DRM_CAS( XVMC_DECODER_FUTEX(sAPriv), context | DRM_LOCK_HELD, - 0, __ret); - if (__ret) { - - drm_via_futex_t fx; - fx.func = VIA_FUTEX_WAKE; - fx.lock = 0; - XVMC_DECODER_FUTEX(sAPriv)->lock = 0; - drmCommandWrite(pVia->drmFD, DRM_VIA_DEC_FUTEX, - &fx,sizeof(fx)); - - } - } - drmDestroyContext(pVia->drmFD,vXvMC->cPrivs[i]->drmCtx); xfree(vXvMC->cPrivs[i]); vXvMC->cPrivs[i] = 0; diff --git a/src/via_xvmc.h b/src/via_xvmc.h index b8c90fb..b47dc72 100644 --- a/src/via_xvmc.h +++ b/src/via_xvmc.h @@ -1,7 +1,7 @@ /***************************************************************************** * VIA Unichrome XvMC extension X server driver. * - * Copyright (c) 2004 Thomas Hellström. All rights reserved. + * Copyright (c) 2004 The Unichrome project. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -20,7 +20,9 @@ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. + * */ + #ifndef _VIA_XVMC_H #define _VIA_XVMC_H 1 diff --git a/src/via_xvpriv.h b/src/via_xvpriv.h index d859791..2dc17c4 100644 --- a/src/via_xvpriv.h +++ b/src/via_xvpriv.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_xvpriv.h,v 1.5 2003/08/27 15:16:14 tsi Exp $ */ /* * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. @@ -27,47 +26,28 @@ #define _VIA_XVPRIV_H_ 1 #include "xf86xv.h" -#include "videodev.h" #define XV_PORT_SWOV 0 -#define XV_PORT_TV0 1 -#define XV_PORT_TV1 2 -#define XV_PORT_DUMMY 3 -#define XV_PORT_NUM 4 +#define XV_PORT_DUMMY 1 +#define XV_PORT_NUM 2 typedef struct { unsigned char xv_portnum; - int brightness; - int saturation; - int contrast; - int hue; - unsigned long dwEncoding; - RegionRec clip; - CARD32 colorKey; - Time offTime; - Time freeTime; - VIACapRec CapInfo; - CARD32 AudioMode; - int Volume; - Bool autoPaint; + int brightness; + int saturation; + int contrast; + int hue; + RegionRec clip; + CARD32 colorKey; + Bool autoPaint; /* Surface structure */ DDSURFACEDESC SurfaceDesc; DDLOCK ddLock; - /* file handle */ - int nr; - - /* attributes */ - - int *input; - int *norm; - int nenc,cenc; - - /* yuv to offscreen */ - struct video_window yuv_win; - /* store old video source & dst data */ + short old_src_x; + short old_src_y; short old_src_w; short old_src_h; @@ -80,14 +60,4 @@ typedef struct { } viaPortPrivRec, *viaPortPrivPtr; - -#if 0 -__inline void AllocatePortPriv(); -__inline void FreePortPriv(); -__inline void ClearPortPriv(int); -viaPortPrivPtr GetPortPriv(int); -void SetPortPriv(int nIndex, unsigned long dwAction, unsigned long dwValue); -unsigned long IdentifyPort(viaPortPrivPtr); -#endif - #endif /* _VIA_XVPRIV_H_ */ |