summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Winischhofer <thomas@winischhofer.net>2004-08-11 18:54:36 +0000
committerThomas Winischhofer <thomas@winischhofer.net>2004-08-11 18:54:36 +0000
commit32f31c8443272db98d82743708d3f22213ec1926 (patch)
treef5eb7181e58f4024c5c2919b0e53aa39b13c53c3
parent813ad3aea67f8d7816fd2cbddc832908a6b7105d (diff)
SiS driver: Adapt mode numbers to new BIOS scheme and provide translation
-rw-r--r--src/310vtbl.h63
-rw-r--r--src/init.c49
-rw-r--r--src/init.h1
-rw-r--r--src/sis_driver.c25
-rw-r--r--src/sis_driver.h1
5 files changed, 124 insertions, 15 deletions
diff --git a/src/310vtbl.h b/src/310vtbl.h
index 15302c9..17215f0 100644
--- a/src/310vtbl.h
+++ b/src/310vtbl.h
@@ -259,6 +259,69 @@ static const SiS_Ext2Struct SiS310_RefIndex[]=
{0xffff,0x00,0x00,0x00,0x00,0x00, 0, 0, 0}
};
+#ifdef LINUX_XF86
+static const struct {
+ UCHAR Ext_ModeID; /* ModeID in new ROM */
+ UCHAR Ext_MyModeID; /* corresponding ModeID in my tables (0 = identical) */
+ USHORT Ext_VESAID; /* corresponding VESA ID in new ROM */
+} SiS_EModeIDTable661[] = {
+ { 0x6a, 0x00, 0x0102 },
+ { 0x20, 0x29, 0x0000 },
+ { 0x21, 0x2a, 0x0000 },
+ { 0x22, 0x2b, 0x0000 },
+ { 0x23, 0x00, 0x011c },
+ { 0x24, 0x00, 0x011d },
+ { 0x25, 0x00, 0x011e },
+ { 0x26, 0x00, 0x011f },
+ { 0x27, 0x00, 0x0120 },
+ { 0x28, 0x00, 0x0121 },
+ { 0x2a, 0x14, 0x013d },
+ { 0x2b, 0x15, 0x013e },
+ { 0x2c, 0x16, 0x013f },
+ { 0x2e, 0x00, 0x0101 },
+ { 0x2f, 0x00, 0x0100 },
+ { 0x30, 0x00, 0x0103 },
+ { 0x37, 0x00, 0x0104 },
+ { 0x38, 0x00, 0x0105 },
+ { 0x3a, 0x00, 0x0107 },
+ { 0x3c, 0x00, 0x0125 },
+ { 0x3d, 0x00, 0x0126 },
+ { 0x40, 0x00, 0x010d },
+ { 0x41, 0x00, 0x010e },
+ { 0x43, 0x00, 0x0110 },
+ { 0x44, 0x00, 0x0111 },
+ { 0x46, 0x00, 0x0113 },
+ { 0x47, 0x00, 0x0114 },
+ { 0x49, 0x00, 0x0116 },
+ { 0x4a, 0x00, 0x0117 },
+ { 0x4c, 0x00, 0x0119 },
+ { 0x4d, 0x00, 0x011a },
+ { 0x50, 0x00, 0x0127 },
+ { 0x51, 0x00, 0x0128 },
+ { 0x52, 0x00, 0x0129 },
+ { 0x56, 0x00, 0x012a },
+ { 0x57, 0x00, 0x012b },
+ { 0x58, 0x00, 0x012c },
+ { 0x59, 0x00, 0x012d },
+ { 0x5a, 0x17, 0x012e },
+ { 0x5b, 0x18, 0x012f },
+ { 0x5c, 0x19, 0x0130 },
+ { 0x5d, 0x00, 0x0131 },
+ { 0x62, 0x00, 0x0112 },
+ { 0x63, 0x00, 0x0115 },
+ { 0x64, 0x00, 0x0118 },
+ { 0x65, 0x00, 0x011b },
+ { 0x66, 0x00, 0x0132 },
+ { 0x75, 0x00, 0x013a },
+ { 0x78, 0x00, 0x013b },
+ { 0x79, 0x00, 0x013c },
+ { 0x7b, 0x7c, 0x0136 },
+ { 0x7c, 0x7d, 0x0137 },
+ { 0x7d, 0x7e, 0x0138 },
+ { 0xff, 0xff, 0xffff }
+};
+#endif
+
static const SiS_CRT1TableStruct SiS310_CRT1Table[]=
{
{{0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f,
diff --git a/src/init.c b/src/init.c
index 02a53e3..88f7695 100644
--- a/src/init.c
+++ b/src/init.c
@@ -4985,12 +4985,12 @@ SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfo
}
-/* Build a list of supported modes */
+/* Translate a mode number into the VESA pendant */
int
SiSTranslateToVESA(ScrnInfoPtr pScrn, int modenumber)
{
- SISPtr pSiS = SISPTR(pScrn);
- int i;
+ SISPtr pSiS = SISPTR(pScrn);
+ int i = 0;
/* Initialize our pointers */
if(pSiS->VGAEngine == SIS_300_VGA) {
@@ -5008,16 +5008,49 @@ SiSTranslateToVESA(ScrnInfoPtr pScrn, int modenumber)
} else return -1;
if(modenumber <= 0x13) return modenumber;
+
+#ifdef SIS315H
+ if(pSiS->ROM661New) {
+ while(SiS_EModeIDTable661[i].Ext_ModeID != 0xff) {
+ if(SiS_EModeIDTable661[i].Ext_ModeID == modenumber) {
+ return (int)SiS_EModeIDTable661[i].Ext_VESAID;
+ }
+ i++;
+ }
+ } else {
+#endif
+ while(pSiS->SiS_Pr->SiS_EModeIDTable[i].Ext_ModeID != 0xff) {
+ if(pSiS->SiS_Pr->SiS_EModeIDTable[i].Ext_ModeID == modenumber) {
+ return (int)pSiS->SiS_Pr->SiS_EModeIDTable[i].Ext_VESAID;
+ }
+ i++;
+ }
+#ifdef SIS315H
+ }
+#endif
+ return -1;
+}
- i = 0;
- while(pSiS->SiS_Pr->SiS_EModeIDTable[i].Ext_ModeID != 0xff) {
- if(pSiS->SiS_Pr->SiS_EModeIDTable[i].Ext_ModeID == modenumber) {
- return (int)pSiS->SiS_Pr->SiS_EModeIDTable[i].Ext_VESAID;
+/* Translate a new BIOS mode number into the driver's pendant */
+int
+SiSTranslateToOldMode(int modenumber)
+{
+#ifdef SIS315H
+ int i = 0;
+
+ while(SiS_EModeIDTable661[i].Ext_ModeID != 0xff) {
+ if(SiS_EModeIDTable661[i].Ext_ModeID == modenumber) {
+ if(SiS_EModeIDTable661[i].Ext_MyModeID)
+ return (int)SiS_EModeIDTable661[i].Ext_MyModeID;
+ else
+ return modenumber;
}
i++;
}
- return -1;
+#endif
+ return modenumber;
}
+
#endif /* Xfree86 */
#ifdef LINUX_KERNEL
diff --git a/src/init.h b/src/init.h
index 51af74e..aa94657 100644
--- a/src/init.h
+++ b/src/init.h
@@ -2322,6 +2322,7 @@ BOOLEAN SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr
BOOLEAN SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
DisplayModePtr mode, BOOLEAN IsCustom);
int SiSTranslateToVESA(ScrnInfoPtr pScrn, int modenumber);
+int SiSTranslateToOldMode(int modenumber);
BOOLEAN SiS_GetPanelID(SiS_Private *SiS_Pr, PSIS_HW_INFO);
USHORT SiS_CheckBuildCustomMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags);
DisplayModePtr SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfordvi);
diff --git a/src/sis_driver.c b/src/sis_driver.c
index 0392b53..cec85da 100644
--- a/src/sis_driver.c
+++ b/src/sis_driver.c
@@ -6878,6 +6878,12 @@ SISRestore(ScrnInfoPtr pScrn)
int backupscaler = pSiS->SiS_Pr->UsePanelScaler;
int backupcenter = pSiS->SiS_Pr->CenterScreen;
unsigned long backupspecialtiming = pSiS->SiS_Pr->SiS_CustomT;
+ int mymode = pSiS->OldMode;
+
+ if((pSiS->VGAEngine == SIS_315_VGA) && (pSiS->ROM661New) && (!pSiS->sisfbfound)) {
+ /* New BIOS has set mode, therefore eventually translate number */
+ mymode = SiSTranslateToOldMode(mymode);
+ }
if((pSiS->VBFlags & (VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV|VB_302ELV))) {
/* !!! REQUIRED for 630+301B-DH, otherwise the text modes
@@ -6888,8 +6894,8 @@ SISRestore(ScrnInfoPtr pScrn)
unsigned char temp;
inSISIDXREG(SISCR, 0x30, temp);
if(temp & 0x20) {
- if(pSiS->OldMode == 0x03) {
- pSiS->OldMode = 0x13;
+ if(mymode == 0x03) {
+ mymode = 0x13;
changedmode = TRUE;
}
}
@@ -6897,16 +6903,21 @@ SISRestore(ScrnInfoPtr pScrn)
pSiS->SiS_Pr->UseCustomMode = FALSE;
pSiS->SiS_Pr->CRT1UsesCustomMode = FALSE;
- pSiS->SiS_Pr->UsePanelScaler = pSiS->sisfbscalelcd;
pSiS->SiS_Pr->CenterScreen = 0;
- pSiS->SiS_Pr->SiS_CustomT = pSiS->sisfbspecialtiming;
- SiSSetMode(pSiS->SiS_Pr, &pSiS->sishw_ext, pScrn, pSiS->OldMode, FALSE);
+ if(pSiS->sisfbfound) {
+ pSiS->SiS_Pr->UsePanelScaler = pSiS->sisfbscalelcd;
+ pSiS->SiS_Pr->SiS_CustomT = pSiS->sisfbspecialtiming;
+ } else {
+ pSiS->SiS_Pr->UsePanelScaler = -1;
+ /* Leave CustomT as it is */
+ }
+ SiSSetMode(pSiS->SiS_Pr, &pSiS->sishw_ext, pScrn, mymode, FALSE);
if(changedmode) {
- pSiS->OldMode = 0x03;
+ mymode = 0x03;
outSISIDXREG(SISCR,0x34,0x03);
}
SISSpecialRestore(pScrn);
- SiS_GetSetModeID(pScrn,pSiS->OldMode);
+ SiS_GetSetModeID(pScrn,pSiS->OldMode); /* NOT mymode! */
pSiS->SiS_Pr->UsePanelScaler = backupscaler;
pSiS->SiS_Pr->CenterScreen = backupcenter;
pSiS->SiS_Pr->SiS_CustomT = backupspecialtiming;
diff --git a/src/sis_driver.h b/src/sis_driver.h
index 29c7bb0..5d8b639 100644
--- a/src/sis_driver.h
+++ b/src/sis_driver.h
@@ -1332,6 +1332,7 @@ extern USHORT SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, in
extern USHORT SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth);
extern USHORT SiS_GetModeID_VGA2(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth);
extern int SiSTranslateToVESA(ScrnInfoPtr pScrn, int modenumber);
+extern int SiSTranslateToOldMode(int modenumber);
extern BOOLEAN SiSDetermineROMLayout661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo);
extern BOOLEAN SiSBIOSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceExtension,
ScrnInfoPtr pScrn, DisplayModePtr mode, BOOLEAN IsCustom);