diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-12-19 20:55:16 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-12-19 20:55:16 +0000 |
commit | 546c4f291a92b5b5b7812196b0a4dc44ce5e7ddb (patch) | |
tree | 6dcad2641a195595bec48f3f17bbcedf14b9590b | |
parent | ebde9d1780cc6bb9307fa6639246764262738696 (diff) |
XFree86 4.3.99.902 (RC 2)xf86-4_3_99_902
-rw-r--r-- | src/init.c | 4 | ||||
-rw-r--r-- | src/init.h | 2 | ||||
-rw-r--r-- | src/init301.c | 85 | ||||
-rw-r--r-- | src/init301.h | 2 | ||||
-rw-r--r-- | src/oem310.h | 41 | ||||
-rw-r--r-- | src/sis.h | 14 | ||||
-rw-r--r-- | src/sis_driver.c | 114 | ||||
-rw-r--r-- | src/sis_driver.h | 11 | ||||
-rw-r--r-- | src/sis_opt.c | 4 | ||||
-rw-r--r-- | src/sis_vb.c | 12 | ||||
-rw-r--r-- | src/sis_video.c | 25 | ||||
-rw-r--r-- | src/vgatypes.h | 5 | ||||
-rw-r--r-- | src/vstruct.h | 5 |
13 files changed, 223 insertions, 101 deletions
@@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.c,v 1.39 2003/12/02 16:44:36 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.c,v 1.40 2003/12/03 23:07:47 twini Exp $ */ /* * Mode initializing code (CRT1 section) for * for SiS 300/305/540/630/730 and @@ -887,7 +887,7 @@ SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, if(VDisplay == 1200) ModeIndex = ModeIndex_1600x1200[Depth]; } break; - } + } } else if(VBFlags & VB_SISBRIDGE) { @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.h,v 1.37 2003/12/02 12:15:30 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.h,v 1.38 2003/12/16 17:59:08 twini Exp $ */ /* * Data and prototypes for init.c * diff --git a/src/init301.c b/src/init301.c index 00298cb..51156bd 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.58 2003/12/02 16:44:37 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c,v 1.59 2003/12/16 17:35:05 twini Exp $ */ /* * Mode initializing code (CRT2 section) * for SiS 300/305/540/630/730 and @@ -45,8 +45,9 @@ #define SET_EMI /* 302LV/ELV: Set EMI values */ #endif -#define COMPAL_HACK /* Needed for compal 1400x1050 (EMI) */ +#define COMPAL_HACK /* Needed for Compal 1400x1050 (EMI) */ #define COMPAQ_HACK /* Needed for Inventec/Compaq 1280x1024 (EMI) */ +#define ASUS_HACK /* Needed for Asus A2H 1024x768 (EMI) */ #include "init301.h" @@ -261,6 +262,8 @@ SiS_AdjustCRT2Rate(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, if(SiS_Pr->SiS_VBType & VB_SIS301B302B) { if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { if(tempbx == 0x2e) { /* 640x480 */ + tempax |= Support64048060Hz; +#if 0 /* DDC info not relyable (eg Sony) */ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) { tempax |= Support64048060Hz; } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelCustom) { @@ -268,6 +271,7 @@ SiS_AdjustCRT2Rate(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, tempax |= Support64048060Hz; } } +#endif } } } @@ -483,10 +487,10 @@ SiS_CR36BIOSWord23d(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) void SiS_DDC2Delay(SiS_Private *SiS_Pr, USHORT delaytime) { - USHORT i; + USHORT i, j; for(i=0; i<delaytime; i++) { - SiS_GetReg(SiS_Pr->SiS_P3c4,0x05); + j += SiS_GetReg(SiS_Pr->SiS_P3c4,0x05); } } @@ -612,7 +616,11 @@ SiS_PanelDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DelayTime) } else { Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[1]; } - SiS_DDC2Delay(SiS_Pr, Delay << 2); + Delay <<= 2; + if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { + Delay <<= 5; + } + SiS_DDC2Delay(SiS_Pr, Delay); } @@ -2211,8 +2219,8 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, /* The following two are responsible for eventually wrong colors * in TV output. The DH (VB_NoLCD) conditions are unknown; the - * b0 was found in some 651 machine (Pim); the b1 version in a - * 650 box (Jake). What is the criteria? + * b0 was found in some 651 machine (Pim; P4_23=0xe5); the b1 version + * in a 650 box (Jake). What is the criteria? */ if((IS_SIS740) || (HwInfo->jChipType >= SIS_661)) { @@ -3344,6 +3352,12 @@ SiS_GetLVDSDesPtrA(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++; } } + if(SiS_Pr->SiS_CustomT == CUT_ASUSA2H_2) { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { + tempbx = 86; + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++; + } + } if(ModeNo <= 0x13) tempal = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; @@ -3393,6 +3407,8 @@ SiS_GetLVDSDesData(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, case 83: PanelDesPtr = (SiS_LVDSDesStruct *)Uniwill1024x768Des_2; break; case 84: PanelDesPtr = (SiS_LVDSDesStruct *)Compaq1280x1024Des_1; break; case 85: PanelDesPtr = (SiS_LVDSDesStruct *)Compaq1280x1024Des_2; break; + case 86: PanelDesPtr = (SiS_LVDSDesStruct *)Asus1024x768Des_1; break; /* custom */ + case 87: PanelDesPtr = (SiS_LVDSDesStruct *)Asus1024x768Des_2; break; default: PanelDesPtr = SiS_Pr->LVDS1024x768Des_1; break; } #endif @@ -3736,7 +3752,7 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) 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); + SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 20); } } @@ -4174,6 +4190,9 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) { SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 2); SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x02); + if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { + SiS_GenericDelay(SiS_Pr, 0x4500); + } SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 2); } else { SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x02); @@ -4303,6 +4322,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) /* 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) */ + /* Asus 1024x768: 0x08, 0x10, 0x3c (problematic) YES (1.10.8q; CR36=22) */ if(SiS_Pr->HaveEMI) { r30 = SiS_Pr->EMI_30; @@ -4362,37 +4382,56 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) } } -#ifdef COMPAL_HACK /* BIOS values don't work so well */ + /* BIOS values don't work so well sometimes */ if(!SiS_Pr->OverruleEMI) { +#ifdef COMPAL_HACK 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 */ + r30 = 0x20; r31 = 0x12; r32 = 0xd0; r33 = 0x6b; /* rev 1 */ + } + } +#endif +#ifdef ASUS_HACK + if(SiS_Pr->SiS_CustomT == CUT_ASUSA2H_2) { + if((cr36 & 0x0f) == 0x02) { + /* r30 = 0x60; r31 = 0x05; r32 = 0x60; r33 = 0x33; */ /* rev 2 */ + /* r30 = 0x20; r31 = 0x05; r32 = 0x60; r33 = 0x33; */ /* rev 3 */ + /* r30 = 0x60; r31 = 0x0d; r32 = 0x70; r33 = 0x40; */ /* rev 4 */ + /* r30 = 0x20; r31 = 0x0d; r32 = 0x70; r33 = 0x40; */ /* rev 5 */ } } - } #endif - SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x20); + } + if(!(SiS_Pr->OverruleEMI && (!r30) && (!r31) && (!r32) && (!r33))) { + 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_Pr->OverruleEMI && (!r30) && (!r31) && (!r32) && (!r33))) { + SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10); + } else { + SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x00); + } 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); + if(delaylong) { + SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 5); + delaylong = FALSE; + } + SiS_WaitVBRetrace(SiS_Pr,HwInfo); + if(SiS_Pr->SiS_CustomT == CUT_ASUSA2H_2) { + SiS_GenericDelay(SiS_Pr, 0x500); + } SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x40); } } @@ -4436,6 +4475,9 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 10); } SiS_WaitVBRetrace(SiS_Pr,HwInfo); + if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { + SiS_GenericDelay(SiS_Pr, 0x500); + } SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x01); } } @@ -6977,6 +7019,10 @@ SiS_GetCRT2Part2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, else if(SiS_Pr->SiS_SetFlag & LCDVESATiming) tempbx = 105; } } + } else if(SiS_Pr->SiS_CustomT == CUT_ASUSA2H_2) { + if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { + if(SiS_Pr->SiS_SetFlag & LCDVESATiming) tempbx = 106; + } } *CRT2Index = tempbx; @@ -7747,6 +7793,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr case 103: CRT2Part2Ptr = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_Clevo1024x768_1; break; /* Custom */ case 104: CRT2Part2Ptr = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_Clevo1024x768_2; break; case 105: CRT2Part2Ptr = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_Clevo1024x768_3; break; + case 106: CRT2Part2Ptr = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_Asus1024x768_3; break; default: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_3; break; } diff --git a/src/init301.h b/src/init301.h index e9c8f3a..79e248d 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.35 2003/12/02 12:15:32 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h,v 1.36 2003/12/16 17:59:08 twini Exp $ */ /* * Data and prototypes for init301.c * diff --git a/src/oem310.h b/src/oem310.h index cc5e527..db13c06 100644 --- a/src/oem310.h +++ b/src/oem310.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/oem310.h,v 1.18 2003/10/30 18:53:42 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/oem310.h,v 1.19 2003/12/16 17:35:06 twini Exp $ */ /* * OEM Data for 315/330 series * @@ -561,6 +561,45 @@ static const SiS_LVDSDesStruct Clevo1024x768Des_2[] = { 0, 0 } }; +/* Asus A2xxxH _2 */ + +static const SiS_Part2PortTblStruct SiS310_CRT2Part2_Asus1024x768_3[] = +{ + {{0x25,0x13,0xc9,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x2c,0x13,0x9a,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x25,0x13,0xc9,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, + {{0x38,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x38,0x13,0x16,0x25,0xff,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x36,0x13,0x13,0x25,0xff,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, + {{0x25,0x13,0xc9,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}} +}; + +static const SiS_LVDSDesStruct Asus1024x768Des_1[] = +{ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 } +}; + +static const SiS_LVDSDesStruct Asus1024x768Des_2[] = +{ + { 1184, 622 }, + { 1184, 597 }, + { 1184, 622 }, + { 1184, 597 }, + { 1152, 622 }, + { 1232, 722 }, + { 0, 0 } +}; + +/* CRT2 data is std */ + /* Uniwill N243S9, ECS A928 */ static const SiS_LVDSDesStruct Uniwill1024x768Des_1[] = @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h,v 1.93 2003/12/02 12:15:32 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h,v 1.99 2003/12/16 17:45:19 twini Exp $ */ /* * Main global data and definitions * @@ -24,8 +24,8 @@ * * Authors: * - * ? * Thomas Winischhofer <thomas@winischhofer.net> + * ? * */ #ifndef _SIS_H @@ -36,7 +36,7 @@ #define SISDRIVERVERSIONYEAR 3 #define SISDRIVERVERSIONMONTH 12 -#define SISDRIVERVERSIONDAY 2 +#define SISDRIVERVERSIONDAY 15 #define SISDRIVERREVISION 1 #define SISDRIVERIVERSION (SISDRIVERVERSIONYEAR << 16) | (SISDRIVERVERSIONMONTH << 8) \ @@ -516,6 +516,7 @@ typedef struct { unsigned char *RenderAccelArray; unsigned char * FbBase1; unsigned long OnScreenSize1; + unsigned char OldMode; #ifdef SIS_CP SIS_CP_H_ENT #endif @@ -592,7 +593,8 @@ typedef struct { int forceCRT1; Bool CRT1changed; unsigned char oldCR17, oldCR63, oldSR1F; - unsigned char oldCR32; + unsigned char oldCR32, oldCR36, oldCR37; + unsigned char myCR32, myCR36, myCR37; unsigned char newCR32; unsigned long VBFlags; /* Video bridge configuration */ unsigned long VBFlags_backup; /* Backup for SlaveMode-modes */ @@ -795,7 +797,7 @@ typedef struct { unsigned char sisfblcda; int sisfbscalelcd; unsigned long sisfbspecialtiming; - BOOL sisfb_haveemi; + BOOL sisfb_haveemi, sisfb_haveemilcd; unsigned char sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33; int EMI; int NoYV12; /* Disable Xv YV12 support (old series) */ @@ -1062,7 +1064,7 @@ extern void SiS_SetTVyposoffset(ScrnInfoPtr pScrn, int val); extern void SiS_SetTVxscale(ScrnInfoPtr pScrn, int val); extern void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val); extern Bool SISSwitchCRT2Type(ScrnInfoPtr pScrn, unsigned long newvbflags); -extern Bool SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, +extern int SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned short index, Bool quiet); extern Bool SISSwitchCRT1Status(ScrnInfoPtr pScrn, int onoff); extern int SiS_GetCHTVlumabandwidthcvbs(ScrnInfoPtr pScrn); diff --git a/src/sis_driver.c b/src/sis_driver.c index 737183a..ed84d52 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.160 2003/12/02 12:15:32 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.166 2003/12/16 17:59:08 twini Exp $ */ /* * Copyright 2001, 2002, 2003 by Thomas Winischhofer, Vienna, Austria. * @@ -1585,6 +1585,8 @@ SiSUpdateXineramaScreenInfo(ScrnInfoPtr pScrn1) /* Attention: Usage of RandR may lead into virtual X and Y values * actually smaller than our MetaModes! To avoid this, we calculate * the maxCRT fields here (and not somewhere else, like in CopyNLink) + * + * *** For now: RandR will be disabled if SiS pseudo-Xinerama is on */ if((pSiS->SiSXineramaVX != pScrn1->virtualX) || (pSiS->SiSXineramaVY != pScrn1->virtualY)) { @@ -2767,10 +2769,14 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->sisfbpdc = mysisfbinfo.sisfb_lcdpdc; if(sisfbversion >= 0x010618) { pSiS->sisfb_haveemi = mysisfbinfo.sisfb_haveemi ? TRUE : FALSE; + pSiS->sisfb_haveemilcd = TRUE; /* will match most cases */ pSiS->sisfb_emi30 = mysisfbinfo.sisfb_emi30; pSiS->sisfb_emi31 = mysisfbinfo.sisfb_emi31; pSiS->sisfb_emi32 = mysisfbinfo.sisfb_emi32; pSiS->sisfb_emi33 = mysisfbinfo.sisfb_emi33; + if(sisfbversion >= 0x010619) { + pSiS->sisfb_haveemilcd = mysisfbinfo.sisfb_haveemilcd ? TRUE : FALSE; + } } } } @@ -3757,10 +3763,15 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* Backup VB connection and CRT1 on/off register */ if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { - inSISIDXREG(SISCR, 0x32, pSiS->oldCR32); - inSISIDXREG(SISCR, 0x17, pSiS->oldCR17); - inSISIDXREG(SISCR, 0x63, pSiS->oldCR63); inSISIDXREG(SISSR, 0x1f, pSiS->oldSR1F); + inSISIDXREG(SISCR, 0x17, pSiS->oldCR17); + inSISIDXREG(SISCR, 0x32, pSiS->oldCR32); + inSISIDXREG(SISCR, 0x36, pSiS->oldCR36); + inSISIDXREG(SISCR, 0x37, pSiS->oldCR37); + if(pSiS->VGAEngine == SIS_315_VGA) { + inSISIDXREG(SISCR, 0x63, pSiS->oldCR63); + } + pSiS->postVBCR32 = pSiS->oldCR32; } @@ -3882,7 +3893,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) SISCRT2PreInit(pScrn); /* Backup detected CRT2 devices */ - pSiS->detectedCRT2Devices = pSiS->VBFlags & (CRT2_LCD | CRT2_TV | CRT2_VGA | TV_AVIDEO | TV_SVIDEO | TV_SCART); + pSiS->detectedCRT2Devices = pSiS->VBFlags & (CRT2_LCD|CRT2_TV|CRT2_VGA|TV_AVIDEO|TV_SVIDEO|TV_SCART); /* Setup SD flags */ pSiS->SiS_SD_Flags |= SiS_SD_ADDLSUPFLAG; @@ -4297,8 +4308,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->VBFlags |= (VB_DISPMODE_SINGLE | DISPTYPE_CRT1); } - if((pSiS->VGAEngine == SIS_315_VGA) || - (pSiS->VGAEngine == SIS_300_VGA) ) { + if((pSiS->VGAEngine == SIS_315_VGA) || (pSiS->VGAEngine == SIS_300_VGA)) { if((!pSiS->NoXvideo) && (!pSiS->hasTwoOverlays)) { xf86DrvMsg(pScrn->scrnIndex, from, "Using Xv overlay by default on CRT%d\n", @@ -4314,6 +4324,13 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* VBFlags are initialized now. Back them up for SlaveMode modes. */ pSiS->VBFlags_backup = pSiS->VBFlags; + /* Backup CR32,36,37 (in order to write them back after a VT switch) */ + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + inSISIDXREG(SISCR,0x32,pSiS->myCR32); + inSISIDXREG(SISCR,0x36,pSiS->myCR36); + inSISIDXREG(SISCR,0x37,pSiS->myCR37); + } + /* Find out about paneldelaycompensation and evaluate option */ #ifdef SISDUALHEAD if((!pSiS->DualHeadMode) || (!pSiS->SecondHead)) { @@ -4457,7 +4474,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) 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->HaveEMI = TRUE; + if(pSiS->sisfb_haveemilcd) pSiS->SiS_Pr->HaveEMILCD = TRUE; pSiS->SiS_Pr->OverruleEMI = FALSE; } else { inSISIDXREG(SISPART4, 0x30, pSiS->SiS_Pr->EMI_30); @@ -5574,10 +5592,12 @@ SISSave(ScrnInfoPtr pScrn) /* "Save" these again as they may have been changed prior to SISSave() call */ if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + sisReg->sisRegs3C4[0x1f] = pSiS->oldSR1F; sisReg->sisRegs3D4[0x17] = pSiS->oldCR17; if(vgaReg->numCRTC >= 0x17) vgaReg->CRTC[0x17] = pSiS->oldCR17; sisReg->sisRegs3D4[0x32] = pSiS->oldCR32; - sisReg->sisRegs3C4[0x1f] = pSiS->oldSR1F; + sisReg->sisRegs3D4[0x36] = pSiS->oldCR36; + sisReg->sisRegs3D4[0x37] = pSiS->oldCR37; if(pSiS->VGAEngine == SIS_315_VGA) { sisReg->sisRegs3D4[0x63] = pSiS->oldCR63; } @@ -6174,7 +6194,7 @@ SISRestore(ScrnInfoPtr pScrn) /* First, restore CRT1 on/off and VB connection registers */ outSISIDXREG(SISCR, 0x32, pSiS->oldCR32); if(!(pSiS->oldCR17 & 0x80)) { /* CRT1 was off */ - if(!(SiSBridgeIsInSlaveMode(pScrn))) { /* Bridge is NOT in SlaveMode now -> do it */ + if(!(SiSBridgeIsInSlaveMode(pScrn))) { /* Bridge is NOT in SlaveMode now -> do it */ doit = TRUE; } else { doitlater = TRUE; @@ -6574,8 +6594,8 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* Read 0:449 which the BIOS sets to the current mode number * Unfortunately, this not reliable since the int10 emulation * does not change this. So if we call the VBE later, this - * byte won't be touched. (which is why we set this manually - * then) + * byte won't be touched (which is why we set this manually + * then). */ unsigned char myoldmode = SiS_GetSetModeID(pScrn,0xFF); unsigned char cr30, cr31; @@ -6585,7 +6605,6 @@ 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); @@ -6603,12 +6622,15 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) * two is valid). */ if(pSiS->OldMode > 0x7f) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Previous video mode (%02x) invalid, using BIOS scratch (%02x)\n", - pSiS->OldMode, myoldmode); pSiS->OldMode = myoldmode; } } +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + if(!pSiS->SecondHead) pSiSEnt->OldMode = pSiS->OldMode; + else pSiS->OldMode = pSiSEnt->OldMode; + } +#endif } /* Initialise the first mode */ @@ -6937,6 +6959,11 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) SiSnoPanoramiXExtension = FALSE; SiSXineramaExtensionInit(pScrn); if(!SiSnoPanoramiXExtension) { +#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0) + xf86DisableRandR(); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "SiS Pseudo-Xinerama enabled, RandR disabled\n"); +#endif pSiS->SiS_SD_Flags |= SiS_SD_PSEUDOXINERAMA; } } @@ -7116,24 +7143,22 @@ SISSwitchCRT2Type(ScrnInfoPtr pScrn, unsigned long newvbflags) return TRUE; } -Bool +int SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned short index, Bool quiet) { SISPtr pSiS = SISPTR(pScrn); BOOLEAN hcm = pSiS->HaveCustomModes; DisplayModePtr mode = pScrn->modes, mastermode; - int i; + int i, result = 0; unsigned long vbflags = pSiS->VBFlags; - /* This has been extended to handle LCDA as well */ + /* Not only CRT2, but also LCDA */ - /* Only on 300 and 315/330 series */ - if(pSiS->VGAEngine != SIS_300_VGA && - pSiS->VGAEngine != SIS_315_VGA) return FALSE; - - /* Mode is OK if there is no video bridge */ - /* (Requires screen size check in app) */ - if(!(pSiS->VBFlags & VB_VIDEOBRIDGE)) return TRUE; + /* returns 0 if mode ok, + * 0x01 if mode not ok for CRT2 device, + * 0x02 if mode too large for current root window + * or combinations thereof + */ /* No special treatment for NTSC-J here */ if(cond) { @@ -7153,14 +7178,10 @@ SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned sh } } - /* Mode is obviously OK if video bridge is disabled */ - /* (Requires extra check for eventual screen size problems in app) */ - if(!(vbflags & (CRT2_ENABLE | CRT1_LCDA))) return TRUE; - /* Find mode of given index */ if(index) { for(i = 0; i < index; i++) { - if(!mode) return FALSE; + if(!mode) return 0x03; mode = mode->next; } } @@ -7188,7 +7209,7 @@ SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned sh xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Desired mode too large for current screen size\n"); } - return FALSE; + result |= 0x02; } /* Check if the desired mode is suitable for current CRT2 output device */ @@ -7197,7 +7218,7 @@ SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned sh xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Desired mode not suitable for current CRT2 output device\n"); } - return FALSE; + result |= 0x01; } } @@ -7229,7 +7250,7 @@ SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned sh xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Desired mode too large for current screen size\n"); } - return FALSE; + result |= 0x02; } /* Check if the desired mode is suitable for current CRT1 output device */ @@ -7238,7 +7259,7 @@ SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned sh xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Desired mode not suitable for current CRT1 output device\n"); } - return FALSE; + result |= 0x01; } } @@ -7247,7 +7268,7 @@ SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned sh } #endif - return TRUE; + return result; } Bool @@ -7719,8 +7740,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((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + outSISIDXREG(SISCR,0x32,pSiS->myCR32); + outSISIDXREG(SISCR,0x36,pSiS->myCR36); + outSISIDXREG(SISCR,0x37,pSiS->myCR37); } if(!SISModeInit(pScrn, pScrn->currentMode)) { @@ -7731,7 +7754,6 @@ SISEnterVT(int scrnIndex, int flags) SISAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); #ifdef XF86DRI - /* this is to be done AFTER switching the mode */ if(pSiS->directRenderingEnabled) { DRIUnlock(screenInfo.screens[scrnIndex]); } @@ -7761,7 +7783,6 @@ SISLeaveVT(int scrnIndex, int flags) #ifdef XF86DRI ScreenPtr pScreen; - /* to be done before mode change */ if(pSiS->directRenderingEnabled) { pScreen = screenInfo.screens[scrnIndex]; DRILock(pScreen, 0); @@ -7810,7 +7831,7 @@ SISLeaveVT(int scrnIndex, int flags) } - /* We use this (otherwise unused) bit to indicate that we are running + /* We use (otherwise unused) bit 7 to indicate that we are running * to keep sisfb to change the displaymode (this would result in * lethal display corruption upon quitting X or changing to a VT * until a reboot) @@ -7886,12 +7907,16 @@ SISCloseScreen(int scrnIndex, ScreenPtr pScreen) } vgaHWLock(hwp); - } - if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) { - andSISIDXREG(SISCR,0x34,0x7f); } + /* We should restore the mode number in case vtsema = false as well, + * but since we haven't register access then we can't do it. I think + * I need to rework the save/restore stuff, like saving the video + * status when returning to the X server and by that save me the + * trouble if sisfb was started from a textmode VT while X was on. + */ + SISUnmapMem(pScrn); vgaHWUnmapMem(pScrn); @@ -11113,6 +11138,7 @@ SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned long VBF return 0xfe; if((havecustommodes) && + (pSiS->LCDwidth) && /* = test if LCD present */ (!(mode->type & M_T_DEFAULT)) && (!(mode->Flags & V_INTERLACE))) return 0xfe; diff --git a/src/sis_driver.h b/src/sis_driver.h index 914aebd..5833186 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.29 2003/11/29 12:08:02 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h,v 1.30 2003/12/16 17:35:07 twini Exp $ */ /* * Global data and definitions * @@ -222,7 +222,14 @@ const customttable mycustomttable[] = { { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 }, 0x1043, 0x1612, - "Asus", "A2H", CUT_ASUSA2H, "ASUS_A2H" + "Asus", "A2H (V1)", CUT_ASUSA2H_1, "ASUS_A2H_1" + }, + { SIS_650, "1.10.8q", "", + 0, /* For EMI */ + { 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0 }, + 0x1043, 0x1612, + "Asus", "A2H (V2)", CUT_ASUSA2H_2, "ASUS_A2H_2" }, { 4321, "", "", /* never autodetected */ 0, diff --git a/src/sis_opt.c b/src/sis_opt.c index 808b3cc..9daea9f 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.49 2003/12/02 12:15:33 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c,v 1.50 2003/12/09 17:49:26 twini Exp $ */ /* * SiS driver option evaluation * @@ -339,7 +339,7 @@ SiSOptions(ScrnInfoPtr pScrn) pSiS->enablesisctrl = FALSE; if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { pSiS->XvDefBri = 10; - pSiS->XvDefCon = 5; + pSiS->XvDefCon = 2; } else { pSiS->XvDefBri = 0; pSiS->XvDefCon = 4; diff --git a/src/sis_vb.c b/src/sis_vb.c index 99c49b9..3242851 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.32 2003/11/23 19:44:26 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c,v 1.34 2003/12/16 17:35:07 twini Exp $ */ /* * Video bridge detection and configuration for 300, 315 and 330 series * @@ -212,6 +212,8 @@ void SISLCDPreInit(ScrnInfoPtr pScrn) SISPtr pSiS = SISPTR(pScrn); unsigned char CR32, CR36, CR37; + pSiS->LCDwidth = 0; + if(!(pSiS->VBFlags & VB_VIDEOBRIDGE)) return; inSISIDXREG(SISCR, 0x32, CR32); @@ -355,8 +357,7 @@ void SISTVPreInit(ScrnInfoPtr pScrn) unsigned char SR16, SR38, CR32, CR35=0, CR38=0, CR79; int temp = 0; - if(!(pSiS->VBFlags & VB_VIDEOBRIDGE)) - return; + if(!(pSiS->VBFlags & VB_VIDEOBRIDGE)) return; inSISIDXREG(SISCR, 0x32, CR32); inSISIDXREG(SISSR, 0x16, SR16); @@ -443,7 +444,7 @@ void SISTVPreInit(ScrnInfoPtr pScrn) } } - if(pSiS->VBFlags & (TV_SCART | TV_SVIDEO | TV_AVIDEO | TV_HIVISION | TV_YPBPR | 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 ", @@ -461,8 +462,7 @@ void SISCRT2PreInit(ScrnInfoPtr pScrn) SISPtr pSiS = SISPTR(pScrn); unsigned char CR32; - if(!(pSiS->VBFlags & VB_VIDEOBRIDGE)) - return; + if(!(pSiS->VBFlags & VB_VIDEOBRIDGE)) return; /* CRT2-VGA not supported on LVDS and 30xLV */ if(pSiS->VBFlags & (VB_LVDS|VB_301LV|VB_302LV|VB_302ELV)) diff --git a/src/sis_video.c b/src/sis_video.c index afe3012..e60efcb 100644 --- a/src/sis_video.c +++ b/src/sis_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c,v 1.41 2003/11/19 00:49:06 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c,v 1.44 2003/12/16 17:35:07 twini Exp $ */ /* * Xv driver for SiS 300, 315 and 330 series. * @@ -1676,12 +1676,12 @@ SISSetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, } } else if(attribute == pSiS->xv_CMD) { if(pSiS->xv_sisdirectunlocked) { + int result = 0; pSiS->xv_sd_result = (value & 0xffffff00); - if(SISCheckModeIndexForCRT2Type(pScrn, (unsigned short)(value & 0xff), - (unsigned short)((value >> 8) & 0xff), - FALSE)) { - pSiS->xv_sd_result |= 0x01; - } + result = SISCheckModeIndexForCRT2Type(pScrn, (unsigned short)(value & 0xff), + (unsigned short)((value >> 8) & 0xff), + FALSE); + pSiS->xv_sd_result |= (result & 0xff); } } else if(attribute == pSiS->xv_SGA) { if(pSiS->xv_sisdirectunlocked) { @@ -2081,12 +2081,10 @@ SiSHandleSiSDirectCommand(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv, sisdirectcomm break; case SDC_CMD_CHECKMODEFORCRT2: j = sdcbuf->sdc_parm[0]; - sdcbuf->sdc_parm[0] = 0; - if(SISCheckModeIndexForCRT2Type(pScrn, (unsigned short)(j & 0xff), - (unsigned short)((j >> 8) & 0xff), - FALSE)) { - sdcbuf->sdc_parm[0] = 1; - } + sdcbuf->sdc_parm[0] = SISCheckModeIndexForCRT2Type(pScrn, + (unsigned short)(j & 0xff), + (unsigned short)((j >> 8) & 0xff), + FALSE) & 0xff; break; default: sdcbuf->sdc_header = SDC_RESULT_UNDEFCMD; @@ -2700,7 +2698,7 @@ set_brightness(SISPtr pSiS, CARD8 brightness) static __inline void set_contrast(SISPtr pSiS, CARD8 contrast) { - setvideoregmask(pSiS, Index_VI_Contrast_Enh_Ctrl, contrast ^ 0x07, 0x07); + setvideoregmask(pSiS, Index_VI_Contrast_Enh_Ctrl, contrast, 0x07); } /* 315 series and later only */ @@ -3398,6 +3396,7 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv) pPriv->mustwait = 1; pPriv->oldx1 = overlay.dstBox.x1; pPriv->oldx2 = overlay.dstBox.x2; pPriv->oldy1 = overlay.dstBox.y1; pPriv->oldy2 = overlay.dstBox.y2; + } #ifdef SISMERGED } diff --git a/src/vgatypes.h b/src/vgatypes.h index b7bd36f..123053c 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.17 2003/12/02 12:15:33 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/vgatypes.h,v 1.18 2003/12/16 17:45:20 twini Exp $ */ /* * General type definitions for universal mode switching modules * @@ -285,8 +285,9 @@ struct _SISFB_INFO { unsigned char sisfb_haveemi; unsigned char sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33; + unsigned char sisfb_haveemilcd; - char reserved[214]; /* for future use */ + char reserved[213]; /* for future use */ }; #endif diff --git a/src/vstruct.h b/src/vstruct.h index 3b0a74d..ca30ca9 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.25 2003/12/02 12:15:33 twini Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/vstruct.h,v 1.26 2003/12/16 17:35:07 twini Exp $ */ /* * General structure definitions for universal mode switching modules * @@ -229,7 +229,8 @@ typedef UCHAR DRAM4Type[4]; #define CUT_ACER1280 14 #define CUT_COMPAL1400_1 15 #define CUT_COMPAL1400_2 16 -#define CUT_ASUSA2H 17 +#define CUT_ASUSA2H_1 17 +#define CUT_ASUSA2H_2 18 typedef struct _SiS_Private { |