summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEgbert Eich <eich@suse.de>2004-01-29 08:08:37 +0000
committerEgbert Eich <eich@suse.de>2004-01-29 08:08:37 +0000
commit10c83bf291a62e9b14699dc2f158a30fbe2d1b2d (patch)
treed39c6b9f9d8209eed368c0d6b9410f56bc77fbfa
parent546c4f291a92b5b5b7812196b0a4dc44ce5e7ddb (diff)
Importing vendor version xf86-012804-2330 on Thu Jan 29 00:06:33 PST 2004xf86-012804-2330
-rw-r--r--src/300vtbl.h65
-rw-r--r--src/310vtbl.h65
-rw-r--r--src/init.c294
-rw-r--r--src/init.h143
-rw-r--r--src/init301.c1991
-rw-r--r--src/init301.h134
-rw-r--r--src/initdef.h134
-rw-r--r--src/oem300.h65
-rw-r--r--src/oem310.h172
-rw-r--r--src/osdef.h57
-rw-r--r--src/sis.h143
-rw-r--r--src/sis300_accel.c109
-rw-r--r--src/sis300_accel.h52
-rw-r--r--src/sis310_accel.c222
-rw-r--r--src/sis310_accel.h48
-rw-r--r--src/sis6326_video.c47
-rw-r--r--src/sis_accel.c80
-rw-r--r--src/sis_accel.h30
-rw-r--r--src/sis_common.h16
-rw-r--r--src/sis_cursor.c837
-rw-r--r--src/sis_cursor.h381
-rw-r--r--src/sis_dac.c92
-rw-r--r--src/sis_dac.h57
-rw-r--r--src/sis_dga.c8
-rw-r--r--src/sis_dri.c36
-rw-r--r--src/sis_dri.h35
-rw-r--r--src/sis_driver.c787
-rw-r--r--src/sis_driver.h271
-rw-r--r--src/sis_opt.c134
-rw-r--r--src/sis_regs.h53
-rw-r--r--src/sis_setup.c51
-rw-r--r--src/sis_shadow.c26
-rw-r--r--src/sis_vb.c184
-rw-r--r--src/sis_vga.c273
-rw-r--r--src/sis_video.c61
-rw-r--r--src/vgatypes.h69
-rw-r--r--src/vstruct.h84
37 files changed, 4209 insertions, 3097 deletions
diff --git a/src/300vtbl.h b/src/300vtbl.h
index 6227235..deedf4f 100644
--- a/src/300vtbl.h
+++ b/src/300vtbl.h
@@ -1,36 +1,55 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/300vtbl.h,v 1.20 2003/11/19 00:49:02 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/300vtbl.h,v 1.23 2004/01/23 22:29:01 twini Exp $ */
/*
* Register settings for SiS 300 series
*
- * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
*
- * If distributed as part of the linux kernel, the contents of this file
- * is entirely covered by the GPL.
+ * If distributed as part of the Linux kernel, the following license terms
+ * apply:
*
- * Otherwise, the following terms apply:
+ * * This program is free software; you can redistribute it and/or modify
+ * * it under the terms of the GNU General Public License as published by
+ * * the Free Software Foundation; either version 2 of the named License,
+ * * or any later version.
+ * *
+ * * This program is distributed in the hope that it will be useful,
+ * * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * * GNU General Public License for more details.
+ * *
+ * * You should have received a copy of the GNU General Public License
+ * * along with this program; if not, write to the Free Software
+ * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Otherwise, the following license terms apply:
*
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * * Redistribution and use in source and binary forms, with or without
+ * * modification, are permitted provided that the following conditions
+ * * are met:
+ * * 1) Redistributions of source code must retain the above copyright
+ * * notice, this list of conditions and the following disclaimer.
+ * * 2) Redistributions in binary form must reproduce the above copyright
+ * * notice, this list of conditions and the following disclaimer in the
+ * * documentation and/or other materials provided with the distribution.
+ * * 3) All advertising materials mentioning features or use of this software
+ * * must display the following acknowledgement: "This product includes
+ * * software developed by Thomas Winischhofer, Vienna, Austria."
+ * * 4) The name of the author may not be used to endorse or promote products
+ * * derived from this software without specific prior written permission.
+ * *
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Author: Thomas Winischhofer <thomas@winischhofer.net>
*
- * Based on code by Silicon Intergrated Systems
- *
*/
typedef struct _SiS300_StStruct
diff --git a/src/310vtbl.h b/src/310vtbl.h
index 1dcff00..cdb63df 100644
--- a/src/310vtbl.h
+++ b/src/310vtbl.h
@@ -1,36 +1,55 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/310vtbl.h,v 1.20 2003/11/19 00:49:02 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/310vtbl.h,v 1.23 2004/01/23 22:29:01 twini Exp $ */
/*
* Register settings for SiS 315/330 series
*
- * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
*
- * If distributed as part of the linux kernel, the contents of this file
- * is entirely covered by the GPL.
+ * If distributed as part of the Linux kernel, the following license terms
+ * apply:
*
- * Otherwise, the following terms apply:
+ * * This program is free software; you can redistribute it and/or modify
+ * * it under the terms of the GNU General Public License as published by
+ * * the Free Software Foundation; either version 2 of the named License,
+ * * or any later version.
+ * *
+ * * This program is distributed in the hope that it will be useful,
+ * * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * * GNU General Public License for more details.
+ * *
+ * * You should have received a copy of the GNU General Public License
+ * * along with this program; if not, write to the Free Software
+ * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Otherwise, the following license terms apply:
*
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * * Redistribution and use in source and binary forms, with or without
+ * * modification, are permitted provided that the following conditions
+ * * are met:
+ * * 1) Redistributions of source code must retain the above copyright
+ * * notice, this list of conditions and the following disclaimer.
+ * * 2) Redistributions in binary form must reproduce the above copyright
+ * * notice, this list of conditions and the following disclaimer in the
+ * * documentation and/or other materials provided with the distribution.
+ * * 3) All advertising materials mentioning features or use of this software
+ * * must display the following acknowledgement: "This product includes
+ * * software developed by Thomas Winischhofer, Vienna, Austria."
+ * * 4) The name of the author may not be used to endorse or promote products
+ * * derived from this software without specific prior written permission.
+ * *
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Author: Thomas Winischhofer <thomas@winischhofer.net>
*
- * Based on code by Silicon Intergrated Systems
- *
*/
typedef struct _SiS310_StStruct
diff --git a/src/init.c b/src/init.c
index 6cb0b41..02e0037 100644
--- a/src/init.c
+++ b/src/init.c
@@ -1,36 +1,60 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.c,v 1.40 2003/12/03 23:07:47 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.c,v 1.46 2004/01/24 21:29:20 twini Exp $ */
/*
* Mode initializing code (CRT1 section) for
* for SiS 300/305/540/630/730 and
- * SiS 315/550/650/M650/651/661FX/M661FX/740/741/330/660/M660/760/M760
+ * SiS 315/550/650/M650/651/661FX/M661FX/740/741/M741/330/660/M660/760/M760
* (Universal module for Linux kernel framebuffer and XFree86 4.x)
*
- * Assembler-To-C translation
- * Copyright 2002, 2003 by Thomas Winischhofer <thomas@winischhofer.net>
- * Formerly based on non-functional code-fragements by SiS, Inc.
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
*
- * If distributed as part of the linux kernel, the contents of this file
- * is entirely covered by the GPL.
+ * If distributed as part of the Linux kernel, the following license terms
+ * apply:
*
- * Otherwise, the following terms apply:
+ * * This program is free software; you can redistribute it and/or modify
+ * * it under the terms of the GNU General Public License as published by
+ * * the Free Software Foundation; either version 2 of the named License,
+ * * or any later version.
+ * *
+ * * This program is distributed in the hope that it will be useful,
+ * * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * * GNU General Public License for more details.
+ * *
+ * * You should have received a copy of the GNU General Public License
+ * * along with this program; if not, write to the Free Software
+ * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Otherwise, the following license terms apply:
*
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * * Redistribution and use in source and binary forms, with or without
+ * * modification, are permitted provided that the following conditions
+ * * are met:
+ * * 1) Redistributions of source code must retain the above copyright
+ * * notice, this list of conditions and the following disclaimer.
+ * * 2) Redistributions in binary form must reproduce the above copyright
+ * * notice, this list of conditions and the following disclaimer in the
+ * * documentation and/or other materials provided with the distribution.
+ * * 3) All advertising materials mentioning features or use of this software
+ * * must display the following acknowledgement: "This product includes
+ * * software developed by Thomas Winischhofer, Vienna, Austria."
+ * * 4) The name of the author may not be used to endorse or promote products
+ * * derived from this software without specific prior written permission.
+ * *
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Author: Thomas Winischhofer <thomas@winischhofer.net>
+ *
+ * Formerly based on non-functional code-fragements for 300 series by SiS, Inc.
+ * Used by permission.
*
* TW says: This code looks awful, I know. But please don't do anything about
* this otherwise debugging will be hell.
@@ -68,35 +92,44 @@ InitCommonPointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_Pr->SiS_ModeResInfo = SiS_ModeResInfo;
SiS_Pr->SiS_StandTable = SiS_StandTable;
- SiS_Pr->SiS_NTSCPhase = SiS_NTSCPhase;
- SiS_Pr->SiS_PALPhase = SiS_PALPhase;
- SiS_Pr->SiS_NTSCPhase2 = SiS_NTSCPhase2;
- SiS_Pr->SiS_PALPhase2 = SiS_PALPhase2;
- SiS_Pr->SiS_PALMPhase = SiS_PALMPhase;
- SiS_Pr->SiS_PALNPhase = SiS_PALNPhase;
- SiS_Pr->SiS_PALMPhase2 = SiS_PALMPhase2;
- SiS_Pr->SiS_PALNPhase2 = SiS_PALNPhase2;
- SiS_Pr->SiS_SpecialPhase = SiS_SpecialPhase;
- SiS_Pr->SiS_SpecialPhaseM= SiS_SpecialPhaseM;
- SiS_Pr->SiS_SpecialPhaseJ= SiS_SpecialPhaseJ;
+ SiS_Pr->SiS_NTSCPhase = SiS_NTSCPhase;
+ SiS_Pr->SiS_PALPhase = SiS_PALPhase;
+ SiS_Pr->SiS_NTSCPhase2 = SiS_NTSCPhase2;
+ SiS_Pr->SiS_PALPhase2 = SiS_PALPhase2;
+ SiS_Pr->SiS_PALMPhase = SiS_PALMPhase;
+ SiS_Pr->SiS_PALNPhase = SiS_PALNPhase;
+ SiS_Pr->SiS_PALMPhase2 = SiS_PALMPhase2;
+ SiS_Pr->SiS_PALNPhase2 = SiS_PALNPhase2;
+ SiS_Pr->SiS_SpecialPhase = SiS_SpecialPhase;
+ SiS_Pr->SiS_SpecialPhaseM = SiS_SpecialPhaseM;
+ SiS_Pr->SiS_SpecialPhaseJ = SiS_SpecialPhaseJ;
SiS_Pr->SiS_NTSCTiming = SiS_NTSCTiming;
SiS_Pr->SiS_PALTiming = SiS_PALTiming;
SiS_Pr->SiS_HiTVSt1Timing = SiS_HiTVSt1Timing;
SiS_Pr->SiS_HiTVSt2Timing = SiS_HiTVSt2Timing;
- SiS_Pr->SiS_HiTVTextTiming = SiS_HiTVTextTiming;
+
SiS_Pr->SiS_HiTVExtTiming = SiS_HiTVExtTiming;
SiS_Pr->SiS_HiTVGroup3Data = SiS_HiTVGroup3Data;
SiS_Pr->SiS_HiTVGroup3Simu = SiS_HiTVGroup3Simu;
+#if 0
+ SiS_Pr->SiS_HiTVTextTiming = SiS_HiTVTextTiming;
SiS_Pr->SiS_HiTVGroup3Text = SiS_HiTVGroup3Text;
+#endif
SiS_Pr->SiS_StPALData = SiS_StPALData;
SiS_Pr->SiS_ExtPALData = SiS_ExtPALData;
SiS_Pr->SiS_StNTSCData = SiS_StNTSCData;
SiS_Pr->SiS_ExtNTSCData = SiS_ExtNTSCData;
-/* SiS_Pr->SiS_St1HiTVData = SiS_St1HiTVData; */
+ SiS_Pr->SiS_St1HiTVData = SiS_StHiTVData;
SiS_Pr->SiS_St2HiTVData = SiS_St2HiTVData;
SiS_Pr->SiS_ExtHiTVData = SiS_ExtHiTVData;
+ SiS_Pr->SiS_St525iData = SiS_StNTSCData;
+ SiS_Pr->SiS_St525pData = SiS_St525pData;
+ SiS_Pr->SiS_St750pData = SiS_St750pData;
+ SiS_Pr->SiS_Ext525iData = SiS_ExtNTSCData;
+ SiS_Pr->SiS_Ext525pData = SiS_ExtNTSCData;
+ SiS_Pr->SiS_Ext750pData = SiS_Ext750pData;
SiS_Pr->pSiS_OutputSelect = &SiS_OutputSelect;
SiS_Pr->pSiS_SoftSetting = &SiS_SoftSetting;
@@ -991,7 +1024,9 @@ SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int D
if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth];
break;
case 512:
- if((VBFlags & TV_PAL) && (!(VBFlags & TV_PALM))) {
+ if( ((VBFlags & TV_YPBPR) && (VBFlags & (TV_YPBPR525P | TV_YPBPR750P | TV_YPBPR1080I))) ||
+ (VBFlags & TV_HIVISION) ||
+ ((!(VBFlags & (TV_YPBPR | TV_PALM))) && (VBFlags & TV_PAL)) ) {
if(VDisplay == 384) ModeIndex = ModeIndex_512x384[Depth];
}
break;
@@ -1000,19 +1035,19 @@ 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_YPBPR))) {
+ if((!(VBFlags & TV_HIVISION)) && (!((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I)))) {
if(VDisplay == 480) {
- if((VBFlags & TV_NTSC) || (VBFlags & TV_PALM))
+ if((VBFlags & TV_YPBPR) || (VBFlags & (TV_NTSC | TV_PALM)))
ModeIndex = ModeIndex_720x480[Depth];
} else if(VDisplay == 576) {
- if((VBFlags & TV_PAL) && (!(VBFlags & TV_PALM)))
+ if((!(VBFlags & (TV_YPBPR | TV_PALM))) && (VBFlags & TV_PAL))
ModeIndex = ModeIndex_720x576[Depth];
}
}
break;
case 768:
- if(!(VBFlags & (TV_HIVISION | TV_YPBPR))) {
- if((VBFlags & TV_PAL) && (!(VBFlags & TV_PALM))) {
+ if((!(VBFlags & TV_HIVISION)) && (!((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I)))) {
+ if((!(VBFlags & (TV_YPBPR | TV_PALM))) && (VBFlags & TV_PAL)) {
if(VDisplay == 576) ModeIndex = ModeIndex_768x576[Depth];
}
}
@@ -1020,8 +1055,8 @@ 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_YPBPR)) {
- ModeIndex = ModeIndex_800x480[Depth];
+ if((VBFlags & TV_HIVISION) || ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I))) {
+ ModeIndex = ModeIndex_800x480[Depth];
}
}
break;
@@ -1031,13 +1066,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_YPBPR)) {
+ if((VBFlags & TV_HIVISION) || ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I))) {
ModeIndex = ModeIndex_1024x576[Depth];
}
}
break;
case 1280:
- if(VBFlags & (TV_HIVISION | TV_YPBPR)) {
+ if((VBFlags & TV_HIVISION) || ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I))) {
if(VDisplay == 720) ModeIndex = ModeIndex_1280x720[Depth];
else if(VDisplay == 1024) ModeIndex = ModeIndex_1280x1024[Depth];
}
@@ -1269,6 +1304,15 @@ SiS_GetSysFlags(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
unsigned char cr5f, temp1, temp2;
+ /* 661 and newer: NEVER write non-zero to SR11[7:4] */
+ /* (SR11 is used for DDC and in enable/disablebridge) */
+ SiS_Pr->SiS_SensibleSR11 = FALSE;
+ SiS_Pr->SiS_MyCR63 = 0x63;
+ if(HwInfo->jChipType >= SIS_661) {
+ SiS_Pr->SiS_SensibleSR11 = TRUE;
+ SiS_Pr->SiS_MyCR63 = 0x53;
+ }
+
/* You should use the macros, not these flags directly */
SiS_Pr->SiS_SysFlags = 0;
@@ -2292,7 +2336,7 @@ SiS_SetCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
modeflag = SiS_Pr->CModeFlag;
- for(i=0,j=0;i<=07;i++,j++) {
+ for(i=0,j=0;i<=7;i++,j++) {
SiS_SetReg(SiS_Pr->SiS_P3d4,j,SiS_Pr->CCRT1CRTC[i]);
}
for(j=0x10;i<=10;i++,j++) {
@@ -2310,7 +2354,7 @@ SiS_SetCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
temp = (SiS_Pr->CCRT1CRTC[16] & 0x01) << 5;
if(modeflag & DoubleScanMode) temp |= 0x80;
- SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0xDF,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0x5F,temp);
} else {
@@ -2372,7 +2416,7 @@ SiS_SetCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
temp = ((LCDACRT1Ptr+ResIndex)->CR[16] & 0x01) << 5;
if(modeflag & DoubleScanMode) temp |= 0x80;
- SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0xDF,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0x5F,temp);
#endif
@@ -2380,7 +2424,7 @@ SiS_SetCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
- for(i=0,j=0;i<=07;i++,j++) {
+ for(i=0,j=0;i<=7;i++,j++) {
SiS_SetReg(SiS_Pr->SiS_P3d4,j,SiS_Pr->SiS_CRT1Table[index].CR[i]);
}
for(j=0x10;i<=10;i++,j++) {
@@ -2398,7 +2442,7 @@ SiS_SetCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
temp = ((SiS_Pr->SiS_CRT1Table[index].CR[16]) & 0x01) << 5;
if(modeflag & DoubleScanMode) temp |= 0x80;
- SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0xDF,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0x5F,temp);
}
}
@@ -3159,39 +3203,33 @@ SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
SiS_SetReg(SiS_Pr->SiS_P3d4,0x52,0x6c);
}
#if 0 /* What is SR0E[D5:6]? */
+ /* These are in the CRT1 table, and we set by CRT1CRTC */
if(HwInfo->jChipType >= SIS_661) {
data = 0;
if((ModeNo == 6) || ((ModeNo >= 0x0e) && (ModeNo <= 0x13))) {
data |= 0x20;
}
if(SiS_Pr->SiS_ModeType != ModeVGA) {
- if(SiS_Pr->UseCustomMode) {
- if((xres >= 640) && (SiS_Pr->CVDisplay >= 480)) {
- data |= 0x40;
- }
- if((xres > 1280) && (SiS_Pr->CVDisplay > 1024)) {
- data |= 0x60;
- }
- }
- } else if(ModeNo > 0x13) { /* These are in the CRT1 table, and set by CRT1CRTC */
- if(resinfo >= SIS_RI_640x480) {
- if(resinfo <= SIS_RI_2048x1536) {
- data |= 0x40;
- if(resinfo > SIS_RI_1280x1024) {
- data |= 0x60;
- if(resinfo != SIS_RI_1600x1200) {
- data = SiS_GetReg(SiS_Pr->SiS_P3c4,0x0e);
- data += 0x60;
- SiS_SetReg(SiS_Pr->SiS_P3c4,0x0e);
- data = 0;
+ if(ModeNo > 0x13) {
+ if(resinfo >= SIS_RI_640x480) {
+ if(resinfo <= SIS_RI_2048x1536) {
+ data |= 0x40;
+ if(resinfo > SIS_RI_1280x1024) {
+ data |= 0x60;
+ if(resinfo != SIS_RI_1600x1200) {
+ data = SiS_GetReg(SiS_Pr->SiS_P3c4,0x0e);
+ data += 0x60;
+ SiS_SetReg(SiS_Pr->SiS_P3c4,0x0e);
+ data = 0;
+ }
}
- }
- }
- if(resinfo == SIS_RI_1152x864) {
- data = 0x40;
- }
- if(resinfo == SIS_RI_1400x1050) { /* TW */
- data = 0x60;
+ }
+ if(resinfo == SIS_RI_1152x864) {
+ data = 0x40;
+ }
+ if(resinfo == SIS_RI_1400x1050) { /* TW */
+ data = 0x60;
+ }
}
}
}
@@ -3444,12 +3482,12 @@ SiS_SetCRT1Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
static void
SiS_HandleCRT1(SiS_Private *SiS_Pr)
{
- SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x63,0xbf);
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,SiS_Pr->SiS_MyCR63,0xbf);
#if 0
if(!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x15) & 0x01)) {
if((SiS_GetReg(SiS_Pr->SiS_P3c4,0x15) & 0x0a) ||
(SiS_GetReg(SiS_Pr->SiS_P3c4,0x16) & 0x01)) {
- SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x63,0x40);
+ SiS_SetRegOR(SiS_Pr->SiS_P3d4,SiS_Pr->SiS_MyCR63,0x40);
}
}
#endif
@@ -3545,7 +3583,7 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo)
USHORT ModeIdIndex;
UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
SISIOADDRESS BaseAddr = HwInfo->ulIOAddress;
- unsigned char backupreg=0, tempr1, tempr2;
+ unsigned char backupreg=0;
#ifndef LINUX_XF86
USHORT KeepLockReg;
@@ -3558,9 +3596,7 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo)
}
SiSInitPtr(SiS_Pr, HwInfo);
-
SiSRegInit(SiS_Pr, BaseAddr);
-
SiS_GetSysFlags(SiS_Pr, HwInfo);
#ifdef LINUX_XF86
@@ -3570,25 +3606,16 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo)
SiS_Pr->SiS_VGAINFO = 0x11;
SiSInitPCIetc(SiS_Pr, HwInfo);
-
SiSSetLVDSetc(SiS_Pr, HwInfo);
-
SiSDetermineROMUsage(SiS_Pr, HwInfo);
- if(!SiS_Pr->UseCustomMode) {
- ModeNo = ((ModeNo & 0x80) << 8) | (ModeNo & 0x7f);
- }
+ SiS_Pr->SiS_flag_clearbuffer = 0;
-#ifdef LINUX_XF86
- /* We never clear the buffer in X */
- ModeNo |= 0x8000;
+ if(!SiS_Pr->UseCustomMode) {
+#ifndef LINUX_XF86
+ if(!(ModeNo & 0x80)) SiS_Pr->SiS_flag_clearbuffer = 1;
#endif
-
- if(ModeNo & 0x8000) {
- ModeNo &= 0x7fff;
- SiS_Pr->SiS_flag_clearbuffer = 0;
- } else {
- SiS_Pr->SiS_flag_clearbuffer = 1;
+ ModeNo &= 0x7f;
}
#ifndef LINUX_XF86
@@ -3607,15 +3634,19 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo)
SiS_GetVBType(SiS_Pr, HwInfo);
/* Init/restore some VB registers */
+
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
if(HwInfo->jChipType >= SIS_315H) {
- SiS_UnLockCRT2(SiS_Pr,HwInfo);
- if(HwInfo->jChipType < SIS_330) {
- if(ROMAddr && SiS_Pr->SiS_UseROM) {
+ if(ROMAddr && SiS_Pr->SiS_UseROM) {
+ if(HwInfo->jChipType < SIS_330) {
temp = ROMAddr[VB310Data_1_2_Offset];
temp |= 0x40;
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x02,temp);
- }
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x02,temp);
+ } else if(HwInfo->jChipType >= SIS_661) {
+ temp = ROMAddr[0x7e];
+ if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x7b) >= 100) temp |= 0x40;
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x02,temp);
+ }
}
SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x32,0x10);
@@ -3651,11 +3682,15 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo)
}
#endif
- if(IS_SIS650) {
- if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(IS_SIS650) {
SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x51,0x1f);
if(IS_SIS651) SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x51,0x20);
SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x56,0xe7);
+ } else if(IS_SIS661741660760) {
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x51,0x1f);
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x56,0xe7);
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x3a,0xef);
}
}
}
@@ -3711,14 +3746,6 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo)
SiS_SetReg(SiS_Pr->SiS_P3d4,0x38,backupreg);
- tempr1 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);
- tempr2 = SiS_GetReg(SiS_Pr->SiS_Part2Port,0x00);
- if(tempr1 & SetCRT2ToAVIDEO) tempr2 &= 0xF7;
- else tempr2 |= 0x08;
- if(tempr1 & SetCRT2ToSVIDEO) tempr2 &= 0xFB;
- else tempr2 |= 0x04;
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x00,tempr2);
-
if((IS_SIS650) && (SiS_GetReg(SiS_Pr->SiS_P3d4,0x30) & 0xfc)) {
if((ModeNo == 0x03) || (ModeNo == 0x10)) {
SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x51,0x80);
@@ -3726,7 +3753,7 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo)
}
}
- if(tempr1 & SetCRT2ToLCD) {
+ if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x30) & SetCRT2ToLCD) {
SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc);
}
} else if((HwInfo->jChipType == SIS_630) ||
@@ -3803,7 +3830,7 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
SISIOADDRESS BaseAddr = HwInfo->ulIOAddress;
UShort ModeNo = 0;
- unsigned char tempr1, tempr2, backupreg=0;
+ unsigned char backupreg=0;
SISPtr pSiS = SISPTR(pScrn);
#ifdef SISDUALHEAD
SISEntPtr pSiSEnt = pSiS->entityPrivate;
@@ -3835,17 +3862,11 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
}
SiSRegInit(SiS_Pr, BaseAddr);
-
SiSInitPtr(SiS_Pr, HwInfo);
-
SiS_GetSysFlags(SiS_Pr, HwInfo);
-
SiS_Pr->SiS_VGAINFO = SiS_GetSetBIOSScratch(pScrn, 0x489, 0xff);
-
SiSInitPCIetc(SiS_Pr, HwInfo);
-
SiSSetLVDSetc(SiS_Pr, HwInfo);
-
SiSDetermineROMUsage(SiS_Pr, HwInfo);
/* Save mode info so we can set it from within SetMode for CRT1 */
@@ -3906,12 +3927,17 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
if(HwInfo->jChipType >= SIS_315H) {
SiS_UnLockCRT2(SiS_Pr,HwInfo);
- if(HwInfo->jChipType < SIS_330) {
- if(ROMAddr && SiS_Pr->SiS_UseROM) {
+ if(ROMAddr && SiS_Pr->SiS_UseROM) {
+ if(HwInfo->jChipType < SIS_330) {
temp = ROMAddr[VB310Data_1_2_Offset];
temp |= 0x40;
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x02,temp);
}
+ if(HwInfo->jChipType > SIS_330) {
+ temp = ROMAddr[0x7e];
+ if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x7b) >= 100) temp |= 0x40;
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x02,temp);
+ }
}
SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x32,0x10);
@@ -3968,15 +3994,7 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
SiS_SetReg(SiS_Pr->SiS_P3d4,0x38,backupreg);
- tempr1 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);
- tempr2 = SiS_GetReg(SiS_Pr->SiS_Part2Port,0x00);
- if(tempr1 & SetCRT2ToAVIDEO) tempr2 &= 0xF7;
- else tempr2 |= 0x08;
- if(tempr1 & SetCRT2ToSVIDEO) tempr2 &= 0xFB;
- else tempr2 |= 0x04;
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x00,tempr2);
-
- if(tempr1 & SetCRT2ToLCD) {
+ if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x30) & SetCRT2ToLCD) {
SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc);
}
} else if((HwInfo->jChipType == SIS_630) ||
@@ -4034,17 +4052,11 @@ SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
}
SiSInitPtr(SiS_Pr, HwInfo);
-
SiSRegInit(SiS_Pr, BaseAddr);
-
SiS_GetSysFlags(SiS_Pr, HwInfo);
-
SiS_Pr->SiS_VGAINFO = SiS_GetSetBIOSScratch(pScrn, 0x489, 0xff);
-
SiSInitPCIetc(SiS_Pr, HwInfo);
-
SiSSetLVDSetc(SiS_Pr, HwInfo);
-
SiSDetermineROMUsage(SiS_Pr, HwInfo);
/* We don't clear the buffer under X */
@@ -4090,11 +4102,15 @@ SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
}
#endif
- if(IS_SIS650) {
- if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(IS_SIS650) {
SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x51,0x1f);
if(IS_SIS651) SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x51,0x20);
SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x56,0xe7);
+ } else if(IS_SIS661741660760) {
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x51,0x1f);
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x56,0xe7);
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x3a,0xef);
}
}
}
diff --git a/src/init.h b/src/init.h
index d41877e..6a766ae 100644
--- a/src/init.h
+++ b/src/init.h
@@ -1,36 +1,55 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.h,v 1.38 2003/12/16 17:59:08 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.h,v 1.46 2004/01/27 11:58:27 twini Exp $ */
/*
* Data and prototypes for init.c
*
- * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
*
- * If distributed as part of the linux kernel, the contents of this file
- * is entirely covered by the GPL.
+ * If distributed as part of the Linux kernel, the following license terms
+ * apply:
*
- * Otherwise, the following terms apply:
+ * * This program is free software; you can redistribute it and/or modify
+ * * it under the terms of the GNU General Public License as published by
+ * * the Free Software Foundation; either version 2 of the named License,
+ * * or any later version.
+ * *
+ * * This program is distributed in the hope that it will be useful,
+ * * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * * GNU General Public License for more details.
+ * *
+ * * You should have received a copy of the GNU General Public License
+ * * along with this program; if not, write to the Free Software
+ * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Otherwise, the following license terms apply:
*
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * * Redistribution and use in source and binary forms, with or without
+ * * modification, are permitted provided that the following conditions
+ * * are met:
+ * * 1) Redistributions of source code must retain the above copyright
+ * * notice, this list of conditions and the following disclaimer.
+ * * 2) Redistributions in binary form must reproduce the above copyright
+ * * notice, this list of conditions and the following disclaimer in the
+ * * documentation and/or other materials provided with the distribution.
+ * * 3) All advertising materials mentioning features or use of this software
+ * * must display the following acknowledgement: "This product includes
+ * * software developed by Thomas Winischhofer, Vienna, Austria."
+ * * 4) The name of the author may not be used to endorse or promote products
+ * * derived from this software without specific prior written permission.
+ * *
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Author: Thomas Winischhofer <thomas@winischhofer.net>
*
- * Based on code by Silicon Intergrated Systems
- *
*/
#ifndef _INIT_
@@ -739,6 +758,7 @@ static const UCHAR SiS_HiTVSt2Timing[] = {
0x63,0x4f,0x27,0x00,0xfc,0xff,0x6a,0x00
};
+#if 0
static const UCHAR SiS_HiTVTextTiming[] = {
0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65,
0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
@@ -749,6 +769,7 @@ static const UCHAR SiS_HiTVTextTiming[] = {
0x60,0x80,0x14,0x90,0x8c,0x60,0x04,0x96,
0x72,0x5c,0x11,0x00,0xfc,0xff,0x32,0x00
};
+#endif
static const UCHAR SiS_HiTVGroup3Data[] = {
0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x5f,
@@ -772,6 +793,7 @@ static const UCHAR SiS_HiTVGroup3Simu[] = {
0x18,0x05,0x18,0x05,0x4c,0xa8,0x01
};
+#if 0
static const UCHAR SiS_HiTVGroup3Text[] = {
0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0xa7,
0xf5,0x20,0xce,0xce,0x55,0x47,0x2a,0xa6,
@@ -782,6 +804,7 @@ static const UCHAR SiS_HiTVGroup3Text[] = {
0x01,0x05,0x03,0x7e,0x65,0x31,0x14,0x75,
0x18,0x05,0x18,0x05,0x4c,0xa8,0x01
};
+#endif
static const UCHAR SiS_NTSCPhase[] = {0x21,0xed,0xba,0x08};
static const UCHAR SiS_PALPhase[] = {0x2a,0x05,0xe3,0x00};
@@ -795,7 +818,7 @@ static const UCHAR SiS_SpecialPhase[] = {0x1e,0x8c,0x5c,0x7a};
static const UCHAR SiS_SpecialPhaseM[]= {0x1e,0x83,0x0a,0xe0};
static const UCHAR SiS_SpecialPhaseJ[]= {0x25,0xd4,0xfd,0x5e};
-static const SiS_TVDataStruct SiS_StPALData[]=
+static const SiS_TVDataStruct SiS_StPALData[] =
{
{ 1, 1, 864, 525,1270, 400, 100, 0, 760,0xf4,0xff,0x1c,0x22},
{ 1, 1, 864, 525,1270, 350, 100, 0, 760,0xf4,0xff,0x1c,0x22},
@@ -815,10 +838,11 @@ static const SiS_TVDataStruct SiS_ExtPALData[] =
/*{ 36, 25,1060, 648,1316, 530, 438, 0, 438,0xeb,0x05,0x25,0x16},*//* 800x600, 400x300 */
{ 36, 25,1060, 648,1270, 530, 438, 0, 438,0xeb,0x05,0x25,0x16}, /* 800x600, 400x300 - better */
{ 3, 2,1080, 619,1270, 540, 438, 0, 438,0xf3,0x00,0x1d,0x20}, /* 720x576 */
- { 1, 1,1170, 821,1270, 520, 686, 0, 686,0xF3,0x00,0x1D,0x20} /* 1024x768 */
+ { 1, 1,1170, 821,1270, 520, 686, 0, 686,0xF3,0x00,0x1D,0x20}, /* 1024x768 */
+ { 1, 1,1170, 821,1270, 520, 686, 0, 686,0xF3,0x00,0x1D,0x20} /* 1024x768 (for NTSC equ) */
};
-static const SiS_TVDataStruct SiS_StNTSCData[]=
+static const SiS_TVDataStruct SiS_StNTSCData[] =
{
{ 1, 1, 858, 525,1270, 400, 50, 0, 760,0xf1,0x04,0x1f,0x18},
{ 1, 1, 858, 525,1270, 350, 50, 0, 640,0xf1,0x04,0x1f,0x18},
@@ -827,7 +851,7 @@ static const SiS_TVDataStruct SiS_StNTSCData[]=
{ 1, 1, 858, 525,1270, 480, 0, 0, 760,0xf1,0x04,0x1f,0x18}
};
-static const SiS_TVDataStruct SiS_ExtNTSCData[]=
+static const SiS_TVDataStruct SiS_ExtNTSCData[] =
{
{ 143, 65, 858, 443,1270, 440, 171, 0, 171,0xf1,0x04,0x1f,0x18}, /* 640x400, 320x200 */
{ 88, 35, 858, 393,1270, 440, 171, 0, 171,0xf1,0x04,0x1f,0x18},
@@ -835,37 +859,78 @@ static const SiS_TVDataStruct SiS_ExtNTSCData[]=
{ 143, 70, 924, 393,1270, 440, 92, 0, 92,0xf4,0x0b,0x1c,0x0a},
{ 143, 76, 836, 523,1270, 440, 224, 0, 0,0xf1,0x05,0x1f,0x16}, /* 640x480, 320x240 */
{ 143, 120,1056, 643,1270, 440, 0, 128, 0,0xf4,0x10,0x1c,0x00}, /* 800x600, 400x300 */
- { 143, 76, 836, 523,1270, 440, 0, 128, 0,0xee,0x0c,0x22,0x08}, /* 720x480 - BETTER (from 300 series) */
/*{ 2, 1, 858, 503,1270, 480, 0, 128, 0,0xee,0x0c,0x22,0x08},*/ /* 720x480 (old, from 650) */
- { 1, 1,1100, 811,1412, 440, 0, 128, 0,0xee,0x0c,0x22,0x08} /* 1024x768 CORRECTED */
-/*{ 65, 64,1056, 791,1270, 480, 638, 0, 0,0xEE,0x0C,0x22,0x08} */ /* 1024x768 */
+ { 143, 76, 836, 523,1270, 440, 0, 128, 0,0xee,0x0c,0x22,0x08}, /* 720x480 - BETTER (from 300 series) */
+/*{ 65, 64,1056, 791,1270, 480, 638, 0, 0,0xEE,0x0C,0x22,0x08} */ /* 1024x768 (525i) */
+ { 1, 1,1100, 811,1412, 440, 0, 128, 0,0xee,0x0c,0x22,0x08}, /* 1024x768 (525i) CORRECTED */
+ { 65, 64,1056, 791,1270, 480, 455, 0, 0,0x00,0x00,0x00,0x00} /* 1024x768 (525p) */
+};
+
+static const SiS_TVDataStruct SiS_StHiTVData[] = /* Slave + TVSimu */
+{
+ { 1, 1, 0x37c,0x233,0x2b2,0x320, 0, 0, 0, 0x00,0x00,0x00,0x00},
+ { 1, 1, 0x37c,0x233,0x2b2,0x2bc, 0, 0, 0, 0x00,0x00,0x00,0x00},
+ { 1, 1, 0x37c,0x233,0x2b2,0x320, 0, 0, 0, 0x00,0x00,0x00,0x00},
+ { 1, 1, 0x37c,0x233,0x2b2,0x2bc, 0, 0, 0, 0x00,0x00,0x00,0x00},
+ { 1, 1, 0x37c,0x233,0x2b2,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00},
+ { 8, 5, 0x41a,0x2ab,0x670,0x3c0,0x150,128, 0, 0x00,0x00,0x00,0x00}
};
-static const SiS_TVDataStruct SiS_St2HiTVData[]=
+static const SiS_TVDataStruct SiS_St2HiTVData[] = /* Slave */
{
{ 3, 1, 0x348,0x1e3,0x670,0x3c0,0x032, 0, 0, 0x00,0x00,0x00,0x00},
{ 1, 1, 0x37c,0x233,0x2b2,0x2bc, 0, 0, 0, 0x00,0x00,0x00,0x00},
{ 3, 1, 0x348,0x1e3,0x670,0x3c0,0x032, 0, 0, 0x00,0x00,0x00,0x00},
- { 1, 1, 0x3e8,0x233,0x311,0x2bc, 0, 0, 0, 0x00,0x00,0x00,0x00},
+ { 1, 1, 0x37c,0x233,0x2b2,0x2bc, 0, 0, 0, 0x00,0x00,0x00,0x00},
{ 5, 2, 0x348,0x233,0x670,0x3c0,0x08d,128, 0, 0x00,0x00,0x00,0x00},
{ 8, 5, 0x41a,0x2ab,0x670,0x3c0,0x17c,128, 0, 0x00,0x00,0x00,0x00}
};
-static const SiS_TVDataStruct SiS_ExtHiTVData[]=
+static const SiS_TVDataStruct SiS_ExtHiTVData[] =
{
{ 6, 1, 0x348,0x233,0x660,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00},
{ 3, 1, 0x3c0,0x233,0x660,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00},
- { 3, 1, 0x348,0x1e3,0x660,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00},
+ { 6, 1, 0x348,0x233,0x660,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00},
{ 3, 1, 0x3c0,0x233,0x660,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00},
{ 5, 1, 0x348,0x233,0x670,0x3c0,0x166,128, 0, 0x00,0x00,0x00,0x00}, /* 640x480 */
{ 16, 5, 0x41a,0x2ab,0x670,0x3c0,0x143,128, 0, 0x00,0x00,0x00,0x00}, /* 800x600 */
{ 25, 12, 0x4ec,0x353,0x670,0x3c0,0x032, 0, 0, 0x00,0x00,0x00,0x00}, /* 1024x768 */
{ 5, 4, 0x627,0x464,0x670,0x3c0,0x128, 0, 0, 0x00,0x00,0x00,0x00}, /* 1280x1024 */
- { 4, 1, 0x41a,0x233,0x670,0x3c0,0x143,128, 0, 0x00,0x00,0x00,0x00}, /* 800x480 */
+ { 4, 1, 0x41a,0x233,0x60c,0x3c0,0x143,128, 0, 0x00,0x00,0x00,0x00}, /* 800x480 */
{ 5, 2, 0x578,0x293,0x670,0x3c0,0x032, 0, 0, 0x00,0x00,0x00,0x00}, /* 1024x576 */
{ 8, 5, 0x6d6,0x323,0x670,0x3c0,0x128, 0, 0, 0x00,0x00,0x00,0x00} /* 1280x720 */
};
+static const SiS_TVDataStruct SiS_St525pData[] =
+{
+ { 1, 1, 0x6b4,0x20d,0x4f6,0x190, 50, 0, 0x2f8, 0x00,0x00,0x00,0x00},
+ { 1, 1, 0x6b4,0x20d,0x4f6,0x15e, 50, 0, 0x280, 0x00,0x00,0x00,0x00},
+ { 1, 1, 0x6b4,0x20d,0x4f6,0x190, 50, 0, 0x2f8, 0x00,0x00,0x00,0x00},
+ { 1, 1, 0x6b4,0x20d,0x4f6,0x15e, 50, 0, 0x280, 0x00,0x00,0x00,0x00},
+ { 1, 1, 0x6b4,0x20d,0x4f6,0x1e0, 0, 0, 0x2f8, 0x00,0x00,0x00,0x00}
+};
+
+static const SiS_TVDataStruct SiS_St750pData[] =
+{
+ { 1, 1, 0x672,0x2ee,0x500,0x190, 50, 0, 0x2f8, 0x00,0x00,0x00,0x00},
+ { 1, 1, 0x672,0x2ee,0x500,0x15e, 50, 0, 0x280, 0x00,0x00,0x00,0x00},
+ { 1, 1, 0x672,0x2ee,0x500,0x190, 0, 0, 0x2d0, 0x00,0x00,0x00,0x00},
+ { 1, 1, 0x672,0x2ee,0x500,0x15e, 0, 0, 0x2d0, 0x00,0x00,0x00,0x00},
+ { 1, 1, 0x672,0x2ee,0x500,0x1e0, 0, 0, 0x2f8, 0x00,0x00,0x00,0x00}
+};
+
+static const SiS_TVDataStruct SiS_Ext750pData[] =
+{
+ { 3, 1, 0x3a7,0x1d6,0x500,0x2a8, 50, 0, 0, 0x00,0x00,0x00,0x00},
+ { 24, 7, 0x3a7,0x1a4,0x500,0x2a8, 50, 0, 0, 0x00,0x00,0x00,0x00},
+ { 3, 1, 0x3a7,0x1d6,0x500,0x2a8, 50, 0, 0, 0x00,0x00,0x00,0x00},
+ { 24, 7, 0x3a7,0x1a4,0x500,0x2a8, 50, 0, 0, 0x00,0x00,0x00,0x00},
+ { 99, 32, 0x320,0x1fe,0x500,0x2d0, 50, 0, 0, 0x00,0x00,0x00,0x00}, /* 640x480 */
+ { 5, 4, 0x5d8,0x29e,0x500,0x2a8, 50, 0, 0, 0x00,0x00,0x00,0x00}, /* 800x600 */
+ { 2, 1, 0x35a,0x1f7,0x4f6,0x1e0, 0,128, 0, 0x00,0x00,0x00,0x00}, /* 720x480 */
+ { 68, 64, 0x55f,0x346,0x500,0x2a8,0x27e, 0, 0, 0x00,0x00,0x00,0x00}, /* 1024x768 */
+};
+
static const SiS_LCDDataStruct SiS_LCD1280x960Data[] =
{
{ 9, 2, 800, 500,1800,1000},
@@ -1103,7 +1168,7 @@ static const SiS_LVDSDataStruct SiS_LCDA1400x1050Data_2[]=
};
static const SiS_LVDSDataStruct SiS_LCDA1600x1200Data_1[]=
-{ /* Clevo (Temporary data) */
+{ /* Clevo, 651+301C */
{1200, 450, 2048,1250},
{1200, 400, 2048,1250},
{1280, 450, 2048,1250},
@@ -1113,14 +1178,16 @@ static const SiS_LVDSDataStruct SiS_LCDA1600x1200Data_1[]=
{1584, 818, 2048,1250},
{1688,1066, 2048,1250},
{1688,1066, 2048,1250},
- {2048,1250, 2048,1250} /* this should be correct */
#if 0
+ {2048,1250, 2048,1250} /* this should be correct */
+#endif
+#if 1
{2160,1250, 2048,1250} /* ? */
#endif
};
static const SiS_LVDSDataStruct SiS_LCDA1600x1200Data_2[]=
-{ /* Clevo (Temporary data. Seems invalid.) */
+{ /* Clevo, 651+301C */
{2160,1250, 2160,1250},
{2160,1250, 2160,1250},
{2160,1250, 2160,1250},
diff --git a/src/init301.c b/src/init301.c
index 51156bd..55a69a7 100644
--- a/src/init301.c
+++ b/src/init301.c
@@ -1,35 +1,60 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c,v 1.59 2003/12/16 17:35:05 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c,v 1.69 2004/01/23 22:29:02 twini Exp $ */
/*
* Mode initializing code (CRT2 section)
* for SiS 300/305/540/630/730 and
- * SiS 315/550/650/M650/651/661FX/M661xX/740/741/330/660/M660/760/M760
+ * SiS 315/550/650/M650/651/661FX/M661xX/740/741/M741/330/660/M660/760/M760
* (Universal module for Linux kernel framebuffer and XFree86 4.x)
*
- * Copyright 2002, 2003 by Thomas Winischhofer <thomas@winischhofer.net>
- * Formerly based on non-functional code-fragements for 300 series by SiS, Inc.
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
+ *
+ * If distributed as part of the Linux kernel, the following license terms
+ * apply:
*
- * If distributed as part of the linux kernel, the contents of this file
- * is entirely covered by the GPL.
+ * * This program is free software; you can redistribute it and/or modify
+ * * it under the terms of the GNU General Public License as published by
+ * * the Free Software Foundation; either version 2 of the named License,
+ * * or any later version.
+ * *
+ * * This program is distributed in the hope that it will be useful,
+ * * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * * GNU General Public License for more details.
+ * *
+ * * You should have received a copy of the GNU General Public License
+ * * along with this program; if not, write to the Free Software
+ * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
*
- * Otherwise, the following terms apply:
+ * Otherwise, the following license terms apply:
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * * Redistribution and use in source and binary forms, with or without
+ * * modification, are permitted provided that the following conditions
+ * * are met:
+ * * 1) Redistributions of source code must retain the above copyright
+ * * notice, this list of conditions and the following disclaimer.
+ * * 2) Redistributions in binary form must reproduce the above copyright
+ * * notice, this list of conditions and the following disclaimer in the
+ * * documentation and/or other materials provided with the distribution.
+ * * 3) All advertising materials mentioning features or use of this software
+ * * must display the following acknowledgement: "This product includes
+ * * software developed by Thomas Winischhofer, Vienna, Austria."
+ * * 4) The name of the author may not be used to endorse or promote products
+ * * derived from this software without specific prior written permission.
+ * *
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * Author: Thomas Winischhofer <thomas@winischhofer.net>
+ *
+ * Formerly based on non-functional code-fragements for 300 series by SiS, Inc.
+ * Used by permission.
*
* TW says: This code looks awful, I know. But please don't do anything about
* this otherwise debugging will be hell.
@@ -40,7 +65,7 @@
* All comments in this file are by me, regardless if marked TW or not.
*
*/
-
+
#if 1
#define SET_EMI /* 302LV/ELV: Set EMI values */
#endif
@@ -99,6 +124,17 @@ SiS_EnableCRT2(SiS_Private *SiS_Pr)
}
/*********************************************/
+/* HELPER: Write SR11 */
+/*********************************************/
+
+static void
+SiS_SetRegSR11ANDOR(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DataAND, USHORT DataOR)
+{
+ if(HwInfo->jChipType >= SIS_661) DataAND &= 0x0f;
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,DataAND,DataOR);
+}
+
+/*********************************************/
/* HELPER: Get Pointer to LCD structure */
/*********************************************/
@@ -225,16 +261,7 @@ SiS_AdjustCRT2Rate(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
USHORT RefreshRateTableIndex, USHORT *i,
PSIS_HW_INFO HwInfo)
{
- USHORT tempax,tempbx,resinfo;
- USHORT modeflag,infoflag;
-
- if(ModeNo <= 0x13) {
- modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
- resinfo = 0;
- } else {
- modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
- }
+ USHORT tempax,tempbx,infoflag;
tempbx = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].ModeID;
@@ -263,29 +290,16 @@ SiS_AdjustCRT2Rate(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
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) {
- if(!(SiS_Pr->CP_Supports64048075)) {
- tempax |= Support64048060Hz;
- }
- }
-#endif
}
}
}
}
- } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) {
+ } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
- if(SiS_Pr->SiS_YPbPr == YPbPrHiVision) {
- tempax |= SupportYPbPr2;
- } else {
- tempax |= SupportYPbPr;
- }
+ tempax |= SupportHiVision;
- } else if(SiS_Pr->SiS_VBInfo & (SetCRT2ToAVIDEO | SetCRT2ToSVIDEO | SetCRT2ToSCART)) {
+ } else if(SiS_Pr->SiS_VBInfo & (SetCRT2ToYPbPr525750|SetCRT2ToAVIDEO|SetCRT2ToSVIDEO|SetCRT2ToSCART)) {
tempax |= SupportTV;
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
@@ -360,7 +374,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]. */
+ /* 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;
@@ -448,6 +462,7 @@ SiS_SaveCRT2Info(SiS_Private *SiS_Pr, USHORT ModeNo)
/* HELPER: GET SOME DATA FROM BIOS ROM */
/*********************************************/
+#ifdef SIS300
static BOOLEAN
SiS_CR36BIOSWord23b(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
@@ -458,10 +473,10 @@ SiS_CR36BIOSWord23b(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
if((ROMAddr[0x233] == 0x12) && (ROMAddr[0x234] == 0x34)) {
temp = 1 << ((SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) & 0xff) >> 4);
temp1 = (ROMAddr[0x23c] << 8) | ROMAddr[0x23b];
- if(temp1 & temp) return(1);
+ if(temp1 & temp) return TRUE;
}
}
- return(0);
+ return FALSE;
}
static BOOLEAN
@@ -474,11 +489,12 @@ SiS_CR36BIOSWord23d(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
if((ROMAddr[0x233] == 0x12) && (ROMAddr[0x234] == 0x34)) {
temp = 1 << ((SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) & 0xff) >> 4);
temp1 = (ROMAddr[0x23e] << 8) | ROMAddr[0x23d];
- if(temp1 & temp) return(1);
+ if(temp1 & temp) return TRUE;
}
}
- return(0);
+ return FALSE;
}
+#endif
/*********************************************/
/* HELPER: DELAY FUNCTIONS */
@@ -616,10 +632,7 @@ SiS_PanelDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DelayTime)
} else {
Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[1];
}
- Delay <<= 2;
- if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
- Delay <<= 5;
- }
+ Delay <<= 8;
SiS_DDC2Delay(SiS_Pr, Delay);
}
@@ -801,6 +814,27 @@ SiS_IsDualLink(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
#ifdef SIS315H
static BOOLEAN
+SiS_TVEnabled(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
+{
+ if((SiS_GetReg(SiS_Pr->SiS_Part2Port,0x00) & 0x0f) != 0x0c) return TRUE;
+ if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS301LV302LV)) {
+ if(SiS_GetReg(SiS_Pr->SiS_Part2Port,0x4d) & 0x10) return TRUE;
+ }
+ return FALSE;
+}
+#endif
+
+#ifdef SIS315H
+static BOOLEAN
+SiS_LCDAEnabled(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
+{
+ if(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x13) & 0x04) return TRUE;
+ return FALSE;
+}
+#endif
+
+#ifdef SIS315H
+static BOOLEAN
SiS_WeHaveBacklightCtrl(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
USHORT flag;
@@ -980,13 +1014,11 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo,
if(ModeNo <= 0x13) {
modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ } else if(SiS_Pr->UseCustomMode) {
+ modeflag = SiS_Pr->CModeFlag;
} else {
- if(SiS_Pr->UseCustomMode) {
- modeflag = SiS_Pr->CModeFlag;
- } else {
- modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
- }
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
}
SiS_Pr->SiS_SetFlag = 0;
@@ -997,20 +1029,22 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo,
if(SiS_BridgeIsOn(SiS_Pr) == 0) {
temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);
#if 0
- 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 */
+ if(HwInfo->jChipType < SIS_661) {
+ /* NO - YPbPr not set yet ! */
+ if(SiS_Pr->SiS_YPbPr & <all ypbpr except 525i>) {
+ temp &= (SetCRT2ToHiVision | SwitchCRT2 | SetSimuScanMode); /* 0x83 */
+ temp |= SetCRT2ToHiVision; /* 0x80 */
+ }
+ if(SiS_Pr->SiS_YPbPr & <ypbpr525i>) {
+ temp &= (SetCRT2ToHiVision | SwitchCRT2 | SetSimuScanMode); /* 0x83 */
+ temp |= SetCRT2ToSVIDEO; /* 0x08 */
+ }
}
#endif
tempbx |= temp;
tempax = SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) << 8;
- tempax &= (LoadDACFlag | DriverMode | SetDispDevSwitch | SetNotSimuMode | SetPALTV);
+ tempax &= (DriverMode | LoadDACFlag | SetNotSimuMode | SetPALTV);
tempbx |= tempax;
- tempbx &= ~(SetCHTVOverScan | SetInSlaveMode | DisableCRT2Display);;
#ifdef SIS315H
if(HwInfo->jChipType >= SIS_315H) {
@@ -1036,7 +1070,23 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo,
if((temp & (EnableDualEdge | SetToLCDA)) == (EnableDualEdge | SetToLCDA)) {
tempbx |= SetCRT2ToLCDA;
}
- }
+ }
+ if(HwInfo->jChipType >= SIS_661) {
+ tempbx &= ~(SetCRT2ToYPbPr525750 | SetCRT2ToHiVision);
+ temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);
+ if(SiS_Pr->SiS_VBType & (VB_SIS301C|VB_SIS301LV|VB_SIS302LV|VB_SIS302ELV)) {
+ if(temp & 0x04) {
+ temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35) & 0xe0;
+ if(temp == 0x60) tempbx |= SetCRT2ToHiVision;
+ else tempbx |= SetCRT2ToYPbPr525750;
+ }
+ } else if(SiS_Pr->SiS_VBType & (VB_SIS301 | VB_SIS301B | VB_SIS302B)) {
+ if(temp & 0x04) {
+ temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35) & 0xe0;
+ if(temp == 0x60) tempbx |= SetCRT2ToHiVision;
+ }
+ }
+ }
if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);
@@ -1045,7 +1095,7 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo,
}
if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
if(temp & EnableCHYPbPr) {
- tempbx |= SetCRT2ToYPbPr;
+ tempbx |= SetCRT2ToCHYPbPr;
}
}
}
@@ -1054,13 +1104,14 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo,
#endif /* SIS315H */
if(SiS_Pr->SiS_VBType & VB_SISVB) {
- temp = SetCRT2ToSVIDEO |
- SetCRT2ToAVIDEO |
- SetCRT2ToSCART |
- SetCRT2ToLCDA |
- SetCRT2ToLCD |
- SetCRT2ToRAMDAC |
- SetCRT2ToYPbPr;
+ temp = SetCRT2ToSVIDEO |
+ SetCRT2ToAVIDEO |
+ SetCRT2ToSCART |
+ SetCRT2ToLCDA |
+ SetCRT2ToLCD |
+ SetCRT2ToRAMDAC |
+ SetCRT2ToHiVision |
+ SetCRT2ToYPbPr525750;
} else {
if(HwInfo->jChipType >= SIS_315H) {
if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
@@ -1069,7 +1120,7 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo,
SetCRT2ToSCART |
SetCRT2ToLCDA |
SetCRT2ToLCD |
- SetCRT2ToYPbPr;
+ SetCRT2ToCHYPbPr;
} else {
temp = SetCRT2ToLCDA |
SetCRT2ToLCD;
@@ -1089,21 +1140,32 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo,
}
if(SiS_Pr->SiS_VBType & VB_SISVB) {
+ USHORT clearmask = ( DriverMode |
+ DisableCRT2Display |
+ LoadDACFlag |
+ SetNotSimuMode |
+ SetInSlaveMode |
+ SetPALTV |
+ SwitchCRT2 |
+ SetSimuScanMode );
if(tempbx & SetCRT2ToLCDA) {
- tempbx &= (0xFF00|SwitchCRT2|SetSimuScanMode);
+ tempbx &= (clearmask | SetCRT2ToLCDA);
}
if(tempbx & SetCRT2ToRAMDAC) {
- tempbx &= (0xFF00|SetCRT2ToRAMDAC|SwitchCRT2|SetSimuScanMode);
+ tempbx &= (clearmask | SetCRT2ToRAMDAC);
}
if(tempbx & SetCRT2ToLCD) {
- tempbx &= (0xFF00|SetCRT2ToLCD|SwitchCRT2|SetSimuScanMode);
+ tempbx &= (clearmask | SetCRT2ToLCD);
}
if(tempbx & SetCRT2ToSCART) {
- tempbx &= (0xFF00|SetCRT2ToSCART|SwitchCRT2|SetSimuScanMode);
+ tempbx &= (clearmask | SetCRT2ToSCART);
}
- if(tempbx & SetCRT2ToYPbPr) {
- tempbx &= (0xFF00|SetCRT2ToYPbPr|SwitchCRT2|SetSimuScanMode);
+ if(tempbx & SetCRT2ToHiVision) {
+ tempbx &= (clearmask | SetCRT2ToHiVision);
}
+ if(tempbx & SetCRT2ToYPbPr525750) {
+ tempbx &= (clearmask | SetCRT2ToYPbPr525750);
+ }
} else {
if(HwInfo->jChipType >= SIS_315H) {
if(tempbx & SetCRT2ToLCDA) {
@@ -1212,20 +1274,40 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo,
void
SiS_SetYPbPr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
+
+ UCHAR temp;
+
/* Note: This variable is only used on 30xLV systems.
* CR38 has a different meaning on LVDS/CH7019 systems.
+ * On 661 and later, these bits moved to CR35.
+ *
+ * On 301, 301B, only HiVision 1080i is supported.
+ * On 30xLV, 301C, only YPbPr 1080i is supported.
*/
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 & SetCRT2ToYPbPr) {
- SiS_Pr->SiS_YPbPr = ((SiS_GetReg(SiS_Pr->SiS_P3d4,0x38) & 0x38) >> 3);
+ if(HwInfo->jChipType >= SIS_661) return;
+
+ if(SiS_Pr->SiS_VBType) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
+ SiS_Pr->SiS_YPbPr = YPbPrHiVision;
+ }
+ }
+
+ if(HwInfo->jChipType >= SIS_315H) {
+ if(SiS_Pr->SiS_VBType & (VB_SIS301LV302LV | VB_SIS301C)) {
+ temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);
+ if(temp & 0x08) {
+ switch((temp >> 4)) {
+ case 0x00: SiS_Pr->SiS_YPbPr = YPbPr525i; break;
+ case 0x01: SiS_Pr->SiS_YPbPr = YPbPr525p; break;
+ case 0x02: SiS_Pr->SiS_YPbPr = YPbPr750p; break;
+ case 0x03: SiS_Pr->SiS_YPbPr = YPbPrHiVision; break;
+ }
}
}
}
-#endif /* SIS315H */
+
}
/*********************************************/
@@ -1251,6 +1333,7 @@ SiS_SetTVMode(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_IN
if(HwInfo->jChipType < SIS_661) {
if(SiS_Pr->SiS_VBInfo & SetPALTV) SiS_Pr->SiS_TVMode |= TVSetPAL;
+
if(SiS_Pr->SiS_VBType & VB_SISVB) {
temp = 0;
if((HwInfo->jChipType == SIS_630) ||
@@ -1283,6 +1366,19 @@ SiS_SetTVMode(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_IN
}
}
}
+ /* Translate HiVision/YPbPr to our new flags */
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
+ if(SiS_Pr->SiS_YPbPr == YPbPr750p) SiS_Pr->SiS_TVMode |= TVSetYPbPr750p;
+ else if(SiS_Pr->SiS_YPbPr == YPbPr525p) SiS_Pr->SiS_TVMode |= TVSetYPbPr525p;
+ else if(SiS_Pr->SiS_YPbPr == YPbPrHiVision) SiS_Pr->SiS_TVMode |= TVSetHiVision;
+ else SiS_Pr->SiS_TVMode |= TVSetYPbPr525i;
+ if(SiS_Pr->SiS_TVMode & (TVSetYPbPr750p | TVSetYPbPr525p | TVSetYPbPr525i)) {
+ SiS_Pr->SiS_VBInfo &= ~SetCRT2ToHiVision;
+ SiS_Pr->SiS_VBInfo |= SetCRT2ToYPbPr525750;
+ } else if(SiS_Pr->SiS_TVMode & TVSetHiVision) {
+ SiS_Pr->SiS_TVMode |= TVSetPAL;
+ }
+ }
} else if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
if(SiS_Pr->SiS_CHOverScan) {
if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) {
@@ -1338,11 +1434,31 @@ SiS_SetTVMode(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_IN
}
}
}
+ if(SiS_Pr->SiS_VBType & VB_SISVB) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) {
+ temp1 &= 0xe0;
+ if(temp1 == 0x00) SiS_Pr->SiS_TVMode |= TVSetYPbPr525i;
+ else if(temp1 == 0x20) SiS_Pr->SiS_TVMode |= TVSetYPbPr525p;
+ else if(temp1 == 0x40) SiS_Pr->SiS_TVMode |= TVSetYPbPr750p;
+ } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
+ SiS_Pr->SiS_TVMode |= (TVSetHiVision | TVSetPAL);
+ }
+ }
}
if(SiS_Pr->SiS_VBInfo & SetCRT2ToSCART) SiS_Pr->SiS_TVMode |= TVSetPAL;
if(SiS_Pr->SiS_VBType & VB_SISVB) {
+
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
+ SiS_Pr->SiS_TVMode |= TVSetPAL;
+ SiS_Pr->SiS_TVMode &= ~(TVSetPALM | TVSetPALN | TVSetNTSCJ);
+ } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) {
+ if(SiS_Pr->SiS_TVMode & (TVSetYPbPr525i | TVSetYPbPr525p | TVSetYPbPr750p)) {
+ SiS_Pr->SiS_TVMode &= ~(TVSetPAL | TVSetNTSCJ | TVSetPALM | TVSetPALN);
+ }
+ }
+
if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) {
SiS_Pr->SiS_TVMode |= TVSetTVSimuMode;
@@ -1350,23 +1466,32 @@ SiS_SetTVMode(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_IN
}
if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) {
- if(resinfo == SIS_RI_1024x768) {
- SiS_Pr->SiS_TVMode |= TVSetNTSC1024;
+ /* BIOS sets TVNTSC1024 without checking 525p here. Wrong? */
+ if(!(SiS_Pr->SiS_TVMode & (TVSetHiVision | TVSetYPbPr525p | TVSetYPbPr750p))) {
+ if(resinfo == SIS_RI_1024x768) {
+ SiS_Pr->SiS_TVMode |= TVSetNTSC1024;
+ }
}
}
SiS_Pr->SiS_TVMode |= TVRPLLDIV2XO;
- if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) {
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) &&
+ (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
+ SiS_Pr->SiS_TVMode &= ~TVRPLLDIV2XO;
+ } else if(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p | TVSetYPbPr750p)) {
+ SiS_Pr->SiS_TVMode &= ~TVRPLLDIV2XO;
+ } else if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) {
if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) {
SiS_Pr->SiS_TVMode &= ~TVRPLLDIV2XO;
}
}
+
}
SiS_Pr->SiS_VBInfo &= ~SetPALTV;
#ifdef TWDEBUG
- xf86DrvMsg(0, X_INFO, "(init301.c: TVMode %x)\n", SiS_Pr->SiS_TVMode);
+ xf86DrvMsg(0, X_INFO, "(init301: TVMode %x, VBInfo %x)\n", SiS_Pr->SiS_TVMode, SiS_Pr->SiS_VBInfo);
#endif
}
@@ -1486,7 +1611,7 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
if(SiS_Pr->SiS_CustomT == CUT_PANEL848) {
- SiS_Pr->SiS_LCDInfo = 0x80 | 0x40 | 0x20; /* neg sync, RGB24 */
+ SiS_Pr->SiS_LCDInfo = 0x80 | 0x40 | 0x20; /* neg h/v sync, RGB24 */
}
}
@@ -1783,18 +1908,18 @@ SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
} else if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { /* TV */
- if( (SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) &&
- (!(SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) ) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
if(SiS_Pr->SiS_TVMode & TVRPLLDIV2XO) VCLKIndex = HiTVVCLKDIV2;
else VCLKIndex = HiTVVCLK;
if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) {
- if(modeflag & Charx8Dot) VCLKIndex = HiTVSimuVCLK;
- else VCLKIndex = HiTVTextVCLK;
+ if(modeflag & Charx8Dot) VCLKIndex = HiTVSimuVCLK;
+ else VCLKIndex = HiTVTextVCLK;
}
- } else {
- if(SiS_Pr->SiS_TVMode & TVRPLLDIV2XO) VCLKIndex = TVVCLKDIV2;
- else VCLKIndex = TVVCLK;
- }
+ } else if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) VCLKIndex = YPbPr750pVCLK - TVCLKBASE_315;
+ else if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) VCLKIndex = TVVCLKDIV2;
+ else if(SiS_Pr->SiS_TVMode & TVRPLLDIV2XO) VCLKIndex = TVVCLKDIV2;
+ else VCLKIndex = TVVCLK;
+
if(HwInfo->jChipType < SIS_315H) {
VCLKIndex += TVCLKBASE_300;
} else {
@@ -1987,12 +2112,12 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
/* BIOS does not do this (neither 301 nor LVDS) */
- /* (But it's harmless; see SetCRT2Offset) */
+ /* (But it's harmless; see SetCRT2Offset) */
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x03,0x00); /* fix write part1 index 0 BTDRAM bit Bug */
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x00,0xAF,0x40); /* FUNCTION CONTROL */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x00,0xAF,0x40);
SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2E,0xF7);
} else {
@@ -2033,7 +2158,7 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#ifdef SIS315H /* ------- 315/330 series ------ */
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
- if(SiS_Pr->SiS_VBInfo & CRT2DisplayFlag) {
+ if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) {
SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x08);
}
}
@@ -2047,13 +2172,13 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
} else tempah = 0x40;
- if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) tempah ^= 0x50;
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) tempah ^= 0x50;
#endif /* SIS315H */
}
- if(SiS_Pr->SiS_VBInfo & CRT2DisplayFlag) tempah = 0;
+ if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) tempah = 0;
if(HwInfo->jChipType < SIS_315H) {
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x00,tempah);
@@ -2082,7 +2207,7 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
}
- if(SiS_Pr->SiS_VBInfo & CRT2DisplayFlag) tempah = 0;
+ if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) tempah = 0;
if(HwInfo->jChipType < SIS_315H) {
@@ -2109,10 +2234,10 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
tempah |= 0x80;
}
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoYPbPr) {
- if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
- if(!(SiS_Pr->SiS_YPbPr & YPbPrModeMask)) {
- tempah |= 0x20;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ if(!(SiS_Pr->SiS_TVMode & (TVSetYPbPr750p | TVSetYPbPr525p))) {
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
+ tempah |= 0x20;
}
}
}
@@ -2120,20 +2245,16 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x0D,0x40,tempah);
tempah = 0;
+
+ if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempah |= 0x40;
+
if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
if(SiS_Pr->SiS_TVMode & TVRPLLDIV2XO) {
tempah |= 0x40;
}
}
- /* For 302LV dual-channel */
- if(HwInfo->jChipType >= SIS_315H) {
- if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
- if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempah |= 0x40;
- }
- }
-
- if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) ||
+ if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) ||
(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) ||
((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelCustom) &&
(SiS_Pr->CP_MaxX >= 1280) && (SiS_Pr->CP_MaxY >= 960))) {
@@ -2391,7 +2512,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 | SetCRT2ToYPbPr)) {
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToHiVision)) {
if(xres == 720) xres = 640;
}
if(SiS_Pr->SiS_SetFlag & SetDOSMode) {
@@ -2403,7 +2524,7 @@ SiS_GetCRT2ResInfo(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
}
}
} else {
- if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToYPbPr)) {
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToHiVision)) {
if(xres == 720) xres = 640;
}
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
@@ -2633,31 +2754,43 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
} else { /* TV */
- if((SiS_Pr->SiS_VBType & VB_SIS301B302B) &&
- (SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr)) {
- if(SiS_Pr->SiS_VGAVDE > 480) SiS_Pr->SiS_TVMode &= (~TVSetTVSimuMode);
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
+ /* if(SiS_Pr->SiS_VGAVDE > 480) SiS_Pr->SiS_TVMode &= (~TVSetTVSimuMode); */
tempbx = 2;
if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
- if(!(SiS_Pr->SiS_TVMode & TVSetTVSimuMode)) tempbx = 12;
+ tempbx = 13;
+ if(!(SiS_Pr->SiS_TVMode & TVSetTVSimuMode)) tempbx = 14;
}
+ } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) {
+ if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) tempbx = 7;
+ else if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) tempbx = 6;
+ else tempbx = 5;
+ if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) tempbx += 5;
} else {
- if(SiS_Pr->SiS_TVMode & TVSetPAL) tempbx = 3;
- else tempbx = 4;
- if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) tempbx += 5;
+ if(SiS_Pr->SiS_TVMode & TVSetPAL) tempbx = 3;
+ else tempbx = 4;
+ if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) tempbx += 5;
}
}
tempal &= 0x3F;
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoYPbPr) {
- if(ModeNo > 0x13) {
+ if(ModeNo > 0x13) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoHiVision) {
if(tempal == 6) tempal = 7;
if((resinfo == SIS_RI_720x480) ||
(resinfo == SIS_RI_720x576) ||
(resinfo == SIS_RI_768x576)) {
tempal = 6;
}
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) {
+ if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) {
+ if(resinfo == SIS_RI_1024x768) {
+ tempal = 8;
+ }
+ }
+ }
}
}
@@ -2858,20 +2991,35 @@ SiS_GetCRT2DataLVDS(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
if((SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) {
#ifdef SIS315H
- SiS_GetCRT2PtrA(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
- &CRT2Index,&ResIndex);
+ if(SiS_Pr->UseCustomMode) {
+
+ SiS_Pr->SiS_VGAHT = SiS_Pr->CHTotal;
+ SiS_Pr->SiS_VGAVT = SiS_Pr->CVTotal;
+ SiS_Pr->SiS_HT = SiS_Pr->CHTotal;
+ SiS_Pr->SiS_VT = SiS_Pr->CVTotal;
+ if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) {
+ SiS_Pr->SiS_HDE = SiS_Pr->PanelXRes;
+ SiS_Pr->SiS_VDE = SiS_Pr->PanelYRes;
+ }
+ return;
- switch (CRT2Index) {
- case 0: LVDSData = SiS_Pr->SiS_LCDA1024x768Data_1; break;
- case 1: LVDSData = SiS_Pr->SiS_LCDA1280x1024Data_1; break;
- case 3: LVDSData = SiS_Pr->SiS_LCDA1400x1050Data_1; break;
- case 4: LVDSData = SiS_Pr->SiS_LCDA1600x1200Data_1; break;
- case 5: LVDSData = SiS_Pr->SiS_LCDA1024x768Data_2; break;
- case 6: LVDSData = SiS_Pr->SiS_LCDA1280x1024Data_2; break;
- case 8: LVDSData = SiS_Pr->SiS_LCDA1400x1050Data_2; break;
- case 9: LVDSData = SiS_Pr->SiS_LCDA1600x1200Data_2; break;
- default: LVDSData = SiS_Pr->SiS_LCDA1024x768Data_1; break;
- }
+ } else {
+
+ SiS_GetCRT2PtrA(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
+ &CRT2Index,&ResIndex);
+
+ switch (CRT2Index) {
+ case 0: LVDSData = SiS_Pr->SiS_LCDA1024x768Data_1; break;
+ case 1: LVDSData = SiS_Pr->SiS_LCDA1280x1024Data_1; break;
+ case 3: LVDSData = SiS_Pr->SiS_LCDA1400x1050Data_1; break;
+ case 4: LVDSData = SiS_Pr->SiS_LCDA1600x1200Data_1; break;
+ case 5: LVDSData = SiS_Pr->SiS_LCDA1024x768Data_2; break;
+ case 6: LVDSData = SiS_Pr->SiS_LCDA1280x1024Data_2; break;
+ case 8: LVDSData = SiS_Pr->SiS_LCDA1400x1050Data_2; break;
+ case 9: LVDSData = SiS_Pr->SiS_LCDA1600x1200Data_2; break;
+ default: LVDSData = SiS_Pr->SiS_LCDA1024x768Data_1; break;
+ }
+ }
#endif
} else {
@@ -3012,93 +3160,106 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
} else {
SiS_GetRAMDAC2DATA(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo);
+
}
} else if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
- SiS_GetCRT2Ptr(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
- &CRT2Index,&ResIndex,HwInfo);
+ SiS_GetCRT2Ptr(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
+ &CRT2Index,&ResIndex,HwInfo);
- switch(CRT2Index) {
+ switch(CRT2Index) {
case 2: TVPtr = SiS_Pr->SiS_ExtHiTVData; break;
-/* case 7: TVPtr = SiS_Pr->SiS_St1HiTVData; break; */
- case 12: TVPtr = SiS_Pr->SiS_St2HiTVData; break;
case 3: TVPtr = SiS_Pr->SiS_ExtPALData; break;
case 4: TVPtr = SiS_Pr->SiS_ExtNTSCData; break;
+ case 5: TVPtr = SiS_Pr->SiS_Ext525iData; break;
+ case 6: TVPtr = SiS_Pr->SiS_Ext525pData; break;
+ case 7: TVPtr = SiS_Pr->SiS_Ext750pData; break;
case 8: TVPtr = SiS_Pr->SiS_StPALData; break;
case 9: TVPtr = SiS_Pr->SiS_StNTSCData; break;
+ case 10: TVPtr = SiS_Pr->SiS_St525iData; break;
+ case 11: TVPtr = SiS_Pr->SiS_St525pData; break;
+ case 12: TVPtr = SiS_Pr->SiS_St750pData; break;
+ case 13: TVPtr = SiS_Pr->SiS_St1HiTVData; break;
+ case 14: TVPtr = SiS_Pr->SiS_St2HiTVData; break;
default: TVPtr = SiS_Pr->SiS_StPALData; break;
- }
+ }
- SiS_Pr->SiS_RVBHCMAX = (TVPtr+ResIndex)->RVBHCMAX;
- SiS_Pr->SiS_RVBHCFACT = (TVPtr+ResIndex)->RVBHCFACT;
- SiS_Pr->SiS_VGAHT = (TVPtr+ResIndex)->VGAHT;
- SiS_Pr->SiS_VGAVT = (TVPtr+ResIndex)->VGAVT;
- SiS_Pr->SiS_HDE = (TVPtr+ResIndex)->TVHDE;
- SiS_Pr->SiS_VDE = (TVPtr+ResIndex)->TVVDE;
- SiS_Pr->SiS_RVBHRS = (TVPtr+ResIndex)->RVBHRS;
- SiS_Pr->SiS_NewFlickerMode = (TVPtr+ResIndex)->FlickerMode;
- if(modeflag & HalfDCLK) {
- SiS_Pr->SiS_RVBHRS = (TVPtr+ResIndex)->HALFRVBHRS;
- }
+ SiS_Pr->SiS_RVBHCMAX = (TVPtr+ResIndex)->RVBHCMAX;
+ SiS_Pr->SiS_RVBHCFACT = (TVPtr+ResIndex)->RVBHCFACT;
+ SiS_Pr->SiS_VGAHT = (TVPtr+ResIndex)->VGAHT;
+ SiS_Pr->SiS_VGAVT = (TVPtr+ResIndex)->VGAVT;
+ SiS_Pr->SiS_HDE = (TVPtr+ResIndex)->TVHDE;
+ SiS_Pr->SiS_VDE = (TVPtr+ResIndex)->TVVDE;
+ SiS_Pr->SiS_RVBHRS = (TVPtr+ResIndex)->RVBHRS;
+ SiS_Pr->SiS_NewFlickerMode = (TVPtr+ResIndex)->FlickerMode;
+ if(modeflag & HalfDCLK) {
+ SiS_Pr->SiS_RVBHRS = (TVPtr+ResIndex)->HALFRVBHRS;
+ }
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) {
-
- 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_YPbPr) {
- case YPbPr525:
- case YPbPr750:
- case 0:
- SiS_Pr->SiS_HT = 0x6b4;
- SiS_Pr->SiS_VT = 0x20d;
- /* Don't care about TVSimuMode */
- break;
- default:
- if(SiS_Pr->SiS_VGAVDE == 350) SiS_Pr->SiS_TVMode |= TVSetTVSimuMode;
-
- SiS_Pr->SiS_HT = ExtHiTVHT;
- SiS_Pr->SiS_VT = ExtHiTVVT;
- if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
- if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) {
- SiS_Pr->SiS_HT = StHiTVHT;
- SiS_Pr->SiS_VT = StHiTVVT;
- if(!(modeflag & Charx8Dot)){
- SiS_Pr->SiS_HT = StHiTextTVHT;
- SiS_Pr->SiS_VT = StHiTextTVVT;
- }
- }
- }
- }
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
- } else {
+ if((resinfo == SIS_RI_1024x768) ||
+ (resinfo == SIS_RI_1280x1024) ||
+ (resinfo == SIS_RI_1280x720)) {
+ SiS_Pr->SiS_NewFlickerMode = 0x40;
+ }
- SiS_Pr->SiS_RY1COE = (TVPtr+ResIndex)->RY1COE;
- SiS_Pr->SiS_RY2COE = (TVPtr+ResIndex)->RY2COE;
- SiS_Pr->SiS_RY3COE = (TVPtr+ResIndex)->RY3COE;
- SiS_Pr->SiS_RY4COE = (TVPtr+ResIndex)->RY4COE;
+ if(SiS_Pr->SiS_VGAVDE == 350) SiS_Pr->SiS_TVMode |= TVSetTVSimuMode;
- if(modeflag & HalfDCLK) {
- SiS_Pr->SiS_RY1COE = 0x00;
- SiS_Pr->SiS_RY2COE = 0xf4;
- SiS_Pr->SiS_RY3COE = 0x10;
- SiS_Pr->SiS_RY4COE = 0x38;
- }
+ SiS_Pr->SiS_HT = ExtHiTVHT;
+ SiS_Pr->SiS_VT = ExtHiTVVT;
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
+ if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) {
+ SiS_Pr->SiS_HT = StHiTVHT;
+ SiS_Pr->SiS_VT = StHiTVVT;
+#if 0
+ if(!(modeflag & Charx8Dot)) {
+ SiS_Pr->SiS_HT = StHiTextTVHT;
+ SiS_Pr->SiS_VT = StHiTextTVVT;
+ }
+#endif
+ }
+ }
- if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) {
- SiS_Pr->SiS_HT = NTSCHT;
- if(SiS_Pr->SiS_TVMode & TVSetNTSC1024) SiS_Pr->SiS_HT = NTSC2HT;
- SiS_Pr->SiS_VT = NTSCVT;
- } else {
- SiS_Pr->SiS_HT = PALHT;
- SiS_Pr->SiS_VT = PALVT;
- }
+ } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) {
- }
+ if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) {
+ SiS_Pr->SiS_HT = 1650;
+ SiS_Pr->SiS_VT = 750;
+ } else if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) {
+ SiS_Pr->SiS_HT = NTSCHT;
+ SiS_Pr->SiS_VT = NTSCVT;
+ } else {
+ SiS_Pr->SiS_HT = NTSCHT;
+ if(SiS_Pr->SiS_TVMode & TVSetNTSC1024) SiS_Pr->SiS_HT = NTSC2HT;
+ SiS_Pr->SiS_VT = NTSCVT;
+ }
+
+ } else {
+
+ SiS_Pr->SiS_RY1COE = (TVPtr+ResIndex)->RY1COE;
+ SiS_Pr->SiS_RY2COE = (TVPtr+ResIndex)->RY2COE;
+ SiS_Pr->SiS_RY3COE = (TVPtr+ResIndex)->RY3COE;
+ SiS_Pr->SiS_RY4COE = (TVPtr+ResIndex)->RY4COE;
+
+ if(modeflag & HalfDCLK) {
+ SiS_Pr->SiS_RY1COE = 0x00;
+ SiS_Pr->SiS_RY2COE = 0xf4;
+ SiS_Pr->SiS_RY3COE = 0x10;
+ SiS_Pr->SiS_RY4COE = 0x38;
+ }
+
+ if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) {
+ SiS_Pr->SiS_HT = NTSCHT;
+ if(SiS_Pr->SiS_TVMode & TVSetNTSC1024) SiS_Pr->SiS_HT = NTSC2HT;
+ SiS_Pr->SiS_VT = NTSCVT;
+ } else {
+ SiS_Pr->SiS_HT = PALHT;
+ SiS_Pr->SiS_VT = PALVT;
+ }
+
+ }
} else if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
@@ -3536,7 +3697,6 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
#endif
USHORT temp=0;
-
if(SiS_Pr->SiS_VBType & VB_SISVB) {
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { /* ===== For 30xB/LV ===== */
@@ -3570,7 +3730,7 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
} else {
if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwInfo))) {
- SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF7,0x08);
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x08);
SiS_PanelDelay(SiS_Pr, HwInfo, 3);
}
if(SiS_Is301B(SiS_Pr)) {
@@ -3587,7 +3747,7 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
if( (!(SiS_CRT2IsLCD(SiS_Pr, HwInfo))) ||
(!(SiS_CR36BIOSWord23d(SiS_Pr, HwInfo))) ) {
SiS_PanelDelay(SiS_Pr, HwInfo, 2);
- SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xFB,0x04);
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x04);
}
}
@@ -3605,7 +3765,7 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
#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);
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
}
}
#endif
@@ -3835,10 +3995,12 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
} else { /* ============ For 301 ================ */
if(HwInfo->jChipType < SIS_315H) {
+#ifdef SIS300
if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwInfo))) {
- SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF7,0x08);
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x08);
SiS_PanelDelay(SiS_Pr, HwInfo, 3);
}
+#endif
}
SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xDF); /* disable VB */
@@ -3856,12 +4018,14 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20);
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x00,temp);
} else {
+#ifdef SIS300
SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF); /* disable CRT2 */
if( (!(SiS_CRT2IsLCD(SiS_Pr, HwInfo))) ||
(!(SiS_CR36BIOSWord23d(SiS_Pr,HwInfo))) ) {
SiS_PanelDelay(SiS_Pr, HwInfo, 2);
- SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xFB,0x04);
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x04);
}
+#endif
}
}
@@ -3881,7 +4045,7 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_WaitVBRetrace(SiS_Pr,HwInfo);
}
if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwInfo))) {
- SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF7,0x08);
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x08);
SiS_PanelDelay(SiS_Pr, HwInfo, 3);
}
} else {
@@ -3892,7 +4056,7 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
if(!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x06) & 0x1c)) {
SiS_DisplayOff(SiS_Pr);
}
- SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF7,0x08);
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x08);
SiS_PanelDelay(SiS_Pr, HwInfo, 3);
}
}
@@ -3911,7 +4075,7 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
if( (!(SiS_CRT2IsLCD(SiS_Pr, HwInfo))) ||
(!(SiS_CR36BIOSWord23d(SiS_Pr,HwInfo))) ) {
SiS_PanelDelay(SiS_Pr, HwInfo, 2);
- SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xFB,0x04);
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x04);
}
#endif /* SIS300 */
@@ -3951,7 +4115,7 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
}
if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) {
- SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF7,0x08);
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x08);
SiS_PanelDelay(SiS_Pr, HwInfo, 3);
}
@@ -4020,14 +4184,14 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
if(SiS_CRT2IsLCD(SiS_Pr, HwInfo)) {
if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwInfo))) {
SiS_PanelDelay(SiS_Pr, HwInfo, 2);
- SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xFB,0x04);
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x04);
}
}
}
#endif /* SIS315H */
- } /* 310 series */
+ } /* 315 series */
} /* LVDS */
@@ -4095,7 +4259,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
if((SiS_Pr->SiS_VBType & VB_NoLCD) &&
(SiS_CRT2IsLCD(SiS_Pr, HwInfo))) {
/* This is only for LCD output on 301B-DH via LVDS */
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xFB);
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x00);
if(!(SiS_CR36BIOSWord23d(SiS_Pr,HwInfo))) {
SiS_PanelDelay(SiS_Pr, HwInfo, 0);
}
@@ -4114,7 +4278,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_PanelDelay(SiS_Pr, HwInfo, 1);
}
SiS_WaitVBRetrace(SiS_Pr,HwInfo);
- SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF7,0x00);
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x00);
}
}
} else {
@@ -4148,29 +4312,18 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
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);
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
}
#endif
}
if(!(SiS_IsNotM650orLater(SiS_Pr,HwInfo))) {
tempah = 0x10;
- if((SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) {
- if(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x13) & 0x04) {
- if((SiS_GetReg(SiS_Pr->SiS_Part2Port,0x00) & 0x0f) == 0x0c) {
- tempah = 0x08;
- } else {
- tempah = 0x18;
- }
- }
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x4c,tempah);
- } else {
- if(SiS_IsVAMode(SiS_Pr,HwInfo)) {
- tempah = 0x08;
- }
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x4c,tempah);
+ if(SiS_LCDAEnabled(SiS_Pr, HwInfo)) {
+ if(SiS_TVEnabled(SiS_Pr, HwInfo)) tempah = 0x18;
+ else tempah = 0x08;
}
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x4c,tempah);
}
if((SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) &&
@@ -4219,13 +4372,11 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
if(!(SiS_IsNotM650orLater(SiS_Pr,HwInfo))) {
tempah = 0x10;
- if(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x13) & 0x04) {
- tempah = 0x18;
- if((SiS_GetReg(SiS_Pr->SiS_Part2Port,0x00) & 0x0f) == 0x0c) {
- tempah = 0x08;
- }
+ if(SiS_LCDAEnabled(SiS_Pr, HwInfo)) {
+ if(SiS_TVEnabled(SiS_Pr, HwInfo)) tempah = 0x18;
+ else tempah = 0x08;
}
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x4c,tempah);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x4c,tempah);
}
}
@@ -4235,10 +4386,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
if(SiS_BridgeInSlave(SiS_Pr)) {
tempah = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);
if(!(tempah & SetCRT2ToRAMDAC)) {
- if((SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) {
- if(!(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x13) & 0x04)) temp |= 0x20;
- } else temp |= 0x20;
+ if(!(SiS_LCDAEnabled(SiS_Pr, HwInfo))) temp |= 0x20;
}
}
SiS_SetReg(SiS_Pr->SiS_P3c4,0x32,temp);
@@ -4304,7 +4452,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
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);
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
}
#endif
SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x0c);
@@ -4549,7 +4697,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
if(HwInfo->jChipType < SIS_315H) {
if(SiS_CRT2IsLCD(SiS_Pr, HwInfo)) {
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xFB);
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x00);
SiS_PanelDelay(SiS_Pr, HwInfo, 0);
}
}
@@ -4582,7 +4730,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
if(HwInfo->jChipType < SIS_315H) {
if(SiS_CRT2IsLCD(SiS_Pr, HwInfo)) {
SiS_PanelDelay(SiS_Pr, HwInfo, 1);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xF7);
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x00);
}
}
@@ -4600,7 +4748,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_PanelDelay(SiS_Pr, HwInfo, 1);
SiS_PanelDelay(SiS_Pr, HwInfo, 1);
}
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xFB);
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x00);
if(!(SiS_CR36BIOSWord23d(SiS_Pr,HwInfo))) {
SiS_PanelDelay(SiS_Pr, HwInfo, 0);
}
@@ -4631,7 +4779,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_PanelDelay(SiS_Pr, HwInfo, 1);
}
SiS_WaitVBRetrace(SiS_Pr, HwInfo);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xF7);
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x00);
}
}
}
@@ -4644,7 +4792,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) {
if(SiS_CRT2IsLCD(SiS_Pr, HwInfo)) {
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xFB);
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x00);
SiS_PanelDelay(SiS_Pr, HwInfo, 0);
}
}
@@ -4723,7 +4871,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwInfo))) {
if(SiS_CRT2IsLCD(SiS_Pr, HwInfo)) {
SiS_PanelDelay(SiS_Pr, HwInfo, 1);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xF7);
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x00);
}
}
}
@@ -5205,31 +5353,36 @@ SiS_SetGroup1_LCDA(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
USHORT push2,tempax,tempbx,tempcx,temp;
ULONG tempeax=0,tempebx,tempecx,tempvcfact;
- /* This is not supported with LCDA */
- if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelCustom) return;
- if(SiS_Pr->UseCustomMode) return;
-
if(IS_SIS330) {
SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x10); /* Xabre 1.01.03 */
} else if(IS_SIS740) {
if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { /* 740/LVDS */
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,0xfb,0x04); /* 740/LVDS */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,0xfb,0x04);
SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x03);
} else if(SiS_Pr->SiS_VBType & VB_SISVB) {
SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x10); /* 740/301LV, 301BDH */
}
} else {
if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { /* 650/LVDS */
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,0xfb,0x04); /* 650/LVDS */
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x00); /* 650/LVDS 1.10.07 */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,0xfb,0x04);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x00);
} else if(SiS_Pr->SiS_VBType & VB_SISVB) {
SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2D,0x0f); /* 650/30xLv 1.10.6s */
+ if(SiS_Pr->SiS_VBType & VB_SIS301C) {
+ if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) ||
+ (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024)) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x20);
+ }
+ }
}
}
if(ModeNo <= 0x13) {
modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo;
+ } else if(SiS_Pr->UseCustomMode) {
+ modeflag = SiS_Pr->CModeFlag;
+ resinfo = 0;
} else {
modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
@@ -5238,9 +5391,9 @@ SiS_SetGroup1_LCDA(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
tempax = SiS_Pr->SiS_LCDHDES;
temp = (tempax & 0x0007); /* BPLHDESKEW[2:0] */
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1A,temp); /* Part1_1Ah */
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1A,temp);
temp = (tempax >> 3) & 0x00FF; /* BPLHDESKEW[10:3] */
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x16,temp); /* Part1_16h */
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x16,temp);
tempbx = SiS_Pr->SiS_HDE;
if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
@@ -5255,14 +5408,15 @@ SiS_SetGroup1_LCDA(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(temp & 0x07) temp += 8;
}
temp >>= 3; /* BPLHDEE */
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x17,temp); /* Part1_17h */
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x17,temp);
tempcx = (SiS_Pr->SiS_HT - tempbx) >> 2; /* (HT-HDE) / 4 */
/* 650/30xLV 1.10.6s, 740/LVDS */
if( ((SiS_Pr->SiS_VBType & VB_SISVB) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) ||
((SiS_Pr->SiS_IF_DEF_LVDS == 1) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) ) {
- if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) {
+ if((SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) &&
+ (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_PanelCustom)) {
if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempcx = 0x28;
else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempcx = 0x18;
else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempcx = 0x30;
@@ -5275,7 +5429,7 @@ SiS_SetGroup1_LCDA(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(tempcx >= SiS_Pr->SiS_HT) tempcx -= SiS_Pr->SiS_HT;
temp = (tempcx >> 3) & 0x00FF; /* BPLHRS */
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x14,temp); /* Part1_14h */
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x14,temp);
temp += 10;
if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
@@ -5293,26 +5447,30 @@ SiS_SetGroup1_LCDA(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
}
}
+ } else if(SiS_Pr->SiS_VBType & VB_SIS301C) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) temp += 7;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) temp += 4;
}
temp &= 0x1F;
temp |= ((tempcx & 0x07) << 5);
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x15,temp); /* Part1_15h */
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x15,temp);
- if(SiS_Pr->SiS_IF_DEF_TRUMPION == 0) {
- tempax = SiS_Pr->PanelYRes;
- } else {
+ tempax = SiS_Pr->PanelYRes;
+ if(SiS_Pr->SiS_IF_DEF_TRUMPION) {
tempax = SiS_Pr->SiS_VGAVDE;
}
tempbx = SiS_Pr->SiS_LCDVDES + tempax;
if(tempbx >= SiS_Pr->SiS_VT) tempbx -= SiS_Pr->SiS_VT;
+
push2 = tempbx;
tempcx = (SiS_Pr->SiS_VGAVT - SiS_Pr->SiS_VGAVDE) >> 2;
if( ((SiS_Pr->SiS_VBType & VB_SISVB) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) ||
((SiS_Pr->SiS_IF_DEF_LVDS == 1) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) ) {
- if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) {
+ if((SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) &&
+ (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_PanelCustom)) {
if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempcx = 1;
else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempcx = 3;
else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) tempcx = 3;
@@ -5324,35 +5482,34 @@ SiS_SetGroup1_LCDA(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
tempbx += tempcx;
- if(SiS_Pr->SiS_VBType & VB_SISVB) {
- tempbx++; /* BPLVRS */
- }
- if(tempbx >= SiS_Pr->SiS_VT) tempbx -= SiS_Pr->SiS_VT;
+ if(SiS_Pr->SiS_VBType & VB_SISVB) tempbx++;
+ if(tempbx >= SiS_Pr->SiS_VT) tempbx -= SiS_Pr->SiS_VT; /* BPLVRS */
temp = tempbx & 0x00FF;
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x18,temp); /* Part1_18h */
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x18,temp);
tempcx >>= 3;
if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
- if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) {
- if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempcx = 3;
- else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempcx = 5;
- else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) tempcx = 5;
- else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempcx = 5;
- else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempcx = 2;
- else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempcx = 2;
- }
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempcx = 3;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempcx = 5;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) tempcx = 5;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempcx = 5;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempcx = 2;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempcx = 2;
}
+ } else if(SiS_Pr->SiS_VBType & VB_SIS301C) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempcx = 5;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempcx = 2;
}
tempcx += tempbx;
tempcx++; /* BPLVRE */
temp = tempcx & 0x000F;
if(SiS_Pr->SiS_VBType & VB_SISVB) {
- temp |= 0xC0;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0xF0,temp); /* Part1_19h */
- } else {
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0xF0,temp);
+ if(!(SiS_Pr->SiS_VBType & VB_SIS301C)) {
+ temp |= 0xC0;
+ }
}
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0xF0,temp);
temp = ((tempbx >> 8) & 0x07) << 3;
if(SiS_Pr->SiS_VGAVDE != SiS_Pr->SiS_VDE) temp |= 0x40;
@@ -5368,7 +5525,7 @@ SiS_SetGroup1_LCDA(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00) & 0x01) temp |= 0x80;
}
}
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x1A,0x07,temp); /* Part1_1Ah */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x1A,0x07,temp);
tempbx = push2; /* BPLVDEE */
@@ -5385,11 +5542,11 @@ SiS_SetGroup1_LCDA(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
temp = ((tempbx >> 8) & 0x07) << 3;
temp = temp | ((tempcx >> 8) & 0x07);
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1D,temp); /* Part1_1Dh */
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1D,temp);
temp = tempbx & 0x00FF;
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1C,temp); /* Part1_1Ch */
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1C,temp);
temp = tempcx & 0x00FF;
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1B,temp); /* Part1_1Bh */
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1B,temp);
tempeax = SiS_Pr->SiS_VGAVDE << 18;
tempebx = SiS_Pr->SiS_VDE;
@@ -5430,7 +5587,7 @@ SiS_SetGroup1_LCDA(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
tempeax = ((SiS_Pr->SiS_VGAHDE << 16) / tempecx) - 1;
tempecx = (tempecx << 16) | (tempeax & 0xFFFF);
temp = (USHORT)(tempecx & 0x00FF);
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1F,temp); /* Part1_1Fh */
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1F,temp);
tempeax = (SiS_Pr->SiS_VGAVDE << 18) / tempvcfact;
tempbx = (USHORT)(tempeax & 0x0FFFF);
@@ -5441,15 +5598,15 @@ SiS_SetGroup1_LCDA(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
temp = ((tempbx >> 8) & 0x07) << 3;
temp = temp | ((tempecx >> 8) & 0x07);
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x20,temp); /* Part1_20h */
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x20,temp);
temp = tempbx & 0x00FF;
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x21,temp); /* Part1_21h */
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x21,temp);
tempecx >>= 16; /* BPLHCFACT */
if(modeflag & HalfDCLK) tempecx >>= 1;
temp = (USHORT)((tempecx & 0x0000FF00) >> 8);
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x22,temp); /* Part1_22h */
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x22,temp);
temp = (USHORT)(tempecx & 0x000000FF);
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x23,temp);
@@ -5484,59 +5641,52 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
if(ModeNo <= 0x13) {
modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo;
+ } else if(SiS_Pr->UseCustomMode) {
+ modeflag = SiS_Pr->CModeFlag;
+ resinfo = 0;
} else {
- if(SiS_Pr->UseCustomMode) {
- modeflag = SiS_Pr->CModeFlag;
- resinfo = 0;
- } else {
- modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
- }
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
}
/* The following is only done if bridge is in slave mode: */
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x03,0xff); /* set MAX HT */
- tempax = 0xFFFF;
- if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) tempax = SiS_GetVGAHT2(SiS_Pr);
-
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) modeflag |= Charx8Dot;
if(modeflag & Charx8Dot) tempcx = 0x08;
else tempcx = 0x09;
- if(tempax >= SiS_Pr->SiS_VGAHT) tempax = SiS_Pr->SiS_VGAHT;
-
- if(modeflag & HalfDCLK) tempax >>= 1;
-
- tempax = (tempax / tempcx) - 5;
- tempbx = tempax & 0x00FF;
-
tempax = SiS_Pr->SiS_VGAHDE; /* 0x04 Horizontal Display End */
if(modeflag & HalfDCLK) tempax >>= 1;
- tempax = (tempax / tempcx) - 1;
- tempbx |= ((tempax & 0x00FF) << 8);
- temp = tempax & 0x00FF;
+ tempax = ((tempax / tempcx) - 1) & 0xff;
+ tempbx = tempax;
+
+ temp = tempax;
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x04,temp);
- temp = (tempbx & 0xFF00) >> 8;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) {
temp += 2;
}
}
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) {
- if(SiS_Pr->SiS_YPbPr == YPbPrHiVision) {
- if(resinfo == SIS_RI_800x600) temp -= 2;
- }
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
+ if(resinfo == SIS_RI_800x600) temp -= 2;
}
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x05,temp); /* 0x05 Horizontal Display Start */
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x06,0x03); /* 0x06 Horizontal Blank end */
- if((SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) && (SiS_Pr->SiS_YPbPr == YPbPrHiVision)) {
- temp = (tempbx & 0x00FF) - 1;
+ tempax = 0xFFFF;
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) tempax = SiS_GetVGAHT2(SiS_Pr);
+ if(tempax >= SiS_Pr->SiS_VGAHT) tempax = SiS_Pr->SiS_VGAHT;
+ if(modeflag & HalfDCLK) tempax >>= 1;
+ tempax = (tempax / tempcx) - 5;
+ tempcx = tempax;
+
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
+ temp = tempcx - 1;
if(!(modeflag & HalfDCLK)) {
temp -= 6;
if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) {
@@ -5545,8 +5695,6 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
}
}
} else {
- tempcx = tempbx & 0x00FF;
- tempbx = (tempbx & 0xFF00) >> 8;
tempcx = (tempcx + tempbx) >> 1;
temp = (tempcx & 0x00FF) + 2;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
@@ -5563,11 +5711,11 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
} else {
if(!(modeflag & HalfDCLK)) {
temp -= 4;
- if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x960) {
+ if((SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x960) &&
+ (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1600x1200)) {
if(SiS_Pr->SiS_VGAHDE >= 800) {
temp -= 7;
if(HwInfo->jChipType < SIS_315H) {
- /* 650/301LV(x) does not do this, 630/301B, 300/301LV do */
if(SiS_Pr->SiS_ModeType == ModeEGA) {
if(SiS_Pr->SiS_VGAVDE == 1024) {
temp += 15;
@@ -5576,8 +5724,10 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
}
}
}
- if(SiS_Pr->SiS_VGAHDE >= 1280) {
- if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) temp += 28;
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1400x1050) {
+ if(SiS_Pr->SiS_VGAHDE >= 1280) {
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) temp += 28;
+ }
}
}
}
@@ -5626,11 +5776,21 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
}
}
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) {
- if(SiS_Pr->SiS_YPbPr & YPbPrModeMask) {
- p1_7 = 0xb2;
- if(SiS_Pr->SiS_YPbPr & YPbPr525) {
- p1_7 = 0xab;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) {
+ if(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p|TVSetYPbPr750p)) {
+ p1_7 = 0x63;
+ if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) p1_7 = 0x55;
+ }
+ if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) {
+ if(!(modeflag & HalfDCLK)) {
+ p1_7 = 0xb2;
+ if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) {
+ p1_7 = 0xab;
+ }
+ }
+ } else {
+ if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) {
+ if(modeflag & HalfDCLK) p1_7 = 0x30;
}
}
}
@@ -5676,18 +5836,21 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
#endif
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0E,temp);
- if(tempbx & 0x0100) tempcx |= 0x0002;
-
- tempax = 0x000B;
- if(modeflag & DoubleScanMode) tempax |= 0x8000;
+ temp = 0;
+ if(modeflag & DoubleScanMode) temp |= 0x80;
+ if(HwInfo->jChipType >= SIS_661) {
+ if(tempbx & 0x0200) temp |= 0x20;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x0B,0x5F,temp);
+ if(tempbx & 0x0100) tempcx |= 0x000a;
+ if(tempbx & 0x0400) tempcx |= 0x1200;
+ } else {
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0B,temp);
+ if(tempbx & 0x0100) tempcx |= 0x0002;
+ if(tempbx & 0x0400) tempcx |= 0x0600;
+ }
if(tempbx & 0x0200) tempcx |= 0x0040;
- temp = (tempax & 0xFF00) >> 8;
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0B,temp);
-
- if(tempbx & 0x0400) tempcx |= 0x0600;
-
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x11,0x00); /* 0x11 Vertical Blank End */
tempax = (SiS_Pr->SiS_VGAVT - tempbx) >> 2;
@@ -5702,17 +5865,15 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
}
}
- if((SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) && (SiS_Pr->SiS_YPbPr == YPbPrHiVision)) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
tempbx -= 10;
} else {
if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) {
if(SiS_Pr->SiS_TVMode & TVSetPAL) {
- if(!(SiS_Pr->SiS_YPbPr & YPbPrModeMask)) {
- tempbx += 40;
- if(HwInfo->jChipType >= SIS_315H) {
- if(SiS_Pr->SiS_VGAHDE == 800) tempbx += 10;
- }
- }
+ tempbx += 40;
+ if(HwInfo->jChipType >= SIS_315H) {
+ if(SiS_Pr->SiS_VGAHDE == 800) tempbx += 10;
+ }
}
}
}
@@ -5742,8 +5903,9 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
if(tempbx & 0x0100) tempcx |= 0x0004;
if(tempbx & 0x0200) tempcx |= 0x0080;
if(tempbx & 0x0400) {
- if(SiS_Pr->SiS_VBType & VB_SIS301) tempcx |= 0x0800;
- else tempcx |= 0x0C00;
+ if(HwInfo->jChipType >= SIS_661) tempcx |= 0x0800;
+ else if(SiS_Pr->SiS_VBType & VB_SIS301) tempcx |= 0x0800;
+ else tempcx |= 0x0C00;
}
tempbx = push1;
@@ -5761,10 +5923,7 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
tempax = modeflag;
temp = (tempax & 0xFF00) >> 8;
temp = (temp >> 1) & 0x09;
- if(!(SiS_Pr->SiS_VBType & VB_SIS301)) {
- /* Only use 8 dot clock */
- temp |= 0x01;
- }
+ if(!(SiS_Pr->SiS_VBType & VB_SIS301)) temp |= 0x01; /* Always 8 dotclock */
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x16,temp); /* 0x16 SR01 */
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0F,0x00); /* 0x0F CR14 */
@@ -5778,6 +5937,9 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
}
}
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1A,temp); /* 0x1A SR0E */
+
+ temp = SiS_GetRegByte((USHORT)(SiS_Pr->SiS_P3ca+0x02));
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1b,temp);
}
/*********** Set Part 1 / LVDS ***********/
@@ -6131,22 +6293,20 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x1A,0x87,temp); /* Part1_1Ah; Panel Link Control Signal (7:3); Vertical Retrace Start (2:0) */
- if (HwInfo->jChipType < SIS_315H) {
+ if(HwInfo->jChipType < SIS_315H) {
#ifdef SIS300 /* 300 series */
- tempeax = SiS_Pr->SiS_VGAVDE << 6;
- temp = (USHORT)(tempeax % (ULONG)SiS_Pr->SiS_VDE);
- tempeax = tempeax / (ULONG)SiS_Pr->SiS_VDE;
- if(temp != 0) tempeax++;
- tempebx = tempeax; /* BPLVCFACT */
+ tempeax = SiS_Pr->SiS_VGAVDE << 6;
+ temp = (USHORT)(tempeax % (ULONG)SiS_Pr->SiS_VDE);
+ tempeax = tempeax / (ULONG)SiS_Pr->SiS_VDE;
+ if(temp != 0) tempeax++;
+ tempebx = tempeax; /* BPLVCFACT */
- if(SiS_Pr->SiS_SetFlag & EnableLVDSDDA) {
- tempebx = 0x003F;
- }
+ if(SiS_Pr->SiS_SetFlag & EnableLVDSDDA) tempebx = 0x003F;
- temp = (USHORT)(tempebx & 0x00FF);
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1E,temp); /* Part1_1Eh; Panel Link Vertical Scaling Factor */
+ temp = (USHORT)(tempebx & 0x00FF);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1E,temp); /* Part1_1Eh; Panel Link Vertical Scaling Factor */
#endif /* SIS300 */
@@ -6154,26 +6314,26 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#ifdef SIS315H /* 315 series */
- if(HwInfo->jChipType == SIS_740) {
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x1E,0x03);
- } else {
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1E,0x23);
- }
-
- tempeax = SiS_Pr->SiS_VGAVDE << 18;
- temp = (USHORT)(tempeax % (ULONG)SiS_Pr->SiS_VDE);
- tempeax = tempeax / SiS_Pr->SiS_VDE;
- if(temp != 0) tempeax++;
- tempebx = tempeax; /* BPLVCFACT */
- tempvcfact = tempeax;
- temp = (USHORT)(tempebx & 0x00FF);
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x37,temp); /* Part1_37h; Panel Link Vertical Scaling Factor */
- temp = (USHORT)((tempebx & 0x00FF00) >> 8);
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x36,temp); /* Part1_36h; Panel Link Vertical Scaling Factor */
- temp = (USHORT)((tempebx & 0x00030000) >> 16);
- temp &= 0x03;
- if(SiS_Pr->SiS_VDE == SiS_Pr->SiS_VGAVDE) temp |= 0x04;
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x35,temp); /* Part1_35h; Panel Link Vertical Scaling Factor */
+ if(HwInfo->jChipType == SIS_740) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x1E,0x03);
+ } else {
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1E,0x23);
+ }
+
+ tempeax = SiS_Pr->SiS_VGAVDE << 18;
+ temp = (USHORT)(tempeax % (ULONG)SiS_Pr->SiS_VDE);
+ tempeax = tempeax / SiS_Pr->SiS_VDE;
+ if(temp != 0) tempeax++;
+ tempebx = tempeax; /* BPLVCFACT */
+ tempvcfact = tempeax;
+ temp = (USHORT)(tempebx & 0x00FF);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x37,temp); /* Part1_37h; Panel Link Vertical Scaling Factor */
+ temp = (USHORT)((tempebx & 0x00FF00) >> 8);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x36,temp); /* Part1_36h; Panel Link Vertical Scaling Factor */
+ temp = (USHORT)((tempebx & 0x00030000) >> 16);
+ temp &= 0x03;
+ if(SiS_Pr->SiS_VDE == SiS_Pr->SiS_VGAVDE) temp |= 0x04;
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x35,temp); /* Part1_35h; Panel Link Vertical Scaling Factor */
#endif /* SIS315H */
@@ -6185,23 +6345,23 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
push1 = temp;
if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
- if(!SiS_Pr->SiS_IF_DEF_FSTN && !SiS_Pr->SiS_IF_DEF_DSTN) {
- if(HwInfo->jChipType < SIS_315H) {
- if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) {
- if(resinfo == SIS_RI_1024x600) tempcx++;
- if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
- if(resinfo == SIS_RI_800x600) tempcx++;
- }
- } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) {
- if(resinfo == SIS_RI_800x600) tempcx++;
- if(resinfo == SIS_RI_1024x768) tempcx++; /* Doesnt make sense anyway... */
- } else if(resinfo == SIS_RI_1024x768) tempcx++;
- } else {
- if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) {
- if(resinfo == SIS_RI_800x600) tempcx++;
- }
- }
+ if(!SiS_Pr->SiS_IF_DEF_FSTN && !SiS_Pr->SiS_IF_DEF_DSTN) {
+ if(HwInfo->jChipType < SIS_315H) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) {
+ if(resinfo == SIS_RI_1024x600) tempcx++;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
+ if(resinfo == SIS_RI_800x600) tempcx++;
+ }
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) {
+ if(resinfo == SIS_RI_800x600) tempcx++;
+ if(resinfo == SIS_RI_1024x768) tempcx++; /* Doesnt make sense anyway... */
+ } else if(resinfo == SIS_RI_1024x768) tempcx++;
+ } else {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) {
+ if(resinfo == SIS_RI_800x600) tempcx++;
+ }
}
+ }
}
if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) {
@@ -6414,14 +6574,12 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(ModeNo <= 0x13) {
modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ } else if(SiS_Pr->UseCustomMode) {
+ modeflag = SiS_Pr->CModeFlag;
} else {
- if(SiS_Pr->UseCustomMode) {
- modeflag = SiS_Pr->CModeFlag;
- } else {
- CRT1Index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
- resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
- modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- }
+ CRT1Index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
+ resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
}
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
@@ -6602,14 +6760,10 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(tempcx > tempax) tempcx = tempax;
}
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
- if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) {
- if(resinfo == SIS_RI_1024x768) {
- tempbx = 1040;
- tempcx = 1042;
- }
- }
- }
+ if(SiS_Pr->SiS_TVMode & TVSetNTSC1024) {
+ tempbx = 1040;
+ tempcx = 1042;
+ }
}
@@ -6619,8 +6773,6 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
} /* 315/330 series */
- /* The following is done for all bridge/chip types/series */
-
tempax = tempbx & 0xFF00;
tempbx = pushbx;
tempbx = (tempbx & 0x00FF) | ((tempbx & 0xFF00) << 4);
@@ -6711,7 +6863,7 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
temp |= (tempcx & 0x000F);
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x11,temp); /* CRT2 Vert. Retrace End; Overflow; "Enable CRTC Check" */
- /* 3. Panel compensation delay */
+ /* 3. Panel delay compensation */
if(HwInfo->jChipType < SIS_315H) {
@@ -6731,27 +6883,25 @@ 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 & SetCRT2ToYPbPr) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
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 & SetCRT2ToTVNoYPbPr)
- temp = ROMAddr[0x221];
- else if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr)
- temp = ROMAddr[0x222];
- else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024)
- temp = ROMAddr[0x223];
- else
- temp = ROMAddr[0x224];
- temp &= 0x3c;
- }
+ if(ROMAddr[0x220] & 0x80) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoYPbPrHiVision)
+ temp = ROMAddr[0x221];
+ else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision)
+ temp = ROMAddr[0x222];
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024)
+ temp = ROMAddr[0x223];
+ else
+ temp = ROMAddr[0x224];
+ temp &= 0x3c;
+ }
}
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
- if(SiS_Pr->PDC) {
- temp = SiS_Pr->PDC & 0x3c;
- }
+ if(SiS_Pr->PDC != -1) temp = SiS_Pr->PDC & 0x3c;
}
} else {
temp = 0x20;
@@ -6759,18 +6909,16 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) temp = 0x04;
}
if((ROMAddr) && SiS_Pr->SiS_UseROM) {
- if(ROMAddr[0x220] & 0x80) {
- temp = ROMAddr[0x220] & 0x3c;
- }
+ if(ROMAddr[0x220] & 0x80) {
+ temp = ROMAddr[0x220] & 0x3c;
+ }
}
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
- if(SiS_Pr->PDC) {
- temp = SiS_Pr->PDC & 0x3c;
- }
+ if(SiS_Pr->PDC != -1) temp = SiS_Pr->PDC & 0x3c;
}
}
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,~0x03C,temp); /* Panel Link Delay Compensation; (Software Command Reset; Power Saving) */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,~0x3C,temp); /* Panel Link Delay Compensation; (Software Command Reset; Power Saving) */
#endif /* SIS300 */
@@ -6780,56 +6928,11 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(HwInfo->jChipType < SIS_661) {
- if(SiS_Pr->SiS_VBType & VB_SISVB) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { /* LVDS */
- temp = 0x10;
- if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) temp = 0x2c;
- if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) temp = 0x20;
- 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 & SetCRT2ToYPbPr) {
- switch(SiS_Pr->SiS_YPbPr) {
- case YPbPr525:
- case YPbPr750:
- case 0:
- temp = 0x08;
- break;
- default:
- if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) temp = 0x2c;
- else temp = 0x20;
- }
- }
- }
- if((SiS_Pr->SiS_VBType & VB_SIS301B302B) && (!(SiS_Pr->SiS_VBType & VB_NoLCD))) {
- tempbl = 0x00;
- if((ROMAddr) && (SiS_Pr->SiS_UseROM)) {
- if(HwInfo->jChipType < SIS_330) {
- if(ROMAddr[0x13c] & 0x80) tempbl = 0xf0;
- } else {
- if(ROMAddr[0x1bc] & 0x80) tempbl = 0xf0;
- }
- }
- } else { /* LV (550/301LV checks ROM byte, other LV BIOSes do not) */
- tempbl = 0xF0;
- }
- if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD|SetCRT2ToLCDA)) {
- if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
- if(SiS_Pr->PDC) {
- temp = SiS_Pr->PDC;
- tempbl = 0;
- }
- }
- }
+ if(HwInfo->jChipType == SIS_740) temp = 0x03;
+ else temp = 0x00;
- } else { /* LVDS */
-
- if(HwInfo->jChipType == SIS_740) {
- temp = 0x03;
- } else {
- temp = 0x00;
- }
if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) temp = 0x0a;
tempbl = 0xF0;
if(HwInfo->jChipType == SIS_650) {
@@ -6845,9 +6948,9 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(ROMAddr[0x13c] & 0x80) tempbl = 0xf0;
}
}
- }
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2D,tempbl,temp); /* Panel Link Delay Compensation */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2D,tempbl,temp); /* Panel Link Delay Compensation */
+ }
} /* < 661 */
@@ -6919,7 +7022,7 @@ SiS_GetGroup2CLVXPtr(SiS_Private *SiS_Pr, int tabletype, PSIS_HW_INFO HwInfo)
b = SiS_Pr->SiS_VDE;
}
- if((ROMAddr = (UCHAR *)HwInfo->pjVirtualRomBase) && SiS_Pr->SiS_UseROM) {
+ if((HwInfo->jChipType >= SIS_661) && (ROMAddr = (UCHAR *)HwInfo->pjVirtualRomBase) && SiS_Pr->SiS_UseROM) {
if(a < b) {
p = ROMAddr[0x278] | (ROMAddr[0x279] << 8);
@@ -6931,6 +7034,13 @@ SiS_GetGroup2CLVXPtr(SiS_Private *SiS_Pr, int tabletype, PSIS_HW_INFO HwInfo)
} else {
p = ROMAddr[0x27c] | (ROMAddr[0x27d] << 8);
}
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) {
+ if(SiS_Pr->SiS_TVMode & TVSetYPbPr525i) p = ROMAddr[0x280] | (ROMAddr[0x281] << 8);
+ else if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) p = ROMAddr[0x282] | (ROMAddr[0x283] << 8);
+ else p = ROMAddr[0x284] | (ROMAddr[0x285] << 8);
+ } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
+ p = ROMAddr[0x286] | (ROMAddr[0x287] << 8);
+ }
do {
if((ROMAddr[p] | ROMAddr[p+1] << 8) == a) break;
p += 0x42;
@@ -6952,6 +7062,14 @@ SiS_GetGroup2CLVXPtr(SiS_Private *SiS_Pr, int tabletype, PSIS_HW_INFO HwInfo)
} else {
tableptr = SiS_Part2CLVX_3;
}
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) {
+ if(SiS_Pr->SiS_TVMode & TVSetYPbPr525i) tableptr = SiS_Part2CLVX_3;
+ else if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) tableptr = SiS_Part2CLVX_3;
+ else tableptr = SiS_Part2CLVX_5;
+
+ } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
+ tableptr = SiS_Part2CLVX_6;
+ }
do {
if((tableptr[p] | tableptr[p+1] << 8) == a) break;
p += 0x42;
@@ -6971,7 +7089,7 @@ SiS_SetGroup2_C_ELV(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
int i, j;
UCHAR temp;
- if(!(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302ELV))) return;
+ if(!(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302ELV))) return;
tableptr = SiS_GetGroup2CLVXPtr(SiS_Pr, 0, HwInfo);
for(i = 0x80, j = 0; i <= 0xbf; i++, j++) {
@@ -7019,7 +7137,7 @@ 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) {
+ } 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;
}
@@ -7080,30 +7198,100 @@ SiS_Set300Part2Regs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
static void
SiS_SetTVSpecial(SiS_Private *SiS_Pr, USHORT ModeNo)
{
- if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
- if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) {
- if(SiS_Pr->SiS_TVMode & TVSetNTSC1024) {
- UCHAR specialtv[] = {
+ if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) return;
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoHiVision)) return;
+ if(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p | TVSetYPbPr750p)) return;
+
+ if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) {
+ if(SiS_Pr->SiS_TVMode & TVSetNTSC1024) {
+ const UCHAR specialtv[] = {
0xa7,0x07,0xf2,0x6e,0x17,0x8b,0x73,0x53,
0x13,0x40,0x34,0xf4,0x63,0xbb,0xcc,0x7a,
0x58,0xe4,0x73,0xda,0x13
- };
- int i, j;
- for(i = 0x1c, j = 0; i <= 0x30; i++, j++) {
- SiS_SetReg(SiS_Pr->SiS_Part2Port,i,specialtv[j]);
- }
+ };
+ int i, j;
+ for(i = 0x1c, j = 0; i <= 0x30; i++, j++) {
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,i,specialtv[j]);
+ }
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x43,0x72);
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750)) {
if(SiS_Pr->SiS_TVMode & TVSetPALM) {
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x14);
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x1b);
} else {
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x15);
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x14); /* 15 */
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x1a); /* 1b */
}
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x1b);
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x43,0x72);
}
+ }
+ } else {
+ if((ModeNo == 0x38) || (ModeNo == 0x4a) || (ModeNo == 0x64) ||
+ (ModeNo == 0x52) || (ModeNo == 0x58) || (ModeNo == 0x5c)) {
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x1b); /* 21 */
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x54); /* 5a */
} else {
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x21);
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x5a);
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x1a); /* 21 */
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x53); /* 5a */
+ }
+ }
+}
+
+static void
+SiS_SetGroup2_Tail(SiS_Private *SiS_Pr, USHORT ModeNo)
+{
+ USHORT temp;
+
+ if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) {
+ if(SiS_Pr->SiS_VGAVDE == 525) {
+ temp = 0xc3;
+ if(SiS_Pr->SiS_ModeType <= ModeVGA) {
+ temp++;
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) temp += 2;
+ }
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2f,temp);
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x30,0xb3);
+ } else if(SiS_Pr->SiS_VGAVDE == 420) {
+ temp = 0x4d;
+ if(SiS_Pr->SiS_ModeType <= ModeVGA) {
+ temp++;
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) temp++;
+ }
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2f,temp);
+ }
+ }
+
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301B302B) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part2Port,0x1a,0x03);
+ /* Not always for LV, see SetGroup2() */
+ }
+ temp = 1;
+ if(ModeNo <= 0x13) temp = 3;
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x0b,temp);
}
+#if 0
+ /* 651+301C, for 1280x768 - do I really need that? */
+ if((SiS_Pr->SiS_PanelXRes == 1280) && (SiS_Pr->SiS_PanelYRes == 768)) {
+ if(SiS_Pr->SiS_VBInfo & SetSimuScanMode) {
+ if(((SiS_Pr->SiS_HDE == 640) && (SiS_Pr->SiS_VDE == 480)) ||
+ ((SiS_Pr->SiS_HDE == 320) && (SiS_Pr->SiS_VDE == 240))) {
+ SiS_SetReg(SiS_Part2Port,0x01,0x2b);
+ SiS_SetReg(SiS_Part2Port,0x02,0x13);
+ SiS_SetReg(SiS_Part2Port,0x04,0xe5);
+ SiS_SetReg(SiS_Part2Port,0x05,0x08);
+ SiS_SetReg(SiS_Part2Port,0x06,0xe2);
+ SiS_SetReg(SiS_Part2Port,0x1c,0x21);
+ SiS_SetReg(SiS_Part2Port,0x1d,0x45);
+ SiS_SetReg(SiS_Part2Port,0x1f,0x0b);
+ SiS_SetReg(SiS_Part2Port,0x20,0x00);
+ SiS_SetReg(SiS_Part2Port,0x21,0xa9);
+ SiS_SetReg(SiS_Part2Port,0x23,0x0b);
+ SiS_SetReg(SiS_Part2Port,0x25,0x04);
+ }
+ }
+ }
+#endif
}
}
@@ -7148,66 +7336,62 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToAVIDEO)) temp |= 0x08;
if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToSVIDEO)) temp |= 0x04;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToSCART) temp |= 0x02;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) temp |= 0x01;
- /* 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) {
- temp |= 0x0c;
- }
- }
+ if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) temp |= 0x10;
+
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x00,temp);
PhasePoint = SiS_Pr->SiS_PALPhase;
TimingPoint = SiS_Pr->SiS_PALTiming;
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
- temp ^= 0x01;
+ TimingPoint = SiS_Pr->SiS_HiTVExtTiming;
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;
+ TimingPoint = SiS_Pr->SiS_HiTVSt1Timing;
+#if 0
+ if(!(modeflag & Charx8Dot)) TimingPoint = SiS_Pr->SiS_HiTVTextTiming;
+#endif
}
- } else TimingPoint = SiS_Pr->SiS_HiTVExtTiming;
+ }
- if(SiS_Pr->SiS_YPbPr & YPbPrModeMask) temp &= 0xfe;
+ } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) {
- } else {
+ if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) TimingPoint = &SiS_YPbPrTable[2][0];
+ else if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) TimingPoint = &SiS_YPbPrTable[1][0];
+ else TimingPoint = &SiS_YPbPrTable[0][0];
- if(SiS_Pr->SiS_TVMode & TVSetPAL) {
+ PhasePoint = SiS_Pr->SiS_NTSCPhase;
- TimingPoint = SiS_Pr->SiS_PALTiming;
- PhasePoint = SiS_Pr->SiS_PALPhase;
+ } else if(SiS_Pr->SiS_TVMode & TVSetPAL) {
- if( (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) &&
- ( (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) ||
- (SiS_Pr->SiS_TVMode & TVSetTVSimuMode) ) ) {
- PhasePoint = SiS_Pr->SiS_PALPhase2;
- }
+ if( (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) &&
+ ( (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) ||
+ (SiS_Pr->SiS_TVMode & TVSetTVSimuMode) ) ) {
+ PhasePoint = SiS_Pr->SiS_PALPhase2;
+ }
- } else {
+ } else {
- temp |= 0x10;
- TimingPoint = SiS_Pr->SiS_NTSCTiming;
- PhasePoint = SiS_Pr->SiS_NTSCPhase;
+ TimingPoint = SiS_Pr->SiS_NTSCTiming;
+ PhasePoint = SiS_Pr->SiS_NTSCPhase;
+ if(SiS_Pr->SiS_TVMode & TVSetNTSCJ) {
+ PhasePoint = SiS_Pr->SiS_PALPhase;
+ }
+
+ if( (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) &&
+ ( (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) ||
+ (SiS_Pr->SiS_TVMode & TVSetTVSimuMode) ) ) {
+ PhasePoint = SiS_Pr->SiS_NTSCPhase2;
if(SiS_Pr->SiS_TVMode & TVSetNTSCJ) {
- PhasePoint = SiS_Pr->SiS_PALPhase;
+ PhasePoint = SiS_Pr->SiS_PALPhase2;
}
-
- if( (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) &&
- ( (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) ||
- (SiS_Pr->SiS_TVMode & TVSetTVSimuMode) ) ) {
- PhasePoint = SiS_Pr->SiS_NTSCPhase2;
- if(SiS_Pr->SiS_TVMode & TVSetNTSCJ) {
- PhasePoint = SiS_Pr->SiS_PALPhase2;
- }
- }
-
}
}
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x00,temp);
if(SiS_Pr->SiS_TVMode & TVSetPALM) {
PhasePoint = SiS_Pr->SiS_PALMPhase;
@@ -7217,6 +7401,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
PhasePoint = SiS_Pr->SiS_PALMPhase2;
}
}
+
if(SiS_Pr->SiS_TVMode & TVSetPALN) {
PhasePoint = SiS_Pr->SiS_PALNPhase;
if( (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) &&
@@ -7259,19 +7444,13 @@ 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 & 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_VBInfo & SetCRT2ToHiVision) tempax = 950;
+ else if(SiS_Pr->SiS_TVMode & TVSetPAL) tempax = 520;
+ else tempax = 440;
- 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)) ) ) ) {
+ if( ( (!(SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoHiVision)) && (SiS_Pr->SiS_VDE <= tempax) ) ||
+ ( (SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoHiVision) &&
+ ((SiS_Pr->SiS_VGAHDE == 1024) || (SiS_Pr->SiS_VDE <= tempax)) ) ) {
tempax -= SiS_Pr->SiS_VDE;
tempax >>= 2;
@@ -7283,12 +7462,10 @@ 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 & SetCRT2ToTVNoYPbPr) &&
- (SiS_Pr->SiS_YPbPr != YPbPrHiVision) &&
- (SiS_Pr->SiS_VGAHDE >= 1024) ) {
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoHiVision) && (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);
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x1b); /* 19 */
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x54); /* 52 */
} else {
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x17);
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x1d);
@@ -7313,26 +7490,20 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
push1 = tempcx;
tempcx += 7;
- if((SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) && (SiS_Pr->SiS_YPbPr == YPbPrHiVision)) {
- tempcx -= 4;
- }
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) tempcx -= 4;
temp = (tempcx & 0x00FF) << 4;
SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x22,0x0F,temp);
tempbx = TimingPoint[j] | ((TimingPoint[j+1]) << 8);
tempbx += tempcx;
- push2 = tempbx;
-
temp = tempbx & 0x00FF;
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x24,temp);
temp = ((tempbx & 0xFF00) >> 8) << 4;
SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x25,0x0F,temp);
- tempbx = push2;
-
tempbx += 8;
- if((SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) && (SiS_Pr->SiS_YPbPr == YPbPrHiVision)) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
tempbx -= 4;
tempcx = tempbx;
}
@@ -7347,9 +7518,7 @@ 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 & SetCRT2ToYPbPr) && (SiS_Pr->SiS_YPbPr == YPbPrHiVision)) {
- tempcx -= 4;
- }
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) tempcx -= 4;
temp = (tempcx & 0x00FF) << 4;
SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x2A,0x0F,temp);
@@ -7374,25 +7543,23 @@ 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_YPbPr & YPbPrModeMask))) {
+ if( (SiS_Pr->SiS_VBInfo & SetCRT2ToTV) &&
+ (!(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p|TVSetYPbPr750p))) ) {
tempbx >>= 1;
if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) {
if(ModeNo <= 0x13) {
- if(crt2crtc == 1) {
- tempbx++;
- }
+ if(crt2crtc == 1) tempbx++;
}
- } else {
- if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
- if(crt2crtc == 4)
- if(SiS_Pr->SiS_ModeType <= 3) tempbx++;
+ } else if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
+ if(crt2crtc == 4) {
+ if(SiS_Pr->SiS_ModeType <= 3) tempbx++;
}
}
}
}
tempbx -= 2;
temp = tempbx & 0x00FF;
- if((SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) && (SiS_Pr->SiS_YPbPr == YPbPrHiVision)) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
if((ModeNo == 0x2f) || (ModeNo == 0x5d) || (ModeNo == 0x5e)) temp++;
}
@@ -7414,7 +7581,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 & (SetCRT2ToYPbPr | SetCRT2ToSCART))) {
+ if(!(SiS_Pr->SiS_VBInfo & (SetCRT2ToHiVision | SetCRT2ToYPbPr525750 | SetCRT2ToSCART))) {
temp |= 0x10;
if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToSVIDEO)) temp |= 0x20;
}
@@ -7431,21 +7598,12 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
}
}
- 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_YPbPrTable[SiS_Pr->SiS_YPbPr & 0x03][j]);
- }
- for(i=0x39; i<=0x45; i++, 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_YPbPr & YPbPrModeMask))) {
- tempbx >>= 1;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ if(!(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p | TVSetYPbPr750p))) {
+ tempbx >>= 1;
+ }
}
tempbx -= 3;
if(HwInfo->jChipType >= SIS_661) {
@@ -7463,13 +7621,6 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
temp = tempbx & 0x00FF;
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x47,temp);
- temp = 0;
- 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);
-
}
tempbx = 0;
@@ -7481,15 +7632,13 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
}
tempcx = 0x0101;
- 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;
- if(SiS_Pr->SiS_VGAHDE >= 1280) {
- tempcx = 0x1420;
- tempbx &= ~0x2000;
- }
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ if(SiS_Pr->SiS_VGAHDE >= 1024) {
+ if((!(modeflag & HalfDCLK)) || (HwInfo->jChipType < SIS_315H)) {
+ tempcx = 0x1920;
+ if(SiS_Pr->SiS_VGAHDE >= 1280) {
+ tempcx = 0x1420;
+ tempbx &= ~0x2000;
}
}
}
@@ -7536,14 +7685,17 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x4C,temp);
temp = (tempcx & 0x0300) >> (8 - 2);
temp |= ((tempbx >> 8) & 0x03);
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x4D,0xF0,temp);
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) {
+ temp |= 0x10;
+ if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) temp |= 0x20;
+ else if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) temp |= 0x40;
+ }
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x4D,temp);
temp = SiS_GetReg(SiS_Pr->SiS_Part2Port,0x43);
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x43,(USHORT)(temp - 3));
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
- SiS_SetTVSpecial(SiS_Pr, ModeNo);
- }
+ SiS_SetTVSpecial(SiS_Pr, ModeNo);
if(SiS_Pr->SiS_VBType & VB_SIS301C) {
temp = 0;
@@ -7561,11 +7713,9 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xEF);
}
- if(HwInfo->jChipType >= SIS_315H) {
- if((SiS_Pr->SiS_VBType & VB_SIS301B302B) && (!(SiS_Pr->SiS_VBType & VB_NoLCD))) {
- if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x0B,0x00);
- }
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
+ if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x0B,0x00);
}
}
@@ -7811,42 +7961,10 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x23,(CRT2Part2Ptr+resindex)->CR[10]);
SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x25,0x0f,(CRT2Part2Ptr+resindex)->CR[11]);
- if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) {
- if(SiS_Pr->SiS_VGAVDE == 525) {
- temp = 0xc3;
- if(SiS_Pr->SiS_ModeType <= ModeVGA) {
- temp++;
- if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) temp += 2;
- }
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2f,temp);
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x30,0xb3);
- } else if(SiS_Pr->SiS_VGAVDE == 420) {
- temp = 0x4d;
- if(SiS_Pr->SiS_ModeType <= ModeVGA) {
- temp++;
- if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) temp++;
- }
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2f,temp);
- }
- }
-
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
- if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) {
- /* See Sync above, 0x1a */
- temp = 1;
- if(ModeNo <= 0x13) temp = 3;
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x0b,temp);
- }
- }
+ SiS_SetGroup2_Tail(SiS_Pr, ModeNo);
#endif
- } else { /* ------ 300 series and other bridges, other LCD resolutions ------ */
-
- /* Using this on the 301B with an auto-expanding 1024 panel (CR37=1) makes
- * the panel scale at modes < 1024 (no black bars); if the panel is non-expanding,
- * the bridge scales all modes to 1024.
- * !!! Malfunction at 640x480 and 640x400 when panel is auto-expanding - black screen !!!
- */
+ } else { /* ------ other bridges, other LCD resolutions ------ */
tempcx = SiS_Pr->SiS_VT;
tempbx = SiS_Pr->PanelYRes;
@@ -7860,6 +7978,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) {
if(tempbx != SiS_Pr->SiS_VDE) {
tempax = tempbx;
+ /* if(SiS_Pr->SiS_VGAVDE == 525) tempax += 0x3c; */ /* 651+301C */
if(tempax < SiS_Pr->SiS_VDE) {
tempax = 0;
tempcx = 0;
@@ -7887,8 +8006,8 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
temp |= ((tempcx & 0xFF00) >> 8);
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,temp);
- tempbx = SiS_Pr->SiS_VT; /* push2; */
- tempax = SiS_Pr->SiS_VDE; /* push1; */
+ tempbx = SiS_Pr->SiS_VT;
+ tempax = SiS_Pr->SiS_VDE;
tempcx = (tempbx - tempax) >> 4;
tempbx += tempax;
tempbx >>= 1;
@@ -7975,11 +8094,18 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
}
#endif
- tempcx = (SiS_Pr->SiS_HT - SiS_Pr->SiS_HDE) >> 2; /* (HT - HDE) >> 2 */
- tempbx = SiS_Pr->SiS_HDE + 7; /* lcdhdee */
- if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
- tempbx += 2;
+ tempcx = SiS_Pr->SiS_HT;
+ tempbx = SiS_Pr->SiS_HDE;
+ if(SiS_IsDualLink(SiS_Pr, HwInfo)) {
+ tempcx >>= 1;
+ tempbx >>= 1;
}
+ tempcx = (tempcx - tempbx) >> 2; /* (HT - HDE) >> 2 */
+ tempbx += 7; /* lcdhdee */
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) tempbx += 2;
+ if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempbx++;
+ if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302ELV)) tempbx++;
+
push1 = tempbx;
#ifdef TWDEBUG
@@ -7992,9 +8118,9 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x25,0xF0,temp);
temp = 7;
- if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
- temp += 2;
- }
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) temp += 2;
+ if(SiS_IsDualLink(SiS_Pr, HwInfo)) temp++;
+ if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302ELV)) temp++;
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x1F,temp); /* RHBLKE = lcdhdes[7:0] */
SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x20,0x0F); /* lcdhdes [11:8] */
@@ -8003,9 +8129,9 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
if(SiS_Pr->UseCustomMode) {
tempbx = SiS_Pr->CHSyncStart + 7;
- if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
- tempbx += 2;
- }
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) tempbx += 2;
+ if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempbx++;
+ if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302ELV)) tempbx++;
}
#ifdef TWDEBUG
@@ -8030,9 +8156,9 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
if(SiS_Pr->UseCustomMode) {
tempbx = SiS_Pr->CHSyncEnd + 7;
- if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
- tempbx += 2;
- }
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) tempbx += 2;
+ if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempbx++;
+ if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302ELV)) tempbx++;
}
#ifdef TWDEBUG
@@ -8042,22 +8168,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
temp = tempbx & 0x00FF; /* RHSYEXP2S = lcdhre */
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x21,temp);
- if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) {
- if(SiS_Pr->SiS_VGAVDE == 525) {
- if(SiS_Pr->SiS_ModeType <= ModeVGA)
- temp=0xC6;
- else
- temp=0xC3;
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2f,temp);
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x30,0xB3);
- } else if(SiS_Pr->SiS_VGAVDE == 420) {
- if(SiS_Pr->SiS_ModeType <= ModeVGA)
- temp=0x4F;
- else
- temp=0x4D;
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2f,temp);
- }
- }
+ SiS_SetGroup2_Tail(SiS_Pr, ModeNo);
#ifdef SIS300
SiS_Set300Part2Regs(SiS_Pr, HwInfo, ModeIdIndex,
@@ -8112,37 +8223,86 @@ SiS_SetGroup3(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_SetReg(SiS_Pr->SiS_Part3Port,0x3D,0xA8);
}
- 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;
- }
+ tempdi = NULL;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
+ tempdi = SiS_Pr->SiS_HiTVGroup3Data;
+ if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) {
+ tempdi = SiS_Pr->SiS_HiTVGroup3Simu;
+#if 0
+ if(!(modeflag & Charx8Dot)) {
+ tempdi = SiS_Pr->SiS_HiTVGroup3Text;
}
- } else if(SiS_Pr->SiS_YPbPr & YPbPrModeMask) {
+#endif
+ }
+ } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) {
+ if(!(SiS_Pr->SiS_TVMode & TVSetYPbPr525i)) {
tempdi = SiS_HiTVGroup3_1;
- if(SiS_Pr->SiS_YPbPr & YPbPr525) tempdi = SiS_HiTVGroup3_2;
+ if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) tempdi = SiS_HiTVGroup3_2;
}
- if(tempdi) {
- 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]);
+ }
+ if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302ELV)) {
+ if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) {
+ SiS_SetReg(SiS_Pr->SiS_Part3Port,0x28,0x3f);
+ }
}
}
#ifdef SIS_CP
SIS_CP_INIT301_CP2
#endif
-
}
/*********************************************/
/* SET PART 4 REGISTER GROUP */
/*********************************************/
+#ifdef SIS315H
+static void
+SiS_SetGroup4_C_ELV(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
+{
+ USHORT temp, temp1;
+
+ if(!(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302ELV))) return;
+
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x3a,0x08);
+ temp = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x3a);
+ if(!(temp & 0x01)) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x3a,0xdf);
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x25,0xfc);
+ if(HwInfo->jChipType < SIS_661) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x25,0xf8);
+ }
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x0f,0xfb);
+ temp = 0;
+ if(!(SiS_Pr->SiS_TVMode & TVSetYPbPr750p)) {
+ temp |= 0x0002;
+ if(!(SiS_Pr->SiS_TVMode & TVSetYPbPr525p)) {
+ temp ^= 0x0402;
+ if(!(SiS_Pr->SiS_TVMode & TVSetHiVision)) {
+ temp ^= 0x0002;
+ }
+ }
+ }
+ if(HwInfo->jChipType >= SIS_661) {
+ temp1 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x39);
+ if(temp1 & 0x01) temp |= 0x10;
+ if(temp1 & 0x02) temp |= 0x01;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xec,(temp & 0xff));
+ } else {
+ temp1 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x3b) & 0x03;
+ if(temp1 == 0x01) temp |= 0x01;
+ if(temp1 == 0x03) temp |= 0x04; /* ? why not 0x10? */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xea,(temp & 0xff));
+ }
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x3a,0xfb,(temp >> 8));
+ }
+}
+#endif
+
static void
SiS_SetCRT2VCLK(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
USHORT RefreshRateTableIndex, PSIS_HW_INFO HwInfo)
@@ -8224,7 +8384,7 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#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_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10);
}
#endif
@@ -8265,7 +8425,7 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
temp = 0xA0;
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
temp = 0;
if(tempbx > 800) {
temp = 0xA0;
@@ -8286,7 +8446,7 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
}
- if(SiS_Pr->SiS_YPbPr & YPbPrModeMask) {
+ if(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p | TVSetYPbPr750p)) {
temp = 0;
if(SiS_Pr->SiS_VGAHDE == 1024) temp = 0x20;
}
@@ -8304,7 +8464,7 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
tempebx = SiS_Pr->SiS_VDE;
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
if(!(temp & 0xE0)) tempebx >>=1;
}
@@ -8342,24 +8502,15 @@ 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_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;
- }
- }
-
- if((SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoYPbPr) && (!(SiS_Pr->SiS_YPbPr & YPbPrModeMask))) {
+ if(modeflag & HalfDCLK) tempax >>= 1;
+ if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempax >>= 1;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if(tempax > 800) tempax -= 800;
+ } else /* if(SiS_Pr->SiS_VBInfo & TvNoHiviNoYPbPr) */ { /* 651+301C */
if(tempax > 800) {
tempbx = 8;
- if(tempax == 1024)
- tempax *= 25;
- else
- tempax *= 20;
-
+ if(tempax == 1024) tempax *= 25;
+ else tempax *= 20;
temp = tempax % 32;
tempax /= 32;
tempax--;
@@ -8367,11 +8518,11 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
}
tempax--;
- temp = (tempax & 0xFF00) >> 8;
- temp &= 0x03;
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { /* From 1.10.7w */
+ temp = ((tempax & 0xFF00) >> 8) & 0x03;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoYPbPrHiVision) { /* From 1.10.7w */
if(ModeNo > 0x13) { /* From 1.10.7w */
if(resinfo == SIS_RI_1024x768) tempax = 0x1f; /* From 1.10.7w */
+ /* ax normally 0x1e */ /* From 1.10.7w */
} /* From 1.10.7w */
} /* From 1.10.7w */
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x1D,tempax & 0x00FF);
@@ -8388,11 +8539,14 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
} else {
temp = 0x0036;
}
- 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))
- temp &= 0xFE;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ if(!(SiS_Pr->SiS_TVMode & (TVSetNTSC1024 | TVSetHiVision | TVSetYPbPr750p | TVSetYPbPr525p))) {
+ temp |= 0x01;
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
+ if(!(SiS_Pr->SiS_TVMode & TVSetTVSimuMode)) {
+ temp &= 0xFE;
+ }
+ }
}
}
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x1F,0xC0,temp);
@@ -8419,7 +8573,7 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#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_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10);
}
#endif
@@ -8443,7 +8597,7 @@ SiS_SetGroup5(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) return;
if(SiS_Pr->SiS_ModeType == ModeVGA) {
- if(!(SiS_Pr->SiS_VBInfo & (SetInSlaveMode | LoadDACFlag))){
+ if(!(SiS_Pr->SiS_VBInfo & (SetInSlaveMode | LoadDACFlag))) {
SiS_EnableCRT2(SiS_Pr);
SiS_LoadDAC(SiS_Pr, HwInfo, ModeNo, ModeIdIndex);
}
@@ -8617,7 +8771,6 @@ SiS_SetCRT2ECLK(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
}
- SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x86);
SiS_SetReg(SiS_Pr->SiS_P3c4,0x31,0x20);
SiS_SetReg(SiS_Pr->SiS_P3c4,clkbase,sr2b);
SiS_SetReg(SiS_Pr->SiS_P3c4,clkbase+1,sr2c);
@@ -8642,9 +8795,9 @@ SiS_SetCHTVReg(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
const SiS_CHTVRegDataStruct *CHTVRegData = NULL;
if(ModeNo <= 0x13)
- tempcl = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ tempcl = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
else
- tempcl = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ tempcl = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
TVType = 0;
if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) TVType += 1;
@@ -9451,6 +9604,9 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
#endif
SiS_SetGroup3(SiS_Pr, ModeNo, ModeIdIndex, HwInfo);
SiS_SetGroup4(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo);
+#ifdef SIS315H
+ SiS_SetGroup4_C_ELV(SiS_Pr, HwInfo);
+#endif
SiS_SetGroup5(SiS_Pr, ModeNo, ModeIdIndex, HwInfo);
/* For 301BDH (Panel link initialization): */
@@ -9472,13 +9628,11 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) {
if(SiS_Pr->SiS_IF_DEF_TRUMPION == 0) {
- SiS_ModCRT1CRTC(SiS_Pr,ModeNo,ModeIdIndex,
- RefreshRateTableIndex,HwInfo);
+ SiS_ModCRT1CRTC(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwInfo);
}
}
- SiS_SetCRT2ECLK(SiS_Pr,ModeNo,ModeIdIndex,
- RefreshRateTableIndex,HwInfo);
+ SiS_SetCRT2ECLK(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwInfo);
if(SiS_Pr->SiS_SetFlag & LowModeTests) {
if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
@@ -9535,9 +9689,7 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
if(SiS_Pr->SiS_SetFlag & LowModeTests) {
if(HwInfo->jChipType < SIS_661) {
SiS_FinalizeLCD(SiS_Pr, ModeNo, ModeIdIndex, HwInfo);
- if(SiS_Pr->SiS_UseOEM) {
- SiS_OEM310Setting(SiS_Pr, HwInfo, ModeNo, ModeIdIndex);
- }
+ SiS_OEM310Setting(SiS_Pr, HwInfo, ModeNo, ModeIdIndex);
} else {
SiS_OEM661Setting(SiS_Pr, HwInfo, ModeNo, ModeIdIndex, RefreshRateTableIndex);
}
@@ -9555,7 +9707,7 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) {
if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
/* Disable LCD panel when using TV */
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x11,0x0C);
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFF,0x0C);
} else {
/* Disable TV when using LCD */
SiS_SetCH70xxANDOR(SiS_Pr,0x010E,0xF8);
@@ -9578,6 +9730,7 @@ void
SiS_SiS30xBLOn(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
/* Switch on LCD backlight on SiS30xLV */
+ SiS_DDC2Delay(SiS_Pr,0xff00);
if(!(SiS_GetReg(SiS_Pr->SiS_Part4Port,0x26) & 0x02)) {
SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x02);
SiS_WaitVBRetrace(SiS_Pr,HwInfo);
@@ -9593,12 +9746,24 @@ SiS_SiS30xBLOff(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
/* Switch off LCD backlight on SiS30xLV */
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFE);
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFD);
+ SiS_DDC2Delay(SiS_Pr,0xe000);
}
/*********************************************/
/* DDC RELATED FUNCTIONS */
/*********************************************/
+static void
+SiS_SetupDDCN(SiS_Private *SiS_Pr)
+{
+ SiS_Pr->SiS_DDC_NData = ~SiS_Pr->SiS_DDC_Data;
+ SiS_Pr->SiS_DDC_NClk = ~SiS_Pr->SiS_DDC_Clk;
+ if((SiS_Pr->SiS_DDC_Index == 0x11) && (SiS_Pr->SiS_SensibleSR11)) {
+ SiS_Pr->SiS_DDC_NData &= 0x0f;
+ SiS_Pr->SiS_DDC_NClk &= 0x0f;
+ }
+}
+
/* The Chrontel 700x is connected to the 630/730 via
* the 630/730's DDC/I2C port.
*
@@ -9639,13 +9804,13 @@ SiS_SetChReg(SiS_Private *SiS_Pr, USHORT tempbx, USHORT myor)
void
SiS_SetCH700x(SiS_Private *SiS_Pr, USHORT tempbx)
{
- SiS_Pr->SiS_DDC_DataShift = 0x00;
SiS_Pr->SiS_DDC_DeviceAddr = 0xEA; /* DAB (Device Address Byte) */
if(!(SiS_Pr->SiS_ChrontelInit)) {
SiS_Pr->SiS_DDC_Index = 0x11; /* Bit 0 = SC; Bit 1 = SD */
SiS_Pr->SiS_DDC_Data = 0x02; /* Bitmask in IndexReg for Data */
SiS_Pr->SiS_DDC_Clk = 0x01; /* Bitmask in IndexReg for Clk */
+ SiS_SetupDDCN(SiS_Pr);
}
if( (!(SiS_SetChReg(SiS_Pr, tempbx, 0x80))) &&
@@ -9653,6 +9818,7 @@ SiS_SetCH700x(SiS_Private *SiS_Pr, USHORT tempbx)
SiS_Pr->SiS_DDC_Index = 0x0a; /* Bit 7 = SC; Bit 6 = SD */
SiS_Pr->SiS_DDC_Data = 0x80; /* Bitmask in IndexReg for Data */
SiS_Pr->SiS_DDC_Clk = 0x40; /* Bitmask in IndexReg for Clk */
+ SiS_SetupDDCN(SiS_Pr);
SiS_SetChReg(SiS_Pr, tempbx, 0x80);
}
@@ -9666,7 +9832,7 @@ SiS_SetCH701x(SiS_Private *SiS_Pr, USHORT tempbx)
SiS_Pr->SiS_DDC_Index = 0x11; /* Bit 0 = SC; Bit 1 = SD */
SiS_Pr->SiS_DDC_Data = 0x08; /* Bitmask in IndexReg for Data */
SiS_Pr->SiS_DDC_Clk = 0x04; /* Bitmask in IndexReg for Clk */
- SiS_Pr->SiS_DDC_DataShift = 0x00;
+ SiS_SetupDDCN(SiS_Pr);
SiS_Pr->SiS_DDC_DeviceAddr = 0xEA; /* DAB (Device Address Byte) */
SiS_SetChReg(SiS_Pr, tempbx, 0);
@@ -9717,13 +9883,13 @@ SiS_GetCH700x(SiS_Private *SiS_Pr, USHORT tempbx)
{
USHORT result;
- SiS_Pr->SiS_DDC_DataShift = 0x00;
SiS_Pr->SiS_DDC_DeviceAddr = 0xEA; /* DAB */
if(!(SiS_Pr->SiS_ChrontelInit)) {
SiS_Pr->SiS_DDC_Index = 0x11; /* Bit 0 = SC; Bit 1 = SD */
SiS_Pr->SiS_DDC_Data = 0x02; /* Bitmask in IndexReg for Data */
SiS_Pr->SiS_DDC_Clk = 0x01; /* Bitmask in IndexReg for Clk */
+ SiS_SetupDDCN(SiS_Pr);
}
SiS_Pr->SiS_DDC_ReadAddr = tempbx;
@@ -9734,6 +9900,7 @@ SiS_GetCH700x(SiS_Private *SiS_Pr, USHORT tempbx)
SiS_Pr->SiS_DDC_Index = 0x0a;
SiS_Pr->SiS_DDC_Data = 0x80;
SiS_Pr->SiS_DDC_Clk = 0x40;
+ SiS_SetupDDCN(SiS_Pr);
result = SiS_GetChReg(SiS_Pr,0x80);
}
@@ -9748,7 +9915,7 @@ SiS_GetCH701x(SiS_Private *SiS_Pr, USHORT tempbx)
SiS_Pr->SiS_DDC_Index = 0x11; /* Bit 0 = SC; Bit 1 = SD */
SiS_Pr->SiS_DDC_Data = 0x08; /* Bitmask in IndexReg for Data */
SiS_Pr->SiS_DDC_Clk = 0x04; /* Bitmask in IndexReg for Clk */
- SiS_Pr->SiS_DDC_DataShift = 0x00;
+ SiS_SetupDDCN(SiS_Pr);
SiS_Pr->SiS_DDC_DeviceAddr = 0xEA; /* DAB */
SiS_Pr->SiS_DDC_ReadAddr = tempbx;
@@ -9872,6 +10039,8 @@ SiS_InitDDCRegs(SiS_Private *SiS_Pr, unsigned long VBFlags, int VGAEngine,
SiS_Pr->SiS_DDC_Data = 0x02 << temp;
SiS_Pr->SiS_DDC_Clk = 0x01 << temp;
+ SiS_SetupDDCN(SiS_Pr);
+
#ifdef TWDEBUG
xf86DrvMsg(0, X_INFO, "DDC Port %x Index %x Shift %d\n",
SiS_Pr->SiS_DDC_Port, SiS_Pr->SiS_DDC_Index, temp);
@@ -9916,11 +10085,15 @@ SiS_SendACK(SiS_Private *SiS_Pr, USHORT yesno)
{
SiS_SetSCLKLow(SiS_Pr);
if(yesno) {
- SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port, SiS_Pr->SiS_DDC_Index,
- ~SiS_Pr->SiS_DDC_Data, SiS_Pr->SiS_DDC_Data);
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,
+ SiS_Pr->SiS_DDC_Index,
+ SiS_Pr->SiS_DDC_NData,
+ SiS_Pr->SiS_DDC_Data);
} else {
- SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port, SiS_Pr->SiS_DDC_Index,
- ~SiS_Pr->SiS_DDC_Data, 0);
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,
+ SiS_Pr->SiS_DDC_Index,
+ SiS_Pr->SiS_DDC_NData,
+ 0);
}
SiS_SetSCLKHigh(SiS_Pr);
}
@@ -10791,7 +10964,7 @@ SiS_SenseVGA2DDC(SiS_Private *SiS_Pr, SISPtr pSiS)
}
if(foundcrt) {
- SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x32,0x10);
+ SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x32,0x10);
}
return(0);
}
@@ -10833,11 +11006,15 @@ USHORT
SiS_SetStart(SiS_Private *SiS_Pr)
{
if(SiS_SetSCLKLow(SiS_Pr)) return 0xFFFF; /* (SC->low) */
- SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index,
- ~SiS_Pr->SiS_DDC_Data,SiS_Pr->SiS_DDC_Data); /* SD->high */
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,
+ SiS_Pr->SiS_DDC_Index,
+ SiS_Pr->SiS_DDC_NData,
+ SiS_Pr->SiS_DDC_Data); /* SD->high */
if(SiS_SetSCLKHigh(SiS_Pr)) return 0xFFFF; /* SC->high */
- SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index,
- ~SiS_Pr->SiS_DDC_Data,0x00); /* SD->low = start condition */
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,
+ SiS_Pr->SiS_DDC_Index,
+ SiS_Pr->SiS_DDC_NData,
+ 0x00); /* SD->low = start condition */
if(SiS_SetSCLKHigh(SiS_Pr)) return 0xFFFF; /* (SC->low) */
return 0;
}
@@ -10848,11 +11025,15 @@ USHORT
SiS_SetStop(SiS_Private *SiS_Pr)
{
if(SiS_SetSCLKLow(SiS_Pr)) return 0xFFFF; /* (SC->low) */
- SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index,
- ~SiS_Pr->SiS_DDC_Data,0x00); /* SD->low */
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,
+ SiS_Pr->SiS_DDC_Index,
+ SiS_Pr->SiS_DDC_NData,
+ 0x00); /* SD->low */
if(SiS_SetSCLKHigh(SiS_Pr)) return 0xFFFF; /* SC->high */
- SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index,
- ~SiS_Pr->SiS_DDC_Data,SiS_Pr->SiS_DDC_Data); /* SD->high = stop condition */
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,
+ SiS_Pr->SiS_DDC_Index,
+ SiS_Pr->SiS_DDC_NData,
+ SiS_Pr->SiS_DDC_Data); /* SD->high = stop condition */
if(SiS_SetSCLKHigh(SiS_Pr)) return 0xFFFF; /* (SC->high) */
return 0;
}
@@ -10867,11 +11048,15 @@ SiS_WriteDDC2Data(SiS_Private *SiS_Pr, USHORT tempax)
for(i=0; i<8; i++) {
SiS_SetSCLKLow(SiS_Pr); /* SC->low */
if(tempax & flag) {
- SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index,
- ~SiS_Pr->SiS_DDC_Data,SiS_Pr->SiS_DDC_Data); /* Write bit (1) to SD */
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,
+ SiS_Pr->SiS_DDC_Index,
+ SiS_Pr->SiS_DDC_NData,
+ SiS_Pr->SiS_DDC_Data); /* Write bit (1) to SD */
} else {
- SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index,
- ~SiS_Pr->SiS_DDC_Data,0x00); /* Write bit (0) to SD */
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,
+ SiS_Pr->SiS_DDC_Index,
+ SiS_Pr->SiS_DDC_NData,
+ 0x00); /* Write bit (0) to SD */
}
SiS_SetSCLKHigh(SiS_Pr); /* SC->high */
flag >>= 1;
@@ -10889,8 +11074,10 @@ SiS_ReadDDC2Data(SiS_Private *SiS_Pr, USHORT tempax)
for(i=0; i<8; i++) {
getdata <<= 1;
SiS_SetSCLKLow(SiS_Pr);
- SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index,
- ~SiS_Pr->SiS_DDC_Data,SiS_Pr->SiS_DDC_Data);
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,
+ SiS_Pr->SiS_DDC_Index,
+ SiS_Pr->SiS_DDC_NData,
+ SiS_Pr->SiS_DDC_Data);
SiS_SetSCLKHigh(SiS_Pr);
temp = SiS_GetReg(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index);
if(temp & SiS_Pr->SiS_DDC_Data) getdata |= 0x01;
@@ -10901,8 +11088,10 @@ SiS_ReadDDC2Data(SiS_Private *SiS_Pr, USHORT tempax)
USHORT
SiS_SetSCLKLow(SiS_Private *SiS_Pr)
{
- SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index,
- ~SiS_Pr->SiS_DDC_Clk,0x00); /* SetSCLKLow() */
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,
+ SiS_Pr->SiS_DDC_Index,
+ SiS_Pr->SiS_DDC_NClk,
+ 0x00); /* SetSCLKLow() */
SiS_DDC2Delay(SiS_Pr,SiS_I2CDELAYSHORT);
return 0;
}
@@ -10912,8 +11101,10 @@ SiS_SetSCLKHigh(SiS_Private *SiS_Pr)
{
USHORT temp, watchdog=1000;
- SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index,
- ~SiS_Pr->SiS_DDC_Clk,SiS_Pr->SiS_DDC_Clk); /* SetSCLKHigh() */
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,
+ SiS_Pr->SiS_DDC_Index,
+ SiS_Pr->SiS_DDC_NClk,
+ SiS_Pr->SiS_DDC_Clk); /* SetSCLKHigh() */
do {
temp = SiS_GetReg(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index);
} while((!(temp & SiS_Pr->SiS_DDC_Clk)) && --watchdog);
@@ -10935,10 +11126,12 @@ SiS_CheckACK(SiS_Private *SiS_Pr)
USHORT tempah;
SiS_SetSCLKLow(SiS_Pr); /* (SC->low) */
- SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index,
- ~SiS_Pr->SiS_DDC_Data,SiS_Pr->SiS_DDC_Data); /* (SD->high) */
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,
+ SiS_Pr->SiS_DDC_Index,
+ SiS_Pr->SiS_DDC_NData,
+ SiS_Pr->SiS_DDC_Data); /* (SD->high) */
SiS_SetSCLKHigh(SiS_Pr); /* SC->high = clock impulse for ack */
- tempah = SiS_GetReg(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index);/* Read SD */
+ tempah = SiS_GetReg(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index); /* Read SD */
SiS_SetSCLKLow(SiS_Pr); /* SC->low = end of clock impulse */
if(tempah & SiS_Pr->SiS_DDC_Data) return(1); /* Ack OK if bit = 0 */
else return(0);
@@ -11052,8 +11245,10 @@ GetTVPtrIndex(SiS_Private *SiS_Pr)
USHORT index;
index = 0;
- if(SiS_Pr->SiS_TVMode & TVSetPAL) index++;
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr) index++; /* YPbPr TV use PAL */
+ if(SiS_Pr->SiS_TVMode & TVSetPAL) index = 1;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) index = 2;
+
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) index = 0;
index <<= 1;
@@ -11096,13 +11291,11 @@ GetOEMTVPtr661(SiS_Private *SiS_Pr)
{
int index = 0;
- if(SiS_Pr->SiS_TVMode & TVSetPAL) index = 2;
-#if 0
- if(SiS_Pr->SiS_TVMode & 0x100?) index = 4;
- if(SiS_Pr->SiS_TVMode & 0x20?) index = 6;
- if(SiS_Pr->SiS_TVMode & 0x40?) index = 8;
- if(SiS_Pr->SiS_TVMode & 0x80?) index = 10;
-#endif
+ if(SiS_Pr->SiS_TVMode & TVSetPAL) index = 2;
+ if(SiS_Pr->SiS_TVMode & TVSetHiVision) index = 4;
+ if(SiS_Pr->SiS_TVMode & TVSetYPbPr525i) index = 6;
+ if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) index = 8;
+ if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) index = 10;
if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) index++;
@@ -11122,9 +11315,9 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
if((ROMAddr) && SiS_Pr->SiS_UseROM) {
romptr = GetRAMDACromptr(SiS_Pr, HwInfo);
- if(!romptr) return;
- delay = ROMAddr[romptr];
- } else {
+ }
+ if(romptr) delay = ROMAddr[romptr];
+ else {
delay = 0x04;
if(SiS_Pr->SiS_VBType & VB_SIS301B302B) {
if(IS_SIS650) {
@@ -11136,8 +11329,7 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
} else {
delay = 0x0c;
}
- }
- if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ } else if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
delay = 0x00;
}
}
@@ -11146,12 +11338,33 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
BOOLEAN gotitfrompci = FALSE;
- if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelCustom) return;
+ /* Custom Panel? */
+
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelCustom) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
+ delay = 0x00;
+ if((SiS_Pr->PanelXRes <= 1280) && (SiS_Pr->PanelYRes <= 1024)) {
+ delay = 0x20;
+ }
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2d,0x0f,delay);
+ } else {
+ delay = 0x0c;
+ if(SiS_Pr->SiS_VBType & VB_SIS301C) delay = 0x03;
+ else if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ if(IS_SIS740) delay = 0x01;
+ else delay = 0x03;
+ }
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2d,0xf0,delay);
+ }
+ return;
+ }
/* Could we detect a PDC for LCD? If yes, use it */
- if(SiS_Pr->PDC) {
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
+ if((SiS_Pr->SiS_VBType & VB_SIS301LV302LV) && (SiS_Pr->PDC != -1)) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2d,0xf0,(SiS_Pr->PDC & 0x0f));
+ } else {
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2d,0x0f,((SiS_Pr->PDC & 0x0f) << 4));
}
return;
@@ -11203,20 +11416,15 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
if(SiS_IsNotM650orLater(SiS_Pr, HwInfo)) {
if((ROMAddr) && SiS_Pr->SiS_UseROM) {
-#if 0 /* Always use the second pointer on 650; some BIOSes */
+ /* Always use the second pointer on 650; some BIOSes */
/* still carry old 301 data at the first location */
- romptr = ROMAddr[0x120] | (ROMAddr[0x121] << 8);
- if(SiS_Pr->SiS_VBType & VB_SIS302LV)
-#endif
- romptr = ROMAddr[0x122] | (ROMAddr[0x123] << 8);
+ /* romptr = ROMAddr[0x120] | (ROMAddr[0x121] << 8); */
+ /* if(SiS_Pr->SiS_VBType & VB_SIS302LV) */
+ romptr = ROMAddr[0x122] | (ROMAddr[0x123] << 8);
if(!romptr) return;
delay = ROMAddr[(romptr + index)];
} else {
- delay = SiS310_LCDDelayCompensation_650301B[myindex];
-#if 0
- if(SiS_Pr->SiS_VBType & VB_SIS302LV)
- delay = SiS310_LCDDelayCompensation_650301B[myindex];
-#endif
+ delay = SiS310_LCDDelayCompensation_650301LV[myindex];
}
} else {
@@ -11228,33 +11436,32 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
}
} else if((ROMAddr) && SiS_Pr->SiS_UseROM &&
- (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024)) {
+ (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024) &&
+ (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x768) &&
+ (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x960)) {
+ /* Data for 1280x1024 wrong in 301B BIOS */
romptr = GetLCDromptr(SiS_Pr, HwInfo);
if(!romptr) return;
delay = ROMAddr[(romptr + index)];
} else if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
- if(IS_SIS650) {
- delay = SiS310_LCDDelayCompensation_LVDS650[myindex];
- } else {
- delay = SiS310_LCDDelayCompensation_LVDS740[myindex];
- }
+ if(IS_SIS740) delay = 0x03;
+ else delay = 0x00;
} else {
delay = SiS310_LCDDelayCompensation_301[myindex];
- if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
-#if 0 /* This data is (like the one in the BIOS) wrong. */
- if(IS_SIS550650740660) {
- delay = SiS310_LCDDelayCompensation_650301B[myindex];
- } else {
-#endif
- delay = SiS310_LCDDelayCompensation_3xx301B[myindex];
-#if 0
- }
-#endif
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ if(IS_SIS740) delay = 0x01;
+ else delay = SiS310_LCDDelayCompensation_650301LV[myindex];
+ } else if(SiS_Pr->SiS_VBType & VB_SIS301C) {
+ if(IS_SIS740) delay = 0x01; /* ? */
+ else delay = 0x03;
+ } else if(SiS_Pr->SiS_VBType & VB_SIS301B302B) {
+ if(IS_SIS740) delay = 0x01;
+ else delay = SiS310_LCDDelayCompensation_3xx301B[myindex];
}
}
@@ -11275,22 +11482,18 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
if(SiS_IsNotM650orLater(SiS_Pr,HwInfo)) {
if((ROMAddr) && SiS_Pr->SiS_UseROM) {
-#if 0 /* Always use the second pointer on 650; some BIOSes */
+ /* Always use the second pointer on 650; some BIOSes */
/* still carry old 301 data at the first location */
- romptr = ROMAddr[0x114] | (ROMAddr[0x115] << 8);
- if(SiS_Pr->SiS_VBType & VB_SIS302LV)
-#endif
- romptr = ROMAddr[0x11a] | (ROMAddr[0x11b] << 8);
+ /* romptr = ROMAddr[0x114] | (ROMAddr[0x115] << 8); */
+ /* if(SiS_Pr->SiS_VBType & VB_SIS302LV) */
+ romptr = ROMAddr[0x11a] | (ROMAddr[0x11b] << 8);
if(!romptr) return;
delay = ROMAddr[romptr + index];
} else {
delay = SiS310_TVDelayCompensation_301B[index];
-#if 0
- if(SiS_Pr->SiS_VBType & VB_SIS302LV)
- delay = SiS310_TVDelayCompensation_301B[index];
-#endif
+
}
} else {
@@ -11332,8 +11535,10 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
if(IS_SIS740) {
delay = SiS310_TVDelayCompensation_740301B[index];
+ /* LV: use 301 data? BIOS bug? */
} else {
delay = SiS310_TVDelayCompensation_301B[index];
+ if(SiS_Pr->SiS_VBType & VB_SIS301C) delay = 0x02;
}
}
@@ -11394,13 +11599,15 @@ SetAntiFlicker(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
USHORT index,temp,temp1,romptr=0;
+ if(SiS_Pr->SiS_TVMode & (TVSetYPbPr750p|TVSetYPbPr525p)) return;
+
if(ModeNo<=0x13)
index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].VB_StTVFlickerIndex;
else
index = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].VB_ExtTVFlickerIndex;
temp = GetTVPtrIndex(SiS_Pr);
- temp >>= 1; /* 0: NTSC, 1: PAL, 2: HiTV */
+ temp >>= 1; /* 0: NTSC/YPbPr, 1: PAL, 2: HiTV */
temp1 = temp;
if(ROMAddr && SiS_Pr->SiS_UseROM) {
@@ -11434,7 +11641,7 @@ SetEdgeEnhance(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
USHORT index,temp,temp1,romptr=0;
temp = GetTVPtrIndex(SiS_Pr);
- temp >>= 1; /* 0: NTSC, 1: PAL, 2: HiTV */
+ temp >>= 1; /* 0: NTSC/YPbPr, 1: PAL, 2: HiTV */
temp1 = temp;
if(ModeNo<=0x13)
@@ -11523,12 +11730,12 @@ SetYFilter(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
index = oldindex;
temp = GetTVPtrIndex(SiS_Pr);
- temp >>= 1; /* 0: NTSC, 1: PAL, 2: HiTV */
+ temp >>= 1; /* 0: NTSC/YPbPr, 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 & SetCRT2ToYPbPr) temp = 1; /* YPbPr 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 & SetCRT2ToHiVision) temp = 1; /* HiVision uses PAL */
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
for(i=0x35, j=0; i<=0x38; i++, j++) {
@@ -11625,19 +11832,19 @@ SetPhaseIncr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
}
}
- if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
- if((!(SiS_Pr->SiS_TVMode & TVSetPAL)) && (ModeNo > 0x13)) {
+ if((SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (!(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision))) {
+ if((!(SiS_Pr->SiS_TVMode & (TVSetPAL | TVSetYPbPr525p | TVSetYPbPr750p))) && (ModeNo > 0x13)) {
if((resinfo == SIS_RI_640x480) ||
(resinfo == SIS_RI_800x600)) {
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x31,0x21);
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x32,0xf0);
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x33,0xf5);
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x34,0x7f);
- } else if (resinfo == SIS_RI_1024x768) {
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x31,0x1e);
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x32,0x8b);
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x33,0xfb);
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x34,0x7b);
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x31,0x21);
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x32,0xf0);
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x33,0xf5);
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x34,0x7f);
+ } else if(resinfo == SIS_RI_1024x768) {
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x31,0x1e);
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x32,0x8b);
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x33,0xfb);
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x34,0x7b);
}
}
}
@@ -11652,12 +11859,12 @@ SiS_OEM310Setting(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
if(SiS_Pr->UseCustomMode) return;
if((SiS_Pr->SiS_VBType & VB_SISVB) && (SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) {
- SetAntiFlicker(SiS_Pr,HwInfo,ModeNo,ModeIdIndex);
- SetPhaseIncr(SiS_Pr,HwInfo,ModeNo,ModeIdIndex);
- SetYFilter(SiS_Pr,HwInfo,ModeNo,ModeIdIndex);
- if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) {
- SetEdgeEnhance(SiS_Pr,HwInfo,ModeNo,ModeIdIndex);
- }
+ SetAntiFlicker(SiS_Pr,HwInfo,ModeNo,ModeIdIndex);
+ SetPhaseIncr(SiS_Pr,HwInfo,ModeNo,ModeIdIndex);
+ SetYFilter(SiS_Pr,HwInfo,ModeNo,ModeIdIndex);
+ if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) {
+ SetEdgeEnhance(SiS_Pr,HwInfo,ModeNo,ModeIdIndex);
+ }
}
}
@@ -11666,20 +11873,23 @@ SetDelayComp661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo,
USHORT ModeIdIndex, USHORT RTI)
{
UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
- USHORT delay = 0, romptr = 0, index;
UCHAR *myptr = NULL;
+ USHORT delay = 0, romptr = 0, index;
UCHAR temp;
if(!(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToLCDA | SetCRT2ToRAMDAC)))
return;
- delay = SiS_Pr->SiS_RefIndex[RTI].Ext_PDC;
+ if(SiS_Pr->UseCustomMode) delay = 0x40;
+ else if(ModeNo <= 0x13) delay = 0x40;
+ else delay = SiS_Pr->SiS_RefIndex[RTI].Ext_PDC;
delay &= 0xf0;
delay >>= 4;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) delay <<= 12; /* BIOS: 8, wrong */
if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+
index = GetOEMTVPtr661(SiS_Pr);
if((ROMAddr) && SiS_Pr->SiS_UseROM) {
romptr = ROMAddr[0x25c] | (ROMAddr[0x25d] << 8);
@@ -11696,20 +11906,27 @@ 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(SiS_Pr->PDC) {
- delay = SiS_Pr->PDC & 0x0f;
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
+
+ if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) {
+ if((SiS_Pr->PanelXRes <= 1024) && (SiS_Pr->PanelYRes <= 768)) {
+ delay = 0x1111;
+ } else if((SiS_Pr->PanelXRes <= 1280) && (SiS_Pr->PanelYRes <= 1024)) {
+ delay = 0xA1A1;
+ } else if((SiS_Pr->PanelXRes <= 1400) && (SiS_Pr->PanelYRes <= 1050)) {
+ delay = 0xA3A3;
+ } else
+ delay = 0x0000;
+ }
+
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_PanelCustom) {
+ if((SiS_Pr->SiS_VBType & VB_SIS301LV302LV) && (SiS_Pr->PDC != -1)) {
+ delay = SiS_Pr->PDC & 0x0f;
delay |= (delay << 12);
- }
- } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelCustom) {
- delay = 0x4444; /* TEST THIS */
- } else if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) {
- myptr = GetLCDStructPtr661(SiS_Pr, HwInfo);
- if(myptr) delay = myptr[4];
- else delay = 0x44;
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
- delay |= (delay << 8);
+ } else if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) {
+ myptr = GetLCDStructPtr661(SiS_Pr, HwInfo);
+ if(myptr) delay = myptr[4] | (myptr[4] << 8);
}
}
}
@@ -11718,8 +11935,7 @@ SetDelayComp661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo,
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToRAMDAC)) {
temp &= 0xf0;
temp |= (delay & 0x000f);
- }
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
+ } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
temp &= 0x0f;
temp |= ((delay & 0xf000) >> 8);
}
@@ -11732,9 +11948,10 @@ SetCRT2SyncDither661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo, US
USHORT infoflag;
UCHAR temp;
- infoflag = SiS_Pr->SiS_RefIndex[RTI].Ext_InfoFlag;
if(ModeNo <= 0x13) {
infoflag = SiS_GetRegByte(SiS_Pr->SiS_P3ca+2);
+ } else {
+ infoflag = SiS_Pr->SiS_RefIndex[RTI].Ext_InfoFlag;
}
infoflag &= 0xc0;
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
@@ -11895,7 +12112,7 @@ SiS_FinalizeLCD(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#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_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10);
}
#endif
@@ -12149,7 +12366,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(SiS_Pr->PDC) return;
+ if(SiS_Pr->PDC != -1) return;
temp = GetOEMLCDPtr(SiS_Pr,HwInfo, 0);
@@ -12243,7 +12460,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 & SetCRT2ToYPbPr) index += 3;
+ else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) index += 3;
else if(SiS_Pr->SiS_TVMode & TVSetPAL) index += 1;
} else {
if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) index += 2;
@@ -12321,7 +12538,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 & SetCRT2ToYPbPr) return;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) return;
if(SiS_Pr->SiS_TVMode & (TVSetNTSC1024 | TVSetNTSCJ | TVSetPALM | TVSetPALN)) return;
@@ -12362,7 +12579,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 | SetCRT2ToYPbPr)) return;
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToSCART | SetCRT2ToHiVision | SetCRT2ToYPbPr525750)) return;
if((ROMAddr) && SiS_Pr->SiS_UseROM) {
if(!(ROMAddr[0x238] & 0x01)) return;
diff --git a/src/init301.h b/src/init301.h
index 79e248d..694c87c 100644
--- a/src/init301.h
+++ b/src/init301.h
@@ -1,36 +1,55 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h,v 1.36 2003/12/16 17:59:08 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h,v 1.42 2004/01/27 11:58:27 twini Exp $ */
/*
* Data and prototypes for init301.c
*
- * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
*
- * If distributed as part of the linux kernel, the contents of this file
- * is entirely covered by the GPL.
+ * If distributed as part of the Linux kernel, the following license terms
+ * apply:
*
- * Otherwise, the following terms apply:
+ * * This program is free software; you can redistribute it and/or modify
+ * * it under the terms of the GNU General Public License as published by
+ * * the Free Software Foundation; either version 2 of the named License,
+ * * or any later version.
+ * *
+ * * This program is distributed in the hope that it will be useful,
+ * * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * * GNU General Public License for more details.
+ * *
+ * * You should have received a copy of the GNU General Public License
+ * * along with this program; if not, write to the Free Software
+ * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Otherwise, the following license terms apply:
*
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * * Redistribution and use in source and binary forms, with or without
+ * * modification, are permitted provided that the following conditions
+ * * are met:
+ * * 1) Redistributions of source code must retain the above copyright
+ * * notice, this list of conditions and the following disclaimer.
+ * * 2) Redistributions in binary form must reproduce the above copyright
+ * * notice, this list of conditions and the following disclaimer in the
+ * * documentation and/or other materials provided with the distribution.
+ * * 3) All advertising materials mentioning features or use of this software
+ * * must display the following acknowledgement: "This product includes
+ * * software developed by Thomas Winischhofer, Vienna, Austria."
+ * * 4) The name of the author may not be used to endorse or promote products
+ * * derived from this software without specific prior written permission.
+ * *
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Author: Thomas Winischhofer <thomas@winischhofer.net>
*
- * Based on code by Silicon Intergrated Systems
- *
*/
#ifndef _INIT301_
@@ -67,34 +86,34 @@
const UCHAR SiS_YPbPrTable[3][64] = {
{
- 0x17, 0x1d, 0x03, 0x09, 0x05, 0x06, 0x0c, 0x0c,
- 0x94, 0x49, 0x01, 0x0a, 0x06, 0x0d, 0x04, 0x0a,
- 0x06, 0x14, 0x0d, 0x04, 0x0a, 0x00, 0x85, 0x1b,
- 0x0c, 0x50, 0x00, 0x97, 0x00, 0xd4, 0x4a, 0x17,
- 0x7d, 0x05, 0x4b, 0x00, 0x00, 0xe2, 0x00, 0x02,
- 0x03, 0x0a, 0x65, 0x9d, 0x08, 0x92, 0x8f, 0x40,
- 0x60, 0x80, 0x14, 0x90, 0x8c, 0x60, 0x14, 0x53,
- 0x00, 0x40, 0x44, 0x00, 0xdb, 0x02, 0x3b, 0x00
+ 0x17,0x1d,0x03,0x09,0x05,0x06,0x0c,0x0c,
+ 0x94,0x49,0x01,0x0a,0x06,0x0d,0x04,0x0a,
+ 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x1b,
+ 0x0c,0x50,0x00,0x97,0x00,0xda,0x4a,0x17,
+ 0x7d,0x05,0x4b,0x00,0x00,0xe2,0x00,0x02,
+ 0x03,0x0a,0x65,0x9d,0x08,0x92,0x8f,0x40,
+ 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x53,
+ 0x00,0x40,0x44,0x00,0xdb,0x02,0x3b,0x00
},
{
- 0x1d, 0x1d, 0x06, 0x09, 0x0b, 0x0c, 0x0c, 0x0c,
- 0x98, 0x0a, 0x01, 0x0d, 0x06, 0x0d, 0x04, 0x0a,
- 0x06, 0x14, 0x0d, 0x04, 0x0a, 0x00, 0x85, 0x3f,
- 0x0c, 0x50, 0xb2, 0x2e, 0x16, 0xb5, 0xf4, 0x03,
- 0x7d, 0x11, 0x7d, 0xea, 0x30, 0x36, 0x18, 0x96,
- 0x21, 0x0a, 0x58, 0xee, 0x42, 0x92, 0x0f, 0x40,
- 0x60, 0x80, 0x14, 0x90, 0x8c, 0x60, 0x04, 0xf3,
- 0x00, 0x40, 0x11, 0x00, 0xfc, 0xff, 0x32, 0x00
+ 0x1d,0x11,0x06,0x09,0x0b,0x0c,0x0c,0x0c,
+ 0x98,0x0a,0x01,0x0d,0x06,0x0d,0x04,0x0a,
+ 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x3f,
+ 0x0c,0x50,0xb2,0x9f,0x16,0x59,0x4f,0x13,
+ 0xad,0x11,0xad,0x1d,0x40,0x8a,0x3d,0xb8,
+ 0x51,0x5e,0x60,0x49,0x7d,0x92,0x0f,0x40,
+ 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x4b,
+ 0x43,0x41,0x11,0x00,0xfc,0xff,0x32,0x00
},
{
- 0x13, 0x1d, 0xe8, 0x09, 0x09, 0xed, 0x0c, 0x0c,
- 0x98, 0x0a, 0x01, 0x0c, 0x06, 0x0d, 0x04, 0x0a,
- 0x06, 0x14, 0x0d, 0x04, 0x0a, 0x00, 0x85, 0x3f,
- 0xed, 0x50, 0x70, 0x9f, 0x16, 0x59, 0x2b, 0x13,
- 0x27, 0x0b, 0x27, 0xfc, 0x30, 0x27, 0x1c, 0xb0,
- 0x4b, 0x4b, 0x6f, 0x2f, 0x63, 0x92, 0x0f, 0x40,
- 0x60, 0x80, 0x14, 0x90, 0x8c, 0x60, 0x14, 0x2a,
- 0x00, 0x40, 0x11, 0x00, 0xfc, 0xff, 0x32, 0x00
+ 0x13,0x1d,0xe8,0x09,0x09,0xed,0x0c,0x0c,
+ 0x98,0x0a,0x01,0x0c,0x06,0x0d,0x04,0x0a,
+ 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x3f,
+ 0xed,0x50,0x70,0x9f,0x16,0x59,0x2b,0x13,
+ 0x27,0x0b,0x27,0xfc,0x30,0x27,0x1c,0xb0,
+ 0x4b,0x4b,0x6f,0x2f,0x63,0x92,0x0f,0x40,
+ 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x27,
+ 0x00,0x40,0x11,0x00,0xfc,0xff,0x32,0x00
}
};
@@ -138,7 +157,7 @@ static const UCHAR SiS_Part2CLVX_2[] = {
0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E
};
-static const UCHAR SiS_Part2CLVX_3[] = { /* NTSC */
+static const UCHAR SiS_Part2CLVX_3[] = { /* NTSC, 525i, 525p */
0xE0,0x01,
0x04,0x1A,0x04,0x7E,0x03,0x1A,0x06,0x7D,0x01,0x1A,0x08,0x7D,0x00,0x19,0x0A,0x7D,
0x7F,0x19,0x0C,0x7C,0x7E,0x18,0x0E,0x7C,0x7E,0x17,0x10,0x7B,0x7D,0x15,0x12,0x7C,
@@ -176,6 +195,25 @@ static const UCHAR SiS_Part2CLVX_4[] = { /* PAL */
0xFF,0xFF
};
+static const UCHAR SiS_Part2CLVX_5[] = { /* 750p */
+ 0x00,0x03,
+ 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x18,0x0A,0x7D,
+ 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x0F,0x7D,0x7E,0x14,0x11,0x7D,
+ 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x16,0x7E,0x7D,0x0E,0x17,0x7E,
+ 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04,
+ 0xFF,0xFF
+};
+
+static const UCHAR SiS_Part2CLVX_6[] = { /* 1080i */
+ 0x00,0x04,
+ 0x04,0x1A,0x04,0x7E,0x02,0x1B,0x05,0x7E,0x01,0x1A,0x07,0x7E,0x00,0x1A,0x09,0x7D,
+ 0x7F,0x19,0x0B,0x7D,0x7E,0x18,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7D,0x15,0x12,0x7C,
+ 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x1D /* 0x7D? */ ,0x7C,0x0D,0x18,0x7F,
+ 0x7D,0x0B,0x19,0x7F,0x7D,0x09,0x1A,0x00,0x7D,0x07,0x1A,0x02,0x7E,0x05,0x1B,0x02,
+ 0xFF,0xFF,
+};
+
+
#ifdef SIS315H
/* 661 et al LCD data structure */
static const UCHAR SiS_LCDStruct661[] = {
diff --git a/src/initdef.h b/src/initdef.h
index c2b8110..53d6a1c 100644
--- a/src/initdef.h
+++ b/src/initdef.h
@@ -1,36 +1,55 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h,v 1.26 2003/11/29 12:08:02 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h,v 1.32 2004/01/23 22:29:03 twini Exp $ */
/*
* Global definitions for init.c and init301.c
*
- * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
*
- * If distributed as part of the linux kernel, the contents of this file
- * is entirely covered by the GPL.
+ * If distributed as part of the Linux kernel, the following license terms
+ * apply:
*
- * Otherwise, the following terms apply:
+ * * This program is free software; you can redistribute it and/or modify
+ * * it under the terms of the GNU General Public License as published by
+ * * the Free Software Foundation; either version 2 of the named License,
+ * * or any later version.
+ * *
+ * * This program is distributed in the hope that it will be useful,
+ * * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * * GNU General Public License for more details.
+ * *
+ * * You should have received a copy of the GNU General Public License
+ * * along with this program; if not, write to the Free Software
+ * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Otherwise, the following license terms apply:
*
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * * Redistribution and use in source and binary forms, with or without
+ * * modification, are permitted provided that the following conditions
+ * * are met:
+ * * 1) Redistributions of source code must retain the above copyright
+ * * notice, this list of conditions and the following disclaimer.
+ * * 2) Redistributions in binary form must reproduce the above copyright
+ * * notice, this list of conditions and the following disclaimer in the
+ * * documentation and/or other materials provided with the distribution.
+ * * 3) All advertising materials mentioning features or use of this software
+ * * must display the following acknowledgement: "This product includes
+ * * software developed by Thomas Winischhofer, Vienna, Austria."
+ * * 4) The name of the author may not be used to endorse or promote products
+ * * derived from this software without specific prior written permission.
+ * *
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Author: Thomas Winischhofer <thomas@winischhofer.net>
*
- * Based on code by Silicon Integrated Systems
- *
*/
#ifndef _INITDEF_
@@ -75,23 +94,26 @@
#define SetCRT2ToSCART 0x0010
#define SetCRT2ToLCD 0x0020
#define SetCRT2ToRAMDAC 0x0040
-#define SetCRT2ToYPbPr 0x0080 /* Needs change in sis_vga.c if changed (GPIO) */
-#define SetCRT2ToTV (SetCRT2ToYPbPr | SetCRT2ToSCART | SetCRT2ToSVIDEO | SetCRT2ToAVIDEO)
-#define SetCRT2ToTVNoYPbPr (SetCRT2ToSCART | SetCRT2ToSVIDEO | SetCRT2ToAVIDEO)
+#define SetCRT2ToHiVision 0x0080 /* for SiS bridge */
+#define SetCRT2ToCHYPbPr SetCRT2ToHiVision /* for Chrontel */
#define SetNTSCTV 0x0000 /* CR 31 */
#define SetPALTV 0x0100 /* Deprecated here, now in TVMode */
#define SetInSlaveMode 0x0200
#define SetNotSimuMode 0x0400
-#define SetNotSimuTVMode 0x0400
+#define SetNotSimuTVMode SetNotSimuMode
#define SetDispDevSwitch 0x0800
+#define SetCRT2ToYPbPr525750 0x0800
#define LoadDACFlag 0x1000
-#define SetCHTVOverScan 0x1000 /* Deprecated here, now in TVMode */
#define DisableCRT2Display 0x2000
-#define CRT2DisplayFlag 0x2000
#define DriverMode 0x4000
-#define HotKeySwitch 0x8000
+#define HotKeySwitch 0x8000
#define SetCRT2ToLCDA 0x8000
+/* v-- Needs change in sis_vga.c if changed (GPIO) --v */
+#define SetCRT2ToTV (SetCRT2ToYPbPr525750|SetCRT2ToHiVision|SetCRT2ToSCART|SetCRT2ToSVIDEO|SetCRT2ToAVIDEO)
+#define SetCRT2ToTVNoYPbPrHiVision (SetCRT2ToSCART | SetCRT2ToSVIDEO | SetCRT2ToAVIDEO)
+#define SetCRT2ToTVNoHiVision (SetCRT2ToYPbPr525750 | SetCRT2ToSCART | SetCRT2ToSVIDEO | SetCRT2ToAVIDEO)
+
/* SiS_ModeType */
#define ModeText 0x00
#define ModeCGA 0x01
@@ -122,8 +144,8 @@
#define SupportTV1024 0x0800
#define SupportCHTV 0x0800
#define Support64048060Hz 0x0800 /* Special for 640x480 LCD */
-#define SupportYPbPr 0x0010
-#define SupportYPbPr2 0x1000
+#define SupportHiVision 0x0010
+#define SupportYPbPr 0x1000 /* TODO */
#define SupportLCD 0x0020
#define SupportRAMDAC2 0x0040 /* All (<= 100Mhz) */
#define SupportRAMDAC2_135 0x0100 /* All except DH (<= 135Mhz) */
@@ -152,16 +174,20 @@
#define TVSetPALM 0x0004
#define TVSetPALN 0x0008
#define TVSetCHOverScan 0x0010
+#define TVSetYPbPr525i 0x0020
+#define TVSetYPbPr525p 0x0040
+#define TVSetYPbPr750p 0x0080
+#define TVSetHiVision 0x0100 /* = 1080i, software-wise identical */
#define TVSetTVSimuMode 0x0800
#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) */
+/* YPbPr flag (>=315, <661; converted to TVMode) */
+#define YPbPr525p 0x0001
+#define YPbPr750p 0x0002
+#define YPbPr525i 0x0004
+#define YPbPrHiVision 0x0008
+#define YPbPrModeMask (YPbPr750p | YPbPr525p | YPbPr525i | YPbPrHiVision)
/* SysFlags (to identify special versions) */
#define SF_Is651 0x0001
@@ -197,10 +223,11 @@
[2] 1 = PALM (if D0 = 1)
[3] 1 = PALN (if D0 = 1)
[4] 1 = Overscan (Chrontel only)
- [7:5] 000 525i (not supported yet)
+ [7:5] (only if D2 in CR38 is set)
+ 000 525i
001 525p
010 750p
- 011 1080i
+ 011 1080i (or HiVision on 301, 301B)
These bits are being translated to TVMode flag.
@@ -254,13 +281,13 @@
/* CR38 (315 series) */
#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 EnableSiSYPbPr 0x08 /* Enable YPbPr mode (30xLV/301C only) */
+#define EnableYPbPr525i 0x00 /* Enable 525i YPbPr mode (30xLV/301C only) (mask 0x30) */
+#define EnableYPbPr525p 0x10 /* Enable 525p YPbPr mode (30xLV/301C only) (mask 0x30) */
+#define EnableYPbPr750p 0x20 /* Enable 750p YPbPr mode (30xLV/301C only) (mask 0x30) */
+#define EnableYPbPr1080i 0x30 /* Enable 1080i YPbPr mode (30xLV/301C only) (mask 0x30) */
#define EnablePALM 0x40 /* 1 = Set PALM */
#define EnablePALN 0x80 /* 1 = Set PALN */
#define EnableNTSCJ EnablePALM /* Not BIOS */
@@ -271,6 +298,8 @@
010 LVDS
011 Chrontel 7019
100 Conexant
+ D2 Enable YPbPr output (see CR35)
+ D[1:0] LCDA (like before)
*/
#define EnablePALMN 0x40 /* Romflag: 1 = Allow PALM/PALN */
@@ -279,6 +308,18 @@
#define LCDPass1_1 0x01 /* LVDS only; set by driver to pass 1:1 data to LVDS output */
#define Enable302LV_DualLink 0x04 /* 302LV only; enable dual link */
+/* CR39 (661 and later)
+ D[1:0] YPbPr Aspect Ratio
+ 00 4:3 letterbox
+ 01 4:3
+ 10 16:9
+ 11 4:3
+*/
+
+/* CR3B (651+301C)
+ D[1:0] YPbPr Aspect Ratio
+ ?
+*/
/* CR79 (315/330 series only; not 661 and later)
[3-0] Notify driver
@@ -344,6 +385,8 @@
#define Panel_Custom 0x0f
#define Panel_Barco1366 0x10
#define Panel_848x480 0x11
+#define Panel_1280x800 0x12 /* 661etc: 0x0c */
+#define Panel_1680x1050 0x13 /* 661etc: 0x0d */
/* Index in ModeResInfo table */
#define SIS_RI_320x200 0
@@ -419,6 +462,7 @@
#define HiTVVCLK 0x03 /* Index relative to TVCLKBASE */
#define HiTVSimuVCLK 0x04 /* Index relative to TVCLKBASE */
#define HiTVTextVCLK 0x05 /* Index relative to TVCLKBASE */
+#define YPbPr750pVCLK 0x0f /* NOT relative to TVCLKBASE ! */
/* ------------------------------ */
diff --git a/src/oem300.h b/src/oem300.h
index b594b4b..0e2f2c6 100644
--- a/src/oem300.h
+++ b/src/oem300.h
@@ -1,36 +1,55 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/oem300.h,v 1.11 2003/10/30 18:53:42 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/oem300.h,v 1.14 2004/01/23 22:29:03 twini Exp $ */
/*
* OEM Data for 300 series
*
- * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
*
- * If distributed as part of the linux kernel, the contents of this file
- * is entirely covered by the GPL.
+ * If distributed as part of the Linux kernel, the following license terms
+ * apply:
*
- * Otherwise, the following terms apply:
+ * * This program is free software; you can redistribute it and/or modify
+ * * it under the terms of the GNU General Public License as published by
+ * * the Free Software Foundation; either version 2 of the named License,
+ * * or any later version.
+ * *
+ * * This program is distributed in the hope that it will be useful,
+ * * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * * GNU General Public License for more details.
+ * *
+ * * You should have received a copy of the GNU General Public License
+ * * along with this program; if not, write to the Free Software
+ * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Otherwise, the following license terms apply:
*
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * * Redistribution and use in source and binary forms, with or without
+ * * modification, are permitted provided that the following conditions
+ * * are met:
+ * * 1) Redistributions of source code must retain the above copyright
+ * * notice, this list of conditions and the following disclaimer.
+ * * 2) Redistributions in binary form must reproduce the above copyright
+ * * notice, this list of conditions and the following disclaimer in the
+ * * documentation and/or other materials provided with the distribution.
+ * * 3) All advertising materials mentioning features or use of this software
+ * * must display the following acknowledgement: "This product includes
+ * * software developed by Thomas Winischhofer, Vienna, Austria."
+ * * 4) The name of the author may not be used to endorse or promote products
+ * * derived from this software without specific prior written permission.
+ * *
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Author: Thomas Winischhofer <thomas@winischhofer.net>
*
- * Based on code by Silicon Intergrated Systems
- *
*/
const UCHAR SiS300_OEMTVDelay301[8][4] =
diff --git a/src/oem310.h b/src/oem310.h
index db13c06..3d3aefe 100644
--- a/src/oem310.h
+++ b/src/oem310.h
@@ -1,36 +1,55 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/oem310.h,v 1.19 2003/12/16 17:35:06 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/oem310.h,v 1.24 2004/01/23 22:29:03 twini Exp $ */
/*
* OEM Data for 315/330 series
*
- * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
*
- * If distributed as part of the linux kernel, the contents of this file
- * is entirely covered by the GPL.
+ * If distributed as part of the Linux kernel, the following license terms
+ * apply:
*
- * Otherwise, the following terms apply:
+ * * This program is free software; you can redistribute it and/or modify
+ * * it under the terms of the GNU General Public License as published by
+ * * the Free Software Foundation; either version 2 of the named License,
+ * * or any later version.
+ * *
+ * * This program is distributed in the hope that it will be useful,
+ * * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * * GNU General Public License for more details.
+ * *
+ * * You should have received a copy of the GNU General Public License
+ * * along with this program; if not, write to the Free Software
+ * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Otherwise, the following license terms apply:
*
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * * Redistribution and use in source and binary forms, with or without
+ * * modification, are permitted provided that the following conditions
+ * * are met:
+ * * 1) Redistributions of source code must retain the above copyright
+ * * notice, this list of conditions and the following disclaimer.
+ * * 2) Redistributions in binary form must reproduce the above copyright
+ * * notice, this list of conditions and the following disclaimer in the
+ * * documentation and/or other materials provided with the distribution.
+ * * 3) All advertising materials mentioning features or use of this software
+ * * must display the following acknowledgement: "This product includes
+ * * software developed by Thomas Winischhofer, Vienna, Austria."
+ * * 4) The name of the author may not be used to endorse or promote products
+ * * derived from this software without specific prior written permission.
+ * *
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Author: Thomas Winischhofer <thomas@winischhofer.net>
*
- * Based on code by Silicon Intergrated Systems
- *
*/
static const UCHAR SiS310_LCDDelayCompensation_301[] = /* 301 */
@@ -53,7 +72,7 @@ static const UCHAR SiS310_LCDDelayCompensation_301[] = /* 301 */
};
/* This is contained in 650+301B BIOSes, but it is wrong - so we don't use it */
-static const UCHAR SiS310_LCDDelayCompensation_650301B[] = /* 30xB,LV */
+static const UCHAR SiS310_LCDDelayCompensation_650301LV[] = /* 650 + 30xLV */
{
0x01,0x01,0x01, /* 800x600 */
0x01,0x01,0x01, /* 1024x768 */
@@ -72,65 +91,7 @@ static const UCHAR SiS310_LCDDelayCompensation_650301B[] = /* 30xB,LV */
0x02,0x02,0x02
};
-/* This data is correct, so we use it instead of the table above */
-static const UCHAR SiS310_LCDDelayCompensation_3xx301B[] = /* 30xB,LV */
-{
- 0x01,0x01,0x01, /* 800x600 */
- 0x0C,0x0C,0x0C, /* 1024x768 */
- 0x0C,0x0C,0x0C, /* 1280x1024 */
- 0x08,0x08,0x08, /* 640x480 */
- 0x0C,0x0C,0x0C, /* 1024x600 (guessed) */
- 0x0C,0x0C,0x0C, /* 1152x864 (guessed) */
- 0x0C,0x0C,0x0C, /* 1280x960 (guessed) */
- 0x0C,0x0C,0x0C, /* 1152x768 (guessed) */
- 0x0C,0x0C,0x0C, /* 1400x1050 (guessed) */
- 0x0C,0x0C,0x0C, /* 1280x768 (guessed) */
- 0x0C,0x0C,0x0C, /* 1600x1200 (guessed) */
- 0x02,0x02,0x02,
- 0x02,0x02,0x02,
- 0x02,0x02,0x02,
- 0x02,0x02,0x02
-};
-
-static const UCHAR SiS310_LCDDelayCompensation_LVDS650[] = /* LVDS */
-{
- 0x00,0x00,0x00, /* 800x600 */
- 0x00,0x00,0x00, /* 1024x768 */
- 0x00,0x00,0x00, /* 1280x1024 */
- 0x00,0x00,0x00, /* 640x480 (unknown) */
- 0x00,0x00,0x00, /* 1024x600 (unknown) */
- 0x00,0x00,0x00, /* 1152x864 (unknown) */
- 0x00,0x00,0x00, /* 1280x960 (guessed) */
- 0x00,0x00,0x00, /* 1152x768 (unknown) */
- 0x00,0x00,0x00, /* 1400x1050 */
- 0x00,0x00,0x00, /* 1280x768 (guessed) */
- 0x00,0x00,0x00, /* 1600x1200 */
- 0x00,0x00,0x00,
- 0x00,0x00,0x00,
- 0x00,0x00,0x00,
- 0x00,0x00,0x00
-};
-
-static const UCHAR SiS310_LCDDelayCompensation_LVDS740[] = /* LVDS */
-{
- 0x03,0x03,0x03, /* 800x600 */
- 0x03,0x03,0x03, /* 1024x768 */
- 0x03,0x03,0x03, /* 1280x1024 */
- 0x03,0x03,0x03, /* 640x480 (unknown) */
- 0x03,0x03,0x03, /* 1024x600 (unknown) */
- 0x03,0x03,0x03, /* 1152x864 (unknown) */
- 0x03,0x03,0x03, /* 1280x960 (guessed) */
- 0x03,0x03,0x03, /* 1152x768 (unknown) */
- 0x03,0x03,0x03, /* 1400x1050 */
- 0x03,0x03,0x03, /* 1280x768 (guessed) */
- 0x03,0x03,0x03, /* 1600x1200 */
- 0x00,0x00,0x00,
- 0x00,0x00,0x00,
- 0x00,0x00,0x00,
- 0x00,0x00,0x00
-};
-
-static const UCHAR SiS310_LCDDelayCompensation_651301LV[] = /* M650/651 301LV */
+static const UCHAR SiS310_LCDDelayCompensation_651301LV[] = /* M650/651 301LV */
{
0x33,0x33,0x33, /* 800x600 (guessed) - new: PanelType, not PanelRes ! */
0x33,0x33,0x33, /* 1024x768 */
@@ -149,7 +110,7 @@ static const UCHAR SiS310_LCDDelayCompensation_651301LV[] = /* M650/651 301LV
0x33,0x33,0x33
};
-static const UCHAR SiS310_LCDDelayCompensation_651302LV[] = /* M650/651 302LV */
+static const UCHAR SiS310_LCDDelayCompensation_651302LV[] = /* M650/651 302LV */
{
0x33,0x33,0x33, /* 800x600 (guessed) */
0x33,0x33,0x33, /* 1024x768 */
@@ -168,6 +129,25 @@ static const UCHAR SiS310_LCDDelayCompensation_651302LV[] = /* M650/651 302LV
0x33,0x33,0x33
};
+static const UCHAR SiS310_LCDDelayCompensation_3xx301B[] = /* 30xB,LV */
+{
+ 0x01,0x01,0x01, /* 800x600 */
+ 0x0C,0x0C,0x0C, /* 1024x768 */
+ 0x0C,0x0C,0x0C, /* 1280x1024 */
+ 0x08,0x08,0x08, /* 640x480 */
+ 0x0C,0x0C,0x0C, /* 1024x600 (guessed) */
+ 0x0C,0x0C,0x0C, /* 1152x864 (guessed) */
+ 0x0C,0x0C,0x0C, /* 1280x960 (guessed) */
+ 0x0C,0x0C,0x0C, /* 1152x768 (guessed) */
+ 0x0C,0x0C,0x0C, /* 1400x1050 (guessed) */
+ 0x0C,0x0C,0x0C, /* 1280x768 (guessed) */
+ 0x0C,0x0C,0x0C, /* 1600x1200 (guessed) */
+ 0x02,0x02,0x02,
+ 0x02,0x02,0x02,
+ 0x02,0x02,0x02,
+ 0x02,0x02,0x02
+};
+
static const UCHAR SiS310_TVDelayCompensation_301[] = /* 301 */
{
0x02,0x02, /* NTSC Enhanced, Standard */
@@ -189,13 +169,6 @@ static const UCHAR SiS310_TVDelayCompensation_740301B[] = /* 740 + 30xB (30xLV?)
0x05,0x05
};
-static const UCHAR SiS310_TVDelayCompensation_LVDS[] = /* LVDS */
-{
- 0x0a,0x0a,
- 0x0a,0x0a,
- 0x0a,0x0a
-};
-
static const UCHAR SiS310_TVDelayCompensation_651301LV[] = /* M650, 651, 301LV */
{
0x33,0x33,
@@ -230,17 +203,30 @@ static const UCHAR SiS_TVDelay661_301B[] = /* 661, 301B et al */
0x44,0x44
};
-static const UCHAR SiS310_TVAntiFlick1[3][2] =
+static const UCHAR SiS310_TVDelayCompensation_LVDS[] = /* LVDS */
+{
+ 0x0a,0x0a,
+ 0x0a,0x0a,
+ 0x0a,0x0a
+};
+
+static const UCHAR SiS310_TVAntiFlick1[6][2] =
{
{0x4,0x0},
{0x4,0x8},
+ {0x0,0x0},
+ {0x0,0x0},
+ {0x0,0x0},
{0x0,0x0}
};
-static const UCHAR SiS310_TVEdge1[3][2] =
+static const UCHAR SiS310_TVEdge1[6][2] =
{
{0x0,0x4},
{0x0,0x4},
+ {0x0,0x0},
+ {0x0,0x0},
+ {0x0,0x0},
{0x0,0x0}
};
diff --git a/src/osdef.h b/src/osdef.h
index 7e6f472..e413dc1 100644
--- a/src/osdef.h
+++ b/src/osdef.h
@@ -1,6 +1,57 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/osdef.h,v 1.5 2003/10/30 18:53:42 twini Exp $ */
-
-/* OS depending defines */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/osdef.h,v 1.8 2004/01/23 22:29:03 twini Exp $ */
+/*
+ * OS depending defines
+ *
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
+ *
+ * If distributed as part of the Linux kernel, the following license terms
+ * apply:
+ *
+ * * This program is free software; you can redistribute it and/or modify
+ * * it under the terms of the GNU General Public License as published by
+ * * the Free Software Foundation; either version 2 of the named License,
+ * * or any later version.
+ * *
+ * * This program is distributed in the hope that it will be useful,
+ * * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * * GNU General Public License for more details.
+ * *
+ * * You should have received a copy of the GNU General Public License
+ * * along with this program; if not, write to the Free Software
+ * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+ *
+ * Otherwise, the following license terms apply:
+ *
+ * * Redistribution and use in source and binary forms, with or without
+ * * modification, are permitted provided that the following conditions
+ * * are met:
+ * * 1) Redistributions of source code must retain the above copyright
+ * * notice, this list of conditions and the following disclaimer.
+ * * 2) Redistributions in binary form must reproduce the above copyright
+ * * notice, this list of conditions and the following disclaimer in the
+ * * documentation and/or other materials provided with the distribution.
+ * * 3) All advertising materials mentioning features or use of this software
+ * * must display the following acknowledgement: "This product includes
+ * * software developed by Thomas Winischhofer, Vienna, Austria."
+ * * 4) The name of the author may not be used to endorse or promote products
+ * * derived from this software without specific prior written permission.
+ * *
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Author: Thomas Winischhofer <thomas@winischhofer.net>
+ * Silicon Integrated Systems, Inc. (used by permission)
+ *
+ */
/* The choices are: */
/* #define LINUX_KERNEL */ /* Kernel framebuffer */
diff --git a/src/sis.h b/src/sis.h
index a689000..37463de 100644
--- a/src/sis.h
+++ b/src/sis.h
@@ -1,42 +1,48 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h,v 1.99 2003/12/16 17:45:19 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h,v 1.108 2004/01/27 11:58:27 twini Exp $ */
/*
* Main global data and definitions
*
- * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1) Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2) Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3) All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement: "This product includes
+ * software developed by Thomas Winischhofer, Vienna, Austria."
+ * 4) The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Authors:
- *
- * Thomas Winischhofer <thomas@winischhofer.net>
- * ?
+ * Authors: Thomas Winischhofer <thomas@winischhofer.net>
+ * others (old code base)
*
*/
+
#ifndef _SIS_H
#define _SIS_H_
/* Always unlock the registers (should be set!) */
#define UNLOCK_ALWAYS
-#define SISDRIVERVERSIONYEAR 3
-#define SISDRIVERVERSIONMONTH 12
-#define SISDRIVERVERSIONDAY 15
+#define SISDRIVERVERSIONYEAR 4
+#define SISDRIVERVERSIONMONTH 1
+#define SISDRIVERVERSIONDAY 27
#define SISDRIVERREVISION 1
#define SISDRIVERIVERSION (SISDRIVERVERSIONYEAR << 16) | (SISDRIVERVERSIONMONTH << 8) \
@@ -107,6 +113,10 @@
#define SIS_ARGB_CURSOR
#endif
+#if 1 /* Include YPbPr support on SiS bridges (315 series and 661/741/760) */
+#define ENABLE_YPBPR
+#endif
+
#ifdef SISMERGED
#ifdef SISXINERAMA
#define NEED_REPLIES /* ? */
@@ -177,29 +187,24 @@
#define CRT2_LCD 0x00000002 /* TW: Never change the order of the CRT2_XXX entries */
#define CRT2_TV 0x00000004 /* (see SISCycleCRT2Type()) */
#define CRT2_VGA 0x00000008
-#define CRT2_ENABLE (CRT2_LCD | CRT2_TV | CRT2_VGA)
-#define DISPTYPE_DISP2 CRT2_ENABLE
#define TV_NTSC 0x00000010
#define TV_PAL 0x00000020
-#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_HIVISION 0x00000040
+#define TV_YPBPR 0x00000080
#define TV_AVIDEO 0x00000100
#define TV_SVIDEO 0x00000200
#define TV_SCART 0x00000400
-#define TV_INTERFACE (TV_AVIDEO | TV_SVIDEO | TV_SCART | TV_CHSCART | TV_CHHDTV)
#define VB_CONEXANT 0x00000800
#define TV_PALM 0x00001000
#define TV_PALN 0x00002000
#define TV_NTSCJ 0x00001000
#define VB_302ELV 0x00004000
#define TV_CHSCART 0x00008000
-#define TV_CHHDTV 0x00010000
+#define TV_CHYPBPR525I 0x00010000
#define CRT1_VGA 0x00000000
#define CRT1_LCDA 0x00020000
#define VGA2_CONNECTED 0x00040000
#define DISPTYPE_CRT1 0x00080000 /* CRT1 connected and used */
-#define DISPTYPE_DISP1 DISPTYPE_CRT1
#define VB_301 0x00100000 /* Video bridge type */
#define VB_301B 0x00200000
#define VB_302B 0x00400000
@@ -209,14 +214,35 @@
#define VB_301LV 0x04000000
#define VB_302LV 0x08000000
#define VB_301C 0x10000000
+#define SINGLE_MODE 0x20000000 /* CRT1 or CRT2; determined by DISPTYPE_CRTx */
+#define MIRROR_MODE 0x40000000 /* CRT1 + CRT2 identical (mirror mode) */
+#define DUALVIEW_MODE 0x80000000 /* CRT1 + CRT2 independent (dual head mode) */
+
+/* Aliases: */
+#define CRT2_ENABLE (CRT2_LCD | CRT2_TV | CRT2_VGA)
+#define TV_STANDARD (TV_NTSC | TV_PAL | TV_PALM | TV_PALN | TV_NTSCJ)
+#define TV_INTERFACE (TV_AVIDEO|TV_SVIDEO|TV_SCART|TV_HIVISION|TV_YPBPR)
+
+/* Only if TV_YPBPR is set: */
+#define TV_YPBPR525I TV_NTSC
+#define TV_YPBPR525P TV_PAL
+#define TV_YPBPR750P TV_PALM
+#define TV_YPBPR1080I TV_PALN
+#define TV_YPBPRALL (TV_YPBPR525I | TV_YPBPR525P | TV_YPBPR750P | TV_YPBPR1080I)
+
+#define TV_YPBPR43LB TV_CHSCART
+#define TV_YPBPR43 TV_CHYPBPR525I
+#define TV_YPBPR169 (TV_CHSCART | TV_CHYPBPR525I)
+#define TV_YPBPRAR (TV_CHSCART | TV_CHYPBPR525I)
+
#define VB_SISBRIDGE (VB_301|VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV|VB_302ELV)
#define VB_SISTVBRIDGE (VB_301|VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV)
-#define VB_VIDEOBRIDGE (VB_SISBRIDGE|VB_LVDS|VB_CHRONTEL|VB_CONEXANT)
-#define SINGLE_MODE 0x20000000 /* CRT1 or CRT2; determined by DISPTYPE_CRTx */
+#define VB_VIDEOBRIDGE (VB_SISBRIDGE | VB_LVDS | VB_CHRONTEL | VB_CONEXANT)
+
+#define DISPTYPE_DISP2 CRT2_ENABLE
+#define DISPTYPE_DISP1 DISPTYPE_CRT1
#define VB_DISPMODE_SINGLE SINGLE_MODE /* alias */
-#define MIRROR_MODE 0x40000000 /* CRT1 + CRT2 identical (mirror mode) */
#define VB_DISPMODE_MIRROR MIRROR_MODE /* alias */
-#define DUALVIEW_MODE 0x80000000 /* CRT1 + CRT2 independent (dual head mode) */
#define VB_DISPMODE_DUAL DUALVIEW_MODE /* alias */
#define DISPLAY_MODE (SINGLE_MODE | MIRROR_MODE | DUALVIEW_MODE)
@@ -237,6 +263,8 @@
#define VB_LCD_640x480_2 0x00002000 /* DSTN/FSTN */
#define VB_LCD_640x480_3 0x00004000 /* DSTN/FSTN */
#define VB_LCD_848x480 0x00008000 /* LVDS only, otherwise handled as custom */
+#define VB_LCD_1280x800 0x00010000
+#define VB_LCD_1680x1050 0x00020000
#define VB_LCD_BARCO1366 0x20000000
#define VB_LCD_CUSTOM 0x40000000
#define VB_LCD_EXPANDING 0x80000000
@@ -250,6 +278,7 @@
#define MISC_CRT1OVERLAY 0x00000001 /* Current display mode supports overlay */
#define MISC_PANELLINKSCALER 0x00000002 /* Panel link is currently scaling */
#define MISC_CRT1OVERLAYGAMMA 0x00000004 /* Current display mode supports overlay gamma corr on CRT1 */
+#define MISC_TVNTSC1024 0x00000008 /* Current display mode is TV NTSC/PALM/YPBPR525I 1024x768 */
/* SiS6326Flags */
#define SIS6326_HASTV 0x00000001
@@ -329,7 +358,7 @@ typedef unsigned char UChar;
#define SiS_SD_IS315SERIES 0x00000002
#define SiS_SD_IS330SERIES 0x00000004
#define SiS_SD_SUPPORTPALMN 0x00000008 /* tv chip supports pal-m, pal-n */
-#define SiS_SD_SUPPORT2OVL 0x00000010 /* set = 2 overlays, 1 = support SWITCHCRT xv prop */
+#define SiS_SD_SUPPORT2OVL 0x00000010 /* set = 2 overlays, clear = support SWITCHCRT xv prop */
#define SiS_SD_SUPPORTTVPOS 0x00000020 /* supports changing tv position */
#define SiS_SD_ISDUALHEAD 0x00000040 /* Driver is in dual head mode */
#define SiS_SD_ISMERGEDFB 0x00000080 /* Driver is in merged fb mode */
@@ -348,18 +377,29 @@ typedef unsigned char UChar;
#define SiS_SD_SUPPORTOVERSCAN 0x00100000 /* Overscan flag supported */
#define SiS_SD_SUPPORTXVGAMMA1 0x00200000 /* Xv Gamma correction for CRT1 supported */
#define SiS_SD_SUPPORTTV 0x00400000 /* CRT2=TV supported */
+#define SiS_SD_SUPPORTYPBPR 0x00800000 /* CRT2=YPbPr (525i, 525p, 750p, 1080i) is supported */
+#define SiS_SD_SUPPORTHIVISION 0x01000000 /* CRT2=HiVision is supported */
+#define SiS_SD_SUPPORTYPBPRAR 0x02000000 /* YPbPr aspect ratio is supported */
#define SIS_DIRECTKEY 0x03145792
/* SiSCtrl: Check mode for CRT2 */
-#define SiS_CF2_LCD 0x01
-#define SiS_CF2_TV 0x02
-#define SiS_CF2_VGA2 0x04
-#define SiS_CF2_TVPAL 0x08
-#define SiS_CF2_TVNTSC 0x10 /* + NTSC-J */
-#define SiS_CF2_TVPALM 0x20
-#define SiS_CF2_TVPALN 0x40
-#define SiS_CF2_CRT1LCDA 0x80
+#define SiS_CF2_LCD 0x01
+#define SiS_CF2_TV 0x02
+#define SiS_CF2_VGA2 0x04
+#define SiS_CF2_TVPAL 0x08
+#define SiS_CF2_TVNTSC 0x10 /* + NTSC-J */
+#define SiS_CF2_TVPALM 0x20
+#define SiS_CF2_TVPALN 0x40
+#define SiS_CF2_CRT1LCDA 0x80
+#define SiS_CF2_TYPEMASK (SiS_CF2_LCD | SiS_CF2_TV | SiS_CF2_VGA2 | SiS_CF2_CRT1LCDA)
+#define SiS_CF2_TVSPECIAL (SiS_CF2_LCD | SiS_CF2_TV)
+#define SiS_CF2_TVSPECMASK (SiS_CF2_TVPAL | SiS_CF2_TVNTSC | SiS_CF2_TVPALM | SiS_CF2_TVPALN)
+#define SiS_CF2_TVHIVISION SiS_CF2_TVPAL
+#define SiS_CF2_TVYPBPR525I SiS_CF2_TVNTSC
+#define SiS_CF2_TVYPBPR525P (SiS_CF2_TVPAL | SiS_CF2_TVNTSC)
+#define SiS_CF2_TVYPBPR750P SiS_CF2_TVPALM
+#define SiS_CF2_TVYPBPR1080I (SiS_CF2_TVPALM | SiS_CF2_TVPAL)
/* AGP stuff for DRI */
#define AGP_PAGE_SIZE 4096
@@ -493,6 +533,7 @@ typedef struct {
int tvxpos, tvypos;
int tvxscale, tvyscale;
int ForceTVType;
+ unsigned long ForceYPbPrType, ForceYPbPrAR;
int chtvtype;
int NonDefaultPAL, NonDefaultNTSC;
unsigned short tvx, tvy;
@@ -501,7 +542,7 @@ typedef struct {
unsigned long sistvccbase;
unsigned char p2_35, p2_36, p2_37, p2_38, p2_48, p2_49, p2_4a;
unsigned char p2_0a, p2_2f, p2_30, p2_47;
- unsigned char scalingp1[9], scalingp4[9];
+ unsigned char scalingp1[9], scalingp4[9], scalingp2[64];
unsigned short cursorBufferNum;
BOOLEAN restorebyset;
BOOLEAN CRT1gamma, CRT1gammaGiven, CRT2gamma, XvGamma, XvGammaGiven;
@@ -517,6 +558,7 @@ typedef struct {
unsigned char * FbBase1;
unsigned long OnScreenSize1;
unsigned char OldMode;
+ int HWCursorMBufNum, HWCursorCBufNum;
#ifdef SIS_CP
SIS_CP_H_ENT
#endif
@@ -594,7 +636,7 @@ typedef struct {
Bool CRT1changed;
unsigned char oldCR17, oldCR63, oldSR1F;
unsigned char oldCR32, oldCR36, oldCR37;
- unsigned char myCR32, myCR36, myCR37;
+ unsigned char myCR32, myCR36, myCR37, myCR63;
unsigned char newCR32;
unsigned long VBFlags; /* Video bridge configuration */
unsigned long VBFlags_backup; /* Backup for SlaveMode-modes */
@@ -805,6 +847,7 @@ typedef struct {
int newFastVram; /* Replaces FastVram */
int ForceTVType;
int NonDefaultPAL, NonDefaultNTSC;
+ unsigned long ForceYPbPrType, ForceYPbPrAR;
unsigned long lockcalls; /* Count unlock calls for debug */
unsigned short tvx, tvy; /* Backup TV position registers */
unsigned char p2_01, p2_02, p2_1f, p2_20; /* Backup TV position registers */
@@ -813,7 +856,7 @@ typedef struct {
unsigned long sistvccbase;
unsigned char p2_35, p2_36, p2_37, p2_38, p2_48, p2_49, p2_4a;
unsigned char p2_0a, p2_2f, p2_30, p2_47;
- unsigned char scalingp1[9], scalingp4[9];
+ unsigned char scalingp1[9], scalingp4[9], scalingp2[64];
BOOLEAN ForceCursorOff;
BOOLEAN HaveCustomModes;
BOOLEAN IsCustom;
@@ -881,6 +924,8 @@ typedef struct {
int GammaPBriR, GammaPBriG, GammaPBriB;
Bool HideHWCursor; /* Custom application */
Bool HWCursorIsVisible;
+ unsigned long HWCursorBackup[16];
+ int HWCursorMBufNum, HWCursorCBufNum;
#ifdef SISMERGED
Bool MergedFB, MergedFBAuto;
SiSScrn2Rel CRT2Position;
diff --git a/src/sis300_accel.c b/src/sis300_accel.c
index ee374d2..d9a521e 100644
--- a/src/sis300_accel.c
+++ b/src/sis300_accel.c
@@ -1,32 +1,36 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c,v 1.23 2003/10/30 18:53:42 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c,v 1.27 2004/01/23 22:29:04 twini Exp $ */
/*
- * 2D Acceleration for SiS300, SiS540, SiS630, SiS730, SiS530, SiS620
+ * 2D Acceleration for SiS 530, 620, 300, 540, 630, 730.
*
- * Copyright Xavier Ducoin <x.ducoin@lectra.com>
- * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1) Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2) Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3) All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement: "This product includes
+ * software developed by Thomas Winischhofer, Vienna, Austria."
+ * 4) The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Authors:
- *
- * Xavier Ducoin <x.ducoin@lectra.com>
- * Thomas Winischhofer <thomas@winischhofer.net>
+ * Authors: Thomas Winischhofer <thomas@winischhofer.net>
+ * Can-Ru Yeou, SiS Inc.
*
*/
@@ -42,6 +46,7 @@
#include "compiler.h"
#include "xaa.h"
#include "xaalocal.h"
+#include "xaarop.h"
#include "sis.h"
#include "sis300_accel.h"
@@ -371,46 +376,6 @@ SiSRestoreAccelState(ScrnInfoPtr pScrn)
}
#endif
-static const int sisALUConv[] =
-{
- 0x00, /* dest = 0; 0, GXclear, 0 */
- 0x88, /* dest &= src; DSa, GXand, 0x1 */
- 0x44, /* dest = src & ~dest; SDna, GXandReverse, 0x2 */
- 0xCC, /* dest = src; S, GXcopy, 0x3 */
- 0x22, /* dest &= ~src; DSna, GXandInverted, 0x4 */
- 0xAA, /* dest = dest; D, GXnoop, 0x5 */
- 0x66, /* dest = ^src; DSx, GXxor, 0x6 */
- 0xEE, /* dest |= src; DSo, GXor, 0x7 */
- 0x11, /* dest = ~src & ~dest; DSon, GXnor, 0x8 */
- 0x99, /* dest ^= ~src ; DSxn, GXequiv, 0x9 */
- 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */
- 0xDD, /* dest = src|~dest ; SDno, GXorReverse, 0xB */
- 0x33, /* dest = ~src; Sn, GXcopyInverted, 0xC */
- 0xBB, /* dest |= ~src; DSno, GXorInverted, 0xD */
- 0x77, /* dest = ~src|~dest; DSan, GXnand, 0xE */
- 0xFF, /* dest = 0xFF; 1, GXset, 0xF */
-};
-/* same ROP but with Pattern as Source */
-static const int sisPatALUConv[] =
-{
- 0x00, /* dest = 0; 0, GXclear, 0 */
- 0xA0, /* dest &= src; DPa, GXand, 0x1 */
- 0x50, /* dest = src & ~dest; PDna, GXandReverse, 0x2 */
- 0xF0, /* dest = src; P, GXcopy, 0x3 */
- 0x0A, /* dest &= ~src; DPna, GXandInverted, 0x4 */
- 0xAA, /* dest = dest; D, GXnoop, 0x5 */
- 0x5A, /* dest = ^src; DPx, GXxor, 0x6 */
- 0xFA, /* dest |= src; DPo, GXor, 0x7 */
- 0x05, /* dest = ~src & ~dest; DPon, GXnor, 0x8 */
- 0xA5, /* dest ^= ~src ; DPxn, GXequiv, 0x9 */
- 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */
- 0xF5, /* dest = src|~dest ; PDno, GXorReverse, 0xB */
- 0x0F, /* dest = ~src; Pn, GXcopyInverted, 0xC */
- 0xAF, /* dest |= ~src; DPno, GXorInverted, 0xD */
- 0x5F, /* dest = ~src|~dest; DPan, GXnand, 0xE */
- 0xFF, /* dest = 0xFF; 1, GXset, 0xF */
-};
-
static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
int xdir, int ydir, int rop,
unsigned int planemask, int trans_color)
@@ -429,7 +394,7 @@ static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
SiSSetupSRCTrans(trans_color)
SiSSetupCMDFlag(TRANSPARENT_BITBLT)
} else {
- SiSSetupROP(sisALUConv[rop])
+ SiSSetupROP(XAACopyROP[rop])
}
if(xdir > 0) {
SiSSetupCMDFlag(X_INC)
@@ -499,7 +464,7 @@ SiSSetupForSolidFill(ScrnInfoPtr pScrn,
SiSSetupPATFG(color)
SiSSetupDSTRect(pSiS->scrnOffset, -1)
SiSSetupDSTColorDepth(pSiS->DstColor);
- SiSSetupROP(sisPatALUConv[rop])
+ SiSSetupROP(XAAPatternROP[rop])
/* SiSSetupCMDFlag(PATFG) - is zero */
}
@@ -657,7 +622,7 @@ SiSSetupForSolidLine(ScrnInfoPtr pScrn,
SiSSetupPATFG(color)
SiSSetupDSTRect(pSiS->scrnOffset, -1)
SiSSetupDSTColorDepth(pSiS->DstColor);
- SiSSetupROP(sisPatALUConv[rop])
+ SiSSetupROP(XAAPatternROP[rop])
SiSSetupCMDFlag(PATFG | LINE)
}
@@ -746,7 +711,7 @@ SiSSetupForDashedLine(ScrnInfoPtr pScrn,
SiSSetupStyleLow(*pattern)
SiSSetupStyleHigh(*(pattern+4))
SiSSetupStylePeriod(length-1);
- SiSSetupROP(sisPatALUConv[rop])
+ SiSSetupROP(XAAPatternROP[rop])
SiSSetupPATFG(fg)
SiSSetupCMDFlag(LINE | LINE_STYLE)
if(bg != -1) {
@@ -806,7 +771,7 @@ SiSSetupForMonoPatternFill(ScrnInfoPtr pScrn,
SiSSetupDSTColorDepth(pSiS->DstColor);
SiSSetupMONOPAT(patx,paty)
SiSSetupPATFG(fg)
- SiSSetupROP(sisPatALUConv[rop])
+ SiSSetupROP(XAAPatternROP[rop])
SiSSetupCMDFlag(PATMONO)
if(bg != -1) {
SiSSetupPATBG(bg)
@@ -940,7 +905,7 @@ SiSSetupForCPUToScreenColorExpand(ScrnInfoPtr pScrn,
SiSSetupDSTColorDepth(pSiS->DstColor);
SiSSetupSRCXY(0,0)
SiSSetupSRCFG(fg)
- SiSSetupROP(sisPatALUConv[rop])
+ SiSSetupROP(XAAPatternROP[rop])
SiSSetupCMDFlag(X_INC | Y_INC | COLOREXP)
if(bg == -1) {
SiSSetupCMDFlag(TRANSPARENT)
@@ -992,7 +957,7 @@ SiSSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn,
SiSSetupDSTColorDepth(pSiS->DstColor)
SiSSetupDSTRect(pSiS->scrnOffset, -1)
- SiSSetupROP(sisALUConv[rop])
+ SiSSetupROP(XAACopyROP[rop])
SiSSetupSRCFG(fg)
/* SiSSetupSRCXY(0,0) */
@@ -1158,7 +1123,7 @@ SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
while((MMIO_IN16(pSiS->IOBase, 0x8242) & 0x1F00) != 0) {} /* WDR: == 0x10 */
SiSSetupSRCXY(0,0);
- SiSSetupROP(sisALUConv[rop]);
+ SiSSetupROP(XAACopyROP[rop]);
SiSSetupSRCFG(fg);
SiSSetupDSTRect(pSiS->scrnOffset, -1);
SiSSetupDSTColorDepth(pSiS->DstColor);
diff --git a/src/sis300_accel.h b/src/sis300_accel.h
index e787005..c58a027 100644
--- a/src/sis300_accel.h
+++ b/src/sis300_accel.h
@@ -1,33 +1,37 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h,v 1.16 2003/11/03 17:02:52 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h,v 1.19 2004/01/23 22:29:04 twini Exp $ */
/*
- * 2D Acceleration for SiS300, SiS540, SiS630, SiS730, SiS530, SiS620
+ * 2D Acceleration for SiS 530, 620, 300, 540, 630, 730.
* Definitions for the SIS engine communication
*
- * Copyright Xavier Ducoin <x.ducoin@lectra.com>
- * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1) Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2) Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3) All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement: "This product includes
+ * software developed by Thomas Winischhofer, Vienna, Austria."
+ * 4) The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Authors:
- *
- * Xavier Ducoin <x.ducoin@lectra.com>
- * Thomas Winischhofer <thomas@winischhofer.net>
+ * Authors: Thomas Winischhofer <thomas@winischhofer.net>
+ * Can-Ru Yeou, SiS Inc. (code base)
*
*/
diff --git a/src/sis310_accel.c b/src/sis310_accel.c
index 5db2d82..f64977a 100644
--- a/src/sis310_accel.c
+++ b/src/sis310_accel.c
@@ -1,33 +1,39 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.c,v 1.32 2003/11/06 19:10:01 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.c,v 1.37 2004/01/27 11:58:27 twini Exp $ */
/*
* 2D Acceleration for SiS 315 and 330 series
- * (315/550/650/740/M650/651/652/M652/330/660/661/M661/741/M741/760/M760)
*
- * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1) Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2) Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3) All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement: "This product includes
+ * software developed by Thomas Winischhofer, Vienna, Austria."
+ * 4) The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Based on sis300_accel.c
- * 2003/08/18: Rewritten for using VRAM command queue (TW)
*
* Author: Thomas Winischhofer <thomas@winischhofer.net>
*
+ * 2003/08/18: Rewritten for using VRAM command queue
+ *
*/
#include "xf86.h"
@@ -38,6 +44,7 @@
#include "compiler.h"
#include "xaa.h"
#include "xaalocal.h"
+#include "xaarop.h"
#include "sis.h"
#include "sis310_accel.h"
@@ -182,10 +189,10 @@ extern void SiSSubsequentCPUToScreenTexture(ScrnInfoPtr pScrn,
int srcx, int srcy,
int width, int height);
-extern CARD32 SiSAlphaTextureFormats[2];
-extern CARD32 SiSTextureFormats[2];
-CARD32 SiSAlphaTextureFormats[2] = { PICT_a8, 0 };
-CARD32 SiSTextureFormats[2] = { PICT_a8r8g8b8, 0 };
+extern CARD32 SiSAlphaTextureFormats[3];
+extern CARD32 SiSTextureFormats[2];
+CARD32 SiSAlphaTextureFormats[3] = { PICT_a8, PICT_a8r8g8b8, 0 };
+CARD32 SiSTextureFormats[2] = { PICT_a8r8g8b8, 0 };
#endif
#endif
@@ -410,8 +417,7 @@ SiS315AccelInit(ScreenPtr pScreen)
infoPtr->SetupForCPUToScreenAlphaTexture = SiSSetupForCPUToScreenAlphaTexture;
infoPtr->SubsequentCPUToScreenAlphaTexture = SiSSubsequentCPUToScreenTexture;
infoPtr->CPUToScreenAlphaTextureFormats = SiSAlphaTextureFormats;
- infoPtr->CPUToScreenAlphaTextureFlags = XAA_RENDER_NO_TILE |
- XAA_RENDER_NO_SRC_ALPHA;
+ infoPtr->CPUToScreenAlphaTextureFlags = XAA_RENDER_NO_TILE;
infoPtr->SetupForCPUToScreenTexture = SiSSetupForCPUToScreenTexture;
infoPtr->SubsequentCPUToScreenTexture = SiSSubsequentCPUToScreenTexture;
@@ -522,47 +528,6 @@ SiSRestoreAccelState(ScrnInfoPtr pScrn)
}
#endif
-static const int sisALUConv[] =
-{
- 0x00, /* dest = 0; 0, GXclear, 0 */
- 0x88, /* dest &= src; DSa, GXand, 0x1 */
- 0x44, /* dest = src & ~dest; SDna, GXandReverse, 0x2 */
- 0xCC, /* dest = src; S, GXcopy, 0x3 */
- 0x22, /* dest &= ~src; DSna, GXandInverted, 0x4 */
- 0xAA, /* dest = dest; D, GXnoop, 0x5 */
- 0x66, /* dest = ^src; DSx, GXxor, 0x6 */
- 0xEE, /* dest |= src; DSo, GXor, 0x7 */
- 0x11, /* dest = ~src & ~dest; DSon, GXnor, 0x8 */
- 0x99, /* dest ^= ~src ; DSxn, GXequiv, 0x9 */
- 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */
- 0xDD, /* dest = src|~dest ; SDno, GXorReverse, 0xB */
- 0x33, /* dest = ~src; Sn, GXcopyInverted, 0xC */
- 0xBB, /* dest |= ~src; DSno, GXorInverted, 0xD */
- 0x77, /* dest = ~src|~dest; DSan, GXnand, 0xE */
- 0xFF, /* dest = 0xFF; 1, GXset, 0xF */
-};
-
-/* same ROP but with Pattern as Source */
-static const int sisPatALUConv[] =
-{
- 0x00, /* dest = 0; 0, GXclear, 0 */
- 0xA0, /* dest &= src; DPa, GXand, 0x1 */
- 0x50, /* dest = src & ~dest; PDna, GXandReverse, 0x2 */
- 0xF0, /* dest = src; P, GXcopy, 0x3 */
- 0x0A, /* dest &= ~src; DPna, GXandInverted, 0x4 */
- 0xAA, /* dest = dest; D, GXnoop, 0x5 */
- 0x5A, /* dest = ^src; DPx, GXxor, 0x6 */
- 0xFA, /* dest |= src; DPo, GXor, 0x7 */
- 0x05, /* dest = ~src & ~dest; DPon, GXnor, 0x8 */
- 0xA5, /* dest ^= ~src ; DPxn, GXequiv, 0x9 */
- 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */
- 0xF5, /* dest = src|~dest ; PDno, GXorReverse, 0xB */
- 0x0F, /* dest = ~src; Pn, GXcopyInverted, 0xC */
- 0xAF, /* dest |= ~src; DPno, GXorInverted, 0xD */
- 0x5F, /* dest = ~src|~dest; DPan, GXnand, 0xE */
- 0xFF, /* dest = 0xFF; 1, GXset, 0xF */
-};
-
static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
int xdir, int ydir, int rop,
unsigned int planemask, int trans_color)
@@ -587,7 +552,7 @@ static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
SiSSetupSRCTrans(trans_color)
SiSSetupCMDFlag(TRANSPARENT_BITBLT)
} else {
- SiSSetupROP(sisALUConv[rop])
+ SiSSetupROP(XAACopyROP[rop])
/* Set command - not needed, both 0 */
/* SiSSetupCMDFlag(BITBLT | SRCVIDEO) */
}
@@ -710,14 +675,14 @@ SiSSetupForSolidFill(ScrnInfoPtr pScrn, int color,
SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
SiSCheckQueue(16 * 1);
SiSSetupPATFGDSTRect(color, pSiS->scrnOffset, -1)
- SiSSetupROP(sisPatALUConv[rop])
+ SiSSetupROP(XAAPatternROP[rop])
SiSSetupCMDFlag(PATFG)
SiSSyncWP
#else
SiSSetupPATFG(color)
SiSSetupDSTRect(pSiS->scrnOffset, -1)
SiSSetupDSTColorDepth(pSiS->DstColor);
- SiSSetupROP(sisPatALUConv[rop])
+ SiSSetupROP(XAAPatternROP[rop])
SiSSetupCMDFlag(PATFG | pSiS->SiS310_AccelDepth)
#endif
}
@@ -855,7 +820,7 @@ SiSSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop,
SiSCheckQueue(16 * 3);
SiSSetupLineCountPeriod(1, 1)
SiSSetupPATFGDSTRect(color, pSiS->scrnOffset, -1)
- SiSSetupROP(sisPatALUConv[rop])
+ SiSSetupROP(XAAPatternROP[rop])
SiSSetupCMDFlag(PATFG | LINE)
SiSSyncWP
#else
@@ -863,7 +828,7 @@ SiSSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop,
SiSSetupPATFG(color)
SiSSetupDSTRect(pSiS->scrnOffset, -1)
SiSSetupDSTColorDepth(pSiS->DstColor)
- SiSSetupROP(sisPatALUConv[rop])
+ SiSSetupROP(XAAPatternROP[rop])
SiSSetupCMDFlag(PATFG | LINE | pSiS->SiS310_AccelDepth)
#endif
}
@@ -974,7 +939,7 @@ SiSSetupForDashedLine(ScrnInfoPtr pScrn,
SiSSetupPATFG(fg)
#endif
- SiSSetupROP(sisPatALUConv[rop])
+ SiSSetupROP(XAAPatternROP[rop])
SiSSetupCMDFlag(LINE | LINE_STYLE)
@@ -1054,7 +1019,7 @@ SiSSetupForMonoPatternFill(ScrnInfoPtr pScrn,
SiSSetupMONOPAT(patx,paty)
- SiSSetupROP(sisPatALUConv[rop])
+ SiSSetupROP(XAAPatternROP[rop])
#ifdef SISVRAMQ
SiSSetupCMDFlag(PATMONO)
@@ -1213,7 +1178,7 @@ SiSSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny,
patadr += 16; /* = 64 due to (CARD32 *) */
}
- SiSSetupROP(sisPatALUConv[rop])
+ SiSSetupROP(XAAPatternROP[rop])
SiSSetupCMDFlag(PATPATREG)
@@ -1272,7 +1237,7 @@ SiSSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
#ifdef SISVRAMQ
SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
- SiSSetupROP(sisALUConv[rop]);
+ SiSSetupROP(XAACopyROP[rop]);
SiSSetupSRCFGDSTRect(fg, pSiS->scrnOffset, -1)
if(bg == -1) {
SiSSetupCMDFlag(TRANSPARENT | ENCOLOREXP | SRCVIDEO);
@@ -1283,7 +1248,7 @@ SiSSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
SiSSyncWP
#else
SiSSetupSRCXY(0,0);
- SiSSetupROP(sisALUConv[rop]);
+ SiSSetupROP(XAACopyROP[rop]);
SiSSetupSRCFG(fg);
SiSSetupDSTRect(pSiS->scrnOffset, -1);
SiSSetupDSTColorDepth(pSiS->DstColor);
@@ -1384,7 +1349,7 @@ SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
#endif
SiSSetupSRCXY(0,0);
- SiSSetupROP(sisALUConv[rop]);
+ SiSSetupROP(XAACopyROP[rop]);
SiSSetupSRCFG(fg);
SiSSetupDSTRect(pSiS->scrnOffset, -1);
#ifndef SISVRAMQ
@@ -1512,7 +1477,7 @@ SiSSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn,
SiSSetupDSTColorDepth(pSiS->DstColor)
#endif
SiSSetupDSTRect(pSiS->scrnOffset, -1)
- SiSSetupROP(sisALUConv[rop])
+ SiSSetupROP(XAACopyROP[rop])
SiSSetupSRCFG(fg)
/* SiSSetupSRCXY(0,0) */
@@ -1731,14 +1696,14 @@ SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
int height, int flags)
{
SISPtr pSiS = SISPTR(pScrn);
- int x, pitch, sizeNeeded, offset;
+ int x, y, pitch, sizeNeeded, offset;
CARD8 myalpha;
CARD32 *dstPtr;
unsigned char *renderaccelarray;
#ifdef ACCELDEBUG
- xf86DrvMsg(0, X_INFO, "AT: op %d RGB %x %x %x, w %d h %d A-pitch %d\n",
- op, red, green, blue, width, height, alphaPitch);
+ xf86DrvMsg(0, X_INFO, "AT: op %d ARGB %x %x %x %x, w %d h %d A-pitch %d\n",
+ op, alpha, red, green, blue, width, height, alphaPitch);
#endif
if(op != PictOpOver) return FALSE;
@@ -1749,16 +1714,16 @@ SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
sizeNeeded = pitch * height;
if(pScrn->bitsPerPixel == 16) sizeNeeded <<= 1;
- red &= 0xff00;
- green &= 0xff00;
- blue &= 0xff00;
-
if(!((renderaccelarray = pSiS->RenderAccelArray)))
return FALSE;
if(!SiSAllocateLinear(pScrn, sizeNeeded))
return FALSE;
+ red &= 0xff00;
+ green &= 0xff00;
+ blue &= 0xff00;
+
#ifdef SISVRAMQ
SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
SiSSetupSRCPitchDSTRect((pitch << 2), pSiS->scrnOffset, -1);
@@ -1782,17 +1747,77 @@ SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
SiSIdle
}
- while(height--) {
- for(x = 0; x < width; x++) {
- myalpha = alphaPtr[x];
- dstPtr[x] = (renderaccelarray[red + myalpha] << 16) |
- (renderaccelarray[green + myalpha] << 8) |
- renderaccelarray[blue + myalpha] |
- myalpha << 24;
+ if(alphaType == PICT_a8) {
+
+ if(alpha == 0xffff) {
+
+ while(height--) {
+ for(x = 0; x < width; x++) {
+ myalpha = alphaPtr[x];
+ dstPtr[x] = (renderaccelarray[red + myalpha] << 16) |
+ (renderaccelarray[green + myalpha] << 8) |
+ renderaccelarray[blue + myalpha] |
+ myalpha << 24;
+ }
+ dstPtr += pitch;
+ alphaPtr += alphaPitch;
+ }
+
+ } else {
+
+ alpha &= 0xff00;
+
+ while(height--) {
+ for(x = 0; x < width; x++) {
+ myalpha = alphaPtr[x];
+ dstPtr[x] = (renderaccelarray[alpha + myalpha] << 24) |
+ (renderaccelarray[red + myalpha] << 16) |
+ (renderaccelarray[green + myalpha] << 8) |
+ renderaccelarray[blue + myalpha];
+ }
+ dstPtr += pitch;
+ alphaPtr += alphaPitch;
+ }
+
}
- dstPtr += pitch;
- alphaPtr += alphaPitch;
- }
+
+ } else {
+
+ width <<= 2;
+
+ if(alpha == 0xffff) {
+
+ while(height--) {
+ for(x = 0, y = 0; x < width; x+=4, y++) {
+ myalpha = alphaPtr[x];
+ dstPtr[y] = (renderaccelarray[red + myalpha] << 16) |
+ (renderaccelarray[green + myalpha] << 8) |
+ renderaccelarray[blue + myalpha] |
+ myalpha << 24;
+ }
+ dstPtr += pitch;
+ alphaPtr += alphaPitch;
+ }
+
+ } else {
+
+ alpha &= 0xff00;
+
+ while(height--) {
+ for(x = 0, y = 0; x < width; x+=4, y++) {
+ myalpha = alphaPtr[x];
+ dstPtr[y] = (renderaccelarray[alpha + myalpha] << 24) |
+ (renderaccelarray[red + myalpha] << 16) |
+ (renderaccelarray[green + myalpha] << 8) |
+ renderaccelarray[blue + myalpha];
+ }
+ dstPtr += pitch;
+ alphaPtr += alphaPitch;
+ }
+
+ }
+
+ }
return TRUE;
}
@@ -1869,8 +1894,7 @@ SiSSubsequentCPUToScreenTexture(ScrnInfoPtr pScrn,
long srcbase, dstbase;
srcbase = pSiS->AccelLinearScratch->offset << 1;
- if(pScrn->bitsPerPixel == 32)
- srcbase <<= 1;
+ if(pScrn->bitsPerPixel == 32) srcbase <<= 1;
#ifdef ACCELDEBUG
xf86DrvMsg(0, X_INFO, "FIRE: scrbase %x dx %d dy %d w %d h %d\n",
diff --git a/src/sis310_accel.h b/src/sis310_accel.h
index da85d67..aa858a8 100644
--- a/src/sis310_accel.h
+++ b/src/sis310_accel.h
@@ -1,33 +1,39 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.h,v 1.14 2003/10/30 18:53:42 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.h,v 1.17 2004/01/23 22:29:04 twini Exp $ */
/*
* 2D Acceleration for SiS 315 and Xabre series
* Definitions for the SIS engine communication.
*
- * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1) Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2) Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3) All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement: "This product includes
+ * software developed by Thomas Winischhofer, Vienna, Austria."
+ * 4) The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Based on sis300_accel.h
- * 2003/08/18: Added VRAM queue support
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Author: Thomas Winischhofer <thomas@winischhofer.net>
*
+ * 2003/08/18: Added VRAM queue support
+ *
*/
/* SiS315 and 330 engine commands */
diff --git a/src/sis6326_video.c b/src/sis6326_video.c
index 15ee1eb..80e5c70 100644
--- a/src/sis6326_video.c
+++ b/src/sis6326_video.c
@@ -1,31 +1,36 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis6326_video.c,v 1.14 2003/11/11 18:04:30 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis6326_video.c,v 1.17 2004/01/23 22:29:04 twini Exp $ */
/*
* Xv driver for SiS 5597/5598, 6236 and 530/620.
*
- * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria.
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria.
*
- * Based on sis_video.c which is
- * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1) Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2) Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3) All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement: "This product includes
+ * software developed by Thomas Winischhofer, Vienna, Austria."
+ * 4) The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Author: Thomas Winischhofer <thomas@winischhofer.net>
+ *
*/
#include "sis.h"
diff --git a/src/sis_accel.c b/src/sis_accel.c
index 12ecb73..8233913 100644
--- a/src/sis_accel.c
+++ b/src/sis_accel.c
@@ -1,34 +1,36 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c,v 1.34 2003/11/03 17:02:52 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c,v 1.37 2004/01/04 18:07:59 twini Exp $ */
/*
* 2D acceleration for SiS5597/5598 and 6326
*
- * Copyright 1998,1999 by Alan Hourihane, Wigan, England.
- * Parts Copyright 2002-2003 Thomas Winischhofer, Vienna, Austria.
+ * Copyright (C) 1998, 1999 by Alan Hourihane, Wigan, England.
+ * Parts Copyright (C) 2001-2004 Thomas Winischhofer, Vienna, Austria.
+ *
+ * Licensed under the following terms:
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
+ * the above copyright notice appears in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * and that the name of the copyright holder not be used in advertising
+ * or publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holder makes no representations
* about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * "as is" without expressed or implied warranty.
*
* THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
* EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
- * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk
+ * Authors: Alan Hourihane <alanh@fairlite.demon.co.uk>,
* Mike Chapman <mike@paranoia.com>,
* Juanjo Santamarta <santamarta@ctv.es>,
- * Mitani Hiroshi <hmitani@drl.mei.co.jp>
- * David Thomas <davtom@dream.org.uk>
- * Thomas Winischhofer <thomas@winischhofer.net>
+ * Mitani Hiroshi <hmitani@drl.mei.co.jp>,
+ * David Thomas <davtom@dream.org.uk>,
+ * Thomas Winischhofer <thomas@winischhofer.net>.
*/
#if 0
@@ -242,7 +244,7 @@ SiSSync(ScrnInfoPtr pScrn) {
}
/* Clipping */
-static void SiSSetClippingRectangle ( ScrnInfoPtr pScrn,
+static void SiSSetClippingRectangle( ScrnInfoPtr pScrn,
int left, int top, int right, int bottom)
{
SISPtr pSiS = SISPTR(pScrn);
@@ -253,54 +255,12 @@ static void SiSSetClippingRectangle ( ScrnInfoPtr pScrn,
pSiS->ClipEnabled = TRUE;
}
-static void SiSDisableClipping (ScrnInfoPtr pScrn)
+static void SiSDisableClipping(ScrnInfoPtr pScrn)
{
SISPtr pSiS = SISPTR(pScrn);
pSiS->ClipEnabled = FALSE;
}
-#ifdef CTSCE
-static const int sisALUConv[] =
-{
- 0x00, /* dest = 0; 0, GXclear, 0 */
- 0x88, /* dest &= src; DSa, GXand, 0x1 */
- 0x44, /* dest = src & ~dest; SDna, GXandReverse, 0x2 */
- 0xCC, /* dest = src; S, GXcopy, 0x3 */
- 0x22, /* dest &= ~src; DSna, GXandInverted, 0x4 */
- 0xAA, /* dest = dest; D, GXnoop, 0x5 */
- 0x66, /* dest = ^src; DSx, GXxor, 0x6 */
- 0xEE, /* dest |= src; DSo, GXor, 0x7 */
- 0x11, /* dest = ~src & ~dest; DSon, GXnor, 0x8 */
- 0x99, /* dest ^= ~src ; DSxn, GXequiv, 0x9 */
- 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */
- 0xDD, /* dest = src|~dest ; SDno, GXorReverse, 0xB */
- 0x33, /* dest = ~src; Sn, GXcopyInverted, 0xC */
- 0xBB, /* dest |= ~src; DSno, GXorInverted, 0xD */
- 0x77, /* dest = ~src|~dest; DSan, GXnand, 0xE */
- 0xFF, /* dest = 0xFF; 1, GXset, 0xF */
-};
-/* same ROP but with Pattern as Source */
-static const int sisPatALUConv[] =
-{
- 0x00, /* dest = 0; 0, GXclear, 0 */
- 0xA0, /* dest &= src; DPa, GXand, 0x1 */
- 0x50, /* dest = src & ~dest; PDna, GXandReverse, 0x2 */
- 0xF0, /* dest = src; P, GXcopy, 0x3 */
- 0x0A, /* dest &= ~src; DPna, GXandInverted, 0x4 */
- 0xAA, /* dest = dest; D, GXnoop, 0x5 */
- 0x5A, /* dest = ^src; DPx, GXxor, 0x6 */
- 0xFA, /* dest |= src; DPo, GXor, 0x7 */
- 0x05, /* dest = ~src & ~dest; DPon, GXnor, 0x8 */
- 0xA5, /* dest ^= ~src ; DPxn, GXequiv, 0x9 */
- 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */
- 0xF5, /* dest = src|~dest ; PDno, GXorReverse, 0xB */
- 0x0F, /* dest = ~src; Pn, GXcopyInverted, 0xC */
- 0xAF, /* dest |= ~src; DPno, GXorInverted, 0xD */
- 0x5F, /* dest = ~src|~dest; DPan, GXnand, 0xE */
- 0xFF, /* dest = 0xFF; 1, GXset, 0xF */
-};
-#endif
-
/* Screen to screen copy */
static void
SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
@@ -578,11 +538,11 @@ SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
sisSETROPBG(0xAA); /* dst = dst (=noop) */
pSiS->CommandReg |= sisSRCFG;
} else {
- sisSETBGROPCOL(sisPatALUConv[rop], bg);
+ sisSETBGROPCOL(XAAPatternROP[rop], bg);
pSiS->CommandReg |= sisSRCFG | sisPATBG;
}
- sisSETFGROPCOL(sisALUConv[rop], fg);
+ sisSETFGROPCOL(XAACopyROP[rop], fg);
sisSETDSTPITCH(pSiS->scrnOffset);
}
diff --git a/src/sis_accel.h b/src/sis_accel.h
index a5c59b5..59d583d 100644
--- a/src/sis_accel.h
+++ b/src/sis_accel.h
@@ -1,35 +1,37 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.h,v 1.9 2003/11/03 17:02:53 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.h,v 1.11 2004/01/04 18:07:59 twini Exp $ */
/*
* 2D acceleration for 5597/5598 and 6326
* Definitions for the SIS engine communication
*
- * Copyright 1998,1999 by Alan Hourihane, Wigan, England.
- * Parts Copyright 2002,2003 Thomas Winischhofer, Vienna, Austria.
+ * Copyright (C) 1998, 1999 by Alan Hourihane, Wigan, England.
+ * Parts Copyright (C) 2001-2004 Thomas Winischhofer, Vienna, Austria.
+ *
+ * Licensed under the following terms:
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
+ * the above copyright notice appears in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * and that the name of the copyright holder not be used in advertising
+ * or publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holder makes no representations
* about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * "as is" without expressed or implied warranty.
*
* THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
* EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
- * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk
+ * Authors: Alan Hourihane <alanh@fairlite.demon.co.uk>,
* Mike Chapman <mike@paranoia.com>,
* Juanjo Santamarta <santamarta@ctv.es>,
- * Mitani Hiroshi <hmitani@drl.mei.co.jp>
- * David Thomas <davtom@dream.org.uk>
- * Thomas Winischhofer <thomas@winischhofer.net>
+ * Mitani Hiroshi <hmitani@drl.mei.co.jp>,
+ * David Thomas <davtom@dream.org.uk>,
+ * Thomas Winischhofer <thomas@winischhofer.net>.
*/
diff --git a/src/sis_common.h b/src/sis_common.h
index c5db1e8..0aa6599 100644
--- a/src/sis_common.h
+++ b/src/sis_common.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_common.h,v 1.2 2003/10/30 18:53:42 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_common.h,v 1.3 2004/01/03 20:08:02 twini Exp $ */
/*
* Common header definitions for SiS 2D/3D/DRM suite
*
@@ -6,16 +6,16 @@
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
+ * the above copyright notice appears in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * and that the name of the copyright holder not be used in advertising
+ * or publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holder makes no representations
* about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * "as is" without expressed or implied warranty.
*
* THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
* EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
diff --git a/src/sis_cursor.c b/src/sis_cursor.c
index 122493f..7abf4e3 100644
--- a/src/sis_cursor.c
+++ b/src/sis_cursor.c
@@ -1,34 +1,38 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c,v 1.22 2003/11/03 17:02:53 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c,v 1.27 2004/01/23 22:29:04 twini Exp $ */
/*
* SiS hardware cursor handling
*
- * Copyright 1998,1999 by Alan Hourihane, Wigan, England.
- * Copyright 2001, 2002, 2003 by Thomas Winischhofer, Vienna, Austria.
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria.
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holders not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1) Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2) Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3) All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement: "This product includes
+ * software developed by Thomas Winischhofer, Vienna, Austria."
+ * 4) The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Author: Thomas Winischhofer <thomas@winischhofer.net>
+ *
+ * Idea based on code by Can-Ru Yeou, SiS Inc.
*
- * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk
- * Mike Chapman <mike@paranoia.com>,
- * Juanjo Santamarta <santamarta@ctv.es>,
- * Mitani Hiroshi <hmitani@drl.mei.co.jp>
- * David Thomas <davtom@dream.org.uk>.
- * Thomas Winischhofer <thomas@winischhofer.net>
*/
#include "xf86.h"
@@ -48,7 +52,6 @@
extern void SISWaitRetraceCRT1(ScrnInfoPtr pScrn);
extern void SISWaitRetraceCRT2(ScrnInfoPtr pScrn);
-extern Bool InRegion(int x, int y, region r);
/* Helper function for Xabre to convert mono image to ARGB */
/* The Xabre's cursor engine for CRT2 is buggy and can't
@@ -67,8 +70,6 @@ SiSXConvertMono2ARGB(SISPtr pSiS)
if(!dest || !src) return;
- if(pSiS->UseHWARGBCursor) return;
-
for(i = 0; i < 64; i++) {
for(j = 0; j < 8; j++) {
chunk = *(src + 8); mask = *src++;
@@ -106,23 +107,23 @@ SiS300HideCursor(ScrnInfoPtr pScrn)
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode && (!pSiS->ForceCursorOff)) {
- if(pSiS->SecondHead) {
- /* TW: Head 2 is always CRT1 */
- sis300DisableHWCursor()
- sis300SetCursorPositionY(2000, 0)
- } else {
- /* TW: Head 1 is always CRT2 */
- sis301DisableHWCursor()
- sis301SetCursorPositionY(2000, 0)
- }
+ if(pSiS->SecondHead) {
+ /* Head 2 is always CRT1 */
+ sis300DisableHWCursor()
+ sis300SetCursorPositionY(2000, 0)
+ } else {
+ /* Head 1 is always CRT2 */
+ sis301DisableHWCursor()
+ sis301SetCursorPositionY(2000, 0)
+ }
} else {
#endif
- sis300DisableHWCursor()
- sis300SetCursorPositionY(2000, 0)
- if(pSiS->VBFlags & CRT2_ENABLE) {
- sis301DisableHWCursor()
- sis301SetCursorPositionY(2000, 0)
- }
+ sis300DisableHWCursor()
+ sis300SetCursorPositionY(2000, 0)
+ if(pSiS->VBFlags & CRT2_ENABLE) {
+ sis301DisableHWCursor()
+ sis301SetCursorPositionY(2000, 0)
+ }
#ifdef SISDUALHEAD
}
#endif
@@ -137,33 +138,23 @@ SiS310HideCursor(ScrnInfoPtr pScrn)
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode && (!pSiS->ForceCursorOff)) {
- if(pSiS->SecondHead) {
- /* TW: Head 2 is always CRT1 */
- sis310DisableHWCursor()
- sis310SetCursorPositionY(2000, 0)
- } else {
- /* TW: Head 1 is always CRT2 */
- if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
- sis301DisableHWCursor330()
- sis301SetCursorPositionY330(2000, 0)
- } else {
- sis301DisableHWCursor310()
- sis301SetCursorPositionY310(2000, 0)
- }
- }
+ if(pSiS->SecondHead) {
+ /* Head 2 is always CRT1 */
+ sis310DisableHWCursor()
+ sis310SetCursorPositionY(2000, 0)
+ } else {
+ /* Head 1 is always CRT2 */
+ sis301DisableHWCursor310()
+ sis301SetCursorPositionY310(2000, 0)
+ }
} else {
#endif
- sis310DisableHWCursor()
- sis310SetCursorPositionY(2000, 0)
- if(pSiS->VBFlags & VB_VIDEOBRIDGE) {
- if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
- sis301DisableHWCursor330()
- sis301SetCursorPositionY330(2000, 0)
- } else {
- sis301DisableHWCursor310()
- sis301SetCursorPositionY310(2000, 0)
- }
- }
+ sis310DisableHWCursor()
+ sis310SetCursorPositionY(2000, 0)
+ if(pSiS->VBFlags & VB_VIDEOBRIDGE) {
+ sis301DisableHWCursor310()
+ sis301SetCursorPositionY310(2000, 0)
+ }
#ifdef SISDUALHEAD
}
#endif
@@ -196,50 +187,50 @@ SiS300ShowCursor(ScrnInfoPtr pScrn)
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
- if(pSiS->SecondHead) {
- /* TW: Head 2 is always CRT1 */
- if(pSiS->UseHWARGBCursor) {
-#ifdef SIS300_USE_ARGB16
- sis300EnableHWARGB16Cursor()
+ if(pSiS->SecondHead) {
+ /* Head 2 is always CRT1 */
+ if(pSiS->UseHWARGBCursor) {
+#ifdef SIS300_USE_ARGB16
+ sis300EnableHWARGB16Cursor()
#else
- sis300EnableHWARGBCursor()
-#endif
- } else {
- sis300EnableHWCursor()
- }
- } else {
- /* TW: Head 1 is always CRT2 */
- if(pSiS->UseHWARGBCursor) {
-#ifdef SIS300_USE_ARGB16
- sis301EnableHWARGB16Cursor()
+ sis300EnableHWARGBCursor()
+#endif
+ } else {
+ sis300EnableHWCursor()
+ }
+ } else {
+ /* Head 1 is always CRT2 */
+ if(pSiS->UseHWARGBCursor) {
+#ifdef SIS300_USE_ARGB16
+ sis301EnableHWARGB16Cursor()
#else
- sis301EnableHWARGBCursor()
-#endif
- } else {
- sis301EnableHWCursor()
- }
- }
+ sis301EnableHWARGBCursor()
+#endif
+ } else {
+ sis301EnableHWCursor()
+ }
+ }
} else {
#endif
- if(pSiS->UseHWARGBCursor) {
+ if(pSiS->UseHWARGBCursor) {
#ifdef SIS300_USE_ARGB16
- sis300EnableHWARGB16Cursor()
+ sis300EnableHWARGB16Cursor()
#else
- sis300EnableHWARGBCursor()
-#endif
- if(pSiS->VBFlags & CRT2_ENABLE) {
-#ifdef SIS300_USE_ARGB16
- sis301EnableHWARGB16Cursor()
+ sis300EnableHWARGBCursor()
+#endif
+ if(pSiS->VBFlags & CRT2_ENABLE) {
+#ifdef SIS300_USE_ARGB16
+ sis301EnableHWARGB16Cursor()
#else
- sis301EnableHWARGBCursor()
-#endif
- }
- } else {
- sis300EnableHWCursor()
- if(pSiS->VBFlags & CRT2_ENABLE) {
- sis301EnableHWCursor()
- }
- }
+ sis301EnableHWARGBCursor()
+#endif
+ }
+ } else {
+ sis300EnableHWCursor()
+ if(pSiS->VBFlags & CRT2_ENABLE) {
+ sis301EnableHWCursor()
+ }
+ }
#ifdef SISDUALHEAD
}
#endif
@@ -260,49 +251,49 @@ SiS310ShowCursor(ScrnInfoPtr pScrn)
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
- if(pSiS->SecondHead) {
- /* TW: Head 2 is always CRT1 */
- if(pSiS->UseHWARGBCursor) {
- sis310EnableHWARGBCursor()
- } else {
- sis310EnableHWCursor()
- }
- } else {
- /* TW: Head 1 is always CRT2 */
- if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
- sis301EnableHWCursor330()
- } else {
- if(pSiS->UseHWARGBCursor) {
- sis301EnableHWARGBCursor310()
- } else {
- sis301EnableHWCursor310()
- }
- }
- }
+ if(pSiS->SecondHead) {
+ /* Head 2 is always CRT1 */
+ if(pSiS->UseHWARGBCursor) {
+ sis310EnableHWARGBCursor()
+ } else {
+ sis310EnableHWCursor()
+ }
+ } else {
+ /* Head 1 is always CRT2 */
+ if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
+ sis301EnableHWCursor330()
+ } else {
+ if(pSiS->UseHWARGBCursor) {
+ sis301EnableHWARGBCursor310()
+ } else {
+ sis301EnableHWCursor310()
+ }
+ }
+ }
} else {
#endif
- if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
- if(pSiS->UseHWARGBCursor) {
- sis310EnableHWARGBCursor()
- } else {
- sis310EnableHWCursor()
- }
- if(pSiS->VBFlags & CRT2_ENABLE) {
- sis301EnableHWCursor330()
- }
- } else {
- if(pSiS->UseHWARGBCursor) {
- sis310EnableHWARGBCursor()
- if(pSiS->VBFlags & CRT2_ENABLE) {
- sis301EnableHWARGBCursor310()
- }
- } else {
- sis310EnableHWCursor()
- if(pSiS->VBFlags & CRT2_ENABLE) {
- sis301EnableHWCursor310()
- }
- }
- }
+ if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
+ if(pSiS->UseHWARGBCursor) {
+ sis310EnableHWARGBCursor()
+ } else {
+ sis310EnableHWCursor()
+ }
+ if(pSiS->VBFlags & CRT2_ENABLE) {
+ sis301EnableHWCursor330()
+ }
+ } else {
+ if(pSiS->UseHWARGBCursor) {
+ sis310EnableHWARGBCursor()
+ if(pSiS->VBFlags & CRT2_ENABLE) {
+ sis301EnableHWARGBCursor310()
+ }
+ } else {
+ sis310EnableHWCursor()
+ if(pSiS->VBFlags & CRT2_ENABLE) {
+ sis301EnableHWCursor310()
+ }
+ }
+ }
#ifdef SISDUALHEAD
}
#endif
@@ -312,7 +303,7 @@ static void
SiSSetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
{
SISPtr pSiS = SISPTR(pScrn);
- DisplayModePtr mode = pSiS->CurrentLayout.mode; /* pScrn->currentMode; */
+ DisplayModePtr mode = pSiS->CurrentLayout.mode;
unsigned char x_preset = 0;
unsigned char y_preset = 0;
int temp;
@@ -324,14 +315,14 @@ SiSSetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
#endif
- if (x < 0) {
- x_preset = (-x);
- x = 0;
+ if(x < 0) {
+ x_preset = (-x);
+ x = 0;
}
- if (y < 0) {
- y_preset = (-y);
- y = 0;
+ if(y < 0) {
+ y_preset = (-y);
+ y = 0;
}
if(mode->Flags & V_INTERLACE) y /= 2;
@@ -377,24 +368,24 @@ SiSSetCursorPositionMerged(ScrnInfoPtr pScrn1, int x, int y)
if((pSiS->VGAEngine == SIS_300_VGA) && (pSiS->UseHWARGBCursor)) maxpreset = 31;
if(x1 < 0) {
- x1_preset = (-x1);
- if(x1_preset > maxpreset) x1_preset = maxpreset;
- x1 = 0;
+ x1_preset = (-x1);
+ if(x1_preset > maxpreset) x1_preset = maxpreset;
+ x1 = 0;
}
if(y1 < 0) {
- y1_preset = (-y1);
- if(y1_preset > maxpreset) y1_preset = maxpreset;
- y1 = 0;
+ y1_preset = (-y1);
+ if(y1_preset > maxpreset) y1_preset = maxpreset;
+ y1 = 0;
}
if(x2 < 0) {
- x2_preset = (-x2);
- if(x2_preset > maxpreset) x2_preset = maxpreset;
- x2 = 0;
+ x2_preset = (-x2);
+ if(x2_preset > maxpreset) x2_preset = maxpreset;
+ x2 = 0;
}
if(y2 < 0) {
- y2_preset = (-y2);
- if(y2_preset > maxpreset) y2_preset = maxpreset;
- y2 = 0;
+ y2_preset = (-y2);
+ if(y2_preset > maxpreset) y2_preset = maxpreset;
+ y2 = 0;
}
if(mode1->Flags & V_INTERLACE) { y1 /= 2; y1_preset /= 2; }
@@ -415,13 +406,8 @@ SiSSetCursorPositionMerged(ScrnInfoPtr pScrn1, int x, int y)
} else {
sis310SetCursorPositionX(x1, x1_preset)
sis310SetCursorPositionY(y1, y1_preset)
- if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
- sis301SetCursorPositionX330(x2 + 17, x2_preset)
- sis301SetCursorPositionY330(y2, y2_preset)
- } else {
- sis301SetCursorPositionX310(x2 + 17, x2_preset)
- sis301SetCursorPositionY310(y2, y2_preset)
- }
+ sis301SetCursorPositionX310(x2 + 17, x2_preset)
+ sis301SetCursorPositionY310(y2, y2_preset)
}
}
#endif
@@ -441,13 +427,13 @@ SiS300SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
}
#endif
- if (x < 0) {
- x_preset = (-x);
- x = 0;
+ if(x < 0) {
+ x_preset = (-x);
+ x = 0;
}
- if (y < 0) {
- y_preset = (-y);
- y = 0;
+ if(y < 0) {
+ y_preset = (-y);
+ y = 0;
}
if(mode->Flags & V_INTERLACE) y /= 2;
@@ -455,23 +441,23 @@ SiS300SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
- if(pSiS->SecondHead) {
- /* TW: Head 2 is always CRT1 */
- sis300SetCursorPositionX(x, x_preset)
- sis300SetCursorPositionY(y, y_preset)
- } else {
- /* TW: Head 1 is always CRT2 */
- sis301SetCursorPositionX(x + 13, x_preset)
- sis301SetCursorPositionY(y, y_preset)
- }
+ if(pSiS->SecondHead) {
+ /* Head 2 is always CRT1 */
+ sis300SetCursorPositionX(x, x_preset)
+ sis300SetCursorPositionY(y, y_preset)
+ } else {
+ /* Head 1 is always CRT2 */
+ sis301SetCursorPositionX(x + 13, x_preset)
+ sis301SetCursorPositionY(y, y_preset)
+ }
} else {
#endif
- sis300SetCursorPositionX(x, x_preset)
- sis300SetCursorPositionY(y, y_preset)
- if(pSiS->VBFlags & CRT2_ENABLE) {
- sis301SetCursorPositionX(x + 13, x_preset)
- sis301SetCursorPositionY(y, y_preset)
- }
+ sis300SetCursorPositionX(x, x_preset)
+ sis300SetCursorPositionY(y, y_preset)
+ if(pSiS->VBFlags & CRT2_ENABLE) {
+ sis301SetCursorPositionX(x + 13, x_preset)
+ sis301SetCursorPositionY(y, y_preset)
+ }
#ifdef SISDUALHEAD
}
#endif
@@ -492,13 +478,13 @@ SiS310SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
}
#endif
- if (x < 0) {
- x_preset = (-x);
- x = 0;
+ if(x < 0) {
+ x_preset = (-x);
+ x = 0;
}
- if (y < 0) {
- y_preset = (-y);
- y = 0;
+ if(y < 0) {
+ y_preset = (-y);
+ y = 0;
}
if(mode->Flags & V_INTERLACE) y /= 2;
@@ -506,32 +492,22 @@ SiS310SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
- if(pSiS->SecondHead) {
- /* TW: Head 2 is always CRT1 */
- sis310SetCursorPositionX(x, x_preset)
- sis310SetCursorPositionY(y, y_preset)
- } else {
- /* TW: Head 1 is always CRT2 */
- if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
- sis301SetCursorPositionX330(x + 17, x_preset)
- sis301SetCursorPositionY330(y, y_preset)
- } else {
- sis301SetCursorPositionX310(x + 17, x_preset)
- sis301SetCursorPositionY310(y, y_preset)
- }
- }
+ if(pSiS->SecondHead) {
+ /* Head 2 is always CRT1 */
+ sis310SetCursorPositionX(x, x_preset)
+ sis310SetCursorPositionY(y, y_preset)
+ } else {
+ /* Head 1 is always CRT2 */
+ sis301SetCursorPositionX310(x + 17, x_preset)
+ sis301SetCursorPositionY310(y, y_preset)
+ }
} else {
#endif
sis310SetCursorPositionX(x, x_preset)
sis310SetCursorPositionY(y, y_preset)
if(pSiS->VBFlags & CRT2_ENABLE) {
- if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
- sis301SetCursorPositionX330(x + 17, x_preset)
- sis301SetCursorPositionY330(y, y_preset)
- } else {
- sis301SetCursorPositionX310(x + 17, x_preset)
- sis301SetCursorPositionY310(y, y_preset)
- }
+ sis301SetCursorPositionX310(x + 17, x_preset)
+ sis301SetCursorPositionY310(y, y_preset)
}
#ifdef SISDUALHEAD
}
@@ -579,23 +555,23 @@ SiS300SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
- if(pSiS->SecondHead) {
- /* TW: Head 2 is always CRT1 */
- sis300SetCursorBGColor(bg)
- sis300SetCursorFGColor(fg)
- } else {
- /* TW: Head 1 is always CRT2 */
- sis301SetCursorBGColor(bg)
- sis301SetCursorFGColor(fg)
- }
+ if(pSiS->SecondHead) {
+ /* Head 2 is always CRT1 */
+ sis300SetCursorBGColor(bg)
+ sis300SetCursorFGColor(fg)
+ } else {
+ /* Head 1 is always CRT2 */
+ sis301SetCursorBGColor(bg)
+ sis301SetCursorFGColor(fg)
+ }
} else {
#endif
- sis300SetCursorBGColor(bg)
- sis300SetCursorFGColor(fg)
- if(pSiS->VBFlags & CRT2_ENABLE) {
- sis301SetCursorBGColor(bg)
- sis301SetCursorFGColor(fg)
- }
+ sis300SetCursorBGColor(bg)
+ sis300SetCursorFGColor(fg)
+ if(pSiS->VBFlags & CRT2_ENABLE) {
+ sis301SetCursorBGColor(bg)
+ sis301SetCursorFGColor(fg)
+ }
#ifdef SISDUALHEAD
}
#endif
@@ -611,39 +587,39 @@ SiS310SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
if(pSiS->SecondHead) {
- /* TW: Head 2 is always CRT1 */
- sis310SetCursorBGColor(bg)
- sis310SetCursorFGColor(fg)
+ /* Head 2 is always CRT1 */
+ sis310SetCursorBGColor(bg)
+ sis310SetCursorFGColor(fg)
} else {
- /* TW: Head 1 is always CRT2 */
- if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
- if((fg != pSiS->CurFGCol) || (bg != pSiS->CurBGCol)) {
- pSiS->CurFGCol = fg;
- pSiS->CurBGCol = bg;
- SiSXConvertMono2ARGB(pSiS);
- }
- } else {
- sis301SetCursorBGColor310(bg)
- sis301SetCursorFGColor310(fg)
- }
- }
- } else {
-#endif
- sis310SetCursorBGColor(bg)
- sis310SetCursorFGColor(fg)
-
- if(pSiS->VBFlags & CRT2_ENABLE) {
+ /* Head 1 is always CRT2 */
if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
if((fg != pSiS->CurFGCol) || (bg != pSiS->CurBGCol)) {
- pSiS->CurFGCol = fg;
- pSiS->CurBGCol = bg;
- SiSXConvertMono2ARGB(pSiS);
+ pSiS->CurFGCol = fg;
+ pSiS->CurBGCol = bg;
+ SiSXConvertMono2ARGB(pSiS);
}
} else {
sis301SetCursorBGColor310(bg)
sis301SetCursorFGColor310(fg)
}
- }
+ }
+ } else {
+#endif
+ sis310SetCursorBGColor(bg)
+ sis310SetCursorFGColor(fg)
+
+ if(pSiS->VBFlags & CRT2_ENABLE) {
+ if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
+ if((fg != pSiS->CurFGCol) || (bg != pSiS->CurBGCol)) {
+ pSiS->CurFGCol = fg;
+ pSiS->CurBGCol = bg;
+ SiSXConvertMono2ARGB(pSiS);
+ }
+ } else {
+ sis301SetCursorBGColor310(bg)
+ sis301SetCursorFGColor310(fg)
+ }
+ }
#ifdef SISDUALHEAD
}
#endif
@@ -743,35 +719,33 @@ SiS300LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
}
if(pSiS->UseHWARGBCursor) {
- if(pSiS->VBFlags & DISPTYPE_CRT1) {
- status1 = sis300GetCursorStatus;
- sis300DisableHWCursor()
- if(pSiS->VBFlags & CRT2_ENABLE) {
- status2 = sis301GetCursorStatus;
- sis301DisableHWCursor()
- }
- SISWaitRetraceCRT1(pScrn);
- sis300SwitchToMONOCursor();
- if(pSiS->VBFlags & CRT2_ENABLE) {
- SISWaitRetraceCRT2(pScrn);
- sis301SwitchToMONOCursor();
- }
- }
+ if(pSiS->VBFlags & DISPTYPE_CRT1) {
+ status1 = sis300GetCursorStatus;
+ sis300DisableHWCursor()
+ if(pSiS->VBFlags & CRT2_ENABLE) {
+ status2 = sis301GetCursorStatus;
+ sis301DisableHWCursor()
+ }
+ SISWaitRetraceCRT1(pScrn);
+ sis300SwitchToMONOCursor();
+ if(pSiS->VBFlags & CRT2_ENABLE) {
+ SISWaitRetraceCRT2(pScrn);
+ sis301SwitchToMONOCursor();
+ }
+ }
}
sis300SetCursorAddress(cursor_addr);
- sis300SetCursorPatternSelect(0);
if(status1) sis300SetCursorStatus(status1)
if(pSiS->VBFlags & CRT2_ENABLE) {
- if((pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) {
- status2 = sis301GetCursorStatus;
- sis301DisableHWCursor()
- SISWaitRetraceCRT2(pScrn);
- sis301SwitchToMONOCursor();
- }
- sis301SetCursorAddress(cursor_addr)
- sis301SetCursorPatternSelect(0)
- if(status2) sis301SetCursorStatus(status2)
+ if((pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) {
+ status2 = sis301GetCursorStatus;
+ sis301DisableHWCursor()
+ SISWaitRetraceCRT2(pScrn);
+ sis301SwitchToMONOCursor();
+ }
+ sis301SetCursorAddress(cursor_addr)
+ if(status2) sis301SetCursorStatus(status2)
}
pSiS->UseHWARGBCursor = FALSE;
@@ -785,8 +759,19 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
CARD32 status1 = 0, status2 = 0;
unsigned char *dest = pSiS->FbBase;
BOOLEAN sizedouble = FALSE;
+ int bufnum;
#ifdef SISDUALHEAD
SISEntPtr pSiSEnt = pSiS->entityPrivate;
+
+ if(pSiS->DualHeadMode) {
+ pSiSEnt->HWCursorMBufNum ^= 1;
+ bufnum = 1 << pSiSEnt->HWCursorMBufNum;
+ } else {
+#endif
+ pSiS->HWCursorMBufNum ^= 1;
+ bufnum = 1 << pSiS->HWCursorMBufNum;
+#ifdef SISDUALHEAD
+ }
#endif
#ifdef SISMERGED
@@ -800,13 +785,17 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
sizedouble = TRUE;
}
- cursor_addr = pScrn->videoRam - pSiS->cursorOffset - (pSiS->CursorSize/1024); /* 1K boundary */
-
#ifdef SISDUALHEAD
- /* TW: Use the global (real) FbBase in DHM */
+ /* Use the global (real) FbBase in DHM */
if(pSiS->DualHeadMode) dest = pSiSEnt->FbBase;
#endif
+ if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
+ cursor_addr = pScrn->videoRam - pSiS->cursorOffset - (pSiS->CursorSize/1024);
+ } else {
+ cursor_addr = pScrn->videoRam - pSiS->cursorOffset - ((pSiS->CursorSize/1024) * bufnum);
+ }
+
if(sizedouble) {
int i;
for(i = 0; i < 32; i++) {
@@ -831,46 +820,44 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
SiSXConvertMono2ARGB(pSiS);
if(pSiS->UseHWARGBCursor) {
- if(pSiS->VBFlags & DISPTYPE_CRT1) {
- status1 = sis310GetCursorStatus;
- sis310DisableHWCursor();
- SISWaitRetraceCRT1(pScrn);
- sis310SwitchToMONOCursor();
- }
- }
+ if(pSiS->VBFlags & DISPTYPE_CRT1) {
+ status1 = sis310GetCursorStatus;
+ sis310DisableHWCursor();
+ SISWaitRetraceCRT1(pScrn);
+ sis310SwitchToMONOCursor();
+ }
+ }
} else {
if(pSiS->UseHWARGBCursor) {
- if(pSiS->VBFlags & DISPTYPE_CRT1) {
- status1 = sis310GetCursorStatus;
- sis310DisableHWCursor()
- if(pSiS->VBFlags & CRT2_ENABLE) {
- status2 = sis301GetCursorStatus310;
- sis301DisableHWCursor310()
- }
- SISWaitRetraceCRT1(pScrn);
- sis310SwitchToMONOCursor();
- if(pSiS->VBFlags & CRT2_ENABLE) {
- SISWaitRetraceCRT2(pScrn);
- sis301SwitchToMONOCursor310();
- }
- }
- } else if(pSiS->Chipset == PCI_CHIP_SIS315H) {
- if(pSiS->VBFlags & DISPTYPE_CRT1) {
- SISWaitRetraceCRT1(pScrn);
- }
- }
+ if(pSiS->VBFlags & DISPTYPE_CRT1) {
+ status1 = sis310GetCursorStatus;
+ sis310DisableHWCursor()
+ if(pSiS->VBFlags & CRT2_ENABLE) {
+ status2 = sis301GetCursorStatus310;
+ sis301DisableHWCursor310()
+ }
+ SISWaitRetraceCRT1(pScrn);
+ sis310SwitchToMONOCursor();
+ if(pSiS->VBFlags & CRT2_ENABLE) {
+ SISWaitRetraceCRT2(pScrn);
+ sis301SwitchToMONOCursor310();
+ }
+ }
+ } else if(pSiS->Chipset == PCI_CHIP_SIS315H) {
+ if(pSiS->VBFlags & DISPTYPE_CRT1) {
+ SISWaitRetraceCRT1(pScrn);
+ }
+ }
}
sis310SetCursorAddress(cursor_addr);
- sis310SetCursorPatternSelect(0);
if(status1) sis310SetCursorStatus(status1)
if(pSiS->VBFlags & CRT2_ENABLE) {
if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
- sis301SetCursorAddress330(cursor_addr2)
- sis301SetCursorPatternSelect330(0)
+ sis301SetCursorAddress310(cursor_addr2)
} else {
if((pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) {
status2 = sis301GetCursorStatus310;
@@ -879,7 +866,6 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
sis301SwitchToMONOCursor310();
}
sis301SetCursorAddress310(cursor_addr)
- sis301SetCursorPatternSelect310(0)
if(status2) sis301SetCursorStatus310(status2)
}
}
@@ -892,15 +878,15 @@ SiSUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
SISPtr pSiS = SISPTR(pScrn);
- DisplayModePtr mode = pSiS->CurrentLayout.mode; /* pScrn->currentMode; */
-
+ DisplayModePtr mode = pSiS->CurrentLayout.mode;
+
if(pSiS->Chipset != PCI_CHIP_SIS6326) return TRUE;
if(!(pSiS->SiS6326Flags & SIS6326_TVDETECTED)) return TRUE;
if((strcmp(mode->name, "PAL800x600U") == 0) ||
(strcmp(mode->name, "NTSC640x480U") == 0))
- return FALSE;
+ return FALSE;
else
- return TRUE;
+ return TRUE;
}
static Bool
@@ -908,7 +894,7 @@ SiS300UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
SISPtr pSiS = SISPTR(pScrn);
- DisplayModePtr mode = pSiS->CurrentLayout.mode; /* pScrn->currentMode; */
+ DisplayModePtr mode = pSiS->CurrentLayout.mode;
#ifdef SISMERGED
DisplayModePtr mode2 = NULL;
@@ -923,9 +909,9 @@ SiS300UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
case PCI_CHIP_SIS630:
case PCI_CHIP_SIS540:
if(mode->Flags & V_INTERLACE)
- return FALSE;
+ return FALSE;
if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32))
- return FALSE;
+ return FALSE;
#ifdef SISMERGED
if(pSiS->MergedFB) {
if(mode2->Flags & V_INTERLACE)
@@ -935,17 +921,22 @@ SiS300UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
}
#endif
break;
+ case PCI_CHIP_SIS330:
+#ifdef SISDUALHEAD
+ if((!pSiS->DualHeadMode) || (!pSiS->SecondHead))
+#endif
+ if(pSiS->MiscFlags & MISC_TVNTSC1024) return FALSE;
+ /* fall through */
case PCI_CHIP_SIS550:
case PCI_CHIP_SIS650:
case PCI_CHIP_SIS315:
case PCI_CHIP_SIS315H:
case PCI_CHIP_SIS315PRO:
- case PCI_CHIP_SIS330:
case PCI_CHIP_SIS660:
if(mode->Flags & V_INTERLACE)
- return FALSE;
+ return FALSE;
if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32))
- return FALSE;
+ return FALSE;
#ifdef SISMERGED
if(pSiS->MergedFB) {
if(mode2->Flags & V_INTERLACE)
@@ -954,24 +945,12 @@ SiS300UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
return FALSE;
}
#endif
- if(pSiS->Chipset == PCI_CHIP_SIS330) {
- if((pSiS->VBFlags & VB_SISBRIDGE) &&
- (pSiS->VBFlags & CRT2_TV) &&
- (pSiS->VBFlags & (TV_NTSC|TV_PALM))) {
-#ifdef SISMERGED
- if(pSiS->MergedFB) {
- if(mode2->HDisplay == 1024) return FALSE;
- } else
-#endif
- if(mode->HDisplay == 1024) return FALSE;
- }
- }
break;
default:
if(mode->Flags & V_INTERLACE)
- return FALSE;
+ return FALSE;
if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32))
- return FALSE;
+ return FALSE;
break;
}
return TRUE;
@@ -985,7 +964,7 @@ SiSUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
SISPtr pSiS = SISPTR(pScrn);
- DisplayModePtr mode = pSiS->CurrentLayout.mode; /* pScrn->currentMode; */
+ DisplayModePtr mode = pSiS->CurrentLayout.mode;
#ifdef SISMERGED
DisplayModePtr mode2 = NULL;
@@ -1000,11 +979,11 @@ SiSUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs)
case PCI_CHIP_SIS630:
case PCI_CHIP_SIS540:
if(mode->Flags & V_INTERLACE)
- return FALSE;
- if(pCurs->bits->height > 32 || pCurs->bits->width > 32)
- return FALSE;
+ return FALSE;
+ if((pCurs->bits->height > 32) || (pCurs->bits->width > 32))
+ return FALSE;
if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 16))
- return FALSE;
+ return FALSE;
#ifdef SISMERGED
if(pSiS->MergedFB) {
if(mode2->Flags & V_INTERLACE)
@@ -1014,28 +993,26 @@ SiSUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs)
}
#endif
break;
+ case PCI_CHIP_SIS330:
+#ifdef SISDUALHEAD
+ if((!pSiS->DualHeadMode) || (!pSiS->SecondHead))
+#endif
+ if(pSiS->MiscFlags & MISC_TVNTSC1024) return FALSE;
+ /* fall through */
case PCI_CHIP_SIS550:
case PCI_CHIP_SIS650:
case PCI_CHIP_SIS315:
case PCI_CHIP_SIS315H:
case PCI_CHIP_SIS315PRO:
- case PCI_CHIP_SIS330:
case PCI_CHIP_SIS660:
if(mode->Flags & V_INTERLACE)
- return FALSE;
- if(pCurs->bits->height > 64 || pCurs->bits->width > 64)
- return FALSE;
- if(mode->Flags & V_DBLSCAN) {
- if(pCurs->bits->height > 32)
- return FALSE;
-#ifdef SISDUALHEAD
- if((!pSiS->DualHeadMode) || (pSiS->SecondHead))
-#endif
- if(pSiS->VBFlags & CRT1_LCDA)
- return FALSE;
- }
+ return FALSE;
+ if((pCurs->bits->height > 64) || (pCurs->bits->width > 64))
+ return FALSE;
+ if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32))
+ return FALSE;
if((pSiS->CurrentLayout.bitsPerPixel == 8) && (pSiS->VBFlags & CRT2_ENABLE))
- return FALSE;
+ return FALSE;
#ifdef SISMERGED
if(pSiS->MergedFB) {
if(mode2->Flags & V_INTERLACE)
@@ -1044,20 +1021,8 @@ SiSUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs)
return FALSE;
}
#endif
- if(pSiS->Chipset == PCI_CHIP_SIS330) {
- if((pSiS->VBFlags & VB_SISBRIDGE) &&
- (pSiS->VBFlags & CRT2_TV) &&
- (pSiS->VBFlags & (TV_NTSC|TV_PALM))) {
-#ifdef SISMERGED
- if(pSiS->MergedFB) {
- if(mode2->HDisplay == 1024) return FALSE;
- } else
-#endif
- if(mode->HDisplay == 1024) return FALSE;
- }
- }
break;
- default:
+ default:
return FALSE;
}
return TRUE;
@@ -1109,10 +1074,10 @@ static void SiS300LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
dest = (MYSISPTRTYPE *)((unsigned char *)pSiS->FbBase + (cursor_addr * 1024));
if(sizedouble) {
- if(srcheight > 16) srcheight = 16;
- maxheight = 16;
+ if(srcheight > 16) srcheight = 16;
+ maxheight = 16;
}
-
+
#ifdef SIS300_USE_ARGB16 /* Use 16 Bit RGB pointer */
for(i = 0; i < srcheight; i++) {
p = src;
@@ -1192,35 +1157,34 @@ static void SiS300LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
#endif
if(!pSiS->UseHWARGBCursor) {
- if(pSiS->VBFlags & DISPTYPE_CRT1) {
- status1 = sis300GetCursorStatus;
- sis300DisableHWCursor()
- if(pSiS->VBFlags & CRT2_ENABLE) {
- status2 = sis301GetCursorStatus;
- sis301DisableHWCursor()
- }
- SISWaitRetraceCRT1(pScrn);
- sis300SwitchToRGBCursor();
- if(pSiS->VBFlags & CRT2_ENABLE) {
- SISWaitRetraceCRT2(pScrn);
- sis301SwitchToRGBCursor();
- }
- }
+ if(pSiS->VBFlags & DISPTYPE_CRT1) {
+ status1 = sis300GetCursorStatus;
+ sis300DisableHWCursor()
+ if(pSiS->VBFlags & CRT2_ENABLE) {
+ status2 = sis301GetCursorStatus;
+ sis301DisableHWCursor()
+ }
+ SISWaitRetraceCRT1(pScrn);
+ sis300SwitchToRGBCursor();
+ if(pSiS->VBFlags & CRT2_ENABLE) {
+ SISWaitRetraceCRT2(pScrn);
+ sis301SwitchToRGBCursor();
+ }
+ }
}
+
sis300SetCursorAddress(cursor_addr);
- sis300SetCursorPatternSelect(0);
if(status1) sis300SetCursorStatus(status1)
- if(pSiS->VBFlags & CRT2_ENABLE) {
- if((!pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) {
- status2 = sis301GetCursorStatus;
- sis301DisableHWCursor()
- SISWaitRetraceCRT2(pScrn);
- sis301SwitchToRGBCursor();
- }
- sis301SetCursorAddress(cursor_addr)
- sis301SetCursorPatternSelect(0)
- if(status2) sis301SetCursorStatus(status2)
+ if(pSiS->VBFlags & CRT2_ENABLE) {
+ if((!pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) {
+ status2 = sis301GetCursorStatus;
+ sis301DisableHWCursor()
+ SISWaitRetraceCRT2(pScrn);
+ sis301SwitchToRGBCursor();
+ }
+ sis301SetCursorAddress(cursor_addr)
+ if(status2) sis301SetCursorStatus(status2)
}
pSiS->UseHWARGBCursor = TRUE;
@@ -1235,6 +1199,7 @@ static void SiS310LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
int srcheight = pCurs->bits->height;
CARD32 status1 = 0, status2 = 0;
BOOLEAN sizedouble = FALSE;
+ int bufnum;
#ifdef SISDUALHEAD
SISEntPtr pSiSEnt = pSiS->entityPrivate;
#endif
@@ -1250,44 +1215,61 @@ static void SiS310LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
sizedouble = TRUE;
}
- cursor_addr = pScrn->videoRam - pSiS->cursorOffset - ((pSiS->CursorSize/1024) * 2);
+#ifdef SISDUALHEAD
+ if(pSiS->DualHeadMode) {
+ pSiSEnt->HWCursorCBufNum ^= 1;
+ bufnum = 1 << pSiSEnt->HWCursorCBufNum;
+ } else {
+#endif
+ pSiS->HWCursorCBufNum ^= 1;
+ bufnum = 1 << pSiS->HWCursorCBufNum;
+#ifdef SISDUALHEAD
+ }
+#endif
+
+ if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
+ cursor_addr = pScrn->videoRam - pSiS->cursorOffset - ((pSiS->CursorSize/1024) * 2);
+ } else {
+ cursor_addr = pScrn->videoRam - pSiS->cursorOffset - ((pSiS->CursorSize/1024) * (2 + bufnum));
+ }
if(srcwidth > 64) srcwidth = 64;
if(srcheight > 64) srcheight = 64;
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode)
- /* TW: Use the global (real) FbBase in DHM */
- dest = (CARD32 *)((unsigned char *)pSiSEnt->FbBase + (cursor_addr * 1024));
+ /* Use the global (real) FbBase in DHM */
+ dest = (CARD32 *)((unsigned char *)pSiSEnt->FbBase + (cursor_addr * 1024));
else
#endif
- dest = (CARD32 *)((unsigned char *)pSiS->FbBase + (cursor_addr * 1024));
+ dest = (CARD32 *)((unsigned char *)pSiS->FbBase + (cursor_addr * 1024));
if(sizedouble) {
- if(srcheight > 32) srcheight = 32;
- maxheight = 32;
+ if(srcheight > 32) srcheight = 32;
+ maxheight = 32;
}
for(i = 0; i < srcheight; i++) {
- p = src;
- pb = dest;
- src += pCurs->bits->width;
- for(j = 0; j < srcwidth; j++) *dest++ = *p++;
- if(srcwidth < 64) {
- for(; j < 64; j++) *dest++ = 0;
- }
- if(sizedouble) {
- for(j = 0; j < 64; j++) {
- *dest++ = *pb++;
- }
- }
+ p = src;
+ pb = dest;
+ src += pCurs->bits->width;
+ for(j = 0; j < srcwidth; j++) *dest++ = *p++;
+ if(srcwidth < 64) {
+ for(; j < 64; j++) *dest++ = 0;
+ }
+ if(sizedouble) {
+ for(j = 0; j < 64; j++) {
+ *dest++ = *pb++;
+ }
+ }
}
if(srcheight < maxheight) {
- for(; i < maxheight; i++)
- for(j = 0; j < 64; j++) *dest++ = 0;
- if(sizedouble) {
- for(j = 0; j < 64; j++) *dest++ = 0;
- }
+ for(; i < maxheight; i++) {
+ for(j = 0; j < 64; j++) *dest++ = 0;
+ if(sizedouble) {
+ for(j = 0; j < 64; j++) *dest++ = 0;
+ }
+ }
}
if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
@@ -1322,13 +1304,11 @@ static void SiS310LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
}
sis310SetCursorAddress(cursor_addr);
- sis310SetCursorPatternSelect(0);
if(status1) sis310SetCursorStatus(status1)
if(pSiS->VBFlags & CRT2_ENABLE) {
if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
- sis301SetCursorAddress330(cursor_addr)
- sis301SetCursorPatternSelect330(0)
+ sis301SetCursorAddress310(cursor_addr)
} else {
if((!pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) {
status2 = sis301GetCursorStatus310;
@@ -1337,7 +1317,6 @@ static void SiS310LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
sis301SwitchToRGBCursor310();
}
sis301SetCursorAddress310(cursor_addr)
- sis301SetCursorPatternSelect310(0)
if(status2) sis301SetCursorStatus310(status2)
}
}
@@ -1400,7 +1379,7 @@ SiSHWCursorInit(ScreenPtr pScreen)
case PCI_CHIP_SIS315PRO:
case PCI_CHIP_SIS330:
case PCI_CHIP_SIS660:
- infoPtr->MaxWidth = 64;
+ infoPtr->MaxWidth = 64;
infoPtr->MaxHeight = 64;
infoPtr->ShowCursor = SiS310ShowCursor;
infoPtr->HideCursor = SiS310HideCursor;
diff --git a/src/sis_cursor.h b/src/sis_cursor.h
index 5de0070..d34df48 100644
--- a/src/sis_cursor.h
+++ b/src/sis_cursor.h
@@ -1,38 +1,42 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.h,v 1.11 2003/10/30 18:53:42 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.h,v 1.15 2004/01/23 22:29:04 twini Exp $ */
/*
* SiS hardware cursor handling
* Definitions
*
- * Copyright 1998,1999 by Alan Hourihane, Wigan, England.
- * Copyright 2001, 2002, 2003 by Thomas Winischhofer, Vienna, Austria.
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria.
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holders not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1) Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2) Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3) All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement: "This product includes
+ * software developed by Thomas Winischhofer, Vienna, Austria."
+ * 4) The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Author: Thomas Winischhofer <thomas@winischhofer.net>
+ *
+ * Idea based on code by Can-Ru Yeou, SiS Inc.
*
- * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk
- * Mike Chapman <mike@paranoia.com>,
- * Juanjo Santamarta <santamarta@ctv.es>,
- * Mitani Hiroshi <hmitani@drl.mei.co.jp>
- * David Thomas <davtom@dream.org.uk>.
- * Thomas Winischhofer <thomas@winischhofer.net>:
*/
-#define CS(x) (0x8500+(x<<2))
+#define CS(x) (0x8500 + (x << 2))
/* 300 series, CRT1 */
@@ -118,20 +122,11 @@
{ \
unsigned long temp; \
temp = MMIO_IN32(pSiS->IOBase, CS(0)); \
- temp &= 0xFFFF0000; \
+ temp &= 0xF0FF0000; \
temp |= address; \
MMIO_OUT32(pSiS->IOBase,CS(0),temp); \
}
-#define sis300SetCursorPatternSelect(pat_id)\
- { \
- unsigned long temp; \
- temp = MMIO_IN32(pSiS->IOBase, CS(0)); \
- temp &= 0xF0FFFFFF; \
- temp |= (pat_id) << 24; \
- MMIO_OUT32(pSiS->IOBase,CS(0),temp); \
- }
-
/* 300 series, CRT2 */
/* 80000000 = RGB(1) - MONO(0)
@@ -216,20 +211,11 @@
{ \
unsigned long temp; \
temp = MMIO_IN32(pSiS->IOBase, CS(8)); \
- temp &= 0xFFFF0000; \
+ temp &= 0xF0FF0000; \
temp |= address; \
MMIO_OUT32(pSiS->IOBase,CS(8),temp); \
}
-#define sis301SetCursorPatternSelect(pat_id)\
- { \
- unsigned long temp; \
- temp = MMIO_IN32(pSiS->IOBase, CS(8)); \
- temp &= 0xF0FFFFFF; \
- temp |= (pat_id) << 24; \
- MMIO_OUT32(pSiS->IOBase,CS(8),temp); \
- }
-
/* 315/330 series CRT1 */
/* 80000000 = RGB(1) - MONO(0)
@@ -242,86 +228,69 @@
MMIO_IN32(pSiS->IOBase, CS(0)) & 0x40000000;
#define sis310SetCursorStatus(status) \
- { \
- unsigned long temp; \
- temp = MMIO_IN32(pSiS->IOBase, CS(0)); \
- temp &= 0xbfffffff; \
- temp |= status; \
- MMIO_OUT32(pSiS->IOBase, CS(0), temp); \
- }
+ pSiS->HWCursorBackup[0] &= 0xbfffffff; \
+ pSiS->HWCursorBackup[0] |= status; \
+ MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \
+ MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \
+ MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]);
#define sis310EnableHWCursor()\
- { \
- unsigned long temp; \
- temp = MMIO_IN32(pSiS->IOBase, CS(0)); \
- temp &= 0x0fffffff; \
- temp |= 0x40000000; \
- MMIO_OUT32(pSiS->IOBase, CS(0), temp); \
- }
+ pSiS->HWCursorBackup[0] &= 0x0fffffff; \
+ pSiS->HWCursorBackup[0] |= 0x40000000; \
+ MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \
+ MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \
+ MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]);
#define sis310EnableHWARGBCursor()\
- { \
- unsigned long temp; \
- temp = MMIO_IN32(pSiS->IOBase, CS(0)); \
- temp &= 0x0FFFFFFF; \
- temp |= 0xE0000000; \
- MMIO_OUT32(pSiS->IOBase, CS(0), temp); \
- }
+ pSiS->HWCursorBackup[0] &= 0x0FFFFFFF; \
+ pSiS->HWCursorBackup[0] |= 0xE0000000; \
+ MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \
+ MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \
+ MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]);
#define sis310SwitchToMONOCursor() \
- { \
- unsigned long temp; \
- temp = MMIO_IN32(pSiS->IOBase, CS(0)); \
- temp &= 0x4fffffff; \
- MMIO_OUT32(pSiS->IOBase, CS(0), temp); \
- }
-
+ pSiS->HWCursorBackup[0] &= 0x4fffffff; \
+ MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \
+ MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \
+ MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]);
+
#define sis310SwitchToRGBCursor() \
- { \
- unsigned long temp; \
- temp = MMIO_IN32(pSiS->IOBase, CS(0)); \
- temp &= 0xBFFFFFFF; \
- temp |= 0xA0000000; \
- MMIO_OUT32(pSiS->IOBase, CS(0), temp); \
- }
-
+ pSiS->HWCursorBackup[0] &= 0xBFFFFFFF; \
+ pSiS->HWCursorBackup[0] |= 0xA0000000; \
+ MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \
+ MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \
+ MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]);
+
#define sis310DisableHWCursor()\
- { \
- unsigned long temp; \
- temp = MMIO_IN32(pSiS->IOBase, CS(0)); \
- temp &= 0xBFFFFFFF; \
- MMIO_OUT32(pSiS->IOBase, CS(0), temp); \
- }
+ pSiS->HWCursorBackup[0] &= 0xBFFFFFFF; \
+ MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \
+ MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \
+ MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]);
#define sis310SetCursorBGColor(color) \
- MMIO_OUT32(pSiS->IOBase, CS(1), (color));
+ MMIO_OUT32(pSiS->IOBase, CS(1), (color)); \
+ pSiS->HWCursorBackup[1] = color;
#define sis310SetCursorFGColor(color)\
- MMIO_OUT32(pSiS->IOBase, CS(2), (color));
+ MMIO_OUT32(pSiS->IOBase, CS(2), (color)); \
+ pSiS->HWCursorBackup[2] = color;
-#define sis310SetCursorPositionX(x,preset)\
- MMIO_OUT32(pSiS->IOBase, CS(3), ((x) | ((preset) << 16)));
+#define sis310SetCursorPositionX(x,preset) \
+ pSiS->HWCursorBackup[3] = ((x) | ((preset) << 16)); \
+ MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]);
-#define sis310SetCursorPositionY(y,preset)\
- MMIO_OUT32(pSiS->IOBase, CS(4), ((y) | ((preset) << 16)));
+#define sis310SetCursorPositionY(y,preset) \
+ pSiS->HWCursorBackup[4] = ((y) | ((preset) << 16)); \
+ MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]);
#define sis310SetCursorAddress(address)\
- { \
- unsigned long temp; \
- temp = MMIO_IN32(pSiS->IOBase, CS(0)); \
- temp &= 0xFFF00000; \
- temp |= address; \
- MMIO_OUT32(pSiS->IOBase,CS(0),temp); \
- }
-
-#define sis310SetCursorPatternSelect(pat_id)\
- { \
- unsigned long temp; \
- temp = MMIO_IN32(pSiS->IOBase, CS(0)); \
- temp &= 0xF0FFFFFF; \
- temp |= (pat_id) << 24; \
- MMIO_OUT32(pSiS->IOBase,CS(0),temp); \
- }
+ pSiS->HWCursorBackup[0] &= 0xF0F00000; \
+ pSiS->HWCursorBackup[0] |= address; \
+ MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \
+ MMIO_OUT32(pSiS->IOBase, CS(1), pSiS->HWCursorBackup[1]); \
+ MMIO_OUT32(pSiS->IOBase, CS(2), pSiS->HWCursorBackup[2]); \
+ MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \
+ MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]);
/* 315 series CRT2 */
@@ -335,78 +304,62 @@
MMIO_IN32(pSiS->IOBase, CS(8)) & 0x40000000;
#define sis301SetCursorStatus310(status) \
- { \
- unsigned long temp; \
- temp = MMIO_IN32(pSiS->IOBase, CS(8)); \
- temp &= 0xbfffffff; \
- temp |= status; \
- MMIO_OUT32(pSiS->IOBase, CS(8), temp); \
- }
+ pSiS->HWCursorBackup[8] &= 0xbfffffff; \
+ pSiS->HWCursorBackup[8] |= status; \
+ MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \
+ MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \
+ MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]);
#define sis301EnableHWCursor310()\
- { \
- unsigned long temp, temp1, temp2; \
- temp1 = MMIO_IN32(pSiS->IOBase, CS(11)); \
- temp2 = MMIO_IN32(pSiS->IOBase, CS(12)); \
- temp = MMIO_IN32(pSiS->IOBase, CS(8)); \
- temp &= 0x0fffffff; \
- temp |= 0x40000000; \
- MMIO_OUT32(pSiS->IOBase, CS(8), temp); \
- MMIO_OUT32(pSiS->IOBase, CS(11), temp1); \
- MMIO_OUT32(pSiS->IOBase, CS(12), temp2); \
- }
+ pSiS->HWCursorBackup[8] &= 0x0fffffff; \
+ pSiS->HWCursorBackup[8] |= 0x40000000; \
+ MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \
+ MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \
+ MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]);
#define sis301EnableHWARGBCursor310()\
- { \
- unsigned long temp, temp1, temp2; \
- temp1 = MMIO_IN32(pSiS->IOBase, CS(11)); \
- temp2 = MMIO_IN32(pSiS->IOBase, CS(12)); \
- temp = MMIO_IN32(pSiS->IOBase, CS(8)); \
- temp &= 0x0FFFFFFF; \
- temp |= 0xE0000000; \
- MMIO_OUT32(pSiS->IOBase, CS(8), temp); \
- MMIO_OUT32(pSiS->IOBase, CS(11), temp1); \
- MMIO_OUT32(pSiS->IOBase, CS(12), temp2); \
- }
+ pSiS->HWCursorBackup[8] &= 0x0FFFFFFF; \
+ pSiS->HWCursorBackup[8] |= 0xE0000000; \
+ MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \
+ MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \
+ MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]);
#define sis301SwitchToRGBCursor310() \
- { \
- unsigned long temp; \
- temp = MMIO_IN32(pSiS->IOBase, CS(8)); \
- temp &= 0xBFFFFFFF; \
- temp |= 0xA0000000; \
- MMIO_OUT32(pSiS->IOBase, CS(8), temp); \
- }
+ pSiS->HWCursorBackup[8] &= 0xBFFFFFFF; \
+ pSiS->HWCursorBackup[8] |= 0xA0000000; \
+ MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \
+ MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \
+ MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]);
#define sis301SwitchToMONOCursor310() \
- { \
- unsigned long temp; \
- temp = MMIO_IN32(pSiS->IOBase, CS(8)); \
- temp &= 0x4fffffff; \
- MMIO_OUT32(pSiS->IOBase, CS(8), temp); \
- }
+ pSiS->HWCursorBackup[8] &= 0x4fffffff; \
+ MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \
+ MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \
+ MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]);
#define sis301DisableHWCursor310()\
- { \
- unsigned long temp; \
- temp = MMIO_IN32(pSiS->IOBase, CS(8)); \
- temp &= 0xBFFFFFFF; \
- MMIO_OUT32(pSiS->IOBase, CS(8), temp); \
- }
+ pSiS->HWCursorBackup[8] &= 0xBFFFFFFF; \
+ MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \
+ MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \
+ MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]);
-#define sis301SetCursorBGColor310(color)\
- MMIO_OUT32(pSiS->IOBase, CS(9), (color));
-#define sis301SetCursorFGColor310(color)\
- MMIO_OUT32(pSiS->IOBase, CS(10), (color));
+#define sis301SetCursorBGColor310(color) \
+ MMIO_OUT32(pSiS->IOBase, CS(9), (color)); \
+ pSiS->HWCursorBackup[9] = color;
-#define sis301SetCursorPositionX310(x,preset)\
- MMIO_OUT32(pSiS->IOBase, CS(11), ((x) | ((preset) << 16)));
-#define sis301SetCursorPositionY310(y,preset)\
- MMIO_OUT32(pSiS->IOBase, CS(12), ((y) | ((preset) << 16)));
+#define sis301SetCursorFGColor310(color) \
+ MMIO_OUT32(pSiS->IOBase, CS(10), (color)); \
+ pSiS->HWCursorBackup[10] = color;
-#define sis301SetCursorAddress310(address)\
- { \
- unsigned long temp; \
+#define sis301SetCursorPositionX310(x,preset) \
+ pSiS->HWCursorBackup[11] = ((x) | ((preset) << 16)); \
+ MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]);
+
+#define sis301SetCursorPositionY310(y,preset) \
+ pSiS->HWCursorBackup[12] = ((y) | ((preset) << 16)); \
+ MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]);
+
+#define sis301SetCursorAddress310(address) \
if(pSiS->sishw_ext.jChipType == SIS_315H) { \
if(address & 0x10000) { \
address &= ~0x10000; \
@@ -415,25 +368,18 @@
andSISIDXREG(SISSR, 0x37, 0x7f); \
} \
} \
- temp = MMIO_IN32(pSiS->IOBase, CS(8)); \
- temp &= 0xFFF00000; \
- temp |= address; \
- MMIO_OUT32(pSiS->IOBase,CS(8),temp); \
- }
-
-#define sis301SetCursorPatternSelect310(pat_id)\
- { \
- unsigned long temp; \
- temp = MMIO_IN32(pSiS->IOBase, CS(8)); \
- temp &= 0xF0FFFFFF; \
- temp |= (pat_id) << 24; \
- MMIO_OUT32(pSiS->IOBase,CS(8),temp); \
- }
+ pSiS->HWCursorBackup[8] &= 0xF0F00000; \
+ pSiS->HWCursorBackup[8] |= address; \
+ MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \
+ MMIO_OUT32(pSiS->IOBase, CS(9), pSiS->HWCursorBackup[9]); \
+ MMIO_OUT32(pSiS->IOBase, CS(10), pSiS->HWCursorBackup[10]); \
+ MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \
+ MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]);
/* 330 series CRT2 */
/* Mono cursor engine for CRT2 on SiS330 (Xabre) has bugs
- * and cannot be used!
+ * and cannot be used! Will hang engine.
*/
/* 80000000 = RGB(1) - MONO(0)
@@ -442,65 +388,14 @@
* 10000000 = "ghost"(1) - Alpha Blend(0) ?
*/
-#define sis301EnableHWCursor330()\
- { \
- unsigned long temp, temp1, temp2; \
- andSISIDXREG(SISCR,0x5b,~0x10); \
- temp1 = MMIO_IN32(pSiS->IOBase, CS(11)); \
- temp2 = MMIO_IN32(pSiS->IOBase, CS(12)); \
- temp = MMIO_IN32(pSiS->IOBase, CS(8)); \
- temp &= 0x0fffffff; \
- temp |= 0xE0000000; \
- MMIO_OUT32(pSiS->IOBase, CS(8), temp); \
- MMIO_OUT32(pSiS->IOBase, CS(11), temp1); \
- MMIO_OUT32(pSiS->IOBase, CS(12), temp2); \
- orSISIDXREG(SISCR,0x5b,0x10); \
- }
-
-#define sis301DisableHWCursor330()\
- { \
- unsigned long temp; \
- andSISIDXREG(SISCR,0x5b,~0x10); \
- temp = MMIO_IN32(pSiS->IOBase, CS(8)); \
- temp &= 0xBFFFFFFF; \
- MMIO_OUT32(pSiS->IOBase, CS(8), temp); \
- orSISIDXREG(SISCR,0x5b,0x10); \
- }
-
-#define sis301SetCursorPositionX330(x,preset)\
- andSISIDXREG(SISCR,0x5b,~0x10); \
- MMIO_OUT32(pSiS->IOBase, CS(11), ((x) | ((preset) << 16))); \
- orSISIDXREG(SISCR,0x5b,0x10);
-
-#define sis301SetCursorPositionY330(y,preset)\
- andSISIDXREG(SISCR,0x5b,~0x10); \
- MMIO_OUT32(pSiS->IOBase, CS(12), ((y) | ((preset) << 16))); \
- orSISIDXREG(SISCR,0x5b,0x10); \
-
-#define sis301SetCursorAddress330(address)\
- { \
- unsigned long temp, temp1, temp2; \
- temp1 = MMIO_IN32(pSiS->IOBase, CS(11)); \
- temp2 = MMIO_IN32(pSiS->IOBase, CS(12)); \
- andSISIDXREG(SISCR,0x5b,~0x10); \
- temp = MMIO_IN32(pSiS->IOBase, CS(8)); \
- temp &= 0xFFF00000; \
- temp |= address; \
- MMIO_OUT32(pSiS->IOBase,CS(8),temp); \
- MMIO_OUT32(pSiS->IOBase, CS(11), temp1); \
- MMIO_OUT32(pSiS->IOBase, CS(12), temp2); \
- orSISIDXREG(SISCR,0x5b,0x10); \
- }
+#define sis301EnableHWCursor330() \
+ /* andSISIDXREG(SISCR,0x5b,~0x10); */ \
+ pSiS->HWCursorBackup[8] &= 0x0fffffff; \
+ pSiS->HWCursorBackup[8] |= 0xE0000000; \
+ MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \
+ MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \
+ MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); \
+ /* orSISIDXREG(SISCR,0x5b,0x10); */
-#define sis301SetCursorPatternSelect330(pat_id)\
- { \
- unsigned long temp; \
- andSISIDXREG(SISCR,0x5b,~0x10); \
- temp = MMIO_IN32(pSiS->IOBase, CS(8)); \
- temp &= 0xF0FFFFFF; \
- temp |= (pat_id) << 24; \
- MMIO_OUT32(pSiS->IOBase,CS(8),temp); \
- orSISIDXREG(SISCR,0x5b,0x10); \
- }
diff --git a/src/sis_dac.c b/src/sis_dac.c
index 6d1a88e..af1bec6 100644
--- a/src/sis_dac.c
+++ b/src/sis_dac.c
@@ -1,36 +1,48 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c,v 1.51 2003/11/30 22:29:52 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c,v 1.56 2004/01/23 22:29:04 twini Exp $ */
/*
* DAC helper functions (Save/Restore, MemClk, etc)
*
- * Copyright 2001, 2002, 2003 by Thomas Winischhofer, Vienna, Austria.
- * Parts Copyright 1998,1999 by Alan Hourihane, Wigan, England.
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria.
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the provider not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The provider makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1) Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2) Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3) All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement: "This product includes
+ * software developed by Thomas Winischhofer, Vienna, Austria."
+ * 4) The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * THE PROVIDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE PROVIDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Author: Thomas Winischhofer <thomas@winischhofer.net>
*
- * MemClock functions by:
- * Alan Hourihane <alanh@fairlite.demon.co.uk>
- * Mike Chapman <mike@paranoia.com>,
- * Juanjo Santamarta <santamarta@ctv.es>,
- * Mitani Hiroshi <hmitani@drl.mei.co.jp>
- * David Thomas <davtom@dream.org.uk>.
+ * SiS_compute_vclk(), SiSCalcClock() and parts of SiSMclk():
+ * Copyright (C) 1998, 1999 by Alan Hourihane, Wigan, England
+ * Written by:
+ * Alan Hourihane <alanh@fairlite.demon.co.uk>,
+ * Mike Chapman <mike@paranoia.com>,
+ * Juanjo Santamarta <santamarta@ctv.es>,
+ * Mitani Hiroshi <hmitani@drl.mei.co.jp>,
+ * David Thomas <davtom@dream.org.uk>,
+ * Thomas Winischhofer <thomas@winischhofer.net>.
+ * Licensed under the terms of the XFree86 license
+ * (http://www.xfree86.org/current/LICENSE1.html)
+ *
*/
#include "xf86.h"
@@ -838,7 +850,7 @@ SiS315Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
if(pSiS->sishw_ext.jChipType < SIS_661) {
outSISIDXREG(SISCR, 0x79, sisReg->sisRegs3D4[0x79]);
}
- outSISIDXREG(SISCR, 0x63, sisReg->sisRegs3D4[0x63]);
+ outSISIDXREG(SISCR, pSiS->myCR63, sisReg->sisRegs3D4[pSiS->myCR63]);
/* Leave PCI_IO_ENABLE on if accelerators are on (Is this required?) */
if(sisReg->sisRegs3C4[0x1e] & 0x50) { /*0x40=2D, 0x10=3D*/
@@ -847,6 +859,9 @@ SiS315Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
}
/* Restore extended SR registers */
+ if(pSiS->sishw_ext.jChipType >= SIS_661) {
+ sisReg->sisRegs3C4[0x11] &= 0x0f;
+ }
for(i = 0x06; i <= 0x3F; i++) {
outSISIDXREG(SISSR, i, sisReg->sisRegs3C4[i]);
}
@@ -1041,10 +1056,13 @@ SiS301BSave(ScrnInfoPtr pScrn, SISRegPtr sisReg)
Part2max = 0x4d;
Part3max = 0x3e;
Part4max = 0x23;
- if(pSiS->VBFlags & (VB_301C|VB_302ELV))
+ if(pSiS->VBFlags & (VB_301C|VB_302ELV)) {
Part2max = 0xff;
- if(pSiS->VBFlags & (VB_301C|VB_301LV|VB_302LV|VB_302ELV))
+ Part4max = 0x3c;
+ }
+ if(pSiS->VBFlags & (VB_301LV|VB_302LV)) {
Part4max = 0x34;
+ }
SiSVBSave(pScrn, sisReg, Part1max, Part2max, Part3max, Part4max);
@@ -1063,10 +1081,13 @@ SiS301BRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
Part2max = 0x4d;
Part3max = 0x3e;
Part4max = 0x22;
- if(pSiS->VBFlags & (VB_301C|VB_302ELV))
+ if(pSiS->VBFlags & (VB_301C|VB_302ELV)) {
Part2max = 0xff;
- if(pSiS->VBFlags & (VB_301LV|VB_302LV|VB_302ELV))
- Part4max = 0x24;
+ Part4max = 0x3c;
+ }
+ if(pSiS->VBFlags & (VB_301LV|VB_302LV)) {
+ Part4max = 0x34;
+ }
SiS_DisableBridge(pSiS->SiS_Pr, &pSiS->sishw_ext);
@@ -1245,13 +1266,13 @@ SiSRestoreBridge(ScrnInfoPtr pScrn, SISRegPtr sisReg)
sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
#endif
- for(i = 0x30; i <= 0x39; i++) {
+ for(i = 0x30; i <= 0x3b; i++) {
if(i == 0x34) continue;
outSISIDXREG(SISCR, i, sisReg->sisRegs3D4[i]);
}
if(pSiS->VGAEngine == SIS_315_VGA) {
- outSISIDXREG(SISCR, 0x63, sisReg->sisRegs3D4[0x63]);
+ outSISIDXREG(SISCR, pSiS->myCR63, sisReg->sisRegs3D4[pSiS->myCR63]);
if(pSiS->sishw_ext.jChipType < SIS_661) {
outSISIDXREG(SISCR, 0x79, sisReg->sisRegs3D4[0x79]);
}
@@ -1428,7 +1449,10 @@ SiSEstimateCRT2Clock(ScrnInfoPtr pScrn, BOOLEAN IsForMergedFBCRT2)
return 70000;
}
} else if(pSiS->VBFlags & VB_SISBRIDGE) {
- return 70000;
+ if(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPR)
+ return 75000;
+ else
+ return 70000;
}
}
diff --git a/src/sis_dac.h b/src/sis_dac.h
index fec0643..92c2947 100644
--- a/src/sis_dac.h
+++ b/src/sis_dac.h
@@ -1,35 +1,35 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h,v 1.15 2003/10/30 18:53:42 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h,v 1.18 2004/01/23 22:29:04 twini Exp $ */
/*
* DAC helper functions (Save/Restore, MemClk, etc)
* Definitions and prototypes
*
- * Copyright 1998,1999 by Alan Hourihane, Wigan, England.
- * Copyright 2001, 2002, 2003 by Thomas Winischhofer, Vienna, Austria.
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria.
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the provider not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The provider makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1) Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2) Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3) All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement: "This product includes
+ * software developed by Thomas Winischhofer, Vienna, Austria."
+ * 4) The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * THE PROVIDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE PROVIDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Authors: Alan Hourihane <alanh@fairlite.demon.co.uk>
- * Mike Chapman <mike@paranoia.com>,
- * Juanjo Santamarta <santamarta@ctv.es>,
- * Mitani Hiroshi <hmitani@drl.mei.co.jp>
- * David Thomas <davtom@dream.org.uk>.
- * Thomas Winischhofer <thomas@winischhofer.net>
*/
int SiS_compute_vclk(int Clock, int *out_n, int *out_dn, int *out_div,
@@ -72,10 +72,3 @@ extern void SiS_DisplayOn(SiS_Private *SiS_Pr);
extern unsigned char SiS_GetSetModeID(ScrnInfoPtr pScrn, unsigned char id);
extern void SiS_SetEnableDstn(SiS_Private *SiS_Pr, int enable);
extern void SiS_SetEnableFstn(SiS_Private *SiS_Pr, int enable);
-
-
-
-
-
-
-
diff --git a/src/sis_dga.c b/src/sis_dga.c
index 549ffbe..ba65be4 100644
--- a/src/sis_dga.c
+++ b/src/sis_dga.c
@@ -1,14 +1,16 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c,v 1.11 2003/10/30 18:53:42 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c,v 1.13 2004/01/04 18:08:00 twini Exp $ */
/*
* SiS DGA handling
*
- * Copyright 2000 by Alan Hourihane, Sychdyn, North Wales, UK.
- * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria
+ * Copyright (C) 2000 by Alan Hourihane, Sychdyn, North Wales, UK.
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
*
* Portions from radeon_dga.c which is
* Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
* VA Linux Systems Inc., Fremont, California.
*
+ * Licensed under the following terms:
+ *
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
diff --git a/src/sis_dri.c b/src/sis_dri.c
index 97be829..7eb8b17 100644
--- a/src/sis_dri.c
+++ b/src/sis_dri.c
@@ -1,12 +1,38 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.39 2003/11/20 19:53:23 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.41 2004/01/04 18:08:00 twini Exp $ */
/*
- * DRI wrapper for 300 and 315 series
+ * DRI wrapper for 300 and 315 series
*
- * Preliminary 315/330 support by Thomas Winischhofer
- * Mesa 4/5 changes by Eric Anholt
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
*
- * Taken and modified from tdfx_dri.c, mga_dri.c
+ * Preliminary 315/330 support by Thomas Winischhofer
+ * Portions of Mesa 4/5 changes by Eric Anholt
*
+ * Licensed under the following terms:
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appears in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * and that the name of the copyright holder not be used in advertising
+ * or publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holder makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without expressed or implied warranty.
+ *
+ * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Previously taken and modified from tdfx_dri.c, mga_dri.c
+ *
+ * Authors: Can-Ru Yeou, SiS Inc.
+ * Alan Hourihane, Wigan, England,
+ * Thomas Winischhofer <thomas@winischhofer.net>
+ * others.
*/
#include "xf86.h"
diff --git a/src/sis_dri.h b/src/sis_dri.h
index 90473a4..f527392 100644
--- a/src/sis_dri.h
+++ b/src/sis_dri.h
@@ -1,6 +1,35 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h,v 1.10 2003/10/30 18:53:42 twini Exp $ */
-
-/* modified from tdfx_dri.h */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h,v 1.12 2004/01/04 18:08:00 twini Exp $ */
+/*
+ * SiS DRI wrapper
+ *
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
+ *
+ * Licensed under the following terms:
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appears in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * and that the name of the copyright holder not be used in advertising
+ * or publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holder makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without expressed or implied warranty.
+ *
+ * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: Can-Ru Yeou, SiS Inc.,
+ * Thomas Winischhofer <thomas@winischhofer.net>,
+ * others.
+ *
+ * Previously taken and modified from tdfx_dri.h
+ */
#ifndef _SIS_DRI_
#define _SIS_DRI_
diff --git a/src/sis_driver.c b/src/sis_driver.c
index ed84d52..253973e 100644
--- a/src/sis_driver.c
+++ b/src/sis_driver.c
@@ -1,59 +1,49 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.166 2003/12/16 17:59:08 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.176 2004/01/24 21:29:20 twini Exp $ */
/*
- * Copyright 2001, 2002, 2003 by Thomas Winischhofer, Vienna, Austria.
+ * SiS driver main code
*
- * Formerly based on old code which is
- * Copyright 1998,1999 by Alan Hourihane, Wigan, England.
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria.
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1) Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2) Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3) All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement: "This product includes
+ * software developed by Thomas Winischhofer, Vienna, Austria."
+ * 4) The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Author: Thomas Winischhofer <thomas@winischhofer.net>
- * - driver entirely rewritten, only basic structure taken from old code
- * (except sis_dri.c, sis_shadow.c and parts of sis_dga.c;
- * these were taken over; sis_dri.c was slightly adapted):
- * - rewritten for 5597/5598, 6326 and 530/620 chipsets,
- * - rewritten for 300 series (300/540/630/730),
- * - 315 series (315/550/650/651/M650/661FX/M661FX/M661MX/740/741) support
- * - 330 series (330/760) support
- * - dual head support for 300, 315 and 330 series
- * - merged-framebuffer support for 300, 315 and 330 series
- * - pseudo-xinerama extension for MergedFB mode
- * - SiS video bridge support for 300, 315 and 330 series (LCD, TV, VGA2),
- * - LVDS support for 300 and 315 series,
- * - Chrontel 7019/LVDS support (650, 740; up to 1600x1200)
- * - Chrontel 700x, 701x support for TV output
- * - VESA mode switching (deprecated),
- * - plasma panel support,
- * - entirely rewritten Xv support for 300 series
- * - Xv support for 5597/5598, 6326, 530/620, 315 and 330 series
- * - TV and hi-res support for the 6326
- * - color HW cursor support for 300(emulated), 315 and 330 series
- * - SiSCtrl interface for 300, 315 and 330 series
- * - etc. etc. etc.
+ * - driver entirely rewritten since 2001, only basic structure taken from
+ * old code (except sis_dri.c, sis_shadow.c, sis_accel.c and parts of
+ * sis_dga.c; these were mostly taken over; sis_dri.c was changed for
+ * new versions of the DRI layer)
*
- * This notice covers the entire driver code
+ * This notice covers the entire driver code unless otherwise indicated.
*
- * Authors of old code:
- * Alan Hourihane, alanh@fairlite.demon.co.uk
+ * Formerly based on code which is
+ * Copyright (C) 1998, 1999 by Alan Hourihane, Wigan, England.
+ * Written by:
+ * Alan Hourihane <alanh@fairlite.demon.co.uk>,
* Mike Chapman <mike@paranoia.com>,
* Juanjo Santamarta <santamarta@ctv.es>,
- * Mitani Hiroshi <hmitani@drl.mei.co.jp>
+ * Mitani Hiroshi <hmitani@drl.mei.co.jp>,
* David Thomas <davtom@dream.org.uk>.
*/
@@ -166,7 +156,7 @@ static SymTabRec SISChipsets[] = {
{ PCI_CHIP_SIS550, "SIS550" },
{ PCI_CHIP_SIS650, "SIS650/M650/651/740" },
{ PCI_CHIP_SIS330, "SIS330(Xabre)" },
- { PCI_CHIP_SIS660, "SIS660/661FX/M661FX/M661MX/741/760" },
+ { PCI_CHIP_SIS660, "SIS660/661FX/M661FX/M661MX/741/M741/760" },
{ -1, NULL }
};
@@ -496,10 +486,16 @@ SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int fla
((pSiS->VBFlags & (VB_LVDS | VB_CHRONTEL)) == VB_LVDS))) {
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
- if(!pSiS->BlankCRT2) inSISIDXREG(SISSR, 0x11, pSiS->LCDon);
+ if(!pSiS->BlankCRT2) {
+ inSISIDXREG(SISSR, 0x11, pSiS->LCDon);
+ if(pSiS->sishw_ext.jChipType >= SIS_661) pSiS->LCDon &= 0x0f;
+ }
} else
#endif
- if(!pSiS->Blank) inSISIDXREG(SISSR, 0x11, pSiS->LCDon);
+ if(!pSiS->Blank) {
+ inSISIDXREG(SISSR, 0x11, pSiS->LCDon);
+ if(pSiS->sishw_ext.jChipType >= SIS_661) pSiS->LCDon &= 0x0f;
+ }
}
}
}
@@ -609,7 +605,7 @@ SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int fla
break;
case SIS_315_VGA:
if((!pSiS->CRT1off) && ((!(pSiS->VBFlags & CRT1_LCDA)) || (pSiS->VBFlags & VB_301C))) {
- setSISIDXREG(SISCR, 0x63, 0xbf, cr63);
+ setSISIDXREG(SISCR, pSiS->myCR63, 0xbf, cr63);
setSISIDXREG(SISSR, 0x07, 0xef, sr7);
}
/* fall through */
@@ -633,7 +629,11 @@ SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int fla
(pSiS->VBFlags & (VB_301|VB_30xBDH|VB_LVDS))) ||
((pSiS->VGAEngine == SIS_315_VGA) &&
((pSiS->VBFlags & (VB_LVDS | VB_CHRONTEL)) == VB_LVDS))) {
- setSISIDXREG(SISSR, 0x11, ~0x0c, sr11);
+ if(pSiS->sishw_ext.jChipType >= SIS_661) {
+ setSISIDXREG(SISSR, 0x11, ~0xfc, sr11);
+ } else {
+ setSISIDXREG(SISSR, 0x11, ~0x0c, sr11);
+ }
}
if(pSiS->VGAEngine == SIS_300_VGA) {
if((pSiS->VBFlags & (VB_301B|VB_301C|VB_302B)) &&
@@ -865,6 +865,7 @@ SISProbe(DriverPtr drv, int flags)
pSiSEnt->FbBase = pSiSEnt->IOBase = NULL;
pSiSEnt->forceUnmapIOBase = FALSE;
pSiSEnt->forceUnmapFbBase = FALSE;
+ pSiSEnt->HWCursorCBufNum = pSiSEnt->HWCursorMBufNum = 0;
#ifdef __alpha__
pSiSEnt->MapCountIOBaseDense = 0;
pSiSEnt->IOBaseDense = NULL;
@@ -2336,12 +2337,19 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
xf86LoaderReqSymLists(vgahwSymbols, NULL);
+ /* Due to the liberal license terms this is needed for
+ * keeping the copyright notice readable and intact in
+ * binary distributions. Removing this is a copyright
+ * infringement. Please read the license terms above.
+ */
+
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "SiS driver (%d/%02d/%02d-%d) by "
- "Thomas Winischhofer <thomas@winischhofer.net>\n",
+ "SiS driver (%d/%02d/%02d-%d)\n",
SISDRIVERVERSIONYEAR + 2000, SISDRIVERVERSIONMONTH,
SISDRIVERVERSIONDAY, SISDRIVERREVISION);
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Copyright (C) 2001-2004 Thomas Winischhofer <thomas@winischhofer.net> and others\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Compiled for XFree86 %d.%d.%d.%d\n",
XF86_VERSION_MAJOR, XF86_VERSION_MINOR,
XF86_VERSION_PATCH, XF86_VERSION_SNAP);
@@ -2555,6 +2563,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
/* Determine chipset and VGA engine type */
pSiS->ChipFlags = 0;
pSiS->SiS_SD_Flags = 0;
+ pSiS->HWCursorMBufNum = pSiS->HWCursorCBufNum = 0;
switch(pSiS->Chipset) {
case PCI_CHIP_SIS300:
@@ -2580,6 +2589,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->VGAEngine = SIS_315_VGA;
pSiS->ChipFlags |= SiSCF_315Core;
pSiS->SiS_SD_Flags |= SiS_SD_IS315SERIES;
+ pSiS->myCR63 = 0x63;
break;
case PCI_CHIP_SIS315:
/* Override for simplicity */
@@ -2588,6 +2598,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->ChipFlags |= SiSCF_315Core;
pSiS->VGAEngine = SIS_315_VGA;
pSiS->SiS_SD_Flags |= SiS_SD_IS315SERIES;
+ pSiS->myCR63 = 0x63;
break;
case PCI_CHIP_SIS315PRO:
/* Override for simplicity */
@@ -2596,12 +2607,14 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->ChipFlags |= SiSCF_315Core;
pSiS->VGAEngine = SIS_315_VGA;
pSiS->SiS_SD_Flags |= SiS_SD_IS315SERIES;
+ pSiS->myCR63 = 0x63;
break;
case PCI_CHIP_SIS550:
pSiS->sishw_ext.jChipType = SIS_550;
pSiS->VGAEngine = SIS_315_VGA;
pSiS->ChipFlags |= SiSCF_Integrated;
pSiS->SiS_SD_Flags |= SiS_SD_IS315SERIES;
+ pSiS->myCR63 = 0x63;
break;
case PCI_CHIP_SIS650: /* 650 + 740 */
pSiS->sishw_ext.jChipType = SIS_650;
@@ -2611,12 +2624,14 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->VGAEngine = SIS_315_VGA;
pSiS->ChipFlags |= (SiSCF_Integrated | SiSCF_Real256ECore);
pSiS->SiS_SD_Flags |= SiS_SD_IS315SERIES;
+ pSiS->myCR63 = 0x63;
break;
case PCI_CHIP_SIS330:
pSiS->sishw_ext.jChipType = SIS_330;
pSiS->VGAEngine = SIS_315_VGA;
pSiS->ChipFlags |= SiSCF_XabreCore;
pSiS->SiS_SD_Flags |= SiS_SD_IS330SERIES;
+ pSiS->myCR63 = 0x63;
break;
case PCI_CHIP_SIS660: /* 660, 661, 741, 760 */
{
@@ -2648,6 +2663,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->VGAEngine = SIS_315_VGA;
pSiS->ChipFlags |= SiSCF_Integrated;
pSiS->SiS_SD_Flags |= SiS_SD_IS330SERIES;
+ pSiS->myCR63 = 0x53; /* Yes, 0x53 */
}
break;
case PCI_CHIP_SIS530:
@@ -2885,11 +2901,16 @@ 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->PDC = -1;
pSiS->SiS_Pr->LVDSHL = -1;
pSiS->SiS_Pr->HaveEMI = FALSE;
pSiS->SiS_Pr->HaveEMILCD = FALSE;
pSiS->SiS_Pr->OverruleEMI = FALSE;
+ pSiS->SiS_Pr->SiS_SensibleSR11 = FALSE;
+ if(pSiS->sishw_ext.jChipType >= SIS_661) {
+ pSiS->SiS_Pr->SiS_SensibleSR11 = TRUE;
+ }
+ pSiS->SiS_Pr->SiS_MyCR63 = pSiS->myCR63;
}
/* Get our relocated IO registers */
@@ -3139,20 +3160,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
"Could not allocate memory for video BIOS image\n");
} else {
unsigned long segstart;
- unsigned short romptr;
+ unsigned short romptr, pciid;
BOOLEAN found;
- int i;
- static const char sis_rom_sig[] = "Silicon Integrated Systems";
- static const char *sis_sig[15] = {
- "300", "540", "630", "730",
- "315", "315", "315", "5315", "6325", "6325",
- "Xabre", "6330", "6330", "6330", "6330"
- };
- static const unsigned short sis_nums[15] = {
- SIS_300, SIS_540, SIS_630, SIS_730,
- SIS_315PRO, SIS_315H, SIS_315, SIS_550, SIS_650, SIS_740,
- SIS_330, SIS_661, SIS_741, SIS_660, SIS_760
- };
found = FALSE;
for(segstart=BIOS_BASE; segstart<0x000f0000; segstart+=0x00001000) {
@@ -3165,29 +3174,19 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if((pSiS->BIOS[0] != 0x55) || (pSiS->BIOS[1] != 0xaa)) continue;
- romptr = pSiS->BIOS[0x12] | (pSiS->BIOS[0x13] << 8);
- if(romptr > (BIOS_SIZE - strlen(sis_rom_sig))) continue;
- if(strncmp(sis_rom_sig, (char *)&pSiS->BIOS[romptr], strlen(sis_rom_sig)) != 0) continue;
-
- romptr = pSiS->BIOS[0x14] | (pSiS->BIOS[0x15] << 8);
- if(romptr > (BIOS_SIZE - 5)) continue;
- for(i = 0; (i < 15) && (!found); i++) {
- if(strncmp(sis_sig[i], (char *)&pSiS->BIOS[romptr], strlen(sis_sig[i])) == 0) {
- if(sis_nums[i] == pSiS->sishw_ext.jChipType) {
- found = TRUE;
- break;
- } else {
- if((pSiS->sishw_ext.jChipType != SIS_740) &&
- (pSiS->sishw_ext.jChipType != SIS_661) &&
- (pSiS->sishw_ext.jChipType != SIS_741) &&
- (pSiS->sishw_ext.jChipType != SIS_660)) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Ignoring BIOS for SiS %s at 0x%lx\n", sis_sig[i], segstart);
- }
- }
- }
- }
- if(found) break;
+ romptr = pSiS->BIOS[0x18] | (pSiS->BIOS[0x19] << 8);
+ if(romptr > (BIOS_SIZE - 8)) continue;
+ if((pSiS->BIOS[romptr] != 'P') || (pSiS->BIOS[romptr+1] != 'C') ||
+ (pSiS->BIOS[romptr+2] != 'I') || (pSiS->BIOS[romptr+3] != 'R')) continue;
+
+ pciid = pSiS->BIOS[romptr+4] | (pSiS->BIOS[romptr+5] << 8);
+ if(pciid != 0x1039) continue;
+
+ pciid = pSiS->BIOS[romptr+6] | (pSiS->BIOS[romptr+7] << 8);
+ if(pciid != pSiS->Chipset) continue;
+
+ found = TRUE;
+ break;
}
if(!found) {
@@ -3236,11 +3235,14 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiSEnt->ForceCRT1Type = pSiS->ForceCRT1Type;
pSiSEnt->ForceCRT2Type = pSiS->ForceCRT2Type;
pSiSEnt->ForceTVType = pSiS->ForceTVType;
+ pSiSEnt->ForceYPbPrType = pSiS->ForceYPbPrType;
+ pSiSEnt->ForceYPbPrAR = pSiS->ForceYPbPrAR;
pSiSEnt->UsePanelScaler = pSiS->UsePanelScaler;
pSiSEnt->DSTN = pSiS->DSTN;
pSiSEnt->OptTVStand = pSiS->OptTVStand;
pSiSEnt->NonDefaultPAL = pSiS->NonDefaultPAL;
pSiSEnt->NonDefaultNTSC = pSiS->NonDefaultNTSC;
+ pSiSEnt->chtvtype = pSiS->chtvtype;
pSiSEnt->OptTVOver = pSiS->OptTVOver;
pSiSEnt->OptTVSOver = pSiS->OptTVSOver;
pSiSEnt->chtvlumabandwidthcvbs = pSiS->chtvlumabandwidthcvbs;
@@ -3314,6 +3316,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->NonDefaultNTSC = pSiSEnt->NonDefaultNTSC;
pSiS->chtvtype = pSiSEnt->chtvtype;
pSiS->ForceTVType = pSiSEnt->ForceTVType;
+ pSiS->ForceYPbPrType = pSiSEnt->ForceYPbPrType;
+ pSiS->ForceYPbPrAR = pSiSEnt->ForceYPbPrAR;
pSiS->OptTVOver = pSiSEnt->OptTVOver;
pSiS->OptTVSOver = pSiSEnt->OptTVSOver;
pSiS->chtvlumabandwidthcvbs = pSiSEnt->chtvlumabandwidthcvbs;
@@ -3522,8 +3526,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
#endif
if(pSiS->HWCursor) {
- pSiS->availMem -= pSiS->CursorSize;
- if(pSiS->OptUseColorCursor) pSiS->availMem -= pSiS->CursorSize;
+ pSiS->availMem -= (pSiS->CursorSize * 2);
+ if(pSiS->OptUseColorCursor) pSiS->availMem -= (pSiS->CursorSize * 2);
}
pSiS->cursorBufferNum = 0;
#ifdef SISDUALHEAD
@@ -3769,7 +3773,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
inSISIDXREG(SISCR, 0x36, pSiS->oldCR36);
inSISIDXREG(SISCR, 0x37, pSiS->oldCR37);
if(pSiS->VGAEngine == SIS_315_VGA) {
- inSISIDXREG(SISCR, 0x63, pSiS->oldCR63);
+ inSISIDXREG(SISCR, pSiS->myCR63, pSiS->oldCR63);
}
pSiS->postVBCR32 = pSiS->oldCR32;
@@ -3886,6 +3890,31 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
}
+ /* Setup SD flags */
+ pSiS->SiS_SD_Flags |= SiS_SD_ADDLSUPFLAG;
+
+ if(pSiS->VBFlags & (VB_SISTVBRIDGE | VB_CHRONTEL)) {
+ pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTTV;
+ }
+
+#ifdef ENABLE_YPBPR
+ if((pSiS->VGAEngine == SIS_315_VGA) &&
+ (pSiS->VBFlags & (VB_301C|VB_301LV|VB_302LV|VB_302ELV))) {
+ pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTYPBPR;
+ if((pSiS->Chipset == PCI_CHIP_SIS660) || (pSiS->VBFlags & VB_301C)) {
+ pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTYPBPRAR;
+ }
+ }
+ if(pSiS->VBFlags & (VB_301|VB_301B|VB_302B)) {
+ pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTHIVISION;
+ }
+#endif
+
+#ifdef TWDEBUG /* @@@ TEST @@@ */
+ pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTYPBPRAR;
+ xf86DrvMsg(0, X_INFO, "TEST: Support Aspect Ratio\n");
+#endif
+
/* Detect CRT2-TV and PAL/NTSC mode */
SISTVPreInit(pScrn);
@@ -3893,13 +3922,20 @@ 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|TV_HIVISION|TV_YPBPR);
- /* Setup SD flags */
- pSiS->SiS_SD_Flags |= SiS_SD_ADDLSUPFLAG;
+ if(!(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPR)) {
+ if((pSiS->ForceTVType != -1) && (pSiS->ForceTVType & TV_YPBPR)) {
+ pSiS->ForceTVType = -1;
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "YPbPr TV output not supported\n");
+ }
+ }
- if(pSiS->VBFlags & (VB_SISTVBRIDGE | VB_CHRONTEL)) {
- pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTTV;
+ if(!(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTHIVISION)) {
+ if((pSiS->ForceTVType != -1) && (pSiS->ForceTVType & TV_HIVISION)) {
+ pSiS->ForceTVType = -1;
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "HiVision TV output not supported\n");
+ }
}
if((pSiS->VBFlags & VB_SISTVBRIDGE) ||
@@ -3934,6 +3970,10 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->VBFlags |= pSiS->ForceCRT1Type;
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "SDFlags %lx\n", pSiS->SiS_SD_Flags);
+#endif
+
/* Eventually overrule detected CRT2 type
* If no type forced, use the detected devices in the order VGA2->TV->LCD
* Since the Chrontel 7005 sometimes delivers wrong detection results,
@@ -4020,11 +4060,20 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
}
- /* Eventually overrule TV Type (SVIDEO, COMPOSITE, SCART) */
+ /* Eventually overrule TV Type (SVIDEO, COMPOSITE, SCART, HIVISION, YPBPR) */
if(pSiS->VBFlags & VB_SISTVBRIDGE) {
if(pSiS->ForceTVType != -1) {
pSiS->VBFlags &= ~(TV_INTERFACE);
+ if(!(pSiS->VBFlags & VB_CHRONTEL)) {
+ pSiS->VBFlags &= ~(TV_CHSCART | TV_CHYPBPR525I);
+ }
pSiS->VBFlags |= pSiS->ForceTVType;
+ if(pSiS->VBFlags & TV_YPBPR) {
+ pSiS->VBFlags &= ~(TV_STANDARD);
+ pSiS->VBFlags &= ~(TV_YPBPRAR);
+ pSiS->VBFlags |= pSiS->ForceYPbPrType;
+ pSiS->VBFlags |= pSiS->ForceYPbPrAR;
+ }
}
}
@@ -4076,7 +4125,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
*/
outSISIDXREG(SISCR, 0x17, usScratchCR17);
if(pSiS->VGAEngine == SIS_315_VGA) {
- outSISIDXREG(SISCR, 0x63, usScratchCR63);
+ outSISIDXREG(SISCR, pSiS->myCR63, usScratchCR63);
}
outSISIDXREG(SISCR, 0x32, usScratchCR32);
if(pSiS->CRT1changed) {
@@ -4133,7 +4182,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
if(pSiS->OptTVStand != -1) {
if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
- if(!(pSiS->VBFlags & (TV_CHSCART | TV_CHHDTV))) {
+ if( (!((pSiS->VBFlags & VB_CHRONTEL) && (pSiS->VBFlags & (TV_CHSCART | TV_CHYPBPR525I)))) &&
+ (!(pSiS->VBFlags & (TV_HIVISION | TV_YPBPR))) ) {
pSiS->VBFlags &= ~(TV_PAL | TV_NTSC | TV_PALN | TV_PALM | TV_NTSCJ);
if(pSiS->OptTVStand) {
pSiS->VBFlags |= TV_PAL;
@@ -4146,7 +4196,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
} else {
pSiS->OptTVStand = pSiS->NonDefaultPAL = -1;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Option TVStandard ignored for SCART and 480i HDTV\n");
+ "Option TVStandard ignored for YPbPr, HiVision and Chrontel-SCART\n");
}
} else if(pSiS->Chipset == PCI_CHIP_SIS6326) {
pSiS->SiS6326Flags &= ~SIS6326_TVPAL;
@@ -4362,15 +4412,15 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
"Unable to detect LCD PanelDelayCompensation, please update sisfb\n");
}
}
- pSiS->SiS_Pr->PDC &= 0x3c;
- if(pSiS->SiS_Pr->PDC) {
+ if(pSiS->SiS_Pr->PDC != -1) {
+ pSiS->SiS_Pr->PDC &= 0x3c;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"Detected LCD PanelDelayCompensation 0x%02x\n",
pSiS->SiS_Pr->PDC);
}
/* If we haven't been able to find out, use our other methods */
- if(pSiS->SiS_Pr->PDC == 0) {
+ if(pSiS->SiS_Pr->PDC == -1) {
int i=0;
do {
if(mypdctable[i].subsysVendor == pSiS->PciInfo->subsysVendor &&
@@ -4445,7 +4495,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
"Unable to detect LCD PanelDelayCompensation, please update sisfb\n");
}
}
- if(pSiS->SiS_Pr->PDC) {
+ if(pSiS->SiS_Pr->PDC != -1) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"Detected LCD PanelDelayCompensation 0x%02x\n",
pSiS->SiS_Pr->PDC);
@@ -5599,7 +5649,7 @@ SISSave(ScrnInfoPtr pScrn)
sisReg->sisRegs3D4[0x36] = pSiS->oldCR36;
sisReg->sisRegs3D4[0x37] = pSiS->oldCR37;
if(pSiS->VGAEngine == SIS_315_VGA) {
- sisReg->sisRegs3D4[0x63] = pSiS->oldCR63;
+ sisReg->sisRegs3D4[pSiS->myCR63] = pSiS->oldCR63;
}
}
}
@@ -5992,6 +6042,7 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
SiSPostSetMode(pScrn, &pSiS->ModeReg);
#ifdef TWDEBUG
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VBFlags %lx\n", pSiS->VBFlags);
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"REAL REGISTER CONTENTS AFTER SETMODE:\n");
(*pSiS->ModeInit)(pScrn, mode);
@@ -6207,7 +6258,7 @@ SISRestore(ScrnInfoPtr pScrn)
outSISIDXREG(SISCR, 0x17, pSiS->oldCR17);
}
if(pSiS->VGAEngine == SIS_315_VGA) {
- outSISIDXREG(SISCR, 0x63, pSiS->oldCR63);
+ outSISIDXREG(SISCR, pSiS->myCR63, pSiS->oldCR63);
}
outSISIDXREG(SISSR, 0x1f, pSiS->oldSR1F);
@@ -6285,7 +6336,7 @@ SISRestore(ScrnInfoPtr pScrn)
/* Restore CRT1 status */
if(pSiS->VGAEngine == SIS_315_VGA) {
- outSISIDXREG(SISCR, 0x63, pSiS->oldCR63);
+ outSISIDXREG(SISCR, pSiS->myCR63, pSiS->oldCR63);
}
outSISIDXREG(SISSR, 0x1f, pSiS->oldSR1F);
@@ -6293,15 +6344,19 @@ SISRestore(ScrnInfoPtr pScrn)
/* Restore queue mode registers on 315/330 series */
/* (This became necessary due to the switch to VRAM queue) */
if(pSiS->VGAEngine == SIS_315_VGA) {
- unsigned char tempCR55;
- inSISIDXREG(SISCR,0x55,tempCR55);
- andSISIDXREG(SISCR,0x55,0x33);
+ unsigned char tempCR55=0;
+ if(pSiS->sishw_ext.jChipType <= SIS_330) {
+ inSISIDXREG(SISCR,0x55,tempCR55);
+ andSISIDXREG(SISCR,0x55,0x33);
+ }
outSISIDXREG(SISSR,0x26,0x01);
MMIO_OUT32(pSiS->IOBase, 0x85c4, 0);
outSISIDXREG(SISSR,0x27,sisReg->sisRegs3C4[0x27]);
outSISIDXREG(SISSR,0x26,sisReg->sisRegs3C4[0x26]);
MMIO_OUT32(pSiS->IOBase, 0x85C0, sisReg->sisMMIO85C0);
- outSISIDXREG(SISCR,0x55,tempCR55);
+ if(pSiS->sishw_ext.jChipType <= SIS_330) {
+ outSISIDXREG(SISCR,0x55,tempCR55);
+ }
}
#endif
@@ -6437,15 +6492,19 @@ SISVESARestore(ScrnInfoPtr pScrn)
/* (This became necessary due to the switch to VRAM queue) */
if(pSiS->VGAEngine == SIS_315_VGA) {
SISRegPtr sisReg = &pSiS->SavedReg;
- unsigned char tempCR55;
- inSISIDXREG(SISCR,0x55,tempCR55);
- andSISIDXREG(SISCR,0x55,0x33);
+ unsigned char tempCR55=0;
+ if(pSiS->sishw_ext.jChipType <= SIS_330) {
+ inSISIDXREG(SISCR,0x55,tempCR55);
+ andSISIDXREG(SISCR,0x55,0x33);
+ }
outSISIDXREG(SISSR,0x26,0x01);
MMIO_OUT32(pSiS->IOBase, 0x85c4, 0);
outSISIDXREG(SISSR,0x27,sisReg->sisRegs3C4[0x27]);
outSISIDXREG(SISSR,0x26,sisReg->sisRegs3C4[0x26]);
MMIO_OUT32(pSiS->IOBase, 0x85C0, sisReg->sisMMIO85C0);
- outSISIDXREG(SISCR,0x55,tempCR55);
+ if(pSiS->sishw_ext.jChipType <= SIS_330) {
+ outSISIDXREG(SISCR,0x55,tempCR55);
+ }
}
#endif
}
@@ -7077,7 +7136,9 @@ SISSwitchCRT2Type(ScrnInfoPtr pScrn, unsigned long newvbflags)
if(pSiS->DualHeadMode) return FALSE;
#endif
-#define SiS_NewVBMask (CRT2_ENABLE|CRT1_LCDA|TV_PAL|TV_NTSC|TV_PALM|TV_PALN|TV_NTSCJ|TV_AVIDEO|TV_SVIDEO|TV_SCART)
+#define SiS_NewVBMask (CRT2_ENABLE|CRT1_LCDA|TV_PAL|TV_NTSC|TV_PALM|TV_PALN|TV_NTSCJ| \
+ TV_AVIDEO|TV_SVIDEO|TV_SCART|TV_HIVISION|TV_YPBPR|TV_YPBPRALL|\
+ TV_YPBPRAR)
newvbflags &= SiS_NewVBMask;
newvbflags |= pSiS->VBFlags & ~SiS_NewVBMask;
@@ -7085,6 +7146,12 @@ SISSwitchCRT2Type(ScrnInfoPtr pScrn, unsigned long newvbflags)
if(!(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTLCDA)) {
newvbflags &= ~CRT1_LCDA;
}
+ if(!(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTHIVISION)) {
+ newvbflags &= ~TV_HIVISION;
+ }
+ if(!(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPR)) {
+ newvbflags &= ~TV_YPBPR;
+ }
#ifdef SISMERGED
if(pSiS->MergedFB) {
@@ -7160,20 +7227,32 @@ SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned sh
* or combinations thereof
*/
- /* No special treatment for NTSC-J here */
+ /* No special treatment for NTSC-J here; conditions equal NTSC */
if(cond) {
- vbflags &= ~(CRT2_ENABLE | TV_TYPE | TV_PALM | TV_PALN | CRT1_LCDA);
- if(cond & SiS_CF2_LCD) {
+ vbflags &= ~(CRT2_ENABLE | CRT1_LCDA | TV_STANDARD | TV_INTERFACE);
+ if((cond & SiS_CF2_TYPEMASK) == SiS_CF2_LCD) {
vbflags |= CRT2_LCD;
- } else if(cond & SiS_CF2_TV) {
- vbflags |= CRT2_TV;
+ } else if((cond & SiS_CF2_TYPEMASK) == SiS_CF2_TV) {
+ vbflags |= (CRT2_TV | TV_SVIDEO);
if(cond & SiS_CF2_TVPAL) vbflags |= TV_PAL;
else if(cond & SiS_CF2_TVPALM) vbflags |= (TV_PAL | TV_PALM);
else if(cond & SiS_CF2_TVPALN) vbflags |= (TV_PAL | TV_PALN);
else if(cond & SiS_CF2_TVNTSC) vbflags |= TV_NTSC;
- } else if(cond & SiS_CF2_VGA2) {
+ } else if((cond & SiS_CF2_TYPEMASK) == SiS_CF2_TVSPECIAL) {
+ vbflags |= CRT2_TV;
+ if((cond & SiS_CF2_TVSPECMASK) == SiS_CF2_TVHIVISION)
+ vbflags |= TV_HIVISION;
+ else if((cond & SiS_CF2_TVSPECMASK) == SiS_CF2_TVYPBPR525I)
+ vbflags |= (TV_YPBPR | TV_YPBPR525I);
+ else if((cond & SiS_CF2_TVSPECMASK) == SiS_CF2_TVYPBPR525P)
+ vbflags |= (TV_YPBPR | TV_YPBPR525P);
+ else if((cond & SiS_CF2_TVSPECMASK) == SiS_CF2_TVYPBPR750P)
+ vbflags |= (TV_YPBPR | TV_YPBPR750P);
+ else if((cond & SiS_CF2_TVSPECMASK) == SiS_CF2_TVYPBPR1080I)
+ vbflags |= (TV_YPBPR | TV_YPBPR1080I);
+ } else if((cond & SiS_CF2_TYPEMASK) == SiS_CF2_VGA2) {
vbflags |= CRT2_VGA;
- } else if(cond & SiS_CF2_CRT1LCDA) {
+ } else if((cond & SiS_CF2_TYPEMASK) == SiS_CF2_CRT1LCDA) {
vbflags |= CRT1_LCDA;
}
}
@@ -7393,7 +7472,7 @@ SISSetStartAddressCRT2(SISPtr pSiS, unsigned long base)
}
#ifdef SISMERGED
-Bool
+static Bool
InRegion(int x, int y, region r)
{
return (r.x0 <= x) && (x <= r.x1) && (r.y0 <= y) && (y <= r.y1);
@@ -8095,6 +8174,7 @@ SISSaveScreen(ScreenPtr pScreen, int mode)
if(!pSiS->Blank) {
inSISIDXREG(SISSR, 0x11, pSiS->LCDon);
+ if(pSiS->sishw_ext.jChipType >= SIS_661) pSiS->LCDon &= 0x0f;
}
if(pSiS->VBFlags & VB_CHRONTEL) {
@@ -8189,6 +8269,7 @@ SISSaveScreenDH(ScreenPtr pScreen, int mode)
if(!pSiS->BlankCRT2) {
inSISIDXREG(SISSR, 0x11, pSiS->LCDon);
+ if(pSiS->sishw_ext.jChipType >= SIS_661) pSiS->LCDon &= 0x0f;
}
if(pSiS->VBFlags & VB_CHRONTEL) {
@@ -8309,7 +8390,7 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn)
*/
#ifdef SISVRAMQ
/* We use VRAM Cmd Queue, not MMIO or AGP */
- unsigned char tempCR55;
+ unsigned char tempCR55 = 0;
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
@@ -8322,8 +8403,10 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn)
/* Set Command Queue Threshold to max value 11111b (?) */
outSISIDXREG(SISSR, 0x27, 0x1F);
/* No idea what this does */
- inSISIDXREG(SISCR, 0x55, tempCR55) ;
- andSISIDXREG(SISCR, 0x55, 0x33) ;
+ if(pSiS->sishw_ext.jChipType <= SIS_330) {
+ inSISIDXREG(SISCR, 0x55, tempCR55) ;
+ andSISIDXREG(SISCR, 0x55, 0x33) ;
+ }
/* Syncronous reset for Command Queue */
outSISIDXREG(SISSR, 0x26, 0x01);
MMIO_OUT32(pSiS->IOBase, 0x85c4, 0);
@@ -8352,7 +8435,9 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn)
#endif
temp += pSiS->cmdQueueOffset;
pSiS->cmdQueueBase = (unsigned long *)temp;
- outSISIDXREG(SISCR, 0x55, tempCR55);
+ if(pSiS->sishw_ext.jChipType <= SIS_330) {
+ outSISIDXREG(SISCR, 0x55, tempCR55);
+ }
#else
/* For MMIO */
/* Set Command Queue Threshold to max value 11111b */
@@ -8385,8 +8470,8 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn)
void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
{
SISPtr pSiS = SISPTR(pScrn);
- unsigned char CR30, CR31;
- unsigned char CR32, CR33;
+ unsigned char CR30, CR31, CR32, CR33;
+ unsigned char CR39 = 0, CR3B = 0;
unsigned char CR17, CR38 = 0;
unsigned char CR35 = 0, CR79 = 0;
unsigned long vbflag;
@@ -8519,25 +8604,24 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); /* Unlock Registers */
#endif
+ inSISIDXREG(SISCR, 0x30, CR30);
+ inSISIDXREG(SISCR, 0x31, CR31);
+ CR32 = pSiS->newCR32;
+ inSISIDXREG(SISCR, 0x33, CR33);
+
if(pSiS->Chipset == PCI_CHIP_SIS660) {
- inSISIDXREG(SISCR, 0x30, CR30);
- inSISIDXREG(SISCR, 0x31, CR31);
- CR32 = pSiS->newCR32;
- inSISIDXREG(SISCR, 0x33, CR33);
inSISIDXREG(SISCR, 0x35, CR35);
inSISIDXREG(SISCR, 0x38, CR38);
+ inSISIDXREG(SISCR, 0x39, CR39);
+
xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 4,
"Before: CR30=0x%02x,CR31=0x%02x,CR32=0x%02x,CR33=0x%02x,CR35=0x%02x,CR38=0x%02x\n",
CR30, CR31, CR32, CR33, CR35, CR38);
- CR38 &= ~0x03;
+ CR38 &= ~0x07;
} else {
- inSISIDXREG(SISCR, 0x30, CR30);
- inSISIDXREG(SISCR, 0x31, CR31);
- CR32 = pSiS->newCR32;
- inSISIDXREG(SISCR, 0x33, CR33);
if(pSiS->Chipset != PCI_CHIP_SIS300) {
switch(pSiS->VGAEngine) {
case SIS_300_VGA: temp = 0x35; break;
@@ -8547,8 +8631,9 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
}
if(pSiS->VGAEngine == SIS_315_VGA) {
inSISIDXREG(SISCR, 0x79, CR79);
- CR38 &= ~0x03; /* Clear LCDA/DualEdge bits */
+ CR38 &= ~0x3b; /* Clear LCDA/DualEdge and YPbPr bits */
}
+ inSISIDXREG(SISCR, 0x3b, CR3B);
xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 4,
"Before: CR30=0x%02x, CR31=0x%02x, CR32=0x%02x, CR33=0x%02x, CR%02x=0x%02x\n",
CR30, CR31, CR32, CR33, temp, CR38);
@@ -8581,26 +8666,65 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
case CRT2_TV:
- CR38 &= ~0xC0;
+ CR38 &= ~0xC0; /* Clear Pal M/N bits */
- if(vbflag & TV_CHSCART) {
+ if((vbflag & VB_CHRONTEL) && (vbflag & TV_CHSCART)) { /* Chrontel */
CR30 |= 0x10;
CR38 |= 0x04;
+ CR38 &= ~0x08;
CR31 |= 0x01;
- } else if(vbflag & TV_CHHDTV) {
+ } else if((vbflag & VB_CHRONTEL) && (vbflag & TV_CHYPBPR525I)) { /* Chrontel */
CR38 |= 0x08;
+ CR38 &= ~0x04;
CR31 &= ~0x01;
- } else if(vbflag & TV_HIVISION)
- CR30 |= 0x80;
- else if(vbflag & TV_SCART)
- CR30 |= 0x10;
- else {
+ } else if(vbflag & TV_HIVISION) { /* SiS bridge */
+ if(pSiS->Chipset == PCI_CHIP_SIS660) {
+ CR38 |= 0x04;
+ CR35 |= 0x60;
+ } else {
+ CR30 |= 0x80;
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ if(vbflag & (VB_301LV | VB_302LV | VB_301C)) {
+ CR38 |= (0x08 | 0x30);
+ }
+ }
+ }
+ CR31 |= 0x01;
+ CR35 |= 0x01;
+ } else if(vbflag & TV_YPBPR) { /* SiS bridge */
+ if(pSiS->Chipset == PCI_CHIP_SIS660) {
+ CR38 |= 0x04;
+ if(vbflag & TV_YPBPR525P) CR35 |= 0x20;
+ else if(vbflag & TV_YPBPR750P) CR35 |= 0x40;
+ else if(vbflag & TV_YPBPR1080I) CR35 |= 0x60;
+ CR31 &= ~0x01;
+ CR35 &= ~0x01;
+ CR39 &= ~0x03;
+ if((vbflag & TV_YPBPRAR) == TV_YPBPR43LB) CR39 |= 0x00;
+ else if((vbflag & TV_YPBPRAR) == TV_YPBPR43) CR39 |= 0x01;
+ else if((vbflag & TV_YPBPRAR) == TV_YPBPR169) CR39 |= 0x02;
+ else CR39 |= 0x03;
+ } else if(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPR) {
+ CR30 |= 0x80;
+ CR38 |= 0x08;
+ if(vbflag & TV_YPBPR525P) CR38 |= 0x10;
+ else if(vbflag & TV_YPBPR750P) CR38 |= 0x20;
+ else if(vbflag & TV_YPBPR1080I) CR38 |= 0x30;
+ CR31 &= ~0x01;
+ if(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPRAR) {
+ CR3B &= ~0x03;
+ if((vbflag & TV_YPBPRAR) == TV_YPBPR43LB) CR3B |= 0x00;
+ else if((vbflag & TV_YPBPRAR) == TV_YPBPR43) CR3B |= 0x03;
+ else if((vbflag & TV_YPBPRAR) == TV_YPBPR169) CR3B |= 0x01;
+ else CR3B |= 0x03;
+ }
+ }
+ } else { /* All */
+ if(vbflag & TV_SCART) CR30 |= 0x10;
if(vbflag & TV_SVIDEO) CR30 |= 0x08;
if(vbflag & TV_AVIDEO) CR30 |= 0x04;
- if(!(CR30 & 0x0c)) CR30 |= 0x08; /* default: SVIDEO */
- }
+ if(!(CR30 & 0x1C)) CR30 |= 0x08; /* default: SVIDEO */
- if(!(vbflag & (TV_CHSCART | TV_CHHDTV))) {
if(vbflag & TV_PAL) {
CR31 |= 0x01;
CR35 |= 0x01;
@@ -8622,6 +8746,10 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
CR35 |= 0x02;
}
}
+ if(vbflag & TV_SCART) {
+ CR31 |= 0x01;
+ CR35 |= 0x01;
+ }
}
CR31 &= ~0x04; /* Clear NotSimuMode */
@@ -8750,12 +8878,13 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
if(pSiS->Chipset == PCI_CHIP_SIS660) {
CR31 &= 0xfe; /* Clear PAL flag (now in CR35) */
- CR38 &= 0x03; /* Use only LCDA bits */
+ CR38 &= 0x07; /* Use only LCDA and HiVision/YPbPr bits */
outSISIDXREG(SISCR, 0x30, CR30);
outSISIDXREG(SISCR, 0x31, CR31);
outSISIDXREG(SISCR, 0x33, CR33);
outSISIDXREG(SISCR, 0x35, CR35);
- setSISIDXREG(SISCR, 0x38, 0xfc, CR38);
+ setSISIDXREG(SISCR, 0x38, 0xf8, CR38);
+ outSISIDXREG(SISCR, 0x39, CR39);
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4,
"After: CR30=0x%02x,CR31=0x%02x,CR33=0x%02x,CR35=0x%02x,CR38=%02x\n",
CR30, CR31, CR33, CR35, CR38);
@@ -8769,7 +8898,8 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
outSISIDXREG(SISCR, temp, CR38);
}
if(pSiS->VGAEngine == SIS_315_VGA) {
- outSISIDXREG(SISCR, 0x79, CR79);
+ outSISIDXREG(SISCR, 0x3b, CR3B);
+ outSISIDXREG(SISCR, 0x79, CR79);
}
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4,
"After: CR30=0x%02x,CR31=0x%02x,CR33=0x%02x,CR%02x=%02x\n",
@@ -8800,7 +8930,7 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
/* Functions for adjusting various TV settings */
/* These are used by the PostSetMode() functions as well as
- * the (hopefully) upcoming display properties extension/tool.
+ * the display properties tool SiSCtrl.
*
* There is each a Set and a Get routine. The Set functions
* take a value of the same range as the corresponding option.
@@ -8825,7 +8955,8 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
*
* All the routines are dual head aware. It does not matter
* if the function is called from the CRT1 or CRT2 session.
- * The values will be stored in pSiSEnt if we're running dual.
+ * The values will be in pSiSEnt anyway, and read from there
+ * if we're running dual head.
*/
void SiS_SetCHTVlumabandwidthcvbs(ScrnInfoPtr pScrn, int val)
@@ -9354,42 +9485,39 @@ void SiS_SetSISTVedgeenhance(ScrnInfoPtr pScrn, int val)
#ifdef SISDUALHEAD
if(pSiSEnt) pSiSEnt->sistvedgeenhance = val;
#endif
-
+
+ if(!(pSiS->VBFlags & VB_301)) return;
if(!(pSiS->VBFlags & CRT2_TV)) return;
- if(!(pSiS->VBFlags & VB_301)) return;
-
+
#ifdef UNLOCK_ALWAYS
sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
#endif
val /= 2;
if((val >= 0) && (val <= 7)) {
- setSISIDXREG(SISPART2,0x3A, 0x1F, (val << 5));
+ setSISIDXREG(SISPART2,0x3A, 0x1F, (val << 5));
}
}
int SiS_GetSISTVedgeenhance(ScrnInfoPtr pScrn)
{
SISPtr pSiS = SISPTR(pScrn);
+ int result = pSiS->sistvedgeenhance;
+ unsigned char temp;
#ifdef SISDUALHEAD
SISEntPtr pSiSEnt = pSiS->entityPrivate;
+
+ if(pSiSEnt && pSiS->DualHeadMode) result = pSiSEnt->sistvedgeenhance;
#endif
- if(!(pSiS->VBFlags & VB_301 && pSiS->VBFlags & CRT2_TV)) {
-#ifdef SISDUALHEAD
- if(pSiSEnt && pSiS->DualHeadMode)
- return (int)pSiSEnt->sistvedgeenhance;
- else
-#endif
- return (int)pSiS->sistvedgeenhance;
- } else {
- unsigned char temp;
+ if(!(pSiS->VBFlags & VB_301)) return result;
+ if(!(pSiS->VBFlags & CRT2_TV)) return result;
+
#ifdef UNLOCK_ALWAYS
- sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
-#endif
- inSISIDXREG(SISPART2, 0x3a, temp);
- return(int)(((temp & 0xe0) >> 5) * 2);
- }
+ sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
+#endif
+ inSISIDXREG(SISPART2, 0x3a, temp);
+ return(int)(((temp & 0xe0) >> 5) * 2);
}
void SiS_SetSISTVantiflicker(ScrnInfoPtr pScrn, int val)
@@ -9404,9 +9532,12 @@ void SiS_SetSISTVantiflicker(ScrnInfoPtr pScrn, int val)
if(pSiSEnt) pSiSEnt->sistvantiflicker = val;
#endif
- if(!(pSiS->VBFlags & CRT2_TV)) return;
+ if(!(pSiS->VBFlags & CRT2_TV)) return;
if(!(pSiS->VBFlags & VB_SISBRIDGE)) return;
-
+ if(pSiS->VBFlags & TV_HIVISION) return;
+ if((pSiS->VBFlags & TV_YPBPR) &&
+ (pSiS->VBFlags & (TV_YPBPR525P | TV_YPBPR750P | TV_YPBPR1080I))) return;
+
#ifdef UNLOCK_ALWAYS
sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
#endif
@@ -9420,25 +9551,25 @@ void SiS_SetSISTVantiflicker(ScrnInfoPtr pScrn, int val)
int SiS_GetSISTVantiflicker(ScrnInfoPtr pScrn)
{
SISPtr pSiS = SISPTR(pScrn);
+ int result = pSiS->sistvantiflicker;
+ unsigned char temp;
#ifdef SISDUALHEAD
SISEntPtr pSiSEnt = pSiS->entityPrivate;
+
+ if(pSiSEnt && pSiS->DualHeadMode) result = pSiSEnt->sistvantiflicker;
#endif
- if(!(pSiS->VBFlags & VB_SISBRIDGE && pSiS->VBFlags & CRT2_TV)) {
-#ifdef SISDUALHEAD
- if(pSiSEnt && pSiS->DualHeadMode)
- return (int)pSiSEnt->sistvantiflicker;
- else
-#endif
- return (int)pSiS->sistvantiflicker;
- } else {
- unsigned char temp;
+ if(!(pSiS->VBFlags & VB_SISBRIDGE)) return result;
+ if(!(pSiS->VBFlags & CRT2_TV)) return result;
+ if(pSiS->VBFlags & TV_HIVISION) return result;
+ if((pSiS->VBFlags & TV_YPBPR) &&
+ (pSiS->VBFlags & (TV_YPBPR525P | TV_YPBPR750P | TV_YPBPR1080I))) return result;
+
#ifdef UNLOCK_ALWAYS
- sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
-#endif
- inSISIDXREG(SISPART2, 0x0a, temp);
- return(int)((temp & 0x70) >> 4);
- }
+ sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
+#endif
+ inSISIDXREG(SISPART2, 0x0a, temp);
+ return(int)((temp & 0x70) >> 4);
}
void SiS_SetSISTVsaturation(ScrnInfoPtr pScrn, int val)
@@ -9470,27 +9601,23 @@ void SiS_SetSISTVsaturation(ScrnInfoPtr pScrn, int val)
int SiS_GetSISTVsaturation(ScrnInfoPtr pScrn)
{
SISPtr pSiS = SISPTR(pScrn);
+ int result = pSiS->sistvsaturation;
+ unsigned char temp;
#ifdef SISDUALHEAD
SISEntPtr pSiSEnt = pSiS->entityPrivate;
-#endif
- if(!(pSiS->VBFlags & VB_SISBRIDGE &&
- (!(pSiS->VBFlags & VB_301)) &&
- pSiS->VBFlags & CRT2_TV)) {
-#ifdef SISDUALHEAD
- if(pSiSEnt && pSiS->DualHeadMode)
- return (int)pSiSEnt->sistvsaturation;
- else
+ if(pSiSEnt && pSiS->DualHeadMode) result = pSiSEnt->sistvsaturation;
#endif
- return (int)pSiS->sistvsaturation;
- } else {
- unsigned char temp;
+
+ if(!(pSiS->VBFlags & VB_SISBRIDGE)) return result;
+ if(pSiS->VBFlags & VB_301) return result;
+ if(!(pSiS->VBFlags & CRT2_TV)) return result;
+
#ifdef UNLOCK_ALWAYS
- sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
+ sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
#endif
- inSISIDXREG(SISPART4, 0x21, temp);
- return(int)((temp & 0x07) * 2);
- }
+ inSISIDXREG(SISPART4, 0x21, temp);
+ return(int)((temp & 0x07) * 2);
}
void SiS_SetSISTVcolcalib(ScrnInfoPtr pScrn, int val, Bool coarse)
@@ -9503,7 +9630,7 @@ void SiS_SetSISTVcolcalib(ScrnInfoPtr pScrn, int val, Bool coarse)
unsigned char temp;
#ifdef SISDUALHEAD
- if(pSiSEnt) cbase = pSiSEnt->sistvccbase;
+ if(pSiSEnt && pSiS->DualHeadMode) cbase = pSiSEnt->sistvccbase;
#endif
if(coarse) {
@@ -9512,7 +9639,7 @@ void SiS_SetSISTVcolcalib(ScrnInfoPtr pScrn, int val, Bool coarse)
#ifdef SISDUALHEAD
if(pSiSEnt) {
pSiSEnt->sistvcolcalibc = val;
- cfine = pSiSEnt->sistvcolcalibf;
+ if(pSiS->DualHeadMode) cfine = pSiSEnt->sistvcolcalibf;
}
#endif
} else {
@@ -9521,13 +9648,14 @@ void SiS_SetSISTVcolcalib(ScrnInfoPtr pScrn, int val, Bool coarse)
#ifdef SISDUALHEAD
if(pSiSEnt) {
pSiSEnt->sistvcolcalibf = val;
- ccoarse = pSiSEnt->sistvcolcalibc;
+ if(pSiS->DualHeadMode) ccoarse = pSiSEnt->sistvcolcalibc;
}
#endif
}
- if(!(pSiS->VBFlags & CRT2_TV)) return;
- if(!(pSiS->VBFlags & VB_SISBRIDGE)) return;
+ if(!(pSiS->VBFlags & CRT2_TV)) return;
+ if(!(pSiS->VBFlags & VB_SISBRIDGE)) return;
+ if(pSiS->VBFlags & (TV_HIVISION | TV_YPBPR)) return;
#ifdef UNLOCK_ALWAYS
sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
@@ -9559,16 +9687,12 @@ int SiS_GetSISTVcolcalib(ScrnInfoPtr pScrn, Bool coarse)
SISEntPtr pSiSEnt = pSiS->entityPrivate;
if(pSiSEnt && pSiS->DualHeadMode)
- if(coarse)
- return (int)pSiSEnt->sistvcolcalibc;
- else
- return (int)pSiSEnt->sistvcolcalibf;
+ if(coarse) return (int)pSiSEnt->sistvcolcalibc;
+ else return (int)pSiSEnt->sistvcolcalibf;
else
#endif
- if(coarse)
- return (int)pSiS->sistvcolcalibc;
- else
- return (int)pSiS->sistvcolcalibf;
+ if(coarse) return (int)pSiS->sistvcolcalibc;
+ else return (int)pSiS->sistvcolcalibf;
}
void SiS_SetSISTVcfilter(ScrnInfoPtr pScrn, int val)
@@ -9583,8 +9707,9 @@ void SiS_SetSISTVcfilter(ScrnInfoPtr pScrn, int val)
if(pSiSEnt) pSiSEnt->sistvcfilter = pSiS->sistvcfilter;
#endif
- if(!(pSiS->VBFlags & CRT2_TV)) return;
- if(!(pSiS->VBFlags & VB_SISBRIDGE)) return;
+ if(!(pSiS->VBFlags & CRT2_TV)) return;
+ if(!(pSiS->VBFlags & VB_SISBRIDGE)) return;
+ if(pSiS->VBFlags & (TV_HIVISION | TV_YPBPR)) return;
#ifdef UNLOCK_ALWAYS
sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
@@ -9596,25 +9721,23 @@ void SiS_SetSISTVcfilter(ScrnInfoPtr pScrn, int val)
int SiS_GetSISTVcfilter(ScrnInfoPtr pScrn)
{
SISPtr pSiS = SISPTR(pScrn);
+ int result = pSiS->sistvcfilter;
+ unsigned char temp;
#ifdef SISDUALHEAD
SISEntPtr pSiSEnt = pSiS->entityPrivate;
-#endif
- if(!(pSiS->VBFlags & VB_SISBRIDGE && pSiS->VBFlags & CRT2_TV)) {
-#ifdef SISDUALHEAD
- if(pSiSEnt && pSiS->DualHeadMode)
- return (int)pSiSEnt->sistvcfilter;
- else
+ if(pSiSEnt && pSiS->DualHeadMode) result = pSiSEnt->sistvcfilter;
#endif
- return (int)pSiS->sistvcfilter;
- } else {
- unsigned char temp;
+
+ if(!(pSiS->VBFlags & VB_SISBRIDGE)) return result;
+ if(!(pSiS->VBFlags & CRT2_TV)) return result;
+ if(pSiS->VBFlags & (TV_HIVISION | TV_YPBPR)) return result;
+
#ifdef UNLOCK_ALWAYS
- sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
+ sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
#endif
- inSISIDXREG(SISPART2, 0x30, temp);
- return(int)((temp & 0x10) ? 1 : 0);
- }
+ inSISIDXREG(SISPART2, 0x30, temp);
+ return(int)((temp & 0x10) ? 1 : 0);
}
void SiS_SetSISTVyfilter(ScrnInfoPtr pScrn, int val)
@@ -9631,15 +9754,16 @@ void SiS_SetSISTVyfilter(ScrnInfoPtr pScrn, int val)
if(pSiSEnt) pSiSEnt->sistvyfilter = pSiS->sistvyfilter;
#endif
- if(!(pSiS->VBFlags & CRT2_TV)) return;
- if(!(pSiS->VBFlags & VB_SISBRIDGE)) return;
+ if(!(pSiS->VBFlags & CRT2_TV)) return;
+ if(!(pSiS->VBFlags & VB_SISBRIDGE)) return;
+ if(pSiS->VBFlags & (TV_HIVISION | TV_YPBPR)) return;
p35 = pSiS->p2_35; p36 = pSiS->p2_36;
p37 = pSiS->p2_37; p38 = pSiS->p2_38;
p48 = pSiS->p2_48; p49 = pSiS->p2_49;
p4a = pSiS->p2_4a; p30 = pSiS->p2_30;
#ifdef SISDUALHEAD
- if(pSiSEnt) {
+ if(pSiSEnt && pSiS->DualHeadMode) {
p35 = pSiSEnt->p2_35; p36 = pSiSEnt->p2_36;
p37 = pSiSEnt->p2_37; p38 = pSiSEnt->p2_38;
p48 = pSiSEnt->p2_48; p49 = pSiSEnt->p2_49;
@@ -9948,7 +10072,7 @@ void SiS_SetTVxposoffset(ScrnInfoPtr pScrn, int val)
if((val >= -32) && (val <= 32)) {
- unsigned char p2_1f,p2_20,p2_2b,p2_43,p3d4_34;
+ unsigned char p2_1f,p2_20,p2_2b,p2_43;
unsigned short temp;
int myadd2, mysub;
@@ -9960,8 +10084,6 @@ void SiS_SetTVxposoffset(ScrnInfoPtr pScrn, int val)
p2_20 = pSiSEnt->p2_20;
}
#endif
- inSISIDXREG(SISCR,0x34,p3d4_34);
- p3d4_34 &= 0x7f;
temp = p2_1f | ((p2_20 & 0xf0) << 4);
temp += (val * 2);
@@ -9969,38 +10091,30 @@ void SiS_SetTVxposoffset(ScrnInfoPtr pScrn, int val)
p2_1f = temp & 0xff;
p2_20 = (temp & 0xf00) >> 4;
- if((pSiS->VBFlags & (TV_NTSC | TV_PALM)) &&
- ((p3d4_34 == 0x64) || (p3d4_34 == 0x4a) || (p3d4_34 == 0x38))) {
- temp += 1514;
- myadd2 = 4;
- mysub = 4;
+ if(pSiS->MiscFlags & MISC_TVNTSC1024) {
+ temp += 1514; myadd2 = 4; mysub = 4;
+ } else if((pSiS->VBFlags & TV_YPBPR) && (pSiS->VBFlags & (TV_YPBPR525P | TV_YPBPR750P))) {
+ myadd2 = -7;
+ if(pSiS->VBFlags & TV_YPBPR525P) {
+ temp += 1274; mysub = 15;
+ } else {
+ temp += 1284; mysub = 12;
+ }
+ } else if((pSiS->VBFlags & TV_HIVISION) ||
+ ((pSiS->VBFlags & TV_YPBPR) && (pSiS->VBFlags & TV_YPBPR1080I))) {
+ temp += 1737; myadd2 = -4;
+ if(pSiS->VBFlags & VB_301) myadd2 += 3;
+ mysub = 12;
} else {
- temp += 1363;
- myadd2 = 3;
+ temp += 1363; myadd2 = 3;
if(pSiS->VBFlags & VB_301) myadd2 += 3;
+ if((pSiS->VBFlags & TV_YPBPR) && (pSiS->VBFlags & TV_YPBPR525I)) myadd2 += 3;
mysub = 5;
}
p2_2b = ((temp & 0xf00) >> 4) | ((p2_1f - mysub) & 0x0f);
p2_43 = p2_1f + myadd2;
-#if 0
- p2_1f += (val * 2);
- if((pSiS->VBFlags & (TV_NTSC | TV_PALM)) &&
- ((p3d4_34 == 0x64) || (p3d4_34 == 0x4a) || (p3d4_34 == 0x38))) {
- p2_2b = ((p2_1f - 4) & 0x0f) | 0x70;
- p2_2c = p2_1f - 22;
- p2_2d = ((p2_2c - 4) & 0x0f) | 0xe0;
- p2_43 = p2_1f + 4;
- } else {
- p2_2b = ((p2_1f - 5) & 0x0f) | 0x60;
- p2_2c = p2_1f + 1;
- p2_2d = ((p2_2c - 5) & 0x0f) | (pSiS->VBFlags & TV_PAL ? 0x80 : 0xf0);
- p2_43 = p2_1f + 3;
- if(pSiS->VBFlags & VB_301) p2_43 += 3;
- }
-#endif
-
SISWaitRetraceCRT2(pScrn);
outSISIDXREG(SISPART2,0x1f,p2_1f);
setSISIDXREG(SISPART2,0x20,0x0F,p2_20);
@@ -10078,7 +10192,7 @@ void SiS_SetTVyposoffset(ScrnInfoPtr pScrn, int val)
#ifdef SISDUALHEAD
SISEntPtr pSiSEnt = pSiS->entityPrivate;
#endif
-
+
#ifdef UNLOCK_ALWAYS
sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
#endif
@@ -10116,7 +10230,7 @@ void SiS_SetTVyposoffset(ScrnInfoPtr pScrn, int val)
if((val >= -32) && (val <= 32)) {
char p2_01, p2_02;
- val /= 4;
+ val /= 2; /* 4 */
p2_01 = pSiS->p2_01;
p2_02 = pSiS->p2_02;
#ifdef SISDUALHEAD
@@ -10125,10 +10239,10 @@ void SiS_SetTVyposoffset(ScrnInfoPtr pScrn, int val)
p2_02 = pSiSEnt->p2_02;
}
#endif
- p2_01 += (val * 2);
- p2_02 += (val * 2);
+ p2_01 += val; /* val * 2 */
+ p2_02 += val; /* val * 2 */
while((p2_01 <= 0) || (p2_02 <= 0)) {
- p2_01 += 2;
+ p2_01 += 2;
p2_02 += 2;
}
SISWaitRetraceCRT2(pScrn);
@@ -10136,9 +10250,9 @@ void SiS_SetTVyposoffset(ScrnInfoPtr pScrn, int val)
outSISIDXREG(SISPART2,0x02,p2_02);
}
}
-
+
}
-
+
} else if(pSiS->Chipset == PCI_CHIP_SIS6326) {
if(pSiS->SiS6326Flags & SIS6326_TVDETECTED) {
@@ -10278,6 +10392,7 @@ int SiS_GetTVxscale(ScrnInfoPtr pScrn)
void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val)
{
SISPtr pSiS = SISPTR(pScrn);
+ Bool usentsc = FALSE;
#ifdef SISDUALHEAD
SISEntPtr pSiSEnt = pSiS->entityPrivate;
#endif
@@ -10294,17 +10409,22 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val)
if(pSiSEnt) pSiSEnt->tvyscale = val;
#endif
- if(pSiS->VBFlags & (TV_HIVISION | TV_YPBPR)) return;
-
if(pSiS->VGAEngine == SIS_315_VGA || pSiS->VGAEngine == SIS_315_VGA) {
if((pSiS->VBFlags & CRT2_TV) && (pSiS->VBFlags & VB_SISBRIDGE)) {
- int srindex = -1;
- int newvde, i=0, j, temp;
- int vlimit = (pSiS->VBFlags & (TV_NTSC | TV_PALM)) ? 259 : 309;
+ int srindex = -1, newvde, i = 0, j, vlimit, temp;
unsigned char p3d4_34;
+ if(pSiS->VBFlags & TV_HIVISION) return;
+ if((pSiS->VBFlags & TV_YPBPR) &&
+ (pSiS->VBFlags & (TV_YPBPR1080I | TV_YPBPR750P | TV_YPBPR525P))) return;
+
+ if(pSiS->VBFlags & TV_YPBPR) usentsc = TRUE;
+ else if(pSiS->VBFlags & (TV_NTSC | TV_PALM)) usentsc = TRUE;
+
+ vlimit = usentsc ? 259 : 309;
+
inSISIDXREG(SISCR,0x34,p3d4_34);
switch((p3d4_34 & 0x7f)) {
@@ -10316,7 +10436,7 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val)
case 0x2e: /* 640x480 */
case 0x44:
case 0x62:
- srindex = (pSiS->VBFlags & (TV_NTSC | TV_PALM)) ? 0 : 21;
+ srindex = usentsc ? 0 : 21;
break;
case 0x31: /* 720x480 */
case 0x33:
@@ -10328,7 +10448,7 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val)
case 0x60:
case 0x61:
if(pSiS->VGAEngine == SIS_315_VGA) {
- srindex = (pSiS->VBFlags & (TV_NTSC | TV_PALM)) ? 7 : 28;
+ srindex = usentsc ? 7 : 28;
}
break;
#if 0
@@ -10339,7 +10459,7 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val)
case 0x30: /* 800x600 */
case 0x47:
case 0x63:
- srindex = (pSiS->VBFlags & (TV_NTSC | TV_PALM)) ? 14 : 35;
+ srindex = usentsc ? 14 : 35;
}
if(srindex >= 0) {
@@ -10367,6 +10487,7 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val)
unsigned char p2_46 = pSiS->p2_46;
unsigned char p2_47 = pSiS->p2_47;
unsigned char p1scaling[9], p4scaling[9];
+ unsigned char *p2scaling;
for(i=0; i<9; i++) {
p1scaling[i] = pSiS->scalingp1[i];
@@ -10374,8 +10495,9 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val)
for(i=0; i<9; i++) {
p4scaling[i] = pSiS->scalingp4[i];
}
+ p2scaling = &pSiS->scalingp2[0];
#ifdef SISDUALHEAD
- if(pSiSEnt) {
+ if(pSiSEnt && pSiS->DualHeadMode) {
p2_0a = pSiSEnt->p2_0a;
p2_2f = pSiSEnt->p2_2f;
p2_30 = pSiSEnt->p2_30;
@@ -10387,9 +10509,15 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val)
for(i=0; i<9; i++) {
p4scaling[i] = pSiSEnt->scalingp4[i];
}
+ p2scaling = &pSiSEnt->scalingp2[0];
}
#endif
SISWaitRetraceCRT2(pScrn);
+ if(pSiS->VBFlags & (VB_301C|VB_302ELV)) {
+ for(i=0; i<64; i++) {
+ outSISIDXREG(SISPART2,(0xc0 + i),p2scaling[i]);
+ }
+ }
for(i=0; i<9; i++) {
outSISIDXREG(SISPART1,SiSScalingP1Regs[i],p1scaling[i]);
}
@@ -10408,10 +10536,11 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val)
} else {
int so = (pSiS->VGAEngine == SIS_300_VGA) ? 12 : 0;
- int realvde;
+ int realvde, j, srindex301c, myypos, watchdog = 32;
unsigned long calctemp;
srindex += i;
+ srindex301c = srindex * 64;
newvde = SiSTVVScale[srindex].ScaleVDE;
realvde = SiSTVVScale[srindex].RealVDE;
@@ -10419,10 +10548,24 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val)
inSISIDXREG(SISPART2,0x01,temp);
temp = vlimit - (temp & 0x7f);
if((temp - (((newvde >> 1) - 2) + 9)) > 0) break;
- SiS_SetTVyposoffset(pScrn, pSiS->tvypos - 1);
- } while(1);
+ myypos = pSiS->tvypos - 1;
+#ifdef SISDUALHEAD
+ if(pSiSEnt && pSiS->DualHeadMode) myypos = pSiSEnt->tvypos - 1;
+#endif
+ SiS_SetTVyposoffset(pScrn, myypos);
+ } while(watchdog--);
SISWaitRetraceCRT2(pScrn);
+
+ if(pSiS->VBFlags & (VB_301C|VB_302ELV)) {
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "301C scaler: Table index %d\n");
+#endif
+ for(j=0; j<64; j++) {
+ outSISIDXREG(SISPART2,(0xc0 + j), SiS301CScaling[srindex301c + j]);
+ }
+ }
+
if(!(pSiS->VBFlags & VB_301)) {
temp = (newvde >> 1) - 3;
setSISIDXREG(SISPART2,0x46,0x9f,((temp & 0x0300) >> 3));
@@ -10551,10 +10694,10 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg)
if(pSiS->VGAEngine == SIS_315_VGA) {
if((pSiS->CRT1off) && (doit)) {
- orSISIDXREG(SISCR,0x63,0x40);
+ orSISIDXREG(SISCR,pSiS->myCR63,0x40);
orSISIDXREG(SISSR,0x1f,0xc0);
} else {
- andSISIDXREG(SISCR,0x63,0xBF);
+ andSISIDXREG(SISCR,pSiS->myCR63,0xBF);
andSISIDXREG(SISSR,0x1f,0x3f);
}
@@ -10663,10 +10806,32 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg)
}
}
+ /* Determine if our very special TV mode is active */
+ pSiS->MiscFlags &= ~MISC_TVNTSC1024;
+ if((pSiS->VBFlags & VB_SISBRIDGE) && (pSiS->VBFlags & CRT2_TV) && (!(pSiS->VBFlags & TV_HIVISION))) {
+ if( ((pSiS->VBFlags & TV_YPBPR) && (pSiS->VBFlags & TV_YPBPR525I)) ||
+ ((!(pSiS->VBFlags & TV_YPBPR)) && (pSiS->VBFlags & (TV_NTSC | TV_PALM))) ) {
+ inSISIDXREG(SISCR,0x34,tmpreg);
+ tmpreg &= 0x7f;
+ if((tmpreg == 0x64) || (tmpreg == 0x4a) || (tmpreg == 0x38)) {
+ pSiS->MiscFlags |= MISC_TVNTSC1024;
+ }
+ }
+ }
+
#ifdef SISVRAMQ
if(pSiS->VGAEngine == SIS_315_VGA) {
+ int i;
/* Re-Enable command queue */
SiSEnableTurboQueue(pScrn);
+ /* Get HWCursor register contents for backup */
+ for(i = 0; i < 16; i++) {
+ pSiS->HWCursorBackup[i] = MMIO_IN32(pSiS->IOBase, 0x8500 + (i << 2));
+ }
+ if(pSiS->sishw_ext.jChipType >= SIS_330) {
+ /* Enable HWCursor protection (Y pos as trigger) */
+ andSISIDXREG(SISCR, 0x5b, ~0x30);
+ }
}
#endif
@@ -10740,7 +10905,7 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg)
pSiS->tvy = SiS_GetCH700x(pSiS->SiS_Pr, 0x0b);
pSiS->tvy |= ((SiS_GetCH700x(pSiS->SiS_Pr, 0x08) & 0x01) << 8);
#ifdef SISDUALHEAD
- if(pSiSEnt && pSiS->DualHeadMode) {
+ if(pSiSEnt) {
pSiSEnt->tvx = pSiS->tvx;
pSiSEnt->tvy = pSiS->tvy;
}
@@ -10804,9 +10969,9 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg)
inSISIDXREG(SISPART2,0x44,pSiS->p2_44);
inSISIDXREG(SISPART2,0x45,pSiS->p2_45);
if(!(pSiS->VBFlags & VB_301)) {
- inSISIDXREG(SISPART2,0x46,pSiS->p2_46);
+ inSISIDXREG(SISPART2,0x46,pSiS->p2_46);
} else {
- pSiS->p2_46 = 0;
+ pSiS->p2_46 = 0;
}
inSISIDXREG(SISPART2,0x0a,pSiS->p2_0a);
inSISIDXREG(SISPART2,0x31,cbase);
@@ -10835,24 +11000,34 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg)
for(i=0; i<9; i++) {
inSISIDXREG(SISPART4,SiSScalingP4Regs[i],pSiS->scalingp4[i]);
}
+ if(pSiS->VBFlags & (VB_301C | VB_302ELV)) {
+ for(i=0; i<64; i++) {
+ inSISIDXREG(SISPART2,(0xc0 + i),pSiS->scalingp2[i]);
+ }
+ }
#ifdef SISDUALHEAD
- if(pSiSEnt && pSiS->DualHeadMode) {
- pSiSEnt->p2_1f = pSiS->p2_1f; pSiSEnt->p2_20 = pSiS->p2_20;
- pSiSEnt->p2_01 = pSiS->p2_01; pSiSEnt->p2_02 = pSiS->p2_02;
- pSiSEnt->p2_44 = pSiS->p2_44; pSiSEnt->p2_45 = pSiS->p2_45;
- pSiSEnt->p2_46 = pSiS->p2_46; pSiSEnt->p2_0a = pSiS->p2_0a;
- pSiSEnt->sistvccbase = pSiS->sistvccbase;
- pSiSEnt->p2_35 = pSiS->p2_35; pSiSEnt->p2_36 = pSiS->p2_36;
- pSiSEnt->p2_37 = pSiS->p2_37; pSiSEnt->p2_38 = pSiS->p2_38;
- pSiSEnt->p2_48 = pSiS->p2_48; pSiSEnt->p2_49 = pSiS->p2_49;
- pSiSEnt->p2_4a = pSiS->p2_4a; pSiSEnt->p2_2f = pSiS->p2_2f;
- pSiSEnt->p2_30 = pSiS->p2_30; pSiSEnt->p2_47 = pSiS->p2_47;
- for(i=0; i<9; i++) {
- pSiSEnt->scalingp1[i] = pSiS->scalingp1[i];
- }
- for(i=0; i<9; i++) {
- pSiSEnt->scalingp4[i] = pSiS->scalingp4[i];
- }
+ if(pSiSEnt) {
+ pSiSEnt->p2_1f = pSiS->p2_1f; pSiSEnt->p2_20 = pSiS->p2_20;
+ pSiSEnt->p2_01 = pSiS->p2_01; pSiSEnt->p2_02 = pSiS->p2_02;
+ pSiSEnt->p2_44 = pSiS->p2_44; pSiSEnt->p2_45 = pSiS->p2_45;
+ pSiSEnt->p2_46 = pSiS->p2_46; pSiSEnt->p2_0a = pSiS->p2_0a;
+ pSiSEnt->sistvccbase = pSiS->sistvccbase;
+ pSiSEnt->p2_35 = pSiS->p2_35; pSiSEnt->p2_36 = pSiS->p2_36;
+ pSiSEnt->p2_37 = pSiS->p2_37; pSiSEnt->p2_38 = pSiS->p2_38;
+ pSiSEnt->p2_48 = pSiS->p2_48; pSiSEnt->p2_49 = pSiS->p2_49;
+ pSiSEnt->p2_4a = pSiS->p2_4a; pSiSEnt->p2_2f = pSiS->p2_2f;
+ pSiSEnt->p2_30 = pSiS->p2_30; pSiSEnt->p2_47 = pSiS->p2_47;
+ for(i=0; i<9; i++) {
+ pSiSEnt->scalingp1[i] = pSiS->scalingp1[i];
+ }
+ for(i=0; i<9; i++) {
+ pSiSEnt->scalingp4[i] = pSiS->scalingp4[i];
+ }
+ if(pSiS->VBFlags & (VB_301C | VB_302ELV)) {
+ for(i=0; i<64; i++) {
+ pSiSEnt->scalingp2[i] = pSiS->scalingp2[i];
+ }
+ }
}
#endif
if((val = mysistvantiflicker) != -1) {
diff --git a/src/sis_driver.h b/src/sis_driver.h
index 5833186..6b0577a 100644
--- a/src/sis_driver.h
+++ b/src/sis_driver.h
@@ -1,26 +1,33 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h,v 1.30 2003/12/16 17:35:07 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h,v 1.36 2004/01/23 22:29:05 twini Exp $ */
/*
* Global data and definitions
*
- * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1) Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2) Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3) All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement: "This product includes
+ * software developed by Thomas Winischhofer, Vienna, Austria."
+ * 4) The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Author: Thomas Winischhofer <thomas@winischhofer.net>
*
@@ -1028,6 +1035,232 @@ unsigned const char SiSScalingP4Regs[] = {
0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b
};
+static const unsigned char SiS301CScaling[] = {
+
+ /* NTSC/PAL-M/525ip 640x480 */
+
+ 0x03,0x1C,0x03,0x7E,0x01,0x1C,0x05,0x7E,0x00,0x1C,0x06,0x7E,0x7F,0x1B,0x09,0x7D,
+ 0x7E,0x1A,0x0B,0x7D,0x7D,0x19,0x0D,0x7D,0x7D,0x18,0x0F,0x7C,0x7C,0x16,0x12,0x7C,
+ 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x16,0x7C,0x7C,0x0F,0x18,0x7D,0x7C,0x0D,0x19,0x7E,
+ 0x7D,0x0B,0x1A,0x7E,0x7D,0x09,0x1B,0x7F,0x7E,0x06,0x1C,0x00,0x7E,0x05,0x1C,0x01,
+
+ 0x03,0x1B,0x03,0x7F,0x02,0x1B,0x05,0x7E,0x00,0x1B,0x07,0x7E,0x7F,0x1B,0x09,0x7D,
+ 0x7E,0x1A,0x0B,0x7D,0x7D,0x19,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7C,0x16,0x12,0x7C,
+ 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x16,0x7C,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x19,0x7E,
+ 0x7D,0x0B,0x1A,0x7E,0x7D,0x09,0x1B,0x7F,0x7E,0x07,0x1B,0x00,0x7E,0x05,0x1B,0x02,
+
+ 0x04,0x1A,0x04,0x7E,0x02,0x1B,0x05,0x7E,0x01,0x1A,0x07,0x7E,0x00,0x1A,0x09,0x7D,
+ 0x7F,0x19,0x0B,0x7D,0x7E,0x18,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7D,0x15,0x12,0x7C,
+ 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x18,0x7F,
+ 0x7D,0x0B,0x19,0x7F,0x7D,0x09,0x1A,0x00,0x7D,0x07,0x1A,0x02,0x7E,0x05,0x1B,0x02,
+
+ 0x04,0x1A,0x04,0x7E,0x03,0x1A,0x06,0x7D,0x01,0x1A,0x08,0x7D,0x00,0x19,0x0A,0x7D,
+ 0x7F,0x19,0x0C,0x7C,0x7E,0x18,0x0E,0x7C,0x7E,0x17,0x10,0x7B,0x7D,0x15,0x12,0x7C,
+ 0x7D,0x13,0x13,0x7D,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0E,0x18,0x7E,
+ 0x7D,0x0C,0x19,0x7E,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x1A,0x01,0x7E,0x06,0x1A,0x02,
+
+ 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x19,0x0A,0x7C,
+ 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x10,0x7C,0x7D,0x15,0x11,0x7D,
+ 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x15,0x7D,0x7D,0x10,0x16,0x7D,0x7D,0x0E,0x17,0x7E,
+ 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04,
+
+ 0x05,0x18,0x05,0x7E,0x04,0x19,0x07,0x7C,0x02,0x18,0x08,0x7E,0x01,0x18,0x0A,0x7D,
+ 0x00,0x17,0x0C,0x7D,0x7F,0x17,0x0E,0x7C,0x7E,0x15,0x0F,0x7E,0x7E,0x14,0x11,0x7D,
+ 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x15,0x7F,0x7D,0x0E,0x17,0x7E,
+ 0x7D,0x0C,0x17,0x00,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x18,0x03,0x7D,0x07,0x19,0x03,
+
+ 0x05,0x18,0x05,0x7E,0x04,0x18,0x07,0x7D,0x03,0x18,0x09,0x7C,0x02,0x17,0x0A,0x7D,
+ 0x01,0x17,0x0C,0x7C,0x00,0x16,0x0E,0x7C,0x7F,0x15,0x0F,0x7D,0x7E,0x14,0x11,0x7D,
+ 0x7E,0x12,0x12,0x7E,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x15,0x7F,0x7D,0x0E,0x16,0x7F,
+ 0x7D,0x0C,0x17,0x00,0x7D,0x0A,0x17,0x02,0x7D,0x09,0x18,0x02,0x7D,0x07,0x18,0x04,
+
+ /* NTSC/PAL-M/525ip 720x480 */
+
+ 0x03,0x1C,0x03,0x7E,0x01,0x1C,0x05,0x7E,0x00,0x1C,0x06,0x7E,0x7F,0x1B,0x09,0x7D,
+ 0x7E,0x1A,0x0B,0x7D,0x7D,0x19,0x0D,0x7D,0x7D,0x18,0x0F,0x7C,0x7C,0x16,0x12,0x7C,
+ 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x16,0x7C,0x7C,0x0F,0x18,0x7D,0x7C,0x0D,0x19,0x7E,
+ 0x7D,0x0B,0x1A,0x7E,0x7D,0x09,0x1B,0x7F,0x7E,0x06,0x1C,0x00,0x7E,0x05,0x1C,0x01,
+
+ 0x03,0x1B,0x03,0x7F,0x02,0x1B,0x05,0x7E,0x00,0x1B,0x07,0x7E,0x7F,0x1B,0x09,0x7D,
+ 0x7E,0x1A,0x0B,0x7D,0x7D,0x19,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7C,0x16,0x12,0x7C,
+ 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x16,0x7C,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x19,0x7E,
+ 0x7D,0x0B,0x1A,0x7E,0x7D,0x09,0x1B,0x7F,0x7E,0x07,0x1B,0x00,0x7E,0x05,0x1B,0x02,
+
+ 0x04,0x1A,0x04,0x7E,0x02,0x1B,0x05,0x7E,0x01,0x1A,0x07,0x7E,0x00,0x1A,0x09,0x7D,
+ 0x7F,0x19,0x0B,0x7D,0x7E,0x18,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7D,0x15,0x12,0x7C,
+ 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x18,0x7F,
+ 0x7D,0x0B,0x19,0x7F,0x7D,0x09,0x1A,0x00,0x7D,0x07,0x1A,0x02,0x7E,0x05,0x1B,0x02,
+
+ 0x04,0x1A,0x04,0x7E,0x03,0x1A,0x06,0x7D,0x01,0x1A,0x08,0x7D,0x00,0x19,0x0A,0x7D,
+ 0x7F,0x19,0x0C,0x7C,0x7E,0x18,0x0E,0x7C,0x7E,0x17,0x10,0x7B,0x7D,0x15,0x12,0x7C,
+ 0x7D,0x13,0x13,0x7D,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0E,0x18,0x7E,
+ 0x7D,0x0C,0x19,0x7E,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x1A,0x01,0x7E,0x06,0x1A,0x02,
+
+ 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x19,0x0A,0x7C,
+ 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x10,0x7C,0x7D,0x15,0x11,0x7D,
+ 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x15,0x7D,0x7D,0x10,0x16,0x7D,0x7D,0x0E,0x17,0x7E,
+ 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04,
+
+ 0x05,0x18,0x05,0x7E,0x04,0x19,0x07,0x7C,0x02,0x18,0x08,0x7E,0x01,0x18,0x0A,0x7D,
+ 0x00,0x17,0x0C,0x7D,0x7F,0x17,0x0E,0x7C,0x7E,0x15,0x0F,0x7E,0x7E,0x14,0x11,0x7D,
+ 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x15,0x7F,0x7D,0x0E,0x17,0x7E,
+ 0x7D,0x0C,0x17,0x00,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x18,0x03,0x7D,0x07,0x19,0x03,
+
+ 0x05,0x18,0x05,0x7E,0x04,0x18,0x07,0x7D,0x03,0x18,0x09,0x7C,0x02,0x17,0x0A,0x7D,
+ 0x01,0x17,0x0C,0x7C,0x00,0x16,0x0E,0x7C,0x7F,0x15,0x0F,0x7D,0x7E,0x14,0x11,0x7D,
+ 0x7E,0x12,0x12,0x7E,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x15,0x7F,0x7D,0x0E,0x16,0x7F,
+ 0x7D,0x0C,0x17,0x00,0x7D,0x0A,0x17,0x02,0x7D,0x09,0x18,0x02,0x7D,0x07,0x18,0x04,
+
+ /* NTSC/PAL-M/525i 800x600 */
+
+ 0x07,0x15,0x07,0x7D,0x05,0x15,0x08,0x7E,0x04,0x15,0x09,0x7E,0x03,0x15,0x0B,0x7D,
+ 0x02,0x14,0x0C,0x7E,0x01,0x14,0x0D,0x7E,0x00,0x13,0x0F,0x7E,0x00,0x12,0x10,0x7E,
+ 0x7F,0x11,0x11,0x7F,0x7E,0x10,0x12,0x00,0x7E,0x0F,0x13,0x00,0x7E,0x0D,0x14,0x01,
+ 0x7D,0x0C,0x14,0x03,0x7D,0x0B,0x15,0x03,0x7D,0x09,0x15,0x05,0x7D,0x08,0x15,0x06,
+
+ 0x07,0x15,0x07,0x7D,0x06,0x15,0x08,0x7D,0x05,0x15,0x09,0x7D,0x04,0x14,0x0B,0x7D,
+ 0x03,0x14,0x0C,0x7D,0x02,0x13,0x0D,0x7E,0x01,0x13,0x0E,0x7E,0x00,0x12,0x10,0x7E,
+ 0x7F,0x11,0x11,0x7F,0x7F,0x10,0x12,0x7F,0x7E,0x0E,0x13,0x01,0x7E,0x0D,0x13,0x02,
+ 0x7E,0x0C,0x14,0x02,0x7D,0x0B,0x14,0x04,0x7D,0x09,0x15,0x05,0x7D,0x08,0x15,0x06,
+
+ 0x07,0x14,0x07,0x7E,0x06,0x14,0x08,0x7E,0x05,0x14,0x0A,0x7D,0x04,0x14,0x0B,0x7D,
+ 0x03,0x13,0x0C,0x7E,0x02,0x13,0x0D,0x7E,0x01,0x12,0x0E,0x7F,0x00,0x11,0x0F,0x00,
+ 0x00,0x10,0x10,0x00,0x7F,0x0F,0x11,0x01,0x7F,0x0E,0x12,0x01,0x7E,0x0D,0x13,0x02,
+ 0x7E,0x0C,0x13,0x03,0x7E,0x0B,0x14,0x03,0x7D,0x0A,0x14,0x05,0x7D,0x08,0x14,0x07,
+
+ 0x07,0x14,0x07,0x7E,0x06,0x14,0x09,0x7D,0x05,0x14,0x0A,0x7D,0x04,0x13,0x0B,0x7E,
+ 0x03,0x13,0x0C,0x7E,0x02,0x12,0x0D,0x7F,0x01,0x12,0x0E,0x7F,0x01,0x11,0x0F,0x7F,
+ 0x00,0x10,0x10,0x00,0x7F,0x0F,0x11,0x01,0x7F,0x0E,0x12,0x01,0x7E,0x0D,0x12,0x03,
+ 0x7E,0x0C,0x13,0x03,0x7E,0x0B,0x13,0x04,0x7E,0x0A,0x14,0x04,0x7D,0x09,0x14,0x06,
+
+ 0x08,0x13,0x08,0x7D,0x07,0x13,0x09,0x7D,0x05,0x13,0x0A,0x7E,0x04,0x13,0x0B,0x7E,
+ 0x04,0x12,0x0C,0x7E,0x03,0x12,0x0D,0x7E,0x02,0x11,0x0E,0x7F,0x01,0x10,0x0F,0x00,
+ 0x00,0x10,0x10,0x00,0x00,0x0F,0x10,0x01,0x7F,0x0E,0x11,0x02,0x7F,0x0D,0x12,0x02,
+ 0x7E,0x0C,0x12,0x04,0x7E,0x0B,0x13,0x04,0x7E,0x0A,0x13,0x05,0x7E,0x09,0x13,0x06,
+
+ 0x08,0x13,0x08,0x7D,0x07,0x13,0x09,0x7D,0x06,0x12,0x0A,0x7E,0x05,0x12,0x0B,0x7E,
+ 0x04,0x12,0x0C,0x7E,0x03,0x11,0x0D,0x7F,0x02,0x11,0x0E,0x7F,0x01,0x10,0x0E,0x01,
+ 0x01,0x0F,0x0F,0x01,0x00,0x0E,0x10,0x02,0x00,0x0E,0x11,0x01,0x7F,0x0D,0x11,0x03,
+ 0x7F,0x0C,0x12,0x03,0x7E,0x0B,0x12,0x05,0x7E,0x0A,0x12,0x06,0x7E,0x09,0x13,0x06,
+
+ 0x08,0x12,0x08,0x7E,0x07,0x12,0x09,0x7E,0x06,0x12,0x0A,0x7E,0x05,0x12,0x0B,0x7E,
+ 0x04,0x11,0x0C,0x7F,0x03,0x11,0x0D,0x7F,0x02,0x10,0x0D,0x01,0x02,0x10,0x0E,0x00,
+ 0x01,0x0F,0x0F,0x01,0x00,0x0E,0x10,0x02,0x00,0x0D,0x10,0x03,0x7F,0x0D,0x11,0x03,
+ 0x7F,0x0C,0x11,0x04,0x7F,0x0B,0x12,0x04,0x7E,0x0A,0x12,0x06,0x7E,0x09,0x12,0x07,
+
+ /* PAL/PAL-N 640x480 */
+
+ 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E,
+ 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C,
+ 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C,
+ 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E,
+
+ 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E,
+ 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C,
+ 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C,
+ 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E,
+
+ 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E,
+ 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C,
+ 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C,
+ 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E,
+
+ 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E,
+ 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C,
+ 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C,
+ 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E,
+
+ 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E,
+ 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C,
+ 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C,
+ 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E,
+
+ 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E,
+ 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C,
+ 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C,
+ 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E,
+
+ 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E,
+ 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C,
+ 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C,
+ 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E,
+
+ /* PAL/PAL-N 720x576, 768x576 */
+
+ 0x03,0x1C,0x03,0x7E,0x01,0x1C,0x05,0x7E,0x00,0x1C,0x07,0x7D,0x7F,0x1B,0x09,0x7D,
+ 0x7E,0x1A,0x0B,0x7D,0x7D,0x19,0x0D,0x7D,0x7D,0x18,0x0F,0x7C,0x7C,0x16,0x12,0x7C,
+ 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x16,0x7C,0x7C,0x0F,0x18,0x7D,0x7C,0x0D,0x19,0x7E,
+ 0x7D,0x0B,0x1A,0x7E,0x7D,0x09,0x1B,0x7F,0x7E,0x07,0x1C,0x7F,0x7E,0x05,0x1C,0x01,
+
+ 0x03,0x1B,0x03,0x7F,0x02,0x1B,0x05,0x7E,0x01,0x1B,0x07,0x7D,0x7F,0x1B,0x09,0x7D,
+ 0x7E,0x1A,0x0B,0x7D,0x7E,0x19,0x0D,0x7C,0x7D,0x17,0x10,0x7C,0x7C,0x16,0x12,0x7C,
+ 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x16,0x7C,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x19,0x7E,
+ 0x7D,0x0B,0x1A,0x7E,0x7D,0x09,0x1B,0x7F,0x7D,0x07,0x1B,0x01,0x7E,0x05,0x1B,0x02,
+
+ 0x04,0x1A,0x04,0x7E,0x02,0x1B,0x05,0x7E,0x01,0x1A,0x07,0x7E,0x00,0x1A,0x09,0x7D,
+ 0x7F,0x19,0x0B,0x7D,0x7E,0x18,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7D,0x15,0x12,0x7C,
+ 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x18,0x7F,
+ 0x7D,0x0B,0x19,0x7F,0x7D,0x09,0x1A,0x00,0x7D,0x07,0x1A,0x02,0x7E,0x05,0x1B,0x02,
+
+ 0x04,0x1A,0x04,0x7E,0x03,0x1A,0x06,0x7D,0x01,0x1A,0x08,0x7D,0x00,0x1A,0x09,0x7D,
+ 0x7F,0x19,0x0B,0x7D,0x7E,0x18,0x0E,0x7C,0x7E,0x17,0x10,0x7B,0x7D,0x15,0x12,0x7C,
+ 0x7D,0x13,0x13,0x7D,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0E,0x18,0x7E,
+ 0x7D,0x0B,0x19,0x7F,0x7D,0x09,0x1A,0x00,0x7D,0x08,0x1A,0x01,0x7E,0x06,0x1A,0x02,
+
+ 0x04,0x19,0x04,0x7F,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x19,0x0A,0x7C,
+ 0x7F,0x18,0x0C,0x7D,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x10,0x7C,0x7D,0x15,0x11,0x7D,
+ 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x15,0x7D,0x7C,0x10,0x16,0x7E,0x7C,0x0E,0x17,0x7F,
+ 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04,
+
+ 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x18,0x0A,0x7D,
+ 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x0F,0x7D,0x7E,0x14,0x11,0x7D,
+ 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x16,0x7E,0x7D,0x0E,0x17,0x7E,
+ 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04,
+
+ 0x05,0x18,0x05,0x7E,0x04,0x18,0x07,0x7D,0x03,0x18,0x08,0x7D,0x01,0x18,0x0A,0x7D,
+ 0x00,0x17,0x0C,0x7D,0x7F,0x16,0x0E,0x7D,0x7F,0x15,0x0F,0x7D,0x7E,0x14,0x11,0x7D,
+ 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x15,0x7F,0x7D,0x0E,0x16,0x7F,
+ 0x7D,0x0C,0x17,0x00,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x18,0x03,0x7D,0x07,0x18,0x04,
+
+ /* PAL/PAL-N 800x600 */
+
+ 0x04,0x1A,0x04,0x7E,0x02,0x1A,0x05,0x7F,0x01,0x1A,0x07,0x7E,0x00,0x1A,0x09,0x7D,
+ 0x7F,0x19,0x0B,0x7D,0x7E,0x18,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7D,0x15,0x12,0x7C,
+ 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x18,0x7F,
+ 0x7D,0x0B,0x19,0x7F,0x7D,0x09,0x1A,0x00,0x7D,0x07,0x1A,0x02,0x7E,0x05,0x1A,0x03,
+
+ 0x04,0x1A,0x04,0x7E,0x03,0x1A,0x06,0x7D,0x01,0x1A,0x08,0x7D,0x00,0x19,0x0A,0x7D,
+ 0x7F,0x19,0x0C,0x7C,0x7E,0x18,0x0E,0x7C,0x7E,0x17,0x10,0x7B,0x7D,0x15,0x12,0x7C,
+ 0x7D,0x13,0x13,0x7D,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0E,0x18,0x7E,
+ 0x7D,0x0C,0x19,0x7E,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x1A,0x01,0x7E,0x06,0x1A,0x02,
+
+ 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x19,0x0A,0x7C,
+ 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x10,0x7C,0x7D,0x15,0x11,0x7D,
+ 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x15,0x7D,0x7C,0x10,0x16,0x7E,0x7C,0x0E,0x17,0x7F,
+ 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04,
+
+ 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x18,0x0A,0x7D,
+ 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x0F,0x7D,0x7E,0x14,0x11,0x7D,
+ 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x16,0x7E,0x7D,0x0E,0x17,0x7E,
+ 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04,
+
+ 0x05,0x18,0x05,0x7E,0x04,0x18,0x07,0x7D,0x03,0x18,0x08,0x7D,0x01,0x18,0x0A,0x7D,
+ 0x00,0x17,0x0C,0x7D,0x7F,0x16,0x0E,0x7D,0x7F,0x15,0x0F,0x7D,0x7E,0x14,0x11,0x7D,
+ 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x15,0x7F,0x7D,0x0E,0x16,0x7F,
+ 0x7D,0x0C,0x17,0x00,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x18,0x03,0x7D,0x07,0x18,0x04,
+
+ 0x06,0x18,0x06,0x7C,0x04,0x18,0x07,0x7D,0x03,0x18,0x09,0x7C,0x02,0x17,0x0A,0x7D,
+ 0x01,0x17,0x0C,0x7C,0x00,0x16,0x0E,0x7C,0x7F,0x15,0x0F,0x7D,0x7E,0x14,0x11,0x7D,
+ 0x7E,0x12,0x12,0x7E,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x15,0x7F,0x7D,0x0E,0x16,0x7F,
+ 0x7D,0x0C,0x17,0x00,0x7D,0x0A,0x17,0x02,0x7D,0x09,0x18,0x02,0x7D,0x07,0x18,0x04,
+
+ 0x06,0x17,0x06,0x7D,0x05,0x17,0x07,0x7D,0x03,0x17,0x09,0x7D,0x02,0x17,0x0A,0x7D,
+ 0x01,0x16,0x0C,0x7D,0x00,0x15,0x0E,0x7D,0x7F,0x14,0x0F,0x7E,0x7F,0x13,0x11,0x7D,
+ 0x7E,0x12,0x12,0x7E,0x7E,0x11,0x13,0x7E,0x7D,0x0F,0x14,0x00,0x7D,0x0E,0x15,0x00,
+ 0x7D,0x0C,0x16,0x01,0x7D,0x0A,0x17,0x02,0x7D,0x09,0x17,0x03,0x7D,0x07,0x17,0x05
+};
+
+
/* Mandatory functions */
static void SISIdentify(int flags);
static Bool SISProbe(DriverPtr drv, int flags);
@@ -1069,7 +1302,7 @@ unsigned char SISSearchCRT1Rate(ScrnInfoPtr pScrn, DisplayModePtr mode);
static void SISWaitVBRetrace(ScrnInfoPtr pScrn);
void SISWaitRetraceCRT1(ScrnInfoPtr pScrn);
void SISWaitRetraceCRT2(ScrnInfoPtr pScrn);
-Bool InRegion(int x, int y, region r);
+static Bool InRegion(int x, int y, region r);
#ifdef SISMERGED
static void SISMergePointerMoved(int scrnIndex, int x, int y);
#endif
diff --git a/src/sis_opt.c b/src/sis_opt.c
index 9daea9f..3200fd3 100644
--- a/src/sis_opt.c
+++ b/src/sis_opt.c
@@ -1,31 +1,40 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c,v 1.50 2003/12/09 17:49:26 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c,v 1.55 2004/01/23 22:29:05 twini Exp $ */
/*
* SiS driver option evaluation
*
- * Copyright 2001, 2002, 2003 by Thomas Winischhofer, Vienna, Austria
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
*
- * Based on code by ? (included in XFree86 4.1)
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1) Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2) Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3) All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement: "This product includes
+ * software developed by Thomas Winischhofer, Vienna, Austria."
+ * 4) The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the supplier not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The supplier makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * THE SUPPLIER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * "NoAccel", "NoXVideo", "SWCursor", "HWCursor" and "Rotate" option portions
+ * Copyright (C) 1999-2004 The XFree86 Project, Inc. Licensed under the terms
+ * of the XFree86 license (http://www.xfree86.org/current/LICENSE1.html).
*
* Authors: Thomas Winischhofer <thomas@winischhofer.net>
- * ?
+ * ?
*/
#include "xf86.h"
@@ -47,6 +56,7 @@ typedef enum {
OPTION_RENDER,
OPTION_FORCE_CRT1TYPE,
OPTION_FORCE_CRT2TYPE,
+ OPTION_YPBPRAR,
OPTION_SHADOW_FB,
OPTION_DRI,
OPTION_AGP_SIZE,
@@ -150,6 +160,7 @@ static const OptionInfoRec SISOptions[] = {
{ OPTION_RENDER, "RenderAcceleration", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_FORCE_CRT1TYPE, "ForceCRT1Type", OPTV_STRING, {0}, FALSE },
{ OPTION_FORCE_CRT2TYPE, "ForceCRT2Type", OPTV_STRING, {0}, FALSE },
+ { OPTION_YPBPRAR, "YPbPrAspectRatio", OPTV_STRING, {0}, FALSE },
{ OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_AGP_SIZE, "AGPSize", OPTV_INTEGER, {0}, FALSE },
@@ -330,6 +341,7 @@ SiSOptions(ScrnInfoPtr pScrn)
pSiS->forcecrt2redetection = TRUE; /* default changed since 13/09/2003 */
pSiS->ForceCRT1Type = CRT1_VGA;
pSiS->ForceCRT2Type = CRT2_DEFAULT;
+ pSiS->ForceYPbPrAR = TV_YPBPR169;
pSiS->ForceTVType = -1;
pSiS->CRT1gamma = TRUE;
pSiS->CRT1gammaGiven = FALSE;
@@ -736,6 +748,9 @@ SiSOptions(ScrnInfoPtr pScrn)
if(xf86GetOptValString(pSiS->Options, OPTION_FORCE_CRT2TYPE)) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "ForceCRT2Type");
}
+ if(xf86GetOptValString(pSiS->Options, OPTION_YPBPRAR)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "YPbPrAspectRatio");
+ }
if(xf86GetOptValBool(pSiS->Options, OPTION_SCALELCD, &val)) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "ScaleLCD");
}
@@ -993,24 +1008,52 @@ SiSOptions(ScrnInfoPtr pScrn)
pSiS->ForceCRT2Type = CRT2_VGA;
else if(!xf86NameCmp(strptr,"NONE"))
pSiS->ForceCRT2Type = 0;
- else if(pSiS->Chipset == PCI_CHIP_SIS550) {
- if(!xf86NameCmp(strptr,"DSTN")) {
- if(pSiS->ForceCRT1Type == CRT1_VGA) {
- pSiS->ForceCRT2Type = CRT2_LCD;
- pSiS->DSTN = TRUE;
- }
- } else if(!xf86NameCmp(strptr,"FSTN")) {
- if(pSiS->ForceCRT1Type == CRT1_VGA) {
- pSiS->ForceCRT2Type = CRT2_LCD;
- pSiS->FSTN = TRUE;
- }
+ else if((!xf86NameCmp(strptr,"DSTN")) && (pSiS->Chipset == PCI_CHIP_SIS550)) {
+ if(pSiS->ForceCRT1Type == CRT1_VGA) {
+ pSiS->ForceCRT2Type = CRT2_LCD;
+ pSiS->DSTN = TRUE;
}
+ } else if((!xf86NameCmp(strptr,"FSTN")) && (pSiS->Chipset == PCI_CHIP_SIS550)) {
+ if(pSiS->ForceCRT1Type == CRT1_VGA) {
+ pSiS->ForceCRT2Type = CRT2_LCD;
+ pSiS->FSTN = TRUE;
+ }
+#ifdef ENABLE_YPBPR
+ } else if(!xf86NameCmp(strptr,"HIVISION")) {
+ pSiS->ForceCRT2Type = CRT2_TV;
+ pSiS->ForceTVType = TV_HIVISION;
+ } else if((!xf86NameCmp(strptr,"YPBPR1080I")) && (pSiS->VGAEngine == SIS_315_VGA)) {
+ pSiS->ForceCRT2Type = CRT2_TV;
+ pSiS->ForceTVType = TV_YPBPR;
+ pSiS->ForceYPbPrType = TV_YPBPR1080I;
+ } else if(((!xf86NameCmp(strptr,"YPBPR525I")) || (!xf86NameCmp(strptr,"YPBPR480I"))) &&
+ (pSiS->VGAEngine == SIS_315_VGA)) {
+ pSiS->ForceCRT2Type = CRT2_TV;
+ pSiS->ForceTVType = TV_YPBPR;
+ pSiS->ForceYPbPrType = TV_YPBPR525I;
+ } else if(((!xf86NameCmp(strptr,"YPBPR525P")) || (!xf86NameCmp(strptr,"YPBPR480P"))) &&
+ (pSiS->VGAEngine == SIS_315_VGA)) {
+ pSiS->ForceCRT2Type = CRT2_TV;
+ pSiS->ForceTVType = TV_YPBPR;
+ pSiS->ForceYPbPrType = TV_YPBPR525P;
+ } else if(((!xf86NameCmp(strptr,"YPBPR750P")) || (!xf86NameCmp(strptr,"YPBPR720P"))) &&
+ (pSiS->VGAEngine == SIS_315_VGA)) {
+ pSiS->ForceCRT2Type = CRT2_TV;
+ pSiS->ForceTVType = TV_YPBPR;
+ pSiS->ForceYPbPrType = TV_YPBPR750P;
+#endif
} else {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mybadparm, strptr, "ForceCRT2Type");
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Valid parameters are \"LCD\" (=\"DVI-D\"), \"TV\", \"SVIDEO\", \"COMPOSITE\",\n"
- "\t\"SVIDEO+COMPOSITE\", \"SCART\", \"VGA\" (=\"DVI-A\") or \"NONE\", on the SiS550\n"
- "\talso \"DSTN\" and \"FSTN\"\n");
+ "\t\"SVIDEO+COMPOSITE\", \"SCART\", \"VGA\" (=\"DVI-A\") or \"NONE\"; on the SiS550\n"
+ "\talso \"DSTN\" and \"FSTN\""
+#ifdef ENABLE_YPBPR
+ "; on SiS 301/301B bridges also \"HIVISION\", and on\n"
+ "\tSiS315/330 series with 301C/30xLV bridge also \"YPBPR480I\", \"YPBPR480P\",\n"
+ "\t\"YPBPR720P\" and \"YPBPR1080I\""
+#endif
+ "\n");
}
if(pSiS->ForceCRT2Type != CRT2_DEFAULT)
@@ -1018,6 +1061,23 @@ SiSOptions(ScrnInfoPtr pScrn)
"CRT2 type shall be %s\n", strptr);
}
+ if(pSiS->ForceTVType == TV_YPBPR) {
+ strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_YPBPRAR);
+ if(strptr != NULL) {
+ if(!xf86NameCmp(strptr,"4:3LB"))
+ pSiS->ForceYPbPrAR = TV_YPBPR43LB;
+ else if(!xf86NameCmp(strptr,"4:3"))
+ pSiS->ForceYPbPrAR = TV_YPBPR43;
+ else if(!xf86NameCmp(strptr,"16:9"))
+ pSiS->ForceYPbPrAR = TV_YPBPR169;
+ else {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mybadparm, strptr, "YPbPrAspectRatio");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Valid parameters are \"4:3LB\", \"4:3\" and \"16:9\"\n");
+ }
+ }
+ }
+
strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SPECIALTIMING);
if(strptr != NULL) {
int i = 0;
@@ -1191,21 +1251,21 @@ SiSOptions(ScrnInfoPtr pScrn)
}
}
- /* CHTVType (315/330 series only)
+ /* CHTVType (315/330 series + Chrontel only)
* Used for telling the driver if the TV output shall
- * be 480i HDTV or SCART.
+ * be 525i YPbPr or SCART.
*/
if(pSiS->VGAEngine == SIS_315_VGA) {
strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CHTVTYPE);
if(strptr != NULL) {
if(!xf86NameCmp(strptr,"SCART"))
pSiS->chtvtype = 1;
- else if(!xf86NameCmp(strptr,"HDTV"))
+ else if(!xf86NameCmp(strptr,"YPBPR525I"))
pSiS->chtvtype = 0;
else {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mybadparm, strptr, "CHTVType");
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Valid parameters are \"SCART\" or \"HDTV\"\n");
+ "Valid parameters are \"SCART\" or \"YPBPR525I\"\n");
}
if(pSiS->chtvtype != -1)
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
diff --git a/src/sis_regs.h b/src/sis_regs.h
index 4298b3f..8ec0151 100644
--- a/src/sis_regs.h
+++ b/src/sis_regs.h
@@ -1,30 +1,41 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h,v 1.24 2003/10/30 18:53:43 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h,v 1.27 2004/01/23 22:29:05 twini Exp $ */
/*
- * 2D Acceleration for SiS300, SiS540, SiS630, SiS730, SiS530, SiS620
+ * Register definitions for old and 300 series
*
- * Copyright 1998,1999 by Alan Hourihane, Wigan, England.
- * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1) Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2) Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3) All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement: "This product includes
+ * software developed by Thomas Winischhofer, Vienna, Austria."
+ * 4) The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Old series register definitions
+ * Copyright (C) 1998, 1999 by Alan Hourihane, Wigan, England.
+ *
+ * Authors: Thomas Winischhofer <thomas@winischhofer.net>
+ * Alan Hourihane
*
*/
-
/* For general use --------------------------------------------------------------- */
diff --git a/src/sis_setup.c b/src/sis_setup.c
index 36e625b..64683c6 100644
--- a/src/sis_setup.c
+++ b/src/sis_setup.c
@@ -1,28 +1,37 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c,v 1.25 2003/11/06 19:10:01 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c,v 1.29 2004/01/23 22:29:05 twini Exp $ */
/*
* Basic hardware and memory detection
*
- * Copyright 2001, 2002, 2003 by Thomas Winischhofer, Vienna, Austria.
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria.
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1) Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2) Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3) All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement: "This product includes
+ * software developed by Thomas Winischhofer, Vienna, Austria."
+ * 4) The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Author: Thomas Winischhofer <thomas@winischhofer.net>
+ * Author: Thomas Winischhofer <thomas@winischhofer.net>
+ *
+ * Ideas and methods for old series based on code by Can-Ru Yeou, SiS Inc.
*
*/
@@ -593,7 +602,7 @@ sis550Setup(ScrnInfoPtr pScrn)
if(!alldone) {
if(pSiS->Chipset == PCI_CHIP_SIS660) {
- inSISIDXREG(SISSR, 0x79, config);
+ inSISIDXREG(SISCR, 0x79, config);
pScrn->videoRam = (1 << ((config & 0xf0) >> 4)) * 1024;
pSiS->BusWidth = (config & 0x04) ? 128 : 64;
ramtype = (config & 0x01) ? 8 : 4;
@@ -650,7 +659,7 @@ SiSSetup(ScrnInfoPtr pScrn)
break;
case PCI_CHIP_SIS550:
case PCI_CHIP_SIS650: /* + 740 */
- case PCI_CHIP_SIS660: /* + 661,741,660,760 */
+ case PCI_CHIP_SIS660: /* + 661,741,760 */
sis550Setup(pScrn);
break;
case PCI_CHIP_SIS5597:
diff --git a/src/sis_shadow.c b/src/sis_shadow.c
index 2c85f79..29e4ede 100644
--- a/src/sis_shadow.c
+++ b/src/sis_shadow.c
@@ -1,28 +1,30 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.c,v 1.8 2003/10/30 18:53:43 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.c,v 1.10 2004/01/04 18:08:00 twini Exp $ */
/*
- * Copyright (c) 1999, The XFree86 Project Inc.
- * based on code written by Mark Vojkovich <markv@valinux.com>
+ * Copyright (C) 1999-2004 by The XFree86 Project, Inc.
+ * based on code written by Mark Vojkovich
+ *
+ * Licensed under the following terms:
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
+ * the above copyright notice appears in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * and that the name of the copyright holder not be used in advertising
+ * or publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holder makes no representations
* about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * "as is" without expressed or implied warranty.
*
* THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
* EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
- * TW: This module doesn't use CurrentLayout, because it is never
- * active when DGA is active and vice versa.
+ * TW: This module doesn't use CurrentLayout, because it is never
+ * active when DGA is active and vice versa.
*/
#include "xf86.h"
diff --git a/src/sis_vb.c b/src/sis_vb.c
index 3242851..ee363ca 100644
--- a/src/sis_vb.c
+++ b/src/sis_vb.c
@@ -1,26 +1,33 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c,v 1.34 2003/12/16 17:35:07 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c,v 1.41 2004/01/23 22:29:06 twini Exp $ */
/*
* Video bridge detection and configuration for 300, 315 and 330 series
*
- * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1) Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2) Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3) All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement: "This product includes
+ * software developed by Thomas Winischhofer, Vienna, Austria."
+ * 4) The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Author: Thomas Winischhofer <thomas@winischhofer.net>
*
@@ -79,6 +86,26 @@ static const SiS_LCD_StStruct SiS315_LCD_Type[]=
{ VB_LCD_CUSTOM, 0, 0, LCD_CUSTOM, } /* f */
};
+static const SiS_LCD_StStruct SiS661_LCD_Type[]=
+{
+ { VB_LCD_1024x768, 1024, 768, LCD_1024x768 }, /* 0 - invalid */
+ { VB_LCD_800x600, 800, 600, LCD_800x600 }, /* 1 */
+ { VB_LCD_1024x768, 1024, 768, LCD_1024x768 }, /* 2 */
+ { VB_LCD_1280x1024,1280, 1024, LCD_1280x1024 }, /* 3 */
+ { VB_LCD_640x480, 640, 480, LCD_640x480 }, /* 4 */
+ { VB_LCD_1024x600, 1024, 600, LCD_1024x600 }, /* 5 */
+ { VB_LCD_1152x864, 1152, 864, LCD_1152x864 }, /* 6 */
+ { VB_LCD_1280x960, 1280, 960, LCD_1280x960 }, /* 7 */
+ { VB_LCD_1152x768, 1152, 768, LCD_1152x768 }, /* 8 */
+ { VB_LCD_1400x1050,1400, 1050, LCD_1400x1050 }, /* 9 */
+ { VB_LCD_1280x768, 1280, 768, LCD_1280x768 }, /* a */
+ { VB_LCD_1600x1200,1600, 1200, LCD_1600x1200 }, /* b */
+ { VB_LCD_1280x800, 1280, 800, LCD_1280x800 }, /* c */
+ { VB_LCD_1680x1050,1680, 1050, LCD_1680x1050 }, /* d */
+ { VB_LCD_320x480, 320, 480, LCD_320x480 }, /* e */
+ { VB_LCD_CUSTOM, 0, 0, LCD_CUSTOM, } /* f */
+};
+
static Bool
TestDDC1(ScrnInfoPtr pScrn)
{
@@ -108,9 +135,9 @@ SiS_SISDetectCRT1(ScrnInfoPtr pScrn)
if(SR1F & 0xc0) mustwait = TRUE;
if(pSiS->VGAEngine == SIS_315_VGA) {
- inSISIDXREG(SISCR,0x63,CR63);
+ inSISIDXREG(SISCR,pSiS->myCR63,CR63);
CR63 &= 0x40;
- andSISIDXREG(SISCR,0x63,0xBF);
+ andSISIDXREG(SISCR,pSiS->myCR63,0xBF);
}
inSISIDXREG(SISCR,0x17,CR17);
@@ -141,7 +168,7 @@ SiS_SISDetectCRT1(ScrnInfoPtr pScrn)
}
if(pSiS->VGAEngine == SIS_315_VGA) {
- setSISIDXREG(SISCR,0x63,0xBF,CR63);
+ setSISIDXREG(SISCR,pSiS->myCR63,0xBF,CR63);
}
setSISIDXREG(SISCR,0x17,0x7F,CR17);
@@ -328,12 +355,18 @@ void SISLCDPreInit(ScrnInfoPtr pScrn)
pSiS->LCDwidth = SiS300_LCD_Type[(CR36 & 0x0f)].LCDwidth;
pSiS->sishw_ext.ulCRT2LCDType = SiS300_LCD_Type[(CR36 & 0x0f)].LCDtype;
if(CR37 & 0x10) pSiS->VBLCDFlags |= VB_LCD_EXPANDING;
- } else {
+ } else if(pSiS->sishw_ext.jChipType < SIS_661) {
pSiS->VBLCDFlags |= SiS315_LCD_Type[(CR36 & 0x0f)].VBLCD_lcdflag;
pSiS->LCDheight = SiS315_LCD_Type[(CR36 & 0x0f)].LCDheight;
pSiS->LCDwidth = SiS315_LCD_Type[(CR36 & 0x0f)].LCDwidth;
pSiS->sishw_ext.ulCRT2LCDType = SiS315_LCD_Type[(CR36 & 0x0f)].LCDtype;
if(CR37 & 0x10) pSiS->VBLCDFlags |= VB_LCD_EXPANDING;
+ } else {
+ pSiS->VBLCDFlags |= SiS661_LCD_Type[(CR36 & 0x0f)].VBLCD_lcdflag;
+ pSiS->LCDheight = SiS661_LCD_Type[(CR36 & 0x0f)].LCDheight;
+ pSiS->LCDwidth = SiS661_LCD_Type[(CR36 & 0x0f)].LCDwidth;
+ pSiS->sishw_ext.ulCRT2LCDType = SiS661_LCD_Type[(CR36 & 0x0f)].LCDtype;
+ if(CR37 & 0x10) pSiS->VBLCDFlags |= VB_LCD_EXPANDING;
}
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"Detected LCD/Plasma panel (%dx%d, %d, %sexp., RGB%d [%02x%02x])\n",
@@ -354,12 +387,13 @@ void SISLCDPreInit(ScrnInfoPtr pScrn)
void SISTVPreInit(ScrnInfoPtr pScrn)
{
SISPtr pSiS = SISPTR(pScrn);
- unsigned char SR16, SR38, CR32, CR35=0, CR38=0, CR79;
+ unsigned char SR16, SR38, CR32, CR35=0, CR38=0, CR79, CR39;
int temp = 0;
if(!(pSiS->VBFlags & VB_VIDEOBRIDGE)) return;
inSISIDXREG(SISCR, 0x32, CR32);
+ inSISIDXREG(SISCR, 0x35, CR35);
inSISIDXREG(SISSR, 0x16, SR16);
inSISIDXREG(SISSR, 0x38, SR38);
switch(pSiS->VGAEngine) {
@@ -367,7 +401,7 @@ void SISTVPreInit(ScrnInfoPtr pScrn)
if(pSiS->Chipset == PCI_CHIP_SIS630) temp = 0x35;
break;
case SIS_315_VGA:
- if(pSiS->Chipset != PCI_CHIP_SIS660) temp = 0x38;
+ temp = 0x38;
break;
}
if(temp) {
@@ -380,27 +414,64 @@ void SISTVPreInit(ScrnInfoPtr pScrn)
CR32, SR16, SR38);
#endif
- if(CR32 & 0x47)
- pSiS->VBFlags |= CRT2_TV;
+ if(CR32 & 0x47) pSiS->VBFlags |= CRT2_TV;
- if(CR32 & 0x04)
- pSiS->VBFlags |= TV_SCART;
+ if(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPR) {
+ if(CR32 & 0x80) pSiS->VBFlags |= CRT2_TV;
+ } else {
+ CR32 &= 0x7f;
+ }
+
+ if(CR32 & 0x01)
+ pSiS->VBFlags |= TV_AVIDEO;
else if(CR32 & 0x02)
pSiS->VBFlags |= TV_SVIDEO;
- else if(CR32 & 0x01)
- pSiS->VBFlags |= TV_AVIDEO;
- 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)))
+ else if(CR32 & 0x04)
+ pSiS->VBFlags |= TV_SCART;
+ else if((CR32 & 0x40) && (pSiS->SiS_SD_Flags & SiS_SD_SUPPORTHIVISION))
+ pSiS->VBFlags |= (TV_HIVISION | TV_PAL);
+ else if((CR32 & 0x80) && (pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPR)) {
pSiS->VBFlags |= TV_YPBPR;
- else if((CR38 & 0x04) && (pSiS->VBFlags & VB_CHRONTEL))
+ if(pSiS->Chipset == PCI_CHIP_SIS660) {
+ if(CR38 & 0x04) {
+ switch((CR35 & 0xE0)) {
+ case 0x20: pSiS->VBFlags |= TV_YPBPR525P; break;
+ case 0x40: pSiS->VBFlags |= TV_YPBPR750P; break;
+ case 0x60: pSiS->VBFlags |= TV_YPBPR1080I; break;
+ default: pSiS->VBFlags |= TV_YPBPR525I;
+ }
+ }
+ inSISIDXREG(SISCR,0x39,CR39);
+ CR39 &= 0x03;
+ if(CR39 == 0x00) pSiS->VBFlags |= TV_YPBPR43LB;
+ else if(CR39 == 0x01) pSiS->VBFlags |= TV_YPBPR43;
+ else if(CR39 == 0x02) pSiS->VBFlags |= TV_YPBPR169;
+ else pSiS->VBFlags |= TV_YPBPR43;
+ } else if(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPR) {
+ if(CR38 & 0x08) {
+ switch((CR38 & 0x30)) {
+ case 0x10: pSiS->VBFlags |= TV_YPBPR525P; break;
+ case 0x20: pSiS->VBFlags |= TV_YPBPR750P; break;
+ case 0x30: pSiS->VBFlags |= TV_YPBPR1080I; break;
+ default: pSiS->VBFlags |= TV_YPBPR525I;
+ }
+ }
+ if(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPRAR) {
+ inSISIDXREG(SISCR,0x3B,CR39);
+ CR39 &= 0x03;
+ if(CR39 == 0x00) pSiS->VBFlags |= TV_YPBPR43LB;
+ else if(CR39 == 0x01) pSiS->VBFlags |= TV_YPBPR169;
+ else if(CR39 == 0x03) pSiS->VBFlags |= TV_YPBPR43;
+ }
+ }
+ } 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_YPBPR)) {
+ pSiS->VBFlags |= (TV_CHYPBPR525I | TV_NTSC);
+
+ if(pSiS->VBFlags & (TV_SCART | TV_SVIDEO | TV_AVIDEO)) {
if(pSiS->VGAEngine == SIS_300_VGA) {
- /* TW: Should be SR38, but this does not work. */
+ /* Should be SR38, but this does not work. */
if(SR16 & 0x20)
pSiS->VBFlags |= TV_PAL;
else
@@ -426,14 +497,14 @@ void SISTVPreInit(ScrnInfoPtr pScrn)
} else
pSiS->VBFlags |= TV_NTSC;
} else if(pSiS->Chipset == PCI_CHIP_SIS660) {
- inSISIDXREG(SISCR, 0x35, CR35);
if(SR38 & 0x01) {
pSiS->VBFlags |= TV_PAL;
if(CR35 & 0x04) pSiS->VBFlags |= TV_PALM;
else if(CR35 & 0x08) pSiS->VBFlags |= TV_PALN;
- } else
+ } else {
pSiS->VBFlags |= TV_NTSC;
if(CR35 & 0x02) pSiS->VBFlags |= TV_NTSCJ;
+ }
} else { /* 315, 330 */
if(SR38 & 0x01) {
pSiS->VBFlags |= TV_PAL;
@@ -443,16 +514,29 @@ void SISTVPreInit(ScrnInfoPtr pScrn)
pSiS->VBFlags |= TV_NTSC;
}
}
-
- 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 ",
- (pSiS->VBFlags & TV_NTSC) ?
- ((pSiS->VBFlags & TV_CHHDTV) ? "480i HDTV" :
- ((pSiS->VBFlags & TV_NTSCJ) ? "NTSCJ" : "NTSC")) :
- ((pSiS->VBFlags & TV_PALM) ? "PALM" :
- ((pSiS->VBFlags & TV_PALN) ? "PALN" : "PAL")) );
+
+ if(pSiS->VBFlags & (TV_SCART|TV_SVIDEO|TV_AVIDEO)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected default TV standard %s\n",
+ (pSiS->VBFlags & TV_NTSC) ?
+ ((pSiS->VBFlags & TV_NTSCJ) ? "NTSCJ" : "NTSC") :
+ ((pSiS->VBFlags & TV_PALM) ? "PALM" :
+ ((pSiS->VBFlags & TV_PALN) ? "PALN" : "PAL")));
+ }
+
+ if(pSiS->VBFlags & TV_HIVISION) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "BIOS reports HiVision TV\n");
+ }
+
+ if((pSiS->VBFlags & VB_CHRONTEL) && (pSiS->VBFlags & (TV_CHSCART|TV_CHYPBPR525I))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Chrontel: %s forced\n",
+ (pSiS->VBFlags & TV_CHSCART) ? "SCART (PAL)" : "YPbPr (480i)");
+ }
+
+ if(pSiS->VBFlags & TV_YPBPR) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected YPbPr TV (%s)\n",
+ (pSiS->VBFlags & TV_YPBPR525I) ? "480i" :
+ ((pSiS->VBFlags & TV_YPBPR525P) ? "480p" :
+ ((pSiS->VBFlags & TV_YPBPR750P) ? "720p" : "1080i")));
}
}
diff --git a/src/sis_vga.c b/src/sis_vga.c
index 9eb1bb9..011d18f 100644
--- a/src/sis_vga.c
+++ b/src/sis_vga.c
@@ -1,33 +1,39 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c,v 1.39 2003/11/24 19:08:53 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c,v 1.43 2004/01/23 22:29:06 twini Exp $ */
/*
* Mode setup and basic video bridge detection
*
- * Copyright 2001, 2002, 2003 by Thomas Winischhofer, Vienna, Austria.
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria.
*
- * Init() function for old series (except for TV and FIFO calculation) based
- * on code which was Copyright 1998,1999 by Alan Hourihane, Wigan, England.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1) Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2) Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3) All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement: "This product includes
+ * software developed by Thomas Winischhofer, Vienna, Austria."
+ * 4) The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Thomas Winischhofer <thomas@winischhofer.net>
- * ...
+ * Author: Thomas Winischhofer <thomas@winischhofer.net>
*
+ * Init() function for old series (except for TV and FIFO calculation)
+ * previously based on code which is Copyright (C) 1998,1999 by Alan
+ * Hourihane, Wigan, England
*/
#include "xf86.h"
@@ -977,7 +983,7 @@ SISDoSense(ScrnInfoPtr pScrn, int tempbl, int tempbh, int tempcl, int tempch)
outSISIDXREG(SISPART4,0x11,tempbl);
temp = tempbh | tempcl;
setSISIDXREG(SISPART4,0x10,0xe0,temp);
- SiS_DDC2Delay(pSiS->SiS_Pr, 0x1000);
+ SiS_DDC2Delay(pSiS->SiS_Pr, 0x1500);
tempch &= 0x7f;
inSISIDXREG(SISPART4,0x03,temp);
temp ^= 0x0e;
@@ -990,42 +996,26 @@ static void
SISSense30x(ScrnInfoPtr pScrn)
{
SISPtr pSiS = SISPTR(pScrn);
- unsigned char backupP4_0d,backupP2_00,biosflag;
- unsigned char svhs_bl, svhs_bh;
+ unsigned char backupP4_0d,backupP2_00,biosflag=0;
+ unsigned char svhs_bl=0, svhs_bh=0;
+ unsigned char cvbs_bl=0, cvbs_bh=0;
+ unsigned char vga2_bl=0, vga2_bh=0;
unsigned char svhs_cl, svhs_ch;
- unsigned char cvbs_bl, cvbs_bh;
unsigned char cvbs_cl, cvbs_ch;
- unsigned char vga2_bl, vga2_bh;
unsigned char vga2_cl, vga2_ch;
int myflag, result=0, i, j;
unsigned short temp;
inSISIDXREG(SISPART4,0x0d,backupP4_0d);
- outSISIDXREG(SISPART4,0x0d,(backupP4_0d | 0x04));
+ if(!(pSiS->VBFlags & (VB_301C | VB_302ELV))) {
+ outSISIDXREG(SISPART4,0x0d,(backupP4_0d | 0x04));
+ }
inSISIDXREG(SISPART2,0x00,backupP2_00);
outSISIDXREG(SISPART2,0x00,(backupP2_00 | 0x1c));
SISDoSense(pScrn, 0, 0, 0, 0);
- if(pSiS->Chipset != PCI_CHIP_SIS660) {
- if((pSiS->VGAEngine == SIS_315_VGA) ||
- (pSiS->Chipset == PCI_CHIP_SIS300)) {
- if(pSiS->sishw_ext.UseROM) {
- if(pSiS->VGAEngine == SIS_300_VGA) temp = 0xfe;
- else if(pSiS->Chipset == PCI_CHIP_SIS330) temp = 0x11b;
- else temp = 0xf3;
- if(pSiS->BIOS[temp] & 0x08) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "SiS30x: Video bridge has DVI-I TMDS/VGA combo connector\n");
- orSISIDXREG(SISCR, 0x32, 0x80);
- } else {
- andSISIDXREG(SISCR, 0x32, 0x7f);
- }
- }
- }
- }
-
if(pSiS->VGAEngine == SIS_300_VGA) {
if(pSiS->sishw_ext.UseROM) {
@@ -1039,21 +1029,35 @@ SISSense30x(ScrnInfoPtr pScrn)
cvbs_bh = 0x00; cvbs_bl = 0xb3;
biosflag = 2;
}
- if(pSiS->VBFlags & (VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV|VB_302ELV)) {
+
+ if(pSiS->VBFlags & (VB_301B|VB_302B|VB_301LV|VB_302LV)) {
vga2_bh = 0x01; vga2_bl = 0x90;
svhs_bh = 0x01; svhs_bl = 0x6b;
cvbs_bh = 0x01; cvbs_bl = 0x74;
+ } else if(pSiS->VBFlags & (VB_301C | VB_302ELV)) {
+ vga2_bh = 0x01; vga2_bl = 0x90;
+ svhs_bh = 0x01; svhs_bl = 0x6b;
+ cvbs_bh = 0x01; cvbs_bl = 0x10;
+ } else {
+ inSISIDXREG(SISPART4,0x01,myflag);
+ if(myflag & 0x04) {
+ vga2_bh = 0x00; vga2_bl = 0xfd;
+ svhs_bh = 0x00; svhs_bl = 0xdd;
+ cvbs_bh = 0x00; cvbs_bl = 0xee;
+ }
}
- inSISIDXREG(SISPART4,0x01,myflag);
- if(myflag & 0x04) {
- vga2_bh = 0x00; vga2_bl = 0xfd;
- svhs_bh = 0x00; svhs_bl = 0xdd;
- cvbs_bh = 0x00; cvbs_bl = 0xee;
- }
+
vga2_ch = 0x0e; vga2_cl = 0x08;
svhs_ch = 0x04; svhs_cl = 0x04;
cvbs_ch = 0x08; cvbs_cl = 0x04;
+ if(pSiS->VBFlags & (VB_301LV|VB_302LV|VB_302ELV)) {
+ vga2_bh = 0x00; vga2_bl = 0x00;
+ vga2_ch = 0x00; vga2_cl = 0x00;
+ svhs_ch = 0x04; svhs_cl = 0x08;
+ cvbs_ch = 0x08; cvbs_cl = 0x08;
+ }
+
if(pSiS->Chipset == PCI_CHIP_SIS300) {
inSISIDXREG(SISSR,0x3b,myflag);
if(!(myflag & 0x01)) {
@@ -1106,26 +1110,35 @@ SISSense30x(ScrnInfoPtr pScrn)
} else {
- if(pSiS->sishw_ext.UseROM) {
- if(pSiS->Chipset == PCI_CHIP_SIS330) {
- vga2_bh = pSiS->BIOS[0xe6]; vga2_bl = pSiS->BIOS[0xe5];
- svhs_bh = pSiS->BIOS[0xe8]; svhs_bl = pSiS->BIOS[0xe7];
- cvbs_bh = pSiS->BIOS[0xea]; cvbs_bl = pSiS->BIOS[0xe9];
- biosflag = pSiS->BIOS[0x11b];
+ if(pSiS->VBFlags & VB_301) {
+
+ if(pSiS->sishw_ext.UseROM) {
+ if(pSiS->Chipset == PCI_CHIP_SIS330) {
+ vga2_bh = pSiS->BIOS[0xe6]; vga2_bl = pSiS->BIOS[0xe5];
+ svhs_bh = pSiS->BIOS[0xe8]; svhs_bl = pSiS->BIOS[0xe7];
+ cvbs_bh = pSiS->BIOS[0xea]; cvbs_bl = pSiS->BIOS[0xe9];
+ biosflag = pSiS->BIOS[0x11b];
+ } else {
+ vga2_bh = pSiS->BIOS[0xbe]; vga2_bl = pSiS->BIOS[0xbd];
+ svhs_bh = pSiS->BIOS[0xc0]; svhs_bl = pSiS->BIOS[0xbf];
+ cvbs_bh = pSiS->BIOS[0xc2]; cvbs_bl = pSiS->BIOS[0xc1];
+ biosflag = pSiS->BIOS[0xf3];
+ }
} else {
- vga2_bh = pSiS->BIOS[0xbe]; vga2_bl = pSiS->BIOS[0xbd];
- svhs_bh = pSiS->BIOS[0xc0]; svhs_bl = pSiS->BIOS[0xbf];
- cvbs_bh = pSiS->BIOS[0xc2]; cvbs_bl = pSiS->BIOS[0xc1];
- biosflag = pSiS->BIOS[0xf3];
+ vga2_bh = 0x00; vga2_bl = 0xd1;
+ svhs_bh = 0x00; svhs_bl = 0xb9;
+ cvbs_bh = 0x00; cvbs_bl = 0xb3;
+ biosflag = 2;
}
- } else {
- vga2_bh = 0x00; vga2_bl = 0xd1;
- svhs_bh = 0x00; svhs_bl = 0xb9;
- cvbs_bh = 0x00; cvbs_bl = 0xb3;
- biosflag = 2;
- }
-
- if(pSiS->VBFlags & (VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV|VB_302ELV)) {
+ inSISIDXREG(SISPART4,0x01,myflag);
+ if(myflag & 0x04) {
+ vga2_bh = 0x00; vga2_bl = 0xfd;
+ svhs_bh = 0x00; svhs_bl = 0xdd;
+ cvbs_bh = 0x00; cvbs_bl = 0xee;
+ }
+
+ } else if(pSiS->VBFlags & (VB_301B|VB_302B|VB_301LV|VB_302LV)) {
+
if(pSiS->sishw_ext.UseROM) {
if(pSiS->Chipset == PCI_CHIP_SIS330) {
vga2_bh = pSiS->BIOS[0xec]; vga2_bl = pSiS->BIOS[0xeb];
@@ -1137,7 +1150,7 @@ SISSense30x(ScrnInfoPtr pScrn)
cvbs_bh = pSiS->BIOS[0xc8]; cvbs_bl = pSiS->BIOS[0xc7];
}
} else {
- if(pSiS->VBFlags & (VB_301B|VB_301C|VB_302B)) {
+ if(pSiS->VBFlags & (VB_301B|VB_302B)) {
vga2_bh = 0x01; vga2_bl = 0x90;
svhs_bh = 0x01; svhs_bl = 0x6b;
cvbs_bh = 0x01; cvbs_bl = 0x74;
@@ -1147,19 +1160,17 @@ SISSense30x(ScrnInfoPtr pScrn)
cvbs_bh = 0x01; cvbs_bl = 0x00;
}
}
- }
-
- if(pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)) {
- inSISIDXREG(SISPART4,0x01,myflag);
- if(myflag & 0x04) {
- vga2_bh = 0x00; vga2_bl = 0xfd;
- svhs_bh = 0x00; svhs_bl = 0xdd;
- cvbs_bh = 0x00; cvbs_bl = 0xee;
- }
+
+ } else if(pSiS->VBFlags & (VB_301C | VB_302ELV)) {
+
+ vga2_bh = 0x01; vga2_bl = 0x90;
+ svhs_bh = 0x01; svhs_bl = 0x6b;
+ cvbs_bh = 0x01; cvbs_bl = 0x10;
+
}
if(pSiS->VBFlags & (VB_301LV|VB_302LV|VB_302ELV)) {
- /* TW: No VGA2 or SCART on LV bridges */
+ /* No VGA2 or SCART on LV bridges */
vga2_bh = 0x00; vga2_bl = 0x00;
vga2_ch = 0x00; vga2_cl = 0x00;
svhs_ch = 0x04; svhs_cl = 0x08;
@@ -1174,6 +1185,7 @@ SISSense30x(ScrnInfoPtr pScrn)
andSISIDXREG(SISCR, 0x32, ~0x14);
pSiS->postVBCR32 &= ~0x14;
+
if(vga2_ch || vga2_cl || vga2_bh || vga2_bl) {
#ifdef TWDEBUG
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -1207,6 +1219,37 @@ SISSense30x(ScrnInfoPtr pScrn)
if(biosflag & 0x01) pSiS->SiS_SD_Flags |= SiS_SD_VBHASSCART;
}
+ if(pSiS->VBFlags & (VB_301C | VB_302ELV)) {
+ orSISIDXREG(SISPART4,0x0d,0x04);
+ }
+
+ andSISIDXREG(SISCR, 0x32, 0x3f);
+ pSiS->postVBCR32 &= 0x3f;
+
+ if((pSiS->VGAEngine == SIS_315_VGA) && (pSiS->VBFlags & (VB_301C|VB_301LV|VB_302LV|VB_302ELV))) {
+ outSISIDXREG(SISPART4,0x11,svhs_bl);
+ setSISIDXREG(SISPART4,0x10,0xE0,(svhs_bh|0x04));
+ SiS_DDC2Delay(pSiS->SiS_Pr, 0x1000);
+ inSISIDXREG(SISPART4,0x03,temp);
+ temp ^= 0x0E;
+ temp &= 0x06;
+ if(temp == 0x06) {
+ outSISIDXREG(SISPART4,0x11,cvbs_bl);
+ setSISIDXREG(SISPART4,0x10,0xE0,(cvbs_bh|0x04));
+ SiS_DDC2Delay(pSiS->SiS_Pr, 0x1000);
+ inSISIDXREG(SISPART4,0x03,temp);
+ temp ^= 0x0E;
+ temp &= 0x08;
+ if(temp) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "SiS30x: Detected TV connected to YPBPR output\n");
+ orSISIDXREG(SISCR,0x32,0x80);
+ pSiS->VBFlags |= TV_YPBPR;
+ pSiS->postVBCR32 |= 0x80;
+ }
+ }
+ }
+
#ifdef TWDEBUG
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"SiS30x: Scanning for TV (%x %x %x %x; %x %x %x %x)\n",
@@ -1217,43 +1260,43 @@ SISSense30x(ScrnInfoPtr pScrn)
andSISIDXREG(SISCR, 0x32, ~0x03);
pSiS->postVBCR32 &= ~0x03;
- if(pSiS->VBFlags & (VB_301C | VB_302ELV)) {
- orSISIDXREG(SISPART4,0x0d,0x04);
- }
-
- for(j = 0; j < 10; j++) {
- result = 0;
- for(i = 0; i < 3; i++) {
- if(SISDoSense(pScrn, svhs_bl, svhs_bh, svhs_cl, svhs_ch))
- result++;
- }
- if((result == 0) || (result >= 2)) break;
- }
- if(result) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "SiS30x: Detected TV connected to SVIDEO output\n");
- pSiS->VBFlags |= TV_SVIDEO;
- orSISIDXREG(SISCR, 0x32, 0x02);
- pSiS->postVBCR32 |= 0x02;
- }
-
- if((biosflag & 0x02) || (!(result))) {
+ if(!(pSiS->VBFlags & TV_YPBPR)) {
for(j = 0; j < 10; j++) {
result = 0;
for(i = 0; i < 3; i++) {
- if(SISDoSense(pScrn, cvbs_bl, cvbs_bh, cvbs_cl, cvbs_ch))
+ if(SISDoSense(pScrn, svhs_bl, svhs_bh, svhs_cl, svhs_ch))
result++;
}
if((result == 0) || (result >= 2)) break;
}
if(result) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "SiS30x: Detected TV connected to COMPOSITE output\n");
- pSiS->VBFlags |= TV_AVIDEO;
- orSISIDXREG(SISCR, 0x32, 0x01);
- pSiS->postVBCR32 |= 0x01;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "SiS30x: Detected TV connected to SVIDEO output\n");
+ pSiS->VBFlags |= TV_SVIDEO;
+ orSISIDXREG(SISCR, 0x32, 0x02);
+ pSiS->postVBCR32 |= 0x02;
+ }
+
+ if((biosflag & 0x02) || (!(result))) {
+
+ for(j = 0; j < 10; j++) {
+ result = 0;
+ for(i = 0; i < 3; i++) {
+ if(SISDoSense(pScrn, cvbs_bl, cvbs_bh, cvbs_cl, cvbs_ch))
+ result++;
+ }
+ if((result == 0) || (result >= 2)) break;
+ }
+ if(result) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "SiS30x: Detected TV connected to COMPOSITE output\n");
+ pSiS->VBFlags |= TV_AVIDEO;
+ orSISIDXREG(SISCR, 0x32, 0x01);
+ pSiS->postVBCR32 |= 0x01;
+ }
}
+
}
SISDoSense(pScrn, 0, 0, 0, 0);
@@ -1417,7 +1460,7 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
inSISIDXREG(SISPART4, 0x23, temp2);
if(!(temp2 & 0x02)) pSiS->VBFlags |= VB_30xBDH;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb,
- (temp2 & 0x02) ? "SiS301B" : "SiS301B-DH", temp1);
+ (temp2 & 0x02) ? "SiS301B" : "SiS301B-DH", 1, temp1);
} else {
pSiS->VBFlags |= VB_301;
pSiS->sishw_ext.ujVBChipID = VB_CHIP_301;
@@ -1444,7 +1487,7 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
inSISIDXREG(SISPART4, 0x23, temp2);
if(!(temp & 0x02)) pSiS->VBFlags |= VB_30xBDH;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb,
- (temp2 & 0x02) ? "SiS302B" : "SiS302B-DH", temp1);
+ (temp2 & 0x02) ? "SiS302B" : "SiS302B-DH", 2, temp1);
}
SISSense30x(pScrn);
@@ -1622,10 +1665,10 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
break;
case 0x04:
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Chrontel: Detected TV connected to SCART output or 480i HDTV\n");
+ "Chrontel: Detected TV connected to SCART or YPBPR output\n");
if(pSiS->chtvtype == -1) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Chrontel: Use CHTVType option to select either SCART or HDTV\n");
+ "Chrontel: Use CHTVType option to select either SCART or YPBPR525I\n");
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Chrontel: Using SCART by default\n");
pSiS->chtvtype = 1;
@@ -1633,7 +1676,7 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
if(pSiS->chtvtype)
pSiS->VBFlags |= TV_CHSCART;
else
- pSiS->VBFlags |= TV_CHHDTV;
+ pSiS->VBFlags |= TV_CHYPBPR525I;
break;
default:
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
diff --git a/src/sis_video.c b/src/sis_video.c
index e60efcb..ec30f3d 100644
--- a/src/sis_video.c
+++ b/src/sis_video.c
@@ -1,39 +1,42 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c,v 1.44 2003/12/16 17:35:07 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c,v 1.48 2004/01/23 22:29:06 twini Exp $ */
/*
* Xv driver for SiS 300, 315 and 330 series.
*
- * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria.
- * All Rights Reserved.
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria.
*
- * Basic structure based on the mga Xv driver by Mark Vojkovich
- * and i810 Xv driver by Jonathan Bian <jonathan.bian@intel.com>.
- *
- * Formerly based on a mostly non-working fragment for the 630 by
- * Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1) Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2) Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3) All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement: "This product includes
+ * software developed by Thomas Winischhofer, Vienna, Austria."
+ * 4) The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * Author: Thomas Winischhofer <thomas@winischhofer.net>
*
- * Authors:
- * Thomas Winischhofer <thomas@winischhofer.net>:
- * (Original code fragment for 630 by
- * Sung-Ching Lin <sclin@sis.com.tw>)
+ * Formerly based on a mostly non-working code fragment for the 630 by
+ * Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan which is
+ * Copyright (C) 2000 Silicon Integrated Systems Corp, Inc.
*
+ * Basic structure based on the mga Xv driver by Mark Vojkovich
+ * and i810 Xv driver by Jonathan Bian <jonathan.bian@intel.com>.
*
* All comments in this file are by Thomas Winischhofer.
*
@@ -1602,6 +1605,7 @@ SISSetPortAttribute(ScrnInfoPtr pScrn, Atom attribute,
#endif
if(pSiS->xv_sisdirectunlocked) {
SISSwitchCRT2Type(pScrn, (unsigned long)value);
+ set_dispmode(pScrn, pPriv);
set_allowswitchcrt(pSiS, pPriv);
set_maxencoding(pSiS, pPriv);
}
@@ -1611,6 +1615,7 @@ SISSetPortAttribute(ScrnInfoPtr pScrn, Atom attribute,
#endif
if(pSiS->xv_sisdirectunlocked) {
SISSwitchCRT1Status(pScrn, (unsigned long)value);
+ set_dispmode(pScrn, pPriv);
set_allowswitchcrt(pSiS, pPriv);
set_maxencoding(pSiS, pPriv);
}
diff --git a/src/vgatypes.h b/src/vgatypes.h
index 123053c..975ddcc 100644
--- a/src/vgatypes.h
+++ b/src/vgatypes.h
@@ -1,36 +1,57 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/vgatypes.h,v 1.18 2003/12/16 17:45:20 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/vgatypes.h,v 1.21 2004/01/23 22:29:06 twini Exp $ */
/*
* General type definitions for universal mode switching modules
*
- * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
*
- * If distributed as part of the linux kernel, the contents of this file
- * is entirely covered by the GPL.
+ * If distributed as part of the Linux kernel, the following license terms
+ * apply:
*
- * Otherwise, the following terms apply:
+ * * This program is free software; you can redistribute it and/or modify
+ * * it under the terms of the GNU General Public License as published by
+ * * the Free Software Foundation; either version 2 of the named License,
+ * * or any later version.
+ * *
+ * * This program is distributed in the hope that it will be useful,
+ * * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * * GNU General Public License for more details.
+ * *
+ * * You should have received a copy of the GNU General Public License
+ * * along with this program; if not, write to the Free Software
+ * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Otherwise, the following license terms apply:
*
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * * Redistribution and use in source and binary forms, with or without
+ * * modification, are permitted provided that the following conditions
+ * * are met:
+ * * 1) Redistributions of source code must retain the above copyright
+ * * notice, this list of conditions and the following disclaimer.
+ * * 2) Redistributions in binary form must reproduce the above copyright
+ * * notice, this list of conditions and the following disclaimer in the
+ * * documentation and/or other materials provided with the distribution.
+ * * 3) All advertising materials mentioning features or use of this software
+ * * must display the following acknowledgement: "This product includes
+ * * software developed by Thomas Winischhofer, Vienna, Austria."
+ * * 4) The name of the author may not be used to endorse or promote products
+ * * derived from this software without specific prior written permission.
+ * *
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Authors: Thomas Winischhofer <thomas@winischhofer.net>
- * Silicon Integrated Systems
+ * Author: Thomas Winischhofer <thomas@winischhofer.net>
*
*/
+
#ifndef _VGATYPES_
#define _VGATYPES_
@@ -164,6 +185,8 @@ typedef enum _SIS_LCD_TYPE {
LCD_640x480_2, /* FSTN, DSTN */
LCD_640x480_3, /* FSTN, DSTN */
LCD_848x480,
+ LCD_1280x800,
+ LCD_1680x1050,
LCD_CUSTOM,
LCD_UNKNOWN
} SIS_LCD_TYPE;
diff --git a/src/vstruct.h b/src/vstruct.h
index ca30ca9..7681d4e 100644
--- a/src/vstruct.h
+++ b/src/vstruct.h
@@ -1,34 +1,54 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/vstruct.h,v 1.26 2003/12/16 17:35:07 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/vstruct.h,v 1.32 2004/01/23 22:29:06 twini Exp $ */
/*
* General structure definitions for universal mode switching modules
*
- * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria
+ * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
*
- * If distributed as part of the linux kernel, the contents of this file
- * is entirely covered by the GPL.
+ * If distributed as part of the Linux kernel, the following license terms
+ * apply:
*
- * Otherwise, the following terms apply:
+ * * This program is free software; you can redistribute it and/or modify
+ * * it under the terms of the GNU General Public License as published by
+ * * the Free Software Foundation; either version 2 of the named License,
+ * * or any later version.
+ * *
+ * * This program is distributed in the hope that it will be useful,
+ * * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * * GNU General Public License for more details.
+ * *
+ * * You should have received a copy of the GNU General Public License
+ * * along with this program; if not, write to the Free Software
+ * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Otherwise, the following license terms apply:
*
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * * Redistribution and use in source and binary forms, with or without
+ * * modification, are permitted provided that the following conditions
+ * * are met:
+ * * 1) Redistributions of source code must retain the above copyright
+ * * notice, this list of conditions and the following disclaimer.
+ * * 2) Redistributions in binary form must reproduce the above copyright
+ * * notice, this list of conditions and the following disclaimer in the
+ * * documentation and/or other materials provided with the distribution.
+ * * 3) All advertising materials mentioning features or use of this software
+ * * must display the following acknowledgement: "This product includes
+ * * software developed by Thomas Winischhofer, Vienna, Austria."
+ * * 4) The name of the author may not be used to endorse or promote products
+ * * derived from this software without specific prior written permission.
+ * *
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Authors: Thomas Winischhofer <thomas@winischhofer.net>
- * Silicon Integrated Systems
+ * Author: Thomas Winischhofer <thomas@winischhofer.net>
*
*/
@@ -280,7 +300,8 @@ typedef struct _SiS_Private
BOOLEAN HaveEMILCD;
BOOLEAN OverruleEMI;
UCHAR EMI_30,EMI_31,EMI_32,EMI_33;
- UCHAR PDC;
+ SHORT PDC;
+ UCHAR SiS_MyCR63;
USHORT SiS_CRT1Mode;
USHORT SiS_flag_clearbuffer;
int SiS_RAMType;
@@ -319,11 +340,13 @@ typedef struct _SiS_Private
USHORT SiS_DDC_Port;
USHORT SiS_DDC_Index;
USHORT SiS_DDC_Data;
+ USHORT SiS_DDC_NData;
USHORT SiS_DDC_Clk;
- USHORT SiS_DDC_DataShift;
+ USHORT SiS_DDC_NClk;
USHORT SiS_DDC_DeviceAddr;
USHORT SiS_DDC_ReadAddr;
USHORT SiS_DDC_SecAddr;
+ BOOLEAN SiS_SensibleSR11;
USHORT SiS_Panel800x600;
USHORT SiS_Panel1024x768;
USHORT SiS_Panel1280x1024;
@@ -421,17 +444,26 @@ typedef struct _SiS_Private
const SiS_TVDataStruct *SiS_ExtPALData;
const SiS_TVDataStruct *SiS_StNTSCData;
const SiS_TVDataStruct *SiS_ExtNTSCData;
+ const SiS_TVDataStruct *SiS_St1HiTVData;
const SiS_TVDataStruct *SiS_St2HiTVData;
const SiS_TVDataStruct *SiS_ExtHiTVData;
+ const SiS_TVDataStruct *SiS_St525iData;
+ const SiS_TVDataStruct *SiS_St525pData;
+ const SiS_TVDataStruct *SiS_St750pData;
+ const SiS_TVDataStruct *SiS_Ext525iData;
+ const SiS_TVDataStruct *SiS_Ext525pData;
+ const SiS_TVDataStruct *SiS_Ext750pData;
const UCHAR *SiS_NTSCTiming;
const UCHAR *SiS_PALTiming;
const UCHAR *SiS_HiTVExtTiming;
const UCHAR *SiS_HiTVSt1Timing;
const UCHAR *SiS_HiTVSt2Timing;
- const UCHAR *SiS_HiTVTextTiming;
const UCHAR *SiS_HiTVGroup3Data;
const UCHAR *SiS_HiTVGroup3Simu;
+#if 0
+ const UCHAR *SiS_HiTVTextTiming;
const UCHAR *SiS_HiTVGroup3Text;
+#endif
const SiS_PanelDelayTblStruct *SiS_PanelDelayTbl;
const SiS_PanelDelayTblStruct *SiS_PanelDelayTblLVDS;
const SiS_LVDSDataStruct *SiS_LVDS800x600Data_1;