summaryrefslogtreecommitdiff
path: root/xc/programs/Xserver
diff options
context:
space:
mode:
authoranholt <anholt>2003-08-27 00:59:01 +0000
committeranholt <anholt>2003-08-27 00:59:01 +0000
commit9ba8f9b5df3408efc828cce350ae41bc3a8b400f (patch)
treec19fc2c44ee4df22ff77b663eafefe228136165e /xc/programs/Xserver
parent34f950d7967b242c623dfbf443b64289072edf40 (diff)
Merge from XFree86 CVS.
Diffstat (limited to 'xc/programs/Xserver')
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/init.c251
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/init.h26
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c128
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h14
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h12
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h78
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h8
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.c1078
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.h571
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c24
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c350
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h29
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c297
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h15
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c173
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/vstruct.h5
16 files changed, 2173 insertions, 886 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/init.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/init.c
index a026af376..50dced605 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.13 2003/07/28 12:39:45 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.c,v 1.15 2003/08/26 14:29:35 twini Exp $ */
/*
* Mode switching code (CRT1 section) for
* SiS 300/540/630/730/315/550/650/M650/651/M652/740/330/660/M660/760
@@ -80,8 +80,10 @@ BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
#pragma alloc_text(PAGE,SiSInit)
#endif
+#ifndef LINUX_XF86
static ULONG GetDRAMSize(SiS_Private *SiS_Pr,
PSIS_HW_DEVICE_INFO HwDeviceExtension);
+#endif
static void
InitCommonPointer(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
@@ -1801,18 +1803,19 @@ SiS_VerifyMclk(SiS_Private *SiS_Pr, ULONG FBAddr)
}
}
-/* TW: Is this a 315E? */
+/* Is this a 315E? */
int
Is315E(SiS_Private *SiS_Pr)
{
- USHORT data;
-
- data = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x5F);
- if(data & 0x10) return 1;
- else return 0;
+ 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;
}
-/* TW: For 315 only */
+/* For 315 only */
void
SiS_SetDRAMSize_310(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
@@ -1820,15 +1823,6 @@ SiS_SetDRAMSize_310(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
ULONG FBAddr = (ULONG)HwDeviceExtension->pjVideoMemoryAddress;
USHORT data;
-#ifdef SIS301 /* TW: SIS301 ??? */
- /*SiS_SetReg1(SiS_Pr->SiS_P3d4,0x30,0x40); */
-#endif
-#ifdef SIS302 /* TW: SIS302 ??? */
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x30,0x4D); /* alan,should change value */
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x31,0xc0); /* alan,should change value */
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x34,0x3F); /* alan,should change value */
-#endif
-
SiSSetMode(SiS_Pr, HwDeviceExtension, 0x2e);
data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x21);
@@ -1959,33 +1953,35 @@ void SiSRegInit(SiS_Private *SiS_Pr, USHORT BaseAddr)
void
SiSInitPCIetc(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
-/* #ifdef LINUX_XF86 */
- if ((HwDeviceExtension->jChipType == SIS_540)||
- (HwDeviceExtension->jChipType == SIS_630)||
- (HwDeviceExtension->jChipType == SIS_730)||
- (HwDeviceExtension->jChipType == SIS_300)) {
- /* TW: Set - PCI LINEAR ADDRESSING ENABLE (0x80)
- - PCI IO ENABLE (0x20)
- - MMIO ENABLE (0x1)
- */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x20,0xa1);
- /* TW: Enable 2D (0x42) & 3D accelerator (0x18) */
- SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x1E,0xFF,0x5A);
- }
- 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)) {
- /* TW: This seems to be done the same way on these chipsets */
+ switch(HwDeviceExtension->jChipType) {
+ case SIS_300:
+ case SIS_540:
+ case SIS_630:
+ case SIS_730:
+ /* Set - PCI LINEAR ADDRESSING ENABLE (0x80)
+ * - PCI IO ENABLE (0x20)
+ * - MMIO ENABLE (0x1)
+ */
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x20,0xa1);
+ /* Enable 2D (0x42) & 3D accelerator (0x18) */
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x5A);
+ break;
+ case SIS_315H:
+ case SIS_315:
+ case SIS_315PRO:
+ case SIS_650:
+ case SIS_740:
+ case SIS_330:
+ case SIS_660:
+ case SIS_760:
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x20,0xa1);
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x5A);
+ break;
+ case SIS_550:
SiS_SetReg1(SiS_Pr->SiS_P3c4,0x20,0xa1);
- SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x1E,0xFF,0x5A);
+ /* No 3D engine ! */
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x42);
}
-/* #endif */
}
void
@@ -2011,12 +2007,12 @@ SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT
}
#endif
+ switch(HwDeviceExtension->jChipType) {
#ifdef SIS300
- if((HwDeviceExtension->jChipType == SIS_540) ||
- (HwDeviceExtension->jChipType == SIS_630) ||
- (HwDeviceExtension->jChipType == SIS_730))
- {
- /* TW: Check for SiS30x first */
+ case SIS_540:
+ case SIS_630:
+ case SIS_730:
+ /* Check for SiS30x first */
temp = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x00);
if((temp == 1) || (temp == 2)) return;
temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x37);
@@ -2024,62 +2020,58 @@ SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT
if((temp >= 2) && (temp <= 5)) SiS_Pr->SiS_IF_DEF_LVDS = 1;
if(temp == 3) SiS_Pr->SiS_IF_DEF_TRUMPION = 1;
if((temp == 4) || (temp == 5)) {
- /* TW: Save power status (and error check) - UNUSED */
+ /* Save power status (and error check) - UNUSED */
SiS_Pr->SiS_Backup70xx = SiS_GetCH700x(SiS_Pr, 0x0e);
SiS_Pr->SiS_IF_DEF_CH70xx = 1;
}
- }
+ break;
#endif
#ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_550) ||
- (HwDeviceExtension->jChipType == SIS_650) ||
- (HwDeviceExtension->jChipType == SIS_740) ||
- (HwDeviceExtension->jChipType == SIS_330) ||
- (HwDeviceExtension->jChipType == SIS_660) ||
- (HwDeviceExtension->jChipType == SIS_760))
- {
- /* TW: CR37 is different on 315 series */
-#if 0
- if(SiS_Pr->SiS_IF_DEF_FSTN) /* fstn: set CR37=0x04 */
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x37,0x04); /* (fake LVDS bridge) */
-#endif
-
+ case SIS_550:
+ case SIS_650:
+ case SIS_740:
+ case SIS_330:
+ case SIS_660:
+ case SIS_760:
temp=SiS_GetReg1(SiS_Pr->SiS_P3d4,0x37);
temp = (temp & 0x0E) >> 1;
if((temp >= 2) && (temp <= 3)) SiS_Pr->SiS_IF_DEF_LVDS = 1;
- if(temp == 3) {
- SiS_Pr->SiS_IF_DEF_CH70xx = 2;
- }
-
- /* HiVision (HDTV) is done differently now. */
- /* SiS_Pr->SiS_IF_DEF_HiVision = 1; */
- }
+ if(temp == 3) SiS_Pr->SiS_IF_DEF_CH70xx = 2;
+ break;
#endif
+ default:
+ break;
+ }
}
void
SiSInitPtr(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
+ switch(HwDeviceExtension->jChipType) {
#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);
+ case SIS_315H:
+ case SIS_315:
+ case SIS_315PRO:
+ case SIS_550:
+ case SIS_650:
+ case SIS_740:
+ case SIS_330:
+ case SIS_660:
+ case SIS_760:
+ InitTo310Pointer(SiS_Pr, HwDeviceExtension);
+ break;
#endif
-
#ifdef SIS300
- if ((HwDeviceExtension->jChipType == SIS_540) ||
- (HwDeviceExtension->jChipType == SIS_630) ||
- (HwDeviceExtension->jChipType == SIS_730) ||
- (HwDeviceExtension->jChipType == SIS_300))
- InitTo300Pointer(SiS_Pr, HwDeviceExtension);
+ case SIS_300:
+ case SIS_540:
+ case SIS_630:
+ case SIS_730:
+ InitTo300Pointer(SiS_Pr, HwDeviceExtension);
+ break;
#endif
+ default:
+ break;
+ }
}
void
@@ -2641,9 +2633,11 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT Mod
SiS_SetHiVision(SiS_Pr,BaseAddr,HwDeviceExtension);
SiS_GetLCDResInfo(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension);
- /* 3. Check memory size */
+#ifndef LINUX_XF86
+ /* 3. Check memory size (Kernel framebuffer driver only) */
temp = SiS_CheckMemorySize(SiS_Pr,ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex);
if(!temp) return(0);
+#endif
if(HwDeviceExtension->jChipType >= SIS_315H) {
if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17) & 0x08) {
@@ -3098,6 +3092,7 @@ SiS_SearchVBModeID(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT *ModeNo)
return ((BOOLEAN)ModeIdIndex);
}
+#ifndef LINUX_XF86
BOOLEAN
SiS_CheckMemorySize(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
USHORT ModeNo,USHORT ModeIdIndex)
@@ -3125,6 +3120,7 @@ SiS_CheckMemorySize(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDe
if(temp < memorysize) return(FALSE);
else return(TRUE);
}
+#endif
UCHAR
SiS_GetModePtr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
@@ -4150,6 +4146,7 @@ SiS_WriteDAC(SiS_Private *SiS_Pr, USHORT DACData, USHORT shiftflag,
SiS_SetReg3(DACData,(USHORT)bl);
}
+#ifndef LINUX_XF86
static ULONG
GetDRAMSize(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
@@ -4158,11 +4155,11 @@ GetDRAMSize(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
USHORT counter;
#endif
+ switch(HwDeviceExtension->jChipType) {
#ifdef SIS315H
- if ((HwDeviceExtension->jChipType == SIS_315H) ||
- (HwDeviceExtension->jChipType == SIS_315) ||
- (HwDeviceExtension->jChipType == SIS_315PRO)) {
-
+ case SIS_315H:
+ case SIS_315:
+ case SIS_315PRO:
counter = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
AdapterMemorySize = 1 << ((counter & 0xF0) >> 4);
counter >>= 2;
@@ -4173,9 +4170,9 @@ GetDRAMSize(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
AdapterMemorySize <<= 1; /* SINGLE_CHANNEL_2_RANK or DUAL_CHANNEL_1_RANK */
}
AdapterMemorySize *= (1024*1024);
+ break;
- } else if(HwDeviceExtension->jChipType == SIS_330) {
-
+ case SIS_330:
counter = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
AdapterMemorySize = 1 << ((counter & 0xF0) >> 4);
counter &= 0x0c;
@@ -4183,35 +4180,37 @@ GetDRAMSize(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
AdapterMemorySize <<= 1;
}
AdapterMemorySize *= (1024*1024);
+ break;
- } else if((HwDeviceExtension->jChipType == SIS_550) ||
- (HwDeviceExtension->jChipType == SIS_740) ||
- (HwDeviceExtension->jChipType == SIS_650) ||
- (HwDeviceExtension->jChipType == SIS_660) ||
- (HwDeviceExtension->jChipType == SIS_760)) {
-
+ case SIS_550:
+ case SIS_650:
+ case SIS_740:
+ case SIS_660:
+ case SIS_760:
counter = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14) & 0x3F;
counter++;
AdapterMemorySize = counter * 4;
AdapterMemorySize *= (1024*1024);
- }
+ break;
#endif
#ifdef SIS300
- if ((HwDeviceExtension->jChipType==SIS_300) ||
- (HwDeviceExtension->jChipType==SIS_540) ||
- (HwDeviceExtension->jChipType==SIS_630) ||
- (HwDeviceExtension->jChipType==SIS_730)) {
-
+ case SIS_300:
+ case SIS_540:
+ case SIS_630:
+ case SIS_730:
AdapterMemorySize = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14) & 0x3F;
AdapterMemorySize++;
AdapterMemorySize *= (1024*1024);
-
- }
+ break;
#endif
+ default:
+ break;
+ }
return AdapterMemorySize;
}
+#endif
#ifndef LINUX_XF86
void
@@ -4540,46 +4539,6 @@ SiS_DoCalcDelay(SiS_Private *SiS_Pr, USHORT MCLK, USHORT VCLK, USHORT colordepth
return((USHORT)longtemp);
}
-#if 0 /* TW: Old fragment, unused */
-USHORT
-SiS_CalcDelay(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT key)
-{
- USHORT data,data2,temp0,temp1;
- UCHAR ThLowA[]= {61,3,52,5,68,7,100,11,
- 43,3,42,5,54,7, 78,11,
- 34,3,37,5,47,7, 67,11};
-
- UCHAR ThLowB[]= {81,4,72,6,88,8,120,12,
- 55,4,54,6,66,8, 90,12,
- 42,4,45,6,55,8, 75,12};
-
- UCHAR ThTiming[]= {1,2,2,3,0,1,1,2};
-
- data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16);
- data=data>>6;
- data2=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
- data2=(data2>>4)&0x0C;
- data=data|data2;
- data=data<1;
- if(key==0) {
- temp0=(USHORT)ThLowA[data];
- temp1=(USHORT)ThLowA[data+1];
- } else {
- temp0=(USHORT)ThLowB[data];
- temp1=(USHORT)ThLowB[data+1];
- }
-
- data2=0;
- data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x18);
- if(data&0x02) data2=data2|0x01;
- if(data&0x20) data2=data2|0x02;
- if(data&0x40) data2=data2|0x04;
-
- data=temp1*ThTiming[data2]+temp0;
- return(data);
-}
-#endif
-
void
SiS_SetCRT1FIFO_630(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,
PSIS_HW_DEVICE_INFO HwDeviceExtension,
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/init.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/init.h
index c340c2534..a3587487b 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.15 2003/08/07 12:52:22 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.h,v 1.17 2003/08/26 14:29:35 twini Exp $ */
/*
* Data and prototypes for init.c
*
@@ -2182,6 +2182,7 @@ typedef struct _SiS_PlasmaTables
USHORT vendor;
UCHAR productnum;
USHORT product[5];
+ const char *DDCnames[5];
const char *plasmaname;
UCHAR modenum;
UCHAR plasmamodes[20]; /* | 0x80 = DVI-capable, | 0x40 = analog */
@@ -2289,13 +2290,17 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
#if 0 /* Product IDs missing */
{ 0x38a3, 4,
{ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+ { "", "", "", "", "" },
"NEC PlasmaSync 42VP4/42VP4D/42VP4G/42VP4DG",
- 14, /* All DVI, except 0, 7, 13; 3, 15, 16 unknown */
- { 0|0x40, 1|0xc0, 2|0xc0, 3|0xc0, 4|0xc0, 7|0x40, 9|0xc0,10|0xc0,11|0xc0,12|0xc0,
- 13|0x40,14|0xc0,15|0xc0,16|0xc0, 0 , 0 , 0 , 0 , 0 , 0 }
+ 11, /* All DVI, except 0, 7, 13 */
+ { 0|0x40, 1|0xc0, 2|0xc0, 4|0xc0, 7|0x40, 9|0xc0,10|0xc0,11|0xc0,13|0x40,14|0xc0,
+ 17|0xc0, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
},
+#endif
+#if 0 /* Product IDs missing */
{ 0x38a3, 3,
{ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+ { "", "", "", "", "" },
"NEC PlasmaSync 42PD1/50PD1/50PD2",
5, /* DVI entirely unknown */
{ 0|0x40, 1|0xc0, 2|0xc0, 4|0xc0, 9|0xc0, 0 , 0 , 0 , 0 , 0 ,
@@ -2303,6 +2308,7 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
},
{ 0x38a3, 1,
{ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+ { "", "", "", "", "" },
"NEC PlasmaSync 42PD3",
10, /* DVI entirely unknown */
{ 0|0x40, 1|0xc0, 2|0xc0, 3|0xc0, 4|0xc0, 5|0xc0, 6|0xc0, 7|0x40, 8|0xc0, 9|0xc0,
@@ -2310,6 +2316,7 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
},
{ 0x38a3, 2,
{ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+ { "", "", "", "", "" },
"NEC PlasmaSync 42VM3/61XM1",
11, /* DVI entirely unknown */
{ 0|0x40, 1|0xc0, 2|0xc0, 3|0xc0, 4|0xc0, 5|0xc0, 6|0xc0, 8|0xc0, 9|0xc0,11|0xc0,
@@ -2317,6 +2324,7 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
},
{ 0x38a3, 2,
{ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+ { "", "", "", "", "" },
"NEC PlasmaSync 42MP1/42MP2",
6, /* DVI entirely unknown */
{ 0|0x40, 1|0xc0, 2|0xc0, 4|0xc0, 9|0xc0,11|0xc0, 0 , 0 , 0 , 0 ,
@@ -2324,6 +2332,7 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
},
{ 0x38a3, 1,
{ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+ { "", "", "", "", "" },
"NEC PlasmaSync 50MP1",
10, /* DVI entirely unknown */
{ 0|0x40, 1|0xc0, 2|0xc0, 4|0xc0, 7|0x40, 9|0xc0,10|0xc0,11|0xc0,13|0x40,14|0xc0,
@@ -2332,6 +2341,7 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
#endif
{ 0x38a3, 4,
{ 0xa482, 0xa483, 0x0000, 0x0000, 0x0000 },
+ { "PX-42VM", "", "", "", "" },
"NEC PlasmaSync 42MP3/42MP4/50MP2/61MP1",
11, /* All DVI except 0, 7, 13, 17 */
{ 0|0x40, 1|0xc0, 2|0xc0, 4|0xc0, 7|0x40, 9|0xc0,10|0xc0,11|0xc0,13|0x40,14|0xc0,
@@ -2340,6 +2350,7 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
#if 0 /* Product IDs missing */
{ 0x38a3, 1,
{ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+ { "", "", "", "", "" },
"NEC PlasmaSync 3300W",
3,
{ 0|0x40, 1|0xc0,18|0xc0, 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
@@ -2347,6 +2358,7 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
},
{ 0x38a3, 1,
{ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+ { "", "", "", "", "" },
"NEC PlasmaSync 4200W",
4, /* DVI entirely unknown */
{ 0|0x40, 1|0xc0, 2|0xc0, 4|0xc0, 0 , 0 , 0 , 0 , 0 , 0 ,
@@ -2354,6 +2366,7 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
},
{ 0x38a3, 1,
{ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+ { "", "", "", "", "" },
"NEC PlasmaSync 4210W",
6, /* DVI entirely unknown */
{ 0|0x40, 1|0xc0, 2|0xc0, 4|0xc0, 9|0xc0,11|0xc0, 0 , 0 , 0 , 0 ,
@@ -2361,6 +2374,7 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
},
{ 0x38a3, 1,
{ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+ { "", "", "", "", "" },
"NEC PlasmaSync 5000W",
7, /* DVI entirely unknown */
{ 0|0x40, 1|0xc0, 2|0xc0, 4|0xc0, 7|0x40, 9|0xc0,11|0xc0, 0 , 0 , 0 ,
@@ -2369,6 +2383,7 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
#endif
{ 0x412f, 2,
{ 0x000c, 0x000b, 0x0000, 0x0000, 0x0000 },
+ { "", "", "", "", "" },
"Pioneer 503CMX/PDA-5002",
6, /* DVI unknown */
{ 1|0xc0, 2|0xc0, 9|0xc0,11|0xc0,12|0xc0,15|0xc0, 0 , 0 , 0 , 0 ,
@@ -2376,6 +2391,7 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
},
{ 0x34a9, 1,
{ 0xa00e, 0x0000, 0x0000, 0x0000, 0x0000 },
+ { "", "", "", "", "" },
"Panasonic TH-42",
5, /* No DVI output */
{ 1|0x40, 2|0x40, 4|0x40, 9|0x40,15|0x40, 0 , 0 , 0 , 0 , 0 ,
@@ -2437,8 +2453,10 @@ 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,
USHORT ModeNo,USHORT ModeIdIndex);
+#endif
UCHAR SiS_GetModePtr(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT ModeNo,USHORT ModeIdIndex);
void SiS_WhatTheHellIsThis(SiS_Private *SiS_Pr,PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr);
void SiS_StrangeStuff(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c
index 2c245fc46..e9ffc557d 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.22 2003/08/07 15:04:41 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c,v 1.23 2003/08/26 14:29:35 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
@@ -107,7 +107,7 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT Mode
((SiS_Pr->SiS_VBType & VB_NoLCD) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) ||
((HwDeviceExtension->jChipType >= SIS_315H) && (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) ) {
SiS_GetLVDSDesData(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
- HwDeviceExtension);
+ HwDeviceExtension, BaseAddr);
} else {
SiS_Pr->SiS_LCDHDES = SiS_Pr->SiS_LCDVDES = 0;
}
@@ -2699,8 +2699,8 @@ SiS_GetMCLK(SiS_Private *SiS_Pr, UCHAR *ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExt
/* Checked against 650/LVDS 1.10.07 BIOS */
void
SiS_GetLVDSDesData(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
- USHORT RefreshRateTableIndex,
- PSIS_HW_DEVICE_INFO HwDeviceExtension)
+ USHORT RefreshRateTableIndex, PSIS_HW_DEVICE_INFO HwDeviceExtension,
+ USHORT BaseAddr)
{
USHORT modeflag;
USHORT PanelIndex,ResIndex;
@@ -2718,7 +2718,7 @@ SiS_GetLVDSDesData(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT Mode
#ifdef SIS315H
SiS_GetLVDSDesPtrA(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
- &PanelIndex,&ResIndex);
+ &PanelIndex,&ResIndex, HwDeviceExtension, BaseAddr);
switch (PanelIndex)
{
@@ -2883,7 +2883,8 @@ SiS_GetLVDSDesPtr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeI
#ifdef SIS315H
void
SiS_GetLVDSDesPtrA(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
- USHORT RefreshRateTableIndex,USHORT *PanelIndex,USHORT *ResIndex)
+ USHORT RefreshRateTableIndex,USHORT *PanelIndex,USHORT *ResIndex,
+ PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
{
USHORT tempbx=0,tempal;
@@ -2895,7 +2896,7 @@ SiS_GetLVDSDesPtrA(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT Mode
if(SiS_Pr->SiS_CustomT == CUT_CLEVO1024) {
if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) {
- if((SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04)) {
+ if(SiS_IsDualLink(SiS_Pr, HwDeviceExtension, BaseAddr)) {
tempbx = 80;
if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++;
}
@@ -3101,7 +3102,7 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT BaseAddr, USHORT ModeNo, USHORT
/* For 302LV dual-channel */
if(HwDeviceExtension->jChipType >= SIS_315H) {
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
- if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04)
+ if(SiS_IsDualLink(SiS_Pr, HwDeviceExtension, BaseAddr))
tempah |= 0x40;
}
}
@@ -4108,7 +4109,8 @@ SiS_GetCRT2PtrA(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdI
void
SiS_GetCRT2Part2Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,USHORT *CRT2Index,
- USHORT *ResIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension)
+ USHORT *ResIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension,
+ USHORT BaseAddr)
{
USHORT tempbx,tempal;
@@ -4131,7 +4133,7 @@ SiS_GetCRT2Part2Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT Mod
}
} else if(SiS_Pr->SiS_CustomT == CUT_CLEVO1024) {
if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) {
- if((SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04)) {
+ if(SiS_IsDualLink(SiS_Pr, HwDeviceExtension, BaseAddr)) {
tempbx = 103;
if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx = 104;
else if(SiS_Pr->SiS_SetFlag & LCDVESATiming) tempbx = 105;
@@ -6501,6 +6503,20 @@ SiS_IsVAMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT
} else
#endif
return(0);
+}
+
+BOOLEAN
+SiS_IsDualLink(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
+{
+#ifdef SIS315H
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if((SiS_CRT2IsLCD(SiS_Pr, BaseAddr, HwDeviceExtension)) ||
+ (SiS_IsVAMode(SiS_Pr, HwDeviceExtension, BaseAddr))) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04) return(1);
+ }
+ }
+#endif
+ return(0);
}
BOOLEAN
@@ -6628,16 +6644,6 @@ SiS_IsLCDOrLCDA(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHO
}
BOOLEAN
-SiS_IsDisableCRT2(SiS_Private *SiS_Pr, USHORT BaseAddr)
-{
- USHORT flag;
-
- flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30);
- if(flag & 0x20) return(0);
- else return(1);
-}
-
-BOOLEAN
SiS_BridgeIsOn(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT flag;
@@ -6732,6 +6738,14 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,
}
}
+#ifdef SIS315H
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x39,~0x04);
+ }
+ }
+#endif
+
if(!(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))) return;
if(!(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2))) return;
@@ -6935,26 +6949,22 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,
}
#ifdef SIS315H
- /* 650/30xLV 1.10.6s */
if(HwDeviceExtension->jChipType >= SIS_315H) {
- if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
- SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x39,~0x04);
- if(SiS_Pr->SiS_VBType & (VB_SIS302B | VB_SIS302LV)) {
- /* Enable 302B/302LV dual link mode.
- * (302B is a theory - not in any BIOS)
- */
- if(SiS_Pr->SiS_CustomT == CUT_CLEVO1024) {
- if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) {
- /* (Sets this in SenseLCD; new paneltypes) */
- SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x39,0x04);
- }
- }
- if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) ||
- (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) ||
- (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200)) {
+ if(SiS_Pr->SiS_VBType & (VB_SIS302B | VB_SIS302LV)) {
+ /* Enable 302B/302LV dual link mode.
+ * (302B is a theory - not in any BIOS)
+ */
+ if(SiS_Pr->SiS_CustomT == CUT_CLEVO1024) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) {
+ /* (Sets this in SenseLCD; new paneltypes) */
SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x39,0x04);
}
}
+ if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) ||
+ (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) ||
+ (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200)) {
+ SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x39,0x04);
+ }
}
}
#endif
@@ -7440,10 +7450,8 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr, USHORT ModeNo
tempcx = SiS_Pr->SiS_HT;
/* 650/30xLV 1.10.6s */
- if(HwDeviceExtension->jChipType >= SIS_315H) {
- if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04) {
- tempcx >>= 1;
- }
+ if(SiS_IsDualLink(SiS_Pr, HwDeviceExtension, BaseAddr)) {
+ tempcx >>= 1;
}
tempcx--;
@@ -7760,10 +7768,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr, USHORT ModeNo
/* From here: Part2 LCD setup */
tempbx = SiS_Pr->SiS_HDE;
- if(HwDeviceExtension->jChipType >= SIS_315H) {
- /* 650/30xLV 1.10.6s */
- if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04) tempbx >>= 1;
- }
+ if(SiS_IsDualLink(SiS_Pr, HwDeviceExtension, BaseAddr)) tempbx >>= 1;
tempbx--; /* RHACTE=HDE-1 */
temp = tempbx & 0x00FF;
SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2C,temp);
@@ -7865,7 +7870,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr, USHORT ModeNo
*/
SiS_GetCRT2Part2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
- &CRT2Index,&resindex,HwDeviceExtension);
+ &CRT2Index,&resindex,HwDeviceExtension,BaseAddr);
switch(CRT2Index) {
case Panel_1024x768 : CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_1; break; /* "Normal" */
@@ -8350,7 +8355,7 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo
if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
/* From 650/301LV (any, incl. 1.10.6s, 1.10.7w) */
/* This is a duplicate; done at the end, too */
- if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04) {
+ if(SiS_IsDualLink(SiS_Pr, HwDeviceExtension, BaseAddr)) {
SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x2c);
}
SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x2a,0x00);
@@ -8414,9 +8419,8 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo
temp = 0;
if(SiS_Pr->SiS_VGAHDE == 1024) temp = 0x20;
}
- if(HwDeviceExtension->jChipType >= SIS_315H) {
- if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04) temp = 0;
- }
+
+ if(SiS_IsDualLink(SiS_Pr, HwDeviceExtension, BaseAddr)) temp = 0;
if(SiS_Pr->SiS_VBType & VB_SIS301) {
if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024)
@@ -8467,7 +8471,7 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo
if(modeflag & HalfDCLK) tempax >>= 1;
if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) || (SiS_Pr->SiS_HiVision & 0x03)) {
if(HwDeviceExtension->jChipType >= SIS_315H) {
- if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04) tempax >>= 1;
+ if(SiS_IsDualLink(SiS_Pr, HwDeviceExtension, BaseAddr)) tempax >>= 1;
else if(tempax > 800) tempax -= 800;
} else {
if(tempax > 800) tempax -= 800;
@@ -8522,9 +8526,7 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x1F,0xC0,temp);
tempbx = SiS_Pr->SiS_HT;
- if(HwDeviceExtension->jChipType >= SIS_315H) {
- if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04) tempbx >>= 1;
- }
+ if(SiS_IsDualLink(SiS_Pr, HwDeviceExtension, BaseAddr)) tempbx >>= 1;
tempbx >>= 1;
tempbx -= 2;
temp = ((tempbx & 0x0700) >> 8) << 3;
@@ -8544,7 +8546,7 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo
/* 315, 330, 650+301B BIOS don't do this at all */
/* This is a duplicate; done for LCDA as well (see above) */
if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
- if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04) {
+ if(SiS_IsDualLink(SiS_Pr, HwDeviceExtension, BaseAddr)) {
SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x2c);
}
SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x2a,0x00);
@@ -11835,6 +11837,24 @@ 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->SiS_VBInfo & SetCRT2ToLCDA) {
+ tempch = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x36) >> 4;
+ if(tempch == 3) {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,0x02);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1b,0x25);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1c,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1d,0x1b);
+ }
+ }
+ return;
+ }
+ }
+ }
+
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) {
SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x2a,0x00);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h
index 55fe52ff2..b5d0c8375 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.17 2003/07/28 12:39:46 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h,v 1.19 2003/08/26 14:29:36 twini Exp $ */
/*
* Data and prototypes for init301.c
*
@@ -124,9 +124,9 @@ extern BOOLEAN SiS_SearchVBModeID(SiS_Private *SiS_Pr, UCHAR *RomAddr, USHORT
BOOLEAN SiS_Is301B(SiS_Private *SiS_Pr, USHORT BaseAddr);
BOOLEAN SiS_IsNotM650or651(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
-BOOLEAN SiS_IsDisableCRT2(SiS_Private *SiS_Pr, USHORT BaseAddr);
BOOLEAN SiS_IsVAMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
BOOLEAN SiS_IsDualEdge(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
+BOOLEAN SiS_IsDualLink(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
BOOLEAN SiS_CRT2IsLCD(SiS_Private *SiS_Pr, USHORT BaseAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
void SiS_SetDefCRT2ExtRegs(SiS_Private *SiS_Pr, USHORT BaseAddr);
USHORT SiS_GetRatePtrCRT2(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT ModeNo,USHORT ModeIdIndex,
@@ -144,7 +144,7 @@ void SiS_GetCRT2PtrA(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHOR
#endif
void SiS_GetCRT2Part2Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,USHORT *CRT2Index, USHORT *ResIndex,
- PSIS_HW_DEVICE_INFO HwDeviceExtension);
+ PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
void SiS_GetCRT2Data301(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension);
USHORT SiS_GetResInfo(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
@@ -159,7 +159,8 @@ void SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT BaseAddr,USHORT ModeNo,
PSIS_HW_DEVICE_INFO );
void SiS_SetHiVision(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension);
void SiS_GetLVDSDesData(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
- USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension);
+ USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension,
+ USHORT BaseAddr);
void SiS_SetCRT2Offset(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension);
USHORT SiS_GetOffset(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
@@ -210,9 +211,10 @@ void SiS_SetCRT2ECLK(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT ModeNo,USHO
void SiS_GetLVDSDesPtr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,USHORT *PanelIndex,USHORT *ResIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension);
-#ifdef SIS315H
+#ifdef SIS315H
void SiS_GetLVDSDesPtrA(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
- USHORT RefreshRateTableIndex,USHORT *PanelIndex,USHORT *ResIndex);
+ USHORT RefreshRateTableIndex,USHORT *PanelIndex,USHORT *ResIndex,
+ PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
#endif
void SiS_SetTPData(SiS_Private *SiS_Pr);
void SiS_SetChrontelGPIO(SiS_Private *SiS_Pr, USHORT myvbinfo);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h
index 285e4e4ba..8f1744b5b 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.15 2003/06/26 22:35:17 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h,v 1.16 2003/08/23 10:25:18 twini Exp $ */
/*
* Global definitions for init.c and init301.c
*
@@ -54,13 +54,16 @@
#define VB_SIS301B302B (VB_SIS301B|VB_SIS302B)
#define VB_SIS301LV302LV (VB_SIS301LV|VB_SIS302LV)
-#define IS_SIS650 (HwDeviceExtension->jChipType == SIS_650)
-#define IS_SIS740 (HwDeviceExtension->jChipType == SIS_740)
#define IS_SIS330 (HwDeviceExtension->jChipType == SIS_330)
#define IS_SIS550 (HwDeviceExtension->jChipType == SIS_550)
+#define IS_SIS650 (HwDeviceExtension->jChipType == SIS_650)
+#define IS_SIS740 (HwDeviceExtension->jChipType == SIS_740)
#define IS_SIS651 (SiS_Pr->SiS_SysFlags & (SF_Is651 | SF_Is652))
#define IS_SISM650 (SiS_Pr->SiS_SysFlags & (SF_IsM650 | SF_IsM652 | SF_IsM653))
+#define IS_SIS661 (SiS_Pr->SiS_SysFlags & (SF_Is661 | SF_IsM651))
+#define IS_SIS741 (SiS_Pr->SiS_SysFlags & SF_IsM741)
#define IS_SIS65x (IS_SIS651 || IS_SISM650)
+#define IS_SIS661741 (SiS_Pr->SiS_SysFlags & (SF_Is661 | SF_IsM661 | SF_Is741))
#define IS_SIS660 (HwDeviceExtension->jChipType == SIS_660)
#define IS_SIS760 (HwDeviceExtension->jChipType == SIS_760)
#define IS_SIS650660 (IS_SIS650 || IS_SIS660)
@@ -160,6 +163,9 @@
#define SF_Is652 0x0004
#define SF_IsM652 0x0008
#define SF_IsM653 0x0010
+#define SF_Is661 0x0020
+#define SF_IsM661 0x0040
+#define SF_Is741 0x0080
#define SF_Is660 0x8000
#define PanelRGB18Bit 0x0100
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h
index 00aed5b4c..850f4eb56 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.42 2003/08/10 21:25:37 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h,v 1.47 2003/08/26 16:38:01 twini Exp $ */
/*
* Main global data and definitions
*
@@ -36,7 +36,7 @@
#define SISDRIVERVERSIONYEAR 3
#define SISDRIVERVERSIONMONTH 8
-#define SISDRIVERVERSIONDAY 10
+#define SISDRIVERVERSIONDAY 26
#define SISDRIVERREVISION 1
#define SISDRIVERIVERSION (SISDRIVERVERSIONYEAR << 16) | (SISDRIVERVERSIONMONTH << 8) \
@@ -115,6 +115,12 @@ typedef unsigned long IOADDRESS;
#endif
#endif
+#if 1
+#define SISVRAMQ /* Use VRAM queue mode on 315 series */
+#endif
+
+#undef SIS315DRI /* define this if dri is adapted for 315/330 series */
+
/* For SiS315/550/650/740/330/660 - these should be moved elsewhere! */
#ifndef PCI_CHIP_SIS315H
#define PCI_CHIP_SIS315H 0x0310
@@ -135,7 +141,7 @@ typedef unsigned long IOADDRESS;
#define PCI_CHIP_SIS330 0x0330
#endif
#ifndef PCI_CHIP_SIS660
-#define PCI_CHIP_SIS660 0x6330 /* 660_VGA and 760_VGA */
+#define PCI_CHIP_SIS660 0x6330 /* 660_VGA and 760_VGA (obviously DOA) */
#endif
#define SIS_NAME "SIS"
@@ -267,6 +273,9 @@ typedef unsigned long IOADDRESS;
#define PDEBUG(p)
#endif
+#define BITMASK(h,l) (((unsigned)(1U << ((h)-(l)+1))-1)<<(l))
+#define GENMASK(mask) BITMASK(1?mask,0?mask)
+
typedef unsigned long ULong;
typedef unsigned short UShort;
typedef unsigned char UChar;
@@ -305,9 +314,14 @@ typedef unsigned char UChar;
#define SiSCF_IsM652 0x00000008
#define SiSCF_IsM653 0x00000010
#define SiSCF_Is652 0x00000020
-#define SiSCF_Is65x (SiSCF_Is651 | SiSCF_IsM650 | SiSCF_IsM652 | SiSCF_IsM653 | SiSCF_Is652)
-#define SiSCF_IsM660 0x00000100
-#define SiSCF_IsM760 0x00000200
+#define SiSCF_Is661FX 0x00000040
+#define SiSCF_IsM661FX 0x00000080
+#define SiSCF_Is661 (SiSCF_Is661FX | SiSCF_IsM661FX)
+#define SiSCF_Is741 0x00000100
+#define SiSCF_Is65x (SiSCF_Is651|SiSCF_IsM650|SiSCF_IsM652|SiSCF_IsM653| \
+ SiSCF_Is652|SiSCF_Is661FX|SiSCF_IsM661FX|SiSCF_Is741)
+#define SiSCF_IsM660 0x00000200
+#define SiSCF_IsM760 0x00000400
#define SiSCF_Is66x (SiSCF_IsM660 | SiSCF_IsM760)
#define SiSCF_XabreCore 0x00010000
#define SiSCF_Glamour3 0x40000000
@@ -387,6 +401,23 @@ typedef struct {
ScrnInfoPtr pScrn_2;
unsigned char * BIOS;
SiS_Private * SiS_Pr;
+ unsigned long agpHandle;
+ CARD32 agpAddr;
+ unsigned char *agpBase;
+ unsigned int agpSize;
+ CARD32 agpCmdBufAddr; /* 300 series */
+ unsigned char *agpCmdBufBase;
+ unsigned int agpCmdBufSize;
+ unsigned int agpCmdBufFree;
+ CARD32 agpVtxBufAddr; /* 315 series */
+ unsigned char *agpVtxBufBase;
+ unsigned int agpVtxBufSize;
+ unsigned int agpVtxBufFree;
+#ifdef XF86DRI
+ sisRegion agp;
+ int drmSubFD;
+#endif
+ Bool AGPInitOK;
int CRT1ModeNo; /* Current display mode for CRT1 */
DisplayModePtr CRT1DMode; /* Current display mode for CRT1 */
int CRT2ModeNo; /* Current display mode for CRT2 */
@@ -459,6 +490,7 @@ typedef struct {
int UsePanelScaler;
int AllowHotkey;
BOOLEAN enablesisctrl;
+ unsigned long cmdQ_SharedWritePort_2D;
#ifdef SIS_CP
SIS_CP_H_ENT
#endif
@@ -563,6 +595,8 @@ typedef struct {
CARD32 AccelFlags;
Bool ClipEnabled;
Bool DoColorExpand;
+ Bool ColorExpandBusy;
+ Bool alphaBlitBusy;
SISRegRec SavedReg;
SISRegRec ModeReg;
xf86CursorInfoPtr CursorInfoPtr;
@@ -583,19 +617,43 @@ typedef struct {
void (*LoadCRT2Palette)(ScrnInfoPtr pScrn, int numColors,
int *indicies, LOCO *colors, VisualPtr pVisual);
- int cmdQueueLen; /* Current cmdQueueLength (for 2D and 3D) */
- int *cmdQueueLenPtr;
+ int cmdQueueLen; /* Current cmdQueueLength (for 2D and 3D) */
+ unsigned long cmdQueueLenMax;
+ unsigned long cmdQueueLenMin;
+ unsigned long *cmdQueueBase;
+ int *cmdQueueLenPtr; /* Ptr to variable holding the current queue length */
+ int *cmdQueueLenPtrBackup; /* Backup for DRI init/restore */
+ unsigned int cmdQueueOffset;
+ unsigned int cmdQueueSize;
+ unsigned long cmdQueueSizeMask;
+ unsigned long cmdQ_SharedWritePort_2D;
+ unsigned long *cmdQ_SharedWritePort;
+ unsigned long *cmdQ_SharedWritePortBackup;
+ unsigned int cmdQueueSize_div2;
+ unsigned int cmdQueueSize_div4;
+ unsigned int cmdQueueSize_4_3;
unsigned long agpHandle;
CARD32 agpAddr;
unsigned char *agpBase;
unsigned int agpSize;
- CARD32 agpCmdBufAddr;
+ CARD32 agpCmdBufAddr; /* 300 series */
unsigned char *agpCmdBufBase;
unsigned int agpCmdBufSize;
unsigned int agpCmdBufFree;
+ CARD32 agpVtxBufAddr; /* 315 series */
+ unsigned char *agpVtxBufBase;
+ unsigned int agpVtxBufSize;
+ unsigned int agpVtxBufFree;
+#ifdef XF86DRI
+ sisRegion agp;
+#endif
+ Bool AGPInitOK;
Bool irqEnabled;
int irq;
+ void (*RenderCallback)(ScrnInfoPtr);
+ Time RenderTime;
+
int ColorExpandRingHead;
int ColorExpandRingTail;
int PerColorExpandBufferSize;
@@ -603,6 +661,7 @@ typedef struct {
int ColorExpandBufferCountMask;
unsigned char *ColorExpandBufferAddr[32];
int ColorExpandBufferScreenOffset[32];
+ long ColorExpandBase;
int ImageWriteBufferSize;
unsigned char *ImageWriteBufferAddr;
@@ -699,6 +758,7 @@ typedef struct {
int sis6326yfilterstrong;
int sis6326tvplug;
int sis6326fscadjust;
+ BOOL sisfbfound;
BOOL donttrustpdc; /* Don't trust the detected PDC */
unsigned char sisfbpdc;
unsigned char sisfblcda;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h
index 308da24b7..3cc5a6607 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h,v 1.12 2003/06/28 14:03:13 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h,v 1.13 2003/08/23 10:25:19 twini Exp $ */
/*
* 2D Acceleration for SiS300, SiS540, SiS630, SiS730, SiS530, SiS620
* Definitions for the SIS engine communication
@@ -103,9 +103,11 @@
*/
-/* TW: BR(16)+2 = 0x8242 */
+/* BR(16)+2 = 0x8242 */
-#define CmdQueLen pSiS->cmdQueueLen
+/* As sis_dri.c relocated the cmd-q len to the sarea, don't use it directly here */
+/* #define CmdQueLen pSiS->cmdQueueLen */
+#define CmdQueLen (*(pSiS->cmdQueueLenPtr))
#define SiSIdle \
{ \
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 566a1740a..a3b6e68ca 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.9 2003/08/07 12:52:23 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.c,v 1.12 2003/08/26 16:38:01 twini Exp $ */
/*
* 2D Acceleration for SiS 315 and Xabre series
* (315/550/650/740/M650/651/652/M652/330/660/M660/760/M760)
@@ -24,6 +24,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*
* Based on sis300_accel.c
+ * 2003/08/18: Rewritten for using VRAM command queue (TW)
*
* Author: Thomas Winischhofer <thomas@winischhofer.net>
*
@@ -49,28 +50,35 @@
#define HEADOFFSET (pSiS->dhmOffset)
#endif
-#undef TRAP /* Use/Don't use Trapezoid Fills
- * DOES NOT WORK. XAA eventually provides illegal
- * trapezoid data (left and right edges cross each
+#undef TRAP /* Use/Don't use Trapezoid Fills
+ * DOES NOT WORK. XAA sometimes provides illegal
+ * trapezoid data (left and right edges cross each
* other) which causes drawing errors. Since
* checking the trapezoid for such a case is very
* time-intensive, it is faster to let it be done
* by the generic polygon functions.
+ * Does not work on XABRE at all, hangs the engine.
+ * Even with correct trapezoids, this is slower than
+ * doing it by the CPU.
*/
-#define CTSCE /* Use/Don't use CPUToScreenColorExpand. Slower than the
- * CPU sometimes, so we disable this on SiS650/740 where
- * we know that we're running on a P4.
+#undef CTSCE /* Use/Don't use CPUToScreenColorExpand. Disabled
+ * because it is slower than doing it by the CPU.
+ * Indirect mode does not work in VRAM queue mode.
+ * Does not work on Xabre (even in MMIO mode).
+ */
+#define CTSCE_DIRECT /* Use direct method - This works (on both 315 and Xabre at
+ * least in VRAM queue mode) but we don't use this either,
+ * because it's slower than doing it by the CPU. (Using it
+ * would require defining CTSCE)
+ */
+
+#undef STSCE /* Use/Don't use ScreenToScreenColorExpand - does not work,
+ * see comments below.
*/
-#undef INCL_RENDER /* Use/Don't use RENDER extension acceleration
- * DOES NOT WORK. The hardware does not support
- * ARGB textures, but Alpha Blended BitBlits with
- * a static alpha value only. This is completely
- * useless as XFree does not provide any environment
- * for such a function. The code is kept regardless
- * as XFree 5 might support translucent windows where
- * this function could make sense.
+#undef INCL_RENDER /* Use/Don't use RENDER extension acceleration
+ * Should work, but how do I test this?
*/
#ifdef INCL_RENDER
@@ -123,7 +131,23 @@ static void SiSSubsequentMonoPatternFillTrap(ScrnInfoPtr pScrn,
int left, int dxL, int dyL, int eL,
int right, int dxR, int dyR, int eR);
#endif
+#ifdef STSCE
+static void SiSSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn,
+ int fg, int bg,
+ int rop, unsigned int planemask);
+static void SiSSubsequentScreenToScreenColorExpand(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ int srcx, int srcy, int skipleft);
+#endif
#ifdef CTSCE
+#ifdef CTSCE_DIRECT
+static void SiSSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask);
+static void SiSSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ int skipleft);
+#else
static void SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
int fg, int bg, int rop,
unsigned int planemask);
@@ -132,6 +156,7 @@ static void SiSSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
int skipleft);
static void SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno);
#endif
+#endif
#ifdef INCL_RENDER
#ifdef RENDER
extern Bool SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
@@ -168,12 +193,14 @@ SiSInitializeAccelerator(ScrnInfoPtr pScrn)
SISPtr pSiS = SISPTR(pScrn);
pSiS->DoColorExpand = FALSE;
+ pSiS->alphaBlitBusy = FALSE;
+#ifndef SISVRAMQ
if(pSiS->ChipFlags & SiSCF_Integrated) {
- /* CmdQueLen = ((128 * 1024) / 4) - 64; - decreases system latecy dramatically */
CmdQueLen = 0;
} else {
- CmdQueLen = ((128 * 1024) / 4) - 64;
+ CmdQueLen = ((128 * 1024) / 4) - 64;
}
+#endif
}
Bool
@@ -187,7 +214,11 @@ SiS315AccelInit(ScreenPtr pScreen)
int UsableFbSize;
unsigned char *AvailBufBase;
BoxRec Avail;
+#ifdef CTSCE
+#ifndef CTSCE_DIRECT
int i;
+#endif
+#endif
pSiS->AccelInfoPtr = infoPtr = XAACreateInfoRec();
if (!infoPtr)
@@ -215,7 +246,10 @@ SiS315AccelInit(ScreenPtr pScreen)
infoPtr->SetupForSolidFill = SiSSetupForSolidFill;
infoPtr->SubsequentSolidFillRect = SiSSubsequentSolidFillRect;
#ifdef TRAP
- infoPtr->SubsequentSolidFillTrap = SiSSubsequentSolidFillTrap;
+ if((pSiS->Chipset != PCI_CHIP_SIS660) &&
+ (pSiS->Chipset != PCI_CHIP_SIS330)) {
+ infoPtr->SubsequentSolidFillTrap = SiSSubsequentSolidFillTrap;
+ }
#endif
infoPtr->SolidFillFlags = NO_PLANEMASK;
@@ -236,7 +270,10 @@ SiS315AccelInit(ScreenPtr pScreen)
infoPtr->SetupForMono8x8PatternFill = SiSSetupForMonoPatternFill;
infoPtr->SubsequentMono8x8PatternFillRect = SiSSubsequentMonoPatternFill;
#ifdef TRAP
- infoPtr->SubsequentMono8x8PatternFillTrap = SiSSubsequentMonoPatternFillTrap;
+ if((pSiS->Chipset != PCI_CHIP_SIS660) &&
+ (pSiS->Chipset != PCI_CHIP_SIS330)) {
+ infoPtr->SubsequentMono8x8PatternFillTrap = SiSSubsequentMonoPatternFillTrap;
+ }
#endif
infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK |
HARDWARE_PATTERN_SCREEN_ORIGIN |
@@ -244,9 +281,12 @@ SiS315AccelInit(ScreenPtr pScreen)
NO_TRANSPARENCY |
BIT_ORDER_IN_BYTE_MSBFIRST ;
-#if 0
+#ifdef STSCE
/* Screen To Screen Color Expand */
- /* TW: The hardware does not support this the way we need it */
+ /* The hardware does not support this the way we need it, because
+ * the mono-bitmap is not provided with a pitch of (width), but
+ * with a pitch of scrnOffset (= width * bpp / 8).
+ */
infoPtr->SetupForScreenToScreenColorExpandFill =
SiSSetupForScreenToScreenColorExpand;
infoPtr->SubsequentScreenToScreenColorExpandFill =
@@ -255,20 +295,49 @@ SiS315AccelInit(ScreenPtr pScreen)
BIT_ORDER_IN_BYTE_MSBFIRST ;
#endif
- /* per-scanline color expansion - indirect method */
- pSiS->ColorExpandBufferNumber = 16;
- pSiS->ColorExpandBufferCountMask = 0x0F;
- pSiS->PerColorExpandBufferSize = ((pScrn->virtualX + 31)/32) * 4;
#ifdef CTSCE
- /* 650, 740, 660: We don't use this, it's much slower than doing it by the CPU.
- * On 650, 740, 660 we know that we are running on a P4; for other chipsets like
- * 315, we don't. On 550, this should be faster than the CPU in any case.
- * I now disabled this for the Xabre as well; people owning a "high speed 3D" card
- * have presumably CPUs fast enough.
+#ifdef CTSCE_DIRECT
+ /* CPU color expansion - direct method
+ *
+ * We somewhat fake this function here in the following way:
+ * XAA copies its mono-bitmap data not into an aperture, but
+ * into our video RAM buffer. We then do a ScreenToScreen
+ * color expand.
+ * Unfortunately, XAA sends the data to the aperture AFTER
+ * the call to Subsequent(), therefore we do not execute the
+ * command in Subsequent, but in the following call to Sync().
+ * (Hence, the SYNC_AFTER_COLOR_EXPAND flag MUST BE SET)
+ *
+ * This is slower than doing it by the CPU.
*/
+
+ pSiS->ColorExpandBufferNumber = 48;
+ pSiS->PerColorExpandBufferSize = ((pScrn->virtualX + 31)/32) * 4;
+ infoPtr->SetupForCPUToScreenColorExpandFill = SiSSetupForCPUToScreenColorExpandFill;
+ infoPtr->SubsequentCPUToScreenColorExpandFill = SiSSubsequentCPUToScreenColorExpandFill;
+ infoPtr->ColorExpandRange = pSiS->ColorExpandBufferNumber * pSiS->PerColorExpandBufferSize;
+ infoPtr->CPUToScreenColorExpandFillFlags =
+ NO_PLANEMASK |
+ CPU_TRANSFER_PAD_DWORD |
+ SCANLINE_PAD_DWORD |
+ BIT_ORDER_IN_BYTE_MSBFIRST |
+ LEFT_EDGE_CLIPPING |
+ SYNC_AFTER_COLOR_EXPAND;
+#else
+ /* CPU color expansion - per-scanline / indirect method
+ *
+ * SLOW! SLOWER! SLOWEST!
+ *
+ * Does not work on XABRE, hangs the engine (both VRAM and MMIO).
+ * Does not work in VRAM queue mode.
+ */
+#ifndef SISVRAMQ
if((pSiS->Chipset != PCI_CHIP_SIS650) &&
(pSiS->Chipset != PCI_CHIP_SIS660) &&
(pSiS->Chipset != PCI_CHIP_SIS330)) {
+ pSiS->ColorExpandBufferNumber = 16;
+ pSiS->ColorExpandBufferCountMask = 0x0F;
+ pSiS->PerColorExpandBufferSize = ((pScrn->virtualX + 31)/32) * 4;
infoPtr->NumScanlineColorExpandBuffers = pSiS->ColorExpandBufferNumber;
infoPtr->ScanlineColorExpandBuffers = (unsigned char **)&pSiS->ColorExpandBufferAddr[0];
infoPtr->SetupForScanlineCPUToScreenColorExpandFill = SiSSetupForScanlineCPUToScreenColorExpandFill;
@@ -280,30 +349,40 @@ SiS315AccelInit(ScreenPtr pScreen)
SCANLINE_PAD_DWORD |
BIT_ORDER_IN_BYTE_MSBFIRST |
LEFT_EDGE_CLIPPING;
+ } else {
+#endif
+ pSiS->ColorExpandBufferNumber = 0;
+ pSiS->PerColorExpandBufferSize = 0;
+#ifndef SISVRAMQ
}
#endif
+#endif
+#else
+ pSiS->ColorExpandBufferNumber = 0;
+ pSiS->PerColorExpandBufferSize = 0;
+#endif
#ifdef INCL_RENDER
#ifdef RENDER
- /* Render - DOES NOT WORK */
+ /* 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 |
- XAA_RENDER_NO_SRC_ALPHA;
-
+ 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");
}
#endif
-#endif
+#endif
#ifdef SISDUALHEAD
- if (pSiS->DualHeadMode) {
- infoPtr->RestoreAccelState = SiSRestoreAccelState;
+ if(pSiS->DualHeadMode) {
+ infoPtr->RestoreAccelState = SiSRestoreAccelState;
}
#endif
@@ -313,7 +392,7 @@ SiS315AccelInit(ScreenPtr pScreen)
reservedFbSize = (pSiS->ColorExpandBufferNumber
* pSiS->PerColorExpandBufferSize);
- /* TW: New for MaxXFBmem Option */
+
UsableFbSize = topFB - reservedFbSize;
/* Layout:
* |--------------++++++++++++++++++++^************==========~~~~~~~~~~~~|
@@ -321,31 +400,39 @@ SiS315AccelInit(ScreenPtr pScreen)
* topFB
*/
AvailBufBase = pSiS->FbBase + UsableFbSize;
- for (i = 0; i < pSiS->ColorExpandBufferNumber; i++) {
- pSiS->ColorExpandBufferAddr[i] = AvailBufBase +
+#ifdef CTSCE
+ if(pSiS->ColorExpandBufferNumber) {
+#ifdef CTSCE_DIRECT
+ infoPtr->ColorExpandBase = (unsigned char *)AvailBufBase;
+ pSiS->ColorExpandBase = UsableFbSize;
+#else
+ for(i = 0; i < pSiS->ColorExpandBufferNumber; i++) {
+ pSiS->ColorExpandBufferAddr[i] = AvailBufBase +
i * pSiS->PerColorExpandBufferSize;
- pSiS->ColorExpandBufferScreenOffset[i] = UsableFbSize +
+ pSiS->ColorExpandBufferScreenOffset[i] = UsableFbSize +
i * pSiS->PerColorExpandBufferSize;
+ }
+#endif
}
+#endif
Avail.x1 = 0;
Avail.y1 = 0;
Avail.x2 = pScrn->displayWidth;
- Avail.y2 = UsableFbSize
- / (pScrn->displayWidth * pScrn->bitsPerPixel/8) - 1;
- if (Avail.y2 < 0)
- Avail.y2 = 32767;
- if (Avail.y2 < pScrn->currentMode->VDisplay) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Not enough video RAM for accelerator. At least "
- "%dKB needed, %dKB available\n",
- ((((pScrn->displayWidth * pScrn->bitsPerPixel/8) /* TW: +8 for make it sure */
- * pScrn->currentMode->VDisplay) + reservedFbSize) / 1024) + 8,
- pSiS->maxxfbmem/1024);
- pSiS->NoAccel = TRUE;
- pSiS->NoXvideo = TRUE;
- XAADestroyInfoRec(pSiS->AccelInfoPtr);
- pSiS->AccelInfoPtr = NULL;
- return FALSE;
+ Avail.y2 = UsableFbSize / (pScrn->displayWidth * pScrn->bitsPerPixel/8) - 1;
+
+ if(Avail.y2 < 0) Avail.y2 = 32767;
+ if(Avail.y2 < pScrn->currentMode->VDisplay) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Not enough video RAM for accelerator. At least "
+ "%dKB needed, %dKB available\n",
+ ((((pScrn->displayWidth * pScrn->bitsPerPixel/8) /* +8 for make it sure */
+ * pScrn->currentMode->VDisplay) + reservedFbSize) / 1024) + 8,
+ pSiS->maxxfbmem/1024);
+ pSiS->NoAccel = TRUE;
+ pSiS->NoXvideo = TRUE;
+ XAADestroyInfoRec(pSiS->AccelInfoPtr);
+ pSiS->AccelInfoPtr = NULL;
+ return FALSE;
}
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -364,7 +451,18 @@ SiSSync(ScrnInfoPtr pScrn)
PDEBUG(ErrorF("SiSSync()\n"));
+#ifdef CTSCE
+#ifdef CTSCE_DIRECT
+ if(pSiS->DoColorExpand) {
+ SiSDoCMD
+ pSiS->ColorExpandBusy = TRUE;
+ }
+#endif
+#endif
+
pSiS->DoColorExpand = FALSE;
+ pSiS->alphaBlitBusy = FALSE;
+
SiSIdle
}
@@ -374,8 +472,8 @@ SiSRestoreAccelState(ScrnInfoPtr pScrn)
{
SISPtr pSiS = SISPTR(pScrn);
- /* TW: We don't need to do anything special here */
- pSiS->DoColorExpand = FALSE;
+ pSiS->ColorExpandBusy = FALSE;
+ pSiS->alphaBlitBusy = FALSE;
SiSIdle
}
#endif
@@ -430,24 +528,31 @@ static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
PDEBUG(ErrorF("Setup ScreenCopy(%d, %d, 0x%x, 0x%x, 0x%x)\n",
xdir, ydir, rop, planemask, trans_color));
- /* "AGP base" - color depth depending value (see sis_vga.c) */
+#ifdef SISVRAMQ
+ SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
+ SiSCheckQueue(16 * 2);
+ SiSSetupSRCPitchDSTRect(pSiS->scrnOffset, pSiS->scrnOffset, -1)
+#else
SiSSetupDSTColorDepth(pSiS->DstColor);
- /* SRC pitch */
SiSSetupSRCPitch(pSiS->scrnOffset)
- /* DST pitch and height (-1 for disabling merge-clipping) */
SiSSetupDSTRect(pSiS->scrnOffset, -1)
+#endif
+
/* Init CommandReg and set ROP */
- if (trans_color != -1) {
- SiSSetupROP(0x0A)
- SiSSetupSRCTrans(trans_color)
- SiSSetupCMDFlag(TRANSPARENT_BITBLT)
+ if(trans_color != -1) {
+ SiSSetupROP(0x0A)
+ SiSSetupSRCTrans(trans_color)
+ SiSSetupCMDFlag(TRANSPARENT_BITBLT)
} else {
- SiSSetupROP(sisALUConv[rop])
- /* Set command - not needed, both 0 */
- /* SiSSetupCMDFlag(BITBLT | SRCVIDEO) */
+ SiSSetupROP(sisALUConv[rop])
+ /* Set command - not needed, both 0 */
+ /* SiSSetupCMDFlag(BITBLT | SRCVIDEO) */
}
- /* Set some color depth depending value (see sis_vga.c) */
+
+#ifndef SISVRAMQ
+ /* Set some color depth depending value (see sis_vga.c) */
SiSSetupCMDFlag(pSiS->SiS310_AccelDepth)
+#endif
/* The chip is smart enough to know the direction */
}
@@ -485,25 +590,33 @@ static void SiSSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
dst_y -= mymin;
}
} else {
- if (src_y >= 2048) {
- srcbase = pSiS->scrnOffset * src_y;
- src_y = 0;
+ if(src_y >= 2048) {
+ srcbase = pSiS->scrnOffset * src_y;
+ src_y = 0;
}
- if ((dst_y >= pScrn->virtualY) || (dst_y >= 2048)) {
- dstbase = pSiS->scrnOffset * dst_y;
- dst_y = 0;
+ if((dst_y >= pScrn->virtualY) || (dst_y >= 2048)) {
+ dstbase = pSiS->scrnOffset * dst_y;
+ dst_y = 0;
}
}
#ifdef SISDUALHEAD
srcbase += HEADOFFSET;
dstbase += HEADOFFSET;
#endif
+
+#ifdef SISVRAMQ
+ SiSCheckQueue(16 * 3);
+ SiSSetupSRCDSTBase(srcbase, dstbase)
+ SiSSetupSRCDSTXY(src_x, src_y, dst_x, dst_y)
+ SiSSetRectDoCMD(width,height)
+#else
SiSSetupSRCBase(srcbase);
SiSSetupDSTBase(dstbase);
SiSSetupRect(width, height)
SiSSetupSRCXY(src_x, src_y)
SiSSetupDSTXY(dst_x, dst_y)
SiSDoCMD
+#endif
}
static void
@@ -520,11 +633,20 @@ SiSSetupForSolidFill(ScrnInfoPtr pScrn, int color,
rop = 5; /* NOOP */
}
}
- SiSSetupPATFG(color)
+
+#ifdef SISVRAMQ
+ SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
+ SiSCheckQueue(16 * 1);
+ SiSSetupPATFGDSTRect(color, pSiS->scrnOffset, -1)
+ SiSSetupROP(sisPatALUConv[rop])
+ SiSSetupCMDFlag(PATFG)
+#else
+ SiSSetupPATFG(color)
SiSSetupDSTRect(pSiS->scrnOffset, -1)
SiSSetupDSTColorDepth(pSiS->DstColor);
SiSSetupROP(sisPatALUConv[rop])
SiSSetupCMDFlag(PATFG | pSiS->SiS310_AccelDepth)
+#endif
}
static void
@@ -537,28 +659,38 @@ SiSSubsequentSolidFillRect(ScrnInfoPtr pScrn,
PDEBUG(ErrorF("Subsequent SolidFillRect(%d, %d, %d, %d)\n",
x, y, w, h));
dstbase = 0;
- if (y >= 2048) {
- dstbase=pSiS->scrnOffset*y;
- y = 0;
+ if(y >= 2048) {
+ dstbase = pSiS->scrnOffset * y;
+ y = 0;
}
#ifdef SISDUALHEAD
dstbase += HEADOFFSET;
#endif
- SiSSetupDSTBase(dstbase)
- SiSSetupDSTXY(x,y)
- SiSSetupRect(w,h)
+
pSiS->CommandReg &= ~(T_XISMAJORL | T_XISMAJORR |
T_L_X_INC | T_L_Y_INC |
T_R_X_INC | T_R_Y_INC |
TRAPAZOID_FILL);
- SiSSetupCMDFlag(BITBLT)
+
+ /* SiSSetupCMDFlag(BITBLT) - BITBLT = 0 */
+
+#ifdef SISVRAMQ
+ SiSCheckQueue(16 * 2)
+ SiSSetupDSTXYRect(x,y,w,h)
+ SiSSetupDSTBaseDoCMD(dstbase)
+#else
+ SiSSetupDSTBase(dstbase)
+ SiSSetupDSTXY(x,y)
+ SiSSetupRect(w,h)
SiSDoCMD
+#endif
}
/* Trapezoid */
/* This would work better if XAA would provide us with valid trapezoids.
* In fact, with small trapezoids the left and the right edge often cross
* each other which causes drawing errors (filling over whole scanline).
+ * DOES NOT WORK ON XABRE, HANGS THE ENGINE.
*/
#ifdef TRAP
static void
@@ -568,19 +700,21 @@ SiSSubsequentSolidFillTrap(ScrnInfoPtr pScrn, int y, int h,
{
SISPtr pSiS = SISPTR(pScrn);
long dstbase;
-#if 0
- float kL, kR;
-#endif
dstbase = 0;
- if (y >= 2048) {
- dstbase=pSiS->scrnOffset*y;
- y = 0;
+ if(y >= 2048) {
+ dstbase = pSiS->scrnOffset * y;
+ y = 0;
}
#ifdef SISDUALHEAD
dstbase += HEADOFFSET;
#endif
+
+#ifdef SISVRAMQ /* Not optimized yet */
+ SiSCheckQueue(16 * 10)
+#else
SiSSetupDSTBase(dstbase)
+#endif
#if 1
SiSSetupPATFG(0xff0000) /* FOR TESTING */
@@ -595,60 +729,41 @@ SiSSubsequentSolidFillTrap(ScrnInfoPtr pScrn, int y, int h,
xf86DrvMsg(0, X_INFO, "Trap (%d %d %d %d) dxL %d dyL %d eL %d dxR %d dyR %d eR %d\n",
left, right, y, h, dxL, dyL, eL, dxR, dyR, eR);
- /* Unfortunately, we must check if the right and the left edge
- * cross each other... INCOMPLETE (equation wrong)
- */
-#if 0
- if (dxL == 0) kL = 0;
- else kL = (float)dyL / (float)dxL;
- if (dxR == 0) kR = 0;
- else kR = (float)dyR / (float)dxR;
- xf86DrvMsg(0, X_INFO, "kL %f kR %f!\n", kL, kR);
- if ( (kR != kL) &&
- (!(kR == 0 && kL == 0)) &&
- (!(kR < 0 && kL > 0)) ) {
- xf86DrvMsg(0, X_INFO, "Inside if (%f - %d)\n", ( kL * ( ( ((float)right - (float)left) / (kL - kR) ) - left) + y), h+y);
- if ( ( ( kL * ( ( ((float)right - (float)left) / (kL - kR) ) - (float)left) + (float)y) < (h + y) ) ) {
- xf86DrvMsg(0, X_INFO, "Cross detected!\n");
- }
- }
-#endif
-
/* Determine egde angles */
- if (dxL < 0) { dxL = -dxL; }
- else { SiSSetupCMDFlag(T_L_X_INC) }
- if (dxR < 0) { dxR = -dxR; }
- else { SiSSetupCMDFlag(T_R_X_INC) }
+ if(dxL < 0) { dxL = -dxL; }
+ else { SiSSetupCMDFlag(T_L_X_INC) }
+ if(dxR < 0) { dxR = -dxR; }
+ else { SiSSetupCMDFlag(T_R_X_INC) }
/* (Y direction always positive - do this anyway) */
- if (dyL < 0) { dyL = -dyL; }
- else { SiSSetupCMDFlag(T_L_Y_INC) }
- if (dyR < 0) { dyR = -dyR; }
- else { SiSSetupCMDFlag(T_R_Y_INC) }
+ if(dyL < 0) { dyL = -dyL; }
+ else { SiSSetupCMDFlag(T_L_Y_INC) }
+ if(dyR < 0) { dyR = -dyR; }
+ else { SiSSetupCMDFlag(T_R_Y_INC) }
/* Determine major axis */
- if (dxL >= dyL) { /* X is major axis */
- SiSSetupCMDFlag(T_XISMAJORL)
- }
- if (dxR >= dyR) { /* X is major axis */
- SiSSetupCMDFlag(T_XISMAJORR)
- }
+ if(dxL >= dyL) { SiSSetupCMDFlag(T_XISMAJORL) }
+ if(dxR >= dyR) { SiSSetupCMDFlag(T_XISMAJORR) }
+
+ SiSSetupCMDFlag(TRAPAZOID_FILL);
+#ifdef SISVRAMQ
+ SiSSetupYHLR(y, h, left, right)
+ SiSSetupdLdR(dxL, dyL, dxR, dyR)
+ SiSSetupELER(eL, eR)
+ SiSSetupDSTBaseDoCMD(dstbase)
+#else
/* Set up deltas */
SiSSetupdL(dxL, dyL)
SiSSetupdR(dxR, dyR)
-
/* Set up y, h, left, right */
- SiSSetupYH(y,h)
- SiSSetupLR(left,right)
-
+ SiSSetupYH(y, h)
+ SiSSetupLR(left, right)
/* Set up initial error term */
SiSSetupEL(eL)
SiSSetupER(eR)
-
- SiSSetupCMDFlag(TRAPAZOID_FILL);
-
SiSDoCMD
+#endif
}
#endif
@@ -660,13 +775,21 @@ SiSSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop,
PDEBUG(ErrorF("Setup SolidLine(0x%x, 0x%x, 0x%x)\n",
color, rop, planemask));
-
+#ifdef SISVRAMQ
+ SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
+ SiSCheckQueue(16 * 3);
+ SiSSetupLineCountPeriod(1, 1)
+ SiSSetupPATFGDSTRect(color, pSiS->scrnOffset, -1)
+ SiSSetupROP(sisPatALUConv[rop])
+ SiSSetupCMDFlag(PATFG | LINE)
+#else
SiSSetupLineCount(1)
SiSSetupPATFG(color)
SiSSetupDSTRect(pSiS->scrnOffset, -1)
- SiSSetupDSTColorDepth(pSiS->DstColor);
+ SiSSetupDSTColorDepth(pSiS->DstColor)
SiSSetupROP(sisPatALUConv[rop])
SiSSetupCMDFlag(PATFG | LINE | pSiS->SiS310_AccelDepth)
+#endif
}
static void
@@ -682,24 +805,31 @@ SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
dstbase = 0;
miny = (y1 > y2) ? y2 : y1;
maxy = (y1 > y2) ? y1 : y2;
- if (maxy >= 2048) {
- dstbase = pSiS->scrnOffset*miny;
- y1 -= miny;
- y2 -= miny;
+ if(maxy >= 2048) {
+ dstbase = pSiS->scrnOffset*miny;
+ y1 -= miny;
+ y2 -= miny;
}
#ifdef SISDUALHEAD
dstbase += HEADOFFSET;
#endif
- SiSSetupDSTBase(dstbase)
- SiSSetupX0Y0(x1,y1)
- SiSSetupX1Y1(x2,y2)
- if (flags & OMIT_LAST) {
- SiSSetupCMDFlag(NO_LAST_PIXEL)
+ if(flags & OMIT_LAST) {
+ SiSSetupCMDFlag(NO_LAST_PIXEL)
} else {
- pSiS->CommandReg &= ~(NO_LAST_PIXEL);
+ pSiS->CommandReg &= ~(NO_LAST_PIXEL);
}
+
+#ifdef SISVRAMQ
+ SiSCheckQueue(16 * 2);
+ SiSSetupX0Y0X1Y1(x1,y1,x2,y2)
+ SiSSetupDSTBaseDoCMD(dstbase)
+#else
+ SiSSetupDSTBase(dstbase)
+ SiSSetupX0Y0(x1,y1)
+ SiSSetupX1Y1(x2,y2)
SiSDoCMD
+#endif
}
static void
@@ -714,22 +844,32 @@ SiSSubsequentSolidHorzVertLine(ScrnInfoPtr pScrn,
len--; /* starting point is included! */
dstbase = 0;
- if ((y >= 2048) || ((y + len) >= 2048)) {
- dstbase = pSiS->scrnOffset * y;
- y = 0;
+ if((y >= 2048) || ((y + len) >= 2048)) {
+ dstbase = pSiS->scrnOffset * y;
+ y = 0;
}
#ifdef SISDUALHEAD
dstbase += HEADOFFSET;
#endif
- SiSSetupDSTBase(dstbase)
+#ifdef SISVRAMQ
+ SiSCheckQueue(16 * 2);
+ if(dir == DEGREES_0) {
+ SiSSetupX0Y0X1Y1(x, y, (x + len), y)
+ } else {
+ SiSSetupX0Y0X1Y1(x, y, x, (y + len))
+ }
+ SiSSetupDSTBaseDoCMD(dstbase)
+#else
+ SiSSetupDSTBase(dstbase)
SiSSetupX0Y0(x,y)
- if (dir == DEGREES_0) {
- SiSSetupX1Y1(x + len, y);
+ if(dir == DEGREES_0) {
+ SiSSetupX1Y1(x + len, y);
} else {
- SiSSetupX1Y1(x, y + len);
+ SiSSetupX1Y1(x, y + len);
}
SiSDoCMD
+#endif
}
static void
@@ -742,21 +882,34 @@ SiSSetupForDashedLine(ScrnInfoPtr pScrn,
PDEBUG(ErrorF("Setup DashedLine(0x%x, 0x%x, 0x%x, 0x%x, %d, 0x%x:%x)\n",
fg, bg, rop, planemask, length, *(pattern+4), *pattern));
+#ifdef SISVRAMQ
+ SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
+ SiSCheckQueue(16 * 3);
+ SiSSetupLineCountPeriod(1, length-1)
+ SiSSetupStyle(*pattern,*(pattern+4))
+ SiSSetupPATFGDSTRect(fg, pSiS->scrnOffset, -1)
+#else
SiSSetupLineCount(1)
SiSSetupDSTRect(pSiS->scrnOffset, -1)
SiSSetupDSTColorDepth(pSiS->DstColor);
SiSSetupStyleLow(*pattern)
SiSSetupStyleHigh(*(pattern+4))
- SiSSetupStylePeriod(length-1);
- SiSSetupROP(sisPatALUConv[rop])
+ SiSSetupStylePeriod(length-1);
SiSSetupPATFG(fg)
+#endif
+
+ SiSSetupROP(sisPatALUConv[rop])
+
SiSSetupCMDFlag(LINE | LINE_STYLE)
- if (bg != -1) {
- SiSSetupPATBG(bg)
+
+ if(bg != -1) {
+ SiSSetupPATBG(bg)
} else {
- SiSSetupCMDFlag(TRANSPARENT)
+ SiSSetupCMDFlag(TRANSPARENT)
}
+#ifndef SISVRAMQ
SiSSetupCMDFlag(pSiS->SiS310_AccelDepth)
+#endif
}
static void
@@ -771,26 +924,33 @@ SiSSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
x1, y1, x2, y2, flags, phase));
dstbase = 0;
- miny=(y1 > y2) ? y2 : y1;
- maxy=(y1 > y2) ? y1 : y2;
- if (maxy >= 2048) {
- dstbase = pSiS->scrnOffset * miny;
- y1 -= miny;
- y2 -= miny;
+ miny = (y1 > y2) ? y2 : y1;
+ maxy = (y1 > y2) ? y1 : y2;
+ if(maxy >= 2048) {
+ dstbase = pSiS->scrnOffset * miny;
+ y1 -= miny;
+ y2 -= miny;
}
#ifdef SISDUALHEAD
dstbase += HEADOFFSET;
#endif
- SiSSetupDSTBase(dstbase)
- SiSSetupX0Y0(x1,y1)
- SiSSetupX1Y1(x2,y2)
- if (flags & OMIT_LAST) {
- SiSSetupCMDFlag(NO_LAST_PIXEL)
+ if(flags & OMIT_LAST) {
+ SiSSetupCMDFlag(NO_LAST_PIXEL)
} else {
- pSiS->CommandReg &= ~(NO_LAST_PIXEL);
+ pSiS->CommandReg &= ~(NO_LAST_PIXEL);
}
+
+#ifdef SISVRAMQ
+ SiSCheckQueue(16 * 2);
+ SiSSetupX0Y0X1Y1(x1,y1,x2,y2)
+ SiSSetupDSTBaseDoCMD(dstbase)
+#else
+ SiSSetupDSTBase(dstbase)
+ SiSSetupX0Y0(x1,y1)
+ SiSSetupX1Y1(x2,y2)
SiSDoCMD
+#endif
}
static void
@@ -802,12 +962,27 @@ SiSSetupForMonoPatternFill(ScrnInfoPtr pScrn,
PDEBUG(ErrorF("Setup MonoPatFill(0x%x,0x%x, 0x%x,0x%x, 0x%x, 0x%x)\n",
patx, paty, fg, bg, rop, planemask));
+
+#ifdef SISVRAMQ
+ SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
+ SiSCheckQueue(16 * 3);
+ SiSSetupPATFGDSTRect(fg, pSiS->scrnOffset, -1)
+#else
SiSSetupDSTRect(pSiS->scrnOffset, -1)
SiSSetupDSTColorDepth(pSiS->DstColor);
+#endif
+
SiSSetupMONOPAT(patx,paty)
- SiSSetupPATFG(fg)
+
SiSSetupROP(sisPatALUConv[rop])
+
+#ifdef SISVRAMQ
+ SiSSetupCMDFlag(PATMONO)
+#else
+ SiSSetupPATFG(fg)
SiSSetupCMDFlag(PATMONO | pSiS->SiS310_AccelDepth)
+#endif
+
SiSSetupPATBG(bg)
}
@@ -822,25 +997,36 @@ SiSSubsequentMonoPatternFill(ScrnInfoPtr pScrn,
PDEBUG(ErrorF("Subsequent MonoPatFill(0x%x,0x%x, %d,%d, %d,%d)\n",
patx, paty, x, y, w, h));
dstbase = 0;
- if (y >= 2048) {
- dstbase = pSiS->scrnOffset * y;
- y = 0;
+ if(y >= 2048) {
+ dstbase = pSiS->scrnOffset * y;
+ y = 0;
}
#ifdef SISDUALHEAD
dstbase += HEADOFFSET;
#endif
- SiSSetupDSTBase(dstbase)
- SiSSetupDSTXY(x,y)
- SiSSetupRect(w,h)
+
/* Clear commandReg because Setup can be used for Rect and Trap */
pSiS->CommandReg &= ~(T_XISMAJORL | T_XISMAJORR |
T_L_X_INC | T_L_Y_INC |
T_R_X_INC | T_R_Y_INC |
TRAPAZOID_FILL);
+
+#ifdef SISVRAMQ
+ SiSCheckQueue(16 * 2);
+ SiSSetupDSTXYRect(x,y,w,h)
+ SiSSetupDSTBaseDoCMD(dstbase)
+#else
+ SiSSetupDSTBase(dstbase)
+ SiSSetupDSTXY(x,y)
+ SiSSetupRect(w,h)
SiSDoCMD
+#endif
}
-/* Trapezoid */
+/* --- Trapezoid --- */
+
+/* Does not work at all on Xabre */
+
#ifdef TRAP
static void
SiSSubsequentMonoPatternFillTrap(ScrnInfoPtr pScrn,
@@ -856,14 +1042,19 @@ SiSSubsequentMonoPatternFillTrap(ScrnInfoPtr pScrn,
y, h, left, right, dxL, dxR, eL, eR));
dstbase = 0;
- if (y >= 2048) {
- dstbase=pSiS->scrnOffset*y;
- y = 0;
+ if(y >= 2048) {
+ dstbase=pSiS->scrnOffset*y;
+ y = 0;
}
#ifdef SISDUALHEAD
dstbase += HEADOFFSET;
#endif
+
+#ifdef SISVRAMQ
+ SiSCheckQueue(16 * 4);
+#else
SiSSetupDSTBase(dstbase)
+#endif
/* Clear CommandReg because SetUp can be used for Rect and Trap */
pSiS->CommandReg &= ~(T_XISMAJORL | T_XISMAJORR |
@@ -871,72 +1062,195 @@ SiSSubsequentMonoPatternFillTrap(ScrnInfoPtr pScrn,
T_R_X_INC | T_R_Y_INC |
BITBLT);
- if (dxL < 0) { dxL = -dxL; }
- else { SiSSetupCMDFlag(T_L_X_INC) }
- if (dxR < 0) { dxR = -dxR; }
- else { SiSSetupCMDFlag(T_R_X_INC) }
+ if(dxL < 0) { dxL = -dxL; }
+ else { SiSSetupCMDFlag(T_L_X_INC) }
+ if(dxR < 0) { dxR = -dxR; }
+ else { SiSSetupCMDFlag(T_R_X_INC) }
- if (dyL < 0) { dyL = -dyL; }
- else { SiSSetupCMDFlag(T_L_Y_INC) }
- if (dyR < 0) { dyR = -dyR; }
- else { SiSSetupCMDFlag(T_R_Y_INC) }
+ if(dyL < 0) { dyL = -dyL; }
+ else { SiSSetupCMDFlag(T_L_Y_INC) }
+ if(dyR < 0) { dyR = -dyR; }
+ else { SiSSetupCMDFlag(T_R_Y_INC) }
/* Determine major axis */
- if (dxL >= dyL) { /* X is major axis */
- SiSSetupCMDFlag(T_XISMAJORL)
- }
- if (dxR >= dyR) { /* X is major axis */
- SiSSetupCMDFlag(T_XISMAJORR)
- }
+ if(dxL >= dyL) { SiSSetupCMDFlag(T_XISMAJORL) }
+ if(dxR >= dyR) { SiSSetupCMDFlag(T_XISMAJORR) }
- SiSSetupYH(y,h)
- SiSSetupLR(left,right)
+ SiSSetupCMDFlag(TRAPAZOID_FILL);
+#ifdef SISVRAMQ
+ SiSSetupYHLR(y, h, left, right)
+ SiSSetupdLdR(dxL, dyL, dxR, dyR)
+ SiSSetupELER(eL, eR)
+ SiSSetupDSTBaseDoCMD(dstbase)
+#else
+ SiSSetupYH(y, h)
+ SiSSetupLR(left, right)
SiSSetupdL(dxL, dyL)
SiSSetupdR(dxR, dyR)
-
SiSSetupEL(eL)
SiSSetupER(eR)
-
- SiSSetupCMDFlag(TRAPAZOID_FILL);
-
SiSDoCMD
+#endif
}
#endif
-/* ---- CPUToScreen Color Expand */
+/* ---- CPUToScreen Color Expand --- */
#ifdef CTSCE
-/* We use the indirect method */
+
+#ifdef CTSCE_DIRECT
+
+/* Direct method */
+
+/* This is somewhat a fake. We let XAA copy its data not to an
+ * aperture, but to video RAM, and then do a ScreenToScreen
+ * color expansion.
+ * Since the data is sent AFTER the call to Subsequent, we
+ * don't execute the command here, but set a flag and do
+ * that in the (subsequent) call to Sync()
+ */
+
+static void
+SiSSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop, unsigned int planemask)
+{
+ SISPtr pSiS=SISPTR(pScrn);
+
+#ifdef SISVRAMQ
+ SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
+ SiSSetupROP(sisALUConv[rop]);
+ SiSSetupSRCFGDSTRect(fg, pSiS->scrnOffset, -1)
+ if(bg == -1) {
+ SiSSetupCMDFlag(TRANSPARENT | ENCOLOREXP | SRCVIDEO);
+ } else {
+ SiSSetupSRCBG(bg);
+ SiSSetupCMDFlag(ENCOLOREXP | SRCVIDEO);
+ }
+#else
+ SiSSetupSRCXY(0,0);
+ SiSSetupROP(sisALUConv[rop]);
+ SiSSetupSRCFG(fg);
+ SiSSetupDSTRect(pSiS->scrnOffset, -1);
+ SiSSetupDSTColorDepth(pSiS->DstColor);
+ if(bg == -1) {
+ SiSSetupCMDFlag(TRANSPARENT | ENCOLOREXP | SRCVIDEO
+ | pSiS->SiS310_AccelDepth);
+ } else {
+ SiSSetupSRCBG(bg);
+ SiSSetupCMDFlag(ENCOLOREXP | SRCVIDEO | pSiS->SiS310_AccelDepth);
+ }
+#endif
+}
+
+static void
+SiSSubsequentCPUToScreenColorExpandFill(
+ ScrnInfoPtr pScrn, int x, int y, int w,
+ int h, int skipleft)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+ int _x0, _y0, _x1, _y1;
+ long srcbase, dstbase;
+
+ srcbase = pSiS->ColorExpandBase;
+
+ dstbase = 0;
+ if(y >= 2048) {
+ dstbase = pSiS->scrnOffset*y;
+ y = 0;
+ }
+
+#ifdef SISDUALHEAD
+ srcbase += HEADOFFSET;
+ dstbase += HEADOFFSET;
+#endif
+
+#ifdef SISVRAMQ
+ SiSSetupSRCDSTBase(srcbase,dstbase);
+#else
+ SiSSetupSRCBase(srcbase);
+ SiSSetupDSTBase(dstbase)
+#endif
+
+ if(skipleft > 0) {
+ _x0 = x + skipleft;
+ _y0 = y;
+ _x1 = x + w;
+ _y1 = y + h;
+#ifdef SISVRAMQ
+ SiSSetupClip(_x0, _y0, _x1, _y1);
+#else
+ SiSSetupClipLT(_x0, _y0);
+ SiSSetupClipRB(_x1, _y1);
+#endif
+ SiSSetupCMDFlag(CLIPENABLE);
+ } else {
+ pSiS->CommandReg &= (~CLIPENABLE);
+ }
+
+#ifdef SISVRAMQ
+ SiSSetupRectSRCPitch(w, h, ((((w + 7) >> 3) + 3) >> 2) << 2);
+ SiSSetupSRCDSTXY(0, 0, x, y);
+#else
+ SiSSetupRect(w, h);
+ SiSSetupSRCPitch(((((w+7)/8)+3) >> 2) * 4);
+ SiSSetupDSTXY(x, y);
+#endif
+
+ if(pSiS->ColorExpandBusy) {
+ pSiS->ColorExpandBusy = FALSE;
+ SiSIdle
+ }
+
+ pSiS->DoColorExpand = TRUE;
+}
+
+#else
+
+/* Indirect method */
+
+/* This is SLOW, slower than the CPU on most chipsets */
+/* Does not work in VRAM queue mode. */
+
static void
SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
int fg, int bg, int rop, unsigned int planemask)
{
SISPtr pSiS=SISPTR(pScrn);
- /* FIXME: How do I check the "CPU driven blit stage" on the
- * 315 series?
- * That's the 300 series method but definitely wrong for
- * 315 series (bit 28 is already used for idle!)
- */
- /* while ((MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x1F00) != 0) {} */
+#ifdef SISVRAMQ
+ SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
+#endif
- /* TW: Do Idle instead... */
- SiSIdle
+ /* !!! DOES NOT WORK IN VRAM QUEUE MODE !!! */
+
+ /* (hence this is not optimized for VRAM mode) */
+ SiSIdle
SiSSetupSRCXY(0,0);
+
SiSSetupROP(sisALUConv[rop]);
SiSSetupSRCFG(fg);
SiSSetupDSTRect(pSiS->scrnOffset, -1);
+#ifndef SISVRAMQ
SiSSetupDSTColorDepth(pSiS->DstColor);
- if (bg == -1) {
- SiSSetupCMDFlag(TRANSPARENT | ENCOLOREXP | SRCCPUBLITBUF
- | pSiS->SiS310_AccelDepth);
+#endif
+ if(bg == -1) {
+#ifdef SISVRAMQ
+ SiSSetupCMDFlag(TRANSPARENT | ENCOLOREXP | SRCCPUBLITBUF);
+#else
+ SiSSetupCMDFlag(TRANSPARENT | ENCOLOREXP | SRCCPUBLITBUF
+ | pSiS->SiS310_AccelDepth);
+#endif
} else {
- SiSSetupSRCBG(bg);
- SiSSetupCMDFlag(ENCOLOREXP | SRCCPUBLITBUF
- | pSiS->SiS310_AccelDepth);
+ SiSSetupSRCBG(bg);
+#ifdef SISVRAMQ
+ SiSSetupCMDFlag(ENCOLOREXP | SRCCPUBLITBUF);
+#else
+ SiSSetupCMDFlag(ENCOLOREXP | SRCCPUBLITBUF | pSiS->SiS310_AccelDepth);
+#endif
};
+
}
static void
@@ -949,35 +1263,40 @@ SiSSubsequentScanlineCPUToScreenColorExpandFill(
long dstbase;
dstbase = 0;
- if (y >= 2048) {
- dstbase = pSiS->scrnOffset*y;
- y = 0;
+ if(y >= 2048) {
+ dstbase = pSiS->scrnOffset*y;
+ y = 0;
}
#ifdef SISDUALHEAD
dstbase += HEADOFFSET;
#endif
if((MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) {
- SiSIdle;
+ SiSIdle;
}
SiSSetupDSTBase(dstbase)
- if (skipleft > 0) {
- _x0 = x+skipleft;
- _y0 = y;
- _x1 = x+w;
- _y1 = y+h;
- SiSSetupClipLT(_x0, _y0);
- SiSSetupClipRB(_x1, _y1);
- SiSSetupCMDFlag(CLIPENABLE);
+ if(skipleft > 0) {
+ _x0 = x+skipleft;
+ _y0 = y;
+ _x1 = x+w;
+ _y1 = y+h;
+#ifdef SISVRAMQ
+ SiSSetupClip(_x0, _y0, _x1, _y1);
+#else
+ SiSSetupClipLT(_x0, _y0);
+ SiSSetupClipRB(_x1, _y1);
+#endif
+ SiSSetupCMDFlag(CLIPENABLE);
} else {
- pSiS->CommandReg &= (~CLIPENABLE);
+ pSiS->CommandReg &= (~CLIPENABLE);
}
SiSSetupRect(w, 1);
SiSSetupSRCPitch(((((w+7)/8)+3) >> 2) * 4);
pSiS->ycurrent = y;
pSiS->xcurrent = x;
+
}
static void
@@ -992,7 +1311,7 @@ SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
#endif
if((MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) {
- SiSIdle;
+ SiSIdle;
}
SiSSetupSRCBase(cbo);
@@ -1006,10 +1325,188 @@ SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
SiSIdle
}
#endif
+#endif
-/* ---- RENDER ---- */
+/* --- Screen To Screen Color Expand --- */
+
+/* This method blits in a single task; this does not work because
+ * the hardware does not use the source pitch as scanline offset
+ * but to calculate pattern address from source X and Y and to
+ * limit the drawing width (similar to width set by SetupRect).
+ * XAA provides the pattern bitmap with scrnOffset (displayWidth * bpp/8)
+ * offset, but this is not supported by the hardware.
+ * DOES NOT WORK ON XABRE, HANGS ENGINE.
+ */
+
+#ifdef STSCE
+static void
+SiSSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn,
+ int fg, int bg,
+ int rop, unsigned int planemask)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+
+#ifdef SISVRAMQ
+ SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
+#else
+ SiSSetupDSTColorDepth(pSiS->DstColor)
+#endif
+ SiSSetupDSTRect(pSiS->scrnOffset, -1)
+ SiSSetupROP(sisALUConv[rop])
+ SiSSetupSRCFG(fg)
+ /* SiSSetupSRCXY(0,0) */
+
+ if(bg == -1) {
+ SiSSetupCMDFlag(TRANSPARENT | ENCOLOREXP | SRCVIDEO);
+ } else {
+ SiSSetupSRCBG(bg);
+ SiSSetupCMDFlag(ENCOLOREXP | SRCVIDEO);
+ };
+}
+
+/* For testing, these are the methods: (use only one at a time!) */
+
+#undef npitch /* Normal: Use srcx/y as srcx/y, use scrnOffset as source pitch
+ * Does not work on 315 series, because the hardware does not
+ * regard the src x and y. Apart from this problem:
+ * This would work if the hareware used the source pitch for
+ * incrementing the source address after each scanline - but
+ * it doesn't do this! The first line of the area is correctly
+ * color expanded, but since the source pitch is ignored and
+ * the source address not incremented correctly, the following
+ * lines are color expanded with any bit pattern that is left
+ * in the unused space of the source bitmap (which is organized
+ * with the depth of the screen framebuffer hence with a pitch
+ * of scrnOffset).
+ */
+
+#undef pitchdw /* Use source pitch "displayWidth / 8" instead
+ * of scrnOffset (=displayWidth * bpp / 8)
+ * This can't work, because the pitch of the source
+ * bitmap is scrnoffset!
+ */
+
+#define nopitch /* Calculate srcbase with srcx and srcy, set the
+ * pitch to scrnOffset (which IS the correct pitch
+ * for the source bitmap) and set srcx and srcy both
+ * to 0.
+ * This would work if the hareware used the source pitch for
+ * incrementing the source address after each scanline - but
+ * it doesn't do this! Again: The first line of the area is
+ * correctly color expanded, but since the source pitch is
+ * ignored for scanline address incremention, the following
+ * lines are not correctly color expanded.
+ * This is the only way it works (apart from the problem
+ * described above). The hardware does not regard the src
+ * x and y values in any way.
+ */
+
+static void
+SiSSubsequentScreenToScreenColorExpand(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ int srcx, int srcy, int skipleft)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+ long srcbase, dstbase;
+#if 0
+ int _x0, _y0, _x1, _y1;
+#endif
+#ifdef pitchdw
+ int newsrcx, newsrcy;
+
+ /* srcx and srcy are provided based on a scrnOffset pitch ( = displayWidth * bpp / 8 )
+ * We recalulate srcx and srcy based on pitch = displayWidth / 8
+ */
+ newsrcy = ((pSiS->scrnOffset * srcy) + (srcx * ((pScrn->bitsPerPixel+7)/8))) /
+ (pScrn->displayWidth/8);
+ newsrcx = ((pSiS->scrnOffset * srcy) + (srcx * ((pScrn->bitsPerPixel+7)/8))) %
+ (pScrn->displayWidth/8);
+#endif
+ xf86DrvMsg(0, X_INFO, "Sub ScreenToScreen ColorExp(%d,%d, %d,%d, %d,%d, %d)\n",
+ x, y, w, h, srcx, srcy, skipleft);
-/* DOES NOT WORK. SEE COMMENT ABOVE. */
+ srcbase = dstbase = 0;
+
+#ifdef pitchdw
+ if(newsrcy >= 2048) {
+ srcbase = (pScrn->displayWidth / 8) * newsrcy;
+ newsrcy = 0;
+ }
+#endif
+#ifdef nopitch
+ srcbase = (pSiS->scrnOffset * srcy) + (srcx * ((pScrn->bitsPerPixel+7)/8));
+#endif
+#ifdef npitch
+ if(srcy >= 2048) {
+ srcbase = pSiS->scrnOffset * srcy;
+ srcy = 0;
+ }
+#endif
+ if(y >= 2048) {
+ dstbase = pSiS->scrnOffset * y;
+ y = 0;
+ }
+
+#ifdef SISDUALHEAD
+ srcbase += HEADOFFSET;
+ dstbase += HEADOFFSET;
+#endif
+
+ SiSSetupSRCBase(srcbase)
+ SiSSetupDSTBase(dstbase)
+
+ /* 315 series seem to treat the src pitch as
+ * a "drawing limit", but still (as 300 series)
+ * does not use it for incrementing the
+ * address pointer for the next scanline. ARGH!
+ */
+
+#ifdef pitchdw
+ SiSSetupSRCPitch(pScrn->displayWidth/8)
+#endif
+#ifdef nopitch
+ SiSSetupSRCPitch(pScrn->displayWidth/8)
+ /* SiSSetupSRCPitch(1024/8) */ /* For test */
+#endif
+#ifdef npitch
+ SiSSetupSRCPitch(pScrn->displayWidth/8)
+ /* SiSSetupSRCPitch(pSiS->scrnOffset) */
+#endif
+
+ SiSSetupRect(w,h)
+
+#if 0 /* How do I implement the offset? Not this way, that's for sure.. */
+ if (skipleft > 0) {
+ _x0 = x+skipleft;
+ _y0 = y;
+ _x1 = x+w;
+ _y1 = y+h;
+ SiSSetupClipLT(_x0, _y0);
+ SiSSetupClipRB(_x1, _y1);
+ SiSSetupCMDFlag(CLIPENABLE);
+ }
+#endif
+#ifdef pitchdw
+ SiSSetupSRCXY(newsrcx, newsrcy)
+#endif
+#ifdef nopitch
+ SiSSetupSRCXY(0,0)
+#endif
+#ifdef npitch
+ SiSSetupSRCXY(srcx, srcy)
+#endif
+
+ SiSSetupDSTXY(x,y)
+
+ SiSDoCMD
+#ifdef SISVRAMQ
+ /* We MUST sync here, there must not be 2 or more color expansion commands in the queue */
+ SiSIdle
+#endif
+}
+#endif
+
+/* ---- RENDER ---- */
#ifdef INCL_RENDER
#ifdef RENDER
@@ -1018,14 +1515,34 @@ SiSRemoveLinear(FBLinearPtr linear)
{
SISPtr pSiS = (SISPtr)(linear->devPrivate.ptr);
- pSiS->AccelLinearScratch = NULL;
+ pSiS->AccelLinearScratch = NULL;
+}
+
+static void
+SiSRenderCallback(ScrnInfoPtr pScrn)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+
+ if((currentTime.milliseconds > pSiS->RenderTime) && pSiS->AccelLinearScratch) {
+ xf86FreeOffscreenLinear(pSiS->AccelLinearScratch);
+ pSiS->AccelLinearScratch = NULL;
+ }
+
+ if(!pSiS->AccelLinearScratch) {
+ pSiS->RenderCallback = NULL;
+ }
}
+#define RENDER_DELAY 15000
+
static Bool
SiSAllocateLinear(ScrnInfoPtr pScrn, int sizeNeeded)
{
SISPtr pSiS = SISPTR(pScrn);
+ pSiS->RenderTime = currentTime.milliseconds + RENDER_DELAY;
+ pSiS->RenderCallback = SiSRenderCallback;
+
if(pSiS->AccelLinearScratch) {
if(pSiS->AccelLinearScratch->size >= sizeNeeded)
return TRUE;
@@ -1056,15 +1573,15 @@ SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
int height, int flags)
{
SISPtr pSiS = SISPTR(pScrn);
- int pitch, sizeNeeded, offset, i;
+ int pitch, sizeNeeded, offset;
#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, " %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]);
-#endif
+ alphaPtr[4],alphaPtr[5],alphaPtr[6],alphaPtr[7]); */
+#endif
if(op != PictOpOver)
return FALSE;
@@ -1084,31 +1601,33 @@ SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
if(pScrn->bitsPerPixel == 32)
offset <<= 1;
+#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)
+ SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_PERPIXELALPHA | pSiS->SiS310_AccelDepth)
+#endif
+
+ 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);
-
- /* "AGP base" - color depth depending value (see sis_vga.c) */
- SiSSetupDSTColorDepth(pSiS->DstColor);
- /* SRC pitch */
- SiSSetupSRCPitch((pitch << 2));
- /* DST pitch and height (-1 for disabling merge-clipping) */
- SiSSetupDSTRect(pSiS->scrnOffset, -1)
- /* Init CommandReg and set ROP */
- SiSSetupROP(RENDER_OP)
- /* Set command */
- SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO)
-
- /* Set some color depth depending value (see sis_vga.c) */
- SiSSetupCMDFlag(pSiS->SiS310_AccelDepth)
-
- /* THIS is the problem: The hardware does not
- * support ARGB textures, but a static alpha
- * value only. Makes the whole thing pretty
- * useless.
- */
- SiSSetupAlpha(0x99)
+
+#if 0
+ /* For constant alpha, we need to do this and set A_CONSTANTALPHA instead */
+ SiSSetupAlpha(0x99)
+#endif
return TRUE;
}
@@ -1125,7 +1644,7 @@ SiSSetupForCPUToScreenTexture(ScrnInfoPtr pScrn,
#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
+#endif
if(op != PictOpOver)
return FALSE;
@@ -1145,28 +1664,34 @@ SiSSetupForCPUToScreenTexture(ScrnInfoPtr pScrn,
if(pScrn->bitsPerPixel == 32)
offset <<= 1;
- {
+#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)
+ SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_PERPIXELALPHA | pSiS->SiS310_AccelDepth)
+#endif
+
+ {
CARD8 *dst = (CARD8*)(pSiS->FbBase + offset);
i = height;
+
+ if(pSiS->alphaBlitBusy) {
+ pSiS->alphaBlitBusy = FALSE;
+ SiSIdle
+ }
+
while(i--) {
memcpy(dst, texPtr, width << 2);
texPtr += texPitch;
dst += pitch << 2;
}
}
-
- /* "AGP base" - color depth depending value (see sis_vga.c) */
- SiSSetupDSTColorDepth(pSiS->DstColor);
- /* SRC pitch */
- SiSSetupSRCPitch((pitch << 4));
- /* DST pitch and height (-1 for disabling merge-clipping) */
- SiSSetupDSTRect(pSiS->scrnOffset, -1)
- /* Init CommandReg and set ROP */
- SiSSetupROP(RENDER_OP)
- /* Set command */
- SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO)
- /* Set some color depth depending value (see sis_vga.c) */
- SiSSetupCMDFlag(pSiS->SiS310_AccelDepth)
return TRUE;
}
@@ -1185,8 +1710,8 @@ SiSSubsequentCPUToScreenTexture(ScrnInfoPtr pScrn,
srcbase <<= 1;
#ifdef ACCELDEBUG
- xf86DrvMsg(0, X_INFO, "!: o %x sx %d sy %d dx %d dy %d w %d h %d\n",
- srcbase, src_x, src_y, dst_x, dst_y, width, height);
+ xf86DrvMsg(0, X_INFO, "FIRE: dx %d dy %d w %d h %d\n",
+ dst_x, dst_y, width, height);
#endif
dstbase = 0;
@@ -1198,12 +1723,21 @@ SiSSubsequentCPUToScreenTexture(ScrnInfoPtr pScrn,
srcbase += HEADOFFSET;
dstbase += HEADOFFSET;
#endif
+
+#ifdef SISVRAMQ
+ SiSCheckQueue(16 * 3)
+ SiSSetupSRCDSTBase(srcbase,dstbase);
+ SiSSetupSRCDSTXY(src_x, src_y, dst_x, dst_y)
+ SiSSetRectDoCMD(width,height)
+#else
SiSSetupSRCBase(srcbase);
SiSSetupDSTBase(dstbase);
SiSSetupRect(width, height)
SiSSetupSRCXY(src_x, src_y)
SiSSetupDSTXY(dst_x, dst_y)
SiSDoCMD
+#endif
+ pSiS->alphaBlitBusy = TRUE;
}
#endif
#endif
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 d87e83a8b..64dfaaf1e 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.7 2003/06/28 14:03:13 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.h,v 1.9 2003/08/26 14:29:36 twini Exp $ */
/*
* 2D Acceleration for SiS 315 and Xabre series
* Definitions for the SIS engine communication.
@@ -24,20 +24,21 @@
* PERFORMANCE OF THIS SOFTWARE.
*
* Based on sis300_accel.h
+ * 2003/08/18: Added VRAM queue support
*
* Author: Thomas Winischhofer <thomas@winischhofer.net>
*
*/
-/* SiS310 engine commands */
+/* SiS315 and 330 engine commands */
#define BITBLT 0x00000000 /* Blit */
#define COLOREXP 0x00000001 /* Color expand */
-#define ENCOLOREXP 0x00000002 /* Enhanced color expand */
+#define ENCOLOREXP 0x00000002 /* Enhanced color expand (315 only?) */
#define MULTIPLE_SCANLINE 0x00000003 /* ? */
#define LINE 0x00000004 /* Draw line */
#define TRAPAZOID_FILL 0x00000005 /* Fill trapezoid */
#define TRANSPARENT_BITBLT 0x00000006 /* Transparent Blit */
-#define ALPHA_BLEND 0x00000007 /* Alpha blending BitBlt */
+#define ALPHA_BLEND 0x00000007 /* Alpha blended BitBlt */
#define A3D_FUNCTION 0x00000008 /* 3D command ? */
#define CLEAR_Z_BUFFER 0x00000009 /* ? */
#define GRADIENT_FILL 0x0000000A /* Gradient fill */
@@ -66,8 +67,11 @@
#define OPAQUE 0x00000000
#define TRANSPARENT 0x00100000
-/* Subfunctions for Alpha Blending BitBlt */
-#define A_UNKNOWN 0x00100000 /* (Blits solid?) */
+/* Subfunctions for Alpha Blended BitBlt */
+#define A_CONSTANTALPHA 0x00000000
+#define A_PERPIXELALPHA 0x00080000
+#define A_NODESTALPHA 0x00100000
+#define A_3DFULLSCENE 0x00180000
/* ? */
#define DSTAGP 0x02000000
@@ -75,14 +79,14 @@
/* Subfunctions for Color/Enhanced Color Expansion */
#define COLOR_TO_MONO 0x00100000
-#define AA_TEXT 0x00200000
+#define AA_TEXT 0x00200000 /* ? (hangs the engine) */
/* Line */
#define LINE_STYLE 0x00800000
#define NO_RESET_COUNTER 0x00400000
#define NO_LAST_PIXEL 0x00200000
-/* Trapezoid */
+/* Trapezoid (315 only?) */
#define T_XISMAJORL 0x00800000 /* X axis is driving axis (left) */
#define T_XISMAJORR 0x08000000 /* X axis is driving axis (right) */
#define T_L_Y_INC 0x00000020 /* left edge direction Y */
@@ -151,7 +155,11 @@
#define Q_READ_PTR 0x85C8 /* Current read pointer (?) */
#define Q_STATUS 0x85CC /* queue status */
-/* Macros to do useful things with the SIS 315 BitBLT engine */
+/* VRAM queue operation command definitions */
+#define SIS_SKPC_HEADER 0x16800000L
+#define SIS_NIL_CMD 0x168F0000L
+
+/* Macros to do useful things with the SiS315/330 BitBLT engine */
/* Q_STATUS:
bit 31 = 1: All engines idle and all queues empty
@@ -167,46 +175,505 @@
bits 7:0: 2D counter 1
Where is the command queue length (current amount of commands the queue
- can accept) on the 315 series? (The current implementation works, but only
- as long as there is no 3D driver which uses the queue without your knowledge)
+ 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)
*/
-#define CmdQueLen pSiS->cmdQueueLen
+/* As sis_dri.c relocated the cmd-q len to the sarea, don't use it directly here */
+/* #define CmdQueLen pSiS->cmdQueueLen */
+#define CmdQueLen (*(pSiS->cmdQueueLenPtr))
+
+#define SiSQEmpty \
+ { \
+ while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x0400) != 0x0400) {}; \
+ while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x0400) != 0x0400) {}; \
+ }
+
+#define SiSResetCmd pSiS->CommandReg = 0;
+
+#define SiSSetupCMDFlag(flags) pSiS->CommandReg |= (flags);
+
+/* --- VRAM mode --- */
+
+#define SiSGetSwWP() (CARD32)(*(pSiS->cmdQ_SharedWritePort))
+#define SiSGetHwRP() (CARD32)(MMIO_IN32(pSiS->IOBase, Q_READ_PTR))
+
+#define SiSSyncWP MMIO_OUT32(pSiS->IOBase, Q_WRITE_PTR, (CARD32(*(pSiS->cmdQ_SharedWritePort))));
+
+#define SiSSetHwWP(p) \
+ *(pSiS->cmdQ_SharedWritePort) = (p); \
+ MMIO_OUT32(pSiS->IOBase, Q_WRITE_PTR, (p)); \
+
+#define SiSSetSwWP(p) *(pSiS->cmdQ_SharedWritePort) = (p);
+
+#define SiSCheckQueue(amount)
+
+#if 0
+ { \
+ CARD32 mcurrent, i=0, ttt = SiSGetSwWP(); \
+ if((ttt + amount) >= pSiS->cmdQueueSize) { \
+ do { \
+ mcurrent = MMIO_IN32(pSiS->IOBase, Q_READ_PTR); \
+ i++; \
+ } while((mcurrent > ttt) || (mcurrent < ((ttt + amount) & pSiS->cmdQueueSizeMask))); \
+ } else { \
+ do { \
+ mcurrent = MMIO_IN32(pSiS->IOBase, Q_READ_PTR); \
+ 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
+
+#define SiSUpdateQueue \
+ ttt += 16; \
+ ttt &= pSiS->cmdQueueSizeMask; \
+ if(!ttt) { \
+ while(MMIO_IN32(pSiS->IOBase, Q_READ_PTR) < pSiS->cmdQueueSize_div4) {} \
+ } else if(ttt == pSiS->cmdQueueSize_div4) { \
+ CARD32 temppp; \
+ do { \
+ temppp = MMIO_IN32(pSiS->IOBase, Q_READ_PTR); \
+ if(temppp < ttt || temppp > pSiS->cmdQueueSize_div2) break; \
+ } while(1); \
+ } else if(ttt == pSiS->cmdQueueSize_div2) { \
+ CARD32 temppp; \
+ do { \
+ temppp = MMIO_IN32(pSiS->IOBase, Q_READ_PTR); \
+ if(temppp < pSiS->cmdQueueSize_div2 || temppp > pSiS->cmdQueueSize_4_3) break; \
+ } while(1); \
+ } else if(ttt == pSiS->cmdQueueSize_4_3) { \
+ while(MMIO_IN32(pSiS->IOBase, Q_READ_PTR) > ttt) {} \
+ }
+
+#define SiSNILandUpdateSWQueue \
+ *(CARD32 *)(tt + 8) = (CARD32)(SIS_NIL_CMD); \
+ *(CARD32 *)(tt + 12) = (CARD32)(SIS_NIL_CMD); \
+ SiSUpdateQueue; \
+ SiSSetSwWP(ttt);
+
+#ifdef SISVRAMQ
+
+#define SiSIdle \
+ { \
+ while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) {}; \
+ while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) {}; \
+ }
+
+#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); \
+ SiSUpdateQueue \
+ SiSSetSwWP(ttt); \
+ }
+
+#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)); \
+ SiSUpdateQueue \
+ SiSSetSwWP(ttt); \
+ }
+
+#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)); \
+ SiSUpdateQueue \
+ SiSSetSwWP(ttt); \
+ }
+
+#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)); \
+ SiSUpdateQueue \
+ SiSSetSwWP(ttt); \
+ }
+
+#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); \
+ 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); \
+ 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)); \
+ 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); \
+ 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)); \
+ 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)); \
+ SiSNILandUpdateSWQueue \
+ }
+
+#define SiSSetupDSTColorDepth(bpp) \
+ pSiS->CommandReg = (((CARD32)(bpp)) & (GENMASK(17:16)));
+
+#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)); \
+ SiSUpdateQueue \
+ SiSSetSwWP(ttt); \
+ }
+
+#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)); \
+ SiSUpdateQueue \
+ SiSSetSwWP(ttt); \
+ }
+
+#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); \
+ SiSUpdateQueue \
+ SiSSetSwWP(ttt); \
+ }
+
+#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)); \
+ 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); \
+ 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); \
+ 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); \
+ SiSNILandUpdateSWQueue \
+ }
-/* TW: FIXME: CmdQueLen is... where....? */
+#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); \
+ 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); \
+ SiSUpdateQueue \
+ SiSSetSwWP(ttt); \
+ }
+
+#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); \
+ SiSUpdateQueue \
+ SiSSetSwWP(ttt); \
+ }
+
+#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); \
+ SiSUpdateQueue \
+ SiSSetSwWP(ttt); \
+ }
+
+#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); \
+ SiSUpdateQueue \
+ SiSSetSwWP(ttt); \
+ }
+
+#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); \
+ SiSUpdateQueue \
+ SiSSetHwWP(ttt); \
+ }
+
+#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); \
+ SiSUpdateQueue \
+ SiSSetHwWP(ttt); \
+ }
+
+#define SiSSetupROP(rop) \
+ pSiS->CommandReg |= (rop) << 8;
+
+#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); \
+ SiSUpdateQueue \
+ SiSSetHwWP(ttt); \
+ }
+
+/* Line */
+
+#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)); \
+ SiSUpdateQueue \
+ SiSSetSwWP(ttt); \
+ }
+
+#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)); \
+ 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)); \
+ 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)); \
+ 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); \
+ SiSUpdateQueue \
+ SiSSetSwWP(ttt); \
+ }
+
+/* Trapezoid */
+
+#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)); \
+ SiSUpdateQueue \
+ SiSSetSwWP(ttt); \
+ }
+
+
+#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)); \
+ SiSUpdateQueue \
+ SiSSetSwWP(ttt); \
+ }
+
+#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); \
+ SiSUpdateQueue \
+ SiSSetSwWP(ttt); \
+ }
+
+/* Alpha blended BitBlt (alpha = 8 bit) */
+
+#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); \
+ SiSNILandUpdateSWQueue \
+ }
+
+#endif /* VRAM mode */
+
+/* ---- MMIO mode ---- */
+
+#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 (assuming that there is no 3D support yet)
- * We calculate it very cautiously (128K only) and let the
- * rest to the (never?)-to-come (?) 3D engine. (The 3D engine
- * can use a similar technique, using the remaining 384K,
- * hence a queue overflow is avoided)
+ * calculated (and written to the address pointed to by
+ * CmdQueueLenPtr, since sis_dri.c relocates this)
* UPDATE: using the command queue without syncing totally
* (ie assuming a QueueLength of 0) decreases system latency
* 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...
+ * but it keeps the rest of the box somewhat alive.
*/
#define SiSIdle \
{ \
if(pSiS->ChipFlags & SiSCF_Integrated) { \
- /* CmdQueLen = ((128 * 1024) / 4) - 64; - decreases system latecy dramatically */ \
CmdQueLen = 0; \
} else { \
- CmdQueLen = ((128 * 1024) / 4) - 64; \
+ CmdQueLen = ((512 * 1024) / 4) - 64; \
} \
while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) {}; \
while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) {}; \
}
#define SiSSetupSRCBase(base) \
- if (CmdQueLen <= 0) SiSIdle;\
- MMIO_OUT32(pSiS->IOBase, SRC_ADDR, base);\
+ if (CmdQueLen <= 0) SiSIdle; \
+ MMIO_OUT32(pSiS->IOBase, SRC_ADDR, base); \
CmdQueLen--;
#define SiSSetupSRCPitch(pitch) \
- if (CmdQueLen <= 0) SiSIdle;\
- MMIO_OUT16(pSiS->IOBase, SRC_PITCH, pitch);\
+ if (CmdQueLen <= 0) SiSIdle; \
+ MMIO_OUT16(pSiS->IOBase, SRC_PITCH, pitch); \
CmdQueLen--;
#define SiSSetupSRCXY(x,y) \
@@ -235,69 +702,68 @@
CmdQueLen--;
#define SiSSetupRect(w,h) \
- if (CmdQueLen <= 0) SiSIdle;\
+ if(CmdQueLen <= 0) SiSIdle;\
MMIO_OUT32(pSiS->IOBase, RECT_WIDTH, (h)<<16 | (w) );\
CmdQueLen--;
#define SiSSetupPATFG(color) \
- if (CmdQueLen <= 0) SiSIdle;\
+ if(CmdQueLen <= 0) SiSIdle;\
MMIO_OUT32(pSiS->IOBase, PAT_FGCOLOR, color);\
CmdQueLen--;
#define SiSSetupPATBG(color) \
- if (CmdQueLen <= 0) SiSIdle;\
+ if(CmdQueLen <= 0) SiSIdle;\
MMIO_OUT32(pSiS->IOBase, PAT_BGCOLOR, color);\
CmdQueLen--;
#define SiSSetupSRCFG(color) \
- if (CmdQueLen <= 0) SiSIdle;\
+ if(CmdQueLen <= 0) SiSIdle;\
MMIO_OUT32(pSiS->IOBase, SRC_FGCOLOR, color);\
CmdQueLen--;
#define SiSSetupSRCBG(color) \
- if (CmdQueLen <= 0) SiSIdle;\
- MMIO_OUT32(pSiS->IOBase, SRC_BGCOLOR, color);\
+ if(CmdQueLen <= 0) SiSIdle; \
+ MMIO_OUT32(pSiS->IOBase, SRC_BGCOLOR, color); \
CmdQueLen--;
#define SiSSetupSRCTrans(color) \
- if (CmdQueLen <= 1) SiSIdle;\
+ if(CmdQueLen <= 1) SiSIdle;\
MMIO_OUT32(pSiS->IOBase, TRANS_SRC_KEY_HIGH, color);\
MMIO_OUT32(pSiS->IOBase, TRANS_SRC_KEY_LOW, color);\
CmdQueLen -= 2;
#define SiSSetupDSTTrans(color) \
- if (CmdQueLen <= 1) SiSIdle;\
+ if(CmdQueLen <= 1) SiSIdle;\
MMIO_OUT32(pSiS->IOBase, TRANS_DST_KEY_HIGH, color); \
MMIO_OUT32(pSiS->IOBase, TRANS_DST_KEY_LOW, color); \
CmdQueLen -= 2;
#define SiSSetupMONOPAT(p0,p1) \
- if (CmdQueLen <= 1) SiSIdle;\
+ if(CmdQueLen <= 1) SiSIdle;\
MMIO_OUT32(pSiS->IOBase, MONO_MASK, p0);\
MMIO_OUT32(pSiS->IOBase, MONO_MASK+4, p1);\
CmdQueLen=CmdQueLen-2;
#define SiSSetupClipLT(left,top) \
- if (CmdQueLen <= 0) SiSIdle;\
- MMIO_OUT32(pSiS->IOBase, LEFT_CLIP, ((left) & 0xFFFF) | (top)<<16 );\
+ if(CmdQueLen <= 0) SiSIdle;\
+ MMIO_OUT32(pSiS->IOBase, LEFT_CLIP, ((left) & 0xFFFF) | (top)<<16); \
CmdQueLen--;
#define SiSSetupClipRB(right,bottom) \
- if (CmdQueLen <= 0) SiSIdle;\
- MMIO_OUT32(pSiS->IOBase, RIGHT_CLIP, ((right) & 0xFFFF) | (bottom)<<16 );\
+ if(CmdQueLen <= 0) SiSIdle; \
+ MMIO_OUT32(pSiS->IOBase, RIGHT_CLIP, ((right) & 0xFFFF) | (bottom)<<16); \
CmdQueLen--;
#define SiSSetupROP(rop) \
pSiS->CommandReg = (rop) << 8;
-#define SiSSetupCMDFlag(flags) \
- pSiS->CommandReg |= (flags);
-
#define SiSDoCMD \
if (CmdQueLen <= 1) SiSIdle;\
MMIO_OUT32(pSiS->IOBase, COMMAND_READY, pSiS->CommandReg); \
MMIO_OUT32(pSiS->IOBase, FIRE_TRIGGER, 0); \
- CmdQueLen=CmdQueLen-2;
+ CmdQueLen -= 2;
+
+/* Line */
#define SiSSetupX0Y0(x,y) \
if (CmdQueLen <= 0) SiSIdle;\
@@ -330,45 +796,50 @@
CmdQueLen--;
/* Trapezoid */
+
#define SiSSetupYH(y,h) \
if (CmdQueLen <= 0) SiSIdle;\
MMIO_OUT32(pSiS->IOBase, TRAP_YH, (y)<<16 | (h) );\
- CmdQueLen --;
+ CmdQueLen--;
#define SiSSetupLR(left,right) \
if (CmdQueLen <= 0) SiSIdle;\
MMIO_OUT32(pSiS->IOBase, TRAP_LR, (right)<<16 | (left) );\
- CmdQueLen --;
+ CmdQueLen--;
#define SiSSetupdL(dxL,dyL) \
if (CmdQueLen <= 0) SiSIdle;\
MMIO_OUT32(pSiS->IOBase, TRAP_DL, (dyL)<<16 | (dxL) );\
- CmdQueLen --;
+ CmdQueLen--;
#define SiSSetupdR(dxR,dyR) \
if (CmdQueLen <= 0) SiSIdle;\
MMIO_OUT32(pSiS->IOBase, TRAP_DR, (dyR)<<16 | (dxR) );\
- CmdQueLen --;
+ CmdQueLen--;
#define SiSSetupEL(eL) \
if (CmdQueLen <= 0) SiSIdle;\
MMIO_OUT32(pSiS->IOBase, TRAP_EL, eL);\
- CmdQueLen --;
+ CmdQueLen--;
#define SiSSetupER(eR) \
if (CmdQueLen <= 0) SiSIdle;\
MMIO_OUT32(pSiS->IOBase, TRAP_ER, eR);\
- CmdQueLen --;
+ CmdQueLen--;
+
+/* Alpha blended BitBlt (alpha = 8 bit) */
-/* Alpha blending BitBlt (alpha = 8 bit) */
#define SiSSetupAlpha(alpha) \
if (CmdQueLen <= 0) SiSIdle;\
MMIO_OUT32(pSiS->IOBase, ALPHA_ALPHA, alpha);\
CmdQueLen--;
-/* Set Pattern register */
+/* Set Pattern register */
+
#define SiSSetPattern(num, value) \
if (CmdQueLen <= 0) SiSIdle; \
MMIO_OUT32(pSiS->IOBase, (PATTERN_REG + (num * 4)), value); \
CmdQueLen--;
+#endif /* MMIO mode */
+
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 593aeb782..d9f5852ea 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.37 2003/08/07 12:52:23 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c,v 1.38 2003/08/23 10:25:19 twini Exp $ */
/*
* DAC helper functions (Save/Restore, MemClk, etc)
*
@@ -738,7 +738,7 @@ SiS315Save(ScrnInfoPtr pScrn, SISRegPtr sisReg)
#endif
}
- /* TW: Save command queue location */
+ /* Save command queue location */
sisReg->sisMMIO85C0 = MMIO_IN32(pSiS->IOBase, 0x85C0);
/* Save CR registers */
@@ -819,6 +819,15 @@ SiS315Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
while ( (MMIO_IN32(pSiS->IOBase, 0x85CC) & 0x80000000) != 0x80000000){};
}
+ /* We reset the command queue before restoring.
+ * This might be required because we never know what
+ * console driver (like the kernel framebuffer driver)
+ * or application is running and which queue mode it
+ * uses.
+ */
+ outSISIDXREG(SISSR, 0x27, 0x1F);
+ outSISIDXREG(SISSR, 0x26, 0x01);
+
/* Restore extended CR registers */
for (i = 0x19; i < 0x5C; i++) {
outSISIDXREG(SISCR, i, sisReg->sisRegs3D4[i]);
@@ -832,15 +841,6 @@ SiS315Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
outSISIDXREG(SISSR, 0x20, sisReg->sisRegs3C4[0x20]);
}
- /* We reset the command queue before restoring.
- * This might be required because we never know what
- * console driver (like the kernel framebuffer driver)
- * or application is running and which queue mode it
- * uses.
- */
- outSISIDXREG(SISSR, 0x27, 0x1F);
- outSISIDXREG(SISSR, 0x26, 0x01);
-
/* Restore extended SR registers */
for (i = 0x06; i <= 0x3F; i++) {
outSISIDXREG(SISSR, i, sisReg->sisRegs3C4[i]);
@@ -876,8 +876,10 @@ SiS315Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
outSISIDXREG(SISSR,0x2d,0x01);
}
+#ifndef SISVRAMQ
/* Initialize read/write pointer for command queue */
MMIO_OUT32(pSiS->IOBase, 0x85C4, MMIO_IN32(pSiS->IOBase, 0x85C8));
+#endif
/* Restore queue location */
MMIO_OUT32(pSiS->IOBase, 0x85C0, sisReg->sisMMIO85C0);
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 c689f1e5c..1c129cc00 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,11 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.28 2003/05/21 15:15:03 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.30 2003/08/23 15:34:37 twini Exp $ */
/*
- * DRI wrapper for 300, 540, 630, 730
+ * DRI wrapper for 300 and 315 series
+ *
+ * Preliminary 315/330 support by Thomas Winischhofer
*
* Taken and modified from tdfx_dri.c, mga_dri.c
+ *
*/
#include "xf86.h"
@@ -22,21 +25,19 @@
#include "xf86drmCompat.h"
#endif
-/* TW: Idle function for 300 series */
+/* Idle function for 300 series */
#define BR(x) (0x8200 | (x) << 2)
#define SiSIdle \
while((MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \
while((MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \
MMIO_IN16(pSiS->IOBase, 0x8240);
-/* TW: Idle function for 315 series */
+/* Idle function for 315/330 series */
#define Q_STATUS 0x85CC
#define SiS315Idle \
{ \
while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000){}; \
while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000){}; \
- while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000){}; \
- MMIO_IN16(pSiS->IOBase, Q_STATUS); \
}
@@ -52,6 +53,10 @@ extern void GlxSetVisualConfigs(
#define AGP_CMDBUF_PAGES 256
#define AGP_CMDBUF_SIZE (AGP_PAGE_SIZE * AGP_CMDBUF_PAGES)
+/* 315/330 */
+#define AGP_VTXBUF_PAGES 512
+#define AGP_VTXBUF_SIZE (AGP_PAGE_SIZE * AGP_VTXBUF_PAGES)
+
static char SISKernelDriverName[] = "sis";
static char SISClientDriverName[] = "sis";
@@ -86,8 +91,8 @@ SISInitVisualConfigs(ScreenPtr pScreen)
int i, db, z_stencil, accum;
Bool useZ16 = FALSE;
- if(getenv("SIS_FORCE_Z16")){
- useZ16 = TRUE;
+ if(getenv("SIS_FORCE_Z16")) {
+ useZ16 = TRUE;
}
switch (pScrn->bitsPerPixel) {
@@ -96,30 +101,29 @@ SISInitVisualConfigs(ScreenPtr pScreen)
break;
case 16:
case 32:
- numConfigs = (useZ16)?8:16;
+ numConfigs = (useZ16) ? 8 : 16;
- if (!(pConfigs = (__GLXvisualConfig*)xcalloc(sizeof(__GLXvisualConfig),
+ if(!(pConfigs = (__GLXvisualConfig*)xcalloc(sizeof(__GLXvisualConfig),
numConfigs))) {
- return FALSE;
+ return FALSE;
}
- if (!(pSISConfigs = (SISConfigPrivPtr)xcalloc(sizeof(SISConfigPrivRec),
+ if(!(pSISConfigs = (SISConfigPrivPtr)xcalloc(sizeof(SISConfigPrivRec),
numConfigs))) {
- xfree(pConfigs);
- return FALSE;
+ xfree(pConfigs);
+ return FALSE;
}
- if (!(pSISConfigPtrs = (SISConfigPrivPtr*)xcalloc(sizeof(SISConfigPrivPtr),
+ if(!(pSISConfigPtrs = (SISConfigPrivPtr*)xcalloc(sizeof(SISConfigPrivPtr),
numConfigs))) {
- xfree(pConfigs);
- xfree(pSISConfigs);
- return FALSE;
+ xfree(pConfigs);
+ xfree(pSISConfigs);
+ return FALSE;
}
- for (i=0; i<numConfigs; i++)
- pSISConfigPtrs[i] = &pSISConfigs[i];
+ for(i=0; i<numConfigs; i++) pSISConfigPtrs[i] = &pSISConfigs[i];
i = 0;
- for (accum = 0; accum <= 1; accum++) {
- for (z_stencil=0; z_stencil<(useZ16?2:4); z_stencil++) {
- for (db = 0; db <= 1; db++) {
+ for(accum = 0; accum <= 1; accum++) {
+ for(z_stencil=0; z_stencil<(useZ16?2:4); z_stencil++) {
+ for(db = 0; db <= 1; db++) {
pConfigs[i].vid = -1;
pConfigs[i].class = -1;
pConfigs[i].rgba = TRUE;
@@ -130,7 +134,7 @@ SISInitVisualConfigs(ScreenPtr pScreen)
pConfigs[i].greenMask = -1;
pConfigs[i].blueMask = -1;
pConfigs[i].alphaMask = 0;
- if (accum) {
+ if(accum) {
pConfigs[i].accumRedSize = 16;
pConfigs[i].accumGreenSize = 16;
pConfigs[i].accumBlueSize = 16;
@@ -141,13 +145,11 @@ SISInitVisualConfigs(ScreenPtr pScreen)
pConfigs[i].accumBlueSize = 0;
pConfigs[i].accumAlphaSize = 0;
}
- if (db)
- pConfigs[i].doubleBuffer = TRUE;
- else
- pConfigs[i].doubleBuffer = FALSE;
+ if(db) pConfigs[i].doubleBuffer = TRUE;
+ else pConfigs[i].doubleBuffer = FALSE;
pConfigs[i].stereo = FALSE;
pConfigs[i].bufferSize = -1;
- switch (z_stencil){
+ switch(z_stencil) {
case 0:
pConfigs[i].depthSize = 0;
pConfigs[i].stencilSize = 0;
@@ -178,10 +180,10 @@ SISInitVisualConfigs(ScreenPtr pScreen)
}
}
}
- if (i != numConfigs) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ if(i != numConfigs) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"[dri] Incorrect initialization of visuals. Disabling DRI.\n");
- return FALSE;
+ return FALSE;
}
break;
}
@@ -200,18 +202,23 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
SISPtr pSIS = SISPTR(pScrn);
DRIInfoPtr pDRIInfo;
SISDRIPtr pSISDRI;
-#if 000
+#if 0
drmVersionPtr version;
#endif
+ pSIS->cmdQueueLenPtrBackup = NULL;
+#ifdef SIS315DRI
+ pSIS->cmdQ_SharedWritePortBackup = NULL;
+#endif
+
/* Check that the GLX, DRI, and DRM modules have been loaded by testing
* for canonical symbols in each module. */
- if (!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) return FALSE;
- if (!xf86LoaderCheckSymbol("DRIScreenInit")) return FALSE;
- if (!xf86LoaderCheckSymbol("drmAvailable")) return FALSE;
- if (!xf86LoaderCheckSymbol("DRIQueryVersion")) {
+ if(!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) return FALSE;
+ if(!xf86LoaderCheckSymbol("DRIScreenInit")) return FALSE;
+ if(!xf86LoaderCheckSymbol("drmAvailable")) return FALSE;
+ if(!xf86LoaderCheckSymbol("DRIQueryVersion")) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[dri] SISDRIScreenInit failed (libdri.a too old)\n");
+ "[dri] SISDRIScreenInit failed (libdri.a too old)\n");
return FALSE;
}
@@ -219,7 +226,7 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
{
int major, minor, patch;
DRIQueryVersion(&major, &minor, &patch);
- if (major != 4 || minor < 0) {
+ if(major != 4 || minor < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
"[dri] SISDRIScreenInit failed because of a version mismatch.\n"
"[dri] libDRI version is %d.%d.%d but version 4.0.x is needed.\n"
@@ -237,9 +244,9 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
pDRIInfo->clientDriverName = SISClientDriverName;
pDRIInfo->busIdString = xalloc(64);
sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d",
- ((pciConfigPtr)pSIS->PciInfo->thisCard)->busnum,
- ((pciConfigPtr)pSIS->PciInfo->thisCard)->devnum,
- ((pciConfigPtr)pSIS->PciInfo->thisCard)->funcnum);
+ ((pciConfigPtr)pSIS->PciInfo->thisCard)->busnum,
+ ((pciConfigPtr)pSIS->PciInfo->thisCard)->devnum,
+ ((pciConfigPtr)pSIS->PciInfo->thisCard)->funcnum);
pDRIInfo->ddxDriverMajorVersion = 0;
pDRIInfo->ddxDriverMinorVersion = 1;
pDRIInfo->ddxDriverPatchVersion = 0;
@@ -261,10 +268,10 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
pDRIInfo->ddxDrawableTableEntry = SIS_MAX_DRAWABLES;
- if (SAREA_MAX_DRAWABLES < SIS_MAX_DRAWABLES)
- pDRIInfo->maxDrawableTableEntry = SAREA_MAX_DRAWABLES;
+ if(SAREA_MAX_DRAWABLES < SIS_MAX_DRAWABLES)
+ pDRIInfo->maxDrawableTableEntry = SAREA_MAX_DRAWABLES;
else
- pDRIInfo->maxDrawableTableEntry = SIS_MAX_DRAWABLES;
+ pDRIInfo->maxDrawableTableEntry = SIS_MAX_DRAWABLES;
#ifdef NOT_DONE
/* FIXME need to extend DRI protocol to pass this size back to client
@@ -278,18 +285,18 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
/* For now the mapping works by using a fixed size defined
* in the SAREA header
*/
- if (sizeof(XF86DRISAREARec)+sizeof(SISSAREAPriv) > SAREA_MAX) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Data does not fit in SAREA\n");
- return FALSE;
+ if(sizeof(XF86DRISAREARec)+sizeof(SISSAREAPriv) > SAREA_MAX) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Data does not fit in SAREA\n");
+ return FALSE;
}
pDRIInfo->SAREASize = SAREA_MAX;
#endif
- if (!(pSISDRI = (SISDRIPtr)xcalloc(sizeof(SISDRIRec),1))) {
- DRIDestroyInfoRec(pSIS->pDRIInfo);
- pSIS->pDRIInfo=0;
- return FALSE;
+ if(!(pSISDRI = (SISDRIPtr)xcalloc(sizeof(SISDRIRec),1))) {
+ DRIDestroyInfoRec(pSIS->pDRIInfo);
+ pSIS->pDRIInfo = 0;
+ return FALSE;
}
pDRIInfo->devPrivate = pSISDRI;
pDRIInfo->devPrivateSize = sizeof(SISDRIRec);
@@ -302,18 +309,18 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
pDRIInfo->MoveBuffers = SISDRIMoveBuffers;
pDRIInfo->bufferRequests = DRI_ALL_WINDOWS;
- if (!DRIScreenInit(pScreen, pDRIInfo, &pSIS->drmSubFD)) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[dri] DRIScreenInit failed. Disabling DRI.\n");
- xfree(pDRIInfo->devPrivate);
- pDRIInfo->devPrivate=0;
- DRIDestroyInfoRec(pSIS->pDRIInfo);
- pSIS->pDRIInfo=0;
- pSIS->drmSubFD = -1;
- return FALSE;
+ if(!DRIScreenInit(pScreen, pDRIInfo, &pSIS->drmSubFD)) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR,
+ "[dri] DRIScreenInit failed. Disabling DRI.\n");
+ xfree(pDRIInfo->devPrivate);
+ pDRIInfo->devPrivate = 0;
+ DRIDestroyInfoRec(pSIS->pDRIInfo);
+ pSIS->pDRIInfo = 0;
+ pSIS->drmSubFD = -1;
+ return FALSE;
}
-#if 000
+#if 0
/* XXX Check DRM kernel version here */
version = drmGetVersion(info->drmFD);
if (version) {
@@ -337,49 +344,56 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
pSISDRI->regs.size = SISIOMAPSIZE;
pSISDRI->regs.map = 0;
- if (drmAddMap(pSIS->drmSubFD, (drmHandle)pSIS->IOAddress,
- pSISDRI->regs.size, DRM_REGISTERS, 0,
- &pSISDRI->regs.handle)<0)
- {
- SISDRICloseScreen(pScreen);
- return FALSE;
+ if(drmAddMap(pSIS->drmSubFD, (drmHandle)pSIS->IOAddress,
+ pSISDRI->regs.size, DRM_REGISTERS, 0,
+ &pSISDRI->regs.handle) < 0) {
+ SISDRICloseScreen(pScreen);
+ return FALSE;
}
xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Registers = 0x%08lx\n",
pSISDRI->regs.handle);
/* AGP */
- do{
+ do {
pSIS->agpSize = 0;
pSIS->agpCmdBufSize = 0;
pSISDRI->AGPCmdBufSize = 0;
- if (drmAgpAcquire(pSIS->drmSubFD) < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpAcquire failed\n");
- break;
+ if(drmAgpAcquire(pSIS->drmSubFD) < 0) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpAcquire failed\n");
+ break;
}
-
- /* TODO: default value is 2x? */
- if (drmAgpEnable(pSIS->drmSubFD, drmAgpGetMode(pSIS->drmSubFD)&~0x0) < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpEnable failed\n");
- break;
+
+ if(pSIS->VGAEngine == SIS_315_VGA) {
+#ifdef SIS315DRI
+ /* Default to 1X agp mode in SIS315 */
+ 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) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpEnable failed\n");
+ break;
+ }
}
- xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] drmAgpEnabled succeeded\n");
- if (drmAgpAlloc(pSIS->drmSubFD, AGP_SIZE, 0, NULL, &pSIS->agpHandle) < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] drmAgpAlloc failed\n");
- drmAgpRelease(pSIS->drmSubFD);
- break;
+ xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] drmAgpEnabled succeeded\n");
+
+ if(drmAgpAlloc(pSIS->drmSubFD, AGP_SIZE, 0, NULL, &pSIS->agpHandle) < 0) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpAlloc failed\n");
+ drmAgpRelease(pSIS->drmSubFD);
+ break;
}
- if (drmAgpBind(pSIS->drmSubFD, pSIS->agpHandle, 0) < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] drmAgpBind failed\n");
- drmAgpFree(pSIS->drmSubFD, pSIS->agpHandle);
- drmAgpRelease(pSIS->drmSubFD);
-
- break;
+ if(drmAgpBind(pSIS->drmSubFD, pSIS->agpHandle, 0) < 0) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpBind failed\n");
+ drmAgpFree(pSIS->drmSubFD, pSIS->agpHandle);
+ drmAgpRelease(pSIS->drmSubFD);
+ break;
}
pSIS->agpSize = AGP_SIZE;
@@ -387,25 +401,39 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
/* pSIS->agpBase = */
pSISDRI->agp.size = pSIS->agpSize;
- if (drmAddMap(pSIS->drmSubFD, (drmHandle)0,
- pSISDRI->agp.size, DRM_AGP, 0,
+ if(drmAddMap(pSIS->drmSubFD, (drmHandle)0,
+ pSISDRI->agp.size, DRM_AGP, 0,
&pSISDRI->agp.handle) < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
+ xf86DrvMsg(pScreen->myNum, X_ERROR,
"[drm] Failed to map public agp area\n");
- pSISDRI->agp.size = 0;
- break;
- }
-
- pSIS->agpCmdBufSize = AGP_CMDBUF_SIZE;
- pSIS->agpCmdBufAddr = pSIS->agpAddr;
- pSIS->agpCmdBufBase = pSIS->agpCmdBufAddr - pSIS->agpAddr +
- pSIS->agpBase;
- pSIS->agpCmdBufFree = 0;
+ pSISDRI->agp.size = 0;
+ break;
+ }
+
+ if(pSIS->VGAEngine == SIS_315_VGA) {
+#ifdef SIS315DRI
+ pSIS->agpVtxBufSize = AGP_VTXBUF_SIZE; /* = 2MB */
+ pSIS->agpVtxBufAddr = pSIS->agpAddr;
+ pSIS->agpVtxBufBase = pSIS->agpVtxBufAddr - pSIS->agpAddr + pSIS->agpBase;
+ pSIS->agpVtxBufFree = 0;
+
+ pSISDRI->AGPVtxBufOffset = pSIS->agpVtxBufAddr - pSIS->agpAddr;
+ pSISDRI->AGPVtxBufSize = pSIS->agpVtxBufSize;
+
+ drmSiSAgpInit(pSIS->drmSubFD, AGP_VTXBUF_SIZE,(AGP_SIZE - AGP_VTXBUF_SIZE));
+#endif
+ } else {
+
+ pSIS->agpCmdBufSize = AGP_CMDBUF_SIZE;
+ pSIS->agpCmdBufAddr = pSIS->agpAddr;
+ pSIS->agpCmdBufBase = pSIS->agpCmdBufAddr - pSIS->agpAddr + pSIS->agpBase;
+ pSIS->agpCmdBufFree = 0;
- pSISDRI->AGPCmdBufOffset = pSIS->agpCmdBufAddr - pSIS->agpAddr;
- pSISDRI->AGPCmdBufSize = pSIS->agpCmdBufSize;
+ pSISDRI->AGPCmdBufOffset = pSIS->agpCmdBufAddr - pSIS->agpAddr;
+ pSISDRI->AGPCmdBufSize = pSIS->agpCmdBufSize;
- drmSiSAgpInit(pSIS->drmSubFD, AGP_CMDBUF_SIZE,(AGP_SIZE - AGP_CMDBUF_SIZE));
+ drmSiSAgpInit(pSIS->drmSubFD, AGP_CMDBUF_SIZE,(AGP_SIZE - AGP_CMDBUF_SIZE));
+ }
}
while(0);
@@ -415,24 +443,22 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
((pciConfigPtr)pSIS->PciInfo->thisCard)->devnum,
((pciConfigPtr)pSIS->PciInfo->thisCard)->funcnum);
- if((drmCtlInstHandler(pSIS->drmSubFD, pSIS->irq)) != 0)
- {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ if((drmCtlInstHandler(pSIS->drmSubFD, pSIS->irq)) != 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"[drm] failure adding irq %d handler, stereo disabled\n",
pSIS->irq);
- pSIS->irqEnabled = FALSE;
- }
- else
- {
- pSIS->irqEnabled = TRUE;
- }
+ pSIS->irqEnabled = FALSE;
+ } else {
+ pSIS->irqEnabled = TRUE;
+ }
pSISDRI->irqEnabled = pSIS->irqEnabled;
- if (!(SISInitVisualConfigs(pScreen))) {
- SISDRICloseScreen(pScreen);
- return FALSE;
+ if(!(SISInitVisualConfigs(pScreen))) {
+ SISDRICloseScreen(pScreen);
+ return FALSE;
}
+
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] visual configs initialized.\n" );
return TRUE;
@@ -444,23 +470,36 @@ SISDRICloseScreen(ScreenPtr pScreen)
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
SISPtr pSIS = SISPTR(pScrn);
+ if(pSIS->VGAEngine == SIS_315_VGA) {
+#ifdef SIS315DRI
+ if(pSIS->cmdQ_SharedWritePortBackup) {
+ pSIS->cmdQ_SharedWritePort = pSIS->cmdQ_SharedWritePortBackup;
+ }
+#endif
+ } else {
+ if(pSIS->cmdQueueLenPtrBackup) {
+ pSIS->cmdQueueLenPtr = pSIS->cmdQueueLenPtrBackup;
+ *(pSIS->cmdQueueLenPtr) = 0;
+ }
+ }
+
DRICloseScreen(pScreen);
- if (pSIS->pDRIInfo) {
- if (pSIS->pDRIInfo->devPrivate) {
- xfree(pSIS->pDRIInfo->devPrivate);
- pSIS->pDRIInfo->devPrivate=0;
- }
- DRIDestroyInfoRec(pSIS->pDRIInfo);
- pSIS->pDRIInfo=0;
+ if(pSIS->pDRIInfo) {
+ if(pSIS->pDRIInfo->devPrivate) {
+ xfree(pSIS->pDRIInfo->devPrivate);
+ pSIS->pDRIInfo->devPrivate=0;
+ }
+ DRIDestroyInfoRec(pSIS->pDRIInfo);
+ pSIS->pDRIInfo=0;
}
- if (pSIS->pVisualConfigs) xfree(pSIS->pVisualConfigs);
- if (pSIS->pVisualConfigsPriv) xfree(pSIS->pVisualConfigsPriv);
+ if(pSIS->pVisualConfigs) xfree(pSIS->pVisualConfigs);
+ if(pSIS->pVisualConfigsPriv) xfree(pSIS->pVisualConfigsPriv);
if(pSIS->agpSize){
- xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Freeing agp memory\n");
+ xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Freeing agp memory\n");
drmAgpFree(pSIS->drmSubFD, pSIS->agpHandle);
- xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Releasing agp module\n");
+ xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Releasing agp module\n");
drmAgpRelease(pSIS->drmSubFD);
}
}
@@ -514,28 +553,32 @@ SISDRIFinishScreenInit(ScreenPtr pScreen)
{
SISSAREAPriv *saPriv;
- saPriv=(SISSAREAPriv*)DRIGetSAREAPrivate(pScreen);
+ saPriv = (SISSAREAPriv*)DRIGetSAREAPrivate(pScreen);
assert(saPriv);
saPriv->CtxOwner = -1;
- saPriv->QueueLength = 0;
+ saPriv->QueueLength = *(pSiS->cmdQueueLenPtr);
+ pSiS->cmdQueueLenPtrBackup = pSiS->cmdQueueLenPtr;
pSiS->cmdQueueLenPtr = &(saPriv->QueueLength);
- saPriv->AGPCmdBufNext = 0;
- /* frame control */
- saPriv->FrameCount = 0;
- if (pSiS->VGAEngine == SIS_315_VGA) { /* 315 series */
-#if 0
- *(unsigned long *)(pSiS->IOBase+0x8a2c) = 0; /* FIXME: Where is this on the 315 series ? */
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+#ifdef SIS315DRI
+ saPriv->AGPVtxBufNext = 0;
+ saPriv->sharedWPoffset = pSiS->cmdQ_SharedWritePort_2D;
+ pSiS->cmdQ_SharedWritePortBackup = pSiS->cmdQ_SharedWritePort;
+ pSiS->cmdQ_SharedWritePort = &(saPriv->sharedWPoffset);
#endif
- SiS315Idle
- } else { /* 300 series (and below) */
+ } else {
+ saPriv->AGPCmdBufNext = 0;
+
+ /* frame control */
+ saPriv->FrameCount = 0;
*(unsigned long *)(pSiS->IOBase+0x8a2c) = 0;
SiSIdle
}
}
-
+
return DRIFinishScreenInit(pScreen);
}
@@ -563,14 +606,13 @@ SISDRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
* TODO: do this only if X-Server get lock. If kernel supports delayed
* signal, needless to do this
*/
- if (pSiS->VGAEngine == SIS_315_VGA) {
-#if 0
- *(pSiS->IOBase + 0x8B50) = 0xff; /* FIXME: Where is this on 315 series */
- *(unsigned int *)(pSiS->IOBase + 0x8B60) = -1; /* FIXME: Where is this on 315 series */
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+#ifdef SIS315DRI
+ /* ? */
#endif
} else {
- *(pSiS->IOBase + 0x8B50) = 0xff;
- *(unsigned int *)(pSiS->IOBase + 0x8B60) = -1;
+ *(pSiS->IOBase + 0x8B50) = 0xff;
+ *(unsigned int *)(pSiS->IOBase + 0x8B60) = -1;
}
}
@@ -581,10 +623,12 @@ SISDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index)
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
SISPtr pSiS = SISPTR(pScrn);
- if (pSiS->VGAEngine == SIS_315_VGA) {
- SiS315Idle /* 315 series */
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+#ifdef SIS315DRI
+ SiS315Idle /* 315 series */
+#endif
} else {
- SiSIdle /* 300 series */
+ SiSIdle /* 300 series */
}
}
@@ -596,10 +640,12 @@ SISDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
SISPtr pSiS = SISPTR(pScrn);
- if (pSiS->VGAEngine == SIS_315_VGA) {
- SiS315Idle /* 315 series */
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+#ifdef SIS315DRI
+ SiS315Idle /* 315 series */
+#endif
} else {
- SiSIdle /* 300 series and below */
+ SiSIdle /* 300 series */
}
}
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 32d477566..7491c8f0c 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h
@@ -1,11 +1,11 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h,v 1.2 2000/08/04 03:51:46 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h,v 1.8 2003/08/23 15:34:38 twini Exp $ */
/* modified from tdfx_dri.h */
#ifndef _SIS_DRI_
#define _SIS_DRI_
-#include <xf86drm.h>
+#include "xf86drm.h"
#define SIS_MAX_DRAWABLES 256
#define SISIOMAPSIZE (64*1024)
@@ -15,8 +15,21 @@ typedef struct {
int QueueLength;
unsigned int AGPCmdBufNext;
unsigned int FrameCount;
+#ifdef SIS315DRI
+ /* For 315 series */
+ unsigned long sharedWPoffset;
+#endif
+#if 0
+ unsigned char *AGPCmdBufBase;
+ unsigned long AGPCmdBufAddr;
+ unsigned long AGPCmdBufOffset;
+ unsigned int AGPCmdBufSize;
+ unsigned long AGPCmdBufNext;
+#endif
} SISSAREAPriv;
+#define AGPVtxBufNext AGPCmdBufNext
+
#define SIS_FRONT 0
#define SIS_BACK 1
#define SIS_DEPTH 2
@@ -47,6 +60,9 @@ typedef struct {
unsigned int scrnX, scrnY;
} SISDRIRec, *SISDRIPtr;
+#define AGPVtxBufOffset AGPCmdBufOffset
+#define AGPVtxBufSize AGPCmdBufSize
+
typedef struct {
/* Nothing here yet */
int dummy;
@@ -57,4 +73,13 @@ typedef struct {
int dummy;
} SISDRIContextRec, *SISDRIContextPtr;
+#ifdef XFree86Server
+
+#include "screenint.h"
+
+Bool SISDRIScreenInit(ScreenPtr pScreen);
+void SISDRICloseScreen(ScreenPtr pScreen);
+Bool SISDRIFinishScreenInit(ScreenPtr pScreen);
+
+#endif
#endif
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 2e548879b..554554613 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.102 2003/08/10 21:25:37 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.110 2003/08/26 16:38:01 twini Exp $ */
/*
* Copyright 2001, 2002, 2003 by Thomas Winischhofer, Vienna, Austria.
*
@@ -27,8 +27,8 @@
* - driver entirely rewritten, only basic structure taken from old code
* (except sis_dri.c, sis_shadow.c and parts of sis_dga.c;
* these were taken over)
- * - 315 series (315/550/650/651/M650/652/M652/740) support
- * - Xabre series (330/660/M660/760/M760) support
+ * - 315 series (315/550/650/651/M650/661FX/M661FX/740/741) support
+ * - Xabre series (330) support
* - new mode switching code for 300, 315 and 330 series
* - dual head support on 300, 315 and 330 series
* - merged-framebuffer support on 300, 315 and 330 series
@@ -239,9 +239,11 @@ static SymTabRec SISChipsets[] = {
{ PCI_CHIP_SIS315H, "SIS315H" },
{ PCI_CHIP_SIS315PRO, "SIS315PRO" },
{ PCI_CHIP_SIS550, "SIS550" },
- { PCI_CHIP_SIS650, "SIS650/M650/651/652/M652/740" },
+ { PCI_CHIP_SIS650, "SIS650/M650/651/652/M652/661FX/M661FX/740/741" },
{ PCI_CHIP_SIS330, "SIS330(Xabre)" },
+#if 0
{ PCI_CHIP_SIS660, "SIS660/M660/760/M760" },
+#endif
{ -1, NULL }
};
@@ -258,7 +260,9 @@ static PciChipsets SISPciChipsets[] = {
{ PCI_CHIP_SIS315PRO, PCI_CHIP_SIS315PRO, RES_SHARED_VGA },
{ PCI_CHIP_SIS650, PCI_CHIP_SIS650, RES_SHARED_VGA },
{ PCI_CHIP_SIS330, PCI_CHIP_SIS330, RES_SHARED_VGA },
+#if 0
{ PCI_CHIP_SIS660, PCI_CHIP_SIS660, RES_SHARED_VGA },
+#endif
{ -1, -1, RES_UNDEFINED }
};
@@ -292,11 +296,13 @@ static const char *vgahwSymbols[] = {
NULL
};
+#if defined(XFree86LOADER)
static const char *miscfbSymbols[] = {
"xf1bppScreenInit",
"xf4bppScreenInit",
NULL
};
+#endif
static const char *fbSymbols[] = {
"fbPictureInit",
@@ -327,12 +333,6 @@ static const char *ddcSymbols[] = {
NULL
};
-static const char *i2cSymbols[] = {
- "xf86I2CBusInit",
- "xf86CreateI2CBusRec",
- NULL
-};
-
static const char *int10Symbols[] = {
"xf86FreeInt10",
"xf86InitInt10",
@@ -419,7 +419,7 @@ sisSetup(pointer module, pointer opts, int *errmaj, int *errmin)
if (!setupDone) {
setupDone = TRUE;
xf86AddDriver(&SIS, module, 0);
- LoaderRefSymLists(vgahwSymbols, fbSymbols, i2cSymbols, xaaSymbols,
+ LoaderRefSymLists(vgahwSymbols, fbSymbols, xaaSymbols,
miscfbSymbols, shadowSymbols, ramdacSymbols,
vbeSymbols, int10Symbols,
#ifdef XF86DRI
@@ -2437,12 +2437,12 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->sisfbscalelcd = -1;
pSiS->sisfbspecialtiming = CUT_NONE;
pSiS->OldMode = 0;
+ pSiS->sisfbfound = FALSE;
if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) {
int fd, i;
sisfb_info mysisfbinfo;
- BOOL found = FALSE;
char name[10];
CARD32 sisfbversion;
@@ -2467,11 +2467,11 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if((mysisfbinfo.sisfb_pcibus == pSiS->PciInfo->bus) &&
(mysisfbinfo.sisfb_pcislot == pSiS->PciInfo->device) &&
(mysisfbinfo.sisfb_pcifunc == pSiS->PciInfo->func) ) {
- found = TRUE;
+ pSiS->sisfbfound = TRUE;
}
- } else found = TRUE;
+ } else pSiS->sisfbfound = TRUE;
- if(found) {
+ if(pSiS->sisfbfound) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"%s: SiS kernel fb driver (sisfb) %d.%d.%d detected (PCI: %02d:%02d.%d)\n",
&name[5],
@@ -2498,10 +2498,10 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"sisfb: %sreserved hardware cursor, using %s command queue\n",
(mysisfbinfo.sisfb_caps & 0x80) ? "" : "not ",
- (mysisfbinfo.sisfb_caps & 0x40) ? "SiS300 series Turbo" :
- (mysisfbinfo.sisfb_caps & 0x20) ? "SiS315 series AGP" :
- (mysisfbinfo.sisfb_caps & 0x10) ? "SiS315 series VRAM" :
- (mysisfbinfo.sisfb_caps & 0x08) ? "SiS315 series MMIO" :
+ (mysisfbinfo.sisfb_caps & 0x40) ? "SiS300 Turbo" :
+ (mysisfbinfo.sisfb_caps & 0x20) ? "SiS315/330 AGP" :
+ (mysisfbinfo.sisfb_caps & 0x10) ? "SiS315/330 VRAM" :
+ (mysisfbinfo.sisfb_caps & 0x08) ? "SiS315/330 MMIO" :
"no");
}
if(sisfbversion >= 0x01050A) {
@@ -2527,8 +2527,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
close (fd);
}
i++;
- } while((i <= 7) && (!found));
- if(!found) xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "sisfb not found\n");
+ } while((i <= 7) && (!pSiS->sisfbfound));
+ if(!pSiS->sisfbfound) xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "sisfb not found\n");
}
}
@@ -2629,6 +2629,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->SiS_Pr->SiS_ChSW = FALSE;
pSiS->SiS_Pr->SiS_CustomT = CUT_NONE;
pSiS->SiS_Pr->CRT1UsesCustomMode = FALSE;
+ pSiS->SiS_Pr->LVDSHL = -1;
}
/* Get our relocated IO registers */
@@ -2686,7 +2687,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
}
- if(!xf86SetDepthBpp(pScrn, 8, 8, 8, pix24flags)) {
+
+ if(!xf86SetDepthBpp(pScrn, 0, 0, 0, pix24flags)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"xf86SetDepthBpp() error\n");
#ifdef SISDUALHEAD
@@ -3146,9 +3148,9 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
from = X_PROBED;
- if (pSiS->pEnt->device->videoRam != 0) {
- pScrn->videoRam = pSiS->pEnt->device->videoRam;
- from = X_CONFIG;
+ if(pSiS->pEnt->device->videoRam != 0) {
+ pScrn->videoRam = pSiS->pEnt->device->videoRam;
+ from = X_CONFIG;
}
pSiS->RealVideoRam = pScrn->videoRam;
@@ -3194,12 +3196,12 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
case SIS_300_VGA:
pSiS->TurboQueueLen = 512;
if(pSiS->TurboQueue) {
- pSiS->availMem -= (pSiS->TurboQueueLen*1024);
- pSiS->cursorOffset = 512;
+ pSiS->availMem -= (pSiS->TurboQueueLen*1024);
+ pSiS->cursorOffset = 512;
}
- if(pSiS->HWCursor) {
- pSiS->availMem -= pSiS->CursorSize;
- if(pSiS->OptUseColorCursor) pSiS->availMem -= pSiS->CursorSize;
+ if(pSiS->HWCursor) {
+ pSiS->availMem -= pSiS->CursorSize;
+ if(pSiS->OptUseColorCursor) pSiS->availMem -= pSiS->CursorSize;
}
pSiS->CmdQueLenMask = 0xFFFF;
pSiS->CmdQueLenFix = 0;
@@ -3210,13 +3212,26 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
break;
case SIS_315_VGA:
+#ifdef SISVRAMQ
+ pSiS->cmdQueueSizeMask = pSiS->cmdQueueSize - 1; /* VRAM Command Queue is variable */
+ pSiS->cmdQueueOffset = (pScrn->videoRam * 1024) - pSiS->cmdQueueSize;
+ pSiS->cmdQueueLen = 0;
+ pSiS->cmdQueueLenMin = 0x200;
+ pSiS->cmdQueueLenMax = pSiS->cmdQueueSize - pSiS->cmdQueueLenMin;
+ pSiS->cmdQueueSize_div2 = pSiS->cmdQueueSize / 2;
+ pSiS->cmdQueueSize_div4 = pSiS->cmdQueueSize / 4;
+ pSiS->cmdQueueSize_4_3 = (pSiS->cmdQueueSize / 4) * 3;
+ pSiS->availMem -= pSiS->cmdQueueSize;
+ pSiS->cursorOffset = (pSiS->cmdQueueSize / 1024);
+#else
if(pSiS->TurboQueue) {
- pSiS->availMem -= (512*1024); /* Command Queue is 512k */
- pSiS->cursorOffset = 512;
+ pSiS->availMem -= (512*1024); /* MMIO Command Queue is 512k */
+ pSiS->cursorOffset = 512;
}
- if(pSiS->HWCursor) {
- pSiS->availMem -= pSiS->CursorSize;
- if(pSiS->OptUseColorCursor) pSiS->availMem -= pSiS->CursorSize;
+#endif
+ if(pSiS->HWCursor) {
+ pSiS->availMem -= pSiS->CursorSize;
+ if(pSiS->OptUseColorCursor) pSiS->availMem -= pSiS->CursorSize;
}
pSiS->cursorBufferNum = 0;
#ifdef SISDUALHEAD
@@ -3323,15 +3338,16 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using %dK of framebuffer memory\n",
pSiS->maxxfbmem / 1024);
- /* Check if the chipset supports two video overlays */
- if( (!pSiS->NoXvideo) &&
- ( pSiS->VGAEngine == SIS_300_VGA ||
- pSiS->VGAEngine == SIS_315_VGA ||
- pSiS->Chipset == PCI_CHIP_SIS530 ||
- pSiS->Chipset == PCI_CHIP_SIS6326 ||
- pSiS->Chipset == PCI_CHIP_SIS5597 ) ) {
+ /* Find out about sub-classes of some chipsets and check
+ * if the chipset supports two video overlays
+ */
+ if(pSiS->VGAEngine == SIS_300_VGA ||
+ pSiS->VGAEngine == SIS_315_VGA ||
+ pSiS->Chipset == PCI_CHIP_SIS530 ||
+ pSiS->Chipset == PCI_CHIP_SIS6326 ||
+ pSiS->Chipset == PCI_CHIP_SIS5597) {
pSiS->hasTwoOverlays = FALSE;
- switch (pSiS->Chipset) {
+ switch(pSiS->Chipset) {
case PCI_CHIP_SIS300:
case PCI_CHIP_SIS630:
case PCI_CHIP_SIS550:
@@ -3380,7 +3396,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
andSISIDXREG(SISCR, 0x5c, 0x07);
inSISIDXREG(SISCR, 0x5c, tempreg1);
tempreg1 &= 0xf8;
- setSISIDXREG(SISCR, 0x5c, 0x07, 0xf8);
+ orSISIDXREG(SISCR, 0x5c, 0xf8);
inSISIDXREG(SISCR, 0x5c, tempreg2);
tempreg2 &= 0xf8;
if((!tempreg1) || (tempreg2)) {
@@ -3491,33 +3507,42 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
} while(mychswtable[i].subsysVendor != 0);
}
- if((pSiS->sishw_ext.UseROM) && (pSiS->SiS_Pr->SiS_CustomT == CUT_NONE)) {
+ if(pSiS->SiS_Pr->SiS_CustomT == CUT_NONE) {
int i = 0, j;
- unsigned short bversptr = pSiS->BIOS[0x16] | (pSiS->BIOS[0x17] << 8);
+ unsigned short bversptr = 0;
BOOLEAN footprint;
unsigned long chksum = 0;
- for(i=0; i<32768; i++) chksum += pSiS->BIOS[i];
+ if(pSiS->sishw_ext.UseROM) {
+ bversptr = pSiS->BIOS[0x16] | (pSiS->BIOS[0x17] << 8);
+ for(i=0; i<32768; i++) chksum += pSiS->BIOS[i];
+ }
i = 0;
do {
if( (mycustomttable[i].chipID == pSiS->sishw_ext.jChipType) &&
((!strlen(mycustomttable[i].biosversion)) ||
+ (pSiS->sishw_ext.UseROM &&
(!strncmp(mycustomttable[i].biosversion, (char *)&pSiS->BIOS[bversptr],
- strlen(mycustomttable[i].biosversion)))) &&
+ strlen(mycustomttable[i].biosversion))))) &&
((!strlen(mycustomttable[i].biosdate)) ||
+ (pSiS->sishw_ext.UseROM &&
(!strncmp(mycustomttable[i].biosdate, (char *)&pSiS->BIOS[0x2c],
- strlen(mycustomttable[i].biosdate)))) &&
+ strlen(mycustomttable[i].biosdate))))) &&
((!mycustomttable[i].bioschksum) ||
- (mycustomttable[i].bioschksum == chksum)) &&
+ (pSiS->sishw_ext.UseROM &&
+ (mycustomttable[i].bioschksum == chksum))) &&
(mycustomttable[i].pcisubsysvendor == pSiS->PciInfo->subsysVendor) &&
(mycustomttable[i].pcisubsyscard == pSiS->PciInfo->subsysCard) ) {
footprint = TRUE;
for(j=0; j<5; j++) {
- if(mycustomttable[i].biosFootprintAddr[j]) {
- if(pSiS->BIOS[mycustomttable[i].biosFootprintAddr[j]] != mycustomttable[i].biosFootprintData[j])
- footprint = FALSE;
- }
+ if(pSiS->sishw_ext.UseROM) {
+ if(mycustomttable[i].biosFootprintAddr[j]) {
+ if(pSiS->BIOS[mycustomttable[i].biosFootprintAddr[j]] !=
+ mycustomttable[i].biosFootprintData[j])
+ footprint = FALSE;
+ }
+ }
}
if(footprint) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -5789,7 +5814,7 @@ SISRestore(ScrnInfoPtr pScrn)
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
"Restoring by setting old mode 0x%02x\n", pSiS->OldMode);
- if((pSiS->OldMode <= 0x13) && (pSiS->pVbe)) {
+ if(((pSiS->OldMode <= 0x13) || (!pSiS->sisfbfound)) && (pSiS->pVbe)) {
if(VBESetVBEMode(pSiS->pVbe, pSiS->OldMode, NULL) == TRUE) {
SISSpecialRestore(pScrn);
SiS_GetSetModeID(pScrn,pSiS->OldMode);
@@ -5837,6 +5862,22 @@ SISRestore(ScrnInfoPtr pScrn)
}
+#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) {
+ 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
+
} else {
if(pSiS->VBFlags & VB_VIDEOBRIDGE) {
@@ -6012,7 +6053,11 @@ SISBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask)
pScreen->BlockHandler = SISBlockHandler;
if(pSiS->VideoTimerCallback) {
- (*pSiS->VideoTimerCallback)(pScrn, currentTime.milliseconds);
+ (*pSiS->VideoTimerCallback)(pScrn, currentTime.milliseconds);
+ }
+
+ if(pSiS->RenderCallback) {
+ (*pSiS->RenderCallback)(pScrn);
}
}
@@ -6105,7 +6150,7 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
* This is done on 300 and 315 series only.
*/
if(pSiS->UseVESA) {
- SiSEnableTurboQueue(pScrn);
+ SiSEnableTurboQueue(pScrn);
}
/* Save the current state */
@@ -6411,6 +6456,11 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
case 24: refreshArea = SISRefreshArea24; break;
case 32: refreshArea = SISRefreshArea32; break;
}
+#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0)
+ xf86DisableRandR();
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Driver rotation enabled, RandR disabled\n");
+#endif
}
ShadowFBInit(pScreen, refreshArea);
@@ -6444,10 +6494,10 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
#endif
if(pSiS->hasTwoOverlays)
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Using SiS300/315 series HW Xv\n" );
+ "Using SiS300/315/330 series HW Xv\n" );
else
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Using SiS300/315 series HW Xv by default on CRT%d\n",
+ "Using SiS300/315/330 series HW Xv by default on CRT%d\n",
(pSiS->XvOnCRT2 ? 2 : 1));
SISInitVideo(pScreen);
#ifdef SISDUALHEAD
@@ -6478,17 +6528,17 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
#ifdef XF86DRI
if(pSiS->directRenderingEnabled) {
- /* Now that mi, drm and others have done their thing,
- * complete the DRI setup.
- */
- pSiS->directRenderingEnabled = SISDRIFinishScreenInit(pScreen);
+ /* Now that mi, drm and others have done their thing,
+ * complete the DRI setup.
+ */
+ pSiS->directRenderingEnabled = SISDRIFinishScreenInit(pScreen);
}
if(pSiS->directRenderingEnabled) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Direct rendering enabled\n");
- /* TODO */
- /* SISSetLFBConfig(pSiS); */
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Direct rendering enabled\n");
+ /* TODO */
+ /* SISSetLFBConfig(pSiS); */
} else {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Direct rendering disabled\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Direct rendering disabled\n");
}
#endif
@@ -7206,7 +7256,7 @@ SISEnterVT(int scrnIndex, int flags)
#ifdef XF86DRI
/* this is to be done AFTER switching the mode */
if(pSiS->directRenderingEnabled)
- DRIUnlock(screenInfo.screens[scrnIndex]);
+ DRIUnlock(screenInfo.screens[scrnIndex]);
#endif
return TRUE;
@@ -7735,27 +7785,19 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn)
outSISIDXREG(SISSR, 0x27, SR27);
}
break;
+
case SIS_315_VGA:
- if (!pSiS->NoAccel) {
+ if(!pSiS->NoAccel) {
/* On 315 series, there are three queue modes available
* which are chosen by setting bits 7:5 in SR26:
* 1. MMIO queue mode (bit 5, 0x20). The hardware will keep
* track of the queue, the FIFO, command parsing and so
* on. This is the one comparable to the 300 series.
* 2. VRAM queue mode (bit 6, 0x40). In this case, one will
- * have to do queue management himself. Register 0x85c4 will
- * hold the location of the next free queue slot, 0x85c8
- * is the "queue read pointer" whose way of working is
- * unknown to me. Anyway, this mode would require a
- * translation of the MMIO commands to some kind of
- * accelerator assembly and writing these commands
- * to the memory location pointed to by 0x85c4.
- * We will not use this, as nobody knows how this
- * "assembly" works, and as it would require a complete
- * re-write of the accelerator code.
+ * have to do queue management himself.
* 3. AGP queue mode (bit 7, 0x80). Works as 2., but keeps the
* queue in AGP memory space.
- * We go MMIO here.
+ * We go MMIO or VRAM here.
* SR26 bit 4 is called "Bypass H/W queue".
* SR26 bit 1 is called "Enable Command Queue Auto Correction"
* SR26 bit 0 resets the queue
@@ -7766,31 +7808,68 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn)
* 11 (0x0C) 4M
* The queue location is to be written to 0x85C0.
*/
-#if 0
- if (pSiS->TurboQueue) {
-#endif
- /* We only use MMIO Cmd Queue, not VRAM or AGP */
- /* Set Command Queue Threshold to max value 11111b */
- outSISIDXREG(SISSR, 0x27, 0x1F);
- /* Syncronous reset for Command Queue */
- outSISIDXREG(SISSR, 0x26, 0x01);
- /* Do some magic (cp readport to writeport) */
- temp = MMIO_IN32(pSiS->IOBase, 0x85C8);
- MMIO_OUT32(pSiS->IOBase, 0x85C4, temp);
- /* Enable MMIO Command Queue mode (0x20),
- * Enable_command_queue_auto_correction (0x02)
- * (no idea, but sounds good, so use it)
- * 512k (0x00) (does this apply to MMIO mode?) */
- outSISIDXREG(SISSR, 0x26, 0x22);
- /* Calc Command Queue position (Q is always 512k)*/
- temp = (pScrn->videoRam - 512) * 1024;
- /* Set Q position */
- MMIO_OUT32(pSiS->IOBase, 0x85C0, temp);
-#if 0
- } else {
- /* Is there a non-TurboQueue mode within MMIO mode? */
+#ifdef SISVRAMQ
+ /* We use VRAM Cmd Queue, not MMIO or AGP */
+ unsigned char tempCR55;
+
+#ifdef SISDUALHEAD
+ if(pSiS->DualHeadMode) {
+ SISEntPtr pSiSEnt = pSiS->entityPrivate;
+ pSiS->cmdQ_SharedWritePort = &(pSiSEnt->cmdQ_SharedWritePort_2D);
+ } else
+#endif
+ pSiS->cmdQ_SharedWritePort = &(pSiS->cmdQ_SharedWritePort_2D);
+
+ /* Set Command Queue Threshold to max value 11111b (?) */
+ outSISIDXREG(SISSR, 0x27, 0x1F);
+ /* No idea what this does */
+ inSISIDXREG(SISCR, 0x55, tempCR55) ;
+ andSISIDXREG(SISCR, 0x55, 0x33) ;
+ /* Syncronous reset for Command Queue */
+ outSISIDXREG(SISSR, 0x26, 0x01);
+ 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;
+ default:
+ case 512*1024: SR26 = (0x40 | 0x00);
+ }
+ 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);
+ MMIO_OUT32(pSiS->IOBase, 0x85C0, pSiS->cmdQueueOffset);
+ temp = (unsigned long)pSiS->FbBase;
+#ifdef SISDUALHEAD
+ if(pSiS->DualHeadMode) {
+ SISEntPtr pSiSEnt = pSiS->entityPrivate;
+ temp = (unsigned long)pSiSEnt->FbBase;
}
#endif
+ temp += pSiS->cmdQueueOffset;
+ pSiS->cmdQueueBase = (unsigned long *)temp;
+ outSISIDXREG(SISCR, 0x55, tempCR55);
+#else
+ /* We use MMIO Cmd Queue, not VRAM or AGP */
+ /* Set Command Queue Threshold to max value 11111b */
+ outSISIDXREG(SISSR, 0x27, 0x1F);
+ /* Syncronous reset for Command Queue */
+ outSISIDXREG(SISSR, 0x26, 0x01);
+ /* Do some magic (cp readport to writeport) */
+ temp = MMIO_IN32(pSiS->IOBase, 0x85C8);
+ MMIO_OUT32(pSiS->IOBase, 0x85C4, temp);
+ /* Enable MMIO Command Queue mode (0x20),
+ * Enable_command_queue_auto_correction (0x02)
+ * (no idea, but sounds good, so use it)
+ * 512k (0x00) (does this apply to MMIO mode?) */
+ outSISIDXREG(SISSR, 0x26, 0x22);
+ /* Calc Command Queue position (Q is always 512k)*/
+ temp = (pScrn->videoRam - 512) * 1024;
+ /* Set Q position */
+ MMIO_OUT32(pSiS->IOBase, 0x85C0, temp);
+#endif
}
break;
default:
@@ -8125,7 +8204,10 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
pSiS->SiS_Pr->SiS_UseOEM = pSiS->OptUseOEM;
/* Enable TurboQueue */
- SiSEnableTurboQueue(pScrn);
+#ifdef SISVRAMQ
+ if(pSiS->VGAEngine != SIS_315_VGA)
+#endif
+ SiSEnableTurboQueue(pScrn);
if((!pSiS->UseVESA) && (pSiS->VBFlags & CRT2_ENABLE)) {
/* Switch on CRT1 for modes that require the bridge in SlaveMode */
@@ -9995,6 +10077,13 @@ void SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg)
}
}
+#ifdef SISVRAMQ
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ /* Re-Enable TurboQueue */
+ SiSEnableTurboQueue(pScrn);
+ }
+#endif
+
/* Apply TV settings given by options
Do this even in DualHeadMode:
- if this is called by SetModeCRT1, CRT2 mode has been reset by SetModeCRT1
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 b987c8876..eb65ecb9b 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.14 2003/08/07 12:52:23 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h,v 1.15 2003/08/26 14:29:36 twini Exp $ */
/*
* Global data and definitions
*
@@ -170,10 +170,17 @@ const customttable mycustomttable[] = {
},
{ SIS_650, "", "",
0,
- { 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0 },
+ { 0x00c, 0, 0, 0, 0 },
+ { 'e' , 0, 0, 0, 0 },
+ 0x1558, 0x0287,
+ "Clevo", "L285/L287 (Version 1)", CUT_CLEVO1024, "CLEVO1024"
+ },
+ { SIS_650, "", "",
+ 0,
+ { 0x00c, 0, 0, 0, 0 },
+ { 'y' , 0, 0, 0, 0 },
0x1558, 0x0287,
- "Clevo", "L285/L287", CUT_CLEVO1024, "CLEVO1024"
+ "Clevo", "L285/L287 (Version 2)", CUT_CLEVO10242, "CLEVO10242"
},
{ 4321, "", "", /* This is hopefully NEVER autodetected */
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 60883930f..df46af8b8 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.25 2003/08/10 21:25:38 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c,v 1.26 2003/08/23 10:25:19 twini Exp $ */
/*
* SiS driver option evaluation
*
@@ -110,6 +110,7 @@ typedef enum {
OPTION_XVYUVCHROMAKEY,
OPTION_SCALELCD,
OPTION_SPECIALTIMING,
+ OPTION_LVDSHL,
OPTION_ENABLEHOTKEY,
OPTION_MERGEDFB,
OPTION_CRT2HSYNC,
@@ -210,6 +211,7 @@ static const OptionInfoRec SISOptions[] = {
{ OPTION_SCALELCD, "ScaleLCD", OPTV_BOOLEAN, {0}, -1 },
{ OPTION_ENABLEHOTKEY, "EnableHotkey", OPTV_BOOLEAN, {0}, -1 },
{ OPTION_SPECIALTIMING, "SpecialTiming", OPTV_STRING, {0}, -1 },
+ { OPTION_LVDSHL, "LVDSHL", OPTV_INTEGER, {0}, -1 },
{ OPTION_ENABLESISCTRL, "EnableSiSCtrl", OPTV_BOOLEAN, {0}, -1 },
{ OPTION_STOREDBRIR, "StoredGammaBrightnessRed", OPTV_INTEGER, {0}, -1 },
{ OPTION_STOREDBRIG, "StoredGammaBrightnessGreen", OPTV_INTEGER, {0}, -1 },
@@ -268,6 +270,11 @@ SiSOptions(ScrnInfoPtr pScrn)
pSiS->NoHostBus = FALSE;
/* pSiS->UsePCIRetry = TRUE; */
pSiS->TurboQueue = TRUE;
+#ifdef SISVRAMQ
+ /* TODO: Option (315 series VRAM command queue) */
+ /* But beware: sisfb does not know about this!!! */
+ pSiS->cmdQueueSize = 512*1024;
+#endif
pSiS->HWCursor = TRUE;
pSiS->Rotate = FALSE;
pSiS->ShadowFB = FALSE;
@@ -688,6 +695,9 @@ SiSOptions(ScrnInfoPtr pScrn)
if(xf86GetOptValString(pSiS->Options, OPTION_SPECIALTIMING)) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "SpecialTiming");
}
+ if(xf86GetOptValString(pSiS->Options, OPTION_LVDSHL)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "LVDSHL");
+ }
if(xf86GetOptValString(pSiS->Options, OPTION_TVSTANDARD)) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "TVStandard");
}
@@ -737,11 +747,19 @@ SiSOptions(ScrnInfoPtr pScrn)
} else
#endif
{
- if(pSiS->VGAEngine != SIS_315_VGA) {
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+
+#ifdef SISVRAMQ
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using VRAM command queue, size %dk\n",
+ pSiS->cmdQueueSize / 1024);
+#else
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using MMIO command queue, size 512k\n");
+#endif
+
+ } else {
+
+ /* TurboQueue */
- /* TurboQueue
- * We always use this on 315 series.
- */
from = X_DEFAULT;
if(xf86GetOptValBool(pSiS->Options, OPTION_TURBOQUEUE, &pSiS->TurboQueue)) {
from = X_CONFIG;
@@ -754,26 +772,26 @@ SiSOptions(ScrnInfoPtr pScrn)
Bool val;
- /* RestoreBySetMode (300/315/330 series only)
- * Set this to force the driver to set the old mode instead of restoring
- * the register contents. This can be used to overcome problems with
- * LCD panels and video bridges.
- */
+ /* RestoreBySetMode (300/315/330 series only)
+ * Set this to force the driver to set the old mode instead of restoring
+ * the register contents. This can be used to overcome problems with
+ * LCD panels and video bridges.
+ */
if(xf86GetOptValBool(pSiS->Options, OPTION_RESTOREBYSET, &val)) {
pSiS->restorebyset = val ? TRUE : FALSE;
}
- /* EnableHotkey (300/315/330 series only)
- * Enables or disables the BIOS hotkey switch for
- * switching the output device on laptops.
- * This key causes a total machine hang on many 300 series
- * machines, it is therefore by default disabled on such.
- * In dual head mode, using the hotkey is lethal, so we
- * forbid it then in any case.
- * However, although the driver disables the hotkey as
- * BIOS developers intented to do that, some buggy BIOSes
- * still cause the machine to freeze. Hence the warning.
- */
+ /* EnableHotkey (300/315/330 series only)
+ * Enables or disables the BIOS hotkey switch for
+ * switching the output device on laptops.
+ * This key causes a total machine hang on many 300 series
+ * machines, it is therefore by default disabled on such.
+ * In dual head mode, using the hotkey is lethal, so we
+ * forbid it then in any case.
+ * However, although the driver disables the hotkey as
+ * BIOS developers intented to do that, some buggy BIOSes
+ * still cause the machine to freeze. Hence the warning.
+ */
{
int flag = 0;
#ifdef SISDUALHEAD
@@ -798,12 +816,12 @@ SiSOptions(ScrnInfoPtr pScrn)
}
}
- /* UseROMData (300/315/330 series only)
- * This option is enabling/disabling usage of some machine
- * specific data from the BIOS ROM. This option can - and
- * should - be used in case the driver makes problems
- * because SiS changed the location of this data.
- */
+ /* UseROMData (300/315/330 series only)
+ * This option is enabling/disabling usage of some machine
+ * specific data from the BIOS ROM. This option can - and
+ * should - be used in case the driver makes problems
+ * because SiS changed the location of this data.
+ */
if(xf86GetOptValBool(pSiS->Options, OPTION_USEROMDATA, &val)) {
pSiS->OptROMUsage = val ? 1 : 0;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
@@ -811,13 +829,13 @@ SiSOptions(ScrnInfoPtr pScrn)
val ? enabledstr : disabledstr);
}
- /* UseOEMData (300/315/330 series only)
- * The driver contains quite a lot data for OEM LCD panels
- * and TV connector specifics which override the defaults.
- * If this data is incorrect, the TV may lose color and
- * the LCD panel might show some strange effects. Use this
- * option to disable the usage of this data.
- */
+ /* UseOEMData (300/315/330 series only)
+ * The driver contains quite a lot data for OEM LCD panels
+ * and TV connector specifics which override the defaults.
+ * If this data is incorrect, the TV may lose color and
+ * the LCD panel might show some strange effects. Use this
+ * option to disable the usage of this data.
+ */
if(xf86GetOptValBool(pSiS->Options, OPTION_USEOEM, &val)) {
pSiS->OptUseOEM = val ? 1 : 0;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
@@ -825,12 +843,12 @@ SiSOptions(ScrnInfoPtr pScrn)
val ? enabledstr : disabledstr);
}
- /* ForceCRT1 (300/315/330 series only)
- * This option can be used to force CRT1 to be switched on/off. Its
- * intention is mainly for old monitors that can't be detected
- * automatically. This is only useful on machines with a video bridge.
- * In normal cases, this option won't be necessary.
- */
+ /* ForceCRT1 (300/315/330 series only)
+ * This option can be used to force CRT1 to be switched on/off. Its
+ * intention is mainly for old monitors that can't be detected
+ * automatically. This is only useful on machines with a video bridge.
+ * In normal cases, this option won't be necessary.
+ */
if(xf86GetOptValBool(pSiS->Options, OPTION_FORCECRT1, &val)) {
pSiS->forceCRT1 = val ? 1 : 0;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
@@ -838,26 +856,26 @@ SiSOptions(ScrnInfoPtr pScrn)
val ? "ON" : "OFF");
}
- /* NoCRT2DDCDetection (315/330 series only)
- * If set to true, this disables CRT2 detection using DDC. This is
- * to avoid problems with not entirely DDC compiant LCD panels or
- * VGA monitors connected to the secondary VGA plug. Since LCD and
- * VGA share the same DDC channel, it might in some cases be impossible
- * to determine if the device is a CRT monitor or a flat panel.
- */
+ /* NoCRT2DDCDetection (315/330 series only)
+ * If set to true, this disables CRT2 detection using DDC. This is
+ * to avoid problems with not entirely DDC compiant LCD panels or
+ * VGA monitors connected to the secondary VGA plug. Since LCD and
+ * VGA share the same DDC channel, it might in some cases be impossible
+ * to determine if the device is a CRT monitor or a flat panel.
+ */
if(xf86GetOptValBool(pSiS->Options, OPTION_NODDCFORCRT2, &val)) {
pSiS->nocrt2ddcdetection = val ? TRUE : FALSE;
}
- /* ForceCRT2ReDetection (315/330 series only)
- * If set to true, it forces re-detection of the LCD panel and
- * a secondary VGA connection even if the BIOS already had found
- * about it. This is meant for custom panels (ie such with
- * non-standard resolutions) which the BIOS will "detect" according
- * to the established timings, resulting in only a very vague idea
- * about the panels real resolution. As for secondary VGA, this
- * enables us to include a Plasma panel's proprietary modes.
- */
+ /* ForceCRT2ReDetection (315/330 series only)
+ * If set to true, it forces re-detection of the LCD panel and
+ * a secondary VGA connection even if the BIOS already had found
+ * about it. This is meant for custom panels (ie such with
+ * non-standard resolutions) which the BIOS will "detect" according
+ * to the established timings, resulting in only a very vague idea
+ * about the panels real resolution. As for secondary VGA, this
+ * enables us to include a Plasma panel's proprietary modes.
+ */
if(xf86GetOptValBool(pSiS->Options, OPTION_FORCECRT2REDETECTION, &val)) {
if(val) {
pSiS->forcecrt2redetection = TRUE;
@@ -865,11 +883,11 @@ SiSOptions(ScrnInfoPtr pScrn)
} else pSiS->forcecrt2redetection = FALSE;
}
- /* ForceCRT2Type (300/315/330 series only)
- * Used for forcing the driver to initialize a given
- * CRT2 device type.
- * (SVIDEO, COMPOSITE and SCART for overriding detection)
- */
+ /* ForceCRT2Type (300/315/330 series only)
+ * Used for forcing the driver to initialize a given
+ * CRT2 device type.
+ * (SVIDEO, COMPOSITE and SCART for overriding detection)
+ */
strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_FORCE_CRT2TYPE);
if(strptr != NULL) {
if(!xf86NameCmp(strptr,"TV"))
@@ -962,6 +980,7 @@ SiSOptions(ScrnInfoPtr pScrn)
* scaling of modes lower than the panel's native resolution.
* Setting this to TRUE will force the bridge/panel link
* to scale; FALSE will rely on the panel's capabilities.
+ * Not supported on all machines.
*/
if(xf86GetOptValBool(pSiS->Options, OPTION_SCALELCD, &val)) {
pSiS->UsePanelScaler = val ? 0 : 1;
@@ -991,6 +1010,22 @@ SiSOptions(ScrnInfoPtr pScrn)
}
}
+ /* LVDSHL (300/315/330 series + 30xLV bridge only)
+ * This might be required if the LCD panel is too dark.
+ * The parameter is an integer from 0 to 3.
+ */
+ if(xf86GetOptValInteger(pSiS->Options, OPTION_LVDSHL, &pSiS->SiS_Pr->LVDSHL)) {
+ if((pSiS->SiS_Pr->LVDSHL < 0) || (pSiS->SiS_Pr->LVDSHL > 3)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Illegal LVDSHL parameter, valid is 0 through 3\n");
+ pSiS->SiS_Pr->LVDSHL = -1;
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "LVDSHL will be %d\n",
+ pSiS->SiS_Pr->LVDSHL);
+ }
+ }
+
}
@@ -1324,12 +1359,19 @@ SiSOptions(ScrnInfoPtr pScrn)
#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,0,0)
pSiS->NoXvideo = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Rotating screen %sclockwise (2D acceleration and Xv disabled)\n",
+ "Rotating screen %sclockwise; (2D acceleration and Xv disabled)\n",
(pSiS->Rotate == -1) ? "counter " : "");
#else
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Rotating screen %sclockwise (2D acceleration disabled)\n",
- (pSiS->Rotate == -1) ? "counter " : "");
+ "Rotating screen %sclockwise (2D acceleration %sdisabled)\n",
+ (pSiS->Rotate == -1) ? "counter " : "",
+#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0)
+ "and RandR extension "
+#else
+ ""
+#endif
+ );
+
#endif
}
@@ -1406,7 +1448,8 @@ SiSOptions(ScrnInfoPtr pScrn)
}
if(xf86GetOptValBool(pSiS->Options, OPTION_XVDEFDISABLEGFX, &val)) {
if(val) pSiS->XvDefDisableGfx = TRUE;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Graphics display will be %s during Xv usage\n",
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Graphics display will be %s during Xv usage\n",
val ? disabledstr : enabledstr);
}
if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/vstruct.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/vstruct.h
index 4e6156207..74dd31d7c 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/vstruct.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/vstruct.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/vstruct.h,v 1.11 2003/08/07 12:52:24 twini Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/vstruct.h,v 1.13 2003/08/26 14:29:36 twini Exp $ */
/*
* General structure definitions for universal mode switching modules
*
@@ -222,6 +222,7 @@ typedef UCHAR DRAM4Type[4];
#define CUT_COMPAQ12802 5
#define CUT_PANEL848 6
#define CUT_CLEVO1024 7
+#define CUT_CLEVO10242 8
typedef struct _SiS_Private
{
@@ -637,6 +638,8 @@ typedef struct _SiS_Private
BOOLEAN SiS_CHPALM;
BOOLEAN SiS_CHPALN;
+
+ int LVDSHL;
BOOLEAN Backup;
UCHAR Backup_Mode;