extractedLnx/linux-2.4.24/drivers/video/sis/init301.c_SiS_AdjustCRT2Rate.c
BOOLEAN
SiS_AdjustCRT2Rate(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,USHORT *i,PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT tempax,tempbx,resinfo;
USHORT modeflag,infoflag;
if(ModeNo <= 0x13) {
modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
resinfo = 0;
} else {
modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
}
tempbx = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].ModeID;
tempax = 0;
if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) {
tempax |= SupportRAMDAC2;
if(HwDeviceExtension->jChipType >= SIS_315H) {
tempax |= SupportTV;
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
if(resinfo == SIS_RI_1600x1200) tempax |= SupportTV1024;
}
}
}
} else if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
tempax |= SupportLCD;
if(HwDeviceExtension->jChipType >= SIS_315H) {
if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1600x1200) {
if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1400x1050) {
if((resinfo == SIS_RI_640x480) && (SiS_Pr->SiS_LCDInfo & DontExpandLCD)) {
(*i) = 0;
return(1);
} else {
if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024) {
if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x960) {
if((resinfo == SIS_RI_640x480) && (SiS_Pr->SiS_LCDInfo & DontExpandLCD)) {
return(0);
} else {
if((resinfo >= SIS_RI_1280x1024) && (resinfo != SIS_RI_1280x768)) {
return(0);
}
}
}
}
}
}
}
} else {
if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) {
if( (resinfo != SIS_RI_1024x600) &&
((resinfo == SIS_RI_512x384) || (resinfo >= SIS_RI_1024x768))) return(0);
} else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) {
if((resinfo != SIS_RI_1152x768) && (resinfo > SIS_RI_1024x768)) return(0);
} else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) {
if((resinfo != SIS_RI_1280x960) && (resinfo > SIS_RI_1024x768)) return(0);
} else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) {
if(resinfo > SIS_RI_1280x1024) return(0);
} else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) {
if(resinfo > SIS_RI_1024x768) return(0);
} else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) {
if((resinfo == SIS_RI_512x384) || (resinfo > SIS_RI_800x600)) return(0);
} else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) {
if((resinfo == SIS_RI_512x384) ||
(resinfo == SIS_RI_400x300) ||
(resinfo > SIS_RI_640x480)) return(0);
}
}
} else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) {
if(SiS_Pr->SiS_HiVision == 3) {
tempax |= SupportHiVisionTV2;
if(SiS_Pr->SiS_VBInfo & SetInSlaveMode){
if(resinfo == SIS_RI_512x384) return(0);
if(resinfo == SIS_RI_400x300) return(0);
if(resinfo == SIS_RI_800x600) {
if(SiS_Pr->SiS_SetFlag & TVSimuMode) return(0);
}
if(resinfo > SIS_RI_800x600) return(0);
}
} else {
tempax |= SupportHiVisionTV;
if(SiS_Pr->SiS_VBInfo & SetInSlaveMode){
if(resinfo == SIS_RI_512x384) return(0);
if((resinfo == SIS_RI_400x300) || (resinfo == SIS_RI_800x600)) {
if(SiS_Pr->SiS_SetFlag & TVSimuMode) return(0);
}
if(resinfo > SIS_RI_800x600) return(0);
}
}
} else if(SiS_Pr->SiS_VBInfo & (SetCRT2ToAVIDEO|SetCRT2ToSVIDEO|SetCRT2ToSCART)) {
tempax |= SupportTV;
tempax |= SupportTV1024;
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
if((SiS_Pr->SiS_VBInfo & SetNotSimuMode) && (SiS_Pr->SiS_VBInfo & SetPALTV)) {
if(resinfo != SIS_RI_1024x768) {
if( (!(SiS_Pr->SiS_VBInfo & SetPALTV)) ||
((SiS_Pr->SiS_VBInfo & SetPALTV) && (resinfo != SIS_RI_512x384)) ) {
tempax &= ~(SupportTV1024);
if(HwDeviceExtension->jChipType >= SIS_315H) {
if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
if( (!(SiS_Pr->SiS_VBInfo & SetPALTV)) ||
((SiS_Pr->SiS_VBInfo & SetPALTV) && (resinfo != SIS_RI_800x600)) ) {
if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return(0);
}
}
} else {
if( (resinfo != SIS_RI_400x300) ||
(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) ||
(SiS_Pr->SiS_VBInfo & SetNotSimuMode) ) {
if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) {
if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
if(resinfo == SIS_RI_400x300) return(0);
if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return (0);
}
}
} else return(0);
}
}
}
} else {
tempax &= ~(SupportTV1024);
if(HwDeviceExtension->jChipType >= SIS_315H) {
if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
if( (!(SiS_Pr->SiS_VBInfo & SetPALTV)) ||
((SiS_Pr->SiS_VBInfo & SetPALTV) && (resinfo != SIS_RI_800x600)) ) {
if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return(0);
}
}
} else {
if( (resinfo != SIS_RI_400x300) ||
(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) ||
(SiS_Pr->SiS_VBInfo & SetNotSimuMode) ) {
if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) {
if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
if(resinfo == SIS_RI_400x300) return(0);
if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return(0);
}
}
} else return(0);
}
}
} else { /* slavemode */
if(resinfo != SIS_RI_1024x768) {
if( (!(SiS_Pr->SiS_VBInfo & SetPALTV)) ||
((SiS_Pr->SiS_VBInfo & SetPALTV) && (resinfo != SIS_RI_512x384) ) ) {
tempax &= ~(SupportTV1024);
if(HwDeviceExtension->jChipType >= SIS_315H) {
if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
if( (!(SiS_Pr->SiS_VBInfo & SetPALTV)) ||
((SiS_Pr->SiS_VBInfo & SetPALTV) && (resinfo != SIS_RI_800x600)) ) {
if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return(0);
}
}
} else {
if( (resinfo != SIS_RI_400x300) ||
(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) ||
(SiS_Pr->SiS_VBInfo & SetNotSimuMode) ) {
if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) {
if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
if(resinfo == SIS_RI_400x300) return(0);
if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return(0);
}
}
} else return(0);
}
}
}
}
} else { /* 301 */
tempax &= ~(SupportTV1024);
if(HwDeviceExtension->jChipType >= SIS_315H) {
if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
if( (!(SiS_Pr->SiS_VBInfo & SetPALTV)) ||
((SiS_Pr->SiS_VBInfo & SetPALTV) && (resinfo != SIS_RI_800x600)) ) {
if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return(0);
}
}
} else {
if( (resinfo != SIS_RI_400x300) ||
(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) ||
(SiS_Pr->SiS_VBInfo & SetNotSimuMode) ) {
if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) {
if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
if(resinfo == SIS_RI_400x300) return(0);
if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return (0);
}
}
} else return(0);
}
}
}
} else { /* for LVDS */
if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
tempax |= SupportCHTV;
}
}
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
tempax |= SupportLCD;
if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) {
if((resinfo != SIS_RI_1280x768) && (resinfo >= SIS_RI_1280x1024)) return(0);
} else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) {
if((resinfo != SIS_RI_1024x600) && (resinfo >= SIS_RI_1024x768)) return(0);
} else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) {
if((resinfo != SIS_RI_1152x768) && (resinfo > SIS_RI_1024x768)) return(0);
} else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) {
if((resinfo != SIS_RI_1400x1050) && (resinfo > SIS_RI_1280x1024)) return(0);
} else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) {
if(resinfo > SIS_RI_1600x1200) return(0);
} else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) {
if(resinfo > SIS_RI_1280x1024) return(0);
} else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) {
if(resinfo > SIS_RI_1024x768) return(0);
} else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600){
if(resinfo > SIS_RI_800x600) return(0);
if(resinfo == SIS_RI_512x384) return(0);
} else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelBarco1366) {
if((resinfo != SIS_RI_1360x1024) && (resinfo > SIS_RI_1280x1024)) return(0);
} else if(SiS_Pr->SiS_LCDResInfo == Panel_848x480) {
if((resinfo != SIS_RI_1360x768) &&
(resinfo != SIS_RI_848x480) &&
(resinfo > SIS_RI_1024x768)) return(0);
}
}
}
/* Look backwards in table for matching CRT2 mode */
for(; SiS_Pr->SiS_RefIndex[RefreshRateTableIndex+(*i)].ModeID == tempbx; (*i)--) {
infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].Ext_InfoFlag;
if(infoflag & tempax) {
return(1);
}
if ((*i) == 0) break;
}
/* Look through the whole mode-section of the table from the beginning
* for a matching CRT2 mode if no mode was found yet.
*/
for((*i) = 0; ; (*i)++) {
infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].Ext_InfoFlag;
if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].ModeID != tempbx) {
return(0);
}
if(infoflag & tempax) {
return(1);
}
}
return(1);
}
Generated by GNU enscript 1.6.4.