diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-12-04 22:03:25 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-12-04 22:03:25 +0000 |
commit | ebde9d1780cc6bb9307fa6639246764262738696 (patch) | |
tree | bde4f42e59e6c22cee7543c93fbcd58a786ba7e7 | |
parent | abe805c8c549fc02efebcfbbfa30ef69c4690b89 (diff) |
XFree86 4.3.99.901 (RC 1)xf86-4_3_99_901
-rw-r--r-- | src/init.c | 29 | ||||
-rw-r--r-- | src/init.h | 15 | ||||
-rw-r--r-- | src/init301.c | 642 | ||||
-rw-r--r-- | src/init301.h | 6 | ||||
-rw-r--r-- | src/initdef.h | 36 | ||||
-rw-r--r-- | src/sis.h | 18 | ||||
-rw-r--r-- | src/sis_dac.c | 26 | ||||
-rw-r--r-- | src/sis_driver.c | 287 | ||||
-rw-r--r-- | src/sis_driver.h | 38 | ||||
-rw-r--r-- | src/sis_opt.c | 53 | ||||
-rw-r--r-- | src/sis_vb.c | 12 | ||||
-rw-r--r-- | src/sis_vga.c | 56 | ||||
-rw-r--r-- | src/vgatypes.h | 9 | ||||
-rw-r--r-- | src/vstruct.h | 43 |
14 files changed, 718 insertions, 552 deletions
@@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.c,v 1.37 2003/11/20 19:53:20 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.c,v 1.39 2003/12/02 16:44:36 twini Exp $ */ /* * Mode initializing code (CRT1 section) for * for SiS 300/305/540/630/730 and @@ -916,7 +916,8 @@ SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, case 1280: if(VDisplay == 1024) ModeIndex = ModeIndex_1280x1024[Depth]; else if(VDisplay == 768) { - if((LCDheight != 1050) && (LCDheight != 960)) { + if((LCDheight == 768) || + ((LCDheight == 1024) && (VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)))) { if(VGAEngine == SIS_300_VGA) { ModeIndex = ModeIndex_300_1280x768[Depth]; } else { @@ -924,7 +925,8 @@ SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, } } } else if(VDisplay == 960) { - if((LCDheight != 1050) && (LCDheight != 768)) { + if((LCDheight == 960) || + ((LCDheight == 1024) && (VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)))) { ModeIndex = ModeIndex_1280x960[Depth]; } } @@ -932,7 +934,9 @@ SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, case 1400: if(VGAEngine == SIS_315_VGA) { if(VBFlags & (VB_301B | VB_301C | VB_302B | VB_302LV | VB_302ELV)) { - if(VDisplay == 1050) ModeIndex = ModeIndex_1400x1050[Depth]; + if(LCDheight != 1200) { + if(VDisplay == 1050) ModeIndex = ModeIndex_1400x1050[Depth]; + } } } break; @@ -996,7 +1000,7 @@ SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int D else if(VDisplay == 400) ModeIndex = ModeIndex_640x400[Depth]; break; case 720: - if(!(VBFlags & (TV_HIVISION | TV_HIVISION_LV))) { + if(!(VBFlags & (TV_HIVISION | TV_YPBPR))) { if(VDisplay == 480) { if((VBFlags & TV_NTSC) || (VBFlags & TV_PALM)) ModeIndex = ModeIndex_720x480[Depth]; @@ -1007,7 +1011,7 @@ SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int D } break; case 768: - if(!(VBFlags & (TV_HIVISION | TV_HIVISION_LV))) { + if(!(VBFlags & (TV_HIVISION | TV_YPBPR))) { if((VBFlags & TV_PAL) && (!(VBFlags & TV_PALM))) { if(VDisplay == 576) ModeIndex = ModeIndex_768x576[Depth]; } @@ -1016,7 +1020,7 @@ SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int D case 800: if(VDisplay == 600) ModeIndex = ModeIndex_800x600[Depth]; else if(VDisplay == 480) { - if(VBFlags & (TV_HIVISION | TV_HIVISION_LV)) { + if(VBFlags & (TV_HIVISION | TV_YPBPR)) { ModeIndex = ModeIndex_800x480[Depth]; } } @@ -1027,13 +1031,13 @@ SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int D ModeIndex = ModeIndex_1024x768[Depth]; } } else if(VDisplay == 576) { - if(VBFlags & (TV_HIVISION | TV_HIVISION_LV)) { + if(VBFlags & (TV_HIVISION | TV_YPBPR)) { ModeIndex = ModeIndex_1024x576[Depth]; } } break; case 1280: - if(VBFlags & (TV_HIVISION | TV_HIVISION_LV)) { + if(VBFlags & (TV_HIVISION | TV_YPBPR)) { if(VDisplay == 720) ModeIndex = ModeIndex_1280x720[Depth]; else if(VDisplay == 1024) ModeIndex = ModeIndex_1280x1024[Depth]; } @@ -1368,7 +1372,6 @@ SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_Pr->SiS_IF_DEF_LVDS = 0; SiS_Pr->SiS_IF_DEF_TRUMPION = 0; SiS_Pr->SiS_IF_DEF_CH70xx = 0; - SiS_Pr->SiS_IF_DEF_HiVision = 0; SiS_Pr->SiS_IF_DEF_DSTN = 0; SiS_Pr->SiS_IF_DEF_FSTN = 0; SiS_Pr->SiS_IF_DEF_CONEX = 0; @@ -3626,7 +3629,7 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo) /* Get VB information (connectors, connected devices) */ SiS_GetVBInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo, (SiS_Pr->UseCustomMode) ? 0 : 1); - SiS_SetHiVision(SiS_Pr, HwInfo); + SiS_SetYPbPr(SiS_Pr, HwInfo); SiS_SetTVMode(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); SiS_GetLCDResInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); SiS_SetLowModeTest(SiS_Pr, ModeNo, HwInfo); @@ -3927,7 +3930,7 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, /* If this is a custom mode, we don't check the modeflag for CRT2Mode */ SiS_GetVBInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo, 0); } - SiS_SetHiVision(SiS_Pr, HwInfo); + SiS_SetYPbPr(SiS_Pr, HwInfo); SiS_SetTVMode(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); SiS_GetLCDResInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); SiS_SetLowModeTest(SiS_Pr, ModeNo, HwInfo); @@ -4071,7 +4074,7 @@ SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, /* Get VB information (connectors, connected devices) */ /* (We don't care if the current mode is a CRT2 mode) */ SiS_GetVBInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo, 0); - SiS_SetHiVision(SiS_Pr, HwInfo); + SiS_SetYPbPr(SiS_Pr, HwInfo); SiS_SetTVMode(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); SiS_GetLCDResInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); SiS_SetLowModeTest(SiS_Pr, ModeNo, HwInfo); @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.h,v 1.35 2003/11/20 19:53:21 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.h,v 1.37 2003/12/02 12:15:30 twini Exp $ */ /* * Data and prototypes for init.c * @@ -879,6 +879,11 @@ static const SiS_LCDDataStruct SiS_LCD1280x960Data[] = { 1, 1,1800,1000,1800,1000} }; +/* 1280x768 panel data from Fujitsu 7911 (VL-17WDX8). + * Other 1280x768 panels (with clock != 81000, HTxVT != 1688x802) + * will be treated as custom panels. + */ + static const SiS_LCDDataStruct SiS_StLCD1280x768Data[] = { { 211, 100, 2100, 408, 1688, 802 }, /* These values are *wrong* */ @@ -889,7 +894,7 @@ static const SiS_LCDDataStruct SiS_StLCD1280x768Data[] = { 211, 72, 1008, 609, 1688, 802 }, { 211, 128, 1400, 776, 1688, 802 }, { 211, 205, 1680, 1041, 1688, 802 }, - { 1, 1, 1688, 802, 1688, 802 } /* That's the only one that *might* be correct */ + { 1, 1, 1688, 802, 1688, 802 } /* That's the only one that is correct */ }; static const SiS_LCDDataStruct SiS_ExtLCD1280x768Data[] = @@ -902,11 +907,11 @@ static const SiS_LCDDataStruct SiS_ExtLCD1280x768Data[] = { 211, 72, 1008, 609, 1688, 802 }, { 211, 128, 1400, 776, 1688, 802 }, { 211, 205, 1680, 1041, 1688, 802 }, - { 1, 1, 1688, 802, 1688, 802 } /* That's the only one that *might* be correct */ + { 1, 1, 1688, 802, 1688, 802 } /* That's the only one that is correct */ }; static const SiS_LCDDataStruct SiS_NoScaleData1280x768[] = -{ /* All values guessed */ +{ { 1, 1, 1688, 802, 1688, 802}, { 1, 1, 1688, 802, 1688, 802}, { 1, 1, 1688, 802, 1688, 802}, @@ -2763,7 +2768,7 @@ extern void SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeId PSIS_HW_INFO HwInfo, int chkcrt2mode); extern void SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_INFO HwInfo); -extern void SiS_SetHiVision(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo); +extern void SiS_SetYPbPr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo); extern void SiS_SetTVMode(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_INFO HwInfo); extern void SiS_UnLockCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo); extern void SiS_LockCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo); diff --git a/src/init301.c b/src/init301.c index 3b88a8d..00298cb 100644 --- a/src/init301.c +++ b/src/init301.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c,v 1.52 2003/11/20 19:53:22 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c,v 1.58 2003/12/02 16:44:37 twini Exp $ */ /* * Mode initializing code (CRT2 section) * for SiS 300/305/540/630/730 and @@ -41,14 +41,13 @@ * */ -#if 0 -#define SET_EMI -#endif - #if 1 -#define SET_EMI_CPQ +#define SET_EMI /* 302LV/ELV: Set EMI values */ #endif +#define COMPAL_HACK /* Needed for compal 1400x1050 (EMI) */ +#define COMPAQ_HACK /* Needed for Inventec/Compaq 1280x1024 (EMI) */ + #include "init301.h" #if 0 @@ -247,7 +246,6 @@ SiS_AdjustCRT2Rate(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, tempax |= SupportRAMDAC2; if(HwInfo->jChipType >= SIS_315H) { tempax |= SupportRAMDAC2_135; - /* if((HwInfo->jChipType >= SIS_661) && (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) { */ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { tempax |= SupportRAMDAC2_162; if(SiS_Pr->SiS_VBType & VB_SIS301C) { @@ -259,13 +257,28 @@ SiS_AdjustCRT2Rate(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } else if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { tempax |= SupportLCD; + if(HwInfo->jChipType >= SIS_315H) { + if(SiS_Pr->SiS_VBType & VB_SIS301B302B) { + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + if(tempbx == 0x2e) { /* 640x480 */ + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) { + tempax |= Support64048060Hz; + } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelCustom) { + if(!(SiS_Pr->CP_Supports64048075)) { + tempax |= Support64048060Hz; + } + } + } + } + } + } - } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { + } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) { - if(SiS_Pr->SiS_HiVision == 3) { - tempax |= SupportHiVisionTV2; + if(SiS_Pr->SiS_YPbPr == YPbPrHiVision) { + tempax |= SupportYPbPr2; } else { - tempax |= SupportHiVisionTV; + tempax |= SupportYPbPr; } } else if(SiS_Pr->SiS_VBInfo & (SetCRT2ToAVIDEO | SetCRT2ToSVIDEO | SetCRT2ToSCART)) { @@ -343,11 +356,7 @@ SiS_GetRatePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, if(ModeNo < 0x14) return(0xFFFF); - /* CR33 holds refresh rate index for CRT1 [3:0] and CRT2 [7:4]. - * On LVDS machines, CRT2 index is always 0 and will be - * set to 0 by the following code; this causes the function - * to take the first non-interlaced mode in SiS_Ext2Struct - */ + /* CR33 holds refresh rate index for CRT1 [3:0] and CRT2 [7:4]. */ index = (SiS_GetReg(SiS_Pr->SiS_P3d4,0x33) >> SiS_Pr->SiS_SelectCRT2Rate) & 0x0F; backupindex = index; @@ -412,8 +421,6 @@ SiS_GetRatePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } } - - return(RefreshRateTableIndex + i); } @@ -597,16 +604,15 @@ SiS_PanelDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DelayTime) SiS_ShortDelay(SiS_Pr,Delay); } - } else if(SiS_Pr->SiS_VBType & VB_SISVB) { /* 315 series, 301(B) */ + } else if(SiS_Pr->SiS_VBType & VB_SISVB) { /* 315 series, all bridges */ - PanelID = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36); - DelayIndex = PanelID >> 4; + DelayIndex = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) >> 4; if(!(DelayTime & 0x01)) { Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[0]; } else { Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[1]; } - SiS_DDC2Delay(SiS_Pr, Delay * 4); + SiS_DDC2Delay(SiS_Pr, Delay << 2); } @@ -724,7 +730,7 @@ SiS_Is301B(SiS_Private *SiS_Pr) flag = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x01); if(flag >= 0xb0) return TRUE; - else return FALSE; + return FALSE; } static BOOLEAN @@ -811,7 +817,6 @@ SiS_IsNotM650orLater(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) /* Check for revision != A0 only */ if((flag == 0xe0) || (flag == 0xc0) || (flag == 0xb0) || (flag == 0x90)) return FALSE; - else return TRUE; } else if(HwInfo->jChipType >= SIS_661) return FALSE; return TRUE; } @@ -825,7 +830,7 @@ SiS_IsYPbPr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if(HwInfo->jChipType >= SIS_315H) { flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); - if(flag & EnableLVDSHiVision) return TRUE; /* = YPrPb = 0x08 */ + if(flag & EnableCHYPbPr) return TRUE; /* = YPrPb = 0x08 */ } return FALSE; } @@ -839,7 +844,7 @@ SiS_IsChScart(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if(HwInfo->jChipType >= SIS_315H) { flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); - if(flag & EnableLVDSScart) return TRUE; /* = Scart = 0x04 */ + if(flag & EnableCHScart) return TRUE; /* = Scart = 0x04 */ } return FALSE; } @@ -855,11 +860,11 @@ SiS_IsTVOrYPbPrOrScart(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30); if(flag & SetCRT2ToTV) return TRUE; flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); - if(flag & EnableLVDSHiVision) return TRUE; /* = YPrPb = 0x08 */ - if(flag & EnableLVDSScart) return TRUE; /* = Scart = 0x04 - TW */ + if(flag & EnableCHYPbPr) return TRUE; /* = YPrPb = 0x08 */ + if(flag & EnableCHScart) return TRUE; /* = Scart = 0x04 - TW */ } else { flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30); - if(flag & SetCRT2ToTV) return TRUE; + if(flag & SetCRT2ToTV) return TRUE; } return FALSE; } @@ -878,7 +883,7 @@ SiS_IsLCDOrLCDA(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if(flag & SetToLCDA) return TRUE; } else { flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30); - if(flag & SetCRT2ToLCD) return TRUE; + if(flag & SetCRT2ToLCD) return TRUE; } return FALSE; } @@ -894,7 +899,6 @@ SiS_BridgeIsOn(SiS_Private *SiS_Pr) } else if(SiS_Pr->SiS_VBType & VB_SISVB) { flag = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x00); if((flag == 1) || (flag == 2)) return FALSE; - else return TRUE; } return TRUE; } @@ -953,9 +957,7 @@ SiS_SetChrontelGPIO(SiS_Private *SiS_Pr, USHORT myvbinfo) temp = SiS_GetRegShort((USHORT)(acpibase + 0x3c)); temp = SiS_GetRegShort((USHORT)(acpibase + 0x3a)); /* ACPI register 0x3a: GP Pin Level (low/high) */ temp &= 0xFEFF; - if(!(myvbinfo & SetCRT2ToTV)) { - temp |= 0x0100; - } + if(!(myvbinfo & SetCRT2ToTV)) temp |= 0x0100; SiS_SetRegShort((USHORT)(acpibase + 0x3a), temp); temp = SiS_GetRegShort((USHORT)(acpibase + 0x3a)); } @@ -987,16 +989,13 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, if(SiS_BridgeIsOn(SiS_Pr) == 0) { temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30); #if 0 - /* SiS_HiVision is only used on 315/330+30xLV */ - if(SiS_Pr->SiS_VBType & (VB_SIS301LV302LV)) { - if(SiS_Pr->SiS_HiVision & 0x03) { /* New from 650/30xLV 1.10.6s */ - temp &= (SetCRT2ToHiVisionTV | SwitchCRT2 | SetSimuScanMode); /* 0x83 */ - temp |= SetCRT2ToHiVisionTV; /* 0x80 */ - } - if(SiS_Pr->SiS_HiVision & 0x04) { /* New from 650/30xLV 1.10.6s */ - temp &= (SetCRT2ToHiVisionTV | SwitchCRT2 | SetSimuScanMode); /* 0x83 */ - temp |= SetCRT2ToSVIDEO; /* 0x08 */ - } + if(SiS_Pr->SiS_YPbPr & YPbPrModeMask) { + temp &= (SetCRT2ToYPbPr | SwitchCRT2 | SetSimuScanMode); /* 0x83 */ + temp |= SetCRT2ToYPbPr; /* 0x80 */ + } + if(SiS_Pr->SiS_YPbPr & YPbPrSetSVideo) { + temp &= (SetCRT2ToYPbPr | SwitchCRT2 | SetSimuScanMode); /* 0x83 */ + temp |= SetCRT2ToSVIDEO; /* 0x08 */ } #endif tempbx |= temp; @@ -1007,7 +1006,7 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, #ifdef SIS315H if(HwInfo->jChipType >= SIS_315H) { - if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302B | VB_SIS301LV | VB_SIS302LV | VB_SIS302ELV)) { + if(SiS_Pr->SiS_VBType & (VB_SIS301C|VB_SIS302B|VB_SIS301LV|VB_SIS302LV|VB_SIS302ELV)) { if(ModeNo == 0x03) { /* Mode 0x03 is never in driver mode */ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x31,0xbf); @@ -1037,8 +1036,8 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, tempbx |= SetCRT2ToLCDA; } if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { - if(temp & EnableLVDSHiVision) { - tempbx |= SetCRT2ToHiVisionTV; + if(temp & EnableCHYPbPr) { + tempbx |= SetCRT2ToYPbPr; } } } @@ -1053,7 +1052,7 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, SetCRT2ToLCDA | SetCRT2ToLCD | SetCRT2ToRAMDAC | - SetCRT2ToHiVisionTV; + SetCRT2ToYPbPr; } else { if(HwInfo->jChipType >= SIS_315H) { if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { @@ -1062,7 +1061,7 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, SetCRT2ToSCART | SetCRT2ToLCDA | SetCRT2ToLCD | - SetCRT2ToHiVisionTV; + SetCRT2ToYPbPr; } else { temp = SetCRT2ToLCDA | SetCRT2ToLCD; @@ -1094,8 +1093,8 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, if(tempbx & SetCRT2ToSCART) { tempbx &= (0xFF00|SetCRT2ToSCART|SwitchCRT2|SetSimuScanMode); } - if(tempbx & SetCRT2ToHiVisionTV) { - tempbx &= (0xFF00|SetCRT2ToHiVisionTV|SwitchCRT2|SetSimuScanMode); + if(tempbx & SetCRT2ToYPbPr) { + tempbx &= (0xFF00|SetCRT2ToYPbPr|SwitchCRT2|SetSimuScanMode); } } else { if(HwInfo->jChipType >= SIS_315H) { @@ -1199,28 +1198,22 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, } /*********************************************/ -/* DETERMINE HiVision MODE */ +/* DETERMINE YPbPr MODE */ /*********************************************/ void -SiS_SetHiVision(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +SiS_SetYPbPr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { -#ifdef SIS315H - USHORT temp; -#endif - /* Note: This variable is only used on 30xLV systems. - CR38 has a different meaning on LVDS/CH7019 systems. + * CR38 has a different meaning on LVDS/CH7019 systems. */ - SiS_Pr->SiS_HiVision = 0; + SiS_Pr->SiS_YPbPr = 0; #ifdef SIS315H if((HwInfo->jChipType >= SIS_315H) && (HwInfo->jChipType < SIS_661)) { if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { - temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); - temp &= 0x38; - SiS_Pr->SiS_HiVision = (temp >> 3); + if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) { + SiS_Pr->SiS_YPbPr = ((SiS_GetReg(SiS_Pr->SiS_P3d4,0x38) & 0x38) >> 3); } } } @@ -1502,6 +1495,11 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, /* We do not scale to 1280x960 (B/C bridges only) */ SiS_Pr->SiS_LCDInfo |= DontExpandLCD; } + if(((HwInfo->jChipType >= SIS_315H) && (ModeNo == 0x23 || ModeNo == 0x24 || ModeNo == 0x25)) || + ((HwInfo->jChipType < SIS_315H) && (ModeNo == 0x55 || ModeNo == 0x5a || ModeNo == 0x5b))) { + /* We do not scale to 1280x768 (B/C bridges only) */ + SiS_Pr->SiS_LCDInfo |= DontExpandLCD; + } if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { /* No non-scaling data available for LV bridges */ SiS_Pr->SiS_LCDInfo &= ~DontExpandLCD; @@ -1777,7 +1775,7 @@ SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { /* TV */ - if( (SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) && + if( (SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) && (!(SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) ) { if(SiS_Pr->SiS_TVMode & TVRPLLDIV2XO) VCLKIndex = HiTVVCLKDIV2; else VCLKIndex = HiTVVCLK; @@ -2103,9 +2101,9 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, tempah |= 0x80; } - if(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV - SetCRT2ToHiVisionTV)) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoYPbPr) { if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { - if(!(SiS_Pr->SiS_HiVision & 0x03)) { + if(!(SiS_Pr->SiS_YPbPr & YPbPrModeMask)) { tempah |= 0x20; } } @@ -2385,7 +2383,7 @@ SiS_GetCRT2ResInfo(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, if(xres == 720) xres = 640; } else { if(SiS_Pr->SiS_VBType & VB_NoLCD) { /* 301BDH */ - if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToHiVisionTV)) { + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToYPbPr)) { if(xres == 720) xres = 640; } if(SiS_Pr->SiS_SetFlag & SetDOSMode) { @@ -2397,7 +2395,7 @@ SiS_GetCRT2ResInfo(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, } } } else { - if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToHiVisionTV)) { + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToYPbPr)) { if(xres == 720) xres = 640; } if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { @@ -2628,7 +2626,7 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, } else { /* TV */ if((SiS_Pr->SiS_VBType & VB_SIS301B302B) && - (SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV)) { + (SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr)) { if(SiS_Pr->SiS_VGAVDE > 480) SiS_Pr->SiS_TVMode &= (~TVSetTVSimuMode); tempbx = 2; if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { @@ -2644,7 +2642,7 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, tempal &= 0x3F; - if(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV - SetCRT2ToHiVisionTV)) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoYPbPr) { if(ModeNo > 0x13) { if(tempal == 6) tempal = 7; if((resinfo == SIS_RI_720x480) || @@ -3036,17 +3034,17 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, SiS_Pr->SiS_RVBHRS = (TVPtr+ResIndex)->HALFRVBHRS; } - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) { - if(SiS_Pr->SiS_HiVision != 3) { + if(SiS_Pr->SiS_YPbPr != YPbPrHiVision) { if(resinfo == SIS_RI_1024x768) SiS_Pr->SiS_NewFlickerMode = 0x40; if(resinfo == SIS_RI_1280x1024) SiS_Pr->SiS_NewFlickerMode = 0x40; if(resinfo == SIS_RI_1280x720) SiS_Pr->SiS_NewFlickerMode = 0x40; } - switch(SiS_Pr->SiS_HiVision) { - case 2: - case 1: + switch(SiS_Pr->SiS_YPbPr) { + case YPbPr525: + case YPbPr750: case 0: SiS_Pr->SiS_HT = 0x6b4; SiS_Pr->SiS_VT = 0x20d; @@ -3085,9 +3083,7 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) { SiS_Pr->SiS_HT = NTSCHT; - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if((ModeNo == 0x64) || (ModeNo == 0x4a) || (ModeNo == 0x38)) SiS_Pr->SiS_HT = NTSC2HT; - } + if(SiS_Pr->SiS_TVMode & TVSetNTSC1024) SiS_Pr->SiS_HT = NTSC2HT; SiS_Pr->SiS_VT = NTSCVT; } else { SiS_Pr->SiS_HT = PALHT; @@ -3467,9 +3463,8 @@ SiS_GetLVDSDesData(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, } } else { if(!(SiS_Pr->SiS_SetFlag & SetDOSMode)) { - if( (HwInfo->jChipType < SIS_315H) || - (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024) ) { - if(SiS_Pr->SiS_LCDResInfo >= SiS_Pr->SiS_Panel1024x768){ + if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024) { + if(SiS_Pr->SiS_LCDResInfo >= SiS_Pr->SiS_Panel1024x768) { if(ModeNo <= 0x13) { modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; if(HwInfo->jChipType < SIS_315H) { @@ -3588,22 +3583,16 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if(IS_SIS550650740660) { /* 550, 650, 740, 660 */ - modenum = SiS_GetReg(SiS_Pr->SiS_P3d4,0x34); + modenum = SiS_GetReg(SiS_Pr->SiS_P3d4,0x34) & 0x7f; if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { /* LV */ - - if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { - if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) { -#ifdef SET_EMI_CPQ - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x30,0x00); -#endif - } else if(SiS_Pr->SiS_CustomT != CUT_CLEVO1400) { #ifdef SET_EMI + if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { + if(SiS_Pr->SiS_CustomT != CUT_CLEVO1400) { SiS_SetReg(SiS_Pr->SiS_Part4Port,0x30,0x00); -#endif } } - +#endif if( (modenum <= 0x13) || (!(SiS_IsDualEdge(SiS_Pr,HwInfo))) || (SiS_IsVAMode(SiS_Pr,HwInfo)) ) { @@ -3718,7 +3707,7 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) (SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) && (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) { - SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,~0x10); /* 1.10.8r, 8m */ + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,~0x10); tempah = 0x3f; if(SiS_IsDualEdge(SiS_Pr,HwInfo)) { @@ -3729,15 +3718,12 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) } SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1F,tempah); - if(SiS_IsNotM650orLater(SiS_Pr,HwInfo)) { /* 1.10.8r, 8m */ + if(SiS_IsNotM650orLater(SiS_Pr,HwInfo)) { SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0x7f); - } /* 1.10.8r, 8m */ + } if(!(SiS_IsVAMode(SiS_Pr,HwInfo))) { SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xdf); - } - - if(!(SiS_IsVAMode(SiS_Pr,HwInfo))) { if(!(SiS_CRT2IsLCD(SiS_Pr,HwInfo))) { if(!(SiS_IsDualEdge(SiS_Pr,HwInfo))) { SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFD); @@ -3747,6 +3733,13 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_SetReg(SiS_Pr->SiS_P3c4,0x06,pushax); + if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { + if( (SiS_IsVAMode(SiS_Pr, HwInfo)) || + (SiS_CRT2IsLCD(SiS_Pr, HwInfo)) ) { + SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 10); + } + } + } else if(SiS_Pr->SiS_VBType & VB_NoLCD) { /* NIL */ @@ -4130,14 +4123,16 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if(IS_SIS550650740660) { /* 550, 650, 740, 660 */ + UCHAR r30=0, r31=0, r32=0, r33=0, cr36=0; + if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { if((SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) && (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) { - SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,0xef); /* 1.10.7u */ + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,0xef); #ifdef SET_EMI if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x30,0x00); /* 1.10.7u */ + SiS_SetReg(SiS_Pr->SiS_Part4Port,0x30,0x00); } #endif } @@ -4275,62 +4270,136 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { + if((SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) && + (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) { + SiS_PanelDelay(SiS_Pr, HwInfo, 2); + } +#ifdef COMPAQ_HACK if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) { -#ifdef SET_EMI_CPQ - if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x30,0x00); - SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x0c); - SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x20); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x31,0x08); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x32,0x10); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x33,0x4d); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10); - if((SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) & 0x0f) != 0x02) { - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x31,0x0d); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x32,0x70); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x33,0x6b); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10); - } - } + SiS_PanelDelay(SiS_Pr, HwInfo, 2); + } #endif - } else if(SiS_Pr->SiS_CustomT != CUT_CLEVO1400) { + + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1f,0x10); + + if(SiS_Pr->SiS_CustomT != CUT_CLEVO1400) { #ifdef SET_EMI if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x30,0x00); /* All this from 1.10.7u */ + SiS_SetReg(SiS_Pr->SiS_Part4Port,0x30,0x00); } #endif SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x0c); #ifdef SET_EMI if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { - SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x20); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x31,0x12); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x32,0xd0); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x33,0x6b); - if((SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) & 0x0f) == 0x02) { /* Acer */ - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x31,0x0d); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x32,0x70); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x33,0x40); - if(((SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) & 0xf0) != 0x30)) { /* Acer */ - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x31,0x05); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x32,0x60); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x33,0x33); /* 00 */ + + cr36 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36); + + /* (P4_30|0x40) */ + /* Compal 1400x1050: 0x05, 0x60, 0x00 YES (1.10.7w; CR36=69) */ + /* Compal 1400x1050: 0x0d, 0x70, 0x40 YES (1.10.7x; CR36=69) */ + /* Acer 1280x1024: 0x12, 0xd0, 0x6b NO (1.10.9k; CR36=73) */ + /* Compaq 1280x1024: 0x0d, 0x70, 0x6b YES (1.12.04b; CR36=03) */ + /* Clevo 1024x768: 0x05, 0x60, 0x33 NO (1.10.8e; CR36=12, DL!) */ + /* Clevo 1024x768: 0x0d, 0x70, 0x40 (if type == 3) YES (1.10.8y; CR36=?2) */ + /* Clevo 1024x768: 0x05, 0x60, 0x33 (if type != 3) YES (1.10.8y; CR36=?2) */ + /* Asus 1024x768: ? ? (1.10.8o; CR36=?2) */ + + if(SiS_Pr->HaveEMI) { + r30 = SiS_Pr->EMI_30; + r31 = SiS_Pr->EMI_31; + r32 = SiS_Pr->EMI_32; + r33 = SiS_Pr->EMI_33; + } else { + r30 = 0; + } + + /* EMI_30 is read at driver start; however, the BIOS sets this + * (if it is used) only if the LCD is in use. In case we caught + * the machine while on TV output, this bit is not set and we + * don't know if it should be set - hence our detection is wrong. + * Work-around this here: + */ + + if((!SiS_Pr->HaveEMI) || (!SiS_Pr->HaveEMILCD)) { + if((cr36 & 0x0f) == 0x02) { /* 1024x768 */ + r30 |= 0x40; + if(SiS_Pr->SiS_CustomT == CUT_CLEVO1024) { + r30 &= ~0x40; + } + } else if((cr36 & 0x0f) == 0x03) { /* 1280x1024 */ + r30 |= 0x40; + if(SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) { + r30 &= ~0x40; + } + } else if((cr36 & 0x0f) == 0x09) { /* 1400x1050 */ + r30 |= 0x40; + } else if((cr36 & 0x0f) == 0x0b) { /* 1600x1200 - unknown */ + r30 |= 0x40; } - } - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10); - if((SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) & 0x0f) != 0x03) { - SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x40); - } + } + + if(!SiS_Pr->HaveEMI) { + if((cr36 & 0x0f) == 0x02) { + if((cr36 & 0xf0) == 0x30) { + r31 = 0x0d; r32 = 0x70; r33 = 0x40; + } else { + r31 = 0x05; r32 = 0x60; r33 = 0x33; + } + } else if((cr36 & 0x0f) == 0x03) { + if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) { + r31 = 0x0d; r32 = 0x70; r33 = 0x6b; + } else { + r31 = 0x12; r32 = 0xd0; r33 = 0x6b; + } + } else if((cr36 & 0x0f) == 0x09) { + if(SiS_Pr->SiS_CustomT == CUT_COMPAL1400_2) { + r31 = 0x0d; r32 = 0x70; r33 = 0x40; /* BIOS values */ + } else { + r31 = 0x05; r32 = 0x60; r33 = 0x00; + } + } else { + r31 = 0x05; r32 = 0x60; r33 = 0x00; + } + } + +#ifdef COMPAL_HACK /* BIOS values don't work so well */ + if(!SiS_Pr->OverruleEMI) { + if(SiS_Pr->SiS_CustomT == CUT_COMPAL1400_2) { + if((cr36 & 0x0f) == 0x09) { + r30 = 0x60; r31 = 0x05; r32 = 0x60; r33 = 0x00; + } + } + } +#endif +#ifdef COMPAQ_HACK + if(!SiS_Pr->OverruleEMI) { + if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) { + if((cr36 & 0x0f) == 0x03) { + r30 = 0x20; r31 = 0x12; r32 = 0xd0; r33 = 0x6b; /* rev 1 */ + /* r30 = 0x60; r31 = 0x12; r32 = 0xd0; r33 = 0x6b; */ /* rev 2 */ + /* r30 = 0x20; r31 = 0x05; r32 = 0x60; r33 = 0x00; */ /* rev 3 */ + /* r30 = 0x60; r31 = 0x05; r32 = 0x60; r33 = 0x00; */ /* rev 4 */ + } + } + } +#endif + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x20); + SiS_SetReg(SiS_Pr->SiS_Part4Port,0x31,r31); + SiS_SetReg(SiS_Pr->SiS_Part4Port,0x32,r32); + SiS_SetReg(SiS_Pr->SiS_Part4Port,0x33,r33); + SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10); + if( (SiS_IsVAMode(SiS_Pr,HwInfo)) || + (SiS_CRT2IsLCD(SiS_Pr, HwInfo)) ) { + if(r30 & 0x40) { + SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 5); + SiS_WaitVBRetrace(SiS_Pr,HwInfo); + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x40); + } + } } #endif } - if((SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) && - (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) { - SiS_PanelDelay(SiS_Pr, HwInfo, 2); - } - - SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1f,0x10); - if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) { if( (SiS_IsVAMode(SiS_Pr,HwInfo)) || @@ -4339,11 +4408,6 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_PanelDelay(SiS_Pr, HwInfo, 1); SiS_WaitVBRetrace(SiS_Pr, HwInfo); SiS_PanelDelay(SiS_Pr, HwInfo, 3); -#ifdef SET_EMI_CPQ - if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { - SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x40); - } -#endif if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwInfo))) { SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x01); } @@ -4364,7 +4428,6 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) } else { SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x80); - if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwInfo))) { if( (SiS_IsVAMode(SiS_Pr,HwInfo)) || ((SiS_CRT2IsLCD(SiS_Pr, HwInfo))) ) { @@ -4657,6 +4720,7 @@ SiS_SetCRT2Offset(SiS_Private *SiS_Pr,USHORT ModeNo, temp = (UCHAR)(offset >> 8); SiS_SetReg(SiS_Pr->SiS_Part1Port,0x09,temp); temp = (UCHAR)(((offset >> 3) & 0xFF) + 1); + if(offset % 8) temp++; SiS_SetReg(SiS_Pr->SiS_Part1Port,0x03,temp); } @@ -5420,8 +5484,8 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, temp += 2; } } - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { - if(SiS_Pr->SiS_HiVision == 3) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) { + if(SiS_Pr->SiS_YPbPr == YPbPrHiVision) { if(resinfo == SIS_RI_800x600) temp -= 2; } } @@ -5429,8 +5493,7 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, SiS_SetReg(SiS_Pr->SiS_Part1Port,0x06,0x03); /* 0x06 Horizontal Blank end */ - if((SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) && - (SiS_Pr->SiS_HiVision == 3)) { + if((SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) && (SiS_Pr->SiS_YPbPr == YPbPrHiVision)) { temp = (tempbx & 0x00FF) - 1; if(!(modeflag & HalfDCLK)) { temp -= 6; @@ -5521,10 +5584,10 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, } } - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { - if(SiS_Pr->SiS_HiVision & 0x03) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) { + if(SiS_Pr->SiS_YPbPr & YPbPrModeMask) { p1_7 = 0xb2; - if(SiS_Pr->SiS_HiVision & 0x02) { + if(SiS_Pr->SiS_YPbPr & YPbPr525) { p1_7 = 0xab; } } @@ -5597,13 +5660,12 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, } } - if((SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) && - (SiS_Pr->SiS_HiVision == 3)) { + if((SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) && (SiS_Pr->SiS_YPbPr == YPbPrHiVision)) { tempbx -= 10; } else { if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) { if(SiS_Pr->SiS_TVMode & TVSetPAL) { - if(!(SiS_Pr->SiS_HiVision & 0x03)) { + if(!(SiS_Pr->SiS_YPbPr & YPbPrModeMask)) { tempbx += 40; if(HwInfo->jChipType >= SIS_315H) { if(SiS_Pr->SiS_VGAHDE == 800) tempbx += 10; @@ -6627,15 +6689,15 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) temp = 0x24; if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelCustom) temp = 0x2c; if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) temp = 0x08; - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) { if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) temp = 0x2c; else temp = 0x20; } if((ROMAddr) && (SiS_Pr->SiS_UseROM)) { if(ROMAddr[0x220] & 0x80) { - if(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV-SetCRT2ToHiVisionTV)) + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoYPbPr) temp = ROMAddr[0x221]; - else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) + else if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) temp = ROMAddr[0x222]; else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) temp = ROMAddr[0x223]; @@ -6645,8 +6707,8 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } } if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - if(HwInfo->pdc) { - temp = HwInfo->pdc & 0x3c; + if(SiS_Pr->PDC) { + temp = SiS_Pr->PDC & 0x3c; } } } else { @@ -6660,8 +6722,8 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } } if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - if(HwInfo->pdc) { - temp = HwInfo->pdc & 0x3c; + if(SiS_Pr->PDC) { + temp = SiS_Pr->PDC & 0x3c; } } } @@ -6685,10 +6747,10 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelCustom) temp = 0x2c; if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { temp = 0x08; - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { - switch(SiS_Pr->SiS_HiVision) { - case 2: - case 1: + if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) { + switch(SiS_Pr->SiS_YPbPr) { + case YPbPr525: + case YPbPr750: case 0: temp = 0x08; break; @@ -6712,8 +6774,8 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD|SetCRT2ToLCDA)) { if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { - if(HwInfo->pdc) { - temp = HwInfo->pdc; + if(SiS_Pr->PDC) { + temp = SiS_Pr->PDC; tempbl = 0; } } @@ -6999,24 +7061,19 @@ SiS_SetTVSpecial(SiS_Private *SiS_Pr, USHORT ModeNo) } } -/* Set 301 TV Encoder (and some LCD relevant) registers */ static void SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT RefreshRateTableIndex, PSIS_HW_INFO HwInfo) { -#if 0 - UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; -#endif USHORT i, j, tempax, tempbx, tempcx, temp; - USHORT push1, push2; + USHORT push1, push2, modeflag, crt2crtc; + ULONG longtemp, tempeax; const UCHAR *PhasePoint; const UCHAR *TimingPoint; #ifdef SIS315H - const SiS_Part2PortTblStruct *CRT2Part2Ptr = NULL; USHORT resindex, CRT2Index; + const SiS_Part2PortTblStruct *CRT2Part2Ptr = NULL; #endif - USHORT modeflag, crt2crtc; - ULONG longtemp, tempeax; #ifdef SIS300 const UCHAR atable[] = { 0xc3,0x9e,0xc3,0x9e,0x02,0x02,0x02, @@ -7046,7 +7103,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToSVIDEO)) temp |= 0x04; if(SiS_Pr->SiS_VBInfo & SetCRT2ToSCART) temp |= 0x02; - /* Disables SVIDEO and CVBS signal */ + /* Disable SVIDEO and CVBS signal */ if((SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) && (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) { if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { @@ -7057,18 +7114,18 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr PhasePoint = SiS_Pr->SiS_PALPhase; TimingPoint = SiS_Pr->SiS_PALTiming; - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) { temp ^= 0x01; if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { TimingPoint = SiS_Pr->SiS_HiTVSt2Timing; if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) { if(modeflag & Charx8Dot) TimingPoint = SiS_Pr->SiS_HiTVSt1Timing; - else TimingPoint = SiS_Pr->SiS_HiTVTextTiming; + else TimingPoint = SiS_Pr->SiS_HiTVTextTiming; } } else TimingPoint = SiS_Pr->SiS_HiTVExtTiming; - if(SiS_Pr->SiS_HiVision & 0x03) temp &= 0xfe; + if(SiS_Pr->SiS_YPbPr & YPbPrModeMask) temp &= 0xfe; } else { @@ -7156,17 +7213,19 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr SiS_SetReg(SiS_Pr->SiS_Part2Port,0x37,SiS_Pr->SiS_RY3COE); SiS_SetReg(SiS_Pr->SiS_Part2Port,0x38,SiS_Pr->SiS_RY4COE); - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { - if(SiS_Pr->SiS_HiVision == 3) tempax = 950; - else tempax = 440; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) { + if(SiS_Pr->SiS_YPbPr == YPbPrHiVision) tempax = 950; + else tempax = 440; } else { - if(SiS_Pr->SiS_TVMode & TVSetPAL) tempax = 520; - else tempax = 440; + if(SiS_Pr->SiS_TVMode & TVSetPAL) tempax = 520; + else tempax = 440; } - if( ( ( (!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) || (SiS_Pr->SiS_HiVision == 3) ) && (SiS_Pr->SiS_VDE <= tempax) ) || - ( (SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (SiS_Pr->SiS_HiVision != 3) && - ( (SiS_Pr->SiS_VGAHDE == 1024) || ((SiS_Pr->SiS_VGAHDE != 1024) && (SiS_Pr->SiS_VDE <= tempax)) ) ) ) { + if( ( ((!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) || (SiS_Pr->SiS_YPbPr == YPbPrHiVision)) && + (SiS_Pr->SiS_VDE <= tempax) ) || + ( (SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (SiS_Pr->SiS_YPbPr != YPbPrHiVision) && + ( (SiS_Pr->SiS_VGAHDE == 1024) || + ((SiS_Pr->SiS_VGAHDE != 1024) && (SiS_Pr->SiS_VDE <= tempax)) ) ) ) { tempax -= SiS_Pr->SiS_VDE; tempax >>= 2; @@ -7178,20 +7237,15 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr temp = tempax + (USHORT)TimingPoint[1]; SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,temp); - if( (SiS_Pr->SiS_VBInfo & (SetCRT2ToTV - SetCRT2ToHiVisionTV)) && - (SiS_Pr->SiS_HiVision != 3) && + if( (SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoYPbPr) && + (SiS_Pr->SiS_YPbPr != YPbPrHiVision) && (SiS_Pr->SiS_VGAHDE >= 1024) ) { if(SiS_Pr->SiS_TVMode & TVSetPAL) { SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x19); SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x52); } else { - if(HwInfo->jChipType >= SIS_315H) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x17); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x1d); - } else { - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x0b); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x11); - } + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x17); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x1d); } } @@ -7213,8 +7267,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr push1 = tempcx; tempcx += 7; - if((SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) && - (SiS_Pr->SiS_HiVision == 3)) { + if((SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) && (SiS_Pr->SiS_YPbPr == YPbPrHiVision)) { tempcx -= 4; } temp = (tempcx & 0x00FF) << 4; @@ -7233,8 +7286,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr tempbx = push2; tempbx += 8; - if((SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) && - (SiS_Pr->SiS_HiVision == 3)) { + if((SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) && (SiS_Pr->SiS_YPbPr == YPbPrHiVision)) { tempbx -= 4; tempcx = tempbx; } @@ -7249,9 +7301,8 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x28,0x0F,temp); tempcx += 8; - if((SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) && - (SiS_Pr->SiS_HiVision == 3)) { - tempcx -= 4; + if((SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) && (SiS_Pr->SiS_YPbPr == YPbPrHiVision)) { + tempcx -= 4; } temp = (tempcx & 0x00FF) << 4; SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x2A,0x0F,temp); @@ -7277,7 +7328,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr if(HwInfo->jChipType < SIS_315H) { if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) tempbx >>= 1; } else { - if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (!(SiS_Pr->SiS_HiVision & 0x03))) { + if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (!(SiS_Pr->SiS_YPbPr & YPbPrModeMask))) { tempbx >>= 1; if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) { if(ModeNo <= 0x13) { @@ -7287,7 +7338,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr } } else { if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { - if(crt2crtc == 4) /* BIOS calls GetRatePtrCRT2 here - does not make sense */ + if(crt2crtc == 4) if(SiS_Pr->SiS_ModeType <= 3) tempbx++; } } @@ -7295,8 +7346,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr } tempbx -= 2; temp = tempbx & 0x00FF; - if((SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) && - (SiS_Pr->SiS_HiVision == 3)) { + if((SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) && (SiS_Pr->SiS_YPbPr == YPbPrHiVision)) { if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { if((ModeNo == 0x2f) || (ModeNo == 0x5d) || (ModeNo == 0x5e)) temp++; } @@ -7318,7 +7368,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr temp = (tempcx >> 8) & 0x0F; temp |= (((tempbx >> 8) << 6) & 0xC0); - if(!(SiS_Pr->SiS_VBInfo & (SetCRT2ToHiVisionTV | SetCRT2ToSCART))) { + if(!(SiS_Pr->SiS_VBInfo & (SetCRT2ToYPbPr | SetCRT2ToSCART))) { temp |= 0x10; if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToSVIDEO)) temp |= 0x20; } @@ -7335,20 +7385,20 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr } } - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { - if(SiS_Pr->SiS_HiVision != 3) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) { + if(SiS_Pr->SiS_YPbPr != YPbPrHiVision) { for(i=0, j=0; i<=0x2d; i++, j++) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,i,SiS_HiVisionTable[SiS_Pr->SiS_HiVision][j]); + SiS_SetReg(SiS_Pr->SiS_Part2Port,i,SiS_YPbPrTable[SiS_Pr->SiS_YPbPr & 0x03][j]); } for(i=0x39; i<=0x45; i++, j++) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,i,SiS_HiVisionTable[SiS_Pr->SiS_HiVision][j]); + SiS_SetReg(SiS_Pr->SiS_Part2Port,i,SiS_YPbPrTable[SiS_Pr->SiS_YPbPr & 0x03][j]); } } } if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { tempbx = SiS_Pr->SiS_VDE; - if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (!(SiS_Pr->SiS_HiVision & 0x03))) { + if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (!(SiS_Pr->SiS_YPbPr & YPbPrModeMask))) { tempbx >>= 1; } tempbx -= 3; @@ -7368,11 +7418,9 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr SiS_SetReg(SiS_Pr->SiS_Part2Port,0x47,temp); temp = 0; - if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { - if(SiS_Pr->SiS_HiVision & 0x03) { - temp = 0x30; - if(SiS_Pr->SiS_HiVision & 0x01) temp = 0x50; - } + if(SiS_Pr->SiS_YPbPr & YPbPrModeMask) { + temp = 0x30; /* 525p */ + if(SiS_Pr->SiS_YPbPr & YPbPr750) temp = 0x50; /* 750p */ } SiS_SetReg(SiS_Pr->SiS_Part2Port,0x4d,temp); @@ -7387,8 +7435,8 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr } tempcx = 0x0101; - if(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV - SetCRT2ToHiVisionTV)) { - if(!(SiS_Pr->SiS_HiVision & 0x03)) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoYPbPr) { + if(!(SiS_Pr->SiS_YPbPr & YPbPrModeMask)) { if(SiS_Pr->SiS_VGAHDE >= 1024) { if((!(modeflag & HalfDCLK)) || (HwInfo->jChipType < SIS_315H)) { tempcx = 0x1920; @@ -7521,7 +7569,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr } } - /* Must do special for Compaq1280; Acer1280 OK, Clevo1400 OK, ECS1400 OK */ + /* Must do special for Compaq1280; Acer1280 OK, Clevo1400 OK, COMPAL1400 OK */ /* Compaq1280 panel loses sync if using CR37 sync info. */ if((SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) { if((HwInfo->jChipType >= SIS_315H) && (SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) { @@ -8017,20 +8065,24 @@ SiS_SetGroup3(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, SiS_SetReg(SiS_Pr->SiS_Part3Port,0x3D,0xA8); } - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { - tempdi = SiS_Pr->SiS_HiTVGroup3Data; - if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) { - tempdi = SiS_Pr->SiS_HiTVGroup3Simu; - if(!(modeflag & Charx8Dot)) { - tempdi = SiS_Pr->SiS_HiTVGroup3Text; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) { + tempdi = NULL; + if(SiS_Pr->SiS_YPbPr == YPbPrHiVision) { + tempdi = SiS_Pr->SiS_HiTVGroup3Data; + if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) { + tempdi = SiS_Pr->SiS_HiTVGroup3Simu; + if(!(modeflag & Charx8Dot)) { + tempdi = SiS_Pr->SiS_HiTVGroup3Text; + } } - } - if(SiS_Pr->SiS_HiVision & 0x03) { + } else if(SiS_Pr->SiS_YPbPr & YPbPrModeMask) { tempdi = SiS_HiTVGroup3_1; - if(SiS_Pr->SiS_HiVision & 0x02) tempdi = SiS_HiTVGroup3_2; + if(SiS_Pr->SiS_YPbPr & YPbPr525) tempdi = SiS_HiTVGroup3_2; } - for(i=0; i<=0x3E; i++){ - SiS_SetReg(SiS_Pr->SiS_Part3Port,i,tempdi[i]); + if(tempdi) { + for(i=0; i<=0x3E; i++){ + SiS_SetReg(SiS_Pr->SiS_Part3Port,i,tempdi[i]); + } } } @@ -8122,21 +8174,13 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, if(SiS_IsDualLink(SiS_Pr, HwInfo)) { SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x2c); } - if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) { -#ifdef SET_EMI_CPQ - if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x2a,0x00); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x30,0x00); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10); - } -#endif - } else if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { #ifdef SET_EMI + if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { SiS_SetReg(SiS_Pr->SiS_Part4Port,0x2a,0x00); SiS_SetReg(SiS_Pr->SiS_Part4Port,0x30,0x00); SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10); -#endif } +#endif } return; } @@ -8174,7 +8218,7 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } temp = 0xA0; - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) { temp = 0; if(tempbx > 800) { temp = 0xA0; @@ -8195,7 +8239,7 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } } - if(SiS_Pr->SiS_HiVision & 0x03) { + if(SiS_Pr->SiS_YPbPr & YPbPrModeMask) { temp = 0; if(SiS_Pr->SiS_VGAHDE == 1024) temp = 0x20; } @@ -8213,7 +8257,7 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, tempebx = SiS_Pr->SiS_VDE; - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) { if(!(temp & 0xE0)) tempebx >>=1; } @@ -8252,16 +8296,16 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, tempbx = 0; tempax = SiS_Pr->SiS_VGAHDE; if(modeflag & HalfDCLK) tempax >>= 1; - if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) || (SiS_Pr->SiS_HiVision & 0x03)) { + if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) || (SiS_Pr->SiS_YPbPr & YPbPrModeMask)) { if(HwInfo->jChipType >= SIS_315H) { if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempax >>= 1; - else if(tempax > 800) tempax -= 800; + else if(tempax > 800) tempax -= 800; } else { if(tempax > 800) tempax -= 800; } } - if((SiS_Pr->SiS_VBInfo & (SetCRT2ToTV - SetCRT2ToHiVisionTV)) && (!(SiS_Pr->SiS_HiVision & 0x03))) { + if((SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoYPbPr) && (!(SiS_Pr->SiS_YPbPr & YPbPrModeMask))) { if(tempax > 800) { tempbx = 8; if(tempax == 1024) @@ -8297,8 +8341,7 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } else { temp = 0x0036; } - if((SiS_Pr->SiS_VBInfo & (SetCRT2ToTV - SetCRT2ToHiVisionTV)) && - (!(SiS_Pr->SiS_HiVision & 0x03))) { + if((SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoYPbPr) && (!(SiS_Pr->SiS_YPbPr & YPbPrModeMask))) { temp |= 0x01; if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { if(!(SiS_Pr->SiS_TVMode & TVSetTVSimuMode)) @@ -8326,21 +8369,13 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x2c); } } - if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) { -#ifdef SET_EMI_CPQ - if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x2a,0x00); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x30,0x00); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10); - } -#endif - } else if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { #ifdef SET_EMI + if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { SiS_SetReg(SiS_Pr->SiS_Part4Port,0x2a,0x00); SiS_SetReg(SiS_Pr->SiS_Part4Port,0x30,0x00); SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10); -#endif } +#endif } } /* 301B */ @@ -9329,16 +9364,6 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) } if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) { -#if 0 - /* RDirectLCDN */ - if( (SiS_IsVAMode(SiS_Pr, HwInfo)) || - (SiS_IsDualEdge(SiS_Pr, HwInfo)) ) { - temp = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x23); - SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x23,0x80); - SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x23,0x7f); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x23,temp); - } -#endif SiS_LockCRT2(SiS_Pr, HwInfo); SiS_DisplayOn(SiS_Pr); return TRUE; @@ -9350,9 +9375,9 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) if( (SiS_Pr->SiS_IF_DEF_LVDS == 1) || ((SiS_Pr->SiS_VBType & VB_NoLCD) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) || ((HwInfo->jChipType >= SIS_315H) && (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) ) { - SiS_GetLVDSDesData(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo); + SiS_GetLVDSDesData(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo); } else { - SiS_Pr->SiS_LCDHDES = SiS_Pr->SiS_LCDVDES = 0; + SiS_Pr->SiS_LCDHDES = SiS_Pr->SiS_LCDVDES = 0; } #ifdef LINUX_XF86 @@ -10083,7 +10108,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) /* Probe supported DA's */ flag = SiS_ProbeDDC(SiS_Pr); -#ifdef TWDEBUG +#ifdef TWDEBUG xf86DrvMsg(pSiS->pScrn->scrnIndex, X_INFO, "CRT2 DDC capabilities 0x%x\n", flag); #endif @@ -10190,9 +10215,13 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) paneltype = Panel310_1280x960; } } else if(yres == 768) { - paneltype = Panel_1280x768; - checkexpand = FALSE; - cr37 |= 0x10; + if( ((buffer[0x36] | (buffer[0x37] << 8)) == 8100) && + ((buffer[0x39] | ((buffer[0x3a] & 0x0f) << 8)) == (1688 - 1280)) && + ((buffer[0x3c] | ((buffer[0x3d] & 0x0f) << 8)) == (802 - 768)) ) { + paneltype = Panel_1280x768; + checkexpand = FALSE; + cr37 |= 0x10; + } } break; case 1400: @@ -10222,6 +10251,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) /* What now? There is no digital separate output timing... */ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_WARNING, "CRT2: Unable to retrieve Sync polarity information\n"); + cr37 |= 0xc0; /* Default */ } } @@ -10248,6 +10278,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) }; paneltype = 0; + SiS_Pr->CP_Supports64048075 = TRUE; /* Find the maximum resolution */ @@ -10303,7 +10334,8 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) SiS_Pr->CP_DataValid[i] = TRUE; /* Sort out invalid timings, interlace and too high clocks */ - if((SiS_Pr->CP_HDisplay[i] > SiS_Pr->CP_HSyncStart[i]) || + if((SiS_Pr->CP_HDisplay[i] & 7) || + (SiS_Pr->CP_HDisplay[i] > SiS_Pr->CP_HSyncStart[i]) || (SiS_Pr->CP_HDisplay[i] >= SiS_Pr->CP_HSyncEnd[i]) || (SiS_Pr->CP_HDisplay[i] >= SiS_Pr->CP_HTotal[i]) || (SiS_Pr->CP_HSyncStart[i] >= SiS_Pr->CP_HSyncEnd[i]) || @@ -10316,7 +10348,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) (SiS_Pr->CP_VSyncStart[i] > SiS_Pr->CP_VTotal[i]) || (SiS_Pr->CP_VSyncEnd[i] > SiS_Pr->CP_VTotal[i]) || (((pSiS->VBFlags & VB_301C) && (SiS_Pr->CP_Clock[i] > 162500)) || - ((!(pSiS->VBFlags & VB_301C)) && (SiS_Pr->CP_Clock[i] > 108500))) || + ((!(pSiS->VBFlags & VB_301C)) && (SiS_Pr->CP_Clock[i] > 108200))) || (buffer[base+17] & 0x80)) { SiS_Pr->CP_DataValid[i] = FALSE; @@ -10334,6 +10366,11 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) SiS_Pr->CP_Vendor = buffer[9] | (buffer[8] << 8); SiS_Pr->CP_Product = buffer[10] | (buffer[11] << 8); + /* By default we drive the LCD at 75Hz in 640x480 mode; if + * the panel does not provide this mode, use 60hz + */ + if(!(buffer[0x23] & 0x04)) SiS_Pr->CP_Supports64048075 = FALSE; + /* We must assume the panel can scale, since we have * no scaling data */ @@ -10438,11 +10475,8 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) } else if(yres == 1024) { paneltype = Panel_1280x1024; checkexpand = TRUE; - } else if(yres == 768) { - paneltype = Panel_1280x768; - checkexpand = FALSE; - cr37 |= 0x10; } + /* 1280x768 treated as custom here */ break; case 1400: if(pSiS->VGAEngine == SIS_315_VGA) { @@ -10507,6 +10541,9 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) /* Now seek the detailed timing descriptions for custom panels */ if(paneltype == Panel_Custom) { + + SiS_Pr->CP_Supports64048075 = TRUE; + index += (numcodes * 4); numcodes = buffer[0x7f] & 0x07; for(i=0; i<numcodes; i++, index += 18) { @@ -10531,7 +10568,8 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) SiS_Pr->CP_DataValid[i] = TRUE; - if((SiS_Pr->CP_HDisplay[i] > SiS_Pr->CP_HSyncStart[i]) || + if((SiS_Pr->CP_HDisplay[i] & 7) || + (SiS_Pr->CP_HDisplay[i] > SiS_Pr->CP_HSyncStart[i]) || (SiS_Pr->CP_HDisplay[i] >= SiS_Pr->CP_HSyncEnd[i]) || (SiS_Pr->CP_HDisplay[i] >= SiS_Pr->CP_HTotal[i]) || (SiS_Pr->CP_HSyncStart[i] >= SiS_Pr->CP_HSyncEnd[i]) || @@ -10544,7 +10582,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) (SiS_Pr->CP_VSyncStart[i] > SiS_Pr->CP_VTotal[i]) || (SiS_Pr->CP_VSyncEnd[i] > SiS_Pr->CP_VTotal[i]) || (((pSiS->VBFlags & VB_301C) && (SiS_Pr->CP_Clock[i] > 162500)) || - ((!(pSiS->VBFlags & VB_301C)) && (SiS_Pr->CP_Clock[i] > 108500))) || + ((!(pSiS->VBFlags & VB_301C)) && (SiS_Pr->CP_Clock[i] > 108200))) || (buffer[index + 17] & 0x80)) { SiS_Pr->CP_DataValid[i] = FALSE; @@ -10613,7 +10651,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x36,0xf0,paneltype); SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,0xf1,cr37); SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x32,0x08); -#ifdef TWDEBUG +#ifdef TWDEBUG xf86DrvMsgVerb(pSiS->pScrn->scrnIndex, X_PROBED, 3, "CRT2: [DDC LCD results: 0x%02x, 0x%02x]\n", paneltype, cr37); #endif @@ -10968,7 +11006,7 @@ GetTVPtrIndex(SiS_Private *SiS_Pr) index = 0; if(SiS_Pr->SiS_TVMode & TVSetPAL) index++; - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) index++; /* Hivision TV use PAL */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) index++; /* YPbPr TV use PAL */ index <<= 1; @@ -11065,9 +11103,9 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) /* Could we detect a PDC for LCD? If yes, use it */ - if(HwInfo->pdc) { + if(SiS_Pr->PDC) { if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { - SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2d,0x0f,((HwInfo->pdc & 0x0f) << 4)); + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2d,0x0f,((SiS_Pr->PDC & 0x0f) << 4)); } return; } @@ -11268,7 +11306,7 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) if(IS_SIS650 && (SiS_Pr->SiS_VBType & VB_SIS301LV302LV) && dochiptest) { temp = (SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) & 0xf0) >> 4; - if(temp == 8) { /* 1400x1050 BIOS (ECS) */ + if(temp == 8) { /* 1400x1050 BIOS (COMPAL) */ delay &= 0x0f; delay |= 0xb0; } else if(temp == 6) { @@ -11440,10 +11478,10 @@ SetYFilter(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, temp = GetTVPtrIndex(SiS_Pr); temp >>= 1; /* 0: NTSC, 1: PAL, 2: HiTV */ - if(SiS_Pr->SiS_TVMode & TVSetNTSCJ) temp = 1; /* NTSC-J uses PAL */ - else if(SiS_Pr->SiS_TVMode & TVSetPALM) temp = 3; /* PAL-M */ - else if(SiS_Pr->SiS_TVMode & TVSetPALN) temp = 4; /* PAL-N */ - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) temp = 1; /* Hivision TV uses PAL */ + if(SiS_Pr->SiS_TVMode & TVSetNTSCJ) temp = 1; /* NTSC-J uses PAL */ + else if(SiS_Pr->SiS_TVMode & TVSetPALM) temp = 3; /* PAL-M */ + else if(SiS_Pr->SiS_TVMode & TVSetPALN) temp = 4; /* PAL-N */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) temp = 1; /* YPbPr TV uses PAL */ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { for(i=0x35, j=0; i<=0x38; i++, j++) { @@ -11612,8 +11650,8 @@ SetDelayComp661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo, delay = myptr[index]; if(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x13) & 0x04) delay >>= 4; /* Should test dual edge */ } else if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { - if(HwInfo->pdc) { - delay = HwInfo->pdc & 0x0f; + if(SiS_Pr->PDC) { + delay = SiS_Pr->PDC & 0x0f; if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { delay |= (delay << 12); } @@ -12064,7 +12102,7 @@ SetOEMLCDDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, * Thus we don't set this if the user select a custom pdc or if * we otherwise detected a valid pdc. */ - if(HwInfo->pdc) return; + if(SiS_Pr->PDC) return; temp = GetOEMLCDPtr(SiS_Pr,HwInfo, 0); @@ -12158,7 +12196,7 @@ GetOEMTVPtr(SiS_Private *SiS_Pr) if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) index += 4; if(SiS_Pr->SiS_VBType & VB_SISVB) { if(SiS_Pr->SiS_VBInfo & SetCRT2ToSCART) index += 2; - else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) index += 3; + else if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) index += 3; else if(SiS_Pr->SiS_TVMode & TVSetPAL) index += 1; } else { if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) index += 2; @@ -12236,7 +12274,7 @@ SetOEMPhaseIncr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; USHORT index,i,j,temp,romptr=0; - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) return; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) return; if(SiS_Pr->SiS_TVMode & (TVSetNTSC1024 | TVSetNTSCJ | TVSetPALM | TVSetPALN)) return; @@ -12277,7 +12315,7 @@ SetOEMYFilter(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; USHORT index,temp,i,j,romptr=0; - if(SiS_Pr->SiS_VBInfo & (SetCRT2ToSCART | SetCRT2ToHiVisionTV)) return; + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToSCART | SetCRT2ToYPbPr)) return; if((ROMAddr) && SiS_Pr->SiS_UseROM) { if(!(ROMAddr[0x238] & 0x01)) return; diff --git a/src/init301.h b/src/init301.h index 757cc36..e9c8f3a 100644 --- a/src/init301.h +++ b/src/init301.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h,v 1.33 2003/11/20 19:53:23 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h,v 1.35 2003/12/02 12:15:32 twini Exp $ */ /* * Data and prototypes for init301.c * @@ -65,7 +65,7 @@ #endif #endif -const UCHAR SiS_HiVisionTable[3][64] = { +const UCHAR SiS_YPbPrTable[3][64] = { { 0x17, 0x1d, 0x03, 0x09, 0x05, 0x06, 0x0c, 0x0c, 0x94, 0x49, 0x01, 0x0a, 0x06, 0x0d, 0x04, 0x0a, @@ -206,7 +206,7 @@ void SiS_SetChrontelGPIO(SiS_Private *SiS_Pr, USHORT myvbinfo); void SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,PSIS_HW_INFO HwInfo, int checkcrt2mode); -void SiS_SetHiVision(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo); +void SiS_SetYPbPr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo); void SiS_SetTVMode(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_INFO HwInfo); void SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_INFO HwInfo); USHORT SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, diff --git a/src/initdef.h b/src/initdef.h index 5dc509f..c2b8110 100644 --- a/src/initdef.h +++ b/src/initdef.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h,v 1.24 2003/11/19 00:49:03 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h,v 1.26 2003/11/29 12:08:02 twini Exp $ */ /* * Global definitions for init.c and init301.c * @@ -75,8 +75,9 @@ #define SetCRT2ToSCART 0x0010 #define SetCRT2ToLCD 0x0020 #define SetCRT2ToRAMDAC 0x0040 -#define SetCRT2ToHiVisionTV 0x0080 -#define SetCRT2ToTV 0x009C /* alias */ +#define SetCRT2ToYPbPr 0x0080 /* Needs change in sis_vga.c if changed (GPIO) */ +#define SetCRT2ToTV (SetCRT2ToYPbPr | SetCRT2ToSCART | SetCRT2ToSVIDEO | SetCRT2ToAVIDEO) +#define SetCRT2ToTVNoYPbPr (SetCRT2ToSCART | SetCRT2ToSVIDEO | SetCRT2ToAVIDEO) #define SetNTSCTV 0x0000 /* CR 31 */ #define SetPALTV 0x0100 /* Deprecated here, now in TVMode */ #define SetInSlaveMode 0x0200 @@ -120,8 +121,9 @@ #define SupportTV 0x0008 #define SupportTV1024 0x0800 #define SupportCHTV 0x0800 -#define SupportHiVisionTV 0x0010 -#define SupportHiVisionTV2 0x1000 +#define Support64048060Hz 0x0800 /* Special for 640x480 LCD */ +#define SupportYPbPr 0x0010 +#define SupportYPbPr2 0x1000 #define SupportLCD 0x0020 #define SupportRAMDAC2 0x0040 /* All (<= 100Mhz) */ #define SupportRAMDAC2_135 0x0100 /* All except DH (<= 135Mhz) */ @@ -154,6 +156,13 @@ #define TVRPLLDIV2XO 0x1000 #define TVSetNTSC1024 0x2000 +/* YPbPr flag (YPbPr not supported yet) */ +#define YPbPr750 0x0001 /* 750p (must be a single bit, checked logially) */ +#define YPbPr525 0x0002 /* 525p (must be a single bit, checked logially) */ +#define YPbPrHiVision 0x0003 /* old HiVision */ +#define YPbPrModeMask (YPbPr750 | YPbPr525 | YPbPrHiVision) +#define YPbPrSetSVideo 0x0004 /* (sets SVIDEO flag) */ + /* SysFlags (to identify special versions) */ #define SF_Is651 0x0001 #define SF_IsM650 0x0002 @@ -243,14 +252,15 @@ #define LCDSyncShift 6 /* CR38 (315 series) */ -#define EnableDualEdge 0x01 -#define SetToLCDA 0x02 /* LCD channel A (302B/30xLV and 650+LVDS only) */ -#define EnableSiSHiVision 0x04 /* HiVision (HDTV) on SiS bridge */ -#define EnableLVDSScart 0x04 /* Scart on Ch7019 (unofficial definition - TW) */ -#define EnableLVDSHiVision 0x08 /* YPbPr color format (480i HDTV); only on 650/Ch7019 systems */ -#define EnableHiVision750 0x08 /* Enable 750P HiVision mode (30xLV only) */ -#define EnableHiVision525 0x10 /* Enable 525P HiVision mode (30xLV only) */ -#define SiSHiVision2 0x20 /* ? - | --- mask 0x38 combinations have different meaning! */ +#define EnableDualEdge 0x01 +#define SetToLCDA 0x02 /* LCD channel A (301C/302B/30x(E)LV and 650+LVDS only) */ +#define EnableSiSYPbPr 0x04 /* YPbPr on SiS bridge (not used) */ +#define EnableCHScart 0x04 /* Scart on Ch7019 (unofficial definition - TW) */ +#define EnableCHYPbPr 0x08 /* YPbPr on Ch7019 (480i HDTV); only on 650/Ch7019 systems */ +#define EnableYPbPr750 0x08 /* Enable 750P YPbPr mode (30xLV/301C only) (not supported) */ +#define EnableYPbPr525 0x10 /* Enable 525P YPbPr mode (30xLV/301C only) (not supported) */ +#define EnableYPbPrHiVision 0x18 /* Enable HiVision (not supported) */ +#define EnableYPbPrsetSVideo 0x20 /* Enable YPbPr and set SVideo */ #define EnablePALM 0x40 /* 1 = Set PALM */ #define EnablePALN 0x80 /* 1 = Set PALN */ #define EnableNTSCJ EnablePALM /* Not BIOS */ @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h,v 1.88 2003/11/20 19:53:23 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h,v 1.93 2003/12/02 12:15:32 twini Exp $ */ /* * Main global data and definitions * @@ -35,8 +35,8 @@ #define UNLOCK_ALWAYS #define SISDRIVERVERSIONYEAR 3 -#define SISDRIVERVERSIONMONTH 11 -#define SISDRIVERVERSIONDAY 19 +#define SISDRIVERVERSIONMONTH 12 +#define SISDRIVERVERSIONDAY 2 #define SISDRIVERREVISION 1 #define SISDRIVERIVERSION (SISDRIVERVERSIONYEAR << 16) | (SISDRIVERVERSIONMONTH << 8) \ @@ -181,9 +181,9 @@ #define DISPTYPE_DISP2 CRT2_ENABLE #define TV_NTSC 0x00000010 #define TV_PAL 0x00000020 -#define TV_HIVISION 0x00000040 -#define TV_HIVISION_LV 0x00000080 -#define TV_TYPE (TV_NTSC | TV_PAL | TV_HIVISION | TV_HIVISION_LV) +#define TV_HIVISION 0x00000040 /* Not supported */ +#define TV_YPBPR 0x00000080 /* Not supported */ +#define TV_TYPE (TV_NTSC | TV_PAL | TV_HIVISION | TV_YPBPR) #define TV_AVIDEO 0x00000100 #define TV_SVIDEO 0x00000200 #define TV_SCART 0x00000400 @@ -379,7 +379,7 @@ typedef struct { unsigned char sisCapt[0x60]; unsigned char sisVid[0x50]; unsigned char VBPart1[0x50]; - unsigned char VBPart2[0x50]; + unsigned char VBPart2[0x100]; unsigned char VBPart3[0x50]; unsigned char VBPart4[0x50]; unsigned short ch70xx[64]; @@ -455,7 +455,6 @@ typedef struct { int OptTVSOver; int OptROMUsage; int OptUseOEM; - int PDC; Bool NoAccel; int forceCRT1; int DSTN, FSTN; @@ -796,6 +795,9 @@ typedef struct { unsigned char sisfblcda; int sisfbscalelcd; unsigned long sisfbspecialtiming; + BOOL sisfb_haveemi; + unsigned char sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33; + int EMI; int NoYV12; /* Disable Xv YV12 support (old series) */ unsigned char postVBCR32; int newFastVram; /* Replaces FastVram */ diff --git a/src/sis_dac.c b/src/sis_dac.c index 6a429e7..6d1a88e 100644 --- a/src/sis_dac.c +++ b/src/sis_dac.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c,v 1.49 2003/11/19 21:27:41 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c,v 1.51 2003/11/30 22:29:52 twini Exp $ */ /* * DAC helper functions (Save/Restore, MemClk, etc) * @@ -1037,13 +1037,14 @@ SiS301BSave(ScrnInfoPtr pScrn, SISRegPtr sisReg) SISPtr pSiS = SISPTR(pScrn); int Part1max, Part2max, Part3max, Part4max; - Part1max = 0x37; /* 0x23, but we also need 2c-2e, 35-37 */ + Part1max = 0x4c; Part2max = 0x4d; Part3max = 0x3e; - if(pSiS->VBFlags & (VB_301LV|VB_302LV|VB_302ELV)) + Part4max = 0x23; + if(pSiS->VBFlags & (VB_301C|VB_302ELV)) + Part2max = 0xff; + if(pSiS->VBFlags & (VB_301C|VB_301LV|VB_302LV|VB_302ELV)) Part4max = 0x34; - else - Part4max = 0x23; SiSVBSave(pScrn, sisReg, Part1max, Part2max, Part3max, Part4max); @@ -1061,10 +1062,11 @@ SiS301BRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg) Part1max = 0x23; Part2max = 0x4d; Part3max = 0x3e; + Part4max = 0x22; + if(pSiS->VBFlags & (VB_301C|VB_302ELV)) + Part2max = 0xff; if(pSiS->VBFlags & (VB_301LV|VB_302LV|VB_302ELV)) Part4max = 0x24; - else - Part4max = 0x22; SiS_DisableBridge(pSiS->SiS_Pr, &pSiS->sishw_ext); @@ -1393,7 +1395,7 @@ SiSMclk(SISPtr pSiS) * For VGA2, we share the bandwith equally. */ static int -SiSEstimateCRT2Clock(ScrnInfoPtr pScrn) +SiSEstimateCRT2Clock(ScrnInfoPtr pScrn, BOOLEAN IsForMergedFBCRT2) { SISPtr pSiS = SISPTR(pScrn); @@ -1404,7 +1406,11 @@ SiSEstimateCRT2Clock(ScrnInfoPtr pScrn) return 65000; else if(pSiS->VBLCDFlags & VB_LCD_1280x768) return 81000; - else if(pSiS->VBLCDFlags & (VB_LCD_1280x1024 | VB_LCD_1280x960 | VB_LCD_1400x1050)) + else if(pSiS->VBLCDFlags & VB_LCD_1400x1050) { + /* Must fake clock; built-in mode shows 122 for VGA, but uses only 108 for LCD */ + if(IsForMergedFBCRT2) return 123000; + else return 108000; + } else if(pSiS->VBLCDFlags & (VB_LCD_1280x1024 | VB_LCD_1280x960)) return 108000; else if(pSiS->VBLCDFlags & VB_LCD_1600x1200) return 162000; @@ -1538,7 +1544,7 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, BOOLEAN IsForCRT2) 301B anyway */ crt2used = 0.0; - crt2clock = SiSEstimateCRT2Clock(pScrn); + crt2clock = SiSEstimateCRT2Clock(pScrn, IsForCRT2); if(crt2clock) { crt2used = crt2clock + 2000; } diff --git a/src/sis_driver.c b/src/sis_driver.c index 833e3c3..737183a 100644 --- a/src/sis_driver.c +++ b/src/sis_driver.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.156 2003/11/20 19:53:23 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.160 2003/12/02 12:15:32 twini Exp $ */ /* * Copyright 2001, 2002, 2003 by Thomas Winischhofer, Vienna, Austria. * @@ -2675,6 +2675,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->sisfblcda = 0xff; pSiS->sisfbscalelcd = -1; pSiS->sisfbspecialtiming = CUT_NONE; + pSiS->sisfb_haveemi = FALSE; pSiS->OldMode = 0; pSiS->sisfbfound = FALSE; @@ -2764,6 +2765,13 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) if(pSiS->VGAEngine == SIS_315_VGA) { pSiS->donttrustpdc = FALSE; pSiS->sisfbpdc = mysisfbinfo.sisfb_lcdpdc; + if(sisfbversion >= 0x010618) { + pSiS->sisfb_haveemi = mysisfbinfo.sisfb_haveemi ? TRUE : FALSE; + pSiS->sisfb_emi30 = mysisfbinfo.sisfb_emi30; + pSiS->sisfb_emi31 = mysisfbinfo.sisfb_emi31; + pSiS->sisfb_emi32 = mysisfbinfo.sisfb_emi32; + pSiS->sisfb_emi33 = mysisfbinfo.sisfb_emi33; + } } } } @@ -2871,7 +2879,11 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->SiS_Pr->SiS_ChSW = FALSE; pSiS->SiS_Pr->SiS_CustomT = CUT_NONE; pSiS->SiS_Pr->CRT1UsesCustomMode = FALSE; + pSiS->SiS_Pr->PDC = 0; pSiS->SiS_Pr->LVDSHL = -1; + pSiS->SiS_Pr->HaveEMI = FALSE; + pSiS->SiS_Pr->HaveEMILCD = FALSE; + pSiS->SiS_Pr->OverruleEMI = FALSE; } /* Get our relocated IO registers */ @@ -3219,7 +3231,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiSEnt->ForceCRT2Type = pSiS->ForceCRT2Type; pSiSEnt->ForceTVType = pSiS->ForceTVType; pSiSEnt->UsePanelScaler = pSiS->UsePanelScaler; - pSiSEnt->PDC = pSiS->PDC; pSiSEnt->DSTN = pSiS->DSTN; pSiSEnt->OptTVStand = pSiS->OptTVStand; pSiSEnt->NonDefaultPAL = pSiS->NonDefaultPAL; @@ -3291,7 +3302,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->ForceCRT1Type = pSiSEnt->ForceCRT1Type; pSiS->ForceCRT2Type = pSiSEnt->ForceCRT2Type; pSiS->UsePanelScaler = pSiSEnt->UsePanelScaler; - pSiS->PDC = pSiSEnt->PDC; pSiS->DSTN = pSiSEnt->DSTN; pSiS->OptTVStand = pSiSEnt->OptTVStand; pSiS->NonDefaultPAL = pSiSEnt->NonDefaultPAL; @@ -4305,139 +4315,170 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->VBFlags_backup = pSiS->VBFlags; /* Find out about paneldelaycompensation and evaluate option */ - pSiS->sishw_ext.pdc = 0; - - if(pSiS->VGAEngine == SIS_300_VGA) { - if(pSiS->VBFlags & (VB_LVDS | VB_30xBDH)) { - /* Save the current PDC if the panel is used at the moment. - * This seems by far the safest way to find out about it. - * If the system is using an old version of sisfb, we can't - * trust the pdc register value. If sisfb saved the pdc for - * us, use it. - */ - if(pSiS->sisfbpdc) { - pSiS->sishw_ext.pdc = pSiS->sisfbpdc; - } else { - if(!(pSiS->donttrustpdc)) { - unsigned char tmp; - inSISIDXREG(SISCR, 0x30, tmp); - if(tmp & 0x20) { - inSISIDXREG(SISPART1, 0x13, pSiS->sishw_ext.pdc); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Unable to detect LCD PanelDelayCompensation, LCD is not active\n"); - } - } else { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Unable to detect LCD PanelDelayCompensation, please update sisfb\n"); - } - } - pSiS->sishw_ext.pdc &= 0x3c; - if(pSiS->sishw_ext.pdc) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected LCD PanelDelayCompensation %d\n", - pSiS->sishw_ext.pdc); - } +#ifdef SISDUALHEAD + if((!pSiS->DualHeadMode) || (!pSiS->SecondHead)) { +#endif + if(pSiS->VGAEngine == SIS_300_VGA) { - /* If we haven't been able to find out, use our other methods */ - if(pSiS->sishw_ext.pdc == 0) { + if(pSiS->VBFlags & (VB_LVDS | VB_30xBDH)) { + + /* Save the current PDC if the panel is used at the moment. + * This seems by far the safest way to find out about it. + * If the system is using an old version of sisfb, we can't + * trust the pdc register value. If sisfb saved the pdc for + * us, use it. + */ + if(pSiS->sisfbpdc) { + pSiS->SiS_Pr->PDC = pSiS->sisfbpdc; + } else { + if(!(pSiS->donttrustpdc)) { + unsigned char tmp; + inSISIDXREG(SISCR, 0x30, tmp); + if(tmp & 0x20) { + inSISIDXREG(SISPART1, 0x13, pSiS->SiS_Pr->PDC); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Unable to detect LCD PanelDelayCompensation, LCD is not active\n"); + } + } else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Unable to detect LCD PanelDelayCompensation, please update sisfb\n"); + } + } + pSiS->SiS_Pr->PDC &= 0x3c; + if(pSiS->SiS_Pr->PDC) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected LCD PanelDelayCompensation 0x%02x\n", + pSiS->SiS_Pr->PDC); + } - int i=0; - do { - if(mypdctable[i].subsysVendor == pSiS->PciInfo->subsysVendor && - mypdctable[i].subsysCard == pSiS->PciInfo->subsysCard) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, + /* If we haven't been able to find out, use our other methods */ + if(pSiS->SiS_Pr->PDC == 0) { + int i=0; + do { + if(mypdctable[i].subsysVendor == pSiS->PciInfo->subsysVendor && + mypdctable[i].subsysCard == pSiS->PciInfo->subsysCard) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PCI card/vendor identified for non-default PanelDelayCompensation\n"); - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Vendor: %s, card: %s (ID %04x), PanelDelayCompensation: %d\n", + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Vendor: %s, card: %s (ID %04x), PanelDelayCompensation: 0x%02x\n", mypdctable[i].vendorName, mypdctable[i].cardName, pSiS->PciInfo->subsysCard, mypdctable[i].pdc); - if(pSiS->PDC == -1) { - pSiS->PDC = mypdctable[i].pdc; - } else { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + if(pSiS->PDC == -1) { + pSiS->PDC = mypdctable[i].pdc; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "PanelDelayCompensation overruled by option\n"); - } - break; - } - i++; - } while(mypdctable[i].subsysVendor != 0); - - } + } + break; + } + i++; + } while(mypdctable[i].subsysVendor != 0); + } - if(pSiS->PDC != -1) { - if(pSiS->BIOS) { - if(pSiS->VBFlags & VB_LVDS) { - if(pSiS->BIOS[0x220] & 0x80) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "BIOS contains custom LCD Panel Delay Compensation %d\n", + if(pSiS->PDC != -1) { + if(pSiS->BIOS) { + if(pSiS->VBFlags & VB_LVDS) { + if(pSiS->BIOS[0x220] & 0x80) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "BIOS contains custom LCD Panel Delay Compensation 0x%02x\n", pSiS->BIOS[0x220] & 0x3c); - pSiS->BIOS[0x220] &= 0x7f; - } - } - if(pSiS->VBFlags & (VB_301B|VB_302B)) { - if(pSiS->BIOS[0x220] & 0x80) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "BIOS contains custom LCD Panel Delay Compensation %d\n", + pSiS->BIOS[0x220] &= 0x7f; + } + } + if(pSiS->VBFlags & (VB_301B|VB_302B)) { + if(pSiS->BIOS[0x220] & 0x80) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "BIOS contains custom LCD Panel Delay Compensation 0x%02x\n", ( (pSiS->VBLCDFlags & VB_LCD_1280x1024) ? pSiS->BIOS[0x223] : pSiS->BIOS[0x224] ) & 0x3c); - pSiS->BIOS[0x220] &= 0x7f; - } - } - } - pSiS->sishw_ext.pdc = (pSiS->PDC & 0x3c); - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Using LCD Panel Delay Compensation %d\n", pSiS->PDC); - } - } - } + pSiS->BIOS[0x220] &= 0x7f; + } + } + } + pSiS->SiS_Pr->PDC = (pSiS->PDC & 0x3c); + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Using LCD Panel Delay Compensation 0x%02x\n", pSiS->SiS_Pr->PDC); + } + } - if(pSiS->VGAEngine == SIS_315_VGA) { - if(pSiS->VBFlags & (VB_301LV | VB_302LV | VB_302ELV)) { - /* Save the current PDC if the panel is used at the moment. - * This seems by far the safest way to find out about it. - */ - if(pSiS->sisfbpdc) { - pSiS->sishw_ext.pdc = pSiS->sisfbpdc; - } else { - if(!(pSiS->donttrustpdc)) { - unsigned char tmp; - inSISIDXREG(SISCR, 0x30, tmp); - if(tmp & 0x20) { - inSISIDXREG(SISPART1, 0x2D, pSiS->sishw_ext.pdc); - } else { + } /* SIS_300_VGA */ + + if(pSiS->VGAEngine == SIS_315_VGA) { + + unsigned char tmp; + inSISIDXREG(SISCR, 0x30, tmp); + + if(pSiS->VBFlags & (VB_301LV | VB_302LV | VB_302ELV)) { + /* Save the current PDC if the panel is used at the moment. + * This seems by far the safest way to find out about it. + */ + if(pSiS->sisfbpdc) { + pSiS->SiS_Pr->PDC = pSiS->sisfbpdc; + } else { + if(!(pSiS->donttrustpdc)) { + if(tmp & 0x20) { + inSISIDXREG(SISPART1, 0x2D, pSiS->SiS_Pr->PDC); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Unable to detect LCD PanelDelayCompensation, LCD is not active\n"); + } + } else { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Unable to detect LCD PanelDelayCompensation, LCD is not active\n"); + "Unable to detect LCD PanelDelayCompensation, please update sisfb\n"); } + } + if(pSiS->SiS_Pr->PDC) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected LCD PanelDelayCompensation 0x%02x\n", + pSiS->SiS_Pr->PDC); + } + if(pSiS->PDC != -1) { + pSiS->SiS_Pr->PDC = pSiS->PDC & 0xff; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Using LCD PanelDelayCompensation 0x%02x\n", + pSiS->SiS_Pr->PDC); + } + } + + /* Read the current EMI (if not overruled) */ + if(pSiS->VBFlags & (VB_302LV | VB_302ELV)) { + MessageType from = X_PROBED; + if(pSiS->EMI != -1) { + pSiS->SiS_Pr->EMI_30 = (pSiS->EMI >> 24) & 0x60; + pSiS->SiS_Pr->EMI_31 = (pSiS->EMI >> 16) & 0xff; + pSiS->SiS_Pr->EMI_32 = (pSiS->EMI >> 8) & 0xff; + pSiS->SiS_Pr->EMI_33 = pSiS->EMI & 0xff; + pSiS->SiS_Pr->HaveEMI = pSiS->SiS_Pr->HaveEMILCD = TRUE; + pSiS->SiS_Pr->OverruleEMI = TRUE; + from = X_CONFIG; + } else if((pSiS->sisfbfound) && (pSiS->sisfb_haveemi)) { + pSiS->SiS_Pr->EMI_30 = pSiS->sisfb_emi30; + pSiS->SiS_Pr->EMI_31 = pSiS->sisfb_emi31; + pSiS->SiS_Pr->EMI_32 = pSiS->sisfb_emi32; + pSiS->SiS_Pr->EMI_33 = pSiS->sisfb_emi33; + pSiS->SiS_Pr->HaveEMI = pSiS->SiS_Pr->HaveEMILCD = TRUE; + pSiS->SiS_Pr->OverruleEMI = FALSE; } else { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Unable to detect LCD PanelDelayCompensation, please update sisfb\n"); + inSISIDXREG(SISPART4, 0x30, pSiS->SiS_Pr->EMI_30); + inSISIDXREG(SISPART4, 0x31, pSiS->SiS_Pr->EMI_31); + inSISIDXREG(SISPART4, 0x32, pSiS->SiS_Pr->EMI_32); + inSISIDXREG(SISPART4, 0x33, pSiS->SiS_Pr->EMI_33); + pSiS->SiS_Pr->HaveEMI = TRUE; + if(tmp & 0x20) pSiS->SiS_Pr->HaveEMILCD = TRUE; + pSiS->SiS_Pr->OverruleEMI = FALSE; } + xf86DrvMsg(pScrn->scrnIndex, from, + "302LV/302ELV: Using EMI 0x%02x%02x%02x%02x%s\n", + pSiS->SiS_Pr->EMI_30,pSiS->SiS_Pr->EMI_31, + pSiS->SiS_Pr->EMI_32,pSiS->SiS_Pr->EMI_33, + pSiS->SiS_Pr->HaveEMILCD ? " (LCD)" : ""); } - if(pSiS->sishw_ext.pdc) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected LCD PanelDelayCompensation %d\n", - pSiS->sishw_ext.pdc); - } - if(pSiS->PDC != -1) { - pSiS->sishw_ext.pdc = pSiS->PDC & 0xff; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Using LCD PanelDelayCompensation %d\n", - pSiS->sishw_ext.pdc); - } - } else if(pSiS->Chipset == PCI_CHIP_SIS660) { - /* Since I have no idea about the required PDC on - * the new chips, let the user specify one. But - * we only use the lower nibble. - */ - if(pSiS->PDC != -1) { - pSiS->sishw_ext.pdc = pSiS->PDC & 0x0f; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Using LCD PanelDelayCompensation %d\n", - pSiS->sishw_ext.pdc); - } - } + + } /* SIS_315_VGA */ +#ifdef SISDUALHEAD } +#endif #ifdef SISDUALHEAD /* In dual head mode, both heads (currently) share the maxxfbmem equally. @@ -6048,6 +6089,7 @@ SISSpecialRestore(ScrnInfoPtr pScrn) if(!(pSiS->ChipFlags & SiSCF_Is65x)) return; inSISIDXREG(SISCR, 0x34, temp); + temp &= 0x7f; if(temp > 0x13) return; #ifdef UNLOCK_ALWAYS @@ -6543,6 +6585,7 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) * bridge... */ inSISIDXREG(SISCR, 0x34, pSiS->OldMode); + pSiS->OldMode &= 0x7f; inSISIDXREG(SISCR, 0x30, cr30); inSISIDXREG(SISCR, 0x31, cr31); @@ -7676,6 +7719,10 @@ SISEnterVT(int scrnIndex, int flags) sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); + if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) { + andSISIDXREG(SISCR,0x34,0x7f); + } + if(!SISModeInit(pScrn, pScrn->currentMode)) { SISErrorLog(pScrn, "SiSEnterVT: SISModeInit() failed\n"); return FALSE; @@ -10222,7 +10269,7 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val) if(pSiSEnt) pSiSEnt->tvyscale = val; #endif - if(pSiS->VBFlags & (TV_HIVISION | TV_HIVISION_LV)) return; + if(pSiS->VBFlags & (TV_HIVISION | TV_YPBPR)) return; if(pSiS->VGAEngine == SIS_315_VGA || pSiS->VGAEngine == SIS_315_VGA) { diff --git a/src/sis_driver.h b/src/sis_driver.h index 4c085ef..914aebd 100644 --- a/src/sis_driver.h +++ b/src/sis_driver.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h,v 1.27 2003/11/19 00:49:05 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h,v 1.29 2003/11/29 12:08:02 twini Exp $ */ /* * Global data and definitions * @@ -141,24 +141,24 @@ const customttable mycustomttable[] = { "Inventec (Compaq)", "3017cl/3045US", CUT_COMPAQ12802, "COMPAQ_1280" }, { SIS_650, "", "", - 0, + 0, /* Special 1024x768 / dual link */ { 0x00c, 0, 0, 0, 0 }, { 'e' , 0, 0, 0, 0 }, 0x1558, 0x0287, "Clevo", "L285/L287 (Version 1)", CUT_CLEVO1024, "CLEVO_L28X_1" }, { SIS_650, "", "", - 0, + 0, /* Special 1024x768 / single link */ { 0x00c, 0, 0, 0, 0 }, { 'y' , 0, 0, 0, 0 }, 0x1558, 0x0287, "Clevo", "L285/L287 (Version 2)", CUT_CLEVO10242, "CLEVO_L28X_2" }, { SIS_650, "", "", - 0, + 0, /* Special 1400x1050 */ { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 }, - 0x1558, 0x0400, /* possibly 401 and 402 as well; not panelsize specific (?) */ + 0x1558, 0x0400, /* possibly 401 and 402 as well; not panelsize specific? */ "Clevo", "D400S/D410S/D400H/D410H", CUT_CLEVO1400, "CLEVO_D4X0" }, { SIS_650, "", "", @@ -196,6 +196,34 @@ const customttable mycustomttable[] = { 0x1043, 0x1612, "Asus", "L3000D/L3500D", CUT_ASUSL3000D, "ASUS_L3X00" }, + { SIS_650, "1.10.9k", "", + 0, /* For EMI */ + { 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0 }, + 0x1025, 0x0028, + "Acer", "Aspire 1700", CUT_ACER1280, "ACER_ASPIRE1700" + }, + { SIS_650, "1.10.7w", "", + 0, /* For EMI */ + { 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0 }, + 0x14c0, 0x0012, + "Compal", "??? (V1)", CUT_COMPAL1400_1, "COMPAL_1400_1" + }, + { SIS_650, "1.10.7x", "", + 0, /* For EMI */ + { 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0 }, + 0x14c0, 0x0012, + "Compal", "??? (V2)", CUT_COMPAL1400_2, "COMPAL_1400_2" + }, + { SIS_650, "1.10.8o", "", + 0, /* For EMI (unknown) */ + { 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0 }, + 0x1043, 0x1612, + "Asus", "A2H", CUT_ASUSA2H, "ASUS_A2H" + }, { 4321, "", "", /* never autodetected */ 0, { 0, 0, 0, 0, 0 }, diff --git a/src/sis_opt.c b/src/sis_opt.c index add8168..808b3cc 100644 --- a/src/sis_opt.c +++ b/src/sis_opt.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c,v 1.45 2003/11/11 18:04:31 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c,v 1.49 2003/12/02 12:15:33 twini Exp $ */ /* * SiS driver option evaluation * @@ -58,6 +58,7 @@ typedef enum { OPTION_FORCECRT1, OPTION_XVONCRT2, OPTION_PDC, + OPTION_EMI, OPTION_TVSTANDARD, OPTION_USEROMDATA, OPTION_NOINTERNALMODES, @@ -160,6 +161,9 @@ static const OptionInfoRec SISOptions[] = { { OPTION_FORCECRT1, "ForceCRT1", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_XVONCRT2, "XvOnCRT2", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_PDC, "PanelDelayCompensation", OPTV_INTEGER, {0}, -1 }, + { OPTION_EMI, "EMI", OPTV_INTEGER, {0}, -1 }, + { OPTION_LVDSHL, "LVDSHL", OPTV_INTEGER, {0}, -1 }, + { OPTION_SPECIALTIMING, "SpecialTiming", OPTV_STRING, {0}, -1 }, { OPTION_TVSTANDARD, "TVStandard", OPTV_STRING, {0}, -1 }, { OPTION_USEROMDATA, "UseROMData", OPTV_BOOLEAN, {0}, -1 }, { OPTION_NOINTERNALMODES, "NoInternalModes", OPTV_BOOLEAN, {0}, FALSE }, @@ -218,8 +222,6 @@ static const OptionInfoRec SISOptions[] = { { OPTION_XVMEMCPY, "XvUseMemcpy", OPTV_BOOLEAN, {0}, -1 }, { OPTION_SCALELCD, "ScaleLCD", OPTV_BOOLEAN, {0}, -1 }, { OPTION_ENABLEHOTKEY, "EnableHotkey", OPTV_BOOLEAN, {0}, -1 }, - { OPTION_SPECIALTIMING, "SpecialTiming", OPTV_STRING, {0}, -1 }, - { OPTION_LVDSHL, "LVDSHL", OPTV_INTEGER, {0}, -1 }, { OPTION_ENABLESISCTRL, "EnableSiSCtrl", OPTV_BOOLEAN, {0}, -1 }, #ifdef SISMERGED { OPTION_MERGEDFB, "MergedFB", OPTV_BOOLEAN, {0}, FALSE }, @@ -235,7 +237,7 @@ static const OptionInfoRec SISOptions[] = { { OPTION_MERGEDDPI, "MergedDPI", OPTV_STRING, {0}, FALSE }, #ifdef SISXINERAMA { OPTION_NOSISXINERAMA, "NoMergedXinerama", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_NOSISXINERAMA2, "NoTwinviewXineramaInfo", OPTV_BOOLEAN, {0}, FALSE }, /* alias */ + { OPTION_NOSISXINERAMA2, "NoTwinviewXineramaInfo", OPTV_BOOLEAN, {0}, FALSE }, /* alias */ { OPTION_CRT2ISSCRN0, "MergedXineramaCRT2IsScreen0",OPTV_BOOLEAN,{0},FALSE }, #endif #endif @@ -250,7 +252,6 @@ SiSOptions(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); MessageType from; -/* double temp; */ char *strptr; static const char *mybadparm = "\"%s\" is is not a valid parameter for option \"%s\"\n"; static const char *disabledstr = "disabled"; @@ -271,7 +272,6 @@ SiSOptions(ScrnInfoPtr pScrn) pSiS->newFastVram = -1; pSiS->NoHostBus = FALSE; -/* pSiS->UsePCIRetry = TRUE; */ pSiS->TurboQueue = TRUE; #ifdef SISVRAMQ /* TODO: Option (315 series VRAM command queue) */ @@ -282,7 +282,7 @@ SiSOptions(ScrnInfoPtr pScrn) pSiS->HWCursor = TRUE; pSiS->Rotate = FALSE; pSiS->ShadowFB = FALSE; - pSiS->loadDRI = TRUE; + pSiS->loadDRI = FALSE; pSiS->agpWantedPages = AGP_PAGES; pSiS->VESA = -1; pSiS->NoXvideo = FALSE; @@ -293,6 +293,7 @@ SiSOptions(ScrnInfoPtr pScrn) pSiS->XvOnCRT2 = FALSE; pSiS->NoYV12 = -1; pSiS->PDC = -1; + pSiS->EMI = -1; pSiS->OptTVStand = -1; pSiS->OptROMUsage = -1; pSiS->noInternalModes = FALSE; @@ -394,6 +395,14 @@ SiSOptions(ScrnInfoPtr pScrn) pSiS->HWCursor = FALSE; } + /* DRI only supported on 300 series, + * so don't load DRI by default on + * others. + */ + if(pSiS->VGAEngine == SIS_300_VGA) { + pSiS->loadDRI = TRUE; + } + #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0) pSiS->OptUseColorCursor = 0; #else @@ -405,6 +414,7 @@ SiSOptions(ScrnInfoPtr pScrn) pSiS->OptUseColorCursor = 1; } #endif + if(pSiS->VGAEngine == SIS_300_VGA) { pSiS->AllowHotkey = 0; } else if(pSiS->VGAEngine == SIS_315_VGA) { @@ -732,6 +742,9 @@ SiSOptions(ScrnInfoPtr pScrn) if(xf86GetOptValInteger(pSiS->Options, OPTION_PDC, &vali)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "PanelDelayCompensation"); } + if(xf86GetOptValInteger(pSiS->Options, OPTION_EMI, &vali)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "EMI"); + } if(xf86GetOptValString(pSiS->Options, OPTION_SPECIALTIMING)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "SpecialTiming"); } @@ -911,7 +924,7 @@ SiSOptions(ScrnInfoPtr pScrn) /* ForceCRT1Type (315/330 series only) * Used for forcing the driver to initialize CRT1 as * VGA (analog) or LCDA (for simultanious LCD and TV - * display) - on M650/651 with 30xLV only! + * display) - on M650/651 and 661 or later with 301C/30xLV only! */ if(pSiS->VGAEngine == SIS_315_VGA) { strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_FORCE_CRT1TYPE); @@ -1104,6 +1117,28 @@ SiSOptions(ScrnInfoPtr pScrn) } } + /* EMI (315/330 series + 302LV/302ELV bridge only) + * This might be required if the LCD panel loses sync on + * mode switches. So far, this problem should not show up + * due to the auto-detection (from reading the values set + * by the BIOS; however, the BIOS values are wrong sometimes + * such as in the case of some Compal machines with a + * 1400x1050, or some Inventec(Compaq) machines with a + * 1280x1024 panel. + * The parameter is an integer from 0 to 0x60ffffff. + */ + if(xf86GetOptValInteger(pSiS->Options, OPTION_EMI, &pSiS->EMI)) { + if((pSiS->EMI < 0) || (pSiS->EMI > 0x60ffffff)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Illegal EMI parameter, valid is 0 through 0x60ffffff\n"); + pSiS->EMI = -1; + } else { + pSiS->EMI &= 0x60ffffff; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "EMI will be 0x%04x\n", pSiS->EMI); + } + } + } @@ -1158,7 +1193,7 @@ SiSOptions(ScrnInfoPtr pScrn) /* CHTVType (315/330 series only) * Used for telling the driver if the TV output shall - * be i480 HDTV or SCART. + * be 480i HDTV or SCART. */ if(pSiS->VGAEngine == SIS_315_VGA) { strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CHTVTYPE); diff --git a/src/sis_vb.c b/src/sis_vb.c index cbfeb07..99c49b9 100644 --- a/src/sis_vb.c +++ b/src/sis_vb.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c,v 1.31 2003/11/19 00:49:06 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c,v 1.32 2003/11/23 19:44:26 twini Exp $ */ /* * Video bridge detection and configuration for 300, 315 and 330 series * @@ -388,16 +388,16 @@ void SISTVPreInit(ScrnInfoPtr pScrn) pSiS->VBFlags |= TV_SVIDEO; else if(CR32 & 0x01) pSiS->VBFlags |= TV_AVIDEO; - else if(CR32 & 0x40) + else if((CR32 & 0x40) && (!(pSiS->VBFlags & (VB_301C | VB_301LV | VB_302LV | VB_302ELV)))) pSiS->VBFlags |= (TV_SVIDEO | TV_HIVISION); else if((CR38 & 0x04) && (pSiS->VBFlags & (VB_301C | VB_301LV | VB_302LV | VB_302ELV))) - pSiS->VBFlags |= TV_HIVISION_LV; - else if((CR38 & 0x04) && (pSiS->VBFlags & VB_CHRONTEL)) + pSiS->VBFlags |= TV_YPBPR; + else if((CR38 & 0x04) && (pSiS->VBFlags & VB_CHRONTEL)) pSiS->VBFlags |= (TV_CHSCART | TV_PAL); else if((CR38 & 0x08) && (pSiS->VBFlags & VB_CHRONTEL)) pSiS->VBFlags |= (TV_CHHDTV | TV_NTSC); - if(pSiS->VBFlags & (TV_SCART | TV_SVIDEO | TV_AVIDEO | TV_HIVISION | TV_HIVISION_LV)) { + if(pSiS->VBFlags & (TV_SCART | TV_SVIDEO | TV_AVIDEO | TV_HIVISION | TV_YPBPR)) { if(pSiS->VGAEngine == SIS_300_VGA) { /* TW: Should be SR38, but this does not work. */ if(SR16 & 0x20) @@ -443,7 +443,7 @@ void SISTVPreInit(ScrnInfoPtr pScrn) } } - if(pSiS->VBFlags & (TV_SCART | TV_SVIDEO | TV_AVIDEO | TV_HIVISION | TV_HIVISION_LV | TV_CHSCART | TV_CHHDTV)) { + if(pSiS->VBFlags & (TV_SCART | TV_SVIDEO | TV_AVIDEO | TV_HIVISION | TV_YPBPR | TV_CHSCART | TV_CHHDTV)) { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "%sTV standard %s\n", (pSiS->VBFlags & (TV_CHSCART | TV_CHHDTV)) ? "Using " : "Detected default ", diff --git a/src/sis_vga.c b/src/sis_vga.c index 1e056c7..9eb1bb9 100644 --- a/src/sis_vga.c +++ b/src/sis_vga.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c,v 1.38 2003/11/19 00:49:06 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c,v 1.39 2003/11/24 19:08:53 twini Exp $ */ /* * Mode setup and basic video bridge detection * @@ -1337,9 +1337,10 @@ void SISVGAPreInit(ScrnInfoPtr pScrn) int upperlimitch, lowerlimitch; int chronteltype, chrontelidreg, upperlimitvb; unsigned char test[3]; + static const char *detectvb = "Detected %s video bridge (ID %d; Revision 0x%x)\n"; #if 0 unsigned char sr17=0; -#endif +#endif static const char *ChrontelTypeStr[] = { "7004", "7005", @@ -1396,43 +1397,31 @@ void SISVGAPreInit(ScrnInfoPtr pScrn) if(temp2 == 0xff) { pSiS->VBFlags |= VB_302LV; pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LV; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected SiS302LV video bridge (ID 1; Revision 0x%x)\n", - temp1); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "SiS302LV", 1, temp1); } else { pSiS->VBFlags |= VB_302ELV; pSiS->sishw_ext.ujVBChipID = VB_CHIP_302ELV; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected SiS302ELV video bridge (ID 1; Revision 0x%x)\n", - temp1); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "SiS302ELV", 1, temp1); } } else if(temp1 >= 0xD0) { pSiS->VBFlags |= VB_301LV; pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LV; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected SiS301LV video bridge (ID 1; Revision 0x%x)\n", - temp1); - } else if(temp1 >= 0xC0) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "SiS301LV", 1, temp1); + } else if(temp1 >= 0xC0) { pSiS->VBFlags |= VB_301C; pSiS->sishw_ext.ujVBChipID = VB_CHIP_301C; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected SiS301C video bridge (ID 1; Revision 0x%x)\n", - temp1); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "SiS301C", 1, temp1); } else if(temp1 >= 0xB0) { pSiS->VBFlags |= VB_301B; pSiS->sishw_ext.ujVBChipID = VB_CHIP_301B; inSISIDXREG(SISPART4, 0x23, temp2); if(!(temp2 & 0x02)) pSiS->VBFlags |= VB_30xBDH; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected SiS301B%s video bridge (Revision 0x%x)\n", - (temp2 & 0x02) ? "" : " (DH)", - temp1); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, + (temp2 & 0x02) ? "SiS301B" : "SiS301B-DH", temp1); } else { pSiS->VBFlags |= VB_301; pSiS->sishw_ext.ujVBChipID = VB_CHIP_301; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected SiS301 video bridge (Revision 0x%x)\n", - temp1); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "SiS301", 1, temp1); } SISSense30x(pScrn); @@ -1444,32 +1433,25 @@ void SISVGAPreInit(ScrnInfoPtr pScrn) if(temp1 >= 0xE0) { pSiS->VBFlags |= VB_302LV; pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LV; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected SiS302LV video bridge (ID 2; Revision 0x%x)\n", - temp1); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "SiS302LV", 2, temp1); } else if(temp1 >= 0xD0) { pSiS->VBFlags |= VB_301LV; pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LV; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected SiS301LV video bridge (ID 2; Revision 0x%x)\n", - temp1); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "SiS301LV", 2, temp1); } else { pSiS->VBFlags |= VB_302B; pSiS->sishw_ext.ujVBChipID = VB_CHIP_302B; inSISIDXREG(SISPART4, 0x23, temp2); if(!(temp & 0x02)) pSiS->VBFlags |= VB_30xBDH; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected SiS302B%s video bridge (Revision 0x%x)\n", - (temp2 & 0x02) ? "" : " (DH)", - temp1); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, + (temp2 & 0x02) ? "SiS302B" : "SiS302B-DH", temp1); } SISSense30x(pScrn); } else if (temp == 3) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected SiS303 video bridge - not supported\n"); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "unsupported SiS303", temp, 0); } else { @@ -1499,7 +1481,7 @@ void SISVGAPreInit(ScrnInfoPtr pScrn) if((temp >= lowerlimitlvds) && (temp <= upperlimitlvds)) { pSiS->VBFlags |= VB_LVDS; xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected LVDS transmitter (Bridge type %d)\n", temp); + "Detected LVDS transmitter (External chip ID %d)\n", temp); } if((temp >= lowerlimitch) && (temp <= upperlimitch)) { /* Set global for init301.c */ @@ -1543,7 +1525,7 @@ void SISVGAPreInit(ScrnInfoPtr pScrn) default: temp2 = 8; pSiS->ChrontelType = CHRONTEL_701x; break; } xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected Chrontel %s TV encoder (ID 0x%02x; bridge type %d)\n", + "Detected Chrontel %s TV encoder (ID 0x%02x; chip ID %d)\n", ChrontelTypeStr[temp2], temp1, temp); /* Sense connected TV's */ @@ -1782,7 +1764,7 @@ void SISVGAPreInit(ScrnInfoPtr pScrn) } if(pSiS->ChipFlags & SiSCF_UseLCDA) { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Bridge uses LCDA for low resolution and text modes\n"); + "BIOS uses LCDA for low resolution and text modes\n"); if(pSiS->SiS_Pr->Backup == TRUE) { inSISIDXREG(SISCR,0x34,pSiS->SiS_Pr->Backup_Mode); inSISIDXREG(SISPART1,0x14,pSiS->SiS_Pr->Backup_14); diff --git a/src/vgatypes.h b/src/vgatypes.h index 0daafed..b7bd36f 100644 --- a/src/vgatypes.h +++ b/src/vgatypes.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/vgatypes.h,v 1.15 2003/11/19 00:49:06 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/vgatypes.h,v 1.17 2003/12/02 12:15:33 twini Exp $ */ /* * General type definitions for universal mode switching modules * @@ -237,8 +237,6 @@ struct _SIS_HW_INFO PSIS_QUERYSPACE pQueryNorthBridgeSpace;/* Get/Set North Bridge */ /* space */ - - UCHAR pdc; /* PanelDelayCompensation */ }; #endif @@ -285,7 +283,10 @@ struct _SISFB_INFO { int sisfb_scalelcd; unsigned long sisfb_specialtiming; - char reserved[219]; /* for future use */ + unsigned char sisfb_haveemi; + unsigned char sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33; + + char reserved[214]; /* for future use */ }; #endif diff --git a/src/vstruct.h b/src/vstruct.h index c200559..3b0a74d 100644 --- a/src/vstruct.h +++ b/src/vstruct.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/vstruct.h,v 1.22 2003/11/03 17:02:54 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/vstruct.h,v 1.25 2003/12/02 12:15:33 twini Exp $ */ /* * General structure definitions for universal mode switching modules * @@ -212,20 +212,24 @@ typedef UCHAR DRAM4Type[4]; /* Defines for SiS_CustomT */ /* Never change these for sisfb compatibility */ -#define CUT_NONE 0 -#define CUT_FORCENONE 1 -#define CUT_BARCO1366 2 -#define CUT_BARCO1024 3 -#define CUT_COMPAQ1280 4 -#define CUT_COMPAQ12802 5 -#define CUT_PANEL848 6 -#define CUT_CLEVO1024 7 -#define CUT_CLEVO10242 8 -#define CUT_CLEVO1400 9 -#define CUT_CLEVO14002 10 -#define CUT_UNIWILL1024 11 -#define CUT_ASUSL3000D 12 -#define CUT_UNIWILL10242 13 +#define CUT_NONE 0 +#define CUT_FORCENONE 1 +#define CUT_BARCO1366 2 +#define CUT_BARCO1024 3 +#define CUT_COMPAQ1280 4 +#define CUT_COMPAQ12802 5 +#define CUT_PANEL848 6 +#define CUT_CLEVO1024 7 +#define CUT_CLEVO10242 8 +#define CUT_CLEVO1400 9 +#define CUT_CLEVO14002 10 +#define CUT_UNIWILL1024 11 +#define CUT_ASUSL3000D 12 +#define CUT_UNIWILL10242 13 +#define CUT_ACER1280 14 +#define CUT_COMPAL1400_1 15 +#define CUT_COMPAL1400_2 16 +#define CUT_ASUSA2H 17 typedef struct _SiS_Private { @@ -258,7 +262,6 @@ typedef struct _SiS_Private USHORT SiS_IF_DEF_TRUMPION; USHORT SiS_IF_DEF_DSTN; USHORT SiS_IF_DEF_FSTN; - USHORT SiS_IF_DEF_HiVision; USHORT SiS_SysFlags; UCHAR SiS_VGAINFO; #ifndef LINUX_KERNEL @@ -272,6 +275,11 @@ typedef struct _SiS_Private int SiS_UseOEM; ULONG SiS_CustomT; USHORT SiS_Backup70xx; + BOOLEAN HaveEMI; + BOOLEAN HaveEMILCD; + BOOLEAN OverruleEMI; + UCHAR EMI_30,EMI_31,EMI_32,EMI_33; + UCHAR PDC; USHORT SiS_CRT1Mode; USHORT SiS_flag_clearbuffer; int SiS_RAMType; @@ -286,7 +294,7 @@ typedef struct _SiS_Private USHORT SiS_LCDInfo661; USHORT SiS_VBType; USHORT SiS_VBExtInfo; - USHORT SiS_HiVision; + USHORT SiS_YPbPr; USHORT SiS_SelectCRT2Rate; USHORT SiS_SetFlag; USHORT SiS_RVBHCFACT; @@ -664,6 +672,7 @@ typedef struct _SiS_Private BOOLEAN CP_HaveCustomData; int CP_PreferredX, CP_PreferredY; int CP_MaxX, CP_MaxY, CP_MaxClock; + BOOLEAN CP_Supports64048075; int CP_HDisplay[7], CP_VDisplay[7]; /* For Custom LCD panel dimensions */ int CP_HTotal[7], CP_VTotal[7]; int CP_HSyncStart[7], CP_VSyncStart[7]; |