summaryrefslogtreecommitdiff
path: root/xc/programs/Xserver
diff options
context:
space:
mode:
Diffstat (limited to 'xc/programs/Xserver')
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile3
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/init.c1524
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/init.h43
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c89
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h7
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h48
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.c132
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.h332
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_common.h63
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c8
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c17
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c58
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h24
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c216
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c33
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c25
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c6
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c52
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c52
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/vgatypes.h3
22 files changed, 822 insertions, 1919 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile
index 4cbe4186e..e5ee0edbb 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile,v 1.32 2003/04/21 12:32:11 sven Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile,v 1.33 2003/08/29 08:50:54 twini Exp $
XCOMM
XCOMM This is an Imakefile for the SIS driver.
XCOMM
@@ -92,6 +92,7 @@ InstallDriverSDKNonExecFile(sis_dac.h,$(DRIVERSDKDIR)/drivers/sis)
InstallDriverSDKNonExecFile(sis_dga.c,$(DRIVERSDKDIR)/drivers/sis)
InstallDriverSDKNonExecFile(sis_dri.c,$(DRIVERSDKDIR)/drivers/sis)
InstallDriverSDKNonExecFile(sis_dri.h,$(DRIVERSDKDIR)/drivers/sis)
+InstallDriverSDKNonExecFile(sis_common.h,$(DRIVERSDKDIR)/drivers/sis)
InstallDriverSDKNonExecFile(sis_driver.c,$(DRIVERSDKDIR)/drivers/sis)
InstallDriverSDKNonExecFile(sis_driver.h,$(DRIVERSDKDIR)/drivers/sis)
InstallDriverSDKNonExecFile(sis_opt.c,$(DRIVERSDKDIR)/drivers/sis)
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/init.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/init.c
index 50dced605..40dcfe4cf 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/init.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/init.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.c,v 1.15 2003/08/26 14:29:35 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.c,v 1.19 2003/08/28 23:20:34 twini Exp $ */
/*
* Mode switching code (CRT1 section) for
* SiS 300/540/630/730/315/550/650/M650/651/M652/740/330/660/M660/760
@@ -63,10 +63,6 @@ BOOLEAN SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExte
#endif /* dual head */
#endif /* linux_xf86 */
-#ifdef LINUXBIOS
-BOOLEAN SiSInit(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
-#endif
-
#ifdef LINUX_XF86
BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
ScrnInfoPtr pScrn,USHORT ModeNo, BOOLEAN dosetpitch);
@@ -75,16 +71,16 @@ BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
USHORT ModeNo);
#endif
-#if defined(ALLOC_PRAGMA)
-#pragma alloc_text(PAGE,SiSSetMode)
-#pragma alloc_text(PAGE,SiSInit)
-#endif
-
#ifndef LINUX_XF86
static ULONG GetDRAMSize(SiS_Private *SiS_Pr,
PSIS_HW_DEVICE_INFO HwDeviceExtension);
#endif
+#if defined(ALLOC_PRAGMA)
+#pragma alloc_text(PAGE,SiSSetMode)
+#pragma alloc_text(PAGE,SiSInit)
+#endif
+
static void
InitCommonPointer(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
@@ -670,1224 +666,6 @@ InitTo310Pointer(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
}
#endif
-#ifdef LINUXBIOS
-/* -------------- SiSInit -----------------*/
-/* TW: I degraded this for LINUXBIOS only, because we
- * don't need this otherwise. Under normal
- * circumstances, the video BIOS has initialized
- * the adapter for us. BTW, this code is incomplete
- * and very possibly not working on newer chipsets.
- */
-BOOLEAN
-SiSInit(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
-{
- UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase;
- ULONG FBAddr = (ULONG)HwDeviceExtension->pjVideoMemoryAddress;
- USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress;
- UCHAR i, temp=0;
- UCHAR SR11;
-#ifdef LINUX_KERNEL
- UCHAR temp1;
- ULONG base;
-#endif
- UCHAR SR13=0, SR14=0, SR16=0
- UCHAR SR17=0, SR19=0, SR1A=0;
-#ifdef SIS300
- UCHAR SR18=0, SR12=0;
-#endif
-#ifdef SIS315H
- UCHAR CR37=0, CR38=0, CR79=0,
- UCHAR CR7A=0, CR7B=0, CR7C=0;
- UCHAR SR1B=0, SR15=0;
- PSIS_DSReg pSR;
- ULONG Temp;
-#endif
- UCHAR VBIOSVersion[5];
-
- if(FBAddr==0) return (FALSE);
- if(BaseAddr==0) return (FALSE);
-
- SiS_SetReg3((USHORT)(BaseAddr+0x12), 0x67); /* Misc */
-
-#ifdef SIS315H
- if(HwDeviceExtension->jChipType > SIS_315PRO) {
- if(!HwDeviceExtension->bIntegratedMMEnabled)
- return (FALSE);
- }
-#endif
-
- SiS_MemoryCopy(VBIOSVersion,HwDeviceExtension->szVBIOSVer,4);
- VBIOSVersion[4]= 0x00;
-
- SiSDetermineROMUsage(SiS_Pr, HwDeviceExtension, ROMAddr);
-
- /* TW: Init pointers */
-#ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_315H) ||
- (HwDeviceExtension->jChipType == SIS_315) ||
- (HwDeviceExtension->jChipType == SIS_315PRO) ||
- (HwDeviceExtension->jChipType == SIS_550) ||
- (HwDeviceExtension->jChipType == SIS_650) ||
- (HwDeviceExtension->jChipType == SIS_740) ||
- (HwDeviceExtension->jChipType == SIS_330) ||
- (HwDeviceExtension->jChipType == SIS_660) ||
- (HwDeviceExtension->jChipType == SIS_760))
- InitTo310Pointer(SiS_Pr, HwDeviceExtension);
-#endif
-
-#ifdef SIS300
- if((HwDeviceExtension->jChipType == SIS_540) ||
- (HwDeviceExtension->jChipType == SIS_630) ||
- (HwDeviceExtension->jChipType == SIS_730) ||
- (HwDeviceExtension->jChipType == SIS_300))
- InitTo300Pointer(SiS_Pr, HwDeviceExtension);
-#endif
-
- /* TW: Set SiS Register definitions */
- SiSRegInit(SiS_Pr, BaseAddr);
-
- /* TW: Determine LVDS/CH70xx/TRUMPION */
- SiS_Set_LVDS_TRUMPION(SiS_Pr, HwDeviceExtension);
-
- /* TW: Unlock registers */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86);
-
-#ifdef LINUX_KERNEL
-
-#ifdef SIS300 /* Set SR14 */
- if((HwDeviceExtension->jChipType==SIS_540) ||
- (HwDeviceExtension->jChipType==SIS_630) ||
- (HwDeviceExtension->jChipType==SIS_730)) {
- base=0x80000060;
- OutPortLong(base,0xcf8);
- temp1 = InPortLong(0xcfc);
- temp1 >>= (16+8+4);
- temp1 &= 0x07;
- temp1++;
- temp1 = 1 << temp1;
- SR14 = temp1 - 1;
- base = 0x80000064;
- OutPortLong(base,0xcf8);
- temp1 = InPortLong(0xcfc);
- temp1 &= 0x00000020;
- if(temp1) SR14 |= 0x80;
- else SR14 |= 0x40;
- }
-#endif
-
-#ifdef SIS315H /* Set SR14 */
- if(HwDeviceExtension->jChipType == SIS_550) {
- base = 0x80000060;
- OutPortLong(base,0xcf8);
- temp1 = InPortLong(0xcfc);
- temp1 >>= (16+8+4);
- temp1 &= 0x07;
- temp1++;
- temp1 = 1 << temp1;
- SR14 = temp1 - 1;
- base = 0x80000064;
- OutPortLong(base,0xcf8);
- temp1 = InPortLong(0xcfc);
- temp1 &= 0x00000020;
- if(temp1) SR14 |= 0x80;
- else SR14 |= 0x40;
- }
-
- if((HwDeviceExtension->jChipType == SIS_740) || /* Set SR14 */
- (HwDeviceExtension->jChipType == SIS_650)) {
- base = 0x80000064;
- OutPortLong(base,0xcf8);
- temp1=InPortLong(0xcfc);
- temp1 >>= 4;
- temp1 &= 0x07;
- if(temp1 > 2) {
- temp = temp1;
- switch(temp) {
- case 3: temp1 = 0x07; break;
- case 4: temp1 = 0x0F; break;
- case 5: temp1 = 0x1F; break;
- case 6: temp1 = 0x05; break;
- case 7: temp1 = 0x17; break;
- case 8: break;
- case 9: break;
- }
- }
- SR14 = temp1;
- base = 0x8000007C;
- OutPortLong(base,0xcf8);
- temp1 = InPortLong(0xcfc);
- temp1 &= 0x00000020;
- if(temp1) SR14 |= 0x80;
- }
-#endif
-
-#endif /* Linux kernel */
-
-#ifdef SIS300
- if((HwDeviceExtension->jChipType == SIS_540)||
- (HwDeviceExtension->jChipType == SIS_630)||
- (HwDeviceExtension->jChipType == SIS_730)) {
- SR12 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x12);
- SR13 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13);
- SR14 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
- SR16 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16);
- SR17 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17);
- SR18 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x18);
- SR19 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x19);
- SR1A = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A);
- } else if(HwDeviceExtension->jChipType == SIS_300){
- SR13 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13);
- SR14 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
- }
-#endif
-#ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_550) ||
- (HwDeviceExtension->jChipType == SIS_740) ||
- (HwDeviceExtension->jChipType == SIS_650)) {
- SR19 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x19);
- SR19 = (SR19)||0x01; /* TW: ??? || ??? */
- if(SR19==0x00) {
- SR13 = 0x22;
- SR14 = 0x00;
- SR15 = 0x01;
- SR16 = 0x00;
- SR17 = 0x00;
- SR1A = 0x00;
- SR1B = 0x00;
- CR37 = 0x00;
- CR38 = 0x00;
- CR79 = 0x00;
- CR7A = 0x00;
- CR7B = 0x00;
- CR7C = 0x00;
- } else {
- SR13 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13);
- SR14 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
- SR15 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x15);
- SR16 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16);
- SR17 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17);
- SR1A = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A);
- SR1B = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1B);
- CR37 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x37); /* TW: Was 0x02 - why? */
- CR38 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38);
- CR79 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x79);
- CR7A = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x7A);
- CR7B = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x7B);
- CR7C = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x7C);
- }
- }
-#endif
-
- /* Reset extended registers */
-
- for(i=0x06; i< 0x20; i++) SiS_SetReg1(SiS_Pr->SiS_P3c4,i,0);
- for(i=0x21; i<=0x27; i++) SiS_SetReg1(SiS_Pr->SiS_P3c4,i,0);
- for(i=0x31; i<=0x3D; i++) SiS_SetReg1(SiS_Pr->SiS_P3c4,i,0);
-
-#ifdef SIS300
- if((HwDeviceExtension->jChipType == SIS_540) ||
- (HwDeviceExtension->jChipType == SIS_630) ||
- (HwDeviceExtension->jChipType == SIS_730) ||
- (HwDeviceExtension->jChipType == SIS_300)) {
- for(i=0x38; i<=0x3F; i++) SiS_SetReg1(SiS_Pr->SiS_P3d4,i,0);
- }
-#endif
-
-#ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_315H) ||
- (HwDeviceExtension->jChipType == SIS_315) ||
- (HwDeviceExtension->jChipType == SIS_315PRO) ||
- (HwDeviceExtension->jChipType == SIS_550) ||
- (HwDeviceExtension->jChipType == SIS_650) ||
- (HwDeviceExtension->jChipType == SIS_740) ||
- (HwDeviceExtension->jChipType == SIS_330) ||
- (HwDeviceExtension->jChipType == SIS_660) ||
- (HwDeviceExtension->jChipType == SIS_760)) {
- for(i=0x12; i<=0x1B; i++) SiS_SetReg1(SiS_Pr->SiS_P3c4,i,0);
- for(i=0x79; i<=0x7C; i++) SiS_SetReg1(SiS_Pr->SiS_P3d4,i,0);
- }
-#endif
-
- /* Restore Extended Registers */
-
-#ifdef SIS300
- if((HwDeviceExtension->jChipType == SIS_540) ||
- (HwDeviceExtension->jChipType == SIS_630) ||
- (HwDeviceExtension->jChipType == SIS_730)) {
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x12,SR12);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SR16);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SR17);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x18,SR18);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SR19);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1A,SR1A);
- }
-#endif
-
-#ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_550) ||
- (HwDeviceExtension->jChipType == SIS_740) ||
- (HwDeviceExtension->jChipType == SIS_650)) {
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x15,SR15);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SR16);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SR17);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SR19);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1A,SR1A);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1B,SR1B);
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x37,CR37);
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x38,CR38);
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x79,CR79);
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x7A,CR7A);
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x7B,CR7B);
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x7C,CR7C);
- }
-#endif
-
-#ifdef SIS300
- if((HwDeviceExtension->jChipType==SIS_540) ||
- (HwDeviceExtension->jChipType==SIS_630) ||
- (HwDeviceExtension->jChipType==SIS_730)) {
- temp = (UCHAR)SR1A & 0x03;
- } else if(HwDeviceExtension->jChipType == SIS_300) {
- /* TW: Nothing */
- }
-#endif
-#ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_315H) ||
- (HwDeviceExtension->jChipType == SIS_315) ||
- (HwDeviceExtension->jChipType == SIS_315PRO) ||
- (HwDeviceExtension->jChipType == SIS_330)) {
- if((*SiS_Pr->pSiS_SoftSetting & SoftDRAMType) == 0) {
- temp = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3A) & 0x03;
- }
- }
- if((HwDeviceExtension->jChipType == SIS_550) ||
- (HwDeviceExtension->jChipType == SIS_740) ||
- (HwDeviceExtension->jChipType == SIS_650) ||
- (HwDeviceExtension->jChipType == SIS_660) ||
- (HwDeviceExtension->jChipType == SIS_760)) {
- if((*SiS_Pr->pSiS_SoftSetting & SoftDRAMType) == 0) {
- temp = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x07;
- }
- }
-#endif
-
- SiS_Pr->SiS_RAMType = temp;
- SiS_SetMemoryClock(SiS_Pr, ROMAddr, HwDeviceExtension);
-
- /* Set default register contents */
-
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x07,*SiS_Pr->pSiS_SR07); /* DAC speed */
-
- if((HwDeviceExtension->jChipType != SIS_540) &&
- (HwDeviceExtension->jChipType != SIS_630) &&
- (HwDeviceExtension->jChipType != SIS_730)){
- for(i=0x15; i<0x1C; i++) {
- SiS_SetReg1(SiS_Pr->SiS_P3c4,i,SiS_Pr->SiS_SR15[i-0x15][SiS_Pr->SiS_RAMType]);
- }
- }
-
-#ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_315H) ||
- (HwDeviceExtension->jChipType == SIS_315) ||
- (HwDeviceExtension->jChipType == SIS_315PRO) ||
- (HwDeviceExtension->jChipType == SIS_330)) {
- for(i=0x40;i<=0x44;i++) {
- SiS_SetReg1(SiS_Pr->SiS_P3d4,i,SiS_Pr->SiS_CR40[i-0x40][SiS_Pr->SiS_RAMType]);
- }
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x48,0x23);
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x49,SiS_Pr->SiS_CR49[0]);
- /* SiS_SetReg1(SiS_Pr->SiS_P3c4,0x25,SiS_Pr->SiS_SR25[0]); */
- }
-#endif
-
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1F,*SiS_Pr->pSiS_SR1F); /* DAC pedestal */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x20,0xA0);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x23,*SiS_Pr->pSiS_SR23);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x24,*SiS_Pr->pSiS_SR24);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x25,SiS_Pr->SiS_SR25[0]);
-
-#ifdef SIS300
- if(HwDeviceExtension->jChipType == SIS_300) {
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,0x84);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x22,0x00);
- }
-#endif
-
- SR11 = 0x0F;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x11,SR11); /* Power Management & DDC port */
-
- SiS_UnLockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr);
- SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x00,0x00);
- SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x02,*SiS_Pr->pSiS_CRT2Data_1_2);
-
-#ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_315H) ||
- (HwDeviceExtension->jChipType == SIS_315) ||
- (HwDeviceExtension->jChipType == SIS_315PRO) ||
- (HwDeviceExtension->jChipType == SIS_550) ||
- (HwDeviceExtension->jChipType == SIS_650) ||
- (HwDeviceExtension->jChipType == SIS_740) ||
- (HwDeviceExtension->jChipType == SIS_330) ||
- (HwDeviceExtension->jChipType == SIS_660) ||
- (HwDeviceExtension->jChipType == SIS_760))
- SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2E,0x08); /* use VB */
-#endif
-
- temp = *SiS_Pr->pSiS_SR32;
- if(SiS_BridgeIsOn(SiS_Pr, BaseAddr)) {
- temp &= 0xEF;
- }
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,temp);
-
-#ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_315H) ||
- (HwDeviceExtension->jChipType == SIS_315) ||
- (HwDeviceExtension->jChipType == SIS_315PRO) ||
- (HwDeviceExtension->jChipType == SIS_330)) {
- HwDeviceExtension->pQueryVGAConfigSpace(HwDeviceExtension,0x50,0,&Temp);
- Temp >>= 20;
- Temp &= 0xF;
- if (Temp != 1) {
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x25,SiS_Pr->SiS_SR25[1]);
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x49,SiS_Pr->SiS_CR49[1]);
- }
-
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x27,0x1F);
-
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x31,*SiS_Pr->pSiS_SR31);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,*SiS_Pr->pSiS_SR32);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x33,*SiS_Pr->pSiS_SR33);
- }
-#endif
-
- if (SiS_BridgeIsOn(SiS_Pr, BaseAddr) == 0) {
- if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
- SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x00,0x1C);
- SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0D,*SiS_Pr->pSiS_CRT2Data_4_D);
- SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0E,*SiS_Pr->pSiS_CRT2Data_4_E);
- SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x10,*SiS_Pr->pSiS_CRT2Data_4_10);
- SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0F,0x3F);
- }
- SiS_LockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr);
- }
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x83,0x00);
-
-#ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_315H) ||
- (HwDeviceExtension->jChipType == SIS_315) ||
- (HwDeviceExtension->jChipType == SIS_315PRO) ||
- (HwDeviceExtension->jChipType == SIS_330)) {
- if(HwDeviceExtension->bSkipDramSizing==TRUE) {
- SiS_SetDRAMModeRegister(SiS_Pr, ROMAddr,HwDeviceExtension);
- pSR = HwDeviceExtension->pSR;
- if(pSR != NULL) {
- while(pSR->jIdx != 0xFF) {
- SiS_SetReg1(SiS_Pr->SiS_P3c4,pSR->jIdx,pSR->jVal);
- pSR++;
- }
- }
- } else SiS_SetDRAMSize_310(SiS_Pr, HwDeviceExtension);
- }
-#endif
-
-#ifdef SIS315H
- if(HwDeviceExtension->jChipType == SIS_550) {
- /* SetDRAMConfig begin */
-/* SiS_SetReg1(SiS_Pr->SiS_P3c4,0x12,SR12);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SR16);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SR17);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x18,SR18);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SR19);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1A,SR1A); */
- /* SetDRAMConfig end */
- }
-#endif
-
-#ifdef SIS300
- if(HwDeviceExtension->jChipType == SIS_300) {
- if (HwDeviceExtension->bSkipDramSizing == TRUE) {
-/* SiS_SetDRAMModeRegister(ROMAddr,HwDeviceExtension);
- temp = (HwDeviceExtension->pSR)->jVal;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,temp);
- temp = (HwDeviceExtension->pSR)->jVal;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,temp); */
- } else {
-#ifdef TC
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14);
- SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x15,0xFF,0x04);
-#else
- SiS_SetDRAMSize_300(SiS_Pr, HwDeviceExtension);
- SiS_SetDRAMSize_300(SiS_Pr, HwDeviceExtension);
-#endif
- }
- }
- if((HwDeviceExtension->jChipType==SIS_540)||
- (HwDeviceExtension->jChipType==SIS_630)||
- (HwDeviceExtension->jChipType==SIS_730)) {
-#if 0
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x12,SR12);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SR16);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SR17);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x18,SR18);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SR19);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1A,SR1A);
-#endif
- }
-/* SetDRAMSize end */
-#endif /* SIS300 */
-
- /* Set default Ext2Regs */
-#if 0
- AGP=1;
- temp=(UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3A);
- temp &= 0x30;
- if(temp == 0x30) AGP=0;
- if(AGP == 0) *SiS_Pr->pSiS_SR21 &= 0xEF;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,*SiS_Pr->pSiS_SR21);
- if(AGP == 1) *SiS_Pr->pSiS_SR22 &= 0x20;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x22,*SiS_Pr->pSiS_SR22);
-#endif
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,*SiS_Pr->pSiS_SR21);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x22,*SiS_Pr->pSiS_SR22);
-
-#if 0
- SiS_SetReg3(SiS_Pr->SiS_P3c6,0xff);
- SiS_ClearDAC(SiS_Pr, SiS_Pr->SiS_P3c8);
-#endif
-
-#ifdef LINUXBIOS /* TW: This is not needed for our purposes */
- SiS_DetectMonitor(SiS_Pr, HwDeviceExtension,BaseAddr); /* Sense CRT1 */
- SiS_GetSenseStatus(SiS_Pr, HwDeviceExtension,ROMAddr); /* Sense CRT2 */
-#endif
-
- return(TRUE);
-}
-
-void
-SiS_Set_LVDS_TRUMPION(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
-{
- USHORT temp = 0;
-
-#ifdef SiS300
- if((HwDeviceExtension->jChipType == SIS_540) ||
- (HwDeviceExtension->jChipType == SIS_630) ||
- (HwDeviceExtension->jChipType == SIS_730)) {
- /* TW: Read POWER_ON_TRAP and copy to CR37 */
- temp = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A);
- temp = (temp & 0xE0) >> 4;
- SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,0xF1,temp);
- }
-#endif
-#ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_650) ||
- (HwDeviceExtension->jChipType == SIS_740) ||
- (HwDeviceExtension->jChipType == SIS_330) ||
- (HwDeviceExtension->jChipType == SIS_660) ||
- (HwDeviceExtension->jChipType == SIS_760)) {
-#if 0 /* TW: This is not required */
- /* TW: Read POWER_ON_TRAP and copy to CR37 */
- temp = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A);
- temp = (temp & 0xE0) >> 4;
- SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,0xF1,temp);
-#endif
- }
-#endif
-
- SiSSetLVDSetc(SiS_Pr, HwDeviceExtension, 0);
-}
-
-/* =============== SiS 300 dram sizing begin =============== */
-#ifdef SIS300
-void
-SiS_SetDRAMSize_300(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
-{
- ULONG FBAddr = (ULONG)HwDeviceExtension->pjVideoMemoryAddress;
- USHORT SR13, SR14=0, buswidth, Done;
- SHORT i, j, k;
- USHORT data, TotalCapacity, PhysicalAdrOtherPage=0;
- ULONG Addr;
- UCHAR temp;
- int PseudoRankCapacity, PseudoTotalCapacity, PseudoAdrPinCount;
- int RankCapacity, AdrPinCount, BankNumHigh, BankNumMid, MB2Bank;
- int PageCapacity, PhysicalAdrHigh, PhysicalAdrHalfPage;
-
- SiSSetMode(SiS_Pr, HwDeviceExtension, 0x2e);
-
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x01,0x20); /* Turn OFF Display */
-
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,0x00);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0xBF);
-
- buswidth = SiS_ChkBUSWidth_300(SiS_Pr, FBAddr);
-
- MB2Bank = 16;
- Done = 0;
- for(i=6; i>=0; i--) {
- if(Done == 1) break;
- PseudoRankCapacity = 1 << i;
- for(j=4; j>=1; j--) {
- if(Done == 1) break;
- PseudoTotalCapacity = PseudoRankCapacity * j;
- PseudoAdrPinCount = 15 - j;
- if(PseudoTotalCapacity <= 64) {
- for(k=0; k<=16; k++) {
- if(Done == 1) break;
- RankCapacity = buswidth * SiS_DRAMType[k][3];
- AdrPinCount = SiS_DRAMType[k][2] + SiS_DRAMType[k][0];
- if(RankCapacity == PseudoRankCapacity)
- if(AdrPinCount <= PseudoAdrPinCount) {
- if(j == 3) { /* Rank No */
- BankNumHigh = RankCapacity * MB2Bank * 3 - 1;
- BankNumMid = RankCapacity * MB2Bank * 1 - 1;
- } else {
- BankNumHigh = RankCapacity * MB2Bank * j - 1;
- BankNumMid = RankCapacity * MB2Bank * j / 2 - 1;
- }
- PageCapacity = (1 << SiS_DRAMType[k][1]) * buswidth * 4;
- PhysicalAdrHigh = BankNumHigh;
- PhysicalAdrHalfPage = (PageCapacity / 2 + PhysicalAdrHigh) % PageCapacity;
- PhysicalAdrOtherPage = PageCapacity * SiS_DRAMType[k][2] + PhysicalAdrHigh;
- /* Write data */
- /*Test*/
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x15,0xFB);
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x15,0x04);
- /*/Test*/
- TotalCapacity = SiS_DRAMType[k][3] * buswidth;
- SR13 = SiS_DRAMType[k][4];
- if(buswidth == 4) SR14 = (TotalCapacity - 1) | 0x80;
- if(buswidth == 2) SR14 = (TotalCapacity - 1) | 0x40;
- if(buswidth == 1) SR14 = (TotalCapacity - 1) | 0x00;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14);
-
- Addr = FBAddr + (BankNumHigh) * 64 * 1024 + PhysicalAdrHigh;
- *((USHORT *)(Addr)) = (USHORT)PhysicalAdrHigh;
- Addr = FBAddr + (BankNumMid) * 64 * 1024 + PhysicalAdrHigh;
- *((USHORT *)(Addr)) = (USHORT)BankNumMid;
- Addr = FBAddr + (BankNumHigh) * 64 * 1024 + PhysicalAdrHalfPage;
- *((USHORT *)(Addr)) = (USHORT)PhysicalAdrHalfPage;
- Addr = FBAddr + (BankNumHigh) * 64 * 1024 + PhysicalAdrOtherPage;
- *((USHORT *)(Addr)) = PhysicalAdrOtherPage;
-
- /* Read data */
- Addr = FBAddr + (BankNumHigh) * 64 * 1024 + PhysicalAdrHigh;
- data = *((USHORT *)(Addr));
- if(data == PhysicalAdrHigh) Done = 1;
- } /* if struct */
- } /* for loop (k) */
- } /* if struct */
- } /* for loop (j) */
- } /* for loop (i) */
-}
-
-USHORT
-SiS_ChkBUSWidth_300(SiS_Private *SiS_Pr, ULONG FBAddress)
-{
- PULONG pVideoMemory;
-
- pVideoMemory = (PULONG)FBAddress;
-
- pVideoMemory[0] = 0x01234567L;
- pVideoMemory[1] = 0x456789ABL;
- pVideoMemory[2] = 0x89ABCDEFL;
- pVideoMemory[3] = 0xCDEF0123L;
- if (pVideoMemory[3]==0xCDEF0123L) { /* Channel A 128bit */
- return(4);
- }
- if (pVideoMemory[1]==0x456789ABL) { /* Channel B 64bit */
- return(2);
- }
- return(1);
-}
-#endif
-/* =============== SiS 300 dram sizing end =============== */
-
-/* ============ SiS 315 dram sizing begin ============== */
-#ifdef SIS315H
-
-/* TW: Moved Get310DRAMType further down */
-
-void
-SiS_Delay15us(SiS_Private *SiS_Pr, ULONG ulMicrsoSec)
-{
-}
-
-void
-SiS_SDR_MRS(SiS_Private *SiS_Pr, )
-{
- USHORT data;
-
- data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16);
- data &= 0x3F; /* SR16 D7=0, D6=0 */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data); /* enable mode register set(MRS) low */
- SiS_Delay15us(SiS_Pr, 0x100);
- data |= 0x80; /* SR16 D7=1, D6=0 */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data); /* enable mode register set(MRS) high */
- SiS_Delay15us(SiS_Pr, 0x100);
-}
-
-void
-SiS_DDR_MRS(SiS_Private *SiS_Pr)
-{
- USHORT data;
-
- /* SR16 <- 1F,DF,2F,AF */
-
- /* enable DLL of DDR SD/SGRAM , SR16 D4=1 */
- data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16);
- data &= 0x0F;
- data |= 0x10;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data);
-
- if (!(SiS_Pr->SiS_SR15[1][SiS_Pr->SiS_RAMType] & 0x10))
- data &= 0x0F;
-
- /* SR16 D7=1,D6=1 */
- data |= 0xC0;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data);
-
- /* SR16 D7=1,D6=0,D5=1,D4=0 */
- data &= 0x0F;
- data |= 0x20;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data);
- if (!(SiS_Pr->SiS_SR15[1][SiS_Pr->SiS_RAMType] & 0x10))
- data &= 0x0F;
-
- /* SR16 D7=1 */
- data |= 0x80;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data);
-}
-
-void
-SiS_SetDRAMModeRegister(SiS_Private *SiS_Pr, UCHAR *ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
-{
- if (SiS_Get310DRAMType(ROMAddr,HwDeviceExtension) < 2)
- SiS_SDR_MRS(SiS_Pr);
- else
- /* SR16 <- 0F,CF,0F,8F */
- SiS_DDR_MRS(SiS_Pr);
-}
-
-void
-SiS_DisableRefresh(SiS_Private *SiS_Pr)
-{
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x17,0xF8);
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x19,0x03);
-}
-
-void
-SiS_EnableRefresh(SiS_Private *SiS_Pr, UCHAR *ROMAddr)
-{
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SiS_Pr->SiS_SR15[2][SiS_Pr->SiS_RAMType]);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SiS_Pr->SiS_SR15[4][SiS_Pr->SiS_RAMType]);
-}
-
-void
-SiS_DisableChannelInterleaving(SiS_Private *SiS_Pr, int index,
- USHORT SiS_DDRDRAM_TYPE[][5])
-{
- USHORT data;
-
- data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x15);
- data &= 0x1F;
- switch (SiS_DDRDRAM_TYPE[index][3])
- {
- case 64: data |= 0; break;
- case 32: data |= 0x20; break;
- case 16: data |= 0x40; break;
- case 4: data |= 0x60; break;
- }
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x15,data);
-}
-
-void
-SiS_SetDRAMSizingType(SiS_Private *SiS_Pr, int index, USHORT DRAMTYPE_TABLE[][5])
-{
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,DRAMTYPE_TABLE[index][4]);
- /* should delay 50 ns */
-}
-
-void
-SiS_CheckBusWidth_310(SiS_Private *SiS_Pr, UCHAR *ROMAddress,ULONG FBAddress,
- PSIS_HW_DEVICE_INFO HwDeviceExtension)
-{
- USHORT data, temp;
- PULONG volatile pVideoMemory;
-
- pVideoMemory = (PULONG)FBAddress;
-
- if(HwDeviceExtension->jChipType == SIS_330) temp = 1;
- else temp = 2;
-
- if(SiS_Get310DRAMType(ROMAddress,HwDeviceExtension) < temp) {
-
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,0x00);
- if(HwDeviceExtension->jChipType != SIS_330) {
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x12);
- } else {
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x02);
- }
- /* should delay */
- SiS_SDR_MRS(SiS_Pr);
-
- SiS_Pr->SiS_ChannelAB = 0;
- SiS_Pr->SiS_DataBusWidth = 128;
- pVideoMemory[0] = 0x01234567L;
- pVideoMemory[1] = 0x456789ABL;
- pVideoMemory[2] = 0x89ABCDEFL;
- pVideoMemory[3] = 0xCDEF0123L;
- pVideoMemory[4] = 0x55555555L;
- pVideoMemory[5] = 0x55555555L;
- pVideoMemory[6] = 0xFFFFFFFFL;
- pVideoMemory[7] = 0xFFFFFFFFL;
- if((pVideoMemory[3] != 0xCDEF0123L) || (pVideoMemory[2] != 0x89ABCDEFL)) {
- /* Channel A 64Bit */
- SiS_Pr->SiS_DataBusWidth = 64;
- SiS_Pr->SiS_ChannelAB = 0;
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x14, 0xFD);
- }
- if((pVideoMemory[1] != 0x456789ABL) || (pVideoMemory[0] != 0x01234567L)) {
- /* Channel B 64Bit */
- SiS_Pr->SiS_DataBusWidth = 64;
- SiS_Pr->SiS_ChannelAB = 1;
- SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x14,0xfd,0x01);
- }
- return;
-
- } else {
-
- /* DDR Dual channel */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,0x00);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x02); /* Channel A, 64bit */
- /* should delay */
- SiS_DDR_MRS(SiS_Pr);
-
- SiS_Pr->SiS_ChannelAB = 0;
- SiS_Pr->SiS_DataBusWidth = 64;
- pVideoMemory[0] = 0x01234567L;
- pVideoMemory[1] = 0x456789ABL;
- pVideoMemory[2] = 0x89ABCDEFL;
- pVideoMemory[3] = 0xCDEF0123L;
- pVideoMemory[4] = 0x55555555L;
- pVideoMemory[5] = 0x55555555L;
- pVideoMemory[6] = 0xAAAAAAAAL;
- pVideoMemory[7] = 0xAAAAAAAAL;
-
- if (pVideoMemory[1] == 0x456789ABL) {
- if (pVideoMemory[0] == 0x01234567L) {
- /* Channel A 64bit */
- return;
- }
- } else {
- if (pVideoMemory[0] == 0x01234567L) {
- /* Channel A 32bit */
- SiS_Pr->SiS_DataBusWidth = 32;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x00);
- return;
- }
- }
-
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x03); /* Channel B, 64bit */
- SiS_DDR_MRS(SiS_Pr);
-
- SiS_Pr->SiS_ChannelAB = 1;
- SiS_Pr->SiS_DataBusWidth = 64;
- pVideoMemory[0] = 0x01234567L;
- pVideoMemory[1] = 0x456789ABL;
- pVideoMemory[2] = 0x89ABCDEFL;
- pVideoMemory[3] = 0xCDEF0123L;
- pVideoMemory[4] = 0x55555555L;
- pVideoMemory[5] = 0x55555555L;
- pVideoMemory[6] = 0xAAAAAAAAL;
- pVideoMemory[7] = 0xAAAAAAAAL;
- if(pVideoMemory[1] == 0x456789ABL) {
- /* Channel B 64 */
- if(pVideoMemory[0] == 0x01234567L) {
- /* Channel B 64bit */
- return;
- } else {
- /* error */
- }
- } else {
- if(pVideoMemory[0] == 0x01234567L) {
- /* Channel B 32 */
- SiS_Pr->SiS_DataBusWidth = 32;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x01);
- } else {
- /* error */
- }
- }
- }
-}
-
-int
-SiS_SetRank(SiS_Private *SiS_Pr, int index,UCHAR RankNo,USHORT DRAMTYPE_TABLE[][5])
-{
- USHORT data;
- int RankSize;
-
- if ((RankNo==2)&&(DRAMTYPE_TABLE[index][0]==2))
- return 0;
-
- RankSize = DRAMTYPE_TABLE[index][3]/2 * SiS_Pr->SiS_DataBusWidth / 32;
-
- if (RankNo * RankSize <= 128) {
- data = 0;
- while((RankSize >>= 1) > 0) {
- data += 0x10;
- }
- data |= (RankNo - 1) << 2;
- data |= (SiS_Pr->SiS_DataBusWidth / 64) & 2;
- data |= SiS_Pr->SiS_ChannelAB;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,data);
- /* should delay */
- SiS_SDR_MRS(SiS_Pr);
- return 1;
- } else
- return 0;
-}
-
-int
-SiS_SetDDRChannel(SiS_Private *SiS_Pr, int index,UCHAR ChannelNo,
- USHORT DRAMTYPE_TABLE[][5])
-{
- USHORT data;
- int RankSize;
-
- RankSize = DRAMTYPE_TABLE[index][3]/2 * SiS_Pr->SiS_DataBusWidth / 32;
- /* RankSize = DRAMTYPE_TABLE[index][3]; */
- if (ChannelNo * RankSize <= 128) {
- data = 0;
- while((RankSize >>= 1) > 0) {
- data += 0x10;
- }
- if(ChannelNo == 2) data |= 0x0C;
- data |= (SiS_Pr->SiS_DataBusWidth / 32) & 2;
- data |= SiS_Pr->SiS_ChannelAB;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,data);
- /* should delay */
- SiS_DDR_MRS(SiS_Pr);
- return 1;
- } else
- return 0;
-}
-
-int
-SiS_CheckColumn(SiS_Private *SiS_Pr, int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
-{
- int i;
- ULONG Increment,Position;
-
- /*Increment = 1<<(DRAMTYPE_TABLE[index][2] + SiS_Pr->SiS_DataBusWidth / 64 + 1); */
- Increment = 1 << (10 + SiS_Pr->SiS_DataBusWidth / 64);
-
- for (i=0,Position=0;i<2;i++) {
- *((PULONG)(FBAddress + Position)) = Position;
- Position += Increment;
- }
-
- for (i=0,Position=0;i<2;i++) {
-/* if (FBAddress[Position]!=Position) */
- if((*(PULONG)(FBAddress + Position)) != Position)
- return 0;
- Position += Increment;
- }
- return 1;
-}
-
-int
-SiS_CheckBanks(SiS_Private *SiS_Pr, int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
-{
- int i;
- ULONG Increment,Position;
- Increment = 1 << (DRAMTYPE_TABLE[index][2] + SiS_Pr->SiS_DataBusWidth / 64 + 2);
-
- for (i=0,Position=0;i<4;i++) {
-/* FBAddress[Position]=Position; */
- *((PULONG)(FBAddress + Position)) = Position;
- Position += Increment;
- }
-
- for (i=0,Position=0;i<4;i++) {
-/* if (FBAddress[Position]!=Position) */
- if((*(PULONG)(FBAddress + Position)) != Position)
- return 0;
- Position += Increment;
- }
- return 1;
-}
-
-int
-SiS_CheckRank(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
-{
- int i;
- ULONG Increment,Position;
- Increment = 1<<(DRAMTYPE_TABLE[index][2] + DRAMTYPE_TABLE[index][1] +
- DRAMTYPE_TABLE[index][0] + SiS_Pr->SiS_DataBusWidth / 64 + RankNo);
-
- for (i=0,Position=0;i<2;i++) {
-/* FBAddress[Position]=Position; */
- *((PULONG)(FBAddress+Position))=Position;
- /* *((PULONG)(FBAddress))=Position; */
- Position += Increment;
- }
-
- for (i=0,Position=0;i<2;i++) {
-/* if (FBAddress[Position]!=Position) */
- if ( (*(PULONG) (FBAddress + Position)) !=Position)
- /*if ( (*(PULONG) (FBAddress )) !=Position) */
- return 0;
- Position += Increment;
- }
- return 1;
-}
-
-int
-SiS_CheckDDRRank(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
-{
- ULONG Increment,Position;
- USHORT data;
-
- Increment = 1<<(DRAMTYPE_TABLE[index][2] + DRAMTYPE_TABLE[index][1] +
- DRAMTYPE_TABLE[index][0] + SiS_Pr->SiS_DataBusWidth / 64 + RankNo);
-
- Increment += Increment/2;
-
- Position =0;
- *((PULONG)(FBAddress+Position + 0)) = 0x01234567;
- *((PULONG)(FBAddress+Position + 1)) = 0x456789AB;
- *((PULONG)(FBAddress+Position + 2)) = 0x55555555;
- *((PULONG)(FBAddress+Position + 3)) = 0x55555555;
- *((PULONG)(FBAddress+Position + 4)) = 0xAAAAAAAA;
- *((PULONG)(FBAddress+Position + 5)) = 0xAAAAAAAA;
-
- if ( (*(PULONG) (FBAddress + 1)) == 0x456789AB)
- return 1;
-
- if ( (*(PULONG) (FBAddress + 0)) == 0x01234567)
- return 0;
-
- data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
- data &= 0xF3;
- data |= 0x08;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,data);
- data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x15);
- data += 0x20;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x15,data);
-
- return 1;
-}
-
-int
-SiS_CheckRanks(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
-{
- int r;
-
- for (r=RankNo;r>=1;r--) {
- if (!SiS_CheckRank(SiS_Pr, r, index, DRAMTYPE_TABLE, FBAddress))
- return 0;
- }
- if (!SiS_CheckBanks(SiS_Pr, index, DRAMTYPE_TABLE, FBAddress))
- return 0;
-
- if (!SiS_CheckColumn(SiS_Pr, index, DRAMTYPE_TABLE, FBAddress))
- return 0;
-
- return 1;
-}
-
-int
-SiS_CheckDDRRanks(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],
- ULONG FBAddress)
-{
- int r;
-
- for (r=RankNo;r>=1;r--) {
- if (!SiS_CheckDDRRank(SiS_Pr, r,index,DRAMTYPE_TABLE,FBAddress))
- return 0;
- }
- if (!SiS_CheckBanks(SiS_Pr, index,DRAMTYPE_TABLE,FBAddress))
- return 0;
-
- if (!SiS_CheckColumn(SiS_Pr, index,DRAMTYPE_TABLE,FBAddress))
- return 0;
-
- return 1;
-}
-
-int
-SiS_SDRSizing(SiS_Private *SiS_Pr, ULONG FBAddress)
-{
- int i;
- UCHAR j;
-
- for (i=0;i<13;i++) {
- SiS_SetDRAMSizingType(SiS_Pr, i, SiS_SDRDRAM_TYPE);
- for (j=2;j>0;j--) {
- if (!SiS_SetRank(SiS_Pr, i,(UCHAR) j, SiS_SDRDRAM_TYPE))
- continue;
- else {
- if (SiS_CheckRanks(SiS_Pr, j,i,SiS_SDRDRAM_TYPE, FBAddress))
- return 1;
- }
- }
- }
- return 0;
-}
-
-int
-SiS_DDRSizing(SiS_Private *SiS_Pr, ULONG FBAddress)
-{
-
- int i;
- UCHAR j;
-
- for (i=0; i<4; i++){
- SiS_SetDRAMSizingType(SiS_Pr, i, SiS_DDRDRAM_TYPE);
- SiS_DisableChannelInterleaving(SiS_Pr, i, SiS_DDRDRAM_TYPE);
- for (j=2; j>0; j--) {
- SiS_SetDDRChannel(SiS_Pr, i, j, SiS_DDRDRAM_TYPE);
- if (!SiS_SetRank(SiS_Pr, i, (UCHAR) j, SiS_DDRDRAM_TYPE))
- continue;
- else {
- if (SiS_CheckDDRRanks(SiS_Pr, j, i, SiS_DDRDRAM_TYPE, FBAddress))
- return 1;
- }
- }
- }
- return 0;
-}
-
-/*
- check if read cache pointer is correct
-*/
-void
-SiS_VerifyMclk(SiS_Private *SiS_Pr, ULONG FBAddr)
-{
- PUCHAR pVideoMemory = (PUCHAR) FBAddr;
- UCHAR i, j;
- USHORT Temp,SR21;
-
- pVideoMemory[0] = 0xaa; /* alan */
- pVideoMemory[16] = 0x55; /* note: PCI read cache is off */
-
- if((pVideoMemory[0] != 0xaa) || (pVideoMemory[16] != 0x55)) {
- for (i=0,j=16; i<2; i++,j+=16) {
- SR21 = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x21);
- Temp = SR21 & 0xFB; /* disable PCI post write buffer empty gating */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,Temp);
-
- Temp = SiS_GetReg1(SiS_Pr->SiS_P3c4, 0x3C);
- Temp |= 0x01; /* MCLK reset */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x3C,Temp);
- Temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3C);
- Temp &= 0xFE; /* MCLK normal operation */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x3C,Temp);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,SR21);
-
- pVideoMemory[16+j] = j;
- if(pVideoMemory[16+j] == j) {
- pVideoMemory[j] = j;
- break;
- }
- }
- }
-}
-
-/* Is this a 315E? */
-int
-Is315E(SiS_Private *SiS_Pr)
-{
- if((HwDeviceExtension->jChipType == SIS_315H) ||
- (HwDeviceExtension->jChipType == SIS_315) ||
- (HwDeviceExtension->jChipType == SIS_315PRO)) {
- if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x5F) & 0x10) return 1;
- }
- return 0;
-}
-
-/* For 315 only */
-void
-SiS_SetDRAMSize_310(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
-{
- UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase;
- ULONG FBAddr = (ULONG)HwDeviceExtension->pjVideoMemoryAddress;
- USHORT data;
-
- SiSSetMode(SiS_Pr, HwDeviceExtension, 0x2e);
-
- data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x21);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x21,0xDF); /* disable read cache */
-
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x01,0x20); /* Turn OFF Display */
-
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x16,0x0F); /* assume lowest speed DRAM */
-
- SiS_SetDRAMModeRegister(SiS_Pr, ROMAddr, HwDeviceExtension);
- SiS_DisableRefresh(SiS_Pr);
- SiS_CheckBusWidth_310(SiS_Pr, ROMAddr, FBAddr, HwDeviceExtension);
-
- SiS_VerifyMclk(SiS_Pr, FBAddr);
-
- if(HwDeviceExtension->jChipType == SIS_330) temp = 1;
- else temp = 2;
-
- if(SiS_Get310DRAMType(SiS_Pr, ROMAddr, HwDeviceExtension) < temp)
- SiS_SDRSizing(SiS_Pr, FBAddr);
- else
- SiS_DDRSizing(SiS_Pr, FBAddr);
-
- if(HwDeviceExtension->jChipType != SIS_330) {
- if(Is315E(SiS_Pr)) {
- data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
- if((data & 0x0C) == 0x0C) { /* dual channel */
- if((data & 0xF0) > 0x40)
- data = (data & 0x0F) | 0x40;
- } else { /* single channel */
- if((data & 0xF0) > 0x50)
- data = (data & 0x0F) | 0x50;
- }
- }
- }
-
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SiS_Pr->SiS_SR15[1][SiS_Pr->SiS_RAMType]); /* restore SR16 */
-
- SiS_EnableRefresh(SiS_Pr, ROMAddr);
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x21,0x20); /* enable read cache */
-}
-#endif
-
-void
-SiS_SetMemoryClock(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension)
-{
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x28,SiS_Pr->SiS_MCLKData_0[SiS_Pr->SiS_RAMType].SR28);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x29,SiS_Pr->SiS_MCLKData_0[SiS_Pr->SiS_RAMType].SR29);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2A,SiS_Pr->SiS_MCLKData_0[SiS_Pr->SiS_RAMType].SR2A);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2E,SiS_Pr->SiS_ECLKData[SiS_Pr->SiS_RAMType].SR2E);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2F,SiS_Pr->SiS_ECLKData[SiS_Pr->SiS_RAMType].SR2F);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x30,SiS_Pr->SiS_ECLKData[SiS_Pr->SiS_RAMType].SR30);
-
-#ifdef SIS315H
- if (Is315E(SiS_Pr)) {
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x28,0x3B); /* 143 */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x29,0x22);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2E,0x3B); /* 143 */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2F,0x22);
- }
-#endif
-}
-
-#endif /* ifdef LINUXBIOS */
-
#ifdef SIS315H
UCHAR
SiS_Get310DRAMType(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension)
@@ -1921,8 +699,6 @@ SiS_Get310DRAMType(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDev
}
#endif
-/* SiSInit END */
-
/* ----------------------------------------- */
void SiSRegInit(SiS_Private *SiS_Pr, USHORT BaseAddr)
@@ -1959,11 +735,15 @@ SiSInitPCIetc(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
case SIS_630:
case SIS_730:
/* Set - PCI LINEAR ADDRESSING ENABLE (0x80)
- * - PCI IO ENABLE (0x20)
+ * - RELOCATED VGA IO (0x20)
* - MMIO ENABLE (0x1)
*/
SiS_SetReg1(SiS_Pr->SiS_P3c4,0x20,0xa1);
- /* Enable 2D (0x42) & 3D accelerator (0x18) */
+ /* - Enable 2D (0x40)
+ * - Enable 3D (0x02)
+ * - Enable 3D Vertex command fetch (0x10) ?
+ * - Enable 3D command parser (0x08) ?
+ */
SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x5A);
break;
case SIS_315H:
@@ -1975,12 +755,20 @@ SiSInitPCIetc(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
case SIS_660:
case SIS_760:
SiS_SetReg1(SiS_Pr->SiS_P3c4,0x20,0xa1);
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x5A);
+ /* - Enable 2D (0x40)
+ * - Enable 3D (0x02)
+ * - Enable 3D vertex command fetch (0x10)
+ * - Enable 3D command parser (0x08)
+ * - Enable 3D G/L transformation engine (0x80)
+ */
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0xDA);
break;
case SIS_550:
SiS_SetReg1(SiS_Pr->SiS_P3c4,0x20,0xa1);
/* No 3D engine ! */
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x42);
+ /* - Enable 2D (0x40)
+ */
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x40);
}
}
@@ -2456,6 +1244,7 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, S
switch (HwDeviceExtension->ujVBChipID) {
case VB_CHIP_301:
case VB_CHIP_301B:
+ case VB_CHIP_301C:
case VB_CHIP_301LV:
case VB_CHIP_302:
case VB_CHIP_302B:
@@ -2679,6 +1468,7 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT Mod
switch (HwDeviceExtension->ujVBChipID) {
case VB_CHIP_301:
case VB_CHIP_301B:
+ case VB_CHIP_301C:
case VB_CHIP_301LV:
case VB_CHIP_302:
case VB_CHIP_302B:
@@ -3004,25 +1794,26 @@ SiS_GetVBType(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceE
flag = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x00);
- /* TW: Illegal values not welcome... */
if(flag > 3) return;
rev = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x01);
- if (flag >= 2) {
+ if(flag >= 2) {
SiS_Pr->SiS_VBType = VB_SIS302B;
- } else if (flag == 1) {
+ } else if(flag == 1) {
SiS_Pr->SiS_VBType = VB_SIS301;
- if(rev >= 0xB0) {
+ if(rev >= 0xC0) {
+ SiS_Pr->SiS_VBType = VB_SIS301C;
+ } else if(rev >= 0xB0) {
SiS_Pr->SiS_VBType = VB_SIS301B;
/* Check if 30xB DH version (no LCD support, use Panel Link instead) */
nolcd = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x23);
if(!(nolcd & 0x02)) SiS_Pr->SiS_VBType |= VB_NoLCD;
}
}
- if(SiS_Pr->SiS_VBType & (VB_SIS301B | VB_SIS302B)) {
+ if(SiS_Pr->SiS_VBType & (VB_SIS301B | VB_SIS301C | VB_SIS302B)) {
if(rev >= 0xD0) {
- SiS_Pr->SiS_VBType &= ~(VB_SIS301B | VB_SIS302B);
+ SiS_Pr->SiS_VBType &= ~(VB_SIS301B | VB_SIS301C | VB_SIS302B);
SiS_Pr->SiS_VBType |= VB_SIS301LV;
SiS_Pr->SiS_VBType &= ~(VB_NoLCD);
if(rev >= 0xE0) {
@@ -3332,7 +2123,7 @@ SiS_SetATTRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT StandTableIndex,
if(HwDeviceExtension->jChipType >= SIS_315H) {
if(IS_SIS550650740660) {
/* 315, 330 don't do this */
- if(SiS_Pr->SiS_VBType & VB_SIS301B302B) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301B302B) {
if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) ARdata=0;
} else {
ARdata = 0;
@@ -4789,9 +3580,7 @@ SiS_CalcDelay2(SiS_Private *SiS_Pr, UCHAR *ROMAddr,UCHAR key, PSIS_HW_DEVICE_INF
}
#endif
-/* =============== Autodetection ================ */
-/* I N C O M P L E T E */
-
+#ifdef LINUX_XF86
BOOLEAN
SiS_GetPanelID(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
@@ -4864,254 +3653,7 @@ SiS_GetPanelID(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
}
return 1;
}
-
-
-#ifdef LINUXBIOS
-
-void
-SiS_DetectMonitor(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr)
-{
- UCHAR DAC_TEST_PARMS[] = {0x0F,0x0F,0x0F};
- UCHAR DAC_CLR_PARMS[] = {0x00,0x00,0x00};
- USHORT SR1F;
-
- SR1F = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1F); /* backup DAC pedestal */
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1F,0x04);
-
- if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
- if(!(SiS_BridgeIsOn(SiS_Pr, BaseAddr))) {
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x30,0x41);
- }
- }
-
- SiSSetMode(SiS_Pr,HwDeviceExtension,0x2E);
- if(HwDeviceExtension->jChipType >= SIS_650) {
- /* TW: On 650 only - enable CRT1 */
- SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x63,0xbf);
- }
- SiS_SetReg3(SiS_Pr->SiS_P3c6,0xff);
- SiS_ClearDAC(SiS_Pr, SiS_Pr->SiS_P3c8);
- SiS_LongWait(SiS_Pr);
- SiS_LongWait(SiS_Pr);
- SiS_LongWait(SiS_Pr);
- SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,0xDF,0x00);
- if(SiS_TestMonitorType(SiS_Pr, DAC_TEST_PARMS[0],DAC_TEST_PARMS[1],DAC_TEST_PARMS[2])) {
- SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,0xDF,0x20);
- } else if(SiS_TestMonitorType(SiS_Pr, DAC_TEST_PARMS[0],DAC_TEST_PARMS[1],DAC_TEST_PARMS[2])) {
- SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,0xDF,0x20);
- }
- SiS_TestMonitorType(SiS_Pr, DAC_CLR_PARMS[0],DAC_CLR_PARMS[1],DAC_CLR_PARMS[2]);
-
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1F,SR1F);
-}
-
-USHORT
-SiS_TestMonitorType(SiS_Private *SiS_Pr, UCHAR R_DAC,UCHAR G_DAC,UCHAR B_DAC)
-{
- USHORT temp,tempbx;
-
- tempbx = R_DAC * 0x4d + G_DAC * 0x97 + B_DAC * 0x1c;
- if((tempbx & 0x00ff) > 0x80) tempbx += 0x100;
- tempbx = (tempbx & 0xFF00) >> 8;
- R_DAC = (UCHAR) tempbx;
- G_DAC = (UCHAR) tempbx;
- B_DAC = (UCHAR) tempbx;
-
- SiS_SetReg3(SiS_Pr->SiS_P3c8,0x00);
- SiS_SetReg3(SiS_Pr->SiS_P3c9,R_DAC);
- SiS_SetReg3(SiS_Pr->SiS_P3c9,G_DAC);
- SiS_SetReg3(SiS_Pr->SiS_P3c9,B_DAC);
- SiS_LongWait(SiS_Pr);
- temp=SiS_GetReg2(SiS_Pr->SiS_P3c2);
- if(temp & 0x10) return(1);
- else return(0);
-}
-
-void
-SiS_GetSenseStatus(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,UCHAR *ROMAddr)
-{
- USHORT tempax=0,tempbx,tempcx,temp;
- USHORT P2reg0=0,SenseModeNo=0,OutputSelect=*SiS_Pr->pSiS_OutputSelect;
- USHORT ModeIdIndex,i;
- USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress;
-
- if(SiS_Pr->SiS_IF_DEF_LVDS == 1){
- SiS_GetPanelID(SiS_Pr);
- temp=LCDSense;
- temp=temp|SiS_SenseCHTV(SiS_Pr);
- tempbx=~(LCDSense|AVIDEOSense|SVIDEOSense);
- SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,tempbx,temp);
- } else { /* for 301 */
- if(SiS_Pr->SiS_IF_DEF_HiVision==1) { /* for HiVision */
- tempax=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x38);
- temp=tempax&0x01;
- tempax=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3A);
- temp=temp|(tempax&0x02);
- SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,0xA0,temp);
- } else {
- if(SiS_BridgeIsOn(SiS_Pr, BaseAddr)==0) { /* TW: Inserted "==0" */
- P2reg0 = SiS_GetReg1(SiS_Pr->SiS_Part2Port,0x00);
- if(!(SiS_BridgeIsEnable(SiS_Pr, BaseAddr,HwDeviceExtension))) {
- SenseModeNo=0x2e;
- temp = SiS_SearchModeID(SiS_Pr, ROMAddr,&SenseModeNo,&ModeIdIndex);
- SiS_Pr->SiS_SetFlag = 0x00;
- SiS_Pr->SiS_ModeType = ModeVGA;
- SiS_Pr->SiS_VBInfo = SetCRT2ToRAMDAC |LoadDACFlag |SetInSlaveMode;
- SiS_SetCRT2Group(SiS_Pr, BaseAddr,ROMAddr,SenseModeNo,HwDeviceExtension);
- for(i=0;i<20;i++) {
- SiS_LongWait(SiS_Pr);
- }
- }
- SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x00,0x1c);
- tempax=0;
- tempbx=*SiS_Pr->pSiS_RGBSenseData;
- if(SiS_Is301B(SiS_Pr, BaseAddr)){
- tempbx=*SiS_Pr->pSiS_RGBSenseData2;
- }
- tempcx=0x0E08;
- if(SiS_Sense(SiS_Pr, tempbx,tempcx)){
- if(SiS_Sense(SiS_Pr, tempbx,tempcx)){
- tempax=tempax|Monitor2Sense;
- }
- }
- tempbx=*SiS_Pr->pSiS_YCSenseData;
- if(SiS_Is301B(SiS_Pr, BaseAddr)){
- tempbx=*SiS_Pr->pSiS_YCSenseData2;
- }
- tempcx=0x0604;
- if(SiS_Sense(SiS_Pr, tempbx,tempcx)){
- if(SiS_Sense(SiS_Pr,tempbx,tempcx)){
- tempax=tempax|SVIDEOSense;
- }
- }
-
- if(ROMAddr && SiS_Pr->SiS_UseROM) {
-#ifdef SIS300
- if((HwDeviceExtension->jChipType==SIS_630)||
- (HwDeviceExtension->jChipType==SIS_730)) {
- OutputSelect = ROMAddr[0xfe];
- }
#endif
-#ifdef SIS315H
- if(HwDeviceExtension->jChipType >= SIS_315H) {
- OutputSelect = ROMAddr[0xf3];
- if(HwDeviceExtension->jChipType >= SIS_330) {
- OutputSelect = ROMAddr[0x11b];
- }
- }
-#endif
- }
- if(OutputSelect & BoardTVType){
- tempbx = *SiS_Pr->pSiS_VideoSenseData;
- if(SiS_Is301B(SiS_Pr, BaseAddr)){
- tempbx = *SiS_Pr->pSiS_VideoSenseData2;
- }
- tempcx = 0x0804;
- if(SiS_Sense(SiS_Pr, tempbx,tempcx)){
- if(SiS_Sense(SiS_Pr, tempbx,tempcx)){
- tempax |= AVIDEOSense;
- }
- }
- } else {
- if(!(tempax & SVIDEOSense)){
- tempbx = *SiS_Pr->pSiS_VideoSenseData;
- if(SiS_Is301B(SiS_Pr, BaseAddr)){
- tempbx = *SiS_Pr->pSiS_VideoSenseData2;
- }
- tempcx = 0x0804;
- if(SiS_Sense(SiS_Pr,tempbx,tempcx)){
- if(SiS_Sense(SiS_Pr, tempbx,tempcx)){
- tempax |= AVIDEOSense;
- }
- }
- }
- }
- }
-
- if(SiS_SenseLCD(SiS_Pr, HwDeviceExtension)){
- tempax |= LCDSense;
- }
-
- tempbx=0;
- tempcx=0;
- SiS_Sense(SiS_Pr, tempbx,tempcx);
-
- if(SiS_Pr->SiS_VBType & (VB_SIS301LV302LV)) {
- tempax &= 0x00ef; /* 30xlv have no VGA2*/
- }
- SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,~0xDF,tempax);
- SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x00,P2reg0);
- if(!(P2reg0 & 0x20)) {
- SiS_Pr->SiS_VBInfo = DisableCRT2Display;
- SiS_SetCRT2Group(SiS_Pr,BaseAddr,ROMAddr,SenseModeNo,HwDeviceExtension);
- }
- }
- }
-}
-
-BOOLEAN
-SiS_Sense(SiS_Private *SiS_Pr, USHORT tempbx,USHORT tempcx)
-{
- USHORT temp,i,tempch;
-
- temp = tempbx & 0xFF;
- SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x11,temp);
- temp = (tempbx & 0xFF00) >> 8;
- temp |= (tempcx & 0x00FF);
- SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x10,~0x1F,temp);
-
- for(i=0; i<10; i++) SiS_LongWait(SiS_Pr);
-
- tempch = (tempcx & 0x7F00) >> 8;
- temp = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x03);
- temp ^= 0x0E;
- temp &= tempch;
- if(temp>0) return 1;
- else return 0;
-}
-
-USHORT
-SiS_SenseLCD(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
-{
- USHORT temp;
-
- temp=SiS_GetPanelID(SiS_Pr);
- if(!temp) temp=SiS_GetLCDDDCInfo(SiS_Pr, HwDeviceExtension);
- return(temp);
-}
-
-BOOLEAN
-SiS_GetLCDDDCInfo(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
-{
- USHORT temp;
- /*add lcd sense*/
- if(HwDeviceExtension->ulCRT2LCDType==LCD_UNKNOWN)
- return 0;
- else{
- temp=(USHORT)HwDeviceExtension->ulCRT2LCDType;
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x36,temp);
- return 1;
- }
-}
-
-USHORT
-SiS_SenseCHTV(SiS_Private *SiS_Pr)
-{
- USHORT temp,push0e,status;
-
- status=0;
- push0e = SiS_GetCH700x(SiS_Pr, 0x0e);
- push0e = (push0e << 8) | 0x0e;
- SiS_SetCH700x(SiS_Pr, 0x0b0e);
- SiS_SetCH700x(SiS_Pr, 0x0110);
- SiS_SetCH700x(SiS_Pr, 0x0010);
- temp = SiS_GetCH700x(SiS_Pr, 0x10);
- if(temp & 0x08) status |= SVIDEOSense;
- if(temp & 0x02) status |= AVIDEOSense;
- SiS_SetCH700x(SiS_Pr, push0e);
- return(status);
-}
-#endif /* LINUXBIOS */
/* ================ XFREE86 ================= */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/init.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/init.h
index a3587487b..b1d7d3269 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/init.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/init.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.h,v 1.17 2003/08/26 14:29:35 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.h,v 1.20 2003/08/28 23:20:37 twini Exp $ */
/*
* Data and prototypes for init.c
*
@@ -2410,48 +2410,16 @@ UCHAR SiS_GetReg2(USHORT);
ULONG SiS_GetReg3(USHORT);
USHORT SiS_GetReg4(USHORT);
void SiS_ClearDAC(SiS_Private *SiS_Pr, ULONG);
-void SiS_SetMemoryClock(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_SetDRAMModeRegister(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension);
BOOLEAN SiS_SearchVBModeID(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT *ModeNo);
void SiS_IsLowResolution(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
void SiS_GetSysFlags(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
-
-#ifdef SIS300
-void SiS_SetDRAMSize_300(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
-USHORT SiS_ChkBUSWidth_300(SiS_Private *SiS_Pr, ULONG FBAddress);
-#endif
-
#ifdef SIS315H
UCHAR SiS_Get310DRAMType(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_DDR_MRS(SiS_Private *SiS_Pr);
-void SiS_SDR_MRS(SiS_Private *SiS_Pr);
-void SiS_DisableRefresh(SiS_Private *SiS_Pr);
-void SiS_EnableRefresh(SiS_Private *SiS_Pr, UCHAR *ROMAddr);
-void SiS_SetDRAMSize_310(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO);
-void SiS_DisableChannelInterleaving(SiS_Private *SiS_Pr, int index,USHORT SiS_DDRDRAM_TYPE[][5]);
-void SiS_SetDRAMSizingType(SiS_Private *SiS_Pr, int index,USHORT DRAMTYPE_TABLE[][5]);
-void SiS_CheckBusWidth_310(SiS_Private *SiS_Pr, UCHAR *ROMAddress,ULONG FBAddress,
- PSIS_HW_DEVICE_INFO HwDeviceExtension);
-int SiS_SetRank(SiS_Private *SiS_Pr, int index,UCHAR RankNo,USHORT DRAMTYPE_TABLE[][5]);
-int SiS_SetDDRChannel(SiS_Private *SiS_Pr, int index,UCHAR ChannelNo,
- USHORT DRAMTYPE_TABLE[][5]);
-int SiS_CheckColumn(SiS_Private *SiS_Pr, int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress);
-int SiS_CheckBanks(SiS_Private *SiS_Pr, int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress);
-int SiS_CheckRank(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress);
-int SiS_CheckDDRRank(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress);
-int SiS_CheckRanks(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress);
-int SiS_CheckDDRRanks(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress);
-int SiS_SDRSizing(SiS_Private *SiS_Pr, ULONG FBAddress);
-int SiS_DDRSizing(SiS_Private *SiS_Pr, ULONG FBAddress);
-int Is315E(SiS_Private *SiS_Pr);
-void SiS_VerifyMclk(SiS_Private *SiS_Pr, ULONG FBAddr);
#endif
-
void SiS_HandleCRT1(SiS_Private *SiS_Pr);
void SiS_Handle301B_1400x1050(SiS_Private *SiS_Pr, USHORT ModeNo);
void SiS_SetEnableDstn(SiS_Private *SiS_Pr, int enable);
void SiS_SetEnableFstn(SiS_Private *SiS_Pr, int enable);
-void SiS_Delay15us(SiS_Private *SiS_Pr);
BOOLEAN SiS_SearchModeID(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT *ModeNo,USHORT *ModeIdIndex);
#ifndef LINUX_XF86
BOOLEAN SiS_CheckMemorySize(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
@@ -2508,14 +2476,6 @@ USHORT SiS_CalcDelay2(SiS_Private *SiS_Pr, UCHAR *ROMAddr, UCHAR,PSIS_HW_DEVIC
void SiS_ClearBuffer(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO,USHORT ModeNo);
void SiS_SetCRT1Group(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
USHORT ModeNo,USHORT ModeIdIndex,USHORT BaseAddr);
-void SiS_DetectMonitor(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr);
-void SiS_GetSenseStatus(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,UCHAR *ROMAddr);
-USHORT SiS_TestMonitorType(SiS_Private *SiS_Pr, UCHAR R_DAC,UCHAR G_DAC,UCHAR B_DAC);
-USHORT SiS_SenseCHTV(SiS_Private *SiS_Pr);
-BOOLEAN SiS_Sense(SiS_Private *SiS_Pr, USHORT tempbx,USHORT tempcx);
-BOOLEAN SiS_GetPanelID(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO);
-BOOLEAN SiS_GetLCDDDCInfo(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO);
-USHORT SiS_SenseLCD(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO);
void SiSRegInit(SiS_Private *SiS_Pr, USHORT BaseAddr);
void SiSInitPtr(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
void SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo);
@@ -2523,6 +2483,7 @@ void SiSInitPCIetc(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtensio
void SiSDetermineROMUsage(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, UCHAR *ROMAddr);
#ifdef LINUX_XF86
+BOOLEAN SiS_GetPanelID(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO);
USHORT SiS_CheckBuildCustomMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags);
void SiS_SetPitch(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, UShort BaseAddr);
void SiS_SetPitchCRT1(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, UShort BaseAddr);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c
index e9ffc557d..31a17e37a 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c,v 1.23 2003/08/26 14:29:35 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c,v 1.27 2003/08/27 10:42:51 twini Exp $ */
/*
* Mode switching code (CRT2 section)
* for SiS 300/305/540/630/730/315/550/650/M650/651/740/330/660/M660/760/M760
@@ -649,7 +649,7 @@ SiS_SetGroup1(SiS_Private *SiS_Pr,USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
}
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
if(HwDeviceExtension->pdc) {
- temp = HwDeviceExtension->pdc & 0x3c;
+ temp = HwDeviceExtension->pdc & 0x3c;
}
}
}
@@ -695,6 +695,14 @@ SiS_SetGroup1(SiS_Private *SiS_Pr,USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
} 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(HwDeviceExtension->pdc) {
+ temp = HwDeviceExtension->pdc;
+ tempbl = 0;
+ }
+ }
+ }
} else {
if(HwDeviceExtension->jChipType == SIS_740) {
temp = 0x03;
@@ -10157,7 +10165,7 @@ SiS_InitDDCRegs(SiS_Private *SiS_Pr, unsigned long VBFlags, int VGAEngine,
USHORT temp = 0, myadaptnum = adaptnum;
if(adaptnum != 0) {
- if(!(VBFlags & (VB_301|VB_301B|VB_302B))) return 0xFFFF;
+ if(!(VBFlags & (VB_301|VB_301B|VB_301C|VB_302B))) return 0xFFFF;
if((VBFlags & VB_30xBDH) && (adaptnum == 1)) return 0xFFFF;
}
@@ -10447,7 +10455,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
SiS_Pr->CP_HaveCustomData = FALSE;
SiS_Pr->CP_MaxX = SiS_Pr->CP_MaxY = SiS_Pr->CP_MaxClock = 0;
- if(!(pSiS->VBFlags & (VB_301|VB_301B|VB_302B))) return 0;
+ if(!(pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B))) return 0;
if(pSiS->VBFlags & VB_30xBDH) return 0;
if(SiS_InitDDCRegs(SiS_Pr, pSiS->VBFlags, pSiS->VGAEngine, 1, 0, FALSE) == 0xFFFF) return 0;
@@ -10682,7 +10690,8 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
(SiS_Pr->CP_VSyncStart[i] > SiS_Pr->CP_VSyncEnd[i]) ||
(SiS_Pr->CP_VSyncStart[i] > SiS_Pr->CP_VTotal[i]) ||
(SiS_Pr->CP_VSyncEnd[i] > SiS_Pr->CP_VTotal[i]) ||
- (SiS_Pr->CP_Clock[i] > 108000) ||
+ ( ((pSiS->VBFlags & VB_301C) && (SiS_Pr->CP_Clock[i] > 162000)) ||
+ ((!(pSiS->VBFlags & VB_301C)) && (SiS_Pr->CP_Clock[i] > 108000)) ) ||
(buffer[base+17] & 0x80)) {
SiS_Pr->CP_DataValid[i] = FALSE;
@@ -10902,7 +10911,8 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
(SiS_Pr->CP_VSyncStart[i] > SiS_Pr->CP_VSyncEnd[i]) ||
(SiS_Pr->CP_VSyncStart[i] > SiS_Pr->CP_VTotal[i]) ||
(SiS_Pr->CP_VSyncEnd[i] > SiS_Pr->CP_VTotal[i]) ||
- (SiS_Pr->CP_Clock[i] > 108000) ||
+ ( ((pSiS->VBFlags & VB_301C) && (SiS_Pr->CP_Clock[i] > 162000)) ||
+ ((!(pSiS->VBFlags & VB_301C)) && (SiS_Pr->CP_Clock[i] > 108000)) ) ||
(buffer[index + 17] & 0x80)) {
SiS_Pr->CP_DataValid[i] = FALSE;
@@ -10988,7 +10998,7 @@ SiS_SenseVGA2DDC(SiS_Private *SiS_Pr, SISPtr pSiS)
int retry;
unsigned char buffer[256];
- if(!(pSiS->VBFlags & (VB_301|VB_301B|VB_302B))) return 0;
+ if(!(pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B))) return 0;
/* if(pSiS->VBFlags & VB_30xBDH) return 0; */
if(SiS_InitDDCRegs(SiS_Pr, pSiS->VBFlags, pSiS->VGAEngine, 2, 0, FALSE) == 0xFFFF) return 0;
@@ -11408,6 +11418,8 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT B
if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelCustom) return;
+ if(HwDeviceExtension->pdc) return;
+
/* This is a piece of typical SiS crap: They code the OEM LCD
* delay into the code, at none defined place in the BIOS.
* We now have to start doing a PCI subsystem check here.
@@ -11421,6 +11433,17 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT B
}
}
+ if((SiS_Pr->SiS_CustomT == CUT_CLEVO1024) ||
+ (SiS_Pr->SiS_CustomT == CUT_CLEVO10242)) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) {
+ gotitfrompci = TRUE;
+ dochiptest = FALSE;
+ delay = 0x33;
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2D,delay);
+ delay &= 0x0f;
+ }
+ }
+
if(!gotitfrompci) {
index = GetLCDPtrIndexBIOS(SiS_Pr, HwDeviceExtension, BaseAddr);
@@ -11480,7 +11503,7 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT B
}
} else { /* TV */
-
+
index = GetTVPtrIndex(SiS_Pr);
if(IS_SIS650 && (SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) {
@@ -11495,16 +11518,28 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT B
if(!romptr) return;
delay = ROMAddr[romptr + index];
} else {
- delay = SiS310_TVDelayCompensation_301B[index];
-#if 0
+ delay = SiS310_TVDelayCompensation_301B[index];
+#if 0
if(SiS_Pr->SiS_VBType & VB_SIS302LV)
- delay = SiS310_TVDelayCompensation_301B[index];
+ delay = SiS310_TVDelayCompensation_301B[index];
#endif
}
} else {
- delay = SiS310_TVDelayCompensation_651301LV[index];
- if(SiS_Pr->SiS_VBType & VB_SIS302LV)
- delay = SiS310_TVDelayCompensation_651302LV[index];
+ switch(SiS_Pr->SiS_CustomT) {
+ case CUT_COMPAQ1280:
+ delay = 0x02;
+ dochiptest = FALSE;
+ break;
+ case CUT_CLEVO1024:
+ case CUT_CLEVO10242:
+ delay = 0x03;
+ dochiptest = FALSE;
+ break;
+ default:
+ delay = SiS310_TVDelayCompensation_651301LV[index];
+ if(SiS_Pr->SiS_VBType & VB_SIS302LV)
+ delay = SiS310_TVDelayCompensation_651302LV[index];
+ }
}
} else {
if((ROMAddr) && SiS_Pr->SiS_UseROM) {
@@ -11514,7 +11549,7 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT B
} else {
delay = SiS310_TVDelayCompensation_301[index];
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
- if(IS_SIS740)
+ if(IS_SIS740)
delay = SiS310_TVDelayCompensation_740301B[index];
else
delay = SiS310_TVDelayCompensation_301B[index];
@@ -11540,13 +11575,13 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT B
} else {
if(dochiptest && IS_SIS650 && (SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) {
temp = (SiS_GetReg1(SiS_Pr->SiS_P3d4,0x36) & 0xf0) >> 4;
- if(temp == 8) { /* 1400x1050 BIOS */
+ if(temp == 8) { /* 1400x1050 BIOS (ECS) */
delay &= 0x0f;
delay |= 0xb0;
} else if(temp == 6) {
delay &= 0x0f;
delay |= 0xc0;
- } else if(temp > 7) { /* 1280x1024 BIOS */
+ } else if(temp > 7) { /* 1280x1024 BIOS (which one?) */
delay = 0x35;
}
SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2D,delay);
@@ -11807,6 +11842,12 @@ SiS_FinalizeLCD(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeN
if(!(SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) return;
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
+ if(SiS_Pr->LVDSHL != -1) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x24,0xfc,SiS_Pr->LVDSHL);
+ }
+ }
+
if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelCustom) return;
if(SiS_Pr->UseCustomMode) return;
@@ -11832,7 +11873,9 @@ SiS_FinalizeLCD(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeN
if(SiS_Pr->SiS_CustomT == CUT_CLEVO1024) {
if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { /* Maybe all panels? */
- SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x24,0xfc,0x01);
+ if(SiS_Pr->LVDSHL == -1) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x24,0xfc,0x01);
+ }
return;
}
}
@@ -11840,7 +11883,9 @@ SiS_FinalizeLCD(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeN
if(SiS_Pr->SiS_CustomT == CUT_CLEVO10242) {
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { /* Maybe all panels? */
- SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x24,0xfc,0x01);
+ if(SiS_Pr->LVDSHL == -1) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x24,0xfc,0x01);
+ }
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
tempch = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x36) >> 4;
if(tempch == 3) {
@@ -11861,8 +11906,10 @@ SiS_FinalizeLCD(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeN
SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x30,0x00);
SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x34,0x10);
} else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { /* Maybe all panels? */
- /* Maybe ACER only? */
- SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x24,0xfc,0x01);
+ if(SiS_Pr->LVDSHL == -1) {
+ /* Maybe ACER only? */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x24,0xfc,0x01);
+ }
}
tempch = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x36);
tempch &= 0xf0;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h
index b5d0c8375..aabb2550d 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h,v 1.19 2003/08/26 14:29:36 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h,v 1.20 2003/08/26 21:49:07 twini Exp $ */
/*
* Data and prototypes for init301.c
*
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h
index 8f1744b5b..6fdc3d2f4 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h,v 1.16 2003/08/23 10:25:18 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h,v 1.17 2003/08/26 20:40:23 twini Exp $ */
/*
* Global definitions for init.c and init301.c
*
@@ -47,11 +47,12 @@
#define VB_SIS302B 0x0004
#define VB_SIS301LV 0x0008
#define VB_SIS302LV 0x0010
+#define VB_SIS301C 0x0020
#define VB_SIS30xLV VB_SIS301LV
#define VB_SIS30xNEW VB_SIS302LV
#define VB_NoLCD 0x8000
-#define VB_SIS301BLV302BLV (VB_SIS301B|VB_SIS302B|VB_SIS301LV|VB_SIS302LV)
-#define VB_SIS301B302B (VB_SIS301B|VB_SIS302B)
+#define VB_SIS301BLV302BLV (VB_SIS301B|VB_SIS301C|VB_SIS302B|VB_SIS301LV|VB_SIS302LV)
+#define VB_SIS301B302B (VB_SIS301B|VB_SIS301C|VB_SIS302B)
#define VB_SIS301LV302LV (VB_SIS301LV|VB_SIS302LV)
#define IS_SIS330 (HwDeviceExtension->jChipType == SIS_330)
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h
index 850f4eb56..8a8331e28 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h,v 1.47 2003/08/26 16:38:01 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h,v 1.54 2003/08/29 08:50:54 twini Exp $ */
/*
* Main global data and definitions
*
@@ -36,7 +36,7 @@
#define SISDRIVERVERSIONYEAR 3
#define SISDRIVERVERSIONMONTH 8
-#define SISDRIVERVERSIONDAY 26
+#define SISDRIVERVERSIONDAY 28
#define SISDRIVERREVISION 1
#define SISDRIVERIVERSION (SISDRIVERVERSIONYEAR << 16) | (SISDRIVERVERSIONMONTH << 8) \
@@ -65,6 +65,12 @@
#include "vstruct.h"
#ifdef XF86DRI
+#undef SISNEWDRI
+#if 0 /* Need to wait for the DRI merge */
+#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,99,??,0)
+#define SISNEWDRI
+#endif
+#endif
#include "xf86drm.h"
#include "sarea.h"
#define _XF86DRI_SERVER_
@@ -205,10 +211,10 @@ typedef unsigned long IOADDRESS;
#define VB_302LV 0x08000000
#define VB_30xLV VB_301LV
#define VB_30xLVX VB_302LV
-#define VB_TRUMPION 0x10000000
-#define VB_VIDEOBRIDGE (VB_301|VB_301B|VB_302B|VB_301LV|VB_302LV| \
- VB_LVDS|VB_CHRONTEL|VB_TRUMPION)
-#define VB_SISBRIDGE (VB_301|VB_301B|VB_302B|VB_301LV|VB_302LV)
+#define VB_301C 0x10000000
+#define VB_VIDEOBRIDGE (VB_301|VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV| \
+ VB_LVDS|VB_CHRONTEL)
+#define VB_SISBRIDGE (VB_301|VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV)
#define SINGLE_MODE 0x20000000 /* CRT1 or CRT2; determined by DISPTYPE_CRTx */
#define VB_DISPMODE_SINGLE SINGLE_MODE /* alias */
#define MIRROR_MODE 0x40000000 /* CRT1 + CRT2 identical (mirror mode) */
@@ -650,9 +656,13 @@ typedef struct {
Bool AGPInitOK;
Bool irqEnabled;
int irq;
+ Bool IsAGPCard;
+ unsigned long DRIheapstart, DRIheapend;
void (*RenderCallback)(ScrnInfoPtr);
Time RenderTime;
+ unsigned char *RenderAccelArray;
+ Bool doRender;
int ColorExpandRingHead;
int ColorExpandRingTail;
@@ -957,6 +967,30 @@ typedef struct _SiSXineramaData {
#endif
#endif
+#if 0
+/* SiS Direct access for config utility */
+
+#define SDC_ID 0x53495321
+
+#define SDC_VERSION 1
+
+#define SDC_NUM_PARM 20
+typedef struct _sisdirectcommand {
+ unsigned long sdc_id;
+ unsigned long sdc_chksum;
+ unsigned long sdc_header;
+ unsigned long sdc_command;
+ unsigned long sdc_parm[SDC_NUM_PARM];
+} sisdirectcommand;
+
+#define SDC_RESULT_OK 0x66670000
+#define SDC_RESULT_UNDEFCMD 0x66670001
+
+#define SDC_CMD_GETVERSION 0x98980001
+#define SDC_CMD_CHECKMODEFORCRT2 0x98980002
+/* more to come */
+#endif
+
extern void sisSaveUnlockExtRegisterLock(SISPtr pSiS, unsigned char *reg1, unsigned char *reg2);
extern void sisRestoreExtRegisterLock(SISPtr pSiS, unsigned char reg1, unsigned char reg2);
extern void SiSOptions(ScrnInfoPtr pScrn);
@@ -994,7 +1028,7 @@ extern void SiS_SetTVyposoffset(ScrnInfoPtr pScrn, int val);
extern void SiS_SetTVxscale(ScrnInfoPtr pScrn, int val);
extern void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val);
extern Bool SISSwitchCRT2Type(ScrnInfoPtr pScrn, unsigned long newvbflags);
-extern Bool SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned short index);
+extern Bool SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned short index, Bool quiet);
extern Bool SISSwitchCRT1Status(ScrnInfoPtr pScrn, int onoff);
extern int SiS_GetCHTVlumabandwidthcvbs(ScrnInfoPtr pScrn);
extern int SiS_GetCHTVlumabandwidthsvideo(ScrnInfoPtr pScrn);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.c
index a3b6e68ca..4ddf8d93a 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.c,v 1.12 2003/08/26 16:38:01 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.c,v 1.19 2003/08/28 11:16:39 twini Exp $ */
/*
* 2D Acceleration for SiS 315 and Xabre series
* (315/550/650/740/M650/651/652/M652/330/660/M660/760/M760)
@@ -77,9 +77,7 @@
* see comments below.
*/
-#undef INCL_RENDER /* Use/Don't use RENDER extension acceleration
- * Should work, but how do I test this?
- */
+#define INCL_RENDER /* Use/Don't use RENDER extension acceleration */
#ifdef INCL_RENDER
#ifdef RENDER
@@ -364,18 +362,27 @@ SiS315AccelInit(ScreenPtr pScreen)
#ifdef INCL_RENDER
#ifdef RENDER
- /* Render (can later also be used for Translucent windows with constant Alpha) */
- if((pScrn->bitsPerPixel == 16) || (pScrn->bitsPerPixel == 32)) {
- infoPtr->SetupForCPUToScreenAlphaTexture = SiSSetupForCPUToScreenAlphaTexture;
- infoPtr->SubsequentCPUToScreenAlphaTexture = SiSSubsequentCPUToScreenTexture;
- infoPtr->CPUToScreenAlphaTextureFormats = SiSAlphaTextureFormats;
- infoPtr->CPUToScreenAlphaTextureFlags = XAA_RENDER_NO_TILE;
-
- infoPtr->SetupForCPUToScreenTexture = SiSSetupForCPUToScreenTexture;
- infoPtr->SubsequentCPUToScreenTexture = SiSSubsequentCPUToScreenTexture;
- infoPtr->CPUToScreenTextureFormats = SiSTextureFormats;
- infoPtr->CPUToScreenTextureFlags = XAA_RENDER_NO_TILE;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "RENDER acceleration enabled\n");
+ /* Render */
+ if(((pScrn->bitsPerPixel == 16) || (pScrn->bitsPerPixel == 32)) && pSiS->doRender) {
+ int i, j;
+ if((pSiS->RenderAccelArray = xnfcalloc(65536, 1))) {
+ for(i = 0; i < 256; i++) {
+ for(j = 0; j < 256; j++) {
+ pSiS->RenderAccelArray[(i << 8) + j] = (i * j) / 255;
+ }
+ }
+ infoPtr->SetupForCPUToScreenAlphaTexture = SiSSetupForCPUToScreenAlphaTexture;
+ infoPtr->SubsequentCPUToScreenAlphaTexture = SiSSubsequentCPUToScreenTexture;
+ infoPtr->CPUToScreenAlphaTextureFormats = SiSAlphaTextureFormats;
+ infoPtr->CPUToScreenAlphaTextureFlags = XAA_RENDER_NO_TILE |
+ XAA_RENDER_NO_SRC_ALPHA;
+
+ infoPtr->SetupForCPUToScreenTexture = SiSSetupForCPUToScreenTexture;
+ infoPtr->SubsequentCPUToScreenTexture = SiSSubsequentCPUToScreenTexture;
+ infoPtr->CPUToScreenTextureFormats = SiSTextureFormats;
+ infoPtr->CPUToScreenTextureFlags = XAA_RENDER_NO_TILE;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "RENDER acceleration enabled\n");
+ }
}
#endif
#endif
@@ -1562,8 +1569,6 @@ SiSAllocateLinear(ScrnInfoPtr pScrn, int sizeNeeded)
return(pSiS->AccelLinearScratch != NULL);
}
-#define RENDER_OP 0xCC /* Has no function whatsoever. No value matters. */
-
Bool
SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
int op, CARD16 red, CARD16 green,
@@ -1573,17 +1578,20 @@ SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
int height, int flags)
{
SISPtr pSiS = SISPTR(pScrn);
- int pitch, sizeNeeded, offset;
-
+ int x, pitch, sizeNeeded, offset;
+ CARD8 myalpha;
+ CARD32 *dstPtr;
+ unsigned char *renderaccelarray;
+
#ifdef ACCELDEBUG
- xf86DrvMsg(0, X_INFO, "AT: RGB %x %x %x, w %d h %d A-pitch %d\n",
- red, green, blue, width, height, alphaPitch);
- /* xf86DrvMsg(0, X_INFO, " %02x %02x %02x %02x %02x %02x %02x %02x\n",
+ 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, " %02x %02x %02x %02x %02x %02x %02x %02x\n",
alphaPtr[0],alphaPtr[1],alphaPtr[2],alphaPtr[3],
- alphaPtr[4],alphaPtr[5],alphaPtr[6],alphaPtr[7]); */
+ alphaPtr[4],alphaPtr[5],alphaPtr[6],alphaPtr[7]);
#endif
- if(op != PictOpOver)
+ if(op != PictOpOver)
return FALSE;
if((width > 2048) || (height > 2048))
@@ -1591,7 +1599,7 @@ SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
pitch = (width + 31) & ~31;
sizeNeeded = pitch * height;
- if(pScrn->bitsPerPixel == 16) /* Texture is always 8888, adapt for AllocLinear */
+ if(pScrn->bitsPerPixel == 16)
sizeNeeded <<= 1;
if(!SiSAllocateLinear(pScrn, sizeNeeded))
@@ -1604,30 +1612,37 @@ SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
#ifdef SISVRAMQ
SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
SiSSetupSRCPitchDSTRect((pitch << 2), pSiS->scrnOffset, -1);
- SiSSetupROP(RENDER_OP)
SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_PERPIXELALPHA)
#else
SiSSetupDSTColorDepth(pSiS->DstColor);
SiSSetupSRCPitch((pitch << 2));
SiSSetupDSTRect(pSiS->scrnOffset, -1)
- SiSSetupROP(RENDER_OP)
+ SiSSetupROP(0)
SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_PERPIXELALPHA | pSiS->SiS310_AccelDepth)
#endif
+ red &= 0xff00;
+ green &= 0xff00;
+ blue &= 0xff00;
+ dstPtr = (CARD32*)(pSiS->FbBase + offset);
+ renderaccelarray = pSiS->RenderAccelArray;
+
if(pSiS->alphaBlitBusy) {
pSiS->alphaBlitBusy = FALSE;
SiSIdle
}
- XAA_888_plus_PICT_a8_to_8888(
- (blue >> 8) | (green & 0xff00) | ((red & 0xff00) << 8),
- alphaPtr, alphaPitch, (CARD32*)(pSiS->FbBase + offset),
- pitch, width, height);
-
-#if 0
- /* For constant alpha, we need to do this and set A_CONSTANTALPHA instead */
- SiSSetupAlpha(0x99)
-#endif
+ 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;
+ }
return TRUE;
}
@@ -1639,14 +1654,15 @@ SiSSetupForCPUToScreenTexture(ScrnInfoPtr pScrn,
int height, int flags)
{
SISPtr pSiS = SISPTR(pScrn);
- int i, pitch, sizeNeeded, offset;
-
+ int pitch, sizeNeeded, offset;
+ CARD8 *dst;
+
#ifdef ACCELDEBUG
xf86DrvMsg(0, X_INFO, "T: type %d op %d w %d h %d T-pitch %d\n",
texType, op, width, height, texPitch);
#endif
- if(op != PictOpOver)
+ if(op != PictOpOver)
return FALSE;
if((width > 2048) || (height > 2048))
@@ -1654,7 +1670,7 @@ SiSSetupForCPUToScreenTexture(ScrnInfoPtr pScrn,
pitch = (width + 31) & ~31;
sizeNeeded = pitch * height;
- if(pScrn->bitsPerPixel == 16) /* Texture is always 8888, adapt for AllocLinear */
+ if(pScrn->bitsPerPixel == 16)
sizeNeeded <<= 1;
if(!SiSAllocateLinear(pScrn, sizeNeeded))
@@ -1664,33 +1680,33 @@ SiSSetupForCPUToScreenTexture(ScrnInfoPtr pScrn,
if(pScrn->bitsPerPixel == 32)
offset <<= 1;
+ width <<= 2;
+ pitch <<= 2;
+
#ifdef SISVRAMQ
SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
- SiSSetupSRCPitchDSTRect((pitch << 2), pSiS->scrnOffset, -1);
- SiSSetupROP(RENDER_OP)
+ SiSSetupSRCPitchDSTRect(pitch, pSiS->scrnOffset, -1);
+ SiSSetupAlpha(0x00)
SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_PERPIXELALPHA)
#else
SiSSetupDSTColorDepth(pSiS->DstColor);
- SiSSetupSRCPitch((pitch << 2));
+ SiSSetupSRCPitch(pitch);
SiSSetupDSTRect(pSiS->scrnOffset, -1)
- SiSSetupROP(RENDER_OP)
+ SiSSetupAlpha(0x00)
SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_PERPIXELALPHA | pSiS->SiS310_AccelDepth)
#endif
- {
- CARD8 *dst = (CARD8*)(pSiS->FbBase + offset);
- i = height;
+ dst = (CARD8*)(pSiS->FbBase + offset);
- if(pSiS->alphaBlitBusy) {
- pSiS->alphaBlitBusy = FALSE;
- SiSIdle
- }
+ if(pSiS->alphaBlitBusy) {
+ pSiS->alphaBlitBusy = FALSE;
+ SiSIdle
+ }
- while(i--) {
- memcpy(dst, texPtr, width << 2);
- texPtr += texPitch;
- dst += pitch << 2;
- }
+ while(height--) {
+ memcpy(dst, texPtr, width);
+ texPtr += texPitch;
+ dst += pitch;
}
return TRUE;
@@ -1708,7 +1724,7 @@ SiSSubsequentCPUToScreenTexture(ScrnInfoPtr pScrn,
srcbase = pSiS->AccelLinearScratch->offset << 1;
if(pScrn->bitsPerPixel == 32)
srcbase <<= 1;
-
+
#ifdef ACCELDEBUG
xf86DrvMsg(0, X_INFO, "FIRE: dx %d dy %d w %d h %d\n",
dst_x, dst_y, width, height);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.h
index 64dfaaf1e..29a678d8b 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.h,v 1.9 2003/08/26 14:29:36 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.h,v 1.12 2003/08/28 11:16:39 twini Exp $ */
/*
* 2D Acceleration for SiS 315 and Xabre series
* Definitions for the SIS engine communication.
@@ -73,13 +73,13 @@
#define A_NODESTALPHA 0x00100000
#define A_3DFULLSCENE 0x00180000
-/* ? */
+/* Destination */
#define DSTAGP 0x02000000
-#define DSTVIDEO 0x02000000
+#define DSTVIDEO 0x00000000
/* Subfunctions for Color/Enhanced Color Expansion */
#define COLOR_TO_MONO 0x00100000
-#define AA_TEXT 0x00200000 /* ? (hangs the engine) */
+#define AA_TEXT 0x00200000
/* Line */
#define LINE_STYLE 0x00800000
@@ -150,13 +150,17 @@
#define TRAP_ER 0x8250
/* Queue */
-#define Q_BASE_ADDR 0x85C0 /* Base address of software queue (?) */
-#define Q_WRITE_PTR 0x85C4 /* Current write pointer (?) */
-#define Q_READ_PTR 0x85C8 /* Current read pointer (?) */
+#define Q_BASE_ADDR 0x85C0 /* Base address of software queue */
+#define Q_WRITE_PTR 0x85C4 /* Current write pointer */
+#define Q_READ_PTR 0x85C8 /* Current read pointer */
#define Q_STATUS 0x85CC /* queue status */
-/* VRAM queue operation command definitions */
-#define SIS_SKPC_HEADER 0x16800000L
+/* VRAM queue operation command header definitions */
+#define SIS_SPKC_HEADER 0x16800000L
+#define SIS_BURST_HEADER0 0x368A0000L
+#define SIS_BURST_HEADER1 0x62100000L
+#define SIS_PACKET_HEARER0 0x968A0000L
+#define SIS_PACKET_HEADER1 0x62100000L
#define SIS_NIL_CMD 0x168F0000L
/* Macros to do useful things with the SiS315/330 BitBLT engine */
@@ -173,15 +177,10 @@
bits 23:16: 2D counter 3
bits 15:8: 2D counter 2
bits 7:0: 2D counter 1
-
- Where is the command queue length (current amount of commands the queue
- can accept) on the 315 series in MMIO mode? (The current implementation works,
- but only as long as there is no 3D driver which uses the queue without your
- knowledge)
*/
-/* As sis_dri.c relocated the cmd-q len to the sarea, don't use it directly here */
-/* #define CmdQueLen pSiS->cmdQueueLen */
+/* As sis_dri.c and dual head mode relocate the cmd-q len to the sarea/entity,
+ * don't use it directly here */
#define CmdQueLen (*(pSiS->cmdQueueLenPtr))
#define SiSQEmpty \
@@ -223,7 +222,6 @@
i++; \
} while((mcurrent > ttt) && (mcurrent < (ttt + amount))); \
} \
- /* xf86DrvMsg(0, X_INFO, "ttt %x current %x, i %d\n", ttt, MMIO_IN32(pSiS->IOBase, Q_READ_PTR), i); */ \
}
#endif
@@ -248,9 +246,10 @@
while(MMIO_IN32(pSiS->IOBase, Q_READ_PTR) > ttt) {} \
}
+/* Write-updates MUST be 128bit aligned. */
#define SiSNILandUpdateSWQueue \
- *(CARD32 *)(tt + 8) = (CARD32)(SIS_NIL_CMD); \
- *(CARD32 *)(tt + 12) = (CARD32)(SIS_NIL_CMD); \
+ ((CARD32 *)(tt))[2] = (CARD32)(SIS_NIL_CMD); \
+ ((CARD32 *)(tt))[3] = (CARD32)(SIS_NIL_CMD); \
SiSUpdateQueue; \
SiSSetSwWP(ttt);
@@ -265,11 +264,11 @@
#define SiSSetupSRCDSTBase(srcbase,dstbase) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + SRC_ADDR); \
- *(CARD32 *)(tt + 4) = (CARD32)(srcbase); \
- *(CARD32 *)(tt + 8) = (CARD32)(SIS_SKPC_HEADER + DST_ADDR); \
- *(CARD32 *)(tt +12) = (CARD32)(dstbase); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + SRC_ADDR); \
+ ((CARD32 *)(tt))[1] = (CARD32)(srcbase); \
+ ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + DST_ADDR); \
+ ((CARD32 *)(tt))[3] = (CARD32)(dstbase); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -277,11 +276,11 @@
#define SiSSetupSRCDSTXY(sx,sy,dx,dy) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + SRC_Y); \
- *(CARD32 *)(tt + 4) = (CARD32)((sx)<<16 | (sy)); \
- *(CARD32 *)(tt + 8) = (CARD32)(SIS_SKPC_HEADER + DST_Y); \
- *(CARD32 *)(tt +12) = (CARD32)((dx)<<16 | (dy)); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + SRC_Y); \
+ ((CARD32 *)(tt))[1] = (CARD32)((sx)<<16 | (sy)); \
+ ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + DST_Y); \
+ ((CARD32 *)(tt))[3] = (CARD32)((dx)<<16 | (dy)); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -289,11 +288,11 @@
#define SiSSetupDSTXYRect(x,y,w,h) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + DST_Y); \
- *(CARD32 *)(tt + 4) = (CARD32)((x)<<16 | (y)); \
- *(CARD32 *)(tt + 8) = (CARD32)(SIS_SKPC_HEADER + RECT_WIDTH); \
- *(CARD32 *)(tt +12) = (CARD32)((h)<<16 | (w)); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + DST_Y); \
+ ((CARD32 *)(tt))[1] = (CARD32)((x)<<16 | (y)); \
+ ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + RECT_WIDTH); \
+ ((CARD32 *)(tt))[3] = (CARD32)((h)<<16 | (w)); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -301,11 +300,11 @@
#define SiSSetupSRCPitchDSTRect(pitch,x,y) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + SRC_PITCH); \
- *(CARD32 *)(tt + 4) = (CARD32)(pitch); \
- *(CARD32 *)(tt + 8) = (CARD32)(SIS_SKPC_HEADER + DST_PITCH); \
- *(CARD32 *)(tt +12) = (CARD32)((y)<<16 | (x)); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + SRC_PITCH); \
+ ((CARD32 *)(tt))[1] = (CARD32)(pitch); \
+ ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + DST_PITCH); \
+ ((CARD32 *)(tt))[3] = (CARD32)((y)<<16 | (x)); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -313,54 +312,54 @@
#define SiSSetupSRCBase(base) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + SRC_ADDR); \
- *(CARD32 *)(tt + 4) = (CARD32)(base); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + SRC_ADDR); \
+ ((CARD32 *)(tt))[1] = (CARD32)(base); \
SiSNILandUpdateSWQueue \
}
#define SiSSetupSRCPitch(pitch) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + SRC_PITCH); \
- *(CARD32 *)(tt + 4) = (CARD32)(pitch); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + SRC_PITCH); \
+ ((CARD32 *)(tt))[1] = (CARD32)(pitch); \
SiSNILandUpdateSWQueue \
}
#define SiSSetupSRCXY(x,y) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + SRC_Y); \
- *(CARD32 *)(tt + 4) = (CARD32)((x)<<16 | (y)); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + SRC_Y); \
+ ((CARD32 *)(tt))[1] = (CARD32)((x)<<16 | (y)); \
SiSNILandUpdateSWQueue \
}
#define SiSSetupDSTBase(base) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + DST_ADDR); \
- *(CARD32 *)(tt + 4) = (CARD32)(base); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + DST_ADDR); \
+ ((CARD32 *)(tt))[1] = (CARD32)(base); \
SiSNILandUpdateSWQueue \
}
#define SiSSetupDSTXY(x,y) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + DST_Y); \
- *(CARD32 *)(tt + 4) = (CARD32)((x)<<16 | (y)); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + DST_Y); \
+ ((CARD32 *)(tt))[1] = (CARD32)((x)<<16 | (y)); \
SiSNILandUpdateSWQueue \
}
#define SiSSetupDSTRect(x,y) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + DST_PITCH); \
- *(CARD32 *)(tt + 4) = (CARD32)((y)<<16 | (x)); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + DST_PITCH); \
+ ((CARD32 *)(tt))[1] = (CARD32)((y)<<16 | (x)); \
SiSNILandUpdateSWQueue \
}
@@ -370,11 +369,11 @@
#define SiSSetupPATFGDSTRect(color,x,y) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + PAT_FGCOLOR); \
- *(CARD32 *)(tt + 4) = (CARD32)(color); \
- *(CARD32 *)(tt + 8) = (CARD32)(SIS_SKPC_HEADER + DST_PITCH); \
- *(CARD32 *)(tt +12) = (CARD32)((y)<<16 | (x)); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + PAT_FGCOLOR); \
+ ((CARD32 *)(tt))[1] = (CARD32)(color); \
+ ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + DST_PITCH); \
+ ((CARD32 *)(tt))[3] = (CARD32)((y)<<16 | (x)); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -382,11 +381,11 @@
#define SiSSetupSRCFGDSTRect(color,x,y) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + SRC_FGCOLOR); \
- *(CARD32 *)(tt + 4) = (CARD32)(color); \
- *(CARD32 *)(tt + 8) = (CARD32)(SIS_SKPC_HEADER + DST_PITCH); \
- *(CARD32 *)(tt +12) = (CARD32)((y)<<16 | (x)); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + SRC_FGCOLOR); \
+ ((CARD32 *)(tt))[1] = (CARD32)(color); \
+ ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + DST_PITCH); \
+ ((CARD32 *)(tt))[3] = (CARD32)((y)<<16 | (x)); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -394,11 +393,11 @@
#define SiSSetupRectSRCPitch(w,h,pitch) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + RECT_WIDTH); \
- *(CARD32 *)(tt + 4) = (CARD32)((h)<<16 | (w)); \
- *(CARD32 *)(tt + 8) = (CARD32)(SIS_SKPC_HEADER + SRC_PITCH); \
- *(CARD32 *)(tt +12) = (CARD32)(pitch); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + RECT_WIDTH); \
+ ((CARD32 *)(tt))[1] = (CARD32)((h)<<16 | (w)); \
+ ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + SRC_PITCH); \
+ ((CARD32 *)(tt))[3] = (CARD32)(pitch); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -406,56 +405,56 @@
#define SiSSetupRect(w,h) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + RECT_WIDTH); \
- *(CARD32 *)(tt + 4) = (CARD32)((h)<<16 | (w)); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + RECT_WIDTH); \
+ ((CARD32 *)(tt))[1] = (CARD32)((h)<<16 | (w)); \
SiSNILandUpdateSWQueue \
}
#define SiSSetupPATFG(color) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + PAT_FGCOLOR); \
- *(CARD32 *)(tt + 4) = (CARD32)(color); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + PAT_FGCOLOR); \
+ ((CARD32 *)(tt))[1] = (CARD32)(color); \
SiSNILandUpdateSWQueue \
}
#define SiSSetupPATBG(color) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + PAT_BGCOLOR); \
- *(CARD32 *)(tt + 4) = (CARD32)(color); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + PAT_BGCOLOR); \
+ ((CARD32 *)(tt))[1] = (CARD32)(color); \
SiSNILandUpdateSWQueue \
}
#define SiSSetupSRCFG(color) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + SRC_FGCOLOR); \
- *(CARD32 *)(tt + 4) = (CARD32)(color); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + SRC_FGCOLOR); \
+ ((CARD32 *)(tt))[1] = (CARD32)(color); \
SiSNILandUpdateSWQueue \
}
#define SiSSetupSRCBG(color) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + SRC_BGCOLOR); \
- *(CARD32 *)(tt + 4) = (CARD32)(color); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + SRC_BGCOLOR); \
+ ((CARD32 *)(tt))[1] = (CARD32)(color); \
SiSNILandUpdateSWQueue \
}
#define SiSSetupSRCTrans(color) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + TRANS_SRC_KEY_HIGH); \
- *(CARD32 *)(tt + 4) = (CARD32)(color); \
- *(CARD32 *)(tt + 8) = (CARD32)(SIS_SKPC_HEADER + TRANS_SRC_KEY_LOW); \
- *(CARD32 *)(tt +12) = (CARD32)(color); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + TRANS_SRC_KEY_HIGH); \
+ ((CARD32 *)(tt))[1] = (CARD32)(color); \
+ ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + TRANS_SRC_KEY_LOW); \
+ ((CARD32 *)(tt))[3] = (CARD32)(color); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -463,11 +462,11 @@
#define SiSSetupDSTTrans(color) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + TRANS_DST_KEY_HIGH); \
- *(CARD32 *)(tt + 4) = (CARD32)(color); \
- *(CARD32 *)(tt + 8) = (CARD32)(SIS_SKPC_HEADER + TRANS_DST_KEY_LOW); \
- *(CARD32 *)(tt +12) = (CARD32)(color); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + TRANS_DST_KEY_HIGH); \
+ ((CARD32 *)(tt))[1] = (CARD32)(color); \
+ ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + TRANS_DST_KEY_LOW); \
+ ((CARD32 *)(tt))[3] = (CARD32)(color); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -475,11 +474,11 @@
#define SiSSetupMONOPAT(p0,p1) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + MONO_MASK); \
- *(CARD32 *)(tt + 4) = (CARD32)(p0); \
- *(CARD32 *)(tt + 8) = (CARD32)(SIS_SKPC_HEADER + MONO_MASK + 4); \
- *(CARD32 *)(tt +12) = (CARD32)(p1); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + MONO_MASK); \
+ ((CARD32 *)(tt))[1] = (CARD32)(p0); \
+ ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + MONO_MASK + 4); \
+ ((CARD32 *)(tt))[3] = (CARD32)(p1); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -487,11 +486,11 @@
#define SiSSetupClip(left,top,right,bottom) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + LEFT_CLIP); \
- *(CARD32 *)(tt + 4) = (CARD32)(((left) & 0xFFFF) | (top)<<16); \
- *(CARD32 *)(tt + 8) = (CARD32)(SIS_SKPC_HEADER + RIGHT_CLIP); \
- *(CARD32 *)(tt +12) = (CARD32)(((right) & 0xFFFF) | (bottom)<<16); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + LEFT_CLIP); \
+ ((CARD32 *)(tt))[1] = (CARD32)(((left) & 0xFFFF) | (top)<<16); \
+ ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + RIGHT_CLIP); \
+ ((CARD32 *)(tt))[3] = (CARD32)(((right) & 0xFFFF) | (bottom)<<16); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -499,11 +498,11 @@
#define SiSSetupDSTBaseDoCMD(base) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + DST_ADDR); \
- *(CARD32 *)(tt + 4) = (CARD32)(base); \
- *(CARD32 *)(tt + 8) = (CARD32)(SIS_SKPC_HEADER + COMMAND_READY); \
- *(CARD32 *)(tt +12) = (CARD32)(pSiS->CommandReg); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + DST_ADDR); \
+ ((CARD32 *)(tt))[1] = (CARD32)(base); \
+ ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + COMMAND_READY); \
+ ((CARD32 *)(tt))[3] = (CARD32)(pSiS->CommandReg); \
SiSUpdateQueue \
SiSSetHwWP(ttt); \
}
@@ -511,11 +510,11 @@
#define SiSSetRectDoCMD(w,h) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + RECT_WIDTH); \
- *(CARD32 *)(tt + 4) = (CARD32)((h)<<16 | (w)); \
- *(CARD32 *)(tt + 8) = (CARD32)(SIS_SKPC_HEADER + COMMAND_READY); \
- *(CARD32 *)(tt +12) = (CARD32)(pSiS->CommandReg); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + RECT_WIDTH); \
+ ((CARD32 *)(tt))[1] = (CARD32)((h)<<16 | (w)); \
+ ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + COMMAND_READY); \
+ ((CARD32 *)(tt))[3] = (CARD32)(pSiS->CommandReg); \
SiSUpdateQueue \
SiSSetHwWP(ttt); \
}
@@ -526,11 +525,11 @@
#define SiSDoCMD \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + COMMAND_READY); \
- *(CARD32 *)(tt + 4) = (CARD32)(pSiS->CommandReg); \
- *(CARD32 *)(tt + 8) = (CARD32)(SIS_NIL_CMD); \
- *(CARD32 *)(tt + 12) = (CARD32)(SIS_NIL_CMD); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + COMMAND_READY); \
+ ((CARD32 *)(tt))[1] = (CARD32)(pSiS->CommandReg); \
+ ((CARD32 *)(tt))[2] = (CARD32)(SIS_NIL_CMD); \
+ ((CARD32 *)(tt))[3] = (CARD32)(SIS_NIL_CMD); \
SiSUpdateQueue \
SiSSetHwWP(ttt); \
}
@@ -540,11 +539,11 @@
#define SiSSetupX0Y0X1Y1(x1,y1,x2,y2) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + LINE_X0); \
- *(CARD32 *)(tt + 4) = (CARD32)((y1)<<16 | (x1)); \
- *(CARD32 *)(tt + 8) = (CARD32)(SIS_SKPC_HEADER + LINE_X1); \
- *(CARD32 *)(tt +12) = (CARD32)((y2)<<16 | (x2)); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + LINE_X0); \
+ ((CARD32 *)(tt))[1] = (CARD32)((y1)<<16 | (x1)); \
+ ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + LINE_X1); \
+ ((CARD32 *)(tt))[3] = (CARD32)((y2)<<16 | (x2)); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -552,38 +551,38 @@
#define SiSSetupX0Y0(x,y) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + LINE_X0); \
- *(CARD32 *)(tt + 4) = (CARD32)((y)<<16 | (x)); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + LINE_X0); \
+ ((CARD32 *)(tt))[1] = (CARD32)((y)<<16 | (x)); \
SiSNILandUpdateSWQueue \
}
#define SiSSetupX1Y1(x,y) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + LINE_X1); \
- *(CARD32 *)(tt + 4) = (CARD32)((y)<<16 | (x)); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + LINE_X1); \
+ ((CARD32 *)(tt))[1] = (CARD32)((y)<<16 | (x)); \
SiSNILandUpdateSWQueue \
}
#define SiSSetupLineCountPeriod(c, p) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + LINE_COUNT); \
- *(CARD32 *)(tt + 4) = (CARD32)((p) << 16 | (c)); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + LINE_COUNT); \
+ ((CARD32 *)(tt))[1] = (CARD32)((p) << 16 | (c)); \
SiSNILandUpdateSWQueue \
}
#define SiSSetupStyle(ls,hs) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + LINE_STYLE_0); \
- *(CARD32 *)(tt + 4) = (CARD32)(ls); \
- *(CARD32 *)(tt + 8) = (CARD32)(SIS_SKPC_HEADER + LINE_STYLE_1); \
- *(CARD32 *)(tt +12) = (CARD32)(hs); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + LINE_STYLE_0); \
+ ((CARD32 *)(tt))[1] = (CARD32)(ls); \
+ ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + LINE_STYLE_1); \
+ ((CARD32 *)(tt))[3] = (CARD32)(hs); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -593,11 +592,11 @@
#define SiSSetupYHLR(y,h,left,right) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + TRAP_YH); \
- *(CARD32 *)(tt + 4) = (CARD32)((y)<<16 | (h)); \
- *(CARD32 *)(tt + 8) = (CARD32)(SIS_SKPC_HEADER + TRAP_LR); \
- *(CARD32 *)(tt +12) = (CARD32)((right)<<16 | (left)); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + TRAP_YH); \
+ ((CARD32 *)(tt))[1] = (CARD32)((y)<<16 | (h)); \
+ ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + TRAP_LR); \
+ ((CARD32 *)(tt))[3] = (CARD32)((right)<<16 | (left)); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -606,11 +605,11 @@
#define SiSSetupdLdR(dxL,dyL,fxR,dyR) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + TRAP_DL); \
- *(CARD32 *)(tt + 4) = (CARD32)((dyL)<<16 | (dxL)); \
- *(CARD32 *)(tt + 8) = (CARD32)(SIS_SKPC_HEADER + TRAP_DR); \
- *(CARD32 *)(tt +12) = (CARD32)((dyR)<<16 | (dxR)); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + TRAP_DL); \
+ ((CARD32 *)(tt))[1] = (CARD32)((dyL)<<16 | (dxL)); \
+ ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + TRAP_DR); \
+ ((CARD32 *)(tt))[3] = (CARD32)((dyR)<<16 | (dxR)); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -618,23 +617,32 @@
#define SiSSetupELER(eL,eR) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + TRAP_EL); \
- *(CARD32 *)(tt + 4) = (CARD32)(eL); \
- *(CARD32 *)(tt + 8) = (CARD32)(SIS_SKPC_HEADER + TRAP_ER); \
- *(CARD32 *)(tt +12) = (CARD32)(eR); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + TRAP_EL); \
+ ((CARD32 *)(tt))[1] = (CARD32)(eL); \
+ ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + TRAP_ER); \
+ ((CARD32 *)(tt))[3] = (CARD32)(eR); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
-/* Alpha blended BitBlt (alpha = 8 bit) */
+/* (Constant) Alpha blended BitBlt (alpha = 8 bit) */
+
+#define SiSSetupAlpha(alpha) \
+ { \
+ CARD32 ttt = SiSGetSwWP(); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + ALPHA_ALPHA); \
+ ((CARD32 *)(tt))[1] = (CARD32)(alpha); \
+ SiSNILandUpdateSWQueue \
+ }
#define SiSSetPattern(num, value) \
{ \
CARD32 ttt = SiSGetSwWP(); \
- CARD32 tt = (CARD32)pSiS->cmdQueueBase + ttt; \
- *(CARD32 *)(tt) = (CARD32)(SIS_SKPC_HEADER + (PATTERN_REG + (num * 4))); \
- *(CARD32 *)(tt + 4) = (CARD32)(value); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + (PATTERN_REG + (num * 4))); \
+ ((CARD32 *)(tt))[1] = (CARD32)(value); \
SiSNILandUpdateSWQueue \
}
@@ -644,7 +652,6 @@
#ifndef SISVRAMQ
-/* FIXME: CmdQueLen is... where....? */
/* We assume a length of 4 bytes per command; since 512K of
* of RAM are allocated, the number of commands is easily
* calculated (and written to the address pointed to by
@@ -654,6 +661,7 @@
* dramatically on the integrated chipsets (sound gets interrupted,
* etc.). We now sync every time... this is a little slower,
* but it keeps the rest of the box somewhat alive.
+ * This was the reason for switching to VRAM queue mode.
*/
#define SiSIdle \
{ \
@@ -827,7 +835,7 @@
MMIO_OUT32(pSiS->IOBase, TRAP_ER, eR);\
CmdQueLen--;
-/* Alpha blended BitBlt (alpha = 8 bit) */
+/* (Constant) alpha blended BitBlt (alpha = 8 bit) */
#define SiSSetupAlpha(alpha) \
if (CmdQueLen <= 0) SiSIdle;\
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_common.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_common.h
new file mode 100644
index 000000000..cbddf0c73
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_common.h
@@ -0,0 +1,63 @@
+/* * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_common.h,v 1.1 2003/08/29 08:52:12 twini Exp $ */
+/*
+ * Common header definitions for SiS 2D/3D/DRM suite
+ *
+ * Copyright (C) 2003 Eric Anholt
+ *
+ * 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.
+ *
+ * Author:
+ * Eric Anholt <anholt@FreeBSD.org>
+ *
+ */
+
+#ifndef _SIS_COMMON_H_
+#define _SIS_COMMON_H_
+
+#define DRM_SIS_FB_ALLOC 0x04
+#define DRM_SIS_FB_FREE 0x05
+#define DRM_SIS_FLIP 0x08
+#define DRM_SIS_FLIP_INIT 0x09
+#define DRM_SIS_FLIP_FINAL 0x10
+#define DRM_SIS_AGP_INIT 0x13
+#define DRM_SIS_AGP_ALLOC 0x14
+#define DRM_SIS_AGP_FREE 0x15
+#define DRM_SIS_FB_INIT 0x16
+
+typedef struct {
+ int context;
+ unsigned long offset;
+ unsigned long size;
+ void *free;
+} drm_sis_mem_t;
+
+typedef struct {
+ unsigned long offset, size;
+} drm_sis_agp_t;
+
+typedef struct {
+ unsigned long offset, size;
+} drm_sis_fb_t;
+
+typedef struct {
+ unsigned int left, right;
+} drm_sis_flip_t;
+
+#endif /* _SIS_COMMON_H_ */
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c
index 1e16b526d..d3c09855f 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c,v 1.16 2003/08/07 12:52:23 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c,v 1.17 2003/08/28 11:16:39 twini Exp $ */
/*
* SiS hardware cursor handling
*
@@ -843,13 +843,17 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
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_XabreCore) {
sis301SetCursorAddress330(cursor_addr2)
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c
index d9f5852ea..78693daa4 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c,v 1.38 2003/08/23 10:25:19 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c,v 1.39 2003/08/26 20:40:23 twini Exp $ */
/*
* DAC helper functions (Save/Restore, MemClk, etc)
*
@@ -547,7 +547,7 @@ SiS300Save(ScrnInfoPtr pScrn, SISRegPtr sisReg)
(*pSiS->SiSSaveLVDSChrontel)(pScrn, sisReg);
if (pSiS->VBFlags & VB_301)
(*pSiS->SiSSave2)(pScrn, sisReg);
- if (pSiS->VBFlags & (VB_301B|VB_302B|VB_301LV|VB_302LV))
+ if (pSiS->VBFlags & (VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV))
(*pSiS->SiSSave3)(pScrn, sisReg);
#ifndef TWDEBUG
}
@@ -642,7 +642,7 @@ SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
}
/* TW: Restore VCLK and ECLK */
- if(pSiS->VBFlags & (VB_LVDS | VB_301B)) {
+ if(pSiS->VBFlags & (VB_LVDS | VB_301B | VB_301C)) {
outSISIDXREG(SISSR,0x31,0x20);
outSISIDXREG(SISSR,0x2b,sisReg->sisRegs3C4[0x2b]);
outSISIDXREG(SISSR,0x2c,sisReg->sisRegs3C4[0x2c]);
@@ -656,7 +656,7 @@ SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
outSISIDXREG(SISSR,0x2b,sisReg->sisRegs3C4[0x2b]);
outSISIDXREG(SISSR,0x2c,sisReg->sisRegs3C4[0x2c]);
outSISIDXREG(SISSR,0x2d,0x80);
- if(pSiS->VBFlags & (VB_LVDS | VB_301B)) {
+ if(pSiS->VBFlags & (VB_LVDS | VB_301B | VB_301C)) {
outSISIDXREG(SISSR,0x31,0x20);
outSISIDXREG(SISSR,0x2e,sisReg->sisRegs3C4[0x2e]);
outSISIDXREG(SISSR,0x2f,sisReg->sisRegs3C4[0x2f]);
@@ -700,7 +700,7 @@ SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
(*pSiS->SiSRestoreLVDSChrontel)(pScrn, sisReg);
if(pSiS->VBFlags & VB_301)
(*pSiS->SiSRestore2)(pScrn, sisReg);
- if(pSiS->VBFlags & (VB_301B|VB_302B|VB_301LV|VB_302LV))
+ if(pSiS->VBFlags & (VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV))
(*pSiS->SiSRestore3)(pScrn, sisReg);
}
@@ -779,7 +779,7 @@ SiS315Save(ScrnInfoPtr pScrn, SISRegPtr sisReg)
(*pSiS->SiSSaveLVDSChrontel)(pScrn, sisReg);
if (pSiS->VBFlags & VB_301)
(*pSiS->SiSSave2)(pScrn, sisReg);
- if (pSiS->VBFlags & (VB_301B|VB_302B|VB_301LV|VB_302LV))
+ if (pSiS->VBFlags & (VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV))
(*pSiS->SiSSave3)(pScrn, sisReg);
#ifndef TWDEBUG
}
@@ -892,7 +892,7 @@ SiS315Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
(*pSiS->SiSRestoreLVDSChrontel)(pScrn, sisReg);
if(pSiS->VBFlags & VB_301)
(*pSiS->SiSRestore2)(pScrn, sisReg);
- if(pSiS->VBFlags & (VB_301B|VB_302B|VB_301LV|VB_302LV))
+ if(pSiS->VBFlags & (VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV))
(*pSiS->SiSRestore3)(pScrn, sisReg);
}
@@ -1621,7 +1621,8 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, BOOLEAN IsForCRT2)
maxcrt2 = 135000;
if(pSiS->VBFlags & (VB_301B|VB_302B)) maxcrt2 = 162000;
- if(pSiS->VBFlags & VB_30xBDH) maxcrt2 = 100000;
+ else if(pSiS->VBFlags & VB_301C) maxcrt2 = 162000; /* ? */
+ if(pSiS->VBFlags & VB_30xBDH) maxcrt2 = 100000;
crt2used = 0.0;
crt2clock = SiSEstimateCRT2Clock(pScrn);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c
index 1c129cc00..eb83bb0f6 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c
@@ -1,8 +1,9 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.30 2003/08/23 15:34:37 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.32 2003/08/29 08:50:54 twini Exp $ */
/*
* DRI wrapper for 300 and 315 series
*
* Preliminary 315/330 support by Thomas Winischhofer
+ * Mesa 4/5 changes by Eric Anholt
*
* Taken and modified from tdfx_dri.c, mga_dri.c
*
@@ -25,6 +26,10 @@
#include "xf86drmCompat.h"
#endif
+#ifdef SISNEWDRI
+#include "sis_common.h"
+#endif
+
/* Idle function for 300 series */
#define BR(x) (0x8200 | (x) << 2)
#define SiSIdle \
@@ -90,7 +95,7 @@ SISInitVisualConfigs(ScreenPtr pScreen)
SISConfigPrivPtr *pSISConfigPtrs = 0;
int i, db, z_stencil, accum;
Bool useZ16 = FALSE;
-
+
if(getenv("SIS_FORCE_Z16")) {
useZ16 = TRUE;
}
@@ -202,7 +207,7 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
SISPtr pSIS = SISPTR(pScrn);
DRIInfoPtr pDRIInfo;
SISDRIPtr pSISDRI;
-#if 0
+#ifdef SISNEWDRI
drmVersionPtr version;
#endif
@@ -247,10 +252,19 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
((pciConfigPtr)pSIS->PciInfo->thisCard)->busnum,
((pciConfigPtr)pSIS->PciInfo->thisCard)->devnum,
((pciConfigPtr)pSIS->PciInfo->thisCard)->funcnum);
+ /* Hack to keep old DRI working -- checked for major==1 and
+ * minor==1.
+ */
+#ifdef SISNEWDRI
+ pDRIInfo->ddxDriverMajorVersion = SIS_MAJOR_VERSION;
+ pDRIInfo->ddxDriverMinorVersion = SIS_MINOR_VERSION;
+ pDRIInfo->ddxDriverPatchVersion = SIS_PATCHLEVEL;
+#else
pDRIInfo->ddxDriverMajorVersion = 0;
pDRIInfo->ddxDriverMinorVersion = 1;
pDRIInfo->ddxDriverPatchVersion = 0;
-
+#endif
+
pDRIInfo->frameBufferPhysicalAddress = pSIS->FbAddress;
/* TW: This was FbMapSize which is wrong as we must not
@@ -320,24 +334,35 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
return FALSE;
}
-#if 0
- /* XXX Check DRM kernel version here */
- version = drmGetVersion(info->drmFD);
- if (version) {
- if (version->version_major != 1 ||
- version->version_minor < 0) {
+#ifdef SISNEWDRI
+ /* Check DRM kernel version */
+ version = drmGetVersion(pSIS->drmSubFD);
+ if(version) {
+ if(version->version_major != 1 ||
+ version->version_minor < 0) {
/* incompatible drm version */
xf86DrvMsg(pScreen->myNum, X_ERROR,
"[dri] SISDRIScreenInit failed because of a version mismatch.\n"
- "[dri] sis.o kernel module version is %d.%d.%d but version 1.0.x is needed.\n"
- "[dri] Disabling the DRI.\n",
+ "\t[dri] sis.o kernel module version is %d.%d.%d but version 1.0.x is needed.\n"
+ "\t[dri] Disabling the DRI.\n",
version->version_major,
version->version_minor,
version->version_patchlevel);
drmFreeVersion(version);
- R128DRICloseScreen(pScreen);
+ SISDRICloseScreen(pScreen);
return FALSE;
}
+ if(version->version_minor >= 1) {
+ /* Includes support for framebuffer memory allocation without sisfb */
+ drm_sis_fb_t fb;
+ fb.offset = pSIS->DRIheapstart;
+ fb.size = pSIS->DRIheapend - pSIS->DRIheapstart;
+ drmCommandWrite(pSIS->drmSubFD, DRM_SIS_FB_INIT, &fb, sizeof(fb));
+ xf86DrvMsg(pScreen->myNum, X_INFO,
+ "[dri] DRI video RAM memory heap: 0x%x to 0x%x (%dKB)\n",
+ pSIS->DRIheapstart, pSIS->DRIheapend,
+ (pSIS->DRIheapend - pSIS->DRIheapstart) >> 10);
+ }
drmFreeVersion(version);
}
#endif
@@ -359,6 +384,9 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
pSIS->agpSize = 0;
pSIS->agpCmdBufSize = 0;
pSISDRI->AGPCmdBufSize = 0;
+
+ if(!pSIS->IsAGPCard)
+ break;
if(drmAgpAcquire(pSIS->drmSubFD) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpAcquire failed\n");
@@ -368,14 +396,14 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
if(pSIS->VGAEngine == SIS_315_VGA) {
#ifdef SIS315DRI
/* Default to 1X agp mode in SIS315 */
- if(drmAgpEnable(pSIS->drmSubFD, drmAgpGetMode(pSIS->drmSubFD)&~0x00000002) < 0) {
+ if(drmAgpEnable(pSIS->drmSubFD, drmAgpGetMode(pSIS->drmSubFD) & ~0x00000002) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpEnable failed\n");
break;
}
#endif
} else {
/* TODO: default value is 2x? */
- if(drmAgpEnable(pSIS->drmSubFD, drmAgpGetMode(pSIS->drmSubFD)&~0x0) < 0) {
+ if(drmAgpEnable(pSIS->drmSubFD, drmAgpGetMode(pSIS->drmSubFD) & ~0x0) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpEnable failed\n");
break;
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h
index 7491c8f0c..d38e39a05 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h,v 1.8 2003/08/23 15:34:38 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h,v 1.9 2003/08/29 08:50:54 twini Exp $ */
/* modified from tdfx_dri.h */
@@ -26,7 +26,7 @@ typedef struct {
unsigned int AGPCmdBufSize;
unsigned long AGPCmdBufNext;
#endif
-} SISSAREAPriv;
+} SISSAREAPriv, *SISSAREAPrivPtr;
#define AGPVtxBufNext AGPCmdBufNext
@@ -45,19 +45,19 @@ typedef struct {
int deviceID;
int width;
int height;
- int mem;
+ int mem; /* unused in Mesa 3 DRI */
int bytesPerPixel;
- int priv1;
- int priv2;
- int fbOffset;
- int backOffset;
- int depthOffset;
- int textureOffset;
- int textureSize;
+ int priv1; /* unused in Mesa 3 DRI */
+ int priv2; /* unused in Mesa 3 DRI */
+ int fbOffset; /* unused in Mesa 3 DRI */
+ int backOffset; /* unused in Mesa 3 DRI */
+ int depthOffset; /* unused in Mesa 3 DRI */
+ int textureOffset; /* unused in Mesa 3 DRI */
+ int textureSize; /* unused in Mesa 3 DRI */
unsigned int AGPCmdBufOffset;
unsigned int AGPCmdBufSize;
- int irqEnabled;
- unsigned int scrnX, scrnY;
+ int irqEnabled; /* unused in Mesa 3 DRI */
+ unsigned int scrnX, scrnY; /* unused in Mesa 3 DRI */
} SISDRIRec, *SISDRIPtr;
#define AGPVtxBufOffset AGPCmdBufOffset
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c
index 554554613..2b265bfee 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.110 2003/08/26 16:38:01 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.118 2003/08/28 13:21:08 twini Exp $ */
/*
* Copyright 2001, 2002, 2003 by Thomas Winischhofer, Vienna, Austria.
*
@@ -359,6 +359,8 @@ static const char *vbeSymbols[] = {
NULL
};
+#ifdef XFree86LOADER
+
#ifdef XF86DRI
static const char *drmSymbols[] = {
"drmAddMap",
@@ -391,8 +393,6 @@ static const char *driSymbols[] = {
};
#endif
-#ifdef XFree86LOADER
-
static MODULESETUPPROTO(sisSetup);
static XF86ModuleVersionInfo sisVersRec =
@@ -714,18 +714,18 @@ SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int fla
setSISIDXREG(SISSR, 0x11, ~0x0c, sr11);
}
if(pSiS->VGAEngine == SIS_300_VGA) {
- if((pSiS->VBFlags & (VB_301B|VB_302B)) &&
+ if((pSiS->VBFlags & (VB_301B|VB_301C|VB_302B)) &&
(!(pSiS->VBFlags & VB_30xBDH))) {
setSISIDXREG(SISPART1, 0x13, 0x3f, p1_13);
}
} else if(pSiS->VGAEngine == SIS_315_VGA) {
- if((pSiS->VBFlags & (VB_301B|VB_302B)) &&
+ if((pSiS->VBFlags & (VB_301B|VB_301C|VB_302B)) &&
(!(pSiS->VBFlags & VB_30xBDH))) {
setSISIDXREG(SISPART2, 0x00, 0x1f, p2_0);
}
}
} else if(pSiS->VBFlags & CRT2_VGA) {
- if(pSiS->VBFlags & (VB_301B|VB_302B)) {
+ if(pSiS->VBFlags & (VB_301B|VB_301C|VB_302B)) {
setSISIDXREG(SISPART2, 0x00, 0x1f, p2_0);
}
}
@@ -2506,10 +2506,12 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
if(sisfbversion >= 0x01050A) {
/* We can trust the pdc value if sisfb is of recent version */
- pSiS->donttrustpdc = FALSE;
+ if(pSiS->VGAEngine == SIS_300_VGA) pSiS->donttrustpdc = FALSE;
if(sisfbversion >= 0x01050B) {
- /* As of 1.5.11, sisfb saved the register for us */
- pSiS->sisfbpdc = mysisfbinfo.sisfb_lcdpdc;
+ if(pSiS->VGAEngine == SIS_300_VGA) {
+ /* As of 1.5.11, sisfb saved the register for us (300 series) */
+ pSiS->sisfbpdc = mysisfbinfo.sisfb_lcdpdc;
+ }
}
if(sisfbversion >= 0x01050E) {
if(pSiS->VGAEngine == SIS_315_VGA) {
@@ -2519,6 +2521,12 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->sisfbscalelcd = mysisfbinfo.sisfb_scalelcd;
pSiS->sisfbspecialtiming = mysisfbinfo.sisfb_specialtiming;
}
+ if(sisfbversion >= 0x010610) {
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ pSiS->donttrustpdc = FALSE;
+ pSiS->sisfbpdc = mysisfbinfo.sisfb_lcdpdc;
+ }
+ }
}
}
}
@@ -3637,7 +3645,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
- if( (pSiS->VBFlags & (VB_301 | VB_301B | VB_302B | VB_301LV | VB_302LV)) &&
+ if( (pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV)) &&
(!((pSiS->VBFlags & VB_30xBDH) && (pSiS->VBFlags & CRT2_LCD))) ) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"CRT2 gamma correction is %s\n",
@@ -3792,8 +3800,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
}
-
-
#ifdef SIS_CP
SIS_CP_DRIVER_RECONFIGOPT
#endif
@@ -3949,7 +3955,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->sishw_ext.pdc = 0;
if(pSiS->VGAEngine == SIS_300_VGA) {
-
if(pSiS->VBFlags & (VB_LVDS | VB_30xBDH)) {
/* Save the current PDC if the panel is used at the moment.
* This seems by far the safest way to find out about it.
@@ -3960,19 +3965,19 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if(pSiS->sisfbpdc) {
pSiS->sishw_ext.pdc = pSiS->sisfbpdc;
} else {
- if(!(pSiS->donttrustpdc)) {
- unsigned char tmp;
- inSISIDXREG(SISCR, 0x30, tmp);
- if(tmp & 0x20) {
- inSISIDXREG(SISPART1, 0x13, pSiS->sishw_ext.pdc);
- } else {
+ if(!(pSiS->donttrustpdc)) {
+ unsigned char tmp;
+ inSISIDXREG(SISCR, 0x30, tmp);
+ if(tmp & 0x20) {
+ inSISIDXREG(SISPART1, 0x13, pSiS->sishw_ext.pdc);
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Unable to detect LCD PanelDelayCompensation, LCD is not active\n");
+ }
+ } else {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Unable to detect LCD PanelDelayCompensation, LCD is not active\n");
- }
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Unable to detect LCD PanelDelayCompensation, please update sisfb\n");
- }
+ "Unable to detect LCD PanelDelayCompensation, please update sisfb\n");
+ }
}
pSiS->sishw_ext.pdc &= 0x3c;
if(pSiS->sishw_ext.pdc) {
@@ -4034,14 +4039,50 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
}
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ if(pSiS->VBFlags & (VB_301LV | VB_302LV)) {
+ /* Save the current PDC if the panel is used at the moment.
+ * This seems by far the safest way to find out about it.
+ */
+ if(pSiS->sisfbpdc) {
+ pSiS->sishw_ext.pdc = pSiS->sisfbpdc;
+ } else {
+ if(!(pSiS->donttrustpdc)) {
+ unsigned char tmp;
+ inSISIDXREG(SISCR, 0x30, tmp);
+ if(tmp & 0x20) {
+ inSISIDXREG(SISPART1, 0x2D, pSiS->sishw_ext.pdc);
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Unable to detect LCD PanelDelayCompensation, LCD is not active\n");
+ }
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Unable to detect LCD PanelDelayCompensation, please update sisfb\n");
+ }
+ }
+ if(pSiS->sishw_ext.pdc) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Detected LCD PanelDelayCompensation %d\n",
+ pSiS->sishw_ext.pdc);
+ }
+ if(pSiS->PDC != -1) {
+ pSiS->sishw_ext.pdc = pSiS->PDC & 0xff;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Using LCD PanelDelayCompensation %d\n",
+ pSiS->sishw_ext.pdc);
+ }
+ }
+ }
+
#ifdef SISDUALHEAD
/* In dual head mode, both heads (currently) share the maxxfbmem equally.
* If memory sharing is done differently, the following has to be changed;
* the other modules (eg. accel and Xv) use dhmOffset for hardware
* pointer settings relative to VideoRAM start and won't need to be changed.
*/
- if (pSiS->DualHeadMode) {
- if (pSiS->SecondHead == FALSE) {
+ if(pSiS->DualHeadMode) {
+ if(pSiS->SecondHead == FALSE) {
/* ===== First head (always CRT2) ===== */
/* We use only half of the memory available */
pSiS->maxxfbmem /= 2;
@@ -4076,6 +4117,21 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
* mode into account.)
*/
+ pSiS->DRIheapstart = pSiS->maxxfbmem;
+ pSiS->DRIheapend = pSiS->availMem;
+#ifdef SISDUALHEAD
+ if(pSiS->DualHeadMode) {
+ pSiS->DRIheapstart = pSiS->DRIheapend = 0;
+ } else
+#endif
+ if(pSiS->DRIheapstart == pSiS->DRIheapend) {
+#if 0 /* For future use */
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "No memory for DRI heap. Please set the option \"MaxXFBMem\" to\n"
+ "\tlimit the memory XFree should use and leave the rest to DRI\n");
+#endif
+ pSiS->DRIheapstart = pSiS->DRIheapend = 0;
+ }
/* Now for something completely different: DDC.
* For 300 and 315 series, we provide our
@@ -4328,7 +4384,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
if(!pSiS->SecondHead) {
- if(pSiS->VBFlags & (VB_301|VB_301B|VB_302B)) {
+ if(pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)) {
if(!(pSiS->VBFlags & (CRT2_LCD|CRT2_VGA))) includelcdmodes = FALSE;
if(pSiS->VBFlags & CRT2_LCD) isfordvi = TRUE;
if(pSiS->VBFlags & CRT2_TV) acceptcustommodes = FALSE;
@@ -4346,7 +4402,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
includelcdmodes = FALSE;
else
#endif
- if(pSiS->VBFlags & (VB_301|VB_301B|VB_302B)) {
+ if(pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)) {
if(!(pSiS->VBFlags & (CRT2_LCD|CRT2_VGA))) includelcdmodes = FALSE;
if(pSiS->VBFlags & CRT2_LCD) isfordvi = TRUE;
if(pSiS->VBFlags & CRT2_TV) acceptcustommodes = FALSE;
@@ -4639,7 +4695,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "Max pixel clock for CRT2 is %d MHz\n",
clockRanges->maxClock / 1000);
- if(pSiS->VBFlags & (VB_301|VB_301B|VB_302B)) {
+ if(pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)) {
if(!(pSiS->VBFlags & (CRT2_LCD|CRT2_VGA))) includelcdmodes = FALSE;
if(pSiS->VBFlags & CRT2_LCD) isfordvi = TRUE;
if(pSiS->VBFlags & CRT2_TV) acceptcustommodes = FALSE;
@@ -5805,7 +5861,7 @@ SISRestore(ScrnInfoPtr pScrn)
* the option RestoreBySetMode.
*/
if( ( (pSiS->restorebyset) ||
- (pSiS->VBFlags & (VB_301B|VB_302B|VB_301LV|VB_302LV)) ||
+ (pSiS->VBFlags & (VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV)) ||
((pSiS->sishw_ext.jChipType == SIS_730) && (pSiS->VBFlags & VB_LVDS)) ) &&
(pSiS->OldMode) ) {
@@ -5830,7 +5886,7 @@ SISRestore(ScrnInfoPtr pScrn)
int backupscaler = pSiS->SiS_Pr->UsePanelScaler;
unsigned long backupspecialtiming = pSiS->SiS_Pr->SiS_CustomT;
- if((pSiS->VBFlags & (VB_301B|VB_302B|VB_301LV|VB_302LV))) {
+ if((pSiS->VBFlags & (VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV))) {
/* !!! REQUIRED for 630+301B-DH, otherwise the text modes
* will not be restored correctly !!!
* !!! Do this ONLY for LCD; VGA2 will not be restored
@@ -5921,7 +5977,7 @@ SISRestore(ScrnInfoPtr pScrn)
vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL);
#if 0
- if(pSiS->VBFlags & (VB_301B|VB_302B|VB_301LV|VB_302LV)) {
+ if(pSiS->VBFlags & (VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV)) {
if(vesasuccess) {
vgaHWRestore(pScrn, vgaReg, (VGA_SR_CMAP | VGA_SR_FONTS));
} else {
@@ -6021,7 +6077,25 @@ SISVESARestore(ScrnInfoPtr pScrn)
{
SISPtr pSiS = SISPTR(pScrn);
- if(pSiS->UseVESA) SISVESASaveRestore(pScrn, MODE_RESTORE);
+ if(pSiS->UseVESA) {
+ SISVESASaveRestore(pScrn, MODE_RESTORE);
+#ifdef SISVRAMQ
+ /* Restore queue mode registers on 315/330 series */
+ /* (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);
+ 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);
+ }
+#endif
+ }
}
/* Restore bridge config registers - to be called BEFORE VESARestore */
@@ -6150,7 +6224,11 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
* This is done on 300 and 315 series only.
*/
if(pSiS->UseVESA) {
- SiSEnableTurboQueue(pScrn);
+#ifdef SISVRAMQ
+ if(pSiS->VGAEngine != SIS_315_VGA)
+#endif
+ SiSEnableTurboQueue(pScrn);
+
}
/* Save the current state */
@@ -6749,7 +6827,7 @@ SISSwitchCRT2Type(ScrnInfoPtr pScrn, unsigned long newvbflags)
}
Bool
-SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned short index)
+SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned short index, Bool quiet)
{
SISPtr pSiS = SISPTR(pScrn);
BOOLEAN hcm;
@@ -6804,14 +6882,16 @@ SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned sh
/* For RandR */
if((mode->HDisplay > pScrn->virtualX) || (mode->VDisplay > pScrn->virtualY)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ if(!quiet) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Desired mode too large for current screen size\n");
+ }
return FALSE;
}
/* Check if the desired mode is suitable for current output device */
if(!SiS_CheckCalcModeIndex(pScrn, mode, vbflags, hcm)) {
- if(!cond) {
+ if((!cond) && (!quiet)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Desired mode not suitable for current CRT2 output device\n");
}
@@ -7463,6 +7543,11 @@ SISCloseScreen(int scrnIndex, ScreenPtr pScreen)
pSiS->AccelLinearScratch = NULL;
}
+ if(pSiS->RenderAccelArray) {
+ xfree(pSiS->RenderAccelArray);
+ pSiS->RenderAccelArray = NULL;
+ }
+
if(pSiS->AccelInfoPtr) {
XAADestroyInfoRec(pSiS->AccelInfoPtr);
pSiS->AccelInfoPtr = NULL;
@@ -7830,13 +7915,16 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn)
MMIO_OUT32(pSiS->IOBase, 0x85c4, 0);
/* Enable VRAM Command Queue mode */
switch(pSiS->cmdQueueSize) {
- case 1*1024*1024: SR26 = (0x40 | 0x04); break;
- case 2*1024*1024: SR26 = (0x40 | 0x08); break;
- case 4*1024*1024: SR26 = (0x40 | 0x0C); break;
+ case 1*1024*1024: SR26 = (0x40 | 0x04 | 0x01); break;
+ case 2*1024*1024: SR26 = (0x40 | 0x08 | 0x01); break;
+ case 4*1024*1024: SR26 = (0x40 | 0x0C | 0x01); break;
default:
- case 512*1024: SR26 = (0x40 | 0x00);
+ pSiS->cmdQueueSize = 512 * 1024;
+ case 512*1024: SR26 = (0x40 | 0x00 | 0x01);
}
outSISIDXREG(SISSR, 0x26, SR26);
+ SR26 &= 0xfe;
+ outSISIDXREG(SISSR, 0x26, SR26);
pSiS->cmdQ_SharedWritePort_2D = (unsigned long)(MMIO_IN32(pSiS->IOBase, 0x85c8));
*(pSiS->cmdQ_SharedWritePort) = pSiS->cmdQ_SharedWritePort_2D;
MMIO_OUT32(pSiS->IOBase, 0x85c4, pSiS->cmdQ_SharedWritePort_2D);
@@ -8047,7 +8135,7 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
#if 0 /* For future use */
if( (pSiS->VBFlags & VB_LVDS) ||
(pSiS->VBFlags & VB_301) ||
- ( (pSiS->VBFlags & (VB_301B | VB_302B |VB_301LV | VB_302LV)) &&
+ ( (pSiS->VBFlags & (VB_301B | VB_301C | VB_302B |VB_301LV | VB_302LV)) &&
(!(pSiS->VBLCDFlags & VB_LCD_1400x1050)) ) ) {
#endif
usScratchCR31 |= 0x04; /* Set VB_NotSimuMode (not for 30xB/1400x1050?) */
@@ -9984,15 +10072,19 @@ void SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg)
if(doit) {
inSISIDXREG(SISCR, 0x17, usScratchCR17);
if(pSiS->CRT1off) {
- if(usScratchCR17 & 0x80) flag = TRUE;
- usScratchCR17 &= ~0x80;
+ if(usScratchCR17 & 0x80) {
+ flag = TRUE;
+ usScratchCR17 &= ~0x80;
+ }
} else {
- if(!(usScratchCR17 & 0x80)) flag = TRUE;
- usScratchCR17 |= 0x80;
+ if(!(usScratchCR17 & 0x80)) {
+ flag = TRUE;
+ usScratchCR17 |= 0x80;
+ }
}
- outSISIDXREG(SISCR, 0x17, usScratchCR17);
/* Reset only if status changed */
if(flag) {
+ outSISIDXREG(SISCR, 0x17, usScratchCR17);
outSISIDXREG(SISSR, 0x00, 0x01); /* Synchronous Reset */
usleep(10000);
outSISIDXREG(SISSR, 0x00, 0x03); /* End Reset */
@@ -10079,7 +10171,7 @@ void SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg)
#ifdef SISVRAMQ
if(pSiS->VGAEngine == SIS_315_VGA) {
- /* Re-Enable TurboQueue */
+ /* Re-Enable command queue */
SiSEnableTurboQueue(pScrn);
}
#endif
@@ -10847,7 +10939,7 @@ SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned long VBF
}
break;
case 1400:
- if(VBFlags & (VB_302B | VB_302LV)) {
+ if(VBFlags & (VB_301C | VB_302B | VB_302LV)) {
if(mode->VDisplay == 1050) {
if(pSiS->VGAEngine == SIS_315_VGA) {
ModeIndex = ModeIndex_1400x1050[i];
@@ -10856,7 +10948,7 @@ SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned long VBF
}
break;
case 1600:
- if(VBFlags & (VB_302B | VB_302LV)) {
+ if(VBFlags & (VB_301C | VB_302B | VB_302LV)) {
if(mode->VDisplay == 1200) {
ModeIndex = ModeIndex_1600x1200[i];
}
@@ -10961,7 +11053,7 @@ SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned long VBF
break;
case 1024:
if(mode->VDisplay == 768) {
- if(VBFlags & (VB_301B|VB_302B|VB_301LV|VB_302LV)) {
+ if(VBFlags & (VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV)) {
ModeIndex = ModeIndex_1024x768[i];
}
} else if(VBFlags & (TV_HIVISION | TV_HIVISION_LV)) {
@@ -11092,12 +11184,30 @@ SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned long VBF
case 1600:
if(mode->VDisplay == 1200) {
if(pSiS->VGAEngine == SIS_315_VGA) {
- if(pSiS->VBFlags & (VB_301B|VB_302B)) {
+ if(pSiS->VBFlags & (VB_301B|VB_301C|VB_302B)) {
ModeIndex = ModeIndex_1600x1200[i];
}
}
}
break;
+ case 1920:
+ if(mode->VDisplay == 1440) {
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ if(pSiS->VBFlags & VB_301C) {
+ ModeIndex = ModeIndex_1920x1440[i];
+ }
+ }
+ }
+ break;
+ case 2048:
+ if(mode->VDisplay == 1536) {
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ if(pSiS->VBFlags & VB_301C) {
+ ModeIndex = ModeIndex_310_2048x1536[i];
+ }
+ }
+ }
+ break;
}
} else { /* CRT1 only, no CRT2 */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h
index eb65ecb9b..643a072be 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h,v 1.15 2003/08/26 14:29:36 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h,v 1.16 2003/08/27 10:42:51 twini Exp $ */
/*
* Global data and definitions
*
@@ -166,7 +166,7 @@ const customttable mycustomttable[] = {
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
0x0e11, 0x083c,
- "Compaq", "Presario 3045US", CUT_COMPAQ12802, "COMPAQ1280"
+ "Compaq", "Presario 3017cl/3045US", CUT_COMPAQ12802, "COMPAQ1280"
},
{ SIS_650, "", "",
0,
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c
index df46af8b8..f43f662d9 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c,v 1.26 2003/08/23 10:25:19 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c,v 1.29 2003/08/28 13:30:21 twini Exp $ */
/*
* SiS driver option evaluation
*
@@ -46,6 +46,7 @@ typedef enum {
OPTION_FAST_VRAM,
OPTION_NOHOSTBUS,
/* OPTION_SET_MEMCLOCK, */
+ OPTION_RENDER,
OPTION_FORCE_CRT2TYPE,
OPTION_SHADOW_FB,
OPTION_ROTATE,
@@ -146,6 +147,7 @@ static const OptionInfoRec SISOptions[] = {
/* { OPTION_SET_MEMCLOCK, "SetMClk", OPTV_FREQ, {0}, -1 }, */
{ OPTION_FAST_VRAM, "FastVram", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_NOHOSTBUS, "NoHostBus", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_RENDER, "RenderAcceleration", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_FORCE_CRT2TYPE, "ForceCRT2Type", OPTV_ANYSTR, {0}, FALSE },
{ OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE },
@@ -275,6 +277,7 @@ SiSOptions(ScrnInfoPtr pScrn)
/* But beware: sisfb does not know about this!!! */
pSiS->cmdQueueSize = 512*1024;
#endif
+ pSiS->doRender = TRUE;
pSiS->HWCursor = TRUE;
pSiS->Rotate = FALSE;
pSiS->ShadowFB = FALSE;
@@ -368,6 +371,12 @@ SiSOptions(ScrnInfoPtr pScrn)
pSiS->newFastVram = 1;
}
+ if(pSiS->sishw_ext.jChipType == SIS_315H ||
+ pSiS->sishw_ext.jChipType == SIS_315) {
+ /* Cursor engine seriously broken */
+ pSiS->HWCursor = FALSE;
+ }
+
#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
pSiS->OptUseColorCursor = 0;
#else
@@ -463,6 +472,17 @@ SiSOptions(ScrnInfoPtr pScrn)
}
+ /* RenderAcceleration
+ * En/Disables RENDER acceleration (315/330 series only)
+ */
+ if((pSiS->VGAEngine == SIS_315_VGA) && (!pSiS->NoAccel)) {
+ if(xf86GetOptValBool(pSiS->Options, OPTION_RENDER, &pSiS->doRender)) {
+ if(!pSiS->doRender) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "RENDER Acceleration disabled\n");
+ }
+ }
+ }
+
/* SWCursor
* HWCursor
* Chooses whether to use the hardware or software cursor
@@ -988,18 +1008,19 @@ SiSOptions(ScrnInfoPtr pScrn)
pSiS->UsePanelScaler ? disabledstr : enabledstr);
}
- /* PanelDelayCompensation (300/315/330 series only; currently used
- * on 300 series only)
+ /* PanelDelayCompensation (300/315/330 series only)
* This might be required if the LCD panel shows "small waves".
- * The parameter is an integer, usually either 4, 32 or 24.
+ * The parameter is an integer, (on 300 series usually either
+ * 4, 32 or 24; on 315 series + LV bridge usually 3 or 51)
* Why this option? Simply because SiS did poor BIOS design.
* The PDC value depends on the very LCD panel used in a
* particular machine. For most panels, the driver is able
* to detect the correct value. However, some panels require
- * a different setting. The value given must be within the mask 0x3c.
+ * a different setting. For 300 series, the value given must
+ * be within the mask 0x3c.
*/
if(xf86GetOptValInteger(pSiS->Options, OPTION_PDC, &pSiS->PDC)) {
- if(pSiS->PDC & ~0x3c) {
+ if((pSiS->VGAEngine == SIS_300_VGA) && (pSiS->PDC & ~0x3c)) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Illegal PanelDelayCompensation parameter\n");
pSiS->PDC = -1;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c
index 8b3215d69..150ad127d 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c,v 1.17 2003/08/07 12:52:23 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c,v 1.18 2003/08/27 23:32:50 twini Exp $ */
/*
* Basic hardware and memory detection
*
@@ -264,7 +264,7 @@ sis300Setup(ScrnInfoPtr pScrn)
100, 100, 100, 100};
const int adaptermclk300[8] = { 125, 125, 125, 100,
100, 100, 100, 100};
- unsigned int config, pciconfig, ramtype;
+ unsigned int config, pciconfig, sr3a, ramtype;
unsigned char temp;
int cpubuswidth;
int from = X_PROBED;
@@ -274,17 +274,18 @@ sis300Setup(ScrnInfoPtr pScrn)
inSISIDXREG(SISSR, 0x14, config);
cpubuswidth = bus[config >> 6];
- inSISIDXREG(SISSR, 0x3A, ramtype);
- ramtype &= 0x03;
- ramtype += 4;
+ inSISIDXREG(SISSR, 0x3A, sr3a);
+ ramtype = (sr3a & 0x03) + 4;
switch(pSiS->Chipset) {
case PCI_CHIP_SIS300:
pScrn->videoRam = ((config & 0x3F) + 1) * 1024;
pSiS->BusWidth = cpubuswidth;
+ pSiS->IsAGPCard = ((sr3a & 0x30) == 0x30) ? FALSE : TRUE;
break;
case PCI_CHIP_SIS540:
case PCI_CHIP_SIS630:
+ pSiS->IsAGPCard = TRUE;
pciconfig = pciReadByte(0x00000000, 0x63);
if(pciconfig & 0x80) {
pScrn->videoRam = (1 << (((pciconfig & 0x70) >> 4) + 21)) / 1024;
@@ -352,7 +353,7 @@ sis315Setup(ScrnInfoPtr pScrn)
int busSDR[4] = {64, 64, 128, 128};
int busDDR[4] = {32, 32, 64, 64};
int busDDRA[4] = {64+32, 64+32 , (64+32)*2, (64+32)*2};
- unsigned int config, config1, config2;
+ unsigned int config, config1, config2, sr3a;
char *dramTypeStr315[] = {
"Single Channel 1 rank SDR SDRAM",
"Single Channel 1 rank SDR SGRAM",
@@ -390,17 +391,21 @@ sis315Setup(ScrnInfoPtr pScrn)
inSISIDXREG(SISSR, 0x14, config);
config1 = (config & 0x0C) >> 2;
- inSISIDXREG(SISSR, 0x3A, config2);
- config2 &= 0x03;
+ inSISIDXREG(SISSR, 0x3A, sr3a);
+ config2 = sr3a & 0x03;
pScrn->videoRam = (1 << ((config & 0xF0) >> 4)) * 1024;
if(pSiS->Chipset == PCI_CHIP_SIS330) {
+ pSiS->IsAGPCard = TRUE;
+
if(config1) pScrn->videoRam <<= 1;
} else {
+ pSiS->IsAGPCard = ((sr3a & 0x30) == 0x30) ? FALSE : TRUE;
+
/* If SINGLE_CHANNEL_2_RANK or DUAL_CHANNEL_1_RANK -> mem * 2 */
if((config1 == 0x01) || (config1 == 0x03))
pScrn->videoRam <<= 1;
@@ -454,7 +459,7 @@ sis315Setup(ScrnInfoPtr pScrn)
pSiS->BusWidth);
}
-/* TW: for 550, 650, 740, 660 */
+/* For 550, 65x, 74x, 660 */
static void
sis550Setup(ScrnInfoPtr pScrn)
{
@@ -463,6 +468,8 @@ sis550Setup(ScrnInfoPtr pScrn)
CARD8 pciconfig, temp;
BOOLEAN alldone = FALSE;
+ pSiS->IsAGPCard = TRUE;
+
pSiS->MemClock = SiSMclk(pSiS);
if(pSiS->Chipset == PCI_CHIP_SIS660) {
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c
index 694a1eb44..b6effa55e 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c,v 1.15 2003/06/26 22:35:19 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c,v 1.16 2003/08/26 20:40:24 twini Exp $ */
/*
* Video bridge detection and configuration for 300, 315 and 330 series
*
@@ -151,7 +151,7 @@ void SISLCDPreInit(ScrnInfoPtr pScrn)
if((!pSiS->DualHeadMode) || (!pSiS->SecondHead)) {
#endif
if((pSiS->VGAEngine == SIS_315_VGA) &&
- (pSiS->VBFlags & (VB_301|VB_301B|VB_302B)) &&
+ (pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)) &&
(!(pSiS->VBFlags & VB_30xBDH))) {
if(pSiS->forcecrt2redetection) {
@@ -384,7 +384,7 @@ void SISCRT2PreInit(ScrnInfoPtr pScrn)
* which is prone to be misdetected as a secondary VGA)
*/
if(!(pSiS->nocrt2ddcdetection)) {
- if(pSiS->VBFlags & (VB_301|VB_301B|VB_302B)) {
+ if(pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)) {
if(!(pSiS->VBFlags & (CRT2_VGA | CRT2_LCD))) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"%s secondary VGA, sensing via DDC\n",
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c
index ff2e1852a..4f8b8d0f8 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c
@@ -1,11 +1,11 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c,v 1.24 2003/08/07 12:52:23 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c,v 1.26 2003/08/26 23:32:19 twini Exp $ */
/*
* Mode setup and basic video bridge detection
*
* Copyright 2001, 2002, 2003 by Thomas Winischhofer, Vienna, Austria.
*
- * Init() function for old series (except for FIFO calculation) based on code
- * which was Copyright 1998,1999 by Alan Hourihane, Wigan, England.
+ * Init() function for old series (except for TV and FIFO calculation) based
+ * on code which was Copyright 1998,1999 by Alan Hourihane, Wigan, England.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -25,6 +25,9 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
+ * Authors: Thomas Winischhofer <thomas@winischhofer.net>
+ * ...
+ *
*/
#include "xf86.h"
@@ -948,12 +951,12 @@ SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
* the videoRAM (notably NOT the x framebuffer memory, which can/should
* be limited by MaxXFbMem when using DRI). Also, enable the accelerators.
*/
- if (!pSiS->NoAccel) {
+ if(!pSiS->NoAccel) {
pReg->sisRegs3C4[0x1E] |= 0x42; /* Enable 2D accelerator */
pReg->sisRegs3C4[0x1E] |= 0x18; /* Enable 3D accelerator */
- switch (pSiS->VGAEngine) {
+ switch(pSiS->VGAEngine) {
case SIS_300_VGA:
- if(pSiS->TurboQueue) { /* set Turbo Queue as 512k */
+ if(pSiS->TurboQueue) { /* set Turbo Queue as 512k */
temp = ((pScrn->videoRam/64)-8); /* 8=512k, 4=256k, 2=128k, 1=64k */
pReg->sisRegs3C4[0x26] = temp & 0xFF;
pReg->sisRegs3C4[0x27] =
@@ -961,10 +964,12 @@ SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
} /* line above new for saving D2&3 of status register */
break;
case SIS_315_VGA:
+#ifndef SISVRAMQ
/* See comments in sis_driver.c */
pReg->sisRegs3C4[0x27] = 0x1F;
pReg->sisRegs3C4[0x26] = 0x22;
pReg->sisMMIO85C0 = (pScrn->videoRam - 512) * 1024;
+#endif
break;
}
}
@@ -1044,7 +1049,7 @@ void SISSense30x(ScrnInfoPtr pScrn)
testcvbs_tempbh = 0x00; testcvbs_tempbl = 0xb3;
biosflag = 0;
}
- if(pSiS->VBFlags & (VB_301B|VB_302B|VB_301LV|VB_302LV)) {
+ if(pSiS->VBFlags & (VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV)) {
testvga2_tempbh = 0x01; testvga2_tempbl = 0x90;
testsvhs_tempbh = 0x01; testsvhs_tempbl = 0x6b;
testcvbs_tempbh = 0x01; testcvbs_tempbl = 0x74;
@@ -1088,7 +1093,7 @@ void SISSense30x(ScrnInfoPtr pScrn)
biosflag = 0;
}
- if(pSiS->VBFlags & (VB_301B|VB_302B|VB_301LV|VB_302LV)) {
+ if(pSiS->VBFlags & (VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV)) {
if(pSiS->sishw_ext.UseROM) {
if((pSiS->Chipset == PCI_CHIP_SIS330) || (pSiS->Chipset == PCI_CHIP_SIS660)) {
testvga2_tempbh = pSiS->BIOS[0xec]; testvga2_tempbl = pSiS->BIOS[0xeb];
@@ -1100,7 +1105,7 @@ void SISSense30x(ScrnInfoPtr pScrn)
testcvbs_tempbh = pSiS->BIOS[0xc8]; testcvbs_tempbl = pSiS->BIOS[0xc7];
}
} else {
- if(pSiS->VBFlags & (VB_301B|VB_302B)) {
+ if(pSiS->VBFlags & (VB_301B|VB_301C|VB_302B)) {
testvga2_tempbh = 0x01; testvga2_tempbl = 0x90;
testsvhs_tempbh = 0x01; testsvhs_tempbl = 0x6b;
testcvbs_tempbh = 0x01; testcvbs_tempbl = 0x74;
@@ -1112,7 +1117,7 @@ void SISSense30x(ScrnInfoPtr pScrn)
}
}
- if(pSiS->VBFlags & (VB_301|VB_301B|VB_302B)) {
+ if(pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)) {
inSISIDXREG(SISPART4,0x01,myflag);
if(myflag & 0x04) {
testvga2_tempbh = 0x00; testvga2_tempbl = 0xfd;
@@ -1346,7 +1351,7 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
pSiS->SiS_Pr->SiS_UseLCDA = FALSE;
pSiS->SiS_Pr->Backup = FALSE;
- /* TW: Videobridges only available for 300/315 series */
+ /* Videobridges only available for 300/315 series */
if((pSiS->VGAEngine != SIS_300_VGA) && (pSiS->VGAEngine != SIS_315_VGA))
return;
@@ -1355,19 +1360,25 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
if (temp == 1) {
inSISIDXREG(SISPART4, 0x01, temp1);
temp1 &= 0xff;
- if (temp1 >= 0xE0) {
+ if(temp1 >= 0xE0) {
pSiS->VBFlags |= VB_302LV;
pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LV;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"Detected SiS302LV video bridge (ID 1; Revision 0x%x)\n",
temp1);
- } else if (temp1 >= 0xD0) {
+ } else if(temp1 >= 0xD0) {
pSiS->VBFlags |= VB_301LV;
pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LV;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"Detected SiS301LV video bridge (ID 1; Revision 0x%x)\n",
temp1);
- } else if (temp1 >= 0xB0) {
+ } else if(temp1 >= 0xC0) { /* guessed */
+ pSiS->VBFlags |= VB_301C;
+ pSiS->sishw_ext.ujVBChipID = VB_CHIP_301C;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Detected SiS301C video bridge (ID 1; Revision 0x%x)\n",
+ temp1);
+ } else if(temp1 >= 0xB0) {
pSiS->VBFlags |= VB_301B;
pSiS->sishw_ext.ujVBChipID = VB_CHIP_301B;
inSISIDXREG(SISPART4, 0x23, temp2);
@@ -1390,13 +1401,13 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
inSISIDXREG(SISPART4, 0x01, temp1);
temp1 &= 0xff;
- if (temp1 >= 0xE0) {
+ if(temp1 >= 0xE0) {
pSiS->VBFlags |= VB_302LV;
pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LV;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"Detected SiS302LV video bridge (ID 2; Revision 0x%x)\n",
temp1);
- } else if (temp1 >= 0xD0) {
+ } else if(temp1 >= 0xD0) {
pSiS->VBFlags |= VB_301LV;
pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LV;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
@@ -1455,7 +1466,7 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
}
}
if((temp >= lowerlimitch) && (temp <= upperlimitch)) {
- /* TW: Set global for init301.c */
+ /* Set global for init301.c */
pSiS->SiS_Pr->SiS_IF_DEF_CH70xx = chronteltype;
if(chronteltype == 1) {
@@ -1463,10 +1474,10 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
SiS_SetChrontelGPIO(pSiS->SiS_Pr, 0x9c);
}
- /* TW: Read Chrontel version number */
+ /* Read Chrontel version number */
temp1 = SiS_GetCH70xx(pSiS->SiS_Pr, chrontelidreg);
if(chronteltype == 1) {
- /* TW: See Chrontel TB31 for explanation */
+ /* See Chrontel TB31 for explanation */
temp2 = SiS_GetCH700x(pSiS->SiS_Pr, 0x0e);
if(((temp2 & 0x07) == 0x01) || (temp2 & 0x04)) {
SiS_SetCH700x(pSiS->SiS_Pr, 0x0b0e);
@@ -1633,9 +1644,8 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
}
}
if ((pSiS->VGAEngine == SIS_300_VGA) && (temp == 3)) {
- pSiS->VBFlags |= VB_TRUMPION;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Detected Trumpion Zurac (I/II/III) LVDS scaler\n");
+ "Detected Trumpion Zurac (I/II/III) LVDS scaler - UNSUPPORTED\n");
}
if (temp > upperlimitlvds) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c
index 7a731e9d3..01d92ec63 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c,v 1.23 2003/08/10 21:25:38 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c,v 1.24 2003/08/28 13:21:09 twini Exp $ */
/*
* Xv driver for SiS 300, 315 and 330 series.
*
@@ -1515,7 +1515,8 @@ SISSetPortAttribute(ScrnInfoPtr pScrn, Atom attribute,
if(pSiS->xv_sisdirectunlocked) {
pSiS->xv_sd_result = (value & 0xffffff00);
if(SISCheckModeIndexForCRT2Type(pScrn, (unsigned short)(value & 0xff),
- (unsigned short)((value >> 8) & 0xff))) {
+ (unsigned short)((value >> 8) & 0xff),
+ FALSE)) {
pSiS->xv_sd_result |= 0x01;
}
}
@@ -1748,6 +1749,47 @@ SISGetPortAttribute(
return Success;
}
+#if 0 /* For future use */
+static int
+SiSHandleSiSDirectCommand(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv, sisdirectcommand *sdcbuf)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+ int i;
+ unsigned long j;
+
+ if(sdcbuf->sdc_id != SDC_ID) return BadMatch;
+
+ j = sdcbuf->sdc_header;
+ j += sdcbuf->sdc_command;
+ for(i = 0; i < SDC_NUM_PARM; i++) {
+ j += sdcbuf->sdc_parm[i];
+ }
+ if(j != sdcbuf->sdc_chksum) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "SiS Direct: Bad packet checksum\n");
+ return BadMatch;
+ }
+ sdcbuf->sdc_header = SDC_RESULT_OK;
+ switch(sdcbuf->sdc_command) {
+ case SDC_CMD_GETVERSION:
+ sdcbuf->sdc_parm[0] = SDC_VERSION;
+ break;
+ case SDC_CMD_CHECKMODEFORCRT2:
+ j = sdcbuf->sdc_parm[0];
+ sdcbuf->sdc_parm[0] = 0;
+ if(SISCheckModeIndexForCRT2Type(pScrn, (unsigned short)(j & 0xff),
+ (unsigned short)((j >> 8) & 0xff),
+ FALSE)) {
+ sdcbuf->sdc_parm[0] = 1;
+ }
+ break;
+ default:
+ sdcbuf->sdc_header = SDC_RESULT_UNDEFCMD;
+ }
+
+ return Success;
+}
+#endif
+
static void
SISQueryBestSize(
ScrnInfoPtr pScrn,
@@ -3349,6 +3391,12 @@ SISPutImage(
int depth = pSiS->CurrentLayout.bitsPerPixel >> 3;
int myreds[] = { 0x000000ff, 0x0000f800, 0, 0x00ff0000 };
+#if 0
+ if(id == SDC_ID) {
+ return(SiSHandleSiSDirectCommand(pScrn, pPriv, (sisdirectcommand *)buf));
+ }
+#endif
+
if(pPriv->grabbedByV4L)
return Success;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/vgatypes.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/vgatypes.h
index 1a1cc4297..a5ec3108f 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/vgatypes.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/vgatypes.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/vgatypes.h,v 1.8 2003/06/26 22:35:19 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/vgatypes.h,v 1.9 2003/08/26 20:40:24 twini Exp $ */
/*
* General type definitions for universal mode switching modules
*
@@ -148,6 +148,7 @@ typedef enum _SIS_VB_CHIP_TYPE {
VB_CHIP_302,
VB_CHIP_302B,
VB_CHIP_302LV,
+ VB_CHIP_301C,
VB_CHIP_UNKNOWN, /* other video bridge or no video bridge */
MAX_VB_CHIP
} SIS_VB_CHIP_TYPE;