diff options
author | Thomas Hellstrom <unichrome@shipmail.org> | 2005-05-23 20:12:50 +0000 |
---|---|---|
committer | Thomas Hellstrom <unichrome@shipmail.org> | 2005-05-23 20:12:50 +0000 |
commit | 15b59db091c8a1406c6fe52626a51bdca207c84d (patch) | |
tree | e621583812ebb9717191618dcbcb13b2fd4f3d14 | |
parent | d7e3ea1da2d12594228fb8ecfff646cdcea6ce1a (diff) |
Sync with Unichrome CVS 2005-05-20. Highlights:
- Extensive output, Xv and XvMC cleanups.
- More general mode support, with a discrete set of dotclocks.
- TV-out noscale / overscan modeline support.
- DRI and Xv bugfixes.
- VBE modes for unsupported chipsets and hardware configurations.
- Initial Unichrome Pro mode support.
- K8M/N800 Xv and XvMC support.
- Increased pipelining in the XvMC client library using AGP DMA.
(Luc Verhaegen, Thomas Hellstrom, Terry Barnaby) For detailed changelog,
see http://unichrome.sourceforge.net.
Remove the old MTRR setup failure hack. Make VBEModes option visible even
when DEBUG is not defined. Update dotclock table with tested Unichrome
Pro dotclocks. Disable XvMC on 64-bit architectures. Patch #1172117
from the Unichrome site tracker.
(Thomas Hellstrom)
38 files changed, 4641 insertions, 4008 deletions
diff --git a/man/via.man b/man/via.man index d1cadba..a0794d4 100644 --- a/man/via.man +++ b/man/via.man @@ -21,23 +21,16 @@ driver supports the VIA CLE266, KM400/KN400 chipsets, including 2D acceleration and the Xv video overlay extensions. Flat panel, TV and VGA outputs are supported. .PP -K8M800/K8N800 support is still under development. +K8M800/K8N800, PM8X0 and CN400 support is still under development. .PP -Direct rendering 3D is available as root only, but has some rendering glitches at -this time. Also there is an XvMC client library for hardware MPEG1 / MPEG2 decoding -acceleration available on the CLE266 chipset that uses the Direct +Direct rendering 3D is available using experimental drivers in Mesa, www.mesa3d.org. +Also there is an XvMC client library for hardware MPEG1 / MPEG2 decoding +acceleration available on the CLE266 and K8M/N800 chipsets that uses the Direct Rendering Infrastructure, DRI. The XvMC client library implements a nonstandard \*qVLD\*q extension to the XvMC standard. The current Direct Rendering Manager Linux kernel module is available at dri.sourceforge.net. .PP -Only a limited number of resolutions are supported at 60, 75, 85, 100 and -120Hz (save memory bandwidth limitations): 640x480, 800x600, 1024x768, -1152x864, 1280x1024 and 1600x1200. Another range of resolutions is only -possible at 60Hz: 720x480, 720x576, 848x480, 856x480, 1024x512, 1024x576, -1280x768, 1280x960, 1400x1050 and 1440x1050. This behaviour will change in -the not too distant future. -.PP .SH CONFIGURATION DETAILS Please refer to __xconfigfile__(__filemansuffix__) for general configuration details. This section only covers configuration details specific to this @@ -64,13 +57,14 @@ but otherwise defaults to disabled. Override the VideoRAM auto detection. This should never be needed. .TP .BI "Option \*qRotate\*q \*q" string \*q -Rotate the display either clockwise ("CW") or counter clockwise ("CCW"). +Rotate the display either clockwise (\*qCW\*q) or counter clockwise (\*qCCW\*q). Rotation is only supported unaccelerated. .TP .BI "Option \*qActiveDevice\*q \*q" string \*q -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. +Specify the active device combination. Any string containing \*qCRT\*q, +\*qLCD\*q, \*qTV\*q 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. @@ -91,18 +85,14 @@ Specify deflicker setting for TV output. Valid values are 0,1,2 0) No deflicker, 1) 1:1:1 deflicker, 2) 1:2:1 deflicker. .TP .BI "Option \*qTVType\*q \*q" string \*q -Specify TV output format. The driver currently supports "NTSC" and -"PAL" timings only. +Specify TV output format. The driver currently supports \*qNTSC\*q and +\*qPAL\*q timings only. .TP .BI "Option \*qTVOutput\*q \*q" string \*q -Specify which TV output to use. The driver supports "S-Video", "Composite", -"SC", "RGB" and "YCbCr" outputs. Note that on many boards the composite -video port is shared with audio out and jumper selected. -.TP -.BI "Option \*qTVVScan\*q \*q" string \*q -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". +Specify which TV output to use. The driver supports \*qS-Video\*q, +\*qComposite\*q, \*qSC\*q, \*qRGB\*q and \*qYCbCr\*q outputs. Note that on some +EPIA boards the composite video port is shared with audio out and jumper +selected. .TP .BI "Option \*qDisableVQ\*q \*q" boolean \*q Disable or enable the use of VQ. VQ is enabled by default. @@ -113,17 +103,40 @@ Set DRI Xinerama mode. Currently unsupported. .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. +make use of this to consume much less CPU. .TP .BI "Option \*qNoAGPFor2D\*q \*q" boolean \*q With this option on, 2D acceleration will not use AGP DMA even if it is enabled. +.TP +.BI "Option \*qVBEModes\*q \*q" boolean \*q +The driver will set modes using BIOS similar to the way the vesa driver does. This +is the default behaviour for Unichrome Pro in panel mode, which is otherwise not +supported. Use this option only when the driver does not support your particular +hardware. + +.SH "Supported TV Encoders" +Unichromes tend to be paired with several different TV Encoders. +.TP +.BI "VIA Technologies VT1621" +Untested as no combination with Unichrome is known or available. +Supports the following normal modes: \*q640x480\*q and \*q800x600\*q. Use +\*q640x480Over\*q and \*q800x600Over\*q for vertical overscan. These modes +are made available by the driver and modelines provided in __xconfigfile__ +will be ignored. +.TP +.BI "VIA Technologies VT1622, VT1622A, VT1623" +Supports the following modes: \*q640x480\*q, \*q800x600\*q, \*q1024x768\*q, +\*q848x480\*q, \*q720x480\*q (NTSC only) and \*q720x576\*q (PAL only). Use +\*q640x480Over\*q, \*q800x600Over\*q, \*q1024x768Over\*q, \*q848x480Over\*q, +\*q720x480Over\*q (NTSC) and \*q720x576Over\*q (PAL) for vertical overscan. +The modes \*q720x480Noscale\*q (NTSC VT1622 only) and \*q720x576Noscale\*q +(PAL VT1622 and VT1622a only) provide cleaner TV output (unscaled with only minimal overscan). +These modes are made available by the driver and modelines provided in +__xconfigfile__ will be ignored. .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. +The driver is not fully 64 bit clean. In particular, 3D acceleration, XvMC and VBEModes do not +work properly in 64-bit mode. .SH "SEE ALSO" __xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__) .SH AUTHORS @@ -16,9 +16,9 @@ * 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 + * 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. */ @@ -27,8 +27,6 @@ /* Video status flag */ -#define VIDEO_SHOW 0x80000000 /*Video on*/ -#define VIDEO_HIDE 0x00000000 /*Video off*/ #define VIDEO_MPEG_INUSE 0x08000000 /*Video is used with MPEG */ #define VIDEO_HQV_INUSE 0x04000000 /*Video is used with HQV*/ #define VIDEO_CAPTURE0_INUSE 0x02000000 /*Video is used with CAPTURE 0*/ diff --git a/src/via_accel.c b/src/via_accel.c index 7ee343f..0caa7e2 100644 --- a/src/via_accel.c +++ b/src/via_accel.c @@ -16,9 +16,9 @@ * 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 + * 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. */ @@ -361,23 +361,16 @@ static void dispatchCBuffer(VIAPtr pVia, ViaCBuffer *buf) static void dispatchCBufferAGP(VIAPtr pVia, ViaCBuffer *buf) { #ifdef XF86DRI - DRIInfoPtr pDRIInfo = pVia->pDRIInfo; - VIADRIPtr pVIADRI = pDRIInfo->devPrivate; - drmViaCmdBuffer b; + drm_via_cmdbuffer_t b; b.buf = (char *)(buf->buffer); b.size = buf->curPos*sizeof(CARD32); - if (pVia->agpEnable && pVia->dma2d) { - if (pVia->directRenderingEnabled && pVIADRI->ringBufActive) { - if (drmCommandWrite(pVia->drmFD,DRM_VIA_CMDBUFFER,&b,sizeof(b))) { - - /* - * No success using AGP. Try PCI instead. - */ - - dispatchCBuffer(pVia,buf); - } + if (pVia->directRenderingEnabled && pVia->agpEnable && pVia->dma2d) { + VIADRIPtr pVIADRI = pVia->pDRIInfo->devPrivate; + if (pVIADRI->ringBufActive) { + if (drmCommandWrite(pVia->drmFD,DRM_VIA_CMDBUFFER,&b,sizeof(b))) + dispatchCBuffer(pVia,buf); /* No success using AGP. Try PCI instead. */ return; } } diff --git a/src/via_bandwidth.c b/src/via_bandwidth.c index c3b4484..ad0732c 100644 --- a/src/via_bandwidth.c +++ b/src/via_bandwidth.c @@ -17,9 +17,9 @@ * 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 + * 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. */ #include "via_driver.h" @@ -110,30 +110,6 @@ ViaSetPrimaryExpireNumber(ScrnInfoPtr pScrn, DisplayModePtr mode, ViaExpireNumbe } /* - * original via comments: - * Enable Refresh to avoid data lose when enter screen saver - * Refresh disable & 128-bit alignment - * - */ -static void -ViaSetPrimaryFetchCount(ScrnInfoPtr pScrn, int width) -{ - vgaHWPtr hwp = VGAHWPTR(pScrn); - CARD16 Count = (width * (pScrn->bitsPerPixel >> 3)) >> 3; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaSetPrimaryFetchCount\n")); - - /* Make sure that this is 32byte aligned */ - if (Count & 0x03) { - Count += 0x03; - Count &= ~0x03; - } - - hwp->writeSeq(hwp, 0x1C, (Count >> 1) & 0xFF); /* +1 in original CLE266/KM400 code */ - ViaSeqMask(hwp, 0x1D, Count >> 9, 0x03); -} - -/* * */ void @@ -188,8 +164,6 @@ ViaSetPrimaryFIFO(ScrnInfoPtr pScrn, DisplayModePtr mode) /* originally when setting secondary */ ViaSetPrimaryExpireNumber(pScrn, mode, CLE266AExpireNumber); } - - ViaSetPrimaryFetchCount(pScrn, mode->CrtcHDisplay); break; case VIA_KM400: if (pVia->HasSecondary) { /* SAMM or DuoView case */ @@ -212,8 +186,6 @@ ViaSetPrimaryFIFO(ScrnInfoPtr pScrn, DisplayModePtr mode) } hwp->writeSeq(hwp, 0x18, 0x57); /* 23 */ - ViaSetPrimaryFetchCount(pScrn, mode->CrtcHDisplay); - /* originally when setting secondary */ ViaSetPrimaryExpireNumber(pScrn, mode, KM400ExpireNumber); break; @@ -223,8 +195,6 @@ ViaSetPrimaryFIFO(ScrnInfoPtr pScrn, DisplayModePtr mode) ViaSeqMask(hwp, 0x16, 0x92, 0xBF); /* 328/4 = 82 = 0x52*/ ViaSeqMask(hwp, 0x18, 0x8a, 0xBF); /* 74 */ - ViaSetPrimaryFetchCount(pScrn, mode->CrtcHDisplay); - if ((mode->HDisplay >= 1400) && (pScrn->bitsPerPixel == 32)) ViaSeqMask(hwp, 0x22, 0x10, 0x1F); /* 64/4 = 16 */ else @@ -237,8 +207,6 @@ ViaSetPrimaryFIFO(ScrnInfoPtr pScrn, DisplayModePtr mode) ViaSeqMask(hwp, 0x16, 0x20, 0xBF); /* 32 */ ViaSeqMask(hwp, 0x18, 0x10, 0xBF); /* 16 */ - ViaSetPrimaryFetchCount(pScrn, mode->CrtcHDisplay); - if ((mode->HDisplay >= 1400) && (pScrn->bitsPerPixel == 32)) ViaSeqMask(hwp, 0x22, 0x10, 0x1F); /* 64/4 = 16 */ else @@ -254,27 +222,6 @@ ViaSetPrimaryFIFO(ScrnInfoPtr pScrn, DisplayModePtr mode) } /* - * - */ -static void -ViaSetSecondaryFetchCount(ScrnInfoPtr pScrn, int width) -{ - vgaHWPtr hwp = VGAHWPTR(pScrn); - CARD16 Count = (width * (pScrn->bitsPerPixel >> 3)) >> 3; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaSetSecondaryFetchCount\n")); - - /* Make sure that this is 32byte aligned */ - if (Count & 0x03) { - Count += 0x03; - Count &= ~0x03; - } - - hwp->writeCrtc(hwp, 0x65, (Count >> 1) & 0xFF); - ViaCrtcMask(hwp, 0x67, Count >> 7, 0x0C); -} - -/* * I've thrown out the LCD requirement. Size > 1024 is not supported * by any currently known TV encoder anyway. -- Luc. * @@ -308,7 +255,6 @@ ViaSetSecondaryFIFO(ScrnInfoPtr pScrn, DisplayModePtr mode) hwp->writeCrtc(hwp, 0x68, 0x67); /* depth: 6, threshold: 7 */ } } - ViaSetSecondaryFetchCount(pScrn, mode->CrtcHDisplay); break; case VIA_KM400: if ((mode->HDisplay >= 1600) && (pVia->MemClk <= VIA_MEM_DDR200)) { @@ -328,7 +274,6 @@ ViaSetSecondaryFIFO(ScrnInfoPtr pScrn, DisplayModePtr mode) ViaCrtcMask(hwp, 0x6A, 0x00, 0x20); hwp->writeCrtc(hwp, 0x68, 0x67); /* depth: 6, threshold: 7 */ } - ViaSetSecondaryFetchCount(pScrn, mode->CrtcHDisplay); break; #ifdef HAVE_K8M800 case VIA_K8M800: @@ -345,8 +290,6 @@ ViaSetSecondaryFIFO(ScrnInfoPtr pScrn, DisplayModePtr mode) ViaCrtcMask(hwp, 0x92, 0x0A, 0x0F); ViaCrtcMask(hwp, 0x95, 0x04, 0x07); - ViaSetSecondaryFetchCount(pScrn, mode->CrtcHDisplay); - if ((mode->HDisplay >= 1400) && (pScrn->bitsPerPixel == 32)) ViaCrtcMask(hwp, 0x94, 0x10, 0x7F); /* 64/4 */ else @@ -368,8 +311,6 @@ ViaSetSecondaryFIFO(ScrnInfoPtr pScrn, DisplayModePtr mode) ViaCrtcMask(hwp, 0x92, 0x08, 0x0F); ViaCrtcMask(hwp, 0x95, 0x00, 0x07); - ViaSetSecondaryFetchCount(pScrn, mode->CrtcHDisplay); - if ((mode->HDisplay >= 1400) && (pScrn->bitsPerPixel == 32)) ViaCrtcMask(hwp, 0x94, 0x10, 0x7F); /* 64/4 */ else diff --git a/src/via_bios.h b/src/via_bios.h index f4f060f..af383d9 100644 --- a/src/via_bios.h +++ b/src/via_bios.h @@ -17,9 +17,9 @@ * 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 + * 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. */ @@ -46,10 +46,11 @@ #define TVOUTPUT_YCBCR 0x08 #define TVOUTPUT_SC 0x16 -#define VIA_NONETV 0 -#define VIA_VT1621 1 /* TV2PLUS */ -#define VIA_VT1622 2 /* TV3 */ -#define VIA_VT1623 3 /* also VT1622A */ +#define VIA_NONETV 0 +#define VIA_VT1621 1 /* TV2PLUS */ +#define VIA_VT1622 2 /* TV3 */ +#define VIA_VT1623 3 /* also VT1622A */ +#define VIA_VT1625 4 #define VIA_TVNORMAL 0 #define VIA_TVOVER 1 @@ -68,6 +69,7 @@ #define VIA_MEM_DDR266 0x04 #define VIA_MEM_DDR333 0x05 #define VIA_MEM_DDR400 0x06 +#define VIA_MEM_END 0x07 #define VIA_MEM_NONE 0xFF /* Digital Output Bus Width */ @@ -80,10 +82,10 @@ typedef struct _VIABIOSINFO { Bool CrtPresent; Bool CrtActive; - CARD16 ModeIndex; CARD16 ResolutionIndex; - CARD16 Refresh; - CARD16 Clock; /* register value for the dotclock */ + CARD32 Clock; /* register value for the dotclock */ + Bool ClockExternal; + CARD32 Bandwidth; /* available memory bandwidth */ /* Panel/LCD entries */ Bool PanelPresent; @@ -106,10 +108,8 @@ typedef struct _VIABIOSINFO { int TVOutput; Bool TVActive; I2CDevPtr TVI2CDev; - CARD16 TVIndex; int TVType; Bool TVDotCrawl; - int TVVScan; int TVDeflicker; CARD8 TVRegs[0xFF]; @@ -117,32 +117,39 @@ typedef struct _VIABIOSINFO { 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); + ModeStatus (*TVModeValid) (ScrnInfoPtr pScrn, DisplayModePtr mode); + void (*TVModeI2C) (ScrnInfoPtr pScrn, DisplayModePtr mode); + void (*TVModeCrtc) (ScrnInfoPtr pScrn, DisplayModePtr mode); void (*TVPower) (ScrnInfoPtr pScrn, Bool On); + DisplayModePtr TVModes; + void (*TVPrintRegs) (ScrnInfoPtr pScrn); } VIABIOSInfoRec, *VIABIOSInfoPtr; /* Function prototypes */ -/* via_bios.c */ -void ViaVBEPrintBIOSVersion(ScrnInfoPtr pScrn); -void ViaVBEPrintBIOSDate(ScrnInfoPtr pScrn); -#ifdef HAVE_DEBUG -CARD8 ViaVBEGetActiveDevice(ScrnInfoPtr pScrn); -void ViaDumpVGAROM(ScrnInfoPtr pScrn); -#endif /* HAVE_DEBUG */ +/* via_vbe.c */ +void ViaVbeAdjustFrame(int scrnIndex, int x, int y, int flags); +Bool ViaVbeSetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode); +Bool ViaVbeSaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function); +Bool ViaVbeModePreInit(ScrnInfoPtr pScrn); +void ViaVbeDPMS(ScrnInfoPtr pScrn, int mode, int flags); +void ViaVbeDoDPMS(ScrnInfoPtr pScrn, int mode); /* via_mode.c */ void ViaOutputsDetect(ScrnInfoPtr pScrn); Bool ViaOutputsSelect(ScrnInfoPtr pScrn); -Bool ViaModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool Final); +void ViaModesAttach(ScrnInfoPtr pScrn, MonPtr monitorp); +CARD32 ViaGetMemoryBandwidth(ScrnInfoPtr pScrn); +ModeStatus ViaValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags); 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); +#ifdef HAVE_DEBUG +void ViaTVPrintRegs(ScrnInfoPtr pScrn); +#endif /* in via_bandwidth.c */ void ViaSetPrimaryFIFO(ScrnInfoPtr pScrn, DisplayModePtr mode); diff --git a/src/via_cursor.c b/src/via_cursor.c index 0ca5b3d..294bcac 100644 --- a/src/via_cursor.c +++ b/src/via_cursor.c @@ -16,9 +16,9 @@ * 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 + * 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. */ diff --git a/src/via_dga.c b/src/via_dga.c index 1e11d6f..0028a19 100644 --- a/src/via_dga.c +++ b/src/via_dga.c @@ -16,9 +16,9 @@ * 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 + * 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. */ @@ -246,7 +246,7 @@ VIADGASetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) pScrn->bitsPerPixel = pVia->DGAOldBitsPerPixel; pScrn->depth = pVia->DGAOldDepth; - VIASwitchMode(index, pScrn->currentMode, 0); + pScrn->SwitchMode(index, pScrn->currentMode, 0); if (pVia->hwcursor) VIAShowCursor(pScrn); @@ -276,7 +276,7 @@ VIADGASetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) pScrn->displayWidth = pMode->bytesPerScanline / (pMode->bitsPerPixel >> 3); - VIASwitchMode(index, pMode->mode, 0); + pScrn->SwitchMode(index, pMode->mode, 0); } return TRUE; @@ -296,7 +296,7 @@ VIADGASetViewport(ScrnInfoPtr pScrn, int x, int y, int flags) { VIAPtr pVia = VIAPTR(pScrn); - VIAAdjustFrame(pScrn->pScreen->myNum, x, y, flags); + pScrn->AdjustFrame(pScrn->pScreen->myNum, x, y, flags); pVia->DGAViewportStatus = 0; /* MGAAdjustFrame loops until finished */ } diff --git a/src/via_dri.c b/src/via_dri.c index 85de16b..8483f74 100644 --- a/src/via_dri.c +++ b/src/via_dri.c @@ -16,9 +16,9 @@ * 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 + * 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. */ #include "xf86.h" @@ -34,7 +34,7 @@ #include "sarea.h" #include "via_driver.h" -#include "via_common.h" +#include "via_drm.h" #include "via_dri.h" #include "via_id.h" #include "xf86drm.h" @@ -122,7 +122,7 @@ VIADRIRingBufferCleanup(ScrnInfoPtr pScrn) VIADRIPtr pVIADRI = pVia->pDRIInfo->devPrivate; if (pVIADRI->ringBufActive) { - drmViaDmaInit ringBufInit; + drm_via_dma_init_t ringBufInit; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Cleaning up DMA ring-buffer.\n"); @@ -146,7 +146,7 @@ VIADRIRingBufferInit(ScrnInfoPtr pScrn) return TRUE; if (pVia->agpEnable) { - drmViaDmaInit ringBufInit; + drm_via_dma_init_t ringBufInit; drmVersionPtr drmVer; if (NULL == (drmVer = drmGetVersion(pVia->drmFD))) { @@ -264,11 +264,11 @@ static Bool VIADRIAgpInit(ScreenPtr pScreen, VIAPtr pVia) "[drm] agp physical addr = 0x%08lx\n", agp_phys); { - drmViaAgp agp; + drm_via_agp_t agp; agp.offset = 0; agp.size = AGP_SIZE-AGP_CMDBUF_SIZE; if (drmCommandWrite(pVia->drmFD, DRM_VIA_AGP_INIT, &agp, - sizeof(drmViaAgp)) < 0) { + sizeof(drm_via_agp_t)) < 0) { drmUnmap(agpaddr,pVia->agpSize); drmRmMap(pVia->drmFD,pVIADRI->agp.handle); drmAgpUnbind(pVia->drmFD, pVia->agpHandle); @@ -290,12 +290,12 @@ static Bool VIADRIFBInit(ScreenPtr pScreen, VIAPtr pVia) pVIADRI->fbSize = pVia->videoRambytes; { - drmViaFb fb; + drm_via_fb_t fb; fb.offset = FBOffset; fb.size = FBSize; if (drmCommandWrite(pVia->drmFD, DRM_VIA_FB_INIT, &fb, - sizeof(drmViaFb)) < 0) { + sizeof(drm_via_fb_t)) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] failed to init frame buffer area\n"); return FALSE; @@ -545,6 +545,9 @@ Bool VIADRIScreenInit(ScreenPtr pScreen) DRIInfoPtr pDRIInfo; VIADRIPtr pVIADRI; + /* if symbols or version check fails, we still want this to be NULL */ + pVia->pDRIInfo = NULL; + /* Check that the GLX, DRI, and DRM modules have been loaded by testing * for canonical symbols in each module. */ if (!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) return FALSE; @@ -571,11 +574,11 @@ Bool VIADRIScreenInit(ScreenPtr pScreen) } } - pDRIInfo = DRICreateInfoRec(); - - if (!pDRIInfo) return FALSE; + pVia->pDRIInfo = DRICreateInfoRec(); + if (!pVia->pDRIInfo) + return FALSE; - pVia->pDRIInfo = pDRIInfo; + pDRIInfo = pVia->pDRIInfo; pDRIInfo->drmDriverName = VIAKernelDriverName; pDRIInfo->clientDriverName = VIAClientDriverName; pDRIInfo->busIdString = xalloc(64); @@ -586,7 +589,7 @@ Bool VIADRIScreenInit(ScreenPtr pScreen) pDRIInfo->ddxDriverMajorVersion = VIA_DRI_VERSION_MAJOR; pDRIInfo->ddxDriverMinorVersion = VIA_DRI_VERSION_MINOR; pDRIInfo->ddxDriverPatchVersion = PATCHLEVEL; - pDRIInfo->frameBufferPhysicalAddress = pVia->FrameBufferBase; + pDRIInfo->frameBufferPhysicalAddress = (pointer) pVia->FrameBufferBase; pDRIInfo->frameBufferSize = pVia->videoRambytes; pDRIInfo->frameBufferStride = (pScrn->displayWidth * @@ -610,8 +613,9 @@ Bool VIADRIScreenInit(ScreenPtr pScreen) * in the SAREA header */ if (sizeof(XF86DRISAREARec)+sizeof(VIASAREAPriv) > SAREA_MAX) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Data does not fit in SAREA\n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Data does not fit in SAREA\n"); + DRIDestroyInfoRec(pVia->pDRIInfo); + pVia->pDRIInfo = NULL; return FALSE; } pDRIInfo->SAREASize = SAREA_MAX; @@ -619,7 +623,7 @@ Bool VIADRIScreenInit(ScreenPtr pScreen) if (!(pVIADRI = (VIADRIPtr)xcalloc(sizeof(VIADRIRec),1))) { DRIDestroyInfoRec(pVia->pDRIInfo); - pVia->pDRIInfo=0; + pVia->pDRIInfo = NULL; return FALSE; } pDRIInfo->devPrivate = pVIADRI; @@ -637,9 +641,9 @@ Bool VIADRIScreenInit(ScreenPtr pScreen) xf86DrvMsg(pScreen->myNum, X_ERROR, "[dri] DRIScreenInit failed. Disabling DRI.\n"); xfree(pDRIInfo->devPrivate); - pDRIInfo->devPrivate=0; + pDRIInfo->devPrivate = NULL; DRIDestroyInfoRec(pVia->pDRIInfo); - pVia->pDRIInfo=0; + pVia->pDRIInfo = NULL; pVia->drmFD = -1; return FALSE; } @@ -694,10 +698,10 @@ VIADRICloseScreen(ScreenPtr pScreen) if ((pVIADRI = (VIADRIPtr) pVia->pDRIInfo->devPrivate)) { VIADRIIrqExit(pScrn, pVIADRI); xfree(pVIADRI); - pVia->pDRIInfo->devPrivate=0; + pVia->pDRIInfo->devPrivate = NULL; } DRIDestroyInfoRec(pVia->pDRIInfo); - pVia->pDRIInfo=0; + pVia->pDRIInfo = NULL; } if (pVia->pVisualConfigs) { @@ -825,8 +829,8 @@ VIADRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, /* Initialize the kernel data structures. */ static Bool VIADRIKernelInit(ScreenPtr pScreen, VIAPtr pVia) { - drmViaInit drmInfo; - memset(&drmInfo, 0, sizeof(drmViaInit)); + drm_via_init_t drmInfo; + memset(&drmInfo, 0, sizeof(drm_via_init_t)); drmInfo.func = VIA_INIT_MAP; drmInfo.sarea_priv_offset = sizeof(XF86DRISAREARec); drmInfo.fb_offset = pVia->FrameBufferBase; @@ -837,7 +841,7 @@ static Bool VIADRIKernelInit(ScreenPtr pScreen, VIAPtr pVia) drmInfo.agpAddr = (CARD32)pVia->agpAddr; if ((drmCommandWrite(pVia->drmFD, DRM_VIA_MAP_INIT,&drmInfo, - sizeof(drmViaInit))) < 0) + sizeof(drm_via_init_t))) < 0) return FALSE; diff --git a/src/via_dri.h b/src/via_dri.h index 020ea97..c1ac77c 100644 --- a/src/via_dri.h +++ b/src/via_dri.h @@ -16,9 +16,9 @@ * 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 + * 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. */ @@ -27,76 +27,13 @@ #include "drm.h" #include "xf86drm.h" -#include "via_common.h" +#include "via_drm.h" #define VIA_MAX_DRAWABLES 256 #define VIA_DRI_VERSION_MAJOR 4 #define VIA_DRI_VERSION_MINOR 1 -/* - * BEGIN compatibility with the DRM module via_drm.h - * Structures here MUST be the same as used in the drm module. - */ - -#define VIA_NR_SAREA_CLIPRECTS 8 -#define VIA_NR_TEX_REGIONS 64 - -#define VIA_NR_XVMC_PORTS 10 -#define VIA_NR_XVMC_LOCKS 5 -#define VIA_MAX_CACHELINE_SIZE 64 - -#define XVMCLOCKPTR(saPriv,lockNo) \ - ((volatile drmLock *)(((((unsigned long) (saPriv)->XvMCLockArea) + \ - (VIA_MAX_CACHELINE_SIZE - 1)) & \ - ~(VIA_MAX_CACHELINE_SIZE - 1)) + \ - VIA_MAX_CACHELINE_SIZE*(lockNo))) - -/* - * Potentially suspending lock for the decoder hardware. - */ - -#define XVMC_DECODER_FUTEX(saPriv) XVMCLOCKPTR(saPriv,0) - -typedef struct _drm_via_tex_region { - unsigned char next, prev; /* indices to form a circular LRU */ - unsigned char inUse; /* owned by a client, or free? */ - int age; /* tracked by clients to update */ - /*local LRU's */ -} drm_via_tex_region_t; - - -typedef struct _drm_via_sarea { - unsigned int dirty; - unsigned int nbox; - drm_clip_rect_t boxes[VIA_NR_SAREA_CLIPRECTS]; - drm_via_tex_region_t texList[VIA_NR_TEX_REGIONS + 1]; - int texAge; /* last time texture was uploaded */ - int ctxOwner; /* last context to upload state */ - int vertexPrim; - - /* - * Below, common variables for XvMC. - */ - - /* - * We want the lock integers alone on, and aligned to, a cache line. - * Therefore this somewhat strange construct. - */ - - char XvMCLockArea[VIA_MAX_CACHELINE_SIZE * (VIA_NR_XVMC_LOCKS + 1)]; - - unsigned XvMCDisplaying[VIA_NR_XVMC_PORTS]; - unsigned XvMCSubPicOn[VIA_NR_XVMC_PORTS]; - unsigned XvMCCtxNoGrabbed; - -} drm_via_sarea_t; - -/* - * END compatibility region. - */ - - typedef drm_via_sarea_t VIASAREAPriv; typedef struct { diff --git a/src/via_driver.c b/src/via_driver.c index 00bb5a6..fb1653f 100644 --- a/src/via_driver.c +++ b/src/via_driver.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. * @@ -17,9 +17,9 @@ * 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 + * 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. */ @@ -42,6 +42,7 @@ #include "via_video.h" #include "via.h" + #ifdef XF86DRI #include "dri.h" #endif @@ -66,8 +67,8 @@ static Bool VIAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv); static int VIAInternalScreenInit(int scrnIndex, ScreenPtr pScreen); static void VIAFreeScreen(int scrnIndex, int flags); -static ModeStatus VIAValidMode(int index, DisplayModePtr mode, - Bool verbose, int flags); +static Bool VIASwitchMode(int scrnIndex, DisplayModePtr mode, int flags); +static void VIAAdjustFrame(int scrnIndex, int y, int x, int flags); static void VIADPMS(ScrnInfoPtr pScrn, int mode, int flags); static const OptionInfoRec * VIAAvailableOptions(int chipid, int busid); @@ -75,10 +76,6 @@ static Bool VIAMapMMIO(ScrnInfoPtr pScrn); static Bool VIAMapFB(ScrnInfoPtr pScrn); static void VIAUnmapMem(ScrnInfoPtr pScrn); -#ifdef XF86DRI -void VIAInitialize3DEngine(ScrnInfoPtr pScrn); -#endif - DriverRec VIA = { VIA_VERSION, @@ -115,11 +112,11 @@ int gVIAEntityIndex = -1; typedef enum { #ifdef HAVE_DEBUG - OPTION_DUMPVGAROM, OPTION_PRINTVGAREGS, OPTION_PRINTTVREGS, OPTION_I2CSCAN, #endif /* HAVE_DEBUG */ + OPTION_VBEMODES, OPTION_PCI_BURST, OPTION_PCI_RETRY, OPTION_NOACCEL, @@ -137,7 +134,6 @@ typedef enum { OPTION_TVDOTCRAWL, OPTION_TVTYPE, OPTION_TVOUTPUT, - OPTION_TVVSCAN, OPTION_DISABLEVQ, OPTION_DRIXINERAMA, OPTION_DISABLEIRQ, @@ -150,11 +146,11 @@ typedef enum { static OptionInfoRec VIAOptions[] = { #ifdef HAVE_DEBUG /* Don't document these */ - {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_VBEMODES, "VBEModes", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_HWCURSOR, "HWCursor", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_SWCURSOR, "SWCursor", OPTV_BOOLEAN, {0}, FALSE}, @@ -171,7 +167,6 @@ static OptionInfoRec VIAOptions[] = {OPTION_TVDEFLICKER,"TVDeflicker", OPTV_INTEGER, {0}, FALSE}, {OPTION_TVTYPE, "TVType", OPTV_ANYSTR, {0}, FALSE}, {OPTION_TVOUTPUT, "TVOutput", OPTV_ANYSTR, {0}, FALSE}, - {OPTION_TVVSCAN, "TVVScan", OPTV_ANYSTR, {0}, FALSE}, {OPTION_DISABLEVQ, "DisableVQ", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_DRIXINERAMA, "DRIXINERAMA", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_DISABLEIRQ, "DisableIRQ", OPTV_BOOLEAN, {0}, FALSE}, @@ -208,15 +203,29 @@ static const char *ramdacSymbols[] = { }; static const char *vbeSymbols[] = { - "VBEInit", "vbeDoEDID", + "VBEDPMSSet", + "VBEExtendedInit", "vbeFree", + "VBEGetVBEInfo", + "VBEGetVBEMode", + "VBEGetModePool", + "VBEInit", + "VBEPrintModes", + "VBESaveRestore", + "VBESetDisplayStart", + "VBESetGetLogicalScanlineLength", + "VBESetLogicalScanline", + "VBESetModeNames", + "VBESetModeParameters", + "VBESetVBEMode", + "VBEValidateModes", + "xf86ExecX86int10", NULL }; static const char *ddcSymbols[] = { "xf86PrintEDID", - "xf86DoEDID_DDC1", "xf86DoEDID_DDC2", "xf86SetDDCproperties", NULL @@ -374,7 +383,6 @@ static Bool VIAGetRec(ScrnInfoPtr pScrn) pScrn->scrnIndex; ((VIARec *)(pScrn->driverPrivate))->pBIOSInfo->TVI2CDev = NULL; - ((VIARec *)(pScrn->driverPrivate))->FirstInit = TRUE; ((VIARec *)(pScrn->driverPrivate))->CursorImage = NULL; return TRUE; @@ -402,6 +410,7 @@ static void VIAFreeRec(ScrnInfoPtr pScrn) } /* VIAFreeRec */ + static const OptionInfoRec * VIAAvailableOptions(int chipid, int busid) { @@ -445,6 +454,10 @@ static Bool VIAProbe(DriverPtr drv, int flags) if (numUsed <= 0) return FALSE; + xf86Msg(X_NOTICE, "VIA Technologies does not support or endorse this driver in any way.\n"); + xf86Msg(X_NOTICE, "For support, please refer to http://unichrome.sourceforge.net/ or\n"); + xf86Msg(X_NOTICE, "your X vendor.\n"); + if (flags & PROBE_DETECT) { foundScreen = TRUE; } @@ -466,7 +479,7 @@ static Bool VIAProbe(DriverPtr drv, int flags) pScrn->EnterVT = VIAEnterVT; pScrn->LeaveVT = VIALeaveVT; pScrn->FreeScreen = VIAFreeScreen; - pScrn->ValidMode = VIAValidMode; + pScrn->ValidMode = ViaValidMode; foundScreen = TRUE; } /* @@ -520,6 +533,25 @@ static Bool VIAProbe(DriverPtr drv, int flags) } /* VIAProbe */ +#ifdef XF86DRI +static void kickVblank(ScrnInfoPtr pScrn) +{ + /* + * Switching mode will clear registers that make vblank + * interrupts happen. If the driver thinks interrupts + * are enabled, make sure vblank interrupts go through. + * registers are not documented in VIA docs. + */ + + VIAPtr pVia = VIAPTR(pScrn); + vgaHWPtr hwp = VGAHWPTR(pScrn); + VIADRIPtr pVIADRI = pVia->pDRIInfo->devPrivate; + + if (pVIADRI->irqEnabled) { + hwp->writeCrtc(hwp, 0x11, hwp->readCrtc(hwp, 0x11) | 0x30); + } +} +#endif static int LookupChipSet(PciChipsets *pset, int chipSet) { @@ -569,6 +601,7 @@ static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags) char *s = NULL; vgaHWPtr hwp; int i, bMemSize = 0; + Bool UseVBEModes = FALSE; DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAPreInit\n")); @@ -876,6 +909,12 @@ static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags) pVia->dma2d = TRUE; } + if (xf86ReturnOptValBool(VIAOptions, OPTION_VBEMODES, FALSE)) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Option: VBEModes - Using BIOS modes\n"); + UseVBEModes = TRUE; + } + /* ActiveDevice Option for device selection */ pVia->ActiveDevice = 0x00; if ((s = xf86GetOptValString(VIAOptions, OPTION_ACTIVEDEVICE))) { @@ -1017,22 +1056,6 @@ static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags) } } - /* TV Standard Option */ - pBIOSInfo->TVVScan = VIA_TVNORMAL; - if ((s = xf86GetOptValString(VIAOptions, OPTION_TVVSCAN))) { - if (!xf86NameCmp(s, "under")) { - pBIOSInfo->TVVScan = VIA_TVNORMAL; - } - else if (!xf86NameCmp(s, "over")) { - pBIOSInfo->TVVScan = VIA_TVOVER; - } - } - - if (xf86LoadSubModule(pScrn, "vbe")) { - xf86LoaderReqSymLists(vbeSymbols, NULL); - pVia->pVbe = VBEInit(NULL, pVia->EntityIndex); - } - pVia->PciInfo = xf86GetPciInfoForEntity(pEnt->index); xf86RegisterResources(pEnt->index, NULL, ResNone); /* @@ -1121,12 +1144,10 @@ static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags) hwp = VGAHWPTR(pScrn); #ifdef HAVE_DEBUG - if (xf86ReturnOptValBool(VIAOptions, OPTION_DUMPVGAROM, FALSE)) - ViaDumpVGAROM(pScrn); - - if (xf86ReturnOptValBool(VIAOptions, OPTION_PRINTVGAREGS, FALSE)) + if (xf86ReturnOptValBool(VIAOptions, OPTION_PRINTVGAREGS, FALSE)) { pVia->PrintVGARegs = TRUE; - else + ViaVgahwPrint(VGAHWPTR(pScrn)); /* Do this as early as possible */ + } else pVia->PrintVGARegs = FALSE; if (xf86ReturnOptValBool(VIAOptions, OPTION_PRINTTVREGS, FALSE)) @@ -1134,10 +1155,6 @@ static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags) else pVia->PrintTVRegs = FALSE; - /* Do this as early as possible */ - if (pVia->PrintVGARegs) - ViaVgahwPrint(VGAHWPTR(pScrn)); - if (xf86ReturnOptValBool(VIAOptions, OPTION_I2CSCAN, FALSE)) pVia->I2CScan = TRUE; else @@ -1154,9 +1171,11 @@ static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags) /* read memory bandwidth from registers */ pVia->MemClk = hwp->readCrtc(hwp, 0x3D) >> 4; DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Detected MemClk %d\n", pVia->MemClk)); - - ViaVBEPrintBIOSVersion(pScrn); - ViaVBEPrintBIOSDate(pScrn); + if (pVia->MemClk >= VIA_MEM_END) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Unknown Memory clock: %d\n", pVia->MemClk); + pVia->MemClk = VIA_MEM_END - 1; + } + pBIOSInfo->Bandwidth = ViaGetMemoryBandwidth(pScrn); if (pBIOSInfo->TVType == TVTYPE_NONE) { /* use jumper to determine TV Type */ @@ -1231,16 +1250,15 @@ static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags) if (!xf86LoadSubModule(pScrn, "ddc")) { VIAFreeRec(pScrn); return FALSE; - } - else { + } else { xf86LoaderReqSymLists(ddcSymbols, NULL); - if (!(pVia->pVbe && ((pVia->DDC1 = vbeDoEDID(pVia->pVbe, NULL))))) + if (pVia->pI2CBus1) { pVia->DDC1 = xf86DoEDID_DDC2(pScrn->scrnIndex, pVia->pI2CBus1); - - if (pVia->DDC1) { - xf86PrintEDID(pVia->DDC1); - xf86SetDDCproperties(pScrn, pVia->DDC1); + if (pVia->DDC1) { + xf86PrintEDID(pVia->DDC1); + xf86SetDDCproperties(pScrn, pVia->DDC1); + } } } @@ -1251,68 +1269,105 @@ static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } - /* - * Setup the ClockRanges, which describe what clock ranges are available, - * and what sort of modes they can be used for. - */ + if (pBIOSInfo->PanelActive && ((pVia->Chipset == VIA_K8M800) || + (pVia->Chipset == VIA_PM800))) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Panel on K8M800 or PM800 is" + " currently not supported.\n"); + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Using VBE to set modes to" + " work around this.\n"); + UseVBEModes = TRUE; + } - clockRanges = xnfalloc(sizeof(ClockRange)); - clockRanges->next = NULL; - clockRanges->minClock = 20000; - clockRanges->maxClock = 230000; + pVia->pVbe = NULL; + if (UseVBEModes) { + /* VBE doesn't properly initialise int10 itself */ + if (xf86LoadSubModule(pScrn, "int10") && xf86LoadSubModule(pScrn, "vbe")) { + xf86LoaderReqSymLists(vbeSymbols, NULL); + pVia->pVbe = VBEExtendedInit(NULL, pVia->EntityIndex, + SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH); + } - clockRanges->clockIndex = -1; - clockRanges->interlaceAllowed = TRUE; - clockRanges->doubleScanAllowed = FALSE; + if (!pVia->pVbe) + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "VBE initialisation failed." + " Using builtin code to set modes.\n"); + } - /* - * xf86ValidateModes will check that the mode HTotal and VTotal values - * don't exceed the chipset's limit if pScrn->maxHValue and - * pScrn->maxVValue are set. Since our VIAValidMode() already takes - * care of this, we don't worry about setting them here. - * - * CLE266A: - * Max Line Pitch: 4080, (FB corruption when higher, driver problem?) - * Max Height: 4096 (and beyond) - * - * CLE266A: primary AdjustFrame only is able to use 24bits, so we are - * limited to 12x11bits; 4080x2048 (~2:1), 3344x2508 (4:3) or 2896x2896 - * (1:1). - * Test CLE266Cx, KM400, KM400A, K8M800, PM800, CN400 please. - * - * We should be able to limit the memory available for a mode to 32MB, - * yet xf86ValidateModes (or miScanLineWidth) fails to catch this properly - * (apertureSize). - */ + if (pVia->pVbe) { + + if (!ViaVbeModePreInit( pScrn )) { + VIAFreeRec(pScrn); + return FALSE; + } - /* Select valid modes from those available */ - i = xf86ValidateModes(pScrn, - pScrn->monitor->Modes, /* availModes */ - pScrn->display->modes, /* modeNames */ - clockRanges, /* list of clock ranges */ - NULL, /* list of line pitches */ - 256, /* mini line pitch */ - 3344, /* max line pitch */ - 16 * pScrn->bitsPerPixel, /* pitch inc (bits) */ - 128, /* min height */ - 2508, /* max height */ - pScrn->display->virtualX, /* virtual width */ - pScrn->display->virtualY, /* virtual height */ - pVia->videoRambytes, /* apertureSize */ - LOOKUP_BEST_REFRESH); /* lookup mode flags */ - - if (i == -1) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "xf86ValidateModes failure\n"); - VIAFreeRec(pScrn); - return FALSE; - } + } else { + /* Add own Modes */ + ViaModesAttach(pScrn, pScrn->monitor); - xf86PruneDriverModes(pScrn); + /* + * Setup the ClockRanges, which describe what clock ranges are available, + * and what sort of modes they can be used for. + */ + + clockRanges = xnfalloc(sizeof(ClockRange)); + clockRanges->next = NULL; + clockRanges->minClock = 20000; + clockRanges->maxClock = 230000; + + clockRanges->clockIndex = -1; + clockRanges->interlaceAllowed = TRUE; + clockRanges->doubleScanAllowed = FALSE; + + /* + * xf86ValidateModes will check that the mode HTotal and VTotal values + * don't exceed the chipset's limit if pScrn->maxHValue and + * pScrn->maxVValue are set. Since our VIAValidMode() already takes + * care of this, we don't worry about setting them here. + * + * CLE266A: + * Max Line Pitch: 4080, (FB corruption when higher, driver problem?) + * Max Height: 4096 (and beyond) + * + * CLE266A: primary AdjustFrame only is able to use 24bits, so we are + * limited to 12x11bits; 4080x2048 (~2:1), 3344x2508 (4:3) or 2896x2896 + * (1:1). + * Test CLE266Cx, KM400, KM400A, K8M800, PM800, CN400 please. + * + * We should be able to limit the memory available for a mode to 32MB, + * yet xf86ValidateModes (or miScanLineWidth) fails to catch this properly + * (apertureSize). + */ + + /* Select valid modes from those available */ + i = xf86ValidateModes(pScrn, + pScrn->monitor->Modes, /* availModes */ + pScrn->display->modes, /* modeNames */ + clockRanges, /* list of clock ranges */ + NULL, /* list of line pitches */ + 256, /* mini line pitch */ + 3344, /* max line pitch */ + 16 * pScrn->bitsPerPixel, /* pitch inc (bits) */ + 128, /* min height */ + 2508, /* max height */ + pScrn->display->virtualX, /* virtual width */ + pScrn->display->virtualY, /* virtual height */ + pVia->videoRambytes, /* apertureSize */ + LOOKUP_BEST_REFRESH); /* lookup mode flags */ + + + if (i == -1) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "xf86ValidateModes failure\n"); + VIAFreeRec(pScrn); + return FALSE; + } + + xf86PruneDriverModes(pScrn); + + if (i == 0 || pScrn->modes == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); + VIAFreeRec(pScrn); + return FALSE; + } - if (i == 0 || pScrn->modes == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); - VIAFreeRec(pScrn); - return FALSE; } /* Set up screen parameters. */ @@ -1370,11 +1425,16 @@ static Bool VIAEnterVT(int scrnIndex, int flags) /* FIXME: Rebind AGP memory here */ DEBUG(xf86DrvMsg(scrnIndex, X_INFO, "VIAEnterVT\n")); - VIASave(pScrn); + + if (pVia->pVbe) { + ViaVbeSaveRestore(pScrn, MODE_SAVE); + ret = ViaVbeSetMode(pScrn, pScrn->currentMode); + } else { + VIASave(pScrn); + ret = VIAWriteMode(pScrn, pScrn->currentMode); + } vgaHWUnlock(hwp); - ret = VIAWriteMode(pScrn, pScrn->currentMode); - /* Patch for APM suspend resume, HWCursor has garbage */ if (pVia->hwcursor) ViaCursorRestore(pScrn); @@ -1383,15 +1443,15 @@ static Bool VIAEnterVT(int scrnIndex, int flags) if (!pVia->IsSecondary) viaRestoreVideo(pScrn); + #ifdef XF86DRI + kickVblank(pScrn); if (pVia->directRenderingEnabled) { VIADRIRingBufferInit(pScrn); DRIUnlock(screenInfo.screens[scrnIndex]); } #endif - VIAAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); - return ret; } @@ -1411,23 +1471,39 @@ static void VIALeaveVT(int scrnIndex, int flags) VIAAccelSync(pScrn); + #ifdef XF86DRI - if (pVia->directRenderingEnabled) + if (pVia->directRenderingEnabled) { + + /* + * Next line apparently helps fix 3D hang on VT switch. + * No idea why. Taken from VIA's binary drivers. + */ + + hwp->writeSeq(hwp, 0x1A, pVia->SavedReg.SR1A | 0x40); + VIADRIRingBufferCleanup(pScrn); + } #endif - if (pVia->VQEnable) + if (pVia->VQEnable) ViaVQDisable(pScrn); /* Save video status and turn off all video activities */ + if (!pVia->IsSecondary) viaSaveVideo(pScrn); if (pVia->hwcursor) ViaCursorStore(pScrn); - VIARestore(pScrn); + if (pVia->pVbe) + ViaVbeSaveRestore(pScrn, MODE_RESTORE); + else + VIARestore(pScrn); + vgaHWLock(hwp); + } @@ -1682,23 +1758,6 @@ static Bool VIAMapFB(ScrnInfoPtr pScrn) if (pVia->videoRambytes) { - /* - * FIXME: This is a hack to get rid of offending wrongly sized - * MTRR regions set up by the VIA BIOS. Should be taken care of - * in the OS support layer. - */ - - unsigned char *tmp; - tmp = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, - pVia->PciTag, pVia->FrameBufferBase, - pVia->videoRambytes); - xf86UnMapVidMem(pScrn->scrnIndex, (pointer)tmp, - pVia->videoRambytes); - - /* - * End of hack. - */ - pVia->FBBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, pVia->PciTag, pVia->FrameBufferBase, pVia->videoRambytes); @@ -1819,19 +1878,27 @@ VIAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (!VIAMapMMIO(pScrn)) return FALSE; - vgaHWUnlock(hwp); - - VIASave(pScrn); + if (pVia->pVbe) + ViaVbeSaveRestore(pScrn, MODE_SAVE); + else + VIASave(pScrn); - vgaHWBlankScreen(pScrn, FALSE); + vgaHWUnlock(hwp); pVia->FirstInit = TRUE; - - if (!VIAWriteMode(pScrn, pScrn->currentMode)) { - vgaHWBlankScreen(pScrn, TRUE); - return FALSE; + if (pVia->pVbe) { + ViaVbeDoDPMS(pScrn, DPMSModeStandby); + if (!ViaVbeSetMode(pScrn, pScrn->currentMode)) { + ViaVbeDoDPMS(pScrn, DPMSModeOn); + return FALSE; + } + } else { + vgaHWBlankScreen(pScrn, FALSE); + if (!VIAWriteMode(pScrn, pScrn->currentMode)) { + vgaHWBlankScreen(pScrn, TRUE); + return FALSE; + } } - pVia->FirstInit = FALSE; /* Darken the screen for aesthetic reasons and set the viewport */ @@ -1930,30 +1997,8 @@ VIAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } } - if (pVia->shadowFB) { - RefreshAreaFuncPtr refreshArea = VIARefreshArea; - - if(pVia->rotate) { - if (!pVia->PointerMoved) { - pVia->PointerMoved = pScrn->PointerMoved; - pScrn->PointerMoved = VIAPointerMoved; - } - - switch(pScrn->bitsPerPixel) { - case 8: - refreshArea = VIARefreshArea8; - break; - case 16: - refreshArea = VIARefreshArea16; - break; - case 32: - refreshArea = VIARefreshArea32; - break; - } - } - - ShadowFBInit(pScreen, refreshArea); - } + if (pVia->shadowFB) + ViaShadowFBInit(pScrn, pScreen); if (!miCreateDefColormap(pScreen)) return FALSE; @@ -1966,7 +2011,10 @@ VIAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Palette loaded\n")); - vgaHWBlankScreen(pScrn, TRUE); + if (pVia->pVbe) + ViaVbeDoDPMS(pScrn, DPMSModeOn); + else + vgaHWBlankScreen(pScrn, TRUE); pVia->CloseScreen = pScreen->CloseScreen; pScreen->SaveScreen = VIASaveScreen; @@ -1993,12 +2041,6 @@ VIAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) viaInitVideo(pScreen); -#ifdef XF86DRI - pVia->XvMCEnabled = 0; - if (pVia->Chipset == VIA_CLE266) - ViaInitXVMC(pScreen); -#endif - if (serverGeneration == 1) xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); @@ -2007,6 +2049,11 @@ VIAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAScreenInit: Printing VGA registers.\n"); ViaVgahwPrint(VGAHWPTR(pScrn)); } + + if (pVia->PrintTVRegs) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAScreenInit: Printing TV registers.\n"); + ViaTVPrintRegs(pScrn); + } #endif DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Done\n")); @@ -2048,30 +2095,15 @@ static int VIAInternalScreenInit(int scrnIndex, ScreenPtr pScreen) pScrn->yDpi, displayWidth, pScrn->bitsPerPixel); } - -static ModeStatus VIAValidMode(int scrnIndex, DisplayModePtr mode, - Bool verbose, int flags) -{ - DEBUG(xf86DrvMsg(scrnIndex, X_INFO, "VIAValidMode\n")); - - if (!ViaModeInit(xf86Screens[scrnIndex], mode, FALSE)) - return MODE_BAD; - return MODE_OK; -} - static Bool VIAWriteMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { VIAPtr pVia = VIAPTR(pScrn); - vgaHWPtr hwp = VGAHWPTR(pScrn); DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAWriteMode\n")); pVia->OverlaySupported = FALSE; - if (!ViaModeInit(pScrn, mode, TRUE)) - return FALSE; - if (!vgaHWInit(pScrn, mode)) return FALSE; @@ -2091,15 +2123,6 @@ VIAWriteMode(ScrnInfoPtr pScrn, DisplayModePtr mode) VIAInitialize3DEngine(pScrn); #endif - /* Save MCLK value*/ - pVia->swov.Save_3C4_16 = hwp->readSeq(hwp, 0x16); - pVia->swov.Save_3C4_17 = hwp->readSeq(hwp, 0x17); - pVia->swov.Save_3C4_18 = hwp->readSeq(hwp, 0x18); - - DBG_DD(ErrorF("Store 3c4.16 : %08x \n", pVia->swov.Save_3C4_16)); - DBG_DD(ErrorF(" 3c4.17 : %08x \n", pVia->swov.Save_3C4_17)); - DBG_DD(ErrorF(" 3c4.18 : %08x \n", pVia->swov.Save_3C4_18)); - VIAAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); return TRUE; } @@ -2116,17 +2139,24 @@ static Bool VIACloseScreen(int scrnIndex, ScreenPtr pScreen) /* Is the display currently visible ? */ if(pScrn->vtSema) { + +#ifdef XF86DRI + if (pVia->directRenderingEnabled) + DRILock(screenInfo.screens[scrnIndex], 0); +#endif /* Wait Hardware Engine idle to exit graphical mode */ VIAAccelSync(pScrn); - - /* Patch for normal log out and restart X, 3D application will hang */ - VIARestore(pScrn); + + +#ifdef XF86DRI + /* Fix 3D Hang after X restart */ + + if (pVia->directRenderingEnabled) + hwp->writeSeq(hwp, 0x1A, pVia->SavedReg.SR1A | 0x40); +#endif if (!pVia->IsSecondary) { /* Turn off all video activities */ -#ifdef XF86DRI - ViaCleanupXVMC(pScreen); -#endif viaExitVideo(pScrn); VIAHideCursor(pScrn); @@ -2157,8 +2187,12 @@ static Bool VIACloseScreen(int scrnIndex, ScreenPtr pScreen) } if (pScrn->vtSema) { - VIARestore(pScrn); - vgaHWLock(hwp); + if (pVia->pVbe) + ViaVbeSaveRestore(pScrn, MODE_RESTORE); + else + VIARestore(pScrn); + + vgaHWLock(hwp); VIAUnmapMem(pScrn); } pScrn->vtSema = FALSE; @@ -2185,8 +2219,8 @@ static Bool VIASaveScreen(ScreenPtr pScreen, int mode) return vgaHWSaveScreen(pScreen, mode); } - -void VIAAdjustFrame(int scrnIndex, int x, int y, int flags) +static void +VIAAdjustFrame(int scrnIndex, int x, int y, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; vgaHWPtr hwp = VGAHWPTR(pScrn); @@ -2195,6 +2229,11 @@ void VIAAdjustFrame(int scrnIndex, int x, int y, int flags) DEBUG(xf86DrvMsg(scrnIndex, X_INFO, "VIAAdjustFrame\n")); + if (pVia->pVbe) { + ViaVbeAdjustFrame(scrnIndex, x, y, flags); + return; + } + Base = (y * pScrn->displayWidth + x) * (pScrn->bitsPerPixel / 8); /* now program the start address registers */ @@ -2215,40 +2254,12 @@ void VIAAdjustFrame(int scrnIndex, int x, int y, int flags) #endif } - /* Pass Panning (x, y) info to V4L */ - VIAVidAdjustFrame(pScrn, x, y); - - /* Check if HW mpeg engine active */ - 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"); - - ddLock.dwFourCC = FOURCC_YUY2; - - VIAVidLockSurface(pScrn, &ddLock); - - UpdateOverlay.dwFlags = DDOVER_SHOW | DDOVER_KEYDEST; - UpdateOverlay.dwColorSpaceLowValue = VIAGETREG(0x220); - UpdateOverlay.rSrc.left = 0; - UpdateOverlay.rSrc.top = 0; - UpdateOverlay.rSrc.right = 720; - UpdateOverlay.rSrc.bottom = 480; - - UpdateOverlay.rDest.left = (int) ddLock.SWDevice.gdwSWDstLeft; - UpdateOverlay.rDest.top = (int) ddLock.SWDevice.gdwSWDstTop; - UpdateOverlay.rDest.right = UpdateOverlay.rDest.left + ddLock.SWDevice.gdwSWDstWidth; - UpdateOverlay.rDest.bottom = UpdateOverlay.rDest.top + ddLock.SWDevice.gdwSWDstHeight; - - VIAVidUpdateOverlay(pScrn, &UpdateOverlay); - } + VIAVidAdjustFrame(pScrn, x, y); } -Bool VIASwitchMode(int scrnIndex, DisplayModePtr mode, int flags) +static Bool +VIASwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; VIAPtr pVia = VIAPTR(pScrn); @@ -2271,18 +2282,23 @@ Bool VIASwitchMode(int scrnIndex, DisplayModePtr mode, int flags) if (pVia->VQEnable) ViaVQDisable(pScrn); - ret = VIAWriteMode(pScrn, mode); + if (pVia->pVbe) + ret = ViaVbeSetMode(pScrn, mode); + else + ret = VIAWriteMode(pScrn, mode); #ifdef XF86DRI + kickVblank(pScrn); if (pVia->directRenderingEnabled) { - VIADRIRingBufferInit(pScrn); - DRIUnlock(screenInfo.screens[scrnIndex]); + VIADRIRingBufferInit(pScrn); + DRIUnlock(screenInfo.screens[scrnIndex]); } #endif return ret; } + static void VIADPMS(ScrnInfoPtr pScrn, int mode, int flags) { vgaHWPtr hwp = VGAHWPTR(pScrn); @@ -2290,6 +2306,11 @@ static void VIADPMS(ScrnInfoPtr pScrn, int mode, int flags) VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; CARD8 val; + if (pVia->pVbe) { + ViaVbeDPMS(pScrn, mode, flags); + return; + } + /* Clear DPMS setting */ val = hwp->readCrtc(hwp, 0x36); val &= 0xCF; @@ -2334,6 +2355,12 @@ VIAInitialize3DEngine(ScrnInfoPtr pScrn) VIAPtr pVia = VIAPTR(pScrn); int i; + /* + * FIXME: Reinitializing the 3D engine after VT switch seems to be the way + * to go to avoid hangs and rendering errors. But what happens with secondary? + * Test this for a while, but keep the old code in case... + */ + if (!pVia->sharedData->b3DRegsInitialized) { @@ -2403,7 +2430,7 @@ VIAInitialize3DEngine(ScrnInfoPtr pScrn) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "3D Engine has been initialized.\n"); } - + VIASETREG(0x43C,0x00fe0000); VIASETREG(0x440,0x08000001); VIASETREG(0x440,0x0A000183); diff --git a/src/via_driver.h b/src/via_driver.h index fcddeb1..947fcd3 100644 --- a/src/via_driver.h +++ b/src/via_driver.h @@ -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. * @@ -17,9 +17,9 @@ * 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 + * 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. */ @@ -67,7 +67,7 @@ #define DRIVER_NAME "via" #define VERSION_MAJOR 0 #define VERSION_MINOR 1 -#define PATCHLEVEL 30 +#define PATCHLEVEL 31 #define VIA_VERSION ((VERSION_MAJOR<<24) | (VERSION_MINOR<<16) | PATCHLEVEL) #define VIA_MAX_ACCEL_X (2047) @@ -143,6 +143,15 @@ typedef struct{ int status; } ViaCBuffer; +typedef struct{ + /* textMode */ + CARD8 *state, *pstate; /* SVGA state */ + int statePage, stateSize, stateMode; + + /* vbe version */ + int major, minor; +} ViaVbeModeInfo; + typedef struct _VIA { VIARegRec SavedReg; xf86CursorInfoPtr CursorInfoRec; @@ -191,9 +200,12 @@ typedef struct _VIA { int Chipset; int ChipId; int ChipRev; - vbeInfoPtr pVbe; int EntityIndex; + /* vbe */ + vbeInfoPtr pVbe; + ViaVbeModeInfo vbeMode; + /* Support for shadowFB and rotation */ unsigned char* ShadowPtr; int ShadowPitch; @@ -306,8 +318,9 @@ typedef struct } VIAEntRec, *VIAEntPtr; /* Prototypes. */ -void VIAAdjustFrame(int scrnIndex, int y, int x, int flags); -Bool VIASwitchMode(int scrnIndex, DisplayModePtr mode, int flags); +#ifdef XF86DRI +void VIAInitialize3DEngine(ScrnInfoPtr pScrn); +#endif /* In via_cursor.c. */ Bool VIAHWCursorInit(ScreenPtr pScreen); @@ -323,12 +336,7 @@ void VIAAccelSync(ScrnInfoPtr); void ViaVQDisable(ScrnInfoPtr pScrn); /* In via_shadow.c */ -void VIAPointerMoved(int index, int x, int y); -void VIARefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); -void VIARefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox); -void VIARefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox); -void VIARefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox); -void VIARefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void ViaShadowFBInit(ScrnInfoPtr pScrn, ScreenPtr pScreen); /* In via_dga.c */ Bool VIADGAInit(ScreenPtr); @@ -336,55 +344,11 @@ Bool VIADGAInit(ScreenPtr); /*In via_video.c*/ void viaInitVideo(ScreenPtr pScreen); void viaExitVideo(ScrnInfoPtr pScrn); -void viaResetVideo(ScrnInfoPtr pScrn); void viaSaveVideo(ScrnInfoPtr pScrn); void viaRestoreVideo(ScrnInfoPtr pScrn); -void viaStopSWOVerlay(ScrnInfoPtr pScrn); -int viaGetPortAttributeG(ScrnInfoPtr, Atom ,INT32 *, pointer); -int viaSetPortAttributeG(ScrnInfoPtr, Atom, INT32, pointer); -int viaPutImageG( ScrnInfoPtr, short, short, short, short, short, short, - short, short,int, unsigned char*, short, short, Bool, - RegionPtr, pointer); void viaSetColorSpace(VIAPtr pVia, int hue, int saturation, int brightness, int contrast, Bool reset); - -/* in via_overlay.c */ - -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); - - +void VIAVidAdjustFrame(ScrnInfoPtr pScrn, int x, int y); /* In via_memory.c */ void VIAFreeLinear(VIAMemPtr); @@ -395,18 +359,14 @@ void VIAInitLinear(ScreenPtr pScreen); #ifdef XF86DRI /* Basic init and exit functions */ -void ViaInitXVMC(ScreenPtr); -void ViaCleanupXVMC(ScreenPtr); +void ViaInitXVMC(ScreenPtr pScreen); +void ViaCleanupXVMC(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr *XvAdaptors, int XvAdaptorCount); +int viaXvMCInitXv(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr XvAdapt); + /* Returns the size of the fake Xv Image used as XvMC command buffer to the X server*/ unsigned long viaXvMCPutImageSize(ScrnInfoPtr pScrn); -int viaXvMCInterceptXvAttribute(ScrnInfoPtr pScrn, Atom attribute, - INT32 value,pointer data); -int viaXvMCInitXv(ScrnInfoPtr pScrn, pointer data); -int viaXvMCInterceptPutImage( ScrnInfoPtr, short, short, short, short, short, - short, short, short,int, unsigned char*, short, - short, Bool, RegionPtr, pointer); -int viaXvMCInterceptXvGetAttribute(ScrnInfoPtr pScrn, Atom attribute, - INT32 *value,pointer data); + + #endif diff --git a/src/via_drmclient.h b/src/via_drmclient.h new file mode 100644 index 0000000..9a869de --- /dev/null +++ b/src/via_drmclient.h @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2005 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"), + * 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 + * THE AUTHOR(S) OR COPYRIGHT HOLDER(S) 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_DRMCLIENT_H +#define _VIA_DRMCLIENT_H + +#include "drm.h" +#include "xf86drm.h" + +typedef CARD32 uint32_t; + +#define UNICHROME_LOCK(fd, lockNo, saPriv, context, lastcontext, ret) \ + do { \ + volatile drm_hw_lock_t *lockPtr = XVMCLOCKPTR((saPriv), (lockNo)); \ + unsigned lockVal; \ + DRM_CAS_RESULT(__ret); \ + \ + ret = 0; \ + lockVal = lockPtr->lock & ~(DRM_LOCK_HELD | DRM_LOCK_CONT); \ + DRM_CAS(lockPtr, lockVal, (context) | DRM_LOCK_HELD, __ret); \ + if (__ret) { \ + drm_via_futex_t fx; \ + \ + lockVal = lockPtr->lock; \ + if (! (lockVal & DRM_LOCK_HELD)) continue; \ + if ((lockVal & ~(DRM_LOCK_HELD | DRM_LOCK_CONT) ) \ + == (context)) { \ + lastcontext = lockVal & ~(DRM_LOCK_HELD | DRM_LOCK_CONT); \ + break; \ + } \ + fx.val = lockVal | DRM_LOCK_CONT; \ + DRM_CAS( lockPtr, lockVal, fx.val, __ret); \ + lockVal = lockPtr->lock; \ + if (__ret) continue; \ + fx.func = VIA_FUTEX_WAIT; \ + fx.lock = (lockNo); \ + fx.ms = 10; \ + ret = drmCommandWrite((fd), DRM_VIA_DEC_FUTEX, \ + &fx,sizeof(fx)); \ + lastcontext = lockVal; \ + if (ret) break; \ + continue; \ + } else { \ + lastcontext = lockVal; \ + break; \ + } \ + } while (1) \ + +#define UNICHROME_UNLOCK(fd, lockNo, saPriv, context) \ + do { \ + volatile drm_hw_lock_t *lockPtr = XVMCLOCKPTR((saPriv), (lockNo)); \ + \ + if ((lockPtr->lock & ~DRM_LOCK_CONT) == \ + ((context) | DRM_LOCK_HELD)) { \ + DRM_CAS_RESULT(__ret); \ + DRM_CAS(lockPtr,(context) | DRM_LOCK_HELD, context, __ret); \ + if (__ret) { \ + drm_via_futex_t fx; \ + fx.func = VIA_FUTEX_WAKE; \ + fx.lock = lockNo; \ + DRM_CAS(lockPtr, (context) | DRM_LOCK_HELD | \ + DRM_LOCK_CONT, \ + context, __ret); \ + drmCommandWrite((fd), DRM_VIA_DEC_FUTEX, &fx, \ + sizeof(fx)); \ + } \ + } \ + } while (0) \ + +#define UNICHROME_LOCK_DECODER1 0 +#define UNICHROME_LOCK_DECODER2 1 +#define UNICHROME_LOCK_HQV 4 + +#endif diff --git a/src/via_i2c.c b/src/via_i2c.c index 571e34c..c6a87f5 100644 --- a/src/via_i2c.c +++ b/src/via_i2c.c @@ -17,9 +17,9 @@ * 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 + * 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. */ /* diff --git a/src/via_id.c b/src/via_id.c index 22fad69..229186b 100644 --- a/src/via_id.c +++ b/src/via_id.c @@ -33,11 +33,6 @@ */ /* - * 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. - * - */ -/* * Known missing devices: * cle266: * Biostar M6VLQ Grand @@ -87,7 +82,12 @@ * Soyo SY-P4VM800 * */ -struct ViaCardIdStruct ViaCardId[] = { +/* + * 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. + * + */ +static struct ViaCardIdStruct ViaCardId[] = { /* CLE266 */ {"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}, @@ -116,11 +116,15 @@ struct ViaCardIdStruct ViaCardId[] = { {"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 K8M Neo-V", VIA_K8M800, 0x1462, 0x0320, VIA_DEVICE_CRT}, {"MSI K8MM-ILSR", VIA_K8M800, 0x1462, 0x7410, VIA_DEVICE_CRT}, + {"Abit KV-80", VIA_K8M800, 0x147B, 0x1419, VIA_DEVICE_CRT}, + {"Averatec 54xx", VIA_K8M800, 0x1509, 0x3930, VIA_DEVICE_CRT | VIA_DEVICE_LCD}, {"Biostar K8VGA-M", VIA_K8M800, 0x1565, 0x1203, VIA_DEVICE_CRT}, /* PM800 */ - {"Biostar P4VMA-M", VIA_PM800, 0x1565, 0x1202, VIA_DEVICE_CRT}, {"ECS PM800-M2", VIA_PM800, 0x1106, 0x3118, VIA_DEVICE_CRT}, /* VIA/PM800 */ + {"Biostar P4VMA-M", VIA_PM800, 0x1565, 0x1202, VIA_DEVICE_CRT}, + {"Fujitsu/Siemens Amilo Pro V2010", VIA_PM800, 0x1734, 0x1078, VIA_DEVICE_CRT | VIA_DEVICE_LCD | VIA_DEVICE_TV}, /* keep this */ {NULL, VIA_UNKNOWN, 0x0000, 0x0000, VIA_DEVICE_NONE} }; diff --git a/src/via_id.h b/src/via_id.h index 61ee771..65ee15f 100644 --- a/src/via_id.h +++ b/src/via_id.h @@ -28,10 +28,10 @@ * K8M800 and PM800/PM880/CN400 are currently untested * and support is disabled. */ -/* + #define HAVE_K8M800 #define HAVE_PM800 -*/ + /* Chip tags. These are used to group the adapters into * related families. diff --git a/src/via_memcpy.c b/src/via_memcpy.c index b2dd39f..c74621f 100644 --- a/src/via_memcpy.c +++ b/src/via_memcpy.c @@ -15,9 +15,9 @@ * 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 - * THE CODE SUPPLIER(S) 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 + * 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. */ @@ -474,12 +474,12 @@ typedef struct { char *mName,**cpuFlag; } McFuncData; -char *libc_cpuflags[] = {" ",0}; -char *kernel_cpuflags[] = {" ",0}; -char *sse_cpuflags[] = {" sse ",0}; -char *mmx_cpuflags[] = {" mmx ",0}; -char *now_cpuflags[] = {" 3dnow ",0}; -char *mmx2_cpuflags[] = {" mmxext ", " sse ",0}; +static char *libc_cpuflags[] = {" ",0}; +static char *kernel_cpuflags[] = {" ",0}; +static char *sse_cpuflags[] = {" sse ",0}; +static char *mmx_cpuflags[] = {" mmx ",0}; +static char *now_cpuflags[] = {" 3dnow ",0}; +static char *mmx2_cpuflags[] = {" mmxext ", " sse ",0}; static McFuncData mcFunctions[totNum] = {{libc_YUV42X,"libc",libc_cpuflags}, diff --git a/src/via_memcpy.h b/src/via_memcpy.h index 338bd6d..bc908e4 100644 --- a/src/via_memcpy.h +++ b/src/via_memcpy.h @@ -15,9 +15,9 @@ * 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 - * THE CODE 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 + * 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_MEMCPY_H_ diff --git a/src/via_memory.c b/src/via_memory.c index ded7a23..aa670c8 100644 --- a/src/via_memory.c +++ b/src/via_memory.c @@ -15,9 +15,9 @@ * 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 + * 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. */ @@ -31,13 +31,11 @@ #include "xf86drm.h" #endif -#include "via_overlay.h" #include "via_driver.h" -#include "via_regrec.h" #include "via_priv.h" #include "via_swov.h" #ifdef XF86DRI -#include "via_common.h" +#include "via_drm.h" #endif /* @@ -64,7 +62,7 @@ void VIAFreeLinear(VIAMemPtr mem) case 2: #ifdef XF86DRI if(drmCommandWrite(mem->drm_fd, DRM_VIA_FREEMEM, - &mem->drm, sizeof(drmViaMem)) < 0) + &mem->drm, sizeof(drm_via_mem_t)) < 0) ErrorF("DRM module failed free.\n"); #endif mem->pool = 0; @@ -110,7 +108,7 @@ unsigned long VIAAllocLinear(VIAMemPtr mem, ScrnInfoPtr pScrn, unsigned long siz mem->drm.size = size; mem->drm.type = VIDEO; ret = drmCommandWrite(mem->drm_fd, DRM_VIA_ALLOCMEM, &mem->drm, - sizeof(drmViaMem)); + sizeof(drm_via_mem_t)); if (ret || (size != mem->drm.size)) { /* * Try XY Fallback before failing. diff --git a/src/via_mode.c b/src/via_mode.c index 5446b91..d300ed7 100644 --- a/src/via_mode.c +++ b/src/via_mode.c @@ -17,9 +17,9 @@ * 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 + * 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. */ @@ -67,6 +67,8 @@ ViaTVDetect(ScrnInfoPtr pScrn) pBIOSInfo->TVModeI2C = NULL; pBIOSInfo->TVModeCrtc = NULL; pBIOSInfo->TVPower = NULL; + pBIOSInfo->TVModes = NULL; + pBIOSInfo->TVPrintRegs = NULL; if (pVia->pI2CBus2 && xf86I2CProbeAddress(pVia->pI2CBus2, 0x40)) pBIOSInfo->TVI2CDev = ViaVT162xDetect(pScrn, pVia->pI2CBus2, 0x40); @@ -102,7 +104,8 @@ ViaTVInit(ScrnInfoPtr pScrn) if (!pBIOSInfo->TVSave || !pBIOSInfo->TVRestore || !pBIOSInfo->TVDACSense || !pBIOSInfo->TVModeValid || !pBIOSInfo->TVModeI2C || !pBIOSInfo->TVModeCrtc || - !pBIOSInfo->TVPower) { + !pBIOSInfo->TVPower || !pBIOSInfo->TVModes || + !pBIOSInfo->TVPrintRegs) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ViaTVInit: TVEncoder was not " "properly initialised."); @@ -119,9 +122,20 @@ ViaTVInit(ScrnInfoPtr pScrn) pBIOSInfo->TVModeI2C = NULL; pBIOSInfo->TVModeCrtc = NULL; pBIOSInfo->TVPower = NULL; + pBIOSInfo->TVModes = NULL; + pBIOSInfo->TVPrintRegs = NULL; return FALSE; } + + /* Save now */ + pBIOSInfo->TVSave(pScrn); + +#ifdef HAVE_DEBUG + if (VIAPTR(pScrn)->PrintTVRegs) + pBIOSInfo->TVPrintRegs(pScrn); +#endif + return TRUE; } @@ -154,15 +168,15 @@ ViaTVDACSense(ScrnInfoPtr pScrn) } static void -ViaTVSetMode(ScrnInfoPtr pScrn) +ViaTVSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; if (pBIOSInfo->TVModeI2C) - pBIOSInfo->TVModeI2C(pScrn); + pBIOSInfo->TVModeI2C(pScrn, mode); if (pBIOSInfo->TVModeCrtc) - pBIOSInfo->TVModeCrtc(pScrn); + pBIOSInfo->TVModeCrtc(pScrn, mode); } void @@ -181,49 +195,28 @@ ViaTVPower(ScrnInfoPtr pScrn, Bool On) pBIOSInfo->TVPower(pScrn, On); } +#ifdef HAVE_DEBUG +void +ViaTVPrintRegs(ScrnInfoPtr pScrn) +{ + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; + + if (pBIOSInfo->TVPrintRegs) + pBIOSInfo->TVPrintRegs(pScrn); +} +#endif /* HAVE_DEBUG */ + /* * */ -static Bool -ViaTVGetIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) +static ModeStatus +ViaTVModeValid(ScrnInfoPtr pScrn, DisplayModePtr mode) { VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; - int i; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaTVGetIndex\n")); - pBIOSInfo->TVIndex = VIA_TVRES_INVALID; - - if (pBIOSInfo->Refresh != 60){ - xf86DrvMsg(pBIOSInfo->scrnIndex, X_INFO, "ViaTVGetIndex:" - " TV requires 60Hz refresh rate.\n"); - return FALSE; - } - - /* 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; - } - - 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; + if (pBIOSInfo->TVModeValid) + return pBIOSInfo->TVModeValid(pScrn, mode); + return MODE_OK; } /* @@ -237,6 +230,9 @@ ViaOutputsDetect(ScrnInfoPtr pScrn) DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaOutputsDetect\n")); + pBIOSInfo->CrtPresent = FALSE; + pBIOSInfo->PanelPresent = FALSE; + /* Panel */ if (pBIOSInfo->ForcePanel) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Enabling panel from config.\n"); @@ -315,8 +311,6 @@ ViaOutputsSelect(ScrnInfoPtr pScrn) 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))); pBIOSInfo->PanelActive = FALSE; pBIOSInfo->CrtActive = FALSE; @@ -512,6 +506,8 @@ VIAGetPanelSize(ScrnInfoPtr pScrn) vgaHWPtr hwp = VGAHWPTR(pScrn); VIAPtr pVia = VIAPTR(pScrn); VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; + char *PanelSizeString[7] = {"640x480", "800x600", "1024x768", "1280x768" + "1280x1024", "1400x1050", "1600x1200"}; int size = 0; Bool ret; @@ -543,7 +539,7 @@ VIAGetPanelSize(ScrnInfoPtr pScrn) break; default: pBIOSInfo->PanelSize = VIA_PANEL_INVALID; - break; + break; } } else { pBIOSInfo->PanelSize = hwp->readCrtc(hwp, 0x3F) >> 4; @@ -552,11 +548,16 @@ VIAGetPanelSize(ScrnInfoPtr pScrn) xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Unable to " "retrieve PanelSize: using default (1024x768)\n"); pBIOSInfo->PanelSize = VIA_PANEL10X7; + return; } } - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PanelSize = %d\n", - pBIOSInfo->PanelSize)); + + if (pBIOSInfo->PanelSize < 7) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using panel at %s.\n", + PanelSizeString[pBIOSInfo->PanelSize]); + else + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Unknown panel size " + "detected: %d.\n", pBIOSInfo->PanelSize); } /* @@ -589,30 +590,6 @@ ViaGetResolutionIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) /* * */ -static Bool -ViaGetModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) -{ - VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; - int i; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaGetModeIndex\n")); - - 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)); - return TRUE; - } - pBIOSInfo->ModeIndex = -1; - return FALSE; -} - -/* - * - */ static int ViaGetVesaMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { @@ -636,10 +613,9 @@ ViaGetVesaMode(ScrnInfoPtr pScrn, DisplayModePtr mode) return 0xFFFF; } - /* * - * ViaModeIndexTable[i].PanelIndex is pBIOSInfo->PanelSize + * ViaResolutionTable[i].PanelIndex is pBIOSInfo->PanelSize * pBIOSInfo->PanelIndex is the index to lcdTable. * */ @@ -649,7 +625,6 @@ ViaPanelGetIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; int i; - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaPanelGetIndex\n")); pBIOSInfo->PanelIndex = VIA_BIOS_NUM_PANEL; @@ -657,14 +632,22 @@ ViaPanelGetIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) if (pBIOSInfo->PanelSize == VIA_PANEL_INVALID) { VIAGetPanelSize(pScrn); if (pBIOSInfo->PanelSize == VIA_PANEL_INVALID) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ViaPanelGetIndex: PanelSize not set.\n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ViaPanelGetIndex:" + " PanelSize not set.\n"); return FALSE; } } - if (pBIOSInfo->Refresh != 60){ + if ((mode->PrivSize != sizeof(struct ViaModePriv)) || + (mode->Private != (void *)&ViaPanelPrivate)){ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaPanelGetIndex:" - " Panel requires 60Hz refresh rate.\n"); + " Mode not supported by Panel.\n"); + return FALSE; + } + + if (!ViaGetResolutionIndex(pScrn, mode)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel does not support this" + " resolution: %s\n", mode->name); return FALSE; } @@ -676,11 +659,17 @@ ViaPanelGetIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) } if (ViaResolutionTable[i].Index == VIA_RES_INVALID) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ViaPanelGetIndex: Unable" + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaPanelGetIndex: Unable" " to find matching PanelSize in ViaResolutionTable.\n"); return FALSE; } + if ((pBIOSInfo->panelX != mode->CrtcHDisplay) || + (pBIOSInfo->panelY != mode->CrtcVDisplay)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaPanelGetIndex: Non-native" + "resolutions are broken.\n"); + return FALSE; + } for (i = 0; i < VIA_BIOS_NUM_PANEL; i++) if (lcdTable[i].fpSize == pBIOSInfo->PanelSize) { @@ -707,125 +696,280 @@ ViaPanelGetIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) return FALSE; } - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ViaPanelGetIndex: Unable" + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaPanelGetIndex: Unable" " to match PanelSize with an lcdTable entry.\n"); return FALSE; } /* - * + * Stolen from xf86Config.c's addDefaultModes */ static void -ViaGetNearestRefresh(ScrnInfoPtr pScrn, DisplayModePtr mode) +ViaModesAttachHelper(ScrnInfoPtr pScrn, MonPtr monitorp, DisplayModePtr Modes) +{ + DisplayModePtr mode; + DisplayModePtr last = monitorp->Last; + int i; + + for (i = 0; Modes[i].name; i++) { + mode = xnfalloc(sizeof(DisplayModeRec)); + memcpy(mode, &Modes[i], sizeof(DisplayModeRec)); + mode->name = xnfstrdup(Modes[i].name); + if (last) { + mode->prev = last; + last->next = mode; + } else { /* this is the first mode */ + monitorp->Modes = mode; + mode->prev = NULL; + } + last = mode; + } + monitorp->Last = last; +} + +/* + * + */ +void +ViaModesAttach(ScrnInfoPtr pScrn, MonPtr monitorp) { VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; - int refresh, i; - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaGetNearestRefresh\n")); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaModesAttach\n")); - refresh = (mode->VRefresh + 0.5); - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaGetNearestRefresh: " - "preferred: %d\n", refresh)); - - /* get closest matching refresh index */ - if (refresh < supportRef[0]) - pBIOSInfo->Refresh = supportRef[0]; - else { - for (i = 0; (i < VIA_NUM_REFRESH_RATE) && (refresh >= supportRef[i]); i++) - ; - pBIOSInfo->Refresh = supportRef[i - 1]; + if (pBIOSInfo->PanelActive) + ViaModesAttachHelper(pScrn, monitorp, ViaPanelModes); + if (pBIOSInfo->TVActive && pBIOSInfo->TVModes) + ViaModesAttachHelper(pScrn, monitorp, pBIOSInfo->TVModes); +} + +/* + * + */ +CARD32 +ViaGetMemoryBandwidth(ScrnInfoPtr pScrn) +{ + VIAPtr pVia = VIAPTR(pScrn); + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaGetMemoryBandwidth\n")); + + switch (pVia->Chipset) { + case VIA_CLE266: + if (CLE266_REV_IS_AX(pVia->ChipRev)) + return ViaBandwidthTable[VIA_BW_CLE266A].Bandwidth[pVia->MemClk]; + else + return ViaBandwidthTable[VIA_BW_CLE266C].Bandwidth[pVia->MemClk]; + case VIA_KM400: + if (pVia->ChipRev < 0x8F) + return ViaBandwidthTable[VIA_BW_KM400].Bandwidth[pVia->MemClk]; + else + return ViaBandwidthTable[VIA_BW_KM400A].Bandwidth[pVia->MemClk]; + case VIA_K8M800: + return ViaBandwidthTable[VIA_BW_K8M800].Bandwidth[pVia->MemClk]; + case VIA_PM800: + return ViaBandwidthTable[VIA_BW_PM800].Bandwidth[pVia->MemClk]; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ViaBandwidthAllowed: Unknown Chipset.\n"); + return VIA_BW_MIN; + } +} + +/* + * Checks for limitations imposed by the available VGA timing registers. + * + */ +static ModeStatus +ViaModePrimaryVGAValid(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaModePrimaryVGAValid\n")); + + if (mode->CrtcHTotal > 4100) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHTotal out of range.\n"); + return MODE_BAD_HVALUE; + } + + if (mode->CrtcHDisplay > 2048) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHDisplay out of range.\n"); + return MODE_BAD_HVALUE; + } + + if (mode->CrtcHBlankStart > 2048) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHBlankStart out of range.\n"); + return MODE_BAD_HVALUE; + } + + if ((mode->CrtcHBlankEnd - mode->CrtcHBlankStart) > 1025) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHBlankEnd out of range.\n"); + return MODE_HBLANK_WIDE; + } + + if (mode->CrtcHSyncStart > 4095) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHSyncStart out of range.\n"); + return MODE_BAD_HVALUE; + } + + if ((mode->CrtcHSyncEnd - mode->CrtcHSyncStart) > 256) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHSyncEnd out of range.\n"); + return MODE_HSYNC_WIDE; + } + + if (mode->CrtcVTotal > 2049) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVTotal out of range.\n"); + return MODE_BAD_VVALUE; + } + + if (mode->CrtcVDisplay > 2048) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVDisplay out of range.\n"); + return MODE_BAD_VVALUE; + } + + if (mode->CrtcVSyncStart > 2047) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVSyncStart out of range.\n"); + return MODE_BAD_VVALUE; + } + + if ((mode->CrtcVSyncEnd - mode->CrtcVSyncStart) > 16) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVSyncEnd out of range.\n"); + return MODE_VSYNC_WIDE; + } + + if (mode->CrtcVBlankStart > 2048) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVBlankStart out of range.\n"); + return MODE_BAD_VVALUE; } - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaGetNearestRefresh: " - "Refresh: %d\n", pBIOSInfo->Refresh)); + if ((mode->CrtcVBlankEnd - mode->CrtcVBlankStart) > 257) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVBlankEnd out of range.\n"); + return MODE_VBLANK_WIDE; + } + + return MODE_OK; } /* * */ -static Bool -ViaRefreshAllowed(ScrnInfoPtr pScrn, DisplayModePtr mode) +static ModeStatus +ViaModeSecondaryVGAValid(ScrnInfoPtr pScrn, DisplayModePtr mode) { - VIAPtr pVia = VIAPTR(pScrn); - VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - int i; + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaModeSecondaryVGAValid\n")); - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaRefreshAllowed\n")); + if (mode->CrtcHTotal > 4096) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHTotal out of range.\n"); + return MODE_BAD_HVALUE; + } - 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; - } - } + if (mode->CrtcHDisplay > 2048) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHDisplay out of range.\n"); + return MODE_BAD_HVALUE; } - return FALSE; + + if (mode->CrtcHBlankStart > 2048) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHBlankStart out of range.\n"); + return MODE_BAD_HVALUE; + } + + if (mode->CrtcHBlankEnd > 4096) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHBlankEnd out of range.\n"); + return MODE_HBLANK_WIDE; + } + + if (mode->CrtcHSyncStart > 2047) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHSyncStart out of range.\n"); + return MODE_BAD_HVALUE; + } + + if ((mode->CrtcHSyncEnd - mode->CrtcHSyncStart) > 512) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHSyncEnd out of range.\n"); + return MODE_HSYNC_WIDE; + } + + if (mode->CrtcVTotal > 2048) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVTotal out of range.\n"); + return MODE_BAD_VVALUE; + } + + if (mode->CrtcVDisplay > 2048) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVDisplay out of range.\n"); + return MODE_BAD_VVALUE; + } + + if (mode->CrtcVBlankStart > 2048) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVBlankStart out of range.\n"); + return MODE_BAD_VVALUE; + } + + if (mode->CrtcVBlankEnd > 2048) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVBlankEnd out of range.\n"); + return MODE_VBLANK_WIDE; + } + + if (mode->CrtcVSyncStart > 2047) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVSyncStart out of range.\n"); + return MODE_BAD_VVALUE; + } + + if ((mode->CrtcVSyncEnd - mode->CrtcVSyncStart) > 32) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVSyncEnd out of range.\n"); + return MODE_VSYNC_WIDE; + } + + return MODE_OK; } + +static CARD32 ViaModeDotClockTranslate(ScrnInfoPtr pScrn, DisplayModePtr mode); + /* * */ -Bool -ViaModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool Final) +ModeStatus +ViaValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; VIAPtr pVia = VIAPTR(pScrn); VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - int level; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaModeInit\n")); + ModeStatus ret; + CARD32 temp; - if (Final) - level = X_ERROR; - else - level = X_INFO; + if (pVia->pVbe) + return MODE_OK; - ViaGetNearestRefresh(pScrn, mode); - 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; - } + DEBUG(xf86DrvMsg(scrnIndex, X_INFO, "ViaValidMode: Validating %s (%d)\n", + mode->name, mode->Clock)); - if (!ViaGetModeIndex(pScrn, mode) || !ViaGetResolutionIndex(pScrn, mode)) { - xf86DrvMsg(pScrn->scrnIndex, level, "Mode \"%s\" not supported by driver.\n", - mode->name); - return FALSE; - } + if (mode->Flags & V_INTERLACE) + return MODE_NO_INTERLACE; + + if (pVia->IsSecondary) + ret = ViaModeSecondaryVGAValid(pScrn, mode); + else + ret = ViaModePrimaryVGAValid(pScrn, mode); + + if (ret != MODE_OK) + return ret; if (pBIOSInfo->TVActive) { - if (!ViaTVGetIndex(pScrn, mode)) { - xf86DrvMsg(pScrn->scrnIndex, level, "Mode \"%s\" not supported by" + ret = ViaTVModeValid(pScrn, mode); + if (ret != MODE_OK) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Mode \"%s\" not supported by" " TV encoder.\n", mode->name); - return FALSE; + return ret; } - } + } else if (pBIOSInfo->PanelActive && !ViaPanelGetIndex(pScrn, mode)) + return MODE_BAD; + else if (!ViaModeDotClockTranslate(pScrn, mode)) + return MODE_NOCLOCK; - if (pBIOSInfo->PanelActive) { - if (!ViaPanelGetIndex(pScrn, mode)) { - xf86DrvMsg(pScrn->scrnIndex, level, "Mode \"%s\" not supported by" - " LCD/DFP.\n", mode->name); - return FALSE; - } + temp = mode->CrtcHDisplay * mode->CrtcVDisplay * mode->VRefresh * + (pScrn->bitsPerPixel >> 3); + if (pBIOSInfo->Bandwidth < temp) { + xf86DrvMsg(scrnIndex, X_INFO, "Required bandwidth is not available. (%u > %u)\n", + (unsigned) temp, (unsigned) pBIOSInfo->Bandwidth); + return MODE_CLOCK_HIGH; /* since there is no MODE_BANDWIDTH */ } - return TRUE; + + return MODE_OK; } /* @@ -836,14 +980,14 @@ ViaModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool Final) /* * Standard vga call really. - * Should be removed now that this is set in ViaModePrimaryVGA + * Needs to be called to reset the dotclock (after SR40:2/1 reset) */ static void -VIASetUseExternalClock(vgaHWPtr hwp) +ViaSetUseExternalClock(vgaHWPtr hwp) { CARD8 data; - DEBUG(xf86DrvMsg(hwp->pScrn->scrnIndex, X_INFO, "VIASetUseExternalClock\n")); + DEBUG(xf86DrvMsg(hwp->pScrn->scrnIndex, X_INFO, "ViaSetUseExternalClock\n")); data = hwp->readMiscOut(hwp); hwp->writeMiscOut(hwp, data | 0x0C); @@ -853,12 +997,21 @@ VIASetUseExternalClock(vgaHWPtr hwp) * */ static void -VIASetPrimaryClock(vgaHWPtr hwp, CARD16 clock) +ViaSetPrimaryDotclock(ScrnInfoPtr pScrn, CARD32 clock) { - DEBUG(xf86DrvMsg(hwp->pScrn->scrnIndex, X_INFO, "VIASetPrimaryClock to 0x%X\n", clock)); + vgaHWPtr hwp = VGAHWPTR(pScrn); + VIAPtr pVia = VIAPTR(pScrn); - hwp->writeSeq(hwp, 0x46, clock >> 8); - hwp->writeSeq(hwp, 0x47, clock & 0xFF); + DEBUG(xf86DrvMsg(hwp->pScrn->scrnIndex, X_INFO, "ViaSetPrimaryDotclock to 0x%lX\n", clock)); + + if ((pVia->Chipset == VIA_CLE266) || (pVia->Chipset == VIA_KM400)) { + hwp->writeSeq(hwp, 0x46, clock >> 8); + hwp->writeSeq(hwp, 0x47, clock & 0xFF); + } else { /* unichrome pro */ + hwp->writeSeq(hwp, 0x44, clock >> 16); + hwp->writeSeq(hwp, 0x45, (clock >> 8) & 0xFF); + hwp->writeSeq(hwp, 0x46, clock & 0xFF); + } ViaSeqMask(hwp, 0x40, 0x02, 0x02); ViaSeqMask(hwp, 0x40, 0x00, 0x02); @@ -868,12 +1021,21 @@ VIASetPrimaryClock(vgaHWPtr hwp, CARD16 clock) * */ static void -VIASetSecondaryClock(vgaHWPtr hwp, CARD16 clock) +ViaSetSecondaryDotclock(ScrnInfoPtr pScrn, CARD32 clock) { - DEBUG(xf86DrvMsg(hwp->pScrn->scrnIndex, X_INFO, "VIASetSecondaryClock to 0x%X\n", clock)); + vgaHWPtr hwp = VGAHWPTR(pScrn); + VIAPtr pVia = VIAPTR(pScrn); - hwp->writeSeq(hwp, 0x44, clock >> 8); - hwp->writeSeq(hwp, 0x45, clock & 0xFF); + DEBUG(xf86DrvMsg(hwp->pScrn->scrnIndex, X_INFO, "ViaSetSecondaryDotclock to 0x%lX\n", clock)); + + if ((pVia->Chipset == VIA_CLE266) || (pVia->Chipset == VIA_KM400)) { + hwp->writeSeq(hwp, 0x44, clock >> 8); + hwp->writeSeq(hwp, 0x45, clock & 0xFF); + } else { /* unichrome pro */ + hwp->writeSeq(hwp, 0x4A, clock >> 16); + hwp->writeSeq(hwp, 0x4B, (clock >> 8) & 0xFF); + hwp->writeSeq(hwp, 0x4C, clock & 0xFF); + } ViaSeqMask(hwp, 0x40, 0x04, 0x04); ViaSeqMask(hwp, 0x40, 0x00, 0x04); @@ -909,19 +1071,19 @@ VIASetLCDMode(ScrnInfoPtr pScrn, DisplayModePtr mode) else { pBIOSInfo->Clock = Table.InitTb.VClk_12Bit; /* for some reason still to be defined this is neccessary */ - VIASetSecondaryClock(hwp, Table.InitTb.LCDClk_12Bit); + ViaSetSecondaryDotclock(pScrn, Table.InitTb.LCDClk_12Bit); } } else { if (pVia->IsSecondary) pBIOSInfo->Clock = Table.InitTb.LCDClk; else { pBIOSInfo->Clock = Table.InitTb.VClk; - VIASetSecondaryClock(hwp, Table.InitTb.LCDClk); + ViaSetSecondaryDotclock(pScrn, Table.InitTb.LCDClk); } } - VIASetUseExternalClock(hwp); + ViaSetUseExternalClock(hwp); for (i = 0; i < Table.InitTb.numEntry; i++) { port = Table.InitTb.port[i]; @@ -1115,15 +1277,12 @@ static void ViaModePrimaryVGA(ScrnInfoPtr pScrn, DisplayModePtr mode) { vgaHWPtr hwp = VGAHWPTR(pScrn); - VIAPtr pVia = VIAPTR(pScrn); - VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - 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)); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaModePrimaryVGA: " + "Setting up %s\n", mode->name)); ViaCrtcMask(hwp, 0x11, 0x00, 0x80); /* modify starting address */ ViaCrtcMask(hwp, 0x03, 0x80, 0x80); /* enable vertical retrace access */ @@ -1132,9 +1291,9 @@ ViaModePrimaryVGA(ScrnInfoPtr pScrn, DisplayModePtr mode) /* Set Misc Register */ temp = 0x23; - if (!ViaMode.HSyncPos) + if (mode->Flags & V_NHSYNC) temp |= 0x40; - if (!ViaMode.VSyncPos) + if (mode->Flags & V_NHSYNC) temp |= 0x80; temp |= 0x0C; /* Undefined/external clock */ hwp->writeMiscOut(hwp, temp); @@ -1215,60 +1374,65 @@ ViaModePrimaryVGA(ScrnInfoPtr pScrn, DisplayModePtr mode) 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; + /* horizontal total : 4100 */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHTotal: 0x%03X\n", + mode->CrtcHTotal)); + temp = (mode->CrtcHTotal >> 3) - 5; hwp->writeCrtc(hwp, 0x00, temp & 0xFF); ViaCrtcMask(hwp, 0x36, temp >> 5, 0x08); - /* horizontal address */ - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHDisplay: 0x%02X\n", + /* horizontal address : 2048 */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHDisplay: 0x%03X\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; + /* horizontal blanking start : 2048 */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHBlankStart: 0x%03X\n", + mode->CrtcHBlankStart)); + if (mode->CrtcHBlankStart != mode->CrtcHDisplay) /* FIX ME */ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Caught X working around an old VGA " + "limitation (HBlankStart).\n"); + temp = (mode->CrtcHDisplay >> 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; + /* horizontal blanking end : start + 1025 */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHBlankEnd: 0x%03X\n", + mode->CrtcHBlankEnd)); + if (mode->CrtcHBlankEnd != mode->CrtcHTotal) /* FIX ME */ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Caught X working around an old VGA " + "limitation (HBlankEnd).\n"); + temp = (mode->CrtcHTotal >> 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; + /* horizontal sync start : 4095 */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHSyncStart: 0x%03X\n", + mode->CrtcHSyncStart)); + temp = mode->CrtcHSyncStart >> 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; + /* horizontal sync end : start + 256 */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHSyncEnd: 0x%03X\n", + mode->CrtcHSyncEnd)); + temp = mode->CrtcHSyncEnd >> 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; + /* vertical total : 2049 */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVTotal: 0x%03X\n", + mode->CrtcVTotal)); + temp = mode->CrtcVTotal - 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 */ + /* vertical address : 2048 */ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVDisplay: 0x%03X\n", mode->CrtcVDisplay)); temp = mode->CrtcVDisplay - 1; @@ -1283,19 +1447,19 @@ ViaModePrimaryVGA(ScrnInfoPtr pScrn, DisplayModePtr mode) 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; + /* vertical sync start : 2047 */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVSyncStart: 0x%03X\n", + mode->CrtcVSyncStart)); + temp = mode->CrtcVSyncStart; 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); + /* vertical sync end : start + 16 -- other bits someplace? */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVSyncEnd: 0x%03X\n", + mode->CrtcVSyncEnd)); + ViaCrtcMask(hwp, 0x11, mode->CrtcVSyncEnd, 0x0F); /* line compare: We are not doing splitscreen so 0x3FFF */ hwp->writeCrtc(hwp, 0x18, 0xFF); @@ -1308,19 +1472,25 @@ ViaModePrimaryVGA(ScrnInfoPtr pScrn, DisplayModePtr mode) 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; + /* vertical blanking start : 2048 */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVBlankStart: 0x%03X\n", + mode->CrtcVBlankStart)); + if (mode->CrtcVBlankStart != mode->CrtcVDisplay) /* FIX ME */ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Caught X working around an old VGA " + "limitation (VBlankStart).\n"); + temp = mode->CrtcVDisplay - 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; + /* vertical blanking end : start + 257 */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVBlankEnd: 0x%03X\n", + mode->CrtcVBlankEnd)); + if (mode->CrtcVBlankEnd != mode->CrtcVTotal) /* FIX ME */ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Caught X working around an old VGA " + "limitation (VBlankEnd).\n"); + temp = mode->CrtcVTotal - 1; hwp->writeCrtc(hwp, 0x16, temp); /* some leftovers */ @@ -1330,7 +1500,8 @@ ViaModePrimaryVGA(ScrnInfoPtr pScrn, DisplayModePtr mode) /* offset */ temp = (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3)) >> 3; - if (temp & 0x03) { /* Make sure that this is 32byte aligned */ + /* Make sure that this is 32byte aligned */ + if (temp & 0x03) { temp += 0x03; temp &= ~0x03; } @@ -1338,6 +1509,17 @@ ViaModePrimaryVGA(ScrnInfoPtr pScrn, DisplayModePtr mode) hwp->writeCrtc(hwp, 0x13, temp & 0xFF); ViaCrtcMask(hwp, 0x35, temp >> 3, 0xE0); + /* fetch count */ + temp = (mode->CrtcHDisplay * (pScrn->bitsPerPixel >> 3)) >> 3; + /* Make sure that this is 32byte aligned */ + if (temp & 0x03) { + temp += 0x03; + temp &= ~0x03; + } + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Fetch Count: 0x%03X\n", temp)); + hwp->writeSeq(hwp, 0x1C, (temp >> 1) & 0xFF); + ViaSeqMask(hwp, 0x1D, temp >> 9, 0x03); + /* some leftovers */ ViaCrtcMask(hwp, 0x32, 0, 0xFF); ViaCrtcMask(hwp, 0x33, 0, 0xC8); @@ -1346,17 +1528,19 @@ ViaModePrimaryVGA(ScrnInfoPtr pScrn, DisplayModePtr mode) /* * */ -static CARD16 -ViaModeDotClockTranslate(ScrnInfoPtr pScrn, int DotClock) +static CARD32 +ViaModeDotClockTranslate(ScrnInfoPtr pScrn, DisplayModePtr mode) { + VIAPtr pVia = VIAPTR(pScrn); int i; 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); + if (ViaDotClocks[i].DotClock == mode->Clock) { + if ((pVia->Chipset == VIA_CLE266) || (pVia->Chipset == VIA_KM400)) + return ViaDotClocks[i].UniChrome; + else + return ViaDotClocks[i].UniChromePro; + } return 0x0000; } @@ -1382,7 +1566,8 @@ ViaModePrimary(ScrnInfoPtr pScrn, DisplayModePtr mode) hwp->writeCrtc(hwp, 0x93, 0x00); ViaModePrimaryVGA(pScrn, mode); - pBIOSInfo->Clock = ViaModeDotClockTranslate(pScrn, ViaModes[pBIOSInfo->ModeIndex].DotClock); + pBIOSInfo->Clock = ViaModeDotClockTranslate(pScrn, mode); + pBIOSInfo->ClockExternal = FALSE; /* Don't do this before the Sequencer is set: locks up KM400 and K8M800 */ if (pVia->FirstInit) @@ -1394,21 +1579,38 @@ ViaModePrimary(ScrnInfoPtr pScrn, DisplayModePtr mode) if (!pBIOSInfo->CrtActive) ViaCrtcMask(hwp, 0x36, 0x30, 0x30); - if (pBIOSInfo->PanelActive && (pBIOSInfo->PanelIndex != VIA_BIOS_NUM_PANEL)) { + if (pBIOSInfo->PanelActive && ViaPanelGetIndex(pScrn, mode)) { VIASetLCDMode(pScrn, mode); ViaLCDPower(pScrn, TRUE); } else if (pBIOSInfo->PanelPresent) ViaLCDPower(pScrn, FALSE); - if (pBIOSInfo->TVActive && (pBIOSInfo->TVIndex != VIA_TVRES_INVALID)) - ViaTVSetMode(pScrn); - else + if (pBIOSInfo->TVActive) { + /* Quick 'n dirty workaround for non-primary case until TVCrtcMode + is removed -- copy from clock handling code below */ + if ((pVia->Chipset == VIA_CLE266) && CLE266_REV_IS_AX(pVia->ChipRev)) + ViaSetPrimaryDotclock(pScrn, 0x471C); /* CLE266Ax use 2x XCLK */ + else + ViaSetPrimaryDotclock(pScrn, 0x871C); + ViaSetUseExternalClock(hwp); + + ViaTVSetMode(pScrn, mode); + } else ViaTVPower(pScrn, FALSE); ViaSetPrimaryFIFO(pScrn, mode); - VIASetPrimaryClock(hwp, pBIOSInfo->Clock); - VIASetUseExternalClock(hwp); + if (pBIOSInfo->ClockExternal) { + if ((pVia->Chipset == VIA_CLE266) && CLE266_REV_IS_AX(pVia->ChipRev)) + ViaSetPrimaryDotclock(pScrn, 0x471C); /* CLE266Ax use 2x XCLK */ + else + ViaSetPrimaryDotclock(pScrn, 0x871C); + ViaCrtcMask(hwp, 0x6B, 0x01, 0x01); + } else { + ViaSetPrimaryDotclock(pScrn, pBIOSInfo->Clock); + ViaSetUseExternalClock(hwp); + ViaCrtcMask(hwp, 0x6B, 0x00, 0x01); + } /* Enable CRT Controller (3D5.17 Hardware Reset) */ ViaCrtcMask(hwp, 0x17, 0x80, 0x80); @@ -1423,7 +1625,7 @@ static void ViaModeSecondaryVGA(ScrnInfoPtr pScrn, DisplayModePtr mode) { vgaHWPtr hwp = VGAHWPTR(pScrn); - CARD16 tmp; + CARD16 temp; DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaModeSecondaryVGA\n")); @@ -1445,15 +1647,124 @@ ViaModeSecondaryVGA(ScrnInfoPtr pScrn, DisplayModePtr mode) break; } + /* Crtc registers */ + /* horizontal total : 4096 */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHTotal: 0x%03X\n", + mode->CrtcHTotal)); + temp = mode->CrtcHTotal - 1; + hwp->writeCrtc(hwp, 0x50, temp & 0xFF); + ViaCrtcMask(hwp, 0x55, temp >> 8, 0x0F); + + /* horizontal address : 2048 */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHDisplay: 0x%03X\n", + mode->CrtcHDisplay)); + temp = mode->CrtcHDisplay - 1; + hwp->writeCrtc(hwp, 0x51, temp & 0xFF); + ViaCrtcMask(hwp, 0x55, temp >> 4, 0x70); + + /* horizontal blanking start : 2048 */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHBlankStart: 0x%03X\n", + mode->CrtcHBlankStart)); + if (mode->CrtcHBlankStart != mode->CrtcHDisplay) /* FIX ME */ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Caught X working around an old VGA " + "limitation (HBlankStart).\n"); + temp = mode->CrtcHDisplay - 1; + hwp->writeCrtc(hwp, 0x52, temp & 0xFF); + ViaCrtcMask(hwp, 0x54, temp >> 8, 0x07); + + /* horizontal blanking end : 4096 */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHBlankEnd: 0x%03X\n", + mode->CrtcHBlankEnd)); + if (mode->CrtcHBlankEnd != mode->CrtcHTotal) /* FIX ME */ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Caught X working around an old VGA " + "limitation (HBlankEnd).\n"); + temp = mode->CrtcHTotal - 1; + hwp->writeCrtc(hwp, 0x53, temp & 0xFF); + ViaCrtcMask(hwp, 0x54, temp >> 5, 0x38); + ViaCrtcMask(hwp, 0x5D, temp >> 5, 0x40); + + /* horizontal sync start : 2047 */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHSyncStart: 0x%03X\n", + mode->CrtcHSyncStart)); + temp = mode->CrtcHSyncStart; + hwp->writeCrtc(hwp, 0x56, temp & 0xFF); + ViaCrtcMask(hwp, 0x54, temp >> 2, 0xC0); + ViaCrtcMask(hwp, 0x5C, temp >> 3, 0x80); + + /* horizontal sync end : sync start + 512 */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcHSyncEnd: 0x%03X\n", + mode->CrtcHSyncEnd)); + temp = mode->CrtcHSyncEnd; + hwp->writeCrtc(hwp, 0x57, temp & 0xFF); + ViaCrtcMask(hwp, 0x5C, temp >> 2, 0x40); + + /* vertical total : 2048 */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVTotal: 0x%03X\n", + mode->CrtcVTotal)); + temp = mode->CrtcVTotal - 1; + hwp->writeCrtc(hwp, 0x58, temp & 0xFF); + ViaCrtcMask(hwp, 0x5D, temp >> 8, 0x07); + + /* vertical address : 2048 */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVDisplay: 0x%03X\n", + mode->CrtcVDisplay)); + temp = mode->CrtcVDisplay - 1; + hwp->writeCrtc(hwp, 0x59, temp & 0xFF); + ViaCrtcMask(hwp, 0x5D, temp >> 5, 0x38); + + /* vertical blanking start : 2048 */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVBlankStart: 0x%03X\n", + mode->CrtcVBlankStart)); + if (mode->CrtcVBlankStart != mode->CrtcVDisplay) /* FIX ME */ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Caught X working around an old VGA " + "limitation (VBlankStart).\n"); + temp = mode->CrtcVDisplay - 1; + hwp->writeCrtc(hwp, 0x5A, temp & 0xFF); + ViaCrtcMask(hwp, 0x5C, temp >> 8, 0x07); + + /* vertical blanking end : 2048 */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVBlankEnd: 0x%03X\n", + mode->CrtcVBlankEnd)); + if (mode->CrtcVBlankEnd != mode->CrtcVTotal) /* FIX ME */ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Caught X working around an old VGA " + "limitation (VBlankEnd).\n"); + temp = mode->CrtcVTotal - 1; + hwp->writeCrtc(hwp, 0x5B, temp & 0xFF); + ViaCrtcMask(hwp, 0x5C, temp >> 5, 0x38); + + /* vertical sync start : 2047 */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVSyncStart: 0x%03X\n", + mode->CrtcVSyncStart)); + temp = mode->CrtcVSyncStart; + hwp->writeCrtc(hwp, 0x5E, temp & 0xFF); + ViaCrtcMask(hwp, 0x5F, temp >> 3, 0xE0); + + /* vertical sync end : start + 32 */ + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CrtcVSyncEnd: 0x%03X\n", + mode->CrtcVSyncEnd)); + temp = mode->CrtcVSyncEnd; + ViaCrtcMask(hwp, 0x5F, temp, 0x1F); + /* offset */ - tmp = (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3)) >> 3; - if (tmp & 0x03) { /* Make sure that this is 32byte aligned */ - tmp += 0x03; - tmp &= ~0x03; + 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", tmp)); - hwp->writeCrtc(hwp, 0x66, tmp & 0xFF); - ViaCrtcMask(hwp, 0x67, tmp >> 8, 0x03); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Offset: 0x%03X\n", temp)); + hwp->writeCrtc(hwp, 0x66, temp & 0xFF); + ViaCrtcMask(hwp, 0x67, temp >> 8, 0x03); + + /* fetch count */ + temp = (mode->CrtcHDisplay * (pScrn->bitsPerPixel >> 3)) >> 3; + /* Make sure that this is 32byte aligned */ + if (temp & 0x03) { + temp += 0x03; + temp &= ~0x03; + } + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Fetch Count: 0x%03X\n", temp)); + hwp->writeCrtc(hwp, 0x65, (temp >> 1) & 0xFF); + ViaCrtcMask(hwp, 0x67, temp >> 7, 0x0C); } /* @@ -1473,8 +1784,8 @@ ViaModeSecondary(ScrnInfoPtr pScrn, DisplayModePtr mode) ViaModeSecondaryVGA(pScrn, mode); - if (pBIOSInfo->TVActive && (pBIOSInfo->TVIndex != VIA_TVRES_INVALID)) - ViaTVSetMode(pScrn); + if (pBIOSInfo->TVActive) + ViaTVSetMode(pScrn, mode); /* CLE266A2 apparently doesn't like this */ if ((pVia->Chipset != VIA_CLE266) || (pVia->ChipRev != 0x02)) @@ -1489,8 +1800,8 @@ ViaModeSecondary(ScrnInfoPtr pScrn, DisplayModePtr mode) ViaSetSecondaryFIFO(pScrn, mode); - VIASetSecondaryClock(hwp, pBIOSInfo->Clock); - VIASetUseExternalClock(hwp); + ViaSetSecondaryDotclock(pScrn, pBIOSInfo->Clock); + ViaSetUseExternalClock(hwp); ViaCrtcMask(hwp, 0x17, 0x80, 0x80); diff --git a/src/via_mode.h b/src/via_mode.h index a0b4936..f3b3b21 100644 --- a/src/via_mode.h +++ b/src/via_mode.h @@ -17,15 +17,140 @@ * 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 + * 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_MODE_H_ #define _VIA_MODE_H_ 1 +/* + * Bandwidth + * + */ +/* used for impossible entries: allow a minimum bandwidth in case this does happen */ +#define VIA_BW_MIN 74000000 /* > 640x480@60Hz@32bpp */ + +/* index to table */ +#define VIA_BW_CLE266A 0 +#define VIA_BW_CLE266C 1 +#define VIA_BW_KM400 2 +#define VIA_BW_KM400A 3 +#define VIA_BW_K8M800 4 +#define VIA_BW_PM800 5 +#define VIA_BW_ALL 6 + +/* + * 393216000 is for SDR133 in via_refresh.h + * 460800000 is for DDR266 + */ +static struct { + CARD8 Device; /* equal to index */ + CARD32 Bandwidth[VIA_MEM_END]; +} ViaBandwidthTable[VIA_BW_ALL] = { + { VIA_BW_CLE266A, { VIA_BW_MIN, VIA_BW_MIN, VIA_BW_MIN, 394000000, 461000000, VIA_BW_MIN, VIA_BW_MIN } }, + { VIA_BW_CLE266C, { VIA_BW_MIN, VIA_BW_MIN, VIA_BW_MIN, 394000000, 461000000, VIA_BW_MIN, VIA_BW_MIN } }, + { VIA_BW_KM400, { VIA_BW_MIN, VIA_BW_MIN, VIA_BW_MIN, 394000000, 461000000, 461000000, VIA_BW_MIN } }, + { VIA_BW_KM400A, { VIA_BW_MIN, VIA_BW_MIN, VIA_BW_MIN, 394000000, 461000000, 461000000, 461000000 } }, + { VIA_BW_K8M800, { VIA_BW_MIN, VIA_BW_MIN, VIA_BW_MIN, 394000000, 461000000, 461000000, 461000000 } }, + { VIA_BW_PM800, { VIA_BW_MIN, VIA_BW_MIN, VIA_BW_MIN, 394000000, 461000000, 461000000, 461000000 } } +}; + +/* + * simple lookup table for dotclocks + * + */ +static struct ViaDotClock { + int DotClock; + CARD16 UniChrome; + CARD32 UniChromePro; +} ViaDotClocks[] = { + { 25200, 0x513C, 0xa79004 }, + { 25312, 0xC763, 0xc49005 }, + { 26591, 0x471A, 0xce9005 }, + { 31500, 0xC558, 0xae9003 }, + { 31704, 0x471F, 0xaf9002 }, + { 32663, 0xC449, 0x479000 }, + { 33750, 0x4721, 0x959002 }, + { 35500, 0x5877, 0x759001 }, + { 36000, 0x5879, 0x9f9002 }, + { 39822, 0xC459, 0x578c02 }, + { 40000, 0x515F, 0x848c04 }, + { 41164, 0x4417, 0x2c8c00 }, + { 46981, 0x5069, 0x678c02 }, + { 49500, 0xC353, 0xa48c04 }, + { 50000, 0xC354, 0x368c00 }, + { 56300, 0x4F76, 0x3d8c00 }, + { 57284, 0x4E70, 0x3e8c00 }, + { 64995, 0x0D3B, 0x6b8c01 }, + { 65000, 0x0D3B, 0x6b8c01 }, /* Slightly unstable on PM800 */ + { 65028, 0x866D, 0x6b8c01 }, + { 75000, 0x156E, 0x288800 }, + { 78800, 0x442C, 0x2a8800 }, + { 81135, 0x0622, 0x428801 }, + { 81613, 0x4539, 0x708803 }, + { 94500, 0x4542, 0x4d8801 }, + { 108000, 0x0B53, 0x778802 }, + { 108280, 0x4879, 0x778802 }, + { 122000, 0x0D6F, 0x428800 }, + { 122726, 0x073C, 0x878802 }, + { 135000, 0x0742, 0x6f8801 }, + { 148500, 0x0853, 0x518800 }, + { 155800, 0x0857, 0x558402 }, + { 157500, 0x422C, 0x2a8400 }, + { 161793, 0x4571, 0x6f8403 }, + { 162000, 0x0A71, 0x6f8403 }, + { 175500, 0x4231, 0x2f8400 }, + { 189000, 0x0542, 0x4d8401 }, + { 202500, 0x0763, 0x6F8402 }, + { 204800, 0x0764, 0x548401 }, + { 218300, 0x043D, 0x3b8400 }, + { 229500, 0x0660, 0x3e8400 }, /* Not tested on Pro */ + { 0, 0, 0 } +}; + +/* + * + * Panel + * + */ +/* + * Since mode->PrivFlags is overwritten to support the antique Tseng + * this is the only way to flag a selfdefined mode as such. + */ +struct ViaModePriv { + char id[12]; /* "Unichrome" */ +}; + +static struct ViaModePriv ViaPanelPrivate = { + { 'U', 'n', 'i', 'c', 'h', 'r', 'o', 'm', 'e', 0, 0, 0 }, +}; + +#define MODEPREFIX(name) NULL, NULL, name, 0,M_T_DEFAULT +#define MODESUFFIX 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,\ + sizeof(struct ViaModePriv),(void *)&ViaPanelPrivate,0,0.0,0.0 + +static DisplayModeRec ViaPanelModes[] = { + { MODEPREFIX("640x480"), 25312, 640, 656, 752, 800, 0, 480, 489, 491, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, + { MODEPREFIX("800x600"), 39822, 800, 840, 968, 1056, 0, 600, 600, 604, 628, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, + { MODEPREFIX("1024x768"), 65028, 1024, 1048, 1184, 1344, 0, 768, 770, 776, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, + { MODEPREFIX("1152x864"), 81613, 1152, 1216, 1336, 1520, 0, 864, 864, 867, 895, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, + { MODEPREFIX("1280x1024"), 108280, 1280, 1328, 1440, 1688, 0, 1024, 1024, 1027, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, + { MODEPREFIX("1600x1200"), 161793, 1600, 1664, 1856, 2160, 0, 1200, 1200, 1203, 1250, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, + { MODEPREFIX("1280x768"), 81135, 1280, 1328, 1440, 1688, 0, 768, 770, 776, 802, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, + { MODEPREFIX("1280x960"), 108280, 1280, 1376, 1488, 1800, 0, 960, 960, 963, 1000, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, + { MODEPREFIX("848x480"), 33750, 848, 864, 976, 1088, 0, 480, 485, 493, 517, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, + { MODEPREFIX("1400x1050"), 122726, 1400, 1488, 1640, 1880, 0, 1050, 1050, 1053, 1087, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, + { MODEPREFIX("720x480"), 26591, 720, 736, 808, 896, 0, 480, 480, 483, 497, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, + { MODEPREFIX("720x576"), 32663, 720, 744, 816, 912, 0, 576, 576, 579, 597, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, + { MODEPREFIX("1024x512"), 41164, 1024, 1056, 1160, 1296, 0, 512, 512, 515, 531, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, + { MODEPREFIX("856x480"), 31704, 856, 872, 960, 1064, 0, 480, 480, 483, 497, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, + { MODEPREFIX("1024x576"), 46981, 1024, 1064, 1168, 1312, 0, 576, 576, 579, 597, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, + { MODEPREFIX(NULL), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, MODESUFFIX }, +}; + #define VIA_RES_640X480 0 #define VIA_RES_800X600 1 #define VIA_RES_1024X768 2 @@ -45,192 +170,37 @@ #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 + * simple lookuptable for PanelIndex selection */ -struct { +static 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 }, + {VIA_RES_640X480, VIA_PANEL6X4, 640, 480}, + {VIA_RES_800X600, VIA_PANEL8X6, 800, 600}, + {VIA_RES_1024X768, VIA_PANEL10X7, 1024, 768}, + {VIA_RES_1152X864, VIA_PANEL_INVALID, 1152, 864}, + {VIA_RES_1280X1024, VIA_PANEL12X10, 1280, 1024}, + {VIA_RES_1600X1200, VIA_PANEL16X12, 1600, 1200}, + {VIA_RES_1440X1050, VIA_PANEL_INVALID, 1440, 1050}, + {VIA_RES_1280X768, VIA_PANEL12X7, 1280, 768}, + {VIA_RES_1280X960, VIA_PANEL_INVALID, 1280, 960}, + /* {VIA_RES_1920X1440, VIA_PANEL_INVALID, 1920, 1140}, */ + {VIA_RES_848X480, VIA_PANEL_INVALID, 848, 480}, + {VIA_RES_1400X1050, VIA_PANEL14X10, 1400, 1050}, + {VIA_RES_720X480, VIA_PANEL_INVALID, 720, 480}, + {VIA_RES_720X576, VIA_PANEL_INVALID, 720, 576}, + {VIA_RES_1024X512, VIA_PANEL_INVALID, 1024, 512}, + {VIA_RES_856X480, VIA_PANEL_INVALID, 856, 480}, + {VIA_RES_1024X576, VIA_PANEL_INVALID, 1024, 576}, + {VIA_RES_INVALID, VIA_PANEL_INVALID, 0, 0} }; -/* - * - * Panel - * - */ - -struct { +static struct { CARD16 Width; CARD16 Height; CARD8 mode_8b; diff --git a/src/via_priv.h b/src/via_priv.h index 7bafdde..c4b6c23 100644 --- a/src/via_priv.h +++ b/src/via_priv.h @@ -2,7 +2,7 @@ #define _VIA_PRIV_H_ 1 #ifdef XF86DRI -#include "via_common.h" +#include "via_drm.h" #endif /* @@ -14,56 +14,11 @@ * FOURCC definitions */ -#define FOURCC_VIA 0x4E4B4C57 /*VIA*/ +#define FOURCC_XVMC (('C' << 24) + ('M' << 16) + ('V' << 8) + 'X') /* * Structures for create surface */ -typedef struct _DDSURFACEDESC -{ - unsigned long dwSize; /* size of the DDSURFACEDESC structure*/ - unsigned long dwFlags; /* determines what fields are valid*/ - unsigned long dwHeight; /* height of surface to be created*/ - unsigned long dwWidth; /* width of input surface*/ - unsigned long lPitch; /* distance to start of next line(return value)*/ - unsigned long dwBackBufferCount; /* number of back buffers requested*/ - void * lpSurface; /* pointer to the surface memory*/ - unsigned long dwColorSpaceLowValue; /* low boundary of color space that is to*/ - /* be treated as Color Key, inclusive*/ - unsigned long dwColorSpaceHighValue; /* high boundary of color space that is*/ - /* to be treated as Color Key, inclusive*/ - unsigned long dwFourCC; /* (FOURCC code)*/ -} DDSURFACEDESC; -typedef DDSURFACEDESC * LPDDSURFACEDESC; - -typedef struct _DDPIXELFORMAT -{ - unsigned long dwSize; /* size of structure */ - unsigned long dwFlags; /* pixel format flags */ - unsigned long dwFourCC; /* (FOURCC code) */ - - unsigned long dwRGBBitCount; /* how many bits per pixel */ - unsigned long dwYUVBitCount; /* how many bits per pixel */ - unsigned long dwZBufferBitDepth; /* how many bits for z buffers */ - unsigned long dwAlphaBitDepth; /* how many bits for alpha channels */ - - unsigned long dwRBitMask; /* mask for red bit */ - unsigned long dwYBitMask; /* mask for Y bits */ - - unsigned long dwGBitMask; /* mask for green bits */ - unsigned long dwUBitMask; /* mask for U bits */ - - unsigned long dwBBitMask; /* mask for blue bits */ - unsigned long dwVBitMask; /* mask for V bits */ - - unsigned long dwRGBAlphaBitMask; /* mask for alpha channel */ - unsigned long dwYUVAlphaBitMask; /* mask for alpha channel */ - unsigned long dwRGBZBitMask; /* mask for Z channel */ - unsigned long dwYUVZBitMask; /* mask for Z channel */ -} DDPIXELFORMAT; -typedef DDPIXELFORMAT * LPDDPIXELFORMAT; - - typedef struct _SWDEVICE { unsigned char * lpSWOverlaySurface[2]; /* Max 2 Pointers to SW Overlay Surface*/ @@ -85,59 +40,29 @@ typedef struct _SWDEVICE }SWDEVICE; typedef SWDEVICE * LPSWDEVICE; - -/* - * Structures for LOCK surface - */ - -typedef struct _DDLOCK +typedef struct _DDUPDATEOVERLAY { - unsigned long dwVersion; - unsigned long dwFourCC; - unsigned long dwPhysicalBase; - SWDEVICE SWDevice; -} DDLOCK; -typedef DDLOCK * LPDDLOCK; + CARD32 SrcLeft; + CARD32 SrcTop; + CARD32 SrcRight; + CARD32 SrcBottom; -typedef struct _RECTL -{ - unsigned long left; - unsigned long top; - unsigned long right; - unsigned long bottom; -} RECTL; + CARD32 DstLeft; + CARD32 DstTop; + CARD32 DstRight; + CARD32 DstBottom; -typedef struct _DDUPDATEOVERLAY -{ - RECTL rDest; /* dest rect */ - RECTL rSrc; /* src rect */ unsigned long dwFlags; /* flags */ unsigned long dwColorSpaceLowValue; - unsigned long dwColorSpaceHighValue; - unsigned long dwFourcc; } DDUPDATEOVERLAY; typedef DDUPDATEOVERLAY * LPDDUPDATEOVERLAY; -typedef struct _ADJUSTFRAME -{ - int x; - int y; -} ADJUSTFRAME; -typedef ADJUSTFRAME * LPADJUSTFRAME; - /* Definition for dwFlags */ -#define DDOVER_HIDE 0x00000001 -#define DDOVER_SHOW 0x00000002 -#define DDOVER_KEYDEST 0x00000004 -#define DDOVER_ENABLE 0x00000008 -#define DDOVER_CLIP 0x00000010 -#define DDOVER_INTERLEAVED 0x00800000l -#define DDOVER_BOB 0x00200000l +#define DDOVER_KEYDEST 1 +#define DDOVER_INTERLEAVED 2 +#define DDOVER_BOB 4 #define FOURCC_HQVSW 0x34565148 /*HQV4*/ -#define DDPF_FOURCC 0x00000004l - - typedef struct { @@ -180,35 +105,6 @@ typedef struct CARD32 dwMpegDecoded; } OVERLAYRECORD; -/**************************************************************************** - * - * PIXELFORMAT FLAGS - * - ****************************************************************************/ - -/* - * The FourCC code is valid. - */ -#define DDPF_FOURCC 0x00000004l - -/* - * The RGB data in the pixel format structure is valid. - */ -#define DDPF_RGB 0x00000040l - - - -/* - * Return value of Proprietary Interface - */ - -#define PI_OK 0x00 -#define PI_ERR 0x01 -#define PI_ERR_NO_X_WINDOW PI_ERR +1 -#define PI_ERR_CANNOT_OPEN_VIDEO_DEVICE PI_ERR +2 -#define PI_ERR_CANNOT_USE_IOCTL PI_ERR +3 -#define PI_ERR_CANNOT_CREATE_SURFACE PI_ERR +4 - #define MEM_BLOCKS 4 typedef struct { @@ -216,7 +112,7 @@ typedef struct { int pool; /* Pool we drew from */ #ifdef XF86DRI int drm_fd; /* Fd in DRM mode */ - drmViaMem drm; /* DRM management object */ + drm_via_mem_t drm; /* DRM management object */ #endif int slot; /* Pool 3 slot */ void *pVia; /* VIA driver pointer */ @@ -236,7 +132,7 @@ typedef struct { VIAMem HQVMem; VIAMem SWfbMem; - DDPIXELFORMAT DPFsrc; + CARD32 SrcFourCC; DDUPDATEOVERLAY UpdateOverlayBackup; /* For HQVcontrol func use // To save MPEG updateoverlay info.*/ @@ -259,12 +155,6 @@ typedef struct { int panning_old_y; int panning_x; int panning_y; - -/*To solve the bandwidth issue */ - unsigned char Save_3C4_16; - unsigned char Save_3C4_17; - unsigned char Save_3C4_18; - } swovRec, *swovPtr; #endif /* _VIA_PRIV_H_ */ diff --git a/src/via_regs.h b/src/via_regs.h index 5c2d359..898362d 100644 --- a/src/via_regs.h +++ b/src/via_regs.h @@ -16,9 +16,9 @@ * 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 + * 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. */ diff --git a/src/via_shadow.c b/src/via_shadow.c index 2265d7b..e1a4e18 100644 --- a/src/via_shadow.c +++ b/src/via_shadow.c @@ -16,9 +16,9 @@ * 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 + * 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. */ @@ -27,7 +27,7 @@ #include "servermd.h" -void +static void VIARefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) { VIAPtr pVia = VIAPTR(pScrn); @@ -55,7 +55,7 @@ VIARefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) } -void +static void VIAPointerMoved(int index, int x, int y) { ScrnInfoPtr pScrn = xf86Screens[index]; @@ -76,7 +76,7 @@ VIAPointerMoved(int index, int x, int y) } -void +static void VIARefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox) { VIAPtr pVia = VIAPTR(pScrn); @@ -125,7 +125,7 @@ VIARefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox) } -void +static void VIARefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox) { VIAPtr pVia = VIAPTR(pScrn); @@ -173,7 +173,7 @@ VIARefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox) } } - +#ifdef UNUSED /* this one could be faster */ void VIARefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox) @@ -227,9 +227,9 @@ VIARefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox) pbox++; } } +#endif /* UNUSED */ - -void +static void VIARefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox) { VIAPtr pVia = VIAPTR(pScrn); @@ -273,3 +273,36 @@ VIARefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox) pbox++; } } + +/* + * + */ +void +ViaShadowFBInit(ScrnInfoPtr pScrn, ScreenPtr pScreen) +{ + VIAPtr pVia = VIAPTR(pScrn); + RefreshAreaFuncPtr refreshArea = VIARefreshArea; + + if (pVia->rotate) { + if (!pVia->PointerMoved) { + pVia->PointerMoved = pScrn->PointerMoved; + pScrn->PointerMoved = VIAPointerMoved; + } + + switch(pScrn->bitsPerPixel) { + case 8: + refreshArea = VIARefreshArea8; + break; + case 16: + refreshArea = VIARefreshArea16; + break; + case 32: + refreshArea = VIARefreshArea32; + break; + } + } + + ShadowFBInit(pScreen, refreshArea); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ShadowFB initialised.\n"); +} + diff --git a/src/via_swov.c b/src/via_swov.c index 35f4f50..c77a465 100644 --- a/src/via_swov.c +++ b/src/via_swov.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. * @@ -17,9 +17,9 @@ * 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 + * 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. */ @@ -33,17 +33,17 @@ #include "xf86drm.h" #endif -#include "via_overlay.h" #include "via_driver.h" -#include "via_regrec.h" #include "via_priv.h" #include "via_swov.h" #ifdef XF86DRI -#include "via_common.h" +#include "via_drm.h" #endif #include "via_vgahw.h" #include "via_id.h" +#include <math.h> + /* * Warning: this file contains revision checks which are CLE266 specific. * There seems to be no checking present for KM400 or more recent devices. @@ -53,6 +53,132 @@ * - move content of pVia->HWDiff into pVia->swov * - merge with CLEXF40040 */ + +/* + * Old via_regrec code. + * + * + */ +#define VIDREG_BUFFER_SIZE 100 /* Number of entries in the VidRegBuffer. */ + +#define IN_HQV_FIRE (*((unsigned long volatile *)(pVia->VidMapBase+HQV_CONTROL))&HQV_IDLE) +#define IN_VIDEO_DISPLAY (*((unsigned long volatile *)(pVia->VidMapBase+V_FLAGS))&VBI_STATUS) + +#ifdef UNUSED + +#define IN_VIDEO_FIRE (*((unsigned long volatile *)(pVia->VidMapBase+V_COMPOSE_MODE))&V1_COMMAND_FIRE) +#define IN_HQV_FLIP (*((unsigned long volatile *)(pVia->VidMapBase+HQV_CONTROL))&HQV_FLIP_STATUS) +#define IN_DISPLAY (VIDInD(V_FLAGS) & 0x200) +#define IN_VBLANK (!IN_DISPLAY) + +static void +viaWaitHQVIdle(VIAPtr pVia) +{ + while (!IN_HQV_FIRE); +} +#endif /* UNUSED */ + +static void +viaWaitVideoCommandFire(VIAPtr pVia) +{ + /*while (IN_VIDEO_FIRE);*/ + CARD32 volatile *pdwState = (CARD32 volatile *) (pVia->VidMapBase+V_COMPOSE_MODE); + /*pdwState = (CARD32 volatile *) (pVia->VidMapBase+V_COMPOSE_MODE);*/ + while ((*pdwState & V1_COMMAND_FIRE)||(*pdwState & V3_COMMAND_FIRE)); +} + +static void +viaWaitHQVFlip(VIAPtr pVia) +{ + CARD32 volatile *pdwState = (CARD32 volatile *) pVia->VidMapBase; + pdwState = (CARD32 volatile *) (pVia->VidMapBase+HQV_CONTROL); + while (!(*pdwState & HQV_FLIP_STATUS) ); +/* + while (!((*pdwState & 0xc0)== 0xc0) ); + while (!((*pdwState & 0xc0)!= 0xc0) ); +*/ +} + +static void +viaWaitHQVFlipClear(VIAPtr pVia, unsigned long dwData) +{ + CARD32 volatile *pdwState = (CARD32 volatile *) (pVia->VidMapBase+HQV_CONTROL); + *pdwState =dwData; + + while ((*pdwState & HQV_FLIP_STATUS) ) + { + VIDOutD(HQV_CONTROL, *pdwState|HQV_FLIP_STATUS); + } +} + +static void +viaWaitVBI(VIAPtr pVia) +{ + while (IN_VIDEO_DISPLAY); +} + +static void +viaWaitHQVDone(VIAPtr pVia) +{ + CARD32 volatile *pdwState = (CARD32 volatile *) (pVia->VidMapBase+HQV_CONTROL); + /*pdwState = (CARD32 volatile *) (GEAddr+HQV_CONTROL);*/ + + /*if (*pdwState & HQV_ENABLE)*/ + if (pVia->swov.MPEG_ON) + { + while ((*pdwState & HQV_SW_FLIP) ); + } +} +/* + * Send all data in VidRegBuffer to the hardware. + */ +static void +FlushVidRegBuffer(VIAPtr pVia) +{ + unsigned int i; + + viaWaitVideoCommandFire(pVia); + + for (i = 0; i < pVia->VidRegCursor; i += 2) + { + VIDOutD(pVia->VidRegBuffer[i], pVia->VidRegBuffer[i+1]); + DBG_DD(ErrorF("FlushVideoRegs: [%i] %08lx %08lx\n", + i>>1, pVia->VidRegBuffer[i]+0x200, pVia->VidRegBuffer[i+1])); + } + + /* BUG: (?) VIA never resets the cursor. + * My fix is commented out for now, in case they had a reason for that. /A + */ + /* pVia->VidRegCursor = 0; */ +} + +/* + * Initialize and clear VidRegBuffer. + */ +static void +ResetVidRegBuffer(VIAPtr pVia) +{ + /* BUG: (Memory leak) This allocation may need have a corresponding free somewhere... /A */ + if (!pVia->VidRegBuffer) + pVia->VidRegBuffer = xnfcalloc(VIDREG_BUFFER_SIZE, sizeof(CARD32) * 2); + pVia->VidRegCursor = 0; +} + +/* + * Save a video register and data in VidRegBuffer. + */ +static void +SaveVideoRegister(VIAPtr pVia, CARD32 index, CARD32 data) +{ + pVia->VidRegBuffer[pVia->VidRegCursor++] = index; + pVia->VidRegBuffer[pVia->VidRegCursor++] = data; + + if (pVia->VidRegCursor > VIDREG_BUFFER_SIZE) { + DBG_DD(ErrorF("SaveVideoRegister: Out of video register space")); + } +} + + /* * HW Difference Flag * Moved here from via_hwdiff.c @@ -121,7 +247,542 @@ VIAVidHWDiffInit(ScrnInfoPtr pScrn) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "VIAVidHWDiffInit: Unhandled ChipSet.\n"); } } +/* + * Old via_overlay code. + * + */ +typedef struct _YCBCRREC { + CARD32 dwY ; + CARD32 dwCB; + CARD32 dwCR; +} YCBCRREC; + +/* Verify that using V1 bit definitions on V3 + * is not broken in OverlayGetV1V3Format() + */ + +#if V1_COLORSPACE_SIGN != V3_COLORSPACE_SIGN +#error "V1_COLORSPACE_SIGN != V3_COLORSPACE_SIGN" +#endif +#if V1_YUV422 != V3_YUV422 +#error "V1_YUV422 != V3_YUV422" +#endif +#if V1_SWAP_HW_HQV != V3_SWAP_HW_HQV +#error "V1_SWAP_HW_HQV != V3_SWAP_HW_HQV" +#endif +#if V1_RGB15 != V3_RGB15 +#error "V1_RGB15 != V3_RGB15" +#endif +#if V1_RGB16 != V3_RGB16 +#error "V1_RGB16 != V3_RGB16" +#endif +#if V1_RGB32 != V3_RGB32 +#error "V1_RGB32 != V3_RGB32" +#endif + +static BOOL +viaOverlayGetV1V3Format(VIAPtr pVia, int vport, /* 1 or 3, as in V1 or V3 */ + unsigned long videoFlag, + unsigned long * pVidCtl, unsigned long * pHQVCtl) +{ + BOOL is_ok = TRUE; + + *pVidCtl |= V1_COLORSPACE_SIGN; + switch (pVia->swov.SrcFourCC) { + case FOURCC_YV12: + case FOURCC_XVMC: + if (videoFlag & VIDEO_HQV_INUSE) { + *pVidCtl |= V1_YUV422 | V1_SWAP_HW_HQV; + *pHQVCtl |= HQV_SRC_SW | HQV_YUV420 | HQV_ENABLE | HQV_SW_FLIP; + } else { + if (vport == 1) + *pVidCtl |= V1_YCbCr420; + else { + DBG_DD(ErrorF("viaOverlayGetV1V3Format: V3 does not support planar YUV.\n")); + is_ok = FALSE; + } + } + break; + + case FOURCC_YUY2: + if (videoFlag & VIDEO_HQV_INUSE) { + *pVidCtl |= V1_YUV422 | V1_SWAP_HW_HQV; + *pHQVCtl |= HQV_SRC_SW | HQV_YUV422 | HQV_ENABLE | HQV_SW_FLIP; + } else + *pVidCtl |= V1_YUV422; + break; + + default: + DBG_DD(ErrorF("viaOverlayGetV1V3Format: Invalid FOURCC format (0x%lx).\n", + pVia->swov.SrcFourCC)); + is_ok = FALSE; + + *pVidCtl |= V1_YUV422; + break; + } + return is_ok; +} + +static unsigned long +viaOverlayGetSrcStartAddress(VIAPtr pVia, unsigned long videoFlag, + LPDDUPDATEOVERLAY pUpdate, unsigned long srcPitch, + unsigned long * pHQVoffset) +{ + unsigned long srcWidth = (unsigned long)(pUpdate->SrcRight - pUpdate->SrcLeft); + unsigned long dstWidth = (unsigned long)(pUpdate->DstRight - pUpdate->DstLeft); + unsigned long srcHeight = (unsigned long)(pUpdate->SrcBottom - pUpdate->SrcTop); + unsigned long dstHeight = (unsigned long)(pUpdate->DstBottom - pUpdate->DstTop); + + unsigned long offset = 0; + unsigned long srcTopOffset = 0; + unsigned long srcLeftOffset = 0; + + if ((pUpdate->SrcLeft != 0) || (pUpdate->SrcTop != 0)) { + switch (pVia->swov.SrcFourCC) { + case FOURCC_YUY2: + case FOURCC_UYVY: + + if (videoFlag & VIDEO_HQV_INUSE) { + offset = (((pUpdate->SrcTop & ~3) * srcPitch) + ((pUpdate->SrcLeft << 1) & ~31)); + + if (srcHeight > dstHeight) + srcTopOffset = ((pUpdate->SrcTop & ~3) * dstHeight / srcHeight) * srcPitch; + else + srcTopOffset = (pUpdate->SrcTop & ~3) * srcPitch; + + if (srcWidth > dstWidth) + srcLeftOffset = ((pUpdate->SrcLeft << 1) & ~31) * dstWidth / srcWidth; + else + srcLeftOffset = (pUpdate->SrcLeft << 1) & ~31; + *pHQVoffset = srcTopOffset + srcLeftOffset; + } else + offset = ((pUpdate->SrcTop * srcPitch) + ((pUpdate->SrcLeft << 1) & ~15)); + break; + + case FOURCC_YV12: + case FOURCC_XVMC: + + if (videoFlag & VIDEO_HQV_INUSE) + offset = (((pUpdate->SrcTop & ~3) * (srcPitch << 1)) + ((pUpdate->SrcLeft << 1) & ~31)); + else { + offset = ((((pUpdate->SrcTop & ~3) * srcPitch) + pUpdate->SrcLeft) & ~31); + if (pUpdate->SrcTop > 0) + pVia->swov.overlayRecordV1.dwUVoffset = (((((pUpdate->SrcTop & ~3)>>1) * srcPitch) + pUpdate->SrcLeft) & ~31) >> 1; + else + pVia->swov.overlayRecordV1.dwUVoffset = offset >> 1; + } + break; + + default: + DBG_DD(ErrorF("viaGetSrcStartAddress: Invalid FOURCC format (0x%lx).\n", + pVia->swov.SrcFourCC)); + break; + } + } + else { + pVia->swov.overlayRecordV1.dwUVoffset = offset = 0; + } + + return offset; +} + +static YCBCRREC +viaOverlayGetYCbCrStartAddress(unsigned long videoFlag, unsigned long startAddr, + unsigned long offset, unsigned long UVoffset, + unsigned long srcPitch, unsigned long srcHeight) +{ + YCBCRREC YCbCr; + + if (videoFlag & VIDEO_HQV_INUSE) { + YCbCr.dwY = startAddr; + YCbCr.dwCB = startAddr + srcPitch * srcHeight; + YCbCr.dwCR = startAddr + srcPitch * srcHeight + + srcPitch * (srcHeight >> 2); + } + else { + YCbCr.dwY = startAddr + offset; + YCbCr.dwCB = startAddr + srcPitch * srcHeight + UVoffset; + YCbCr.dwCR = startAddr + srcPitch * srcHeight + UVoffset + + srcPitch * (srcHeight >> 2); + } + return YCbCr; +} + +static 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 * pHQVzoomflag) +{ + unsigned long tmp, sw1, d, falign, mdiv; + Bool zoom_ok = TRUE; + + CARD32 HQVfilter[5] = { + HQV_H_FILTER_DEFAULT, HQV_H_TAP4_121, HQV_H_TAP4_121, + HQV_H_TAP8_12221, HQV_H_TAP8_12221 + }; + /* CARD HQVmini[5] = { 0, 0xc00, 0xa00, 0x900, 0x8800 }; */ + + falign = 0; + mdiv = 1; + + if (srcWidth == dstWidth) { /* No zoom */ + *pHQVfilterCtl |= HQV_H_FILTER_DEFAULT; + } + else if (srcWidth < dstWidth) { /* Zoom in */ + + tmp = srcWidth * 0x800 / dstWidth; + *pZoomCtl = ((tmp & 0x7ff) << 16) | V1_X_ZOOM_ENABLE; + *pMiniCtl |= V1_X_INTERPOLY; + zoom_ok = !(tmp > 0x7ff); + + *pHQVzoomflag = 1; + *pHQVfilterCtl |= HQV_H_FILTER_DEFAULT; + + } else { /* srcWidth > dstWidth - Zoom out */ + + /*HQV rounding patch + //tmp = dstWidth*0x0800 / srcWidth;*/ + tmp = dstWidth * 0x800 * 0x400 / srcWidth; + tmp = tmp / 0x400 + ((tmp & 0x3ff) ? 1 : 0); + + *pHQVminiCtl = (tmp & 0x7ff) | HQV_H_MINIFY_ENABLE; + + /* Scale down the picture by a factor mdiv = (1 << d) = {2, 4, 8 or 16} */ + + sw1 = srcWidth; + for (d = 1; d < 5; d++) { + sw1 >>= 1; + if (sw1 <= dstWidth) break; + } + if (d == 5) { /* Too small. */ + d = 4; + zoom_ok = FALSE; + } + mdiv = 1 << d; /* <= {2,4,8,16} */ + falign = ((mdiv<<1)-1) & 0xf; /* <= {3,7,15,15} */ + *pMiniCtl |= V1_X_INTERPOLY; + *pMiniCtl |= ((d<<1)-1) << 24; /* <= {1,3,5,7} << 24 */ + + *pHQVfilterCtl |= HQVfilter[d]; + /* *pHQVminiCtl = HQVmini[d]; */ + *pHQVminiCtl |= HQV_HDEBLOCK_FILTER; + + /* Scale to arbitrary size, on top of previous scaling by (1 << d). */ + + if (sw1 < dstWidth) { + /* CLE bug + *pZoomCtl = sw1 * 0x0800 / dstWidth;*/ + *pZoomCtl = (sw1 - 2) * 0x0800 / dstWidth; + *pZoomCtl = ((*pZoomCtl & 0x7ff) << 16) | V1_X_ZOOM_ENABLE; + } + } + + if (videoFlag & VIDEO_1_INUSE) { + pVia->swov.overlayRecordV1.dwFetchAlignment = falign; + pVia->swov.overlayRecordV1.dwminifyH = mdiv; + } + else { + pVia->swov.overlayRecordV3.dwFetchAlignment = falign; + pVia->swov.overlayRecordV3.dwminifyH = mdiv; + } + + return zoom_ok; +} + +static 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) +{ + unsigned long tmp, sh1, d; + Bool zoom_ok = TRUE; + + CARD32 HQVfilter[5] = { + HQV_V_TAP4_121, HQV_V_TAP4_121, HQV_V_TAP4_121, + HQV_V_TAP8_12221, HQV_V_TAP8_12221 + }; + /* CARD32 HQVmini[5] = { 0, 0x0c000000, 0x0a000000, 0x09000000, 0x08800000 }; */ + + /*if (pVia->pBIOSInfo->scaleY) + { + dstHeight = dstHeight + 1; + }*/ + + if (srcHeight == dstHeight) { /* No zoom */ + *pHQVfilterCtl |= HQV_V_TAP4_121; + } + else if (srcHeight < dstHeight) { /* Zoom in */ + + tmp = srcHeight * 0x0400 / dstHeight; + *pZoomCtl |= ((tmp & 0x3ff) | V1_Y_ZOOM_ENABLE); + *pMiniCtl |= (V1_Y_INTERPOLY | V1_YCBCR_INTERPOLY); + + *pHQVzoomflag = 1; + *pHQVfilterCtl |= HQV_V_TAP4_121; + } + else { /* srcHeight > dstHeight - Zoom out */ + + /*HQV rounding patch + //tmp = dstHeight*0x0800 / srcHeight;*/ + tmp = dstHeight * 0x0800 * 0x400 / srcHeight; + tmp = tmp / 0x400 + ((tmp & 0x3ff) ? 1 : 0); + *pHQVminiCtl |= ((tmp& 0x7ff) << 16) | HQV_V_MINIFY_ENABLE; + + /* Scale down the picture by a factor (1 << d) = {2, 4, 8 or 16} */ + + sh1 = srcHeight; + for (d = 1; d < 5; d++) { + sh1 >>= 1; + if (sh1 <= dstHeight) break; + } + if (d == 5) { /* Too small. */ + d = 4; + zoom_ok = FALSE; + } + + *pMiniCtl |= ((d<<1)-1) << 16; /* <= {1,3,5,7} << 16 */ + + *pHQVfilterCtl |= HQVfilter[d]; + /* *pHQVminiCtl |= HQVmini[d]; */ + *pHQVminiCtl |= HQV_VDEBLOCK_FILTER; + + /* Scale to arbitrary size, on top of previous scaling by (1 << d). */ + + if (sh1 < dstHeight) { + tmp = sh1 * 0x0400 / dstHeight; + *pZoomCtl |= ((tmp & 0x3ff) | V1_Y_ZOOM_ENABLE); + *pMiniCtl |= V1_Y_INTERPOLY | V1_YCBCR_INTERPOLY; + } + } + + return zoom_ok; +} + +static unsigned long +viaOverlayGetFetch(VIAPtr pVia, unsigned long videoFlag, + unsigned long srcWidth, unsigned long dstWidth, + unsigned long oriSrcWidth, unsigned long * pHQVsrcFetch) +{ + unsigned long fetch = 0; + int n = 2; /* 2^n bytes per pixel. */ + + switch (pVia->swov.SrcFourCC) { + case FOURCC_YV12: + case FOURCC_XVMC: + n = 0; /* 2^n = 1 byte per pixel (Y channel in planar YUV) */ + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + n = 1; /* 2^n = 2 bytes per pixel (packed YUV) */ + break; + default: + DBG_DD(ErrorF("viaOverlayGetFetch: Invalid FOURCC format (0x%lx).\n", + pVia->swov.SrcFourCC)); + break; + } + + if (videoFlag & VIDEO_HQV_INUSE) { + *pHQVsrcFetch = oriSrcWidth << n; + if (n == 0) { + /* Assume n == 0 <=> Planar YUV. + * The V1/V3 pixelformat is always packed YUV when we use HQV, + * so we switch from 8-bit to 16-bit pixels here. + */ + n = 1; + } + if (dstWidth >= srcWidth) + fetch = (ALIGN_TO(srcWidth << n, 16) >> 4) + 1; + else + fetch = (ALIGN_TO(dstWidth << n, 16) >> 4) + 1; + } else { + if (n == 0) + fetch = (ALIGN_TO(srcWidth, 32) >> 4); + else + fetch = (ALIGN_TO(srcWidth << n, 16) >> 4) + 1; + } + + /* Fix planar mode problem. */ + if (fetch < 4) fetch = 4; + + return fetch; +} +/* + * This function uses quadratic mapping to adjust the midpoint of the scaling. + */ +static float rangeEqualize(float inLow,float inHigh,float outLow,float outHigh,float outMid, + float inValue) +{ + float + inRange = inHigh - inLow, + outRange = outHigh - outLow, + normIn = ((inValue - inLow) / inRange)*2.-1., + delta = outMid - outRange*0.5 - outLow; + return (inValue - inLow) * outRange / inRange + outLow + (1. - normIn*normIn)*delta; +} + +static unsigned vPackFloat(float val, float hiLimit, float loLimit, float mult, int shift, + Bool doSign) +{ + unsigned packed,mask,sign; + val = (val > hiLimit) ? hiLimit : val; + val = (val < loLimit) ? loLimit : val; + sign = (val < 0) ? 1:0; + val = (sign) ? -val : val; + packed = ((unsigned)(val*mult + 1.)) >> 1; + mask = (1 << shift) - 1; + return (((packed >= mask) ? mask : packed) | ((doSign) ? (sign << shift) : 0)); + +} + + +typedef float colorCoeff[5]; +static colorCoeff colorCTable[] = {{1.1875,1.625,0.875,0.375,2.0}, + {1.164,1.596,0.54,0.45,2.2}}; + +/* + * This function is a partial rewrite of the overlay.c file of the original VIA drivers, + * which was extremely nasty and difficult to follow. Coefficient for new chipset models should + * be added in the table above and, if needed, implemented in the model switch below. + */ + +static void +viaCalculateVideoColor(VIAPtr pVia, int hue, int saturation, int brightness, + int contrast,Bool reset,CARD32 *col1,CARD32 *col2) +{ + float fA,fB1,fC1,fD,fB2,fC2,fB3,fC3; + float fPI,fContrast,fSaturation,fHue,fBrightness; + const float *mCoeff; + unsigned long dwA,dwB1,dwC1,dwD,dwB2,dwC2,dwB3,dwC3,dwS; + unsigned long dwD_Int,dwD_Dec; + int intD; + int model; + fPI = (float)(M_PI/180.); + + if ( reset ) { + saturation = 10000; + brightness = 5000; + contrast = 10000; + } + + switch ( pVia->ChipId ) + { + case PCI_CHIP_VT3205: + case PCI_CHIP_VT3204: + model = 0; + break; + case PCI_CHIP_CLE3122: + model = (CLE266_REV_IS_CX(pVia->ChipRev) ? 0 : 1); + break; + default: + ErrorF("Unknown Chip ID\n"); + model = 0; + } + + switch( model ) + { + case 0: + fBrightness = rangeEqualize(0.,10000.,-128.,128.,-16.,(float) brightness); + fContrast = rangeEqualize(0.,20000.,0.,1.6645,1.0,(float) contrast); + fSaturation = rangeEqualize(0.,20000,0.,2.,1.,(float) saturation); + break; + default: + fBrightness = rangeEqualize(0.,10000.,-128.,128.,-12.,(float) brightness); + fContrast = rangeEqualize(0.,20000.,0.,1.6645,1.1,(float) contrast); + fSaturation = rangeEqualize(0.,20000,0.,2.,1.15,(float) saturation); + break; + } + fHue = (float)hue; + + mCoeff = colorCTable[model]; + + fA = (float)(mCoeff[0]*fContrast); + fB1 = (float)(-mCoeff[1]*fContrast*fSaturation*sin(fHue*fPI)); + fC1 = (float)(mCoeff[1]*fContrast*fSaturation*cos(fHue*fPI)); + fD = (float)(mCoeff[0]*(fBrightness)); + fB2 = (float)((mCoeff[2]*sin(fHue*fPI)- + mCoeff[3]*cos(fHue*fPI))*fContrast*fSaturation); + fC2 = (float)(-(mCoeff[2]*cos(fHue*fPI)+ + mCoeff[3]*sin(fHue*fPI))*fContrast*fSaturation); + fB3 = (float)(mCoeff[4]*fContrast*fSaturation*cos(fHue*fPI)); + fC3 = (float)(mCoeff[4]*fContrast*fSaturation*sin(fHue*fPI)); + + switch(model) + { + case 0: + dwA = vPackFloat(fA,1.9375,0.,32.,5,0); + dwB1 = vPackFloat(fB1,2.125,-2.125,16.,5,1); + dwC1 = vPackFloat(fC1,2.125,-2.125,16.,5,1); + + if (fD>=0) { + intD=(int)fD; + if (intD>127) + intD = 127; + dwD_Int = ((unsigned long)intD)&0xff; + dwD = ((unsigned long)(fD*16+1))>>1; + dwD_Dec= dwD&0x7; + } else { + intD=(int)fD; + if (intD< -128) + intD = -128; + intD = intD+256; + dwD_Int = ((unsigned long)intD)&0xff; + fD = -fD; + dwD = ((unsigned long)(fD*16+1))>>1; + dwD_Dec= dwD&0x7; + } + + dwB2 = vPackFloat(fB2,1.875,-1.875,16,4,1); + dwC2 = vPackFloat(fC2,1.875,-1.875,16,4,1); + dwB3 = vPackFloat(fB3,3.875,-3.875,16,5,1); + dwC3 = vPackFloat(fC3,3.875,-3.875,16,5,1); + *col1 = (dwA<<24)|(dwB1<<16)|(dwC1<<8)|dwD_Int; + *col2 = (dwD_Dec<<29|dwB2<<24)|(dwC2<<16)|(dwB3<<8)|(dwC3); + break; + + default: + dwA = vPackFloat(fA,1.9375,-0.,32,5,0); + dwB1 = vPackFloat(fB1,0.75,-0.75,8.,2,1); + dwC1 = vPackFloat(fC1,2.875,1.,16.,5,0); + + if (fD>=127) + fD=127; + + if (fD<=-128) + fD=-128; + + if (fD>=0) { + dwS = 0; + } + else { + dwS = 1; + fD = fD+128; + } + + dwD = ((unsigned long)(fD*2+1))>>1; + if (dwD>=0x7f) { + dwD = 0x7f|(dwS<<7); + } else { + dwD = (dwD&0x7f)|(dwS<<7); + } + + dwB2 = vPackFloat(fB2,0.,-0.875,16.,3,0); + dwC2 = vPackFloat(fC2,0.,-1.875,16.,4,0); + dwB3 = vPackFloat(fB3,3.75,0.,8.,4,0); + dwC3 = vPackFloat(fC3,1.25,-1.25,8.,3,1); + *col1 = (dwA<<24)|(dwB1<<18)|(dwC1<<9)|dwD; + *col2 = (dwB2<<25)|(dwC2<<17)|(dwB3<<10)|(dwC3<<2); + break; + } +} + +/* + * + * + */ void viaSetColorSpace(VIAPtr pVia, int hue, int saturation, int brightness, int contrast, Bool reset) { @@ -130,10 +791,11 @@ void viaSetColorSpace(VIAPtr pVia, int hue, int saturation, int brightness, int viaCalculateVideoColor(pVia,hue,saturation,brightness, contrast,reset,&col1,&col2); switch ( pVia->ChipId ) { case PCI_CHIP_VT3205: + case PCI_CHIP_VT3204: VIDOutD(V3_ColorSpaceReg_1, col1); VIDOutD(V3_ColorSpaceReg_2, col2); - DBG_DD(ErrorF("000002C4 %08x\n",col1)); - DBG_DD(ErrorF("000002C8 %08x\n",col2)); + DBG_DD(ErrorF("000002C4 %08lx\n",col1)); + DBG_DD(ErrorF("000002C8 %08lx\n",col2)); break; case PCI_CHIP_CLE3122: VIDOutD(V1_ColorSpaceReg_2, col2); @@ -141,8 +803,8 @@ void viaSetColorSpace(VIAPtr pVia, int hue, int saturation, int brightness, int VIDOutD(V3_ColorSpaceReg_2, col2); VIDOutD(V3_ColorSpaceReg_1, col1); - DBG_DD(ErrorF("00000288 %08x\n",col2)); - DBG_DD(ErrorF("00000284 %08x\n",col1)); + DBG_DD(ErrorF("00000288 %08lx\n",col2)); + DBG_DD(ErrorF("00000284 %08lx\n",col1)); break; default: DBG_DD(ErrorF("Unknown DeviceID\n")); @@ -154,6 +816,7 @@ static unsigned long ViaInitVideoStatusFlag(VIAPtr pVia) { switch ( pVia->ChipId ) { case PCI_CHIP_VT3205: + case PCI_CHIP_VT3204: return VIDEO_HQV_INUSE | SW_USE_HQV | VIDEO_3_INUSE; case PCI_CHIP_CLE3122: return VIDEO_HQV_INUSE | SW_USE_HQV | VIDEO_1_INUSE; @@ -183,6 +846,7 @@ static unsigned long ViaSetVidCtl(VIAPtr pVia, unsigned int videoFlag) switch (pVia->ChipId) { case PCI_CHIP_VT3205: + case PCI_CHIP_VT3204: return V3_ENABLE | V3_EXPIRE_NUM_3205; case PCI_CHIP_CLE3122: @@ -230,7 +894,7 @@ static long AddHQVSurface(ScrnInfoPtr pScrn, unsigned int numbuf, CARD32 fourcc) VIAPtr pVia = VIAPTR(pScrn); CARD32 AddrReg[3] = {HQV_DST_STARTADDR0, HQV_DST_STARTADDR1, HQV_DST_STARTADDR2}; - isplanar = ((fourcc == FOURCC_YV12) || (fourcc == FOURCC_VIA)); + isplanar = ((fourcc == FOURCC_YV12) || (fourcc == FOURCC_XVMC)); width = pVia->swov.SWDevice.gdwSWSrcWidth; height = pVia->swov.SWDevice.gdwSWSrcHeight; @@ -257,30 +921,29 @@ static long AddHQVSurface(ScrnInfoPtr pScrn, unsigned int numbuf, CARD32 fourcc) * 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) +static long +CreateSurface(ScrnInfoPtr pScrn, CARD32 FourCC, CARD16 Width, + CARD16 Height, BOOL doalloc) { VIAPtr pVia = VIAPTR(pScrn); - unsigned long width, height, pitch, fbsize, addr; + unsigned long pitch, fbsize, addr; unsigned long retCode; BOOL isplanar; - pVia->swov.DPFsrc.dwFlags = DDPF_FOURCC; - pVia->swov.DPFsrc.dwFourCC = surfaceDesc->dwFourCC; + pVia->swov.SrcFourCC = FourCC; pVia->swov.gdwVideoFlagSW = ViaInitVideoStatusFlag(pVia); - isplanar = ((surfaceDesc->dwFourCC == FOURCC_YV12) || - (surfaceDesc->dwFourCC == FOURCC_VIA)); + isplanar = ((FourCC == FOURCC_YV12) || (FourCC == FOURCC_XVMC)); - width = surfaceDesc->dwWidth; - height = surfaceDesc->dwHeight; - pitch = ALIGN_TO(width, 32) * (isplanar ? 1 : 2); - fbsize = pitch * height * (isplanar ? 1.5 : 1.0); + 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; + if(retCode != Success) + return retCode; addr = pVia->swov.SWfbMem.base; ViaYUVFillBlack(pVia, addr, fbsize); @@ -293,131 +956,129 @@ static long CreateSurface(ScrnInfoPtr pScrn, LPDDSURFACEDESC surfaceDesc, BOOL d if (isplanar) { pVia->swov.SWDevice.dwSWCrPhysicalAddr[0] = - pVia->swov.SWDevice.dwSWPhysicalAddr[0] + (pitch*height); + pVia->swov.SWDevice.dwSWPhysicalAddr[0] + (pitch*Height); pVia->swov.SWDevice.dwSWCrPhysicalAddr[1] = - pVia->swov.SWDevice.dwSWPhysicalAddr[1] + (pitch*height); + pVia->swov.SWDevice.dwSWPhysicalAddr[1] + (pitch*Height); pVia->swov.SWDevice.dwSWCbPhysicalAddr[0] = - pVia->swov.SWDevice.dwSWCrPhysicalAddr[0] + ((pitch>>1)*(height>>1)); + pVia->swov.SWDevice.dwSWCrPhysicalAddr[0] + ((pitch>>1)*(Height>>1)); pVia->swov.SWDevice.dwSWCbPhysicalAddr[1] = - pVia->swov.SWDevice.dwSWCrPhysicalAddr[1] + ((pitch>>1)*(height>>1)); + pVia->swov.SWDevice.dwSWCrPhysicalAddr[1] + ((pitch>>1)*(Height>>1)); } } - pVia->swov.SWDevice.gdwSWSrcWidth = width; - pVia->swov.SWDevice.gdwSWSrcHeight = height; + pVia->swov.SWDevice.gdwSWSrcWidth = Width; + pVia->swov.SWDevice.gdwSWSrcHeight = Height; pVia->swov.SWDevice.dwPitch = pitch; - pVia->swov.overlayRecordV1.dwV1OriWidth = width; - pVia->swov.overlayRecordV1.dwV1OriHeight = height; + pVia->swov.overlayRecordV1.dwV1OriWidth = Width; + pVia->swov.overlayRecordV1.dwV1OriHeight = Height; pVia->swov.overlayRecordV1.dwV1OriPitch = pitch; return Success; } -/************************************************************************* - Function : VIAVidCreateSurface - Create overlay surface depend on FOURCC -*************************************************************************/ -unsigned long VIAVidCreateSurface(ScrnInfoPtr pScrn, LPDDSURFACEDESC surfaceDesc) +/* + * + */ +int +ViaSwovSurfaceCreate(ScrnInfoPtr pScrn, viaPortPrivPtr pPriv, CARD32 FourCC, + CARD16 Width, CARD16 Height) { VIAPtr pVia = VIAPTR(pScrn); unsigned long retCode = Success; int numbuf = pVia->HWDiff.dwThreeHQVBuffer ? 3 : 2; - if (surfaceDesc == NULL) return BadAccess; + DBG_DD(ErrorF("ViaSwovSurfaceCreate: FourCC =0x%08lx\n", FourCC)); - switch (surfaceDesc->dwFourCC) - { + if (pVia->VideoStatus & VIDEO_SWOV_SURFACE_CREATED) + return Success; + + switch (FourCC) { case FOURCC_YUY2: - retCode = CreateSurface(pScrn, surfaceDesc, TRUE); - if (retCode != Success) break; - if (!(pVia->swov.gdwVideoFlagSW & SW_USE_HQV)) break; + retCode = CreateSurface(pScrn, FourCC, Width, Height, TRUE); + if (retCode != Success) + break; + if ((pVia->swov.gdwVideoFlagSW & SW_USE_HQV)) + retCode = AddHQVSurface(pScrn, numbuf, FOURCC_YUY2); + break; case FOURCC_HQVSW: retCode = AddHQVSurface(pScrn, numbuf, FOURCC_YUY2); break; case FOURCC_YV12: - retCode = CreateSurface(pScrn, surfaceDesc, TRUE); + retCode = CreateSurface(pScrn, FourCC, Width, Height, TRUE); if (retCode == Success) retCode = AddHQVSurface(pScrn, numbuf, FOURCC_YV12); break; - case FOURCC_VIA: - retCode = CreateSurface(pScrn, surfaceDesc, FALSE); + case FOURCC_XVMC: + retCode = CreateSurface(pScrn, FourCC, Width, Height, FALSE); if (retCode == Success) - retCode = AddHQVSurface(pScrn, numbuf, FOURCC_VIA); + retCode = AddHQVSurface(pScrn, numbuf, FOURCC_XVMC); break; default: break; } - return retCode; - -} /*VIAVidCreateSurface*/ - -/************************************************************************* - Function : VIAVidLockSurface - Lock Surface -*************************************************************************/ -unsigned long VIAVidLockSurface(ScrnInfoPtr pScrn, LPDDLOCK lpLock) -{ - VIAPtr pVia = VIAPTR(pScrn); - - switch (lpLock->dwFourCC) - { - case FOURCC_YUY2: - case FOURCC_YV12: - case FOURCC_VIA: - lpLock->SWDevice = pVia->swov.SWDevice; - lpLock->dwPhysicalBase = pVia->FrameBufferBase; + if (retCode == Success) { + pVia->swov.SWDevice.lpSWOverlaySurface[0] = pVia->FBBase + pVia->swov.SWDevice.dwSWPhysicalAddr[0]; + pVia->swov.SWDevice.lpSWOverlaySurface[1] = pVia->FBBase + pVia->swov.SWDevice.dwSWPhysicalAddr[1]; + + DBG_DD(ErrorF(" lpSWOverlaySurface[0]: %p\n", pVia->swov.SWDevice.lpSWOverlaySurface[0])); + DBG_DD(ErrorF(" lpSWOverlaySurface[1]: %p\n", pVia->swov.SWDevice.lpSWOverlaySurface[1])); + + pVia->VideoStatus |= VIDEO_SWOV_SURFACE_CREATED | VIDEO_SWOV_ON; } + return retCode; +} - return PI_OK; - -} /*VIAVidLockSurface*/ - -/************************************************************************* +/* * Destroy Surface -*************************************************************************/ -unsigned long VIAVidDestroySurface(ScrnInfoPtr pScrn, LPDDSURFACEDESC lpDDSurfaceDesc) + */ +void +ViaSwovSurfaceDestroy(ScrnInfoPtr pScrn, viaPortPrivPtr pPriv) { - VIAPtr pVia = VIAPTR(pScrn); - - DBG_DD(ErrorF("//VIAVidDestroySurface: \n")); - - switch (lpDDSurfaceDesc->dwFourCC) - { - case FOURCC_YUY2: - pVia->swov.DPFsrc.dwFlags = 0; - pVia->swov.DPFsrc.dwFourCC = 0; - - VIAFreeLinear(&pVia->swov.SWfbMem); - if (!(pVia->swov.gdwVideoFlagSW & SW_USE_HQV)) - { - pVia->swov.gdwVideoFlagSW = 0; - break; - } - - 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; - } - return PI_OK; - -} /*VIAVidDestroySurface*/ + VIAPtr pVia = VIAPTR(pScrn); + DBG_DD(ErrorF("ViaSwovSurfaceDestroy: FourCC =0x%08lx\n", + pPriv->FourCC)); + + if (pVia->VideoStatus & VIDEO_SWOV_SURFACE_CREATED) { + DBG_DD(ErrorF("ViaSwovSurfaceDestroy: VideoStatus =0x%08lx\n", + pVia->VideoStatus)); + + switch (pPriv->FourCC) { + case FOURCC_YUY2: + pVia->swov.SrcFourCC = 0; + + VIAFreeLinear(&pVia->swov.SWfbMem); + if ((pVia->swov.gdwVideoFlagSW & SW_USE_HQV)) + VIAFreeLinear(&pVia->swov.HQVMem); + pVia->swov.gdwVideoFlagSW = 0; + break; + + case FOURCC_HQVSW: + VIAFreeLinear(&pVia->swov.HQVMem); + pVia->swov.gdwVideoFlagSW = 0; + break; + + case FOURCC_YV12: + case FOURCC_XVMC: + pVia->swov.SrcFourCC = 0; + + VIAFreeLinear(&pVia->swov.SWfbMem); + VIAFreeLinear(&pVia->swov.HQVMem); + pVia->swov.gdwVideoFlagSW = 0; + break; + } + + pVia->VideoStatus &= ~VIDEO_SWOV_SURFACE_CREATED; + + } else + DBG_DD(ErrorF("ViaSwovSurfaceDestroy: No SW Overlay Surface Destroyed," + " VideoStatus =0x%08lx\n", pVia->VideoStatus)); +} static void SetFIFO_V1(VIAPtr pVia, CARD8 depth, CARD8 prethreshold, CARD8 threshold) { @@ -474,6 +1135,7 @@ static void SetFIFO_V3_64or32or32(VIAPtr pVia) switch (pVia->ChipId) { case PCI_CHIP_VT3205: + case PCI_CHIP_VT3204: SetFIFO_V3(pVia, 32, 29, 29); break; @@ -494,6 +1156,7 @@ static void SetFIFO_V3_64or32or16(VIAPtr pVia) switch (pVia->ChipId) { case PCI_CHIP_VT3205: + case PCI_CHIP_VT3204: SetFIFO_V3(pVia, 32, 29, 29); break; @@ -515,8 +1178,8 @@ SetupFIFOs(VIAPtr pVia, unsigned long videoFlag, unsigned long miniCtl, { if (miniCtl & V1_Y_INTERPOLY) { - if (pVia->swov.DPFsrc.dwFourCC == FOURCC_YV12 || - pVia->swov.DPFsrc.dwFourCC == FOURCC_VIA) + if (pVia->swov.SrcFourCC == FOURCC_YV12 || + pVia->swov.SrcFourCC == FOURCC_XVMC) { if (videoFlag & VIDEO_HQV_INUSE) { @@ -560,8 +1223,8 @@ SetupFIFOs(VIAPtr pVia, unsigned long videoFlag, unsigned long miniCtl, } else { - if (pVia->swov.DPFsrc.dwFourCC == FOURCC_YV12 || - pVia->swov.DPFsrc.dwFourCC == FOURCC_VIA) + if (pVia->swov.SrcFourCC == FOURCC_YV12 || + pVia->swov.SrcFourCC == FOURCC_XVMC) { if (videoFlag & VIDEO_HQV_INUSE) { @@ -632,82 +1295,12 @@ 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; 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) - { - 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) - { - switch (pVia->swov.DPFsrc.dwRGBBitCount) - { - case 16: - if (pVia->swov.DPFsrc.dwGBitMask==0x07E0) /*RGB16(5:6:5)*/ - { - 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 /*RGB15(5:5:5)*/ - { - 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) { @@ -763,12 +1356,24 @@ static void SetFetch(VIAPtr pVia, unsigned long videoFlag, CARD32 fetch) } static void SetDisplayCount(VIAPtr pVia, unsigned long videoFlag, - unsigned long srcHeight, CARD32 displayCountW) + unsigned long srcWidth, unsigned long srcHeight) { + unsigned long DisplayCount; + + /* Removed VIA's large pixelformat switch/case. + * All formats (YV12, UYVY, YUY2, VIA, RGB16 and RGB32) + * seem to use the same count. /A + */ + + if (videoFlag & VIDEO_HQV_INUSE) + DisplayCount = srcWidth - 1; + else + DisplayCount = srcWidth - pVia->swov.overlayRecordV1.dwminifyH; + if (videoFlag & VIDEO_1_INUSE) - SaveVideoRegister(pVia, V1_SOURCE_HEIGHT, (srcHeight << 16) | displayCountW); + SaveVideoRegister(pVia, V1_SOURCE_HEIGHT, (srcHeight << 16) | DisplayCount); else - SaveVideoRegister(pVia, V3_SOURCE_WIDTH, displayCountW); + SaveVideoRegister(pVia, V3_SOURCE_WIDTH, DisplayCount); } static void SetMiniAndZoom(VIAPtr pVia, unsigned long videoFlag, @@ -800,24 +1405,56 @@ static void FireVideoCommand(VIAPtr pVia, unsigned long videoFlag, CARD32 compos 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) +static void +SetVideoWindow(ScrnInfoPtr pScrn, unsigned long videoFlag, LPDDUPDATEOVERLAY pUpdate) { - if (top < 0) top = 0; - if (bottom < 0) bottom = 0; - if (left < 0) left = 0; - if (right < 0) right = 0; + VIAPtr pVia = VIAPTR(pScrn); + VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; + CARD32 left = pUpdate->DstLeft; + CARD32 top = pUpdate->DstTop; + CARD32 right = pUpdate->DstRight - 1; + CARD32 bottom = pUpdate->DstBottom - 1; + + DBG_DD(ErrorF("SetVideoWindow: X (%ld,%ld) Y (%ld,%ld)\n", + left, right, top, bottom)); + + /* 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 (videoFlag & VIDEO_1_INUSE) { + if (pBIOSInfo->SetDVI && pBIOSInfo->scaleY) { + top = pUpdate->DstTop * pBIOSInfo->panelY / pScrn->currentMode->VDisplay; + bottom = pUpdate->DstBottom * pBIOSInfo->panelY / pScrn->currentMode->VDisplay; + } + } + + if (top < 0) + top = 0; + else if (top > 2047) + top = 2047; + + if (bottom < 0) + bottom = 0; + else if (bottom > 2047) + bottom = 2047; + + if (left < 0) + left = 0; + else if (left > 2047) + left = 2047; - if (top > 2047) top = 2047; - if (bottom > 2047) bottom = 2047; - if (left > 2047) left = 2047; - if (right > 2047) right = 2047; + if (right < 0) + right = 0; + else 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 { + } else { SaveVideoRegister(pVia, V3_WIN_END_Y, (right << 16) | bottom); SaveVideoRegister(pVia, V3_WIN_START_Y, (left << 16) | top); } @@ -830,22 +1467,21 @@ static void SetVideoWindow(VIAPtr pVia, unsigned long videoFlag, * 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) +static Bool +Upd_Video(ScrnInfoPtr pScrn, unsigned long videoFlag, + unsigned long startAddr, LPDDUPDATEOVERLAY pUpdate, + unsigned long srcPitch, + unsigned long oriSrcWidth, unsigned long oriSrcHeight, + unsigned long deinterlaceMode, + unsigned long haveColorKey, unsigned long haveChromaKey, + unsigned long colorKeyLow, unsigned long colorKeyHigh, + unsigned long chromaKeyLow, unsigned long chromaKeyHigh) { VIAPtr pVia = VIAPTR(pScrn); vgaHWPtr hwp = VGAHWPTR(pScrn); VIAHWDiff *hwDiff = &pVia->HWDiff; - int i, j; + int i; unsigned long vidCtl = 0, compose; unsigned long srcWidth, srcHeight, dstWidth, dstHeight; unsigned long zoomCtl = 0, miniCtl = 0; @@ -855,445 +1491,336 @@ static unsigned long Upd_Video(ScrnInfoPtr pScrn, unsigned long videoFlag, 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)); + pUpdate->SrcLeft, pUpdate->SrcRight, + pUpdate->SrcTop, pUpdate->SrcBottom)); 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; - } - - /* 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) - { - 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 - { - if (videoFlag & VIDEO_HQV_INUSE) { - hqvSrcWidth = (unsigned long) rSrc.right - rSrc.left; - hqvDstWidth = (unsigned long) rDest.right - rDest.left; - - if (hqvSrcWidth > hqvDstWidth) { - dwOffset = dwOffset * hqvDstWidth / hqvSrcWidth; - } - - 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 (videoFlag & VIDEO_HQV_INUSE) { - hqvCtl |= HQV_FIELD_2_FRAME | HQV_FRAME_2_FIELD | HQV_DEINTERLACE; - } - else { - vidCtl |= V1_BOB_ENABLE | V1_FRAME_BASE; - } - } - else if (deinterlaceMode & DDOVER_BOB) { - if (videoFlag & VIDEO_HQV_INUSE) - { - //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; - } - } -*/ - if (videoFlag & 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) - { - 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 (videoFlag & VIDEO_1_INUSE) - SaveVideoRegister(pVia, V1_STRIDE, srcPitch); - else - SaveVideoRegister(pVia, V3_STRIDE, srcPitch); - - SaveVideoRegister(pVia, HQV_SRC_STRIDE, srcPitch); - SaveVideoRegister(pVia, HQV_DST_STRIDE, srcPitch); - } - - } - else - { - if (videoFlag & VIDEO_1_INUSE) - SaveVideoRegister(pVia, V1_STRIDE, srcPitch | (srcPitch << 15)); - else - SaveVideoRegister(pVia, V3_STRIDE, srcPitch | (srcPitch << 15)); - } - - 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) - { - /* 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; - - /* 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; - } - - SetFetch(pVia, videoFlag, fetch); - - /* Setup Y zoom factor */ - - /*For DCT450 test-BOB INTERLEAVE*/ - if ((deinterlaceMode & DDOVER_INTERLEAVED) && (deinterlaceMode & DDOVER_BOB)) - { - if (!(videoFlag & VIDEO_HQV_INUSE)) { - srcHeight /= 2; - if (videoFlag & VIDEO_1_INUSE) - vidCtl |= V1_BOB_ENABLE | V1_FRAME_BASE; - else - vidCtl |= V3_BOB_ENABLE | V3_FRAME_BASE; - } - else { - hqvCtl |= HQV_FIELD_2_FRAME | HQV_FRAME_2_FIELD | HQV_DEINTERLACE; - } - } - else if (deinterlaceMode & DDOVER_BOB) - { - if (videoFlag & VIDEO_HQV_INUSE) { - srcHeight <<= 1; - hqvCtl |= HQV_FIELD_2_FRAME | HQV_DEINTERLACE; - } - else { - if (videoFlag & VIDEO_1_INUSE) - vidCtl |= V1_BOB_ENABLE; - else - vidCtl |= V3_BOB_ENABLE; - } - } - - 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 (haveHQVzoomH || haveHQVzoomV) { - tmp = 0; - if (haveHQVzoomH) { - miniCtl = V1_X_INTERPOLY; - tmp = zoomCtl & 0xffff0000; - } - if (haveHQVzoomV) { - miniCtl |= V1_Y_INTERPOLY | V1_YCBCR_INTERPOLY; - tmp |= zoomCtl & 0x0000ffff; - hqvFilterCtl &= 0xfffdffff; - } - - /* Temporary fix for 2D bandwidth problem. 2002/08/01*/ - if (pVia->swov.gdwUseExtendedFIFO) { - miniCtl &= ~V1_Y_INTERPOLY; - } + pUpdate->DstLeft, pUpdate->DstRight, + pUpdate->DstTop, pUpdate->DstBottom)); + + pVia->swov.overlayRecordV1.dwWidth = dstWidth = pUpdate->DstRight - pUpdate->DstLeft; + pVia->swov.overlayRecordV1.dwHeight = dstHeight = pUpdate->DstBottom - pUpdate->DstTop; + srcWidth = (unsigned long) pUpdate->SrcRight - pUpdate->SrcLeft; + srcHeight = (unsigned long) pUpdate->SrcBottom - pUpdate->SrcTop; + 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, &vidCtl, &hqvCtl); + + if (hwDiff->dwThreeHQVBuffer) { /* CLE_C0: HQV supports triple-buffering */ + hqvCtl &= ~HQV_SW_FLIP; + hqvCtl |= HQV_TRIPLE_BUFF | HQV_FLIP_STATUS; + } + + /* Starting address of source and Source offset*/ + dwOffset = viaOverlayGetSrcStartAddress(pVia, videoFlag, pUpdate, srcPitch, &hqvOffset); + DBG_DD(ErrorF("===dwOffset= 0x%lx \n", dwOffset)); + + pVia->swov.overlayRecordV1.dwOffset = dwOffset; + + if (pVia->swov.SrcFourCC == FOURCC_YV12 || + pVia->swov.SrcFourCC == FOURCC_XVMC) { + YCBCRREC YCbCr; + if (videoFlag & VIDEO_HQV_INUSE) { + 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); + + if (pVia->swov.SrcFourCC != FOURCC_XVMC) { + 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 { + if (videoFlag & VIDEO_HQV_INUSE) { + hqvSrcWidth = (unsigned long) pUpdate->SrcRight - pUpdate->SrcLeft; + hqvDstWidth = (unsigned long) pUpdate->DstRight - pUpdate->DstLeft; + + if (hqvSrcWidth > hqvDstWidth) + dwOffset = dwOffset * hqvDstWidth / hqvSrcWidth; + + 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); + } + } - SetMiniAndZoom(pVia, videoFlag, miniCtl, tmp); - } - else { - if (srcHeight == dstHeight) { - hqvFilterCtl &= 0xfffdffff; - } - SetMiniAndZoom(pVia, videoFlag, 0, 0); - } - SaveVideoRegister(pVia, HQV_MINIFY_CONTROL, hqvMiniCtl); - SaveVideoRegister(pVia, HQV_FILTER_CONTROL, hqvFilterCtl); - } - else { - SetMiniAndZoom(pVia, videoFlag, miniCtl, zoomCtl); - } + fetch = viaOverlayGetFetch(pVia, videoFlag, + srcWidth, dstWidth, oriSrcWidth, &hqvSrcFetch); + DBG_DD(ErrorF("===fetch= 0x%lx \n", fetch)); - if (haveColorKey) { - compose = SetColorKey(pVia, videoFlag, colorKeyLow, colorKeyHigh, compose); - } +#if 0 + /* For DCT450 test-BOB INTERLEAVE */ + if ((deinterlaceMode & DDOVER_INTERLEAVED) && (deinterlaceMode & DDOVER_BOB)) { + if (videoFlag & VIDEO_HQV_INUSE) + hqvCtl |= HQV_FIELD_2_FRAME | HQV_FRAME_2_FIELD | HQV_DEINTERLACE; + else + vidCtl |= V1_BOB_ENABLE | V1_FRAME_BASE; + } else if (deinterlaceMode & DDOVER_BOB) { + if (videoFlag & VIDEO_HQV_INUSE) + /* 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; + } +#endif + + if (videoFlag & VIDEO_HQV_INUSE) { + if (!(deinterlaceMode & DDOVER_INTERLEAVED) && (deinterlaceMode & DDOVER_BOB)) + SetHQVFetch(pVia, hqvSrcFetch, oriSrcHeight << 1); + else + SetHQVFetch(pVia, hqvSrcFetch, oriSrcHeight); + + if (pVia->swov.SrcFourCC == FOURCC_YV12 || + pVia->swov.SrcFourCC == FOURCC_XVMC) { + 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 (videoFlag & VIDEO_1_INUSE) + SaveVideoRegister(pVia, V1_STRIDE, srcPitch); + else + SaveVideoRegister(pVia, V3_STRIDE, srcPitch); + + SaveVideoRegister(pVia, HQV_SRC_STRIDE, srcPitch); + SaveVideoRegister(pVia, HQV_DST_STRIDE, srcPitch); + } + + } else { + if (videoFlag & VIDEO_1_INUSE) + SaveVideoRegister(pVia, V1_STRIDE, srcPitch | (srcPitch << 15)); + else + SaveVideoRegister(pVia, V3_STRIDE, srcPitch | (srcPitch << 15)); + } + + /* Set destination window */ + SetVideoWindow(pScrn, videoFlag, pUpdate); + + compose |= ALWAYS_SELECT_VIDEO; + + /* Setup X zoom factor*/ + + pVia->swov.overlayRecordV1.dwFetchAlignment = 0; + + if (!viaOverlayHQVCalcZoomWidth(pVia, videoFlag, srcWidth, dstWidth, &zoomCtl, &miniCtl, + &hqvFilterCtl, &hqvMiniCtl, &haveHQVzoomH)) { + /* Need to scale (minify) too much - can't handle it. */ + SetFetch(pVia, videoFlag, fetch); + FireVideoCommand(pVia, videoFlag, compose); + FlushVidRegBuffer(pVia); + return FALSE; + } + + SetFetch(pVia, videoFlag, fetch); + + /* Setup Y zoom factor */ + + /* For DCT450 test-BOB INTERLEAVE */ + if ((deinterlaceMode & DDOVER_INTERLEAVED) && (deinterlaceMode & DDOVER_BOB)) { + if (!(videoFlag & VIDEO_HQV_INUSE)) { + srcHeight /= 2; + if (videoFlag & VIDEO_1_INUSE) + vidCtl |= V1_BOB_ENABLE | V1_FRAME_BASE; + else + vidCtl |= V3_BOB_ENABLE | V3_FRAME_BASE; + } else + hqvCtl |= HQV_FIELD_2_FRAME | HQV_FRAME_2_FIELD | HQV_DEINTERLACE; + } else if (deinterlaceMode & DDOVER_BOB) { + if (videoFlag & VIDEO_HQV_INUSE) { + srcHeight <<= 1; + hqvCtl |= HQV_FIELD_2_FRAME | HQV_DEINTERLACE; + } else { + if (videoFlag & VIDEO_1_INUSE) + vidCtl |= V1_BOB_ENABLE; + else + vidCtl |= V3_BOB_ENABLE; + } + } - if (haveChromaKey) { - compose = SetChromaKey(pVia, videoFlag, - chromaKeyLow, chromaKeyHigh, miniCtl, compose); - } + SetDisplayCount(pVia, videoFlag, srcWidth, srcHeight); + + if (!viaOverlayHQVCalcZoomHeight(pVia, srcHeight, dstHeight, &zoomCtl, &miniCtl, + &hqvFilterCtl, &hqvMiniCtl ,&haveHQVzoomV)) { + /* Need to scale (minify) too much - can't handle it. */ + FireVideoCommand(pVia, videoFlag, compose); + FlushVidRegBuffer(pVia); + return FALSE; + } + + SetupFIFOs(pVia, videoFlag, miniCtl, srcWidth); + + if (videoFlag & VIDEO_HQV_INUSE) { + miniCtl=0; + + if (haveHQVzoomH || haveHQVzoomV) { + tmp = 0; + + if (haveHQVzoomH) { + miniCtl = V1_X_INTERPOLY; + tmp = zoomCtl & 0xffff0000; + } + + if (haveHQVzoomV) { + miniCtl |= V1_Y_INTERPOLY | V1_YCBCR_INTERPOLY; + tmp |= zoomCtl & 0x0000ffff; + hqvFilterCtl &= 0xfffdffff; + } + + /* Temporary fix for 2D bandwidth problem. 2002/08/01*/ + if (pVia->swov.gdwUseExtendedFIFO) + miniCtl &= ~V1_Y_INTERPOLY; + + SetMiniAndZoom(pVia, videoFlag, miniCtl, tmp); + } else { + if (srcHeight == dstHeight) + hqvFilterCtl &= 0xfffdffff; + + SetMiniAndZoom(pVia, videoFlag, 0, 0); + } + SaveVideoRegister(pVia, HQV_MINIFY_CONTROL, hqvMiniCtl); + SaveVideoRegister(pVia, HQV_FILTER_CONTROL, hqvFilterCtl); + } else + SetMiniAndZoom(pVia, videoFlag, miniCtl, zoomCtl); + + if (haveColorKey) + compose = SetColorKey(pVia, videoFlag, colorKeyLow, colorKeyHigh, compose); + + if (haveChromaKey) + compose = SetChromaKey(pVia, videoFlag, chromaKeyLow, chromaKeyHigh, + miniCtl, compose); - /* determine which video stream is on top */ - /* - DBG_DD(ErrorF(" flags= 0x%08lx\n", flags)); - if (flags & DDOVER_CLIP) - compose |= COMPOSE_V3_TOP; - else - compose |= COMPOSE_V1_TOP; - */ - - /* Setup video control*/ - if (videoFlag & VIDEO_HQV_INUSE) { - if (!pVia->swov.SWVideo_ON) - /*if (0)*/ - { - DBG_DD(ErrorF(" First HQV\n")); - - FlushVidRegBuffer(pVia); - - DBG_DD(ErrorF(" Wait flips")); - - 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 */ - { - CARD32 volatile *HQVCtrl = - (CARD32 volatile *) (pVia->VidMapBase + HQV_CONTROL); - - /* check HQV is idle */ - - DBG_DD(ErrorF("HQV control wf - %08x\n", *HQVCtrl)); - while(!(*HQVCtrl & HQV_IDLE)) { - DBG_DD(ErrorF("HQV control busy - %08x\n", *HQVCtrl)); - usleep(1); - } - - VIDOutD(HQV_CONTROL, hqvCtl & ~HQV_SW_FLIP); - VIDOutD(HQV_CONTROL, hqvCtl | HQV_SW_FLIP); - - DBG_DD(ErrorF("HQV control wf5 - %08x\n", *HQVCtrl)); - DBG_DD(ErrorF(" Wait flips5")); - - 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); - } + /* Setup video control*/ + if (videoFlag & VIDEO_HQV_INUSE) { + if (!pVia->swov.SWVideo_ON) { + DBG_DD(ErrorF(" First HQV\n")); + + FlushVidRegBuffer(pVia); + + DBG_DD(ErrorF(" Wait flips")); + + 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 */ + CARD32 volatile *HQVCtrl = + (CARD32 volatile *) (pVia->VidMapBase + HQV_CONTROL); + + /* check HQV is idle */ + DBG_DD(ErrorF("HQV control wf - %08lx\n", *HQVCtrl)); + while (!(*HQVCtrl & HQV_IDLE)) { + DBG_DD(ErrorF("HQV control busy - %08lx\n", *HQVCtrl)); + usleep(1); + } + + VIDOutD(HQV_CONTROL, hqvCtl & ~HQV_SW_FLIP); + VIDOutD(HQV_CONTROL, hqvCtl | HQV_SW_FLIP); + + DBG_DD(ErrorF("HQV control wf5 - %08lx\n", *HQVCtrl)); + DBG_DD(ErrorF(" Wait flips5")); + + for (i = 0; (i < 50) && !(*HQVCtrl & HQV_FLIP_STATUS); i++) { + DBG_DD(ErrorF(" HQV wait %d %08lx\n",i, *HQVCtrl)); + *HQVCtrl |= HQV_SW_FLIP | HQV_FLIP_STATUS; + usleep(1); + } #if 0 - viaWaitHQVFlip(pVia); + viaWaitHQVFlip(pVia); #endif - DBG_DD(ErrorF(" Wait flips6")); - } - - if (videoFlag & VIDEO_1_INUSE) - { - VIDOutD(V1_CONTROL, vidCtl); - VIDOutD(V_COMPOSE_MODE, compose | V1_COMMAND_FIRE); - if (pVia->swov.gdwUseExtendedFIFO) - { - /*Set Display FIFO*/ - 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")); - } - } - else - { - DBG_DD(ErrorF(" Wait flips 10")); - VIDOutD(V3_CONTROL, vidCtl); - VIDOutD(V_COMPOSE_MODE, compose | V3_COMMAND_FIRE); - } - DBG_DD(ErrorF(" Done flips")); - } - else - { - DBG_DD(ErrorF(" Normal called\n")); - SetVideoControl(pVia, videoFlag, vidCtl); - FireVideoCommand(pVia, videoFlag, compose); - SaveVideoRegister(pVia, HQV_CONTROL, hqvCtl | HQV_FLIP_STATUS); - viaWaitHQVDone(pVia); - FlushVidRegBuffer(pVia); - } - } - else - { - SetVideoControl(pVia, videoFlag, vidCtl); - FireVideoCommand(pVia, videoFlag, compose); - viaWaitHQVDone(pVia); - FlushVidRegBuffer(pVia); - } - pVia->swov.SWVideo_ON = TRUE; + DBG_DD(ErrorF(" Wait flips6")); + } + + if (videoFlag & VIDEO_1_INUSE) { + VIDOutD(V1_CONTROL, vidCtl); + VIDOutD(V_COMPOSE_MODE, compose | V1_COMMAND_FIRE); + if (pVia->swov.gdwUseExtendedFIFO) { + /*Set Display FIFO*/ + 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")); + } + } else { + DBG_DD(ErrorF(" Wait flips 10")); + VIDOutD(V3_CONTROL, vidCtl); + VIDOutD(V_COMPOSE_MODE, compose | V3_COMMAND_FIRE); + } + DBG_DD(ErrorF(" Done flips")); + } else { + DBG_DD(ErrorF(" Normal called\n")); + SetVideoControl(pVia, videoFlag, vidCtl); + FireVideoCommand(pVia, videoFlag, compose); + SaveVideoRegister(pVia, HQV_CONTROL, hqvCtl | HQV_FLIP_STATUS); + viaWaitHQVDone(pVia); + FlushVidRegBuffer(pVia); + } + } else { + SetVideoControl(pVia, videoFlag, vidCtl); + FireVideoCommand(pVia, videoFlag, compose); + viaWaitHQVDone(pVia); + FlushVidRegBuffer(pVia); } - else - { - /* Hide overlay */ + pVia->swov.SWVideo_ON = TRUE; - if (hwDiff->dwHQVDisablePatch) /*CLE_C0*/ - ViaSeqMask(hwp, 0x2E, 0x00, 0x10); - - 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 - SaveVideoRegister(pVia, V3_CONTROL, VIDInD(V3_CONTROL) & ~V3_ENABLE); - - 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 TRUE; } /* Upd_Video */ -/************************************************************************* +/* * VIAVidUpdateOverlay * Parameters: src rectangle, dst rectangle, colorkey... * Return Value: unsigned long of state * note: Update the overlay image param. - *************************************************************************/ -unsigned long VIAVidUpdateOverlay(ScrnInfoPtr pScrn, LPDDUPDATEOVERLAY pUpdate) + */ +Bool +VIAVidUpdateOverlay(ScrnInfoPtr pScrn, LPDDUPDATEOVERLAY pUpdate) { VIAPtr pVia = VIAPTR(pScrn); - vgaHWPtr hwp = VGAHWPTR(pScrn); OVERLAYRECORD* ovlV1 = &pVia->swov.overlayRecordV1; unsigned long flags = pUpdate->dwFlags; @@ -1316,21 +1843,21 @@ unsigned long VIAVidUpdateOverlay(ScrnInfoPtr pScrn, LPDDUPDATEOVERLAY pUpdate) /* Adjust to fix panning mode bug */ - pUpdate->rDest.left -= panDX; - pUpdate->rDest.top -= panDY; - pUpdate->rDest.right -= panDX; - pUpdate->rDest.bottom -= panDY; + pUpdate->DstLeft -= panDX; + pUpdate->DstTop -= panDY; + pUpdate->DstRight -= panDX; + pUpdate->DstBottom -= panDY; DBG_DD(ErrorF("Raw rSrc X (%ld,%ld) Y (%ld,%ld)\n", - pUpdate->rSrc.left, pUpdate->rSrc.right, - pUpdate->rSrc.top, pUpdate->rSrc.bottom)); + pUpdate->SrcLeft, pUpdate->SrcRight, + pUpdate->SrcTop, pUpdate->SrcBottom)); DBG_DD(ErrorF("Raw rDest X (%ld,%ld) Y (%ld,%ld)\n", - pUpdate->rDest.left, pUpdate->rDest.right, - pUpdate->rDest.top, pUpdate->rDest.bottom)); + pUpdate->DstLeft, pUpdate->DstRight, + pUpdate->DstTop, pUpdate->DstBottom)); - if ((pVia->swov.DPFsrc.dwFourCC == FOURCC_YUY2) || - (pVia->swov.DPFsrc.dwFourCC == FOURCC_YV12) || - (pVia->swov.DPFsrc.dwFourCC == FOURCC_VIA)) + if ((pVia->swov.SrcFourCC == FOURCC_YUY2) || + (pVia->swov.SrcFourCC == FOURCC_YV12) || + (pVia->swov.SrcFourCC == FOURCC_XVMC)) { videoFlag = pVia->swov.gdwVideoFlagSW; } @@ -1343,156 +1870,142 @@ unsigned long VIAVidUpdateOverlay(ScrnInfoPtr pScrn, LPDDUPDATEOVERLAY pUpdate) ResetVidRegBuffer(pVia); - if (flags & DDOVER_HIDE) - { - 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; - } - pVia->swov.SWVideo_ON = FALSE; - - 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))); - pVia->swov.gdwUseExtendedFIFO = 0; - } - return PI_OK; + /*for SW decode HW overlay use*/ + startAddr = VIDInD(HQV_SRC_STARTADDR_Y); + + if (flags & DDOVER_KEYDEST) { + haveColorKey = 1; + colorKeyLow = pUpdate->dwColorSpaceLowValue; } - if (flags & DDOVER_SHOW) - { - /*for SW decode HW overlay use*/ - startAddr = VIDInD(HQV_SRC_STARTADDR_Y); - - if (flags & DDOVER_KEYDEST) { - haveColorKey = 1; - colorKeyLow = pUpdate->dwColorSpaceLowValue; - } - 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; - } - - videoFlag |= VIDEO_SHOW; - - /* Figure out actual rSrc rectangle */ - - 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. */ - - 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; - } - - 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 */ - - 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*/ - + if (flags & DDOVER_INTERLEAVED) + deinterlaceMode |= DDOVER_INTERLEAVED; + + if (flags & DDOVER_BOB) + deinterlaceMode |= DDOVER_BOB; + + if ((pVia->ChipId == PCI_CHIP_CLE3122) && (pScrn->currentMode->HDisplay > 1024)) { + DBG_DD(ErrorF("UseExtendedFIFO\n")); + pVia->swov.gdwUseExtendedFIFO = 1; + } else + pVia->swov.gdwUseExtendedFIFO = 0; + + /* Figure out actual rSrc rectangle */ + + dstLeft = pUpdate->DstLeft; + dstTop = pUpdate->DstTop; + dstRight = pUpdate->DstRight; + dstBottom = pUpdate->DstBottom; + + scrnWidth = pScrn->currentMode->HDisplay; + scrnHeight = pScrn->currentMode->VDisplay; + + if (dstLeft < 0) { + pUpdate->SrcLeft = (((-dstLeft) * ovlV1->dwV1OriWidth) + + ((dstRight - dstLeft) >> 1)) / (dstRight - dstLeft); + } + if (dstRight > scrnWidth) { + pUpdate->SrcRight = (((scrnWidth - dstLeft) * ovlV1->dwV1OriWidth) + + ((dstRight - dstLeft) >> 1)) / (dstRight - dstLeft); + } + if (dstTop < 0) { + pUpdate->SrcTop = (((-dstTop) * ovlV1->dwV1OriHeight) + + ((dstBottom - dstTop) >> 1)) / (dstBottom - dstTop); + } + if (dstBottom > scrnHeight) { + pUpdate->SrcBottom = (((scrnHeight - dstTop) * ovlV1->dwV1OriHeight) + + ((dstBottom - dstTop) >> 1)) / (dstBottom - dstTop); + } + + /* Save modified src & original dest rectangle param. */ + + if ((pVia->swov.SrcFourCC == FOURCC_YUY2) || + (pVia->swov.SrcFourCC == FOURCC_YV12) || + (pVia->swov.SrcFourCC == FOURCC_XVMC)) { + pVia->swov.SWDevice.gdwSWDstLeft = pUpdate->DstLeft + panDX; + pVia->swov.SWDevice.gdwSWDstTop = pUpdate->DstTop + panDY; + pVia->swov.SWDevice.gdwSWDstWidth = pUpdate->DstRight - pUpdate->DstLeft; + pVia->swov.SWDevice.gdwSWDstHeight = pUpdate->DstBottom - pUpdate->DstTop; + + pVia->swov.SWDevice.gdwSWSrcWidth = + ovlV1->dwV1SrcWidth = pUpdate->SrcRight - pUpdate->SrcLeft; + pVia->swov.SWDevice.gdwSWSrcHeight = + ovlV1->dwV1SrcHeight = pUpdate->SrcBottom - pUpdate->SrcTop; + } + + ovlV1->dwV1SrcLeft = pUpdate->SrcLeft; + ovlV1->dwV1SrcRight = pUpdate->SrcRight; + ovlV1->dwV1SrcTop = pUpdate->SrcTop; + ovlV1->dwV1SrcBot = pUpdate->SrcBottom; + + /* Figure out actual rDest rectangle */ + + pUpdate->DstLeft = (dstLeft < 0) ? 0 : dstLeft; + pUpdate->DstTop = (dstTop < 0) ? 0 : dstTop; + if (pUpdate->DstTop >= scrnHeight) pUpdate->DstTop = scrnHeight-1; + pUpdate->DstRight = (dstRight > scrnWidth) ? scrnWidth : dstRight; + pUpdate->DstBottom = (dstBottom > scrnHeight) ? scrnHeight : dstBottom; + + /* Update the overlay */ + + if (!Upd_Video(pScrn, videoFlag, startAddr, pUpdate, + pVia->swov.SWDevice.dwPitch, ovlV1->dwV1OriWidth, + ovlV1->dwV1OriHeight, deinterlaceMode, haveColorKey, haveChromaKey, + colorKeyLow, colorKeyHigh, chromaKeyLow, chromaKeyHigh)) + return FALSE; + + pVia->swov.SWVideo_ON = FALSE; + pVia->swov.panning_old_x = pVia->swov.panning_x; pVia->swov.panning_old_y = pVia->swov.panning_y; - return PI_OK; + return TRUE; } /*VIAVidUpdateOverlay*/ - -/************************************************************************* - * ADJUST FRAME - *************************************************************************/ -void VIAVidAdjustFrame(ScrnInfoPtr pScrn, int x, int y) +/* + * + */ +void +ViaOverlayHide(ScrnInfoPtr pScrn) { - VIAPtr pVia = VIAPTR(pScrn); - pVia->swov.panning_x = x; - pVia->swov.panning_y = y; + VIAPtr pVia = VIAPTR(pScrn); + vgaHWPtr hwp = VGAHWPTR(pScrn); + CARD32 videoFlag = 0; + + if ((pVia->swov.SrcFourCC == FOURCC_YUY2) || + (pVia->swov.SrcFourCC == FOURCC_YV12) || + (pVia->swov.SrcFourCC == FOURCC_XVMC)) + videoFlag = pVia->swov.gdwVideoFlagSW; + + ResetVidRegBuffer(pVia); + + if (pVia->HWDiff.dwHQVDisablePatch) + ViaSeqMask(hwp, 0x2E, 0x00, 0x10); + + 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 + SaveVideoRegister(pVia, V3_CONTROL, VIDInD(V3_CONTROL) & ~V3_ENABLE); + + FireVideoCommand(pVia, videoFlag, VIDInD(V_COMPOSE_MODE)); + FlushVidRegBuffer(pVia); + + if (pVia->HWDiff.dwHQVDisablePatch) + ViaSeqMask(hwp, 0x2E, 0x10, 0x10); + + pVia->swov.SWVideo_ON = FALSE; + + if (pVia->swov.gdwUseExtendedFIFO) + ViaSetPrimaryFIFO(pScrn, pScrn->currentMode); + + pVia->VideoStatus &= ~VIDEO_SWOV_ON; } diff --git a/src/via_swov.h b/src/via_swov.h index b841aa9..ac84d6d 100644 --- a/src/via_swov.h +++ b/src/via_swov.h @@ -1,4 +1,5 @@ /* + * 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. * @@ -16,16 +17,16 @@ * 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 + * 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_SWOV_H_ #define _VIA_SWOV_H_ 1 -/*#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 */ #ifdef XV_DEBUG # define DBG_DD(x) (x) @@ -38,6 +39,8 @@ /* Definition for VideoStatus */ #define VIDEO_NULL 0x00000000 +#define VIDEO_SWOV_SURFACE_CREATED 0x00000001 +#define VIDEO_SWOV_ON 0x00000002 /*For Video HW Difference */ #define VID_HWDIFF_TRUE 0x00000001 @@ -72,10 +75,9 @@ typedef struct __VIAHWDiff } VIAHWDiff; 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 pUpdate); -void VIAVidAdjustFrame(ScrnInfoPtr pScrn, int x, int y); +int ViaSwovSurfaceCreate(ScrnInfoPtr pScrn, viaPortPrivPtr pPriv, CARD32 FourCC, CARD16 Width, CARD16 Height); +void ViaSwovSurfaceDestroy(ScrnInfoPtr pScrn, viaPortPrivPtr pPriv); +Bool VIAVidUpdateOverlay(ScrnInfoPtr pScrn, LPDDUPDATEOVERLAY pUpdate); +void ViaOverlayHide(ScrnInfoPtr pScrn); #endif /* _VIA_SWOV_H_ */ diff --git a/src/via_vbe.c b/src/via_vbe.c new file mode 100644 index 0000000..9ba60d5 --- /dev/null +++ b/src/via_vbe.c @@ -0,0 +1,275 @@ +/* + * Copyright 2004 The Unichrome Project [unichrome.sf.net] + * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) + * + * 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 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. + */ +/* + * + * VBE Mode setting + * + */ + +#include "via_driver.h" +#include "vbe.h" +#include "vbeModes.h" + +#define R16(v) ((v) & 0xffff) + +/* + * Functions more or less stolen from the vesa driver. Added to support BIOS modes directly. + */ + +void +ViaVbeAdjustFrame(int scrnIndex, int x, int y, int flags) +{ + VIAPtr pVia = VIAPTR(xf86Screens[scrnIndex]); + + VBESetDisplayStart(pVia->pVbe, x, y, TRUE); +} + +Bool +ViaVbeSetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) +{ + VIAPtr pVia; + VbeModeInfoData *data; + int mode; + + pVia = VIAPTR(pScrn); + + pVia->OverlaySupported = FALSE; + + if (pVia->FirstInit) + memset(pVia->FBBase, 0x00, pVia->videoRambytes); + + data = (VbeModeInfoData*)pMode->Private; + + mode = data->mode | (1 << 15); + + /* enable linear addressing */ + mode |= 1 << 14; + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Trying VBE Mode %dx%d (0x%x) :\n", + (int) data->data->XResolution, + (int) data->data->YResolution, + mode & ~(1 << 11)); + if (VBESetVBEMode(pVia->pVbe, mode, data->block) == FALSE) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VBESetVBEMode failed"); + if ((data->block || (data->mode & (1 << 11))) && + VBESetVBEMode(pVia->pVbe, (mode & ~(1 << 11)), NULL) == TRUE) { + /* Some cards do not like setting the clock. + */ + xf86ErrorF("...but worked OK without customized refresh and dotclock.\n"); + data->mode &= ~(1 << 11); + } + else { + ErrorF("\n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Set VBE Mode failed!\n"); + return (FALSE); + } + } + + if (data->data->XResolution != pScrn->displayWidth) + VBESetLogicalScanline(pVia->pVbe, pScrn->displayWidth); + + pScrn->vtSema = TRUE; + + if (!pVia->NoAccel) + VIAInitialize2DEngine(pScrn); + +#ifdef XF86DRI + VIAInitialize3DEngine(pScrn); +#endif + + ViaVbeAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + VIAAccelSync(pScrn); + + + return (TRUE); +} + +Bool +ViaVbeSaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function) +{ + VIAPtr pVia = VIAPTR(pScrn); + vgaHWPtr hwp = VGAHWPTR(pScrn); + + if ((MODE_QUERY < 0) || (function > MODE_RESTORE)) + return (FALSE); + + if (function == MODE_SAVE) { + pVia->SavedReg.SR1A = hwp->readSeq(hwp, 0x1A); + } + + /* Query amount of memory to save state */ + if ((function == MODE_QUERY) || + ((function == MODE_SAVE) && (pVia->vbeMode.state == NULL))) { + + /* Make sure we save at least this information in case of failure */ + (void)VBEGetVBEMode(pVia->pVbe, &(pVia->vbeMode.stateMode)); + + if (pVia->vbeMode.major > 1) { + + if (!VBESaveRestore(pVia->pVbe, function, + (pointer) &(pVia->vbeMode.state), + &(pVia->vbeMode.stateSize), + &(pVia->vbeMode.statePage))) + return FALSE; + + } + } + + /* Save/Restore Super VGA state */ + if (function != MODE_QUERY) { + Bool retval = TRUE; + + if (pVia->vbeMode.major > 1) { + if (function == MODE_RESTORE) + memcpy(pVia->vbeMode.state, pVia->vbeMode.pstate, pVia->vbeMode.stateSize); + + if ((retval = VBESaveRestore(pVia->pVbe, function, + (pointer) &(pVia->vbeMode.state), + &(pVia->vbeMode.stateSize), + &(pVia->vbeMode.statePage))) + && (function == MODE_SAVE)) { + /* don't rely on the memory not being touched */ + if (pVia->vbeMode.pstate == NULL) + pVia->vbeMode.pstate = xalloc(pVia->vbeMode.stateSize); + memcpy(pVia->vbeMode.pstate, pVia->vbeMode.state, pVia->vbeMode.stateSize); + } + } + + if (function == MODE_RESTORE) { + VBESetVBEMode(pVia->pVbe, pVia->vbeMode.stateMode, NULL); + } + + if (!retval) + return (FALSE); + + } + + return (TRUE); +} + + +Bool +ViaVbeModePreInit(ScrnInfoPtr pScrn) +{ + VIAPtr pVia = VIAPTR(pScrn); + VbeInfoBlock *vbe; + VbeModeInfoBlock *vbeMode; + DisplayModePtr pMode; + int i; + + memset(&(pVia->vbeMode), 0, sizeof(ViaVbeModeInfo)); + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Searching for matching VESA mode(s):\n"); + + if ((vbe = VBEGetVBEInfo(pVia->pVbe)) == NULL) { + return FALSE; + } + + pVia->vbeMode.major = (unsigned) (vbe->VESAVersion >> 8); + pVia->vbeMode.minor = vbe->VESAVersion & 0xff; + + pScrn->modePool = VBEGetModePool (pScrn, pVia->pVbe, vbe, V_MODETYPE_VBE); + if (pScrn->modePool == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No matching modes\n"); + return FALSE; + } + + VBESetModeNames(pScrn->modePool); + + i = VBEValidateModes(pScrn, NULL, pScrn->display->modes, + NULL, NULL, 0, 2048, 1, 0, 2048, + pScrn->display->virtualX, + pScrn->display->virtualY, + pScrn->videoRam, LOOKUP_BEST_REFRESH); + + + if (i <= 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n"); + return (FALSE); + } + + VBESetModeParameters(pScrn, pVia->pVbe); + xf86PruneDriverModes(pScrn); + + pMode = pScrn->modes; + do { + vbeMode = ((VbeModeInfoData*)pMode->Private)->data; + pMode = pMode->next; + } while (pMode != pScrn->modes); + + return TRUE; +} + +static int ViaVbePanelPower(vbeInfoPtr pVbe, int mode) +{ + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x5F54; + pVbe->pInt10->bx = (mode) ? 0x00 : 0x01; + + xf86ExecX86int10(pVbe->pInt10); + + return (R16(pVbe->pInt10->ax) == 0x015f); +} + +#if 0 +/* + * FIXME: This might be useful in the future. Otherwise feel free to remove. + * if mode=1 sets the panel in a low power, low performance state. + * if mode=0 high performance. + */ + +static int ViaVbePanelLowPower(vbeInfoPtr pVbe, int mode) +{ + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x5F60; + pVbe->pInt10->bx = (mode) ? 0x01 : 0x00; + + xf86ExecX86int10(pVbe->pInt10); + + return (R16(pVbe->pInt10->ax) == 0x015f); +} +#endif + +void +ViaVbeDoDPMS(ScrnInfoPtr pScrn, int mode) +{ + VIAPtr pVia = VIAPTR(pScrn); + VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; + + + if (pBIOSInfo->PanelActive) + ViaVbePanelPower(pVia->pVbe, (mode == DPMSModeOn)); + + VBEDPMSSet(pVia->pVbe,mode); +} + +void +ViaVbeDPMS(ScrnInfoPtr pScrn, int mode, int flags) +{ + if (!pScrn->vtSema) + return; + + ViaVbeDoDPMS(pScrn, mode); +} diff --git a/src/via_vgahw.c b/src/via_vgahw.c index 45ab601..b1b79cb 100644 --- a/src/via_vgahw.c +++ b/src/via_vgahw.c @@ -15,9 +15,9 @@ * 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 + * 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. */ @@ -164,7 +164,7 @@ ViaVgahwPrint(vgaHWPtr hwp) { int i; xf86DrvMsg(hwp->pScrn->scrnIndex, X_INFO, "Printing VGA Sequence registers:\n"); - for (i = 0x00; i < 0x93; i++) + for (i = 0x00; i < 0x80; i++) xf86DrvMsg(hwp->pScrn->scrnIndex, X_INFO, "SR%02X: 0x%02X\n", i, hwp->readSeq(hwp, i)); xf86DrvMsg(hwp->pScrn->scrnIndex, X_INFO, "Printing VGA CRTM/C registers:\n"); diff --git a/src/via_vgahw.h b/src/via_vgahw.h index 41d2a1c..10047bb 100644 --- a/src/via_vgahw.h +++ b/src/via_vgahw.h @@ -15,9 +15,9 @@ * 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 + * 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_VGAHW_H_ diff --git a/src/via_video.c b/src/via_video.c index 160b506..80ae35d 100644 --- a/src/via_video.c +++ b/src/via_video.c @@ -16,9 +16,9 @@ * 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 + * 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. */ @@ -79,16 +79,17 @@ static vidCopyFunc viaFastVidCpy = NULL; /* * F U N C T I O N D E C L A R A T I O N */ -XF86VideoAdaptorPtr viaSetupImageVideoG(ScreenPtr); -static void viaStopVideoG(ScrnInfoPtr, pointer, Bool); -static void viaQueryBestSizeG(ScrnInfoPtr, Bool, +static unsigned viaSetupAdaptors(ScreenPtr pScreen, XF86VideoAdaptorPtr **adaptors); +static void viaStopVideo(ScrnInfoPtr, pointer, Bool); +static void viaQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short, unsigned int *, unsigned int *, pointer); -static int viaPutVideo(ScrnInfoPtr , - short , short , short , short ,short , short , short , short , - RegionPtr , pointer ); - -static int viaQueryImageAttributesG(ScrnInfoPtr, +static int viaQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, unsigned short *, int *, int *); +static int viaGetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer); +static int viaSetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); +static int viaPutImage(ScrnInfoPtr, short, short, short, short, short, short, + short, short,int, unsigned char*, short, short, Bool, + RegionPtr, pointer); static Atom xvBrightness, xvContrast, xvColorKey, xvHue, xvSaturation, xvAutoPaint; @@ -141,7 +142,7 @@ static XF86ImageRec ImagesG[NUM_IMAGES_G] = * Defined to have a zero data size. */ - FOURCC_VIA, + FOURCC_XVMC, XvYUV, LSBFirst, {'V','I','A',0x00, @@ -159,12 +160,16 @@ static XF86ImageRec ImagesG[NUM_IMAGES_G] = } }; -static char * XVPORTNAME[XV_PORT_NUM] = +static char * XvAdaptorName[XV_ADAPT_NUM] = { - "XV_SWOV", - "XV_DUMMY" + "XV_SWOV" }; +static XF86VideoAdaptorPtr viaAdaptPtr[XV_ADAPT_NUM]; +static XF86VideoAdaptorPtr *allAdaptors; +static unsigned numAdaptPort[XV_ADAPT_NUM] = + {1}; + /* * F U N C T I O N */ @@ -181,102 +186,110 @@ static Bool DecideOverlaySupport(ScrnInfoPtr pScrn) /* Small trick here. We keep the height in 16's of lines and width in 32's to avoid numeric overflow */ - if ( pVia->ChipId != PCI_CHIP_VT3205 ) { + if ( pVia->ChipId != PCI_CHIP_VT3205 && + pVia->ChipId != PCI_CHIP_VT3204 ) { CARD32 bandwidth = (mode->HDisplay >> 4) * (mode->VDisplay >> 5) * pScrn->bitsPerPixel * mode->VRefresh; - switch (pVia->MemClk) - { - case SDR100: /* No overlay without DDR */ - case SDR133: + switch (pVia->MemClk) { + case VIA_MEM_SDR100: /* No overlay without DDR */ + case VIA_MEM_SDR133: + return FALSE; + case VIA_MEM_DDR200: + /* Basic limit for DDR200 is about this */ + if(bandwidth > 1800000) return FALSE; - case DDR100: - /* Basic limit for DDR100 is about this */ - if(bandwidth > 1800000) + /* But we have constraints at higher than 800x600 */ + if (mode->HDisplay > 800) { + if(pScrn->bitsPerPixel != 8) return FALSE; - /* But we have constraints at higher than 800x600 */ - if (mode->HDisplay > 800) - { - if(pScrn->bitsPerPixel != 8) - return FALSE; - if(mode->VDisplay > 768) - return FALSE; - if(mode->VRefresh > 60) - return FALSE; - } - return TRUE; - case 0: /* FIXME: Why does my CLE266 report 0? */ - case DDR133: - if(bandwidth > 7901250) + if(mode->VDisplay > 768) + return FALSE; + if(mode->VRefresh > 60) return FALSE; - return TRUE; } + return TRUE; + case 0: /* FIXME: Why does my CLE266 report 0? */ + case VIA_MEM_DDR266: + if(bandwidth > 7901250) + return FALSE; + return TRUE; + } return FALSE; } else { VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; unsigned width,height,refresh,dClock; float mClock,memEfficiency,needBandWidth,totalBandWidth; - int - bTV = 0; + int bTV = 0; switch(pVia->MemClk) { - case SDR100: + case VIA_MEM_SDR100: mClock = 50; /*HW base on 128 bit*/ break; - case SDR133: + case VIA_MEM_SDR133: mClock = 66.5 ; break; - case DDR100: - mClock = 100; - break; - case DDR133: + case VIA_MEM_DDR200: + mClock = 100; + break; + case VIA_MEM_DDR266: mClock = 133; break; - case DDR166: + case VIA_MEM_DDR333: mClock = 166; - break; + break; default: /*Unknow DRAM Type*/ - DBG_DD(ErrorF("Unknow DRAM Type!\n")); + DBG_DD(ErrorF("Unknow DRAM Type!\n")); mClock = 166; break; } - switch(pVia->MemClk) - { - case SDR100: - case SDR133: - case DDR100: - memEfficiency = (float)SINGLE_3205_100; - break; - case DDR133: - case DDR166: - memEfficiency = (float)SINGLE_3205_133; - break; - default: - /*Unknow DRAM Type .*/ - DBG_DD(ErrorF("Unknow DRAM Type!\n")); - memEfficiency = (float)SINGLE_3205_133; - break; - } + switch(pVia->MemClk) { + case VIA_MEM_SDR100: + case VIA_MEM_SDR133: + case VIA_MEM_DDR200: + memEfficiency = (float)SINGLE_3205_100; + break; + case VIA_MEM_DDR266: + case VIA_MEM_DDR333: + memEfficiency = (float)SINGLE_3205_133; + break; + default: + /*Unknow DRAM Type .*/ + DBG_DD(ErrorF("Unknow DRAM Type!\n")); + memEfficiency = (float)SINGLE_3205_133; + break; + } width = mode->HDisplay; height = mode->VDisplay; refresh = mode->VRefresh; - if (pBIOSInfo->PanelActive) { - width = pBIOSInfo->panelX; - height = pBIOSInfo->panelY; - if ((width == 1400) && (height == 1050)) { - width = 1280; - height = 1024; + /* + * FIXME: If VBE modes assume a high refresh (100) for now + */ + + if (pVia->pVbe) { + refresh = 100; + if (pBIOSInfo->PanelActive) + refresh = 70; + if (pBIOSInfo->TVActive) refresh = 60; + } else { + if (pBIOSInfo->PanelActive) { + width = pBIOSInfo->panelX; + height = pBIOSInfo->panelY; + if ((width == 1400) && (height == 1050)) { + width = 1280; + height = 1024; + refresh = 60; + } + } else if (pBIOSInfo->TVActive) { + bTV = 1; } - } else if (pBIOSInfo->TVActive) { - bTV = 1; - } - + } if (bTV) { /* @@ -317,7 +330,8 @@ static Bool DecideOverlaySupport(ScrnInfoPtr pScrn) return FALSE; } -void viaResetVideo(ScrnInfoPtr pScrn) +static void +viaResetVideo(ScrnInfoPtr pScrn) { VIAPtr pVia = VIAPTR(pScrn); vmmtr viaVidEng = (vmmtr) pVia->VidMapBase; @@ -358,42 +372,66 @@ void viaRestoreVideo(ScrnInfoPtr pScrn) } + + void viaExitVideo(ScrnInfoPtr pScrn) { VIAPtr pVia = VIAPTR(pScrn); vmmtr viaVidEng = (vmmtr) pVia->VidMapBase; + XF86VideoAdaptorPtr curAdapt; + int i; DBG_DD(ErrorF(" via_video.c : viaExitVideo : \n")); +#ifdef XF86DRI + ViaCleanupXVMC(pScrn, viaAdaptPtr, XV_ADAPT_NUM); +#endif + viaVidEng->video1_ctl = 0; viaVidEng->video3_ctl = 0; viaVidEng->compose = 0x80000000; viaVidEng->compose = 0x40000000; -} - -static XF86VideoAdaptorPtr viaAdaptPtr[XV_PORT_NUM]; + /* + * Free all adaptor info allocated in viaInitVideo. + */ -/* - * FIXME: Must free those above and their contents. (In viaExitVideo.) - */ + for (i=0; i<XV_ADAPT_NUM; ++i) { + curAdapt = viaAdaptPtr[i]; + if (curAdapt) { + if (curAdapt->pPortPrivates) { + if (curAdapt->pPortPrivates->ptr) { + xfree(curAdapt->pPortPrivates->ptr); + } + xfree(curAdapt->pPortPrivates); + } + xfree(curAdapt); + } + } + if (allAdaptors) + xfree(allAdaptors); +} void viaInitVideo(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; VIAPtr pVia = VIAPTR(pScrn); - XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; - XF86VideoAdaptorPtr newAdaptor = NULL; - int num_adaptors; + XF86VideoAdaptorPtr *adaptors, *newAdaptors; + int num_adaptors, num_new; + DBG_DD(ErrorF(" via_video.c : viaInitVideo : \n")); + allAdaptors = NULL; + newAdaptors = NULL; + num_new = 0; + if (!viaFastVidCpy) viaFastVidCpy = viaVidCopyInit("video", pScreen); - - if ( (pVia->Chipset == VIA_CLE266) || (pVia->Chipset == VIA_KM400) ) { - newAdaptor = viaSetupImageVideoG(pScreen); + if ( (pVia->Chipset == VIA_CLE266) || (pVia->Chipset == VIA_KM400) || + (pVia->Chipset == VIA_K8M800) ) { + num_new = viaSetupAdaptors(pScreen, &newAdaptors); num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); } else { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, @@ -402,42 +440,37 @@ void viaInitVideo(ScreenPtr pScreen) } DBG_DD(ErrorF(" via_video.c : num_adaptors : %d\n",num_adaptors)); - if(newAdaptor) { - if(!num_adaptors) { - num_adaptors = 1; - adaptors = &newAdaptor; /* Now ,useless */ - } else { - DBG_DD(ErrorF(" via_video.c : viaInitVideo : Warning !!! MDS not supported yet !\n")); - newAdaptors = /* need to free this someplace */ - xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); - if(newAdaptors) { - memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr)); - newAdaptors[num_adaptors] = newAdaptor; - adaptors = newAdaptors; - num_adaptors++; - } + if(newAdaptors) { + allAdaptors = xalloc((num_adaptors + num_new) * + sizeof(XF86VideoAdaptorPtr*)); + if(allAdaptors) { + if (num_adaptors) + memcpy(allAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr)); + memcpy(allAdaptors + num_adaptors, newAdaptors, + num_new * sizeof(XF86VideoAdaptorPtr)); + num_adaptors += num_new; } } - if(num_adaptors) { - xf86XVScreenInit(pScreen, viaAdaptPtr, XV_PORT_NUM); + if (num_adaptors) { + xf86XVScreenInit(pScreen, allAdaptors, num_adaptors); +#ifdef XF86DRI + ViaInitXVMC(pScreen); +#endif viaSetColorSpace(pVia,0,0,0,0,TRUE); } - - if(newAdaptors) - xfree(newAdaptors); } -XF86VideoAdaptorPtr -viaSetupImageVideoG(ScreenPtr pScreen) +static unsigned +viaSetupAdaptors(ScreenPtr pScreen, XF86VideoAdaptorPtr **adaptors) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - viaPortPrivRec *gviaPortPriv[XV_PORT_NUM]; - DevUnion * pdevUnion[XV_PORT_NUM]; - int i; + viaPortPrivRec *viaPortPriv; + DevUnion *pdevUnion; + int i,j, usedPorts, numPorts; - DBG_DD(ErrorF(" via_video.c : viaSetupImageVideoG: \n")); + DBG_DD(ErrorF(" via_video.c : viaSetupImageVideo: \n")); xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); xvContrast = MAKE_ATOM("XV_CONTRAST"); @@ -446,14 +479,19 @@ viaSetupImageVideoG(ScreenPtr pScreen) xvSaturation = MAKE_ATOM("XV_SATURATION"); xvAutoPaint = MAKE_ATOM("XV_AUTOPAINT_COLORKEY"); - for ( i = 0; i < XV_PORT_NUM; i ++ ) { - if(!(viaAdaptPtr[i] = xf86XVAllocateVideoAdaptorRec(pScrn))) - return NULL; + *adaptors = NULL; + usedPorts = 0; - gviaPortPriv[i] = (viaPortPrivPtr)xnfcalloc(1, sizeof(viaPortPrivRec) ); - pdevUnion[i] = (DevUnion *)xnfcalloc(1, sizeof(DevUnion)); - if(i == XV_PORT_SWOV) /* Overlay engine */ + for ( i = 0; i < XV_ADAPT_NUM; i ++ ) { + if(!(viaAdaptPtr[i] = xf86XVAllocateVideoAdaptorRec(pScrn))) + return 0; + numPorts = numAdaptPort[i]; + + viaPortPriv = (viaPortPrivPtr)xnfcalloc(numPorts, sizeof(viaPortPrivRec) ); + pdevUnion = (DevUnion *)xnfcalloc(numPorts, sizeof(DevUnion)); + + if(i == XV_ADAPT_SWOV) /* Overlay engine */ { viaAdaptPtr[i]->type = XvInputMask | XvWindowMask | XvImageMask | XvVideoMask | XvStillMask; @@ -464,51 +502,49 @@ viaSetupImageVideoG(ScreenPtr pScreen) viaAdaptPtr[i]->type = XvInputMask | XvWindowMask | XvVideoMask; viaAdaptPtr[i]->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; } - viaAdaptPtr[i]->name = XVPORTNAME[i]; + viaAdaptPtr[i]->name = XvAdaptorName[i]; viaAdaptPtr[i]->nEncodings = 1; viaAdaptPtr[i]->pEncodings = DummyEncoding; viaAdaptPtr[i]->nFormats = sizeof(FormatsG) / sizeof(FormatsG[0]); viaAdaptPtr[i]->pFormats = FormatsG; /* The adapter can handle 1 port simultaneously */ - viaAdaptPtr[i]->nPorts = 1; - viaAdaptPtr[i]->pPortPrivates = pdevUnion[i]; - viaAdaptPtr[i]->pPortPrivates->ptr = (pointer) gviaPortPriv[i]; + viaAdaptPtr[i]->nPorts = numPorts; + viaAdaptPtr[i]->pPortPrivates = pdevUnion; + viaAdaptPtr[i]->pPortPrivates->ptr = (pointer) viaPortPriv; viaAdaptPtr[i]->nAttributes = NUM_ATTRIBUTES_G; viaAdaptPtr[i]->pAttributes = AttributesG; viaAdaptPtr[i]->nImages = NUM_IMAGES_G; viaAdaptPtr[i]->pImages = ImagesG; - viaAdaptPtr[i]->PutVideo = viaPutVideo; - viaAdaptPtr[i]->StopVideo = viaStopVideoG; - viaAdaptPtr[i]->QueryBestSize = viaQueryBestSizeG; -#ifdef XF86DRI - - viaAdaptPtr[i]->GetPortAttribute = viaXvMCInterceptXvGetAttribute; - viaAdaptPtr[i]->SetPortAttribute = viaXvMCInterceptXvAttribute; - viaAdaptPtr[i]->PutImage = viaXvMCInterceptPutImage; -#else - viaAdaptPtr[i]->GetPortAttribute = viaGetPortAttributeG; - viaAdaptPtr[i]->SetPortAttribute = viaSetPortAttributeG; - viaAdaptPtr[i]->PutImage = viaPutImageG; -#endif - viaAdaptPtr[i]->QueryImageAttributes = viaQueryImageAttributesG; - - gviaPortPriv[i]->colorKey = 0x0821; - gviaPortPriv[i]->autoPaint = TRUE; - gviaPortPriv[i]->brightness = 5000.; - gviaPortPriv[i]->saturation = 10000; - gviaPortPriv[i]->contrast = 10000; - gviaPortPriv[i]->hue = 0; - gviaPortPriv[i]->xv_portnum = i; - /* gotta uninit this someplace */ - REGION_NULL(pScreen, &gviaPortPriv[i]->clip); -#ifdef XF86DRI - viaXvMCInitXv( pScrn, gviaPortPriv[i]); -#endif + viaAdaptPtr[i]->PutVideo = NULL; + viaAdaptPtr[i]->StopVideo = viaStopVideo; + viaAdaptPtr[i]->QueryBestSize = viaQueryBestSize; + viaAdaptPtr[i]->GetPortAttribute = viaGetPortAttribute; + viaAdaptPtr[i]->SetPortAttribute = viaSetPortAttribute; + viaAdaptPtr[i]->PutImage = viaPutImage; + viaAdaptPtr[i]->QueryImageAttributes = viaQueryImageAttributes; + for (j=0; j<numPorts; ++j) { + viaPortPriv[j].colorKey = 0x0821; + viaPortPriv[j].autoPaint = TRUE; + viaPortPriv[j].brightness = 5000.; + viaPortPriv[j].saturation = 10000; + viaPortPriv[j].contrast = 10000; + viaPortPriv[j].hue = 0; + viaPortPriv[j].xv_portnum = j + usedPorts; + REGION_NULL(pScreen, &viaPortPriv[j].clip); + } + usedPorts += j; + + #ifdef XF86DRI + viaXvMCInitXv(pScrn, viaAdaptPtr[i]); + #endif + + } /* End of for */ viaResetVideo(pScrn); - return viaAdaptPtr[0]; + *adaptors = viaAdaptPtr; + return XV_ADAPT_NUM; } @@ -541,100 +577,28 @@ RegionsEqual(RegionPtr A, RegionPtr B) return TRUE; } - -static int CreateSWOVSurface(ScrnInfoPtr pScrn, viaPortPrivPtr pPriv, int fourcc, short width, short height) -{ - VIAPtr pVia = VIAPTR(pScrn); - LPDDSURFACEDESC lpSurfaceDesc = &pPriv->SurfaceDesc; - unsigned long retCode; - - if (pVia->VideoStatus & VIDEO_SWOV_SURFACE_CREATED) - return Success; - - lpSurfaceDesc->dwWidth = (unsigned long)width; - lpSurfaceDesc->dwHeight = (unsigned long)height; - lpSurfaceDesc->dwBackBufferCount =1; - - lpSurfaceDesc->dwFourCC = (unsigned long)fourcc; - - if (Success != (retCode = VIAVidCreateSurface(pScrn, lpSurfaceDesc))) - return retCode; - - pPriv->ddLock.dwFourCC = (unsigned long)fourcc; - - VIAVidLockSurface(pScrn, &pPriv->ddLock); - - pPriv->ddLock.SWDevice.lpSWOverlaySurface[0] = pVia->FBBase + pPriv->ddLock.SWDevice.dwSWPhysicalAddr[0]; - pPriv->ddLock.SWDevice.lpSWOverlaySurface[1] = pVia->FBBase + pPriv->ddLock.SWDevice.dwSWPhysicalAddr[1]; - - 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->VideoStatus |= VIDEO_SWOV_SURFACE_CREATED | VIDEO_SWOV_ON; - return Success; -} - - -static void DestroySWOVSurface(ScrnInfoPtr pScrn, viaPortPrivPtr pPriv) -{ - VIAPtr pVia = VIAPTR(pScrn); - LPDDSURFACEDESC lpSurfaceDesc = &pPriv->SurfaceDesc; - DBG_DD(ErrorF(" via_video.c : Destroy SW Overlay Surface, fourcc =0x%08x : \n", - lpSurfaceDesc->dwFourCC)); - - if (pVia->VideoStatus & VIDEO_SWOV_SURFACE_CREATED) - { - DBG_DD(ErrorF(" via_video.c : Destroy SW Overlay Surface, VideoStatus =0x%08x : \n", - pVia->VideoStatus)); - } - else - { - DBG_DD(ErrorF(" via_video.c : No SW Overlay Surface Destroyed, VideoStatus =0x%08x : \n", - pVia->VideoStatus)); - return; - } - - VIAVidDestroySurface(pScrn, lpSurfaceDesc); - - pVia->VideoStatus &= ~VIDEO_SWOV_SURFACE_CREATED; -} - - -void viaStopSWOVerlay(ScrnInfoPtr pScrn) -{ - DDUPDATEOVERLAY UpdateOverlay_Video; - LPDDUPDATEOVERLAY lpUpdateOverlay = &UpdateOverlay_Video; - VIAPtr pVia = VIAPTR(pScrn); - - pVia->VideoStatus &= ~VIDEO_SWOV_ON; - - lpUpdateOverlay->dwFlags = DDOVER_HIDE; - VIAVidUpdateOverlay(pScrn, lpUpdateOverlay); -} - - static void -viaStopVideoG(ScrnInfoPtr pScrn, pointer data, Bool exit) +viaStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) { VIAPtr pVia = VIAPTR(pScrn); viaPortPrivPtr pPriv = (viaPortPrivPtr)data; - DBG_DD(ErrorF(" via_video.c : viaStopVideoG: exit=%d\n", exit)); + DBG_DD(ErrorF(" via_video.c : viaStopVideo: exit=%d\n", exit)); REGION_EMPTY(pScrn->pScreen, &pPriv->clip); - if(exit) { - viaStopSWOVerlay(pScrn); - DestroySWOVSurface(pScrn, pPriv); - pVia->dwFrameNum = 0; - pPriv->old_drw_x= 0; - pPriv->old_drw_y= 0; - pPriv->old_drw_w= 0; - pPriv->old_drw_h= 0; - } + if (exit) { + ViaOverlayHide(pScrn); + ViaSwovSurfaceDestroy(pScrn, pPriv); + pVia->dwFrameNum = 0; + pPriv->old_drw_x= 0; + pPriv->old_drw_y= 0; + pPriv->old_drw_w= 0; + pPriv->old_drw_h= 0; + } } -int -viaSetPortAttributeG( +static int +viaSetPortAttribute( ScrnInfoPtr pScrn, Atom attribute, INT32 value, @@ -645,12 +609,12 @@ viaSetPortAttributeG( viaPortPrivPtr pPriv = (viaPortPrivPtr)data; int attr, avalue; - DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : \n")); + DBG_DD(ErrorF(" via_video.c : viaSetPortAttribute : \n")); /* Color Key */ if(attribute == xvColorKey) { - DBG_DD(ErrorF(" V4L Disable xvColorKey = %08x\n",value)); + DBG_DD(ErrorF(" V4L Disable xvColorKey = %08lx\n",value)); pPriv->colorKey = value; /* All assume color depth is 16 */ @@ -658,11 +622,11 @@ viaSetPortAttributeG( viaVidEng->color_key = value; viaVidEng->snd_color_key = value; REGION_EMPTY(pScrn->pScreen, &pPriv->clip); - DBG_DD(ErrorF(" V4L Disable done xvColorKey = %08x\n",value)); + DBG_DD(ErrorF(" V4L Disable done xvColorKey = %08lx\n",value)); } else if (attribute == xvAutoPaint) { pPriv->autoPaint = value; - DBG_DD(ErrorF(" xvAutoPaint = %08x\n",value)); + DBG_DD(ErrorF(" xvAutoPaint = %08lx\n",value)); /* Color Control */ } else if (attribute == xvBrightness || attribute == xvContrast || @@ -670,28 +634,28 @@ viaSetPortAttributeG( attribute == xvHue) { if (attribute == xvBrightness) { - DBG_DD(ErrorF(" xvBrightness = %08d\n",value)); + DBG_DD(ErrorF(" xvBrightness = %08ld\n",value)); pPriv->brightness = value; } if (attribute == xvContrast) { - DBG_DD(ErrorF(" xvContrast = %08d\n",value)); + DBG_DD(ErrorF(" xvContrast = %08ld\n",value)); pPriv->contrast = value; } if (attribute == xvSaturation) { - DBG_DD(ErrorF(" xvSaturation = %08d\n",value)); + DBG_DD(ErrorF(" xvSaturation = %08ld\n",value)); pPriv->saturation = value; } if (attribute == xvHue) { - DBG_DD(ErrorF(" xvHue = %08d\n",value)); + DBG_DD(ErrorF(" xvHue = %08ld\n",value)); pPriv->hue = value; } viaSetColorSpace(pVia, pPriv->hue, pPriv->saturation, pPriv->brightness, pPriv->contrast, FALSE); }else{ - DBG_DD(ErrorF(" via_video.c : viaSetPortAttributeG : is not supported the attribute")); + DBG_DD(ErrorF(" via_video.c : viaSetPortAttribute : is not supported the attribute")); return BadMatch; } @@ -702,8 +666,8 @@ viaSetPortAttributeG( return Success; } -int -viaGetPortAttributeG( +static int +viaGetPortAttribute( ScrnInfoPtr pScrn, Atom attribute, INT32 *value, @@ -711,16 +675,16 @@ viaGetPortAttributeG( ){ viaPortPrivPtr pPriv = (viaPortPrivPtr)data; - DBG_DD(ErrorF(" via_video.c : viaGetPortAttributeG : port %d %d\n", + DBG_DD(ErrorF(" via_video.c : viaGetPortAttribute : port %d %ld\n", pPriv->xv_portnum, attribute)); *value = 0; if (attribute == xvColorKey ) { *value =(INT32) pPriv->colorKey; - DBG_DD(ErrorF(" via_video.c : ColorKey 0x%x\n",pPriv->colorKey)); + DBG_DD(ErrorF(" via_video.c : ColorKey 0x%lx\n",pPriv->colorKey)); } else if (attribute == xvAutoPaint ) { *value = (INT32) pPriv->autoPaint; - DBG_DD(ErrorF(" AutoPaint = %08d\n", *value)); + DBG_DD(ErrorF(" AutoPaint = %08ld\n", *value)); /* Color Control */ } else if (attribute == xvBrightness || attribute == xvContrast || @@ -729,22 +693,22 @@ viaGetPortAttributeG( if (attribute == xvBrightness) { *value = pPriv->brightness; - DBG_DD(ErrorF(" xvBrightness = %08d\n", *value)); + DBG_DD(ErrorF(" xvBrightness = %08ld\n", *value)); } if (attribute == xvContrast) { *value = pPriv->contrast; - DBG_DD(ErrorF(" xvContrast = %08d\n", *value)); + DBG_DD(ErrorF(" xvContrast = %08ld\n", *value)); } if (attribute == xvSaturation) { *value = pPriv->saturation; - DBG_DD(ErrorF(" xvSaturation = %08d\n", *value)); + DBG_DD(ErrorF(" xvSaturation = %08ld\n", *value)); } if (attribute == xvHue) { *value = pPriv->hue; - DBG_DD(ErrorF(" xvHue = %08d\n", *value)); + DBG_DD(ErrorF(" xvHue = %08ld\n", *value)); } }else { @@ -754,7 +718,7 @@ viaGetPortAttributeG( } static void -viaQueryBestSizeG( +viaQueryBestSize( ScrnInfoPtr pScrn, Bool motion, short vid_w, short vid_h, @@ -762,7 +726,7 @@ viaQueryBestSizeG( unsigned int *p_w, unsigned int *p_h, pointer data ){ - DBG_DD(ErrorF(" via_video.c : viaQueryBestSizeG :\n")); + DBG_DD(ErrorF(" via_video.c : viaQueryBestSize :\n")); *p_w = drw_w; *p_h = drw_h; @@ -780,23 +744,23 @@ static void Flip(VIAPtr pVia, viaPortPrivPtr pPriv, int fourcc, unsigned long Di case FOURCC_UYVY: case FOURCC_YUY2: while ((VIDInD(HQV_CONTROL) & HQV_SW_FLIP) ); - VIDOutD(HQV_SRC_STARTADDR_Y, pPriv->ddLock.SWDevice.dwSWPhysicalAddr[DisplayBufferIndex]); + VIDOutD(HQV_SRC_STARTADDR_Y, pVia->swov.SWDevice.dwSWPhysicalAddr[DisplayBufferIndex]); VIDOutD(HQV_CONTROL,( VIDInD(HQV_CONTROL)&~HQV_FLIP_ODD) |HQV_SW_FLIP|HQV_FLIP_STATUS); break; case FOURCC_YV12: default: while ((VIDInD(HQV_CONTROL) & HQV_SW_FLIP) ); - VIDOutD(HQV_SRC_STARTADDR_Y, pPriv->ddLock.SWDevice.dwSWPhysicalAddr[DisplayBufferIndex]); - VIDOutD(HQV_SRC_STARTADDR_U, pPriv->ddLock.SWDevice.dwSWCbPhysicalAddr[DisplayBufferIndex]); - VIDOutD(HQV_SRC_STARTADDR_V, pPriv->ddLock.SWDevice.dwSWCrPhysicalAddr[DisplayBufferIndex]); + VIDOutD(HQV_SRC_STARTADDR_Y, pVia->swov.SWDevice.dwSWPhysicalAddr[DisplayBufferIndex]); + VIDOutD(HQV_SRC_STARTADDR_U, pVia->swov.SWDevice.dwSWCbPhysicalAddr[DisplayBufferIndex]); + VIDOutD(HQV_SRC_STARTADDR_V, pVia->swov.SWDevice.dwSWCrPhysicalAddr[DisplayBufferIndex]); VIDOutD(HQV_CONTROL,( VIDInD(HQV_CONTROL)&~HQV_FLIP_ODD) |HQV_SW_FLIP|HQV_FLIP_STATUS); break; } } -int -viaPutImageG( +static int +viaPutImage( ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x, short drw_y, @@ -810,20 +774,17 @@ viaPutImageG( VIAPtr pVia = VIAPTR(pScrn); viaPortPrivPtr pPriv = (viaPortPrivPtr)data; unsigned long retCode; -/* int i; - BoxPtr pbox; */ # ifdef XV_DEBUG - ErrorF(" via_video.c : viaPutImageG : called\n"); + ErrorF(" via_video.c : viaPutImage : called\n"); ErrorF(" via_video.c : FourCC=0x%x width=%d height=%d sync=%d\n",id,width,height,sync); - ErrorF(" via_video.c : src_x=%d src_y=%d src_w=%d src_h=%d colorkey=0x%x\n",src_x, src_y, src_w, src_h, pPriv->colorKey); + ErrorF(" via_video.c : src_x=%d src_y=%d src_w=%d src_h=%d colorkey=0x%lx\n",src_x, src_y, src_w, src_h, pPriv->colorKey); ErrorF(" via_video.c : drw_x=%d drw_y=%d drw_w=%d drw_h=%d\n",drw_x,drw_y,drw_w,drw_h); # endif switch ( pPriv->xv_portnum ) { - case XV_PORT_SWOV: - case XV_PORT_DUMMY: + case XV_ADAPT_SWOV: { DDUPDATEOVERLAY UpdateOverlay_Video; LPDDUPDATEOVERLAY lpUpdateOverlay = &UpdateOverlay_Video; @@ -836,9 +797,9 @@ viaPutImageG( * add codes to judge if need to re-create surface */ if ( (pPriv->old_src_w != src_w) || (pPriv->old_src_h != src_h) ) - DestroySWOVSurface(pScrn, pPriv); + ViaSwovSurfaceDestroy(pScrn, pPriv); - if (Success != ( retCode = CreateSWOVSurface(pScrn, pPriv, id, width, height) )) + if (Success != ( retCode = ViaSwovSurfaceCreate(pScrn, pPriv, id, width, height) )) { DBG_DD(ErrorF(" : Fail to Create SW Video Surface\n")); return retCode; @@ -848,17 +809,18 @@ viaPutImageG( /* Copy image data from system memory to video memory * TODO: use DRM's DMA feature to accelerate data copy */ - if (FOURCC_VIA != id) { - dstPitch = pPriv->ddLock.SWDevice.dwPitch; + if (FOURCC_XVMC != id) { + dstPitch = pVia->swov.SWDevice.dwPitch; switch(id) { case FOURCC_YV12: - (*viaFastVidCpy)(pPriv->ddLock.SWDevice.lpSWOverlaySurface[pVia->dwFrameNum&1],buf,dstPitch,width,height,0); + (*viaFastVidCpy)(pVia->swov.SWDevice.lpSWOverlaySurface[pVia->dwFrameNum&1],buf,dstPitch,width,height,0); break; case FOURCC_UYVY: case FOURCC_YUY2: default: - (*viaFastVidCpy)(pPriv->ddLock.SWDevice.lpSWOverlaySurface[pVia->dwFrameNum&1],buf,dstPitch,width,height,1); break; + (*viaFastVidCpy)(pVia->swov.SWDevice.lpSWOverlaySurface[pVia->dwFrameNum&1],buf,dstPitch,width,height,1); + break; } } @@ -874,26 +836,22 @@ viaPutImageG( /* * fill video overlay parameter */ - lpUpdateOverlay->rSrc.left = src_x; - lpUpdateOverlay->rSrc.top = src_y; - lpUpdateOverlay->rSrc.right = src_x + src_w; - lpUpdateOverlay->rSrc.bottom = src_y + src_h; + lpUpdateOverlay->SrcLeft = src_x; + lpUpdateOverlay->SrcTop = src_y; + lpUpdateOverlay->SrcRight = src_x + src_w; + lpUpdateOverlay->SrcBottom = src_y + src_h; + + lpUpdateOverlay->DstLeft = drw_x; + lpUpdateOverlay->DstTop = drw_y; + lpUpdateOverlay->DstRight = drw_x + drw_w; + lpUpdateOverlay->DstBottom = drw_y + drw_h; - lpUpdateOverlay->rDest.left = drw_x; - lpUpdateOverlay->rDest.top = drw_y; - lpUpdateOverlay->rDest.right = drw_x + drw_w; - lpUpdateOverlay->rDest.bottom = drw_y + drw_h; + lpUpdateOverlay->dwFlags = DDOVER_KEYDEST; - lpUpdateOverlay->dwFlags = DDOVER_SHOW | DDOVER_KEYDEST; if (pScrn->bitsPerPixel == 8) - { - lpUpdateOverlay->dwColorSpaceLowValue = pPriv->colorKey & 0xff; - } + lpUpdateOverlay->dwColorSpaceLowValue = pPriv->colorKey & 0xff; else - { - lpUpdateOverlay->dwColorSpaceLowValue = pPriv->colorKey; - } - lpUpdateOverlay->dwFourcc = id; + lpUpdateOverlay->dwColorSpaceLowValue = pPriv->colorKey; /* If use extend FIFO mode */ if (pScrn->currentMode->HDisplay > 1024) @@ -901,7 +859,7 @@ viaPutImageG( dwUseExtendedFIFO = 1; } - if (FOURCC_VIA != id) { + if (FOURCC_XVMC != id) { /* * XvMC flipping is done in the client lib. @@ -948,29 +906,25 @@ viaPutImageG( /* * Update video overlay */ - - if ( -1 == VIAVidUpdateOverlay(pScrn, lpUpdateOverlay)) - { - DBG_DD(ErrorF(" via_video.c : : call v4l updateoverlay fail. \n")); - } - else - { - DBG_DD(ErrorF(" via_video.c : PutImageG done OK\n")); - return Success; - } - } + if (!VIAVidUpdateOverlay(pScrn, lpUpdateOverlay)) { + DBG_DD(ErrorF(" via_video.c : call v4l updateoverlay fail. \n")); + } else { + DBG_DD(ErrorF(" via_video.c : PutImage done OK\n")); + return Success; + } break; + } default: DBG_DD(ErrorF(" via_video.c : XVPort not supported\n")); break; } - DBG_DD(ErrorF(" via_video.c : PutImageG done OK\n")); + DBG_DD(ErrorF(" via_video.c : PutImage done OK\n")); return Success; } static int -viaQueryImageAttributesG( +viaQueryImageAttributes( ScrnInfoPtr pScrn, int id, unsigned short *w, unsigned short *h, @@ -978,7 +932,7 @@ viaQueryImageAttributesG( ){ int size, tmp; - DBG_DD(ErrorF(" via_video.c : viaQueryImageAttributesG : FourCC=0x%x, ", id)); + DBG_DD(ErrorF(" via_video.c : viaQueryImageAttributes : FourCC=0x%x, ", id)); if ( (!w) || (!h) ) return 0; @@ -1004,7 +958,7 @@ viaQueryImageAttributesG( if(offsets) offsets[2] = size; size += tmp; break; - case FOURCC_VIA: + case FOURCC_XVMC: *h = (*h + 1) & ~1; #ifdef XF86DRI size = viaXvMCPutImageSize(pScrn); @@ -1039,53 +993,39 @@ viaQueryImageAttributesG( } -static int -viaPutVideo(ScrnInfoPtr pScrn, - short src_x, short src_y, short drw_x, short drw_y, - short src_w, short src_h, short drw_w, short drw_h, - RegionPtr clipBoxes, pointer data) +/* + * + */ +void +VIAVidAdjustFrame(ScrnInfoPtr pScrn, int x, int y) { + VIAPtr pVia = VIAPTR(pScrn); - viaPortPrivPtr pPriv=(viaPortPrivPtr)data; - VIAPtr pVia = VIAPTR(pScrn); + pVia->swov.panning_x = x; + pVia->swov.panning_y = y; + /* Check if HW mpeg engine active */ + if (pVia->VideoStatus & VIDEO_SWOV_ON) { /* SW video case */ + DDUPDATEOVERLAY UpdateOverlay; -#ifdef XV_DEBUG - ErrorF(" via_video.c : viaPutVideo : Src %dx%d, %d, %d, %p\n",src_w,src_h,src_x,src_y,clipBoxes); - ErrorF(" via_video.c : Dst %dx%d, %d, %d \n",drw_w,drw_h,drw_x,drw_y); - ErrorF(" via_video.c : colorkey : 0x%x \n",pPriv->colorKey); -#endif + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Call SW MPEG UpdateOverlay at panning mode.\n"); + UpdateOverlay.dwFlags = DDOVER_KEYDEST; + UpdateOverlay.dwColorSpaceLowValue = VIAGETREG(0x220); + UpdateOverlay.SrcLeft = 0; + UpdateOverlay.SrcTop = 0; + UpdateOverlay.SrcRight = 720; + UpdateOverlay.SrcBottom = 480; - /* BitBlt: Color fill */ - if(!RegionsEqual(&pPriv->clip, clipBoxes)) { - REGION_COPY(pScrn->pScreen, &pPriv->clip, clipBoxes); - XAAFillSolidRects(pScrn,pPriv->colorKey,GXcopy, ~0, - REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); - } + UpdateOverlay.DstLeft = (int) pVia->swov.SWDevice.gdwSWDstLeft; + UpdateOverlay.DstTop = (int) pVia->swov.SWDevice.gdwSWDstTop; + UpdateOverlay.DstRight = UpdateOverlay.DstLeft + pVia->swov.SWDevice.gdwSWDstWidth; + UpdateOverlay.DstBottom = UpdateOverlay.DstTop + pVia->swov.SWDevice.gdwSWDstHeight; - /* 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; + VIAVidUpdateOverlay(pScrn, &UpdateOverlay); } - switch ( pPriv->xv_portnum ) - { - case XV_PORT_SWOV: - case XV_PORT_DUMMY: - DBG_DD(ErrorF(" via_video.c : This port doesn't support PutVideo.\n")); - return XvBadAlloc; - default: - DBG_DD(ErrorF(" via_video.c : Error port access.\n")); - return XvBadAlloc; - } - - return Success; } #endif /* !XvExtension */ diff --git a/src/via_video.h b/src/via_video.h index ebbad5a..5c23fe7 100644 --- a/src/via_video.h +++ b/src/via_video.h @@ -16,9 +16,9 @@ * 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 + * 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. */ @@ -29,15 +29,8 @@ * I N C L U D E S */ -/* #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 -# define DBG_DD(x) (x) -#else -# define DBG_DD(x) -#endif - #define HW_3123 /* Definition for VideoStatus */ @@ -45,79 +38,72 @@ #define VIDEO_SWOV_SURFACE_CREATED 0x00000001 #define VIDEO_SWOV_ON 0x00000002 -#define SDR100 1 -#define SDR133 2 -#define DDR100 3 -#define DDR133 4 -#define DDR166 5 -#define DDR200 6 - #define SINGLE_3205_100 0.41 #define SINGLE_3205_133 0.70 #define VIDEO_BPP 2 typedef struct{ - unsigned long interruptflag; /* 200 */ - unsigned long ramtab; /* 204 */ - unsigned long alphawin_hvstart; /* 208 */ - unsigned long alphawin_size; /* 20c */ - unsigned long alphawin_ctl; /* 210 */ - unsigned long crt_startaddr; /* 214 */ - unsigned long crt_startaddr_2; /* 218 */ - unsigned long alphafb_stride ; /* 21c */ - unsigned long color_key; /* 220 */ - unsigned long alphafb_addr; /* 224 */ - unsigned long chroma_low; /* 228 */ - unsigned long chroma_up; /* 22c */ - unsigned long video1_ctl; /* 230 */ - unsigned long video1_fetch; /* 234 */ - unsigned long video1y_addr1; /* 238 */ - unsigned long video1_stride; /* 23c */ - unsigned long video1_hvstart; /* 240 */ - unsigned long video1_size; /* 244 */ - unsigned long video1y_addr2; /* 248 */ - unsigned long video1_zoom; /* 24c */ - unsigned long video1_mictl; /* 250 */ - unsigned long video1y_addr0; /* 254 */ - unsigned long video1_fifo; /* 258 */ - unsigned long video1y_addr3; /* 25c */ - unsigned long hi_control; /* 260 */ - unsigned long snd_color_key; /* 264 */ - unsigned long v3alpha_prefifo; /* 268 */ - unsigned long v1_source_w_h; /* 26c */ - unsigned long hi_transparent_color; /* 270 */ - unsigned long v_display_temp; /* 274 :No use */ - unsigned long v3alpha_fifo; /* 278 */ - unsigned long v3_source_width; /* 27c */ - unsigned long dummy1; /* 280 */ - unsigned long video1_CSC1; /* 284 */ - unsigned long video1_CSC2; /* 288 */ - unsigned long video1u_addr0; /* 28c */ - unsigned long video1_opqctl; /* 290 */ - unsigned long video3_opqctl; /* 294 */ - unsigned long compose; /* 298 */ - unsigned long dummy2; /* 29c */ - unsigned long video3_ctl; /* 2a0 */ - unsigned long video3_addr0; /* 2a4 */ - unsigned long video3_addr1; /* 2a8 */ - unsigned long video3_stribe; /* 2ac */ - unsigned long video3_hvstart; /* 2b0 */ - unsigned long video3_size; /* 2b4 */ - unsigned long v3alpha_fetch; /* 2b8 */ - unsigned long video3_zoom; /* 2bc */ - unsigned long video3_mictl; /* 2c0 */ - unsigned long video3_CSC1; /* 2c4 */ - unsigned long video3_CSC2; /* 2c8 */ - unsigned long v3_display_temp; /* 2cc */ - unsigned long reserved[5]; /* 2d0 */ - unsigned long video1u_addr1; /* 2e4 */ - unsigned long video1u_addr2; /* 2e8 */ - unsigned long video1u_addr3; /* 2ec */ - unsigned long video1v_addr0; /* 2f0 */ - unsigned long video1v_addr1; /* 2f4 */ - unsigned long video1v_addr2; /* 2f8 */ - unsigned long video1v_addr3; /* 2fc */ + CARD32 interruptflag; /* 200 */ + CARD32 ramtab; /* 204 */ + CARD32 alphawin_hvstart; /* 208 */ + CARD32 alphawin_size; /* 20c */ + CARD32 alphawin_ctl; /* 210 */ + CARD32 crt_startaddr; /* 214 */ + CARD32 crt_startaddr_2; /* 218 */ + CARD32 alphafb_stride ; /* 21c */ + CARD32 color_key; /* 220 */ + CARD32 alphafb_addr; /* 224 */ + CARD32 chroma_low; /* 228 */ + CARD32 chroma_up; /* 22c */ + CARD32 video1_ctl; /* 230 */ + CARD32 video1_fetch; /* 234 */ + CARD32 video1y_addr1; /* 238 */ + CARD32 video1_stride; /* 23c */ + CARD32 video1_hvstart; /* 240 */ + CARD32 video1_size; /* 244 */ + CARD32 video1y_addr2; /* 248 */ + CARD32 video1_zoom; /* 24c */ + CARD32 video1_mictl; /* 250 */ + CARD32 video1y_addr0; /* 254 */ + CARD32 video1_fifo; /* 258 */ + CARD32 video1y_addr3; /* 25c */ + CARD32 hi_control; /* 260 */ + CARD32 snd_color_key; /* 264 */ + CARD32 v3alpha_prefifo; /* 268 */ + CARD32 v1_source_w_h; /* 26c */ + CARD32 hi_transparent_color; /* 270 */ + CARD32 v_display_temp; /* 274 :No use */ + CARD32 v3alpha_fifo; /* 278 */ + CARD32 v3_source_width; /* 27c */ + CARD32 dummy1; /* 280 */ + CARD32 video1_CSC1; /* 284 */ + CARD32 video1_CSC2; /* 288 */ + CARD32 video1u_addr0; /* 28c */ + CARD32 video1_opqctl; /* 290 */ + CARD32 video3_opqctl; /* 294 */ + CARD32 compose; /* 298 */ + CARD32 dummy2; /* 29c */ + CARD32 video3_ctl; /* 2a0 */ + CARD32 video3_addr0; /* 2a4 */ + CARD32 video3_addr1; /* 2a8 */ + CARD32 video3_stribe; /* 2ac */ + CARD32 video3_hvstart; /* 2b0 */ + CARD32 video3_size; /* 2b4 */ + CARD32 v3alpha_fetch; /* 2b8 */ + CARD32 video3_zoom; /* 2bc */ + CARD32 video3_mictl; /* 2c0 */ + CARD32 video3_CSC1; /* 2c4 */ + CARD32 video3_CSC2; /* 2c8 */ + CARD32 v3_display_temp; /* 2cc */ + CARD32 reserved[5]; /* 2d0 */ + CARD32 video1u_addr1; /* 2e4 */ + CARD32 video1u_addr2; /* 2e8 */ + CARD32 video1u_addr3; /* 2ec */ + CARD32 video1v_addr0; /* 2f0 */ + CARD32 video1v_addr1; /* 2f4 */ + CARD32 video1v_addr2; /* 2f8 */ + CARD32 video1v_addr3; /* 2fc */ } video_via_regs; #define vmmtr volatile video_via_regs * diff --git a/src/via_vt162x.c b/src/via_vt162x.c index 1c6ef4f..8f21e23 100644 --- a/src/via_vt162x.c +++ b/src/via_vt162x.c @@ -17,9 +17,9 @@ * 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 + * 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. */ @@ -28,28 +28,26 @@ #include "via_vt162x.h" #include "via_id.h" -#ifdef HAVE_DEBUG /* * */ static void VT162xPrintRegs(ScrnInfoPtr pScrn) { - VIAPtr pVia = VIAPTR(pScrn); - VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->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++) { + for (i = 0; i < 0x68; 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 */ /* * @@ -57,9 +55,9 @@ VT162xPrintRegs(ScrnInfoPtr pScrn) I2CDevPtr ViaVT162xDetect(ScrnInfoPtr pScrn, I2CBusPtr pBus, CARD8 Address) { - CARD8 buf; VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; I2CDevPtr pDev = xf86CreateI2CDevRec(); + CARD8 buf; DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT162xDetect\n")); @@ -80,37 +78,45 @@ ViaVT162xDetect(ScrnInfoPtr pScrn, I2CBusPtr pBus, CARD8 Address) } switch (buf) { - case 2: + case 0x02: xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected VIA Technologies VT1621 TV Encoder\n"); pBIOSInfo->TVEncoder = VIA_VT1621; pDev->DevName = "VT1621"; break; - case 3: + case 0x03: xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected VIA Technologies VT1622 TV Encoder\n"); pBIOSInfo->TVEncoder = VIA_VT1622; pDev->DevName = "VT1622"; break; - case 16: + case 0x10: xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected VIA Technologies VT1622A/VT1623 TV Encoder\n"); pBIOSInfo->TVEncoder = VIA_VT1623; pDev->DevName = "VT1623"; break; + case 0x50: + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected VIA Technologies VT1625 TV Encoder\n"); +#if 0 + pBIOSInfo->TVEncoder = VIA_VT1625; + pDev->DevName = "VT1625"; +#else + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "VT1625 is not supported yet.\n"); + xf86DestroyI2CDevRec(pDev, TRUE); + pDev = NULL; +#endif + 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; + break; } -#ifdef HAVE_DEBUG - if (VIAPTR(pScrn)->PrintTVRegs && pDev) - VT162xPrintRegs(pScrn); -#endif - return pDev; } @@ -118,37 +124,37 @@ ViaVT162xDetect(ScrnInfoPtr pScrn, I2CBusPtr pBus, CARD8 Address) * */ static void -ViaVT162xSave(ScrnInfoPtr pScrn) +VT162xSave(ScrnInfoPtr pScrn) { VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; CARD8 buf = 0x00; - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT162xSave\n")); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT162xSave\n")); - xf86I2CWriteRead(pBIOSInfo->TVI2CDev, &buf,1, pBIOSInfo->TVRegs, - VIA_BIOS_MAX_NUM_TV_REG); + xf86I2CWriteRead(pBIOSInfo->TVI2CDev, &buf,1, pBIOSInfo->TVRegs, 0x68); } /* * */ static void -ViaVT162xRestore(ScrnInfoPtr pScrn) +VT162xRestore(ScrnInfoPtr pScrn) { - int i; VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; + int i; - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT162xRestore\n")); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT162xRestore\n")); - for (i = 0; i < VIA_BIOS_MAX_NUM_TV_REG; i++) + for (i = 0; i < 0x68; i++) xf86I2CWriteByte(pBIOSInfo->TVI2CDev, i, pBIOSInfo->TVRegs[i]); } /* * the same for VT1621 as for VT1622/VT1622A/VT1623, result is different though + * still needs testing on vt1621 of course. */ static CARD8 -ViaVT162xDACSenseI2C(I2CDevPtr pDev) +VT162xDACSenseI2C(I2CDevPtr pDev) { CARD8 save, sense; @@ -166,17 +172,14 @@ ViaVT162xDACSenseI2C(I2CDevPtr pDev) * VT1621 only knows composite and s-video */ static Bool -ViaVT1621DACSense(ScrnInfoPtr pScrn) +VT1621DACSense(ScrnInfoPtr pScrn) { VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; CARD8 sense; - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT1621DACDetect\n")); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1621DACSense\n")); - if (!pBIOSInfo->TVI2CDev) - return FALSE; - - sense = ViaVT162xDACSenseI2C(pBIOSInfo->TVI2CDev); + sense = VT162xDACSenseI2C(pBIOSInfo->TVI2CDev); switch (sense) { case 0x00: pBIOSInfo->TVOutput = TVOUTPUT_SC; @@ -207,17 +210,14 @@ ViaVT1621DACSense(ScrnInfoPtr pScrn) * VT1622, VT1622A and VT1623 know composite, s-video, RGB and YCBCR */ static Bool -ViaVT1622DACSense(ScrnInfoPtr pScrn) +VT1622DACSense(ScrnInfoPtr pScrn) { VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; CARD8 sense; - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT1622DACDetect\n")); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1622DACSense\n")); - if (!pBIOSInfo->TVI2CDev) - return FALSE; - - sense = ViaVT162xDACSenseI2C(pBIOSInfo->TVI2CDev); + sense = VT162xDACSenseI2C(pBIOSInfo->TVI2CDev); switch (sense) { case 0x00: /* DAC A,B,C,D */ pBIOSInfo->TVOutput = TVOUTPUT_RGB; @@ -251,475 +251,354 @@ ViaVT1622DACSense(ScrnInfoPtr pScrn) } } +/* + * + */ +static CARD8 +VT1621ModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; + int i; + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1621ModeIndex\n")); + + for (i = 0; VT1621Table[i].Width; i++) { + if ((VT1621Table[i].Width == mode->CrtcHDisplay) && + (VT1621Table[i].Height == mode->CrtcVDisplay) && + (VT1621Table[i].Standard == pBIOSInfo->TVType) && + !(strcmp(VT1621Table[i].name, mode->name))) + return i; + } + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "VT1622ModeIndex:" + " Mode \"%s\" not found in Table\n", mode->name); + return 0xFF; +} /* * */ -static Bool -ViaVT1621ModeValid(ScrnInfoPtr pScrn, DisplayModePtr mode) +static ModeStatus +VT1621ModeValid(ScrnInfoPtr pScrn, DisplayModePtr mode) { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT1621ModeValid\n")); + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; - 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; + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1621ModeValid\n")); + + if ((mode->PrivSize != sizeof(struct VT162xModePrivate)) || + ((mode->Private != (void *) &VT162xModePrivateNTSC) && + (mode->Private != (void *) &VT162xModePrivatePAL))) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Not a mode defined by the TV Encoder.\n"); + return MODE_BAD; } + + if ((pBIOSInfo->TVType == TVTYPE_NTSC) && + (mode->Private != (void *) &VT162xModePrivateNTSC)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "TV standard is NTSC. This is a PAL mode.\n"); + return MODE_BAD; + } else if ((pBIOSInfo->TVType == TVTYPE_PAL) && + (mode->Private != (void *) &VT162xModePrivatePAL)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "TV standard is PAL. This is a NTSC mode.\n"); + return MODE_BAD; + } + + if (VT1621ModeIndex(pScrn, mode) != 0xFF) + return MODE_OK; + return MODE_BAD; } /* * */ -static Bool -ViaVT1622ModeValid(ScrnInfoPtr pScrn, DisplayModePtr mode) +static CARD8 +VT1622ModeIndex(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; + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; + struct VT162XTableRec *Table; + int i; + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1622ModeIndex\n")); + + if (pBIOSInfo->TVEncoder == VIA_VT1622) + Table = VT1622Table; + else + Table = VT1623Table; + + for (i = 0; Table[i].Width; i++) { + if ((Table[i].Width == mode->CrtcHDisplay) && + (Table[i].Height == mode->CrtcVDisplay) && + (Table[i].Standard == pBIOSInfo->TVType) && + !strcmp(Table[i].name, mode->name)) + return i; } + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "VT1622ModeIndex:" + " Mode \"%s\" not found in Table\n", mode->name); + return 0xFF; } /* * */ -static void -ViaVT1621ModeI2C(ScrnInfoPtr pScrn) +static ModeStatus +VT1622ModeValid(ScrnInfoPtr pScrn, DisplayModePtr mode) { - 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; + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1622ModeValid\n")); + + if ((mode->PrivSize != sizeof(struct VT162xModePrivate)) || + ((mode->Private != (void *) &VT162xModePrivateNTSC) && + (mode->Private != (void *) &VT162xModePrivatePAL))) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Not a mode defined by the TV Encoder.\n"); + return MODE_BAD; } - 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]); + if ((pBIOSInfo->TVType == TVTYPE_NTSC) && + (mode->Private != (void *) &VT162xModePrivateNTSC)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "TV standard is NTSC. This is a PAL mode.\n"); + return MODE_BAD; + } else if ((pBIOSInfo->TVType == TVTYPE_PAL) && + (mode->Private != (void *) &VT162xModePrivatePAL)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "TV standard is PAL. This is a NTSC mode.\n"); + return MODE_BAD; } + if (VT1622ModeIndex(pScrn, mode) != 0xFF) + return MODE_OK; + return MODE_BAD; +} + +/* + * + */ +static void +VT162xSetSubCarrier(I2CDevPtr pDev, CARD32 SubCarrier) +{ + xf86I2CWriteByte(pDev, 0x16, SubCarrier & 0xFF); + xf86I2CWriteByte(pDev, 0x17, (SubCarrier >> 8) & 0xFF); + xf86I2CWriteByte(pDev, 0x18, (SubCarrier >> 16) & 0xFF); + xf86I2CWriteByte(pDev, 0x19, (SubCarrier >> 24) & 0xFF); +} + +/* + * + */ +static void +VT1621ModeI2C(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; + struct VT1621TableRec Table = VT1621Table[VT1621ModeIndex(pScrn, mode)]; + CARD8 i; + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1621ModeI2C\n")); + + for (i = 0; i < 0x16; i++) + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, i, Table.TV[i]); + + VT162xSetSubCarrier(pBIOSInfo->TVI2CDev, Table.SubCarrier); + + /* skip reserved (1A) and version id (1B). */ + + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x1C, Table.TV[0x1C]); + + /* skip software reset (1D) */ + + for (i = 0x1E; i < 0x24; i++) + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, i, Table.TV[i]); + + /* write some zeroes? */ + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x24, 0x00); + for (i = 0; i < 0x08; i++) + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x4A + i, 0x00); + + if (pBIOSInfo->TVOutput == TVOUTPUT_COMPOSITE) + for (i = 0; i < 0x10; i++) + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x52 + i, Table.TVC[i]); + else + for (i = 0; i < 0x10; i++) + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x52 + i, Table.TVS[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 (pBIOSInfo->TVDotCrawl) { + if (Table.DotCrawlSubCarrier) { + xf86I2CReadByte(pBIOSInfo->TVI2CDev, 0x11, &i); + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x11, i | 0x08); - 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); + VT162xSetSubCarrier(pBIOSInfo->TVI2CDev, Table.DotCrawlSubCarrier); + } else + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "This mode does not currently " + "support DotCrawl suppression.\n"); } - -#ifdef HAVE_DEBUG - if (pVia->PrintTVRegs) - VT162xPrintRegs(pScrn); -#endif /* HAVE_DEBUG */ } /* * */ static void -ViaVT1621ModeCrtc(ScrnInfoPtr pScrn) +VT1621ModeCrtc(ScrnInfoPtr pScrn, DisplayModePtr mode) { 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")); + struct VT1621TableRec Table = VT1621Table[VT1621ModeIndex(pScrn, mode)]; - if (pBIOSInfo->TVVScan == VIA_TVOVER) - Table = VT1621OverTable[pBIOSInfo->TVIndex]; - else /* VIA_TVNORMAL */ - Table = VT1621Table[pBIOSInfo->TVIndex]; - Mask = VT1621MaskTable; + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1621ModeCrtc\n")); 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]; + hwp->writeCrtc(hwp, 0x6A, 0x80); + hwp->writeCrtc(hwp, 0x6B, 0x20); + hwp->writeCrtc(hwp, 0x6C, 0x80); - ViaCrtcMask(hwp, 0x6A, 0xC0, 0xC0); - ViaCrtcMask(hwp, 0x6B, 0x01, 0x01); - ViaCrtcMask(hwp, 0x6C, 0x01, 0x01); - - /* Disable LCD Scaling */ + /* 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]; + hwp->writeCrtc(hwp, 0x6A, 0x00); + hwp->writeCrtc(hwp, 0x6B, 0x80); + hwp->writeCrtc(hwp, 0x6C, Table.PrimaryCR6C); } + pBIOSInfo->ClockExternal = TRUE; + ViaCrtcMask(hwp, 0x6A, 0x40, 0x40); + ViaCrtcMask(hwp, 0x6C, 0x01, 0x01); } /* * also suited for VT1622A, VT1623 */ static void -ViaVT1622ModeI2C(ScrnInfoPtr pScrn) +VT1622ModeI2C(ScrnInfoPtr pScrn, DisplayModePtr mode) { - 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; - } + VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; + struct VT162XTableRec Table; + CARD8 save, i; - 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; - } + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1622ModeI2C\n")); + + if (pBIOSInfo->TVEncoder == VIA_VT1622) + Table = VT1622Table[VT1622ModeIndex(pScrn, mode)]; + else /* VT1622A/VT1623 */ + Table = VT1623Table[VT1622ModeIndex(pScrn, mode)]; /* 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]); - } + for (i = 0; i < 0x16; i++) + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, i, Table.TV1[i]); - /* Turn on all Composite and S-Video output */ - xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x0E, 0x00); + VT162xSetSubCarrier(pBIOSInfo->TVI2CDev, Table.SubCarrier); - if ((pBIOSInfo->TVType == TVTYPE_NTSC) && pBIOSInfo->TVDotCrawl) { - CARD16 *DotCrawl = Table.DotCrawlNTSC; - CARD8 address; + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x1A, Table.TV1[0x1A]); + + /* skip version id */ - for (i = 1; i < (DotCrawl[0] + 1); i++) { - address = (CARD8)(DotCrawl[i] & 0xFF); + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x1C, Table.TV1[0x1C]); - if (address == 0x11) { - xf86I2CReadByte(pBIOSInfo->TVI2CDev, 0x11, &save); - save |= (CARD8)(DotCrawl[i] >> 8); - } else - save = (CARD8)(DotCrawl[i] >> 8); - xf86I2CWriteByte(pBIOSInfo->TVI2CDev, address, save); - } - } + /* skip software reset */ - 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); + for (i = 0x1E; i < 0x30; i++) + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, i, Table.TV1[i]); - if (pVia->IsSecondary) { /* Patch as setting 2nd path */ - j = (CARD8)(Mask.misc2 >> 5); + for (i = 0; i < 0x1B; i++) + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x4A + i, Table.TV2[i]); - for (i = 0; i < j; i++) - xf86I2CWriteByte(pBIOSInfo->TVI2CDev, Patch2[i] & 0xFF, Patch2[i] >> 8); + /* Turn on all Composite and S-Video output */ + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x0E, 0x00); + + if (pBIOSInfo->TVDotCrawl) { + if (Table.DotCrawlSubCarrier) { + xf86I2CReadByte(pBIOSInfo->TVI2CDev, 0x11, &save); + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x11, save | 0x08); + + VT162xSetSubCarrier(pBIOSInfo->TVI2CDev, Table.DotCrawlSubCarrier); + } else + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "This mode does not currently " + "support DotCrawl suppression.\n"); + } + + if (pBIOSInfo->TVOutput == TVOUTPUT_RGB) { + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x02, 0x2A); + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x65, Table.RGB[0]); + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x66, Table.RGB[1]); + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x67, Table.RGB[2]); + if (Table.RGB[3]) + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x27, Table.RGB[3]); + if (Table.RGB[4]) + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x2B, Table.RGB[4]); + if (Table.RGB[5]) + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x2C, Table.RGB[5]); + } else if (pBIOSInfo->TVOutput == TVOUTPUT_YCBCR) { + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x02, 0x03); + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x65, Table.YCbCr[0]); + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x66, Table.YCbCr[1]); + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x67, Table.YCbCr[2]); } /* Configure flicker filter */ xf86I2CReadByte(pBIOSInfo->TVI2CDev, 0x03, &save); save &= 0xFC; - if(pBIOSInfo->TVDeflicker == 1) + if (pBIOSInfo->TVDeflicker == 1) save |= 0x01; - else if(pBIOSInfo->TVDeflicker == 2) + 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) +VT1622ModeCrtc(ScrnInfoPtr pScrn, DisplayModePtr mode) { 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; - } + struct VT162XTableRec Table; + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1622ModeCrtc\n")); + + if (pBIOSInfo->TVEncoder == VIA_VT1622) + Table = VT1622Table[VT1622ModeIndex(pScrn, mode)]; + else /* VT1622A/VT1623 */ + Table = VT1623Table[VT1622ModeIndex(pScrn, mode)]; + + hwp->writeCrtc(hwp, 0x6A, 0x00); + hwp->writeCrtc(hwp, 0x6B, 0x00); + hwp->writeCrtc(hwp, 0x6C, 0x00); 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; + hwp->writeCrtc(hwp, 0x6C, Table.SecondaryCR6C); + + ViaCrtcMask(hwp, 0x6A, 0x80, 0x80); + ViaCrtcMask(hwp, 0x6C, 0x80, 0x80); + + /* 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); } - for (i = 0, j = 0; i < Mask.numCRTC1; j++) { - if (Mask.CRTC1[j] == 0xFF) { - hwp->writeCrtc(hwp, j, CRTC[j]); - i++; - } - } + /* Disable LCD Scaling */ + if (!pVia->SAMM || pVia->FirstInit) + hwp->writeCrtc(hwp, 0x79, 0x00); - ViaCrtcMask(hwp, 0x33, Misc[0], 0x20); - hwp->writeCrtc(hwp, 0x6A, Misc[1]); + } else { + if ((pVia->Chipset == VIA_CLE266) && CLE266_REV_IS_AX(pVia->ChipRev)) { + ViaCrtcMask(hwp, 0x6B, 0x80, 0x80); - 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]; + hwp->writeCrtc(hwp, 0x6C, Table.PrimaryCR6C); } - - ViaCrtcMask(hwp, 0x6A, 0x40, 0x40); - ViaCrtcMask(hwp, 0x6B, 0x01, 0x01); - ViaCrtcMask(hwp, 0x6C, 0x01, 0x01); } - + pBIOSInfo->ClockExternal = TRUE; + ViaCrtcMask(hwp, 0x6A, 0x40, 0x40); + ViaCrtcMask(hwp, 0x6C, 0x01, 0x01); ViaSeqMask(hwp, 0x1E, 0xC0, 0xC0); /* Enable DI0/DVP0 */ } @@ -727,14 +606,14 @@ ViaVT1622ModeCrtc(ScrnInfoPtr pScrn) * */ static void -ViaVT1621Power(ScrnInfoPtr pScrn, Bool On) +VT1621Power(ScrnInfoPtr pScrn, Bool On) { VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT1621Power\n")); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1621Power\n")); if (On) - xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x00, 0x03); + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x0E, 0x00); else xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x0E, 0x03); } @@ -743,14 +622,14 @@ ViaVT1621Power(ScrnInfoPtr pScrn, Bool On) * */ static void -ViaVT1622Power(ScrnInfoPtr pScrn, Bool On) +VT1622Power(ScrnInfoPtr pScrn, Bool On) { VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT1622Power\n")); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1622Power\n")); if (On) - xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x00, 0x03); + xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x0E, 0x00); else xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x0E, 0x0F); } @@ -767,29 +646,39 @@ ViaVT162xInit(ScrnInfoPtr pScrn) 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; + pBIOSInfo->TVSave = VT162xSave; + pBIOSInfo->TVRestore = VT162xRestore; + pBIOSInfo->TVDACSense = VT1621DACSense; + pBIOSInfo->TVModeValid = VT1621ModeValid; + pBIOSInfo->TVModeI2C = VT1621ModeI2C; + pBIOSInfo->TVModeCrtc = VT1621ModeCrtc; + pBIOSInfo->TVPower = VT1621Power; + pBIOSInfo->TVModes = VT1621Modes; + pBIOSInfo->TVPrintRegs = VT162xPrintRegs; break; case VIA_VT1622: + pBIOSInfo->TVSave = VT162xSave; + pBIOSInfo->TVRestore = VT162xRestore; + pBIOSInfo->TVDACSense = VT1622DACSense; + pBIOSInfo->TVModeValid = VT1622ModeValid; + pBIOSInfo->TVModeI2C = VT1622ModeI2C; + pBIOSInfo->TVModeCrtc = VT1622ModeCrtc; + pBIOSInfo->TVPower = VT1622Power; + pBIOSInfo->TVModes = VT1622Modes; + pBIOSInfo->TVPrintRegs = VT162xPrintRegs; + break; case VIA_VT1623: - pBIOSInfo->TVSave = ViaVT162xSave; - pBIOSInfo->TVRestore = ViaVT162xRestore; - pBIOSInfo->TVDACSense = ViaVT1622DACSense; - pBIOSInfo->TVModeValid = ViaVT1622ModeValid; - pBIOSInfo->TVModeI2C = ViaVT1622ModeI2C; - pBIOSInfo->TVModeCrtc = ViaVT1622ModeCrtc; - pBIOSInfo->TVPower = ViaVT1622Power; + pBIOSInfo->TVSave = VT162xSave; + pBIOSInfo->TVRestore = VT162xRestore; + pBIOSInfo->TVDACSense = VT1622DACSense; + pBIOSInfo->TVModeValid = VT1622ModeValid; + pBIOSInfo->TVModeI2C = VT1622ModeI2C; + pBIOSInfo->TVModeCrtc = VT1622ModeCrtc; + pBIOSInfo->TVPower = VT1622Power; + pBIOSInfo->TVModes = VT1623Modes; + pBIOSInfo->TVPrintRegs = VT162xPrintRegs; break; default: break; } - - /* Save before continuing */ - if (pBIOSInfo->TVSave) - pBIOSInfo->TVSave(pScrn); } diff --git a/src/via_vt162x.h b/src/via_vt162x.h index 26c0d59..29b3e5c 100644 --- a/src/via_vt162x.h +++ b/src/via_vt162x.h @@ -1,7 +1,5 @@ /* - * 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. + * 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"), @@ -16,185 +14,141 @@ * * 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_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; +struct VT162xModePrivate { + char id[12]; /* "VT162x" */ + CARD8 Standard; +}; -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; +static struct VT162xModePrivate VT162xModePrivateNTSC = { + { 'V', 'T', '1', '6', '2', 'x', 0, 0, 0, 0, 0, 0 }, + TVTYPE_NTSC, +}; +static struct VT162xModePrivate VT162xModePrivatePAL = { + { 'V', 'T', '1', '6', '2', 'x', 0, 0, 0, 0, 0, 0 }, + TVTYPE_PAL, +}; + -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; +#define MODEPREFIX(name) NULL, NULL, name, 0,M_T_DEFAULT +#define MODESUFFIXNTSC 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,\ + sizeof(struct VT162xModePrivate),(void *)&VT162xModePrivateNTSC,0,0.0,0.0 +#define MODESUFFIXPAL 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,\ + sizeof(struct VT162xModePrivate),(void *)&VT162xModePrivatePAL,0,0.0,0.0 /* * * VT1621 modetables * */ -static const VIATVMASKTableRec VT1621MaskTable = { - { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0, 0XFF, 0, 0, 0, 0, 0, 0, 0XFF, 0, 0XFF, 0, 0, 0XFF, 0XFF, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0, 0, 0, 0, 0, 0XFF, 0XFF, 0XFF, 0, 0, 0XFF, 0XFF, 0XFF, 0, 0, 0 }, - 0X3F, 0X38, 61, 13, 22 +/* for dotclock i just took HTotal*VTotal*50 -- is not actually used - just to satisfy modevalidation */ +static DisplayModeRec VT1621Modes[] = { + { MODEPREFIX("640x480"), 23520, 640, 656, 752, 784, 0, 480, 520, 523, 600, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("640x480"), 26250, 640, 664, 792, 840, 0, 480, 529, 539, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXPAL }, + { MODEPREFIX("800x600"), 39900, 800, 840, 976, 1064, 0, 600, 604, 620, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("800x600"), 36000, 800, 824, 904, 960, 0, 600, 604, 620, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXPAL }, + { MODEPREFIX("640x480Over"), 20580, 640, 656, 752, 784, 0, 480, 494, 507, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("640x480Over"), 24000, 640, 672, 888, 960, 0, 480, 485, 491, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXPAL }, + { MODEPREFIX("800x600Over"), 36400, 800, 840, 960, 1040, 0, 600, 602, 604, 700, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("800x600Over"), 29500, 800, 824, 896, 944, 0, 600, 599, 604, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXPAL }, + { MODEPREFIX(NULL), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, MODESUFFIXNTSC }, }; -static const VIAVT1621TableRec VT1621Table[] = { - { - { 0X64, 0X3, 0X22, 0X33, 0X43, 0, 0X10, 0X7D, 0XAC, 0X5, 0X99, 0X17, 0X93, 0XA5, 0X3, 0XBA, 0, 0, 0XA, 0XCD, 0X80, 0X28, 0XBE, 0XFF, 0X7F, 0X20, 0, 0X1, 0X2, 0X80, 0, 0, 0X75, 0XC, 0X4, 0X6D, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0X48, 0X1, 0X2, 0, 0XFC, 0XF9, 0XFF, 0X10, 0X23, 0X2C, 0X9, 0X8, 0XA, 0XC, 0XD, 0XD, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0X64, 0X3, 0X22, 0X33, 0X43, 0, 0X10, 0X7D, 0XAC, 0X5, 0X99, 0X17, 0X93, 0XA5, 0X3, 0XBA, 0, 0, 0XA, 0XCD, 0X80, 0X28, 0XBE, 0XFF, 0X7F, 0X20, 0, 0X1, 0X2, 0X80, 0, 0, 0X75, 0XC, 0X4, 0X6D, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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X38, 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 } - } +struct VT1621TableRec { + char * name; + CARD16 Width; + CARD16 Height; + int Standard; + CARD8 PrimaryCR6C; + CARD8 TV[0x25]; + CARD8 TVC[0x18]; + CARD8 TVS[0x18]; + CARD32 SubCarrier; + CARD32 DotCrawlSubCarrier; }; -static const VIAVT1621TableRec VT1621OverTable[] = { - { - { 0X64, 0X3, 0X2, 0X33, 0X43, 0, 0X10, 0X7D, 0X72, 0X5, 0X99, 0X17, 0X93, 0XA5, 0X3, 0XBA, 0, 0, 0XD, 0X45, 0X38, 0X34, 0XF1, 0X91, 0X24, 0X25, 0, 0X1, 0X2, 0X80, 0, 0, 0X75, 0XC, 0X4, 0X6D, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0X48, 0, 0X1, 0X2, 0XFF, 0XF9, 0XFA, 0XC, 0X26, 0X32, 0X7, 0X8, 0XA, 0XD, 0XE, 0XF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0X64, 0X3, 0X2, 0X33, 0X43, 0, 0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 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 } +static struct VT1621TableRec +VT1621Table[] = { + { "640x480", 640, 480, TVTYPE_NTSC, 0, + { 0x64, 0x03, 0x22, 0x33, 0x43, 0, 0x10, 0x7D, 0xAC, 0x05, 0x99, 0x17, 0x93, 0xA5, 0x03, 0xBA, + 0, 0, 0x0A, 0xCD, 0x80, 0x28, 0, 0, 0, 0, 0, 0, 0x02, 0, 0, 0, + 0x75, 0x0C, 0x04, 0x6D }, + { 0x48, 0x01, 0x02, 0, 0xFC, 0xF9, 0xFF, 0x10, 0x23, 0x2C, 0x09, 0x08, 0x0A, 0x0C, 0x0D, 0x0D }, + { 0x48, 0x02, 0x02, 0xFD, 0x06, 0xF8, 0x0B, 0xF3, 0x0F, 0x70, 0x05, 0xF9, 0x0B, 0xF1, 0x11, 0x6E }, + 0x207FFFBE, 0x207FF6BE, + }, + { "640x480", 640, 480, TVTYPE_PAL, 0x04, + { 0x64, 0x01, 0x02, 0x33, 0x40, 0, 0x10, 0xAD, 0xD3, 0x37, 0xA3, 0, 0x94, 0xFF, 0x03, 0xBA, + 0, 0, 0x07, 0x26, 0x2C, 0x20, 0, 0, 0, 0, 0, 0, 0x02, 0, 0, 0, + 0x75, 0x0C, 0x04, 0x76 }, + { 0x48, 0, 0, 0xFE, 0xFC, 0xFD, 0x05, 0x12, 0x1F, 0x25, 0x0B, 0x08, 0x0A, 0x0C, 0x0D, 0x0D }, + { 0x48, 0xFE, 0x03, 0xFB, 0x06, 0xF8, 0x0A, 0xF5, 0x0C, 0x73, 0x06, 0xF8, 0x0B, 0xF2, 0x10, 0x6F }, + 0x25D56350, 0, + }, + { "800x600", 800, 600, TVTYPE_NTSC, 0x1E, + { 0x84, 0x03, 0x2A, 0x33, 0x43, 0, 0x10, 0xDD, 0xB9, 0x15, 0x99, 0x17, 0x93, 0xA5, 0x03, 0xBA, + 0, 0, 0x0A, 0xED, 0x98, 0x1C, 0, 0, 0, 0, 0, 0, 0x02, 0, 0, 0, + 0x75, 0x0C, 0x04, 0x6D }, + { 0x48, 0, 0xFF, 0xFD, 0xFC, 0xFF, 0x07, 0x13, 0x1E, 0x22, 0x0D, 0x08, 0x09, 0x0A, 0x0B, 0x0C }, + { 0x48, 0x02, 0x02, 0xFD, 0x06, 0xF8, 0x0B, 0xF3, 0x0F, 0x70, 0x05, 0xF9, 0x0B, 0xF1, 0x11, 0x6E }, + 0x1B5E5096, 0x1B5E5796, + }, + { "800x600", 800, 600, TVTYPE_PAL, 0x04, + { 0x84, 0x03, 0x1A, 0x33, 0x40, 0, 0x10, 0x85, 0xF1, 0x4B, 0xA3, 0, 0x94, 0xFF, 0x03, 0xBA, + 0, 0, 0x07, 0x25, 0x2C, 0x1C, 0, 0, 0, 0, 0, 0, 0x02, 0, 0, 0, + 0x75, 0x0C, 0x04, 0x76 }, + { 0x48, 0xFF, 0xFE, 0xFD, 0xFE, 0x02, 0x0A, 0x13, 0x1A, 0x1D, 0x0F, 0x08, 0x09, 0x0A, 0x0B, 0x0B }, + { 0x48, 0xFB, 0x04, 0xFB, 0x07, 0xF8, 0x09, 0xF6, 0x0A, 0x74, 0x06, 0xF8, 0x0B, 0xF2, 0x10, 0x6F }, + 0x1F872818, 0, + }, + { "640x480Over", 640, 480, TVTYPE_NTSC, 0, + { 0x64, 0x03, 0x02, 0x33, 0x43, 0, 0x10, 0x7D, 0x72, 0x05, 0x99, 0x17, 0x93, 0xA5, 0x03, 0xBA, + 0, 0, 0x0D, 0x45, 0x38, 0x34, 0, 0, 0, 0, 0, 0, 0x02, 0, 0, 0, + 0x75, 0x0C, 0x04, 0x6D }, + { 0x48, 0, 0x01, 0x02, 0xFF, 0xF9, 0xFA, 0x0C, 0x26, 0x32, 0x07, 0x08, 0x0A, 0x0D, 0x0E, 0x0F }, + { 0x48, 0x02, 0x02, 0xFD, 0x06, 0xF8, 0x0B, 0xF3, 0x0F, 0x70, 0x05, 0xF9, 0x0B, 0xF1, 0x11, 0x6E }, + 0x252491F1, 0x252499F1, + }, + { "640x480Over", 640, 480, TVTYPE_PAL, 0, + { 0x64, 0x01, 0x12, 0x33, 0x40, 0, 0x10, 0x1D, 0x68, 0x26, 0xA3, 0, 0x94, 0xFF, 0x03, 0xBA, + 0, 0, 0x0F, 0x67, 0x58, 0x3C, 0, 0, 0, 0, 0, 0, 0x0A, 0, 0, 0, + 0x75, 0x0C, 0x04, 0x76 }, + { 0x48, 0, 0x01, 0x01, 0xFE, 0xFA, 0xFD, 0x0E, 0x24, 0x2E, 0x07, 0x07, 0x0A, 0x0D, 0x0F, 0x0F }, + { 0x48, 0xFD, 0x03, 0xFB, 0x07, 0xF8, 0x0A, 0xF5, 0x0B, 0x74, 0x06, 0xF8, 0x0B, 0xF2, 0x10, 0x6F }, + 0x2F4ABC24, 0, + }, + { "800x600Over", 800, 600, TVTYPE_NTSC, 0, + { 0x84, 0x03, 0x0A, 0x33, 0x43, 0, 0x10, 0xC5, 0xAD, 0x10, 0x99, 0x17, 0x93, 0xA5, 0x03, 0xBA, + 0, 0, 0x04, 0x07, 0x20, 0x0C, 0, 0, 0, 0, 0, 0, 0x02, 0, 0, 0, + 0x75, 0x0C, 0x04, 0x6D }, + { 0x48, 0, 0xFF, 0xFD, 0xFC, 0xFE, 0x06, 0x13, 0x1E, 0x23, 0x0D, 0x08, 0x0A, 0x0B, 0x0C, 0x0C }, + { 0x48, 0x02, 0x02, 0xFD, 0x06, 0xF8, 0x0B, 0xF3, 0x0F, 0x70, 0x05, 0xF9, 0x0B, 0xF1, 0x11, 0x6E }, + 0x1C000008, 0x1C000808, + }, + { "800x600Over", 800, 600, TVTYPE_PAL, 0, + { 0x84, 0x03, 0x02, 0x33, 0x40, 0, 0x10, 0x75, 0x7B, 0x34, 0xA3, 0, 0x94, 0xFF, 0x03, 0xBA, + 0, 0, 0x08, 0xFD, 0xEF, 0x20, 0, 0, 0, 0, 0, 0, 0x02, 0, 0, 0, + 0x75, 0x0C, 0x04, 0x76 }, + { 0x48, 0xFF, 0xFE, 0xFD, 0xFE, 0x02, 0x0A, 0x13, 0x1A, 0x1D, 0x0F, 0x08, 0x09, 0x0A, 0x0B, 0x0B }, + { 0x48, 0xFB, 0x04, 0xFB, 0x07, 0xF8, 0x09, 0xF6, 0x0A, 0x74, 0x06, 0xF8, 0x0B, 0xF2, 0x10, 0x6F }, + 0x26798C0C, 0, + }, + { NULL, 0, 0, 0, 0, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + 0, 0, } }; @@ -203,340 +157,278 @@ static const VIAVT1621TableRec VT1621OverTable[] = { * VT1622 modetables * */ -static const VIATVMASKTableRec VT1622MaskTable = { - { 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0X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PREFIX("640x480"), 30000, 640, 680, 808, 1000, 0, 480, 520, 523, 600, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXPAL }, + { MODEPREFIX("800x600"), 39900, 800, 840, 976, 1064, 0, 600, 604, 620, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("800x600"), 34500, 800, 816, 880, 920, 0, 600, 604, 620, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXPAL }, + { MODEPREFIX("1024x768"), 54810, 1024, 1032, 1088, 1160, 0, 768, 780, 792, 945, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("1024x768"), 57000, 1024, 1040, 1112, 1200, 0, 768, 829, 840, 950, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXPAL }, + { MODEPREFIX("848x480"), 34860, 848, 872, 1032, 1200, 0, 480, 495, 509, 581, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("848x480"), 36000, 848, 872, 1032, 1200, 0, 480, 498, 509, 600, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXPAL }, + { MODEPREFIX("720x480"), 25200, 720, 728, 776, 840, 0, 480, 511, 515, 600, 0, V_NHSYNC | V_PVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("720x576"), 28500, 720, 728, 744, 760, 0, 576, 635, 643, 750, 0, V_NHSYNC | V_PVSYNC, MODESUFFIXPAL }, + { MODEPREFIX("640x480Over"), 20160, 640, 648, 704, 720, 0, 480, 487, 491, 560, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("640x480Over"), 21000, 640, 664, 792, 840, 0, 480, 485, 491, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXPAL }, + { MODEPREFIX("800x600Over"), 35910, 800, 840, 984, 1080, 0, 600, 601, 604, 665, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("800x600Over"), 32500, 800, 832, 928, 1000, 0, 600, 600, 604, 650, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXPAL }, + { MODEPREFIX("1024x768Over"), 50400, 1024, 1040, 1112, 1200, 0, 768, 772, 776, 840, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("1024x768Over"), 49500, 1024, 1032, 1112, 1200, 0, 768, 771, 776, 825, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXPAL }, + { MODEPREFIX("848x480Over"), 27720, 848, 856, 928, 1008, 0, 480, 490, 493, 550, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("848x480Over"), 33000, 848, 872, 1032, 1200, 0, 480, 490, 493, 550, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXPAL }, + { MODEPREFIX("720x480Over"), 21000, 720, 728, 760, 800, 0, 480, 480, 483, 525, 0, V_NHSYNC | V_PVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("720x576Over"), 30000, 720, 728, 864, 1000, 0, 576, 576, 579, 600, 0, V_NHSYNC | V_PVSYNC, MODESUFFIXPAL }, + { MODEPREFIX("720x480Noscale"), 27972, 720, 736, 768, 888, 0, 480, 480, 483, 525, 0, V_NHSYNC | V_PVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("720x576Noscale"), 28000, 720, 728, 864, 896, 0, 576, 576, 579, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXPAL }, + { MODEPREFIX(NULL), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, MODESUFFIXNTSC }, }; -static const VIAVT162XTableRec VT1622Table[] = { - { - { 0X4, 0, 0, 0X2, 0X3, 0, 0X10, 0X7E, 0X9D, 0XD, 0X60, 0X17, 0X52, 0X45, 0XF, 0, 0, 0, 0XD0, 0X33, 0XBF, 0X3A, 0XF1, 0X91, 0X24, 0X25, 0XE9, 0X3, 0, 0X80, 0, 0X5, 0X12, 0XC, 0X4, 0X74, 0, 0X5A, 0X2F, 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, 0X57, 0, 0, 0X57, 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 }, - { 0X97, 0X1F, 0X1F, 0X97, 0XDB, 0X33, 0X36, 0X80, 0XED, 0X57, 0X57, 0XED, 0X52, 0X12, 0X5D, 0X5C, 0, 0, 0, 0, 0, 0X32, 0X64, 0, 0, 0, 0X80, 0, 0X80, 0, 0, 0 }, - { 0X97, 0X1F, 0X1F, 0X97, 0XDB, 0X33, 0X36, 0X80, 0XED, 0X57, 0X57, 0XED, 0X52, 0X12, 0X5D, 0X5C, 0, 0, 0, 0, 0, 0X64, 0XC8, 0X40, 0, 0, 0X80, 0, 0X80, 0, 0, 0 }, - { 0X97, 0X1F, 0X1F, 0X97, 0XDB, 0X33, 0X36, 0X80, 0XED, 0X57, 0X57, 0XED, 0X52, 0X12, 0X5D, 0X5C, 0, 0, 0, 0, 0, 0XC8, 0X90, 0X81, 0, 0, 0X80, 0, 0X80, 0, 0, 0 }, - { 0X6607, 0, 0, 0, 0, 0, 0, 0 }, - { 0X4, 0X2A02, 0XB865, 0XB466, 0XB467, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0X4, 0X302, 0X5865, 0X5E66, 0X5E67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 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, 0X44, 0X3, 0, 0X10, 0X80, 0X15, 0XA, 0X58, 0X17, 0X5B, 0X40, 0XF, 0, 0, 0, 0XE9, 0X1E, 0X9D, 0X19, 0XD6, 0X66, 0XEB, 0X14, 0X9C, 0X3, 0X5, 0X80, 0, 0X85, 0XA, 0X5, 0X4, 0X74, 0, 0X5A, 0X56,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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 } - } +struct VT162XTableRec { + char * name; + CARD16 Width; + CARD16 Height; + int Standard; + CARD8 PrimaryCR6C; + CARD8 SecondaryCR6C; + CARD8 TV1[0x30]; + CARD8 TV2[0x1B]; + CARD8 RGB[6]; + CARD8 YCbCr[3]; + CARD32 SubCarrier; + CARD32 DotCrawlSubCarrier; }; -static const VIAVT162XTableRec VT1622OverTable[] = { - { - { 0X4, 0, 0, 0X2, 0X3, 0, 0X10, 0X48, 0X72, 0XA, 0X60, 0X17, 0X52, 0X45, 0XF, 0, 0, 0, 0XED, 0X23, 0X80, 0X35, 0X5E, 0XAA, 0XEA, 0X25, 0XE9, 0X3, 0X2, 0X80, 0, 0X5, 0X12, 0XC, 0X4, 0X75, 0, 0X5A, 0X2F, 0X97, 0X50, 0, 0, 0XAA, 0X2B, 0X7A, 0XD8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0XC4, 0X50, 0X4, 0, 0, 0X41, 0XCF, 0X7F, 0X22, 0X2F, 0X2, 0XFF, 0X7F, 0X71, 0X22, 0X83, 0XC0, 0XE5, 0XC0, 0X5, 0X44, 0, 0X4, 0, 0, 0XFF, 0X2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0X55, 0X4F, 0X4F, 0X99, 0X51, 0X18, 0X2E, 0X3E, 0, 0X40, 0, 0, 0, 0, 0, 0, 0XE7, 0, 0XDF, 0, 0, 0XDF, 0X2F, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0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X40, 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, 0X4, 0X7B, 0, 0X64, 0X37, 0X93, 0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X9A, 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 } +static struct VT162XTableRec +VT1622Table[] = { + { "640x480", 640, 480, TVTYPE_NTSC, 0, 0, + { 0x04, 0, 0, 0x02, 0x03, 0, 0x10, 0x7E, 0x9D, 0x0D, 0x60, 0x17, 0x52, 0x45, 0x0F, 0, + 0, 0, 0xD0, 0x33, 0xBF, 0x3A, 0, 0, 0, 0, 0xE9, 0, 0, 0, 0, 0x05, + 0x12, 0x0C, 0x04, 0x74, 0, 0x5A, 0x2F, 0x97, 0x50, 0, 0, 0xAA, 0x2B, 0x7A, 0xD8, 0 }, + { 0xDC, 0x50, 0x04, 0, 0, 0x40, 0x0F, 0x81, 0x23, 0x57, 0x02, 0x0F, 0x29, 0x73, 0x23, 0x86, + 0xC4, 0xEA, 0xDF, 0x05, 0x92, 0xA1, 0x04, 0, 0, 0x7F, 0x03 }, + { 0xAF, 0xAA, 0xAA, 0x91, 0x9C, 0x27 }, + { 0x50, 0x4B, 0x4D }, + 0x252491F1, 0x252487BE, + }, + { "640x480", 640, 480, TVTYPE_PAL, 0, 0, + { 0x04, 0, 0, 0x82, 0, 0, 0x10, 0x3E, 0xA4, 0x37, 0x67, 0, 0x49, 0x49, 0x0F, 0, + 0, 0, 0xEC, 0x2A, 0xB8, 0x29, 0, 0, 0, 0, 0xED, 0, 0x0A, 0, 0, 0x04, + 0x12, 0x0C, 0x04, 0x7B, 0, 0x64, 0x30, 0x93, 0x49, 0x5F, 0x15, 0xA5, 0x23, 0x7A, 0xCC, 0 }, + { 0xF9, 0x50, 0x04, 0, 0, 0x45, 0xE7, 0x81, 0x23, 0x57, 0x02, 0x1F, 0x31, 0x75, 0x23, 0x8A, + 0xC8, 0xF0, 0xFF, 0x05, 0xD7, 0x8E, 0x03, 0x7F, 0xCF, 0xBF, 0x03 }, + { 0x8A, 0x86, 0x86, 0x8D, 0x96, 0x20 }, + { 0x42, 0x49, 0x49 }, + 0x2D66772D, 0, + }, + { "800x600", 800, 600, TVTYPE_NTSC, 0x1E, 0, + { 0x84, 0, 0, 0x24, 0x03, 0, 0x10, 0xDE, 0xD4, 0x0E, 0x59, 0x17, 0x46, 0x40, 0x0F, 0, + 0, 0, 0xEA, 0x0D, 0x98, 0x1C, 0, 0, 0, 0, 0x3D, 0, 0x01, 0, 0, 0x85, + 0x0D, 0x0A, 0x04, 0x74, 0, 0x5A, 0x41, 0x96, 0x6B, 0, 0, 0xAA, 0x2B, 0xA6, 0x1E, 0x10 }, + { 0xE4, 0x69, 0x04, 0, 0, 0x3F, 0x27, 0x21, 0x34, 0xED, 0x02, 0x27, 0xF5, 0x9D, 0x24, 0xB7, + 0x0D, 0x40, 0, 0x58, 0xB6, 0x3B, 0x05, 0, 0x01, 0xEF, 0x05 }, + { 0x93, 0x90, 0x90, 0x91, 0x9C, 0 }, + { 0x43, 0x4A, 0x49 }, + 0x1B5E5096, 0x1B5E4912, + }, + { "800x600", 800, 600, TVTYPE_PAL, 0, 0, + { 0x84, 0, 0, 0xA4, 0, 0, 0x19, 0x66, 0xBF, 0x12, 0x60, 0, 0x56, 0x45, 0x0F, 0, + 0, 0, 0xEC, 0x15, 0xFD, 0x28, 0, 0, 0, 0, 0x16, 0, 0x01, 0, 0, 0x85, + 0x10, 0x0C, 0x04, 0x7B, 0, 0x64, 0x37, 0x93, 0x54, 0x5F, 0x15, 0xA5, 0x23, 0x8F, 0xF4, 0 }, + { 0xE7, 0x45, 0x04, 0, 0, 0x44, 0x97, 0x21, 0x33, 0xED, 0x02, 0x97, 0x87, 0x87, 0x23, 0x9F, + 0xE7, 0x16, 0xE7, 0x16, 0xCC, 0xF3, 0x04, 0, 0x01, 0x4F, 0x04 }, + { 0xB8, 0xB4, 0xB4, 0, 0, 0 }, + { 0x58, 0x5E, 0x5E }, + 0x277A7DE4, 0, + }, + { "1024x768", 1024, 768, TVTYPE_NTSC, 0x12, 0x1C, + { 0x84, 0, 0, 0x44, 0x03, 0, 0x10, 0x80, 0x15, 0x0A, 0x58, 0x17, 0x5B, 0x40, 0x0F, 0, + 0, 0, 0xE9, 0x1E, 0x9D, 0x19, 0, 0, 0, 0, 0x9C, 0, 0x05, 0, 0, 0x85, + 0x0A, 0x05, 0x04, 0x74, 0, 0x5A, 0x56, 0x96, 0x8B, 0, 0, 0xAA, 0x2B, 0xDA, 0x79, 0x10 }, + { 0xDA, 0x50, 0x04, 0, 0, 0x3F, 0x87, 0xFF, 0x34, 0xB0, 0x03, 0x6F, 0xDB, 0xCD, 0x35, 0xF1, + 0x5E, 0xA5, 0x7E, 0x5A, 0x33, 0x26, 0x07, 0, 0x01, 0x27, 0x08 }, + { 0xC2, 0xBE, 0xBE, 0x91, 0x9C, 0 }, + { 0x58, 0x4B, 0x4A }, + 0x14EB66D6, 0x14EB6118, + }, + { "1024x768", 1024, 768, TVTYPE_PAL, 0x1E, 0, + { 0x84, 0, 0, 0xC0, 0, 0, 0x10, 0xA0, 0x2A, 0x38, 0x70, 0, 0x4E, 0x50, 0x0F, 0, + 0, 0, 0xE4, 0x23, 0xD1, 0x0C, 0, 0, 0, 0, 0x96, 0, 0x07, 0, 0, 0x85, + 0x0C, 0x0C, 0x04, 0x7B, 0, 0x64, 0x53, 0x90, 0x7B, 0x5B, 0x15, 0xA0, 0x22, 0xD1, 0x71, 0x10 }, + { 0xDD, 0x60, 0x04, 0, 0, 0x45, 0xAF, 0xFF, 0x34, 0xB5, 0x03, 0x57, 0xA8, 0xC8, 0x35, 0xEC, + 0x4C, 0xCC, 0x67, 0x5A, 0x14, 0x5C, 0x06, 0, 0x01, 0x1F, 0x07 }, + { 0xA9, 0xA6, 0xA6, 0x90, 0x99, 0 }, + { 0x51, 0x49, 0x49 }, + 0x1A8CC372, 0, + }, + { "848x480", 848, 480, TVTYPE_NTSC, 0, 0, + { 0x84, 0, 0, 0x24, 0x03, 0, 0x10, 0x46, 0xCC, 0x0E, 0x56, 0x17, 0x43, 0x3E, 0x0F, 0, + 0, 0, 0xE8, 0x29, 0x67, 0x19, 0, 0, 0, 0, 0x29, 0, 0x0B, 0, 0, 0x85, + 0x0E, 0x08, 0x04, 0x74, 0, 0x5A, 0x3D, 0x96, 0x64, 0, 0, 0xAA, 0x2B, 0x9C, 0x17, 0x10 }, + { 0xDC, 0x50, 0, 0, 0, 0x40, 0xAF, 0x51, 0x34, 0x44, 0x02, 0xE3, 0xC1, 0x93, 0x23, 0xAD, + 0xFD, 0x2B, 0x7C, 0x17, 0x6D, 0xCA, 0x04, 0, 0x01, 0x2F, 0x05 }, + { 0x94, 0x90, 0x91, 0x91, 0x9C, 0 }, + { 0x44, 0x45, 0x45 }, + 0x1D3CA863, 0x1D3CA05B, + }, + { "848x480", 848, 480, TVTYPE_PAL, 0x08, 0, + { 0x04, 0, 0, 0xC2, 0, 0, 0x10, 0x47, 0xE4, 0x09, 0x64, 0, 0x4F, 0x48, 0x0F, 0, + 0, 0, 0xE7, 0x05, 0x2C, 0x1C, 0, 0, 0, 0, 0x5E, 0, 0x09, 0, 0, 0x84, + 0x0A, 0x0C, 0x04, 0x7B, 0, 0x64, 0x46, 0x93, 0x68, 0x5F, 0x15, 0xA5, 0x23, 0xB4, 0x2A, 0x10 }, + { 0xE7, 0x45, 0x04, 0, 0, 0x43, 0xAF, 0x51, 0x34, 0x57, 0x02, 0x7F, 0x4F, 0xA9, 0x34, 0xD1, + 0x2B, 0x5D, 0xAA, 0x58, 0xD7, 0x01, 0x03, 0, 0x01, 0x7F, 0x04 }, + { 0xA4, 0xA0, 0xA1, 0, 0, 0 }, + { 0x50, 0x49, 0x49 }, + 0x1F872818, 0, + }, + { "720x480", 720, 480, TVTYPE_NTSC, 0x04, 0, + { 0x04, 0, 0, 0x26, 0x03, 0, 0x10, 0x6D, 0xC3, 0x08, 0x56, 0x17, 0x43, 0x3E, 0x0F, 0, + 0, 0, 0x0D, 0x07, 0x60, 0x34, 0, 0, 0, 0, 0x1E, 0, 0x03, 0, 0, 0x85, + 0x0F, 0x08, 0x04, 0x74, 0, 0x5A, 0x39, 0x95, 0x5E, 0, 0, 0xAA, 0x2B, 0x92, 0xFF, 0 }, + { 0xE4, 0x69, 0x04, 0, 0, 0x40, 0x47, 0xD1, 0x23, 0x57, 0x02, 0xBF, 0xAF, 0x8D, 0x23, 0xA4, + 0xF3, 0x20, 0x36, 0x17, 0x92, 0x33, 0x04, 0, 0, 0xBF, 0x03 }, + { 0x94, 0x90, 0x90, 0x91, 0x9C, 0 }, + { 0x42, 0x49, 0x48 }, + 0x1E555518, 0x1E554CC3, + }, + { "720x576", 720, 576, TVTYPE_PAL, 0, 0, + { 0x04, 0, 0, 0xA2, 0, 0, 0x10, 0x1E, 0xAC, 0x38, 0x67, 0, 0x57, 0x49, 0x0F, 0, + 0, 0, 0xF0, 0x0F, 0xD1, 0x38, 0, 0, 0, 0, 0xF2, 0, 0x02, 0, 0, 0x84, + 0x13, 0x0C, 0x04, 0x7B, 0x48, 0x64, 0x30, 0x93, 0x49, 0x5F, 0x15, 0xA5, 0x23, 0x8B, 0xBD, 0 }, + { 0xE7, 0x45, 0x04, 0, 0, 0x45, 0xF7, 0xD1, 0x22, 0xED, 0x02, 0x1D, 0x29, 0x75, 0x23, 0x88, + 0xC6, 0xF0, 0xFA, 0x0F, 0xCC, 0x30, 0x14, 0, 0, 0x8F, 0x03 }, + { 0xB5, 0xB1, 0xB1, 0, 0, 0 }, + { 0x59, 0x4D, 0x4A }, + 0x2D839832, 0, + }, + { "640x480Over", 640, 480, TVTYPE_NTSC, 0, 0, + { 0x04, 0, 0, 0x02, 0x03, 0, 0x10, 0x48, 0x72, 0x0A, 0x60, 0x17, 0x52, 0x45, 0x0F, 0, + 0, 0, 0xED, 0x23, 0x80, 0x35, 0, 0, 0, 0, 0xE9, 0, 0x02, 0, 0, 0x05, + 0x12, 0x0C, 0x04, 0x75, 0, 0x5A, 0x2F, 0x97, 0x50, 0, 0, 0xAA, 0x2B, 0x7A, 0xD8, 0 }, + { 0xC4, 0x50, 0x04, 0, 0, 0x41, 0xCF, 0x7F, 0x22, 0x2F, 0x02, 0xFF, 0x7F, 0x71, 0x22, 0x83, + 0xC0, 0xE5, 0xC0, 0x05, 0x44, 0, 0x04, 0, 0, 0xFF, 0x02 }, + { 0xAD, 0xA9, 0xA9, 0, 0, 0 }, + { 0x4F, 0x49, 0x49 }, + 0x25EAAA5E, 0x25EA9FF4, + }, + { "640x480Over", 640, 480, TVTYPE_PAL, 0, 0, + { 0x04, 0, 0, 0x82, 0, 0, 0x10, 0xB0, 0x39, 0x39, 0x67, 0, 0x48, 0x4A, 0x0F, 0, + 0, 0, 0x2C, 0x05, 0x2C, 0x30, 0, 0, 0, 0, 0xC8, 0, 0x02, 0, 0, 0x05, + 0x15, 0x0C, 0x04, 0x7B, 0, 0x64, 0x28, 0x93, 0x3E, 0x5F, 0x15, 0xA5, 0x23, 0x65, 0xCC, 0 }, + { 0xF9, 0x50, 0x04, 0, 0, 0x45, 0x47, 0x7F, 0x23, 0xF3, 0x01, 0x9F, 0x7F, 0x62, 0x22, 0x72, + 0xA7, 0xCB, 0x05, 0x05, 0x33, 0, 0x03, 0, 0, 0x9F, 0x02 }, + { 0x8A, 0x86, 0x86, 0x90, 0x99, 0 }, + { 0x42, 0x49, 0x49 }, + 0x360C44BC, 0, + }, + { "800x600Over", 800, 600, TVTYPE_NTSC, 0, 0, + { 0x84, 0, 0, 0x24, 0x03, 0, 0x10, 0xEF, 0xB0, 0x0A, 0x5A, 0x17, 0x46, 0x40, 0x0F, 0, + 0, 0, 0xE8, 0x32, 0xC3, 0x19, 0, 0, 0, 0, 0x33, 0, 0x01, 0, 0, 0x85, + 0x0D, 0x0A, 0x04, 0x75, 0, 0x5A, 0x41, 0x96, 0x68, 0, 0, 0xAA, 0x2B, 0x9E, 0x1E, 0x10 }, + { 0xE4, 0x69, 0x04, 0, 0, 0x40, 0x37, 0x21, 0x34, 0x98, 0x02, 0x01, 0x21, 0x97, 0x34, 0xB1, + 0xFF, 0x34, 0xB6, 0x17, 0x11, 0, 0x05, 0, 0x01, 0x57, 0x05 }, + { 0x93, 0x90, 0x90, 0, 0, 0 }, + { 0x42, 0x45, 0x45 }, + 0x1C61CEE0, 0x1C61C714, + }, + { "800x600Over", 800, 600, TVTYPE_PAL, 0, 0, + { 0x84, 0, 0, 0xA0, 0, 0, 0x19, 0xA6, 0x9F, 0x38, 0x60, 0, 0x57, 0x45, 0x0F, 0, + 0, 0, 0xC8, 0x12, 0x8F, 0x1C, 0, 0, 0, 0, 0x0E, 0, 0x03, 0, 0, 0x85, + 0x10, 0x0C, 0x04, 0x7B, 0, 0x64, 0x37, 0x93, 0x54, 0x5F, 0x15, 0xA5, 0x23, 0x8B, 0xF4, 0 }, + { 0xE9, 0x50, 0x04, 0, 0, 0x44, 0xE7, 0x1F, 0x33, 0x89, 0x02, 0x8D, 0xBC, 0x85, 0x23, 0x9C, + 0xE4, 0x13, 0xD4, 0x16, 0x28, 0x90, 0x04, 0, 0x01, 0x0F, 0x04 }, + { 0xB8, 0xB4, 0xB4, 0x90, 0x99, 0 }, + { 0x58, 0x48, 0x48 }, + 0x27E98D57, 0, + }, + { "1024x768Over", 1024, 768, TVTYPE_NTSC, 0x16, 0x1C, + { 0x84, 0, 0, 0x44, 0x03, 0, 0x10, 0xA0, 0xAA, 0x05, 0x57, 0x17, 0x5C, 0x3F, 0x0F, 0, + 0, 0, 0xE8, 0x33, 0x1A, 0x16, 0, 0, 0, 0, 0x66, 0, 0x01, 0, 0, 0x85, + 0x0A, 0x05, 0x04, 0x74, 0, 0x5A, 0x4B, 0x96, 0x79, 0, 0, 0xAA, 0x2B, 0xB9, 0x4B, 0x10 }, + { 0xE4, 0x50, 0x04, 0, 0, 0x40, 0xAF, 0xFF, 0x34, 0x47, 0x03, 0xAF, 0xFF, 0xB1, 0x34, 0xD1, + 0x30, 0x68, 0x0B, 0x59, 0x66, 0, 0x06, 0, 0x01, 0x7F, 0x07 }, + { 0xC2, 0xBE, 0xBE, 0, 0, 0 }, + { 0x57, 0x45, 0x45 }, + 0x1844440E, 0x18443D63, + }, + { "1024x768Over", 1024, 768, TVTYPE_PAL, 0x1E, 0, + { 0x84, 0, 0, 0xC0, 0, 0, 0x10, 0xA8, 0xC5, 0x36, 0x5D, 0, 0x4E, 0x43, 0x0F, 0, + 0, 0, 0xC9, 0x0A, 0x79, 0x1C, 0, 0, 0, 0, 0x6E, 0, 0x03, 0, 0, 0x85, + 0x0C, 0x0C, 0x04, 0x7B, 0, 0x64, 0x4B, 0x93, 0x6F, 0x5F, 0x15, 0xA5, 0x23, 0xBE, 0x5A, 0x10 }, + { 0xDD, 0x60, 0x04, 0, 0, 0x43, 0xAF, 0xFF, 0x34, 0x38, 0x03, 0xCF, 0xDF, 0xB4, 0x34, 0xD6, + 0x35, 0x75, 0x47, 0x59, 0x47, 0x20, 0x05, 0, 0x01, 0x2F, 0x06 }, + { 0xA9, 0xA6, 0xA6, 0x90, 0x99, 0 }, + { 0x51, 0x49, 0x49 }, + 0x1D7B0E38, 0, + }, + { "848x480Over", 848, 480, TVTYPE_NTSC, 0, 0, + { 0x84, 0, 0, 0x44, 0x03, 0, 0x10, 0x96, 0xA7, 0x08, 0x5B, 0x17, 0x46, 0x40, 0x0F, 0, + 0, 0, 0xE8, 0x3C, 0x2D, 0x22, 0, 0, 0, 0, 0x3D, 0, 0x01, 0, 0, 0x85, + 0x0D, 0x08, 0x04, 0x75, 0, 0x5A, 0x41, 0x96, 0x69, 0, 0, 0xAA, 0x2B, 0xA2, 0x24, 0x10 }, + { 0xDC, 0x50, 0, 0, 0, 0x40, 0xEF, 0x51, 0x33, 0x25, 0x02, 0x1F, 0x4D, 0x9C, 0x34, 0xB5, + 0x0C, 0x3D, 0xF1, 0x57, 0x30, 0x01, 0x04, 0, 0x01, 0x1F, 0x04 }, + { 0xC0, 0xBC, 0xBC, 0, 0, 0 }, + { 0x58, 0x45, 0x45 }, + 0x1B9364A1, 0x1B933067, + }, + { "848x480Over", 848, 480, TVTYPE_PAL, 0, 0, + { 0x84, 0, 0, 0xC0, 0, 0, 0x10, 0x47, 0xA8, 0x39, 0x64, 0, 0x4E, 0x46, 0x0F, 0, + 0, 0, 0xEA, 0x15, 0xF2, 0x28, 0, 0, 0, 0, 0x39, 0, 0x0B, 0, 0, 0x84, + 0x0F, 0x0C, 0x04, 0x7B, 0, 0x64, 0x40, 0x93, 0x5F, 0x5F, 0x15, 0xA5, 0x23, 0xA3, 0x2A, 0x10 }, + { 0xE7, 0x45, 0x04, 0, 0, 0x43, 0xAF, 0x4F, 0x34, 0x25, 0x02, 0x1F, 0x4F, 0x9B, 0x34, 0xB7, + 0x0A, 0x3F, 0xF0, 0x57, 0x85, 0, 0x03, 0, 0x01, 0x1F, 0x04 }, + { 0xA4, 0xA1, 0xA1, 0x90, 0x99, 0 }, + { 0x4E, 0x49, 0x49 }, + 0x2264E5EC, 0, + }, + { "720x480Over", 720, 480, TVTYPE_NTSC, 0, 0, + { 0x04, 0, 0, 0x02, 0x03, 0, 0x10, 0x18, 0x28, 0x09, 0x5B, 0x17, 0x46, 0x41, 0x0F, 0, + 0, 0, 0xEE, 0x0D, 0xA0, 0x38, 0, 0, 0, 0, 0xEE, 0, 0x02, 0, 0, 0x85, + 0x11, 0x08, 0x04, 0x75, 0, 0x5A, 0x31, 0x95, 0x51, 0, 0, 0xAA, 0x2B, 0x7A, 0xDB, 0 }, + { 0xE4, 0x69, 0x04, 0, 0, 0x40, 0x1F, 0xCF, 0x23, 0x0C, 0x02, 0x1F, 0xCF, 0x76, 0x23, 0x88, + 0xC9, 0xEF, 0xFF, 0x05, 0, 0, 0, 0, 0, 0x1F, 0x03 }, + { 0xAB, 0xA7, 0xA7, 0, 0, 0 }, + { 0x4D, 0x49, 0x49 }, + 0x2466661D, 0x24665C1E, + }, + { "720x576Over", 720, 576, TVTYPE_PAL, 0, 0, + { 0x04, 0, 0, 0xA6, 0, 0, 0x10, 0x10, 0x7D, 0x32, 0x60, 0, 0x57, 0x46, 0x0F, 0, + 0, 0, 0xEC, 0x15, 0xDC, 0x28, 0, 0, 0, 0, 0xEE, 0, 0x0A, 0, 0, 0x84, + 0x13, 0x0C, 0x04, 0x7B, 0x48, 0x64, 0x30, 0x93, 0x49, 0x5F, 0x15, 0xA5, 0x23, 0x77, 0xFF, 0 }, + { 0xE7, 0x45, 0x04, 0, 0, 0x45, 0xE7, 0xCF, 0x23, 0x57, 0x02, 0x1F, 0x80, 0x75, 0x23, 0x89, + 0xC7, 0xF1, 0xFF, 0x05, 0xD7, 0x80, 0x03, 0, 0, 0xBF, 0x03 }, + { 0xBA, 0xB8, 0xB8, 0x90, 0x99, 0 }, + { 0x58, 0x48, 0x49 }, + 0x2D66772D, 0, + }, + { "720x480Noscale", 720, 480, TVTYPE_NTSC, 0, 0, + { 0x04, 0, 0, 0, 0x03, 0, 0x10, 0x98, 0x98, 0x08, 0x5A, 0x17, 0x49, 0x41, 0, 0x89, + 0, 0, 0xA9, 0x19, 0xDC, 0x24, 0, 0, 0, 0, 0xEE, 0x03, 0x02, 0x80, 0, 0x04, + 0x11, 0x08, 0x04, 0x75, 0, 0x5A, 0x31, 0x95, 0x51, 0, 0, 0xAA, 0x2B, 0x7A, 0xDB, 0 }, + { 0xE4, 0x69, 0x04, 0, 0, 0x40, 0x77, 0xD0, 0x23, 0x0C, 0x02, 0x77, 0xD0, 0x80, 0x23, 0x88, + 0xC9, 0x30, 0xD0, 0x16, 0, 0, 0, 0, 0, 0x77, 0x03 }, + { 0xBA, 0xB8, 0xB8, 0x90, 0x99, 0 }, /* added later - untested */ + { 0x58, 0x48, 0x49 }, /* added later - untested */ + 0x20BA2E8B, 0, + }, + { "720x576Noscale", 720, 576, TVTYPE_PAL, 0, 0, + { 0x04, 0, 0, 0xA4, 0, 0, 0x10, 0x75, 0xA5, 0x3A, 0x5A, 0, 0x49, 0x46, 0, 0x89, + 0, 0, 0xE9, 0x19, 0xDC, 0x24, 0, 0, 0, 0, 0xEE, 0, 0x0A, 0, 0, 0x04, + 0x13, 0x0C, 0x04, 0x7B, 0x48, 0x64, 0x30, 0x93, 0x49, 0x5F, 0x15, 0xA5, 0x23, 0x77, 0xFF, 0 }, + { 0xE7, 0x45, 0x04, 0, 0, 0x45, 0x7F, 0xD0, 0x23, 0x70, 0x02, 0x7F, 0xD0, 0x93, 0x23, 0x89, + 0xC7, 0xF1, 0xBD, 0x06, 0, 0, 0, 0, 0, 0x7F, 0x03 }, + { 0xBA, 0xB8, 0xB8, 0x90, 0x99, 0 }, /* added later - untested */ + { 0x58, 0x48, 0x49 }, /* added later - untested */ + 0x288933E3, 0, + }, + { NULL, 0, 0, 0, 0, 0, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 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, 0XFF, 0XFF, 0XFF, 0, 0, 0XFF, 0XFF, 0XFF, 0, 0, 0 }, - 0X3F, 0X18, 75, 13, 22 +static DisplayModeRec VT1623Modes[] = { + { MODEPREFIX("640x480"), 23520, 640, 656, 744, 784, 0, 480, 487, 491, 600, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("640x480"), 30000, 640, 680, 808, 1000, 0, 480, 520, 523, 600, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXPAL }, + { MODEPREFIX("800x600"), 39900, 800, 840, 976, 1064, 0, 600, 604, 620, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("800x600"), 34500, 800, 816, 880, 920, 0, 600, 604, 620, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXPAL }, + { MODEPREFIX("1024x768"), 54810, 1024, 1032, 1088, 1160, 0, 768, 780, 792, 945, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("1024x768"), 57000, 1024, 1040, 1112, 1200, 0, 768, 829, 840, 950, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXPAL }, + { MODEPREFIX("848x480"), 34860, 848, 872, 1032, 1200, 0, 480, 495, 509, 581, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("848x480"), 36000, 848, 872, 1032, 1200, 0, 480, 498, 509, 600, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXPAL }, + { MODEPREFIX("720x480"), 25200, 720, 728, 776, 840, 0, 480, 511, 515, 600, 0, V_NHSYNC | V_PVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("720x576"), 28500, 720, 728, 744, 760, 0, 576, 635, 643, 750, 0, V_NHSYNC | V_PVSYNC, MODESUFFIXPAL }, + { MODEPREFIX("640x480Over"), 20160, 640, 648, 704, 720, 0, 480, 490, 491, 560, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("640x480Over"), 21000, 640, 664, 792, 840, 0, 480, 485, 491, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXPAL }, + { MODEPREFIX("800x600Over"), 35910, 800, 840, 984, 1080, 0, 600, 601, 604, 665, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("800x600Over"), 32500, 800, 832, 928, 1000, 0, 600, 600, 604, 650, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXPAL }, + { MODEPREFIX("1024x768Over"), 50400, 1024, 1040, 1112, 1200, 0, 768, 772, 776, 840, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("1024x768Over"), 49500, 1024, 1032, 1112, 1200, 0, 768, 771, 776, 825, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXPAL }, + { MODEPREFIX("848x480Over"), 27720, 848, 856, 928, 1008, 0, 480, 490, 493, 550, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("848x480Over"), 33000, 848, 872, 1032, 1200, 0, 480, 490, 493, 550, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXPAL }, + { MODEPREFIX("720x480Over"), 21000, 720, 728, 760, 800, 0, 480, 480, 483, 525, 0, V_NHSYNC | V_PVSYNC, MODESUFFIXNTSC }, + { MODEPREFIX("720x576Over"), 27000, 720, 768, 800, 864, 0, 576, 577, 579, 625, 0, V_NHSYNC | V_PVSYNC, MODESUFFIXPAL }, + { MODEPREFIX("720x576Noscale"), 28000, 720, 728, 864, 896, 0, 576, 576, 579, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXPAL }, + { MODEPREFIX(NULL), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, MODESUFFIXNTSC }, }; -static const VIAVT162XTableRec VT1623Table[] = { - { - { 0X4, 0, 0, 0X6, 0X3, 0, 0X20, 0X28, 0X9A, 0XC, 0X55, 0, 0X52, 0X3B, 0XF, 0, 0, 0, 0XF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 }, - { 0X6E, 0X63, 0X63, 0X92, 0X66, 0X8E, 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, 0, 0, 0X87, 0X1C, 0, 0 }, - { 0, 0, 0, 0X87, 0X1C, 0, 0, 0 }, - { 0X97, 0X1F, 0X1F, 0X97, 0XDB, 0X33, 0X36, 0X72, 0XED, 0X57, 0X57, 0XED, 0X52, 0X12, 0X5D, 0X4D, 0, 0, 0, 0, 0, 0X32, 0X64, 0, 0, 0, 0X80, 0, 0X80, 0, 0, 0 }, - { 0X97, 0X1F, 0X1F, 0X97, 0XDB, 0X33, 0X36, 0X72, 0XED, 0X57, 0X57, 0XED, 0X52, 0X12, 0X5D, 0X4D, 0, 0, 0, 0, 0, 0X64, 0XC8, 0X40, 0, 0, 0X80, 0, 0X80, 0, 0, 0 }, - { 0X97, 0X1F, 0X1F, 0X97, 0XDB, 0X33, 0X36, 0X72, 0XED, 0X57, 0X57, 0XED, 0X52, 0X12, 0X5D, 0X4D, 0, 0, 0, 0, 0, 0XC8, 0X90, 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, 0X5865, 0X5E66, 0X5E67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 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, 0X47, 0X12, 0X8, 0X50, 0, 0X50, 0X3A, 0XF, 0, 0, 0, 0XEF, 0X37, 0X77, 0X2A, 0XD6, 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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 } +static struct VT162XTableRec +VT1623Table[] = { + { "640x480", 640, 480, TVTYPE_NTSC, 0, 0, + { 0x04, 0, 0, 0x06, 0x03, 0, 0x20, 0x28, 0x9A, 0x0C, 0x55, 0, 0x52, 0x3B, 0x0F, 0, + 0, 0, 0xF8, 0x3E, 0x81, 0x56, 0, 0, 0, 0, 0xEA, 0, 0, 0, 0, 0x11, + 0x15, 0x0C, 0x5F, 0x75, 0x08, 0x56, 0x2F, 0x90, 0x50, 0, 0, 0xA3, 0x29, 0x5B, 0xBF, 0 }, + { 0, 0, 0, 0, 0, 0x3B, 0x0F, 0x7F, 0x23, 0x57, 0x02, 0x0F, 0x26, 0x73, 0x63, 0x86, + 0xC4, 0xEA, 0xDF, 0x05, 0x92, 0xA1, 0x84, 0, 0, 0x7F, 0x03 }, + { 0x6A, 0x62, 0x65, 0x91, 0x9C, 0x27 }, + { 0x50, 0x4B, 0x4D }, + 0x252491F1, 0x252487BE, + }, + { "640x480", 640, 480, TVTYPE_PAL, 0, 0, + { 0x04, 0, 0, 0x06, 0, 0, 0x20, 0xBF, 0x9F, 0x37, 0x5D, 0, 0x4F, 0x42, 0x0F, 0, + 0, 0, 0xAC, 0x15, 0x6E, 0x28, 0, 0, 0, 0, 0xED, 0, 0x02, 0, 0, 0x99, + 0x17, 0x0C, 0x31, 0x7A, 0x04, 0x62, 0x30, 0x8E, 0x4A, 0x5B, 0x15, 0xA0, 0x22, 0x5C, 0xCC, 0 }, + { 0, 0, 0, 0, 0, 0x43, 0xE7, 0x7F, 0x23, 0x57, 0x02, 0x1F, 0x2F, 0x75, 0x63, 0x8A, + 0xC8, 0xF0, 0xFF, 0x05, 0xD7, 0x8E, 0x83, 0x7F, 0xCF, 0xBF, 0x03 }, + { 0x6A, 0x62, 0x65, 0x8D, 0x96, 0x20 }, + { 0x42, 0x49, 0x49 }, + 0x2D66772D, 0, + }, + { "800x600", 800, 600, TVTYPE_NTSC, 0, 0, + { 0x84, 0, 0, 0x04, 0x03, 0, 0x20, 0x58, 0xD4, 0x09, 0x52, 0, 0x51, 0x3B, 0x0F, 0, + 0, 0, 0x6A, 0x0D, 0x4C, 0x1C, 0, 0, 0, 0, 0x3E, 0, 0x01, 0, 0, 0x44, + 0x10, 0x0A, 0x9C, 0x75, 0x04, 0x56, 0x41, 0x90, 0x6B, 0, 0, 0xA3, 0x29, 0x86, 0x10, 0x10 }, + { 0, 0, 0, 0, 0, 0x3A, 0x27, 0x1F, 0x34, 0xED, 0x02, 0x27, 0xF5, 0x9D, 0x64, 0xB7, + 0x0D, 0x40, 0, 0x58, 0xB6, 0x3B, 0x85, 0, 0x01, 0xEF, 0x05 }, + { 0x6A, 0x62, 0x65, 0x91, 0x9C, 0 }, + { 0x43, 0x4A, 0x49 }, + 0x1B5E5096, 0x1B5E4912, + }, + { "800x600", 800, 600, TVTYPE_PAL, 0, 0, + { 0x84, 0, 0, 0x04, 0, 0, 0x20, 0x27, 0xB8, 0x0D, 0x5C, 0, 0x4E, 0x40, 0x0F, 0, + 0, 0, 0xEC, 0x2A, 0xFD, 0x28, 0, 0, 0, 0, 0x11, 0, 0x01, 0, 0, 0xAA, + 0x13, 0x0C, 0x9F, 0x79, 0x0C, 0x62, 0x37, 0x8E, 0x54, 0x5B, 0x15, 0xA0, 0x22, 0x70, 0xF4, 0 }, + { 0, 0, 0, 0, 0, 0x41, 0x97, 0x1F, 0x33, 0xED, 0x02, 0x97, 0x87, 0x87, 0x63, 0x9F, + 0xE7, 0x16, 0xE7, 0x16, 0xCC, 0xF3, 0x84, 0, 0x01, 0x4F, 0x04 }, + { 0x6A, 0x62, 0x65, 0, 0, 0}, + { 0x58, 0x5E, 0x5E }, + 0x277A7DE4, 0, + }, + { "1024x768", 1024, 768, TVTYPE_NTSC, 0, 0, + { 0x84, 0, 0, 0x04, 0x03, 0, 0x20, 0x47, 0x12, 0x08, 0x50, 0, 0x50, 0x3A, 0x0F, 0, + 0, 0, 0xEF, 0x37, 0x77, 0x2A, 0, 0, 0, 0, 0xA1, 0, 0x05, 0, 0, 0x77, + 0x0D, 0x05, 0xEF, 0x73, 0x0C, 0x56, 0x56, 0x90, 0x8B, 0, 0, 0xA3, 0x29, 0xB9, 0x6A, 0x10 }, + { 0, 0, 0, 0, 0, 0x39, 0x87, 0xFF, 0x34, 0xB0, 0x03, 0x6F, 0xDC, 0xCD, 0x35, 0xF1, + 0x5E, 0xA5, 0x7E, 0x5A, 0x33, 0x26, 0x87, 0, 0x01, 0x27, 0x08 }, + { 0x6A, 0x62, 0x65, 0x91, 0x9C, 0 }, + { 0x58, 0x4B, 0x4A }, + 0x14EB66D6, 0x14EB6118, + }, + { "1024x768", 1024, 768, TVTYPE_PAL, 0, 0, + { 0x84, 0, 0, 0x04, 0, 0, 0x20, 0x57, 0x25, 0x35, 0x5A, 0, 0x4D, 0x40, 0x0F, 0, + 0, 0, 0xE8, 0x23, 0xD1, 0x18, 0, 0, 0, 0, 0x96, 0, 0x07, 0, 0, 0xFF, + 0x0F, 0x0C, 0x87, 0x79, 0, 0x62, 0x53, 0x8E, 0x7B, 0x5B, 0x15, 0xA0, 0x22, 0xB6, 0x5A, 0x10 }, + { 0, 0, 0, 0, 0, 0x40, 0xAF, 0xFF, 0x34, 0xB5, 0x03, 0x57, 0xA8, 0xC8, 0x35, 0xEC, + 0x4C, 0xCC, 0x67, 0x5A, 0x14, 0x5C, 0x06, 0, 0x01, 0x1F, 0x07 }, + { 0x6A, 0x62, 0x65, 0, 0, 0 }, + { 0x50, 0x69, 0x69 }, + 0x1A8CC372, 0, + }, + { "848x480", 848, 480, TVTYPE_NTSC, 0, 0, + { 0x84, 0, 0, 0x04, 0x03, 0, 0x20, 0xA7, 0xC1, 0x07, 0x50, 0, 0x50, 0x39, 0x0F, 0, + 0, 0, 0xF0, 0x29, 0x67, 0x31, 0, 0, 0, 0, 0x2A, 0, 0x03, 0, 0, 0x33, + 0x11, 0x08, 0x47, 0x73, 0x0C, 0x56, 0x3C, 0x90, 0x65, 0, 0, 0xA3, 0x29, 0x7C, 0, 0x10 }, + { 0, 0, 0, 0, 0, 0x39, 0xAF, 0x4F, 0x34, 0x44, 0x02, 0xE3, 0xC2, 0x93, 0x63, 0xAD, + 0xFD, 0x2B, 0x7C, 0x17, 0x6D, 0xCA, 0x84, 0, 0x01, 0x2F, 0x05 }, + { 0x6A, 0x62, 0x65, 0x91, 0x9C, 0 }, + { 0x44, 0x45, 0x45 }, + 0x1D3CA863, 0x1D3CA05B, + }, + { "848x480", 848, 480, TVTYPE_PAL, 0, 0, + { 0x04, 0, 0, 0x06, 0, 0, 0x20, 0xA7, 0xE6, 0x06, 0x5C, 0, 0x4E, 0x41, 0x0F, 0, + 0, 0, 0xE6, 0x23, 0x84, 0x18, 0, 0, 0, 0, 0x56, 0, 0x01, 0, 0, 0xCC, + 0x0F, 0x0C, 0x60, 0x79, 0, 0x62, 0x46, 0x8E, 0x68, 0x5B, 0x15, 0xA0, 0x22, 0x94, 0x2A, 0x10 }, + { 0, 0, 0, 0, 0, 0x40, 0xAF, 0x4F, 0x34, 0x57, 0x02, 0x7F, 0x31, 0xA9, 0x74, 0xD1, + 0x2B, 0x5D, 0xAA, 0x58, 0xD7, 0x26, 0x83, 0, 0x01, 0x7F, 0x04 }, + { 0x6A, 0x62, 0x65, 0, 0, 0 }, + { 0x50, 0x49, 0x49 }, + 0x1F872818, 0, + }, + { "720x480", 720, 480, TVTYPE_NTSC, 0, 0, + { 0x04, 0, 0, 0x06, 0x03, 0, 0x20, 0x3F, 0xB6, 0x07, 0x52, 0, 0x51, 0x3A, 0x0F, 0, + 0, 0, 0xED, 0x31, 0x50, 0x35, 0, 0, 0, 0, 0x1E, 0, 0x03, 0, 0, 0x33, + 0x12, 0x08, 0x57, 0x75, 0, 0x56, 0x3A, 0x90, 0x61, 0, 0, 0xA3, 0x29, 0x76, 0xF1, 0 }, + { 0, 0, 0, 0, 0, 0x3A, 0x47, 0xCF, 0x23, 0x57, 0x02, 0xBF, 0xAD, 0x8D, 0x63, 0xA4, + 0xF3, 0x20, 0x36, 0x17, 0x92, 0x33, 0x84, 0, 0, 0xBF, 0x03 }, + { 0x6A, 0x62, 0x65, 0x91, 0x9C, 0 }, + { 0x42, 0x49, 0x48 }, + 0x1E555518, 0x1E554CC3, + }, + { "720x576", 720, 576, TVTYPE_PAL, 0, 0, + { 0x04, 0, 0, 0x06, 0, 0, 0x20, 0x0F, 0xAF, 0x35, 0x5D, 0, 0x4F, 0x41, 0x0F, 0, + 0, 0, 0xF8, 0x3C, 0x73, 0x56, 0, 0, 0, 0, 0xED, 0, 0x02, 0, 0, 0x99, + 0x18, 0x0C, 0x76, 0x7A, 0x44, 0x62, 0x30, 0x8E, 0x49, 0x5B, 0x15, 0xA0, 0x22, 0x5C, 0xBD, 0 }, + { 0, 0, 0, 0, 0, 0x43, 0xF7, 0xCF, 0x22, 0xED, 0x02, 0x1D, 0x29, 0x75, 0x63, 0x88, + 0xC6, 0xF0, 0xFA, 0x0F, 0xCC, 0x30, 0x94, 0, 0, 0x8F, 0x03 }, + { 0x6A, 0x62, 0x65, 0, 0, 0 }, + { 0x59, 0x4D, 0x4A }, + 0x2D839832, 0, + }, + { "640x480Over", 640, 480, TVTYPE_NTSC, 0, 0, + { 0x04, 0, 0, 0x06, 0x03, 0, 0x20, 0x10, 0x76, 0x0A, 0x56, 0x05, 0x50, 0x3B, 0x0F, 0, + 0, 0, 0xED, 0x23, 0xC0, 0x34, 0, 0, 0, 0, 0xE5, 0, 0x02, 0, 0, 0x11, + 0x17, 0x0C, 0x46, 0x73, 0x0C, 0x56, 0x2E, 0x90, 0x4E, 0, 0, 0xA3, 0x29, 0x59, 0xBA, 0 }, + { 0, 0, 0, 0, 0, 0x3A, 0xCF, 0x7F, 0x22, 0x2F, 0x02, 0xFF, 0x59, 0x71, 0x62, 0x83, + 0xC0, 0xE5, 0xC0, 0x05, 0x44, 0x44, 0x84, 0, 0, 0xFF, 0x02 }, + { 0x6A, 0x62, 0x65, 0, 0, 0 }, + { 0x4F, 0x49, 0x49 }, + 0x25EAAA5E, 0x25EA9FF4, + }, + { "640x480Over", 640, 480, TVTYPE_PAL, 0, 0, + { 0x04, 0, 0, 0x06, 0, 0, 0x20, 0x23, 0x4E, 0x2A, 0x61, 0, 0x4D, 0x47, 0x0F, 0, + 0, 0, 0x4A, 0x0F, 0x37, 0x28, 0, 0, 0, 0, 0xC7, 0, 0x02, 0, 0, 0x88, + 0x1B, 0x0C, 0xFF, 0x79, 0, 0x62, 0x28, 0x8E, 0x3E, 0x5B, 0x15, 0xA0, 0x22, 0x49, 0xCC, 0 }, + { 0, 0, 0, 0, 0, 0x44, 0x47, 0x7F, 0x23, 0xF3, 0x01, 0x9F, 0x3F, 0x62, 0x62, 0x72, + 0xA7, 0xCB, 0x05, 0x05, 0x33, 0x70, 0x83, 0, 0, 0x9F, 0x02 }, + { 0x6A, 0x62, 0x65, 0x90, 0x99, 0 }, + { 0x42, 0x49, 0x49 }, + 0x360C44BC, 0, + }, + { "800x600Over", 800, 600, TVTYPE_NTSC, 0, 0, + { 0x84, 0, 0, 0x04, 0x03, 0, 0x20, 0x5F, 0xA4, 0x08, 0x51, 0, 0x50, 0x39, 0x0F, 0, + 0, 0, 0xE8, 0x33, 0xE6, 0x18, 0, 0, 0, 0, 0x32, 0, 0x03, 0, 0, 0x33, + 0x11, 0x0A, 0x9B, 0x73, 0x08, 0x56, 0x3F, 0x90, 0x68, 0, 0, 0xA3, 0x29, 0x82, 0x02, 0x10 }, + { 0, 0, 0, 0, 0, 0x39, 0x37, 0x21, 0x34, 0x98, 0x02, 0x01, 0x21, 0x97, 0x74, 0xB1, + 0xFF, 0x34, 0xB6, 0x17, 0x11, 0, 0x85, 0, 0x01, 0x57, 0x05 }, + { 0x6A, 0x62, 0x65, 0, 0, 0 }, + { 0x42, 0x45, 0x45 }, + 0x1C61CEE0, 0x1C61C714, + }, + { "800x600Over", 800, 600, TVTYPE_PAL, 0, 0, + { 0x84, 0, 0, 0x04, 0, 0, 0x20, 0x47, 0x90, 0x3B, 0x5A, 0, 0x4D, 0x3F, 0x0F, 0, + 0, 0, 0xE8, 0x24, 0x8F, 0x1C, 0, 0, 0, 0, 0x0E, 0, 0x03, 0, 0, 0xAA, + 0x14, 0x0C, 0x2F, 0x79, 0, 0x62, 0x37, 0x8E, 0x54, 0x5B, 0x15, 0xA0, 0x22, 0x6E, 0xF4, 0 }, + { 0, 0, 0, 0, 0, 0x41, 0xE7, 0x1F, 0x33, 0x89, 0x02, 0x8D, 0xCD, 0x85, 0x63, 0x9C, + 0xE4, 0x13, 0xD4, 0x16, 0x28, 0x60, 0x84, 0, 0x01, 0x0F, 0x04 }, + { 0x6A, 0x62, 0x65, 0x90, 0x99, 0 }, + { 0x58, 0x48, 0x48 }, + 0x27E98D57, 0, + }, + { "1024x768Over", 1024, 768, TVTYPE_NTSC, 0, 0, + { 0x84, 0, 0, 0x04, 0x03, 0, 0x20, 0x52, 0xAE, 0x09, 0x50, 0, 0x50, 0x39, 0x0F, 0, + 0, 0, 0xE8, 0x33, 0x0D, 0x15, 0, 0, 0, 0, 0x66, 0, 0x03, 0, 0, 0x55, + 0x0F, 0x05, 0xF1, 0x73, 0x08, 0x56, 0x4A, 0x90, 0x79, 0, 0, 0xA3, 0x29, 0x9B, 0x33, 0x10 }, + { 0, 0, 0, 0, 0, 0x39, 0xAF, 0xFF, 0x34, 0x47, 0x03, 0xAF, 0xC3, 0xB1, 0x34, 0xD1, + 0x30, 0x68, 0x0B, 0x59, 0x66, 0x40, 0x86, 0, 0x01, 0x7F, 0x07 }, + { 0x6A, 0x62, 0x65, 0, 0, 0 }, + { 0x57, 0x45, 0x45 }, + 0x1844440E, 0x18443D63, + }, + { "1024x768Over", 1024, 768, TVTYPE_PAL, 0, 0, + { 0x84, 0, 0, 0x04, 0, 0, 0x20, 0x56, 0xC0, 0x32, 0x5A, 0, 0x4D, 0x40, 0x0F, 0, + 0, 0, 0xC9, 0x14, 0x79, 0x1C, 0, 0, 0, 0, 0x6D, 0, 0x03, 0, 0, 0xDD, + 0x0F, 0x0C, 0xCA, 0x79, 0x08, 0x62, 0x4B, 0x8E, 0x6F, 0x5B, 0x15, 0xA0, 0x22, 0xA1, 0x5A, 0x10 }, + { 0, 0, 0, 0, 0, 0x40, 0xAF, 0xFF, 0x34, 0x38, 0x03, 0xCF, 0xDF, 0xB4, 0x34, 0xD6, + 0x35, 0x75, 0x47, 0x59, 0x47, 0x20, 0x05, 0, 0x01, 0x2F, 0x06 }, + { 0x6A, 0x62, 0x65, 0x90, 0x99, 0 }, + { 0x51, 0x49, 0x49 }, + 0x1D7B0E38, 0, + }, + { "848x480Over", 848, 480, TVTYPE_NTSC, 0, 0, + { 0x84, 0, 0, 0x04, 0x03, 0, 0x20, 0x4E, 0x9E, 0x07, 0x51, 0, 0x50, 0x3A, 0x0F, 0, + 0, 0, 0xED, 0x23, 0x08, 0x35, 0, 0, 0, 0, 0x3C, 0, 0x03, 0, 0, 0x44, + 0x11, 0x0A, 0xF0, 0x73, 0x04, 0x56, 0x41, 0x90, 0x6A, 0, 0, 0xA3, 0x29, 0x87, 0x0A, 0x10 }, + { 0, 0, 0, 0, 0, 0x39, 0xEF, 0x51, 0x33, 0x25, 0x02, 0x1F, 0x47, 0x9C, 0x74, 0xB5, + 0x0C, 0x3D, 0xF1, 0x57, 0x30, 0x0C, 0x84, 0, 0x01, 0x1F, 0x04 }, + { 0x6A, 0x62, 0x65, 0, 0, 0 }, + { 0x58, 0x45, 0x45 }, + 0x1B9364A1, 0x1B933067, + }, + { "848x480Over", 848, 480, TVTYPE_PAL, 0, 0, + { 0x84, 0, 0, 0x04, 0, 0, 0x20, 0xA5, 0xA1, 0x38, 0x5E, 0, 0x4D, 0x41, 0x0F, 0, + 0, 0, 0xC7, 0x1E, 0x79, 0x1C, 0, 0, 0, 0, 0x39, 0, 0x03, 0, 0, 0xBB, + 0x12, 0x0C, 0x5A, 0x79, 0x0C, 0x62, 0x40, 0x8E, 0x5F, 0x5B, 0x15, 0xA0, 0x22, 0x88, 0x2A, 0x10 }, + { 0, 0, 0, 0, 0, 0x3A, 0xAF, 0x4F, 0x34, 0x25, 0x02, 0x1F, 0x4F, 0x9B, 0x74, 0xB7, + 0x0A, 0x3F, 0xF0, 0x58, 0x85, 0, 0x83, 0, 0x01, 0x1F, 0x04 }, + { 0x6A, 0x62, 0x65, 0x90, 0x99, 0 }, + { 0x4E, 0x49, 0x49 }, + 0x2264E5EC, 0, + }, + { "720x480Over", 720, 480, TVTYPE_NTSC, 0, 0, + { 0x04, 0, 0, 0, 0x03, 0, 0x20, 0x28, 0x52, 0x08, 0x50, 0, 0x4E, 0x2F, 0x0F, 0, + 0, 0, 0x2D, 0x07, 0x28, 0x34, 0, 0, 0, 0, 0xEE, 0, 0x02, 0, 0, 0x11, + 0x16, 0x08, 0xDF, 0x76, 0x04, 0x56, 0x31, 0x90, 0x51, 0, 0, 0xA3, 0x29, 0x5D, 0xC3, 0 }, + { 0, 0, 0, 0, 0x08, 0x3A, 0x1F, 0xCF, 0x23, 0x0C, 0x02, 0x1F, 0xCE, 0x76, 0x23, 0x88, + 0xC9, 0xEF, 0xFF, 0x05, 0, 0, 0, 0, 0, 0x1F, 0x03 }, + { 0x6A, 0x62, 0x65, 0, 0, 0 }, + { 0x4D, 0x49, 0x49 }, + 0x2466661D, 0x24665C1E, + }, + { "720x576Over", 720, 576, TVTYPE_PAL, 0, 0, + { 0x04, 0, 0, 0, 0, 0, 0x20, 0x3F, 0x89, 0x35, 0x50, 0, 0x43, 0x2E, 0x0F, 0, + 0, 0, 0xE8, 0x23, 0x84, 0x20, 0, 0, 0, 0, 0xFF, 0, 0x02, 0, 0, 0x99, + 0x17, 0x0C, 0x6F, 0x79, 0x48, 0x62, 0x34, 0x8E, 0x4F, 0x5B, 0x15, 0xA0, 0x22, 0x67, 0xFF, 0 }, + { 0, 0, 0, 0, 0, 0x3A, 0x5F, 0xCF, 0x23, 0x70, 0x02, 0x5F, 0xBF, 0x7E, 0x23, 0x94, + 0xD0, 0x27, 0x8F, 0x16, 0, 0, 0x04, 0, 0, 0x5F, 0x03 }, + { 0x6A, 0x62, 0x65, 0x90, 0x99, 0 }, + { 0x58, 0x48, 0x49 }, + 0x2A098ACB, 0, + }, + { "720x576Noscale", 720, 576, TVTYPE_PAL, 0, 0, + { 0x04, 0, 0, 0x00, 0, 0, 0x20, 0x75, 0xA5, 0x3A, 0x50, 0, 0x43, 0x2E, 0, 0x09, + 0, 0, 0xE9, 0x19, 0x6E, 0x24, 0xe3, 0x33, 0x89, 0x28, 0xEE, 0x10, 0x0A, 0x80, 0, 0, + 0x13, 0x0C, 0x04, 0x7B, 0x48, 0x64, 0x30, 0x93, 0x49, 0x5F, 0x15, 0xA5, 0x23, 0x77, 0xFF, 0 }, + { 0x00, 0x00, 0x04, 0, 0, 0x45, 0x7F, 0x4b, 0x33, 0x70, 0x02, 0x7F, 0xD0, 0x93, 0x23, 0x89, + 0xC7, 0xF1, 0xBD, 0x06, 0, 0, 0, 0, 0, 0x7F, 0x03 }, + { 0xBA, 0xB8, 0xB8, 0x90, 0x99, 0 }, + { 0x58, 0x48, 0x49 }, + 0x288933E3, 0, + }, + { NULL, 0, 0, 0, 0, 0, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0X78, 0X63, 0X63, 0X9C, 0X68, 0X94, 0X88, 0XF0, 0, 0X60, 0, 0, 0, 0, 0, 0, 0X58, 0, 0X57, 0, 0, 0X57, 0X89, 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 }, - { 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,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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 } - } -}; #endif /* _VIA_VT162X_H_ */ diff --git a/src/via_xvmc.c b/src/via_xvmc.c index 5ba13e1..e1e3f20 100644 --- a/src/via_xvmc.c +++ b/src/via_xvmc.c @@ -83,6 +83,10 @@ typedef struct{ int xvmc_port; ViaXvMCAttrHolder xvAttr; int newAttribute; + + SetPortAttributeFuncPtr SetPortAttribute; + GetPortAttributeFuncPtr GetPortAttribute; + PutImageFuncPtr PutImage; }ViaXvMCXVPriv; @@ -106,8 +110,13 @@ static void ViaXvMCDestroySurface (ScrnInfoPtr pScrn, XvMCSurfacePtr pSurf); static int ViaXvMCCreateSubpicture (ScrnInfoPtr pScrn, XvMCSubpicturePtr pSurf, int *num_priv, long **priv ); static void ViaXvMCDestroySubpicture (ScrnInfoPtr pScrn, XvMCSubpicturePtr pSubp); - - +static int viaXvMCInterceptXvAttribute(ScrnInfoPtr pScrn, Atom attribute, + INT32 value,pointer data); +static int viaXvMCInterceptPutImage(ScrnInfoPtr, short, short, short, short, short, + short, short, short,int, unsigned char*, short, + short, Bool, RegionPtr, pointer); +static int viaXvMCInterceptXvGetAttribute(ScrnInfoPtr pScrn, Atom attribute, + INT32 *value,pointer data); /* * Init and clean up the screen private parts of XvMC. */ @@ -128,7 +137,9 @@ static void initViaXvMC(ViaXvMCPtr vXvMC) } -static void cleanupViaXvMC(ViaXvMCPtr vXvMC) +static void +cleanupViaXvMC(ViaXvMCPtr vXvMC, XF86VideoAdaptorPtr *XvAdaptors, + int XvAdaptorCount) { unsigned i; @@ -306,7 +317,8 @@ static void mpegDisable(VIAPtr pVia,CARD32 val) } -void ViaInitXVMC(ScreenPtr pScreen) +void +ViaInitXVMC(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; VIAPtr pVia = VIAPTR(pScrn); @@ -315,10 +327,21 @@ void ViaInitXVMC(ScreenPtr pScreen) char *bID; drmVersionPtr drmVer; - if (pVia->XvMCEnabled) + pVia->XvMCEnabled = 0; + + if (!(pVia->Chipset == VIA_CLE266) && !(pVia->Chipset == VIA_K8M800)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "[XvMC] Not supported. Only on CLE266 and K8M800.\n"); return; + } - if(!pVia->directRenderingEnabled) { + if (sizeof(unsigned long) == 8) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "[XvMC] XvMC libs are not 64 bit clean. Disabling XvMC.\n"); + return; + } + + if (!pVia->directRenderingEnabled) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "[XvMC] Cannot use XvMC without DRI!\n"); return; @@ -392,30 +415,38 @@ void ViaInitXVMC(ScreenPtr pScreen) saPriv=(ViaXvMCSAreaPriv *) DRIGetSAREAPrivate(pScreen); saPriv->XvMCCtxNoGrabbed = ~0; - XVMC_DECODER_FUTEX(saPriv)->lock = 0; + XVMCLOCKPTR(saPriv,UNICHROME_LOCK_DECODER1)->lock = 0; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[XvMC] Initialized XvMC extension.\n"); pVia->XvMCEnabled = 1; } -void ViaCleanupXVMC(ScreenPtr pScreen) +void ViaCleanupXVMC(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr *XvAdaptors, + int XvAdaptorCount) { - - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; VIAPtr pVia = VIAPTR(pScrn); ViaXvMCPtr vXvMC = &(pVia->xvmc); - + int i,j; + if (pVia->XvMCEnabled) { mpegDisable(pVia,0); drmRmMap(pVia->drmFD,vXvMC->mmioBase); drmRmMap(pVia->drmFD,vXvMC->fbBase); - cleanupViaXvMC(vXvMC); + cleanupViaXvMC(vXvMC, XvAdaptors, XvAdaptorCount); } + for (i=0; i<XvAdaptorCount; ++i) { + for (j=0; j<XvAdaptors[i]->nPorts; ++j) { + viaPortPrivPtr pPriv = XvAdaptors[i]->pPortPrivates[j].ptr; + if (pPriv->xvmc_priv) + xfree(pPriv->xvmc_priv); + } + } pVia->XvMCEnabled = 0; } -int ViaXvMCCreateContext (ScrnInfoPtr pScrn, XvMCContextPtr pContext, - int *num_priv, long **priv ) +static int +ViaXvMCCreateContext (ScrnInfoPtr pScrn, XvMCContextPtr pContext, + int *num_priv, long **priv ) { VIAPtr pVia = VIAPTR(pScrn); ViaXvMCPtr vXvMC = &(pVia->xvmc); @@ -480,7 +511,6 @@ int ViaXvMCCreateContext (ScrnInfoPtr pScrn, XvMCContextPtr pContext, cPriv->drmCtx = contextRec->drmcontext; authenticated = (drmAuthMagic(pVia->drmFD, pContext->flags) == 0); - contextRec->fbBase = (CARD8 *)pVia->FrameBufferBase; /* * Export framebuffer and mmio to non-root clients. @@ -500,8 +530,11 @@ int ViaXvMCCreateContext (ScrnInfoPtr pScrn, XvMCContextPtr pContext, contextRec->pl = VIAXVMC_PL; strncpy (contextRec->busIdString,pDRIInfo->busIdString, 20); contextRec->initAttrs = vx->xvAttr; - contextRec->useAGP = pViaDRI->ringBufActive; + contextRec->useAGP = pViaDRI->ringBufActive && + ((pVia->Chipset == VIA_CLE266) || + (pVia->Chipset == VIA_KM400)); contextRec->authenticated = authenticated; + contextRec->chipId = pVia->ChipId; vXvMC->nContexts++; vXvMC->contexts[ctxNo] = pContext->context_id; vXvMC->cPrivs[ctxNo] = cPriv; @@ -510,8 +543,9 @@ int ViaXvMCCreateContext (ScrnInfoPtr pScrn, XvMCContextPtr pContext, } -int ViaXvMCCreateSurface (ScrnInfoPtr pScrn, XvMCSurfacePtr pSurf, - int *num_priv, long **priv ) +static int +ViaXvMCCreateSurface (ScrnInfoPtr pScrn, XvMCSurfacePtr pSurf, + int *num_priv, long **priv ) { VIAPtr pVia = VIAPTR(pScrn); ViaXvMCPtr vXvMC = &(pVia->xvmc); @@ -530,9 +564,9 @@ int ViaXvMCCreateSurface (ScrnInfoPtr pScrn, XvMCSurfacePtr pSurf, if(!sPriv) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[XvMC] ViaXvMCCreateSurface: Unable to allocate memory!\n"); - *num_priv = 0; - return BadAlloc; + "[XvMC] ViaXvMCCreateSurface: Unable to allocate memory!\n"); + *num_priv = 0; + return BadAlloc; } numBuffers = 1; @@ -564,10 +598,10 @@ int ViaXvMCCreateSurface (ScrnInfoPtr pScrn, XvMCSurfacePtr pSurf, if(!*priv) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[XvMC] ViaXvMCCreateSurface: Unable to allocate memory!\n"); - *num_priv = 0; - xfree(sPriv); - return BadAlloc; + "[XvMC] ViaXvMCCreateSurface: Unable to allocate memory!\n"); + *num_priv = 0; + xfree(sPriv); + return BadAlloc; } for (srfNo = 0; srfNo < VIA_XVMC_MAX_SURFACES; ++srfNo) { @@ -606,8 +640,9 @@ int ViaXvMCCreateSurface (ScrnInfoPtr pScrn, XvMCSurfacePtr pSurf, return Success; } -int ViaXvMCCreateSubpicture (ScrnInfoPtr pScrn, XvMCSubpicturePtr pSubp, - int *num_priv, long **priv ) +static int +ViaXvMCCreateSubpicture (ScrnInfoPtr pScrn, XvMCSubpicturePtr pSubp, + int *num_priv, long **priv ) { VIAPtr pVia = VIAPTR(pScrn); ViaXvMCPtr vXvMC = &(pVia->xvmc); @@ -627,18 +662,18 @@ int ViaXvMCCreateSubpicture (ScrnInfoPtr pScrn, XvMCSubpicturePtr pSubp, if(!sPriv) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[XvMC] ViaXvMCCreateSubpicture: Unable to allocate memory!\n"); - *num_priv = 0; - return BadAlloc; + *num_priv = 0; + return BadAlloc; } *priv = (long *)xcalloc(3,sizeof(long)); if(!*priv) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[XvMC] ViaXvMCCreateSubpicture: Unable to allocate memory!\n"); - *num_priv = 0; - xfree(sPriv); - return BadAlloc; + "[XvMC] ViaXvMCCreateSubpicture: Unable to allocate memory!\n"); + *num_priv = 0; + xfree(sPriv); + return BadAlloc; } *num_priv = 2; @@ -726,7 +761,7 @@ static void ViaXvMCDestroySurface (ScrnInfoPtr pScrn, XvMCSurfacePtr pSurf) DRM_CAS(&(sAPriv->XvMCDisplaying[vx->xvmc_port]), i|VIA_XVMC_VALID,0,__ret); if (!__ret) - viaStopSWOVerlay(pScrn); + ViaOverlayHide(pScrn); } VIAFreeLinear(&(vXvMC->sPrivs[i]->memory_ref)); @@ -820,46 +855,58 @@ static int viaXvMCSetDisplayLock(ScrnInfoPtr pScrn, ViaXvMCXVPriv *vx) return 0; } -int viaXvMCInitXv(ScrnInfoPtr pScrn, pointer data) + +int viaXvMCInitXv(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr XvAdapt) { - viaPortPrivPtr pPriv = (viaPortPrivPtr) data; + viaPortPrivPtr pPriv; ViaXvMCXVPriv *vx; - unsigned i; - + unsigned i,j; - if (NULL == (pPriv->xvmc_priv = xcalloc(1,sizeof(ViaXvMCXVPriv)))) { - return BadAlloc; - } - - for (i=0; i < VIA_NUM_XVMC_ATTRIBUTES; ++i) { - attrAtoms[i] = MAKE_ATOM(attrXvMC[i]); - } + for (j=0; j < XvAdapt->nPorts; ++j) { + pPriv= (viaPortPrivPtr) XvAdapt->pPortPrivates[j].ptr; + + if (NULL == (pPriv->xvmc_priv = xcalloc(1,sizeof(ViaXvMCXVPriv)))) { + return BadAlloc; + } - vx = (ViaXvMCXVPriv *) pPriv->xvmc_priv; + for (i=0; i < VIA_NUM_XVMC_ATTRIBUTES; ++i) { + attrAtoms[i] = MAKE_ATOM(attrXvMC[i]); + } - vx->ctxDisplaying = 0; - vx->xvAttr.numAttr = VIA_NUM_XVMC_ATTRIBUTES; - vx->xvmc_port = -1; - vx->newAttribute = 1; + vx = (ViaXvMCXVPriv *) pPriv->xvmc_priv; - for (i = 0; i < VIA_NUM_XVMC_ATTRIBUTES; ++i) { - vx->xvAttr.attributes[i].attribute = attrAtoms[i]; - vx->xvAttr.attributes[i].value = 0; - viaGetPortAttributeG( pScrn, attrAtoms[i] , - &(vx->xvAttr.attributes[i].value), data); - } + vx->ctxDisplaying = 0; + vx->xvAttr.numAttr = VIA_NUM_XVMC_ATTRIBUTES; + vx->xvmc_port = -1; + vx->newAttribute = 1; + + /* set up wrappers */ + vx->GetPortAttribute = XvAdapt->GetPortAttribute; + vx->SetPortAttribute = XvAdapt->SetPortAttribute; + vx->PutImage = XvAdapt->PutImage; + + XvAdapt->GetPortAttribute = viaXvMCInterceptXvGetAttribute; + XvAdapt->SetPortAttribute = viaXvMCInterceptXvAttribute; + XvAdapt->PutImage = viaXvMCInterceptPutImage; + + for (i = 0; i < VIA_NUM_XVMC_ATTRIBUTES; ++i) { + vx->xvAttr.attributes[i].attribute = attrAtoms[i]; + vx->xvAttr.attributes[i].value = 0; + vx->GetPortAttribute( pScrn, attrAtoms[i] , + &(vx->xvAttr.attributes[i].value), pPriv); + } + } return Success; } -int viaXvMCInterceptXvAttribute(ScrnInfoPtr pScrn, Atom attribute, - INT32 value,pointer data) +static int +viaXvMCInterceptXvAttribute(ScrnInfoPtr pScrn, Atom attribute, + INT32 value,pointer data) { unsigned i; - viaPortPrivPtr pPriv = (viaPortPrivPtr) data; ViaXvMCXVPriv *vx = (ViaXvMCXVPriv *) pPriv->xvmc_priv; - VIAPtr pVia = VIAPTR(pScrn); - if (pVia->XvMCEnabled) { + if (VIAPTR(pScrn)->XvMCEnabled) { for (i=0; i< vx->xvAttr.numAttr; ++i) { if (vx->xvAttr.attributes[i].attribute == attribute) { vx->xvAttr.attributes[i].value = value; @@ -871,18 +918,18 @@ int viaXvMCInterceptXvAttribute(ScrnInfoPtr pScrn, Atom attribute, } } } - return viaSetPortAttributeG( pScrn, attribute, value, data); + return vx->SetPortAttribute(pScrn, attribute, value, data); } -int viaXvMCInterceptXvGetAttribute(ScrnInfoPtr pScrn, Atom attribute, +static int +viaXvMCInterceptXvGetAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 *value,pointer data) { unsigned i; - viaPortPrivPtr pPriv = (viaPortPrivPtr) data; ViaXvMCXVPriv *vx = (ViaXvMCXVPriv *) pPriv->xvmc_priv; - VIAPtr pVia = VIAPTR(pScrn); - if (pVia->XvMCEnabled) { + + if (VIAPTR(pScrn)->XvMCEnabled) { for (i=0; i< vx->xvAttr.numAttr; ++i) { if (vx->xvAttr.attributes[i].attribute == attribute) { *value = vx->xvAttr.attributes[i].value; @@ -890,59 +937,58 @@ int viaXvMCInterceptXvGetAttribute(ScrnInfoPtr pScrn, Atom attribute, } } } - return viaGetPortAttributeG( pScrn, attribute, value, data); + + return vx->GetPortAttribute( pScrn, attribute, value, data); } static int viaXvMCDisplayAttributes(ScrnInfoPtr pScrn, - const ViaXvMCAttrHolder *ah, pointer data) + const ViaXvMCAttrHolder *ah, viaPortPrivPtr pPriv) { - + ViaXvMCXVPriv *vx = (ViaXvMCXVPriv *) pPriv->xvmc_priv; unsigned i; int ret; for (i=0; i< ah->numAttr; ++i) { - ret = viaSetPortAttributeG( pScrn, ah->attributes[i].attribute, - ah->attributes[i].value, data); + ret = vx->SetPortAttribute(pScrn, ah->attributes[i].attribute, + ah->attributes[i].value, pPriv); if (ret) return ret; } return Success; } -int viaXvMCInterceptPutImage( ScrnInfoPtr pScrn,short src_x, short src_y, - short drw_x, short drw_y, short src_w, - short src_h,short drw_w, short drw_h, - int id, unsigned char* buf, short width, - short height, Bool sync, RegionPtr clipBoxes, - pointer data) -{ - ViaXvMCCommandBuffer *vXvMCData; +static int +viaXvMCInterceptPutImage( ScrnInfoPtr pScrn,short src_x, short src_y, + short drw_x, short drw_y, short src_w, + short src_h,short drw_w, short drw_h, + int id, unsigned char* buf, short width, + short height, Bool sync, RegionPtr clipBoxes, + pointer data) +{ viaPortPrivPtr pPriv = (viaPortPrivPtr) data; ViaXvMCXVPriv *vx = (ViaXvMCXVPriv *) pPriv->xvmc_priv; - VIAPtr pVia = VIAPTR(pScrn); - if (pVia->XvMCEnabled) { - if (FOURCC_VIA == id) { + + if (VIAPTR(pScrn)->XvMCEnabled) { + if (FOURCC_XVMC == id) { volatile ViaXvMCSAreaPriv *sAPriv; - vXvMCData = (ViaXvMCCommandBuffer *) buf; + ViaXvMCCommandBuffer *vXvMCData = (ViaXvMCCommandBuffer *) buf; sAPriv=(ViaXvMCSAreaPriv*) DRIGetSAREAPrivate(pScrn->pScreen); + switch(vXvMCData->command) { case VIA_XVMC_COMMAND_ATTRIBUTES: - if ((vXvMCData->ctxNo | VIA_XVMC_VALID) != vx->ctxDisplaying) { + if ((vXvMCData->ctxNo | VIA_XVMC_VALID) != vx->ctxDisplaying) return 1; - } else { - viaXvMCDisplayAttributes( pScrn, &vXvMCData->attrib, data); - return 0; - } - break; + viaXvMCDisplayAttributes( pScrn, &vXvMCData->attrib, pPriv); + return 0; case VIA_XVMC_COMMAND_FDISPLAY: if (sAPriv->XvMCDisplaying[vx->xvmc_port] != vXvMCData->srfNo) return 1; - viaXvMCDisplayAttributes( pScrn, &vXvMCData->attrib, data); + viaXvMCDisplayAttributes( pScrn, &vXvMCData->attrib, pPriv); vx->ctxDisplaying = vXvMCData->ctxNo; break; case VIA_XVMC_COMMAND_DISPLAY: if ((vXvMCData->ctxNo | VIA_XVMC_VALID) != vx->ctxDisplaying) { - viaXvMCDisplayAttributes( pScrn, &vXvMCData->attrib, data); + viaXvMCDisplayAttributes( pScrn, &vXvMCData->attrib, pPriv); } if (sAPriv->XvMCDisplaying[vx->xvmc_port] != vXvMCData->srfNo) return 1; vx->ctxDisplaying = vXvMCData->ctxNo; @@ -953,32 +999,33 @@ int viaXvMCInterceptPutImage( ScrnInfoPtr pScrn,short src_x, short src_y, DRM_CAS(&(sAPriv->XvMCDisplaying[vx->xvmc_port]), vXvMCData->srfNo, 0,__ret); if (!__ret) - viaStopSWOVerlay(pScrn); + ViaOverlayHide(pScrn); } return Success; - break; default: break; } } else { if ((VIA_XVMC_MAX_CONTEXTS | VIA_XVMC_VALID) != vx->ctxDisplaying) { - viaXvMCDisplayAttributes( pScrn, &vx->xvAttr, data); + viaXvMCDisplayAttributes( pScrn, &vx->xvAttr, pPriv); vx->ctxDisplaying = VIA_XVMC_MAX_CONTEXTS | VIA_XVMC_VALID; } else if (vx->newAttribute) { vx->newAttribute = 0; - viaXvMCDisplayAttributes( pScrn, &vx->xvAttr, data); + viaXvMCDisplayAttributes( pScrn, &vx->xvAttr, pPriv); } viaXvMCSetDisplayLock( pScrn, vx ); } } - return viaPutImageG( pScrn, src_x, src_y, drw_x, drw_y, src_w, src_h, - drw_w, drw_h, id, buf, width, height, sync, - clipBoxes, data); + return vx->PutImage(pScrn, src_x, src_y, drw_x, drw_y, src_w, src_h, + drw_w, drw_h, id, buf, width, height, sync, + clipBoxes, data); } unsigned long viaXvMCPutImageSize(ScrnInfoPtr pScrn) { - return sizeof(ViaXvMCCommandBuffer); + if (VIAPTR(pScrn)->XvMCEnabled) + return sizeof(ViaXvMCCommandBuffer); + return 0; } #endif diff --git a/src/via_xvmc.h b/src/via_xvmc.h index b47dc72..6a475dc 100644 --- a/src/via_xvmc.h +++ b/src/via_xvmc.h @@ -26,7 +26,7 @@ #ifndef _VIA_XVMC_H #define _VIA_XVMC_H 1 -#include "via_dri.h" +#include "via_drm.h" /* * This file contains the common definitions between the XvMC lib and the @@ -34,10 +34,9 @@ * structure change is reflected also in a change in minor version number!! */ -#define DRM_VIA_DEC_FUTEX 5 #define VIAXVMC_MAJOR 0 -#define VIAXVMC_MINOR 7 +#define VIAXVMC_MINOR 9 #define VIAXVMC_PL 0 #define VIA_NUM_XVMC_ATTRIBUTES 6 #define VIA_XVMC_VALID 0x80000000 @@ -85,7 +84,6 @@ typedef struct { unsigned ctxNo; unsigned xvmc_port; drm_context_t drmcontext; - CARD8 *fbBase; unsigned int fbOffset; unsigned int fbSize; unsigned int mmioOffset; @@ -97,6 +95,7 @@ typedef struct { ViaXvMCAttrHolder initAttrs; int useAGP; int authenticated; + unsigned chipId; unsigned pad; } ViaXvMCCreateContextRec; diff --git a/src/via_xvpriv.h b/src/via_xvpriv.h index 2dc17c4..b692e91 100644 --- a/src/via_xvpriv.h +++ b/src/via_xvpriv.h @@ -16,9 +16,9 @@ * 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 + * 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. */ @@ -27,12 +27,16 @@ #include "xf86xv.h" -#define XV_PORT_SWOV 0 -#define XV_PORT_DUMMY 1 -#define XV_PORT_NUM 2 + +enum{ XV_ADAPT_SWOV=0, + XV_ADAPT_NUM}; + +#define VIA_MAX_XV_PORTS 1 typedef struct { + unsigned char xv_adaptor; unsigned char xv_portnum; + int adaptor; int brightness; int saturation; int contrast; @@ -41,9 +45,7 @@ typedef struct { CARD32 colorKey; Bool autoPaint; - /* Surface structure */ - DDSURFACEDESC SurfaceDesc; - DDLOCK ddLock; + CARD32 FourCC; /* from old SurfaceDesc -- passed down from viaPutImageG */ /* store old video source & dst data */ short old_src_x; @@ -60,4 +62,8 @@ typedef struct { } viaPortPrivRec, *viaPortPrivPtr; +extern viaPortPrivPtr viaPortPriv[]; +extern unsigned viaNumXvPorts; + + #endif /* _VIA_XVPRIV_H_ */ diff --git a/src/xvmc/viaLowLevel.h b/src/xvmc/viaLowLevel.h index 8f3ffdf..ea8f30d 100644 --- a/src/xvmc/viaLowLevel.h +++ b/src/xvmc/viaLowLevel.h @@ -24,14 +24,14 @@ /* - * Authors: Thomas Hellström 2004. + * Authors: Thomas Hellstrom 2004 - 2005. */ #ifndef VIA_LOWLEVEL_H #define VIA_LOWLEVEL_H -#define LL_AGP_CMDBUF_SIZE (4096*32) +#define LL_AGP_CMDBUF_SIZE (4096*3) #define LL_PCI_CMDBUF_SIZE (4096) #define LL_MODE_DECODER_SLICE 0x01 @@ -59,6 +59,8 @@ #define VIA_SLICEIDLEVAL 0x00000200 #define VIA_IDLEVAL 0x00000204 +#include "via_drm.h" + typedef struct{ CARD32 agp_buffer[LL_AGP_CMDBUF_SIZE]; CARD32 pci_buffer[LL_PCI_CMDBUF_SIZE]; @@ -70,18 +72,30 @@ typedef struct{ drm_context_t *drmcontext; drmLockPtr hwLock; drmAddress mmioAddress; + drmAddress fbAddress; unsigned curWaitFlags; int performLocking; unsigned errors; + drm_via_mem_t tsMem; + CARD32 tsOffset; + volatile CARD32 *tsP; + CARD32 curTimeStamp; + CARD32 lastReadTimeStamp; + int agpSync; + CARD32 agpSyncTimeStamp; }XvMCLowLevel; -extern void initXvMCLowLevel(XvMCLowLevel *xl, int fd, drm_context_t *ctx, +extern int initXvMCLowLevel(XvMCLowLevel *xl, int fd, drm_context_t *ctx, drmLockPtr hwLock, drmAddress mmioAddress, - int useAgp); + drmAddress fbAddress,int useAgp); -void setLowLevelLocking(XvMCLowLevel *xl, int perFormLocking); +extern void setLowLevelLocking(XvMCLowLevel *xl, int perFormLocking); extern void closeXvMCLowLevel(XvMCLowLevel *xl); +extern void flushPCIXvMCLowLevel(XvMCLowLevel *xl); +extern CARD32 viaDMATimeStampLowLevel(XvMCLowLevel *xl); +extern void setAGPSyncLowLevel(XvMCLowLevel *xl, int val, CARD32 timeStamp); + /* * These two functions also return and clear the current error status. @@ -89,18 +103,18 @@ extern void closeXvMCLowLevel(XvMCLowLevel *xl); extern unsigned flushXvMCLowLevel(XvMCLowLevel *xl); extern unsigned syncXvMCLowLevel(XvMCLowLevel *xl, unsigned int mode, - unsigned int sleep); + unsigned int doSleep, CARD32 timeStamp); extern void hwlUnlock(XvMCLowLevel *xl, int videoLock); extern void hwlLock(XvMCLowLevel *xl, int videoLock); #define LL_HW_LOCK(xl) \ - do { \ + do { \ DRM_LOCK((xl)->fd,(xl)->hwLock,*(xl)->drmcontext,0); } while(0); #define LL_HW_UNLOCK(xl) \ do {DRM_UNLOCK((xl)->fd,(xl)->hwLock,*(xl)->drmcontext); \ - } while(0); + } while(0); #endif diff --git a/src/xvmc/viaXvMC.c b/src/xvmc/viaXvMC.c index c3cec8b..37f304c 100644 --- a/src/xvmc/viaXvMC.c +++ b/src/xvmc/viaXvMC.c @@ -1,7 +1,7 @@ /***************************************************************************** * VIA Unichrome XvMC extension client lib. * - * Copyright (c) 2004 The Unichrome Project. All rights reserved. + * Copyright (c) 2004 Thomas Hellström. 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"), @@ -24,12 +24,18 @@ /* - *Author: Thomas Hellström, 2004. + *Author: Thomas Hellstrom, 2004 - 2005. *Change: 0.9.3, Bugfix by Pascal Brisset. *Change: 0.10.1, Support for interlaced streams Thanks to Pascal Brisset. */ -#undef WAITPAUSE +/* + * For correct size of atom. + */ + +#ifdef __amd64__ +#define _XSERVER64 +#endif #include "viaXvMCPriv.h" #include "viaLowLevel.h" @@ -53,7 +59,9 @@ static int error_base; static int event_base; -#define FOURCC_VIA 0x4E4B4C57 +#define FOURCC_XVMC (('C' << 24) + ('M' << 16) + ('V' << 8) + 'X') +#define XVMC_DECODER_FUTEX(sAPriv) \ + XVMCLOCKPTR(sAPriv, UNICHROME_LOCK_DECODER1) static unsigned yOffs (ViaXvMCSurface *srf) { @@ -91,38 +99,19 @@ static void defaultQMatrices(ViaXvMCContext *ctx) ctx->nonIntraLoaded = 0; } - static void releaseDecoder(ViaXvMCContext *ctx,int clearCtx) { volatile ViaXvMCSAreaPriv *sAPriv; sAPriv = SAREAPTR(ctx); - - if ((XVMC_DECODER_FUTEX(sAPriv)->lock & ~DRM_LOCK_CONT) == - (ctx->drmcontext | DRM_LOCK_HELD)) { - DRM_CAS_RESULT(__ret); - - if (clearCtx) - sAPriv->XvMCCtxNoGrabbed = ~0; - - DRM_CAS( XVMC_DECODER_FUTEX(sAPriv), ctx->drmcontext | 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(ctx->fd, DRM_VIA_DEC_FUTEX, &fx, sizeof(fx)); - } - } - + UNICHROME_UNLOCK(ctx->fd, UNICHROME_LOCK_DECODER1, sAPriv, ctx->drmcontext); } static int grabDecoder( ViaXvMCContext *ctx, int *hadLastLock) { volatile ViaXvMCSAreaPriv *sAPriv = SAREAPTR(ctx); - int retFtx; + int retFtx, lc; /* * Try to grab the decoder. If it is not available we will sleep until @@ -131,87 +120,19 @@ static int grabDecoder( ViaXvMCContext *ctx, int *hadLastLock) * available, the lock should be reasonably fast. */ - - if (ctx->haveDecoder) return 0; - - while(1) { - DRM_CAS_RESULT(__ret); - DRM_CAS( XVMC_DECODER_FUTEX(sAPriv), 0, - ctx->drmcontext | DRM_LOCK_HELD,__ret); - - if (__ret) { - - drm_via_futex_t fx; - int lockVal; - - /* - * The decoder is locked. Try to - * mark the lock as contended and go to - * sleep. - */ - - lockVal = XVMC_DECODER_FUTEX(sAPriv)->lock; - - if (!(lockVal & DRM_LOCK_HELD)) continue; - if ((lockVal & ~(DRM_LOCK_HELD | DRM_LOCK_CONT)) == - ctx->drmcontext) { - *hadLastLock = 1; - return 0; - } - fx.val = lockVal | DRM_LOCK_CONT; - DRM_CAS( XVMC_DECODER_FUTEX(sAPriv), lockVal, fx.val , __ret); - lockVal = XVMC_DECODER_FUTEX(sAPriv)->lock; - - if (__ret) continue; - - fx.func = VIA_FUTEX_WAIT; - fx.lock = 0; - fx.ms = 10; - pthread_mutex_unlock( &ctx->ctxMutex ); - if (0 != (retFtx = - drmCommandWrite(ctx->fd,DRM_VIA_DEC_FUTEX, &fx, - sizeof(fx)))) { - switch(retFtx) { - case -EBUSY: - return 1; - case -EINVAL: - { - /* - * DRM does not support the futex IOCTL. Sleep. - */ - - struct timespec - sleep,rem; - - sleep.tv_nsec = 1; - sleep.tv_sec = 0; - nanosleep(&sleep,&rem); - break; - } - default: - break; - } - } - pthread_mutex_lock( &ctx->ctxMutex ); - } else { - - /* - * The decoder is available. Mark it as used, check if we were - * the one who had it locked last time and return. - */ - - *hadLastLock = (sAPriv->XvMCCtxNoGrabbed == ctx->drmcontext); - sAPriv->XvMCCtxNoGrabbed = ctx->drmcontext; - return 0; - } + if (ctx->haveDecoder) { + flushXvMCLowLevel(&ctx->xl); /* Ignore errors here. */ + fprintf(stderr,"libviaXvMC: ERROR: Player forgot to call XvMCFlushSurface()\n"); + *hadLastLock = 1; + return 0; } + UNICHROME_LOCK(ctx->fd, UNICHROME_LOCK_DECODER1, sAPriv, ctx->drmcontext, lc, + retFtx); + *hadLastLock = (ctx->drmcontext == lc); - /* - * We should never get here. - */ - - return 0; + return retFtx; } + static void setupAttribDesc(Display *display, XvPortID port, const ViaXvMCAttrHolder *attrib, @@ -253,7 +174,37 @@ static void releaseAttribDesc(int numAttr, XvAttribute attribDesc[]) } } - +static Status releaseContextResources(Display *display, XvMCContext *context, + int freePrivate, Status errType) +{ + ViaXvMCContext *pViaXvMC = (ViaXvMCContext *) context->privData; + + switch(pViaXvMC->resources) { + case context_lowLevel: + closeXvMCLowLevel(&pViaXvMC->xl); + case context_mutex: + pthread_mutex_destroy(&pViaXvMC->ctxMutex); + case context_sAreaMap: + drmUnmap(pViaXvMC->sAreaAddress,pViaXvMC->sAreaSize); + case context_fbMap: + drmUnmap(pViaXvMC->fbAddress,pViaXvMC->fbSize); + case context_mmioMap: + drmUnmap(pViaXvMC->mmioAddress,pViaXvMC->mmioSize); + case context_context: + XLockDisplay(display); + _xvmc_destroy_context(display, context); + XUnlockDisplay(display); + case context_fd: + if (pViaXvMC->fd >= 0) + drmClose(pViaXvMC->fd); + pViaXvMC->fd = -1; + if (!freePrivate) break; + default: + free(pViaXvMC); + } + return errType; +} + Status XvMCCreateContext(Display *display, XvPortID port, int surface_type_id, int width, int height, int flags, @@ -306,6 +257,7 @@ Status XvMCCreateContext(Display *display, XvPortID port, } pViaXvMC = (ViaXvMCContext *)context->privData; + pViaXvMC->resources = context_none; /* Verify the XvMC extension exists */ @@ -332,8 +284,7 @@ Status XvMCCreateContext(Display *display, XvPortID port, if(! drmAvailable()) { fprintf(stderr,"Direct Rendering is not avilable on this system!\n"); - free(pViaXvMC); - return BadAlloc; + return releaseContextResources(display, context, 1, BadAlloc); } /* @@ -348,13 +299,14 @@ Status XvMCCreateContext(Display *display, XvPortID port, if (strcmp(curBusID,"NOBUSID")) { if((pViaXvMC->fd = drmOpen("via",curBusID)) < 0) { fprintf(stderr,"DRM Device for via could not be opened.\n"); - goto err2; + return releaseContextResources(display, context, 1, BadAlloc); } + pViaXvMC->resources = context_fd; if (NULL == (drmVer = drmGetVersion(pViaXvMC->fd))) { fprintf(stderr, "viaXvMC: Could not get drm version."); - goto err2; + return releaseContextResources(display, context, 1, BadAlloc); } if (((drmVer->version_major != 2 ) || (drmVer->version_minor < 0))) { fprintf(stderr, @@ -366,8 +318,9 @@ Status XvMCCreateContext(Display *display, XvPortID port, drmVer->version_major,drmVer->version_minor, drmVer->version_patchlevel); drmFreeVersion(drmVer); - goto err2; + return releaseContextResources(display, context, 1, BadAlloc); } + drmFreeVersion(drmVer); drmGetMagic(pViaXvMC->fd,&magic); } else { magic = 0; @@ -384,7 +337,7 @@ Status XvMCCreateContext(Display *display, XvPortID port, &priv_data))) { XUnlockDisplay(display); fprintf(stderr,"Unable to create XvMC Context.\n"); - goto err2; + return releaseContextResources(display, context, 1, BadAlloc); } XUnlockDisplay(display); @@ -394,8 +347,9 @@ Status XvMCCreateContext(Display *display, XvPortID port, fprintf(stderr,"\tExpected %d, got %d\n", (sizeof(ViaXvMCCreateContextRec) >> 2), priv_count); - goto err1; + return releaseContextResources(display, context, 1, BadAlloc); } + pViaXvMC->resources = context_context; tmpComm = ( ViaXvMCCreateContextRec *) priv_data; @@ -403,39 +357,26 @@ Status XvMCCreateContext(Display *display, XvPortID port, (tmpComm->minor != VIAXVMC_MINOR)) { fprintf(stderr,"Version mismatch between the XFree86 via driver\n" "and the XvMC library. Cannot continue!\n"); - goto err1; + return releaseContextResources(display, context, 1, BadAlloc); } if (strncmp(curBusID, tmpComm->busIdString, 20)) { - XLockDisplay(display); - _xvmc_destroy_context(display, context); - XUnlockDisplay(display); - if (pViaXvMC->fd >= 0) - drmClose(pViaXvMC->fd); - pViaXvMC->fd = -1; + releaseContextResources(display, context, 0, Success); + pViaXvMC->resources = context_none; strncpy(curBusID, tmpComm->busIdString, 20); + XFree(priv_data); continue; } - if (!tmpComm->authenticated) goto err1; - - continue; - - err1: - XLockDisplay(display); - _xvmc_destroy_context(display, context); - XUnlockDisplay(display); - err2: - if (pViaXvMC->fd >= 0) - drmClose(pViaXvMC->fd); - free(pViaXvMC); - return BadAlloc; - + if (!tmpComm->authenticated) { + XFree(priv_data); + return releaseContextResources(display, context, 1, BadAlloc); + } + } while (pViaXvMC->fd < 0); pViaXvMC->ctxNo = tmpComm->ctxNo; pViaXvMC->drmcontext = tmpComm->drmcontext; - pViaXvMC->fb_base = tmpComm->fbBase; pViaXvMC->fbOffset = tmpComm->fbOffset; pViaXvMC->fbSize = tmpComm->fbSize; pViaXvMC->mmioOffset = tmpComm->mmioOffset; @@ -449,8 +390,8 @@ Status XvMCCreateContext(Display *display, XvPortID port, for (i=0; i<VIA_MAX_RENDSURF; ++i) { pViaXvMC->rendSurf[i] = 0; } - strncpy(pViaXvMC->busIdString,tmpComm->busIdString,9); - pViaXvMC->busIdString[9] = '\0'; + strncpy(pViaXvMC->busIdString,tmpComm->busIdString,20); + pViaXvMC->busIdString[20] = '\0'; pViaXvMC->attrib = tmpComm->initAttrs; pViaXvMC->lastSrfDisplaying = ~0; setupAttribDesc(display, port, &pViaXvMC->attrib, pViaXvMC->attribDesc); @@ -468,12 +409,9 @@ Status XvMCCreateContext(Display *display, XvPortID port, if(drmMap(pViaXvMC->fd,pViaXvMC->mmioOffset, pViaXvMC->mmioSize,&(pViaXvMC->mmioAddress)) < 0) { fprintf(stderr,"Unable to map the display chip mmio registers.\n"); - XLockDisplay(display); - _xvmc_destroy_context(display, context); - XUnlockDisplay(display); - free(pViaXvMC); - return BadAlloc; + return releaseContextResources(display, context, 1, BadAlloc); } + pViaXvMC->resources = context_mmioMap; /* * Map Framebuffer memory @@ -482,12 +420,10 @@ Status XvMCCreateContext(Display *display, XvPortID port, if(drmMap(pViaXvMC->fd,pViaXvMC->fbOffset, pViaXvMC->fbSize,&(pViaXvMC->fbAddress)) < 0) { fprintf(stderr,"Unable to map XvMC Framebuffer.\n"); - XLockDisplay(display); - _xvmc_destroy_context(display, context); - XUnlockDisplay(display); - free(pViaXvMC); - return BadAlloc; + return releaseContextResources(display, context, 1, BadAlloc); } + pViaXvMC->resources = context_fbMap; + /* * Map XvMC Sarea and get the address of the HW lock. @@ -496,33 +432,38 @@ Status XvMCCreateContext(Display *display, XvPortID port, if(drmMap(pViaXvMC->fd,pViaXvMC->sAreaOffset, pViaXvMC->sAreaSize,&(pViaXvMC->sAreaAddress)) < 0) { fprintf(stderr,"Unable to map DRI SAREA.\n"); - XLockDisplay(display); - _xvmc_destroy_context(display, context); - XUnlockDisplay(display); - free(pViaXvMC); - return BadAlloc; + return releaseContextResources(display, context, 1, BadAlloc); } - pViaXvMC->hwLock = (drmLockPtr) pViaXvMC->sAreaAddress; + pViaXvMC->resources = context_sAreaMap; + + pViaXvMC->hwLock = (drmLockPtr) pViaXvMC->sAreaAddress; defaultQMatrices(pViaXvMC); pViaXvMC->chromaIntraLoaded = 1; pViaXvMC->chromaNonIntraLoaded = 1; pViaXvMC->yStride = (width + 31) & ~31; pViaXvMC->haveDecoder = 0; - pViaXvMC->decTimeOut = 0; pViaXvMC->attribChanged = 1; pViaXvMC->haveXv = 0; pViaXvMC->port = context->port; - initXvMCLowLevel(&pViaXvMC->xl, pViaXvMC->fd, &pViaXvMC->drmcontext, - pViaXvMC->hwLock, pViaXvMC->mmioAddress, pViaXvMC->useAGP); - + pthread_mutex_init(&pViaXvMC->ctxMutex,NULL); + pViaXvMC->resources = context_mutex; + pViaXvMC->timeStamp = 0; + + if (initXvMCLowLevel(&pViaXvMC->xl, pViaXvMC->fd, &pViaXvMC->drmcontext, + pViaXvMC->hwLock, pViaXvMC->mmioAddress, + pViaXvMC->fbAddress, pViaXvMC->useAGP)) { + fprintf(stderr,"ViaXvMC: Could not allocate timestamp blit area\n"); + return releaseContextResources(display, context, 1, BadAlloc); + } + pViaXvMC->resources = context_lowLevel; + setAGPSyncLowLevel(&pViaXvMC->xl, 1, 0); hwlLock(&pViaXvMC->xl,1); setLowLevelLocking(&pViaXvMC->xl,0); viaVideoSubPictureOffLocked(&pViaXvMC->xl); flushXvMCLowLevel(&pViaXvMC->xl); /* Ignore errors here. */ setLowLevelLocking(&pViaXvMC->xl,1); hwlUnlock(&pViaXvMC->xl,1); - pthread_mutex_init(&pViaXvMC->ctxMutex,NULL); return Success; } @@ -545,28 +486,9 @@ Status XvMCDestroyContext(Display *display, XvMCContext *context) * before XvMCDestroyContext, the X server will take care of this. */ - pthread_mutex_lock(&pViaXvMC->ctxMutex); - closeXvMCLowLevel(&pViaXvMC->xl); releaseAttribDesc(pViaXvMC->attrib.numAttr,pViaXvMC->attribDesc); releaseDecoder(pViaXvMC,1); - - drmUnmap(pViaXvMC->sAreaAddress,pViaXvMC->sAreaSize); - drmUnmap(pViaXvMC->fbAddress,pViaXvMC->fbSize); - drmUnmap(pViaXvMC->mmioAddress,pViaXvMC->mmioSize); - - XLockDisplay(display); - _xvmc_destroy_context(display, context); - XUnlockDisplay(display); - - - if (pViaXvMC->haveXv) { - XFree(pViaXvMC->xvImage); - } - pthread_mutex_destroy(&pViaXvMC->ctxMutex); - drmClose(pViaXvMC->fd); - free(pViaXvMC); - context->privData = NULL; - return Success; + return releaseContextResources(display, context, 1, Success); } Status XvMCCreateSurface( Display *display, XvMCContext *context, @@ -630,6 +552,7 @@ Status XvMCCreateSurface( Display *display, XvMCContext *context, pViaSurface->yStride = pViaXvMC->yStride; pViaSurface->privContext = pViaXvMC; pViaSurface->privSubPic = NULL; + pViaSurface->needsSync = 0; pthread_mutex_unlock( &pViaXvMC->ctxMutex ); return Success; } @@ -675,16 +598,8 @@ Status XvMCPutSlice2(Display *display,XvMCContext *context, char *slice, return BadAlloc; } - if (pViaXvMC->decTimeOut) { - pthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return BadValue; - } - viaMpegWriteSlice(&pViaXvMC->xl, (CARD8 *)slice, nBytes, sCode); - if (flushXvMCLowLevel(&pViaXvMC->xl)) { - pthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return BadValue; - } + flushPCIXvMCLowLevel(&pViaXvMC->xl); pthread_mutex_unlock( &pViaXvMC->ctxMutex ); return Success; } @@ -708,16 +623,8 @@ Status XvMCPutSlice(Display *display,XvMCContext *context, char *slice, return BadAlloc; } - if (pViaXvMC->decTimeOut) { - pthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return BadValue; - } - viaMpegWriteSlice(&pViaXvMC->xl, (CARD8 *)slice, nBytes, 0); - if (flushXvMCLowLevel(&pViaXvMC->xl)) { - pthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return BadValue; - } + flushPCIXvMCLowLevel(&pViaXvMC->xl); pthread_mutex_unlock( &pViaXvMC->ctxMutex ); return Success; } @@ -735,7 +642,7 @@ static Status updateXVOverlay(Display *display,ViaXvMCContext *pViaXvMC, if (!pViaXvMC->haveXv) { pViaXvMC->xvImage = - XvCreateImage(display,pViaXvMC->port,FOURCC_VIA, + XvCreateImage(display,pViaXvMC->port,FOURCC_XVMC, (char *)&buf,pViaSurface->width, pViaSurface->height); pViaXvMC->gc = XCreateGC(display,draw,0,0); @@ -818,6 +725,9 @@ Status XvMCPutSurface(Display *display,XvMCSurface *surface,Drawable draw, pViaXvMC->lastSrfDisplaying = pViaSurface->srfNo | VIA_XVMC_VALID; overlayUpdated = 0; + viaVideoSetSWFLipLocked(&pViaXvMC->xl, yOffs(pViaSurface), uOffs(pViaSurface), + vOffs(pViaSurface)); + if (lastSurface != dispSurface) { hwlUnlock(&pViaXvMC->xl,1); @@ -825,6 +735,7 @@ Status XvMCPutSurface(Display *display,XvMCSurface *surface,Drawable draw, * We weren't the last to display. Update the overlay before flipping. */ + flushPCIXvMCLowLevel(&pViaXvMC->xl); ret = updateXVOverlay(display,pViaXvMC,pViaSurface,draw,srcx,srcy,srcw, srch,destx,desty,destw,desth); if (ret) { @@ -869,10 +780,8 @@ Status XvMCPutSurface(Display *display,XvMCSurface *surface,Drawable draw, * Flip */ - viaVideoSWFlipLocked(&pViaXvMC->xl, flags, pViaSurface->progressiveSequence, - yOffs(pViaSurface), uOffs(pViaSurface), - vOffs(pViaSurface)); - ret = flushXvMCLowLevel(&pViaXvMC->xl); + viaVideoSWFlipLocked(&pViaXvMC->xl, flags, pViaSurface->progressiveSequence); + flushPCIXvMCLowLevel(&pViaXvMC->xl); setLowLevelLocking(&pViaXvMC->xl,1); hwlUnlock(&pViaXvMC->xl,1); @@ -902,7 +811,7 @@ Status XvMCBeginSurface(Display *display, ViaXvMCSurface *targS,*futS,*pastS; ViaXvMCContext *pViaXvMC; int hadDecoderLast; - + CARD32 timeStamp; if((display == NULL) || (context == NULL) || (target_surface == NULL)) { return BadValue; @@ -912,34 +821,58 @@ Status XvMCBeginSurface(Display *display, pthread_mutex_lock( &pViaXvMC->ctxMutex ); if (grabDecoder(pViaXvMC, &hadDecoderLast)) { - pthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return BadAlloc; + pthread_mutex_unlock( &pViaXvMC->ctxMutex ); + return BadAlloc; } + pViaXvMC->haveDecoder = 1; - if (!hadDecoderLast) { + /* + * We need to wait for decoder idle at next flush, since hardware doesn't queue + * beginsurface requests until the decoder is idle. This is + * done by waiting on the last previous timestamp, or if there was another context + * having the decoder before us, by emitting a new one. + */ + + if (pViaXvMC->useAGP) { + if (!hadDecoderLast || pViaXvMC->timeStamp == 0) { + timeStamp = viaDMATimeStampLowLevel(&pViaXvMC->xl); + if (flushXvMCLowLevel(&pViaXvMC->xl)) { + releaseDecoder(pViaXvMC, 0); + return BadAlloc; + } + pViaXvMC->timeStamp = timeStamp; + } else { + timeStamp = pViaXvMC->timeStamp; + } + setAGPSyncLowLevel(&pViaXvMC->xl, 1, timeStamp); + } + + if (!hadDecoderLast || !pViaXvMC->decoderOn) { pViaXvMC->intraLoaded = 0; pViaXvMC->nonIntraLoaded = 0; } - pViaXvMC->haveDecoder = 1; + viaMpegReset(&pViaXvMC->xl); targS = (ViaXvMCSurface *)target_surface->privData; futS = NULL; pastS = NULL; + + pViaXvMC->rendSurf[0] = targS->srfNo | VIA_XVMC_VALID; if (future_surface) { futS = (ViaXvMCSurface *)future_surface->privData; + futS->needsSync = 0; } if (past_surface) { pastS = (ViaXvMCSurface *)past_surface->privData; + pastS->needsSync = 0; } + targS->progressiveSequence = (control->flags & XVMC_PROGRESSIVE_SEQUENCE); targS->privSubPic = NULL; - syncXvMCLowLevel(&pViaXvMC->xl, LL_MODE_DECODER_IDLE, 0); - - viaMpegReset(&pViaXvMC->xl); viaMpegSetFB(&pViaXvMC->xl,0,yOffs(targS),uOffs(targS),vOffs(targS)); viaMpegSetSurfaceStride(&pViaXvMC->xl,pViaXvMC); if (past_surface) { @@ -954,11 +887,9 @@ Status XvMCBeginSurface(Display *display, viaMpegSetFB(&pViaXvMC->xl,2,0xffffffff,0xffffffff,0xffffffff); } viaMpegBeginPicture(&pViaXvMC->xl,pViaXvMC,context->width,context->height,control); - if (flushXvMCLowLevel(&pViaXvMC->xl)) { - pthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return BadValue; - } - pViaXvMC->decTimeOut = 0; + flushPCIXvMCLowLevel(&pViaXvMC->xl); + targS->needsSync = 1; + targS->syncMode = LL_MODE_DECODER_IDLE; pViaXvMC->decoderOn = 1; pthread_mutex_unlock( &pViaXvMC->ctxMutex ); return Success; @@ -969,9 +900,7 @@ Status XvMCSyncSurface(Display *display,XvMCSurface *surface) { ViaXvMCSurface *pViaSurface; ViaXvMCContext *pViaXvMC; - volatile ViaXvMCSAreaPriv *sPriv; unsigned i; - int retVal; if((display == NULL) || (surface == NULL)) { return BadValue; @@ -988,38 +917,44 @@ Status XvMCSyncSurface(Display *display,XvMCSurface *surface) } pthread_mutex_lock( &pViaXvMC->ctxMutex ); - if (!pViaXvMC->haveDecoder) { - pthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return Success; - } + if (pViaSurface->needsSync) { + CARD32 timeStamp = pViaSurface->timeStamp; + int syncMode = pViaSurface->syncMode; - retVal = Success; - if (pViaXvMC->rendSurf[0] == (pViaSurface->srfNo | VIA_XVMC_VALID)) { + if (pViaXvMC->useAGP) { - sPriv = SAREAPTR(pViaXvMC); - if (!pViaXvMC->decTimeOut) { - if (syncXvMCLowLevel(&pViaXvMC->xl, LL_MODE_DECODER_IDLE, - 1)) { - retVal = BadValue; - } - } else { - viaMpegReset(&pViaXvMC->xl); - if (!flushXvMCLowLevel(&pViaXvMC->xl)) - pViaXvMC->decTimeOut = 0; - retVal = BadValue; + syncMode = (pViaSurface->syncMode == LL_MODE_2D || + pViaSurface->timeStamp < pViaXvMC->timeStamp) ? + LL_MODE_2D : LL_MODE_DECODER_IDLE; + if (pViaSurface->syncMode != LL_MODE_2D) + timeStamp = pViaXvMC->timeStamp; + + } else if (syncMode != LL_MODE_2D && + pViaXvMC->rendSurf[0] != (pViaSurface->srfNo | VIA_XVMC_VALID)) { + + pViaSurface->needsSync = 0; + pthread_mutex_unlock( &pViaXvMC->ctxMutex ); + return Success; } - hwlLock(&pViaXvMC->xl,0); - pViaXvMC->haveDecoder = 0; - releaseDecoder(pViaXvMC, 0); - hwlUnlock(&pViaXvMC->xl,0); + + if (syncXvMCLowLevel(&pViaXvMC->xl, syncMode, 1, + pViaSurface->timeStamp)) { + pthread_mutex_unlock( &pViaXvMC->ctxMutex ); + return BadValue; + } + pViaSurface->needsSync = 0; + } + + if (pViaXvMC->rendSurf[0] == (pViaSurface->srfNo | VIA_XVMC_VALID)) { + pViaSurface->needsSync = 0; for (i=0; i<VIA_MAX_RENDSURF; ++i) { pViaXvMC->rendSurf[i] = 0; } - } + pthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return retVal; + return Success; } Status XvMCLoadQMatrix(Display *display, XvMCContext *context, @@ -1178,6 +1113,7 @@ Status XvMCCreateSubpicture( Display *display, pViaSubPic->stride = (subpicture->width + 31) & ~31; pViaSubPic->privContext = pViaXvMC; pViaSubPic->ia44 = (xvimage_id == FOURCC_IA44); + pViaSubPic->needsSync = 0; /* Free data returned from _xvmc_create_subpicture */ @@ -1193,7 +1129,6 @@ XvMCSetSubpicturePalette (Display *display, XvMCSubpicture *subpicture, ViaXvMCSubPicture *pViaSubPic; ViaXvMCContext *pViaXvMC; volatile ViaXvMCSAreaPriv *sAPriv; - unsigned ret; unsigned i; CARD32 tmp; @@ -1227,11 +1162,10 @@ XvMCSetSubpicturePalette (Display *display, XvMCSubpicture *subpicture, (pViaSubPic->srfNo | VIA_XVMC_VALID)) { viaVideoSubPictureLocked(&pViaXvMC->xl,pViaSubPic); } - ret = flushXvMCLowLevel(&pViaXvMC->xl); + flushPCIXvMCLowLevel(&pViaXvMC->xl); setLowLevelLocking(&pViaXvMC->xl,1); hwlUnlock(&pViaXvMC->xl,1); pthread_mutex_unlock( &pViaXvMC->ctxMutex ); - if (ret) return BadValue; return Success; } @@ -1309,14 +1243,12 @@ Status XvMCClearSubpicture ( bOffs = pViaSubPic->offset + y*pViaSubPic->stride + x; viaBlit(&pViaXvMC->xl, 8, 0, pViaSubPic->stride, bOffs, pViaSubPic->stride, width, height, 1, 1, VIABLIT_FILL, color); + pViaSubPic->needsSync = 1; + pViaSubPic->timeStamp = viaDMATimeStampLowLevel(&pViaXvMC->xl); if (flushXvMCLowLevel(&pViaXvMC->xl)) { pthread_mutex_unlock( &pViaXvMC->ctxMutex ); return BadValue; } - if (syncXvMCLowLevel(&pViaXvMC->xl, LL_MODE_2D, 0)) { - pthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return BadValue; - } pthread_mutex_unlock( &pViaXvMC->ctxMutex ); return Success; } @@ -1371,6 +1303,14 @@ XvMCCompositeSubpicture ( return Success; } + if (pViaSubPic->needsSync) { + if (syncXvMCLowLevel(&pViaXvMC->xl, LL_MODE_2D, 0, pViaSubPic->timeStamp)) { + pthread_mutex_unlock( &pViaXvMC->ctxMutex ); + return BadValue; + } + pViaSubPic->needsSync = 0; + } + for(i=0; i<height; ++i) { dAddr = (((CARD8 *)pViaXvMC->fbAddress) + (pViaSubPic->offset + (dsty+i)*pViaSubPic->stride + dstx)); @@ -1477,25 +1417,30 @@ XvMCBlendSubpicture2 ( if (width != pViaSurface->width || height != pViaSSurface->height) { return BadMatch; } + + if (XvMCSyncSurface(display,source_surface)) { + return BadValue; + } + pthread_mutex_lock( &pViaXvMC->ctxMutex ); viaBlit(&pViaXvMC->xl, 8, yOffs(pViaSSurface), pViaSSurface->yStride, yOffs(pViaSurface), pViaSurface->yStride, width, height, 1, 1, VIABLIT_COPY, 0); + flushPCIXvMCLowLevel(&pViaXvMC->xl); viaBlit(&pViaXvMC->xl, 8, uOffs(pViaSSurface), pViaSSurface->yStride >> 1, uOffs(pViaSurface), pViaSurface->yStride >> 1, width >> 1, height >> 1, 1, 1, VIABLIT_COPY, 0); + flushPCIXvMCLowLevel(&pViaXvMC->xl); viaBlit(&pViaXvMC->xl, 8, vOffs(pViaSSurface), pViaSSurface->yStride >> 1, vOffs(pViaSurface), pViaSurface->yStride >> 1, width >> 1, height >> 1, 1, 1, VIABLIT_COPY, 0); + pViaSurface->needsSync = 1; + pViaSurface->syncMode = LL_MODE_2D; + pViaSurface->timeStamp = viaDMATimeStampLowLevel(&pViaXvMC->xl); if (flushXvMCLowLevel(&pViaXvMC->xl)) { pthread_mutex_unlock( &pViaXvMC->ctxMutex ); return BadValue; } - if (syncXvMCLowLevel(&pViaXvMC->xl, LL_MODE_2D, 0)) { - pthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return BadValue; - } - if (subpicture) { if(NULL == (pViaSubPic = subpicture->privData)) { @@ -1516,6 +1461,8 @@ Status XvMCSyncSubpicture (Display *display, XvMCSubpicture *subpicture) { ViaXvMCSubPicture *pViaSubPic; + ViaXvMCContext *pViaXvMC; + Status retVal=0; if((display == NULL) || subpicture == NULL){ return BadValue; @@ -1524,7 +1471,17 @@ XvMCSyncSubpicture (Display *display, XvMCSubpicture *subpicture) return (error_base + XvMCBadSubpicture); } - return Success; + pViaXvMC = pViaSubPic->privContext; + pthread_mutex_lock( &pViaXvMC->ctxMutex ); + if (pViaSubPic->needsSync) { + if (syncXvMCLowLevel(&pViaXvMC->xl, LL_MODE_2D, + 0, pViaSubPic->timeStamp)) { + retVal = BadValue; + } + pViaSubPic->needsSync = 0; + } + pthread_mutex_unlock( &pViaXvMC->ctxMutex ); + return retVal; } Status @@ -1567,7 +1524,7 @@ XvMCDestroySubpicture (Display *display, XvMCSubpicture *subpicture) viaVideoSubPictureOffLocked(&pViaXvMC->xl); sAPriv->XvMCSubPicOn[pViaXvMC->xvMCPort] = 0; } - flushXvMCLowLevel(&pViaXvMC->xl); + flushPCIXvMCLowLevel(&pViaXvMC->xl); setLowLevelLocking(&pViaXvMC->xl,1); hwlUnlock(&pViaXvMC->xl,1); @@ -1623,10 +1580,17 @@ XvMCFlushSurface (Display *display, XvMCSurface *surface) pViaXvMC = pViaSurface->privContext; pthread_mutex_lock( &pViaXvMC->ctxMutex ); - - ret = (flushXvMCLowLevel(&pViaXvMC->xl)) ? BadValue : Success; + if (pViaSurface->needsSync) + pViaSurface->timeStamp = pViaXvMC->timeStamp = + viaDMATimeStampLowLevel(&pViaXvMC->xl); + ret = (flushXvMCLowLevel(&pViaXvMC->xl)) ? BadValue : Success; + if (pViaXvMC->rendSurf[0] == (pViaSurface->srfNo | VIA_XVMC_VALID)) { + hwlLock(&pViaXvMC->xl,0); + pViaXvMC->haveDecoder = 0; + releaseDecoder(pViaXvMC, 0); + hwlUnlock(&pViaXvMC->xl,0); + } pthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return ret; } @@ -1835,7 +1799,7 @@ Status XvMCHideSurface(Display *display,XvMCSurface *surface) viaVideoSubPictureOffLocked(&pViaXvMC->xl); } } - flushXvMCLowLevel(&pViaXvMC->xl); + flushPCIXvMCLowLevel(&pViaXvMC->xl); setLowLevelLocking(&pViaXvMC->xl,1); hwlUnlock(&pViaXvMC->xl,1); diff --git a/src/xvmc/viaXvMCPriv.h b/src/xvmc/viaXvMCPriv.h index fb99111..3197679 100644 --- a/src/xvmc/viaXvMCPriv.h +++ b/src/xvmc/viaXvMCPriv.h @@ -55,12 +55,21 @@ extern Status _xvmc_destroy_subpicture(Display *dpy, that can answer RENDERING to a rendering query*/ +typedef enum{ + context_lowLevel, + context_mutex, + context_sAreaMap, + context_fbMap, + context_mmioMap, + context_context, + context_fd, + context_none +} ContextRes; typedef struct{ unsigned ctxNo; /* XvMC private context reference number */ pthread_mutex_t ctxMutex; /* Mutex for multi-threading. Not used */ drm_context_t drmcontext; /* The drm context */ - CARD8 *fb_base; /* Absolute Base of frame-buffer */ drm_handle_t fbOffset; /* Handle to drm frame-buffer area */ drm_handle_t mmioOffset; /* Handle to drm mmio area */ drm_handle_t sAreaOffset; /* Handle to drm shared memory area */ @@ -71,7 +80,7 @@ typedef struct{ drmAddress fbAddress; /* Virtual address of frame buffer area */ drmAddress mmioAddress; /* Virtual address of mmio area */ drmAddress sAreaAddress; /* Virtual address of shared memory area */ - char busIdString[10]; /* Busid of video card */ + char busIdString[21]; /* Busid of video card */ unsigned yStride; /* Y stride of surfaces in this context */ int fd; /* FD for connection to drm module */ unsigned char intra_quantiser_matrix[64]; @@ -88,8 +97,6 @@ typedef struct{ int chromaIntraLoaded; int chromaNonIntraLoaded; int haveDecoder; /* Does this context own decoder? */ - int decTimeOut; /* Decoder has timed out and need a - reset */ int attribChanged; /* Attributes have changed and need to be uploaded to Xv at next frame display */ @@ -110,6 +117,8 @@ typedef struct{ Drawable draw; /* Drawable to undisplay from */ XvPortID port; /* Xv Port ID when displaying */ int lastSrfDisplaying; + ContextRes resources; + CARD32 timeStamp; }ViaXvMCContext; typedef struct{ @@ -122,6 +131,8 @@ typedef struct{ CARD32 palette[VIA_SUBPIC_PALETTE_SIZE]; /* YUV Palette */ ViaXvMCContext *privContext; /* Pointer to context private data */ int ia44; /* IA44 or AI44 format */ + int needsSync; + CARD32 timeStamp; }ViaXvMCSubPicture; @@ -140,6 +151,9 @@ typedef struct{ ViaXvMCContext *privContext; /* XvMC context private part. */ ViaXvMCSubPicture *privSubPic; /* Subpicture to be blended when displaying. NULL if none. */ + int needsSync; + int syncMode; + CARD32 timeStamp; }ViaXvMCSurface; /* @@ -175,10 +189,9 @@ extern void viaBlit(XvMCLowLevel *xl,unsigned bpp,unsigned srcBase, unsigned blitMode, unsigned color); extern void viaVideoSWFlipLocked(XvMCLowLevel *xl, unsigned flags, - int progressiveSequence, - unsigned yOffs, - unsigned uOffs, - unsigned vOffs); + int progressiveSequence); +extern void viaVideoSetSWFLipLocked(XvMCLowLevel *xl,unsigned yOffs,unsigned uOffs, + unsigned vOffs); extern void viaVideoSubPictureLocked(XvMCLowLevel *xl,ViaXvMCSubPicture *pViaSubPic); extern void viaVideoSubPictureOffLocked(XvMCLowLevel *xl); |