apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2 | #include <asm/io.h> |
| 3 | #include <linux/types.h> |
| 4 | #include <linux/version.h> |
| 5 | #include "XGIfb.h" |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7 | |
| 8 | #include "vb_def.h" |
| 9 | #include "vgatypes.h" |
| 10 | #include "vb_struct.h" |
| 11 | #include "vb_util.h" |
| 12 | #include "vb_table.h" |
| 13 | |
| 14 | |
| 15 | |
| 16 | #define IndexMask 0xff |
| 17 | #ifndef XGI_MASK_DUAL_CHIP |
| 18 | #define XGI_MASK_DUAL_CHIP 0x04 /* SR3A */ |
| 19 | #endif |
| 20 | |
| 21 | |
| 22 | |
| 23 | BOOLEAN XGI_IsLCDDualLink(PVB_DEVICE_INFO pVBInfo); |
| 24 | BOOLEAN XGI_SetCRT2Group301(USHORT ModeNo, PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo); |
| 25 | BOOLEAN XGI_BacklightByDrv(PVB_DEVICE_INFO pVBInfo); |
| 26 | |
| 27 | BOOLEAN XGI_IsLCDON(PVB_DEVICE_INFO pVBInfo); |
| 28 | BOOLEAN XGI_DisableChISLCD(PVB_DEVICE_INFO pVBInfo); |
| 29 | BOOLEAN XGI_EnableChISLCD(PVB_DEVICE_INFO pVBInfo); |
| 30 | BOOLEAN XGI_AjustCRT2Rate(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,USHORT *i, PVB_DEVICE_INFO pVBInfo); |
| 31 | BOOLEAN XGI_SearchModeID( USHORT ModeNo,USHORT *ModeIdIndex, PVB_DEVICE_INFO pVBInfo); |
| 32 | BOOLEAN XGI_GetLCDInfo(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo); |
| 33 | BOOLEAN XGISetModeNew( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT ModeNo ) ; |
| 34 | BOOLEAN XGI_BridgeIsOn(PVB_DEVICE_INFO pVBInfo); |
| 35 | UCHAR XGI_GetModePtr( USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo); |
| 36 | USHORT XGI_GetOffset(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo); |
| 37 | USHORT XGI_GetRatePtrCRT2( PXGI_HW_DEVICE_INFO pXGIHWDE, USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo ); |
| 38 | USHORT XGI_GetResInfo(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo); |
| 39 | USHORT XGI_GetColorDepth(USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo); |
| 40 | USHORT XGI_GetVGAHT2(PVB_DEVICE_INFO pVBInfo); |
| 41 | USHORT XGI_GetVCLK2Ptr(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo); |
| 42 | void XGI_VBLongWait(PVB_DEVICE_INFO pVBInfo); |
| 43 | void XGI_SaveCRT2Info(USHORT ModeNo, PVB_DEVICE_INFO pVBInfo); |
| 44 | void XGI_GetCRT2Data(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 45 | void XGI_GetCRT2ResInfo(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo); |
| 46 | void XGI_PreSetGroup1(USHORT ModeNo,USHORT ModeIdIndex, PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 47 | void XGI_SetGroup1(USHORT ModeNo,USHORT ModeIdIndex, PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 48 | void XGI_SetLockRegs(USHORT ModeNo,USHORT ModeIdIndex, PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 49 | void XGI_SetLCDRegs(USHORT ModeNo,USHORT ModeIdIndex, PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 50 | void XGI_SetGroup2(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo); |
| 51 | void XGI_SetGroup3(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo); |
| 52 | void XGI_SetGroup4(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo); |
| 53 | void XGI_SetGroup5(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo); |
| 54 | void* XGI_GetLcdPtr(USHORT BX, USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 55 | void* XGI_GetTVPtr(USHORT BX, USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 56 | void XGI_FirePWDEnable(PVB_DEVICE_INFO pVBInfo); |
| 57 | void XGI_EnableGatingCRT(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo); |
| 58 | void XGI_DisableGatingCRT(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo); |
| 59 | void XGI_SetPanelDelay(USHORT tempbl, PVB_DEVICE_INFO pVBInfo); |
| 60 | void XGI_SetPanelPower(USHORT tempah,USHORT tempbl, PVB_DEVICE_INFO pVBInfo); |
| 61 | void XGI_EnablePWD( PVB_DEVICE_INFO pVBInfo); |
| 62 | void XGI_DisablePWD( PVB_DEVICE_INFO pVBInfo); |
| 63 | void XGI_AutoThreshold( PVB_DEVICE_INFO pVBInfo); |
| 64 | void XGI_SetTap4Regs( PVB_DEVICE_INFO pVBInfo); |
| 65 | |
| 66 | void XGI_DisplayOn(PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO pVBInfo); |
| 67 | void XGI_DisplayOff( PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO pVBInfo ); |
| 68 | void XGI_SetCRT1Group(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo); |
| 69 | void XGI_SetXG21CRTC(USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 70 | void XGI_SetXG21LCD(PVB_DEVICE_INFO pVBInfo,USHORT RefreshRateTableIndex,USHORT ModeNo); |
| 71 | void XGI_SetXG27CRTC(USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 72 | void XGI_SetXG27LCD(PVB_DEVICE_INFO pVBInfo,USHORT RefreshRateTableIndex,USHORT ModeNo); |
| 73 | void XGI_UpdateXG21CRTC(USHORT ModeNo, PVB_DEVICE_INFO pVBInfo, USHORT RefreshRateTableIndex); |
| 74 | void XGI_WaitDisply(PVB_DEVICE_INFO pVBInfo); |
| 75 | void XGI_SenseCRT1(PVB_DEVICE_INFO pVBInfo); |
| 76 | void XGI_SetSeqRegs(USHORT ModeNo,USHORT StandTableIndex,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo); |
| 77 | void XGI_SetMiscRegs(USHORT StandTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 78 | void XGI_SetCRTCRegs(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT StandTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 79 | void XGI_SetATTRegs(USHORT ModeNo,USHORT StandTableIndex,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo ); |
| 80 | void XGI_SetGRCRegs(USHORT StandTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 81 | void XGI_ClearExt1Regs(PVB_DEVICE_INFO pVBInfo); |
| 82 | |
| 83 | void XGI_SetSync(USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo); |
| 84 | void XGI_SetCRT1CRTC(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo,PXGI_HW_DEVICE_INFO HwDeviceExtension); |
| 85 | void XGI_SetCRT1Timing_H(PVB_DEVICE_INFO pVBInfo,PXGI_HW_DEVICE_INFO HwDeviceExtension); |
| 86 | void XGI_SetCRT1Timing_V(USHORT ModeIdIndex,USHORT ModeNo,PVB_DEVICE_INFO pVBInfo); |
| 87 | void XGI_SetCRT1DE(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo); |
| 88 | void XGI_SetCRT1VCLK(USHORT ModeNo,USHORT ModeIdIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 89 | void XGI_SetCRT1FIFO(USHORT ModeNo,PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo); |
| 90 | void XGI_SetCRT1ModeRegs(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo); |
| 91 | void XGI_SetVCLKState(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo,USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo); |
| 92 | |
| 93 | void XGI_LoadDAC(USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo); |
| 94 | void XGI_WriteDAC(USHORT dl, USHORT ah, USHORT al, USHORT dh, PVB_DEVICE_INFO pVBInfo); |
| 95 | /*void XGI_ClearBuffer(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo,PVB_DEVICE_INFO pVBInfo);*/ |
| 96 | void XGI_SetLCDAGroup(USHORT ModeNo,USHORT ModeIdIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo); |
| 97 | void XGI_GetLVDSResInfo( USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo); |
| 98 | void XGI_GetLVDSData(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo); |
| 99 | void XGI_ModCRT1Regs(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo); |
| 100 | void XGI_SetLVDSRegs(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo); |
| 101 | void XGI_UpdateModeInfo(PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo); |
| 102 | void XGI_GetVGAType(PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo); |
| 103 | void XGI_GetVBType(PVB_DEVICE_INFO pVBInfo); |
| 104 | void XGI_GetVBInfo(USHORT ModeNo,USHORT ModeIdIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo); |
| 105 | void XGI_GetTVInfo(USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo); |
| 106 | void XGI_SetCRT2ECLK( USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo); |
| 107 | void InitTo330Pointer(UCHAR,PVB_DEVICE_INFO pVBInfo); |
| 108 | void XGI_GetLCDSync(USHORT* HSyncWidth, USHORT* VSyncWidth, PVB_DEVICE_INFO pVBInfo); |
| 109 | void XGI_DisableBridge(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo); |
| 110 | void XGI_EnableBridge(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo); |
| 111 | void XGI_SetCRT2VCLK(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 112 | void XGI_OEM310Setting(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo); |
| 113 | void XGI_SetDelayComp(PVB_DEVICE_INFO pVBInfo); |
| 114 | void XGI_SetLCDCap(PVB_DEVICE_INFO pVBInfo); |
| 115 | void XGI_SetLCDCap_A(USHORT tempcx,PVB_DEVICE_INFO pVBInfo); |
| 116 | void XGI_SetLCDCap_B(USHORT tempcx,PVB_DEVICE_INFO pVBInfo); |
| 117 | void SetSpectrum(PVB_DEVICE_INFO pVBInfo); |
| 118 | void XGI_SetAntiFlicker(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo); |
| 119 | void XGI_SetEdgeEnhance(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo); |
| 120 | void XGI_SetPhaseIncr(PVB_DEVICE_INFO pVBInfo); |
| 121 | void XGI_SetYFilter(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo); |
| 122 | void XGI_GetTVPtrIndex2(USHORT* tempbx,UCHAR* tempcl,UCHAR* tempch, PVB_DEVICE_INFO pVBInfo); |
| 123 | USHORT XGI_GetTVPtrIndex( PVB_DEVICE_INFO pVBInfo ); |
| 124 | void XGI_SetCRT2ModeRegs(USHORT ModeNo,PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO pVBInfo ); |
| 125 | void XGI_CloseCRTC(PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO pVBInfo); |
| 126 | void XGI_OpenCRTC(PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO pVBInfo); |
| 127 | void XGI_GetRAMDAC2DATA(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 128 | void XGI_UnLockCRT2(PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO pVBInfo); |
| 129 | void XGI_LockCRT2(PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO pVBInfo); |
| 130 | void XGINew_EnableCRT2(PVB_DEVICE_INFO pVBInfo); |
| 131 | void XGINew_LCD_Wait_Time(UCHAR DelayTime, PVB_DEVICE_INFO pVBInfo); |
| 132 | void XGI_LongWait(PVB_DEVICE_INFO pVBInfo); |
| 133 | void XGI_SetCRT1Offset( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex , PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo ); |
| 134 | void XGI_GetLCDVCLKPtr(UCHAR* di_0,UCHAR *di_1, PVB_DEVICE_INFO pVBInfo); |
| 135 | UCHAR XGI_GetVCLKPtr(USHORT RefreshRateTableIndex,USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo); |
| 136 | void XGI_GetVCLKLen(UCHAR tempal,UCHAR* di_0,UCHAR* di_1, PVB_DEVICE_INFO pVBInfo); |
| 137 | USHORT XGI_GetLCDCapPtr(PVB_DEVICE_INFO pVBInfo); |
| 138 | USHORT XGI_GetLCDCapPtr1(PVB_DEVICE_INFO pVBInfo); |
| 139 | XGI301C_Tap4TimingStruct* XGI_GetTap4Ptr(USHORT tempcx, PVB_DEVICE_INFO pVBInfo); |
| 140 | void XGI_SetXG21FPBits(PVB_DEVICE_INFO pVBInfo); |
| 141 | void XGI_SetXG27FPBits(PVB_DEVICE_INFO pVBInfo); |
| 142 | UCHAR XGI_XG21GetPSCValue(PVB_DEVICE_INFO pVBInfo); |
| 143 | UCHAR XGI_XG27GetPSCValue(PVB_DEVICE_INFO pVBInfo); |
| 144 | void XGI_XG21BLSignalVDD(USHORT tempbh,USHORT tempbl, PVB_DEVICE_INFO pVBInfo); |
| 145 | void XGI_XG27BLSignalVDD(USHORT tempbh,USHORT tempbl, PVB_DEVICE_INFO pVBInfo); |
| 146 | void XGI_XG21SetPanelDelay(USHORT tempbl, PVB_DEVICE_INFO pVBInfo); |
| 147 | BOOLEAN XGI_XG21CheckLVDSMode(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ); |
| 148 | void XGI_SetXG21LVDSPara(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ); |
| 149 | void XGI_SetXG27LVDSPara(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ); |
| 150 | UCHAR XGI_SetDefaultVCLK( PVB_DEVICE_INFO pVBInfo ); |
| 151 | |
| 152 | extern void ReadVBIOSTablData( UCHAR ChipType , PVB_DEVICE_INFO pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 153 | |
| 154 | /* USHORT XGINew_flag_clearbuffer; 0: no clear frame buffer 1:clear frame buffer */ |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | USHORT XGINew_MDA_DAC[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 161 | 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, |
| 162 | 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, |
| 163 | 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F, |
| 164 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 165 | 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, |
| 166 | 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, |
| 167 | 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F}; |
| 168 | |
| 169 | USHORT XGINew_CGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, |
| 170 | 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, |
| 171 | 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, |
| 172 | 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, |
| 173 | 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, |
| 174 | 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, |
| 175 | 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, |
| 176 | 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F}; |
| 177 | |
| 178 | USHORT XGINew_EGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x05,0x15, |
| 179 | 0x20,0x30,0x24,0x34,0x21,0x31,0x25,0x35, |
| 180 | 0x08,0x18,0x0C,0x1C,0x09,0x19,0x0D,0x1D, |
| 181 | 0x28,0x38,0x2C,0x3C,0x29,0x39,0x2D,0x3D, |
| 182 | 0x02,0x12,0x06,0x16,0x03,0x13,0x07,0x17, |
| 183 | 0x22,0x32,0x26,0x36,0x23,0x33,0x27,0x37, |
| 184 | 0x0A,0x1A,0x0E,0x1E,0x0B,0x1B,0x0F,0x1F, |
| 185 | 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F}; |
| 186 | |
| 187 | USHORT XGINew_VGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, |
| 188 | 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, |
| 189 | 0x00,0x05,0x08,0x0B,0x0E,0x11,0x14,0x18, |
| 190 | 0x1C,0x20,0x24,0x28,0x2D,0x32,0x38,0x3F, |
| 191 | |
| 192 | 0x00,0x10,0x1F,0x2F,0x3F,0x1F,0x27,0x2F, |
| 193 | 0x37,0x3F,0x2D,0x31,0x36,0x3A,0x3F,0x00, |
| 194 | 0x07,0x0E,0x15,0x1C,0x0E,0x11,0x15,0x18, |
| 195 | 0x1C,0x14,0x16,0x18,0x1A,0x1C,0x00,0x04, |
| 196 | 0x08,0x0C,0x10,0x08,0x0A,0x0C,0x0E,0x10, |
| 197 | 0x0B,0x0C,0x0D,0x0F,0x10}; |
| 198 | |
| 199 | |
| 200 | /* --------------------------------------------------------------------- */ |
| 201 | /* Function : InitTo330Pointer */ |
| 202 | /* Input : */ |
| 203 | /* Output : */ |
| 204 | /* Description : */ |
| 205 | /* --------------------------------------------------------------------- */ |
| 206 | void InitTo330Pointer( UCHAR ChipType ,PVB_DEVICE_INFO pVBInfo) |
| 207 | { |
| 208 | pVBInfo->SModeIDTable = (XGI_StStruct *) XGI330_SModeIDTable ; |
| 209 | pVBInfo->StandTable = (XGI_StandTableStruct *) XGI330_StandTable ; |
| 210 | pVBInfo->EModeIDTable = (XGI_ExtStruct *) XGI330_EModeIDTable ; |
| 211 | pVBInfo->RefIndex = (XGI_Ext2Struct *) XGI330_RefIndex ; |
| 212 | pVBInfo->XGINEWUB_CRT1Table = (XGI_CRT1TableStruct *) XGI_CRT1Table ; |
| 213 | |
| 214 | /* add for new UNIVGABIOS */ |
| 215 | /* XGINew_UBLCDDataTable = (XGI_LCDDataTablStruct *) XGI_LCDDataTable ; */ |
| 216 | /* XGINew_UBTVDataTable = (XGI_TVDataTablStruct *) XGI_TVDataTable ; */ |
| 217 | |
| 218 | |
| 219 | if ( ChipType >= XG40 ) |
| 220 | { |
| 221 | pVBInfo->MCLKData = (XGI_MCLKDataStruct *) XGI340New_MCLKData ; |
| 222 | pVBInfo->ECLKData = (XGI_ECLKDataStruct *) XGI340_ECLKData ; |
| 223 | } |
| 224 | else |
| 225 | { |
| 226 | pVBInfo->MCLKData = (XGI_MCLKDataStruct *) XGI330New_MCLKData ; |
| 227 | pVBInfo->ECLKData = (XGI_ECLKDataStruct *) XGI330_ECLKData ; |
| 228 | } |
| 229 | |
| 230 | pVBInfo->VCLKData = (XGI_VCLKDataStruct *) XGI_VCLKData ; |
| 231 | pVBInfo->VBVCLKData = (XGI_VBVCLKDataStruct *) XGI_VBVCLKData ; |
| 232 | pVBInfo->ScreenOffset = XGI330_ScreenOffset ; |
| 233 | pVBInfo->StResInfo = (XGI_StResInfoStruct *) XGI330_StResInfo ; |
| 234 | pVBInfo->ModeResInfo = (XGI_ModeResInfoStruct *) XGI330_ModeResInfo ; |
| 235 | |
| 236 | pVBInfo->pOutputSelect = &XGI330_OutputSelect ; |
| 237 | pVBInfo->pSoftSetting = &XGI330_SoftSetting ; |
| 238 | pVBInfo->pSR07 = &XGI330_SR07 ; |
| 239 | pVBInfo->LCDResInfo = 0 ; |
| 240 | pVBInfo->LCDTypeInfo = 0 ; |
| 241 | pVBInfo->LCDInfo = 0 ; |
| 242 | pVBInfo->VBInfo = 0 ; |
| 243 | pVBInfo->TVInfo = 0; |
| 244 | |
| 245 | |
| 246 | pVBInfo->SR15 = XGI340_SR13 ; |
| 247 | pVBInfo->CR40 = XGI340_cr41 ; |
| 248 | pVBInfo->SR25 = XGI330_sr25 ; |
| 249 | pVBInfo->pSR31 = &XGI330_sr31 ; |
| 250 | pVBInfo->pSR32 = &XGI330_sr32 ; |
| 251 | pVBInfo->CR6B = XGI340_CR6B ; |
| 252 | pVBInfo->CR6E = XGI340_CR6E ; |
| 253 | pVBInfo->CR6F = XGI340_CR6F ; |
| 254 | pVBInfo->CR89 = XGI340_CR89 ; |
| 255 | pVBInfo->AGPReg = XGI340_AGPReg ; |
| 256 | pVBInfo->SR16 = XGI340_SR16 ; |
| 257 | pVBInfo->pCRCF = &XG40_CRCF ; |
| 258 | pVBInfo->pXGINew_DRAMTypeDefinition = &XG40_DRAMTypeDefinition ; |
| 259 | |
| 260 | |
| 261 | pVBInfo->CR49 = XGI330_CR49 ; |
| 262 | pVBInfo->pSR1F = &XGI330_SR1F ; |
| 263 | pVBInfo->pSR21 = &XGI330_SR21 ; |
| 264 | pVBInfo->pSR22 = &XGI330_SR22 ; |
| 265 | pVBInfo->pSR23 = &XGI330_SR23 ; |
| 266 | pVBInfo->pSR24 = &XGI330_SR24 ; |
| 267 | pVBInfo->pSR33 = &XGI330_SR33 ; |
| 268 | |
| 269 | |
| 270 | |
| 271 | pVBInfo->pCRT2Data_1_2 = &XGI330_CRT2Data_1_2 ; |
| 272 | pVBInfo->pCRT2Data_4_D = &XGI330_CRT2Data_4_D ; |
| 273 | pVBInfo->pCRT2Data_4_E = &XGI330_CRT2Data_4_E ; |
| 274 | pVBInfo->pCRT2Data_4_10 = &XGI330_CRT2Data_4_10 ; |
| 275 | pVBInfo->pRGBSenseData = &XGI330_RGBSenseData ; |
| 276 | pVBInfo->pVideoSenseData = &XGI330_VideoSenseData ; |
| 277 | pVBInfo->pYCSenseData = &XGI330_YCSenseData ; |
| 278 | pVBInfo->pRGBSenseData2 = &XGI330_RGBSenseData2 ; |
| 279 | pVBInfo->pVideoSenseData2 = &XGI330_VideoSenseData2 ; |
| 280 | pVBInfo->pYCSenseData2 = &XGI330_YCSenseData2 ; |
| 281 | |
| 282 | pVBInfo->NTSCTiming = XGI330_NTSCTiming ; |
| 283 | pVBInfo->PALTiming = XGI330_PALTiming ; |
| 284 | pVBInfo->HiTVExtTiming = XGI330_HiTVExtTiming ; |
| 285 | pVBInfo->HiTVSt1Timing = XGI330_HiTVSt1Timing ; |
| 286 | pVBInfo->HiTVSt2Timing = XGI330_HiTVSt2Timing ; |
| 287 | pVBInfo->HiTVTextTiming = XGI330_HiTVTextTiming ; |
| 288 | pVBInfo->YPbPr750pTiming = XGI330_YPbPr750pTiming ; |
| 289 | pVBInfo->YPbPr525pTiming = XGI330_YPbPr525pTiming ; |
| 290 | pVBInfo->YPbPr525iTiming = XGI330_YPbPr525iTiming ; |
| 291 | pVBInfo->HiTVGroup3Data = XGI330_HiTVGroup3Data ; |
| 292 | pVBInfo->HiTVGroup3Simu = XGI330_HiTVGroup3Simu ; |
| 293 | pVBInfo->HiTVGroup3Text = XGI330_HiTVGroup3Text ; |
| 294 | pVBInfo->Ren525pGroup3 = XGI330_Ren525pGroup3 ; |
| 295 | pVBInfo->Ren750pGroup3 = XGI330_Ren750pGroup3 ; |
| 296 | |
| 297 | |
| 298 | pVBInfo->TimingH = (XGI_TimingHStruct *) XGI_TimingH ; |
| 299 | pVBInfo->TimingV = (XGI_TimingVStruct *) XGI_TimingV ; |
| 300 | pVBInfo->UpdateCRT1 = (XGI_XG21CRT1Struct *) XGI_UpdateCRT1Table ; |
| 301 | |
| 302 | pVBInfo->CHTVVCLKUNTSC = XGI330_CHTVVCLKUNTSC ; |
| 303 | pVBInfo->CHTVVCLKONTSC = XGI330_CHTVVCLKONTSC ; |
| 304 | pVBInfo->CHTVVCLKUPAL = XGI330_CHTVVCLKUPAL ; |
| 305 | pVBInfo->CHTVVCLKOPAL = XGI330_CHTVVCLKOPAL ; |
| 306 | |
| 307 | /* 310 customization related */ |
| 308 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 309 | pVBInfo->LCDCapList = XGI_LCDDLCapList ; |
| 310 | else |
| 311 | pVBInfo->LCDCapList = XGI_LCDCapList ; |
| 312 | |
| 313 | if ( ( ChipType == XG21 ) || ( ChipType == XG27 ) ) |
| 314 | pVBInfo->XG21_LVDSCapList = XGI21_LCDCapList ; |
| 315 | |
| 316 | pVBInfo->XGI_TVDelayList = XGI301TVDelayList ; |
| 317 | pVBInfo->XGI_TVDelayList2 = XGI301TVDelayList2 ; |
| 318 | |
| 319 | |
| 320 | pVBInfo->pXGINew_I2CDefinition = &XG40_I2CDefinition ; |
| 321 | |
| 322 | if ( ChipType >= XG20 ) |
| 323 | pVBInfo->pXGINew_CR97 = &XG20_CR97 ; |
| 324 | |
| 325 | if ( ChipType == XG27 ) |
| 326 | { |
| 327 | pVBInfo->MCLKData = (XGI_MCLKDataStruct *) XGI27New_MCLKData ; |
| 328 | pVBInfo->CR40 = XGI27_cr41 ; |
| 329 | pVBInfo->pXGINew_CR97 = &XG27_CR97 ; |
| 330 | pVBInfo->pSR36 = &XG27_SR36 ; |
| 331 | pVBInfo->pCR8F = &XG27_CR8F ; |
| 332 | pVBInfo->pCRD0 = XG27_CRD0 ; |
| 333 | pVBInfo->pCRDE = XG27_CRDE ; |
| 334 | pVBInfo->pSR40 = &XG27_SR40 ; |
| 335 | pVBInfo->pSR41 = &XG27_SR41 ; |
| 336 | |
| 337 | } |
| 338 | |
| 339 | if ( ChipType >= XG20 ) |
| 340 | { |
| 341 | pVBInfo->pDVOSetting = &XG21_DVOSetting ; |
| 342 | pVBInfo->pCR2E = &XG21_CR2E ; |
| 343 | pVBInfo->pCR2F = &XG21_CR2F ; |
| 344 | pVBInfo->pCR46 = &XG21_CR46 ; |
| 345 | pVBInfo->pCR47 = &XG21_CR47 ; |
| 346 | } |
| 347 | |
| 348 | } |
| 349 | |
| 350 | |
| 351 | |
| 352 | |
| 353 | |
| 354 | |
| 355 | /* --------------------------------------------------------------------- */ |
| 356 | /* Function : XGISetModeNew */ |
| 357 | /* Input : */ |
| 358 | /* Output : */ |
| 359 | /* Description : */ |
| 360 | /* --------------------------------------------------------------------- */ |
| 361 | BOOLEAN XGISetModeNew( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT ModeNo ) |
| 362 | { |
| 363 | USHORT ModeIdIndex ; |
| 364 | /* PUCHAR pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress ; */ |
| 365 | VB_DEVICE_INFO VBINF; |
| 366 | PVB_DEVICE_INFO pVBInfo = &VBINF; |
| 367 | pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase ; |
| 368 | pVBInfo->BaseAddr = (ULONG)HwDeviceExtension->pjIOAddress ; |
| 369 | pVBInfo->IF_DEF_LVDS = 0 ; |
| 370 | pVBInfo->IF_DEF_CH7005 = 0 ; |
| 371 | pVBInfo->IF_DEF_LCDA = 1 ; |
| 372 | pVBInfo->IF_DEF_CH7017 = 0 ; |
| 373 | pVBInfo->IF_DEF_CH7007 = 0 ; /* [Billy] 2007/05/14 */ |
| 374 | pVBInfo->IF_DEF_VideoCapture = 0 ; |
| 375 | pVBInfo->IF_DEF_ScaleLCD = 0 ; |
| 376 | pVBInfo->IF_DEF_OEMUtil = 0 ; |
| 377 | pVBInfo->IF_DEF_PWD = 0 ; |
| 378 | |
| 379 | |
| 380 | if ( HwDeviceExtension->jChipType >= XG20 ) /* kuku 2004/06/25 */ |
| 381 | { |
| 382 | pVBInfo->IF_DEF_YPbPr = 0 ; |
| 383 | pVBInfo->IF_DEF_HiVision = 0 ; |
| 384 | pVBInfo->IF_DEF_CRT2Monitor = 0 ; |
| 385 | pVBInfo->VBType = 0 ; /*set VBType default 0*/ |
| 386 | } |
| 387 | else if ( HwDeviceExtension->jChipType >= XG40 ) |
| 388 | { |
| 389 | pVBInfo->IF_DEF_YPbPr = 1 ; |
| 390 | pVBInfo->IF_DEF_HiVision = 1 ; |
| 391 | pVBInfo->IF_DEF_CRT2Monitor = 1 ; |
| 392 | } |
| 393 | else |
| 394 | { |
| 395 | pVBInfo->IF_DEF_YPbPr = 1 ; |
| 396 | pVBInfo->IF_DEF_HiVision = 1 ; |
| 397 | pVBInfo->IF_DEF_CRT2Monitor = 0 ; |
| 398 | } |
| 399 | |
| 400 | pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14 ; |
| 401 | pVBInfo->P3d4 = pVBInfo->BaseAddr + 0x24 ; |
| 402 | pVBInfo->P3c0 = pVBInfo->BaseAddr + 0x10 ; |
| 403 | pVBInfo->P3ce = pVBInfo->BaseAddr + 0x1e ; |
| 404 | pVBInfo->P3c2 = pVBInfo->BaseAddr + 0x12 ; |
| 405 | pVBInfo->P3cc = pVBInfo->BaseAddr + 0x1C ; |
| 406 | pVBInfo->P3ca = pVBInfo->BaseAddr + 0x1a ; |
| 407 | pVBInfo->P3c6 = pVBInfo->BaseAddr + 0x16 ; |
| 408 | pVBInfo->P3c7 = pVBInfo->BaseAddr + 0x17 ; |
| 409 | pVBInfo->P3c8 = pVBInfo->BaseAddr + 0x18 ; |
| 410 | pVBInfo->P3c9 = pVBInfo->BaseAddr + 0x19 ; |
| 411 | pVBInfo->P3da = pVBInfo->BaseAddr + 0x2A ; |
| 412 | pVBInfo->Part0Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_00 ; |
| 413 | pVBInfo->Part1Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_04 ; |
| 414 | pVBInfo->Part2Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_10 ; |
| 415 | pVBInfo->Part3Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_12 ; |
| 416 | pVBInfo->Part4Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 ; |
| 417 | pVBInfo->Part5Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 + 2 ; |
| 418 | |
| 419 | if ( HwDeviceExtension->jChipType == XG21 ) /* for x86 Linux, XG21 LVDS */ |
| 420 | { |
| 421 | if ( ( XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) & 0xE0 ) == 0xC0 ) |
| 422 | { |
| 423 | pVBInfo->IF_DEF_LVDS = 1 ; |
| 424 | } |
| 425 | } |
| 426 | if ( HwDeviceExtension->jChipType == XG27 ) |
| 427 | { |
| 428 | if ( ( XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) & 0xE0 ) == 0xC0 ) |
| 429 | { |
| 430 | if ( XGINew_GetReg1( pVBInfo->P3d4 , 0x30 ) & 0x20 ) |
| 431 | { |
| 432 | pVBInfo->IF_DEF_LVDS = 1 ; |
| 433 | } |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | if ( HwDeviceExtension->jChipType < XG20 ) /* kuku 2004/06/25 */ |
| 438 | XGI_GetVBType( pVBInfo ) ; |
| 439 | |
| 440 | InitTo330Pointer( HwDeviceExtension->jChipType, pVBInfo ) ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 441 | if ( ModeNo & 0x80 ) |
| 442 | { |
| 443 | ModeNo = ModeNo & 0x7F ; |
| 444 | /* XGINew_flag_clearbuffer = 0 ; */ |
| 445 | } |
| 446 | /* else |
| 447 | { |
| 448 | XGINew_flag_clearbuffer = 1 ; |
| 449 | } |
| 450 | */ |
| 451 | XGINew_SetReg1( pVBInfo->P3c4 , 0x05 , 0x86 ) ; |
| 452 | |
| 453 | if ( HwDeviceExtension->jChipType < XG20 ) /* kuku 2004/06/25 1.Openkey */ |
| 454 | XGI_UnLockCRT2( HwDeviceExtension , pVBInfo ) ; |
| 455 | |
| 456 | XGI_SearchModeID( ModeNo , &ModeIdIndex, pVBInfo ) ; |
| 457 | |
| 458 | XGI_GetVGAType(HwDeviceExtension, pVBInfo) ; |
| 459 | |
| 460 | if ( HwDeviceExtension->jChipType < XG20 ) /* kuku 2004/06/25 */ |
| 461 | { |
| 462 | XGI_GetVBInfo(ModeNo , ModeIdIndex , HwDeviceExtension, pVBInfo ) ; |
| 463 | XGI_GetTVInfo(ModeNo , ModeIdIndex, pVBInfo ) ; |
| 464 | XGI_GetLCDInfo(ModeNo , ModeIdIndex, pVBInfo ) ; |
| 465 | XGI_DisableBridge( HwDeviceExtension,pVBInfo ) ; |
| 466 | /* XGI_OpenCRTC( HwDeviceExtension, pVBInfo ) ; */ |
| 467 | |
| 468 | if ( pVBInfo->VBInfo & ( SetSimuScanMode | SetCRT2ToLCDA ) ) |
| 469 | { |
| 470 | XGI_SetCRT1Group(HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ; |
| 471 | |
| 472 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 473 | { |
| 474 | XGI_SetLCDAGroup(ModeNo , ModeIdIndex , HwDeviceExtension, pVBInfo ) ; |
| 475 | } |
| 476 | } |
| 477 | else |
| 478 | { |
| 479 | if ( !( pVBInfo->VBInfo & SwitchToCRT2) ) |
| 480 | { |
| 481 | XGI_SetCRT1Group( HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ; |
| 482 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 483 | { |
| 484 | XGI_SetLCDAGroup( ModeNo , ModeIdIndex , HwDeviceExtension, pVBInfo ) ; |
| 485 | } |
| 486 | } |
| 487 | } |
| 488 | |
| 489 | if ( pVBInfo->VBInfo & ( SetSimuScanMode | SwitchToCRT2 ) ) |
| 490 | { |
| 491 | switch( HwDeviceExtension->ujVBChipID ) |
| 492 | { |
| 493 | case VB_CHIP_301: |
| 494 | XGI_SetCRT2Group301( ModeNo , HwDeviceExtension, pVBInfo ) ; /*add for CRT2 */ |
| 495 | break ; |
| 496 | |
| 497 | case VB_CHIP_302: |
| 498 | XGI_SetCRT2Group301(ModeNo , HwDeviceExtension, pVBInfo ) ; /*add for CRT2 */ |
| 499 | break ; |
| 500 | |
| 501 | default: |
| 502 | break ; |
| 503 | } |
| 504 | } |
| 505 | |
| 506 | XGI_SetCRT2ModeRegs( ModeNo, HwDeviceExtension,pVBInfo ) ; |
| 507 | XGI_OEM310Setting( ModeNo, ModeIdIndex,pVBInfo ) ; /*0212*/ |
| 508 | XGI_CloseCRTC( HwDeviceExtension, pVBInfo ) ; |
| 509 | XGI_EnableBridge( HwDeviceExtension ,pVBInfo) ; |
| 510 | } /* !XG20 */ |
| 511 | else |
| 512 | { |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 513 | if (pVBInfo->IF_DEF_LVDS == 1) |
| 514 | if (!XGI_XG21CheckLVDSMode(ModeNo , ModeIdIndex, pVBInfo)) |
| 515 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 516 | |
| 517 | if ( ModeNo <= 0x13 ) |
| 518 | { |
| 519 | pVBInfo->ModeType = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag & ModeInfoFlag; |
| 520 | } |
| 521 | else |
| 522 | { |
| 523 | pVBInfo->ModeType = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag & ModeInfoFlag; |
| 524 | } |
| 525 | |
| 526 | pVBInfo->SetFlag = 0 ; |
| 527 | if ( pVBInfo->IF_DEF_CH7007 != 1 ) |
| 528 | { |
| 529 | pVBInfo->VBInfo = DisableCRT2Display ; |
| 530 | } |
| 531 | |
| 532 | |
| 533 | XGI_DisplayOff(HwDeviceExtension, pVBInfo) ; |
| 534 | |
| 535 | XGI_SetCRT1Group(HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ; |
| 536 | |
| 537 | XGI_DisplayOn( HwDeviceExtension, pVBInfo ) ; |
| 538 | /* |
| 539 | if( HwDeviceExtension->jChipType == XG21 ) |
| 540 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x09 , ~0x80 , 0x80 ) ; |
| 541 | */ |
| 542 | } |
| 543 | |
| 544 | |
| 545 | /* |
| 546 | if ( ModeNo <= 0x13 ) |
| 547 | { |
| 548 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 549 | } |
| 550 | else |
| 551 | { |
| 552 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 553 | } |
| 554 | pVBInfo->ModeType = modeflag&ModeInfoFlag ; |
| 555 | pVBInfo->SetFlag = 0x00 ; |
| 556 | pVBInfo->VBInfo = DisableCRT2Display ; |
| 557 | temp = XGINew_CheckMemorySize( HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ; |
| 558 | |
| 559 | if ( temp == 0 ) |
| 560 | return( 0 ) ; |
| 561 | |
| 562 | XGI_DisplayOff( HwDeviceExtension, pVBInfo) ; |
| 563 | XGI_SetCRT1Group( HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ; |
| 564 | XGI_DisplayOn( HwDeviceExtension, pVBInfo) ; |
| 565 | */ |
| 566 | |
| 567 | XGI_UpdateModeInfo( HwDeviceExtension, pVBInfo ) ; |
| 568 | |
| 569 | if ( HwDeviceExtension->jChipType < XG20 ) /* kuku 2004/06/25 */ |
| 570 | { |
| 571 | XGI_LockCRT2( HwDeviceExtension, pVBInfo ) ; |
| 572 | } |
| 573 | |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 574 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 575 | } |
| 576 | |
| 577 | |
| 578 | /* --------------------------------------------------------------------- */ |
| 579 | /* Function : XGI_SetCRT1Group */ |
| 580 | /* Input : */ |
| 581 | /* Output : */ |
| 582 | /* Description : */ |
| 583 | /* --------------------------------------------------------------------- */ |
| 584 | void XGI_SetCRT1Group( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 585 | { |
| 586 | USHORT StandTableIndex , |
| 587 | RefreshRateTableIndex , |
| 588 | b3CC , |
| 589 | temp ; |
| 590 | |
| 591 | USHORT XGINew_P3cc = pVBInfo->P3cc; |
| 592 | |
| 593 | /* XGINew_CRT1Mode = ModeNo ; // SaveModeID */ |
| 594 | StandTableIndex = XGI_GetModePtr( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 595 | /* XGI_SetBIOSData(ModeNo , ModeIdIndex ) ; */ |
| 596 | /* XGI_ClearBankRegs( ModeNo , ModeIdIndex ) ; */ |
| 597 | XGI_SetSeqRegs( ModeNo , StandTableIndex , ModeIdIndex, pVBInfo ) ; |
| 598 | XGI_SetMiscRegs( StandTableIndex, pVBInfo ) ; |
| 599 | XGI_SetCRTCRegs( HwDeviceExtension , StandTableIndex, pVBInfo) ; |
| 600 | XGI_SetATTRegs( ModeNo , StandTableIndex , ModeIdIndex, pVBInfo ) ; |
| 601 | XGI_SetGRCRegs( StandTableIndex, pVBInfo ) ; |
| 602 | XGI_ClearExt1Regs(pVBInfo) ; |
| 603 | |
| 604 | /* if ( pVBInfo->IF_DEF_ExpLink ) */ |
| 605 | if ( HwDeviceExtension->jChipType == XG27 ) |
| 606 | { |
| 607 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 608 | { |
| 609 | XGI_SetDefaultVCLK( pVBInfo ) ; |
| 610 | } |
| 611 | } |
| 612 | |
| 613 | temp = ~ProgrammingCRT2 ; |
| 614 | pVBInfo->SetFlag &= temp ; |
| 615 | pVBInfo->SelectCRT2Rate = 0 ; |
| 616 | |
| 617 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 618 | { |
| 619 | if ( pVBInfo->VBInfo & ( SetSimuScanMode | SetCRT2ToLCDA | SetInSlaveMode ) ) |
| 620 | { |
| 621 | pVBInfo->SetFlag |= ProgrammingCRT2 ; |
| 622 | } |
| 623 | } |
| 624 | |
| 625 | RefreshRateTableIndex = XGI_GetRatePtrCRT2( HwDeviceExtension, ModeNo , ModeIdIndex, pVBInfo ) ; |
| 626 | if ( RefreshRateTableIndex != 0xFFFF ) |
| 627 | { |
| 628 | XGI_SetSync( RefreshRateTableIndex, pVBInfo ) ; |
| 629 | XGI_SetCRT1CRTC( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo, HwDeviceExtension ) ; |
| 630 | XGI_SetCRT1DE( HwDeviceExtension , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 631 | XGI_SetCRT1Offset( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; |
| 632 | XGI_SetCRT1VCLK( ModeNo , ModeIdIndex , HwDeviceExtension , RefreshRateTableIndex, pVBInfo ) ; |
| 633 | } |
| 634 | |
| 635 | if ( ( HwDeviceExtension->jChipType >= XG20 )&& |
| 636 | ( HwDeviceExtension->jChipType < XG27 ) ) /* fix H/W DCLK/2 bug */ |
| 637 | { |
| 638 | if ( ( ModeNo == 0x00 ) | (ModeNo == 0x01) ) |
| 639 | { |
| 640 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , 0x4E) ; |
| 641 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , 0xE9) ; |
| 642 | b3CC =(UCHAR) XGINew_GetReg2(XGINew_P3cc) ; |
| 643 | XGINew_SetReg3(XGINew_P3cc , (b3CC |= 0x0C) ) ; |
| 644 | } |
| 645 | else if ( ( ModeNo == 0x04) | ( ModeNo == 0x05) | ( ModeNo == 0x0D) ) |
| 646 | { |
| 647 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , 0x1B) ; |
| 648 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , 0xE3) ; |
| 649 | b3CC = (UCHAR)XGINew_GetReg2(XGINew_P3cc) ; |
| 650 | XGINew_SetReg3(XGINew_P3cc , (b3CC |= 0x0C) ) ; |
| 651 | } |
| 652 | } |
| 653 | |
| 654 | if ( HwDeviceExtension->jChipType >= XG21 ) |
| 655 | { |
| 656 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) ; |
| 657 | if ( temp & 0xA0 ) |
| 658 | { |
| 659 | |
| 660 | /*XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~0x20 ) ;*/ /* Enable write GPIOF */ |
| 661 | /*XGINew_SetRegAND( pVBInfo->P3d4 , 0x48 , ~0x20 ) ;*/ /* P. DWN */ |
| 662 | /* XG21 CRT1 Timing */ |
| 663 | if ( HwDeviceExtension->jChipType == XG27 ) |
| 664 | XGI_SetXG27CRTC( ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo ); |
| 665 | else |
| 666 | XGI_SetXG21CRTC( ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo ); |
| 667 | |
| 668 | XGI_UpdateXG21CRTC( ModeNo , pVBInfo , RefreshRateTableIndex) ; |
| 669 | |
| 670 | if ( HwDeviceExtension->jChipType == XG27 ) |
| 671 | XGI_SetXG27LCD( pVBInfo , RefreshRateTableIndex , ModeNo ); |
| 672 | else |
| 673 | XGI_SetXG21LCD( pVBInfo , RefreshRateTableIndex , ModeNo ); |
| 674 | |
| 675 | if ( pVBInfo->IF_DEF_LVDS == 1 ) |
| 676 | { |
| 677 | if ( HwDeviceExtension->jChipType == XG27 ) |
| 678 | XGI_SetXG27LVDSPara(ModeNo,ModeIdIndex, pVBInfo ); |
| 679 | else |
| 680 | XGI_SetXG21LVDSPara(ModeNo,ModeIdIndex, pVBInfo ); |
| 681 | } |
| 682 | /*XGINew_SetRegOR( pVBInfo->P3d4 , 0x48 , 0x20 ) ;*/ /* P. ON */ |
| 683 | } |
| 684 | } |
| 685 | |
| 686 | pVBInfo->SetFlag &= ( ~ProgrammingCRT2 ) ; |
| 687 | XGI_SetCRT1FIFO( ModeNo , HwDeviceExtension, pVBInfo ) ; |
| 688 | XGI_SetCRT1ModeRegs( HwDeviceExtension , ModeNo , ModeIdIndex , RefreshRateTableIndex , pVBInfo) ; |
| 689 | |
| 690 | |
| 691 | /* XGI_LoadCharacter(); //dif ifdef TVFont */ |
| 692 | |
| 693 | XGI_LoadDAC( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 694 | /* XGI_ClearBuffer( HwDeviceExtension , ModeNo, pVBInfo ) ; */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 695 | } |
| 696 | |
| 697 | |
| 698 | /* --------------------------------------------------------------------- */ |
| 699 | /* Function : XGI_GetModePtr */ |
| 700 | /* Input : */ |
| 701 | /* Output : */ |
| 702 | /* Description : */ |
| 703 | /* --------------------------------------------------------------------- */ |
| 704 | UCHAR XGI_GetModePtr( USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 705 | { |
| 706 | UCHAR index ; |
| 707 | |
| 708 | if ( ModeNo <= 0x13 ) |
| 709 | index = pVBInfo->SModeIDTable[ ModeIdIndex ].St_StTableIndex ; |
| 710 | else |
| 711 | { |
| 712 | if ( pVBInfo->ModeType <= 0x02 ) |
| 713 | index = 0x1B ; /* 02 -> ModeEGA */ |
| 714 | else |
| 715 | index = 0x0F ; |
| 716 | } |
| 717 | return( index ) ; /* Get pVBInfo->StandTable index */ |
| 718 | } |
| 719 | |
| 720 | |
| 721 | /* --------------------------------------------------------------------- */ |
| 722 | /* Function : XGI_SetBIOSData */ |
| 723 | /* Input : */ |
| 724 | /* Output : */ |
| 725 | /* Description : */ |
| 726 | /* --------------------------------------------------------------------- */ |
| 727 | /*UCHAR XGI_SetBIOSData( USHORT ModeNo , USHORT ModeIdIndex ) |
| 728 | { |
| 729 | return( 0 ) ; |
| 730 | } |
| 731 | */ |
| 732 | |
| 733 | /* --------------------------------------------------------------------- */ |
| 734 | /* Function : XGI_ClearBankRegs */ |
| 735 | /* Input : */ |
| 736 | /* Output : */ |
| 737 | /* Description : */ |
| 738 | /* --------------------------------------------------------------------- */ |
| 739 | /*UCHAR XGI_ClearBankRegs( USHORT ModeNo , USHORT ModeIdIndex ) |
| 740 | { |
| 741 | return( 0 ) ; |
| 742 | } |
| 743 | */ |
| 744 | |
| 745 | /* --------------------------------------------------------------------- */ |
| 746 | /* Function : XGI_SetSeqRegs */ |
| 747 | /* Input : */ |
| 748 | /* Output : */ |
| 749 | /* Description : */ |
| 750 | /* --------------------------------------------------------------------- */ |
| 751 | void XGI_SetSeqRegs( USHORT ModeNo , USHORT StandTableIndex , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 752 | { |
| 753 | UCHAR tempah , |
| 754 | SRdata ; |
| 755 | |
| 756 | USHORT i , |
| 757 | modeflag ; |
| 758 | |
| 759 | if ( ModeNo <= 0x13 ) |
| 760 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 761 | else |
| 762 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 763 | |
| 764 | XGINew_SetReg1( pVBInfo->P3c4 , 0x00 , 0x03 ) ; /* Set SR0 */ |
| 765 | tempah=pVBInfo->StandTable[ StandTableIndex ].SR[ 0 ] ; |
| 766 | |
| 767 | i = SetCRT2ToLCDA ; |
| 768 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 769 | { |
| 770 | tempah |= 0x01 ; |
| 771 | } |
| 772 | else |
| 773 | { |
| 774 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToLCD ) ) |
| 775 | { |
| 776 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 777 | tempah |= 0x01 ; |
| 778 | } |
| 779 | } |
| 780 | |
| 781 | tempah |= 0x20 ; /* screen off */ |
| 782 | XGINew_SetReg1( pVBInfo->P3c4 , 0x01 , tempah ) ; /* Set SR1 */ |
| 783 | |
| 784 | for( i = 02 ; i <= 04 ; i++ ) |
| 785 | { |
| 786 | SRdata = pVBInfo->StandTable[ StandTableIndex ].SR[ i - 1 ] ; /* Get SR2,3,4 from file */ |
| 787 | XGINew_SetReg1( pVBInfo->P3c4 , i , SRdata ) ; /* Set SR2 3 4 */ |
| 788 | } |
| 789 | } |
| 790 | |
| 791 | |
| 792 | /* --------------------------------------------------------------------- */ |
| 793 | /* Function : XGI_SetMiscRegs */ |
| 794 | /* Input : */ |
| 795 | /* Output : */ |
| 796 | /* Description : */ |
| 797 | /* --------------------------------------------------------------------- */ |
| 798 | void XGI_SetMiscRegs( USHORT StandTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 799 | { |
| 800 | UCHAR Miscdata ; |
| 801 | |
| 802 | Miscdata = pVBInfo->StandTable[ StandTableIndex ].MISC ; /* Get Misc from file */ |
| 803 | /* |
| 804 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 805 | { |
| 806 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 807 | { |
| 808 | Miscdata |= 0x0C ; |
| 809 | } |
| 810 | } |
| 811 | */ |
| 812 | |
| 813 | XGINew_SetReg3( pVBInfo->P3c2 , Miscdata ) ; /* Set Misc(3c2) */ |
| 814 | } |
| 815 | |
| 816 | |
| 817 | /* --------------------------------------------------------------------- */ |
| 818 | /* Function : XGI_SetCRTCRegs */ |
| 819 | /* Input : */ |
| 820 | /* Output : */ |
| 821 | /* Description : */ |
| 822 | /* --------------------------------------------------------------------- */ |
| 823 | void XGI_SetCRTCRegs( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT StandTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 824 | { |
| 825 | UCHAR CRTCdata ; |
| 826 | USHORT i ; |
| 827 | |
| 828 | CRTCdata = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x11 ) ; |
| 829 | CRTCdata &= 0x7f ; |
| 830 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , CRTCdata ) ; /* Unlock CRTC */ |
| 831 | |
| 832 | for( i = 0 ; i <= 0x18 ; i++ ) |
| 833 | { |
| 834 | CRTCdata = pVBInfo->StandTable[ StandTableIndex ].CRTC[ i ] ; /* Get CRTC from file */ |
| 835 | XGINew_SetReg1( pVBInfo->P3d4 , i , CRTCdata ) ; /* Set CRTC( 3d4 ) */ |
| 836 | } |
| 837 | /* |
| 838 | if ( ( HwDeviceExtension->jChipType == XGI_630 )&& ( HwDeviceExtension->jChipRevision == 0x30 ) ) |
| 839 | { |
| 840 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 841 | { |
| 842 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToTV ) ) |
| 843 | { |
| 844 | XGINew_SetReg1( pVBInfo->P3d4 , 0x18 , 0xFE ) ; |
| 845 | } |
| 846 | } |
| 847 | } |
| 848 | */ |
| 849 | } |
| 850 | |
| 851 | |
| 852 | /* --------------------------------------------------------------------- */ |
| 853 | /* Function : */ |
| 854 | /* Input : */ |
| 855 | /* Output : */ |
| 856 | /* Description : */ |
| 857 | /* --------------------------------------------------------------------- */ |
| 858 | void XGI_SetATTRegs( USHORT ModeNo , USHORT StandTableIndex , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 859 | { |
| 860 | UCHAR ARdata ; |
| 861 | USHORT i , |
| 862 | modeflag ; |
| 863 | |
| 864 | if ( ModeNo <= 0x13 ) |
| 865 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 866 | else |
| 867 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 868 | |
| 869 | for( i = 0 ; i <= 0x13 ; i++ ) |
| 870 | { |
| 871 | ARdata = pVBInfo->StandTable[ StandTableIndex ].ATTR[ i ] ; |
| 872 | if ( modeflag & Charx8Dot ) /* ifndef Dot9 */ |
| 873 | { |
| 874 | if ( i == 0x13 ) |
| 875 | { |
| 876 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 877 | ARdata = 0 ; |
| 878 | else |
| 879 | { |
| 880 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToLCD ) ) |
| 881 | { |
| 882 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 883 | ARdata = 0 ; |
| 884 | } |
| 885 | } |
| 886 | } |
| 887 | } |
| 888 | |
| 889 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ |
| 890 | XGINew_SetReg3( pVBInfo->P3c0 , i ) ; /* set index */ |
| 891 | XGINew_SetReg3( pVBInfo->P3c0 , ARdata ) ; /* set data */ |
| 892 | } |
| 893 | |
| 894 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ |
| 895 | XGINew_SetReg3( pVBInfo->P3c0 , 0x14 ) ; /* set index */ |
| 896 | XGINew_SetReg3( pVBInfo->P3c0 , 0x00 ) ; /* set data */ |
| 897 | XGINew_GetReg2( pVBInfo->P3da ) ; /* Enable Attribute */ |
| 898 | XGINew_SetReg3( pVBInfo->P3c0 , 0x20 ) ; |
| 899 | } |
| 900 | |
| 901 | |
| 902 | /* --------------------------------------------------------------------- */ |
| 903 | /* Function : XGI_SetGRCRegs */ |
| 904 | /* Input : */ |
| 905 | /* Output : */ |
| 906 | /* Description : */ |
| 907 | /* --------------------------------------------------------------------- */ |
| 908 | void XGI_SetGRCRegs( USHORT StandTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 909 | { |
| 910 | UCHAR GRdata ; |
| 911 | USHORT i ; |
| 912 | |
| 913 | for( i = 0 ; i <= 0x08 ; i++ ) |
| 914 | { |
| 915 | GRdata = pVBInfo->StandTable[ StandTableIndex ].GRC[ i ] ; /* Get GR from file */ |
| 916 | XGINew_SetReg1( pVBInfo->P3ce , i , GRdata ) ; /* Set GR(3ce) */ |
| 917 | } |
| 918 | |
| 919 | if ( pVBInfo->ModeType > ModeVGA ) |
| 920 | { |
| 921 | GRdata = ( UCHAR )XGINew_GetReg1( pVBInfo->P3ce , 0x05 ) ; |
| 922 | GRdata &= 0xBF ; /* 256 color disable */ |
| 923 | XGINew_SetReg1( pVBInfo->P3ce , 0x05 , GRdata ) ; |
| 924 | } |
| 925 | } |
| 926 | |
| 927 | |
| 928 | /* --------------------------------------------------------------------- */ |
| 929 | /* Function : XGI_ClearExt1Regs */ |
| 930 | /* Input : */ |
| 931 | /* Output : */ |
| 932 | /* Description : */ |
| 933 | /* --------------------------------------------------------------------- */ |
| 934 | void XGI_ClearExt1Regs(PVB_DEVICE_INFO pVBInfo) |
| 935 | { |
| 936 | USHORT i ; |
| 937 | |
| 938 | for( i = 0x0A ; i <= 0x0E ; i++ ) |
| 939 | XGINew_SetReg1( pVBInfo->P3c4 , i , 0x00 ) ; /* Clear SR0A-SR0E */ |
| 940 | } |
| 941 | |
| 942 | |
| 943 | /* --------------------------------------------------------------------- */ |
| 944 | /* Function : XGI_SetDefaultVCLK */ |
| 945 | /* Input : */ |
| 946 | /* Output : */ |
| 947 | /* Description : */ |
| 948 | /* --------------------------------------------------------------------- */ |
| 949 | UCHAR XGI_SetDefaultVCLK( PVB_DEVICE_INFO pVBInfo ) |
| 950 | { |
| 951 | |
| 952 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x31 , ~0x30 , 0x20 ) ; |
| 953 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->VCLKData[ 0 ].SR2B ) ; |
| 954 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ 0 ].SR2C ) ; |
| 955 | |
| 956 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x31 , ~0x30 , 0x10 ) ; |
| 957 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->VCLKData[ 1 ].SR2B ) ; |
| 958 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ 1 ].SR2C ) ; |
| 959 | |
| 960 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x31 , ~0x30 ) ; |
| 961 | return( 0 ) ; |
| 962 | } |
| 963 | |
| 964 | |
| 965 | /* --------------------------------------------------------------------- */ |
| 966 | /* Function : XGI_GetRatePtrCRT2 */ |
| 967 | /* Input : */ |
| 968 | /* Output : */ |
| 969 | /* Description : */ |
| 970 | /* --------------------------------------------------------------------- */ |
| 971 | USHORT XGI_GetRatePtrCRT2( PXGI_HW_DEVICE_INFO pXGIHWDE, USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 972 | { |
| 973 | SHORT LCDRefreshIndex[] = { 0x00 , 0x00 , 0x03 , 0x01 } , |
| 974 | LCDARefreshIndex[] = { 0x00 , 0x00 , 0x03 , 0x01 , 0x01 , 0x01 , 0x01 } ; |
| 975 | |
| 976 | USHORT RefreshRateTableIndex , i , |
| 977 | modeflag , index , temp ; |
| 978 | |
| 979 | if ( ModeNo <= 0x13 ) |
| 980 | { |
| 981 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 982 | } |
| 983 | else |
| 984 | { |
| 985 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 986 | } |
| 987 | |
| 988 | if ( pVBInfo->IF_DEF_CH7005 == 1 ) |
| 989 | { |
| 990 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 991 | { |
| 992 | if ( modeflag & HalfDCLK ) |
| 993 | return( 0 ) ; |
| 994 | } |
| 995 | } |
| 996 | |
| 997 | if ( ModeNo < 0x14 ) |
| 998 | return( 0xFFFF ) ; |
| 999 | |
| 1000 | index = XGINew_GetReg1( pVBInfo->P3d4 , 0x33 ) ; |
| 1001 | index = index >> pVBInfo->SelectCRT2Rate ; |
| 1002 | index &= 0x0F ; |
| 1003 | |
| 1004 | if ( pVBInfo->LCDInfo & LCDNonExpanding ) |
| 1005 | index = 0 ; |
| 1006 | |
| 1007 | if ( index > 0 ) |
| 1008 | index-- ; |
| 1009 | |
| 1010 | if ( pVBInfo->SetFlag & ProgrammingCRT2 ) |
| 1011 | { |
| 1012 | if ( pVBInfo->IF_DEF_CH7005 == 1 ) |
| 1013 | { |
| 1014 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 1015 | { |
| 1016 | index = 0 ; |
| 1017 | } |
| 1018 | } |
| 1019 | |
| 1020 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 1021 | { |
| 1022 | if( pVBInfo->IF_DEF_LVDS == 0 ) |
| 1023 | { |
| 1024 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 1025 | temp = LCDARefreshIndex[ pVBInfo->LCDResInfo & 0x0F ] ; /* 301b */ |
| 1026 | else |
| 1027 | temp = LCDRefreshIndex[ pVBInfo->LCDResInfo & 0x0F ] ; |
| 1028 | |
| 1029 | if ( index > temp ) |
| 1030 | { |
| 1031 | index = temp ; |
| 1032 | } |
| 1033 | } |
| 1034 | else |
| 1035 | { |
| 1036 | index = 0 ; |
| 1037 | } |
| 1038 | } |
| 1039 | } |
| 1040 | |
| 1041 | RefreshRateTableIndex = pVBInfo->EModeIDTable[ ModeIdIndex ].REFindex ; |
| 1042 | ModeNo = pVBInfo->RefIndex[ RefreshRateTableIndex ].ModeID ; |
| 1043 | if ( pXGIHWDE->jChipType >= XG20 ) /* for XG20, XG21, XG27 */ |
| 1044 | { |
| 1045 | /* |
| 1046 | if ( pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag & XG2xNotSupport ) |
| 1047 | { |
| 1048 | index++; |
| 1049 | } |
| 1050 | */ |
| 1051 | if ( ( pVBInfo->RefIndex[ RefreshRateTableIndex ].XRes == 800 ) && |
| 1052 | ( pVBInfo->RefIndex[ RefreshRateTableIndex ].YRes == 600 ) ) |
| 1053 | { |
| 1054 | index++; |
| 1055 | } |
| 1056 | /* Alan 10/19/2007; do the similiar adjustment like XGISearchCRT1Rate() */ |
| 1057 | if ( ( pVBInfo->RefIndex[ RefreshRateTableIndex ].XRes == 1024 ) && |
| 1058 | ( pVBInfo->RefIndex[ RefreshRateTableIndex ].YRes == 768 ) ) |
| 1059 | { |
| 1060 | index++; |
| 1061 | } |
| 1062 | if ( ( pVBInfo->RefIndex[ RefreshRateTableIndex ].XRes == 1280 ) && |
| 1063 | ( pVBInfo->RefIndex[ RefreshRateTableIndex ].YRes == 1024 ) ) |
| 1064 | { |
| 1065 | index++; |
| 1066 | } |
| 1067 | } |
| 1068 | |
| 1069 | i = 0 ; |
| 1070 | do |
| 1071 | { |
| 1072 | if ( pVBInfo->RefIndex[ RefreshRateTableIndex + i ].ModeID != ModeNo ) |
| 1073 | break ; |
| 1074 | temp = pVBInfo->RefIndex[ RefreshRateTableIndex + i ].Ext_InfoFlag ; |
| 1075 | temp &= ModeInfoFlag ; |
| 1076 | if ( temp < pVBInfo->ModeType ) |
| 1077 | break ; |
| 1078 | i++ ; |
| 1079 | index-- ; |
| 1080 | |
| 1081 | } while( index != 0xFFFF ) ; |
| 1082 | if ( !( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) ) |
| 1083 | { |
| 1084 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 1085 | { |
| 1086 | temp = pVBInfo->RefIndex[ RefreshRateTableIndex + i - 1 ].Ext_InfoFlag ; |
| 1087 | if ( temp & InterlaceMode ) |
| 1088 | { |
| 1089 | i++ ; |
| 1090 | } |
| 1091 | } |
| 1092 | } |
| 1093 | i-- ; |
| 1094 | if ( ( pVBInfo->SetFlag & ProgrammingCRT2 ) ) |
| 1095 | { |
| 1096 | temp = XGI_AjustCRT2Rate( ModeNo , ModeIdIndex , RefreshRateTableIndex , &i, pVBInfo) ; |
| 1097 | } |
| 1098 | return( RefreshRateTableIndex + i ) ; /*return(0x01|(temp1<<1)); */ |
| 1099 | } |
| 1100 | |
| 1101 | |
| 1102 | /* --------------------------------------------------------------------- */ |
| 1103 | /* Function : XGI_AjustCRT2Rate */ |
| 1104 | /* Input : */ |
| 1105 | /* Output : */ |
| 1106 | /* Description : */ |
| 1107 | /* --------------------------------------------------------------------- */ |
| 1108 | BOOLEAN XGI_AjustCRT2Rate( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex , USHORT *i, PVB_DEVICE_INFO pVBInfo ) |
| 1109 | { |
| 1110 | USHORT tempax , |
| 1111 | tempbx , |
| 1112 | resinfo , |
| 1113 | modeflag , |
| 1114 | infoflag ; |
| 1115 | |
| 1116 | if ( ModeNo <= 0x13 ) |
| 1117 | { |
| 1118 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ModeFlag */ |
| 1119 | } |
| 1120 | else |
| 1121 | { |
| 1122 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 1123 | } |
| 1124 | |
| 1125 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 1126 | tempbx = pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].ModeID ; |
| 1127 | tempax = 0 ; |
| 1128 | |
| 1129 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 1130 | { |
| 1131 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) |
| 1132 | { |
| 1133 | tempax |= SupportRAMDAC2 ; |
| 1134 | |
| 1135 | if ( pVBInfo->VBType & VB_XGI301C ) |
| 1136 | tempax |= SupportCRT2in301C ; |
| 1137 | } |
| 1138 | |
| 1139 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) /* 301b */ |
| 1140 | { |
| 1141 | tempax |= SupportLCD ; |
| 1142 | |
| 1143 | if ( pVBInfo->LCDResInfo != Panel1280x1024 ) |
| 1144 | { |
| 1145 | if ( pVBInfo->LCDResInfo != Panel1280x960 ) |
| 1146 | { |
| 1147 | if ( pVBInfo->LCDInfo & LCDNonExpanding ) |
| 1148 | { |
| 1149 | if ( resinfo >= 9 ) |
| 1150 | { |
| 1151 | tempax = 0 ; |
| 1152 | return( 0 ) ; |
| 1153 | } |
| 1154 | } |
| 1155 | } |
| 1156 | } |
| 1157 | } |
| 1158 | |
| 1159 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) /* for HiTV */ |
| 1160 | { |
| 1161 | if ( ( pVBInfo->VBType & VB_XGI301LV ) && ( pVBInfo->VBExtInfo == VB_YPbPr1080i ) ) |
| 1162 | { |
| 1163 | tempax |= SupportYPbPr ; |
| 1164 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 1165 | { |
| 1166 | if ( resinfo == 4 ) |
| 1167 | return( 0 ) ; |
| 1168 | |
| 1169 | if ( resinfo == 3 ) |
| 1170 | return( 0 ) ; |
| 1171 | |
| 1172 | if ( resinfo > 7 ) |
| 1173 | return( 0 ) ; |
| 1174 | } |
| 1175 | } |
| 1176 | else |
| 1177 | { |
| 1178 | tempax |= SupportHiVisionTV ; |
| 1179 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 1180 | { |
| 1181 | if ( resinfo == 4 ) |
| 1182 | return( 0 ) ; |
| 1183 | |
| 1184 | if ( resinfo == 3 ) |
| 1185 | { |
| 1186 | if ( pVBInfo->SetFlag & TVSimuMode ) |
| 1187 | return( 0 ) ; |
| 1188 | } |
| 1189 | |
| 1190 | if ( resinfo > 7 ) |
| 1191 | return( 0 ) ; |
| 1192 | } |
| 1193 | } |
| 1194 | } |
| 1195 | else |
| 1196 | { |
| 1197 | if ( pVBInfo->VBInfo & ( SetCRT2ToAVIDEO | SetCRT2ToSVIDEO | SetCRT2ToSCART | SetCRT2ToYPbPr | SetCRT2ToHiVisionTV ) ) |
| 1198 | { |
| 1199 | tempax |= SupportTV ; |
| 1200 | |
| 1201 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 1202 | { |
| 1203 | tempax |= SupportTV1024 ; |
| 1204 | } |
| 1205 | |
| 1206 | if ( !( pVBInfo->VBInfo & SetPALTV ) ) |
| 1207 | { |
| 1208 | if ( modeflag & NoSupportSimuTV ) |
| 1209 | { |
| 1210 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 1211 | { |
| 1212 | if ( !( pVBInfo->VBInfo & SetNotSimuMode ) ) |
| 1213 | { |
| 1214 | return( 0 ) ; |
| 1215 | } |
| 1216 | } |
| 1217 | } |
| 1218 | } |
| 1219 | } |
| 1220 | } |
| 1221 | } |
| 1222 | else /* for LVDS */ |
| 1223 | { |
| 1224 | if ( pVBInfo->IF_DEF_CH7005 == 1 ) |
| 1225 | { |
| 1226 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 1227 | { |
| 1228 | tempax |= SupportCHTV ; |
| 1229 | } |
| 1230 | } |
| 1231 | |
| 1232 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) |
| 1233 | { |
| 1234 | tempax |= SupportLCD ; |
| 1235 | |
| 1236 | if ( resinfo > 0x08 ) |
| 1237 | return( 0 ) ; /* 1024x768 */ |
| 1238 | |
| 1239 | if ( pVBInfo->LCDResInfo < Panel1024x768 ) |
| 1240 | { |
| 1241 | if ( resinfo > 0x07 ) |
| 1242 | return( 0 ) ; /* 800x600 */ |
| 1243 | |
| 1244 | if ( resinfo == 0x04 ) |
| 1245 | return( 0 ) ; /* 512x384 */ |
| 1246 | } |
| 1247 | } |
| 1248 | } |
| 1249 | |
| 1250 | for( ; pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].ModeID == tempbx ; ( *i )-- ) |
| 1251 | { |
| 1252 | infoflag = pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].Ext_InfoFlag ; |
| 1253 | if ( infoflag & tempax ) |
| 1254 | { |
| 1255 | return( 1 ) ; |
| 1256 | } |
| 1257 | if ( ( *i ) == 0 ) |
| 1258 | break ; |
| 1259 | } |
| 1260 | |
| 1261 | for( ( *i ) = 0 ; ; ( *i )++ ) |
| 1262 | { |
| 1263 | infoflag = pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].Ext_InfoFlag ; |
| 1264 | if ( pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].ModeID != tempbx ) |
| 1265 | { |
| 1266 | return( 0 ) ; |
| 1267 | } |
| 1268 | |
| 1269 | if ( infoflag & tempax ) |
| 1270 | { |
| 1271 | return( 1 ) ; |
| 1272 | } |
| 1273 | } |
| 1274 | return( 1 ) ; |
| 1275 | } |
| 1276 | |
| 1277 | |
| 1278 | /* --------------------------------------------------------------------- */ |
| 1279 | /* Function : XGI_SetSync */ |
| 1280 | /* Input : */ |
| 1281 | /* Output : */ |
| 1282 | /* Description : */ |
| 1283 | /* --------------------------------------------------------------------- */ |
| 1284 | void XGI_SetSync(USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 1285 | { |
| 1286 | USHORT sync , |
| 1287 | temp ; |
| 1288 | |
| 1289 | sync = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag >> 8 ; /* di+0x00 */ |
| 1290 | sync &= 0xC0 ; |
| 1291 | temp = 0x2F ; |
| 1292 | temp |= sync ; |
| 1293 | XGINew_SetReg3( pVBInfo->P3c2 , temp ) ; /* Set Misc(3c2) */ |
| 1294 | } |
| 1295 | |
| 1296 | |
| 1297 | /* --------------------------------------------------------------------- */ |
| 1298 | /* Function : XGI_SetCRT1CRTC */ |
| 1299 | /* Input : */ |
| 1300 | /* Output : */ |
| 1301 | /* Description : */ |
| 1302 | /* --------------------------------------------------------------------- */ |
| 1303 | void XGI_SetCRT1CRTC( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo, PXGI_HW_DEVICE_INFO HwDeviceExtension ) |
| 1304 | { |
| 1305 | UCHAR index , |
| 1306 | data ; |
| 1307 | |
| 1308 | USHORT i ; |
| 1309 | |
| 1310 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; /* Get index */ |
| 1311 | index = index&IndexMask ; |
| 1312 | |
| 1313 | data =( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x11 ) ; |
| 1314 | data &= 0x7F ; |
| 1315 | XGINew_SetReg1(pVBInfo->P3d4,0x11,data); /* Unlock CRTC */ |
| 1316 | |
| 1317 | for( i = 0 ; i < 8 ; i++ ) |
| 1318 | pVBInfo->TimingH[ 0 ].data[ i ] = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ i ] ; |
| 1319 | |
| 1320 | for( i = 0 ; i < 7 ; i++ ) |
| 1321 | pVBInfo->TimingV[ 0 ].data[ i ] = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ i + 8 ] ; |
| 1322 | |
| 1323 | XGI_SetCRT1Timing_H( pVBInfo, HwDeviceExtension ) ; |
| 1324 | |
| 1325 | |
| 1326 | |
| 1327 | XGI_SetCRT1Timing_V( ModeIdIndex , ModeNo, pVBInfo ) ; |
| 1328 | |
| 1329 | |
| 1330 | if( pVBInfo->ModeType > 0x03 ) |
| 1331 | XGINew_SetReg1( pVBInfo->P3d4 , 0x14 , 0x4F ) ; |
| 1332 | } |
| 1333 | |
| 1334 | |
| 1335 | /* --------------------------------------------------------------------- */ |
| 1336 | /* Function : XGI_SetCRT1Timing_H */ |
| 1337 | /* Input : */ |
| 1338 | /* Output : */ |
| 1339 | /* Description : */ |
| 1340 | /* --------------------------------------------------------------------- */ |
| 1341 | void XGI_SetCRT1Timing_H( PVB_DEVICE_INFO pVBInfo, PXGI_HW_DEVICE_INFO HwDeviceExtension ) |
| 1342 | { |
| 1343 | UCHAR data , data1, pushax; |
| 1344 | USHORT i , j ; |
| 1345 | |
| 1346 | /* XGINew_SetReg1( pVBInfo->P3d4 , 0x51 , 0 ) ; */ |
| 1347 | /* XGINew_SetReg1( pVBInfo->P3d4 , 0x56 , 0 ) ; */ |
| 1348 | /* XGINew_SetRegANDOR( pVBInfo->P3d4 ,0x11 , 0x7f , 0x00 ) ; */ |
| 1349 | |
| 1350 | data = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x11 ) ; /* unlock cr0-7 */ |
| 1351 | data &= 0x7F ; |
| 1352 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , data ) ; |
| 1353 | |
| 1354 | data = pVBInfo->TimingH[ 0 ].data[ 0 ] ; |
| 1355 | XGINew_SetReg1( pVBInfo->P3d4 , 0 , data ) ; |
| 1356 | |
| 1357 | for( i = 0x01 ; i <= 0x04 ; i++ ) |
| 1358 | { |
| 1359 | data = pVBInfo->TimingH[ 0 ].data[ i ] ; |
| 1360 | XGINew_SetReg1( pVBInfo->P3d4 , ( USHORT )( i + 1 ) , data ) ; |
| 1361 | } |
| 1362 | |
| 1363 | for( i = 0x05 ; i <= 0x06 ; i++ ) |
| 1364 | { |
| 1365 | data = pVBInfo->TimingH[ 0 ].data[ i ]; |
| 1366 | XGINew_SetReg1( pVBInfo->P3c4 ,( USHORT )( i + 6 ) , data ) ; |
| 1367 | } |
| 1368 | |
| 1369 | j = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x0e ) ; |
| 1370 | j &= 0x1F ; |
| 1371 | data = pVBInfo->TimingH[ 0 ].data[ 7 ] ; |
| 1372 | data &= 0xE0 ; |
| 1373 | data |= j ; |
| 1374 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0e , data ) ; |
| 1375 | |
| 1376 | if ( HwDeviceExtension->jChipType >= XG20 ) |
| 1377 | { |
| 1378 | data = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x04 ) ; |
| 1379 | data = data - 1 ; |
| 1380 | XGINew_SetReg1( pVBInfo->P3d4 , 0x04 , data ) ; |
| 1381 | data = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x05 ) ; |
| 1382 | data1 = data ; |
| 1383 | data1 &= 0xE0 ; |
| 1384 | data &= 0x1F ; |
| 1385 | if ( data == 0 ) |
| 1386 | { |
| 1387 | pushax = data ; |
| 1388 | data = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x0c ) ; |
| 1389 | data &= 0xFB ; |
| 1390 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0c , data ) ; |
| 1391 | data = pushax ; |
| 1392 | } |
| 1393 | data = data - 1 ; |
| 1394 | data |= data1 ; |
| 1395 | XGINew_SetReg1( pVBInfo->P3d4 , 0x05 , data ) ; |
| 1396 | data = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x0e ) ; |
| 1397 | data = data >> 5 ; |
| 1398 | data = data + 3 ; |
| 1399 | if ( data > 7 ) |
| 1400 | data = data - 7 ; |
| 1401 | data = data << 5 ; |
| 1402 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0e , ~0xE0 , data ) ; |
| 1403 | } |
| 1404 | } |
| 1405 | |
| 1406 | |
| 1407 | /* --------------------------------------------------------------------- */ |
| 1408 | /* Function : XGI_SetCRT1Timing_V */ |
| 1409 | /* Input : */ |
| 1410 | /* Output : */ |
| 1411 | /* Description : */ |
| 1412 | /* --------------------------------------------------------------------- */ |
| 1413 | void XGI_SetCRT1Timing_V( USHORT ModeIdIndex , USHORT ModeNo,PVB_DEVICE_INFO pVBInfo ) |
| 1414 | { |
| 1415 | UCHAR data ; |
| 1416 | USHORT i , j ; |
| 1417 | |
| 1418 | /* XGINew_SetReg1( pVBInfo->P3d4 , 0x51 , 0 ) ; */ |
| 1419 | /* XGINew_SetReg1( pVBInfo->P3d4 , 0x56 , 0 ) ; */ |
| 1420 | /* XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x11 , 0x7f , 0x00 ) ; */ |
| 1421 | |
| 1422 | for( i = 0x00 ; i <= 0x01 ; i++ ) |
| 1423 | { |
| 1424 | data = pVBInfo->TimingV[ 0 ].data[ i ] ; |
| 1425 | XGINew_SetReg1( pVBInfo->P3d4 , ( USHORT )( i + 6 ) , data ) ; |
| 1426 | } |
| 1427 | |
| 1428 | for( i = 0x02 ; i <= 0x03 ; i++ ) |
| 1429 | { |
| 1430 | data = pVBInfo->TimingV[ 0 ].data[ i ] ; |
| 1431 | XGINew_SetReg1( pVBInfo->P3d4 , ( USHORT )( i + 0x0e ) , data ) ; |
| 1432 | } |
| 1433 | |
| 1434 | for( i = 0x04 ; i <= 0x05 ; i++ ) |
| 1435 | { |
| 1436 | data = pVBInfo->TimingV[ 0 ].data[ i ] ; |
| 1437 | XGINew_SetReg1( pVBInfo->P3d4 , ( USHORT )( i + 0x11 ) , data ) ; |
| 1438 | } |
| 1439 | |
| 1440 | j = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x0a ) ; |
| 1441 | j &= 0xC0 ; |
| 1442 | data = pVBInfo->TimingV[ 0 ].data[ 6 ] ; |
| 1443 | data &= 0x3F ; |
| 1444 | data |= j ; |
| 1445 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0a , data ) ; |
| 1446 | |
| 1447 | data = pVBInfo->TimingV[ 0 ].data[ 6 ] ; |
| 1448 | data &= 0x80 ; |
| 1449 | data = data >> 2 ; |
| 1450 | |
| 1451 | if ( ModeNo <= 0x13 ) |
| 1452 | i = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 1453 | else |
| 1454 | i = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 1455 | |
| 1456 | i &= DoubleScanMode ; |
| 1457 | if ( i ) |
| 1458 | data |= 0x80 ; |
| 1459 | |
| 1460 | j = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x09 ) ; |
| 1461 | j &= 0x5F ; |
| 1462 | data |= j ; |
| 1463 | XGINew_SetReg1( pVBInfo->P3d4 , 0x09 , data ) ; |
| 1464 | } |
| 1465 | |
| 1466 | |
| 1467 | /* --------------------------------------------------------------------- */ |
| 1468 | /* Function : XGI_SetXG21CRTC */ |
| 1469 | /* Input : Stand or enhance CRTC table */ |
| 1470 | /* Output : Fill CRT Hsync/Vsync to SR2E/SR2F/SR30/SR33/SR34/SR3F */ |
| 1471 | /* Description : Set LCD timing */ |
| 1472 | /* --------------------------------------------------------------------- */ |
| 1473 | void XGI_SetXG21CRTC(USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo) |
| 1474 | { |
| 1475 | UCHAR StandTableIndex, index, Tempax, Tempbx, Tempcx, Tempdx ; |
| 1476 | USHORT Temp1, Temp2, Temp3 ; |
| 1477 | |
| 1478 | if ( ModeNo <= 0x13 ) |
| 1479 | { |
| 1480 | StandTableIndex = XGI_GetModePtr( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 1481 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 4 ] ; /* CR04 HRS */ |
| 1482 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , Tempax ) ; /* SR2E [7:0]->HRS */ |
| 1483 | Tempbx = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 5 ] ; /* Tempbx: CR05 HRE */ |
| 1484 | Tempbx &= 0x1F ; /* Tempbx: HRE[4:0] */ |
| 1485 | Tempcx = Tempax ; |
| 1486 | Tempcx &= 0xE0 ; /* Tempcx: HRS[7:5] */ |
| 1487 | Tempdx = Tempcx | Tempbx ; /* Tempdx(HRE): HRS[7:5]HRE[4:0] */ |
| 1488 | if ( Tempbx < ( Tempax & 0x1F ) ) /* IF HRE < HRS */ |
| 1489 | Tempdx |= 0x20 ; /* Tempdx: HRE = HRE + 0x20 */ |
| 1490 | Tempdx <<= 2 ; /* Tempdx << 2 */ |
| 1491 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , Tempdx ) ; /* SR2F [7:2]->HRE */ |
| 1492 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , 0xE3 , 00 ) ; |
| 1493 | |
| 1494 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 16 ] ; /* Tempax: CR16 VRS */ |
| 1495 | Tempbx = Tempax ; /* Tempbx=Tempax */ |
| 1496 | Tempax &= 0x01 ; /* Tempax: VRS[0] */ |
| 1497 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x33 , Tempax ) ; /* SR33[0]->VRS */ |
| 1498 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 7 ] ; /* Tempax: CR7 VRS */ |
| 1499 | Tempdx = Tempbx >> 1 ; /* Tempdx: VRS[7:1] */ |
| 1500 | Tempcx = Tempax & 0x04 ; /* Tempcx: CR7[2] */ |
| 1501 | Tempcx <<= 5 ; /* Tempcx[7]: VRS[8] */ |
| 1502 | Tempdx |= Tempcx ; /* Tempdx: VRS[8:1] */ |
| 1503 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , Tempdx ) ; /* SR34[7:0]: VRS[8:1] */ |
| 1504 | |
| 1505 | Temp1 = Tempcx << 1 ; /* Temp1[8]: VRS[8] UCHAR -> USHORT */ |
| 1506 | Temp1 |= Tempbx ; /* Temp1[8:0]: VRS[8:0] */ |
| 1507 | Tempax &= 0x80 ; /* Tempax[7]: CR7[7] */ |
| 1508 | Temp2 = Tempax << 2 ; /* Temp2[9]: VRS[9] */ |
| 1509 | Temp1 |= Temp2 ; /* Temp1[9:0]: VRS[9:0] */ |
| 1510 | |
| 1511 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 17 ] ; /* CR16 VRE */ |
| 1512 | Tempax &= 0x0F ; /* Tempax[3:0]: VRE[3:0] */ |
| 1513 | Temp2 = Temp1 & 0x3F0 ; /* Temp2[9:4]: VRS[9:4] */ |
| 1514 | Temp2 |= Tempax ; /* Temp2[9:0]: VRE[9:0] */ |
| 1515 | Temp3 = Temp1 & 0x0F ; /* Temp3[3:0]: VRS[3:0] */ |
| 1516 | if ( Tempax < Temp3 ) /* VRE[3:0]<VRS[3:0] */ |
| 1517 | Temp2 |= 0x10 ; /* Temp2: VRE + 0x10 */ |
| 1518 | Temp2 &= 0xFF ; /* Temp2[7:0]: VRE[7:0] */ |
| 1519 | Tempax = (UCHAR)Temp2 ; /* Tempax[7:0]: VRE[7:0] */ |
| 1520 | Tempax <<= 2 ; /* Tempax << 2: VRE[5:0] */ |
| 1521 | Temp1 &= 0x600 ; /* Temp1[10:9]: VRS[10:9] */ |
| 1522 | Temp1 >>= 9 ; /* [10:9]->[1:0] */ |
| 1523 | Tempbx = (UCHAR)Temp1 ; /* Tempbx[1:0]: VRS[10:9] */ |
| 1524 | Tempax |= Tempbx ; /* VRE[5:0]VRS[10:9] */ |
| 1525 | Tempax &= 0x7F ; |
| 1526 | XGINew_SetReg1( pVBInfo->P3c4 , 0x3F , Tempax ) ; /* SR3F D[7:2]->VRE D[1:0]->VRS */ |
| 1527 | } |
| 1528 | else |
| 1529 | { |
| 1530 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; |
| 1531 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 3 ] ; /* Tempax: CR4 HRS */ |
| 1532 | Tempcx = Tempax ; /* Tempcx: HRS */ |
| 1533 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , Tempax ) ; /* SR2E[7:0]->HRS */ |
| 1534 | |
| 1535 | Tempdx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 5 ] ; /* SRB */ |
| 1536 | Tempdx &= 0xC0 ; /* Tempdx[7:6]: SRB[7:6] */ |
| 1537 | Temp1 = Tempdx ; /* Temp1[7:6]: HRS[9:8] */ |
| 1538 | Temp1 <<= 2 ; /* Temp1[9:8]: HRS[9:8] */ |
| 1539 | Temp1 |= Tempax ; /* Temp1[9:0]: HRS[9:0] */ |
| 1540 | |
| 1541 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 4 ] ; /* CR5 HRE */ |
| 1542 | Tempax &= 0x1F ; /* Tempax[4:0]: HRE[4:0] */ |
| 1543 | |
| 1544 | Tempbx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 6 ] ; /* SRC */ |
| 1545 | Tempbx &= 0x04 ; /* Tempbx[2]: HRE[5] */ |
| 1546 | Tempbx <<= 3 ; /* Tempbx[5]: HRE[5] */ |
| 1547 | Tempax |= Tempbx ; /* Tempax[5:0]: HRE[5:0] */ |
| 1548 | |
| 1549 | Temp2 = Temp1 & 0x3C0 ; /* Temp2[9:6]: HRS[9:6] */ |
| 1550 | Temp2 |= Tempax ; /* Temp2[9:0]: HRE[9:0] */ |
| 1551 | |
| 1552 | Tempcx &= 0x3F ; /* Tempcx[5:0]: HRS[5:0] */ |
| 1553 | if( Tempax < Tempcx ) /* HRE < HRS */ |
| 1554 | Temp2 |= 0x40 ; /* Temp2 + 0x40 */ |
| 1555 | |
| 1556 | Temp2 &= 0xFF ; |
| 1557 | Tempax = (UCHAR)Temp2 ; /* Tempax: HRE[7:0] */ |
| 1558 | Tempax <<= 2 ; /* Tempax[7:2]: HRE[5:0] */ |
| 1559 | Tempdx >>= 6 ; /* Tempdx[7:6]->[1:0] HRS[9:8] */ |
| 1560 | Tempax |= Tempdx ; /* HRE[5:0]HRS[9:8] */ |
| 1561 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , Tempax ) ; /* SR2F D[7:2]->HRE, D[1:0]->HRS */ |
| 1562 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , 0xE3 , 00 ) ; |
| 1563 | |
| 1564 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 10 ] ; /* CR10 VRS */ |
| 1565 | Tempbx = Tempax ; /* Tempbx: VRS */ |
| 1566 | Tempax &= 0x01 ; /* Tempax[0]: VRS[0] */ |
| 1567 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x33 , Tempax ) ; /* SR33[0]->VRS[0] */ |
| 1568 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 9 ] ; /* CR7[2][7] VRE */ |
| 1569 | Tempcx = Tempbx >> 1 ; /* Tempcx[6:0]: VRS[7:1] */ |
| 1570 | Tempdx = Tempax & 0x04 ; /* Tempdx[2]: CR7[2] */ |
| 1571 | Tempdx <<= 5 ; /* Tempdx[7]: VRS[8] */ |
| 1572 | Tempcx |= Tempdx ; /* Tempcx[7:0]: VRS[8:1] */ |
| 1573 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , Tempcx ) ; /* SR34[8:1]->VRS */ |
| 1574 | |
| 1575 | Temp1 = Tempdx ; /* Temp1[7]: Tempdx[7] */ |
| 1576 | Temp1 <<= 1 ; /* Temp1[8]: VRS[8] */ |
| 1577 | Temp1 |= Tempbx ; /* Temp1[8:0]: VRS[8:0] */ |
| 1578 | Tempax &= 0x80 ; |
| 1579 | Temp2 = Tempax << 2 ; /* Temp2[9]: VRS[9] */ |
| 1580 | Temp1 |= Temp2 ; /* Temp1[9:0]: VRS[9:0] */ |
| 1581 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempax: SRA */ |
| 1582 | Tempax &= 0x08 ; /* Tempax[3]: VRS[3] */ |
| 1583 | Temp2 = Tempax ; |
| 1584 | Temp2 <<= 7 ; /* Temp2[10]: VRS[10] */ |
| 1585 | Temp1 |= Temp2 ; /* Temp1[10:0]: VRS[10:0] */ |
| 1586 | |
| 1587 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 11 ] ; /* Tempax: CR11 VRE */ |
| 1588 | Tempax &= 0x0F ; /* Tempax[3:0]: VRE[3:0] */ |
| 1589 | Tempbx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempbx: SRA */ |
| 1590 | Tempbx &= 0x20 ; /* Tempbx[5]: VRE[5] */ |
| 1591 | Tempbx >>= 1 ; /* Tempbx[4]: VRE[4] */ |
| 1592 | Tempax |= Tempbx ; /* Tempax[4:0]: VRE[4:0] */ |
| 1593 | Temp2 = Temp1 & 0x7E0 ; /* Temp2[10:5]: VRS[10:5] */ |
| 1594 | Temp2 |= Tempax ; /* Temp2[10:5]: VRE[10:5] */ |
| 1595 | |
| 1596 | Temp3 = Temp1 & 0x1F ; /* Temp3[4:0]: VRS[4:0] */ |
| 1597 | if ( Tempax < Temp3 ) /* VRE < VRS */ |
| 1598 | Temp2 |= 0x20 ; /* VRE + 0x20 */ |
| 1599 | |
| 1600 | Temp2 &= 0xFF ; |
| 1601 | Tempax = (UCHAR)Temp2 ; /* Tempax: VRE[7:0] */ |
| 1602 | Tempax <<= 2 ; /* Tempax[7:0]; VRE[5:0]00 */ |
| 1603 | Temp1 &= 0x600 ; /* Temp1[10:9]: VRS[10:9] */ |
| 1604 | Temp1 >>= 9 ; /* Temp1[1:0]: VRS[10:9] */ |
| 1605 | Tempbx = (UCHAR)Temp1 ; |
| 1606 | Tempax |= Tempbx ; /* Tempax[7:0]: VRE[5:0]VRS[10:9] */ |
| 1607 | Tempax &= 0x7F ; |
| 1608 | XGINew_SetReg1( pVBInfo->P3c4 , 0x3F , Tempax ) ; /* SR3F D[7:2]->VRE D[1:0]->VRS */ |
| 1609 | } |
| 1610 | } |
| 1611 | |
| 1612 | void XGI_SetXG27CRTC(USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo) |
| 1613 | { |
| 1614 | USHORT StandTableIndex, index, Tempax, Tempbx, Tempcx, Tempdx ; |
| 1615 | |
| 1616 | if ( ModeNo <= 0x13 ) |
| 1617 | { |
| 1618 | StandTableIndex = XGI_GetModePtr( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 1619 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 4 ] ; /* CR04 HRS */ |
| 1620 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , Tempax ) ; /* SR2E [7:0]->HRS */ |
| 1621 | Tempbx = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 5 ] ; /* Tempbx: CR05 HRE */ |
| 1622 | Tempbx &= 0x1F ; /* Tempbx: HRE[4:0] */ |
| 1623 | Tempcx = Tempax ; |
| 1624 | Tempcx &= 0xE0 ; /* Tempcx: HRS[7:5] */ |
| 1625 | Tempdx = Tempcx | Tempbx ; /* Tempdx(HRE): HRS[7:5]HRE[4:0] */ |
| 1626 | if ( Tempbx < ( Tempax & 0x1F ) ) /* IF HRE < HRS */ |
| 1627 | Tempdx |= 0x20 ; /* Tempdx: HRE = HRE + 0x20 */ |
| 1628 | Tempdx <<= 2 ; /* Tempdx << 2 */ |
| 1629 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , Tempdx ) ; /* SR2F [7:2]->HRE */ |
| 1630 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , 0xE3 , 00 ) ; |
| 1631 | |
| 1632 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 16 ] ; /* Tempax: CR10 VRS */ |
| 1633 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , Tempax ) ; /* SR34[7:0]->VRS */ |
| 1634 | Tempcx = Tempax ; /* Tempcx=Tempax=VRS[7:0] */ |
| 1635 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 7 ] ; /* Tempax[7][2]: CR7[7][2] VRS[9][8] */ |
| 1636 | Tempbx = Tempax ; /* Tempbx=CR07 */ |
| 1637 | Tempax &= 0x04 ; /* Tempax[2]: CR07[2] VRS[8] */ |
| 1638 | Tempax >>= 2; |
| 1639 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x01, Tempax ) ; /* SR35 D[0]->VRS D[8] */ |
| 1640 | Tempcx |= (Tempax << 8) ; /* Tempcx[8] |= VRS[8] */ |
| 1641 | Tempcx |= (Tempbx & 0x80)<<2; /* Tempcx[9] |= VRS[9] */ |
| 1642 | |
| 1643 | |
| 1644 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 17 ] ; /* CR11 VRE */ |
| 1645 | Tempax &= 0x0F ; /* Tempax: VRE[3:0] */ |
| 1646 | Tempbx = Tempcx ; /* Tempbx=Tempcx=VRS[9:0] */ |
| 1647 | Tempbx &= 0x3F0 ; /* Tempbx[9:4]: VRS[9:4] */ |
| 1648 | Tempbx |= Tempax ; /* Tempbx[9:0]: VRE[9:0] */ |
| 1649 | if ( Tempax <= (Tempcx & 0x0F) ) /* VRE[3:0]<=VRS[3:0] */ |
| 1650 | Tempbx |= 0x10 ; /* Tempbx: VRE + 0x10 */ |
| 1651 | Tempax = (UCHAR)Tempbx & 0xFF; /* Tempax[7:0]: VRE[7:0] */ |
| 1652 | Tempax <<= 2 ; /* Tempax << 2: VRE[5:0] */ |
| 1653 | Tempcx = (Tempcx&0x600)>>8; /* Tempcx VRS[10:9] */ |
| 1654 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x3F , ~0xFC, Tempax ) ; /* SR3F D[7:2]->VRE D[5:0] */ |
| 1655 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x06, Tempcx ) ; /* SR35 D[2:1]->VRS[10:9] */ |
| 1656 | } |
| 1657 | else |
| 1658 | { |
| 1659 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; |
| 1660 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 3 ] ; /* Tempax: CR4 HRS */ |
| 1661 | Tempbx = Tempax ; /* Tempbx: HRS[7:0] */ |
| 1662 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , Tempax ) ; /* SR2E[7:0]->HRS */ |
| 1663 | |
| 1664 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 5 ] ; /* SR0B */ |
| 1665 | Tempax &= 0xC0 ; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/ |
| 1666 | Tempbx |= (Tempax << 2); /* Tempbx: HRS[9:0] */ |
| 1667 | |
| 1668 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 4 ] ; /* CR5 HRE */ |
| 1669 | Tempax &= 0x1F ; /* Tempax[4:0]: HRE[4:0] */ |
| 1670 | Tempcx = Tempax ; /* Tempcx: HRE[4:0] */ |
| 1671 | |
| 1672 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 6 ] ; /* SRC */ |
| 1673 | Tempax &= 0x04 ; /* Tempax[2]: HRE[5] */ |
| 1674 | Tempax <<= 3 ; /* Tempax[5]: HRE[5] */ |
| 1675 | Tempcx |= Tempax ; /* Tempcx[5:0]: HRE[5:0] */ |
| 1676 | |
| 1677 | Tempbx = Tempbx & 0x3C0 ; /* Tempbx[9:6]: HRS[9:6] */ |
| 1678 | Tempbx |= Tempcx ; /* Tempbx: HRS[9:6]HRE[5:0] */ |
| 1679 | |
| 1680 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 3 ] ; /* Tempax: CR4 HRS */ |
| 1681 | Tempax &= 0x3F ; /* Tempax: HRS[5:0] */ |
| 1682 | if( Tempcx <= Tempax ) /* HRE[5:0] < HRS[5:0] */ |
| 1683 | Tempbx += 0x40 ; /* Tempbx= Tempbx + 0x40 : HRE[9:0]*/ |
| 1684 | |
| 1685 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 5 ] ; /* SR0B */ |
| 1686 | Tempax &= 0xC0 ; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/ |
| 1687 | Tempax >>= 6; /* Tempax[1:0]: HRS[9:8]*/ |
| 1688 | Tempax |= ((Tempbx << 2) & 0xFF); /* Tempax[7:2]: HRE[5:0] */ |
| 1689 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , Tempax ) ; /* SR2F [7:2][1:0]: HRE[5:0]HRS[9:8] */ |
| 1690 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , 0xE3 , 00 ) ; |
| 1691 | |
| 1692 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 10 ] ; /* CR10 VRS */ |
| 1693 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , Tempax ) ; /* SR34[7:0]->VRS[7:0] */ |
| 1694 | |
| 1695 | Tempcx = Tempax ; /* Tempcx <= VRS[7:0] */ |
| 1696 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 9 ] ; /* CR7[7][2] VRS[9][8] */ |
| 1697 | Tempbx = Tempax ; /* Tempbx <= CR07[7:0] */ |
| 1698 | Tempax = Tempax & 0x04 ; /* Tempax[2]: CR7[2]: VRS[8] */ |
| 1699 | Tempax >>= 2 ; /* Tempax[0]: VRS[8] */ |
| 1700 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x01 , Tempax ) ; /* SR35[0]: VRS[8] */ |
| 1701 | Tempcx |= (Tempax<<8) ; /* Tempcx <= VRS[8:0] */ |
| 1702 | Tempcx |= ((Tempbx&0x80)<<2) ; /* Tempcx <= VRS[9:0] */ |
| 1703 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempax: SR0A */ |
| 1704 | Tempax &= 0x08; /* SR0A[3] VRS[10] */ |
| 1705 | Tempcx |= (Tempax<<7) ; /* Tempcx <= VRS[10:0] */ |
| 1706 | |
| 1707 | |
| 1708 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 11 ] ; /* Tempax: CR11 VRE */ |
| 1709 | Tempax &= 0x0F ; /* Tempax[3:0]: VRE[3:0] */ |
| 1710 | Tempbx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempbx: SR0A */ |
| 1711 | Tempbx &= 0x20 ; /* Tempbx[5]: SR0A[5]: VRE[4] */ |
| 1712 | Tempbx >>= 1 ; /* Tempbx[4]: VRE[4] */ |
| 1713 | Tempax |= Tempbx ; /* Tempax[4:0]: VRE[4:0] */ |
| 1714 | Tempbx = Tempcx ; /* Tempbx: VRS[10:0] */ |
| 1715 | Tempbx &= 0x7E0 ; /* Tempbx[10:5]: VRS[10:5] */ |
| 1716 | Tempbx |= Tempax ; /* Tempbx: VRS[10:5]VRE[4:0] */ |
| 1717 | |
| 1718 | if ( Tempbx <= Tempcx ) /* VRE <= VRS */ |
| 1719 | Tempbx |= 0x20 ; /* VRE + 0x20 */ |
| 1720 | |
| 1721 | Tempax = (Tempbx<<2) & 0xFF ; /* Tempax: Tempax[7:0]; VRE[5:0]00 */ |
| 1722 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x3F , ~0xFC , Tempax ) ; /* SR3F[7:2]:VRE[5:0] */ |
| 1723 | Tempax = Tempcx >> 8; |
| 1724 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x07 , Tempax ) ; /* SR35[2:0]:VRS[10:8] */ |
| 1725 | } |
| 1726 | } |
| 1727 | |
| 1728 | |
| 1729 | /* --------------------------------------------------------------------- */ |
| 1730 | /* Function : XGI_SetXG21LCD */ |
| 1731 | /* Input : */ |
| 1732 | /* Output : FCLK duty cycle, FCLK delay compensation */ |
| 1733 | /* Description : All values set zero */ |
| 1734 | /* --------------------------------------------------------------------- */ |
| 1735 | void XGI_SetXG21LCD(PVB_DEVICE_INFO pVBInfo,USHORT RefreshRateTableIndex,USHORT ModeNo) |
| 1736 | { |
| 1737 | USHORT Data , Temp , b3CC ; |
| 1738 | USHORT XGI_P3cc ; |
| 1739 | |
| 1740 | XGI_P3cc = pVBInfo->P3cc ; |
| 1741 | |
| 1742 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2E , 0x00 ) ; |
| 1743 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2F , 0x00 ) ; |
| 1744 | XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , 0x00 ) ; |
| 1745 | XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , 0x00 ) ; |
| 1746 | if ( ((*pVBInfo->pDVOSetting)&0xC0) == 0xC0 ) |
| 1747 | { |
| 1748 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2E , *pVBInfo->pCR2E ) ; |
| 1749 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2F , *pVBInfo->pCR2F ) ; |
| 1750 | XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , *pVBInfo->pCR46 ) ; |
| 1751 | XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , *pVBInfo->pCR47 ) ; |
| 1752 | } |
| 1753 | |
| 1754 | Temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; |
| 1755 | |
| 1756 | if ( Temp & 0x01 ) |
| 1757 | { |
| 1758 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x06 , 0x40 ) ; /* 18 bits FP */ |
| 1759 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x09 , 0x40 ) ; |
| 1760 | } |
| 1761 | |
| 1762 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x1E , 0x01 ) ; /* Negative blank polarity */ |
| 1763 | |
| 1764 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x30 , ~0x20 ) ; |
| 1765 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x35 , ~0x80 ) ; |
| 1766 | |
| 1767 | if ( ModeNo <= 0x13 ) |
| 1768 | { |
| 1769 | b3CC = (UCHAR) XGINew_GetReg2( XGI_P3cc ) ; |
| 1770 | if ( b3CC & 0x40 ) |
| 1771 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */ |
| 1772 | if ( b3CC & 0x80 ) |
| 1773 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */ |
| 1774 | } |
| 1775 | else |
| 1776 | { |
| 1777 | Data = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; |
| 1778 | if ( Data & 0x4000 ) |
| 1779 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */ |
| 1780 | if ( Data & 0x8000 ) |
| 1781 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */ |
| 1782 | } |
| 1783 | } |
| 1784 | |
| 1785 | void XGI_SetXG27LCD(PVB_DEVICE_INFO pVBInfo,USHORT RefreshRateTableIndex,USHORT ModeNo) |
| 1786 | { |
| 1787 | USHORT Data , Temp , b3CC ; |
| 1788 | USHORT XGI_P3cc ; |
| 1789 | |
| 1790 | XGI_P3cc = pVBInfo->P3cc ; |
| 1791 | |
| 1792 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2E , 0x00 ) ; |
| 1793 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2F , 0x00 ) ; |
| 1794 | XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , 0x00 ) ; |
| 1795 | XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , 0x00 ) ; |
| 1796 | |
| 1797 | Temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; |
| 1798 | if ( ( Temp & 0x03 ) == 0 ) /* dual 12 */ |
| 1799 | { |
| 1800 | XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , 0x13 ) ; |
| 1801 | XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , 0x13 ) ; |
| 1802 | } |
| 1803 | |
| 1804 | if ( ((*pVBInfo->pDVOSetting)&0xC0) == 0xC0 ) |
| 1805 | { |
| 1806 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2E , *pVBInfo->pCR2E ) ; |
| 1807 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2F , *pVBInfo->pCR2F ) ; |
| 1808 | XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , *pVBInfo->pCR46 ) ; |
| 1809 | XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , *pVBInfo->pCR47 ) ; |
| 1810 | } |
| 1811 | |
| 1812 | XGI_SetXG27FPBits(pVBInfo); |
| 1813 | |
| 1814 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x1E , 0x01 ) ; /* Negative blank polarity */ |
| 1815 | |
| 1816 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x30 , ~0x20 ) ; /* Hsync polarity */ |
| 1817 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x35 , ~0x80 ) ; /* Vsync polarity */ |
| 1818 | |
| 1819 | if ( ModeNo <= 0x13 ) |
| 1820 | { |
| 1821 | b3CC = (UCHAR) XGINew_GetReg2( XGI_P3cc ) ; |
| 1822 | if ( b3CC & 0x40 ) |
| 1823 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */ |
| 1824 | if ( b3CC & 0x80 ) |
| 1825 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */ |
| 1826 | } |
| 1827 | else |
| 1828 | { |
| 1829 | Data = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; |
| 1830 | if ( Data & 0x4000 ) |
| 1831 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */ |
| 1832 | if ( Data & 0x8000 ) |
| 1833 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */ |
| 1834 | } |
| 1835 | } |
| 1836 | |
| 1837 | /* --------------------------------------------------------------------- */ |
| 1838 | /* Function : XGI_UpdateXG21CRTC */ |
| 1839 | /* Input : */ |
| 1840 | /* Output : CRT1 CRTC */ |
| 1841 | /* Description : Modify CRT1 Hsync/Vsync to fix LCD mode timing */ |
| 1842 | /* --------------------------------------------------------------------- */ |
| 1843 | void XGI_UpdateXG21CRTC( USHORT ModeNo , PVB_DEVICE_INFO pVBInfo , USHORT RefreshRateTableIndex ) |
| 1844 | { |
| 1845 | int i , index = -1; |
| 1846 | |
| 1847 | XGINew_SetRegAND( pVBInfo->P3d4 , 0x11 , 0x7F ) ; /* Unlock CR0~7 */ |
| 1848 | if ( ModeNo <= 0x13 ) |
| 1849 | { |
| 1850 | for( i = 0 ; i < 12 ; i++ ) |
| 1851 | { |
| 1852 | if ( ModeNo == pVBInfo->UpdateCRT1[ i ].ModeID ) |
| 1853 | index = i ; |
| 1854 | } |
| 1855 | } |
| 1856 | else |
| 1857 | { |
| 1858 | if ( ModeNo == 0x2E && ( pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC == RES640x480x60 ) ) |
| 1859 | index = 12 ; |
| 1860 | else if ( ModeNo == 0x2E && ( pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC == RES640x480x72 ) ) |
| 1861 | index = 13 ; |
| 1862 | else if ( ModeNo == 0x2F ) |
| 1863 | index = 14 ; |
| 1864 | else if ( ModeNo == 0x50 ) |
| 1865 | index = 15 ; |
| 1866 | else if ( ModeNo == 0x59 ) |
| 1867 | index = 16 ; |
| 1868 | } |
| 1869 | |
| 1870 | if( index != -1 ) |
| 1871 | { |
| 1872 | XGINew_SetReg1( pVBInfo->P3d4 , 0x02 , pVBInfo->UpdateCRT1[ index ].CR02 ) ; |
| 1873 | XGINew_SetReg1( pVBInfo->P3d4 , 0x03 , pVBInfo->UpdateCRT1[ index ].CR03 ) ; |
| 1874 | XGINew_SetReg1( pVBInfo->P3d4 , 0x15 , pVBInfo->UpdateCRT1[ index ].CR15 ) ; |
| 1875 | XGINew_SetReg1( pVBInfo->P3d4 , 0x16 , pVBInfo->UpdateCRT1[ index ].CR16 ) ; |
| 1876 | } |
| 1877 | } |
| 1878 | |
| 1879 | |
| 1880 | /* --------------------------------------------------------------------- */ |
| 1881 | /* Function : XGI_SetCRT1DE */ |
| 1882 | /* Input : */ |
| 1883 | /* Output : */ |
| 1884 | /* Description : */ |
| 1885 | /* --------------------------------------------------------------------- */ |
| 1886 | void XGI_SetCRT1DE( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT ModeNo,USHORT ModeIdIndex , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 1887 | { |
| 1888 | USHORT resindex , |
| 1889 | tempax , |
| 1890 | tempbx , |
| 1891 | tempcx , |
| 1892 | temp , |
| 1893 | modeflag ; |
| 1894 | |
| 1895 | UCHAR data ; |
| 1896 | |
| 1897 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 1898 | |
| 1899 | if ( ModeNo <= 0x13 ) |
| 1900 | { |
| 1901 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 1902 | tempax = pVBInfo->StResInfo[ resindex ].HTotal ; |
| 1903 | tempbx = pVBInfo->StResInfo[ resindex ].VTotal ; |
| 1904 | } |
| 1905 | else |
| 1906 | { |
| 1907 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 1908 | tempax = pVBInfo->ModeResInfo[ resindex ].HTotal ; |
| 1909 | tempbx = pVBInfo->ModeResInfo[ resindex ].VTotal ; |
| 1910 | } |
| 1911 | |
| 1912 | if ( modeflag & HalfDCLK ) |
| 1913 | tempax = tempax >> 1 ; |
| 1914 | |
| 1915 | if ( ModeNo > 0x13 ) |
| 1916 | { |
| 1917 | if ( modeflag & HalfDCLK ) |
| 1918 | tempax = tempax << 1 ; |
| 1919 | |
| 1920 | temp = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; |
| 1921 | |
| 1922 | if ( temp & InterlaceMode ) |
| 1923 | tempbx = tempbx >> 1 ; |
| 1924 | |
| 1925 | if ( modeflag & DoubleScanMode ) |
| 1926 | tempbx = tempbx << 1 ; |
| 1927 | } |
| 1928 | |
| 1929 | tempcx = 8 ; |
| 1930 | |
| 1931 | /* if ( !( modeflag & Charx8Dot ) ) */ |
| 1932 | /* tempcx = 9 ; */ |
| 1933 | |
| 1934 | tempax /= tempcx ; |
| 1935 | tempax -= 1 ; |
| 1936 | tempbx -= 1 ; |
| 1937 | tempcx = tempax ; |
| 1938 | temp = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x11 ) ; |
| 1939 | data = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x11 ) ; |
| 1940 | data &= 0x7F ; |
| 1941 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , data ) ; /* Unlock CRTC */ |
| 1942 | XGINew_SetReg1( pVBInfo->P3d4 , 0x01 , ( USHORT )( tempcx & 0xff ) ) ; |
| 1943 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x0b , ~0x0c , ( USHORT )( ( tempcx & 0x0ff00 ) >> 10 ) ) ; |
| 1944 | XGINew_SetReg1( pVBInfo->P3d4 , 0x12 , ( USHORT )( tempbx & 0xff ) ) ; |
| 1945 | tempax = 0 ; |
| 1946 | tempbx = tempbx >> 8 ; |
| 1947 | |
| 1948 | if ( tempbx & 0x01 ) |
| 1949 | tempax |= 0x02 ; |
| 1950 | |
| 1951 | if ( tempbx & 0x02 ) |
| 1952 | tempax |= 0x40 ; |
| 1953 | |
| 1954 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x42 , tempax ) ; |
| 1955 | data =( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x07 ) ; |
| 1956 | data &= 0xFF ; |
| 1957 | tempax = 0 ; |
| 1958 | |
| 1959 | if ( tempbx & 0x04 ) |
| 1960 | tempax |= 0x02 ; |
| 1961 | |
| 1962 | XGINew_SetRegANDOR( pVBInfo->P3d4 ,0x0a , ~0x02 , tempax ) ; |
| 1963 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , temp ) ; |
| 1964 | } |
| 1965 | |
| 1966 | |
| 1967 | /* --------------------------------------------------------------------- */ |
| 1968 | /* Function : XGI_GetResInfo */ |
| 1969 | /* Input : */ |
| 1970 | /* Output : */ |
| 1971 | /* Description : */ |
| 1972 | /* --------------------------------------------------------------------- */ |
| 1973 | USHORT XGI_GetResInfo(USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 1974 | { |
| 1975 | USHORT resindex ; |
| 1976 | |
| 1977 | if ( ModeNo <= 0x13 ) |
| 1978 | { |
| 1979 | resindex = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; /* si+St_ResInfo */ |
| 1980 | } |
| 1981 | else |
| 1982 | { |
| 1983 | resindex = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo */ |
| 1984 | } |
| 1985 | return( resindex ) ; |
| 1986 | } |
| 1987 | |
| 1988 | |
| 1989 | /* --------------------------------------------------------------------- */ |
| 1990 | /* Function : XGI_SetCRT1Offset */ |
| 1991 | /* Input : */ |
| 1992 | /* Output : */ |
| 1993 | /* Description : */ |
| 1994 | /* --------------------------------------------------------------------- */ |
| 1995 | void XGI_SetCRT1Offset( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex , PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo ) |
| 1996 | { |
| 1997 | USHORT temp , |
| 1998 | ah , |
| 1999 | al , |
| 2000 | temp2 , |
| 2001 | i , |
| 2002 | DisplayUnit ; |
| 2003 | |
| 2004 | /* GetOffset */ |
| 2005 | temp = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeInfo ; |
| 2006 | temp = temp >> 8 ; |
| 2007 | temp = pVBInfo->ScreenOffset[ temp ] ; |
| 2008 | |
| 2009 | temp2 = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; |
| 2010 | temp2 &= InterlaceMode ; |
| 2011 | |
| 2012 | if ( temp2 ) |
| 2013 | temp = temp << 1; |
| 2014 | |
| 2015 | temp2 = pVBInfo->ModeType - ModeEGA ; |
| 2016 | |
| 2017 | switch( temp2 ) |
| 2018 | { |
| 2019 | case 0: |
| 2020 | temp2 = 1 ; |
| 2021 | break ; |
| 2022 | case 1: |
| 2023 | temp2 = 2 ; |
| 2024 | break ; |
| 2025 | case 2: |
| 2026 | temp2 = 4 ; |
| 2027 | break ; |
| 2028 | case 3: |
| 2029 | temp2 = 4 ; |
| 2030 | break ; |
| 2031 | case 4: |
| 2032 | temp2 = 6 ; |
| 2033 | break; |
| 2034 | case 5: |
| 2035 | temp2 = 8 ; |
| 2036 | break ; |
| 2037 | default: |
| 2038 | break ; |
| 2039 | } |
| 2040 | |
| 2041 | if ( ( ModeNo >= 0x26 ) && ( ModeNo <= 0x28 ) ) |
| 2042 | temp = temp * temp2 + temp2 / 2 ; |
| 2043 | else |
| 2044 | temp *= temp2 ; |
| 2045 | |
| 2046 | /* SetOffset */ |
| 2047 | DisplayUnit = temp ; |
| 2048 | temp2 = temp ; |
| 2049 | temp = temp >> 8 ; /* ah */ |
| 2050 | temp &= 0x0F ; |
| 2051 | i = XGINew_GetReg1( pVBInfo->P3c4 , 0x0E ) ; |
| 2052 | i &= 0xF0 ; |
| 2053 | i |= temp ; |
| 2054 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0E , i ) ; |
| 2055 | |
| 2056 | temp =( UCHAR )temp2 ; |
| 2057 | temp &= 0xFF ; /* al */ |
| 2058 | XGINew_SetReg1( pVBInfo->P3d4 , 0x13 , temp ) ; |
| 2059 | |
| 2060 | /* SetDisplayUnit */ |
| 2061 | temp2 = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; |
| 2062 | temp2 &= InterlaceMode ; |
| 2063 | if ( temp2 ) |
| 2064 | DisplayUnit >>= 1 ; |
| 2065 | |
| 2066 | DisplayUnit = DisplayUnit << 5 ; |
| 2067 | ah = ( DisplayUnit & 0xff00 ) >> 8 ; |
| 2068 | al = DisplayUnit & 0x00ff ; |
| 2069 | if ( al == 0 ) |
| 2070 | ah += 1 ; |
| 2071 | else |
| 2072 | ah += 2 ; |
| 2073 | |
| 2074 | if ( HwDeviceExtension->jChipType >= XG20 ) |
| 2075 | if ( ( ModeNo == 0x4A ) | (ModeNo == 0x49 ) ) |
| 2076 | ah -= 1 ; |
| 2077 | |
| 2078 | XGINew_SetReg1( pVBInfo->P3c4 , 0x10 , ah ) ; |
| 2079 | } |
| 2080 | |
| 2081 | |
| 2082 | /* --------------------------------------------------------------------- */ |
| 2083 | /* Function : XGI_SetCRT1VCLK */ |
| 2084 | /* Input : */ |
| 2085 | /* Output : */ |
| 2086 | /* Description : */ |
| 2087 | /* --------------------------------------------------------------------- */ |
| 2088 | void XGI_SetCRT1VCLK( USHORT ModeNo , USHORT ModeIdIndex , |
| 2089 | PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 2090 | { |
| 2091 | UCHAR index , data ; |
| 2092 | USHORT vclkindex ; |
| 2093 | |
| 2094 | if ( pVBInfo->IF_DEF_LVDS == 1 ) |
| 2095 | { |
| 2096 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRTVCLK ; |
| 2097 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x31 ) & 0xCF ; |
| 2098 | XGINew_SetReg1( pVBInfo->P3c4 , 0x31 , data ) ; |
| 2099 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->VCLKData[ index ].SR2B ) ; |
| 2100 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ index ].SR2C ) ; |
| 2101 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2D , 0x01 ) ; |
| 2102 | } |
| 2103 | else if ( ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) && ( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) |
| 2104 | { |
| 2105 | vclkindex = XGI_GetVCLK2Ptr( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; |
| 2106 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x31 ) & 0xCF ; |
| 2107 | XGINew_SetReg1( pVBInfo->P3c4 , 0x31 , data ) ; |
| 2108 | data = pVBInfo->VBVCLKData[ vclkindex ].Part4_A ; |
| 2109 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , data ) ; |
| 2110 | data = pVBInfo->VBVCLKData[ vclkindex ].Part4_B ; |
| 2111 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , data ) ; |
| 2112 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2D , 0x01 ) ; |
| 2113 | } |
| 2114 | else |
| 2115 | { |
| 2116 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRTVCLK ; |
| 2117 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x31 ) & 0xCF ; |
| 2118 | XGINew_SetReg1( pVBInfo->P3c4 , 0x31 , data ) ; |
| 2119 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->VCLKData[ index ].SR2B ) ; |
| 2120 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ index ].SR2C ) ; |
| 2121 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2D , 0x01 ) ; |
| 2122 | } |
| 2123 | |
| 2124 | if ( HwDeviceExtension->jChipType >= XG20 ) |
| 2125 | { |
| 2126 | if ( pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag & HalfDCLK ) |
| 2127 | { |
| 2128 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x2B ) ; |
| 2129 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , data ) ; |
| 2130 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x2C ) ; |
| 2131 | index = data ; |
| 2132 | index &= 0xE0 ; |
| 2133 | data &= 0x1F ; |
| 2134 | data = data << 1 ; |
| 2135 | data += 1 ; |
| 2136 | data |= index ; |
| 2137 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , data ) ; |
| 2138 | } |
| 2139 | } |
| 2140 | } |
| 2141 | |
| 2142 | |
| 2143 | /* --------------------------------------------------------------------- */ |
| 2144 | /* Function : XGI_SetCRT1FIFO */ |
| 2145 | /* Input : */ |
| 2146 | /* Output : */ |
| 2147 | /* Description : */ |
| 2148 | /* --------------------------------------------------------------------- */ |
| 2149 | void XGI_SetCRT1FIFO( USHORT ModeNo , PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo ) |
| 2150 | { |
| 2151 | USHORT data ; |
| 2152 | |
| 2153 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x3D ) ; |
| 2154 | data &= 0xfe ; |
| 2155 | XGINew_SetReg1( pVBInfo->P3c4 , 0x3D , data ) ; /* diable auto-threshold */ |
| 2156 | |
| 2157 | if ( ModeNo > 0x13 ) |
| 2158 | { |
| 2159 | XGINew_SetReg1( pVBInfo->P3c4 , 0x08 , 0x34 ) ; |
| 2160 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x09 ) ; |
| 2161 | data &= 0xC0 ; |
| 2162 | XGINew_SetReg1( pVBInfo->P3c4 , 0x09 , data | 0x30) ; |
| 2163 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x3D ) ; |
| 2164 | data |= 0x01 ; |
| 2165 | XGINew_SetReg1( pVBInfo->P3c4 , 0x3D , data ) ; |
| 2166 | } |
| 2167 | else |
| 2168 | { |
| 2169 | if (HwDeviceExtension->jChipType == XG27) |
| 2170 | { |
| 2171 | XGINew_SetReg1( pVBInfo->P3c4 , 0x08 , 0x0E ) ; |
| 2172 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x09 ) ; |
| 2173 | data &= 0xC0 ; |
| 2174 | XGINew_SetReg1( pVBInfo->P3c4 , 0x09 , data | 0x20 ) ; |
| 2175 | } |
| 2176 | else |
| 2177 | { |
| 2178 | XGINew_SetReg1( pVBInfo->P3c4 , 0x08 , 0xAE ) ; |
| 2179 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x09 ) ; |
| 2180 | data &= 0xF0 ; |
| 2181 | XGINew_SetReg1( pVBInfo->P3c4 , 0x09 , data ) ; |
| 2182 | } |
| 2183 | } |
| 2184 | |
| 2185 | if (HwDeviceExtension->jChipType == XG21) |
| 2186 | { |
| 2187 | XGI_SetXG21FPBits(pVBInfo); /* Fix SR9[7:6] can't read back */ |
| 2188 | } |
| 2189 | } |
| 2190 | |
| 2191 | |
| 2192 | /* --------------------------------------------------------------------- */ |
| 2193 | /* Function : XGI_SetCRT1ModeRegs */ |
| 2194 | /* Input : */ |
| 2195 | /* Output : */ |
| 2196 | /* Description : */ |
| 2197 | /* --------------------------------------------------------------------- */ |
| 2198 | void XGI_SetCRT1ModeRegs( PXGI_HW_DEVICE_INFO HwDeviceExtension , |
| 2199 | USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo ) |
| 2200 | { |
| 2201 | USHORT data , |
| 2202 | data2 , |
| 2203 | data3 , |
| 2204 | infoflag = 0 , |
| 2205 | modeflag , |
| 2206 | resindex , |
| 2207 | xres ; |
| 2208 | |
| 2209 | if ( ModeNo > 0x13 ) |
| 2210 | { |
| 2211 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 2212 | infoflag = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; |
| 2213 | } |
| 2214 | else |
| 2215 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ModeFlag */ |
| 2216 | |
| 2217 | if ( XGINew_GetReg1( pVBInfo->P3d4 , 0x31 ) & 0x01 ) |
| 2218 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x1F , 0x3F , 0x00 ) ; |
| 2219 | |
| 2220 | if ( ModeNo > 0x13 ) |
| 2221 | data = infoflag ; |
| 2222 | else |
| 2223 | data = 0 ; |
| 2224 | |
| 2225 | data2 = 0 ; |
| 2226 | |
| 2227 | if ( ModeNo > 0x13 ) |
| 2228 | { |
| 2229 | if ( pVBInfo->ModeType > 0x02 ) |
| 2230 | { |
| 2231 | data2 |= 0x02 ; |
| 2232 | data3 = pVBInfo->ModeType - ModeVGA ; |
| 2233 | data3 = data3 << 2 ; |
| 2234 | data2 |= data3 ; |
| 2235 | } |
| 2236 | } |
| 2237 | |
| 2238 | data &= InterlaceMode ; |
| 2239 | |
| 2240 | if ( data ) |
| 2241 | data2 |= 0x20 ; |
| 2242 | |
| 2243 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x06 , ~0x3F , data2 ) ; |
| 2244 | /* XGINew_SetReg1(pVBInfo->P3c4,0x06,data2); */ |
| 2245 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 2246 | if ( ModeNo <= 0x13 ) |
| 2247 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; |
| 2248 | else |
| 2249 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */ |
| 2250 | |
| 2251 | data = 0x0000 ; |
| 2252 | if ( infoflag & InterlaceMode ) |
| 2253 | { |
| 2254 | if ( xres == 1024 ) |
| 2255 | data = 0x0035 ; |
| 2256 | else if ( xres == 1280 ) |
| 2257 | data = 0x0048 ; |
| 2258 | } |
| 2259 | |
| 2260 | data2 = data & 0x00FF ; |
| 2261 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x19 , 0xFF , data2 ) ; |
| 2262 | data2 = ( data & 0xFF00 ) >> 8 ; |
| 2263 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x19 , 0xFC , data2 ) ; |
| 2264 | |
| 2265 | if( modeflag & HalfDCLK ) |
| 2266 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x01 , 0xF7 , 0x08 ) ; |
| 2267 | |
| 2268 | data2 = 0 ; |
| 2269 | |
| 2270 | if ( modeflag & LineCompareOff ) |
| 2271 | data2 |= 0x08 ; |
| 2272 | |
| 2273 | if ( ModeNo > 0x13 ) |
| 2274 | { |
| 2275 | if ( pVBInfo->ModeType == ModeEGA ) |
| 2276 | data2 |= 0x40 ; |
| 2277 | } |
| 2278 | |
| 2279 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0F , ~0x48 , data2 ) ; |
| 2280 | data = 0x60 ; |
| 2281 | if ( pVBInfo->ModeType != ModeText ) |
| 2282 | { |
| 2283 | data = data ^ 0x60 ; |
| 2284 | if ( pVBInfo->ModeType != ModeEGA ) |
| 2285 | { |
| 2286 | data = data ^ 0xA0 ; |
| 2287 | } |
| 2288 | } |
| 2289 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x21 , 0x1F , data ) ; |
| 2290 | |
| 2291 | XGI_SetVCLKState( HwDeviceExtension , ModeNo , RefreshRateTableIndex, pVBInfo) ; |
| 2292 | |
| 2293 | /* if(modeflag&HalfDCLK)//030305 fix lowresolution bug */ |
| 2294 | /* if(XGINew_IF_DEF_NEW_LOWRES) */ |
| 2295 | /* XGI_VesaLowResolution(ModeNo,ModeIdIndex);//030305 fix lowresolution bug */ |
| 2296 | |
| 2297 | data=XGINew_GetReg1( pVBInfo->P3d4 , 0x31 ) ; |
| 2298 | |
| 2299 | if (HwDeviceExtension->jChipType == XG27 ) |
| 2300 | { |
| 2301 | if ( data & 0x40 ) |
| 2302 | data = 0x2c ; |
| 2303 | else |
| 2304 | data = 0x6c ; |
| 2305 | XGINew_SetReg1( pVBInfo->P3d4 , 0x52 , data ) ; |
| 2306 | XGINew_SetRegOR( pVBInfo->P3d4 , 0x51 , 0x10 ) ; |
| 2307 | } |
| 2308 | else |
| 2309 | if (HwDeviceExtension->jChipType >= XG20 ) |
| 2310 | { |
| 2311 | if ( data & 0x40 ) |
| 2312 | data = 0x33 ; |
| 2313 | else |
| 2314 | data = 0x73 ; |
| 2315 | XGINew_SetReg1( pVBInfo->P3d4 , 0x52 , data ) ; |
| 2316 | XGINew_SetReg1( pVBInfo->P3d4 , 0x51 , 0x02 ) ; |
| 2317 | } |
| 2318 | else |
| 2319 | { |
| 2320 | if ( data & 0x40 ) |
| 2321 | data = 0x2c ; |
| 2322 | else |
| 2323 | data = 0x6c ; |
| 2324 | XGINew_SetReg1( pVBInfo->P3d4 , 0x52 , data ) ; |
| 2325 | } |
| 2326 | |
| 2327 | } |
| 2328 | |
| 2329 | |
| 2330 | /* --------------------------------------------------------------------- */ |
| 2331 | /* Function : XGI_SetVCLKState */ |
| 2332 | /* Input : */ |
| 2333 | /* Output : */ |
| 2334 | /* Description : */ |
| 2335 | /* --------------------------------------------------------------------- */ |
| 2336 | void XGI_SetVCLKState( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT ModeNo , USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo ) |
| 2337 | { |
| 2338 | USHORT data , |
| 2339 | data2 = 0 ; |
| 2340 | SHORT VCLK ; |
| 2341 | |
| 2342 | UCHAR index ; |
| 2343 | |
| 2344 | if ( ModeNo <= 0x13 ) |
| 2345 | VCLK = 0 ; |
| 2346 | else |
| 2347 | { |
| 2348 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRTVCLK ; |
| 2349 | index &= IndexMask ; |
| 2350 | VCLK = pVBInfo->VCLKData[ index ].CLOCK ; |
| 2351 | } |
| 2352 | |
| 2353 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x32 ) ; |
| 2354 | data &= 0xf3 ; |
| 2355 | if ( VCLK >= 200 ) |
| 2356 | data |= 0x0c ; /* VCLK > 200 */ |
| 2357 | |
| 2358 | if ( HwDeviceExtension->jChipType >= XG20 ) |
| 2359 | data &= ~0x04 ; /* 2 pixel mode */ |
| 2360 | |
| 2361 | XGINew_SetReg1( pVBInfo->P3c4 , 0x32 , data ) ; |
| 2362 | |
| 2363 | if ( HwDeviceExtension->jChipType < XG20 ) |
| 2364 | { |
| 2365 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x1F ) ; |
| 2366 | data &= 0xE7 ; |
| 2367 | if ( VCLK < 200 ) |
| 2368 | data |= 0x10 ; |
| 2369 | XGINew_SetReg1( pVBInfo->P3c4 , 0x1F , data ) ; |
| 2370 | } |
| 2371 | |
| 2372 | /* Jong for Adavantech LCD ripple issue |
| 2373 | if ( ( VCLK >= 0 ) && ( VCLK < 135 ) ) |
| 2374 | data2 = 0x03 ; |
| 2375 | else if ( ( VCLK >= 135 ) && ( VCLK < 160 ) ) |
| 2376 | data2 = 0x02 ; |
| 2377 | else if ( ( VCLK >= 160 ) && ( VCLK < 260 ) ) |
| 2378 | data2 = 0x01 ; |
| 2379 | else if ( VCLK > 260 ) |
| 2380 | data2 = 0x00 ; |
| 2381 | */ |
| 2382 | data2 = 0x00 ; |
| 2383 | |
| 2384 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x07 , 0xFC , data2 ) ; |
| 2385 | if (HwDeviceExtension->jChipType >= XG27 ) |
| 2386 | { |
| 2387 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x40 , 0xFC , data2&0x03 ) ; |
| 2388 | } |
| 2389 | |
| 2390 | |
| 2391 | } |
| 2392 | |
| 2393 | |
| 2394 | /* --------------------------------------------------------------------- */ |
| 2395 | /* Function : XGI_VesaLowResolution */ |
| 2396 | /* Input : */ |
| 2397 | /* Output : */ |
| 2398 | /* Description : */ |
| 2399 | /* --------------------------------------------------------------------- */ |
| 2400 | /*void XGI_VesaLowResolution( USHORT ModeNo , USHORT ModeIdIndex ,PVB_DEVICE_INFO pVBInfo) |
| 2401 | { |
| 2402 | USHORT modeflag; |
| 2403 | |
| 2404 | if ( ModeNo > 0x13 ) |
| 2405 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 2406 | else |
| 2407 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 2408 | |
| 2409 | if ( ModeNo > 0x13 ) |
| 2410 | { |
| 2411 | if ( modeflag & DoubleScanMode ) |
| 2412 | { |
| 2413 | if ( modeflag & HalfDCLK ) |
| 2414 | { |
| 2415 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 2416 | { |
| 2417 | if ( !( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) ) |
| 2418 | { |
| 2419 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 2420 | { |
| 2421 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x01 , 0xf7 , 0x00 ) ; |
| 2422 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0f , 0x7f , 0x00 ) ; |
| 2423 | return ; |
| 2424 | } |
| 2425 | } |
| 2426 | } |
| 2427 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0f , 0xff , 0x80 ) ; |
| 2428 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x01 , 0xf7 , 0x00 ) ; |
| 2429 | return ; |
| 2430 | } |
| 2431 | } |
| 2432 | } |
| 2433 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0f , 0x7f , 0x00 ) ; |
| 2434 | } |
| 2435 | */ |
| 2436 | |
| 2437 | /* --------------------------------------------------------------------- */ |
| 2438 | /* Function : XGI_LoadDAC */ |
| 2439 | /* Input : */ |
| 2440 | /* Output : */ |
| 2441 | /* Description : */ |
| 2442 | /* --------------------------------------------------------------------- */ |
| 2443 | void XGI_LoadDAC( USHORT ModeNo , USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo ) |
| 2444 | { |
| 2445 | USHORT data , data2 , time , |
| 2446 | i , j , k , m , n , o , |
| 2447 | si , di , bx , dl , al , ah , dh , |
| 2448 | *table = NULL ; |
| 2449 | |
| 2450 | if ( ModeNo <= 0x13 ) |
| 2451 | data = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 2452 | else |
| 2453 | data = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 2454 | |
| 2455 | data &= DACInfoFlag ; |
| 2456 | time = 64 ; |
| 2457 | |
| 2458 | if ( data == 0x00 ) |
| 2459 | table = XGINew_MDA_DAC ; |
| 2460 | else if ( data == 0x08 ) |
| 2461 | table = XGINew_CGA_DAC ; |
| 2462 | else if ( data == 0x10 ) |
| 2463 | table = XGINew_EGA_DAC ; |
| 2464 | else if ( data == 0x18 ) |
| 2465 | { |
| 2466 | time = 256 ; |
| 2467 | table = XGINew_VGA_DAC ; |
| 2468 | } |
| 2469 | |
| 2470 | if ( time == 256 ) |
| 2471 | j = 16 ; |
| 2472 | else |
| 2473 | j = time ; |
| 2474 | |
| 2475 | XGINew_SetReg3( pVBInfo->P3c6 , 0xFF ) ; |
| 2476 | XGINew_SetReg3( pVBInfo->P3c8 , 0x00 ) ; |
| 2477 | |
| 2478 | for( i = 0 ; i < j ; i++ ) |
| 2479 | { |
| 2480 | data = table[ i ] ; |
| 2481 | |
| 2482 | for( k = 0 ; k < 3 ; k++ ) |
| 2483 | { |
| 2484 | data2 = 0 ; |
| 2485 | |
| 2486 | if ( data & 0x01 ) |
| 2487 | data2 = 0x2A ; |
| 2488 | |
| 2489 | if ( data & 0x02 ) |
| 2490 | data2 += 0x15 ; |
| 2491 | |
| 2492 | XGINew_SetReg3( pVBInfo->P3c9 , data2 ) ; |
| 2493 | data = data >> 2 ; |
| 2494 | } |
| 2495 | } |
| 2496 | |
| 2497 | if ( time == 256 ) |
| 2498 | { |
| 2499 | for( i = 16 ; i < 32 ; i++ ) |
| 2500 | { |
| 2501 | data = table[ i ] ; |
| 2502 | |
| 2503 | for( k = 0 ; k < 3 ; k++ ) |
| 2504 | XGINew_SetReg3( pVBInfo->P3c9 , data ) ; |
| 2505 | } |
| 2506 | |
| 2507 | si = 32 ; |
| 2508 | |
| 2509 | for( m = 0 ; m < 9 ; m++ ) |
| 2510 | { |
| 2511 | di = si ; |
| 2512 | bx = si + 0x04 ; |
| 2513 | dl = 0 ; |
| 2514 | |
| 2515 | for( n = 0 ; n < 3 ; n++ ) |
| 2516 | { |
| 2517 | for( o = 0 ; o < 5 ; o++ ) |
| 2518 | { |
| 2519 | dh = table[ si ] ; |
| 2520 | ah = table[ di ] ; |
| 2521 | al = table[ bx ] ; |
| 2522 | si++ ; |
| 2523 | XGI_WriteDAC( dl , ah , al , dh, pVBInfo ) ; |
| 2524 | } |
| 2525 | |
| 2526 | si -= 2 ; |
| 2527 | |
| 2528 | for( o = 0 ; o < 3 ; o++ ) |
| 2529 | { |
| 2530 | dh = table[ bx ] ; |
| 2531 | ah = table[ di ] ; |
| 2532 | al = table[ si ] ; |
| 2533 | si-- ; |
| 2534 | XGI_WriteDAC( dl , ah , al , dh, pVBInfo ) ; |
| 2535 | } |
| 2536 | |
| 2537 | dl++ ; |
| 2538 | } |
| 2539 | |
| 2540 | si += 5 ; |
| 2541 | } |
| 2542 | } |
| 2543 | } |
| 2544 | |
| 2545 | |
| 2546 | /* --------------------------------------------------------------------- */ |
| 2547 | /* Function : XGI_WriteDAC */ |
| 2548 | /* Input : */ |
| 2549 | /* Output : */ |
| 2550 | /* Description : */ |
| 2551 | /* --------------------------------------------------------------------- */ |
| 2552 | void XGI_WriteDAC( USHORT dl , USHORT ah , USHORT al , USHORT dh,PVB_DEVICE_INFO pVBInfo ) |
| 2553 | { |
| 2554 | USHORT temp , bh , bl ; |
| 2555 | |
| 2556 | bh = ah ; |
| 2557 | bl = al ; |
| 2558 | |
| 2559 | if ( dl != 0 ) |
| 2560 | { |
| 2561 | temp = bh ; |
| 2562 | bh = dh ; |
| 2563 | dh = temp ; |
| 2564 | if ( dl == 1 ) |
| 2565 | { |
| 2566 | temp = bl ; |
| 2567 | bl = dh ; |
| 2568 | dh = temp ; |
| 2569 | } |
| 2570 | else |
| 2571 | { |
| 2572 | temp = bl ; |
| 2573 | bl = bh ; |
| 2574 | bh = temp ; |
| 2575 | } |
| 2576 | } |
| 2577 | XGINew_SetReg3( pVBInfo->P3c9 , ( USHORT )dh ) ; |
| 2578 | XGINew_SetReg3( pVBInfo->P3c9 , ( USHORT )bh ) ; |
| 2579 | XGINew_SetReg3( pVBInfo->P3c9 , ( USHORT )bl ) ; |
| 2580 | } |
| 2581 | |
| 2582 | #if 0 |
| 2583 | /* --------------------------------------------------------------------- */ |
| 2584 | /* Function : XGI_ClearBuffer */ |
| 2585 | /* Input : */ |
| 2586 | /* Output : */ |
| 2587 | /* Description : */ |
| 2588 | /* --------------------------------------------------------------------- */ |
| 2589 | void XGI_ClearBuffer( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT ModeNo, PVB_DEVICE_INFO pVBInfo) |
| 2590 | { |
| 2591 | PVOID VideoMemoryAddress = ( PVOID )HwDeviceExtension->pjVideoMemoryAddress ; |
| 2592 | ULONG AdapterMemorySize = ( ULONG )HwDeviceExtension->ulVideoMemorySize ; |
| 2593 | PUSHORT pBuffer ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2594 | int i ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2595 | |
| 2596 | if ( pVBInfo->ModeType >= ModeEGA ) |
| 2597 | { |
| 2598 | if ( ModeNo > 0x13 ) |
| 2599 | { |
| 2600 | AdapterMemorySize = 0x40000 ; /* clear 256k */ |
| 2601 | /* GetDRAMSize( HwDeviceExtension ) ; */ |
Bill Pemberton | cc75bb0 | 2010-06-17 13:10:40 -0400 | [diff] [blame] | 2602 | memset(VideoMemoryAddress, 0, AdapterMemorySize); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2603 | } |
| 2604 | else |
| 2605 | { |
| 2606 | /* |
| 2607 | pBuffer = VideoMemoryAddress ; |
| 2608 | for( i = 0 ; i < 0x4000 ; i++ ) |
| 2609 | pBuffer[ i ] = 0x0000 ; |
| 2610 | */ |
| 2611 | } |
| 2612 | } |
| 2613 | else |
| 2614 | { |
| 2615 | pBuffer = VideoMemoryAddress ; |
| 2616 | if ( pVBInfo->ModeType < ModeCGA ) |
| 2617 | { |
| 2618 | /* |
| 2619 | for ( i = 0 ; i < 0x4000 ; i++ ) |
| 2620 | pBuffer[ i ] = 0x0720 ; |
| 2621 | */ |
| 2622 | } |
| 2623 | else |
Bill Pemberton | cc75bb0 | 2010-06-17 13:10:40 -0400 | [diff] [blame] | 2624 | memset(VideoMemoryAddress , 0, 0x8000); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2625 | } |
| 2626 | } |
| 2627 | |
| 2628 | #endif |
| 2629 | /* --------------------------------------------------------------------- */ |
| 2630 | /* Function : XGI_SetLCDAGroup */ |
| 2631 | /* Input : */ |
| 2632 | /* Output : */ |
| 2633 | /* Description : */ |
| 2634 | /* --------------------------------------------------------------------- */ |
| 2635 | void XGI_SetLCDAGroup( USHORT ModeNo , USHORT ModeIdIndex , PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo ) |
| 2636 | { |
| 2637 | USHORT RefreshRateTableIndex ; |
| 2638 | /* USHORT temp ; */ |
| 2639 | |
| 2640 | /* pVBInfo->SelectCRT2Rate = 0 ; */ |
| 2641 | |
| 2642 | pVBInfo->SetFlag |= ProgrammingCRT2 ; |
| 2643 | RefreshRateTableIndex = XGI_GetRatePtrCRT2( HwDeviceExtension, ModeNo , ModeIdIndex, pVBInfo ) ; |
| 2644 | XGI_GetLVDSResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 2645 | XGI_GetLVDSData( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo); |
| 2646 | XGI_ModCRT1Regs( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; |
| 2647 | XGI_SetLVDSRegs( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2648 | XGI_SetCRT2ECLK( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2649 | } |
| 2650 | |
| 2651 | |
| 2652 | /* --------------------------------------------------------------------- */ |
| 2653 | /* Function : XGI_GetLVDSResInfo */ |
| 2654 | /* Input : */ |
| 2655 | /* Output : */ |
| 2656 | /* Description : */ |
| 2657 | /* --------------------------------------------------------------------- */ |
| 2658 | void XGI_GetLVDSResInfo( USHORT ModeNo , USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo ) |
| 2659 | { |
| 2660 | USHORT resindex , xres , yres , modeflag ; |
| 2661 | |
| 2662 | if ( ModeNo <= 0x13 ) |
| 2663 | { |
| 2664 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; /* si+St_ResInfo */ |
| 2665 | } |
| 2666 | else |
| 2667 | { |
| 2668 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo */ |
| 2669 | } |
| 2670 | |
| 2671 | |
| 2672 | /* if ( ModeNo > 0x13 ) */ |
| 2673 | /* modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; */ |
| 2674 | /* else */ |
| 2675 | /* modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; */ |
| 2676 | |
| 2677 | if ( ModeNo <= 0x13 ) |
| 2678 | { |
| 2679 | resindex = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; /* si+St_ResInfo */ |
| 2680 | } |
| 2681 | else |
| 2682 | { |
| 2683 | resindex = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo */ |
| 2684 | } |
| 2685 | |
| 2686 | /* resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; */ |
| 2687 | |
| 2688 | if ( ModeNo <= 0x13 ) |
| 2689 | { |
| 2690 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; |
| 2691 | yres = pVBInfo->StResInfo[ resindex ].VTotal ; |
| 2692 | } |
| 2693 | else |
| 2694 | { |
| 2695 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; |
| 2696 | yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; |
| 2697 | } |
| 2698 | if ( ModeNo > 0x13 ) |
| 2699 | { |
| 2700 | if ( modeflag & HalfDCLK ) |
| 2701 | xres = xres << 1 ; |
| 2702 | |
| 2703 | if ( modeflag & DoubleScanMode ) |
| 2704 | yres = yres << 1 ; |
| 2705 | } |
| 2706 | /* if ( modeflag & Charx8Dot ) */ |
| 2707 | /* { */ |
| 2708 | |
| 2709 | if ( xres == 720 ) |
| 2710 | xres = 640 ; |
| 2711 | |
| 2712 | /* } */ |
| 2713 | pVBInfo->VGAHDE = xres ; |
| 2714 | pVBInfo->HDE = xres ; |
| 2715 | pVBInfo->VGAVDE = yres ; |
| 2716 | pVBInfo->VDE = yres ; |
| 2717 | } |
| 2718 | |
| 2719 | |
| 2720 | /* --------------------------------------------------------------------- */ |
| 2721 | /* Function : XGI_GetLVDSData */ |
| 2722 | /* Input : */ |
| 2723 | /* Output : */ |
| 2724 | /* Description : */ |
| 2725 | /* --------------------------------------------------------------------- */ |
| 2726 | void XGI_GetLVDSData( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 2727 | { |
| 2728 | USHORT tempbx ; |
| 2729 | XGI330_LVDSDataStruct *LCDPtr = NULL ; |
| 2730 | XGI330_CHTVDataStruct *TVPtr = NULL ; |
| 2731 | |
| 2732 | tempbx = 2 ; |
| 2733 | |
| 2734 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 2735 | { |
| 2736 | LCDPtr = ( XGI330_LVDSDataStruct * )XGI_GetLcdPtr( tempbx, ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo) ; |
| 2737 | pVBInfo->VGAHT = LCDPtr->VGAHT ; |
| 2738 | pVBInfo->VGAVT = LCDPtr->VGAVT ; |
| 2739 | pVBInfo->HT = LCDPtr->LCDHT ; |
| 2740 | pVBInfo->VT = LCDPtr->LCDVT ; |
| 2741 | } |
| 2742 | if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 2743 | { |
| 2744 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 2745 | { |
| 2746 | TVPtr = ( XGI330_CHTVDataStruct * )XGI_GetTVPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2747 | pVBInfo->VGAHT = TVPtr->VGAHT ; |
| 2748 | pVBInfo->VGAVT = TVPtr->VGAVT ; |
| 2749 | pVBInfo->HT = TVPtr->LCDHT ; |
| 2750 | pVBInfo->VT = TVPtr->LCDVT ; |
| 2751 | } |
| 2752 | } |
| 2753 | |
| 2754 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 2755 | { |
| 2756 | if ( !( pVBInfo->LCDInfo & ( SetLCDtoNonExpanding | EnableScalingLCD ) ) ) |
| 2757 | { |
| 2758 | if ( ( pVBInfo->LCDResInfo == Panel1024x768 ) || ( pVBInfo->LCDResInfo == Panel1024x768x75 ) ) |
| 2759 | { |
| 2760 | pVBInfo->HDE = 1024 ; |
| 2761 | pVBInfo->VDE = 768 ; |
| 2762 | } |
| 2763 | else if ( ( pVBInfo->LCDResInfo == Panel1280x1024 ) || ( pVBInfo->LCDResInfo == Panel1280x1024x75 ) ) |
| 2764 | { |
| 2765 | pVBInfo->HDE = 1280 ; |
| 2766 | pVBInfo->VDE = 1024 ; |
| 2767 | } |
| 2768 | else if ( pVBInfo->LCDResInfo == Panel1400x1050 ) |
| 2769 | { |
| 2770 | pVBInfo->HDE = 1400 ; |
| 2771 | pVBInfo->VDE = 1050 ; |
| 2772 | } |
| 2773 | else |
| 2774 | { |
| 2775 | pVBInfo->HDE = 1600 ; |
| 2776 | pVBInfo->VDE = 1200 ; |
| 2777 | } |
| 2778 | } |
| 2779 | } |
| 2780 | } |
| 2781 | |
| 2782 | |
| 2783 | /* --------------------------------------------------------------------- */ |
| 2784 | /* Function : XGI_ModCRT1Regs */ |
| 2785 | /* Input : */ |
| 2786 | /* Output : */ |
| 2787 | /* Description : */ |
| 2788 | /* --------------------------------------------------------------------- */ |
| 2789 | void XGI_ModCRT1Regs( USHORT ModeNo , USHORT ModeIdIndex , |
| 2790 | USHORT RefreshRateTableIndex , PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo ) |
| 2791 | { |
| 2792 | UCHAR index ; |
| 2793 | USHORT tempbx , i ; |
| 2794 | XGI_LVDSCRT1HDataStruct *LCDPtr = NULL ; |
| 2795 | XGI_LVDSCRT1VDataStruct *LCDPtr1 =NULL ; |
| 2796 | /* XGI330_CHTVDataStruct *TVPtr = NULL ; */ |
| 2797 | XGI_CH7007TV_TimingHStruct *CH7007TV_TimingHPtr = NULL; |
| 2798 | XGI_CH7007TV_TimingVStruct *CH7007TV_TimingVPtr = NULL; |
| 2799 | |
| 2800 | if( ModeNo <= 0x13 ) |
| 2801 | index = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; |
| 2802 | else |
| 2803 | index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; |
| 2804 | |
| 2805 | index= index & IndexMask ; |
| 2806 | |
| 2807 | if ( ( pVBInfo->IF_DEF_ScaleLCD == 0 ) || ( ( pVBInfo->IF_DEF_ScaleLCD == 1 ) && ( !( pVBInfo->LCDInfo & EnableScalingLCD ) ) ) ) |
| 2808 | { |
| 2809 | tempbx = 0 ; |
| 2810 | |
| 2811 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 2812 | { |
| 2813 | LCDPtr = ( XGI_LVDSCRT1HDataStruct * )XGI_GetLcdPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2814 | |
| 2815 | for( i = 0 ; i < 8 ; i++ ) |
| 2816 | pVBInfo->TimingH[ 0 ].data[ i ] = LCDPtr[ 0 ].Reg[ i ] ; |
| 2817 | } |
| 2818 | |
| 2819 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 2820 | { |
| 2821 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 2822 | { |
| 2823 | CH7007TV_TimingHPtr = ( XGI_CH7007TV_TimingHStruct *)XGI_GetTVPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2824 | |
| 2825 | for( i = 0 ; i < 8 ; i++ ) |
| 2826 | pVBInfo->TimingH[ 0 ].data[ i ] = CH7007TV_TimingHPtr[ 0 ].data[ i ] ; |
| 2827 | } |
| 2828 | } |
| 2829 | |
| 2830 | /* if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 2831 | { |
| 2832 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 2833 | TVPtr = ( XGI330_CHTVDataStruct *)XGI_GetTVPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2834 | } */ |
| 2835 | |
| 2836 | XGI_SetCRT1Timing_H(pVBInfo,HwDeviceExtension) ; |
| 2837 | |
| 2838 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 2839 | { |
| 2840 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , CH7007TV_TimingHPtr[ 0 ].data[ 8 ] ) ; |
| 2841 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , CH7007TV_TimingHPtr[ 0 ].data[ 9 ] ) ; |
| 2842 | } |
| 2843 | |
| 2844 | tempbx = 1 ; |
| 2845 | |
| 2846 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 2847 | { |
| 2848 | LCDPtr1 = ( XGI_LVDSCRT1VDataStruct * )XGI_GetLcdPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2849 | for( i = 0 ; i < 7 ; i++ ) |
| 2850 | pVBInfo->TimingV[ 0 ].data[ i ] = LCDPtr1[ 0 ].Reg[ i ] ; |
| 2851 | } |
| 2852 | |
| 2853 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 2854 | { |
| 2855 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 2856 | { |
| 2857 | CH7007TV_TimingVPtr = ( XGI_CH7007TV_TimingVStruct *)XGI_GetTVPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2858 | |
| 2859 | for( i = 0 ; i < 7 ; i++ ) |
| 2860 | pVBInfo->TimingV[ 0 ].data[ i ] = CH7007TV_TimingVPtr[ 0 ].data[ i ] ; |
| 2861 | } |
| 2862 | } |
| 2863 | /* if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 2864 | { |
| 2865 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 2866 | TVPtr = ( XGI330_CHTVDataStruct *)XGI_GetTVPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2867 | } */ |
| 2868 | |
| 2869 | XGI_SetCRT1Timing_V( ModeIdIndex , ModeNo , pVBInfo) ; |
| 2870 | |
| 2871 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 2872 | { |
| 2873 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x33 , ~0x01 , CH7007TV_TimingVPtr[ 0 ].data[ 7 ]&0x01 ) ; |
| 2874 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , CH7007TV_TimingVPtr[ 0 ].data[8 ] ) ; |
| 2875 | XGINew_SetReg1( pVBInfo->P3c4 , 0x3F , CH7007TV_TimingVPtr[ 0 ].data[9 ] ) ; |
| 2876 | |
| 2877 | } |
| 2878 | } |
| 2879 | } |
| 2880 | |
| 2881 | |
| 2882 | |
| 2883 | /* --------------------------------------------------------------------- */ |
| 2884 | /* Function : XGI_SetLVDSRegs */ |
| 2885 | /* Input : */ |
| 2886 | /* Output : */ |
| 2887 | /* Description : */ |
| 2888 | /* --------------------------------------------------------------------- */ |
| 2889 | void XGI_SetLVDSRegs( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 2890 | { |
| 2891 | USHORT tempbx , tempax , tempcx , tempdx , push1 , push2 , modeflag ; |
| 2892 | unsigned long temp , temp1 , temp2 , temp3 , push3 ; |
| 2893 | XGI330_LCDDataDesStruct *LCDPtr = NULL ; |
| 2894 | XGI330_LCDDataDesStruct2 *LCDPtr1 = NULL ; |
| 2895 | |
| 2896 | if ( ModeNo > 0x13 ) |
| 2897 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 2898 | else |
| 2899 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 2900 | |
| 2901 | if ( !( pVBInfo->SetFlag & Win9xDOSMode ) ) |
| 2902 | { |
| 2903 | if ( ( pVBInfo->IF_DEF_CH7017 == 0 ) || ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) |
| 2904 | { |
| 2905 | if ( pVBInfo->IF_DEF_OEMUtil == 1 ) |
| 2906 | { |
| 2907 | tempbx = 8 ; |
| 2908 | LCDPtr = ( XGI330_LCDDataDesStruct * )XGI_GetLcdPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2909 | } |
| 2910 | |
| 2911 | if ( ( pVBInfo->IF_DEF_OEMUtil == 0 ) || ( LCDPtr == 0 ) ) |
| 2912 | { |
| 2913 | tempbx = 3 ; |
| 2914 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 2915 | LCDPtr1 = ( XGI330_LCDDataDesStruct2 * )XGI_GetLcdPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2916 | else |
| 2917 | LCDPtr = ( XGI330_LCDDataDesStruct * )XGI_GetLcdPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2918 | } |
| 2919 | |
| 2920 | XGI_GetLCDSync( &tempax , &tempbx ,pVBInfo) ; |
| 2921 | push1 = tempbx ; |
| 2922 | push2 = tempax ; |
| 2923 | |
| 2924 | /* GetLCDResInfo */ |
| 2925 | if ( ( pVBInfo->LCDResInfo == Panel1024x768 ) || ( pVBInfo->LCDResInfo == Panel1024x768x75 ) ) |
| 2926 | { |
| 2927 | tempax = 1024 ; |
| 2928 | tempbx = 768 ; |
| 2929 | } |
| 2930 | else if ( ( pVBInfo->LCDResInfo == Panel1280x1024 ) || ( pVBInfo->LCDResInfo == Panel1280x1024x75 ) ) |
| 2931 | { |
| 2932 | tempax = 1280 ; |
| 2933 | tempbx = 1024 ; |
| 2934 | } |
| 2935 | else if ( pVBInfo->LCDResInfo == Panel1400x1050 ) |
| 2936 | { |
| 2937 | tempax = 1400 ; |
| 2938 | tempbx = 1050 ; |
| 2939 | } |
| 2940 | else |
| 2941 | { |
| 2942 | tempax = 1600 ; |
| 2943 | tempbx = 1200 ; |
| 2944 | } |
| 2945 | |
| 2946 | if ( pVBInfo->LCDInfo & SetLCDtoNonExpanding ) |
| 2947 | { |
| 2948 | pVBInfo->HDE=tempax; |
| 2949 | pVBInfo->VDE=tempbx; |
| 2950 | pVBInfo->VGAHDE=tempax; |
| 2951 | pVBInfo->VGAVDE=tempbx; |
| 2952 | } |
| 2953 | |
| 2954 | if ( ( pVBInfo->IF_DEF_ScaleLCD == 1 ) && ( pVBInfo->LCDInfo & EnableScalingLCD ) ) |
| 2955 | { |
| 2956 | tempax=pVBInfo->HDE; |
| 2957 | tempbx=pVBInfo->VDE; |
| 2958 | } |
| 2959 | |
| 2960 | tempax = pVBInfo->HT ; |
| 2961 | |
| 2962 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 2963 | tempbx = LCDPtr1->LCDHDES ; |
| 2964 | else |
| 2965 | tempbx = LCDPtr->LCDHDES ; |
| 2966 | |
| 2967 | tempcx = pVBInfo->HDE ; |
| 2968 | tempbx = tempbx & 0x0fff ; |
| 2969 | tempcx += tempbx ; |
| 2970 | |
| 2971 | if ( tempcx >= tempax ) |
| 2972 | tempcx -= tempax ; |
| 2973 | |
| 2974 | XGINew_SetReg1( pVBInfo->Part1Port , 0x1A , tempbx & 0x07 ) ; |
| 2975 | |
| 2976 | tempcx = tempcx >> 3 ; |
| 2977 | tempbx = tempbx >> 3 ; |
| 2978 | |
| 2979 | XGINew_SetReg1( pVBInfo->Part1Port , 0x16 , ( USHORT )( tempbx & 0xff ) ) ; |
| 2980 | XGINew_SetReg1( pVBInfo->Part1Port , 0x17 , ( USHORT )( tempcx & 0xff ) ) ; |
| 2981 | |
| 2982 | tempax = pVBInfo->HT ; |
| 2983 | |
| 2984 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 2985 | tempbx = LCDPtr1->LCDHRS ; |
| 2986 | else |
| 2987 | tempbx = LCDPtr->LCDHRS ; |
| 2988 | |
| 2989 | tempcx = push2 ; |
| 2990 | |
| 2991 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 2992 | tempcx = LCDPtr1->LCDHSync ; |
| 2993 | |
| 2994 | tempcx += tempbx ; |
| 2995 | |
| 2996 | if ( tempcx >= tempax ) |
| 2997 | tempcx -= tempax ; |
| 2998 | |
| 2999 | tempax = tempbx & 0x07 ; |
| 3000 | tempax = tempax >> 5 ; |
| 3001 | tempcx = tempcx >> 3 ; |
| 3002 | tempbx = tempbx >> 3 ; |
| 3003 | |
| 3004 | tempcx &= 0x1f ; |
| 3005 | tempax |= tempcx ; |
| 3006 | |
| 3007 | XGINew_SetReg1( pVBInfo->Part1Port , 0x15 , tempax ) ; |
| 3008 | XGINew_SetReg1( pVBInfo->Part1Port , 0x14 , ( USHORT )( tempbx & 0xff ) ) ; |
| 3009 | |
| 3010 | tempax = pVBInfo->VT ; |
| 3011 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 3012 | tempbx = LCDPtr1->LCDVDES ; |
| 3013 | else |
| 3014 | tempbx = LCDPtr->LCDVDES ; |
| 3015 | tempcx = pVBInfo->VDE ; |
| 3016 | |
| 3017 | tempbx = tempbx & 0x0fff ; |
| 3018 | tempcx += tempbx ; |
| 3019 | if ( tempcx >= tempax ) |
| 3020 | tempcx -= tempax ; |
| 3021 | |
| 3022 | XGINew_SetReg1( pVBInfo->Part1Port , 0x1b , ( USHORT )( tempbx & 0xff ) ) ; |
| 3023 | XGINew_SetReg1( pVBInfo->Part1Port , 0x1c , ( USHORT )( tempcx & 0xff ) ) ; |
| 3024 | |
| 3025 | tempbx = ( tempbx >> 8 ) & 0x07 ; |
| 3026 | tempcx = ( tempcx >> 8 ) & 0x07 ; |
| 3027 | |
| 3028 | XGINew_SetReg1( pVBInfo->Part1Port , 0x1d , ( USHORT )( ( tempcx << 3 ) | tempbx ) ) ; |
| 3029 | |
| 3030 | tempax = pVBInfo->VT ; |
| 3031 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 3032 | tempbx = LCDPtr1->LCDVRS ; |
| 3033 | else |
| 3034 | tempbx = LCDPtr->LCDVRS ; |
| 3035 | |
| 3036 | /* tempbx = tempbx >> 4 ; */ |
| 3037 | tempcx = push1 ; |
| 3038 | |
| 3039 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 3040 | tempcx = LCDPtr1->LCDVSync ; |
| 3041 | |
| 3042 | tempcx += tempbx ; |
| 3043 | if ( tempcx >= tempax ) |
| 3044 | tempcx -= tempax ; |
| 3045 | |
| 3046 | XGINew_SetReg1( pVBInfo->Part1Port , 0x18 , ( USHORT )( tempbx & 0xff ) ) ; |
| 3047 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x19 , ~0x0f , ( USHORT )( tempcx & 0x0f ) ) ; |
| 3048 | |
| 3049 | tempax = ( ( tempbx >> 8 ) & 0x07 ) << 3 ; |
| 3050 | |
| 3051 | tempbx = pVBInfo->VGAVDE ; |
| 3052 | if ( tempbx != pVBInfo->VDE ) |
| 3053 | tempax |= 0x40 ; |
| 3054 | |
| 3055 | if ( pVBInfo->LCDInfo & EnableLVDSDDA ) |
| 3056 | tempax |= 0x40 ; |
| 3057 | |
| 3058 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x1a , 0x07 , tempax ) ; |
| 3059 | |
| 3060 | tempcx = pVBInfo->VGAVT ; |
| 3061 | tempbx = pVBInfo->VDE ; |
| 3062 | tempax = pVBInfo->VGAVDE ; |
| 3063 | tempcx -= tempax ; |
| 3064 | |
| 3065 | temp = tempax ; /* 0430 ylshieh */ |
| 3066 | temp1 = ( temp << 18 ) / tempbx ; |
| 3067 | |
| 3068 | tempdx = ( USHORT )( ( temp << 18 ) % tempbx ) ; |
| 3069 | |
| 3070 | if ( tempdx != 0 ) |
| 3071 | temp1 += 1 ; |
| 3072 | |
| 3073 | temp2 = temp1 ; |
| 3074 | push3 = temp2 ; |
| 3075 | |
| 3076 | XGINew_SetReg1( pVBInfo->Part1Port , 0x37 , ( USHORT )( temp2 & 0xff ) ) ; |
| 3077 | XGINew_SetReg1( pVBInfo->Part1Port , 0x36 , ( USHORT )( ( temp2 >> 8 ) & 0xff ) ) ; |
| 3078 | |
| 3079 | tempbx = ( USHORT )( temp2 >> 16 ) ; |
| 3080 | tempax = tempbx & 0x03 ; |
| 3081 | |
| 3082 | tempbx = pVBInfo->VGAVDE ; |
| 3083 | if ( tempbx == pVBInfo->VDE ) |
| 3084 | tempax |= 0x04 ; |
| 3085 | |
| 3086 | XGINew_SetReg1( pVBInfo->Part1Port , 0x35 , tempax ) ; |
| 3087 | |
| 3088 | if ( pVBInfo->VBType & VB_XGI301C ) |
| 3089 | { |
| 3090 | temp2 = push3 ; |
| 3091 | XGINew_SetReg1( pVBInfo->Part4Port , 0x3c , ( USHORT )( temp2 & 0xff ) ) ; |
| 3092 | XGINew_SetReg1( pVBInfo->Part4Port , 0x3b , ( USHORT )( ( temp2 >> 8 ) & 0xff ) ) ; |
| 3093 | tempbx = ( USHORT )( temp2 >> 16 ) ; |
| 3094 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x3a , ~0xc0 , ( USHORT )( ( tempbx & 0xff ) << 6 ) ) ; |
| 3095 | |
| 3096 | tempcx = pVBInfo->VGAVDE ; |
| 3097 | if ( tempcx == pVBInfo->VDE ) |
| 3098 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x30 , ~0x0c , 0x00 ) ; |
| 3099 | else |
| 3100 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x30 , ~0x0c , 0x08 ) ; |
| 3101 | } |
| 3102 | |
| 3103 | tempcx = pVBInfo->VGAHDE ; |
| 3104 | tempbx = pVBInfo->HDE ; |
| 3105 | |
| 3106 | temp1 = tempcx << 16 ; |
| 3107 | |
| 3108 | tempax = ( USHORT )( temp1 / tempbx ) ; |
| 3109 | |
| 3110 | if ( ( tempbx & 0xffff ) == ( tempcx & 0xffff ) ) |
| 3111 | tempax = 65535 ; |
| 3112 | |
| 3113 | temp3 = tempax ; |
| 3114 | temp1 = pVBInfo->VGAHDE << 16 ; |
| 3115 | |
| 3116 | temp1 /= temp3 ; |
| 3117 | temp3 = temp3 << 16 ; |
| 3118 | temp1 -= 1 ; |
| 3119 | |
| 3120 | temp3 = ( temp3 & 0xffff0000 ) + ( temp1 & 0xffff ) ; |
| 3121 | |
| 3122 | tempax = ( USHORT )( temp3 & 0xff ) ; |
| 3123 | XGINew_SetReg1( pVBInfo->Part1Port , 0x1f , tempax ) ; |
| 3124 | |
| 3125 | temp1 = pVBInfo->VGAVDE << 18 ; |
| 3126 | temp1 = temp1 / push3 ; |
| 3127 | tempbx = ( USHORT )( temp1 & 0xffff ) ; |
| 3128 | |
| 3129 | if ( pVBInfo->LCDResInfo == Panel1024x768 ) |
| 3130 | tempbx -= 1 ; |
| 3131 | |
| 3132 | tempax = ( ( tempbx >> 8 ) & 0xff ) << 3 ; |
| 3133 | tempax |= ( USHORT )( ( temp3 >> 8 ) & 0x07 ) ; |
| 3134 | XGINew_SetReg1( pVBInfo->Part1Port , 0x20 , ( USHORT )( tempax & 0xff ) ) ; |
| 3135 | XGINew_SetReg1( pVBInfo->Part1Port , 0x21 , ( USHORT )( tempbx & 0xff ) ) ; |
| 3136 | |
| 3137 | temp3 = temp3 >> 16 ; |
| 3138 | |
| 3139 | if ( modeflag & HalfDCLK ) |
| 3140 | temp3 = temp3 >> 1 ; |
| 3141 | |
| 3142 | XGINew_SetReg1(pVBInfo->Part1Port , 0x22 , ( USHORT )( ( temp3 >> 8 ) & 0xff ) ) ; |
| 3143 | XGINew_SetReg1(pVBInfo->Part1Port , 0x23 , ( USHORT )( temp3 & 0xff ) ) ; |
| 3144 | } |
| 3145 | } |
| 3146 | } |
| 3147 | |
| 3148 | |
| 3149 | /* --------------------------------------------------------------------- */ |
| 3150 | /* Function : XGI_SetCRT2ECLK */ |
| 3151 | /* Input : */ |
| 3152 | /* Output : */ |
| 3153 | /* Description : */ |
| 3154 | /* --------------------------------------------------------------------- */ |
| 3155 | void XGI_SetCRT2ECLK( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 3156 | { |
| 3157 | UCHAR di_0 , di_1 , tempal ; |
| 3158 | int i ; |
| 3159 | |
| 3160 | tempal = XGI_GetVCLKPtr( RefreshRateTableIndex , ModeNo , ModeIdIndex, pVBInfo ) ; |
| 3161 | XGI_GetVCLKLen( tempal , &di_0 , &di_1, pVBInfo ) ; |
| 3162 | XGI_GetLCDVCLKPtr( &di_0 , &di_1, pVBInfo ) ; |
| 3163 | |
| 3164 | for( i = 0 ; i < 4 ; i++ ) |
| 3165 | { |
| 3166 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x31 , ~0x30 , ( USHORT )( 0x10 * i ) ) ; |
| 3167 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 3168 | { |
| 3169 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2b , di_0 ) ; |
| 3170 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2c , di_1 ) ; |
| 3171 | } |
| 3172 | else if ( ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) && ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) ) |
| 3173 | { |
| 3174 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2e , di_0 ) ; |
| 3175 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2f , di_1 ) ; |
| 3176 | } |
| 3177 | else |
| 3178 | { |
| 3179 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2b , di_0 ) ; |
| 3180 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2c , di_1 ) ; |
| 3181 | } |
| 3182 | } |
| 3183 | } |
| 3184 | |
| 3185 | |
| 3186 | /* --------------------------------------------------------------------- */ |
| 3187 | /* Function : XGI_UpdateModeInfo */ |
| 3188 | /* Input : */ |
| 3189 | /* Output : */ |
| 3190 | /* Description : */ |
| 3191 | /* --------------------------------------------------------------------- */ |
| 3192 | void XGI_UpdateModeInfo( PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo ) |
| 3193 | { |
| 3194 | USHORT tempcl , |
| 3195 | tempch , |
| 3196 | temp , |
| 3197 | tempbl , |
| 3198 | tempax ; |
| 3199 | |
| 3200 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 3201 | { |
| 3202 | tempcl = 0 ; |
| 3203 | tempch = 0 ; |
| 3204 | temp = XGINew_GetReg1( pVBInfo->P3c4 , 0x01 ) ; |
| 3205 | |
| 3206 | if ( !( temp & 0x20 ) ) |
| 3207 | { |
| 3208 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x17 ) ; |
| 3209 | if ( temp & 0x80 ) |
| 3210 | { |
| 3211 | if ( ( HwDeviceExtension->jChipType >= XG20 ) || ( HwDeviceExtension->jChipType >= XG40 ) ) |
| 3212 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x53 ) ; |
| 3213 | else |
| 3214 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x63 ) ; |
| 3215 | |
| 3216 | if ( !( temp & 0x40 ) ) |
| 3217 | tempcl |= ActiveCRT1 ; |
| 3218 | } |
| 3219 | } |
| 3220 | |
| 3221 | temp = XGINew_GetReg1( pVBInfo->Part1Port , 0x2e ) ; |
| 3222 | temp &= 0x0f ; |
| 3223 | |
| 3224 | if ( !( temp == 0x08 ) ) |
| 3225 | { |
| 3226 | tempax = XGINew_GetReg1( pVBInfo->Part1Port , 0x13 ) ; /* Check ChannelA by Part1_13 [2003/10/03] */ |
| 3227 | if ( tempax & 0x04 ) |
| 3228 | tempcl = tempcl | ActiveLCD ; |
| 3229 | |
| 3230 | temp &= 0x05 ; |
| 3231 | |
| 3232 | if ( !( tempcl & ActiveLCD ) ) |
| 3233 | if ( temp == 0x01 ) |
| 3234 | tempcl |= ActiveCRT2 ; |
| 3235 | |
| 3236 | if ( temp == 0x04 ) |
| 3237 | tempcl |= ActiveLCD ; |
| 3238 | |
| 3239 | if ( temp == 0x05 ) |
| 3240 | { |
| 3241 | temp = XGINew_GetReg1( pVBInfo->Part2Port , 0x00 ) ; |
| 3242 | |
| 3243 | if( !( temp & 0x08 ) ) |
| 3244 | tempch |= ActiveAVideo ; |
| 3245 | |
| 3246 | if ( !( temp & 0x04 ) ) |
| 3247 | tempch |= ActiveSVideo ; |
| 3248 | |
| 3249 | if ( temp & 0x02 ) |
| 3250 | tempch |= ActiveSCART ; |
| 3251 | |
| 3252 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 3253 | { |
| 3254 | if ( temp & 0x01 ) |
| 3255 | tempch |= ActiveHiTV ; |
| 3256 | } |
| 3257 | |
| 3258 | if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) |
| 3259 | { |
| 3260 | temp = XGINew_GetReg1( pVBInfo->Part2Port , 0x4d ) ; |
| 3261 | |
| 3262 | if ( temp & 0x10 ) |
| 3263 | tempch |= ActiveYPbPr ; |
| 3264 | } |
| 3265 | |
| 3266 | if ( tempch != 0 ) |
| 3267 | tempcl |= ActiveTV ; |
| 3268 | } |
| 3269 | } |
| 3270 | |
| 3271 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x3d ) ; |
| 3272 | if ( tempcl & ActiveLCD ) |
| 3273 | { |
| 3274 | if ( ( pVBInfo->SetFlag & ReserveTVOption ) ) |
| 3275 | { |
| 3276 | if ( temp & ActiveTV ) |
| 3277 | tempcl |= ActiveTV ; |
| 3278 | } |
| 3279 | } |
| 3280 | temp = tempcl ; |
| 3281 | tempbl = ~ModeSwitchStatus ; |
| 3282 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x3d , tempbl , temp ) ; |
| 3283 | |
| 3284 | if ( !( pVBInfo->SetFlag & ReserveTVOption ) ) |
| 3285 | XGINew_SetReg1( pVBInfo->P3d4 , 0x3e , tempch ) ; |
| 3286 | } |
| 3287 | else |
| 3288 | { |
| 3289 | return ; |
| 3290 | } |
| 3291 | } |
| 3292 | |
| 3293 | |
| 3294 | /* --------------------------------------------------------------------- */ |
| 3295 | /* Function : XGI_GetVGAType */ |
| 3296 | /* Input : */ |
| 3297 | /* Output : */ |
| 3298 | /* Description : */ |
| 3299 | /* --------------------------------------------------------------------- */ |
| 3300 | void XGI_GetVGAType( PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo) |
| 3301 | { |
| 3302 | /* |
| 3303 | if ( HwDeviceExtension->jChipType >= XG20 ) |
| 3304 | { |
| 3305 | pVBInfo->Set_VGAType = XG20; |
| 3306 | } |
| 3307 | else if ( HwDeviceExtension->jChipType >= XG40 ) |
| 3308 | { |
| 3309 | pVBInfo->Set_VGAType = VGA_XGI340 ; |
| 3310 | } |
| 3311 | */ |
| 3312 | pVBInfo->Set_VGAType = HwDeviceExtension->jChipType; |
| 3313 | } |
| 3314 | |
| 3315 | |
| 3316 | /* --------------------------------------------------------------------- */ |
| 3317 | /* Function : XGI_GetVBType */ |
| 3318 | /* Input : */ |
| 3319 | /* Output : */ |
| 3320 | /* Description : */ |
| 3321 | /* --------------------------------------------------------------------- */ |
| 3322 | void XGI_GetVBType(PVB_DEVICE_INFO pVBInfo) |
| 3323 | { |
| 3324 | USHORT flag , tempbx , tempah ; |
| 3325 | |
| 3326 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 3327 | { |
| 3328 | pVBInfo->VBType = VB_CH7007 ; |
| 3329 | return; |
| 3330 | } |
| 3331 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3332 | { |
| 3333 | tempbx = VB_XGI302B ; |
| 3334 | flag = XGINew_GetReg1( pVBInfo->Part4Port , 0x00 ) ; |
| 3335 | if ( flag != 0x02 ) |
| 3336 | { |
| 3337 | tempbx = VB_XGI301 ; |
| 3338 | flag = XGINew_GetReg1( pVBInfo->Part4Port , 0x01 ) ; |
| 3339 | if ( flag >= 0xB0 ) |
| 3340 | { |
| 3341 | tempbx = VB_XGI301B ; |
| 3342 | if ( flag >= 0xC0 ) |
| 3343 | { |
| 3344 | tempbx = VB_XGI301C ; |
| 3345 | if ( flag >= 0xD0 ) |
| 3346 | { |
| 3347 | tempbx = VB_XGI301LV ; |
| 3348 | if ( flag >= 0xE0 ) |
| 3349 | { |
| 3350 | tempbx = VB_XGI302LV ; |
| 3351 | tempah = XGINew_GetReg1( pVBInfo->Part4Port , 0x39 ) ; |
| 3352 | if ( tempah != 0xFF ) |
| 3353 | tempbx = VB_XGI301C ; |
| 3354 | } |
| 3355 | } |
| 3356 | } |
| 3357 | |
| 3358 | if ( tempbx & ( VB_XGI301B | VB_XGI302B ) ) |
| 3359 | { |
| 3360 | flag = XGINew_GetReg1( pVBInfo->Part4Port , 0x23 ) ; |
| 3361 | |
| 3362 | if ( !( flag & 0x02 ) ) |
| 3363 | tempbx = tempbx | VB_NoLCD ; |
| 3364 | } |
| 3365 | } |
| 3366 | } |
| 3367 | pVBInfo->VBType = tempbx ; |
| 3368 | } |
| 3369 | /* |
| 3370 | else if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 3371 | pVBInfo->VBType = VB_CH7017 ; |
| 3372 | else //LVDS |
| 3373 | pVBInfo->VBType = VB_LVDS_NS ; |
| 3374 | */ |
| 3375 | |
| 3376 | } |
| 3377 | |
| 3378 | |
| 3379 | /* --------------------------------------------------------------------- */ |
| 3380 | /* Function : XGI_GetVBInfo */ |
| 3381 | /* Input : */ |
| 3382 | /* Output : */ |
| 3383 | /* Description : */ |
| 3384 | /* --------------------------------------------------------------------- */ |
| 3385 | void XGI_GetVBInfo( USHORT ModeNo , USHORT ModeIdIndex , PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo ) |
| 3386 | { |
| 3387 | USHORT tempax , |
| 3388 | push , |
| 3389 | tempbx , |
| 3390 | temp , |
| 3391 | modeflag ; |
| 3392 | |
| 3393 | if ( ModeNo <= 0x13 ) |
| 3394 | { |
| 3395 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 3396 | } |
| 3397 | else |
| 3398 | { |
| 3399 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 3400 | } |
| 3401 | |
| 3402 | pVBInfo->SetFlag = 0 ; |
| 3403 | pVBInfo->ModeType = modeflag & ModeInfoFlag ; |
| 3404 | tempbx = 0 ; |
| 3405 | |
| 3406 | if ( pVBInfo->VBType & 0xFFFF ) |
| 3407 | { |
| 3408 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x30 ) ; /* Check Display Device */ |
| 3409 | tempbx = tempbx | temp ; |
| 3410 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x31 ) ; |
| 3411 | push = temp ; |
| 3412 | push = push << 8 ; |
| 3413 | tempax = temp << 8 ; |
| 3414 | tempbx = tempbx | tempax ; |
| 3415 | temp = ( SetCRT2ToDualEdge | SetCRT2ToYPbPr | SetCRT2ToLCDA | SetInSlaveMode | DisableCRT2Display ) ; |
| 3416 | temp = 0xFFFF ^ temp ; |
| 3417 | tempbx &= temp ; |
| 3418 | |
| 3419 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) ; |
| 3420 | |
| 3421 | if ( pVBInfo->IF_DEF_LCDA == 1 ) |
| 3422 | { |
| 3423 | |
| 3424 | if ( ( pVBInfo->Set_VGAType >= XG20 ) || ( pVBInfo->Set_VGAType >= XG40 )) |
| 3425 | { |
| 3426 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3427 | { |
| 3428 | /* if ( ( pVBInfo->VBType & VB_XGI302B ) || ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) || ( pVBInfo->VBType & VB_XGI301C ) ) */ |
| 3429 | if ( pVBInfo->VBType & ( VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 3430 | { |
| 3431 | if ( temp & EnableDualEdge ) |
| 3432 | { |
| 3433 | tempbx |= SetCRT2ToDualEdge ; |
| 3434 | |
| 3435 | if ( temp & SetToLCDA ) |
| 3436 | tempbx |= SetCRT2ToLCDA ; |
| 3437 | } |
| 3438 | } |
| 3439 | } |
| 3440 | else if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 3441 | { |
| 3442 | if ( pVBInfo->VBType & VB_CH7017 ) |
| 3443 | { |
| 3444 | if ( temp & EnableDualEdge ) |
| 3445 | { |
| 3446 | tempbx |= SetCRT2ToDualEdge ; |
| 3447 | |
| 3448 | if ( temp & SetToLCDA ) |
| 3449 | tempbx |= SetCRT2ToLCDA ; |
| 3450 | } |
| 3451 | } |
| 3452 | } |
| 3453 | } |
| 3454 | } |
| 3455 | |
| 3456 | if ( pVBInfo->IF_DEF_YPbPr == 1 ) |
| 3457 | { |
| 3458 | if ( ( ( pVBInfo->IF_DEF_LVDS == 0 ) && ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) || ( pVBInfo->VBType & VB_XGI301C ) ) ) |
| 3459 | || ( ( pVBInfo->IF_DEF_CH7017 == 1 ) && ( pVBInfo->VBType&VB_CH7017 ) ) || ( (pVBInfo->IF_DEF_CH7007 == 1) && (pVBInfo->VBType&VB_CH7007) ) ) /* [Billy] 07/05/04 */ |
| 3460 | { |
| 3461 | if ( temp & SetYPbPr ) /* temp = CR38 */ |
| 3462 | { |
| 3463 | if ( pVBInfo->IF_DEF_HiVision == 1 ) |
| 3464 | { |
| 3465 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ; /* shampoo add for new scratch */ |
| 3466 | temp &= YPbPrMode ; |
| 3467 | tempbx |= SetCRT2ToHiVisionTV ; |
| 3468 | |
| 3469 | if ( temp != YPbPrMode1080i ) { |
| 3470 | tempbx &= ( ~SetCRT2ToHiVisionTV ) ; |
| 3471 | tempbx |= SetCRT2ToYPbPr ; } |
| 3472 | } |
| 3473 | |
| 3474 | /* tempbx |= SetCRT2ToYPbPr ; */ |
| 3475 | } |
| 3476 | } |
| 3477 | } |
| 3478 | |
| 3479 | tempax = push ; /* restore CR31 */ |
| 3480 | |
| 3481 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3482 | { |
| 3483 | if ( pVBInfo->IF_DEF_YPbPr == 1 ) |
| 3484 | { |
| 3485 | if ( pVBInfo->IF_DEF_HiVision == 1 ) |
| 3486 | temp = 0x09FC ; |
| 3487 | else |
| 3488 | temp = 0x097C ; |
| 3489 | } |
| 3490 | else |
| 3491 | { |
| 3492 | if ( pVBInfo->IF_DEF_HiVision == 1 ) |
| 3493 | temp = 0x01FC ; |
| 3494 | else |
| 3495 | temp = 0x017C ; |
| 3496 | } |
| 3497 | } |
| 3498 | else /* 3nd party chip */ |
| 3499 | { |
| 3500 | if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 3501 | temp = ( SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToLCDA ) ; |
| 3502 | else if ( pVBInfo->IF_DEF_CH7007 == 1 ) /* [Billy] 07/05/03 */ |
| 3503 | { |
| 3504 | temp = SetCRT2ToTV ; |
| 3505 | } |
| 3506 | else |
| 3507 | temp = SetCRT2ToLCD ; |
| 3508 | } |
| 3509 | |
| 3510 | if ( !( tempbx & temp ) ) |
| 3511 | { |
| 3512 | tempax |= DisableCRT2Display ; |
| 3513 | tempbx = 0 ; |
| 3514 | } |
| 3515 | |
| 3516 | if ( pVBInfo->IF_DEF_LCDA == 1 ) /* Select Display Device */ |
| 3517 | { |
| 3518 | if ( !( pVBInfo->VBType & VB_NoLCD ) ) |
| 3519 | { |
| 3520 | if ( tempbx & SetCRT2ToLCDA ) |
| 3521 | { |
| 3522 | if ( tempbx & SetSimuScanMode ) |
| 3523 | tempbx &= ( ~( SetCRT2ToLCD | SetCRT2ToRAMDAC | SwitchToCRT2 ) ) ; |
| 3524 | else |
| 3525 | tempbx &= ( ~( SetCRT2ToLCD | SetCRT2ToRAMDAC | SetCRT2ToTV | SwitchToCRT2 ) ) ; |
| 3526 | } |
| 3527 | } |
| 3528 | } |
| 3529 | |
| 3530 | /* shampoo add */ |
| 3531 | if ( !( tempbx & ( SwitchToCRT2 | SetSimuScanMode ) ) ) /* for driver abnormal */ |
| 3532 | { |
| 3533 | if ( pVBInfo->IF_DEF_CRT2Monitor == 1 ) |
| 3534 | { |
| 3535 | if ( tempbx & SetCRT2ToRAMDAC ) |
| 3536 | { |
| 3537 | tempbx &= ( 0xFF00 | SetCRT2ToRAMDAC | SwitchToCRT2 | SetSimuScanMode ) ; |
| 3538 | tempbx &= ( 0x00FF | ( ~SetCRT2ToYPbPr ) ) ; |
| 3539 | } |
| 3540 | } |
| 3541 | else |
| 3542 | tempbx &= ( ~( SetCRT2ToRAMDAC | SetCRT2ToLCD | SetCRT2ToTV ) ) ; |
| 3543 | } |
| 3544 | |
| 3545 | if ( !( pVBInfo->VBType & VB_NoLCD ) ) |
| 3546 | { |
| 3547 | if ( tempbx & SetCRT2ToLCD ) |
| 3548 | { |
| 3549 | tempbx &= ( 0xFF00 | SetCRT2ToLCD | SwitchToCRT2 | SetSimuScanMode ) ; |
| 3550 | tempbx &= ( 0x00FF | ( ~SetCRT2ToYPbPr ) ) ; |
| 3551 | } |
| 3552 | } |
| 3553 | |
| 3554 | if ( tempbx & SetCRT2ToSCART ) |
| 3555 | { |
| 3556 | tempbx &= ( 0xFF00 | SetCRT2ToSCART | SwitchToCRT2 | SetSimuScanMode ) ; |
| 3557 | tempbx &= ( 0x00FF | ( ~SetCRT2ToYPbPr ) ) ; |
| 3558 | } |
| 3559 | |
| 3560 | if ( pVBInfo->IF_DEF_YPbPr == 1 ) |
| 3561 | { |
| 3562 | if ( tempbx & SetCRT2ToYPbPr ) |
| 3563 | tempbx &= ( 0xFF00 | SwitchToCRT2 | SetSimuScanMode ) ; |
| 3564 | } |
| 3565 | |
| 3566 | if ( pVBInfo->IF_DEF_HiVision == 1 ) |
| 3567 | { |
| 3568 | if ( tempbx & SetCRT2ToHiVisionTV ) |
| 3569 | tempbx &= ( 0xFF00 | SetCRT2ToHiVisionTV | SwitchToCRT2 | SetSimuScanMode ) ; |
| 3570 | } |
| 3571 | |
| 3572 | if ( tempax & DisableCRT2Display ) /* Set Display Device Info */ |
| 3573 | { |
| 3574 | if ( !( tempbx & ( SwitchToCRT2 | SetSimuScanMode ) ) ) |
| 3575 | tempbx = DisableCRT2Display ; |
| 3576 | } |
| 3577 | |
| 3578 | if ( !( tempbx & DisableCRT2Display ) ) |
| 3579 | { |
| 3580 | if ( ( !( tempbx & DriverMode ) ) || ( !( modeflag & CRT2Mode ) ) ) |
| 3581 | { |
| 3582 | if ( pVBInfo->IF_DEF_LCDA == 1 ) |
| 3583 | { |
| 3584 | if ( !( tempbx & SetCRT2ToLCDA ) ) |
| 3585 | tempbx |= ( SetInSlaveMode | SetSimuScanMode ) ; |
| 3586 | } |
| 3587 | |
| 3588 | if ( pVBInfo->IF_DEF_VideoCapture == 1 ) |
| 3589 | { |
| 3590 | if ( ( ( HwDeviceExtension->jChipType == XG40 ) && ( pVBInfo->Set_VGAType == XG40 ) ) |
| 3591 | || ( ( HwDeviceExtension->jChipType == XG41 ) && ( pVBInfo->Set_VGAType == XG41 ) ) |
| 3592 | || ( ( HwDeviceExtension->jChipType == XG42 ) && ( pVBInfo->Set_VGAType == XG42 ) ) |
| 3593 | || ( ( HwDeviceExtension->jChipType == XG45 ) && ( pVBInfo->Set_VGAType == XG45 ) ) ) |
| 3594 | { |
| 3595 | if ( ModeNo <= 13 ) |
| 3596 | { |
| 3597 | if ( !( tempbx & SetCRT2ToRAMDAC ) ) /*CRT2 not need to support*/ |
| 3598 | { |
| 3599 | tempbx &= ( 0x00FF | ( ~SetInSlaveMode ) ) ; |
| 3600 | pVBInfo->SetFlag |= EnableVCMode ; |
| 3601 | } |
| 3602 | } |
| 3603 | } |
| 3604 | } |
| 3605 | } |
| 3606 | |
| 3607 | /*LCD+TV can't support in slave mode (Force LCDA+TV->LCDB)*/ |
| 3608 | if ( ( tempbx & SetInSlaveMode ) && ( tempbx & SetCRT2ToLCDA ) ) |
| 3609 | { |
| 3610 | tempbx ^= ( SetCRT2ToLCD | SetCRT2ToLCDA | SetCRT2ToDualEdge ) ; |
| 3611 | pVBInfo->SetFlag |= ReserveTVOption ; |
| 3612 | } |
| 3613 | } |
| 3614 | } |
| 3615 | |
| 3616 | pVBInfo->VBInfo = tempbx ; |
| 3617 | } |
| 3618 | |
| 3619 | |
| 3620 | /* --------------------------------------------------------------------- */ |
| 3621 | /* Function : XGI_GetTVInfo */ |
| 3622 | /* Input : */ |
| 3623 | /* Output : */ |
| 3624 | /* Description : */ |
| 3625 | /* --------------------------------------------------------------------- */ |
| 3626 | void XGI_GetTVInfo( USHORT ModeNo , USHORT ModeIdIndex ,PVB_DEVICE_INFO pVBInfo ) |
| 3627 | { |
| 3628 | USHORT temp , |
| 3629 | tempbx = 0 , |
| 3630 | resinfo = 0 , |
| 3631 | modeflag , |
| 3632 | index1 ; |
| 3633 | |
| 3634 | tempbx = 0 ; |
| 3635 | resinfo = 0 ; |
| 3636 | |
| 3637 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 3638 | { |
| 3639 | if ( ModeNo <= 0x13 ) |
| 3640 | { |
| 3641 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ModeFlag */ |
| 3642 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; /* si+St_ResInfo */ |
| 3643 | } |
| 3644 | else |
| 3645 | { |
| 3646 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 3647 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo */ |
| 3648 | } |
| 3649 | |
| 3650 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 3651 | { |
| 3652 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ; |
| 3653 | tempbx = temp; |
| 3654 | if ( tempbx & SetPALTV ) |
| 3655 | { |
| 3656 | tempbx &= ( SetCHTVOverScan | SetPALMTV | SetPALNTV | SetPALTV ) ; |
| 3657 | if ( tempbx & SetPALMTV ) |
| 3658 | tempbx &= ~SetPALTV ; /* set to NTSC if PAL-M */ |
| 3659 | } |
| 3660 | else |
| 3661 | tempbx &= ( SetCHTVOverScan | SetNTSCJ | SetPALTV ) ; |
| 3662 | /* |
| 3663 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3664 | { |
| 3665 | index1 = XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) ; //PAL-M/PAL-N Info |
| 3666 | temp2 = ( index1 & 0xC0 ) >> 5 ; //00:PAL, 01:PAL-M, 10:PAL-N |
| 3667 | tempbx |= temp2 ; |
| 3668 | if ( temp2 & 0x02 ) //PAL-M |
| 3669 | tempbx &= ( ~SetPALTV ) ; |
| 3670 | } |
| 3671 | */ |
| 3672 | } |
| 3673 | |
| 3674 | if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 3675 | { |
| 3676 | tempbx = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ; |
| 3677 | |
| 3678 | if ( tempbx & TVOverScan ) |
| 3679 | tempbx |= SetCHTVOverScan ; |
| 3680 | } |
| 3681 | |
| 3682 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) /* [Billy] 07/05/04 */ |
| 3683 | { |
| 3684 | tempbx = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ; |
| 3685 | |
| 3686 | if ( tempbx & TVOverScan ) |
| 3687 | { |
| 3688 | tempbx |= SetCHTVOverScan ; |
| 3689 | } |
| 3690 | } |
| 3691 | |
| 3692 | |
| 3693 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3694 | { |
| 3695 | if ( pVBInfo->VBInfo & SetCRT2ToSCART ) |
| 3696 | tempbx |= SetPALTV ; |
| 3697 | } |
| 3698 | |
| 3699 | if ( pVBInfo->IF_DEF_YPbPr == 1 ) |
| 3700 | { |
| 3701 | if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) |
| 3702 | { |
| 3703 | index1 = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ; |
| 3704 | index1 &= YPbPrMode ; |
| 3705 | |
| 3706 | if ( index1 == YPbPrMode525i ) |
| 3707 | tempbx |= SetYPbPrMode525i ; |
| 3708 | |
| 3709 | if ( index1 == YPbPrMode525p ) |
| 3710 | tempbx = tempbx | SetYPbPrMode525p; |
| 3711 | if ( index1 == YPbPrMode750p) |
| 3712 | tempbx = tempbx | SetYPbPrMode750p; |
| 3713 | } |
| 3714 | } |
| 3715 | |
| 3716 | if ( pVBInfo->IF_DEF_HiVision == 1 ) |
| 3717 | { |
| 3718 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 3719 | { |
| 3720 | tempbx = tempbx | SetYPbPrMode1080i | SetPALTV ; |
| 3721 | } |
| 3722 | } |
| 3723 | |
| 3724 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3725 | { /* shampoo */ |
| 3726 | if ( ( pVBInfo->VBInfo & SetInSlaveMode ) && ( !( pVBInfo->VBInfo & SetNotSimuMode ) ) ) |
| 3727 | tempbx |= TVSimuMode ; |
| 3728 | |
| 3729 | if ( !( tempbx & SetPALTV ) && ( modeflag > 13 ) && ( resinfo == 8 ) ) /* NTSC 1024x768, */ |
| 3730 | tempbx |= NTSC1024x768 ; |
| 3731 | |
| 3732 | tempbx |= RPLLDIV2XO ; |
| 3733 | |
| 3734 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 3735 | { |
| 3736 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 3737 | tempbx &=( ~RPLLDIV2XO ) ; |
| 3738 | } |
| 3739 | else |
| 3740 | { |
| 3741 | if ( tempbx & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) |
| 3742 | tempbx &= ( ~RPLLDIV2XO ) ; |
| 3743 | else if ( !( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) ) |
| 3744 | { |
| 3745 | if ( tempbx & TVSimuMode ) |
| 3746 | tempbx &= ( ~RPLLDIV2XO ) ; |
| 3747 | } |
| 3748 | } |
| 3749 | } |
| 3750 | } |
| 3751 | pVBInfo->TVInfo = tempbx ; |
| 3752 | } |
| 3753 | |
| 3754 | |
| 3755 | /* --------------------------------------------------------------------- */ |
| 3756 | /* Function : XGI_GetLCDInfo */ |
| 3757 | /* Input : */ |
| 3758 | /* Output : */ |
| 3759 | /* Description : */ |
| 3760 | /* --------------------------------------------------------------------- */ |
| 3761 | BOOLEAN XGI_GetLCDInfo( USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo) |
| 3762 | { |
| 3763 | USHORT temp , |
| 3764 | tempax , |
| 3765 | tempbx , |
| 3766 | modeflag , |
| 3767 | resinfo = 0 , |
| 3768 | LCDIdIndex ; |
| 3769 | |
| 3770 | pVBInfo->LCDResInfo = 0 ; |
| 3771 | pVBInfo->LCDTypeInfo = 0 ; |
| 3772 | pVBInfo->LCDInfo = 0 ; |
| 3773 | |
| 3774 | if ( ModeNo <= 0x13 ) |
| 3775 | { |
| 3776 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ModeFlag // */ |
| 3777 | } |
| 3778 | else |
| 3779 | { |
| 3780 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 3781 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo// */ |
| 3782 | } |
| 3783 | |
| 3784 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x36 ) ; /* Get LCD Res.Info */ |
| 3785 | tempbx = temp & 0x0F ; |
| 3786 | |
| 3787 | if ( tempbx == 0 ) |
| 3788 | tempbx = Panel1024x768 ; /* default */ |
| 3789 | |
| 3790 | /* LCD75 [2003/8/22] Vicent */ |
| 3791 | if ( ( tempbx == Panel1024x768 ) || ( tempbx == Panel1280x1024 ) ) |
| 3792 | { |
| 3793 | if ( pVBInfo->VBInfo & DriverMode ) |
| 3794 | { |
| 3795 | tempax = XGINew_GetReg1( pVBInfo->P3d4 , 0x33 ) ; |
| 3796 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 3797 | tempax &= 0x0F ; |
| 3798 | else |
| 3799 | tempax = tempax >> 4 ; |
| 3800 | |
| 3801 | if ( ( resinfo == 6 ) || ( resinfo == 9 ) ) |
| 3802 | { |
| 3803 | if ( tempax >= 3 ) |
| 3804 | tempbx |= PanelRef75Hz ; |
| 3805 | } |
| 3806 | else if ( ( resinfo == 7 ) || ( resinfo == 8 ) ) |
| 3807 | { |
| 3808 | if ( tempax >= 4 ) |
| 3809 | tempbx |= PanelRef75Hz ; |
| 3810 | } |
| 3811 | } |
| 3812 | } |
| 3813 | |
| 3814 | pVBInfo->LCDResInfo = tempbx ; |
| 3815 | |
| 3816 | /* End of LCD75 */ |
| 3817 | |
| 3818 | if( pVBInfo->IF_DEF_OEMUtil == 1 ) |
| 3819 | { |
| 3820 | pVBInfo->LCDTypeInfo = ( temp & 0xf0 ) >> 4 ; |
| 3821 | } |
| 3822 | |
| 3823 | if ( !( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) |
| 3824 | { |
| 3825 | return 0; |
| 3826 | } |
| 3827 | |
| 3828 | tempbx = 0 ; |
| 3829 | |
| 3830 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; |
| 3831 | |
| 3832 | temp &= ( ScalingLCD | LCDNonExpanding | LCDSyncBit | SetPWDEnable ) ; |
| 3833 | |
| 3834 | if ( ( pVBInfo->IF_DEF_ScaleLCD == 1 ) && ( temp & LCDNonExpanding ) ) |
| 3835 | temp &= ~EnableScalingLCD ; |
| 3836 | |
| 3837 | tempbx |= temp ; |
| 3838 | |
| 3839 | LCDIdIndex = XGI_GetLCDCapPtr1(pVBInfo) ; |
| 3840 | |
| 3841 | tempax = pVBInfo->LCDCapList[ LCDIdIndex ].LCD_Capability ; |
| 3842 | |
| 3843 | if ( pVBInfo->IF_DEF_LVDS == 0 ) /* shampoo */ |
| 3844 | { |
| 3845 | if ( ( ( pVBInfo->VBType & VB_XGI302LV ) || ( pVBInfo->VBType & VB_XGI301C ) ) && ( tempax & LCDDualLink ) ) |
| 3846 | { |
| 3847 | tempbx |= SetLCDDualLink ; |
| 3848 | } |
| 3849 | } |
| 3850 | |
| 3851 | if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 3852 | { |
| 3853 | if ( tempax & LCDDualLink ) |
| 3854 | { |
| 3855 | tempbx |= SetLCDDualLink ; |
| 3856 | } |
| 3857 | } |
| 3858 | |
| 3859 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3860 | { |
| 3861 | if ( ( pVBInfo->LCDResInfo == Panel1400x1050 ) && ( pVBInfo->VBInfo & SetCRT2ToLCD ) && ( ModeNo > 0x13 ) && ( resinfo == 9 ) && ( !( tempbx & EnableScalingLCD ) ) ) |
| 3862 | tempbx |= SetLCDtoNonExpanding ; /* set to center in 1280x1024 LCDB for Panel1400x1050 */ |
| 3863 | } |
| 3864 | |
| 3865 | /* |
| 3866 | if ( tempax & LCDBToA ) |
| 3867 | { |
| 3868 | tempbx |= SetLCDBToA ; |
| 3869 | } |
| 3870 | */ |
| 3871 | |
| 3872 | if ( pVBInfo->IF_DEF_ExpLink == 1 ) |
| 3873 | { |
| 3874 | if ( modeflag & HalfDCLK ) |
| 3875 | { |
| 3876 | /* if ( !( pVBInfo->LCDInfo&LCDNonExpanding ) ) */ |
| 3877 | if ( !( tempbx & SetLCDtoNonExpanding ) ) |
| 3878 | { |
| 3879 | tempbx |= EnableLVDSDDA ; |
| 3880 | } |
| 3881 | else |
| 3882 | { |
| 3883 | if ( ModeNo > 0x13 ) |
| 3884 | { |
| 3885 | if ( pVBInfo->LCDResInfo == Panel1024x768 ) |
| 3886 | { |
| 3887 | if ( resinfo == 4 ) |
| 3888 | { /* 512x384 */ |
| 3889 | tempbx |= EnableLVDSDDA ; |
| 3890 | } |
| 3891 | } |
| 3892 | } |
| 3893 | } |
| 3894 | } |
| 3895 | } |
| 3896 | |
| 3897 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 3898 | { |
| 3899 | if ( pVBInfo->VBInfo & SetNotSimuMode ) |
| 3900 | { |
| 3901 | tempbx |= LCDVESATiming ; |
| 3902 | } |
| 3903 | } |
| 3904 | else |
| 3905 | { |
| 3906 | tempbx |= LCDVESATiming ; |
| 3907 | } |
| 3908 | |
| 3909 | pVBInfo->LCDInfo = tempbx ; |
| 3910 | |
| 3911 | if ( pVBInfo->IF_DEF_PWD == 1 ) |
| 3912 | { |
| 3913 | if ( pVBInfo->LCDInfo & SetPWDEnable ) |
| 3914 | { |
| 3915 | if ( ( pVBInfo->VBType & VB_XGI302LV ) || ( pVBInfo->VBType & VB_XGI301C ) ) |
| 3916 | { |
| 3917 | if ( !( tempax & PWDEnable ) ) |
| 3918 | { |
| 3919 | pVBInfo->LCDInfo &= ~SetPWDEnable ; |
| 3920 | } |
| 3921 | } |
| 3922 | } |
| 3923 | } |
| 3924 | |
| 3925 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3926 | { |
| 3927 | if ( tempax & ( LockLCDBToA | StLCDBToA ) ) |
| 3928 | { |
| 3929 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 3930 | { |
| 3931 | if ( !( tempax & LockLCDBToA ) ) |
| 3932 | { |
| 3933 | if ( ModeNo <= 0x13 ) |
| 3934 | { |
| 3935 | pVBInfo->VBInfo &= ~( SetSimuScanMode | SetInSlaveMode | SetCRT2ToLCD ) ; |
| 3936 | pVBInfo->VBInfo |= SetCRT2ToLCDA | SetCRT2ToDualEdge ; |
| 3937 | } |
| 3938 | } |
| 3939 | } |
| 3940 | } |
| 3941 | } |
| 3942 | |
| 3943 | /* |
| 3944 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3945 | { |
| 3946 | if ( tempax & ( LockLCDBToA | StLCDBToA ) ) |
| 3947 | { |
| 3948 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 3949 | { |
| 3950 | if ( !( ( !( tempax & LockLCDBToA ) ) && ( ModeNo > 0x13 ) ) ) |
| 3951 | { |
| 3952 | pVBInfo->VBInfo&=~(SetSimuScanMode|SetInSlaveMode|SetCRT2ToLCD); |
| 3953 | pVBInfo->VBInfo|=SetCRT2ToLCDA|SetCRT2ToDualEdge; |
| 3954 | } |
| 3955 | } |
| 3956 | } |
| 3957 | } |
| 3958 | */ |
| 3959 | |
| 3960 | return( 1 ) ; |
| 3961 | } |
| 3962 | |
| 3963 | |
| 3964 | /* --------------------------------------------------------------------- */ |
| 3965 | /* Function : XGI_SearchModeID */ |
| 3966 | /* Input : */ |
| 3967 | /* Output : */ |
| 3968 | /* Description : */ |
| 3969 | /* --------------------------------------------------------------------- */ |
| 3970 | BOOLEAN XGI_SearchModeID( USHORT ModeNo , USHORT *ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 3971 | { |
| 3972 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3973 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3974 | |
| 3975 | #ifdef LINUX /* chiawen for linux solution */ |
| 3976 | |
| 3977 | if ( ModeNo <= 5 ) |
| 3978 | ModeNo |= 1 ; |
| 3979 | if ( ModeNo <= 0x13 ) |
| 3980 | { |
| 3981 | /* for (*ModeIdIndex=0;*ModeIdIndex<sizeof(pVBInfo->SModeIDTable)/sizeof(XGI_StStruct);(*ModeIdIndex)++) */ |
| 3982 | for( *ModeIdIndex = 0 ; ; ( *ModeIdIndex )++ ) |
| 3983 | { |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 3984 | if (pVBInfo->SModeIDTable[*ModeIdIndex].St_ModeID == ModeNo) |
| 3985 | break; |
| 3986 | if (pVBInfo->SModeIDTable[*ModeIdIndex].St_ModeID == 0xFF) |
| 3987 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3988 | } |
| 3989 | |
| 3990 | if ( ModeNo == 0x07 ) |
| 3991 | ( *ModeIdIndex )++ ; /* 400 lines */ |
| 3992 | |
| 3993 | if ( ModeNo <= 3 ) |
| 3994 | ( *ModeIdIndex ) += 2 ; /* 400 lines */ |
| 3995 | /* else 350 lines */ |
| 3996 | } |
| 3997 | else |
| 3998 | { |
| 3999 | /* for (*ModeIdIndex=0;*ModeIdIndex<sizeof(pVBInfo->EModeIDTable)/sizeof(XGI_ExtStruct);(*ModeIdIndex)++) */ |
| 4000 | for( *ModeIdIndex = 0 ; ; ( *ModeIdIndex )++ ) |
| 4001 | { |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 4002 | if (pVBInfo->EModeIDTable[*ModeIdIndex].Ext_ModeID == ModeNo) |
| 4003 | break; |
| 4004 | if (pVBInfo->EModeIDTable[*ModeIdIndex].Ext_ModeID == 0xFF) |
| 4005 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4006 | } |
| 4007 | } |
| 4008 | |
| 4009 | #endif |
| 4010 | |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 4011 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4012 | } |
| 4013 | |
| 4014 | |
| 4015 | |
| 4016 | |
| 4017 | /* win2000 MM adapter not support standard mode! */ |
| 4018 | |
| 4019 | /* --------------------------------------------------------------------- */ |
| 4020 | /* Function : */ |
| 4021 | /* Input : */ |
| 4022 | /* Output : */ |
| 4023 | /* Description : */ |
| 4024 | /* --------------------------------------------------------------------- */ |
| 4025 | BOOLEAN XGINew_CheckMemorySize(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo) |
| 4026 | { |
| 4027 | USHORT memorysize , |
| 4028 | modeflag , |
| 4029 | temp , |
| 4030 | temp1 , |
| 4031 | tmp ; |
| 4032 | |
| 4033 | /* if ( ( HwDeviceExtension->jChipType == XGI_650 ) || |
| 4034 | ( HwDeviceExtension->jChipType == XGI_650M ) ) |
| 4035 | { |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 4036 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4037 | } */ |
| 4038 | |
| 4039 | if ( ModeNo <= 0x13 ) |
| 4040 | { |
| 4041 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 4042 | } |
| 4043 | else { |
| 4044 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 4045 | } |
| 4046 | |
| 4047 | /* ModeType = modeflag&ModeInfoFlag ; // Get mode type */ |
| 4048 | |
| 4049 | memorysize = modeflag & MemoryInfoFlag ; |
| 4050 | memorysize = memorysize > MemorySizeShift ; |
| 4051 | memorysize++ ; /* Get memory size */ |
| 4052 | |
| 4053 | temp = XGINew_GetReg1( pVBInfo->P3c4 , 0x14 ) ; /* Get DRAM Size */ |
| 4054 | tmp = temp ; |
| 4055 | |
| 4056 | if ( HwDeviceExtension->jChipType == XG40 ) |
| 4057 | { |
| 4058 | temp = 1 << ( ( temp & 0x0F0 ) >> 4 ) ; /* memory size per channel SR14[7:4] */ |
| 4059 | if ( ( tmp & 0x0c ) == 0x0C ) /* Qual channels */ |
| 4060 | { |
| 4061 | temp <<= 2 ; |
| 4062 | } |
| 4063 | else if ( ( tmp & 0x0c ) == 0x08 ) /* Dual channels */ |
| 4064 | { |
| 4065 | temp <<= 1 ; |
| 4066 | } |
| 4067 | } |
| 4068 | else if ( HwDeviceExtension->jChipType == XG42 ) |
| 4069 | { |
| 4070 | temp = 1 << ( ( temp & 0x0F0 ) >> 4 ) ; /* memory size per channel SR14[7:4] */ |
| 4071 | if ( ( tmp & 0x04 ) == 0x04 ) /* Dual channels */ |
| 4072 | { |
| 4073 | temp <<= 1 ; |
| 4074 | } |
| 4075 | } |
| 4076 | else if ( HwDeviceExtension->jChipType == XG45 ) |
| 4077 | { |
| 4078 | temp = 1 << ( ( temp & 0x0F0 ) >> 4 ) ; /* memory size per channel SR14[7:4] */ |
| 4079 | if ( ( tmp & 0x0c ) == 0x0C ) /* Qual channels */ |
| 4080 | { |
| 4081 | temp <<= 2 ; |
| 4082 | } |
| 4083 | else if ( ( tmp & 0x0c ) == 0x08 ) /* triple channels */ |
| 4084 | { |
| 4085 | temp1 = temp ; |
| 4086 | temp <<= 1 ; |
| 4087 | temp += temp1 ; |
| 4088 | } |
| 4089 | else if ( ( tmp & 0x0c ) == 0x04 ) /* Dual channels */ |
| 4090 | { |
| 4091 | temp <<= 1 ; |
| 4092 | } |
| 4093 | } |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 4094 | if (temp < memorysize) |
| 4095 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4096 | else |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 4097 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4098 | } |
| 4099 | |
| 4100 | |
| 4101 | /* --------------------------------------------------------------------- */ |
| 4102 | /* Function : XGINew_IsLowResolution */ |
| 4103 | /* Input : */ |
| 4104 | /* Output : */ |
| 4105 | /* Description : */ |
| 4106 | /* --------------------------------------------------------------------- */ |
| 4107 | /*void XGINew_IsLowResolution( USHORT ModeNo , USHORT ModeIdIndex, BOOLEAN XGINew_CheckMemorySize(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo) |
| 4108 | { |
| 4109 | USHORT data ; |
| 4110 | USHORT ModeFlag ; |
| 4111 | |
| 4112 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x0F ) ; |
| 4113 | data &= 0x7F ; |
| 4114 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0F , data ) ; |
| 4115 | |
| 4116 | if ( ModeNo > 0x13 ) |
| 4117 | { |
| 4118 | ModeFlag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 4119 | if ( ( ModeFlag & HalfDCLK ) && ( ModeFlag & DoubleScanMode ) ) |
| 4120 | { |
| 4121 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x0F ) ; |
| 4122 | data |= 0x80 ; |
| 4123 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0F , data ) ; |
| 4124 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x01 ) ; |
| 4125 | data &= 0xF7 ; |
| 4126 | XGINew_SetReg1( pVBInfo->P3c4 , 0x01 , data ) ; |
| 4127 | } |
| 4128 | } |
| 4129 | } |
| 4130 | |
| 4131 | */ |
| 4132 | |
| 4133 | /* --------------------------------------------------------------------- */ |
| 4134 | /* Function : XGI_DisplayOn */ |
| 4135 | /* Input : */ |
| 4136 | /* Output : */ |
| 4137 | /* Description : */ |
| 4138 | /* --------------------------------------------------------------------- */ |
| 4139 | void XGI_DisplayOn( PXGI_HW_DEVICE_INFO pXGIHWDE , PVB_DEVICE_INFO pVBInfo ) |
| 4140 | { |
| 4141 | |
| 4142 | XGINew_SetRegANDOR(pVBInfo->P3c4,0x01,0xDF,0x00); |
| 4143 | if ( pXGIHWDE->jChipType == XG21 ) |
| 4144 | { |
| 4145 | if ( pVBInfo->IF_DEF_LVDS == 1 ) |
| 4146 | { |
| 4147 | if (!(XGI_XG21GetPSCValue( pVBInfo )&0x1)) |
| 4148 | { |
| 4149 | XGI_XG21BLSignalVDD( 0x01 , 0x01, pVBInfo ) ; /* LVDS VDD on */ |
| 4150 | XGI_XG21SetPanelDelay( 2,pVBInfo ) ; |
| 4151 | } |
| 4152 | if (!(XGI_XG21GetPSCValue( pVBInfo )&0x20)) |
| 4153 | { |
| 4154 | XGI_XG21BLSignalVDD( 0x20 , 0x20, pVBInfo ) ; /* LVDS signal on */ |
| 4155 | } |
| 4156 | XGI_XG21SetPanelDelay( 3,pVBInfo ) ; |
| 4157 | XGI_XG21BLSignalVDD( 0x02 , 0x02, pVBInfo ) ; /* LVDS backlight on */ |
| 4158 | } |
| 4159 | else |
| 4160 | { |
| 4161 | XGI_XG21BLSignalVDD( 0x20 , 0x20, pVBInfo ) ; /* DVO/DVI signal on */ |
| 4162 | } |
| 4163 | |
| 4164 | } |
| 4165 | |
| 4166 | if (pVBInfo->IF_DEF_CH7007 == 1) /* [Billy] 07/05/23 For CH7007 */ |
| 4167 | { |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4168 | |
| 4169 | } |
| 4170 | |
| 4171 | |
| 4172 | if ( pXGIHWDE->jChipType == XG27 ) |
| 4173 | { |
| 4174 | if ( pVBInfo->IF_DEF_LVDS == 1 ) |
| 4175 | { |
| 4176 | if (!(XGI_XG27GetPSCValue( pVBInfo )&0x1)) |
| 4177 | { |
| 4178 | XGI_XG27BLSignalVDD( 0x01 , 0x01, pVBInfo ) ; /* LVDS VDD on */ |
| 4179 | XGI_XG21SetPanelDelay( 2,pVBInfo ) ; |
| 4180 | } |
| 4181 | if (!(XGI_XG27GetPSCValue( pVBInfo )&0x20)) |
| 4182 | { |
| 4183 | XGI_XG27BLSignalVDD( 0x20 , 0x20, pVBInfo ) ; /* LVDS signal on */ |
| 4184 | } |
| 4185 | XGI_XG21SetPanelDelay( 3,pVBInfo ) ; |
| 4186 | XGI_XG27BLSignalVDD( 0x02 , 0x02, pVBInfo ) ; /* LVDS backlight on */ |
| 4187 | } |
| 4188 | else |
| 4189 | { |
| 4190 | XGI_XG27BLSignalVDD( 0x20 , 0x20, pVBInfo ) ; /* DVO/DVI signal on */ |
| 4191 | } |
| 4192 | |
| 4193 | } |
| 4194 | } |
| 4195 | |
| 4196 | |
| 4197 | /* --------------------------------------------------------------------- */ |
| 4198 | /* Function : XGI_DisplayOff */ |
| 4199 | /* Input : */ |
| 4200 | /* Output : */ |
| 4201 | /* Description : */ |
| 4202 | /* --------------------------------------------------------------------- */ |
| 4203 | void XGI_DisplayOff( PXGI_HW_DEVICE_INFO pXGIHWDE , PVB_DEVICE_INFO pVBInfo ) |
| 4204 | { |
| 4205 | |
| 4206 | if ( pXGIHWDE->jChipType == XG21 ) |
| 4207 | { |
| 4208 | if ( pVBInfo->IF_DEF_LVDS == 1 ) |
| 4209 | { |
| 4210 | XGI_XG21BLSignalVDD( 0x02 , 0x00, pVBInfo ) ; /* LVDS backlight off */ |
| 4211 | XGI_XG21SetPanelDelay( 3,pVBInfo ) ; |
| 4212 | } |
| 4213 | else |
| 4214 | { |
| 4215 | XGI_XG21BLSignalVDD( 0x20 , 0x00, pVBInfo ) ; /* DVO/DVI signal off */ |
| 4216 | } |
| 4217 | } |
| 4218 | |
| 4219 | if (pVBInfo->IF_DEF_CH7007 == 1) /*[Billy] 07/05/23 For CH7007 */ |
| 4220 | { |
| 4221 | /* if( IsCH7007TVMode( pVBInfo ) == 0 ) */ |
| 4222 | { |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4223 | } |
| 4224 | } |
| 4225 | |
| 4226 | |
| 4227 | if ( pXGIHWDE->jChipType == XG27 ) |
| 4228 | { |
| 4229 | if ((XGI_XG27GetPSCValue( pVBInfo )&0x2)) |
| 4230 | { |
| 4231 | XGI_XG27BLSignalVDD( 0x02 , 0x00, pVBInfo ) ; /* LVDS backlight off */ |
| 4232 | XGI_XG21SetPanelDelay( 3,pVBInfo ) ; |
| 4233 | } |
| 4234 | |
| 4235 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 4236 | { |
| 4237 | XGI_XG27BLSignalVDD( 0x20 , 0x00, pVBInfo ) ; /* DVO/DVI signal off */ |
| 4238 | } |
| 4239 | } |
| 4240 | |
| 4241 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x01 , 0xDF , 0x20 ) ; |
| 4242 | } |
| 4243 | |
| 4244 | |
| 4245 | /* --------------------------------------------------------------------- */ |
| 4246 | /* Function : XGI_WaitDisply */ |
| 4247 | /* Input : */ |
| 4248 | /* Output : */ |
| 4249 | /* Description : chiawen for sensecrt1 */ |
| 4250 | /* --------------------------------------------------------------------- */ |
| 4251 | void XGI_WaitDisply( PVB_DEVICE_INFO pVBInfo ) |
| 4252 | { |
| 4253 | while( ( XGINew_GetReg2( pVBInfo->P3da ) & 0x01 ) ) |
| 4254 | break ; |
| 4255 | |
| 4256 | while( !( XGINew_GetReg2( pVBInfo->P3da ) & 0x01 ) ) |
| 4257 | break ; |
| 4258 | } |
| 4259 | |
| 4260 | /* --------------------------------------------------------------------- */ |
| 4261 | /* Function : XGI_SenseCRT1 */ |
| 4262 | /* Input : */ |
| 4263 | /* Output : */ |
| 4264 | /* Description : */ |
| 4265 | /* --------------------------------------------------------------------- */ |
| 4266 | |
| 4267 | void XGI_SenseCRT1( PVB_DEVICE_INFO pVBInfo ) |
| 4268 | { |
| 4269 | UCHAR CRTCData[ 17 ] = { 0x5F , 0x4F , 0x50 , 0x82 , 0x55 , 0x81 , |
| 4270 | 0x0B , 0x3E , 0xE9 , 0x0B , 0xDF , 0xE7 , |
| 4271 | 0x04 , 0x00 , 0x00 , 0x05 , 0x00 } ; |
| 4272 | |
| 4273 | UCHAR SR01 = 0 , SR1F = 0 , SR07 = 0 , SR06 = 0 ; |
| 4274 | |
| 4275 | UCHAR CR17 , CR63 , SR31 ; |
| 4276 | USHORT temp ; |
| 4277 | UCHAR DAC_TEST_PARMS[ 3 ] = { 0x0F , 0x0F , 0x0F } ; |
| 4278 | |
| 4279 | int i ; |
| 4280 | XGINew_SetReg1( pVBInfo->P3c4 , 0x05 , 0x86 ) ; |
| 4281 | |
| 4282 | /* [2004/05/06] Vicent to fix XG42 single LCD sense to CRT+LCD */ |
| 4283 | XGINew_SetReg1( pVBInfo->P3d4 , 0x57 , 0x4A ) ; |
| 4284 | XGINew_SetReg1( pVBInfo->P3d4 , 0x53 , ( UCHAR )( XGINew_GetReg1( pVBInfo->P3d4 , 0x53 ) | 0x02 ) ) ; |
| 4285 | |
| 4286 | SR31 = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x31 ) ; |
| 4287 | CR63 = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x63 ) ; |
| 4288 | SR01 = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x01 ) ; |
| 4289 | |
| 4290 | XGINew_SetReg1( pVBInfo->P3c4 , 0x01 , ( UCHAR )( SR01 & 0xDF ) ) ; |
| 4291 | XGINew_SetReg1( pVBInfo->P3d4 , 0x63 , ( UCHAR )( CR63 & 0xBF ) ) ; |
| 4292 | |
| 4293 | CR17 = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x17 ) ; |
| 4294 | XGINew_SetReg1( pVBInfo->P3d4 , 0x17 , ( UCHAR )( CR17 | 0x80 ) ) ; |
| 4295 | |
| 4296 | SR1F = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x1F ) ; |
| 4297 | XGINew_SetReg1( pVBInfo->P3c4 , 0x1F , ( UCHAR )( SR1F | 0x04 ) ) ; |
| 4298 | |
| 4299 | SR07 = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x07 ) ; |
| 4300 | XGINew_SetReg1( pVBInfo->P3c4 , 0x07 , ( UCHAR )( SR07 & 0xFB ) ) ; |
| 4301 | SR06 = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x06 ) ; |
| 4302 | XGINew_SetReg1( pVBInfo->P3c4 , 0x06 , ( UCHAR )( SR06 & 0xC3 ) ) ; |
| 4303 | |
| 4304 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , 0x00 ) ; |
| 4305 | |
| 4306 | for( i = 0 ; i < 8 ; i++ ) |
| 4307 | XGINew_SetReg1( pVBInfo->P3d4 , ( USHORT )i , CRTCData[ i ] ) ; |
| 4308 | |
| 4309 | for( i = 8 ; i < 11 ; i++ ) |
| 4310 | XGINew_SetReg1( pVBInfo->P3d4 , ( USHORT )( i + 8 ) , CRTCData[ i ] ) ; |
| 4311 | |
| 4312 | for( i = 11 ; i < 13 ; i++ ) |
| 4313 | XGINew_SetReg1( pVBInfo->P3d4 , ( USHORT )( i + 4 ) , CRTCData[ i ] ) ; |
| 4314 | |
| 4315 | for( i = 13 ; i < 16 ; i++ ) |
| 4316 | XGINew_SetReg1( pVBInfo->P3c4 , ( USHORT )( i - 3 ) , CRTCData[ i ] ) ; |
| 4317 | |
| 4318 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0E , ( UCHAR )( CRTCData[ 16 ] & 0xE0 ) ) ; |
| 4319 | |
| 4320 | XGINew_SetReg1( pVBInfo->P3c4 , 0x31 , 0x00 ) ; |
| 4321 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , 0x1B ) ; |
| 4322 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , 0xE1 ) ; |
| 4323 | |
| 4324 | XGINew_SetReg3( pVBInfo->P3c8 , 0x00 ) ; |
| 4325 | |
| 4326 | for( i = 0 ; i < 256 ; i++ ) |
| 4327 | { |
| 4328 | XGINew_SetReg3( ( pVBInfo->P3c8 + 1 ) , ( UCHAR )DAC_TEST_PARMS[ 0 ] ) ; |
| 4329 | XGINew_SetReg3( ( pVBInfo->P3c8 + 1 ) , ( UCHAR )DAC_TEST_PARMS[ 1 ] ) ; |
| 4330 | XGINew_SetReg3( ( pVBInfo->P3c8 + 1 ) , ( UCHAR )DAC_TEST_PARMS[ 2 ] ) ; |
| 4331 | } |
| 4332 | |
| 4333 | XGI_VBLongWait( pVBInfo ) ; |
| 4334 | XGI_VBLongWait( pVBInfo ) ; |
| 4335 | XGI_VBLongWait( pVBInfo ) ; |
| 4336 | |
| 4337 | XGINew_LCD_Wait_Time( 0x01 , pVBInfo ) ; |
| 4338 | |
| 4339 | XGI_WaitDisply( pVBInfo ) ; |
| 4340 | temp = XGINew_GetReg2( pVBInfo->P3c2 ) ; |
| 4341 | |
| 4342 | if( temp & 0x10 ) |
| 4343 | { |
| 4344 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x32 , 0xDF , 0x20 ) ; |
| 4345 | } |
| 4346 | else |
| 4347 | { |
| 4348 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x32 , 0xDF , 0x00 ) ; |
| 4349 | } |
| 4350 | |
| 4351 | /* alan, avoid display something, set BLACK DAC if not restore DAC */ |
| 4352 | XGINew_SetReg3( pVBInfo->P3c8 , 0x00 ) ; |
| 4353 | |
| 4354 | for( i = 0 ; i < 256 ; i++ ) |
| 4355 | { |
| 4356 | XGINew_SetReg3( ( pVBInfo->P3c8 + 1 ) , 0 ) ; |
| 4357 | XGINew_SetReg3( ( pVBInfo->P3c8 + 1 ) , 0 ) ; |
| 4358 | XGINew_SetReg3( ( pVBInfo->P3c8 + 1 ) , 0 ) ; |
| 4359 | } |
| 4360 | |
| 4361 | XGINew_SetReg1( pVBInfo->P3c4 , 0x01 , SR01 ) ; |
| 4362 | XGINew_SetReg1( pVBInfo->P3d4 , 0x63 , CR63 ) ; |
| 4363 | XGINew_SetReg1( pVBInfo->P3c4 , 0x31 , SR31 ) ; |
| 4364 | |
| 4365 | /* [2004/05/11] Vicent */ |
| 4366 | XGINew_SetReg1( pVBInfo->P3d4 , 0x53 , ( UCHAR )( XGINew_GetReg1( pVBInfo->P3d4 , 0x53 ) & 0xFD ) ) ; |
| 4367 | XGINew_SetReg1( pVBInfo->P3c4 , 0x1F , ( UCHAR ) SR1F ) ; |
| 4368 | } |
| 4369 | |
| 4370 | |
| 4371 | |
| 4372 | |
| 4373 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4374 | |
| 4375 | |
| 4376 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4377 | |
| 4378 | |
| 4379 | /* --------------------------------------------------------------------- */ |
| 4380 | /* Function : XGI_WaitDisplay */ |
| 4381 | /* Input : */ |
| 4382 | /* Output : */ |
| 4383 | /* Description : */ |
| 4384 | /* --------------------------------------------------------------------- */ |
| 4385 | void XGI_WaitDisplay( PVB_DEVICE_INFO pVBInfo ) |
| 4386 | { |
| 4387 | while( !( XGINew_GetReg2( pVBInfo->P3da ) & 0x01 ) ) ; |
| 4388 | |
| 4389 | while( XGINew_GetReg2( pVBInfo->P3da ) & 0x01 ) ; |
| 4390 | } |
| 4391 | |
| 4392 | |
| 4393 | |
| 4394 | |
| 4395 | /* --------------------------------------------------------------------- */ |
| 4396 | /* Function : XGI_SetCRT2Group301 */ |
| 4397 | /* Input : */ |
| 4398 | /* Output : */ |
| 4399 | /* Description : */ |
| 4400 | /* --------------------------------------------------------------------- */ |
| 4401 | BOOLEAN XGI_SetCRT2Group301( USHORT ModeNo , PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo ) |
| 4402 | { |
| 4403 | USHORT tempbx , |
| 4404 | ModeIdIndex , |
| 4405 | RefreshRateTableIndex ; |
| 4406 | |
| 4407 | tempbx=pVBInfo->VBInfo ; |
| 4408 | pVBInfo->SetFlag |= ProgrammingCRT2 ; |
| 4409 | XGI_SearchModeID( ModeNo , &ModeIdIndex, pVBInfo ) ; |
| 4410 | pVBInfo->SelectCRT2Rate = 4 ; |
| 4411 | RefreshRateTableIndex = XGI_GetRatePtrCRT2( HwDeviceExtension, ModeNo , ModeIdIndex, pVBInfo ) ; |
| 4412 | XGI_SaveCRT2Info( ModeNo, pVBInfo ) ; |
| 4413 | XGI_GetCRT2ResInfo( ModeNo , ModeIdIndex, pVBInfo) ; |
| 4414 | XGI_GetCRT2Data( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 4415 | XGI_PreSetGroup1( ModeNo , ModeIdIndex , HwDeviceExtension , RefreshRateTableIndex, pVBInfo ) ; |
| 4416 | XGI_SetGroup1( ModeNo , ModeIdIndex , HwDeviceExtension , RefreshRateTableIndex, pVBInfo ) ; |
| 4417 | XGI_SetLockRegs( ModeNo , ModeIdIndex , HwDeviceExtension , RefreshRateTableIndex, pVBInfo ) ; |
| 4418 | XGI_SetGroup2( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; |
| 4419 | XGI_SetLCDRegs(ModeNo , ModeIdIndex , HwDeviceExtension , RefreshRateTableIndex, pVBInfo ) ; |
| 4420 | XGI_SetTap4Regs(pVBInfo) ; |
| 4421 | XGI_SetGroup3(ModeNo, ModeIdIndex, pVBInfo); |
| 4422 | XGI_SetGroup4( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; |
| 4423 | XGI_SetCRT2VCLK( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 4424 | XGI_SetGroup5( ModeNo , ModeIdIndex, pVBInfo) ; |
| 4425 | XGI_AutoThreshold( pVBInfo) ; |
| 4426 | return 1 ; |
| 4427 | } |
| 4428 | |
| 4429 | |
| 4430 | /* --------------------------------------------------------------------- */ |
| 4431 | /* Function : XGI_AutoThreshold */ |
| 4432 | /* Input : */ |
| 4433 | /* Output : */ |
| 4434 | /* Description : */ |
| 4435 | /* --------------------------------------------------------------------- */ |
| 4436 | void XGI_AutoThreshold( PVB_DEVICE_INFO pVBInfo ) |
| 4437 | { |
| 4438 | if ( !( pVBInfo->SetFlag & Win9xDOSMode ) ) |
| 4439 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x01 , 0x40 ) ; |
| 4440 | } |
| 4441 | |
| 4442 | |
| 4443 | /* --------------------------------------------------------------------- */ |
| 4444 | /* Function : XGI_SaveCRT2Info */ |
| 4445 | /* Input : */ |
| 4446 | /* Output : */ |
| 4447 | /* Description : */ |
| 4448 | /* --------------------------------------------------------------------- */ |
| 4449 | void XGI_SaveCRT2Info( USHORT ModeNo , PVB_DEVICE_INFO pVBInfo) |
| 4450 | { |
| 4451 | USHORT temp1 , |
| 4452 | temp2 ; |
| 4453 | |
| 4454 | XGINew_SetReg1( pVBInfo->P3d4 , 0x34 , ModeNo ) ; /* reserve CR34 for CRT1 Mode No */ |
| 4455 | temp1 = ( pVBInfo->VBInfo&SetInSlaveMode ) >> 8 ; |
| 4456 | temp2 = ~( SetInSlaveMode >> 8 ) ; |
| 4457 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x31 , temp2 , temp1 ) ; |
| 4458 | } |
| 4459 | |
| 4460 | |
| 4461 | /* --------------------------------------------------------------------- */ |
| 4462 | /* Function : XGI_GetCRT2ResInfo */ |
| 4463 | /* Input : */ |
| 4464 | /* Output : */ |
| 4465 | /* Description : */ |
| 4466 | /* --------------------------------------------------------------------- */ |
| 4467 | void XGI_GetCRT2ResInfo( USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 4468 | { |
| 4469 | USHORT xres , |
| 4470 | yres , |
| 4471 | modeflag , |
| 4472 | resindex ; |
| 4473 | |
| 4474 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo) ; |
| 4475 | if ( ModeNo <= 0x13 ) |
| 4476 | { |
| 4477 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; |
| 4478 | yres = pVBInfo->StResInfo[ resindex ].VTotal ; |
| 4479 | /* modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; si+St_ResInfo */ |
| 4480 | } |
| 4481 | else |
| 4482 | { |
| 4483 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */ |
| 4484 | yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; /* yres->bx */ |
| 4485 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex].Ext_ModeFlag ; /* si+St_ModeFlag */ |
| 4486 | |
| 4487 | /* if ( pVBInfo->IF_DEF_FSTN ) |
| 4488 | { |
| 4489 | xres *= 2 ; |
| 4490 | yres *= 2 ; |
| 4491 | } |
| 4492 | else |
| 4493 | { |
| 4494 | */ |
| 4495 | if ( modeflag & HalfDCLK ) |
| 4496 | xres *= 2; |
| 4497 | |
| 4498 | if ( modeflag & DoubleScanMode ) |
| 4499 | yres *= 2 ; |
| 4500 | /* } */ |
| 4501 | } |
| 4502 | |
| 4503 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) |
| 4504 | { |
| 4505 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 4506 | { |
| 4507 | if ( pVBInfo->LCDResInfo == Panel1600x1200 ) |
| 4508 | { |
| 4509 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) |
| 4510 | { |
| 4511 | if ( yres == 1024 ) |
| 4512 | yres = 1056 ; |
| 4513 | } |
| 4514 | } |
| 4515 | |
| 4516 | if ( pVBInfo->LCDResInfo == Panel1280x1024 ) |
| 4517 | { |
| 4518 | if ( yres == 400 ) |
| 4519 | yres = 405 ; |
| 4520 | else if ( yres == 350 ) |
| 4521 | yres = 360 ; |
| 4522 | |
| 4523 | if ( pVBInfo->LCDInfo & LCDVESATiming ) |
| 4524 | { |
| 4525 | if ( yres == 360 ) |
| 4526 | yres = 375 ; |
| 4527 | } |
| 4528 | } |
| 4529 | |
| 4530 | if ( pVBInfo->LCDResInfo == Panel1024x768 ) |
| 4531 | { |
| 4532 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) |
| 4533 | { |
| 4534 | if ( !( pVBInfo->LCDInfo & LCDNonExpanding ) ) |
| 4535 | { |
| 4536 | if ( yres == 350 ) |
| 4537 | yres = 357 ; |
| 4538 | else if ( yres == 400 ) |
| 4539 | yres = 420 ; |
| 4540 | else if ( yres == 480 ) |
| 4541 | yres = 525 ; |
| 4542 | } |
| 4543 | } |
| 4544 | } |
| 4545 | } |
| 4546 | |
| 4547 | if ( xres == 720 ) |
| 4548 | xres = 640 ; |
| 4549 | } |
| 4550 | |
| 4551 | pVBInfo->VGAHDE = xres ; |
| 4552 | pVBInfo->HDE = xres ; |
| 4553 | pVBInfo->VGAVDE = yres ; |
| 4554 | pVBInfo->VDE = yres ; |
| 4555 | } |
| 4556 | |
| 4557 | |
| 4558 | /* --------------------------------------------------------------------- */ |
| 4559 | /* Function : XGI_IsLCDDualLink */ |
| 4560 | /* Input : */ |
| 4561 | /* Output : */ |
| 4562 | /* Description : */ |
| 4563 | /* --------------------------------------------------------------------- */ |
| 4564 | BOOLEAN XGI_IsLCDDualLink( PVB_DEVICE_INFO pVBInfo ) |
| 4565 | { |
| 4566 | |
| 4567 | if ( ( ( ( pVBInfo->VBInfo & SetCRT2ToLCD ) | SetCRT2ToLCDA ) ) && ( pVBInfo->LCDInfo & SetLCDDualLink ) ) /* shampoo0129 */ |
| 4568 | return ( 1 ) ; |
| 4569 | |
| 4570 | return( 0 ) ; |
| 4571 | } |
| 4572 | |
| 4573 | |
| 4574 | /* --------------------------------------------------------------------- */ |
| 4575 | /* Function : XGI_GetCRT2Data */ |
| 4576 | /* Input : */ |
| 4577 | /* Output : */ |
| 4578 | /* Description : */ |
| 4579 | /* --------------------------------------------------------------------- */ |
| 4580 | void XGI_GetCRT2Data( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 4581 | { |
| 4582 | USHORT tempax = 0, |
| 4583 | tempbx , |
| 4584 | modeflag , |
| 4585 | resinfo ; |
| 4586 | |
| 4587 | XGI_LCDDataStruct *LCDPtr = NULL ; |
| 4588 | XGI_TVDataStruct *TVPtr = NULL ; |
| 4589 | |
| 4590 | if ( ModeNo <= 0x13 ) |
| 4591 | { |
| 4592 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ |
| 4593 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; |
| 4594 | } |
| 4595 | else |
| 4596 | { |
| 4597 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ |
| 4598 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 4599 | } |
| 4600 | |
| 4601 | pVBInfo->NewFlickerMode = 0 ; |
| 4602 | pVBInfo->RVBHRS = 50 ; |
| 4603 | |
| 4604 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) |
| 4605 | { |
| 4606 | XGI_GetRAMDAC2DATA( ModeNo , ModeIdIndex , RefreshRateTableIndex,pVBInfo ) ; |
| 4607 | return ; |
| 4608 | } |
| 4609 | |
| 4610 | tempbx = 4 ; |
| 4611 | |
| 4612 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 4613 | { |
| 4614 | LCDPtr = (XGI_LCDDataStruct* )XGI_GetLcdPtr( tempbx, ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 4615 | |
| 4616 | pVBInfo->RVBHCMAX = LCDPtr->RVBHCMAX ; |
| 4617 | pVBInfo->RVBHCFACT = LCDPtr->RVBHCFACT ; |
| 4618 | pVBInfo->VGAHT = LCDPtr->VGAHT ; |
| 4619 | pVBInfo->VGAVT = LCDPtr->VGAVT ; |
| 4620 | pVBInfo->HT = LCDPtr->LCDHT ; |
| 4621 | pVBInfo->VT = LCDPtr->LCDVT ; |
| 4622 | |
| 4623 | if ( pVBInfo->LCDResInfo == Panel1024x768 ) |
| 4624 | { |
| 4625 | tempax = 1024 ; |
| 4626 | tempbx = 768 ; |
| 4627 | |
| 4628 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) |
| 4629 | { |
| 4630 | if ( pVBInfo->VGAVDE == 357 ) |
| 4631 | tempbx = 527 ; |
| 4632 | else if ( pVBInfo->VGAVDE == 420 ) |
| 4633 | tempbx = 620 ; |
| 4634 | else if ( pVBInfo->VGAVDE == 525 ) |
| 4635 | tempbx = 775 ; |
| 4636 | else if ( pVBInfo->VGAVDE == 600 ) |
| 4637 | tempbx = 775 ; |
| 4638 | /* else if(pVBInfo->VGAVDE==350) tempbx=560; */ |
| 4639 | /* else if(pVBInfo->VGAVDE==400) tempbx=640; */ |
| 4640 | else |
| 4641 | tempbx = 768 ; |
| 4642 | } |
| 4643 | else |
| 4644 | tempbx = 768 ; |
| 4645 | } |
| 4646 | else if ( pVBInfo->LCDResInfo == Panel1024x768x75 ) |
| 4647 | { |
| 4648 | tempax = 1024 ; |
| 4649 | tempbx = 768 ; |
| 4650 | } |
| 4651 | else if ( pVBInfo->LCDResInfo == Panel1280x1024 ) |
| 4652 | { |
| 4653 | tempax = 1280 ; |
| 4654 | if ( pVBInfo->VGAVDE == 360 ) |
| 4655 | tempbx = 768 ; |
| 4656 | else if ( pVBInfo->VGAVDE == 375 ) |
| 4657 | tempbx = 800 ; |
| 4658 | else if ( pVBInfo->VGAVDE == 405 ) |
| 4659 | tempbx = 864 ; |
| 4660 | else |
| 4661 | tempbx = 1024 ; |
| 4662 | } |
| 4663 | else if ( pVBInfo->LCDResInfo == Panel1280x1024x75 ) |
| 4664 | { |
| 4665 | tempax = 1280 ; |
| 4666 | tempbx = 1024 ; |
| 4667 | } |
| 4668 | else if ( pVBInfo->LCDResInfo == Panel1280x960 ) |
| 4669 | { |
| 4670 | tempax = 1280 ; |
| 4671 | if ( pVBInfo->VGAVDE == 350 ) |
| 4672 | tempbx = 700 ; |
| 4673 | else if ( pVBInfo->VGAVDE == 400 ) |
| 4674 | tempbx = 800 ; |
| 4675 | else if ( pVBInfo->VGAVDE == 1024 ) |
| 4676 | tempbx = 960 ; |
| 4677 | else |
| 4678 | tempbx = 960 ; |
| 4679 | } |
| 4680 | else if ( pVBInfo->LCDResInfo == Panel1400x1050 ) |
| 4681 | { |
| 4682 | tempax = 1400 ; |
| 4683 | tempbx = 1050 ; |
| 4684 | |
| 4685 | if ( pVBInfo->VGAVDE == 1024 ) |
| 4686 | { |
| 4687 | tempax = 1280 ; |
| 4688 | tempbx = 1024 ; |
| 4689 | } |
| 4690 | } |
| 4691 | else if ( pVBInfo->LCDResInfo == Panel1600x1200 ) |
| 4692 | { |
| 4693 | tempax = 1600 ; |
| 4694 | tempbx = 1200 ; /* alan 10/14/2003 */ |
| 4695 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) |
| 4696 | { |
| 4697 | if ( pVBInfo->VGAVDE == 350 ) |
| 4698 | tempbx = 875 ; |
| 4699 | else if ( pVBInfo->VGAVDE == 400 ) |
| 4700 | tempbx = 1000 ; |
| 4701 | } |
| 4702 | } |
| 4703 | |
| 4704 | if ( pVBInfo->LCDInfo & LCDNonExpanding ) |
| 4705 | { |
| 4706 | tempax = pVBInfo->VGAHDE ; |
| 4707 | tempbx = pVBInfo->VGAVDE ; |
| 4708 | } |
| 4709 | |
| 4710 | pVBInfo->HDE = tempax ; |
| 4711 | pVBInfo->VDE = tempbx ; |
| 4712 | return ; |
| 4713 | } |
| 4714 | |
| 4715 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV ) ) |
| 4716 | { |
| 4717 | tempbx = 4 ; |
| 4718 | TVPtr = ( XGI_TVDataStruct * )XGI_GetTVPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 4719 | |
| 4720 | pVBInfo->RVBHCMAX = TVPtr->RVBHCMAX ; |
| 4721 | pVBInfo->RVBHCFACT = TVPtr->RVBHCFACT ; |
| 4722 | pVBInfo->VGAHT = TVPtr->VGAHT ; |
| 4723 | pVBInfo->VGAVT = TVPtr->VGAVT ; |
| 4724 | pVBInfo->HDE = TVPtr->TVHDE ; |
| 4725 | pVBInfo->VDE = TVPtr->TVVDE ; |
| 4726 | pVBInfo->RVBHRS = TVPtr->RVBHRS ; |
| 4727 | pVBInfo->NewFlickerMode = TVPtr->FlickerMode ; |
| 4728 | |
| 4729 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 4730 | { |
| 4731 | if ( resinfo == 0x08 ) |
| 4732 | pVBInfo->NewFlickerMode = 0x40 ; |
| 4733 | else if ( resinfo == 0x09 ) |
| 4734 | pVBInfo->NewFlickerMode = 0x40 ; |
| 4735 | else if ( resinfo == 0x12 ) |
| 4736 | pVBInfo->NewFlickerMode = 0x40 ; |
| 4737 | |
| 4738 | if ( pVBInfo->VGAVDE == 350 ) |
| 4739 | pVBInfo->TVInfo |= TVSimuMode ; |
| 4740 | |
| 4741 | tempax = ExtHiTVHT ; |
| 4742 | tempbx = ExtHiTVVT ; |
| 4743 | |
| 4744 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 4745 | { |
| 4746 | if ( pVBInfo->TVInfo & TVSimuMode ) |
| 4747 | { |
| 4748 | tempax = StHiTVHT ; |
| 4749 | tempbx = StHiTVVT ; |
| 4750 | |
| 4751 | if ( !( modeflag & Charx8Dot ) ) |
| 4752 | { |
| 4753 | tempax = StHiTextTVHT ; |
| 4754 | tempbx = StHiTextTVVT ; |
| 4755 | } |
| 4756 | } |
| 4757 | } |
| 4758 | } |
| 4759 | else if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) |
| 4760 | { |
| 4761 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) |
| 4762 | { |
| 4763 | tempax = YPbPrTV750pHT ; /* Ext750pTVHT */ |
| 4764 | tempbx = YPbPrTV750pVT ; /* Ext750pTVVT */ |
| 4765 | } |
| 4766 | |
| 4767 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) |
| 4768 | { |
| 4769 | tempax = YPbPrTV525pHT ; /* Ext525pTVHT */ |
| 4770 | tempbx = YPbPrTV525pVT ; /* Ext525pTVVT */ |
| 4771 | } |
| 4772 | else if ( pVBInfo->TVInfo & SetYPbPrMode525i ) |
| 4773 | { |
| 4774 | tempax = YPbPrTV525iHT ; /* Ext525iTVHT */ |
| 4775 | tempbx = YPbPrTV525iVT ; /* Ext525iTVVT */ |
| 4776 | if ( pVBInfo->TVInfo & NTSC1024x768 ) |
| 4777 | tempax = NTSC1024x768HT ; |
| 4778 | } |
| 4779 | } |
| 4780 | else |
| 4781 | { |
| 4782 | tempax = PALHT ; |
| 4783 | tempbx = PALVT ; |
| 4784 | if ( !( pVBInfo->TVInfo & SetPALTV ) ) |
| 4785 | { |
| 4786 | tempax = NTSCHT ; |
| 4787 | tempbx = NTSCVT ; |
| 4788 | if ( pVBInfo->TVInfo & NTSC1024x768 ) |
| 4789 | tempax = NTSC1024x768HT ; |
| 4790 | } |
| 4791 | } |
| 4792 | |
| 4793 | pVBInfo->HT = tempax ; |
| 4794 | pVBInfo->VT = tempbx ; |
| 4795 | return ; |
| 4796 | } |
| 4797 | } |
| 4798 | |
| 4799 | |
| 4800 | /* --------------------------------------------------------------------- */ |
| 4801 | /* Function : XGI_SetCRT2VCLK */ |
| 4802 | /* Input : */ |
| 4803 | /* Output : */ |
| 4804 | /* Description : */ |
| 4805 | /* --------------------------------------------------------------------- */ |
| 4806 | void XGI_SetCRT2VCLK( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 4807 | { |
| 4808 | UCHAR di_0 , |
| 4809 | di_1 , |
| 4810 | tempal ; |
| 4811 | |
| 4812 | tempal = XGI_GetVCLKPtr( RefreshRateTableIndex , ModeNo , ModeIdIndex, pVBInfo ) ; |
| 4813 | XGI_GetVCLKLen( tempal, &di_0 , &di_1, pVBInfo ) ; |
| 4814 | XGI_GetLCDVCLKPtr( &di_0 , &di_1, pVBInfo ) ; |
| 4815 | |
| 4816 | if ( pVBInfo->VBType & VB_XGI301 ) /* shampoo 0129 */ |
| 4817 | { /* 301 */ |
| 4818 | XGINew_SetReg1(pVBInfo->Part4Port , 0x0A , 0x10 ) ; |
| 4819 | XGINew_SetReg1(pVBInfo->Part4Port , 0x0B , di_1 ) ; |
| 4820 | XGINew_SetReg1(pVBInfo->Part4Port , 0x0A , di_0 ) ; |
| 4821 | } |
| 4822 | else |
| 4823 | { /* 301b/302b/301lv/302lv */ |
| 4824 | XGINew_SetReg1( pVBInfo->Part4Port , 0x0A , di_0 ) ; |
| 4825 | XGINew_SetReg1( pVBInfo->Part4Port , 0x0B , di_1 ) ; |
| 4826 | } |
| 4827 | |
| 4828 | XGINew_SetReg1( pVBInfo->Part4Port , 0x00 , 0x12 ) ; |
| 4829 | |
| 4830 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) |
| 4831 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x12 , 0x28 ) ; |
| 4832 | else |
| 4833 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x12 , 0x08 ) ; |
| 4834 | } |
| 4835 | |
| 4836 | |
| 4837 | /* --------------------------------------------------------------------- */ |
| 4838 | /* Function : XGI_GETLCDVCLKPtr */ |
| 4839 | /* Input : */ |
| 4840 | /* Output : al -> VCLK Index */ |
| 4841 | /* Description : */ |
| 4842 | /* --------------------------------------------------------------------- */ |
| 4843 | void XGI_GetLCDVCLKPtr( UCHAR* di_0 , UCHAR *di_1, PVB_DEVICE_INFO pVBInfo ) |
| 4844 | { |
| 4845 | USHORT index ; |
| 4846 | |
| 4847 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 4848 | { |
| 4849 | if ( pVBInfo->IF_DEF_ScaleLCD == 1 ) |
| 4850 | { |
| 4851 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 4852 | return ; |
| 4853 | } |
| 4854 | |
| 4855 | /* index = XGI_GetLCDCapPtr(pVBInfo) ; */ |
| 4856 | index = XGI_GetLCDCapPtr1( pVBInfo) ; |
| 4857 | |
| 4858 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) |
| 4859 | { /* LCDB */ |
| 4860 | *di_0 = pVBInfo->LCDCapList[ index ].LCUCHAR_VCLKData1 ; |
| 4861 | *di_1 = pVBInfo->LCDCapList[ index ].LCUCHAR_VCLKData2 ; |
| 4862 | } |
| 4863 | else |
| 4864 | { /* LCDA */ |
| 4865 | *di_0 = pVBInfo->LCDCapList[ index ].LCDA_VCLKData1 ; |
| 4866 | *di_1 = pVBInfo->LCDCapList[ index ].LCDA_VCLKData2 ; |
| 4867 | } |
| 4868 | } |
| 4869 | return ; |
| 4870 | } |
| 4871 | |
| 4872 | |
| 4873 | /* --------------------------------------------------------------------- */ |
| 4874 | /* Function : XGI_GetVCLKPtr */ |
| 4875 | /* Input : */ |
| 4876 | /* Output : */ |
| 4877 | /* Description : */ |
| 4878 | /* --------------------------------------------------------------------- */ |
| 4879 | UCHAR XGI_GetVCLKPtr(USHORT RefreshRateTableIndex,USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo) |
| 4880 | { |
| 4881 | |
| 4882 | USHORT index , |
| 4883 | modeflag ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4884 | USHORT tempbx ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4885 | UCHAR tempal ; |
| 4886 | UCHAR *CHTVVCLKPtr = NULL ; |
| 4887 | |
| 4888 | if ( ModeNo <= 0x13 ) |
| 4889 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ |
| 4890 | else |
| 4891 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ |
| 4892 | |
| 4893 | |
| 4894 | if ( ( pVBInfo->SetFlag & ProgrammingCRT2 ) && ( !( pVBInfo->LCDInfo & EnableScalingLCD ) ) ) |
| 4895 | { /* {LCDA/LCDB} */ |
| 4896 | index = XGI_GetLCDCapPtr(pVBInfo) ; |
| 4897 | tempal = pVBInfo->LCDCapList[ index ].LCD_VCLK ; |
| 4898 | |
| 4899 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 4900 | return tempal ; |
| 4901 | |
| 4902 | /* {TV} */ |
| 4903 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV| VB_XGI302LV| VB_XGI301C ) ) |
| 4904 | { |
| 4905 | if(pVBInfo->VBInfo&SetCRT2ToHiVisionTV) |
| 4906 | { |
| 4907 | tempal = HiTVVCLKDIV2; |
| 4908 | if(!(pVBInfo->TVInfo & RPLLDIV2XO)) |
| 4909 | tempal = HiTVVCLK; |
| 4910 | if(pVBInfo->TVInfo & TVSimuMode) |
| 4911 | { |
| 4912 | tempal = HiTVSimuVCLK; |
| 4913 | if(!(modeflag & Charx8Dot)) |
| 4914 | tempal = HiTVTextVCLK; |
| 4915 | |
| 4916 | } |
| 4917 | return tempal; |
| 4918 | } |
| 4919 | |
| 4920 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) |
| 4921 | { |
| 4922 | tempal = YPbPr750pVCLK ; |
| 4923 | return tempal ; |
| 4924 | } |
| 4925 | |
| 4926 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) |
| 4927 | { |
| 4928 | tempal = YPbPr525pVCLK ; |
| 4929 | return tempal ; |
| 4930 | } |
| 4931 | |
| 4932 | tempal = NTSC1024VCLK ; |
| 4933 | |
| 4934 | if ( !( pVBInfo->TVInfo & NTSC1024x768 ) ) |
| 4935 | { |
| 4936 | tempal = TVVCLKDIV2 ; |
| 4937 | if ( !( pVBInfo->TVInfo & RPLLDIV2XO ) ) |
| 4938 | tempal = TVVCLK ; |
| 4939 | } |
| 4940 | |
| 4941 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 4942 | return tempal ; |
| 4943 | } |
| 4944 | /*else |
| 4945 | if((pVBInfo->IF_DEF_CH7017==1)&&(pVBInfo->VBType&VB_CH7017)) |
| 4946 | { |
| 4947 | if(ModeNo<=0x13) |
| 4948 | *tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC; |
| 4949 | else |
| 4950 | *tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; |
| 4951 | *tempal = *tempal & 0x1F; |
| 4952 | |
| 4953 | tempbx = 0; |
| 4954 | if(pVBInfo->TVInfo & SetPALTV) |
| 4955 | tempbx = tempbx + 2; |
| 4956 | if(pVBInfo->TVInfo & SetCHTVOverScan) |
| 4957 | tempbx++; |
| 4958 | tempbx = tempbx << 1; |
| 4959 | } */ |
| 4960 | } /* {End of VB} */ |
| 4961 | |
| 4962 | if((pVBInfo->IF_DEF_CH7007==1)&&(pVBInfo->VBType&VB_CH7007)) /* [Billy] 07/05/08 CH7007 */ |
| 4963 | { |
| 4964 | /* VideoDebugPrint((0, "XGI_GetVCLKPtr: pVBInfo->IF_DEF_CH7007==1\n")); */ |
| 4965 | if ( (pVBInfo->VBInfo & SetCRT2ToTV) ) |
| 4966 | { |
| 4967 | if( ModeNo <= 0x13 ) |
| 4968 | { |
| 4969 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; |
| 4970 | } |
| 4971 | else |
| 4972 | { |
| 4973 | tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; |
| 4974 | } |
| 4975 | |
| 4976 | tempal = tempal & 0x0F; |
| 4977 | tempbx = 0; |
| 4978 | |
| 4979 | if(pVBInfo->TVInfo & SetPALTV) |
| 4980 | { |
| 4981 | tempbx = tempbx + 2; |
| 4982 | } |
| 4983 | if(pVBInfo->TVInfo & SetCHTVOverScan) |
| 4984 | { |
| 4985 | tempbx++; |
| 4986 | } |
| 4987 | /** tempbx = tempbx << 1; CH7007 ? **/ |
| 4988 | |
| 4989 | /*[Billy]07/05/29 CH7007*/ |
| 4990 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 4991 | { |
| 4992 | switch( tempbx ) |
| 4993 | { |
| 4994 | case 0: |
| 4995 | CHTVVCLKPtr = XGI7007_CHTVVCLKUNTSC ; |
| 4996 | break ; |
| 4997 | case 1: |
| 4998 | CHTVVCLKPtr = XGI7007_CHTVVCLKONTSC ; |
| 4999 | break ; |
| 5000 | case 2: |
| 5001 | CHTVVCLKPtr = XGI7007_CHTVVCLKUPAL ; |
| 5002 | break ; |
| 5003 | case 3: |
| 5004 | CHTVVCLKPtr = XGI7007_CHTVVCLKOPAL ; |
| 5005 | break ; |
| 5006 | default: |
| 5007 | break ; |
| 5008 | |
| 5009 | } |
| 5010 | } |
| 5011 | /*else |
| 5012 | { |
| 5013 | switch( tempbx ) |
| 5014 | { |
| 5015 | case 0: |
| 5016 | CHTVVCLKPtr = pVBInfo->CHTVVCLKUNTSC ; |
| 5017 | break ; |
| 5018 | case 1: |
| 5019 | CHTVVCLKPtr = pVBInfo->CHTVVCLKONTSC ; |
| 5020 | break ; |
| 5021 | case 2: |
| 5022 | CHTVVCLKPtr = pVBInfo->CHTVVCLKUPAL ; |
| 5023 | break ; |
| 5024 | case 3: |
| 5025 | CHTVVCLKPtr = pVBInfo->CHTVVCLKOPAL ; |
| 5026 | break ; |
| 5027 | default: |
| 5028 | break ; |
| 5029 | } |
| 5030 | }*/ |
| 5031 | |
| 5032 | tempal = CHTVVCLKPtr[ tempal ] ; |
| 5033 | return tempal ; |
| 5034 | } |
| 5035 | |
| 5036 | } |
| 5037 | |
| 5038 | tempal = ( UCHAR )XGINew_GetReg2( ( pVBInfo->P3ca + 0x02 ) ) ; |
| 5039 | tempal = tempal >> 2 ; |
| 5040 | tempal &= 0x03 ; |
| 5041 | |
| 5042 | if ( ( pVBInfo->LCDInfo & EnableScalingLCD ) && ( modeflag & Charx8Dot ) ) /* for Dot8 Scaling LCD */ |
| 5043 | tempal = tempal ^ tempal ; /* ; set to VCLK25MHz always */ |
| 5044 | |
| 5045 | if ( ModeNo <= 0x13 ) |
| 5046 | return tempal ; |
| 5047 | |
| 5048 | tempal = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRTVCLK ; |
| 5049 | return tempal ; |
| 5050 | } |
| 5051 | |
| 5052 | |
| 5053 | /* --------------------------------------------------------------------- */ |
| 5054 | /* Function : XGI_GetVCLKLen */ |
| 5055 | /* Input : */ |
| 5056 | /* Output : */ |
| 5057 | /* Description : */ |
| 5058 | /* --------------------------------------------------------------------- */ |
| 5059 | void XGI_GetVCLKLen(UCHAR tempal,UCHAR* di_0,UCHAR* di_1, PVB_DEVICE_INFO pVBInfo) |
| 5060 | { |
| 5061 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) /* [Billy] 2007/05/16 */ |
| 5062 | { |
| 5063 | /* VideoDebugPrint((0, "XGI_GetVCLKLen: pVBInfo->IF_DEF_CH7007==1\n")); */ |
| 5064 | *di_0 = ( UCHAR )XGI_CH7007VCLKData[ tempal ].SR2B ; |
| 5065 | *di_1 = ( UCHAR )XGI_CH7007VCLKData[ tempal ].SR2C ; |
| 5066 | } |
| 5067 | else if ( pVBInfo->VBType & ( VB_XGI301 | VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 5068 | { |
| 5069 | if ( ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) && ( pVBInfo->SetFlag & ProgrammingCRT2 ) ) |
| 5070 | { |
| 5071 | *di_0 = ( UCHAR )XGI_VBVCLKData[ tempal ].SR2B ; |
| 5072 | *di_1 = XGI_VBVCLKData[ tempal ].SR2C ; |
| 5073 | } |
| 5074 | } |
| 5075 | else |
| 5076 | { |
| 5077 | *di_0 = XGI_VCLKData[ tempal ].SR2B ; |
| 5078 | *di_1 = XGI_VCLKData[ tempal ].SR2C ; |
| 5079 | } |
| 5080 | } |
| 5081 | |
| 5082 | |
| 5083 | /* --------------------------------------------------------------------- */ |
| 5084 | /* Function : XGI_SetCRT2Offset */ |
| 5085 | /* Input : */ |
| 5086 | /* Output : */ |
| 5087 | /* Description : */ |
| 5088 | /* --------------------------------------------------------------------- */ |
| 5089 | void XGI_SetCRT2Offset( USHORT ModeNo , |
| 5090 | USHORT ModeIdIndex , USHORT RefreshRateTableIndex , PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo ) |
| 5091 | { |
| 5092 | USHORT offset ; |
| 5093 | UCHAR temp ; |
| 5094 | |
| 5095 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 5096 | { |
| 5097 | return ; |
| 5098 | } |
| 5099 | |
| 5100 | offset = XGI_GetOffset( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; |
| 5101 | temp = ( UCHAR )( offset & 0xFF ) ; |
| 5102 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , temp ) ; |
| 5103 | temp =( UCHAR)( ( offset & 0xFF00 ) >> 8 ) ; |
| 5104 | XGINew_SetReg1( pVBInfo->Part1Port , 0x09 , temp ) ; |
| 5105 | temp =( UCHAR )( ( ( offset >> 3 ) & 0xFF ) + 1 ) ; |
| 5106 | XGINew_SetReg1( pVBInfo->Part1Port , 0x03 , temp ) ; |
| 5107 | } |
| 5108 | |
| 5109 | |
| 5110 | /* --------------------------------------------------------------------- */ |
| 5111 | /* Function : XGI_GetOffset */ |
| 5112 | /* Input : */ |
| 5113 | /* Output : */ |
| 5114 | /* Description : */ |
| 5115 | /* --------------------------------------------------------------------- */ |
| 5116 | USHORT XGI_GetOffset(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo) |
| 5117 | { |
| 5118 | USHORT temp , |
| 5119 | colordepth , |
| 5120 | modeinfo , |
| 5121 | index , |
| 5122 | infoflag , |
| 5123 | ColorDepth[] = { 0x01 , 0x02 , 0x04 } ; |
| 5124 | |
| 5125 | modeinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeInfo ; |
| 5126 | if ( ModeNo <= 0x14 ) |
| 5127 | infoflag = 0 ; |
| 5128 | else |
| 5129 | infoflag = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; |
| 5130 | |
| 5131 | |
| 5132 | index = ( modeinfo >> 8 ) & 0xFF ; |
| 5133 | |
| 5134 | temp = pVBInfo->ScreenOffset[ index ] ; |
| 5135 | |
| 5136 | if ( infoflag & InterlaceMode ) |
| 5137 | { |
| 5138 | temp = temp << 1 ; |
| 5139 | } |
| 5140 | |
| 5141 | colordepth = XGI_GetColorDepth( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 5142 | |
| 5143 | if ( ( ModeNo >= 0x7C ) && ( ModeNo <= 0x7E ) ) |
| 5144 | { |
| 5145 | temp = ModeNo - 0x7C ; |
| 5146 | colordepth = ColorDepth[ temp ] ; |
| 5147 | temp = 0x6B ; |
| 5148 | if ( infoflag & InterlaceMode ) |
| 5149 | { |
| 5150 | temp = temp << 1 ; |
| 5151 | } |
| 5152 | return( temp * colordepth ) ; |
| 5153 | } |
| 5154 | else |
| 5155 | return( temp * colordepth ) ; |
| 5156 | } |
| 5157 | |
| 5158 | |
| 5159 | /* --------------------------------------------------------------------- */ |
| 5160 | /* Function : XGI_SetCRT2FIFO */ |
| 5161 | /* Input : */ |
| 5162 | /* Output : */ |
| 5163 | /* Description : */ |
| 5164 | /* --------------------------------------------------------------------- */ |
| 5165 | void XGI_SetCRT2FIFO( PVB_DEVICE_INFO pVBInfo) |
| 5166 | { |
| 5167 | XGINew_SetReg1( pVBInfo->Part1Port , 0x01 , 0x3B ) ; /* threshold high ,disable auto threshold */ |
| 5168 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x02 , ~( 0x3F ) , 0x04 ) ; /* threshold low default 04h */ |
| 5169 | } |
| 5170 | |
| 5171 | |
| 5172 | /* --------------------------------------------------------------------- */ |
| 5173 | /* Function : XGI_PreSetGroup1 */ |
| 5174 | /* Input : */ |
| 5175 | /* Output : */ |
| 5176 | /* Description : */ |
| 5177 | /* --------------------------------------------------------------------- */ |
| 5178 | void XGI_PreSetGroup1(USHORT ModeNo , USHORT ModeIdIndex ,PXGI_HW_DEVICE_INFO HwDeviceExtension, |
| 5179 | USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 5180 | { |
| 5181 | USHORT tempcx = 0 , |
| 5182 | CRT1Index = 0 , |
| 5183 | resinfo = 0 ; |
| 5184 | |
| 5185 | if ( ModeNo > 0x13 ) |
| 5186 | { |
| 5187 | CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; |
| 5188 | CRT1Index &= IndexMask ; |
| 5189 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 5190 | } |
| 5191 | |
| 5192 | XGI_SetCRT2Offset( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; |
| 5193 | XGI_SetCRT2FIFO(pVBInfo) ; |
| 5194 | /* XGI_SetCRT2Sync(ModeNo,RefreshRateTableIndex); */ |
| 5195 | |
| 5196 | for( tempcx = 4 ; tempcx < 7 ; tempcx++ ) |
| 5197 | { |
| 5198 | XGINew_SetReg1( pVBInfo->Part1Port , tempcx , 0x0 ) ; |
| 5199 | } |
| 5200 | |
| 5201 | XGINew_SetReg1( pVBInfo->Part1Port , 0x50 , 0x00 ) ; |
| 5202 | XGINew_SetReg1( pVBInfo->Part1Port , 0x02 , 0x44 ) ; /* temp 0206 */ |
| 5203 | } |
| 5204 | |
| 5205 | |
| 5206 | /* --------------------------------------------------------------------- */ |
| 5207 | /* Function : XGI_SetGroup1 */ |
| 5208 | /* Input : */ |
| 5209 | /* Output : */ |
| 5210 | /* Description : */ |
| 5211 | /* --------------------------------------------------------------------- */ |
| 5212 | void XGI_SetGroup1( USHORT ModeNo , USHORT ModeIdIndex , |
| 5213 | PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 5214 | { |
| 5215 | USHORT temp = 0 , |
| 5216 | tempax = 0 , |
| 5217 | tempbx = 0 , |
| 5218 | tempcx = 0 , |
| 5219 | pushbx = 0 , |
| 5220 | CRT1Index = 0 , |
| 5221 | modeflag , |
| 5222 | resinfo = 0 ; |
| 5223 | |
| 5224 | if ( ModeNo > 0x13 ) |
| 5225 | { |
| 5226 | CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; |
| 5227 | CRT1Index &= IndexMask ; |
| 5228 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 5229 | } |
| 5230 | |
| 5231 | if ( ModeNo <= 0x13 ) |
| 5232 | { |
| 5233 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 5234 | } |
| 5235 | else |
| 5236 | { |
| 5237 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 5238 | } |
| 5239 | |
| 5240 | /* bainy change table name */ |
| 5241 | if ( modeflag & HalfDCLK ) |
| 5242 | { |
| 5243 | temp = ( pVBInfo->VGAHT / 2 - 1 ) & 0x0FF ; /* BTVGA2HT 0x08,0x09 */ |
| 5244 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , temp ) ; |
| 5245 | temp = ( ( ( pVBInfo->VGAHT / 2 - 1 ) & 0xFF00 ) >> 8 ) << 4 ; |
| 5246 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x09 , ~0x0F0 , temp ) ; |
| 5247 | temp = ( pVBInfo->VGAHDE / 2 + 16 ) & 0x0FF ; /* BTVGA2HDEE 0x0A,0x0C */ |
| 5248 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0A , temp ) ; |
| 5249 | tempcx = ( ( pVBInfo->VGAHT - pVBInfo->VGAHDE ) / 2 ) >> 2 ; |
| 5250 | pushbx = pVBInfo->VGAHDE / 2 + 16 ; |
| 5251 | tempcx = tempcx >> 1 ; |
| 5252 | tempbx = pushbx + tempcx ; /* bx BTVGA@HRS 0x0B,0x0C */ |
| 5253 | tempcx += tempbx ; |
| 5254 | |
| 5255 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) |
| 5256 | { |
| 5257 | tempbx = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 4 ] ; |
| 5258 | tempbx |= ( ( pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 14 ] & 0xC0 ) << 2 ) ; |
| 5259 | tempbx = ( tempbx - 3 ) << 3 ; /* (VGAHRS-3)*8 */ |
| 5260 | tempcx = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[ 5 ] ; |
| 5261 | tempcx &= 0x1F ; |
| 5262 | temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 15 ] ; |
| 5263 | temp = ( temp & 0x04 ) << ( 5 - 2 ) ; /* VGAHRE D[5] */ |
| 5264 | tempcx = ( ( tempcx | temp ) - 3 ) << 3 ; /* (VGAHRE-3)*8 */ |
| 5265 | } |
| 5266 | |
| 5267 | tempbx += 4 ; |
| 5268 | tempcx += 4 ; |
| 5269 | |
| 5270 | if ( tempcx > ( pVBInfo->VGAHT / 2 ) ) |
| 5271 | tempcx = pVBInfo->VGAHT / 2 ; |
| 5272 | |
| 5273 | temp = tempbx & 0x00FF ; |
| 5274 | |
| 5275 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0B , temp ) ; |
| 5276 | } |
| 5277 | else |
| 5278 | { |
| 5279 | temp = ( pVBInfo->VGAHT - 1 ) & 0x0FF ; /* BTVGA2HT 0x08,0x09 */ |
| 5280 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , temp ) ; |
| 5281 | temp = ( ( ( pVBInfo->VGAHT - 1 ) & 0xFF00 ) >> 8 ) << 4 ; |
| 5282 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x09 , ~0x0F0 , temp ) ; |
| 5283 | temp = ( pVBInfo->VGAHDE + 16 ) & 0x0FF ; /* BTVGA2HDEE 0x0A,0x0C */ |
| 5284 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0A , temp ) ; |
| 5285 | tempcx = ( pVBInfo->VGAHT - pVBInfo->VGAHDE ) >> 2 ; /* cx */ |
| 5286 | pushbx = pVBInfo->VGAHDE + 16 ; |
| 5287 | tempcx = tempcx >> 1 ; |
| 5288 | tempbx = pushbx + tempcx ; /* bx BTVGA@HRS 0x0B,0x0C */ |
| 5289 | tempcx += tempbx ; |
| 5290 | |
| 5291 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) |
| 5292 | { |
| 5293 | tempbx = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 3 ] ; |
| 5294 | tempbx |= ( ( pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 5 ] & 0xC0 ) << 2 ) ; |
| 5295 | tempbx = ( tempbx - 3 ) << 3 ; /* (VGAHRS-3)*8 */ |
| 5296 | tempcx = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 4 ] ; |
| 5297 | tempcx &= 0x1F ; |
| 5298 | temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 6 ] ; |
| 5299 | temp = ( temp & 0x04 ) << ( 5 - 2 ) ; /* VGAHRE D[5] */ |
| 5300 | tempcx = ( ( tempcx | temp ) - 3 ) << 3 ; /* (VGAHRE-3)*8 */ |
| 5301 | tempbx += 16 ; |
| 5302 | tempcx += 16 ; |
| 5303 | } |
| 5304 | |
| 5305 | if ( tempcx > pVBInfo->VGAHT ) |
| 5306 | tempcx = pVBInfo->VGAHT ; |
| 5307 | |
| 5308 | temp = tempbx & 0x00FF ; |
| 5309 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0B , temp ) ; |
| 5310 | } |
| 5311 | |
| 5312 | tempax = ( tempax & 0x00FF ) | ( tempbx & 0xFF00 ) ; |
| 5313 | tempbx = pushbx ; |
| 5314 | tempbx = ( tempbx & 0x00FF ) | ( ( tempbx & 0xFF00 ) << 4 ) ; |
| 5315 | tempax |= ( tempbx & 0xFF00 ) ; |
| 5316 | temp = ( tempax & 0xFF00 ) >> 8 ; |
| 5317 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0C , temp ) ; |
| 5318 | temp = tempcx & 0x00FF ; |
| 5319 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0D , temp ) ; |
| 5320 | tempcx = ( pVBInfo->VGAVT - 1 ) ; |
| 5321 | temp = tempcx & 0x00FF ; |
| 5322 | |
| 5323 | if ( pVBInfo->IF_DEF_CH7005 == 1 ) |
| 5324 | { |
| 5325 | if ( pVBInfo->VBInfo & 0x0C ) |
| 5326 | { |
| 5327 | temp-- ; |
| 5328 | } |
| 5329 | } |
| 5330 | |
| 5331 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0E , temp ) ; |
| 5332 | tempbx = pVBInfo->VGAVDE - 1 ; |
| 5333 | temp = tempbx & 0x00FF ; |
| 5334 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0F , temp ) ; |
| 5335 | temp = ( ( tempbx & 0xFF00 ) << 3 ) >> 8 ; |
| 5336 | temp |= ( ( tempcx & 0xFF00 ) >> 8 ) ; |
| 5337 | XGINew_SetReg1( pVBInfo->Part1Port , 0x12 , temp ) ; |
| 5338 | |
| 5339 | tempax = pVBInfo->VGAVDE ; |
| 5340 | tempbx = pVBInfo->VGAVDE ; |
| 5341 | tempcx = pVBInfo->VGAVT ; |
| 5342 | tempbx = ( pVBInfo->VGAVT + pVBInfo->VGAVDE ) >> 1 ; /* BTVGA2VRS 0x10,0x11 */ |
| 5343 | tempcx = ( ( pVBInfo->VGAVT - pVBInfo->VGAVDE ) >> 4 ) + tempbx + 1 ; /* BTVGA2VRE 0x11 */ |
| 5344 | |
| 5345 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) |
| 5346 | { |
| 5347 | tempbx = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 10 ] ; |
| 5348 | temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 9 ] ; |
| 5349 | |
| 5350 | if ( temp & 0x04 ) |
| 5351 | tempbx |= 0x0100 ; |
| 5352 | |
| 5353 | if ( temp & 0x080 ) |
| 5354 | tempbx |= 0x0200 ; |
| 5355 | |
| 5356 | temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 14 ] ; |
| 5357 | |
| 5358 | if ( temp & 0x08 ) |
| 5359 | tempbx |= 0x0400 ; |
| 5360 | |
| 5361 | temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 11 ] ; |
| 5362 | tempcx = ( tempcx & 0xFF00 ) | ( temp & 0x00FF ) ; |
| 5363 | } |
| 5364 | |
| 5365 | temp = tempbx & 0x00FF ; |
| 5366 | XGINew_SetReg1( pVBInfo->Part1Port , 0x10 , temp ) ; |
| 5367 | temp = ( ( tempbx & 0xFF00 ) >> 8 ) << 4 ; |
| 5368 | temp = ( ( tempcx & 0x000F ) | ( temp ) ) ; |
| 5369 | XGINew_SetReg1( pVBInfo->Part1Port , 0x11 , temp ) ; |
| 5370 | tempax = 0 ; |
| 5371 | |
| 5372 | if ( modeflag & DoubleScanMode ) |
| 5373 | tempax |= 0x80 ; |
| 5374 | |
| 5375 | if ( modeflag & HalfDCLK ) |
| 5376 | tempax |= 0x40 ; |
| 5377 | |
| 5378 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2C , ~0x0C0 , tempax ) ; |
| 5379 | } |
| 5380 | |
| 5381 | |
| 5382 | /* --------------------------------------------------------------------- */ |
| 5383 | /* Function : XGI_SetLockRegs */ |
| 5384 | /* Input : */ |
| 5385 | /* Output : */ |
| 5386 | /* Description : */ |
| 5387 | /* --------------------------------------------------------------------- */ |
| 5388 | void XGI_SetLockRegs( USHORT ModeNo , USHORT ModeIdIndex , |
| 5389 | PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 5390 | { |
| 5391 | USHORT push1 , |
| 5392 | push2 , |
| 5393 | tempax , |
| 5394 | tempbx = 0 , |
| 5395 | tempcx , |
| 5396 | temp , |
| 5397 | resinfo , |
| 5398 | modeflag , |
| 5399 | CRT1Index ; |
| 5400 | |
| 5401 | if ( ModeNo <= 0x13 ) |
| 5402 | { |
| 5403 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ |
| 5404 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; |
| 5405 | } |
| 5406 | else |
| 5407 | { |
| 5408 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ |
| 5409 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 5410 | CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; |
| 5411 | CRT1Index &= IndexMask; |
| 5412 | } |
| 5413 | |
| 5414 | if ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) |
| 5415 | { |
| 5416 | return ; |
| 5417 | } |
| 5418 | |
| 5419 | temp = 0xFF ; /* set MAX HT */ |
| 5420 | XGINew_SetReg1( pVBInfo->Part1Port , 0x03 , temp ) ; |
| 5421 | /* if ( modeflag & Charx8Dot ) tempcx = 0x08 ; */ |
| 5422 | /* else */ |
| 5423 | tempcx=0x08; |
| 5424 | |
| 5425 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 5426 | modeflag |= Charx8Dot ; |
| 5427 | |
| 5428 | tempax = pVBInfo->VGAHDE ; /* 0x04 Horizontal Display End */ |
| 5429 | |
| 5430 | if ( modeflag & HalfDCLK ) |
| 5431 | tempax = tempax >> 1 ; |
| 5432 | |
| 5433 | tempax = ( tempax / tempcx ) - 1 ; |
| 5434 | tempbx |= ( ( tempax & 0x00FF ) << 8 ) ; |
| 5435 | temp = tempax & 0x00FF ; |
| 5436 | XGINew_SetReg1( pVBInfo->Part1Port , 0x04 , temp ) ; |
| 5437 | |
| 5438 | temp = ( tempbx & 0xFF00 ) >> 8 ; |
| 5439 | |
| 5440 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 5441 | { |
| 5442 | if ( !( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) ) |
| 5443 | temp += 2 ; |
| 5444 | |
| 5445 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 5446 | { |
| 5447 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 5448 | { |
| 5449 | if ( pVBInfo->VBExtInfo == VB_YPbPr1080i ) |
| 5450 | { |
| 5451 | if ( resinfo == 7 ) |
| 5452 | temp -= 2 ; |
| 5453 | } |
| 5454 | } |
| 5455 | else |
| 5456 | if ( resinfo == 7 ) |
| 5457 | temp -= 2 ; |
| 5458 | } |
| 5459 | } |
| 5460 | |
| 5461 | XGINew_SetReg1( pVBInfo->Part1Port , 0x05 , temp ) ; /* 0x05 Horizontal Display Start */ |
| 5462 | XGINew_SetReg1( pVBInfo->Part1Port , 0x06 , 0x03 ) ; /* 0x06 Horizontal Blank end */ |
| 5463 | |
| 5464 | if ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) |
| 5465 | { /* 030226 bainy */ |
| 5466 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 5467 | tempax = pVBInfo->VGAHT ; |
| 5468 | else |
| 5469 | tempax = XGI_GetVGAHT2( pVBInfo) ; |
| 5470 | } |
| 5471 | |
| 5472 | if ( tempax >= pVBInfo->VGAHT ) |
| 5473 | { |
| 5474 | tempax = pVBInfo->VGAHT ; |
| 5475 | } |
| 5476 | |
| 5477 | if ( modeflag & HalfDCLK ) |
| 5478 | { |
| 5479 | tempax = tempax >> 1 ; |
| 5480 | } |
| 5481 | |
| 5482 | tempax = ( tempax / tempcx ) - 5 ; |
| 5483 | tempcx = tempax ; /* 20030401 0x07 horizontal Retrace Start */ |
| 5484 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 5485 | { |
| 5486 | temp = ( tempbx & 0x00FF ) - 1 ; |
| 5487 | if ( !( modeflag & HalfDCLK ) ) |
| 5488 | { |
| 5489 | temp -= 6 ; |
| 5490 | if ( pVBInfo->TVInfo & TVSimuMode ) |
| 5491 | { |
| 5492 | temp -= 4 ; |
| 5493 | if ( ModeNo > 0x13 ) |
| 5494 | temp -= 10 ; |
| 5495 | } |
| 5496 | } |
| 5497 | } |
| 5498 | else |
| 5499 | { |
| 5500 | /* tempcx = tempbx & 0x00FF ; */ |
| 5501 | tempbx = ( tempbx & 0xFF00 ) >> 8 ; |
| 5502 | tempcx = ( tempcx + tempbx ) >> 1 ; |
| 5503 | temp = ( tempcx & 0x00FF ) + 2 ; |
| 5504 | |
| 5505 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 5506 | { |
| 5507 | temp -= 1 ; |
| 5508 | if ( !( modeflag & HalfDCLK ) ) |
| 5509 | { |
| 5510 | if ( ( modeflag & Charx8Dot ) ) |
| 5511 | { |
| 5512 | temp += 4 ; |
| 5513 | if ( pVBInfo->VGAHDE >= 800 ) |
| 5514 | { |
| 5515 | temp -= 6 ; |
| 5516 | } |
| 5517 | } |
| 5518 | } |
| 5519 | } |
| 5520 | else |
| 5521 | { |
| 5522 | if ( !( modeflag & HalfDCLK ) ) |
| 5523 | { |
| 5524 | temp -= 4 ; |
| 5525 | if ( pVBInfo->LCDResInfo != Panel1280x960 ) |
| 5526 | { |
| 5527 | if( pVBInfo->VGAHDE >= 800 ) |
| 5528 | { |
| 5529 | temp -= 7 ; |
| 5530 | if ( pVBInfo->ModeType == ModeEGA ) |
| 5531 | { |
| 5532 | if ( pVBInfo->VGAVDE == 1024 ) |
| 5533 | { |
| 5534 | temp += 15 ; |
| 5535 | if ( pVBInfo->LCDResInfo != Panel1280x1024 ) |
| 5536 | { |
| 5537 | temp += 7 ; |
| 5538 | } |
| 5539 | } |
| 5540 | } |
| 5541 | |
| 5542 | if ( pVBInfo->VGAHDE >= 1280 ) |
| 5543 | { |
| 5544 | if ( pVBInfo->LCDResInfo != Panel1280x960 ) |
| 5545 | { |
| 5546 | if ( pVBInfo->LCDInfo & LCDNonExpanding ) |
| 5547 | { |
| 5548 | temp += 28 ; |
| 5549 | } |
| 5550 | } |
| 5551 | } |
| 5552 | } |
| 5553 | } |
| 5554 | } |
| 5555 | } |
| 5556 | } |
| 5557 | |
| 5558 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , temp ) ; /* 0x07 Horizontal Retrace Start */ |
| 5559 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0 ) ; /* 0x08 Horizontal Retrace End */ |
| 5560 | |
| 5561 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 5562 | { |
| 5563 | if ( pVBInfo->TVInfo & TVSimuMode ) |
| 5564 | { |
| 5565 | if ( ( ModeNo == 0x06 ) || ( ModeNo == 0x10 ) || ( ModeNo == 0x11 ) || ( ModeNo == 0x13 ) || ( ModeNo == 0x0F ) ) |
| 5566 | { |
| 5567 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x5b ) ; |
| 5568 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x03 ) ; |
| 5569 | } |
| 5570 | |
| 5571 | if ( ( ModeNo == 0x00 ) || ( ModeNo == 0x01 ) ) |
| 5572 | { |
| 5573 | if ( pVBInfo->TVInfo & SetNTSCTV ) |
| 5574 | { |
| 5575 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x2A ) ; |
| 5576 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x61 ) ; |
| 5577 | } |
| 5578 | else |
| 5579 | { |
| 5580 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x2A ) ; |
| 5581 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x41 ) ; |
| 5582 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0C , 0xF0 ) ; |
| 5583 | } |
| 5584 | } |
| 5585 | |
| 5586 | if ( ( ModeNo == 0x02 ) || ( ModeNo == 0x03 ) || ( ModeNo == 0x07 ) ) |
| 5587 | { |
| 5588 | if ( pVBInfo->TVInfo & SetNTSCTV ) |
| 5589 | { |
| 5590 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x54 ) ; |
| 5591 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x00 ) ; |
| 5592 | } |
| 5593 | else |
| 5594 | { |
| 5595 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x55 ) ; |
| 5596 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x00 ) ; |
| 5597 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0C , 0xF0 ) ; |
| 5598 | } |
| 5599 | } |
| 5600 | |
| 5601 | if ( ( ModeNo == 0x04 ) || ( ModeNo == 0x05 ) || ( ModeNo == 0x0D ) || ( ModeNo == 0x50 ) ) |
| 5602 | { |
| 5603 | if ( pVBInfo->TVInfo & SetNTSCTV ) |
| 5604 | { |
| 5605 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x30 ) ; |
| 5606 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x03 ) ; |
| 5607 | } |
| 5608 | else |
| 5609 | { |
| 5610 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x2f ) ; |
| 5611 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x02 ) ; |
| 5612 | } |
| 5613 | } |
| 5614 | } |
| 5615 | } |
| 5616 | |
| 5617 | XGINew_SetReg1( pVBInfo->Part1Port , 0x18 , 0x03 ) ; /* 0x18 SR0B */ |
| 5618 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x19 , 0xF0 , 0x00 ) ; |
| 5619 | XGINew_SetReg1( pVBInfo->Part1Port , 0x09 , 0xFF ) ; /* 0x09 Set Max VT */ |
| 5620 | |
| 5621 | tempbx = pVBInfo->VGAVT ; |
| 5622 | push1 = tempbx ; |
| 5623 | tempcx = 0x121 ; |
| 5624 | tempbx = pVBInfo->VGAVDE ; /* 0x0E Virtical Display End */ |
| 5625 | |
| 5626 | if ( tempbx == 357 ) |
| 5627 | tempbx = 350 ; |
| 5628 | if ( tempbx == 360 ) |
| 5629 | tempbx =350 ; |
| 5630 | if ( tempbx == 375 ) |
| 5631 | tempbx = 350 ; |
| 5632 | if ( tempbx == 405 ) |
| 5633 | tempbx = 400 ; |
| 5634 | if ( tempbx == 525 ) |
| 5635 | tempbx = 480 ; |
| 5636 | |
| 5637 | push2 = tempbx ; |
| 5638 | |
| 5639 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) |
| 5640 | { |
| 5641 | if ( pVBInfo->LCDResInfo == Panel1024x768 ) |
| 5642 | { |
| 5643 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) |
| 5644 | { |
| 5645 | if ( tempbx == 350 ) |
| 5646 | tempbx += 5 ; |
| 5647 | if ( tempbx == 480 ) |
| 5648 | tempbx += 5 ; |
| 5649 | } |
| 5650 | } |
| 5651 | } |
| 5652 | tempbx-- ; |
| 5653 | temp = tempbx & 0x00FF ; |
| 5654 | tempbx-- ; |
| 5655 | temp = tempbx & 0x00FF ; |
| 5656 | XGINew_SetReg1( pVBInfo->Part1Port , 0x10 ,temp ) ; /* 0x10 vertical Blank Start */ |
| 5657 | tempbx = push2 ; |
| 5658 | tempbx-- ; |
| 5659 | temp = tempbx & 0x00FF ; |
| 5660 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0E , temp ) ; |
| 5661 | |
| 5662 | if ( tempbx & 0x0100 ) |
| 5663 | { |
| 5664 | tempcx |= 0x0002 ; |
| 5665 | } |
| 5666 | |
| 5667 | tempax = 0x000B ; |
| 5668 | |
| 5669 | if ( modeflag & DoubleScanMode ) |
| 5670 | { |
| 5671 | tempax |= 0x08000 ; |
| 5672 | } |
| 5673 | |
| 5674 | if ( tempbx & 0x0200 ) |
| 5675 | { |
| 5676 | tempcx |= 0x0040 ; |
| 5677 | } |
| 5678 | |
| 5679 | temp = ( tempax & 0xFF00 ) >> 8 ; |
| 5680 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0B , temp ) ; |
| 5681 | |
| 5682 | if ( tempbx & 0x0400 ) |
| 5683 | { |
| 5684 | tempcx |= 0x0600 ; |
| 5685 | } |
| 5686 | |
| 5687 | XGINew_SetReg1( pVBInfo->Part1Port , 0x11 , 0x00 ) ; /* 0x11 Vertival Blank End */ |
| 5688 | |
| 5689 | tempax = push1 ; |
| 5690 | tempax -= tempbx ; /* 0x0C Vertical Retrace Start */ |
| 5691 | tempax = tempax >> 2 ; |
| 5692 | push1 = tempax ; /* push ax */ |
| 5693 | |
| 5694 | if ( resinfo != 0x09 ) |
| 5695 | { |
| 5696 | tempax = tempax << 1 ; |
| 5697 | tempbx += tempax ; |
| 5698 | } |
| 5699 | |
| 5700 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 5701 | { |
| 5702 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 5703 | { |
| 5704 | if ( pVBInfo->TVInfo & SetYPbPrMode1080i ) |
| 5705 | tempbx -= 10 ; |
| 5706 | else |
| 5707 | { |
| 5708 | if ( pVBInfo->TVInfo & TVSimuMode ) |
| 5709 | { |
| 5710 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 5711 | { |
| 5712 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 5713 | { |
| 5714 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i ) ) ) |
| 5715 | tempbx += 40 ; |
| 5716 | } |
| 5717 | else |
| 5718 | tempbx += 40 ; |
| 5719 | } |
| 5720 | } |
| 5721 | } |
| 5722 | } |
| 5723 | else |
| 5724 | tempbx -= 10 ; |
| 5725 | } |
| 5726 | else |
| 5727 | { |
| 5728 | if ( pVBInfo->TVInfo & TVSimuMode ) |
| 5729 | { |
| 5730 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 5731 | { |
| 5732 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 5733 | { |
| 5734 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i ) ) ) |
| 5735 | tempbx += 40 ; |
| 5736 | } |
| 5737 | else |
| 5738 | tempbx += 40 ; |
| 5739 | } |
| 5740 | } |
| 5741 | } |
| 5742 | tempax = push1 ; |
| 5743 | tempax = tempax >> 2 ; |
| 5744 | tempax++ ; |
| 5745 | tempax += tempbx ; |
| 5746 | push1 = tempax ; /* push ax */ |
| 5747 | |
| 5748 | if ( ( pVBInfo->TVInfo & SetPALTV ) ) |
| 5749 | { |
| 5750 | if ( tempbx <= 513 ) |
| 5751 | { |
| 5752 | if ( tempax >= 513 ) |
| 5753 | { |
| 5754 | tempbx = 513 ; |
| 5755 | } |
| 5756 | } |
| 5757 | } |
| 5758 | |
| 5759 | temp = tempbx & 0x00FF ; |
| 5760 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0C , temp ) ; |
| 5761 | tempbx-- ; |
| 5762 | temp = tempbx & 0x00FF ; |
| 5763 | XGINew_SetReg1( pVBInfo->Part1Port , 0x10 , temp ) ; |
| 5764 | |
| 5765 | if ( tempbx & 0x0100 ) |
| 5766 | { |
| 5767 | tempcx |= 0x0008 ; |
| 5768 | } |
| 5769 | |
| 5770 | if ( tempbx & 0x0200 ) |
| 5771 | { |
| 5772 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x0B , 0x0FF , 0x20 ) ; |
| 5773 | } |
| 5774 | |
| 5775 | tempbx++ ; |
| 5776 | |
| 5777 | if ( tempbx & 0x0100 ) |
| 5778 | { |
| 5779 | tempcx |= 0x0004 ; |
| 5780 | } |
| 5781 | |
| 5782 | if ( tempbx & 0x0200 ) |
| 5783 | { |
| 5784 | tempcx |= 0x0080 ; |
| 5785 | } |
| 5786 | |
| 5787 | if ( tempbx & 0x0400 ) |
| 5788 | { |
| 5789 | tempcx |= 0x0C00 ; |
| 5790 | } |
| 5791 | |
| 5792 | tempbx = push1 ; /* pop ax */ |
| 5793 | temp = tempbx & 0x00FF ; |
| 5794 | temp &= 0x0F ; |
| 5795 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0D , temp ) ; /* 0x0D vertical Retrace End */ |
| 5796 | |
| 5797 | if ( tempbx & 0x0010 ) |
| 5798 | { |
| 5799 | tempcx |= 0x2000 ; |
| 5800 | } |
| 5801 | |
| 5802 | temp = tempcx & 0x00FF ; |
| 5803 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0A , temp ) ; /* 0x0A CR07 */ |
| 5804 | temp = ( tempcx & 0x0FF00 ) >> 8 ; |
| 5805 | XGINew_SetReg1( pVBInfo->Part1Port , 0x17 , temp ) ; /* 0x17 SR0A */ |
| 5806 | tempax = modeflag ; |
| 5807 | temp = ( tempax & 0xFF00 ) >> 8 ; |
| 5808 | |
| 5809 | temp = ( temp >> 1 ) & 0x09 ; |
| 5810 | |
| 5811 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 5812 | temp |= 0x01 ; |
| 5813 | |
| 5814 | XGINew_SetReg1( pVBInfo->Part1Port , 0x16 , temp ) ; /* 0x16 SR01 */ |
| 5815 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0F , 0 ) ; /* 0x0F CR14 */ |
| 5816 | XGINew_SetReg1( pVBInfo->Part1Port , 0x12 , 0 ) ; /* 0x12 CR17 */ |
| 5817 | |
| 5818 | if ( pVBInfo->LCDInfo & LCDRGB18Bit ) |
| 5819 | temp = 0x80 ; |
| 5820 | else |
| 5821 | temp = 0x00 ; |
| 5822 | |
| 5823 | XGINew_SetReg1( pVBInfo->Part1Port , 0x1A , temp ) ; /* 0x1A SR0E */ |
| 5824 | |
| 5825 | return ; |
| 5826 | } |
| 5827 | |
| 5828 | |
| 5829 | /* --------------------------------------------------------------------- */ |
| 5830 | /* Function : XGI_SetGroup2 */ |
| 5831 | /* Input : */ |
| 5832 | /* Output : */ |
| 5833 | /* Description : */ |
| 5834 | /* --------------------------------------------------------------------- */ |
| 5835 | void XGI_SetGroup2( USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, |
| 5836 | PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo ) |
| 5837 | { |
| 5838 | USHORT i , |
| 5839 | j , |
| 5840 | tempax , |
| 5841 | tempbx , |
| 5842 | tempcx , |
| 5843 | temp , |
| 5844 | push1 , |
| 5845 | push2 , |
| 5846 | modeflag , |
| 5847 | resinfo , |
| 5848 | crt2crtc ; |
| 5849 | UCHAR *TimingPoint ; |
| 5850 | |
| 5851 | ULONG longtemp , |
| 5852 | tempeax , |
| 5853 | tempebx , |
| 5854 | temp2 , |
| 5855 | tempecx ; |
| 5856 | |
| 5857 | if ( ModeNo <= 0x13 ) |
| 5858 | { |
| 5859 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ |
| 5860 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; |
| 5861 | crt2crtc = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; |
| 5862 | } |
| 5863 | else |
| 5864 | { |
| 5865 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ |
| 5866 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 5867 | crt2crtc = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC ; |
| 5868 | } |
| 5869 | |
| 5870 | tempax = 0 ; |
| 5871 | |
| 5872 | if ( !( pVBInfo->VBInfo & SetCRT2ToAVIDEO ) ) |
| 5873 | tempax |= 0x0800 ; |
| 5874 | |
| 5875 | if ( !( pVBInfo->VBInfo & SetCRT2ToSVIDEO ) ) |
| 5876 | tempax |= 0x0400 ; |
| 5877 | |
| 5878 | if ( pVBInfo->VBInfo & SetCRT2ToSCART ) |
| 5879 | tempax |= 0x0200 ; |
| 5880 | |
| 5881 | if ( !( pVBInfo->TVInfo & SetPALTV ) ) |
| 5882 | tempax |= 0x1000 ; |
| 5883 | |
| 5884 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 5885 | tempax |= 0x0100 ; |
| 5886 | |
| 5887 | if ( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) |
| 5888 | tempax &= 0xfe00 ; |
| 5889 | |
| 5890 | tempax = ( tempax & 0xff00 ) >> 8 ; |
| 5891 | |
| 5892 | XGINew_SetReg1( pVBInfo->Part2Port , 0x0 , tempax ) ; |
| 5893 | TimingPoint = pVBInfo->NTSCTiming ; |
| 5894 | |
| 5895 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 5896 | { |
| 5897 | TimingPoint = pVBInfo->PALTiming ; |
| 5898 | } |
| 5899 | |
| 5900 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 5901 | { |
| 5902 | TimingPoint = pVBInfo->HiTVExtTiming ; |
| 5903 | |
| 5904 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 5905 | TimingPoint = pVBInfo->HiTVSt2Timing ; |
| 5906 | |
| 5907 | if ( pVBInfo->SetFlag & TVSimuMode ) |
| 5908 | TimingPoint = pVBInfo->HiTVSt1Timing ; |
| 5909 | |
| 5910 | if ( !(modeflag & Charx8Dot) ) |
| 5911 | TimingPoint = pVBInfo->HiTVTextTiming ; |
| 5912 | } |
| 5913 | |
| 5914 | if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) |
| 5915 | { |
| 5916 | if ( pVBInfo->TVInfo & SetYPbPrMode525i ) |
| 5917 | TimingPoint = pVBInfo->YPbPr525iTiming ; |
| 5918 | |
| 5919 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) |
| 5920 | TimingPoint = pVBInfo->YPbPr525pTiming ; |
| 5921 | |
| 5922 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) |
| 5923 | TimingPoint = pVBInfo->YPbPr750pTiming ; |
| 5924 | } |
| 5925 | |
| 5926 | for( i = 0x01 , j = 0 ; i <= 0x2D ; i++ , j++ ) |
| 5927 | { |
| 5928 | XGINew_SetReg1( pVBInfo->Part2Port , i , TimingPoint[ j ] ) ; |
| 5929 | } |
| 5930 | |
| 5931 | for( i = 0x39 ; i <= 0x45 ; i++ , j++ ) |
| 5932 | { |
| 5933 | XGINew_SetReg1( pVBInfo->Part2Port , i , TimingPoint[ j ] ) ; /* di->temp2[j] */ |
| 5934 | } |
| 5935 | |
| 5936 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 5937 | { |
| 5938 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x3A , 0x1F , 0x00 ) ; |
| 5939 | } |
| 5940 | |
| 5941 | temp = pVBInfo->NewFlickerMode ; |
| 5942 | temp &= 0x80 ; |
| 5943 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x0A , 0xFF , temp ) ; |
| 5944 | |
| 5945 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 5946 | tempax = 950 ; |
| 5947 | |
| 5948 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 5949 | tempax = 520 ; |
| 5950 | else |
| 5951 | tempax = 440 ; |
| 5952 | |
| 5953 | if ( pVBInfo->VDE <= tempax ) |
| 5954 | { |
| 5955 | tempax -= pVBInfo->VDE ; |
| 5956 | tempax = tempax >> 2 ; |
| 5957 | tempax = ( tempax & 0x00FF ) | ( ( tempax & 0x00FF ) << 8 ) ; |
| 5958 | push1 = tempax ; |
| 5959 | temp = ( tempax & 0xFF00 ) >> 8 ; |
| 5960 | temp += ( USHORT )TimingPoint[ 0 ] ; |
| 5961 | |
| 5962 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 5963 | { |
| 5964 | if ( pVBInfo->VBInfo & ( SetCRT2ToAVIDEO | SetCRT2ToSVIDEO | SetCRT2ToSCART | SetCRT2ToYPbPr ) ) |
| 5965 | { |
| 5966 | tempcx=pVBInfo->VGAHDE; |
| 5967 | if ( tempcx >= 1024 ) |
| 5968 | { |
| 5969 | temp = 0x17 ; /* NTSC */ |
| 5970 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 5971 | temp = 0x19 ; /* PAL */ |
| 5972 | } |
| 5973 | } |
| 5974 | } |
| 5975 | |
| 5976 | XGINew_SetReg1( pVBInfo->Part2Port , 0x01 , temp ) ; |
| 5977 | tempax = push1 ; |
| 5978 | temp = ( tempax & 0xFF00 ) >> 8 ; |
| 5979 | temp += TimingPoint[ 1 ] ; |
| 5980 | |
| 5981 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 5982 | { |
| 5983 | if ( ( pVBInfo->VBInfo & ( SetCRT2ToAVIDEO | SetCRT2ToSVIDEO | SetCRT2ToSCART | SetCRT2ToYPbPr ) ) ) |
| 5984 | { |
| 5985 | tempcx = pVBInfo->VGAHDE ; |
| 5986 | if ( tempcx >= 1024 ) |
| 5987 | { |
| 5988 | temp = 0x1D ; /* NTSC */ |
| 5989 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 5990 | temp = 0x52 ; /* PAL */ |
| 5991 | } |
| 5992 | } |
| 5993 | } |
| 5994 | XGINew_SetReg1( pVBInfo->Part2Port , 0x02 , temp ) ; |
| 5995 | } |
| 5996 | |
| 5997 | /* 301b */ |
| 5998 | tempcx = pVBInfo->HT ; |
| 5999 | |
| 6000 | if ( XGI_IsLCDDualLink( pVBInfo ) ) |
| 6001 | tempcx = tempcx >> 1 ; |
| 6002 | |
| 6003 | tempcx -= 2 ; |
| 6004 | temp = tempcx & 0x00FF ; |
| 6005 | XGINew_SetReg1( pVBInfo->Part2Port , 0x1B , temp ) ; |
| 6006 | |
| 6007 | temp = ( tempcx & 0xFF00 ) >> 8 ; |
| 6008 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x1D , ~0x0F , temp ) ; |
| 6009 | |
| 6010 | tempcx = pVBInfo->HT >> 1 ; |
| 6011 | push1 = tempcx ; /* push cx */ |
| 6012 | tempcx += 7 ; |
| 6013 | |
| 6014 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 6015 | { |
| 6016 | tempcx -= 4 ; |
| 6017 | } |
| 6018 | |
| 6019 | temp = tempcx & 0x00FF ; |
| 6020 | temp = temp << 4 ; |
| 6021 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x22 , 0x0F , temp ) ; |
| 6022 | |
| 6023 | tempbx = TimingPoint[ j ] | ( ( TimingPoint[ j + 1 ] ) << 8 ) ; |
| 6024 | tempbx += tempcx ; |
| 6025 | push2 = tempbx ; |
| 6026 | temp = tempbx & 0x00FF ; |
| 6027 | XGINew_SetReg1( pVBInfo->Part2Port , 0x24 , temp ) ; |
| 6028 | temp = ( tempbx & 0xFF00 ) >> 8 ; |
| 6029 | temp = temp << 4 ; |
| 6030 | XGINew_SetRegANDOR(pVBInfo->Part2Port,0x25,0x0F,temp); |
| 6031 | |
| 6032 | tempbx=push2; |
| 6033 | tempbx=tempbx+8; |
| 6034 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 6035 | { |
| 6036 | tempbx=tempbx-4; |
| 6037 | tempcx=tempbx; |
| 6038 | } |
| 6039 | |
| 6040 | temp = ( tempbx & 0x00FF ) << 4 ; |
| 6041 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x29 , 0x0F , temp ) ; |
| 6042 | |
| 6043 | j += 2 ; |
| 6044 | tempcx += ( TimingPoint[ j ] | ( ( TimingPoint[ j + 1 ] ) << 8 ) ) ; |
| 6045 | temp = tempcx & 0x00FF ; |
| 6046 | XGINew_SetReg1( pVBInfo->Part2Port , 0x27 , temp ) ; |
| 6047 | temp = ( ( tempcx & 0xFF00 ) >> 8 ) << 4 ; |
| 6048 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x28 , 0x0F , temp ) ; |
| 6049 | |
| 6050 | tempcx += 8 ; |
| 6051 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 6052 | { |
| 6053 | tempcx -= 4 ; |
| 6054 | } |
| 6055 | |
| 6056 | temp = tempcx & 0xFF ; |
| 6057 | temp = temp << 4 ; |
| 6058 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x2A , 0x0F , temp ) ; |
| 6059 | |
| 6060 | tempcx = push1 ; /* pop cx */ |
| 6061 | j += 2 ; |
| 6062 | temp = TimingPoint[ j ] | ( ( TimingPoint[ j + 1 ] ) << 8 ) ; |
| 6063 | tempcx -= temp ; |
| 6064 | temp = tempcx & 0x00FF ; |
| 6065 | temp = temp << 4 ; |
| 6066 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x2D , 0x0F ,temp ) ; |
| 6067 | |
| 6068 | tempcx -= 11 ; |
| 6069 | |
| 6070 | if ( !( pVBInfo->VBInfo & SetCRT2ToTV ) ) |
| 6071 | { |
| 6072 | tempax = XGI_GetVGAHT2( pVBInfo) ; |
| 6073 | tempcx = tempax - 1 ; |
| 6074 | } |
| 6075 | temp = tempcx & 0x00FF ; |
| 6076 | XGINew_SetReg1( pVBInfo->Part2Port , 0x2E , temp ) ; |
| 6077 | |
| 6078 | tempbx = pVBInfo->VDE ; |
| 6079 | |
| 6080 | if ( pVBInfo->VGAVDE == 360 ) |
| 6081 | tempbx = 746 ; |
| 6082 | if ( pVBInfo->VGAVDE == 375 ) |
| 6083 | tempbx = 746 ; |
| 6084 | if ( pVBInfo->VGAVDE == 405 ) |
| 6085 | tempbx = 853 ; |
| 6086 | |
| 6087 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 6088 | { |
| 6089 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 6090 | { |
| 6091 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) |
| 6092 | tempbx = tempbx >> 1 ; |
| 6093 | } |
| 6094 | else |
| 6095 | tempbx = tempbx >> 1 ; |
| 6096 | } |
| 6097 | |
| 6098 | tempbx -= 2 ; |
| 6099 | temp = tempbx & 0x00FF ; |
| 6100 | |
| 6101 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 6102 | { |
| 6103 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 6104 | { |
| 6105 | if ( pVBInfo->TVInfo & SetYPbPrMode1080i ) |
| 6106 | { |
| 6107 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 6108 | { |
| 6109 | if ( ModeNo == 0x2f ) |
| 6110 | temp += 1 ; |
| 6111 | } |
| 6112 | } |
| 6113 | } |
| 6114 | else |
| 6115 | { |
| 6116 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 6117 | { |
| 6118 | if ( ModeNo == 0x2f ) |
| 6119 | temp += 1 ; |
| 6120 | } |
| 6121 | } |
| 6122 | } |
| 6123 | |
| 6124 | XGINew_SetReg1( pVBInfo->Part2Port , 0x2F , temp ) ; |
| 6125 | |
| 6126 | temp = ( tempcx & 0xFF00 ) >> 8 ; |
| 6127 | temp |= ( ( tempbx & 0xFF00 ) >> 8 ) << 6 ; |
| 6128 | |
| 6129 | if ( !( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) ) |
| 6130 | { |
| 6131 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 6132 | { |
| 6133 | if ( pVBInfo->TVInfo & SetYPbPrMode1080i ) |
| 6134 | { |
| 6135 | temp |= 0x10 ; |
| 6136 | |
| 6137 | if ( !( pVBInfo->VBInfo & SetCRT2ToSVIDEO ) ) |
| 6138 | temp |= 0x20 ; |
| 6139 | } |
| 6140 | } |
| 6141 | else |
| 6142 | { |
| 6143 | temp |= 0x10 ; |
| 6144 | if ( !( pVBInfo->VBInfo & SetCRT2ToSVIDEO ) ) |
| 6145 | temp |= 0x20 ; |
| 6146 | } |
| 6147 | } |
| 6148 | |
| 6149 | XGINew_SetReg1( pVBInfo->Part2Port , 0x30 , temp ) ; |
| 6150 | |
| 6151 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) /* TV gatingno */ |
| 6152 | { |
| 6153 | tempbx = pVBInfo->VDE ; |
| 6154 | tempcx = tempbx - 2 ; |
| 6155 | |
| 6156 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 6157 | { |
| 6158 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) |
| 6159 | tempbx = tempbx >> 1 ; |
| 6160 | } |
| 6161 | |
| 6162 | if ( pVBInfo->VBType & ( VB_XGI302LV | VB_XGI301C ) ) |
| 6163 | { |
| 6164 | temp=0; |
| 6165 | if( tempcx & 0x0400 ) |
| 6166 | temp |= 0x20 ; |
| 6167 | |
| 6168 | if ( tempbx & 0x0400 ) |
| 6169 | temp |= 0x40 ; |
| 6170 | |
| 6171 | XGINew_SetReg1( pVBInfo->Part4Port , 0x10 , temp ) ; |
| 6172 | } |
| 6173 | |
| 6174 | temp = ( ( ( tempbx - 3 ) & 0x0300 ) >> 8 ) << 5 ; |
| 6175 | XGINew_SetReg1( pVBInfo->Part2Port , 0x46 , temp ) ; |
| 6176 | temp = ( tempbx - 3 ) & 0x00FF ; |
| 6177 | XGINew_SetReg1( pVBInfo->Part2Port , 0x47 , temp ) ; |
| 6178 | } |
| 6179 | |
| 6180 | tempbx = tempbx & 0x00FF ; |
| 6181 | |
| 6182 | if ( !( modeflag & HalfDCLK ) ) |
| 6183 | { |
| 6184 | tempcx = pVBInfo->VGAHDE ; |
| 6185 | if ( tempcx >= pVBInfo->HDE ) |
| 6186 | { |
| 6187 | tempbx |= 0x2000 ; |
| 6188 | tempax &= 0x00FF ; |
| 6189 | } |
| 6190 | } |
| 6191 | |
| 6192 | tempcx = 0x0101 ; |
| 6193 | |
| 6194 | if( pVBInfo->VBInfo & SetCRT2ToTV ) { /*301b*/ |
| 6195 | if(pVBInfo->VGAHDE>=1024) |
| 6196 | { |
| 6197 | tempcx=0x1920; |
| 6198 | if(pVBInfo->VGAHDE>=1280) |
| 6199 | { |
| 6200 | tempcx=0x1420; |
| 6201 | tempbx=tempbx&0xDFFF; |
| 6202 | } |
| 6203 | } |
| 6204 | } |
| 6205 | |
| 6206 | if ( !( tempbx & 0x2000 ) ) |
| 6207 | { |
| 6208 | if ( modeflag & HalfDCLK ) |
| 6209 | { |
| 6210 | tempcx = ( tempcx & 0xFF00 ) | ( ( tempcx & 0x00FF ) << 1 ) ; |
| 6211 | } |
| 6212 | |
| 6213 | push1 = tempbx ; |
| 6214 | tempeax = pVBInfo->VGAHDE ; |
| 6215 | tempebx = ( tempcx & 0xFF00 ) >> 8 ; |
| 6216 | longtemp = tempeax * tempebx ; |
| 6217 | tempecx = tempcx & 0x00FF ; |
| 6218 | longtemp = longtemp / tempecx ; |
| 6219 | |
| 6220 | /* 301b */ |
| 6221 | tempecx = 8 * 1024 ; |
| 6222 | |
| 6223 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 6224 | { |
| 6225 | tempecx = tempecx * 8 ; |
| 6226 | } |
| 6227 | |
| 6228 | longtemp = longtemp * tempecx ; |
| 6229 | tempecx = pVBInfo->HDE ; |
| 6230 | temp2 = longtemp % tempecx ; |
| 6231 | tempeax = longtemp / tempecx ; |
| 6232 | if ( temp2 != 0 ) |
| 6233 | { |
| 6234 | tempeax += 1 ; |
| 6235 | } |
| 6236 | |
| 6237 | tempax = ( USHORT )tempeax ; |
| 6238 | |
| 6239 | /* 301b */ |
| 6240 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 6241 | { |
| 6242 | tempcx = ( ( tempax & 0xFF00 ) >> 5 ) >> 8 ; |
| 6243 | } |
| 6244 | /* end 301b */ |
| 6245 | |
| 6246 | tempbx = push1 ; |
| 6247 | tempbx =( USHORT )( ( ( tempeax & 0x0000FF00 ) & 0x1F00 ) | ( tempbx & 0x00FF ) ) ; |
| 6248 | tempax =( USHORT )( ( ( tempeax & 0x000000FF ) << 8 ) | ( tempax & 0x00FF ) ) ; |
| 6249 | temp = ( tempax & 0xFF00 ) >> 8 ; |
| 6250 | } |
| 6251 | else |
| 6252 | { |
| 6253 | temp = ( tempax & 0x00FF ) >> 8 ; |
| 6254 | } |
| 6255 | |
| 6256 | XGINew_SetReg1( pVBInfo->Part2Port , 0x44 , temp ) ; |
| 6257 | temp = ( tempbx & 0xFF00 ) >> 8 ; |
| 6258 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x45 , ~0x03F , temp ) ; |
| 6259 | temp = tempcx & 0x00FF ; |
| 6260 | |
| 6261 | if ( tempbx & 0x2000 ) |
| 6262 | temp = 0 ; |
| 6263 | |
| 6264 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCD ) ) |
| 6265 | temp |= 0x18 ; |
| 6266 | |
| 6267 | XGINew_SetRegANDOR(pVBInfo->Part2Port,0x46,~0x1F,temp); |
| 6268 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 6269 | { |
| 6270 | tempbx = 0x0382 ; |
| 6271 | tempcx = 0x007e ; |
| 6272 | } |
| 6273 | else |
| 6274 | { |
| 6275 | tempbx = 0x0369 ; |
| 6276 | tempcx = 0x0061 ; |
| 6277 | } |
| 6278 | |
| 6279 | temp = tempbx & 0x00FF ; |
| 6280 | XGINew_SetReg1( pVBInfo->Part2Port , 0x4b , temp ) ; |
| 6281 | temp = tempcx & 0x00FF ; |
| 6282 | XGINew_SetReg1( pVBInfo->Part2Port , 0x4c , temp ) ; |
| 6283 | |
| 6284 | temp = ( ( tempcx & 0xFF00 ) >> 8 ) & 0x03 ; |
| 6285 | temp = temp << 2 ; |
| 6286 | temp |= ( ( tempbx & 0xFF00 ) >> 8 ) & 0x03 ; |
| 6287 | |
| 6288 | if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) |
| 6289 | { |
| 6290 | temp |= 0x10 ; |
| 6291 | |
| 6292 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) |
| 6293 | temp |= 0x20 ; |
| 6294 | |
| 6295 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) |
| 6296 | temp |= 0x60 ; |
| 6297 | } |
| 6298 | |
| 6299 | XGINew_SetReg1( pVBInfo->Part2Port , 0x4d , temp ) ; |
| 6300 | temp=XGINew_GetReg1( pVBInfo->Part2Port , 0x43 ) ; /* 301b change */ |
| 6301 | XGINew_SetReg1( pVBInfo->Part2Port , 0x43 , ( USHORT )( temp - 3 ) ) ; |
| 6302 | |
| 6303 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) |
| 6304 | { |
| 6305 | if ( pVBInfo->TVInfo & NTSC1024x768 ) |
| 6306 | { |
| 6307 | TimingPoint = XGI_NTSC1024AdjTime ; |
| 6308 | for( i = 0x1c , j = 0 ; i <= 0x30 ; i++ , j++ ) |
| 6309 | { |
| 6310 | XGINew_SetReg1( pVBInfo->Part2Port , i , TimingPoint[ j ] ) ; |
| 6311 | } |
| 6312 | XGINew_SetReg1( pVBInfo->Part2Port , 0x43 , 0x72 ) ; |
| 6313 | } |
| 6314 | } |
| 6315 | |
| 6316 | /* [ycchen] 01/14/03 Modify for 301C PALM Support */ |
| 6317 | if ( pVBInfo->VBType & VB_XGI301C ) |
| 6318 | { |
| 6319 | if ( pVBInfo->TVInfo & SetPALMTV ) |
| 6320 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x4E , ~0x08 , 0x08 ) ; /* PALM Mode */ |
| 6321 | } |
| 6322 | |
| 6323 | if ( pVBInfo->TVInfo & SetPALMTV ) |
| 6324 | { |
| 6325 | tempax = ( UCHAR )XGINew_GetReg1( pVBInfo->Part2Port , 0x01 ) ; |
| 6326 | tempax-- ; |
| 6327 | XGINew_SetRegAND( pVBInfo->Part2Port , 0x01 , tempax ) ; |
| 6328 | |
| 6329 | /* if ( !( pVBInfo->VBType & VB_XGI301C ) ) */ |
| 6330 | XGINew_SetRegAND( pVBInfo->Part2Port , 0x00 , 0xEF ) ; |
| 6331 | } |
| 6332 | |
| 6333 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 6334 | { |
| 6335 | if ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) |
| 6336 | { |
| 6337 | XGINew_SetReg1( pVBInfo->Part2Port , 0x0B , 0x00 ) ; |
| 6338 | } |
| 6339 | } |
| 6340 | |
| 6341 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 6342 | { |
| 6343 | return ; |
| 6344 | } |
| 6345 | } |
| 6346 | |
| 6347 | |
| 6348 | /* --------------------------------------------------------------------- */ |
| 6349 | /* Function : XGI_SetLCDRegs */ |
| 6350 | /* Input : */ |
| 6351 | /* Output : */ |
| 6352 | /* Description : */ |
| 6353 | /* --------------------------------------------------------------------- */ |
| 6354 | void XGI_SetLCDRegs(USHORT ModeNo,USHORT ModeIdIndex, PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo) |
| 6355 | { |
| 6356 | USHORT push1 , |
| 6357 | push2 , |
| 6358 | pushbx , |
| 6359 | tempax , |
| 6360 | tempbx , |
| 6361 | tempcx , |
| 6362 | temp , |
| 6363 | tempah , |
| 6364 | tempbh , |
| 6365 | tempch , |
| 6366 | resinfo , |
| 6367 | modeflag , |
| 6368 | CRT1Index ; |
| 6369 | |
| 6370 | XGI_LCDDesStruct *LCDBDesPtr = NULL ; |
| 6371 | |
| 6372 | |
| 6373 | if ( ModeNo <= 0x13 ) |
| 6374 | { |
| 6375 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ |
| 6376 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; |
| 6377 | } |
| 6378 | else |
| 6379 | { |
| 6380 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ |
| 6381 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 6382 | CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; |
| 6383 | CRT1Index &= IndexMask ; |
| 6384 | } |
| 6385 | |
| 6386 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCD ) ) |
| 6387 | { |
| 6388 | return ; |
| 6389 | } |
| 6390 | |
| 6391 | tempbx = pVBInfo->HDE ; /* RHACTE=HDE-1 */ |
| 6392 | |
| 6393 | if ( XGI_IsLCDDualLink( pVBInfo ) ) |
| 6394 | tempbx = tempbx >> 1 ; |
| 6395 | |
| 6396 | tempbx -= 1 ; |
| 6397 | temp = tempbx & 0x00FF ; |
| 6398 | XGINew_SetReg1( pVBInfo->Part2Port , 0x2C , temp ) ; |
| 6399 | temp = ( tempbx & 0xFF00 ) >> 8 ; |
| 6400 | temp = temp << 4 ; |
| 6401 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x2B , 0x0F , temp ) ; |
| 6402 | temp = 0x01 ; |
| 6403 | |
| 6404 | if ( pVBInfo->LCDResInfo == Panel1280x1024 ) |
| 6405 | { |
| 6406 | if ( pVBInfo->ModeType == ModeEGA ) |
| 6407 | { |
| 6408 | if ( pVBInfo->VGAHDE >= 1024 ) |
| 6409 | { |
| 6410 | temp = 0x02 ; |
| 6411 | if ( pVBInfo->LCDInfo & LCDVESATiming ) |
| 6412 | temp = 0x01 ; |
| 6413 | } |
| 6414 | } |
| 6415 | } |
| 6416 | |
| 6417 | XGINew_SetReg1( pVBInfo->Part2Port , 0x0B , temp ) ; |
| 6418 | tempbx = pVBInfo->VDE ; /* RTVACTEO=(VDE-1)&0xFF */ |
| 6419 | push1 = tempbx ; |
| 6420 | tempbx-- ; |
| 6421 | temp = tempbx & 0x00FF ; |
| 6422 | XGINew_SetReg1( pVBInfo->Part2Port , 0x03 , temp ) ; |
| 6423 | temp = ( ( tempbx & 0xFF00 ) >> 8 ) & 0x07 ; |
| 6424 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x0C , ~0x07 , temp ) ; |
| 6425 | |
| 6426 | tempcx = pVBInfo->VT - 1 ; |
| 6427 | push2 = tempcx + 1 ; |
| 6428 | temp = tempcx & 0x00FF ; /* RVTVT=VT-1 */ |
| 6429 | XGINew_SetReg1( pVBInfo->Part2Port , 0x19 , temp ) ; |
| 6430 | temp = ( tempcx & 0xFF00 ) >> 8 ; |
| 6431 | temp = temp << 5 ; |
| 6432 | XGINew_SetReg1( pVBInfo->Part2Port , 0x1A , temp ) ; |
| 6433 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x09 , 0xF0 , 0x00 ) ; |
| 6434 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x0A , 0xF0 , 0x00 ) ; |
| 6435 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x17 , 0xFB , 0x00 ) ; |
| 6436 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x18 , 0xDF , 0x00 ) ; |
| 6437 | |
| 6438 | /* Customized LCDB Des no add */ |
| 6439 | tempbx = 5 ; |
| 6440 | LCDBDesPtr = ( XGI_LCDDesStruct * )XGI_GetLcdPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 6441 | tempah = pVBInfo->LCDResInfo ; |
| 6442 | tempah &= PanelResInfo ; |
| 6443 | |
| 6444 | if ( ( tempah == Panel1024x768 ) || ( tempah == Panel1024x768x75 ) ) |
| 6445 | { |
| 6446 | tempbx = 1024 ; |
| 6447 | tempcx = 768 ; |
| 6448 | } |
| 6449 | else if ( ( tempah == Panel1280x1024 ) || ( tempah == Panel1280x1024x75 ) ) |
| 6450 | { |
| 6451 | tempbx = 1280 ; |
| 6452 | tempcx = 1024 ; |
| 6453 | } |
| 6454 | else if ( tempah == Panel1400x1050 ) |
| 6455 | { |
| 6456 | tempbx = 1400 ; |
| 6457 | tempcx = 1050 ; |
| 6458 | } |
| 6459 | else |
| 6460 | { |
| 6461 | tempbx = 1600 ; |
| 6462 | tempcx = 1200 ; |
| 6463 | } |
| 6464 | |
| 6465 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 6466 | { |
| 6467 | tempbx = pVBInfo->HDE ; |
| 6468 | tempcx = pVBInfo->VDE ; |
| 6469 | } |
| 6470 | |
| 6471 | pushbx = tempbx ; |
| 6472 | tempax = pVBInfo->VT ; |
| 6473 | pVBInfo->LCDHDES = LCDBDesPtr->LCDHDES ; |
| 6474 | pVBInfo->LCDHRS = LCDBDesPtr->LCDHRS ; |
| 6475 | pVBInfo->LCDVDES = LCDBDesPtr->LCDVDES ; |
| 6476 | pVBInfo->LCDVRS = LCDBDesPtr->LCDVRS ; |
| 6477 | tempbx = pVBInfo->LCDVDES ; |
| 6478 | tempcx += tempbx ; |
| 6479 | |
| 6480 | if ( tempcx >= tempax ) |
| 6481 | tempcx -= tempax ; /* lcdvdes */ |
| 6482 | |
| 6483 | temp = tempbx & 0x00FF ; /* RVEQ1EQ=lcdvdes */ |
| 6484 | XGINew_SetReg1( pVBInfo->Part2Port , 0x05 , temp ) ; |
| 6485 | temp = tempcx & 0x00FF ; |
| 6486 | XGINew_SetReg1( pVBInfo->Part2Port , 0x06 , temp ) ; |
| 6487 | tempch = ( ( tempcx & 0xFF00 ) >> 8 ) & 0x07 ; |
| 6488 | tempbh = ( ( tempbx & 0xFF00 ) >> 8 ) & 0x07 ; |
| 6489 | tempah = tempch ; |
| 6490 | tempah = tempah << 3 ; |
| 6491 | tempah |= tempbh ; |
| 6492 | XGINew_SetReg1( pVBInfo->Part2Port , 0x02 , tempah ) ; |
| 6493 | |
| 6494 | /* getlcdsync() */ |
| 6495 | XGI_GetLCDSync( &tempax , &tempbx,pVBInfo ) ; |
| 6496 | tempcx = tempbx ; |
| 6497 | tempax = pVBInfo->VT ; |
| 6498 | tempbx = pVBInfo->LCDVRS ; |
| 6499 | |
| 6500 | /* if ( SetLCD_Info & EnableScalingLCD ) */ |
| 6501 | tempcx += tempbx ; |
| 6502 | if ( tempcx >= tempax ) |
| 6503 | tempcx -= tempax ; |
| 6504 | |
| 6505 | temp = tempbx & 0x00FF ; /* RTVACTEE=lcdvrs */ |
| 6506 | XGINew_SetReg1( pVBInfo->Part2Port , 0x04 , temp ) ; |
| 6507 | temp = ( tempbx & 0xFF00 ) >> 8 ; |
| 6508 | temp = temp << 4 ; |
| 6509 | temp |= ( tempcx & 0x000F ) ; |
| 6510 | XGINew_SetReg1( pVBInfo->Part2Port , 0x01 , temp ) ; |
| 6511 | tempcx = pushbx ; |
| 6512 | tempax = pVBInfo->HT ; |
| 6513 | tempbx = pVBInfo->LCDHDES ; |
| 6514 | tempbx &= 0x0FFF ; |
| 6515 | |
| 6516 | if ( XGI_IsLCDDualLink( pVBInfo ) ) |
| 6517 | { |
| 6518 | tempax = tempax >> 1 ; |
| 6519 | tempbx = tempbx >> 1 ; |
| 6520 | tempcx = tempcx >> 1 ; |
| 6521 | } |
| 6522 | |
| 6523 | if ( pVBInfo->VBType & VB_XGI302LV ) |
| 6524 | tempbx += 1 ; |
| 6525 | |
| 6526 | if ( pVBInfo->VBType & VB_XGI301C ) /* tap4 */ |
| 6527 | tempbx += 1 ; |
| 6528 | |
| 6529 | tempcx += tempbx ; |
| 6530 | |
| 6531 | if ( tempcx >= tempax ) |
| 6532 | tempcx -= tempax ; |
| 6533 | |
| 6534 | temp = tempbx & 0x00FF ; |
| 6535 | XGINew_SetReg1( pVBInfo->Part2Port , 0x1F , temp ) ; /* RHBLKE=lcdhdes */ |
| 6536 | temp = ( ( tempbx & 0xFF00 ) >> 8 ) << 4 ; |
| 6537 | XGINew_SetReg1( pVBInfo->Part2Port , 0x20 , temp ) ; |
| 6538 | temp = tempcx & 0x00FF ; |
| 6539 | XGINew_SetReg1( pVBInfo->Part2Port , 0x23 , temp ) ; /* RHEQPLE=lcdhdee */ |
| 6540 | temp = ( tempcx & 0xFF00 ) >> 8 ; |
| 6541 | XGINew_SetReg1( pVBInfo->Part2Port , 0x25 , temp ) ; |
| 6542 | |
| 6543 | /* getlcdsync() */ |
| 6544 | XGI_GetLCDSync( &tempax , &tempbx ,pVBInfo) ; |
| 6545 | tempcx = tempax ; |
| 6546 | tempax = pVBInfo->HT ; |
| 6547 | tempbx = pVBInfo->LCDHRS ; |
| 6548 | /* if ( SetLCD_Info & EnableScalingLCD) */ |
| 6549 | if ( XGI_IsLCDDualLink( pVBInfo) ) |
| 6550 | { |
| 6551 | tempax = tempax >> 1 ; |
| 6552 | tempbx = tempbx >> 1 ; |
| 6553 | tempcx = tempcx >> 1 ; |
| 6554 | } |
| 6555 | |
| 6556 | if ( pVBInfo->VBType & VB_XGI302LV ) |
| 6557 | tempbx += 1 ; |
| 6558 | |
| 6559 | tempcx += tempbx ; |
| 6560 | |
| 6561 | if ( tempcx >= tempax ) |
| 6562 | tempcx -= tempax ; |
| 6563 | |
| 6564 | temp = tempbx & 0x00FF ; /* RHBURSTS=lcdhrs */ |
| 6565 | XGINew_SetReg1( pVBInfo->Part2Port , 0x1C , temp ) ; |
| 6566 | |
| 6567 | temp = ( tempbx & 0xFF00 ) >> 8 ; |
| 6568 | temp = temp << 4 ; |
| 6569 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x1D , ~0x0F0 , temp ) ; |
| 6570 | temp = tempcx & 0x00FF ; /* RHSYEXP2S=lcdhre */ |
| 6571 | XGINew_SetReg1( pVBInfo->Part2Port , 0x21 , temp ) ; |
| 6572 | |
| 6573 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) |
| 6574 | { |
| 6575 | if ( pVBInfo->VGAVDE == 525 ) |
| 6576 | { |
| 6577 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 6578 | { |
| 6579 | temp = 0xC6 ; |
| 6580 | } |
| 6581 | else |
| 6582 | temp = 0xC4 ; |
| 6583 | |
| 6584 | XGINew_SetReg1( pVBInfo->Part2Port , 0x2f , temp ) ; |
| 6585 | XGINew_SetReg1( pVBInfo->Part2Port , 0x30 , 0xB3 ) ; |
| 6586 | } |
| 6587 | |
| 6588 | if ( pVBInfo->VGAVDE == 420 ) |
| 6589 | { |
| 6590 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 6591 | { |
| 6592 | temp = 0x4F ; |
| 6593 | } |
| 6594 | else |
| 6595 | temp = 0x4E ; |
| 6596 | XGINew_SetReg1( pVBInfo->Part2Port , 0x2f , temp ) ; |
| 6597 | } |
| 6598 | } |
| 6599 | } |
| 6600 | |
| 6601 | |
| 6602 | /* --------------------------------------------------------------------- */ |
| 6603 | /* Function : XGI_GetTap4Ptr */ |
| 6604 | /* Input : */ |
| 6605 | /* Output : di -> Tap4 Reg. Setting Pointer */ |
| 6606 | /* Description : */ |
| 6607 | /* --------------------------------------------------------------------- */ |
| 6608 | XGI301C_Tap4TimingStruct* XGI_GetTap4Ptr(USHORT tempcx, PVB_DEVICE_INFO pVBInfo) |
| 6609 | { |
| 6610 | USHORT tempax , |
| 6611 | tempbx , |
| 6612 | i ; |
| 6613 | |
| 6614 | XGI301C_Tap4TimingStruct *Tap4TimingPtr ; |
| 6615 | |
| 6616 | if ( tempcx == 0 ) |
| 6617 | { |
| 6618 | tempax = pVBInfo->VGAHDE ; |
| 6619 | tempbx = pVBInfo->HDE ; |
| 6620 | } |
| 6621 | else |
| 6622 | { |
| 6623 | tempax = pVBInfo->VGAVDE ; |
| 6624 | tempbx = pVBInfo->VDE ; |
| 6625 | } |
| 6626 | |
| 6627 | if ( tempax < tempbx ) |
| 6628 | return &EnlargeTap4Timing[ 0 ] ; |
| 6629 | else if( tempax == tempbx ) |
| 6630 | return &NoScaleTap4Timing[ 0 ] ; /* 1:1 */ |
| 6631 | else |
| 6632 | Tap4TimingPtr = NTSCTap4Timing ; /* NTSC */ |
| 6633 | |
| 6634 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 6635 | Tap4TimingPtr = PALTap4Timing ; |
| 6636 | |
| 6637 | |
| 6638 | if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) |
| 6639 | { |
| 6640 | if ( pVBInfo->TVInfo & SetYPbPrMode525i ) |
| 6641 | Tap4TimingPtr = YPbPr525iTap4Timing ; |
| 6642 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) |
| 6643 | Tap4TimingPtr = YPbPr525pTap4Timing ; |
| 6644 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) |
| 6645 | Tap4TimingPtr = YPbPr750pTap4Timing ; |
| 6646 | } |
| 6647 | |
| 6648 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 6649 | Tap4TimingPtr = HiTVTap4Timing ; |
| 6650 | |
| 6651 | i = 0 ; |
| 6652 | while( Tap4TimingPtr[ i ].DE != 0xFFFF ) |
| 6653 | { |
| 6654 | if ( Tap4TimingPtr[ i ].DE == tempax ) |
| 6655 | break ; |
| 6656 | i++ ; |
| 6657 | } |
| 6658 | return &Tap4TimingPtr[ i ] ; |
| 6659 | } |
| 6660 | |
| 6661 | |
| 6662 | /* --------------------------------------------------------------------- */ |
| 6663 | /* Function : XGI_SetTap4Regs */ |
| 6664 | /* Input : */ |
| 6665 | /* Output : */ |
| 6666 | /* Description : */ |
| 6667 | /* --------------------------------------------------------------------- */ |
| 6668 | void XGI_SetTap4Regs( PVB_DEVICE_INFO pVBInfo) |
| 6669 | { |
| 6670 | USHORT i , |
| 6671 | j ; |
| 6672 | |
| 6673 | XGI301C_Tap4TimingStruct *Tap4TimingPtr ; |
| 6674 | |
| 6675 | if ( !( pVBInfo->VBType & VB_XGI301C ) ) |
| 6676 | return ; |
| 6677 | |
| 6678 | #ifndef Tap4 |
| 6679 | XGINew_SetRegAND( pVBInfo->Part2Port , 0x4E , 0xEB ) ; /* Disable Tap4 */ |
| 6680 | #else /* Tap4 Setting */ |
| 6681 | |
| 6682 | Tap4TimingPtr = XGI_GetTap4Ptr( 0 , pVBInfo) ; /* Set Horizontal Scaling */ |
| 6683 | for( i = 0x80 , j = 0 ; i <= 0xBF ; i++ , j++ ) |
| 6684 | XGINew_SetReg1( pVBInfo->Part2Port , i , Tap4TimingPtr->Reg[ j ] ) ; |
| 6685 | |
| 6686 | if ( ( pVBInfo->VBInfo & SetCRT2ToTV ) && ( !( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) ) ) |
| 6687 | { |
| 6688 | Tap4TimingPtr = XGI_GetTap4Ptr( 1 , pVBInfo); /* Set Vertical Scaling */ |
| 6689 | for( i = 0xC0 , j = 0 ; i < 0xFF ; i++ , j++ ) |
| 6690 | XGINew_SetReg1( pVBInfo->Part2Port , i , Tap4TimingPtr->Reg[ j ] ) ; |
| 6691 | } |
| 6692 | |
| 6693 | if ( ( pVBInfo->VBInfo & SetCRT2ToTV ) && ( !( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) ) ) |
| 6694 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x4E , ~0x14 , 0x04 ) ; /* Enable V.Scaling */ |
| 6695 | else |
| 6696 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x4E , ~0x14 , 0x10 ) ; /* Enable H.Scaling */ |
| 6697 | #endif |
| 6698 | } |
| 6699 | |
| 6700 | /* --------------------------------------------------------------------- */ |
| 6701 | /* Function : XGI_SetGroup3 */ |
| 6702 | /* Input : */ |
| 6703 | /* Output : */ |
| 6704 | /* Description : */ |
| 6705 | /* --------------------------------------------------------------------- */ |
| 6706 | void XGI_SetGroup3(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo) |
| 6707 | { |
| 6708 | USHORT i; |
| 6709 | UCHAR *tempdi; |
| 6710 | USHORT modeflag; |
| 6711 | |
| 6712 | if(ModeNo<=0x13) |
| 6713 | { |
| 6714 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ |
| 6715 | } |
| 6716 | else |
| 6717 | { |
| 6718 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ |
| 6719 | } |
| 6720 | |
| 6721 | |
| 6722 | XGINew_SetReg1(pVBInfo->Part3Port,0x00,0x00); |
| 6723 | if(pVBInfo->TVInfo&SetPALTV) |
| 6724 | { |
| 6725 | XGINew_SetReg1(pVBInfo->Part3Port,0x13,0xFA); |
| 6726 | XGINew_SetReg1(pVBInfo->Part3Port,0x14,0xC8); |
| 6727 | } |
| 6728 | else |
| 6729 | { |
| 6730 | XGINew_SetReg1(pVBInfo->Part3Port,0x13,0xF5); |
| 6731 | XGINew_SetReg1(pVBInfo->Part3Port,0x14,0xB7); |
| 6732 | } |
| 6733 | |
| 6734 | if(!(pVBInfo->VBInfo&SetCRT2ToTV)) |
| 6735 | { |
| 6736 | return; |
| 6737 | } |
| 6738 | |
| 6739 | if(pVBInfo->TVInfo&SetPALMTV) |
| 6740 | { |
| 6741 | XGINew_SetReg1(pVBInfo->Part3Port,0x13,0xFA); |
| 6742 | XGINew_SetReg1(pVBInfo->Part3Port,0x14,0xC8); |
| 6743 | XGINew_SetReg1(pVBInfo->Part3Port,0x3D,0xA8); |
| 6744 | } |
| 6745 | |
| 6746 | if((pVBInfo->VBInfo&SetCRT2ToHiVisionTV)|| (pVBInfo->VBInfo&SetCRT2ToYPbPr)) |
| 6747 | { |
| 6748 | if(pVBInfo->TVInfo & SetYPbPrMode525i) |
| 6749 | { |
| 6750 | return; |
| 6751 | } |
| 6752 | tempdi=pVBInfo->HiTVGroup3Data; |
| 6753 | if(pVBInfo->SetFlag&TVSimuMode) |
| 6754 | { |
| 6755 | tempdi=pVBInfo->HiTVGroup3Simu; |
| 6756 | if(!(modeflag&Charx8Dot)) |
| 6757 | { |
| 6758 | tempdi=pVBInfo->HiTVGroup3Text; |
| 6759 | } |
| 6760 | } |
| 6761 | |
| 6762 | if(pVBInfo->TVInfo & SetYPbPrMode525p) |
| 6763 | { |
| 6764 | tempdi=pVBInfo->Ren525pGroup3; |
| 6765 | } |
| 6766 | if(pVBInfo->TVInfo & SetYPbPrMode750p) |
| 6767 | { |
| 6768 | tempdi=pVBInfo->Ren750pGroup3; |
| 6769 | } |
| 6770 | |
| 6771 | for(i=0;i<=0x3E;i++) |
| 6772 | { |
| 6773 | XGINew_SetReg1(pVBInfo->Part3Port,i,tempdi[i]); |
| 6774 | } |
| 6775 | if(pVBInfo->VBType&VB_XGI301C) /* Marcovision */ |
| 6776 | { |
| 6777 | if(pVBInfo->TVInfo & SetYPbPrMode525p) |
| 6778 | { |
| 6779 | XGINew_SetReg1(pVBInfo->Part3Port,0x28,0x3f); |
| 6780 | } |
| 6781 | } |
| 6782 | } |
| 6783 | return; |
| 6784 | } /* {end of XGI_SetGroup3} */ |
| 6785 | |
| 6786 | |
| 6787 | /* --------------------------------------------------------------------- */ |
| 6788 | /* Function : XGI_SetGroup4 */ |
| 6789 | /* Input : */ |
| 6790 | /* Output : */ |
| 6791 | /* Description : */ |
| 6792 | /* --------------------------------------------------------------------- */ |
| 6793 | void XGI_SetGroup4(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo) |
| 6794 | { |
| 6795 | USHORT tempax , |
| 6796 | tempcx , |
| 6797 | tempbx , |
| 6798 | modeflag , |
| 6799 | temp , |
| 6800 | temp2 ; |
| 6801 | |
| 6802 | ULONG tempebx , |
| 6803 | tempeax , |
| 6804 | templong ; |
| 6805 | |
| 6806 | |
| 6807 | if ( ModeNo <= 0x13 ) |
| 6808 | { |
| 6809 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ |
| 6810 | } |
| 6811 | else |
| 6812 | { |
| 6813 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ |
| 6814 | } |
| 6815 | |
| 6816 | temp = pVBInfo->RVBHCFACT ; |
| 6817 | XGINew_SetReg1( pVBInfo->Part4Port , 0x13 , temp ) ; |
| 6818 | |
| 6819 | tempbx = pVBInfo->RVBHCMAX ; |
| 6820 | temp = tempbx & 0x00FF ; |
| 6821 | XGINew_SetReg1( pVBInfo->Part4Port , 0x14 , temp ) ; |
| 6822 | temp2 = ( ( tempbx & 0xFF00 ) >> 8 ) << 7 ; |
| 6823 | tempcx = pVBInfo->VGAHT - 1 ; |
| 6824 | temp = tempcx & 0x00FF ; |
| 6825 | XGINew_SetReg1( pVBInfo->Part4Port , 0x16 , temp ) ; |
| 6826 | |
| 6827 | temp =( ( tempcx & 0xFF00 ) >> 8 ) << 3 ; |
| 6828 | temp2 |= temp ; |
| 6829 | |
| 6830 | tempcx = pVBInfo->VGAVT - 1 ; |
| 6831 | if ( !( pVBInfo->VBInfo & SetCRT2ToTV ) ) |
| 6832 | { |
| 6833 | tempcx -= 5 ; |
| 6834 | } |
| 6835 | |
| 6836 | temp = tempcx & 0x00FF ; |
| 6837 | XGINew_SetReg1( pVBInfo->Part4Port , 0x17 , temp ) ; |
| 6838 | temp = temp2 | ( ( tempcx & 0xFF00 ) >> 8 ) ; |
| 6839 | XGINew_SetReg1( pVBInfo->Part4Port , 0x15 , temp ) ; |
| 6840 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x0D , 0x08 ) ; |
| 6841 | tempcx = pVBInfo->VBInfo ; |
| 6842 | tempbx = pVBInfo->VGAHDE ; |
| 6843 | |
| 6844 | if ( modeflag & HalfDCLK ) |
| 6845 | { |
| 6846 | tempbx = tempbx >> 1 ; |
| 6847 | } |
| 6848 | |
| 6849 | if ( XGI_IsLCDDualLink( pVBInfo ) ) |
| 6850 | tempbx = tempbx >> 1 ; |
| 6851 | |
| 6852 | if(tempcx&SetCRT2ToHiVisionTV) |
| 6853 | { |
| 6854 | temp=0; |
| 6855 | if(tempbx<=1024) |
| 6856 | temp=0xA0; |
| 6857 | if(tempbx == 1280) |
| 6858 | temp = 0xC0; |
| 6859 | } |
| 6860 | else if(tempcx&SetCRT2ToTV) |
| 6861 | { |
| 6862 | temp=0xA0; |
| 6863 | if(tempbx <= 800) |
| 6864 | temp=0x80; |
| 6865 | } |
| 6866 | else |
| 6867 | { |
| 6868 | temp=0x80; |
| 6869 | if(pVBInfo->VBInfo&SetCRT2ToLCD) |
| 6870 | { |
| 6871 | temp=0; |
| 6872 | if(tempbx>800) |
| 6873 | temp=0x60; |
| 6874 | } |
| 6875 | } |
| 6876 | |
| 6877 | if ( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) |
| 6878 | { |
| 6879 | temp = 0x00 ; |
| 6880 | if ( pVBInfo->VGAHDE == 1280 ) |
| 6881 | temp = 0x40 ; |
| 6882 | if ( pVBInfo->VGAHDE == 1024 ) |
| 6883 | temp = 0x20 ; |
| 6884 | } |
| 6885 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x0E , ~0xEF , temp ) ; |
| 6886 | |
| 6887 | tempebx = pVBInfo->VDE ; |
| 6888 | |
| 6889 | if ( tempcx & SetCRT2ToHiVisionTV ) |
| 6890 | { |
| 6891 | if ( !( temp & 0xE000 ) ) |
| 6892 | tempbx = tempbx >> 1 ; |
| 6893 | } |
| 6894 | |
| 6895 | tempcx = pVBInfo->RVBHRS ; |
| 6896 | temp = tempcx & 0x00FF ; |
| 6897 | XGINew_SetReg1( pVBInfo->Part4Port , 0x18 , temp ); |
| 6898 | |
| 6899 | tempeax = pVBInfo->VGAVDE ; |
| 6900 | tempcx |= 0x04000 ; |
| 6901 | |
| 6902 | |
| 6903 | if ( tempeax <= tempebx ) |
| 6904 | { |
| 6905 | tempcx=(tempcx&(~0x4000)); |
| 6906 | tempeax = pVBInfo->VGAVDE ; |
| 6907 | } |
| 6908 | else |
| 6909 | { |
| 6910 | tempeax -= tempebx ; |
| 6911 | } |
| 6912 | |
| 6913 | |
| 6914 | templong = ( tempeax * 256 * 1024 ) % tempebx ; |
| 6915 | tempeax = ( tempeax * 256 * 1024 ) / tempebx ; |
| 6916 | tempebx = tempeax ; |
| 6917 | |
| 6918 | if ( templong != 0 ) |
| 6919 | { |
| 6920 | tempebx++ ; |
| 6921 | } |
| 6922 | |
| 6923 | |
| 6924 | temp = ( USHORT )( tempebx & 0x000000FF ) ; |
| 6925 | XGINew_SetReg1( pVBInfo->Part4Port , 0x1B , temp ) ; |
| 6926 | |
| 6927 | temp = ( USHORT )( ( tempebx & 0x0000FF00 ) >> 8 ) ; |
| 6928 | XGINew_SetReg1( pVBInfo->Part4Port , 0x1A , temp ) ; |
| 6929 | tempbx = ( USHORT )( tempebx >> 16 ) ; |
| 6930 | temp = tempbx & 0x00FF ; |
| 6931 | temp = temp << 4 ; |
| 6932 | temp |= ( ( tempcx & 0xFF00 ) >> 8 ) ; |
| 6933 | XGINew_SetReg1( pVBInfo->Part4Port , 0x19 , temp ) ; |
| 6934 | |
| 6935 | /* 301b */ |
| 6936 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 6937 | { |
| 6938 | temp = 0x0028 ; |
| 6939 | XGINew_SetReg1( pVBInfo->Part4Port , 0x1C , temp ) ; |
| 6940 | tempax = pVBInfo->VGAHDE ; |
| 6941 | if ( modeflag & HalfDCLK ) |
| 6942 | { |
| 6943 | tempax = tempax >> 1 ; |
| 6944 | } |
| 6945 | |
| 6946 | if ( XGI_IsLCDDualLink( pVBInfo ) ) |
| 6947 | tempax = tempax >> 1 ; |
| 6948 | |
| 6949 | /* if((pVBInfo->VBInfo&(SetCRT2ToLCD))||((pVBInfo->TVInfo&SetYPbPrMode525p)||(pVBInfo->TVInfo&SetYPbPrMode750p))) { */ |
| 6950 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) |
| 6951 | { |
| 6952 | if ( tempax > 800 ) |
| 6953 | tempax -= 800 ; |
| 6954 | } |
| 6955 | else |
| 6956 | { |
| 6957 | if ( pVBInfo->VGAHDE > 800 ) |
| 6958 | { |
| 6959 | if ( pVBInfo->VGAHDE == 1024 ) |
| 6960 | tempax = ( tempax * 25 / 32 ) - 1 ; |
| 6961 | else |
| 6962 | tempax = ( tempax * 20 / 32 ) - 1 ; |
| 6963 | } |
| 6964 | } |
| 6965 | tempax -= 1 ; |
| 6966 | |
| 6967 | /* |
| 6968 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToHiVisionTV ) ) |
| 6969 | { |
| 6970 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 6971 | { |
| 6972 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i ) ) ) |
| 6973 | { |
| 6974 | if ( pVBInfo->VGAHDE > 800 ) |
| 6975 | { |
| 6976 | if ( pVBInfo->VGAHDE == 1024 ) |
| 6977 | tempax = ( tempax * 25 / 32 ) - 1 ; |
| 6978 | else |
| 6979 | tempax = ( tempax * 20 / 32 ) - 1 ; |
| 6980 | } |
| 6981 | } |
| 6982 | } |
| 6983 | else |
| 6984 | { |
| 6985 | if ( pVBInfo->VGAHDE > 800 ) |
| 6986 | { |
| 6987 | if ( pVBInfo->VGAHDE == 1024 ) |
| 6988 | tempax = ( tempax * 25 / 32 ) - 1 ; |
| 6989 | else |
| 6990 | tempax = ( tempax * 20 / 32 ) - 1 ; |
| 6991 | } |
| 6992 | } |
| 6993 | } |
| 6994 | */ |
| 6995 | |
| 6996 | temp = ( tempax & 0xFF00 ) >> 8 ; |
| 6997 | temp = ( ( temp & 0x0003 ) << 4 ) ; |
| 6998 | XGINew_SetReg1( pVBInfo->Part4Port , 0x1E , temp ) ; |
| 6999 | temp = ( tempax & 0x00FF ) ; |
| 7000 | XGINew_SetReg1( pVBInfo->Part4Port , 0x1D , temp ) ; |
| 7001 | |
| 7002 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToHiVisionTV ) ) |
| 7003 | { |
| 7004 | if ( pVBInfo->VGAHDE > 800 ) |
| 7005 | { |
| 7006 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x1E , 0x08 ) ; |
| 7007 | } |
| 7008 | } |
| 7009 | temp = 0x0036 ; |
| 7010 | |
| 7011 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 7012 | { |
| 7013 | if ( !( pVBInfo->TVInfo & ( NTSC1024x768 | SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i ) ) ) |
| 7014 | { |
| 7015 | temp |= 0x0001 ; |
| 7016 | if ( ( pVBInfo->VBInfo & SetInSlaveMode ) && ( !( pVBInfo->TVInfo & TVSimuMode ) ) ) |
| 7017 | temp &= ( ~0x0001 ) ; |
| 7018 | } |
| 7019 | } |
| 7020 | |
| 7021 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x1F , 0x00C0 , temp ) ; |
| 7022 | tempbx = pVBInfo->HT ; |
| 7023 | if ( XGI_IsLCDDualLink( pVBInfo ) ) |
| 7024 | tempbx = tempbx >> 1 ; |
| 7025 | tempbx = ( tempbx >> 1 ) - 2 ; |
| 7026 | temp = ( ( tempbx & 0x0700 ) >> 8 ) << 3 ; |
| 7027 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x21 , 0x00C0 , temp ) ; |
| 7028 | temp = tempbx & 0x00FF ; |
| 7029 | XGINew_SetReg1( pVBInfo->Part4Port , 0x22 , temp ) ; |
| 7030 | } |
| 7031 | /* end 301b */ |
| 7032 | |
| 7033 | if ( pVBInfo->ISXPDOS == 0 ) |
| 7034 | XGI_SetCRT2VCLK( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 7035 | } |
| 7036 | |
| 7037 | |
| 7038 | /* --------------------------------------------------------------------- */ |
| 7039 | /* Function : XGI_SetGroup5 */ |
| 7040 | /* Input : */ |
| 7041 | /* Output : */ |
| 7042 | /* Description : */ |
| 7043 | /* --------------------------------------------------------------------- */ |
| 7044 | void XGI_SetGroup5( USHORT ModeNo , USHORT ModeIdIndex , PVB_DEVICE_INFO pVBInfo) |
| 7045 | { |
| 7046 | USHORT Pindex , |
| 7047 | Pdata ; |
| 7048 | |
| 7049 | Pindex = pVBInfo->Part5Port ; |
| 7050 | Pdata = pVBInfo->Part5Port + 1 ; |
| 7051 | if ( pVBInfo->ModeType == ModeVGA ) |
| 7052 | { |
| 7053 | if ( !( pVBInfo->VBInfo & ( SetInSlaveMode | LoadDACFlag | CRT2DisplayFlag ) ) ) |
| 7054 | { |
| 7055 | XGINew_EnableCRT2(pVBInfo) ; |
| 7056 | /* LoadDAC2(pVBInfo->Part5Port,ModeNo,ModeIdIndex); */ |
| 7057 | } |
| 7058 | } |
| 7059 | return ; |
| 7060 | } |
| 7061 | |
| 7062 | |
| 7063 | /* --------------------------------------------------------------------- */ |
| 7064 | /* Function : XGI_GetLcdPtr */ |
| 7065 | /* Input : */ |
| 7066 | /* Output : */ |
| 7067 | /* Description : */ |
| 7068 | /* --------------------------------------------------------------------- */ |
| 7069 | void* XGI_GetLcdPtr( USHORT BX , USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 7070 | { |
| 7071 | USHORT i , |
| 7072 | tempdx , |
| 7073 | tempcx , |
| 7074 | tempbx , |
| 7075 | tempal , |
| 7076 | modeflag , |
| 7077 | table ; |
| 7078 | |
| 7079 | XGI330_LCDDataTablStruct *tempdi = 0 ; |
| 7080 | |
| 7081 | |
| 7082 | tempbx = BX; |
| 7083 | |
| 7084 | if ( ModeNo <= 0x13 ) |
| 7085 | { |
| 7086 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 7087 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; |
| 7088 | } |
| 7089 | else |
| 7090 | { |
| 7091 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 7092 | tempal = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC ; |
| 7093 | } |
| 7094 | |
| 7095 | tempal = tempal & 0x0f ; |
| 7096 | |
| 7097 | if ( tempbx <= 1 ) /* ExpLink */ |
| 7098 | { |
| 7099 | if ( ModeNo <= 0x13 ) |
| 7100 | { |
| 7101 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; /* find no Ext_CRT2CRTC2 */ |
| 7102 | } |
| 7103 | else |
| 7104 | { |
| 7105 | tempal= pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC ; |
| 7106 | } |
| 7107 | |
| 7108 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 7109 | { |
| 7110 | if ( ModeNo <= 0x13 ) |
| 7111 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC2 ; |
| 7112 | else |
| 7113 | tempal= pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC2 ; |
| 7114 | } |
| 7115 | |
| 7116 | if ( tempbx & 0x01 ) |
| 7117 | tempal = ( tempal >> 4 ) ; |
| 7118 | |
| 7119 | tempal = ( tempal & 0x0f ) ; |
| 7120 | } |
| 7121 | |
| 7122 | tempcx = LCDLenList[ tempbx ] ; /* mov cl,byte ptr cs:LCDLenList[bx] */ |
| 7123 | |
| 7124 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) /* ScaleLCD */ |
| 7125 | { |
| 7126 | if ( ( tempbx == 5 ) || ( tempbx ) == 7 ) |
| 7127 | tempcx = LCDDesDataLen2 ; |
| 7128 | else if ( ( tempbx == 3 ) || ( tempbx == 8 ) ) |
| 7129 | tempcx = LVDSDesDataLen2 ; |
| 7130 | } |
| 7131 | /* mov di, word ptr cs:LCDDataList[bx] */ |
| 7132 | /* tempdi=pVideoMemory[LCDDataList+tempbx*2]|(pVideoMemory[LCDDataList+tempbx*2+1]<<8); */ |
| 7133 | |
| 7134 | switch( tempbx ) |
| 7135 | { |
| 7136 | case 0: |
| 7137 | tempdi = XGI_EPLLCDCRT1Ptr_H ; |
| 7138 | break ; |
| 7139 | case 1: |
| 7140 | tempdi = XGI_EPLLCDCRT1Ptr_V ; |
| 7141 | break ; |
| 7142 | case 2: |
| 7143 | tempdi = XGI_EPLLCDDataPtr ; |
| 7144 | break ; |
| 7145 | case 3: |
| 7146 | tempdi = XGI_EPLLCDDesDataPtr ; |
| 7147 | break ; |
| 7148 | case 4: |
| 7149 | tempdi = XGI_LCDDataTable ; |
| 7150 | break ; |
| 7151 | case 5: |
| 7152 | tempdi = XGI_LCDDesDataTable ; |
| 7153 | break ; |
| 7154 | case 6: |
| 7155 | tempdi = XGI_EPLCHLCDRegPtr ; |
| 7156 | break ; |
| 7157 | case 7: |
| 7158 | case 8: |
| 7159 | case 9: |
| 7160 | tempdi = 0 ; |
| 7161 | break ; |
| 7162 | default: |
| 7163 | break ; |
| 7164 | } |
| 7165 | |
| 7166 | if ( tempdi == 0x00 ) /* OEMUtil */ |
| 7167 | return 0 ; |
| 7168 | |
| 7169 | table = tempbx ; |
| 7170 | i = 0 ; |
| 7171 | |
| 7172 | while( tempdi[ i ].PANELID != 0xff ) |
| 7173 | { |
| 7174 | tempdx = pVBInfo->LCDResInfo ; |
| 7175 | if ( tempbx & 0x0080 ) /* OEMUtil */ |
| 7176 | { |
| 7177 | tempbx &= ( ~0x0080 ) ; |
| 7178 | tempdx = pVBInfo->LCDTypeInfo ; |
| 7179 | } |
| 7180 | |
| 7181 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 7182 | tempdx &= ( ~PanelResInfo ) ; |
| 7183 | |
| 7184 | if ( tempdi[ i ].PANELID == tempdx ) |
| 7185 | { |
| 7186 | tempbx = tempdi[ i ].MASK ; |
| 7187 | tempdx = pVBInfo->LCDInfo ; |
| 7188 | |
| 7189 | if ( ModeNo <= 0x13 ) /* alan 09/10/2003 */ |
| 7190 | tempdx |= SetLCDStdMode ; |
| 7191 | |
| 7192 | if ( modeflag & HalfDCLK ) |
| 7193 | tempdx |= SetLCDLowResolution ; |
| 7194 | |
| 7195 | tempbx &= tempdx; |
| 7196 | if ( tempbx == tempdi[ i ].CAP ) |
| 7197 | break ; |
| 7198 | } |
| 7199 | i++ ; |
| 7200 | } |
| 7201 | |
| 7202 | if ( table == 0 ) |
| 7203 | { |
| 7204 | switch( tempdi[ i ].DATAPTR ) |
| 7205 | { |
| 7206 | case 0: |
| 7207 | return &XGI_LVDSCRT11024x768_1_H[ tempal ] ; |
| 7208 | break ; |
| 7209 | case 1: |
| 7210 | return &XGI_LVDSCRT11024x768_2_H[ tempal ] ; |
| 7211 | break ; |
| 7212 | case 2: |
| 7213 | return &XGI_LVDSCRT11280x1024_1_H[ tempal ] ; |
| 7214 | break ; |
| 7215 | case 3: |
| 7216 | return &XGI_LVDSCRT11280x1024_2_H[ tempal ] ; |
| 7217 | break ; |
| 7218 | case 4: |
| 7219 | return &XGI_LVDSCRT11400x1050_1_H[ tempal ] ; |
| 7220 | break ; |
| 7221 | case 5: |
| 7222 | return &XGI_LVDSCRT11400x1050_2_H[ tempal ] ; |
| 7223 | break ; |
| 7224 | case 6: |
| 7225 | return &XGI_LVDSCRT11600x1200_1_H[ tempal ] ; |
| 7226 | break ; |
| 7227 | case 7: |
| 7228 | return &XGI_LVDSCRT11024x768_1_Hx75[ tempal ] ; |
| 7229 | break ; |
| 7230 | case 8: |
| 7231 | return &XGI_LVDSCRT11024x768_2_Hx75[ tempal ] ; |
| 7232 | break ; |
| 7233 | case 9: |
| 7234 | return &XGI_LVDSCRT11280x1024_1_Hx75[ tempal ] ; |
| 7235 | break ; |
| 7236 | case 10: |
| 7237 | return &XGI_LVDSCRT11280x1024_2_Hx75[ tempal ] ; |
| 7238 | break ; |
| 7239 | default: |
| 7240 | break ; |
| 7241 | } |
| 7242 | } |
| 7243 | else if ( table == 1 ) |
| 7244 | { |
| 7245 | switch( tempdi[ i ].DATAPTR ) |
| 7246 | { |
| 7247 | case 0: |
| 7248 | return &XGI_LVDSCRT11024x768_1_V[ tempal ] ; |
| 7249 | break ; |
| 7250 | case 1: |
| 7251 | return &XGI_LVDSCRT11024x768_2_V[ tempal ] ; |
| 7252 | break ; |
| 7253 | case 2: |
| 7254 | return &XGI_LVDSCRT11280x1024_1_V[ tempal ] ; |
| 7255 | break ; |
| 7256 | case 3: |
| 7257 | return &XGI_LVDSCRT11280x1024_2_V[ tempal ] ; |
| 7258 | break ; |
| 7259 | case 4: |
| 7260 | return &XGI_LVDSCRT11400x1050_1_V[ tempal ] ; |
| 7261 | break ; |
| 7262 | case 5: |
| 7263 | return &XGI_LVDSCRT11400x1050_2_V[ tempal ] ; |
| 7264 | break ; |
| 7265 | case 6: |
| 7266 | return &XGI_LVDSCRT11600x1200_1_V[ tempal ] ; |
| 7267 | break ; |
| 7268 | case 7: |
| 7269 | return &XGI_LVDSCRT11024x768_1_Vx75[ tempal ] ; |
| 7270 | break ; |
| 7271 | case 8: |
| 7272 | return &XGI_LVDSCRT11024x768_2_Vx75[ tempal ] ; |
| 7273 | break ; |
| 7274 | case 9: |
| 7275 | return &XGI_LVDSCRT11280x1024_1_Vx75[ tempal ] ; |
| 7276 | break ; |
| 7277 | case 10: |
| 7278 | return &XGI_LVDSCRT11280x1024_2_Vx75[ tempal ] ; |
| 7279 | break ; |
| 7280 | default: |
| 7281 | break ; |
| 7282 | } |
| 7283 | } |
| 7284 | else if ( table == 2 ) |
| 7285 | { |
| 7286 | switch( tempdi[ i ].DATAPTR ) |
| 7287 | { |
| 7288 | case 0: |
| 7289 | return &XGI_LVDS1024x768Data_1[ tempal ] ; |
| 7290 | break ; |
| 7291 | case 1: |
| 7292 | return &XGI_LVDS1024x768Data_2[ tempal ] ; |
| 7293 | break ; |
| 7294 | case 2: |
| 7295 | return &XGI_LVDS1280x1024Data_1[ tempal ] ; |
| 7296 | break ; |
| 7297 | case 3: |
| 7298 | return &XGI_LVDS1280x1024Data_2[ tempal ] ; |
| 7299 | break ; |
| 7300 | case 4: |
| 7301 | return &XGI_LVDS1400x1050Data_1[ tempal ] ; |
| 7302 | break ; |
| 7303 | case 5: |
| 7304 | return &XGI_LVDS1400x1050Data_2[ tempal ] ; |
| 7305 | break ; |
| 7306 | case 6: |
| 7307 | return &XGI_LVDS1600x1200Data_1[ tempal ] ; |
| 7308 | break ; |
| 7309 | case 7: |
| 7310 | return &XGI_LVDSNoScalingData[ tempal ] ; |
| 7311 | break ; |
| 7312 | case 8: |
| 7313 | return &XGI_LVDS1024x768Data_1x75[ tempal ] ; |
| 7314 | break ; |
| 7315 | case 9: |
| 7316 | return &XGI_LVDS1024x768Data_2x75[ tempal ] ; |
| 7317 | break ; |
| 7318 | case 10: |
| 7319 | return &XGI_LVDS1280x1024Data_1x75[ tempal ] ; |
| 7320 | break ; |
| 7321 | case 11: |
| 7322 | return &XGI_LVDS1280x1024Data_2x75[ tempal ] ; |
| 7323 | break ; |
| 7324 | case 12: |
| 7325 | return &XGI_LVDSNoScalingDatax75[ tempal ] ; |
| 7326 | break ; |
| 7327 | default: |
| 7328 | break ; |
| 7329 | } |
| 7330 | } |
| 7331 | else if ( table == 3 ) |
| 7332 | { |
| 7333 | switch( tempdi[ i ].DATAPTR ) |
| 7334 | { |
| 7335 | case 0: |
| 7336 | return &XGI_LVDS1024x768Des_1[ tempal ] ; |
| 7337 | break ; |
| 7338 | case 1: |
| 7339 | return &XGI_LVDS1024x768Des_3[ tempal ] ; |
| 7340 | break ; |
| 7341 | case 2: |
| 7342 | return &XGI_LVDS1024x768Des_2[ tempal ] ; |
| 7343 | break ; |
| 7344 | case 3: |
| 7345 | return &XGI_LVDS1280x1024Des_1[ tempal ] ; |
| 7346 | break ; |
| 7347 | case 4: |
| 7348 | return &XGI_LVDS1280x1024Des_2[ tempal ] ; |
| 7349 | break ; |
| 7350 | case 5: |
| 7351 | return &XGI_LVDS1400x1050Des_1[ tempal ] ; |
| 7352 | break ; |
| 7353 | case 6: |
| 7354 | return &XGI_LVDS1400x1050Des_2[ tempal ] ; |
| 7355 | break ; |
| 7356 | case 7: |
| 7357 | return &XGI_LVDS1600x1200Des_1[ tempal ] ; |
| 7358 | break ; |
| 7359 | case 8: |
| 7360 | return &XGI_LVDSNoScalingDesData[ tempal ] ; |
| 7361 | break ; |
| 7362 | case 9: |
| 7363 | return &XGI_LVDS1024x768Des_1x75[ tempal ] ; |
| 7364 | break ; |
| 7365 | case 10: |
| 7366 | return &XGI_LVDS1024x768Des_3x75[ tempal ] ; |
| 7367 | break ; |
| 7368 | case 11: |
| 7369 | return &XGI_LVDS1024x768Des_2x75[ tempal ] ; |
| 7370 | break; |
| 7371 | case 12: |
| 7372 | return &XGI_LVDS1280x1024Des_1x75[ tempal ] ; |
| 7373 | break ; |
| 7374 | case 13: |
| 7375 | return &XGI_LVDS1280x1024Des_2x75[ tempal ] ; |
| 7376 | break ; |
| 7377 | case 14: |
| 7378 | return &XGI_LVDSNoScalingDesDatax75[ tempal ] ; |
| 7379 | break ; |
| 7380 | default: |
| 7381 | break ; |
| 7382 | } |
| 7383 | } |
| 7384 | else if ( table == 4 ) |
| 7385 | { |
| 7386 | switch( tempdi[ i ].DATAPTR ) |
| 7387 | { |
| 7388 | case 0: |
| 7389 | return &XGI_ExtLCD1024x768Data[ tempal ] ; |
| 7390 | break ; |
| 7391 | case 1: |
| 7392 | return &XGI_StLCD1024x768Data[ tempal ] ; |
| 7393 | break ; |
| 7394 | case 2: |
| 7395 | return &XGI_CetLCD1024x768Data[ tempal ] ; |
| 7396 | break ; |
| 7397 | case 3: |
| 7398 | return &XGI_ExtLCD1280x1024Data[ tempal ] ; |
| 7399 | break ; |
| 7400 | case 4: |
| 7401 | return &XGI_StLCD1280x1024Data[ tempal ] ; |
| 7402 | break ; |
| 7403 | case 5: |
| 7404 | return &XGI_CetLCD1280x1024Data[ tempal ] ; |
| 7405 | break ; |
| 7406 | case 6: |
| 7407 | return &XGI_ExtLCD1400x1050Data[ tempal ] ; |
| 7408 | break ; |
| 7409 | case 7: |
| 7410 | return &XGI_StLCD1400x1050Data[ tempal ] ; |
| 7411 | break ; |
| 7412 | case 8: |
| 7413 | return &XGI_CetLCD1400x1050Data[ tempal ] ; |
| 7414 | break ; |
| 7415 | case 9: |
| 7416 | return &XGI_ExtLCD1600x1200Data[ tempal ] ; |
| 7417 | break ; |
| 7418 | case 10: |
| 7419 | return &XGI_StLCD1600x1200Data[ tempal ] ; |
| 7420 | break ; |
| 7421 | case 11: |
| 7422 | return &XGI_NoScalingData[ tempal ] ; |
| 7423 | break ; |
| 7424 | case 12: |
| 7425 | return &XGI_ExtLCD1024x768x75Data[ tempal ] ; |
| 7426 | break ; |
| 7427 | case 13: |
| 7428 | return &XGI_ExtLCD1024x768x75Data[ tempal ] ; |
| 7429 | break ; |
| 7430 | case 14: |
| 7431 | return &XGI_CetLCD1024x768x75Data[ tempal ] ; |
| 7432 | break ; |
| 7433 | case 15: |
| 7434 | return &XGI_ExtLCD1280x1024x75Data[ tempal ] ; |
| 7435 | break ; |
| 7436 | case 16: |
| 7437 | return &XGI_StLCD1280x1024x75Data[ tempal ] ; |
| 7438 | break; |
| 7439 | case 17: |
| 7440 | return &XGI_CetLCD1280x1024x75Data[ tempal ] ; |
| 7441 | break; |
| 7442 | case 18: |
| 7443 | return &XGI_NoScalingDatax75[ tempal ] ; |
| 7444 | break ; |
| 7445 | default: |
| 7446 | break ; |
| 7447 | } |
| 7448 | } |
| 7449 | else if ( table == 5 ) |
| 7450 | { |
| 7451 | switch( tempdi[ i ].DATAPTR ) |
| 7452 | { |
| 7453 | case 0: |
| 7454 | return &XGI_ExtLCDDes1024x768Data[ tempal ] ; |
| 7455 | break ; |
| 7456 | case 1: |
| 7457 | return &XGI_StLCDDes1024x768Data[ tempal ] ; |
| 7458 | break ; |
| 7459 | case 2: |
| 7460 | return &XGI_CetLCDDes1024x768Data[ tempal ] ; |
| 7461 | break ; |
| 7462 | case 3: |
| 7463 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7464 | return &XGI_ExtLCDDLDes1280x1024Data[ tempal ] ; |
| 7465 | else |
| 7466 | return &XGI_ExtLCDDes1280x1024Data[ tempal ] ; |
| 7467 | break ; |
| 7468 | case 4: |
| 7469 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7470 | return &XGI_StLCDDLDes1280x1024Data[ tempal ] ; |
| 7471 | else |
| 7472 | return &XGI_StLCDDes1280x1024Data[ tempal ] ; |
| 7473 | break ; |
| 7474 | case 5: |
| 7475 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7476 | return &XGI_CetLCDDLDes1280x1024Data[ tempal ] ; |
| 7477 | else |
| 7478 | return &XGI_CetLCDDes1280x1024Data[ tempal ] ; |
| 7479 | break ; |
| 7480 | case 6: |
| 7481 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7482 | return &XGI_ExtLCDDLDes1400x1050Data[ tempal ] ; |
| 7483 | else |
| 7484 | return &XGI_ExtLCDDes1400x1050Data[ tempal ] ; |
| 7485 | break ; |
| 7486 | case 7: |
| 7487 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7488 | return &XGI_StLCDDLDes1400x1050Data[ tempal ] ; |
| 7489 | else |
| 7490 | return &XGI_StLCDDes1400x1050Data[ tempal ] ; |
| 7491 | break ; |
| 7492 | case 8: |
| 7493 | return &XGI_CetLCDDes1400x1050Data[ tempal ] ; |
| 7494 | break ; |
| 7495 | case 9: |
| 7496 | return &XGI_CetLCDDes1400x1050Data2[ tempal ] ; |
| 7497 | break ; |
| 7498 | case 10: |
| 7499 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7500 | return &XGI_ExtLCDDLDes1600x1200Data[ tempal ] ; |
| 7501 | else |
| 7502 | return &XGI_ExtLCDDes1600x1200Data[ tempal ] ; |
| 7503 | break ; |
| 7504 | case 11: |
| 7505 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7506 | return &XGI_StLCDDLDes1600x1200Data[ tempal ] ; |
| 7507 | else |
| 7508 | return &XGI_StLCDDes1600x1200Data[ tempal ] ; |
| 7509 | break ; |
| 7510 | case 12: |
| 7511 | return &XGI_NoScalingDesData[ tempal ] ; |
| 7512 | break; |
| 7513 | case 13: |
| 7514 | return &XGI_ExtLCDDes1024x768x75Data[ tempal ] ; |
| 7515 | break ; |
| 7516 | case 14: |
| 7517 | return &XGI_StLCDDes1024x768x75Data[ tempal ] ; |
| 7518 | break ; |
| 7519 | case 15: |
| 7520 | return &XGI_CetLCDDes1024x768x75Data[ tempal ] ; |
| 7521 | break ; |
| 7522 | case 16: |
| 7523 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7524 | return &XGI_ExtLCDDLDes1280x1024x75Data[ tempal ] ; |
| 7525 | else |
| 7526 | return &XGI_ExtLCDDes1280x1024x75Data[ tempal ] ; |
| 7527 | break ; |
| 7528 | case 17: |
| 7529 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7530 | return &XGI_StLCDDLDes1280x1024x75Data[ tempal ] ; |
| 7531 | else |
| 7532 | return &XGI_StLCDDes1280x1024x75Data[ tempal ] ; |
| 7533 | break ; |
| 7534 | case 18: |
| 7535 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7536 | return &XGI_CetLCDDLDes1280x1024x75Data[ tempal ] ; |
| 7537 | else |
| 7538 | return &XGI_CetLCDDes1280x1024x75Data[ tempal ] ; |
| 7539 | break ; |
| 7540 | case 19: |
| 7541 | return &XGI_NoScalingDesDatax75[ tempal ] ; |
| 7542 | break ; |
| 7543 | default: |
| 7544 | break ; |
| 7545 | } |
| 7546 | } |
| 7547 | else if ( table == 6 ) |
| 7548 | { |
| 7549 | switch( tempdi[ i ].DATAPTR ) |
| 7550 | { |
| 7551 | case 0: |
| 7552 | return &XGI_CH7017LV1024x768[ tempal ] ; |
| 7553 | break ; |
| 7554 | case 1: |
| 7555 | return &XGI_CH7017LV1400x1050[ tempal ] ; |
| 7556 | break ; |
| 7557 | default: |
| 7558 | break ; |
| 7559 | } |
| 7560 | } |
| 7561 | return 0 ; |
| 7562 | } |
| 7563 | |
| 7564 | |
| 7565 | /* --------------------------------------------------------------------- */ |
| 7566 | /* Function : XGI_GetTVPtr */ |
| 7567 | /* Input : */ |
| 7568 | /* Output : */ |
| 7569 | /* Description : */ |
| 7570 | /* --------------------------------------------------------------------- */ |
| 7571 | void* XGI_GetTVPtr (USHORT BX,USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 7572 | { |
| 7573 | USHORT i , tempdx , tempbx , tempal , modeflag , table ; |
| 7574 | XGI330_TVDataTablStruct *tempdi = 0 ; |
| 7575 | |
| 7576 | tempbx = BX ; |
| 7577 | |
| 7578 | if ( ModeNo <= 0x13 ) |
| 7579 | { |
| 7580 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 7581 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; |
| 7582 | } |
| 7583 | else |
| 7584 | { |
| 7585 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 7586 | tempal = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC ; |
| 7587 | } |
| 7588 | |
| 7589 | tempal = tempal & 0x3f ; |
| 7590 | table = tempbx ; |
| 7591 | |
| 7592 | switch( tempbx ) |
| 7593 | { |
| 7594 | case 0: |
| 7595 | tempdi = 0 ; /*EPLCHTVCRT1Ptr_H;*/ |
| 7596 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 7597 | { |
| 7598 | tempdi = XGI_EPLCHTVCRT1Ptr; |
| 7599 | } |
| 7600 | break ; |
| 7601 | case 1: |
| 7602 | tempdi = 0 ; /*EPLCHTVCRT1Ptr_V;*/ |
| 7603 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 7604 | { |
| 7605 | tempdi = XGI_EPLCHTVCRT1Ptr; |
| 7606 | } |
| 7607 | break ; |
| 7608 | case 2: |
| 7609 | tempdi = XGI_EPLCHTVDataPtr ; |
| 7610 | break ; |
| 7611 | case 3: |
| 7612 | tempdi = 0 ; |
| 7613 | break ; |
| 7614 | case 4: |
| 7615 | tempdi = XGI_TVDataTable ; |
| 7616 | break ; |
| 7617 | case 5: |
| 7618 | tempdi = 0 ; |
| 7619 | break ; |
| 7620 | case 6: |
| 7621 | tempdi = XGI_EPLCHTVRegPtr ; |
| 7622 | break ; |
| 7623 | default: |
| 7624 | break ; |
| 7625 | } |
| 7626 | |
| 7627 | if ( tempdi == 0x00 ) /* OEMUtil */ |
| 7628 | return( 0 ) ; |
| 7629 | |
| 7630 | tempdx = pVBInfo->TVInfo ; |
| 7631 | |
| 7632 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 7633 | tempdx = tempdx | SetTVLockMode ; |
| 7634 | |
| 7635 | if ( modeflag & HalfDCLK ) |
| 7636 | tempdx = tempdx | SetTVLowResolution ; |
| 7637 | |
| 7638 | i = 0 ; |
| 7639 | |
| 7640 | while( tempdi[ i ].MASK != 0xffff ) |
| 7641 | { |
| 7642 | if ( ( tempdx & tempdi[ i ].MASK ) == tempdi[ i ].CAP ) |
| 7643 | break ; |
| 7644 | i++ ; |
| 7645 | } |
| 7646 | |
| 7647 | if ( table == 0x00 ) /* 07/05/22 */ |
| 7648 | { |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7649 | } |
| 7650 | else if ( table == 0x01 ) |
| 7651 | { |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7652 | } |
| 7653 | else if ( table == 0x04 ) |
| 7654 | { |
| 7655 | switch( tempdi[ i ].DATAPTR ) |
| 7656 | { |
| 7657 | case 0: |
| 7658 | return &XGI_ExtPALData[ tempal ] ; |
| 7659 | break ; |
| 7660 | case 1: |
| 7661 | return &XGI_ExtNTSCData[ tempal ] ; |
| 7662 | break ; |
| 7663 | case 2: |
| 7664 | return &XGI_StPALData[ tempal ] ; |
| 7665 | break ; |
| 7666 | case 3: |
| 7667 | return &XGI_StNTSCData[ tempal ] ; |
| 7668 | break ; |
| 7669 | case 4: |
| 7670 | return &XGI_ExtHiTVData[ tempal ] ; |
| 7671 | break ; |
| 7672 | case 5: |
| 7673 | return &XGI_St2HiTVData[ tempal ] ; |
| 7674 | break ; |
| 7675 | case 6: |
| 7676 | return &XGI_ExtYPbPr525iData[ tempal ] ; |
| 7677 | break ; |
| 7678 | case 7: |
| 7679 | return &XGI_ExtYPbPr525pData[ tempal ] ; |
| 7680 | break ; |
| 7681 | case 8: |
| 7682 | return &XGI_ExtYPbPr750pData[ tempal ] ; |
| 7683 | break ; |
| 7684 | case 9: |
| 7685 | return &XGI_StYPbPr525iData[ tempal ] ; |
| 7686 | break ; |
| 7687 | case 10: |
| 7688 | return &XGI_StYPbPr525pData[ tempal ] ; |
| 7689 | break ; |
| 7690 | case 11: |
| 7691 | return &XGI_StYPbPr750pData[ tempal ] ; |
| 7692 | break; |
| 7693 | case 12: /* avoid system hang */ |
| 7694 | return &XGI_ExtNTSCData[ tempal ] ; |
| 7695 | break ; |
| 7696 | case 13: |
| 7697 | return &XGI_St1HiTVData[ tempal ] ; |
| 7698 | break ; |
| 7699 | default: |
| 7700 | break ; |
| 7701 | } |
| 7702 | } |
| 7703 | else if( table == 0x02 ) |
| 7704 | { |
| 7705 | switch( tempdi[ i ].DATAPTR ) |
| 7706 | { |
| 7707 | case 0: |
| 7708 | return &XGI_CHTVUNTSCData[ tempal ] ; |
| 7709 | break ; |
| 7710 | case 1: |
| 7711 | return &XGI_CHTVONTSCData[ tempal ] ; |
| 7712 | break ; |
| 7713 | case 2: |
| 7714 | return &XGI_CHTVUPALData[ tempal ] ; |
| 7715 | break ; |
| 7716 | case 3: |
| 7717 | return &XGI_CHTVOPALData[ tempal ] ; |
| 7718 | break ; |
| 7719 | default: |
| 7720 | break ; |
| 7721 | } |
| 7722 | } |
| 7723 | else if( table == 0x06 ) |
| 7724 | { |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7725 | } |
| 7726 | return( 0 ) ; |
| 7727 | } |
| 7728 | |
| 7729 | |
| 7730 | /* --------------------------------------------------------------------- */ |
| 7731 | /* Function : XGI_BacklightByDrv */ |
| 7732 | /* Input : */ |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 7733 | /* Output : 1 -> Skip backlight control */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7734 | /* Description : */ |
| 7735 | /* --------------------------------------------------------------------- */ |
| 7736 | BOOLEAN XGI_BacklightByDrv( PVB_DEVICE_INFO pVBInfo ) |
| 7737 | { |
| 7738 | UCHAR tempah ; |
| 7739 | |
| 7740 | tempah = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x3A ) ; |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 7741 | if (tempah & BacklightControlBit) |
| 7742 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7743 | else |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 7744 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7745 | } |
| 7746 | |
| 7747 | |
| 7748 | /* --------------------------------------------------------------------- */ |
| 7749 | /* Function : XGI_FirePWDDisable */ |
| 7750 | /* Input : */ |
| 7751 | /* Output : */ |
| 7752 | /* Description : Turn off VDD & Backlight : Fire disable procedure */ |
| 7753 | /* --------------------------------------------------------------------- */ |
| 7754 | /* |
| 7755 | void XGI_FirePWDDisable( PVB_DEVICE_INFO pVBInfo ) |
| 7756 | { |
| 7757 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x26 , 0x00 , 0xFC ) ; |
| 7758 | } |
| 7759 | */ |
| 7760 | |
| 7761 | /* --------------------------------------------------------------------- */ |
| 7762 | /* Function : XGI_FirePWDEnable */ |
| 7763 | /* Input : */ |
| 7764 | /* Output : */ |
| 7765 | /* Description : Turn on VDD & Backlight : Fire enable procedure */ |
| 7766 | /* --------------------------------------------------------------------- */ |
| 7767 | void XGI_FirePWDEnable(PVB_DEVICE_INFO pVBInfo ) |
| 7768 | { |
| 7769 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x26 , 0x03 , 0xFC ) ; |
| 7770 | } |
| 7771 | |
| 7772 | |
| 7773 | /* --------------------------------------------------------------------- */ |
| 7774 | /* Function : XGI_EnableGatingCRT */ |
| 7775 | /* Input : */ |
| 7776 | /* Output : */ |
| 7777 | /* Description : */ |
| 7778 | /* --------------------------------------------------------------------- */ |
| 7779 | void XGI_EnableGatingCRT(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo) |
| 7780 | { |
| 7781 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x63 , 0xBF , 0x40 ) ; |
| 7782 | } |
| 7783 | |
| 7784 | |
| 7785 | /* --------------------------------------------------------------------- */ |
| 7786 | /* Function : XGI_DisableGatingCRT */ |
| 7787 | /* Input : */ |
| 7788 | /* Output : */ |
| 7789 | /* Description : */ |
| 7790 | /* --------------------------------------------------------------------- */ |
| 7791 | void XGI_DisableGatingCRT(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo) |
| 7792 | { |
| 7793 | |
| 7794 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x63 , 0xBF , 0x00 ) ; |
| 7795 | } |
| 7796 | |
| 7797 | |
| 7798 | /* --------------------------------------------------------------------- */ |
| 7799 | /* Function : XGI_SetPanelDelay */ |
| 7800 | /* Input : */ |
| 7801 | /* Output : */ |
| 7802 | /* Description : */ |
| 7803 | /* I/P : bl : 1 ; T1 : the duration between CPL on and signal on */ |
| 7804 | /* : bl : 2 ; T2 : the duration signal on and Vdd on */ |
| 7805 | /* : bl : 3 ; T3 : the duration between CPL off and signal off */ |
| 7806 | /* : bl : 4 ; T4 : the duration signal off and Vdd off */ |
| 7807 | /* --------------------------------------------------------------------- */ |
| 7808 | void XGI_SetPanelDelay(USHORT tempbl, PVB_DEVICE_INFO pVBInfo) |
| 7809 | { |
| 7810 | USHORT index ; |
| 7811 | |
| 7812 | index = XGI_GetLCDCapPtr(pVBInfo) ; |
| 7813 | |
| 7814 | if ( tempbl == 1 ) |
| 7815 | XGINew_LCD_Wait_Time( pVBInfo->LCDCapList[ index ].PSC_S1, pVBInfo ) ; |
| 7816 | |
| 7817 | if ( tempbl == 2 ) |
| 7818 | XGINew_LCD_Wait_Time( pVBInfo->LCDCapList[ index ].PSC_S2, pVBInfo ) ; |
| 7819 | |
| 7820 | if ( tempbl == 3 ) |
| 7821 | XGINew_LCD_Wait_Time( pVBInfo->LCDCapList[ index ].PSC_S3, pVBInfo ) ; |
| 7822 | |
| 7823 | if ( tempbl == 4 ) |
| 7824 | XGINew_LCD_Wait_Time( pVBInfo->LCDCapList[ index ].PSC_S4, pVBInfo ) ; |
| 7825 | } |
| 7826 | |
| 7827 | |
| 7828 | /* --------------------------------------------------------------------- */ |
| 7829 | /* Function : XGI_SetPanelPower */ |
| 7830 | /* Input : */ |
| 7831 | /* Output : */ |
| 7832 | /* Description : */ |
| 7833 | /* I/O : ah = 0011b = 03h ; Backlight on, Power on */ |
| 7834 | /* = 0111b = 07h ; Backlight on, Power off */ |
| 7835 | /* = 1011b = 0Bh ; Backlight off, Power on */ |
| 7836 | /* = 1111b = 0Fh ; Backlight off, Power off */ |
| 7837 | /* --------------------------------------------------------------------- */ |
| 7838 | void XGI_SetPanelPower(USHORT tempah,USHORT tempbl, PVB_DEVICE_INFO pVBInfo) |
| 7839 | { |
| 7840 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 7841 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x26 , tempbl , tempah ) ; |
| 7842 | else |
| 7843 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x11 , tempbl , tempah ) ; |
| 7844 | } |
| 7845 | |
| 7846 | UCHAR XG21GPIODataTransfer(UCHAR ujDate) |
| 7847 | { |
| 7848 | UCHAR ujRet = 0; |
| 7849 | UCHAR i = 0; |
| 7850 | |
| 7851 | for (i=0; i<8; i++) |
| 7852 | { |
| 7853 | ujRet = ujRet << 1; |
| 7854 | /* ujRet |= GETBITS(ujDate >> i, 0:0); */ |
| 7855 | ujRet |= (ujDate >> i) & 1; |
| 7856 | } |
| 7857 | |
| 7858 | return ujRet; |
| 7859 | } |
| 7860 | |
| 7861 | /*----------------------------------------------------------------------------*/ |
| 7862 | /* output */ |
| 7863 | /* bl[5] : LVDS signal */ |
| 7864 | /* bl[1] : LVDS backlight */ |
| 7865 | /* bl[0] : LVDS VDD */ |
| 7866 | /*----------------------------------------------------------------------------*/ |
| 7867 | UCHAR XGI_XG21GetPSCValue(PVB_DEVICE_INFO pVBInfo) |
| 7868 | { |
| 7869 | UCHAR CR4A,temp; |
| 7870 | |
| 7871 | CR4A = XGINew_GetReg1( pVBInfo->P3d4 , 0x4A ) ; |
| 7872 | XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~0x23 ) ; /* enable GPIO write */ |
| 7873 | |
| 7874 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x48 ) ; |
| 7875 | |
| 7876 | temp = XG21GPIODataTransfer(temp); |
| 7877 | temp &= 0x23; |
| 7878 | XGINew_SetReg1( pVBInfo->P3d4 , 0x4A , CR4A ) ; |
| 7879 | return temp; |
| 7880 | } |
| 7881 | |
| 7882 | /*----------------------------------------------------------------------------*/ |
| 7883 | /* output */ |
| 7884 | /* bl[5] : LVDS signal */ |
| 7885 | /* bl[1] : LVDS backlight */ |
| 7886 | /* bl[0] : LVDS VDD */ |
| 7887 | /*----------------------------------------------------------------------------*/ |
| 7888 | UCHAR XGI_XG27GetPSCValue(PVB_DEVICE_INFO pVBInfo) |
| 7889 | { |
| 7890 | UCHAR CR4A,CRB4,temp; |
| 7891 | |
| 7892 | CR4A = XGINew_GetReg1( pVBInfo->P3d4 , 0x4A ) ; |
| 7893 | XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~0x0C ) ; /* enable GPIO write */ |
| 7894 | |
| 7895 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x48 ) ; |
| 7896 | |
| 7897 | temp &= 0x0C; |
| 7898 | temp >>= 2; |
| 7899 | XGINew_SetReg1( pVBInfo->P3d4 , 0x4A , CR4A ) ; |
| 7900 | CRB4 = XGINew_GetReg1( pVBInfo->P3d4 , 0xB4 ) ; |
| 7901 | temp |= ((CRB4&0x04)<<3); |
| 7902 | return temp; |
| 7903 | } |
| 7904 | /*----------------------------------------------------------------------------*/ |
| 7905 | /* input */ |
| 7906 | /* bl[5] : 1;LVDS signal on */ |
| 7907 | /* bl[1] : 1;LVDS backlight on */ |
| 7908 | /* bl[0] : 1:LVDS VDD on */ |
| 7909 | /* bh: 100000b : clear bit 5, to set bit5 */ |
| 7910 | /* 000010b : clear bit 1, to set bit1 */ |
| 7911 | /* 000001b : clear bit 0, to set bit0 */ |
| 7912 | /*----------------------------------------------------------------------------*/ |
| 7913 | void XGI_XG21BLSignalVDD(USHORT tempbh,USHORT tempbl, PVB_DEVICE_INFO pVBInfo) |
| 7914 | { |
| 7915 | UCHAR CR4A,temp; |
| 7916 | |
| 7917 | CR4A = XGINew_GetReg1( pVBInfo->P3d4 , 0x4A ) ; |
| 7918 | tempbh &= 0x23; |
| 7919 | tempbl &= 0x23; |
| 7920 | XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~tempbh ) ; /* enable GPIO write */ |
| 7921 | |
| 7922 | if (tempbh&0x20) |
| 7923 | { |
| 7924 | temp = (tempbl>>4)&0x02; |
| 7925 | |
| 7926 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0xB4 , ~0x02 , temp) ; /* CR B4[1] */ |
| 7927 | |
| 7928 | } |
| 7929 | |
| 7930 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x48 ) ; |
| 7931 | |
| 7932 | temp = XG21GPIODataTransfer(temp); |
| 7933 | temp &= ~tempbh; |
| 7934 | temp |= tempbl; |
| 7935 | XGINew_SetReg1( pVBInfo->P3d4 , 0x48 , temp ) ; |
| 7936 | } |
| 7937 | |
| 7938 | void XGI_XG27BLSignalVDD(USHORT tempbh,USHORT tempbl, PVB_DEVICE_INFO pVBInfo) |
| 7939 | { |
| 7940 | UCHAR CR4A,temp; |
| 7941 | USHORT tempbh0,tempbl0; |
| 7942 | |
| 7943 | tempbh0 = tempbh; |
| 7944 | tempbl0 = tempbl; |
| 7945 | tempbh0 &= 0x20; |
| 7946 | tempbl0 &= 0x20; |
| 7947 | tempbh0 >>= 3; |
| 7948 | tempbl0 >>= 3; |
| 7949 | |
| 7950 | if (tempbh&0x20) |
| 7951 | { |
| 7952 | temp = (tempbl>>4)&0x02; |
| 7953 | |
| 7954 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0xB4 , ~0x02 , temp) ; /* CR B4[1] */ |
| 7955 | |
| 7956 | } |
| 7957 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0xB4 , ~tempbh0 , tempbl0 ) ; |
| 7958 | |
| 7959 | CR4A = XGINew_GetReg1( pVBInfo->P3d4 , 0x4A ) ; |
| 7960 | tempbh &= 0x03; |
| 7961 | tempbl &= 0x03; |
| 7962 | tempbh <<= 2; |
| 7963 | tempbl <<= 2; /* GPIOC,GPIOD */ |
| 7964 | XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~tempbh ) ; /* enable GPIO write */ |
| 7965 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x48 , ~tempbh , tempbl ) ; |
| 7966 | } |
| 7967 | |
| 7968 | /* --------------------------------------------------------------------- */ |
| 7969 | USHORT XGI_GetLVDSOEMTableIndex(PVB_DEVICE_INFO pVBInfo) |
| 7970 | { |
| 7971 | USHORT index ; |
| 7972 | |
| 7973 | index = XGINew_GetReg1( pVBInfo->P3d4 , 0x36 ) ; |
| 7974 | if (index<sizeof(XGI21_LCDCapList)/sizeof(XGI21_LVDSCapStruct)) |
| 7975 | { |
| 7976 | return index; |
| 7977 | } |
| 7978 | return 0; |
| 7979 | } |
| 7980 | |
| 7981 | /* --------------------------------------------------------------------- */ |
| 7982 | /* Function : XGI_XG21SetPanelDelay */ |
| 7983 | /* Input : */ |
| 7984 | /* Output : */ |
| 7985 | /* Description : */ |
| 7986 | /* I/P : bl : 1 ; T1 : the duration between CPL on and signal on */ |
| 7987 | /* : bl : 2 ; T2 : the duration signal on and Vdd on */ |
| 7988 | /* : bl : 3 ; T3 : the duration between CPL off and signal off */ |
| 7989 | /* : bl : 4 ; T4 : the duration signal off and Vdd off */ |
| 7990 | /* --------------------------------------------------------------------- */ |
| 7991 | void XGI_XG21SetPanelDelay(USHORT tempbl, PVB_DEVICE_INFO pVBInfo) |
| 7992 | { |
| 7993 | USHORT index ; |
| 7994 | |
| 7995 | index = XGI_GetLVDSOEMTableIndex( pVBInfo ); |
| 7996 | if ( tempbl == 1 ) |
| 7997 | XGINew_LCD_Wait_Time( pVBInfo->XG21_LVDSCapList[ index ].PSC_S1, pVBInfo ) ; |
| 7998 | |
| 7999 | if ( tempbl == 2 ) |
| 8000 | XGINew_LCD_Wait_Time( pVBInfo->XG21_LVDSCapList[ index ].PSC_S2, pVBInfo ) ; |
| 8001 | |
| 8002 | if ( tempbl == 3 ) |
| 8003 | XGINew_LCD_Wait_Time( pVBInfo->XG21_LVDSCapList[ index ].PSC_S3, pVBInfo ) ; |
| 8004 | |
| 8005 | if ( tempbl == 4 ) |
| 8006 | XGINew_LCD_Wait_Time( pVBInfo->XG21_LVDSCapList[ index ].PSC_S4, pVBInfo ) ; |
| 8007 | } |
| 8008 | |
| 8009 | BOOLEAN XGI_XG21CheckLVDSMode(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 8010 | { |
| 8011 | USHORT xres , |
| 8012 | yres , |
| 8013 | colordepth , |
| 8014 | modeflag , |
| 8015 | resindex , |
| 8016 | lvdstableindex; |
| 8017 | |
| 8018 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 8019 | if ( ModeNo <= 0x13 ) |
| 8020 | { |
| 8021 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; |
| 8022 | yres = pVBInfo->StResInfo[ resindex ].VTotal ; |
| 8023 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ |
| 8024 | } |
| 8025 | else |
| 8026 | { |
| 8027 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */ |
| 8028 | yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; /* yres->bx */ |
| 8029 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex].Ext_ModeFlag ; /* si+St_ModeFlag */ |
| 8030 | } |
| 8031 | |
| 8032 | if ( !( modeflag & Charx8Dot ) ) |
| 8033 | { |
| 8034 | xres /= 9; |
| 8035 | xres *= 8; |
| 8036 | } |
| 8037 | |
| 8038 | if ( ModeNo > 0x13 ) |
| 8039 | { |
| 8040 | if ( ( ModeNo>0x13 ) && ( modeflag & HalfDCLK ) ) |
| 8041 | { |
| 8042 | xres *= 2 ; |
| 8043 | } |
| 8044 | if ( ( ModeNo>0x13 ) && ( modeflag & DoubleScanMode ) ) |
| 8045 | { |
| 8046 | yres *= 2 ; |
| 8047 | } |
| 8048 | } |
| 8049 | |
| 8050 | lvdstableindex = XGI_GetLVDSOEMTableIndex( pVBInfo ); |
| 8051 | if ( xres > (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE) ) |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 8052 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8053 | |
| 8054 | if ( yres > (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE) ) |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 8055 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8056 | |
| 8057 | if ( ModeNo > 0x13 ) |
| 8058 | { |
| 8059 | if ( ( xres != (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE) ) || |
| 8060 | ( yres != (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE)) ) |
| 8061 | { |
| 8062 | colordepth = XGI_GetColorDepth( ModeNo , ModeIdIndex, pVBInfo ) ; |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 8063 | if (colordepth > 2) |
| 8064 | return 0; |
| 8065 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8066 | } |
| 8067 | } |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 8068 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8069 | } |
| 8070 | |
| 8071 | void XGI_SetXG21FPBits(PVB_DEVICE_INFO pVBInfo) |
| 8072 | { |
| 8073 | UCHAR temp; |
| 8074 | |
| 8075 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; /* D[0] 1: 18bit */ |
| 8076 | temp = ( temp & 1 ) << 6; |
| 8077 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x06 , ~0x40 , temp ) ; /* SR06[6] 18bit Dither */ |
| 8078 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x09 , ~0xc0 , temp | 0x80 ) ; /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: dual 12bits */ |
| 8079 | |
| 8080 | } |
| 8081 | |
| 8082 | void XGI_SetXG27FPBits(PVB_DEVICE_INFO pVBInfo) |
| 8083 | { |
| 8084 | UCHAR temp; |
| 8085 | |
| 8086 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; /* D[1:0] 01: 18bit, 00: dual 12, 10: single 24 */ |
| 8087 | temp = ( temp & 3 ) << 6; |
| 8088 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x06 , ~0xc0 , temp & 0x80 ) ; /* SR06[7]0: dual 12/1: single 24 [6] 18bit Dither <= 0 h/w recommend */ |
| 8089 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x09 , ~0xc0 , temp | 0x80 ) ; /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: 24bits */ |
| 8090 | |
| 8091 | } |
| 8092 | |
| 8093 | void XGI_SetXG21LVDSPara(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 8094 | { |
| 8095 | UCHAR temp,Miscdata; |
| 8096 | USHORT xres , |
| 8097 | yres , |
| 8098 | modeflag , |
| 8099 | resindex , |
| 8100 | lvdstableindex ; |
| 8101 | USHORT LVDSHT,LVDSHBS,LVDSHRS,LVDSHRE,LVDSHBE; |
| 8102 | USHORT LVDSVT,LVDSVBS,LVDSVRS,LVDSVRE,LVDSVBE; |
| 8103 | USHORT value; |
| 8104 | |
| 8105 | lvdstableindex = XGI_GetLVDSOEMTableIndex( pVBInfo ); |
| 8106 | |
| 8107 | temp = (UCHAR) ( ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability & (LCDPolarity << 8 ) ) >> 8 ); |
| 8108 | temp &= LCDPolarity; |
| 8109 | Miscdata =(UCHAR) XGINew_GetReg2(pVBInfo->P3cc) ; |
| 8110 | |
| 8111 | XGINew_SetReg3( pVBInfo->P3c2 , (Miscdata & 0x3F) | temp ) ; |
| 8112 | |
| 8113 | temp = (UCHAR) ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability & LCDPolarity ) ; |
| 8114 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x80 , temp&0x80 ) ; /* SR35[7] FP VSync polarity */ |
| 8115 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , ~0x20 , (temp&0x40)>>1 ) ; /* SR30[5] FP HSync polarity */ |
| 8116 | |
| 8117 | XGI_SetXG21FPBits(pVBInfo); |
| 8118 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 8119 | if ( ModeNo <= 0x13 ) |
| 8120 | { |
| 8121 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; |
| 8122 | yres = pVBInfo->StResInfo[ resindex ].VTotal ; |
| 8123 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ |
| 8124 | } |
| 8125 | else |
| 8126 | { |
| 8127 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */ |
| 8128 | yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; /* yres->bx */ |
| 8129 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex].Ext_ModeFlag ; /* si+St_ModeFlag */ |
| 8130 | } |
| 8131 | |
| 8132 | if (!( modeflag & Charx8Dot )) |
| 8133 | xres = xres * 8 / 9; |
| 8134 | |
| 8135 | LVDSHT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHT; |
| 8136 | |
| 8137 | LVDSHBS = xres + ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE - xres ) / 2 ; |
| 8138 | if ( ( ModeNo<=0x13 ) && ( modeflag & HalfDCLK ) ) |
| 8139 | { |
| 8140 | LVDSHBS -= xres/4 ; |
| 8141 | } |
| 8142 | if (LVDSHBS > LVDSHT) LVDSHBS -= LVDSHT ; |
| 8143 | |
| 8144 | LVDSHRS = LVDSHBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHFP ; |
| 8145 | if (LVDSHRS > LVDSHT) LVDSHRS -= LVDSHT ; |
| 8146 | |
| 8147 | LVDSHRE = LVDSHRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHSYNC ; |
| 8148 | if (LVDSHRE > LVDSHT) LVDSHRE -= LVDSHT ; |
| 8149 | |
| 8150 | LVDSHBE = LVDSHBS + LVDSHT - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE ; |
| 8151 | |
| 8152 | LVDSVT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVT; |
| 8153 | |
| 8154 | LVDSVBS = yres + ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE - yres ) / 2 ; |
| 8155 | if ( ( ModeNo>0x13 ) && ( modeflag & DoubleScanMode ) ) |
| 8156 | { |
| 8157 | LVDSVBS += yres/2 ; |
| 8158 | } |
| 8159 | if (LVDSVBS > LVDSVT) LVDSVBS -= LVDSVT ; |
| 8160 | |
| 8161 | LVDSVRS = LVDSVBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVFP ; |
| 8162 | if (LVDSVRS > LVDSVT) LVDSVRS -= LVDSVT ; |
| 8163 | |
| 8164 | LVDSVRE = LVDSVRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVSYNC ; |
| 8165 | if (LVDSVRE > LVDSVT) LVDSVRE -= LVDSVT ; |
| 8166 | |
| 8167 | LVDSVBE = LVDSVBS + LVDSVT - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE ; |
| 8168 | |
| 8169 | temp = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x11 ) ; |
| 8170 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , temp & 0x7f ) ; /* Unlock CRTC */ |
| 8171 | |
| 8172 | if (!( modeflag & Charx8Dot )) |
| 8173 | { |
| 8174 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x1 , 0x1 ) ; |
| 8175 | } |
| 8176 | |
| 8177 | /* HT SR0B[1:0] CR00 */ |
| 8178 | value = ( LVDSHT >> 3 ) - 5; |
| 8179 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0x03 , ( value & 0x300 ) >> 8 ) ; |
| 8180 | XGINew_SetReg1( pVBInfo->P3d4 , 0x0 , (value & 0xFF) ) ; |
| 8181 | |
| 8182 | /* HBS SR0B[5:4] CR02 */ |
| 8183 | value = ( LVDSHBS >> 3 ) - 1; |
| 8184 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0x30 , ( value & 0x300 ) >> 4 ) ; |
| 8185 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2 , (value & 0xFF) ) ; |
| 8186 | |
| 8187 | /* HBE SR0C[1:0] CR05[7] CR03[4:0] */ |
| 8188 | value = ( LVDSHBE >> 3 ) - 1; |
| 8189 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0C , ~0x03 , ( value & 0xC0 ) >> 6 ) ; |
| 8190 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x05 , ~0x80 , ( value & 0x20 ) << 2 ) ; |
| 8191 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x03 , ~0x1F , value & 0x1F ) ; |
| 8192 | |
| 8193 | /* HRS SR0B[7:6] CR04 */ |
| 8194 | value = ( LVDSHRS >> 3 ) + 2; |
| 8195 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0xC0 , ( value & 0x300 ) >> 2 ) ; |
| 8196 | XGINew_SetReg1( pVBInfo->P3d4 , 0x4 , (value & 0xFF) ) ; |
| 8197 | |
| 8198 | /* Panel HRS SR2F[1:0] SR2E[7:0] */ |
| 8199 | value--; |
| 8200 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x2F , ~0x03 , ( value & 0x300 ) >> 8 ) ; |
| 8201 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , (value & 0xFF) ) ; |
| 8202 | |
| 8203 | /* HRE SR0C[2] CR05[4:0] */ |
| 8204 | value = ( LVDSHRE >> 3 ) + 2; |
| 8205 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0C , ~0x04 , ( value & 0x20 ) >> 3 ) ; |
| 8206 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x05 , ~0x1F , value & 0x1F ) ; |
| 8207 | |
| 8208 | /* Panel HRE SR2F[7:2] */ |
| 8209 | value--; |
| 8210 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x2F , ~0xFC , value << 2 ) ; |
| 8211 | |
| 8212 | /* VT SR0A[0] CR07[5][0] CR06 */ |
| 8213 | value = LVDSVT - 2 ; |
| 8214 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x01 , ( value & 0x400 ) >> 10 ) ; |
| 8215 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x20 , ( value & 0x200 ) >> 4 ) ; |
| 8216 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x01 , ( value & 0x100 ) >> 8 ) ; |
| 8217 | XGINew_SetReg1( pVBInfo->P3d4 , 0x06 , (value & 0xFF) ) ; |
| 8218 | |
| 8219 | /* VBS SR0A[2] CR09[5] CR07[3] CR15 */ |
| 8220 | value = LVDSVBS - 1 ; |
| 8221 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x04 , ( value & 0x400 ) >> 8 ) ; |
| 8222 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x09 , ~0x20 , ( value & 0x200 ) >> 4 ) ; |
| 8223 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x08 , ( value & 0x100 ) >> 5 ) ; |
| 8224 | XGINew_SetReg1( pVBInfo->P3d4 , 0x15 , (value & 0xFF) ) ; |
| 8225 | |
| 8226 | /* VBE SR0A[4] CR16 */ |
| 8227 | value = LVDSVBE - 1; |
| 8228 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x10 , ( value & 0x100 ) >> 4 ) ; |
| 8229 | XGINew_SetReg1( pVBInfo->P3d4 , 0x16 , (value & 0xFF) ) ; |
| 8230 | |
| 8231 | /* VRS SR0A[3] CR7[7][2] CR10 */ |
| 8232 | value = LVDSVRS - 1 ; |
| 8233 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x08 , ( value & 0x400 ) >> 7 ) ; |
| 8234 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x80 , ( value & 0x200 ) >> 2 ) ; |
| 8235 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x04 , ( value & 0x100 ) >> 6 ) ; |
| 8236 | XGINew_SetReg1( pVBInfo->P3d4 , 0x10 , (value & 0xFF) ) ; |
| 8237 | |
| 8238 | /* Panel VRS SR3F[1:0] SR34[7:0] SR33[0] */ |
| 8239 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x3F , ~0x03 , ( value & 0x600 ) >> 9 ) ; |
| 8240 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , (value >> 1) & 0xFF ) ; |
| 8241 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x33 , ~0x01 , value & 0x01 ) ; |
| 8242 | |
| 8243 | /* VRE SR0A[5] CR11[3:0] */ |
| 8244 | value = LVDSVRE - 1; |
| 8245 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x20 , ( value & 0x10 ) << 1 ) ; |
| 8246 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x11 , ~0x0F , value & 0x0F ) ; |
| 8247 | |
| 8248 | /* Panel VRE SR3F[7:2] */ /* SR3F[7] has to be 0, h/w bug */ |
| 8249 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x3F , ~0xFC , ( value << 2 ) & 0x7C ) ; |
| 8250 | |
| 8251 | for ( temp=0, value = 0; temp < 3; temp++) |
| 8252 | { |
| 8253 | |
| 8254 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x31 , ~0x30 , value ) ; |
| 8255 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData1) ; |
| 8256 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData2) ; |
| 8257 | value += 0x10; |
| 8258 | } |
| 8259 | |
| 8260 | if (!( modeflag & Charx8Dot )) |
| 8261 | { |
| 8262 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ |
| 8263 | XGINew_SetReg3( pVBInfo->P3c0 , 0x13 ) ; /* set index */ |
| 8264 | XGINew_SetReg3( pVBInfo->P3c0 , 0x00 ) ; /* set data, panning = 0, shift left 1 dot*/ |
| 8265 | |
| 8266 | XGINew_GetReg2( pVBInfo->P3da ) ; /* Enable Attribute */ |
| 8267 | XGINew_SetReg3( pVBInfo->P3c0 , 0x20 ) ; |
| 8268 | |
| 8269 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ |
| 8270 | } |
| 8271 | |
| 8272 | |
| 8273 | } |
| 8274 | |
| 8275 | /* no shadow case */ |
| 8276 | void XGI_SetXG27LVDSPara(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 8277 | { |
| 8278 | UCHAR temp,Miscdata; |
| 8279 | USHORT xres , |
| 8280 | yres , |
| 8281 | modeflag , |
| 8282 | resindex , |
| 8283 | lvdstableindex ; |
| 8284 | USHORT LVDSHT,LVDSHBS,LVDSHRS,LVDSHRE,LVDSHBE; |
| 8285 | USHORT LVDSVT,LVDSVBS,LVDSVRS,LVDSVRE,LVDSVBE; |
| 8286 | USHORT value; |
| 8287 | |
| 8288 | lvdstableindex = XGI_GetLVDSOEMTableIndex( pVBInfo ); |
| 8289 | temp = (UCHAR) ( ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability & (LCDPolarity << 8 ) ) >> 8 ); |
| 8290 | temp &= LCDPolarity; |
| 8291 | Miscdata =(UCHAR) XGINew_GetReg2(pVBInfo->P3cc) ; |
| 8292 | |
| 8293 | XGINew_SetReg3( pVBInfo->P3c2 , (Miscdata & 0x3F) | temp ) ; |
| 8294 | |
| 8295 | temp = (UCHAR) ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability & LCDPolarity ) ; |
| 8296 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x80 , temp&0x80 ) ; /* SR35[7] FP VSync polarity */ |
| 8297 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , ~0x20 , (temp&0x40)>>1 ) ; /* SR30[5] FP HSync polarity */ |
| 8298 | |
| 8299 | XGI_SetXG27FPBits(pVBInfo); |
| 8300 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 8301 | if ( ModeNo <= 0x13 ) |
| 8302 | { |
| 8303 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; |
| 8304 | yres = pVBInfo->StResInfo[ resindex ].VTotal ; |
| 8305 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ |
| 8306 | } |
| 8307 | else |
| 8308 | { |
| 8309 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */ |
| 8310 | yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; /* yres->bx */ |
| 8311 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex].Ext_ModeFlag ; /* si+St_ModeFlag */ |
| 8312 | } |
| 8313 | |
| 8314 | if (!( modeflag & Charx8Dot )) |
| 8315 | xres = xres * 8 / 9; |
| 8316 | |
| 8317 | LVDSHT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHT; |
| 8318 | |
| 8319 | LVDSHBS = xres + ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE - xres ) / 2 ; |
| 8320 | if ( ( ModeNo<=0x13 ) && ( modeflag & HalfDCLK ) ) |
| 8321 | { |
| 8322 | LVDSHBS -= xres/4 ; |
| 8323 | } |
| 8324 | if (LVDSHBS > LVDSHT) LVDSHBS -= LVDSHT ; |
| 8325 | |
| 8326 | LVDSHRS = LVDSHBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHFP ; |
| 8327 | if (LVDSHRS > LVDSHT) LVDSHRS -= LVDSHT ; |
| 8328 | |
| 8329 | LVDSHRE = LVDSHRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHSYNC ; |
| 8330 | if (LVDSHRE > LVDSHT) LVDSHRE -= LVDSHT ; |
| 8331 | |
| 8332 | LVDSHBE = LVDSHBS + LVDSHT - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE ; |
| 8333 | |
| 8334 | LVDSVT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVT; |
| 8335 | |
| 8336 | LVDSVBS = yres + ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE - yres ) / 2 ; |
| 8337 | if ( ( ModeNo>0x13 ) && ( modeflag & DoubleScanMode ) ) |
| 8338 | { |
| 8339 | LVDSVBS += yres/2 ; |
| 8340 | } |
| 8341 | if (LVDSVBS > LVDSVT) LVDSVBS -= LVDSVT ; |
| 8342 | |
| 8343 | LVDSVRS = LVDSVBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVFP ; |
| 8344 | if (LVDSVRS > LVDSVT) LVDSVRS -= LVDSVT ; |
| 8345 | |
| 8346 | LVDSVRE = LVDSVRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVSYNC ; |
| 8347 | if (LVDSVRE > LVDSVT) LVDSVRE -= LVDSVT ; |
| 8348 | |
| 8349 | LVDSVBE = LVDSVBS + LVDSVT - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE ; |
| 8350 | |
| 8351 | temp = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x11 ) ; |
| 8352 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , temp & 0x7f ) ; /* Unlock CRTC */ |
| 8353 | |
| 8354 | if (!( modeflag & Charx8Dot )) |
| 8355 | { |
| 8356 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x1 , 0x1 ) ; |
| 8357 | } |
| 8358 | |
| 8359 | /* HT SR0B[1:0] CR00 */ |
| 8360 | value = ( LVDSHT >> 3 ) - 5; |
| 8361 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0x03 , ( value & 0x300 ) >> 8 ) ; |
| 8362 | XGINew_SetReg1( pVBInfo->P3d4 , 0x0 , (value & 0xFF) ) ; |
| 8363 | |
| 8364 | /* HBS SR0B[5:4] CR02 */ |
| 8365 | value = ( LVDSHBS >> 3 ) - 1; |
| 8366 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0x30 , ( value & 0x300 ) >> 4 ) ; |
| 8367 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2 , (value & 0xFF) ) ; |
| 8368 | |
| 8369 | /* HBE SR0C[1:0] CR05[7] CR03[4:0] */ |
| 8370 | value = ( LVDSHBE >> 3 ) - 1; |
| 8371 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0C , ~0x03 , ( value & 0xC0 ) >> 6 ) ; |
| 8372 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x05 , ~0x80 , ( value & 0x20 ) << 2 ) ; |
| 8373 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x03 , ~0x1F , value & 0x1F ) ; |
| 8374 | |
| 8375 | /* HRS SR0B[7:6] CR04 */ |
| 8376 | value = ( LVDSHRS >> 3 ) + 2; |
| 8377 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0xC0 , ( value & 0x300 ) >> 2 ) ; |
| 8378 | XGINew_SetReg1( pVBInfo->P3d4 , 0x4 , (value & 0xFF) ) ; |
| 8379 | |
| 8380 | /* Panel HRS SR2F[1:0] SR2E[7:0] */ |
| 8381 | value--; |
| 8382 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x2F , ~0x03 , ( value & 0x300 ) >> 8 ) ; |
| 8383 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , (value & 0xFF) ) ; |
| 8384 | |
| 8385 | /* HRE SR0C[2] CR05[4:0] */ |
| 8386 | value = ( LVDSHRE >> 3 ) + 2; |
| 8387 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0C , ~0x04 , ( value & 0x20 ) >> 3 ) ; |
| 8388 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x05 , ~0x1F , value & 0x1F ) ; |
| 8389 | |
| 8390 | /* Panel HRE SR2F[7:2] */ |
| 8391 | value--; |
| 8392 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x2F , ~0xFC , value << 2 ) ; |
| 8393 | |
| 8394 | /* VT SR0A[0] CR07[5][0] CR06 */ |
| 8395 | value = LVDSVT - 2 ; |
| 8396 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x01 , ( value & 0x400 ) >> 10 ) ; |
| 8397 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x20 , ( value & 0x200 ) >> 4 ) ; |
| 8398 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x01 , ( value & 0x100 ) >> 8 ) ; |
| 8399 | XGINew_SetReg1( pVBInfo->P3d4 , 0x06 , (value & 0xFF) ) ; |
| 8400 | |
| 8401 | /* VBS SR0A[2] CR09[5] CR07[3] CR15 */ |
| 8402 | value = LVDSVBS - 1 ; |
| 8403 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x04 , ( value & 0x400 ) >> 8 ) ; |
| 8404 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x09 , ~0x20 , ( value & 0x200 ) >> 4 ) ; |
| 8405 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x08 , ( value & 0x100 ) >> 5 ) ; |
| 8406 | XGINew_SetReg1( pVBInfo->P3d4 , 0x15 , (value & 0xFF) ) ; |
| 8407 | |
| 8408 | /* VBE SR0A[4] CR16 */ |
| 8409 | value = LVDSVBE - 1; |
| 8410 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x10 , ( value & 0x100 ) >> 4 ) ; |
| 8411 | XGINew_SetReg1( pVBInfo->P3d4 , 0x16 , (value & 0xFF) ) ; |
| 8412 | |
| 8413 | /* VRS SR0A[3] CR7[7][2] CR10 */ |
| 8414 | value = LVDSVRS - 1 ; |
| 8415 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x08 , ( value & 0x400 ) >> 7 ) ; |
| 8416 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x80 , ( value & 0x200 ) >> 2 ) ; |
| 8417 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x04 , ( value & 0x100 ) >> 6 ) ; |
| 8418 | XGINew_SetReg1( pVBInfo->P3d4 , 0x10 , (value & 0xFF) ) ; |
| 8419 | |
| 8420 | /* Panel VRS SR35[2:0] SR34[7:0] */ |
| 8421 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x07 , ( value & 0x700 ) >> 8 ) ; |
| 8422 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , value & 0xFF ) ; |
| 8423 | |
| 8424 | /* VRE SR0A[5] CR11[3:0] */ |
| 8425 | value = LVDSVRE - 1; |
| 8426 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x20 , ( value & 0x10 ) << 1 ) ; |
| 8427 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x11 , ~0x0F , value & 0x0F ) ; |
| 8428 | |
| 8429 | /* Panel VRE SR3F[7:2] */ |
| 8430 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x3F , ~0xFC , ( value << 2 ) & 0xFC ) ; |
| 8431 | |
| 8432 | for ( temp=0, value = 0; temp < 3; temp++) |
| 8433 | { |
| 8434 | |
| 8435 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x31 , ~0x30 , value ) ; |
| 8436 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData1) ; |
| 8437 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData2) ; |
| 8438 | value += 0x10; |
| 8439 | } |
| 8440 | |
| 8441 | if (!( modeflag & Charx8Dot )) |
| 8442 | { |
| 8443 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ |
| 8444 | XGINew_SetReg3( pVBInfo->P3c0 , 0x13 ) ; /* set index */ |
| 8445 | XGINew_SetReg3( pVBInfo->P3c0 , 0x00 ) ; /* set data, panning = 0, shift left 1 dot*/ |
| 8446 | |
| 8447 | XGINew_GetReg2( pVBInfo->P3da ) ; /* Enable Attribute */ |
| 8448 | XGINew_SetReg3( pVBInfo->P3c0 , 0x20 ) ; |
| 8449 | |
| 8450 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ |
| 8451 | } |
| 8452 | |
| 8453 | |
| 8454 | } |
| 8455 | |
| 8456 | /* --------------------------------------------------------------------- */ |
| 8457 | /* Function : XGI_IsLCDON */ |
| 8458 | /* Input : */ |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 8459 | /* Output : 0 : Skip PSC Control */ |
| 8460 | /* 1: Disable PSC */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8461 | /* Description : */ |
| 8462 | /* --------------------------------------------------------------------- */ |
| 8463 | BOOLEAN XGI_IsLCDON(PVB_DEVICE_INFO pVBInfo) |
| 8464 | { |
| 8465 | USHORT tempax ; |
| 8466 | |
| 8467 | tempax = pVBInfo->VBInfo ; |
| 8468 | if ( tempax & SetCRT2ToDualEdge ) |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 8469 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8470 | else if ( tempax & ( DisableCRT2Display | SwitchToCRT2 | SetSimuScanMode ) ) |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 8471 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8472 | |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 8473 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8474 | } |
| 8475 | |
| 8476 | |
| 8477 | /* --------------------------------------------------------------------- */ |
| 8478 | /* Function : XGI_EnablePWD */ |
| 8479 | /* Input : */ |
| 8480 | /* Output : */ |
| 8481 | /* Description : */ |
| 8482 | /* --------------------------------------------------------------------- */ |
| 8483 | void XGI_EnablePWD( PVB_DEVICE_INFO pVBInfo ) |
| 8484 | { |
| 8485 | USHORT index , |
| 8486 | temp ; |
| 8487 | |
| 8488 | index = XGI_GetLCDCapPtr(pVBInfo) ; |
| 8489 | temp = pVBInfo->LCDCapList[ index ].PWD_2B ; |
| 8490 | XGINew_SetReg1( pVBInfo->Part4Port , 0x2B , temp ) ; |
| 8491 | XGINew_SetReg1( pVBInfo->Part4Port , 0x2C , pVBInfo->LCDCapList[ index ].PWD_2C ) ; |
| 8492 | XGINew_SetReg1( pVBInfo->Part4Port , 0x2D , pVBInfo->LCDCapList[ index ].PWD_2D ) ; |
| 8493 | XGINew_SetReg1( pVBInfo->Part4Port , 0x2E , pVBInfo->LCDCapList[ index ].PWD_2E ) ; |
| 8494 | XGINew_SetReg1( pVBInfo->Part4Port , 0x2F , pVBInfo->LCDCapList[ index ].PWD_2F ) ; |
| 8495 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x27 , 0x80 ) ; /* enable PWD */ |
| 8496 | } |
| 8497 | |
| 8498 | |
| 8499 | /* --------------------------------------------------------------------- */ |
| 8500 | /* Function : XGI_DisablePWD */ |
| 8501 | /* Input : */ |
| 8502 | /* Output : */ |
| 8503 | /* Description : */ |
| 8504 | /* --------------------------------------------------------------------- */ |
| 8505 | void XGI_DisablePWD( PVB_DEVICE_INFO pVBInfo ) |
| 8506 | { |
| 8507 | XGINew_SetRegAND( pVBInfo->Part4Port , 0x27 , 0x7F ) ; /* disable PWD */ |
| 8508 | } |
| 8509 | |
| 8510 | |
| 8511 | /* --------------------------------------------------------------------- */ |
| 8512 | /* Function : XGI_DisableChISLCD */ |
| 8513 | /* Input : */ |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 8514 | /* Output : 0 -> Not LCD Mode */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8515 | /* Description : */ |
| 8516 | /* --------------------------------------------------------------------- */ |
| 8517 | BOOLEAN XGI_DisableChISLCD(PVB_DEVICE_INFO pVBInfo) |
| 8518 | { |
| 8519 | USHORT tempbx , |
| 8520 | tempah ; |
| 8521 | |
| 8522 | tempbx = pVBInfo->SetFlag & ( DisableChA | DisableChB ) ; |
| 8523 | tempah = ~( ( USHORT )XGINew_GetReg1( pVBInfo->Part1Port , 0x2E ) ) ; |
| 8524 | |
| 8525 | if ( tempbx & ( EnableChA | DisableChA ) ) |
| 8526 | { |
| 8527 | if ( !( tempah & 0x08 ) ) /* Chk LCDA Mode */ |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 8528 | return 0 ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8529 | } |
| 8530 | |
| 8531 | if ( !( tempbx & ( EnableChB | DisableChB ) ) ) |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 8532 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8533 | |
| 8534 | if ( tempah & 0x01 ) /* Chk LCDB Mode */ |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 8535 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8536 | |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 8537 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8538 | } |
| 8539 | |
| 8540 | |
| 8541 | /* --------------------------------------------------------------------- */ |
| 8542 | /* Function : XGI_EnableChISLCD */ |
| 8543 | /* Input : */ |
| 8544 | /* Output : 0 -> Not LCD mode */ |
| 8545 | /* Description : */ |
| 8546 | /* --------------------------------------------------------------------- */ |
| 8547 | BOOLEAN XGI_EnableChISLCD(PVB_DEVICE_INFO pVBInfo) |
| 8548 | { |
| 8549 | USHORT tempbx , |
| 8550 | tempah ; |
| 8551 | |
| 8552 | |
| 8553 | tempbx = pVBInfo->SetFlag & ( EnableChA | EnableChB ) ; |
| 8554 | tempah = ~( ( USHORT )XGINew_GetReg1( pVBInfo->Part1Port , 0x2E ) ) ; |
| 8555 | |
| 8556 | if ( tempbx & ( EnableChA | DisableChA ) ) |
| 8557 | { |
| 8558 | if ( !( tempah & 0x08 ) ) /* Chk LCDA Mode */ |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 8559 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8560 | } |
| 8561 | |
| 8562 | if ( !( tempbx & ( EnableChB | DisableChB ) ) ) |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 8563 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8564 | |
| 8565 | if ( tempah & 0x01 ) /* Chk LCDB Mode */ |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 8566 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8567 | |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame^] | 8568 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8569 | } |
| 8570 | |
| 8571 | |
| 8572 | /* --------------------------------------------------------------------- */ |
| 8573 | /* Function : XGI_GetLCDCapPtr */ |
| 8574 | /* Input : */ |
| 8575 | /* Output : */ |
| 8576 | /* Description : */ |
| 8577 | /* --------------------------------------------------------------------- */ |
| 8578 | USHORT XGI_GetLCDCapPtr( PVB_DEVICE_INFO pVBInfo ) |
| 8579 | { |
| 8580 | UCHAR tempal , |
| 8581 | tempah , |
| 8582 | tempbl , |
| 8583 | i ; |
| 8584 | |
| 8585 | tempah = XGINew_GetReg1( pVBInfo->P3d4 , 0x36 ) ; |
| 8586 | tempal = tempah & 0x0F ; |
| 8587 | tempah = tempah & 0xF0 ; |
| 8588 | i = 0 ; |
| 8589 | tempbl = pVBInfo->LCDCapList[ i ].LCD_ID ; |
| 8590 | |
| 8591 | while( tempbl != 0xFF ) |
| 8592 | { |
| 8593 | if ( tempbl & 0x80 ) /* OEMUtil */ |
| 8594 | { |
| 8595 | tempal = tempah ; |
| 8596 | tempbl = tempbl & ~( 0x80 ) ; |
| 8597 | } |
| 8598 | |
| 8599 | if ( tempal == tempbl ) |
| 8600 | break ; |
| 8601 | |
| 8602 | i++ ; |
| 8603 | |
| 8604 | tempbl = pVBInfo->LCDCapList[ i ].LCD_ID ; |
| 8605 | } |
| 8606 | |
| 8607 | return i ; |
| 8608 | } |
| 8609 | |
| 8610 | |
| 8611 | /* --------------------------------------------------------------------- */ |
| 8612 | /* Function : XGI_GetLCDCapPtr1 */ |
| 8613 | /* Input : */ |
| 8614 | /* Output : */ |
| 8615 | /* Description : */ |
| 8616 | /* --------------------------------------------------------------------- */ |
| 8617 | USHORT XGI_GetLCDCapPtr1( PVB_DEVICE_INFO pVBInfo ) |
| 8618 | { |
| 8619 | USHORT tempah , |
| 8620 | tempal , |
| 8621 | tempbl , |
| 8622 | i ; |
| 8623 | |
| 8624 | tempal = pVBInfo->LCDResInfo ; |
| 8625 | tempah = pVBInfo->LCDTypeInfo ; |
| 8626 | |
| 8627 | i = 0 ; |
| 8628 | tempbl = pVBInfo->LCDCapList[ i ].LCD_ID; |
| 8629 | |
| 8630 | while( tempbl != 0xFF ) |
| 8631 | { |
| 8632 | if ( ( tempbl & 0x80 ) && ( tempbl != 0x80 ) ) |
| 8633 | { |
| 8634 | tempal = tempah ; |
| 8635 | tempbl &= ~0x80 ; |
| 8636 | } |
| 8637 | |
| 8638 | if ( tempal == tempbl ) |
| 8639 | break ; |
| 8640 | |
| 8641 | i++ ; |
| 8642 | tempbl = pVBInfo->LCDCapList[ i ].LCD_ID ; |
| 8643 | } |
| 8644 | |
| 8645 | if ( tempbl == 0xFF ) |
| 8646 | { |
| 8647 | pVBInfo->LCDResInfo = Panel1024x768 ; |
| 8648 | pVBInfo->LCDTypeInfo = 0 ; |
| 8649 | i = 0 ; |
| 8650 | } |
| 8651 | |
| 8652 | return i ; |
| 8653 | } |
| 8654 | |
| 8655 | |
| 8656 | /* --------------------------------------------------------------------- */ |
| 8657 | /* Function : XGI_GetLCDSync */ |
| 8658 | /* Input : */ |
| 8659 | /* Output : */ |
| 8660 | /* Description : */ |
| 8661 | /* --------------------------------------------------------------------- */ |
| 8662 | void XGI_GetLCDSync( USHORT* HSyncWidth , USHORT* VSyncWidth, PVB_DEVICE_INFO pVBInfo ) |
| 8663 | { |
| 8664 | USHORT Index ; |
| 8665 | |
| 8666 | Index = XGI_GetLCDCapPtr(pVBInfo) ; |
| 8667 | *HSyncWidth = pVBInfo->LCDCapList[ Index ].LCD_HSyncWidth ; |
| 8668 | *VSyncWidth = pVBInfo->LCDCapList[ Index ].LCD_VSyncWidth ; |
| 8669 | |
| 8670 | return ; |
| 8671 | } |
| 8672 | |
| 8673 | |
| 8674 | |
| 8675 | /* --------------------------------------------------------------------- */ |
| 8676 | /* Function : XGI_EnableBridge */ |
| 8677 | /* Input : */ |
| 8678 | /* Output : */ |
| 8679 | /* Description : */ |
| 8680 | /* --------------------------------------------------------------------- */ |
| 8681 | void XGI_EnableBridge( PXGI_HW_DEVICE_INFO HwDeviceExtension , PVB_DEVICE_INFO pVBInfo) |
| 8682 | { |
| 8683 | USHORT tempbl , |
| 8684 | tempah ; |
| 8685 | |
| 8686 | if ( pVBInfo->SetFlag == Win9xDOSMode ) |
| 8687 | { |
| 8688 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 8689 | { |
| 8690 | XGI_DisplayOn( HwDeviceExtension, pVBInfo) ; |
| 8691 | return ; |
| 8692 | } |
| 8693 | else /* LVDS or CH7017 */ |
| 8694 | return ; |
| 8695 | } |
| 8696 | |
| 8697 | |
| 8698 | if ( HwDeviceExtension->jChipType < XG40 ) |
| 8699 | { |
| 8700 | if ( !XGI_DisableChISLCD(pVBInfo) ) |
| 8701 | { |
| 8702 | if ( ( XGI_EnableChISLCD(pVBInfo) ) || ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) |
| 8703 | { |
| 8704 | if ( pVBInfo->LCDInfo & SetPWDEnable ) |
| 8705 | { |
| 8706 | XGI_EnablePWD( pVBInfo); |
| 8707 | } |
| 8708 | else |
| 8709 | { |
| 8710 | pVBInfo->LCDInfo &= ( ~SetPWDEnable ) ; |
| 8711 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 8712 | { |
| 8713 | tempbl = 0xFD ; |
| 8714 | tempah = 0x02 ; |
| 8715 | } |
| 8716 | else |
| 8717 | { |
| 8718 | tempbl = 0xFB ; |
| 8719 | tempah = 0x00 ; |
| 8720 | } |
| 8721 | |
| 8722 | XGI_SetPanelPower( tempah , tempbl, pVBInfo ) ; |
| 8723 | XGI_SetPanelDelay( 1,pVBInfo ) ; |
| 8724 | } |
| 8725 | } |
| 8726 | } |
| 8727 | } /* Not 340 */ |
| 8728 | |
| 8729 | |
| 8730 | |
| 8731 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 8732 | { |
| 8733 | if ( !( pVBInfo->SetFlag & DisableChA ) ) |
| 8734 | { |
| 8735 | if ( pVBInfo->SetFlag & EnableChA ) |
| 8736 | { |
| 8737 | XGINew_SetReg1( pVBInfo->Part1Port , 0x1E , 0x20 ) ; /* Power on */ |
| 8738 | } |
| 8739 | else |
| 8740 | { |
| 8741 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) /* SetCRT2ToLCDA ) */ |
| 8742 | { |
| 8743 | XGINew_SetReg1(pVBInfo->Part1Port,0x1E,0x20); /* Power on */ |
| 8744 | } |
| 8745 | } |
| 8746 | } |
| 8747 | |
| 8748 | if ( !( pVBInfo->SetFlag & DisableChB ) ) |
| 8749 | { |
| 8750 | if ( ( pVBInfo->SetFlag & EnableChB ) || ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToTV | SetCRT2ToRAMDAC ) ) ) |
| 8751 | { |
| 8752 | tempah = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x32 ) ; |
| 8753 | tempah &= 0xDF; |
| 8754 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 8755 | { |
| 8756 | if ( !( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) ) |
| 8757 | tempah |= 0x20 ; |
| 8758 | } |
| 8759 | XGINew_SetReg1( pVBInfo->P3c4 , 0x32 , tempah ) ; |
| 8760 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x1E , 0x20 ) ; |
| 8761 | |
| 8762 | |
| 8763 | tempah = ( UCHAR )XGINew_GetReg1( pVBInfo->Part1Port , 0x2E ) ; |
| 8764 | |
| 8765 | if ( !( tempah & 0x80 ) ) |
| 8766 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x2E , 0x80 ) ; /* BVBDOENABLE = 1 */ |
| 8767 | |
| 8768 | XGINew_SetRegAND( pVBInfo->Part1Port , 0x00 , 0x7F ) ; /* BScreenOFF = 0 */ |
| 8769 | } |
| 8770 | } |
| 8771 | |
| 8772 | if ( ( pVBInfo->SetFlag & ( EnableChA | EnableChB ) ) || ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) ) |
| 8773 | { |
| 8774 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x00 , ~0xE0 , 0x20 ) ; /* shampoo 0129 */ |
| 8775 | if ( pVBInfo->VBType & ( VB_XGI302LV | VB_XGI301C ) ) |
| 8776 | { |
| 8777 | if ( !XGI_DisableChISLCD(pVBInfo) ) |
| 8778 | { |
| 8779 | if ( XGI_EnableChISLCD( pVBInfo) || ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) |
| 8780 | XGINew_SetRegAND( pVBInfo->Part4Port ,0x2A , 0x7F ) ; /* LVDS PLL power on */ |
| 8781 | } |
| 8782 | XGINew_SetRegAND( pVBInfo->Part4Port , 0x30 , 0x7F ) ; /* LVDS Driver power on */ |
| 8783 | } |
| 8784 | } |
| 8785 | |
| 8786 | tempah = 0x00 ; |
| 8787 | |
| 8788 | if ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) |
| 8789 | { |
| 8790 | tempah = 0xc0 ; |
| 8791 | |
| 8792 | if ( !( pVBInfo->VBInfo & SetSimuScanMode ) ) |
| 8793 | { |
| 8794 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 8795 | { |
| 8796 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) |
| 8797 | { |
| 8798 | tempah = tempah & 0x40; |
| 8799 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 8800 | tempah = tempah ^ 0xC0 ; |
| 8801 | |
| 8802 | if ( pVBInfo->SetFlag & DisableChB ) |
| 8803 | tempah &= 0xBF ; |
| 8804 | |
| 8805 | if ( pVBInfo->SetFlag & DisableChA ) |
| 8806 | tempah &= 0x7F ; |
| 8807 | |
| 8808 | if ( pVBInfo->SetFlag & EnableChB ) |
| 8809 | tempah |= 0x40 ; |
| 8810 | |
| 8811 | if ( pVBInfo->SetFlag & EnableChA ) |
| 8812 | tempah |= 0x80 ; |
| 8813 | } |
| 8814 | } |
| 8815 | } |
| 8816 | } |
| 8817 | |
| 8818 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x1F , tempah ) ; /* EnablePart4_1F */ |
| 8819 | |
| 8820 | if ( pVBInfo->SetFlag & Win9xDOSMode ) |
| 8821 | { |
| 8822 | XGI_DisplayOn( HwDeviceExtension, pVBInfo) ; |
| 8823 | return ; |
| 8824 | } |
| 8825 | |
| 8826 | if ( !( pVBInfo->SetFlag & DisableChA ) ) |
| 8827 | { |
| 8828 | XGI_VBLongWait( pVBInfo) ; |
| 8829 | if ( !( pVBInfo->SetFlag & GatingCRT ) ) |
| 8830 | { |
| 8831 | XGI_DisableGatingCRT( HwDeviceExtension, pVBInfo ) ; |
| 8832 | XGI_DisplayOn( HwDeviceExtension, pVBInfo) ; |
| 8833 | XGI_VBLongWait( pVBInfo) ; |
| 8834 | } |
| 8835 | } |
| 8836 | } /* 301 */ |
| 8837 | else /* LVDS */ |
| 8838 | { |
| 8839 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 8840 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x1E , 0x20 ) ; /* enable CRT2 */ |
| 8841 | |
| 8842 | |
| 8843 | |
| 8844 | tempah = ( UCHAR )XGINew_GetReg1( pVBInfo->Part1Port , 0x2E ) ; |
| 8845 | if ( !( tempah & 0x80 ) ) |
| 8846 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x2E , 0x80 ) ; /* BVBDOENABLE = 1 */ |
| 8847 | |
| 8848 | XGINew_SetRegAND(pVBInfo->Part1Port,0x00,0x7F); |
| 8849 | XGI_DisplayOn( HwDeviceExtension, pVBInfo); |
| 8850 | } /* End of VB */ |
| 8851 | |
| 8852 | |
| 8853 | if ( HwDeviceExtension->jChipType < XG40 ) |
| 8854 | { |
| 8855 | if ( !XGI_EnableChISLCD(pVBInfo) ) |
| 8856 | { |
| 8857 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 8858 | { |
| 8859 | if ( XGI_BacklightByDrv(pVBInfo) ) |
| 8860 | return ; |
| 8861 | } |
| 8862 | else |
| 8863 | return ; |
| 8864 | } |
| 8865 | |
| 8866 | if ( pVBInfo->LCDInfo & SetPWDEnable ) |
| 8867 | { |
| 8868 | XGI_FirePWDEnable(pVBInfo) ; |
| 8869 | return ; |
| 8870 | } |
| 8871 | |
| 8872 | XGI_SetPanelDelay( 2,pVBInfo ) ; |
| 8873 | |
| 8874 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 8875 | { |
| 8876 | tempah = 0x01 ; |
| 8877 | tempbl = 0xFE ; /* turn on backlght */ |
| 8878 | } |
| 8879 | else |
| 8880 | { |
| 8881 | tempbl = 0xF7 ; |
| 8882 | tempah = 0x00 ; |
| 8883 | } |
| 8884 | XGI_SetPanelPower( tempah , tempbl , pVBInfo) ; |
| 8885 | } |
| 8886 | } |
| 8887 | |
| 8888 | |
| 8889 | /* --------------------------------------------------------------------- */ |
| 8890 | /* Function : XGI_DisableBridge */ |
| 8891 | /* Input : */ |
| 8892 | /* Output : */ |
| 8893 | /* Description : */ |
| 8894 | /* --------------------------------------------------------------------- */ |
| 8895 | void XGI_DisableBridge(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo) |
| 8896 | { |
| 8897 | USHORT tempax , |
| 8898 | tempbx , |
| 8899 | tempah = 0 , |
| 8900 | tempbl = 0 ; |
| 8901 | |
| 8902 | if ( pVBInfo->SetFlag == Win9xDOSMode ) |
| 8903 | return ; |
| 8904 | |
| 8905 | |
| 8906 | if ( HwDeviceExtension->jChipType < XG40 ) |
| 8907 | { |
| 8908 | if ( ( !( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) || ( XGI_DisableChISLCD(pVBInfo) ) ) |
| 8909 | { |
| 8910 | if ( !XGI_IsLCDON(pVBInfo) ) |
| 8911 | { |
| 8912 | if ( pVBInfo->LCDInfo & SetPWDEnable ) |
| 8913 | XGI_EnablePWD( pVBInfo) ; |
| 8914 | else |
| 8915 | { |
| 8916 | pVBInfo->LCDInfo &= ~SetPWDEnable ; |
| 8917 | XGI_DisablePWD(pVBInfo) ; |
| 8918 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 8919 | { |
| 8920 | tempbx = 0xFE ; /* not 01h */ |
| 8921 | tempax = 0 ; |
| 8922 | } |
| 8923 | else |
| 8924 | { |
| 8925 | tempbx = 0xF7 ; /* not 08h */ |
| 8926 | tempax = 0x08 ; |
| 8927 | } |
| 8928 | XGI_SetPanelPower( tempax , tempbx , pVBInfo) ; |
| 8929 | XGI_SetPanelDelay( 3,pVBInfo ) ; |
| 8930 | } |
| 8931 | } /* end if(!XGI_IsLCDON(pVBInfo)) */ |
| 8932 | } |
| 8933 | } |
| 8934 | |
| 8935 | /* if ( CH7017 ) |
| 8936 | { |
| 8937 | if ( !( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2toLCDA ) ) || ( XGI_DisableChISLCD(pVBInfo) ) ) |
| 8938 | { |
| 8939 | if ( !XGI_IsLCDON(pVBInfo) ) |
| 8940 | { |
| 8941 | if ( DISCHARGE ) |
| 8942 | { |
| 8943 | tempbx = XGINew_GetCH7005( 0x61 ) ; |
| 8944 | if ( tempbx < 0x01 ) //first time we power up |
| 8945 | XGINew_SetCH7005( 0x0066 ) ; //and disable power sequence |
| 8946 | else |
| 8947 | XGINew_SetCH7005( 0x5f66 ) ; //leave VDD on - disable power |
| 8948 | } |
| 8949 | } |
| 8950 | } |
| 8951 | } */ |
| 8952 | |
| 8953 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B| VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 8954 | { |
| 8955 | tempah = 0x3F ; |
| 8956 | if ( !( pVBInfo->VBInfo & ( DisableCRT2Display | SetSimuScanMode ) ) ) |
| 8957 | { |
| 8958 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 8959 | { |
| 8960 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) |
| 8961 | { |
| 8962 | tempah = 0x7F; /* Disable Channel A */ |
| 8963 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) |
| 8964 | tempah = 0xBF ; /* Disable Channel B */ |
| 8965 | |
| 8966 | if ( pVBInfo->SetFlag & DisableChB ) |
| 8967 | tempah &= 0xBF ; /* force to disable Cahnnel */ |
| 8968 | |
| 8969 | if ( pVBInfo->SetFlag & DisableChA ) |
| 8970 | tempah &= 0x7F ; /* Force to disable Channel B */ |
| 8971 | } |
| 8972 | } |
| 8973 | } |
| 8974 | |
| 8975 | XGINew_SetRegAND( pVBInfo->Part4Port , 0x1F , tempah ) ; /* disable part4_1f */ |
| 8976 | |
| 8977 | if ( pVBInfo->VBType & ( VB_XGI302LV | VB_XGI301C ) ) |
| 8978 | { |
| 8979 | if ( ( ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) || ( XGI_DisableChISLCD(pVBInfo) ) || ( XGI_IsLCDON(pVBInfo) ) ) |
| 8980 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x30 , 0x80 ) ; /* LVDS Driver power down */ |
| 8981 | } |
| 8982 | |
| 8983 | if ( ( pVBInfo->SetFlag & DisableChA ) || ( pVBInfo->VBInfo & ( DisableCRT2Display | SetCRT2ToLCDA | SetSimuScanMode ) ) ) |
| 8984 | { |
| 8985 | if ( pVBInfo->SetFlag & GatingCRT ) |
| 8986 | XGI_EnableGatingCRT( HwDeviceExtension, pVBInfo ) ; |
| 8987 | XGI_DisplayOff( HwDeviceExtension, pVBInfo) ; |
| 8988 | } |
| 8989 | |
| 8990 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 8991 | { |
| 8992 | if ( ( pVBInfo->SetFlag & DisableChA ) || ( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) |
| 8993 | XGINew_SetRegAND( pVBInfo->Part1Port , 0x1e , 0xdf ) ; /* Power down */ |
| 8994 | } |
| 8995 | |
| 8996 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x32 , 0xdf ) ; /* disable TV as primary VGA swap */ |
| 8997 | |
| 8998 | if ( ( pVBInfo->VBInfo & ( SetSimuScanMode | SetCRT2ToDualEdge ) ) ) |
| 8999 | XGINew_SetRegAND(pVBInfo->Part2Port,0x00,0xdf); |
| 9000 | |
| 9001 | if ( ( pVBInfo->SetFlag & DisableChB ) || ( pVBInfo->VBInfo & ( DisableCRT2Display | SetSimuScanMode ) ) |
| 9002 | || ( ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) && ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToLCD | SetCRT2ToTV ) ) ) ) |
| 9003 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x00 , 0x80 ) ; /* BScreenOff=1 */ |
| 9004 | |
| 9005 | if ( ( pVBInfo->SetFlag & DisableChB ) || ( pVBInfo->VBInfo & ( DisableCRT2Display | SetSimuScanMode ) ) |
| 9006 | || ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) || ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToLCD | SetCRT2ToTV ) ) ) |
| 9007 | { |
| 9008 | tempah= XGINew_GetReg1( pVBInfo->Part1Port , 0x00 ) ; /* save Part1 index 0 */ |
| 9009 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x00 , 0x10 ) ; /* BTDAC = 1, avoid VB reset */ |
| 9010 | XGINew_SetRegAND( pVBInfo->Part1Port , 0x1E , 0xDF ) ; /* disable CRT2 */ |
| 9011 | XGINew_SetReg1( pVBInfo->Part1Port , 0x00 , tempah ) ; /* restore Part1 index 0 */ |
| 9012 | } |
| 9013 | } |
| 9014 | else /* {301} */ |
| 9015 | { |
| 9016 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToTV ) ) |
| 9017 | { |
| 9018 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x00 , 0x80 ) ; /* BScreenOff=1 */ |
| 9019 | XGINew_SetRegAND( pVBInfo->Part1Port , 0x1E , 0xDF ) ; /* Disable CRT2 */ |
| 9020 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x32 , 0xDF ) ; /* Disable TV asPrimary VGA swap */ |
| 9021 | } |
| 9022 | |
| 9023 | if ( pVBInfo->VBInfo & ( DisableCRT2Display | SetCRT2ToLCDA | SetSimuScanMode ) ) |
| 9024 | XGI_DisplayOff( HwDeviceExtension, pVBInfo) ; |
| 9025 | } |
| 9026 | |
| 9027 | |
| 9028 | |
| 9029 | |
| 9030 | if ( HwDeviceExtension->jChipType < XG40 ) |
| 9031 | { |
| 9032 | if ( !( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) || ( XGI_DisableChISLCD(pVBInfo) ) || ( XGI_IsLCDON(pVBInfo) ) ) |
| 9033 | { |
| 9034 | if ( pVBInfo->LCDInfo & SetPWDEnable ) |
| 9035 | { |
| 9036 | if ( pVBInfo->LCDInfo & SetPWDEnable ) |
| 9037 | XGI_BacklightByDrv(pVBInfo) ; |
| 9038 | else |
| 9039 | { |
| 9040 | XGI_SetPanelDelay( 4 ,pVBInfo) ; |
| 9041 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 9042 | { |
| 9043 | tempbl = 0xFD ; |
| 9044 | tempah = 0x00 ; |
| 9045 | } |
| 9046 | else |
| 9047 | { |
| 9048 | tempbl = 0xFB ; |
| 9049 | tempah = 0x04 ; |
| 9050 | } |
| 9051 | } |
| 9052 | } |
| 9053 | XGI_SetPanelPower( tempah , tempbl , pVBInfo) ; |
| 9054 | } |
| 9055 | } |
| 9056 | } |
| 9057 | |
| 9058 | |
| 9059 | /* --------------------------------------------------------------------- */ |
| 9060 | /* Function : XGI_GetTVPtrIndex */ |
| 9061 | /* Input : */ |
| 9062 | /* Output : */ |
| 9063 | /* Description : bx 0 : ExtNTSC */ |
| 9064 | /* 1 : StNTSC */ |
| 9065 | /* 2 : ExtPAL */ |
| 9066 | /* 3 : StPAL */ |
| 9067 | /* 4 : ExtHiTV */ |
| 9068 | /* 5 : StHiTV */ |
| 9069 | /* 6 : Ext525i */ |
| 9070 | /* 7 : St525i */ |
| 9071 | /* 8 : Ext525p */ |
| 9072 | /* 9 : St525p */ |
| 9073 | /* A : Ext750p */ |
| 9074 | /* B : St750p */ |
| 9075 | /* --------------------------------------------------------------------- */ |
| 9076 | USHORT XGI_GetTVPtrIndex( PVB_DEVICE_INFO pVBInfo ) |
| 9077 | { |
| 9078 | USHORT tempbx = 0 ; |
| 9079 | |
| 9080 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 9081 | tempbx = 2 ; |
| 9082 | if ( pVBInfo->TVInfo & SetYPbPrMode1080i ) |
| 9083 | tempbx = 4 ; |
| 9084 | if ( pVBInfo->TVInfo & SetYPbPrMode525i ) |
| 9085 | tempbx = 6 ; |
| 9086 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) |
| 9087 | tempbx = 8 ; |
| 9088 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) |
| 9089 | tempbx = 10 ; |
| 9090 | if ( pVBInfo->TVInfo & TVSimuMode ) |
| 9091 | tempbx++ ; |
| 9092 | |
| 9093 | return tempbx ; |
| 9094 | } |
| 9095 | |
| 9096 | |
| 9097 | /* --------------------------------------------------------------------- */ |
| 9098 | /* Function : XGI_OEM310Setting */ |
| 9099 | /* Input : */ |
| 9100 | /* Output : */ |
| 9101 | /* Description : Customized Param. for 301 */ |
| 9102 | /* --------------------------------------------------------------------- */ |
| 9103 | void XGI_OEM310Setting( USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo) |
| 9104 | { |
| 9105 | if ( pVBInfo->SetFlag & Win9xDOSMode ) |
| 9106 | return ; |
| 9107 | |
| 9108 | /* GetPart1IO(); */ |
| 9109 | XGI_SetDelayComp(pVBInfo) ; |
| 9110 | |
| 9111 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 9112 | XGI_SetLCDCap(pVBInfo) ; |
| 9113 | |
| 9114 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 9115 | { |
| 9116 | /* GetPart2IO() */ |
| 9117 | XGI_SetPhaseIncr(pVBInfo) ; |
| 9118 | XGI_SetYFilter( ModeNo , ModeIdIndex,pVBInfo ) ; |
| 9119 | XGI_SetAntiFlicker( ModeNo , ModeIdIndex,pVBInfo ) ; |
| 9120 | |
| 9121 | if ( pVBInfo->VBType&VB_XGI301) |
| 9122 | XGI_SetEdgeEnhance( ModeNo , ModeIdIndex ,pVBInfo) ; |
| 9123 | } |
| 9124 | } |
| 9125 | |
| 9126 | |
| 9127 | /* --------------------------------------------------------------------- */ |
| 9128 | /* Function : XGI_SetDelayComp */ |
| 9129 | /* Input : */ |
| 9130 | /* Output : */ |
| 9131 | /* Description : */ |
| 9132 | /* --------------------------------------------------------------------- */ |
| 9133 | void XGI_SetDelayComp( PVB_DEVICE_INFO pVBInfo ) |
| 9134 | { |
| 9135 | USHORT index ; |
| 9136 | |
| 9137 | UCHAR tempah , |
| 9138 | tempbl , |
| 9139 | tempbh ; |
| 9140 | |
| 9141 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9142 | { |
| 9143 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA | SetCRT2ToTV | SetCRT2ToRAMDAC ) ) |
| 9144 | { |
| 9145 | tempbl = 0; |
| 9146 | tempbh = 0; |
| 9147 | |
| 9148 | index = XGI_GetTVPtrIndex(pVBInfo ) ; /* Get TV Delay */ |
| 9149 | tempbl = pVBInfo->XGI_TVDelayList[ index ] ; |
| 9150 | |
| 9151 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9152 | tempbl = pVBInfo->XGI_TVDelayList2[ index ] ; |
| 9153 | |
| 9154 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) |
| 9155 | tempbl = tempbl >> 4 ; |
| 9156 | /* |
| 9157 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) |
| 9158 | tempbl = CRT2Delay1 ; // Get CRT2 Delay |
| 9159 | |
| 9160 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9161 | tempbl = CRT2Delay2 ; |
| 9162 | */ |
| 9163 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 9164 | { |
| 9165 | index = XGI_GetLCDCapPtr(pVBInfo) ; /* Get LCD Delay */ |
| 9166 | tempbh=pVBInfo->LCDCapList[ index ].LCD_DelayCompensation ; |
| 9167 | |
| 9168 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) |
| 9169 | tempbl = tempbh ; |
| 9170 | } |
| 9171 | |
| 9172 | tempbl &= 0x0F ; |
| 9173 | tempbh &= 0xF0 ; |
| 9174 | tempah = XGINew_GetReg1( pVBInfo->Part1Port , 0x2D ) ; |
| 9175 | |
| 9176 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToLCD | SetCRT2ToTV ) ) /* Channel B */ |
| 9177 | { |
| 9178 | tempah &= 0xF0 ; |
| 9179 | tempah |= tempbl ; |
| 9180 | } |
| 9181 | |
| 9182 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) /* Channel A */ |
| 9183 | { |
| 9184 | tempah &= 0x0F ; |
| 9185 | tempah |= tempbh ; |
| 9186 | } |
| 9187 | XGINew_SetReg1(pVBInfo->Part1Port,0x2D,tempah); |
| 9188 | } |
| 9189 | } |
| 9190 | else if ( pVBInfo->IF_DEF_LVDS == 1 ) |
| 9191 | { |
| 9192 | tempbl = 0; |
| 9193 | tempbh = 0; |
| 9194 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) |
| 9195 | { |
| 9196 | tempah = pVBInfo->LCDCapList[ XGI_GetLCDCapPtr(pVBInfo) ].LCD_DelayCompensation ; /* / Get LCD Delay */ |
| 9197 | tempah &= 0x0f ; |
| 9198 | tempah = tempah << 4 ; |
| 9199 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2D , 0x0f , tempah ) ; |
| 9200 | } |
| 9201 | } |
| 9202 | } |
| 9203 | |
| 9204 | |
| 9205 | /* --------------------------------------------------------------------- */ |
| 9206 | /* Function : XGI_SetLCDCap */ |
| 9207 | /* Input : */ |
| 9208 | /* Output : */ |
| 9209 | /* Description : */ |
| 9210 | /* --------------------------------------------------------------------- */ |
| 9211 | void XGI_SetLCDCap( PVB_DEVICE_INFO pVBInfo ) |
| 9212 | { |
| 9213 | USHORT tempcx ; |
| 9214 | |
| 9215 | tempcx = pVBInfo->LCDCapList[ XGI_GetLCDCapPtr(pVBInfo) ].LCD_Capability ; |
| 9216 | |
| 9217 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9218 | { |
| 9219 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9220 | { /* 301LV/302LV only */ |
| 9221 | /* Set 301LV Capability */ |
| 9222 | XGINew_SetReg1( pVBInfo->Part4Port , 0x24 , ( UCHAR )( tempcx & 0x1F ) ) ; |
| 9223 | } |
| 9224 | /* VB Driving */ |
| 9225 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x0D , ~( ( EnableVBCLKDRVLOW | EnablePLLSPLOW ) >> 8 ) , ( USHORT )( ( tempcx & ( EnableVBCLKDRVLOW | EnablePLLSPLOW ) ) >> 8 ) ) ; |
| 9226 | } |
| 9227 | |
| 9228 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9229 | { |
| 9230 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) |
| 9231 | XGI_SetLCDCap_B( tempcx,pVBInfo ) ; |
| 9232 | else if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 9233 | XGI_SetLCDCap_A( tempcx,pVBInfo ) ; |
| 9234 | |
| 9235 | if ( pVBInfo->VBType & ( VB_XGI302LV | VB_XGI301C ) ) |
| 9236 | { |
| 9237 | if ( tempcx & EnableSpectrum ) |
| 9238 | SetSpectrum( pVBInfo) ; |
| 9239 | } |
| 9240 | } |
| 9241 | else /* LVDS,CH7017 */ |
| 9242 | XGI_SetLCDCap_A( tempcx, pVBInfo ) ; |
| 9243 | } |
| 9244 | |
| 9245 | |
| 9246 | /* --------------------------------------------------------------------- */ |
| 9247 | /* Function : XGI_SetLCDCap_A */ |
| 9248 | /* Input : */ |
| 9249 | /* Output : */ |
| 9250 | /* Description : */ |
| 9251 | /* --------------------------------------------------------------------- */ |
| 9252 | void XGI_SetLCDCap_A(USHORT tempcx,PVB_DEVICE_INFO pVBInfo) |
| 9253 | { |
| 9254 | USHORT temp ; |
| 9255 | |
| 9256 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; |
| 9257 | |
| 9258 | if ( temp & LCDRGB18Bit ) |
| 9259 | { |
| 9260 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x19 , 0x0F , ( USHORT )( 0x20 | ( tempcx & 0x00C0 ) ) ) ; /* Enable Dither */ |
| 9261 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x1A , 0x7F , 0x80 ) ; |
| 9262 | } |
| 9263 | else |
| 9264 | { |
| 9265 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x19 , 0x0F , ( USHORT )( 0x30 | ( tempcx & 0x00C0 ) ) ) ; |
| 9266 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x1A , 0x7F , 0x00 ) ; |
| 9267 | } |
| 9268 | |
| 9269 | /* |
| 9270 | if ( tempcx & EnableLCD24bpp ) // 24bits |
| 9271 | { |
| 9272 | XGINew_SetRegANDOR(pVBInfo->Part1Port,0x19, 0x0F,(USHORT)(0x30|(tempcx&0x00C0)) ); |
| 9273 | XGINew_SetRegANDOR(pVBInfo->Part1Port,0x1A,0x7F,0x00); |
| 9274 | } |
| 9275 | else |
| 9276 | { |
| 9277 | XGINew_SetRegANDOR(pVBInfo->Part1Port,0x19, 0x0F,(USHORT)(0x20|(tempcx&0x00C0)) );//Enable Dither |
| 9278 | XGINew_SetRegANDOR(pVBInfo->Part1Port,0x1A,0x7F,0x80); |
| 9279 | } |
| 9280 | */ |
| 9281 | } |
| 9282 | |
| 9283 | |
| 9284 | /* --------------------------------------------------------------------- */ |
| 9285 | /* Function : XGI_SetLCDCap_B */ |
| 9286 | /* Input : cx -> LCD Capability */ |
| 9287 | /* Output : */ |
| 9288 | /* Description : */ |
| 9289 | /* --------------------------------------------------------------------- */ |
| 9290 | void XGI_SetLCDCap_B(USHORT tempcx,PVB_DEVICE_INFO pVBInfo) |
| 9291 | { |
| 9292 | if ( tempcx & EnableLCD24bpp ) /* 24bits */ |
| 9293 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x1A , 0xE0 , ( USHORT )( ( ( tempcx & 0x00ff ) >> 6 ) | 0x0c ) ) ; |
| 9294 | else |
| 9295 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x1A , 0xE0 , ( USHORT )( ( ( tempcx & 0x00ff ) >> 6 ) | 0x18 ) ) ; /* Enable Dither */ |
| 9296 | } |
| 9297 | |
| 9298 | |
| 9299 | /* --------------------------------------------------------------------- */ |
| 9300 | /* Function : SetSpectrum */ |
| 9301 | /* Input : */ |
| 9302 | /* Output : */ |
| 9303 | /* Description : */ |
| 9304 | /* --------------------------------------------------------------------- */ |
| 9305 | void SetSpectrum( PVB_DEVICE_INFO pVBInfo ) |
| 9306 | { |
| 9307 | USHORT index ; |
| 9308 | |
| 9309 | index = XGI_GetLCDCapPtr(pVBInfo) ; |
| 9310 | |
| 9311 | XGINew_SetRegAND( pVBInfo->Part4Port , 0x30 , 0x8F ) ; /* disable down spectrum D[4] */ |
| 9312 | XGI_LongWait(pVBInfo) ; |
| 9313 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x30 , 0x20 ) ; /* reset spectrum */ |
| 9314 | XGI_LongWait(pVBInfo) ; |
| 9315 | |
| 9316 | XGINew_SetReg1( pVBInfo->Part4Port , 0x31 , pVBInfo->LCDCapList[ index ].Spectrum_31 ) ; |
| 9317 | XGINew_SetReg1( pVBInfo->Part4Port , 0x32 , pVBInfo->LCDCapList[ index ].Spectrum_32 ) ; |
| 9318 | XGINew_SetReg1( pVBInfo->Part4Port , 0x33 , pVBInfo->LCDCapList[ index ].Spectrum_33 ) ; |
| 9319 | XGINew_SetReg1( pVBInfo->Part4Port , 0x34 , pVBInfo->LCDCapList[ index ].Spectrum_34 ) ; |
| 9320 | XGI_LongWait(pVBInfo) ; |
| 9321 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x30 , 0x40 ) ; /* enable spectrum */ |
| 9322 | } |
| 9323 | |
| 9324 | |
| 9325 | /* --------------------------------------------------------------------- */ |
| 9326 | /* Function : XGI_SetAntiFlicker */ |
| 9327 | /* Input : */ |
| 9328 | /* Output : */ |
| 9329 | /* Description : Set TV Customized Param. */ |
| 9330 | /* --------------------------------------------------------------------- */ |
| 9331 | void XGI_SetAntiFlicker( USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 9332 | { |
| 9333 | USHORT tempbx , |
| 9334 | index ; |
| 9335 | |
| 9336 | UCHAR tempah ; |
| 9337 | |
| 9338 | if (pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) |
| 9339 | return ; |
| 9340 | |
| 9341 | tempbx = XGI_GetTVPtrIndex(pVBInfo ) ; |
| 9342 | tempbx &= 0xFE ; |
| 9343 | |
| 9344 | if ( ModeNo <= 0x13 ) |
| 9345 | { |
| 9346 | index = pVBInfo->SModeIDTable[ ModeIdIndex ].VB_StTVFlickerIndex ; |
| 9347 | } |
| 9348 | else |
| 9349 | { |
| 9350 | index = pVBInfo->EModeIDTable[ ModeIdIndex ].VB_ExtTVFlickerIndex ; |
| 9351 | } |
| 9352 | |
| 9353 | tempbx += index ; |
| 9354 | tempah = TVAntiFlickList[ tempbx ] ; |
| 9355 | tempah = tempah << 4 ; |
| 9356 | |
| 9357 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x0A , 0x8F , tempah ) ; |
| 9358 | } |
| 9359 | |
| 9360 | |
| 9361 | /* --------------------------------------------------------------------- */ |
| 9362 | /* Function : XGI_SetEdgeEnhance */ |
| 9363 | /* Input : */ |
| 9364 | /* Output : */ |
| 9365 | /* Description : */ |
| 9366 | /* --------------------------------------------------------------------- */ |
| 9367 | void XGI_SetEdgeEnhance( USHORT ModeNo , USHORT ModeIdIndex , PVB_DEVICE_INFO pVBInfo) |
| 9368 | { |
| 9369 | USHORT tempbx , |
| 9370 | index ; |
| 9371 | |
| 9372 | UCHAR tempah ; |
| 9373 | |
| 9374 | |
| 9375 | tempbx = XGI_GetTVPtrIndex(pVBInfo ) ; |
| 9376 | tempbx &= 0xFE ; |
| 9377 | |
| 9378 | if ( ModeNo <= 0x13 ) |
| 9379 | { |
| 9380 | index = pVBInfo->SModeIDTable[ ModeIdIndex ].VB_StTVEdgeIndex ; |
| 9381 | } |
| 9382 | else |
| 9383 | { |
| 9384 | index = pVBInfo->EModeIDTable[ ModeIdIndex ].VB_ExtTVEdgeIndex ; |
| 9385 | } |
| 9386 | |
| 9387 | tempbx += index ; |
| 9388 | tempah = TVEdgeList[ tempbx ] ; |
| 9389 | tempah = tempah << 5 ; |
| 9390 | |
| 9391 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x3A , 0x1F , tempah ) ; |
| 9392 | } |
| 9393 | |
| 9394 | |
| 9395 | /* --------------------------------------------------------------------- */ |
| 9396 | /* Function : XGI_SetPhaseIncr */ |
| 9397 | /* Input : */ |
| 9398 | /* Output : */ |
| 9399 | /* Description : */ |
| 9400 | /* --------------------------------------------------------------------- */ |
| 9401 | void XGI_SetPhaseIncr( PVB_DEVICE_INFO pVBInfo ) |
| 9402 | { |
| 9403 | USHORT tempbx ; |
| 9404 | |
| 9405 | UCHAR tempcl , |
| 9406 | tempch ; |
| 9407 | |
| 9408 | ULONG tempData ; |
| 9409 | |
| 9410 | XGI_GetTVPtrIndex2( &tempbx , &tempcl , &tempch, pVBInfo ) ; /* bx, cl, ch */ |
| 9411 | tempData = TVPhaseList[ tempbx ] ; |
| 9412 | |
| 9413 | XGINew_SetReg1( pVBInfo->Part2Port , 0x31 , ( USHORT )( tempData & 0x000000FF ) ) ; |
| 9414 | XGINew_SetReg1( pVBInfo->Part2Port , 0x32 , ( USHORT )( ( tempData & 0x0000FF00 ) >> 8 ) ) ; |
| 9415 | XGINew_SetReg1( pVBInfo->Part2Port , 0x33 , ( USHORT )( ( tempData & 0x00FF0000 ) >> 16 ) ) ; |
| 9416 | XGINew_SetReg1( pVBInfo->Part2Port , 0x34 , ( USHORT )( ( tempData & 0xFF000000 ) >> 24 ) ) ; |
| 9417 | } |
| 9418 | |
| 9419 | |
| 9420 | /* --------------------------------------------------------------------- */ |
| 9421 | /* Function : XGI_SetYFilter */ |
| 9422 | /* Input : */ |
| 9423 | /* Output : */ |
| 9424 | /* Description : */ |
| 9425 | /* --------------------------------------------------------------------- */ |
| 9426 | void XGI_SetYFilter( USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo) |
| 9427 | { |
| 9428 | USHORT tempbx , |
| 9429 | index ; |
| 9430 | |
| 9431 | UCHAR tempcl , |
| 9432 | tempch , |
| 9433 | tempal , |
| 9434 | *filterPtr ; |
| 9435 | |
| 9436 | XGI_GetTVPtrIndex2( &tempbx , &tempcl , &tempch, pVBInfo ) ; /* bx, cl, ch */ |
| 9437 | |
| 9438 | switch( tempbx ) |
| 9439 | { |
| 9440 | case 0x00: |
| 9441 | case 0x04: |
| 9442 | filterPtr = NTSCYFilter1 ; |
| 9443 | break ; |
| 9444 | |
| 9445 | case 0x01: |
| 9446 | filterPtr = PALYFilter1 ; |
| 9447 | break ; |
| 9448 | |
| 9449 | case 0x02: |
| 9450 | case 0x05: |
| 9451 | case 0x0D: |
| 9452 | filterPtr = PALMYFilter1 ; |
| 9453 | break ; |
| 9454 | |
| 9455 | case 0x03: |
| 9456 | filterPtr = PALNYFilter1 ; |
| 9457 | break ; |
| 9458 | |
| 9459 | case 0x08: |
| 9460 | case 0x0C: |
| 9461 | filterPtr = NTSCYFilter2 ; |
| 9462 | break ; |
| 9463 | |
| 9464 | case 0x0A: |
| 9465 | filterPtr = PALMYFilter2 ; |
| 9466 | break ; |
| 9467 | |
| 9468 | case 0x0B: |
| 9469 | filterPtr = PALNYFilter2 ; |
| 9470 | break ; |
| 9471 | |
| 9472 | case 0x09: |
| 9473 | filterPtr = PALYFilter2 ; |
| 9474 | break ; |
| 9475 | |
| 9476 | default: |
| 9477 | return ; |
| 9478 | } |
| 9479 | |
| 9480 | if ( ModeNo <= 0x13 ) |
| 9481 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].VB_StTVYFilterIndex ; |
| 9482 | else |
| 9483 | tempal = pVBInfo->EModeIDTable[ ModeIdIndex ].VB_ExtTVYFilterIndex ; |
| 9484 | |
| 9485 | if ( tempcl == 0 ) |
| 9486 | index = tempal * 4; |
| 9487 | else |
| 9488 | index = tempal * 7; |
| 9489 | |
| 9490 | if ( ( tempcl == 0 ) && ( tempch == 1 ) ) |
| 9491 | { |
| 9492 | XGINew_SetReg1( pVBInfo->Part2Port , 0x35 , 0 ) ; |
| 9493 | XGINew_SetReg1( pVBInfo->Part2Port , 0x36 , 0 ) ; |
| 9494 | XGINew_SetReg1( pVBInfo->Part2Port , 0x37 , 0 ) ; |
| 9495 | XGINew_SetReg1( pVBInfo->Part2Port , 0x38 , filterPtr[ index++ ] ) ; |
| 9496 | } |
| 9497 | else |
| 9498 | { |
| 9499 | XGINew_SetReg1( pVBInfo->Part2Port , 0x35 , filterPtr[ index++ ] ) ; |
| 9500 | XGINew_SetReg1( pVBInfo->Part2Port , 0x36 , filterPtr[ index++ ] ) ; |
| 9501 | XGINew_SetReg1( pVBInfo->Part2Port , 0x37 , filterPtr[ index++ ] ) ; |
| 9502 | XGINew_SetReg1( pVBInfo->Part2Port , 0x38 , filterPtr[ index++ ] ) ; |
| 9503 | } |
| 9504 | |
| 9505 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9506 | { |
| 9507 | XGINew_SetReg1( pVBInfo->Part2Port , 0x48 , filterPtr[ index++ ] ) ; |
| 9508 | XGINew_SetReg1( pVBInfo->Part2Port , 0x49 , filterPtr[ index++ ] ) ; |
| 9509 | XGINew_SetReg1( pVBInfo->Part2Port , 0x4A , filterPtr[ index++ ] ) ; |
| 9510 | } |
| 9511 | } |
| 9512 | |
| 9513 | |
| 9514 | /* --------------------------------------------------------------------- */ |
| 9515 | /* Function : XGI_GetTVPtrIndex2 */ |
| 9516 | /* Input : */ |
| 9517 | /* Output : bx 0 : NTSC */ |
| 9518 | /* 1 : PAL */ |
| 9519 | /* 2 : PALM */ |
| 9520 | /* 3 : PALN */ |
| 9521 | /* 4 : NTSC1024x768 */ |
| 9522 | /* 5 : PAL-M 1024x768 */ |
| 9523 | /* 6-7: reserved */ |
| 9524 | /* cl 0 : YFilter1 */ |
| 9525 | /* 1 : YFilter2 */ |
| 9526 | /* ch 0 : 301A */ |
| 9527 | /* 1 : 301B/302B/301LV/302LV */ |
| 9528 | /* Description : */ |
| 9529 | /* --------------------------------------------------------------------- */ |
| 9530 | void XGI_GetTVPtrIndex2(USHORT* tempbx,UCHAR* tempcl,UCHAR* tempch, PVB_DEVICE_INFO pVBInfo) |
| 9531 | { |
| 9532 | *tempbx = 0 ; |
| 9533 | *tempcl = 0 ; |
| 9534 | *tempch = 0 ; |
| 9535 | |
| 9536 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 9537 | *tempbx = 1 ; |
| 9538 | |
| 9539 | if ( pVBInfo->TVInfo & SetPALMTV ) |
| 9540 | *tempbx = 2 ; |
| 9541 | |
| 9542 | if ( pVBInfo->TVInfo & SetPALNTV ) |
| 9543 | *tempbx = 3 ; |
| 9544 | |
| 9545 | if ( pVBInfo->TVInfo & NTSC1024x768 ) |
| 9546 | { |
| 9547 | *tempbx = 4 ; |
| 9548 | if ( pVBInfo->TVInfo & SetPALMTV ) |
| 9549 | *tempbx = 5 ; |
| 9550 | } |
| 9551 | |
| 9552 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9553 | { |
| 9554 | if ( ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) || ( pVBInfo->TVInfo & TVSimuMode ) ) |
| 9555 | { |
| 9556 | *tempbx += 8 ; |
| 9557 | *tempcl += 1 ; |
| 9558 | } |
| 9559 | } |
| 9560 | |
| 9561 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9562 | (*tempch)++ ; |
| 9563 | } |
| 9564 | |
| 9565 | |
| 9566 | /* --------------------------------------------------------------------- */ |
| 9567 | /* Function : XGI_SetCRT2ModeRegs */ |
| 9568 | /* Input : */ |
| 9569 | /* Output : */ |
| 9570 | /* Description : Origin code for crt2group */ |
| 9571 | /* --------------------------------------------------------------------- */ |
| 9572 | void XGI_SetCRT2ModeRegs(USHORT ModeNo,PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo) |
| 9573 | { |
| 9574 | USHORT tempbl ; |
| 9575 | SHORT tempcl ; |
| 9576 | |
| 9577 | UCHAR tempah ; |
| 9578 | |
| 9579 | /* XGINew_SetReg1( pVBInfo->Part1Port , 0x03 , 0x00 ) ; // fix write part1 index 0 BTDRAM bit Bug */ |
| 9580 | tempah=0; |
| 9581 | if ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) |
| 9582 | { |
| 9583 | tempah=XGINew_GetReg1( pVBInfo->Part1Port , 0x00 ) ; |
| 9584 | tempah &= ~0x10 ; /* BTRAMDAC */ |
| 9585 | tempah |= 0x40 ; /* BTRAM */ |
| 9586 | |
| 9587 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD ) ) |
| 9588 | { |
| 9589 | tempah=0x40; /* BTDRAM */ |
| 9590 | if ( ModeNo > 0x13 ) |
| 9591 | { |
| 9592 | tempcl = pVBInfo->ModeType ; |
| 9593 | tempcl -= ModeVGA ; |
| 9594 | if ( tempcl >= 0 ) |
| 9595 | { |
| 9596 | tempah = ( 0x008 >> tempcl ) ; /* BT Color */ |
| 9597 | if ( tempah == 0 ) |
| 9598 | tempah = 1 ; |
| 9599 | tempah |= 0x040 ; |
| 9600 | } |
| 9601 | } |
| 9602 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 9603 | tempah ^= 0x50 ; /* BTDAC */ |
| 9604 | } |
| 9605 | } |
| 9606 | |
| 9607 | /* 0210 shampoo |
| 9608 | if ( pVBInfo->VBInfo & DisableCRT2Display ) |
| 9609 | { |
| 9610 | tempah = 0 ; |
| 9611 | } |
| 9612 | |
| 9613 | XGINew_SetReg1( pVBInfo->Part1Port , 0x00 , tempah ) ; |
| 9614 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD ) ) |
| 9615 | { |
| 9616 | tempcl = pVBInfo->ModeType ; |
| 9617 | if ( ModeNo > 0x13 ) |
| 9618 | { |
| 9619 | tempcl -= ModeVGA ; |
| 9620 | if ( ( tempcl > 0 ) || ( tempcl == 0 ) ) |
| 9621 | { |
| 9622 | tempah=(0x008>>tempcl) ; |
| 9623 | if ( tempah == 0 ) |
| 9624 | tempah = 1 ; |
| 9625 | tempah |= 0x040; |
| 9626 | } |
| 9627 | } |
| 9628 | else |
| 9629 | { |
| 9630 | tempah = 0x040 ; |
| 9631 | } |
| 9632 | |
| 9633 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 9634 | { |
| 9635 | tempah = ( tempah ^ 0x050 ) ; |
| 9636 | } |
| 9637 | } |
| 9638 | */ |
| 9639 | |
| 9640 | XGINew_SetReg1( pVBInfo->Part1Port , 0x00 , tempah ) ; |
| 9641 | tempah = 0x08 ; |
| 9642 | tempbl = 0xf0 ; |
| 9643 | |
| 9644 | if ( pVBInfo->VBInfo & DisableCRT2Display ) |
| 9645 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ; |
| 9646 | else |
| 9647 | { |
| 9648 | tempah = 0x00 ; |
| 9649 | tempbl = 0xff ; |
| 9650 | |
| 9651 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 9652 | { |
| 9653 | if ( ( pVBInfo->VBInfo & SetCRT2ToLCDA ) && ( !( pVBInfo->VBInfo & SetSimuScanMode ) ) ) |
| 9654 | { |
| 9655 | tempbl &= 0xf7 ; |
| 9656 | tempah |= 0x01 ; |
| 9657 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ; |
| 9658 | } |
| 9659 | else |
| 9660 | { |
| 9661 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 9662 | { |
| 9663 | tempbl &= 0xf7 ; |
| 9664 | tempah |= 0x01 ; |
| 9665 | } |
| 9666 | |
| 9667 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD ) ) |
| 9668 | { |
| 9669 | tempbl &= 0xf8 ; |
| 9670 | tempah = 0x01 ; |
| 9671 | |
| 9672 | if ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) |
| 9673 | tempah |= 0x02 ; |
| 9674 | |
| 9675 | if ( !( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) ) |
| 9676 | { |
| 9677 | tempah = tempah ^ 0x05 ; |
| 9678 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCD ) ) |
| 9679 | tempah = tempah ^ 0x01 ; |
| 9680 | } |
| 9681 | |
| 9682 | if ( !( pVBInfo->VBInfo & SetCRT2ToDualEdge ) ) |
| 9683 | tempah |= 0x08 ; |
| 9684 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ; |
| 9685 | } |
| 9686 | else |
| 9687 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ; |
| 9688 | } |
| 9689 | } |
| 9690 | else |
| 9691 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ; |
| 9692 | } |
| 9693 | |
| 9694 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 9695 | { |
| 9696 | tempah &= ( ~0x08 ) ; |
| 9697 | if ( ( pVBInfo->ModeType == ModeVGA ) && ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) ) |
| 9698 | { |
| 9699 | tempah |= 0x010 ; |
| 9700 | } |
| 9701 | tempah |= 0x080 ; |
| 9702 | |
| 9703 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 9704 | { |
| 9705 | /* if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) */ |
| 9706 | /* { */ |
| 9707 | tempah |= 0x020 ; |
| 9708 | if ( ModeNo > 0x13 ) |
| 9709 | { |
| 9710 | if ( pVBInfo->VBInfo & DriverMode ) |
| 9711 | tempah = tempah ^ 0x20 ; |
| 9712 | } |
| 9713 | /* } */ |
| 9714 | } |
| 9715 | |
| 9716 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x0D , ~0x0BF , tempah ) ; |
| 9717 | tempah = 0 ; |
| 9718 | |
| 9719 | if ( pVBInfo->LCDInfo & SetLCDDualLink ) |
| 9720 | tempah |= 0x40 ; |
| 9721 | |
| 9722 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 9723 | { |
| 9724 | /* if ( ( !( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) ) && ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) ) */ |
| 9725 | /* { */ |
| 9726 | if ( pVBInfo->TVInfo & RPLLDIV2XO ) |
| 9727 | tempah |= 0x40 ; |
| 9728 | /* } */ |
| 9729 | } |
| 9730 | |
| 9731 | if ( ( pVBInfo->LCDResInfo == Panel1280x1024 ) || ( pVBInfo->LCDResInfo == Panel1280x1024x75 ) ) |
| 9732 | tempah |= 0x80 ; |
| 9733 | |
| 9734 | if ( pVBInfo->LCDResInfo == Panel1280x960 ) |
| 9735 | tempah |= 0x80 ; |
| 9736 | |
| 9737 | XGINew_SetReg1( pVBInfo->Part4Port , 0x0C , tempah ) ; |
| 9738 | } |
| 9739 | |
| 9740 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9741 | { |
| 9742 | tempah = 0 ; |
| 9743 | tempbl = 0xfb ; |
| 9744 | |
| 9745 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) |
| 9746 | { |
| 9747 | tempbl=0xff; |
| 9748 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 9749 | tempah |= 0x04 ; /* shampoo 0129 */ |
| 9750 | } |
| 9751 | |
| 9752 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x13 , tempbl , tempah ) ; |
| 9753 | tempah = 0x00 ; |
| 9754 | tempbl = 0xcf ; |
| 9755 | if ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) |
| 9756 | { |
| 9757 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) |
| 9758 | tempah |= 0x30 ; |
| 9759 | } |
| 9760 | |
| 9761 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2c , tempbl , tempah ) ; |
| 9762 | tempah = 0 ; |
| 9763 | tempbl = 0x3f ; |
| 9764 | |
| 9765 | if ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) |
| 9766 | { |
| 9767 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) |
| 9768 | tempah |= 0xc0 ; |
| 9769 | } |
| 9770 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x21 , tempbl , tempah ) ; |
| 9771 | } |
| 9772 | |
| 9773 | tempah = 0 ; |
| 9774 | tempbl = 0x7f ; |
| 9775 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) |
| 9776 | { |
| 9777 | tempbl = 0xff ; |
| 9778 | if ( !( pVBInfo->VBInfo & SetCRT2ToDualEdge ) ) |
| 9779 | tempah |= 0x80 ; |
| 9780 | } |
| 9781 | |
| 9782 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x23 , tempbl , tempah ) ; |
| 9783 | |
| 9784 | if ( pVBInfo->VBType & ( VB_XGI302LV | VB_XGI301C ) ) |
| 9785 | { |
| 9786 | if ( pVBInfo->LCDInfo & SetLCDDualLink ) |
| 9787 | { |
| 9788 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x27 , 0x20 ) ; |
| 9789 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x34 , 0x10 ) ; |
| 9790 | } |
| 9791 | } |
| 9792 | } |
| 9793 | |
| 9794 | |
| 9795 | /* --------------------------------------------------------------------- */ |
| 9796 | /* Function : XGI_CloseCRTC */ |
| 9797 | /* Input : */ |
| 9798 | /* Output : */ |
| 9799 | /* Description : */ |
| 9800 | /* --------------------------------------------------------------------- */ |
| 9801 | void XGI_CloseCRTC( PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo ) |
| 9802 | { |
| 9803 | USHORT tempbx ; |
| 9804 | |
| 9805 | tempbx = 0 ; |
| 9806 | |
| 9807 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 9808 | tempbx = 0x08A0 ; |
| 9809 | |
| 9810 | |
| 9811 | } |
| 9812 | |
| 9813 | |
| 9814 | /* --------------------------------------------------------------------- */ |
| 9815 | /* Function : XGI_OpenCRTC */ |
| 9816 | /* Input : */ |
| 9817 | /* Output : */ |
| 9818 | /* Description : */ |
| 9819 | /* --------------------------------------------------------------------- */ |
| 9820 | void XGI_OpenCRTC( PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo ) |
| 9821 | { |
| 9822 | USHORT tempbx ; |
| 9823 | |
| 9824 | tempbx = 0 ; |
| 9825 | |
| 9826 | |
| 9827 | } |
| 9828 | |
| 9829 | |
| 9830 | /* --------------------------------------------------------------------- */ |
| 9831 | /* Function : XGI_GetRAMDAC2DATA */ |
| 9832 | /* Input : */ |
| 9833 | /* Output : */ |
| 9834 | /* Description : */ |
| 9835 | /* --------------------------------------------------------------------- */ |
| 9836 | void XGI_GetRAMDAC2DATA(USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 9837 | { |
| 9838 | USHORT tempax , |
| 9839 | tempbx , |
| 9840 | temp1 , |
| 9841 | temp2 , |
| 9842 | modeflag = 0 , |
| 9843 | tempcx , |
| 9844 | StandTableIndex , |
| 9845 | CRT1Index ; |
| 9846 | |
| 9847 | pVBInfo->RVBHCMAX = 1 ; |
| 9848 | pVBInfo->RVBHCFACT = 1 ; |
| 9849 | |
| 9850 | if ( ModeNo <= 0x13 ) |
| 9851 | { |
| 9852 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 9853 | StandTableIndex = XGI_GetModePtr( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 9854 | tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 0 ] ; |
| 9855 | tempbx = pVBInfo->StandTable[StandTableIndex ].CRTC[ 6 ] ; |
| 9856 | temp1 = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 7 ] ; |
| 9857 | } |
| 9858 | else |
| 9859 | { |
| 9860 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 9861 | CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; |
| 9862 | CRT1Index &= IndexMask ; |
| 9863 | temp1 = ( USHORT )pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 0 ] ; |
| 9864 | temp2 = ( USHORT )pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 5 ] ; |
| 9865 | tempax = ( temp1 & 0xFF ) | ( ( temp2 & 0x03 ) << 8 ) ; |
| 9866 | tempbx = ( USHORT )pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 8 ] ; |
| 9867 | tempcx = ( USHORT )pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 14 ] << 8 ; |
| 9868 | tempcx &= 0x0100 ; |
| 9869 | tempcx = tempcx << 2 ; |
| 9870 | tempbx |= tempcx; |
| 9871 | temp1 = ( USHORT )pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 9 ] ; |
| 9872 | } |
| 9873 | |
| 9874 | if ( temp1 & 0x01 ) |
| 9875 | tempbx |= 0x0100 ; |
| 9876 | |
| 9877 | if ( temp1 & 0x20 ) |
| 9878 | tempbx |= 0x0200 ; |
| 9879 | tempax += 5 ; |
| 9880 | |
| 9881 | if ( modeflag & Charx8Dot ) |
| 9882 | tempax *= 8 ; |
| 9883 | else |
| 9884 | tempax *= 9 ; |
| 9885 | |
| 9886 | pVBInfo->VGAHT = tempax ; |
| 9887 | pVBInfo->HT = tempax ; |
| 9888 | tempbx++ ; |
| 9889 | pVBInfo->VGAVT = tempbx ; |
| 9890 | pVBInfo->VT = tempbx ; |
| 9891 | } |
| 9892 | |
| 9893 | |
| 9894 | |
| 9895 | /* --------------------------------------------------------------------- */ |
| 9896 | /* Function : XGI_GetColorDepth */ |
| 9897 | /* Input : */ |
| 9898 | /* Output : */ |
| 9899 | /* Description : */ |
| 9900 | /* --------------------------------------------------------------------- */ |
| 9901 | USHORT XGI_GetColorDepth(USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo) |
| 9902 | { |
| 9903 | USHORT ColorDepth[ 6 ] = { 1 , 2 , 4 , 4 , 6 , 8 } ; |
| 9904 | SHORT index ; |
| 9905 | USHORT modeflag ; |
| 9906 | |
| 9907 | if ( ModeNo <= 0x13 ) |
| 9908 | { |
| 9909 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 9910 | } |
| 9911 | else |
| 9912 | { |
| 9913 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 9914 | } |
| 9915 | |
| 9916 | index=(modeflag&ModeInfoFlag)-ModeEGA; |
| 9917 | |
| 9918 | if ( index < 0 ) |
| 9919 | index = 0 ; |
| 9920 | |
| 9921 | return( ColorDepth[ index ] ) ; |
| 9922 | } |
| 9923 | |
| 9924 | |
| 9925 | |
| 9926 | /* --------------------------------------------------------------------- */ |
| 9927 | /* Function : XGI_UnLockCRT2 */ |
| 9928 | /* Input : */ |
| 9929 | /* Output : */ |
| 9930 | /* Description : */ |
| 9931 | /* --------------------------------------------------------------------- */ |
| 9932 | void XGI_UnLockCRT2( PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo ) |
| 9933 | { |
| 9934 | |
| 9935 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2f , 0xFF , 0x01 ) ; |
| 9936 | |
| 9937 | } |
| 9938 | |
| 9939 | |
| 9940 | /* --------------------------------------------------------------------- */ |
| 9941 | /* Function : XGI_LockCRT2 */ |
| 9942 | /* Input : */ |
| 9943 | /* Output : */ |
| 9944 | /* Description : */ |
| 9945 | /* --------------------------------------------------------------------- */ |
| 9946 | void XGI_LockCRT2( PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo ) |
| 9947 | { |
| 9948 | |
| 9949 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2F , 0xFE , 0x00 ) ; |
| 9950 | |
| 9951 | |
| 9952 | } |
| 9953 | |
| 9954 | |
| 9955 | /* --------------------------------------------------------------------- */ |
| 9956 | /* Function : XGINew_EnableCRT2 */ |
| 9957 | /* Input : */ |
| 9958 | /* Output : */ |
| 9959 | /* Description : */ |
| 9960 | /* --------------------------------------------------------------------- */ |
| 9961 | void XGINew_EnableCRT2( PVB_DEVICE_INFO pVBInfo) |
| 9962 | { |
| 9963 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x1E , 0xFF , 0x20 ) ; |
| 9964 | } |
| 9965 | |
| 9966 | |
| 9967 | |
| 9968 | /* --------------------------------------------------------------------- */ |
| 9969 | /* Function : */ |
| 9970 | /* Input : */ |
| 9971 | /* Output : */ |
| 9972 | /* Description : */ |
| 9973 | /* --------------------------------------------------------------------- */ |
| 9974 | void XGINew_LCD_Wait_Time(UCHAR DelayTime, PVB_DEVICE_INFO pVBInfo) |
| 9975 | { |
| 9976 | USHORT i , |
| 9977 | j ; |
| 9978 | |
| 9979 | ULONG temp , |
| 9980 | flag ; |
| 9981 | |
| 9982 | flag = 0 ; |
| 9983 | //printk("XGINew_LCD_Wait_Time"); |
| 9984 | //return; |
| 9985 | for( i = 0 ; i < DelayTime ; i++ ) |
| 9986 | { |
| 9987 | for( j = 0 ; j < 66 ; j++ ) |
| 9988 | { |
| 9989 | |
| 9990 | temp = XGINew_GetReg3( 0x61 ) ; |
| 9991 | |
| 9992 | //temp &= 0x10000000; |
| 9993 | temp &= 0x10; |
| 9994 | if ( temp == flag ) |
| 9995 | continue ; |
| 9996 | |
| 9997 | flag = temp ; |
| 9998 | } |
| 9999 | } |
| 10000 | } |
| 10001 | |
| 10002 | |
| 10003 | |
| 10004 | |
| 10005 | /* --------------------------------------------------------------------- */ |
| 10006 | /* Function : XGI_BridgeIsOn */ |
| 10007 | /* Input : */ |
| 10008 | /* Output : */ |
| 10009 | /* Description : */ |
| 10010 | /* --------------------------------------------------------------------- */ |
| 10011 | BOOLEAN XGI_BridgeIsOn( PVB_DEVICE_INFO pVBInfo ) |
| 10012 | { |
| 10013 | USHORT flag ; |
| 10014 | |
| 10015 | if ( pVBInfo->IF_DEF_LVDS == 1 ) |
| 10016 | { |
| 10017 | return( 1 ) ; |
| 10018 | } |
| 10019 | else |
| 10020 | { |
| 10021 | flag = XGINew_GetReg1( pVBInfo->Part4Port , 0x00 ) ; |
| 10022 | if ( ( flag == 1 ) || ( flag == 2 ) ) |
| 10023 | return( 1 ) ; /* 301b */ |
| 10024 | else |
| 10025 | return( 0 ) ; |
| 10026 | } |
| 10027 | } |
| 10028 | |
| 10029 | |
| 10030 | |
| 10031 | /* --------------------------------------------------------------------- */ |
| 10032 | /* Function : XGI_LongWait */ |
| 10033 | /* Input : */ |
| 10034 | /* Output : */ |
| 10035 | /* Description : */ |
| 10036 | /* --------------------------------------------------------------------- */ |
| 10037 | void XGI_LongWait(PVB_DEVICE_INFO pVBInfo) |
| 10038 | { |
| 10039 | USHORT i ; |
| 10040 | |
| 10041 | i = XGINew_GetReg1( pVBInfo->P3c4 , 0x1F ) ; |
| 10042 | |
| 10043 | if ( !( i & 0xC0 ) ) |
| 10044 | { |
| 10045 | for( i = 0 ; i < 0xFFFF ; i++ ) |
| 10046 | { |
| 10047 | if ( !( XGINew_GetReg2( pVBInfo->P3da ) & 0x08 ) ) |
| 10048 | break ; |
| 10049 | } |
| 10050 | |
| 10051 | for( i = 0 ; i < 0xFFFF ; i++ ) |
| 10052 | { |
| 10053 | if ( ( XGINew_GetReg2( pVBInfo->P3da ) & 0x08 ) ) |
| 10054 | break ; |
| 10055 | } |
| 10056 | } |
| 10057 | } |
| 10058 | |
| 10059 | |
| 10060 | /* --------------------------------------------------------------------- */ |
| 10061 | /* Function : XGI_VBLongWait */ |
| 10062 | /* Input : */ |
| 10063 | /* Output : */ |
| 10064 | /* Description : */ |
| 10065 | /* --------------------------------------------------------------------- */ |
| 10066 | void XGI_VBLongWait( PVB_DEVICE_INFO pVBInfo ) |
| 10067 | { |
| 10068 | USHORT tempal , |
| 10069 | temp , |
| 10070 | i , |
| 10071 | j ; |
| 10072 | return ; |
| 10073 | if ( !( pVBInfo->VBInfo & SetCRT2ToTV ) ) |
| 10074 | { |
| 10075 | temp = 0 ; |
| 10076 | for( i = 0 ; i < 3 ; i++ ) |
| 10077 | { |
| 10078 | for( j = 0 ; j < 100 ; j++ ) |
| 10079 | { |
| 10080 | tempal = XGINew_GetReg2( pVBInfo->P3da ) ; |
| 10081 | if ( temp & 0x01 ) |
| 10082 | { /* VBWaitMode2 */ |
| 10083 | if ( ( tempal & 0x08 ) ) |
| 10084 | { |
| 10085 | continue ; |
| 10086 | } |
| 10087 | |
| 10088 | if ( !( tempal & 0x08 ) ) |
| 10089 | { |
| 10090 | break ; |
| 10091 | } |
| 10092 | } |
| 10093 | else |
| 10094 | { /* VBWaitMode1 */ |
| 10095 | if ( !( tempal & 0x08 ) ) |
| 10096 | { |
| 10097 | continue ; |
| 10098 | } |
| 10099 | |
| 10100 | if ( ( tempal & 0x08 ) ) |
| 10101 | { |
| 10102 | break ; |
| 10103 | } |
| 10104 | } |
| 10105 | } |
| 10106 | temp = temp ^ 0x01 ; |
| 10107 | } |
| 10108 | } |
| 10109 | else |
| 10110 | { |
| 10111 | XGI_LongWait(pVBInfo) ; |
| 10112 | } |
| 10113 | return ; |
| 10114 | } |
| 10115 | |
| 10116 | |
| 10117 | |
| 10118 | |
| 10119 | /* --------------------------------------------------------------------- */ |
| 10120 | /* Function : XGI_GetVGAHT2 */ |
| 10121 | /* Input : */ |
| 10122 | /* Output : */ |
| 10123 | /* Description : */ |
| 10124 | /* --------------------------------------------------------------------- */ |
| 10125 | USHORT XGI_GetVGAHT2( PVB_DEVICE_INFO pVBInfo ) |
| 10126 | { |
| 10127 | ULONG tempax , |
| 10128 | tempbx ; |
| 10129 | |
| 10130 | tempbx = ( ( pVBInfo->VGAVT - pVBInfo->VGAVDE ) * pVBInfo->RVBHCMAX ) & 0xFFFF ; |
| 10131 | tempax = ( pVBInfo->VT - pVBInfo->VDE ) * pVBInfo->RVBHCFACT ; |
| 10132 | tempax = ( tempax * pVBInfo->HT ) /tempbx ; |
| 10133 | |
| 10134 | return( ( USHORT )tempax ) ; |
| 10135 | } |
| 10136 | |
| 10137 | |
| 10138 | /* --------------------------------------------------------------------- */ |
| 10139 | /* Function : XGI_GetVCLK2Ptr */ |
| 10140 | /* Input : */ |
| 10141 | /* Output : */ |
| 10142 | /* Description : */ |
| 10143 | /* --------------------------------------------------------------------- */ |
| 10144 | USHORT XGI_GetVCLK2Ptr( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex , PXGI_HW_DEVICE_INFO HwDeviceExtension ,PVB_DEVICE_INFO pVBInfo) |
| 10145 | { |
| 10146 | USHORT tempbx ; |
| 10147 | |
| 10148 | USHORT LCDXlat1VCLK[ 4 ] = { VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 } ; |
| 10149 | USHORT LCDXlat2VCLK[ 4 ] = { VCLK108_2 + 5 , VCLK108_2 + 5 , VCLK108_2 + 5 , VCLK108_2 + 5 } ; |
| 10150 | USHORT LVDSXlat1VCLK[ 4 ] = { VCLK40 , VCLK40 , VCLK40 , VCLK40 } ; |
| 10151 | USHORT LVDSXlat2VCLK[ 4 ] = { VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 } ; |
| 10152 | USHORT LVDSXlat3VCLK[ 4 ] = { VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 } ; |
| 10153 | |
| 10154 | USHORT CRT2Index , VCLKIndex ; |
| 10155 | USHORT modeflag , resinfo ; |
| 10156 | UCHAR *CHTVVCLKPtr = NULL ; |
| 10157 | |
| 10158 | if ( ModeNo <= 0x13 ) |
| 10159 | { |
| 10160 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ |
| 10161 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; |
| 10162 | CRT2Index = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; |
| 10163 | } |
| 10164 | else |
| 10165 | { |
| 10166 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ |
| 10167 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 10168 | CRT2Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC ; |
| 10169 | } |
| 10170 | |
| 10171 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 10172 | { |
| 10173 | CRT2Index = CRT2Index >> 6 ; /* for LCD */ |
| 10174 | if ( ( ( pVBInfo->VBInfo & SetCRT2ToLCD ) | SetCRT2ToLCDA ) ) /*301b*/ |
| 10175 | { |
| 10176 | if ( pVBInfo->LCDResInfo != Panel1024x768 ) |
| 10177 | { |
| 10178 | VCLKIndex = LCDXlat2VCLK[ CRT2Index ] ; |
| 10179 | } |
| 10180 | else |
| 10181 | { |
| 10182 | VCLKIndex = LCDXlat1VCLK[ CRT2Index ] ; |
| 10183 | } |
| 10184 | } |
| 10185 | else /* for TV */ |
| 10186 | { |
| 10187 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 10188 | { |
| 10189 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 10190 | { |
| 10191 | if ( pVBInfo->SetFlag & RPLLDIV2XO ) |
| 10192 | { |
| 10193 | VCLKIndex = HiTVVCLKDIV2 ; |
| 10194 | |
| 10195 | |
| 10196 | VCLKIndex += 25 ; |
| 10197 | |
| 10198 | } |
| 10199 | else |
| 10200 | { |
| 10201 | VCLKIndex = HiTVVCLK ; |
| 10202 | |
| 10203 | |
| 10204 | VCLKIndex += 25 ; |
| 10205 | |
| 10206 | } |
| 10207 | |
| 10208 | if ( pVBInfo->SetFlag & TVSimuMode ) |
| 10209 | { |
| 10210 | if( modeflag & Charx8Dot ) |
| 10211 | { |
| 10212 | VCLKIndex = HiTVSimuVCLK ; |
| 10213 | |
| 10214 | |
| 10215 | VCLKIndex += 25 ; |
| 10216 | |
| 10217 | } |
| 10218 | else |
| 10219 | { |
| 10220 | VCLKIndex = HiTVTextVCLK ; |
| 10221 | |
| 10222 | |
| 10223 | VCLKIndex += 25 ; |
| 10224 | |
| 10225 | } |
| 10226 | } |
| 10227 | |
| 10228 | if ( pVBInfo->VBType & VB_XGI301LV ) /* 301lv */ |
| 10229 | { |
| 10230 | if ( !( pVBInfo->VBExtInfo == VB_YPbPr1080i ) ) |
| 10231 | { |
| 10232 | VCLKIndex = YPbPr750pVCLK ; |
| 10233 | if ( !( pVBInfo->VBExtInfo == VB_YPbPr750p ) ) |
| 10234 | { |
| 10235 | VCLKIndex = YPbPr525pVCLK ; |
| 10236 | if ( !( pVBInfo->VBExtInfo == VB_YPbPr525p ) ) |
| 10237 | { |
| 10238 | VCLKIndex = YPbPr525iVCLK_2 ; |
| 10239 | if ( !( pVBInfo->SetFlag & RPLLDIV2XO ) ) |
| 10240 | VCLKIndex = YPbPr525iVCLK ; |
| 10241 | } |
| 10242 | } |
| 10243 | } |
| 10244 | } |
| 10245 | } |
| 10246 | else |
| 10247 | { |
| 10248 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 10249 | { |
| 10250 | if ( pVBInfo->SetFlag & RPLLDIV2XO ) |
| 10251 | { |
| 10252 | VCLKIndex = TVVCLKDIV2 ; |
| 10253 | |
| 10254 | |
| 10255 | VCLKIndex += 25 ; |
| 10256 | |
| 10257 | } |
| 10258 | else |
| 10259 | { |
| 10260 | VCLKIndex = TVVCLK ; |
| 10261 | |
| 10262 | |
| 10263 | VCLKIndex += 25 ; |
| 10264 | |
| 10265 | } |
| 10266 | } |
| 10267 | } |
| 10268 | } |
| 10269 | else |
| 10270 | { /* for CRT2 */ |
| 10271 | VCLKIndex = ( UCHAR )XGINew_GetReg2( ( pVBInfo->P3ca + 0x02 ) ) ; /* Port 3cch */ |
| 10272 | VCLKIndex = ( ( VCLKIndex >> 2 ) & 0x03 ) ; |
| 10273 | if ( ModeNo > 0x13 ) |
| 10274 | { |
| 10275 | VCLKIndex = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRTVCLK ; /* di+Ext_CRTVCLK */ |
| 10276 | VCLKIndex &= IndexMask ; |
| 10277 | } |
| 10278 | } |
| 10279 | } |
| 10280 | } |
| 10281 | else |
| 10282 | { /* LVDS */ |
| 10283 | if ( ModeNo <= 0x13 ) |
| 10284 | VCLKIndex = CRT2Index ; |
| 10285 | else |
| 10286 | VCLKIndex = CRT2Index ; |
| 10287 | |
| 10288 | if ( pVBInfo->IF_DEF_CH7005 == 1 ) |
| 10289 | { |
| 10290 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCD ) ) |
| 10291 | { |
| 10292 | VCLKIndex &= 0x1f ; |
| 10293 | tempbx = 0 ; |
| 10294 | |
| 10295 | if ( pVBInfo->VBInfo & SetPALTV ) |
| 10296 | tempbx += 2 ; |
| 10297 | |
| 10298 | if ( pVBInfo->VBInfo & SetCHTVOverScan ) |
| 10299 | tempbx += 1 ; |
| 10300 | |
| 10301 | switch( tempbx ) |
| 10302 | { |
| 10303 | case 0: |
| 10304 | CHTVVCLKPtr = pVBInfo->CHTVVCLKUNTSC ; |
| 10305 | break ; |
| 10306 | case 1: |
| 10307 | CHTVVCLKPtr = pVBInfo->CHTVVCLKONTSC ; |
| 10308 | break; |
| 10309 | case 2: |
| 10310 | CHTVVCLKPtr = pVBInfo->CHTVVCLKUPAL ; |
| 10311 | break ; |
| 10312 | case 3: |
| 10313 | CHTVVCLKPtr = pVBInfo->CHTVVCLKOPAL ; |
| 10314 | break ; |
| 10315 | default: |
| 10316 | break ; |
| 10317 | } |
| 10318 | |
| 10319 | VCLKIndex = CHTVVCLKPtr[ VCLKIndex ] ; |
| 10320 | } |
| 10321 | } |
| 10322 | else |
| 10323 | { |
| 10324 | VCLKIndex = VCLKIndex >> 6 ; |
| 10325 | if ( ( pVBInfo->LCDResInfo == Panel800x600 ) || ( pVBInfo->LCDResInfo == Panel320x480 ) ) |
| 10326 | VCLKIndex = LVDSXlat1VCLK[ VCLKIndex ] ; |
| 10327 | else if ( ( pVBInfo->LCDResInfo == Panel1024x768 ) || ( pVBInfo->LCDResInfo == Panel1024x768x75 ) ) |
| 10328 | VCLKIndex = LVDSXlat2VCLK[ VCLKIndex ] ; |
| 10329 | else |
| 10330 | VCLKIndex = LVDSXlat3VCLK[ VCLKIndex ] ; |
| 10331 | } |
| 10332 | } |
| 10333 | /* VCLKIndex = VCLKIndex&IndexMask ; */ |
| 10334 | |
| 10335 | |
| 10336 | |
| 10337 | return( VCLKIndex ) ; |
| 10338 | } |
| 10339 | |