diff options
| author | Enrico Weigelt, metux IT consult <info@metux.net> | 2024-05-27 16:12:15 +0200 |
|---|---|---|
| committer | Enrico Weigelt, metux IT consult <info@metux.net> | 2024-05-27 16:12:15 +0200 |
| commit | 6f881371d34eb45a67f9223d77b69e6358f229b2 (patch) | |
| tree | 3143d2142d71551a40a185a3b732103dc3ef13ea | |
| parent | 58bd89aebd593c47eeb4005b4d2d3c61a4b1c5f1 (diff) | |
drop dead code
We've got lots of dead (commented-out of ifdef'ed-out) code that most likely
nobody needs anymore.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-video-xgi/-/merge_requests/7>
| -rw-r--r-- | src/init.c | 17 | ||||
| -rw-r--r-- | src/init.h | 1 | ||||
| -rw-r--r-- | src/valid_mode.h | 4 | ||||
| -rw-r--r-- | src/vb_def.h | 45 | ||||
| -rw-r--r-- | src/vb_ext.c | 53 | ||||
| -rw-r--r-- | src/vb_i2c.c | 70 | ||||
| -rw-r--r-- | src/vb_i2c.h | 7 | ||||
| -rw-r--r-- | src/vb_init.c | 156 | ||||
| -rw-r--r-- | src/vb_init.h | 2 | ||||
| -rw-r--r-- | src/vb_setmode.c | 375 | ||||
| -rw-r--r-- | src/vb_struct.h | 12 | ||||
| -rw-r--r-- | src/vb_table.h | 226 | ||||
| -rw-r--r-- | src/xgi.h | 6 | ||||
| -rw-r--r-- | src/xgi_accel.c | 22 | ||||
| -rw-r--r-- | src/xgi_accel.h | 203 | ||||
| -rw-r--r-- | src/xgi_cursor.c | 18 | ||||
| -rw-r--r-- | src/xgi_dac.c | 80 | ||||
| -rw-r--r-- | src/xgi_dri.c | 33 | ||||
| -rw-r--r-- | src/xgi_dri.h | 8 | ||||
| -rw-r--r-- | src/xgi_driver.c | 984 | ||||
| -rw-r--r-- | src/xgi_memcpy.c | 536 | ||||
| -rw-r--r-- | src/xgi_opt.c | 15 | ||||
| -rw-r--r-- | src/xgi_setup.c | 10 | ||||
| -rw-r--r-- | src/xgi_vb.c | 12 | ||||
| -rw-r--r-- | src/xgi_vga.c | 4 | ||||
| -rw-r--r-- | src/xgi_video.c | 61 | ||||
| -rw-r--r-- | src/xgi_videohw.c | 43 | ||||
| -rw-r--r-- | src/xgi_videohw.h | 4 |
28 files changed, 26 insertions, 2981 deletions
@@ -72,7 +72,6 @@ /*********************************************/ /* HELPER: Get ModeID */ /*********************************************/ -/* Jong 09/18/2007; patch to GIT */ /* VGAEngine is not used; FSTN is always FALSE */ USHORT XGI_GetModeID(ULONG VBFlags, int HDisplay, int VDisplay, @@ -161,7 +160,6 @@ XGI_GetModeID(ULONG VBFlags, int HDisplay, int VDisplay, case 1400: break; case 1440: - /* if(VDisplay == 900) ModeIndex = ModeIndex_1440x900[Depth]; */ break; case 1600: if(VDisplay == 1200) ModeIndex = ModeIndex_1600x1200[Depth]; @@ -826,14 +824,6 @@ XGI_New_SetCRT1Group(VB_DEVICE_INFO *XGI_Pr, PXGI_HW_DEVICE_INFO HwInfo, ModeNo, ModeIdIndex); USHORT RefreshRateTableIndex = 0; - -/* - if(XGI_Pr->SetFlag & LowModeTests) { - if(XGI_Pr->VBInfo & (SetSimuScanMode | SwitchToCRT2)) { - XGI_New_DisableBridge(XGI_Pr, HwInfo); - } - } -*/ XGI_SetSeqRegs(StandTableIndex, XGI_Pr); XGI_SetMiscRegs(StandTableIndex, XGI_Pr); XGI_SetCRTCRegs(StandTableIndex, XGI_Pr); @@ -933,13 +923,11 @@ XGIBIOSSetMode(VB_DEVICE_INFO *XGI_Pr, PXGI_HW_DEVICE_INFO HwInfo, xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting a standard mode 0x%x\n", ModeNo); } - /* ------------------------------------------------------------------ */ SetModeRet = XGISetModeNew(HwInfo, XGI_Pr, ModeNo); PDEBUG(ErrorF("out_of_C_code_SETMODE \n")); } - - + /* SetPitch: Adapt to virtual size & position */ if ((ModeNo > 0x13) || (mode->type == M_T_USERDEF) || ((mode->type & M_T_CLOCK_CRTC_C) == M_T_CLOCK_CRTC_C)) { XGI_SetReg(XGI_Pr->Part1Port, 0x2f, 1); //yilin for crt2pitch it shoude modify if not colone mode @@ -950,9 +938,6 @@ XGIBIOSSetMode(VB_DEVICE_INFO *XGI_Pr, PXGI_HW_DEVICE_INFO HwInfo, PDEBUG(ErrorF("scrnOffset is %d...\n", pXGI->scrnOffset)); XGI_SetReg(XGI_Pr->P3d4,0x13,(HDisplay & 0xFF)); XGI_SetRegANDOR(XGI_Pr->P3c4,0x0E,0xF0,(HDisplay>>8)); - /* - XGI_SetReg(XGI_Pr->P3d4,0x13,(HDisplay & 0xFF)); - XGI_SetRegANDOR(XGI_Pr->P3c4,0x0E,0xF0,(HDisplay>>8)); */ } return SetModeRet; @@ -88,7 +88,6 @@ static const USHORT ModeIndex_1280x720[] = {0x79, 0x75, 0x00, 0x78}; static const USHORT ModeIndex_1280x800[] = {0x14, 0x15, 0x00, 0x16}; static const USHORT ModeIndex_1360x768[] = {0x48, 0x4b, 0x00, 0x4e}; static const USHORT ModeIndex_1400x1050[] = {0x26, 0x27, 0x00, 0x28}; /* 315 series only */ -/* static const USHORT ModeIndex_1440x900[] = {0x26, 0x27, 0x00, 0x28}; */ /* Jong@09292009 */ static const USHORT ModeIndex_1680x1050[] = {0x17, 0x18, 0x00, 0x19}; /* 315 series only */ static const USHORT ModeIndex_1600x1200[] = {0x3c, 0x3d, 0x00, 0x66}; static const USHORT ModeIndex_1920x1440[] = {0x68, 0x69, 0x00, 0x6b}; diff --git a/src/valid_mode.h b/src/valid_mode.h index 7450308..f3625c2 100644 --- a/src/valid_mode.h +++ b/src/valid_mode.h @@ -69,13 +69,11 @@ SupportMode XG20_Mode[]= { {1280, 1024, 157500}, {1280, 1024, 190960}, {1280, 1024, 233793}, -/* {1440, 900, 106470}, *//* Jong@09292009; 1440x900@60 */ {1600, 1200, 162000}, {1600, 1200, 175500}, {1600, 1200, 189000}, {1600, 1200, 202500}, {1600, 1200, 229500}, -/* {1680, 1050, 147140}, *//* Jong@09292009; 1680x1050@60 */ {0, 0, 0} }; @@ -109,5 +107,3 @@ SupportMode XGI_Mode[]= { }; #endif -/* {108000, 1280, 960}, */ -/* {80350, 1152, 864}, {108000, 1152, 864}, */ diff --git a/src/vb_def.h b/src/vb_def.h index 5f73000..4123fdd 100644 --- a/src/vb_def.h +++ b/src/vb_def.h @@ -50,25 +50,9 @@ #define VB_YPbPr750p 0x02 #define VB_YPbPr1080i 0x03 -/* #define CRT1Len 17 */ #define LVDSCRT1Len 15 #define CHTVRegDataLen 5 -/* #define ModeInfoFlag 0x07 */ -/* #define IsTextMode 0x07 */ -/* #define ModeText 0x00 */ -/* #define ModeCGA 0x01 */ -/* #define ModeEGA 0x02 */ -/* #define ModeVGA 0x03 */ -/* #define Mode15Bpp 0x04 */ -/* #define Mode16Bpp 0x05 */ -/* #define Mode24Bpp 0x06 */ -/* #define Mode32Bpp 0x07 */ - -/* #define DACInfoFlag 0x18 */ -/* #define MemoryInfoFlag 0x1E0 */ -/* #define MemorySizeShift 0x05 */ - #define Charx8Dot 0x0200 #define LineCompareOff 0x0400 #define CRT2Mode 0x0800 @@ -92,7 +76,6 @@ #define SyncPP 0x0000 #define SyncPN 0x4000 #define SyncNP 0x8000 -/* #define SyncNN 0xc000 */ #define ECLKindex0 0x0000 #define ECLKindex1 0x0100 #define ECLKindex2 0x0200 @@ -116,7 +99,6 @@ * CR31 */ #define SetNTSCTV 0x0000 -/* #define SetPALTV 0x0100 */ #define SetCRT2ToLCDA 0x0100 #define SetInSlaveMode 0x0200 #define SetNotSimuMode 0x0400 @@ -129,7 +111,6 @@ #define HotKeySwitch 0x8000 #define SetCHTVOverScan 0x8000 #define SetCRT2ToDualEdge 0x8000 -/* #define SetCRT2ToLCDA 0x8000 301b */ #define PanelRGB18Bit 0x0100 #define PanelRGB24Bit 0x0000 @@ -145,16 +126,10 @@ #define SetToLCDA 0x02 #define YPbPrModeInfo 0x38 -/* #define YPbPrMode525i 0x00 */ -/* #define YPbPrMode525p 0x08 */ -/* #define YPbPrMode750p 0x10 */ -/* #define YPbPrMode1080i 0x18 */ #define SetSCARTOutput 0x01 #define BoardTVType 0x02 #define EnablePALMN 0x40 /* Romflag: 1 = Allow PALM/PALN */ -/* #define LCDVESATiming 0x0008 */ -/* #define EnableLVDSDDA 0x0010 */ #define Panel320x480 0x07/*fstn*/ /* [ycchen] 02/12/03 Modify for Multi-Sync. LCD Support */ @@ -178,13 +153,7 @@ #define PanelRef60Hz 0x00 #define PanelRef75Hz 0x20 -/* #define DDC2DelayTime 300 */ - #define CRT2DisplayFlag 0x2000 -/* #define LCDDataLen 8 */ -/* #define HiTVDataLen 12 */ -/* #define TVDataLen 16 */ -/* #define SetPALTV 0x0100 */ #define HalfDCLK 0x1000 #define NTSCHT 1716 #define NTSC2HT 1920 @@ -220,7 +189,6 @@ #define YPbPr525iVCLK 0x03B #define YPbPr525iVCLK_2 0x03A -/* #define LCDVESATiming 0x08 */ #define SetSCARTOutput 0x01 #define AVIDEOSense 0x01 #define SVIDEOSense 0x02 @@ -251,19 +219,13 @@ #define ADR_CHTVRegDataPtr 0x218 #define LVDSDataLen 6 -/* #define EnableLVDSDDA 0x10 */ -/* #define LVDSDesDataLen 3 */ #define ActiveNonExpanding 0x40 #define ActiveNonExpandingShift 6 -/* #define ActivePAL 0x20 */ #define ActivePALShift 5 -/* #define ModeSwitchStatus 0x0F */ #define SoftTVType 0x40 #define SoftSettingAddr 0x52 #define ModeSettingAddr 0x53 -/* #define SelectCRT1Rate 0x4 */ - #define _PanelType00 0x00 #define _PanelType01 0x08 #define _PanelType02 0x10 @@ -324,12 +286,9 @@ #define OEMLCDPanelIDSupport 0x0080 -/* #define LCDVESATiming 0x0001 //LCD Info CR37 */ -/* #define EnableLVDSDDA 0x0002 */ #define EnableScalingLCD 0x0008 #define SetPWDEnable 0x0004 #define SetLCDtoNonExpanding 0x0010 -/* #define SetLCDPolarity 0x00E0 */ #define SetLCDDualLink 0x0100 #define SetLCDLowResolution 0x0200 #define SetLCDStdMode 0x0400 @@ -526,7 +485,6 @@ #define SetPALMTV 0x0004 #define SetPALNTV 0x0008 #define SetCHTVUnderScan 0x0000 -/* #define SetCHTVOverScan 0x0010 */ #define SetYPbPrMode525i 0x0020 #define SetYPbPrMode525p 0x0040 #define SetYPbPrMode750p 0x0080 @@ -936,10 +894,7 @@ #define HiTVSimuVCLK 0x3E #define HiTVTextVCLK 0x3F #define VCLK39_77 0x40 -/* #define YPbPr750pVCLK 0x0F */ #define YPbPr525pVCLK 0x3A -/* #define ;;YPbPr525iVCLK 0x3B */ -/* #define ;;YPbPr525iVCLK_2 0x3A */ #define NTSC1024VCLK 0x41 #define VCLK25_175_41 0x42 /* ; ScaleLCD */ #define VCLK25_175_42 0x43 diff --git a/src/vb_ext.c b/src/vb_ext.c index c33a6a3..833139f 100644 --- a/src/vb_ext.c +++ b/src/vb_ext.c @@ -146,11 +146,7 @@ void XGI_GetSenseStatus( PXGI_HW_DEVICE_INFO HwDeviceExtension , PVB_DEVICE_INFO if ( !XGINew_BridgeIsEnable( HwDeviceExtension, pVBInfo ) ) { USHORT temp_mode_no; - SenseModeNo = 0x2e ; - /* XGI_SetReg((XGIIOADDRESS) pVBInfo->P3d4 , 0x30 , 0x41 ) ; */ - /* XGISetModeNew(HwDeviceExtension, pVBInfo, 0x2e); // ynlai InitMode */ - temp_mode_no = SenseModeNo; XGI_SearchModeID(pVBInfo->SModeIDTable, pVBInfo->EModeIDTable, 0x11, @@ -165,7 +161,6 @@ void XGI_GetSenseStatus( PXGI_HW_DEVICE_INFO HwDeviceExtension , PVB_DEVICE_INFO XGI_EnableBridge( HwDeviceExtension, pVBInfo ) ; XGI_SetCRT2Group301( SenseModeNo , HwDeviceExtension, pVBInfo ) ; XGI_SetCRT2ModeRegs( 0x2e , HwDeviceExtension, pVBInfo ) ; - /* XGI_DisableBridge( HwDeviceExtension, pVBInfo ) ; */ XGI_SetRegANDOR((XGIIOADDRESS) pVBInfo->P3c4 , 0x01 , 0xDF , 0x20 ) ; /* Display Off 0212 */ for( i = 0 ; i < 20 ; i++ ) { @@ -272,7 +267,6 @@ void XGI_GetSenseStatus( PXGI_HW_DEVICE_INFO HwDeviceExtension , PVB_DEVICE_INFO if ( !( P2reg0 & 0x20 ) ) { pVBInfo->VBInfo = DisableCRT2Display ; - /* XGI_SetCRT2Group301( SenseModeNo , HwDeviceExtension, pVBInfo ) ; */ } } } @@ -440,13 +434,11 @@ void XGIPowerSaving(PVB_DEVICE_INFO pVBInfo, UCHAR PowerSavingStatus) if(PowerSavingStatus & 0x01) /* turn off DAC1 */ { ErrorF("Turn off DAC1...\n"); - /* XGI_SetRegAND((XGIIOADDRESS) pVBInfo->P3c4 , ??? , ??? ) ; */ /* ??? */ XGI_SetRegANDOR((XGIIOADDRESS) pVBInfo->P3c4 , 0x07 , ~0x20, 0x20 ) ; /* SR07[5] : Enable DAC1 power saving mode */ } else { ErrorF("Turn on DAC1...\n"); - /* XGI_SetRegAND((XGIIOADDRESS) pVBInfo->P3c4 , ??? , ??? ) ; */ XGI_SetRegAND((XGIIOADDRESS) pVBInfo->P3c4 , 0x07 , ~0x20 ) ; } @@ -492,8 +484,6 @@ VOID XGISetDPMS(ScrnInfoPtr pScrn, PVB_DEVICE_INFO pVBInfo, PXGI_HW_DEVICE_INFO { USHORT ModeNo, ModeIdIndex ; UCHAR temp ; - /* VB_DEVICE_INFO VBINF; */ - /* PVB_DEVICE_INFO pVBInfo = pXGI->XGI_Pr */ /* &VBINF */; ErrorF("XGISetDPMS(VESA_POWER_STATE = 0x%lx)...\n", VESA_POWER_STATE); @@ -502,48 +492,16 @@ VOID XGISetDPMS(ScrnInfoPtr pScrn, PVB_DEVICE_INFO pVBInfo, PXGI_HW_DEVICE_INFO XGIInitMiscVBInfo(pXGIHWDE, pVBInfo); - /* Jong@08212009; ignored at present */ - /* - if ( pVBInfo->IF_DEF_CH7007 == 0 ) - { - XGINew_SetModeScratch ( pXGIHWDE , pVBInfo ) ; - } */ - XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4 , 0x05 , 0x86 ) ; /* 1.Openkey */ XGI_UnLockCRT2( pXGIHWDE , pVBInfo) ; ModeNo = XGI_GetReg((XGIIOADDRESS) pVBInfo->P3d4 , 0x34 ) ; XGI_SearchModeID(pVBInfo->SModeIDTable, pVBInfo->EModeIDTable, 0x11, &ModeNo , &ModeIdIndex); - /* XGI_SearchModeID( ModeNo , &ModeIdIndex, pVBInfo ) ; */ - - /* Jong@08212009; ignored */ - /* - if ( ( pXGIHWDE->ujVBChipID == VB_CHIP_301 ) || ( pXGIHWDE->ujVBChipID == VB_CHIP_302 ) || ( pVBInfo->IF_DEF_CH7007 == 1 )) - { - XGI_GetVBType( pVBInfo ) ; - XGI_GetVBInfo( ModeNo , ModeIdIndex , pXGIHWDE, pVBInfo ) ; - XGI_GetTVInfo( ModeNo , ModeIdIndex, pVBInfo ) ; - XGI_GetLCDInfo( ModeNo , ModeIdIndex, pVBInfo ) ; - } - - if ( VESA_POWER_STATE == 0x00000400 ) - XGINew_SetReg1( pVBInfo->Part4Port , 0x31 , ( UCHAR )( XGINew_GetReg1( pVBInfo->Part4Port , 0x31 ) & 0xFE ) ) ; - else - XGINew_SetReg1( pVBInfo->Part4Port , 0x31 , ( UCHAR )( XGINew_GetReg1( pVBInfo->Part4Port , 0x31 ) | 0x01 ) ) ; - */ temp = ( UCHAR )XGI_GetReg((XGIIOADDRESS) pVBInfo->P3c4 , 0x1f ) ; temp &= 0x3f ; switch ( VESA_POWER_STATE ) { case 0x00000000 : /* on */ - /* Jong@08212009; not support */ - /* - if ( ( pXGIHWDE->ujVBChipID == VB_CHIP_301 ) || ( pXGIHWDE->ujVBChipID == VB_CHIP_302 ) ) - { - XGINew_SetReg1( pVBInfo->P3c4 , 0x1f , ( UCHAR )( temp | 0x00 ) ) ; - XGI_EnableBridge( pXGIHWDE, pVBInfo ) ; - } - else */ { /* Handle LVDS */ if ( pVBInfo->IF_DEF_LVDS == 1 ) @@ -572,7 +530,6 @@ VOID XGISetDPMS(ScrnInfoPtr pScrn, PVB_DEVICE_INFO pVBInfo, PXGI_HW_DEVICE_INFO XGI_SetRegANDOR((XGIIOADDRESS) pVBInfo->P3c4 , 0x09 , ~0x80 , 0x80 ) ; /* DVO ON */ XGI_SetXG21FPBits( pVBInfo ); XGI_SetRegAND((XGIIOADDRESS) pVBInfo->P3d4 , 0x4A , ~0x20 ) ; /* Enable write GPIOF */ - /*XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x48 , ~0x20 , 0x20 ) ;*/ /* LCD Display ON */ } XGI_XG21BLSignalVDD( 0x20 , 0x20, pVBInfo ) ; /* LVDS signal on */ @@ -587,7 +544,6 @@ VOID XGISetDPMS(ScrnInfoPtr pScrn, PVB_DEVICE_INFO pVBInfo, PXGI_HW_DEVICE_INFO XGI_SetRegANDOR((XGIIOADDRESS) pVBInfo->P3c4 , 0x09 , ~0x80 , 0x80 ) ; /* DVO ON */ XGI_SetXG27FPBits( pVBInfo ); XGI_SetRegAND((XGIIOADDRESS) pVBInfo->P3d4 , 0x4A , ~0x20 ) ; /* Enable write GPIOF */ - /*XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x48 , ~0x20 , 0x20 ) ;*/ /* LCD Display ON */ } XGI_XG27BLSignalVDD( 0x20 , 0x20, pVBInfo ) ; /* LVDS signal on */ @@ -659,14 +615,6 @@ VOID XGISetDPMS(ScrnInfoPtr pScrn, PVB_DEVICE_INFO pVBInfo, PXGI_HW_DEVICE_INFO break ; case 0x00000400: /* off */ - /* Jong@08212009; not support */ - /* - if ( (pXGIHWDE->ujVBChipID == VB_CHIP_301 ) || ( pXGIHWDE->ujVBChipID == VB_CHIP_302 ) ) - { - XGINew_SetReg1( pVBInfo->P3c4 , 0x1f , ( UCHAR )( temp | 0xc0 ) ) ; - XGI_DisableBridge( pXGIHWDE, pVBInfo ) ; - } - else */ { if ( pXGIHWDE->jChipType == XG21 ) { @@ -680,7 +628,6 @@ VOID XGISetDPMS(ScrnInfoPtr pScrn, PVB_DEVICE_INFO pVBInfo, PXGI_HW_DEVICE_INFO { XGI_SetRegAND((XGIIOADDRESS) pVBInfo->P3c4 , 0x09 , ~0x80 ) ; /* DVO Off */ XGI_SetRegAND((XGIIOADDRESS) pVBInfo->P3d4 , 0x4A , ~0x20 ) ; /* Enable write GPIOF */ - /*XGINew_SetRegAND( pVBInfo->P3d4 , 0x48 , ~0x20 ) ;*/ /* LCD Display OFF */ } XGIPowerSaving(pVBInfo, 0x03); /* Turn off DAC1, DVO */ diff --git a/src/vb_i2c.c b/src/vb_i2c.c index d87fbb9..6e881e9 100644 --- a/src/vb_i2c.c +++ b/src/vb_i2c.c @@ -65,7 +65,6 @@ extern UCHAR XGI_GetRegByte(XGIIOADDRESS port); void I2C_DelayUS(ULONG MicroSeconds) { ErrorF(""); - /* udelay(MicroSeconds); */ } @@ -73,9 +72,6 @@ typedef enum _I2C_ACCESS_CMD { I2C_WRITE = 0, I2C_READ -/* Jong 08/18/2008; for XFree86 */ - /* WRITE = 0, - READ */ } I2C_ACCESS_CMD; /* For XG21 */ @@ -500,24 +496,17 @@ char vGetEnhancedEDIDBlock( } char I2COpen (PXGI_HW_DEVICE_INFO pHWDE, ULONG ulI2CEnable, ULONG ulChannelID, PI2CControl pI2CControl) { -/* -// printk("\nI2COpen(%d) : Channel ID = %d\n", ulI2CEnable, ulChannelID); - // we need to determine the Context area for each command we receive - // i.e. which hardware I2C bus is the command for. - // this is unimplemented here! -*/ if (ulChannelID >= MAX_I2C_CHANNEL) { return ERROR_INVALID_PARAMETER; } if (ulI2CEnable) /* Open I2C Port */ { -/* // verify clock rate. If you cannot implement the given rate, + // verify clock rate. If you cannot implement the given rate, // enable a lower clock rate closest to the request clock rate. // // put a better check here if your device can only do discrete // clock rate values. -*/ if (pI2CControl->ClockRate > I2C_MAX_CLOCK_RATE) { pI2CControl->ClockRate = I2C_MAX_CLOCK_RATE; @@ -533,11 +522,9 @@ char I2COpen (PXGI_HW_DEVICE_INFO pHWDE, ULONG ulI2CEnable, ULONG ulChannelID, pI2CControl->Status = I2C_STATUS_NOERROR; } - - return 0; } -/* end of I2COpen */ + char I2CAccess(PXGI_HW_DEVICE_INFO pHWDE, PI2CControl pI2CControl) { ULONG ulChannel = pI2CControl->dwCookie % MAX_I2C_CHANNEL; @@ -552,36 +539,22 @@ char I2CAccess(PXGI_HW_DEVICE_INFO pHWDE, PI2CControl pI2CControl) } pHWDE->I2CDelay = (1000000 / pI2CControl->ClockRate) * 10 * 2; /* in 100ns */ - /* pHWDE->I2CDelay = (1000000 / pI2CControl->ClockRate) * 10; */ /* in 100ns */ - /* pHWDE->I2CDelay = 100; */ - /* PDEBUG(ErrorF("I2CAccess()-I2CDelay = %d...\n", pHWDE->I2CDelay)); */ - - /* pHWDE->I2CDelay = 100; */ /* Jong@08032009 */ switch (pI2CControl->Command) { /* Issue a STOP or START without a READ or WRITE Command */ case I2C_COMMAND_NULL: if (I2CNull(pHWDE, pI2CControl) == FALSE) break; -/* if (pI2CControl->Flags & I2C_FLAGS_STOP) { - pI2CContext->dwI2CPortAcquired = FALSE; - } -*/ break; + break; /* READ or WRITE Command */ case I2C_COMMAND_READ: if (I2CRead(pHWDE, pI2CControl) == FALSE) break; -/* if (pI2CControl->Flags & I2C_FLAGS_STOP) { - pI2CContext->dwI2CPortAcquired = FALSE; - } -*/ break; + break; case I2C_COMMAND_WRITE: if (I2CWrite(pHWDE, pI2CControl) == FALSE) break; -/* if (pI2CControl->Flags & I2C_FLAGS_STOP) { - pI2CContext->dwI2CPortAcquired = FALSE; - } -*/ break; + break; case I2C_COMMAND_STATUS: pI2CControl->Status = I2C_STATUS_NOERROR; @@ -597,9 +570,6 @@ char I2CAccess(PXGI_HW_DEVICE_INFO pHWDE, PI2CControl pI2CControl) return ERROR_INVALID_PARAMETER; } - -/* printk("\nI2CAccess(): I2C Cmd = 0x%X I2C Flags = 0x%X I2C Status = 0x%X I2C Data = 0x%X", pI2CControl->Command, pI2CControl->Flags, pI2CControl->Status, pI2CControl->Data); */ - return NO_ERROR; } @@ -640,7 +610,7 @@ BOOLEAN I2CNull( PXGI_HW_DEVICE_INFO pHWDE, PI2CControl pI2CControl) pI2CControl->Status = I2C_STATUS_NOERROR; return TRUE; -}/* end of I2CNull()*/ +} /*^^* * Function: I2CRead @@ -691,7 +661,7 @@ BOOLEAN I2CRead(PXGI_HW_DEVICE_INFO pHWDE, PI2CControl pI2CControl) pI2CControl->Status = I2C_STATUS_NOERROR; return TRUE; -} /* end of I2CRead() */ +} /*^^* * Function: I2CWrite @@ -758,7 +728,7 @@ BOOLEAN I2CWrite(PXGI_HW_DEVICE_INFO pHWDE, PI2CControl pI2CControl) pI2CControl->Status = I2C_STATUS_NOERROR; return TRUE; -} /* end of I2CWrite() */ +} /*^^* * Function: ResetI2C @@ -781,10 +751,7 @@ BOOLEAN ResetI2C(PXGI_HW_DEVICE_INFO pHWDE, PI2CControl pI2CControl) pI2CControl->Status = I2C_STATUS_ERROR; return FALSE; } -} /* ResetI2C() */ - - - +} /*^^* * Function: Ack @@ -874,8 +841,7 @@ BOOLEAN Ack (PXGI_HW_DEVICE_INFO pHWDE, bool fPut) } return (BOOLEAN)(status == LODAT); } -}/* end of Ack() */ - +} BOOLEAN NoAck(PXGI_HW_DEVICE_INFO pHWDE) { @@ -967,7 +933,7 @@ BOOLEAN Start( PXGI_HW_DEVICE_INFO pHWDE) I2C_DelayUS(delay); return TRUE; -}/* end of Start */ +} /*^^* * Function: Stop @@ -1010,7 +976,7 @@ BOOLEAN Stop(PXGI_HW_DEVICE_INFO pHWDE) I2C_DelayUS(delay); return (BOOLEAN)(bReadDataLine(pHWDE) == HIDAT); -}/* end of Stop*/ +} /*^^* * Function: WriteUCHARI2C @@ -1058,7 +1024,7 @@ BOOLEAN WriteUCHARI2C(PXGI_HW_DEVICE_INFO pHWDE, UCHAR cData) I2C_DelayUS(delay); } return TRUE; -}/* end of WriteUCHARI2C */ +} /*^^* * Function: ReadUCHARI2C @@ -1381,7 +1347,6 @@ VOID vWriteClockLineCRT(PXGI_HW_DEVICE_INFO pHWDE, UCHAR data) temp = (temp & (~MASK(1:0))) | pHWDE->ucI2cCRT; //wait for CRT1 retrace only when CRT1 is enabled! - /* if (pHWDE->bMonitorPoweredOn) */ /* jong@08042009; ignore here */ { if(!(data & 1) && ((ujSR1F & 0xC0)==0) ) { @@ -1415,7 +1380,6 @@ VOID vWriteDataLineCRT(PXGI_HW_DEVICE_INFO pHWDE, UCHAR data) temp = (temp & (~MASK(1:0))) | pHWDE->ucI2cCRT; //wait for CRT1 retrace only when CRT1 is enabled! - /* if (pHWDE->bMonitorPoweredOn) */ /* Jong@08042009; ignore checking */ { if(!(data & 1) && ((ujSR1F & 0xC0)==0) ) { @@ -1629,9 +1593,8 @@ BOOLEAN bEDIDCheckSum(PUCHAR pjEDIDBuf,ULONG ulBufSize) for (i = 0; i < ulBufSize; i++) { - /* printk("pujPtr=%x, ",*pujPtr); */ ujSum += *(pujPtr++); - } /*for-loop */ + } return(ujSum); @@ -1672,11 +1635,6 @@ VP_STATUS vGetEDID_1( } // Set Segment Block ID as 0 if Monitor support Enhanced-EDID - /* - pI2C->Command = I2C_COMMAND_WRITE_SEGMENT; // to replace I2C_COMMAND_WRITE - pI2C->Data = 0; - I2CAccessBuffer(pHWDE, pI2C, 0x60, 0, &(pI2C->Data), 0); - */ pI2C->Command = I2C_COMMAND_WRITE; pI2C->Data = 0; I2CAccessBuffer(pHWDE, pI2C, 0x60, 0, &(pI2C->Data), 0); diff --git a/src/vb_i2c.h b/src/vb_i2c.h index 8bab105..a3cc3d2 100644 --- a/src/vb_i2c.h +++ b/src/vb_i2c.h @@ -62,11 +62,6 @@ #define LARGE(n) ((1?n) > (0?n) ? (1?n) : (0?n)) // Select Small one from a:b #define SMALL(n) ((1?n) < (0?n) ? (1?n) : (0?n)) -// set bits as 1 between bit(a) and bit(b) -//#define BITSMASK(a,b) ( (a)>(b) ? BITS((a)-(b)+1) << (b) : BITS((b)-(a)+1) << (a) ) -// The same as BITMASK(a,b) instead of parameters' format -//#define MASK(n) BITSMASK(1?n, 0?n) -// set bits as 1 between bit(a) and bit(b) #define MASK(n) ( BITS(LARGE(n)-SMALL(n)+1) << SMALL(n) ) // get bits [a:b]'s binary value #ifndef GETBITS @@ -154,8 +149,6 @@ typedef struct _XGI_I2C_CONTROL ULONG I2CDelay; /* 100ns units*/ } XGI_I2C_CONTROL, *PXGI_I2C_CONTROL; -/*extern char I2CAccessBuffer(PXGI_HW_DEVICE_INFO pHWDE, PI2CControl I2CCntl, ULONG DevAddr, ULONG Offset, PUCHAR pBuffer, ULONG ulSize); -*/ extern char vGetEDIDExtensionBlocks(PXGI_HW_DEVICE_INFO pHWDE, PI2CControl pI2C, PUCHAR pjBuffer, ULONG ulBufferSize); extern char vGetEnhancedEDIDBlock(PXGI_HW_DEVICE_INFO pHWDE, PI2CControl pI2C, ULONG ulBlockID, ULONG ulBlockTag, PUCHAR pjBuffer, ULONG ulBufferSize); diff --git a/src/vb_init.c b/src/vb_init.c index 287fcde..931a213 100644 --- a/src/vb_init.c +++ b/src/vb_init.c @@ -203,24 +203,15 @@ BOOLEAN XGIInitNew(PXGI_HW_DEVICE_INFO HwDeviceExtension, VBIOSVersion[ 5 ] ; ULONG base,ChipsetID,VendorID,GraphicVendorID; PUCHAR volatile pVideoMemory; - - /* ULONG j, k ; */ - PXGI_DSReg pSR ; - ULONG Temp ; - XGINew_InitVBIOSData(HwDeviceExtension, pVBInfo); pVideoMemory = ( PUCHAR )pVBInfo->ROMAddr; - Newdebugcode( 0x99 ) ; - /* if ( pVBInfo->ROMAddr == 0 ) */ - /* return( FALSE ) ; */ - if ( pVBInfo->FBAddr == 0 ) return( FALSE ) ; @@ -233,21 +224,16 @@ BOOLEAN XGIInitNew(PXGI_HW_DEVICE_INFO HwDeviceExtension, if ( !HwDeviceExtension->bIntegratedMMEnabled ) return( FALSE ) ; /* alan */ - - XGI_MemoryCopy( VBIOSVersion , HwDeviceExtension->szVBIOSVer , 4 ) ; VBIOSVersion[ 4 ] = 0x0 ; - /* ReadVBIOSData */ ReadVBIOSTablData( HwDeviceExtension->jChipType , pVBInfo) ; /* 1.Openkey */ XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4 , 0x05 , 0x86 ) ; - - /* 2.Reset Extended register */ for( i = 0x06 ; i < 0x20 ; i++ ) @@ -256,10 +242,6 @@ BOOLEAN XGIInitNew(PXGI_HW_DEVICE_INFO HwDeviceExtension, for( i = 0x21 ; i <= 0x27 ; i++ ) XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4 , i , 0 ) ; - /* for( i = 0x06 ; i <= 0x27 ; i++ ) */ - /* XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4 , i , 0 ) ; */ - - if(( HwDeviceExtension->jChipType == XG20 ) || ( HwDeviceExtension->jChipType >= XG40)) { for( i = 0x31 ; i <= 0x3B ; i++ ) @@ -274,9 +256,6 @@ BOOLEAN XGIInitNew(PXGI_HW_DEVICE_INFO HwDeviceExtension, if ( HwDeviceExtension->jChipType == XG42 ) /* [Hsuan] 2004/08/20 Auto over driver for XG42 */ XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4 , 0x3B , 0xC0 ) ; - /* for( i = 0x30 ; i <= 0x3F ; i++ ) */ - /* XGI_SetReg((XGIIOADDRESS) pVBInfo->P3d4 , i , 0 ) ; */ - for( i = 0x79 ; i <= 0x7C ; i++ ) XGI_SetReg((XGIIOADDRESS) pVBInfo->P3d4 , i , 0 ) ; /* shampoo 0208 */ @@ -309,7 +288,6 @@ BOOLEAN XGIInitNew(PXGI_HW_DEVICE_INFO HwDeviceExtension, } } - if ( HwDeviceExtension->jChipType == XG20 ) XGINew_RAMType = temp & 0x01 ; else @@ -340,7 +318,6 @@ BOOLEAN XGIInitNew(PXGI_HW_DEVICE_INFO HwDeviceExtension, XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4, 0x11, 0x0F); XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4, 0x1F, pVBInfo->SR1F); - /* XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4, 0x20, 0x20); */ XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4, 0x20, 0xA0); /* alan, 2001/6/26 Frame buffer can read/write SR20 */ /* Jong 10/01/2007; added for ??? */ @@ -348,10 +325,6 @@ BOOLEAN XGIInitNew(PXGI_HW_DEVICE_INFO HwDeviceExtension, if ( HwDeviceExtension->jChipType == XG27 ) /* Alan 12/07/2006 */ XGI_SetReg( (XGIIOADDRESS) pVBInfo->P3c4 , 0x36 , *pVBInfo->pSR36 ) ; - /* SR11 = 0x0F ; */ - /* XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4 , 0x11 , SR11 ) ; */ - - if ( (HwDeviceExtension->jChipType != XG20) &&(HwDeviceExtension->jChipType != XG21) &&(HwDeviceExtension->jChipType != XG27) @@ -527,17 +500,9 @@ BOOLEAN XGIInitNew(PXGI_HW_DEVICE_INFO HwDeviceExtension, pSR++ ; } } - /* XGINew_SetDRAMModeRegister340( pVBInfo ) ; */ } /* SkipDramSizing */ else { -/* if ( HwDeviceExtension->jChipType == XG20 ) - { - XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4 , 0x13 , pVBInfo->SR15[0][XGINew_RAMType] ) ; - XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4 , 0x14 , pVBInfo->SR15[1][XGINew_RAMType] ) ; - XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4 , 0x20 , 0x20 ) ; - } - else*/ if ( HwDeviceExtension->jChipType == XG45 ) XGINew_SetDRAMSize_XG45( HwDeviceExtension , pVBInfo) ; else @@ -545,26 +510,6 @@ BOOLEAN XGIInitNew(PXGI_HW_DEVICE_INFO HwDeviceExtension, } } /* XG40 */ - - - - /* SetDefExt2Regs begin */ -/* - AGP = 1 ; - temp =( UCHAR )XGI_GetReg((XGIIOADDRESS) pVBInfo->P3c4 , 0x3A ) ; - temp &= 0x30 ; - if ( temp == 0x30 ) - AGP = 0 ; - - if ( AGP == 0 ) - pVBInfo->SR21 &= 0xEF ; - - XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4 , 0x21 , pVBInfo->SR21 ) ; - if ( AGP == 1 ) - pVBInfo->SR22 &= 0x20; - XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4 , 0x22 , pVBInfo->SR22 ) ; -*/ - base = 0x80000000; XGI_SetRegLong(0xcf8, base); Temp = (XGI_GetRegLong(0xcfc) & 0x0000FFFF); @@ -584,31 +529,13 @@ BOOLEAN XGIInitNew(PXGI_HW_DEVICE_INFO HwDeviceExtension, /* SetDefExt2Regs end */ } - /* Jong 10/01/2007; be removed and recoded */ -#if 0 - if ( HwDeviceExtension->bSkipSense == FALSE ) - { - XGI_SenseCRT1(pVBInfo) ; - /* XGINew_DetectMonitor( HwDeviceExtension ) ; */ - XGI_GetSenseStatus( HwDeviceExtension , pVBInfo ) ; /* sense CRT2 */ - } -#endif - XGINew_ChkSenseStatus ( HwDeviceExtension , pVBInfo ) ; XGINew_SetModeScratch ( HwDeviceExtension , pVBInfo ) ; Newdebugcode( 0x88 ) ; - /* Johnson@062403. To save time for power management. */ - /* DelayMS(1000); */ - /* ~Johnson@062403. */ - /* XGI_SetReg((XGIIOADDRESS) pVBInfo->P3d4 , 0x32 , 0x28 ) ; //0207 temp */ - /* XGI_SetReg((XGIIOADDRESS) pVBInfo->P3d4 , 0x36 , 0x02 ) ; //0207 temp */ - return( TRUE ) ; -} /* end of init */ - - +} /* --------------------------------------------------------------------- */ /* Function : DualChipInit */ @@ -803,19 +730,6 @@ UCHAR XGINew_Get340DRAMType( PXGI_HW_DEVICE_INFO HwDeviceExtension , PVB_DEVICE_ /* --------------------------------------------------------------------- */ -/* Function : XGINew_Delay15us */ -/* Input : */ -/* Output : */ -/* Description : */ -/* --------------------------------------------------------------------- */ -/* -void XGINew_Delay15us(ULONG ulMicrsoSec) -{ -} -*/ - - -/* --------------------------------------------------------------------- */ /* Function : XGINew_SDR_MRS */ /* Input : */ /* Output : */ @@ -828,10 +742,8 @@ void XGINew_SDR_MRS(PVB_DEVICE_INFO pVBInfo) data = XGI_GetReg((XGIIOADDRESS) pVBInfo->P3c4 , 0x16 ) ; data &= 0x3F ; /* SR16 D7=0,D6=0 */ XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4 , 0x16 , data ) ; /* enable mode register set(MRS) low */ - /* XGINew_Delay15us( 0x100 ) ; */ data |= 0x80 ; /* SR16 D7=1,D6=0 */ XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4 , 0x16 , data ) ; /* enable mode register set(MRS) high */ - /* XGINew_Delay15us( 0x100 ) ; */ } @@ -913,17 +825,15 @@ void XGINew_DDR2x_MRS_340(PXGI_HW_DEVICE_INFO HwDeviceExtension, USHORT P3c4, XGI_SetReg((XGIIOADDRESS) P3c4 , 0x16 , 0x00 ) ; XGI_SetReg((XGIIOADDRESS) P3c4 , 0x16 , 0x80 ) ; } - + DelayUS( 60 ) ; XGI_SetReg((XGIIOADDRESS) P3c4 , 0x18 , pVBInfo->SR15[ 2 ][ XGINew_RAMType ] ) ; /* SR18 */ - /* XGI_SetReg((XGIIOADDRESS) P3c4 , 0x18 , 0x31 ) ; */ XGI_SetReg((XGIIOADDRESS) P3c4 , 0x19 , 0x02 ) ; /*TSop DRAM DLL pin jump to A9*/ XGI_SetReg((XGIIOADDRESS) P3c4 , 0x16 , pVBInfo->SR16[ 0 ] ) ; XGI_SetReg((XGIIOADDRESS) P3c4 , 0x16 , pVBInfo->SR16[ 1 ] ) ; DelayUS( 1000 ) ; XGI_SetReg((XGIIOADDRESS) P3c4 , 0x1B , 0x03 ) ; DelayUS( 500 ) ; - /* XGI_SetReg((XGIIOADDRESS) P3c4 , 0x18 , 0x31 ) ; */ XGI_SetReg((XGIIOADDRESS) P3c4 , 0x18 , pVBInfo->SR15[ 2 ][ XGINew_RAMType ] ) ; /* SR18 */ XGI_SetReg((XGIIOADDRESS) P3c4 , 0x19 , 0x00 ) ; XGI_SetReg((XGIIOADDRESS) P3c4 , 0x16 , pVBInfo->SR16[ 2 ] ) ; @@ -987,7 +897,6 @@ void XGINew_DDR2_MRS_340(PXGI_HW_DEVICE_INFO HwDeviceExtension, USHORT P3c4, DelayUS( 5) ; XGI_SetReg((XGIIOADDRESS) P3c4 , 0x1B , 0x00 ) ; /* SR1B */ DelayUS( 5 ) ; - /* XGI_SetReg((XGIIOADDRESS) P3c4 , 0x18 , 0x72 ) ; */ XGI_SetReg((XGIIOADDRESS) P3c4 , 0x18 , pVBInfo->SR15[ 2 ][ XGINew_RAMType ] ) ; /* SR18 */ XGI_SetReg((XGIIOADDRESS) P3c4 , 0x19 , 0x06 ) ; XGI_SetReg((XGIIOADDRESS) P3c4 , 0x16 , 0x05 ) ; @@ -1104,7 +1013,6 @@ void XGINew_DDR2_MRS_XG20( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT P3c4 XGI_SetReg( (XGIIOADDRESS) P3c4 , 0x16 , 0x05 ) ; XGI_SetReg( (XGIIOADDRESS) P3c4 , 0x16 , 0x85 ) ; - /* XGINew_SetReg1( P3c4 , 0x18 , 0x52 ) ;*/ /* MRS1 */ XGI_SetReg( (XGIIOADDRESS) P3c4 , 0x18 , 0x42 ) ; /* MRS1 */ XGI_SetReg( (XGIIOADDRESS) P3c4 , 0x19 , 0x02 ) ; XGI_SetReg( (XGIIOADDRESS) P3c4 , 0x16 , 0x05 ) ; @@ -1116,7 +1024,6 @@ void XGINew_DDR2_MRS_XG20( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT P3c4 XGI_SetReg( (XGIIOADDRESS) P3c4 , 0x1B , 0x00 ) ; /* SR1B */ DelayUS( 100 ) ; - /*XGINew_SetReg1( P3c4 , 0x18 , 0x52 ) ;*/ /* MRS2 */ XGI_SetReg( (XGIIOADDRESS) P3c4 , 0x18 , 0x42 ) ; /* MRS1 */ XGI_SetReg( (XGIIOADDRESS) P3c4 , 0x19 , 0x00 ) ; XGI_SetReg( (XGIIOADDRESS) P3c4 , 0x16 , 0x05 ) ; @@ -1656,33 +1563,6 @@ void XGINew_DDR_MRS(PVB_DEVICE_INFO pVBInfo) XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4 , 0x16 , data ) ; data |= 0xA0 ; XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4 , 0x16 , data ) ; -/* - else { - data &= 0x0F; - data |= 0x10; - XGI_SetReg((XGIIOADDRESS)pVBInfo->P3c4,0x16,data); - - if (!(pVBInfo->SR15[1][XGINew_RAMType] & 0x10)) - { - data &= 0x0F; - } - - data |= 0xC0; - XGI_SetReg((XGIIOADDRESS)pVBInfo->P3c4,0x16,data); - - - data &= 0x0F; - data |= 0x20; - XGI_SetReg((XGIIOADDRESS)pVBInfo->P3c4,0x16,data); - if (!(pVBInfo->SR15[1][XGINew_RAMType] & 0x10)) - { - data &= 0x0F; - } - - data |= 0x80; - XGI_SetReg((XGIIOADDRESS)pVBInfo->P3c4,0x16,data); - } -*/ } @@ -2206,13 +2086,6 @@ USHORT XGINew_SetDRAMSizeReg(int index, const USHORT DRAMTYPE_TABLE[][5], /* [2004/03/25] Vicent, Fix DRAM Sizing Error */ XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4 , 0x14 , ( XGI_GetReg((XGIIOADDRESS) pVBInfo->P3c4 , 0x14 ) & 0x0F ) | ( data & 0xF0 ) ) ; - - /* data |= XGINew_ChannelAB << 2 ; */ - /* data |= ( XGINew_DataBusWidth / 64 ) << 1 ; */ - /* XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4 , 0x14 , data ) ; */ - - /* should delay */ - /* XGINew_SetDRAMModeRegister340( pVBInfo ) ; */ } return( memsize ) ; } @@ -2255,13 +2128,6 @@ USHORT XGINew_SetDRAMSize20Reg( int index , USHORT DRAMTYPE_TABLE[][ 5 ], PVB_DE /* [2004/03/25] Vicent, Fix DRAM Sizing Error */ XGI_SetReg( (XGIIOADDRESS) pVBInfo->P3c4 , 0x14 , ( XGI_GetReg( (XGIIOADDRESS) pVBInfo->P3c4 , 0x14 ) & 0x0F ) | ( data & 0xF0 ) ) ; DelayUS( 15 ) ; - - /* data |= XGINew_ChannelAB << 2 ; */ - /* data |= ( XGINew_DataBusWidth / 64 ) << 1 ; */ - /* XGINew_SetReg1( pVBInfo->P3c4 , 0x14 , data ) ; */ - - /* should delay */ - /* XGINew_SetDRAMModeRegister340( pVBInfo ) ; */ } return( memsize ) ; } @@ -2907,12 +2773,9 @@ void SetPowerConsume ( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT XGI_P3d4Po void XGINew_InitVBIOSData(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo) { - - /* ULONG ROMAddr = (ULONG)HwDeviceExtension->pjVirtualRomBase; */ pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase ; pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress ; - /* pVBInfo->BaseAddr = ( USHORT )HwDeviceExtension->pjIOAddress ; */ pVBInfo->BaseAddr = ( ULONG )HwDeviceExtension->pjIOAddress ; pVBInfo->RelIO = HwDeviceExtension->pjIOAddress - 0x30; @@ -3024,7 +2887,6 @@ void ReadVBIOSTablData( UCHAR ChipType , PVB_DEVICE_INFO pVBInfo) } /* Volari customize data area start */ - /* if ( ChipType == XG40 ) */ if ( ChipType >= XG40 ) { ii = 0xE0 ; @@ -3149,13 +3011,6 @@ void ReadVBIOSTablData( UCHAR ChipType , PVB_DEVICE_INFO pVBInfo) for( j = 0 ; j < 4 ; j++ ) pVBInfo->SR16[ j ] = pVideoMemory[ i + j ] ; - /* Jong 10/03/2007 */ - /* - pVBInfo->CRCF = pVideoMemory[0x1CA]; - pVBInfo->DRAMTypeDefinition = pVideoMemory[0x1CB]; - pVBInfo->I2CDefinition = pVideoMemory[0x1D1]; - if ( ChipType == XG20 ) - pVBInfo->CR97 = pVideoMemory[0x1D2]; */ if ( ChipType == XG21 ) { if (pVideoMemory[ 0x67 ] & 0x80) @@ -3270,7 +3125,6 @@ void ReadVBIOSTablData( UCHAR ChipType , PVB_DEVICE_INFO pVBInfo) pVBInfo->IF_DEF_CH7007 = 0 ; if ( ( pVideoMemory[ 0x65 ] & 0x02 ) ) /* For XG21 CH7007 */ { - /* VideoDebugPrint((0, "ReadVBIOSTablData: pVideoMemory[ 0x65 ] =%x\n",pVideoMemory[ 0x65 ])); */ pVBInfo->IF_DEF_CH7007 = 1 ; /* [Billy] 07/05/03 */ } } @@ -3353,14 +3207,12 @@ void XGINew_DDR1x_MRS_XG20( USHORT P3c4 , PVB_DEVICE_INFO pVBInfo) XGI_SetReg((XGIIOADDRESS) P3c4 , 0x16 , 0x80 ) ; DelayUS( 60 ) ; XGI_SetReg((XGIIOADDRESS) P3c4 , 0x18 , pVBInfo->SR15[ 2 ][ XGINew_RAMType ] ) ; /* SR18 */ - /* XGI_SetReg((XGIIOADDRESS) P3c4 , 0x18 , 0x31 ) ; */ XGI_SetReg((XGIIOADDRESS) P3c4 , 0x19 , 0x01 ) ; XGI_SetReg((XGIIOADDRESS) P3c4 , 0x16 , 0x03 ) ; XGI_SetReg((XGIIOADDRESS) P3c4 , 0x16 , 0x83 ) ; DelayUS( 1000 ) ; XGI_SetReg((XGIIOADDRESS) P3c4 , 0x1B , 0x03 ) ; DelayUS( 500 ) ; - /* XGI_SetReg((XGIIOADDRESS) P3c4 , 0x18 , 0x31 ) ; */ XGI_SetReg((XGIIOADDRESS) P3c4 , 0x18 , pVBInfo->SR15[ 2 ][ XGINew_RAMType ] ) ; /* SR18 */ XGI_SetReg((XGIIOADDRESS) P3c4 , 0x19 , 0x00 ) ; XGI_SetReg((XGIIOADDRESS) P3c4 , 0x16 , 0x03 ) ; @@ -3425,12 +3277,9 @@ void XGINew_SetDRAMModeRegister_XG27( PXGI_HW_DEVICE_INFO HwDeviceExtension ) if ( XGINew_GetXG20DRAMType( HwDeviceExtension, pVBInfo) == 0 ) XGINew_DDR1x_MRS_XG20( pVBInfo->P3c4, pVBInfo ) ; else - /*XGINew_DDR2_MRS_XG27( HwDeviceExtension , pVBInfo->P3c4 , pVBInfo ) ;*/ XGINew_DDRII_Bootup_XG27( HwDeviceExtension , pVBInfo->P3c4 , pVBInfo) ; - /*XGINew_SetReg1( pVBInfo->P3c4 , 0x1B , 0x03 ) ;*/ XGI_SetReg( (XGIIOADDRESS) pVBInfo->P3c4 , 0x1B , pVBInfo->SR15[ 3 ][ XGINew_RAMType ] ) ; /* SR1B */ - } /* -------------------------------------------------------- */ @@ -3698,4 +3547,3 @@ UCHAR GetXG27FPBits(PVB_DEVICE_INFO pVBInfo) return temp; } - diff --git a/src/vb_init.h b/src/vb_init.h index 7412a6e..3d59b3f 100644 --- a/src/vb_init.h +++ b/src/vb_init.h @@ -26,6 +26,7 @@ #ifndef _VBINIT_ #define _VBINIT_ + extern BOOLEAN XGIInitNew(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo); @@ -37,4 +38,3 @@ extern void ReadVBIOSTablData(UCHAR ChipType, PVB_DEVICE_INFO pVBInfo); extern XGI21_LVDSCapStruct XGI21_LCDCapList; #endif - diff --git a/src/vb_setmode.c b/src/vb_setmode.c index 682a653..6a69fff 100644 --- a/src/vb_setmode.c +++ b/src/vb_setmode.c @@ -300,11 +300,6 @@ InitTo330Pointer(UCHAR ChipType, PVB_DEVICE_INFO pVBInfo) pVBInfo->RefIndex = XGI330_RefIndex; pVBInfo->XGINEWUB_CRT1Table = XGI_CRT1Table; - /* add for new UNIVGABIOS */ - /* XGINew_UBLCDDataTable = (XGI_LCDDataTablStruct *) XGI_LCDDataTable ; */ - /* XGINew_UBTVDataTable = (XGI_TVDataTablStruct *) XGI_TVDataTable ; */ - - if (ChipType >= XG40) { (void) memcpy(pVBInfo->MCLKData, XGI340New_MCLKData, sizeof(XGI340New_MCLKData)); (void) memcpy(pVBInfo->ECLKData, XGI340_ECLKData, sizeof(XGI340_ECLKData)); @@ -329,7 +324,6 @@ InitTo330Pointer(UCHAR ChipType, PVB_DEVICE_INFO pVBInfo) pVBInfo->VBInfo = 0; pVBInfo->TVInfo = 0; - (void) memcpy(pVBInfo->SR15, XGI340_SR13, sizeof(XGI340_SR13)); (void) memcpy(pVBInfo->CR40, XGI340_CR41, sizeof(XGI340_CR41)); (void) memcpy(pVBInfo->SR25, XGI330_SR25, sizeof(XGI330_SR25)); @@ -350,7 +344,6 @@ InitTo330Pointer(UCHAR ChipType, PVB_DEVICE_INFO pVBInfo) pVBInfo->CRCF = XG40_CRCF; pVBInfo->DRAMTypeDefinition = XG40_DRAMTypeDefinition; - (void) memcpy(pVBInfo->CR49, XGI330_CR49, sizeof(XGI330_CR49)); pVBInfo->SR1F = XGI330_SR1F; pVBInfo->SR21 = XGI330_SR21; @@ -359,8 +352,6 @@ InitTo330Pointer(UCHAR ChipType, PVB_DEVICE_INFO pVBInfo) pVBInfo->SR24 = XGI330_SR24; pVBInfo->SR33 = XGI330_SR33; - - pVBInfo->CRT2Data_1_2 = XGI330_CRT2Data_1_2; pVBInfo->CRT2Data_4_D = XGI330_CRT2Data_4_D; pVBInfo->CRT2Data_4_E = XGI330_CRT2Data_4_E; @@ -387,11 +378,9 @@ InitTo330Pointer(UCHAR ChipType, PVB_DEVICE_INFO pVBInfo) pVBInfo->Ren525pGroup3 = XGI330_Ren525pGroup3; pVBInfo->Ren750pGroup3 = XGI330_Ren750pGroup3; - (void) memcpy(& pVBInfo->TimingH, XGI_TimingH, sizeof(XGI_TimingH)); (void) memcpy(& pVBInfo->TimingV, XGI_TimingV, sizeof(XGI_TimingV)); - /* Jong 10/17/2007; merge code */ pVBInfo->UpdateCRT1 = (XGI_XG21CRT1Struct *) XGI_UpdateCRT1Table ; pVBInfo->CHTVVCLKUNTSC = XGI330_CHTVVCLKUNTSC; @@ -405,28 +394,20 @@ InitTo330Pointer(UCHAR ChipType, PVB_DEVICE_INFO pVBInfo) else pVBInfo->LCDCapList = XGI_LCDCapList; - /* Jong 10/03/2007 */ if ( ( ChipType == XG21 ) || ( ChipType == XG27 ) ) pVBInfo->XG21_LVDSCapList = XGI21_LCDCapList ; pVBInfo->XGI_TVDelayList = XGI301TVDelayList; pVBInfo->XGI_TVDelayList2 = XGI301TVDelayList2; - pVBInfo->I2CDefinition = XG40_I2CDefinition; - /* Jong 10/03/2007 */ if (ChipType >= XG20) pVBInfo->CR97 = XG20_CR97; - - /* Jong 10/03/2007 */ if ( ChipType == XG27 ) { - /* pVBInfo->MCLKData = (XGI_MCLKDataStruct *) XGI27New_MCLKData ; */ (void) memcpy(pVBInfo->MCLKData, XGI27New_MCLKData, sizeof(XGI27New_MCLKData)); - - /* pVBInfo->CR40 = XGI27_cr41 ; */ (void) memcpy(pVBInfo->CR40, XGI27_cr41, sizeof(XGI27_cr41)); pVBInfo->CR97 = XG27_CR97 ; @@ -446,14 +427,8 @@ InitTo330Pointer(UCHAR ChipType, PVB_DEVICE_INFO pVBInfo) pVBInfo->pCR46 = &XG21_CR46 ; pVBInfo->pCR47 = &XG21_CR47 ; } - } - - - - - /* --------------------------------------------------------------------- */ /* Function : XGISetModeNew */ /* Input : */ @@ -465,7 +440,6 @@ XGISetModeNew(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo, USHORT ModeNo) { USHORT ModeIdIndex; - /* PUCHAR pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress ; */ USHORT temp_mode_no; pVBInfo->IF_DEF_LVDS = 0 ; @@ -510,15 +484,6 @@ XGISetModeNew(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo, /* Jong 10/03/2007 */ HwDeviceExtension->SpecialMode = FALSE; -/* Jong 11/27/2007 */ -#if 0 /* can't get pScrn */ -#if (defined(i386) || defined(__i386) || defined(__i386__) || defined(__AMD64__)) - vga_info = XGI_GetSetBIOSScratch(pScrn, 0x489, 0xff); -#else - vga_info = 0x11; /* set default mode 3 */ -#endif -#endif - PDEBUG(ErrorF("XGISetModeNew()...2\n")); if ( (!XGI_SearchModeID(pVBInfo->SModeIDTable, pVBInfo->EModeIDTable, 0x11, &ModeNo , &ModeIdIndex)) || @@ -546,9 +511,6 @@ XGISetModeNew(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo, /* Jong 10/03/2007 */ if (HwDeviceExtension->SpecialMode) { - - /* Jong 11/28/2007; pVBInfo field is not matching VGAINFO argument */ - /* XGI_SearchModeID( pVBInfo->SModeIDTable, pVBInfo->EModeIDTable, pVBInfo, &ModeNo , &ModeIdIndex ) ; */ XGI_SearchModeID( pVBInfo->SModeIDTable, pVBInfo->EModeIDTable, 0x11, &ModeNo , &ModeIdIndex ) ; if ( !(HwDeviceExtension->SpecifyTiming) ) { @@ -693,27 +655,6 @@ XGISetModeNew(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo, PDEBUG(ErrorF("XGISetModeNew()...9\n")); } -/* - if ( ModeNo <= 0x13 ) - { - modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; - } - else - { - modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; - } - pVBInfo->ModeType = modeflag&ModeInfoFlag ; - pVBInfo->SetFlag = 0x00 ; - pVBInfo->VBInfo = DisableCRT2Display ; - temp = XGINew_CheckMemorySize( HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ; - - if ( temp == 0 ) - return( 0 ) ; - - XGI_DisplayOff( HwDeviceExtension,pVBInfo) ; - XGI_SetCRT1Group( HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ; - XGI_DisplayOn( HwDeviceExtension, pVBInfo) ; -*/ ErrorF("Part2 0 = %x ", XGI_GetReg((XGIIOADDRESS) pVBInfo->Part2Port, 0x0)); XGI_UpdateModeInfo(HwDeviceExtension, pVBInfo); @@ -727,7 +668,6 @@ XGISetModeNew(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo, return (TRUE); } -#if 1 void XGI_SetCRTVCLK(PVB_DEVICE_INFO pVBInfo, double dwPixelClock) { struct factor @@ -826,79 +766,7 @@ struct factor kind[16]= XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4 , 0x2B , (unsigned char) sr2b) ; XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4 , 0x2C , (unsigned char) sr2c) ; } -#else -/* Jong 10/17/2007; merge code */ -void XGI_SetCRTVCLK(PVB_DEVICE_INFO pVBInfo, double dwPixelClock) -{ -struct factor -{ - int sr2b7; - int sr2c7; - int sr2c6; - int sr2c5; - int dividend ; - int divisor ; -}; - -struct factor kind[16]= -{ - {0,0,0,0,1,1}, - {0,0,0,1,1,2}, - {0,0,1,0,1,3}, - {0,0,1,1,1,4}, - {1,0,0,0,2,1}, - {1,0,0,1,2,2}, - {1,0,1,0,2,3}, - {1,0,1,1,2,4}, - {0,1,0,0,1,1}, - {0,1,0,1,1,4}, - {0,1,1,0,1,6}, - {0,1,1,1,1,8}, - {1,1,0,0,2,1}, - {1,1,0,1,2,4}, - {1,1,1,0,2,6}, - {1,1,1,1,2,8} -}; - int ii,jj,kk,ll,sr2b,sr2c,Numerator,DeNumerator; - double factor1,tempclock,vclk,temp1,min,clock; - - - vclk=(double)dwPixelClock; - min=99.0; - for(ii=2;ii<=31;ii++) /* (DeNumerator1)It's value must >=2 */ - { - for(jj=0;jj<=127;jj++) /* (Numerator1) */ - { - - for(kk=0;kk<=15;kk++) - { - tempclock=14.318*kind[kk].dividend*(jj+1)/(ii+1); - if ( (tempclock >= 150 ) && ( tempclock <= 380) ) - { - tempclock = tempclock / kind[kk].divisor ; - temp1=fabs(vclk-tempclock); - if(temp1<min) - { - clock=tempclock; - DeNumerator=ii; - Numerator=jj; - min=temp1; - factor1=(double) (kind[kk].dividend / kind[kk].divisor); - ll=kk; - } - } - } - } - } - sr2b=128*kind[ll].sr2b7+Numerator; - sr2c=128*kind[ll].sr2c7+64*kind[ll].sr2c6+32*kind[ll].sr2c5+DeNumerator; - - XGI_SetReg( (XGIIOADDRESS) pVBInfo->P3c4 , 0x2B , (unsigned char) sr2b) ; - XGI_SetReg( (XGIIOADDRESS) pVBInfo->P3c4 , 0x2C , (unsigned char) sr2c) ; -} -#endif -/* Jong 10/17/2007; merge code */ void XGI_SetCRTTiming( PXGI_HW_DEVICE_INFO pXGIHWDE, PVB_DEVICE_INFO pVBInfo @@ -944,11 +812,6 @@ void XGI_SetCRTTiming( HRS = HRS + 3; HRE = HRE + 3; - /* - HRS = HRS + 2; - HRE = HRE + 2; - */ - VT = VerticalActivePixel + VerticalFrontPorch + VerticalSyncWidth + VerticalBackPorch; VDE = VerticalActivePixel; VRS = VerticalActivePixel + VerticalFrontPorch; @@ -960,7 +823,6 @@ void XGI_SetCRTTiming( VDE = VDE - 1; VT = VT - 1; - temp = XGI_GetReg( pVBInfo->P3c4 , 0x06 ) ; temp = ((temp & 0x1c ) >> 2) * 8; @@ -1089,9 +951,6 @@ XGI_SetCRT1Group(PXGI_HW_DEVICE_INFO HwDeviceExtension, USHORT ModeNo, PDEBUG(ErrorF("XGI_SetCRT1Group()...1\n")); - /* Jong 10/19/2007; merge code */ - /* Jong 04/23/2008; All XG20,21,27 should do this */ - /* if ( HwDeviceExtension->jChipType == XG27 ) */ if ( HwDeviceExtension->jChipType >= XG20 ) { if ( pVBInfo->IF_DEF_LVDS == 0 ) @@ -1115,8 +974,6 @@ XGI_SetCRT1Group(PXGI_HW_DEVICE_INFO HwDeviceExtension, USHORT ModeNo, } } - /* Jong 10/05/2007; merge code */ - /* RefreshRateTableIndex = XGI_GetRatePtrCRT2( ModeNo, ModeIdIndex, pVBInfo); */ RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo, ModeIdIndex, pVBInfo); PDEBUG(ErrorF("XGI_SetCRT1Group()...3\n")); @@ -1135,8 +992,6 @@ XGI_SetCRT1Group(PXGI_HW_DEVICE_INFO HwDeviceExtension, USHORT ModeNo, PDEBUG(ErrorF("XGI_SetCRT1Group()...4\n")); - /* Jong 10/04/2007; merge code */ - /* if (HwDeviceExtension->jChipType == XG20) { */ if ( ( HwDeviceExtension->jChipType >= XG20 ) && ( HwDeviceExtension->jChipType < XG27 ) ) /* fix H/W DCLK/2 bug */ { @@ -1164,9 +1019,6 @@ XGI_SetCRT1Group(PXGI_HW_DEVICE_INFO HwDeviceExtension, USHORT ModeNo, { PDEBUG(ErrorF("XGI_SetCRT1Group()...4-2\n")); - /*XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~0x20 ) ;*/ /* Enable write GPIOF */ - /*XGINew_SetRegAND( pVBInfo->P3d4 , 0x48 , ~0x20 ) ;*/ /* P. DWN */ - /* XG21 CRT1 Timing */ if ( HwDeviceExtension->jChipType == XG27 ) XGI_SetXG27CRTC( ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo ); else @@ -1192,7 +1044,6 @@ XGI_SetCRT1Group(PXGI_HW_DEVICE_INFO HwDeviceExtension, USHORT ModeNo, } PDEBUG(ErrorF("XGI_SetCRT1Group()...4-5\n")); - /*XGINew_SetRegOR( pVBInfo->P3d4 , 0x48 , 0x20 ) ;*/ /* P. ON */ } } @@ -1215,8 +1066,6 @@ XGI_SetCRT1Group(PXGI_HW_DEVICE_INFO HwDeviceExtension, USHORT ModeNo, PDEBUG(ErrorF("XGI_SetCRT1Group()...6\n")); - /* XGI_LoadCharacter(); //dif ifdef TVFont */ - XGI_LoadDAC(ModeNo, ModeIdIndex, pVBInfo); PDEBUG(ErrorF("XGI_SetCRT1Group()...End\n")); } @@ -1271,16 +1120,6 @@ XGI_SetMiscRegs(USHORT StandTableIndex, const VB_DEVICE_INFO *pVBInfo) UCHAR Miscdata; Miscdata = pVBInfo->StandTable[StandTableIndex].MISC; /* Get Misc from file */ -/* - if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) - { - if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) - { - Miscdata |= 0x0C ; - } - } -*/ - XGI_SetRegByte((XGIIOADDRESS) pVBInfo->P3c2, Miscdata); /* Set Misc(3c2) */ } @@ -1399,21 +1238,7 @@ XGI_ClearExt1Regs(unsigned ModeNo, const VB_DEVICE_INFO *pVBInfo) for (i = 0x0A; i <= 0x0E; i++) { XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4, i, 0x00); } - - /* This code came from the old XGI_New_ClearExt1Regs in init.c. Since - * it wasn't included in the newer code drop from XGI, I'm not sure if - * it's necessary on the Volari chips. I've included it here, ifdefed - * out, for future reference. - * - idr - */ -#if 0 - XGI_SetRegAND(pVBInfo->P3c4, 0x37, 0xFE); - if ((ModeNo == 0x06) || ((ModeNo >= 0x0e) && (ModeNo <= 0x13))) { - XGI_SetReg(pVBInfo->P3c4, 0x0e, 0x20); - } -#else (void) ModeNo; -#endif } /* Jong 10/17/2007; merge code */ @@ -1425,14 +1250,10 @@ XGI_ClearExt1Regs(unsigned ModeNo, const VB_DEVICE_INFO *pVBInfo) /* --------------------------------------------------------------------- */ UCHAR XGI_SetDefaultVCLK( PVB_DEVICE_INFO pVBInfo ) { - /* Jong 04/22/2008; XGINew_ -> XGI_*/ - /* Jong 04/23/2008; coding error: VCLKData[0]-> 0x10:25MHz; VCLKData[1]-> 0x20:28MHz */ - /* XGI_SetRegANDOR( (XGIIOADDRESS) pVBInfo->P3c4 , 0x31 , ~0x30 , 0x20 ) ; */ XGI_SetRegANDOR( (XGIIOADDRESS) pVBInfo->P3c4 , 0x31 , ~0x30 , 0x10 ) ; XGI_SetReg( (XGIIOADDRESS) pVBInfo->P3c4 , 0x2B , pVBInfo->VCLKData[ 0 ].SR2B ) ; XGI_SetReg( (XGIIOADDRESS) pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ 0 ].SR2C ) ; - /* XGI_SetRegANDOR( (XGIIOADDRESS) pVBInfo->P3c4 , 0x31 , ~0x30 , 0x10 ) ; */ XGI_SetRegANDOR( (XGIIOADDRESS) pVBInfo->P3c4 , 0x31 , ~0x30 , 0x20 ) ; XGI_SetReg( (XGIIOADDRESS) pVBInfo->P3c4 , 0x2B , pVBInfo->VCLKData[ 1 ].SR2B ) ; XGI_SetReg( (XGIIOADDRESS) pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ 1 ].SR2C ) ; @@ -1508,13 +1329,6 @@ XGI_GetRatePtrCRT2(PXGI_HW_DEVICE_INFO HwDeviceExtension, USHORT ModeNo, USHORT /* Do the similar adjustment like XGISearchCRT1Rate() */ if ( HwDeviceExtension->jChipType >= XG20 ) /* for XG20, XG21, XG27 */ { - /* - if ( pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag & XG2xNotSupport ) - { - index++; - } - */ - if ( ( pVBInfo->RefIndex[ RefreshRateTableIndex ].XRes == 800 ) && ( pVBInfo->RefIndex[ RefreshRateTableIndex ].YRes == 600 ) ) { @@ -1798,10 +1612,6 @@ XGI_SetCRT1Timing_H(PVB_DEVICE_INFO pVBInfo, UCHAR data, data1, pushax; USHORT i, j; - /* XGI_SetReg((XGIIOADDRESS) pVBInfo->P3d4 , 0x51 , 0 ) ; */ - /* XGI_SetReg((XGIIOADDRESS) pVBInfo->P3d4 , 0x56 , 0 ) ; */ - /* XGI_SetRegANDOR((XGIIOADDRESS) pVBInfo->P3d4 ,0x11 , 0x7f , 0x00 ) ; */ - data = (UCHAR) XGI_GetReg((XGIIOADDRESS) pVBInfo->P3d4, 0x11); /* unlock cr0-7 */ data &= 0x7F; XGI_SetReg((XGIIOADDRESS) pVBInfo->P3d4, 0x11, data); @@ -1869,10 +1679,6 @@ XGI_SetCRT1Timing_V(USHORT ModeIdIndex, USHORT ModeNo, UCHAR data; USHORT i, j; - /* XGI_SetReg((XGIIOADDRESS) pVBInfo->P3d4 , 0x51 , 0 ) ; */ - /* XGI_SetReg((XGIIOADDRESS) pVBInfo->P3d4 , 0x56 , 0 ) ; */ - /* XGI_SetRegANDOR((XGIIOADDRESS) pVBInfo->P3d4 , 0x11 , 0x7f , 0x00 ) ; */ - for (i = 0x00; i <= 0x01; i++) { data = pVBInfo->TimingV.data[i]; XGI_SetReg((XGIIOADDRESS) pVBInfo->P3d4, (USHORT) (i + 6), data); @@ -2069,8 +1875,6 @@ void XGI_SetXG27CRTC(USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableI if ( ModeNo <= 0x13 ) { - /* Jong 10/05/2007; merge code */ - /* StandTableIndex = XGI_GetModePtr( ModeNo , ModeIdIndex, pVBInfo ) ; */ StandTableIndex = XGI_GetModePtr( pVBInfo->SModeIDTable, pVBInfo->ModeType, ModeNo, ModeIdIndex); @@ -2229,13 +2033,11 @@ void XGI_SetXG21LCD(PVB_DEVICE_INFO pVBInfo,USHORT RefreshRateTableIndex,USHORT if ( ModeNo <= 0x13 ) { /* Jong 07/31/2009; might use XGINew_P3cc instead */ -#if 1 b3CC = (UCHAR) XGI_GetRegByte( (XGIIOADDRESS) XGI_P3cc ) ; if ( b3CC & 0x40 ) XGI_SetRegOR( (XGIIOADDRESS) pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */ if ( b3CC & 0x80 ) XGI_SetRegOR( (XGIIOADDRESS) pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */ -#endif } else { @@ -2246,7 +2048,6 @@ void XGI_SetXG21LCD(PVB_DEVICE_INFO pVBInfo,USHORT RefreshRateTableIndex,USHORT } } -/* Jong 10/04/2007; merge code */ void XGI_SetXG27LCD(PVB_DEVICE_INFO pVBInfo,USHORT RefreshRateTableIndex,USHORT ModeNo) { ULONG Data , Temp , b3CC ; @@ -2306,13 +2107,11 @@ void XGI_SetXG27LCD(PVB_DEVICE_INFO pVBInfo,USHORT RefreshRateTableIndex,USHORT PDEBUG(ErrorF("XGI_SetXG27LCD()...7-1-XGI_P3cc=%d\n", XGI_P3cc)); /* Jong 07/31/2009; might use XGINew_P3cc instead */ -#if 1 b3CC = (UCHAR) XGI_GetRegByte( (XGIIOADDRESS) XGI_P3cc ) ; if ( b3CC & 0x40 ) XGI_SetRegOR( (XGIIOADDRESS) pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */ if ( b3CC & 0x80 ) XGI_SetRegOR( (XGIIOADDRESS) pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */ -#endif PDEBUG(ErrorF("XGI_SetXG27LCD()...7-2\n")); } @@ -2424,9 +2223,6 @@ XGI_SetCRT1DE(PXGI_HW_DEVICE_INFO HwDeviceExtension, USHORT ModeNo, tempcx = 8; - /* if ( !( modeflag & Charx8Dot ) ) */ - /* tempcx = 9 ; */ - tempax /= tempcx; tempax -= 1; tempbx -= 1; @@ -2691,10 +2487,6 @@ XGI_SetCRT1FIFO(USHORT ModeNo, PXGI_HW_DEVICE_INFO HwDeviceExtension, XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4, 0x08, 0x34); data = XGI_GetReg((XGIIOADDRESS) pVBInfo->P3c4, 0x09); - /* Jong 02/06/2009; performance; add 10 for WinBench 99 */ - /* Jong 02/13/2009; might cause threshold noise of display; not sure */ - /* data &= 0xF0; - XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4, 0x09, data); */ data &= 0xC0 ; XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4 , 0x09 , data | 0x30) ; @@ -2773,7 +2565,6 @@ XGI_SetCRT1ModeRegs(PXGI_HW_DEVICE_INFO HwDeviceExtension, data2 |= 0x20; XGI_SetRegANDOR((XGIIOADDRESS) pVBInfo->P3c4, 0x06, ~0x3F, data2); - /* XGI_SetReg((XGIIOADDRESS)pVBInfo->P3c4,0x06,data2); */ resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo); if (ModeNo <= 0x13) xres = pVBInfo->StResInfo[resindex].HTotal; @@ -2847,7 +2638,6 @@ XGI_SetCRT1ModeRegs(PXGI_HW_DEVICE_INFO HwDeviceExtension, data = 0x6c; XGI_SetReg((XGIIOADDRESS) pVBInfo->P3d4, 0x52, data); } - } @@ -2894,16 +2684,6 @@ XGI_SetVCLKState(PXGI_HW_DEVICE_INFO HwDeviceExtension, USHORT ModeNo, XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4, 0x1F, data); } - /* Jong for Adavantech LCD ripple issue - if ((VCLK >= 0) && (VCLK < 135)) - data2 = 0x03; - else if ((VCLK >= 135) && (VCLK < 160)) - data2 = 0x02; - else if ((VCLK >= 160) && (VCLK < 260)) - data2 = 0x01; - else if (VCLK > 260) - data2 = 0x00; */ - data2 = 0x00 ; XGI_SetRegANDOR((XGIIOADDRESS) pVBInfo->P3c4, 0x07, 0xFC, data2); @@ -2913,7 +2693,6 @@ XGI_SetVCLKState(PXGI_HW_DEVICE_INFO HwDeviceExtension, USHORT ModeNo, { XGI_SetRegANDOR( (XGIIOADDRESS) pVBInfo->P3c4 , 0x40 , 0xFC , data2&0x03 ) ; } - } @@ -3072,9 +2851,6 @@ XGI_SetLCDAGroup(USHORT ModeNo, USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo) { USHORT RefreshRateTableIndex; - /* USHORT temp ; */ - - /* pVBInfo->SelectCRT2Rate = 0 ; */ pVBInfo->SetFlag |= ProgrammingCRT2; RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo, ModeIdIndex, pVBInfo); @@ -3189,7 +2965,6 @@ XGI_ModCRT1Regs(USHORT ModeNo, USHORT ModeIdIndex, USHORT tempbx, i; XGI_LVDSCRT1HDataStruct *LCDPtr = NULL; XGI_LVDSCRT1VDataStruct *LCDPtr1 = NULL; - /* XGI330_CHTVDataStruct *TVPtr = NULL ; */ if (ModeNo <= 0x13) index = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC; @@ -3373,7 +3148,6 @@ XGI_SetLVDSRegs(USHORT ModeNo, USHORT ModeIdIndex, else tempbx = LCDPtr->LCDVRS; - /* tempbx = tempbx >> 4 ; */ tempcx = push1; if (pVBInfo->LCDInfo & EnableScalingLCD) @@ -3750,8 +3524,6 @@ XGI_GetVBInfo(USHORT ModeNo, USHORT ModeIdIndex, tempbx |= SetCRT2ToYPbPr; } } - - /* tempbx |= SetCRT2ToYPbPr ; */ } } } @@ -4078,16 +3850,8 @@ XGI_GetLCDInfo(USHORT ModeNo, USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo) tempbx |= SetLCDtoNonExpanding; /* set to center in 1280x1024 LCDB for Panel1400x1050 */ } -/* - if ( tempax & LCDBToA ) - { - tempbx |= SetLCDBToA ; - } -*/ - if (pVBInfo->IF_DEF_ExpLink == 1) { if (modeflag & HalfDCLK) { - /* if ( !( pVBInfo->LCDInfo&LCDNonExpanding ) ) */ if (!(tempbx & SetLCDtoNonExpanding)) { tempbx |= EnableLVDSDDA; } @@ -4150,13 +3914,6 @@ XGI_GetLCDInfo(USHORT ModeNo, USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo) return (1); } -/* Jong 10/04/2007; defined in init.c */ -/* Function : XGI_SearchModeID */ -/* Input : */ -/* Output : */ -/* Description : */ -/* --------------------------------------------------------------------- */ - /* --------------------------------------------------------------------- */ /* Function : */ /* Input : */ @@ -4176,8 +3933,6 @@ XGINew_CheckMemorySize(PXGI_HW_DEVICE_INFO HwDeviceExtension, USHORT ModeNo, modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; } - /* ModeType = modeflag&ModeInfoFlag ; // Get mode type */ - memorysize = modeflag & MemoryInfoFlag; memorysize = memorysize > MemorySizeShift; memorysize++; /* Get memory size */ @@ -4748,8 +4503,6 @@ XGI_GetCRT2Data(USHORT ModeNo, USHORT ModeIdIndex, tempbx = 775; else if (pVBInfo->VGAVDE == 600) tempbx = 775; - /* else if(pVBInfo->VGAVDE==350) tempbx=560; */ - /* else if(pVBInfo->VGAVDE==400) tempbx=640; */ else tempbx = 768; } @@ -5142,13 +4895,6 @@ XGI_GetOffset(USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, } else return( temp * colordepth ) ; - - /* - if ((ModeNo >= 0x26) && (ModeNo <= 0x28)) { - return (temp * colordepth + (colordepth >> 1)); - } - else - return (temp * colordepth); */ } @@ -5188,7 +4934,6 @@ XGI_PreSetGroup1(USHORT ModeNo, USHORT ModeIdIndex, XGI_SetCRT2Offset(ModeNo, ModeIdIndex, RefreshRateTableIndex, HwDeviceExtension, pVBInfo); XGI_SetCRT2FIFO(pVBInfo); - /* XGI_SetCRT2Sync(ModeNo,RefreshRateTableIndex); */ for (tempcx = 4; tempcx < 7; tempcx++) { XGI_SetReg((XGIIOADDRESS) pVBInfo->Part1Port, tempcx, 0x0); @@ -5391,8 +5136,6 @@ XGI_SetLockRegs(USHORT ModeNo, USHORT ModeIdIndex, temp = 0xFF; /* set MAX HT */ XGI_SetReg((XGIIOADDRESS) pVBInfo->Part1Port, 0x03, temp); - /* if ( modeflag & Charx8Dot ) tempcx = 0x08 ; */ - /* else */ tempcx = 0x08; if (pVBInfo->VBType & (VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) @@ -5461,7 +5204,6 @@ XGI_SetLockRegs(USHORT ModeNo, USHORT ModeIdIndex, } } else { - /* tempcx = tempbx & 0x00FF ; */ tempbx = (tempbx & 0xFF00) >> 8; tempcx = (tempcx + tempbx) >> 1; temp = (tempcx & 0x00FF) + 2; @@ -6352,7 +6094,6 @@ XGI_SetLCDRegs(USHORT ModeNo, USHORT ModeIdIndex, tempax = pVBInfo->VT; tempbx = pVBInfo->LCDVRS; - /* if ( SetLCD_Info & EnableScalingLCD ) */ tempcx += tempbx; if (tempcx >= tempax) tempcx -= tempax; @@ -6406,7 +6147,6 @@ XGI_SetLCDRegs(USHORT ModeNo, USHORT ModeIdIndex, tempcx = tempax; tempax = pVBInfo->HT; tempbx = pVBInfo->LCDHRS; - /* if ( SetLCD_Info & EnableScalingLCD) */ if (XGI_IsLCDDualLink(pVBInfo)) { tempax = tempax >> 1; tempbx = tempbx >> 1; @@ -6770,7 +6510,6 @@ XGI_SetGroup4(USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, if (XGI_IsLCDDualLink(pVBInfo)) tempax = tempax >> 1; - /* if((pVBInfo->VBInfo&(SetCRT2ToLCD))||((pVBInfo->TVInfo&SetYPbPrMode525p)||(pVBInfo->TVInfo&SetYPbPrMode750p))) { */ if (pVBInfo->VBInfo & SetCRT2ToLCD) { if (tempax > 800) tempax -= 800; @@ -6785,35 +6524,6 @@ XGI_SetGroup4(USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, } tempax -= 1; -/* - if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToHiVisionTV ) ) - { - if ( pVBInfo->VBType & VB_XGI301LV ) - { - if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i ) ) ) - { - if ( pVBInfo->VGAHDE > 800 ) - { - if ( pVBInfo->VGAHDE == 1024 ) - tempax = ( tempax * 25 / 32 ) - 1 ; - else - tempax = ( tempax * 20 / 32 ) - 1 ; - } - } - } - else - { - if ( pVBInfo->VGAHDE > 800 ) - { - if ( pVBInfo->VGAHDE == 1024 ) - tempax = ( tempax * 25 / 32 ) - 1 ; - else - tempax = ( tempax * 20 / 32 ) - 1 ; - } - } - } -*/ - temp = (tempax & 0xFF00) >> 8; temp = ((temp & 0x0003) << 4); XGI_SetReg((XGIIOADDRESS) pVBInfo->Part4Port, 0x1E, temp); @@ -6876,7 +6586,6 @@ XGI_SetGroup5(USHORT ModeNo, USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo) (pVBInfo-> VBInfo & (SetInSlaveMode | LoadDACFlag | CRT2DisplayFlag))) { XGINew_EnableCRT2(pVBInfo); - /* LoadDAC2(pVBInfo->Part5Port,ModeNo,ModeIdIndex); */ } } return; @@ -6950,8 +6659,6 @@ XGI_GetLcdPtr(USHORT BX, USHORT ModeNo, USHORT ModeIdIndex, else if ((tempbx == 3) || (tempbx == 8)) tempcx = LVDSDesDataLen2; } - /* mov di, word ptr cs:LCDDataList[bx] */ - /* tempdi=pVideoMemory[LCDDataList+tempbx*2]|(pVideoMemory[LCDDataList+tempbx*2+1]<<8); */ switch (tempbx) { case 0: @@ -7566,20 +7273,6 @@ XGI_BacklightByDrv(PVB_DEVICE_INFO pVBInfo) return FALSE; } - -/* --------------------------------------------------------------------- */ -/* Function : XGI_FirePWDDisable */ -/* Input : */ -/* Output : */ -/* Description : Turn off VDD & Backlight : Fire disable procedure */ -/* --------------------------------------------------------------------- */ -/* -void XGI_FirePWDDisable( PVB_DEVICE_INFO pVBInfo ) -{ - XGI_SetRegANDOR((XGIIOADDRESS) pVBInfo->Part1Port , 0x26 , 0x00 , 0xFC ) ; -} -*/ - /* --------------------------------------------------------------------- */ /* Function : XGI_FirePWDEnable */ /* Input : */ @@ -7680,7 +7373,6 @@ UCHAR XG21GPIODataTransfer(UCHAR ujDate) for (i=0; i<8; i++) { ujRet = ujRet << 1; - /* ujRet |= GETBITS(ujDate >> i, 0:0); */ ujRet |= (ujDate >> i) & 1; } @@ -8159,8 +7851,6 @@ void XGI_SetXG21LVDSPara(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBIn XGI_GetRegByte( (XGIIOADDRESS) pVBInfo->P3da ) ; /* reset 3da */ } - - } /* Jong 10/04/2007; merge code */ @@ -9006,13 +8696,7 @@ XGI_SetDelayComp(PVB_DEVICE_INFO pVBInfo) if (pVBInfo->VBInfo & SetCRT2ToDualEdge) tempbl = tempbl >> 4; -/* - if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) - tempbl = CRT2Delay1 ; // Get CRT2 Delay - if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) - tempbl = CRT2Delay2 ; -*/ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { index = XGI_GetLCDCapPtr(pVBInfo); /* Get LCD Delay */ tempbh = pVBInfo->LCDCapList[index].LCD_DelayCompensation; @@ -9123,19 +8807,6 @@ XGI_SetLCDCap_A(USHORT tempcx, PVB_DEVICE_INFO pVBInfo) (USHORT) (0x30 | (tempcx & 0x00C0))); XGI_SetRegANDOR((XGIIOADDRESS) pVBInfo->Part1Port, 0x1A, 0x7F, 0x00); } - -/* - if ( tempcx & EnableLCD24bpp ) // 24bits - { - XGI_SetRegANDOR((XGIIOADDRESS)pVBInfo->Part1Port,0x19, 0x0F,(USHORT)(0x30|(tempcx&0x00C0)) ); - XGI_SetRegANDOR((XGIIOADDRESS)pVBInfo->Part1Port,0x1A,0x7F,0x00); - } - else - { - XGI_SetRegANDOR((XGIIOADDRESS)pVBInfo->Part1Port,0x19, 0x0F,(USHORT)(0x20|(tempcx&0x00C0)) );//Enable Dither - XGI_SetRegANDOR((XGIIOADDRESS)pVBInfo->Part1Port,0x1A,0x7F,0x80); - } -*/ } @@ -9450,7 +9121,6 @@ XGI_SetCRT2ModeRegs(USHORT ModeNo, PXGI_HW_DEVICE_INFO HwDeviceExtension, SHORT tempcl; UCHAR tempah; - /* XGI_SetReg((XGIIOADDRESS) pVBInfo->Part1Port , 0x03 , 0x00 ) ; // fix write part1 index 0 BTDRAM bit Bug */ tempah = 0; if (!(pVBInfo->VBInfo & DisableCRT2Display)) { tempah = XGI_GetReg((XGIIOADDRESS) pVBInfo->Part1Port, 0x00); @@ -9474,39 +9144,6 @@ XGI_SetCRT2ModeRegs(USHORT ModeNo, PXGI_HW_DEVICE_INFO HwDeviceExtension, } } -/* 0210 shampoo - if ( pVBInfo->VBInfo & DisableCRT2Display ) - { - tempah = 0 ; - } - - XGI_SetReg((XGIIOADDRESS) pVBInfo->Part1Port , 0x00 , tempah ) ; - if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD ) ) - { - tempcl = pVBInfo->ModeType ; - if ( ModeNo > 0x13 ) - { - tempcl -= ModeVGA ; - if ( ( tempcl > 0 ) || ( tempcl == 0 ) ) - { - tempah=(0x008>>tempcl) ; - if ( tempah == 0 ) - tempah = 1 ; - tempah |= 0x040; - } - } - else - { - tempah = 0x040 ; - } - - if ( pVBInfo->VBInfo & SetInSlaveMode ) - { - tempah = ( tempah ^ 0x050 ) ; - } - } -*/ - XGI_SetReg((XGIIOADDRESS) pVBInfo->Part1Port, 0x00, tempah); tempah = 0x08; tempbl = 0xf0; @@ -9574,14 +9211,11 @@ XGI_SetCRT2ModeRegs(USHORT ModeNo, PXGI_HW_DEVICE_INFO HwDeviceExtension, tempah |= 0x080; if (pVBInfo->VBInfo & SetCRT2ToTV) { - /* if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) */ - /* { */ tempah |= 0x020; if (ModeNo > 0x13) { if (pVBInfo->VBInfo & DriverMode) tempah = tempah ^ 0x20; } - /* } */ } XGI_SetRegANDOR((XGIIOADDRESS) pVBInfo->Part4Port, 0x0D, ~0x0BF, @@ -9592,11 +9226,8 @@ XGI_SetCRT2ModeRegs(USHORT ModeNo, PXGI_HW_DEVICE_INFO HwDeviceExtension, tempah |= 0x40; if (pVBInfo->VBInfo & SetCRT2ToTV) { - /* if ( ( !( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) ) && ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) ) */ - /* { */ if (pVBInfo->TVInfo & RPLLDIV2XO) tempah |= 0x40; - /* } */ } if ((pVBInfo->LCDResInfo == Panel1280x1024) @@ -10144,12 +9775,8 @@ void XGIInitMiscVBInfo(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pV if ( (XGI_GetReg((XGIIOADDRESS) pVBInfo->P3d4, 0x38) >> 5 & 0x07) == 0x03 ) /*CH7007 CR38 D[7-5]=011b*/ { pVBInfo->IF_DEF_CH7007 = 1 ; - /* HwDeviceExtension->bCH7007 = 1; */ XGI_SetReg((XGIIOADDRESS) pVBInfo->P3c4, 0x30, 0x09); /* For if (pHWDE->bVGAEnabled)== 0 */ -/* if( HwDeviceExtension->pDevice == NULL ) */ - HwDeviceExtension->pDevice= HwDeviceExtension; - } } @@ -10165,4 +9792,4 @@ void XGIInitMiscVBInfo(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pV } PDEBUG(ErrorF("XGIInitMiscVBInfo()...End\n")); -}
\ No newline at end of file +} diff --git a/src/vb_struct.h b/src/vb_struct.h index 4007f06..1bb13dd 100644 --- a/src/vb_struct.h +++ b/src/vb_struct.h @@ -145,7 +145,6 @@ typedef struct _XGI_Ext2Struct UCHAR ModeID; USHORT XRes; USHORT YRes; - /* USHORT ROM_OFFSET; */ } XGI_Ext2Struct; @@ -433,15 +432,6 @@ struct _VB_DEVICE_INFO ULONG VGAVT,VGAHT,VGAVDE,VGAHDE; ULONG VT,HT,VDE,HDE; ULONG LCDHRS,LCDVRS,LCDHDES,LCDVDES; - /* - USHORT P3c4,P3d4,P3c0,P3ce,P3c2,P3cc; - USHORT P3ca,P3c6,P3c7,P3c8,P3c9,P3da; - USHORT Part0Port,Part1Port,Part2Port; - USHORT Part3Port,Part4Port,Part5Port; - USHORT RVBHCFACT,RVBHCMAX,RVBHRS; - USHORT VGAVT,VGAHT,VGAVDE,VGAHDE; - USHORT VT,HT,VDE,HDE; - USHORT LCDHRS,LCDVRS,LCDHDES,LCDVDES; */ USHORT ModeType; USHORT IF_DEF_TRUMPION,IF_DEF_DSTN; @@ -460,7 +450,6 @@ struct _VB_DEVICE_INFO PUCHAR ROMAddr; PUCHAR FBAddr; ULONG BaseAddr; - /* USHORT BaseAddr; */ XGIIOADDRESS RelIO; DRAM4Type CR6B[CR6B_SIZE]; @@ -555,7 +544,6 @@ struct _VB_DEVICE_INFO const XGI_StandTableStruct *StandTable; const XGI_ExtStruct *EModeIDTable; const XGI_Ext2Struct *RefIndex; - /* XGINew_CRT1TableStruct *CRT1Table; */ const XGI_CRT1TableStruct *XGINEWUB_CRT1Table; const XGI_VCLKDataStruct *VCLKData; const XGI_VBVCLKDataStruct *VBVCLKData; diff --git a/src/vb_table.h b/src/vb_table.h index d49f233..601c256 100644 --- a/src/vb_table.h +++ b/src/vb_table.h @@ -1022,17 +1022,6 @@ static const XGI330_LCDDataStruct XGI_ExtLCD1024x768Data[]= { 1, 1,1344, 806,1344, 806} }; -/*XGI330_LCDDataStruct XGI_St2LCD1024x768Data[]= -{ - { 62, 25, 800, 546,1344, 806}, - { 32, 15, 930, 546,1344, 806}, - { 62, 25, 800, 546,1344, 806}, - { 104, 45, 945, 496,1344, 806}, - { 62, 25, 800, 546,1344, 806}, - { 31, 18,1008, 624,1344, 806}, - { 1, 1,1344, 806,1344, 806} -};*/ - static const XGI330_LCDDataStruct XGI_CetLCD1024x768Data[]= { { 1,1,1344,806,1344,806 }, /* ; 00 (320x200,320x400,640x200,640x400) */ @@ -3163,187 +3152,82 @@ static const XGI330_VCLKDataStruct XGI_VCLKData[]= { /* SR2B,SR2C,SR2D */ { 0x1B,0xE1,25 },/* 00 (25.175MHz) */ - { 0x4E,0xE4,28 },/* 01 (28.322MHz) */ - { 0x57,0xE4,31 },/* 02 (31.500MHz) */ - { 0xC3,0xC8,36 },/* 03 (36.000MHz) */ - { 0x42,0xE2,40 },/* 04 (40.000MHz) */ - { 0xFE,0xCD,43 },/* 05 (43.163MHz) */ - { 0x5D,0xC4,44 },/* 06 (44.900MHz) */ - { 0x52,0xE2,49 },/* 07 (49.500MHz) */ - { 0x53,0xE2,50 },/* 08 (50.000MHz) */ - { 0x74,0x67,52 },/* 09 (52.406MHz) */ - { 0x6D,0x66,56 },/* 0A (56.250MHz) */ - { 0x6C,0xC3,65 },/* 0B (65.000MHz) */ - { 0x46,0x44,67 },/* 0C (67.765MHz) */ - { 0xB1,0x46,68 },/* 0D (68.179MHz) */ - { 0xD3,0x4A,72 },/* 0E (72.852MHz) */ - { 0x29,0x61,75 },/* 0F (75.000MHz) */ - { 0x6E,0x46,76 },/* 10 (75.800MHz) */ - { 0x2B,0x61,78 },/* 11 (78.750MHz) */ - { 0x31,0x42,79 },/* 12 (79.411MHz) */ - { 0xAB,0x44,83 },/* 13 (83.950MHz) */ - { 0x46,0x25,84 },/* 14 (84.800MHz) */ - { 0x78,0x29,86 },/* 15 (86.600MHz) */ - { 0x62,0x44,94 },/* 16 (94.500MHz) */ - { 0x2B,0x41,104 },/* 17 (104.998MHz) */ - { 0x3A,0x23,105 },/* 18 (105.882MHz) */ - { 0x70,0x44,108 },/* 19 (107.862MHz) */ - { 0x3C,0x23,109 },/* 1A (109.175MHz) */ - { 0x5E,0x43,113 },/* 1B (113.309MHz) */ - { 0xBC,0x44,116 },/* 1C (116.406MHz) */ - { 0xE0,0x46,132 },/* 1D (132.258MHz) */ - { 0x54,0x42,135 },/* 1E (135.500MHz) */ - { 0x9C,0x22,139 },/* 1F (139.275MHz) */ - { 0x41,0x22,157 },/* 20 (157.500MHz) */ - { 0x70,0x24,162 },/* 21 (161.793MHz) */ - { 0x30,0x21,175 },/* 22 (175.000MHz) */ - { 0x4E,0x22,189 },/* 23 (188.520MHz) */ - { 0xDE,0x26,194 },/* 24 (194.400MHz) */ - { 0x62,0x06,202 },/* 25 (202.500MHz) */ - { 0x3F,0x03,229 },/* 26 (229.500MHz) */ - { 0xB8,0x06,234 },/* 27 (233.178MHz) */ - { 0x34,0x02,253 },/* 28 (252.699MHz) */ - { 0x58,0x04,255 },/* 29 (254.817MHz) */ - { 0x24,0x01,265 },/* 2A (265.728MHz) */ - { 0x9B,0x02,267 },/* 2B (266.952MHz) */ - { 0x70,0x05,270 },/* 2C (269.65567MHz) */ - { 0x25,0x01,272 },/* 2D (272.04199MHz) */ - { 0x9C,0x02,277 },/* 2E (277.015MHz) */ - { 0x27,0x01,286 },/* 2F (286.359985MHz) */ - { 0xB3,0x04,291 },/* 30 (291.13266MHz) */ - { 0xBC,0x05,292 },/* 31 (291.766MHz) */ - { 0xF6,0x0A,310 },/* 32 (309.789459MHz) */ - { 0x95,0x01,315 },/* 33 (315.195MHz) */ - { 0xF0,0x09,324 },/* 34 (323.586792MHz) */ - { 0xFE,0x0A,331 },/* 35 (330.615631MHz) */ - { 0xF3,0x09,332 },/* 36 (332.177612MHz) */ - { 0x5E,0x03,340 },/* 37 (340.477MHz) */ - { 0xE8,0x07,376 },/* 38 (375.847504MHz) */ - { 0xDE, 0x06,389 },/* 39 (388.631439MHz) */ - { 0x52,0x2A,54 },/* 3A (54.000MHz) */ - { 0x52,0x6A,27 },/* 3B (27.000MHz) */ - { 0x62,0x24,70 },/* 3C (70.874991MHz) */ - { 0x62,0x64,70 },/* 3D (70.1048912MHz) */ - { 0xA8,0x4C,30 },/* 3E (30.1048912MHz) */ - { 0x20,0x26,33 },/* 3F (33.7499957MHz) */ - { 0x31,0xc2,39 },/* 40 (39.77MHz) */ - { 0x11,0x21,30 },/* 41 (30MHz) }// NTSC 1024X768 */ - { 0x2E,0x48,25 },/* 42 (25.175MHz) }// ScaleLCD */ - { 0x24,0x46,25 },/* 43 (25.175MHz) */ - { 0x26,0x64,28 },/* 44 (28.322MHz) */ - { 0x37,0x64,40 },/* 45 (40.000MHz) */ - { 0xA1,0x42,108 },/* 46 (95.000MHz) }// QVGA */ - { 0x37,0x61,100 },/* 47 (100.00MHz) */ - { 0x78,0x27,108 },/* 48 (108.200MHz) */ - { 0xBF,0xC8,35 },/* 49 (35.2MHz) */ - { 0x66,0x43,123 },/* 4A (122.61Mhz) */ - { 0x2C,0x61,80 },/* 4B (80.350Mhz) */ - { 0x3B,0x61,108 },/* 4C (107.385Mhz) */ - - -/* { 0x60,0x36,30 },// 4D (30.200MHz) }// No use - - { 0x60,0x36,30 },// 4E (30.200MHz) }// No use - - { 0x60,0x36,30 },// 4F (30.200MHz) }// No use - - { 0x60,0x36,30 },// 50 (30.200MHz) }// CHTV - - { 0x40,0x4A,28 },// 51 (28.190MHz) - - { 0x9F,0x46,44 },// 52 (43.600MHz) - - { 0x97,0x2C,26 },// 53 (26.400MHz) - - { 0x44,0xE4,25 },// 54 (24.600MHz) - - { 0x7E,0x32,47 },// 55 (47.832MHz) - - { 0x8A,0x24,31 },// 56 (31.500MHz) - - { 0x97,0x2C,26 },// 57 (26.200MHz) - - { 0xCE,0x3C,39 },// 58 (39.000MHz) - - { 0x52,0x4A,36 },// 59 (36.000MHz) - -*/ { 0x69,0x61,191 }, /* 4D (190.96MHz ) */ { 0x4F,0x22,192 }, /* 4E (192.069MHz) */ { 0x28,0x26,322 }, /* 4F (322.273MHz) */ @@ -3355,196 +3239,88 @@ static const XGI330_VCLKDataStruct XGI_VCLKData[]= { 0x59,0x22,217 }, /* 55 (217.325MHz) */ { 0x29,0x01,300 }, /* 56 (299.505Mhz) */ { 0x52,0x63,74 }, /* 57 (74.25MHz) */ - - { 0xFF,0x00,0 }/* End mark */ }; static const XGI330_VCLKDataStruct XGI_VBVCLKData[]= { { 0x1B,0xE1,25 },/* 00 (25.175MHz) */ - { 0x4E,0xE4,28 },/* 01 (28.322MHz) */ - { 0x57,0xE4,31 },/* 02 (31.500MHz) */ - { 0xC3,0xC8,36 },/* 03 (36.000MHz) */ - { 0x42,0x47,40 },/* 04 (40.000MHz) */ - { 0xFE,0xCD,43 },/* 05 (43.163MHz) */ - { 0x5D,0xC4,44 },/* 06 (44.900MHz) */ - { 0x52,0x47,49 },/* 07 (49.500MHz) */ - { 0x53,0x47,50 },/* 08 (50.000MHz) */ - { 0x74,0x67,52 },/* 09 (52.406MHz) */ - { 0x6D,0x66,56 },/* 0A (56.250MHz) */ - { 0x35,0x62,65 },/* 0B (65.000MHz) */ - { 0x46,0x44,67 },/* 0C (67.765MHz) */ - { 0xB1,0x46,68 },/* 0D (68.179MHz) */ - { 0xD3,0x4A,72 },/* 0E (72.852MHz) */ - { 0x29,0x61,75 },/* 0F (75.000MHz) */ - { 0x6D,0x46,75 },/* 10 (75.800MHz) */ - { 0x41,0x43,78 },/* 11 (78.750MHz) */ - { 0x31,0x42,79 },/* 12 (79.411MHz) */ - { 0xAB,0x44,83 },/* 13 (83.950MHz) */ - { 0x46,0x25,84 },/* 14 (84.800MHz) */ - { 0x78,0x29,86 },/* 15 (86.600MHz) */ - { 0x62,0x44,94 },/* 16 (94.500MHz) */ - { 0x2B,0x22,104 },/* 17 (104.998MHz) */ - { 0x49,0x24,105 },/* 18 (105.882MHz) */ - { 0xF8,0x2F,108 },/* 19 (108.279MHz) */ - { 0x3C,0x23,109 },/* 1A (109.175MHz) */ - { 0x5E,0x43,113 },/* 1B (113.309MHz) */ - { 0xBC,0x44,116 },/* 1C (116.406MHz) */ - { 0xE0,0x46,132 },/* 1D (132.258MHz) */ - { 0xD4,0x28,135 },/* 1E (135.220MHz) */ - { 0xEA,0x2A,139 },/* 1F (139.275MHz) */ - { 0x41,0x22,157 },/* 20 (157.500MHz) */ - { 0x70,0x24,162 },/* 21 (161.793MHz) */ - { 0x30,0x21,175 },/* 22 (175.000MHz) */ - { 0x4E,0x22,189 },/* 23 (188.520MHz) */ - { 0xDE,0x26,194 },/* 24 (194.400MHz) */ - { 0x70,0x07,202 },/* 25 (202.500MHz) */ - { 0x3F,0x03,229 },/* 26 (229.500MHz) */ - { 0xB8,0x06,234 },/* 27 (233.178MHz) */ - { 0x34,0x02,253 },/* 28 (252.699997 MHz) */ - { 0x58,0x04,255 },/* 29 (254.817MHz) */ - { 0x24,0x01,265 },/* 2A (265.728MHz) */ - { 0x9B,0x02,267 },/* 2B (266.952MHz) */ - { 0x70,0x05,270 },/* 2C (269.65567 MHz) */ - { 0x25,0x01,272 },/* 2D (272.041992 MHz) */ - { 0x9C,0x02,277 },/* 2E (277.015MHz) */ - { 0x27,0x01,286 },/* 2F (286.359985 MHz) */ - { 0x3C,0x02,291 },/* 30 (291.132660 MHz) */ - { 0xEF,0x0A,292 },/* 31 (291.766MHz) */ - { 0xF6,0x0A,310 },/* 32 (309.789459 MHz) */ - { 0x95,0x01,315 },/* 33 (315.195MHz) */ - { 0xF0,0x09,324 },/* 34 (323.586792 MHz) */ - { 0xFE,0x0A,331 },/* 35 (330.615631 MHz) */ - { 0xF3,0x09,332 },/* 36 (332.177612 MHz) */ - { 0xEA,0x08,340 },/* 37 (340.477MHz) */ - { 0xE8,0x07,376 },/* 38 (375.847504 MHz) */ - { 0xDE,0x06,389 },/* 39 (388.631439 MHz) */ - { 0x52,0x2A,54 },/* 3A (54.000MHz) */ - { 0x52,0x6A,27 },/* 3B (27.000MHz) */ - - { 0x62,0x24,70 },/* 3C (70.874991MHz) */ - - { 0x62,0x64,70 },/* 3D (70.1048912MHz) */ - { 0xA8,0x4C,30 },/* 3E (30.1048912MHz) */ - { 0x20,0x26,33 },/* 3F (33.7499957MHz) */ - { 0x31,0xc2,39 },/* 40 (39.77MHz) */ - { 0x11,0x21,30 },/* 41 (30MHz) }// NTSC 1024X768 */ - { 0x2E,0x48,25 },/* 42 (25.175MHz) }// ScaleLCD */ - { 0x24,0x46,25 },/* 43 (25.175MHz) */ - { 0x26,0x64,28 },/* 44 (28.322MHz) */ - { 0x37,0x64,40 },/* 45 (40.000MHz) */ - { 0xA1,0x42,108 },/* 46 (95.000MHz) }// QVGA */ - { 0x37,0x61,100 },/* 47 (100.00MHz) */ - { 0x78,0x27,108 },/* 48 (108.200MHz) */ - { 0xBF,0xC8,35 },/* 49 (35.2MHz) */ - { 0x66,0x43,123 },/* 4A (122.61Mhz) */ - { 0x2C,0x61,80 },/* 4B (80.350Mhz) */ - { 0x3B,0x61,108 },/* 4C (107.385Mhz) */ - -/* - { 0x60,0x36,30 },// 4D (30.200MHz) }// No use - - { 0x60,0x36,30 },// 4E (30.200MHz) }// No use - - { 0x60,0x36,30 },// 4F (30.200MHz) }// No use - - { 0x60,0x36,30 },// 50 (30.200MHz) }// CHTV - - { 0x40,0x4A,28 },// 51 (28.190MHz) - - { 0x9F,0x46,44 },// 52 (43.600MHz) - - { 0x97,0x2C,26 },// 53 (26.400MHz) - - { 0x44,0xE4,25 },// 54 (24.600MHz) - - { 0x7E,0x32,47 },// 55 (47.832MHz) - - { 0x8A,0x24,31 },// 56 (31.500MHz) - - { 0x97,0x2C,26 },// 57 (26.200MHz) - - { 0xCE,0x3C,39 },// 58 (39.000MHz) - - { 0x52,0x4A,36 },// 59 (36.000MHz) -*/ { 0x69,0x61,191 }, /* 4D (190.96MHz ) */ { 0x4F,0x22,192 }, /* 4E (192.069MHz) */ { 0x28,0x26,322 }, /* 4F (322.273MHz) */ @@ -3556,8 +3332,6 @@ static const XGI330_VCLKDataStruct XGI_VBVCLKData[]= { 0x59,0x22,217 }, /* 55 (217.325MHz) */ { 0x29,0x01,300 }, /* 56 (299.505Mhz) */ { 0x52,0x63,74 }, /* 57 (74.25MHz) */ - - { 0xFF,0x00,0 } /* End mark */ }; @@ -868,17 +868,11 @@ void XGI_WaitBeginRetrace(XGIIOADDRESS RelIO); void XGI_WaitEndRetrace(XGIIOADDRESS RelIO); #include <unistd.h> -/* 2005/11/21 added by jjtseng */ #define DelayS(sec) usleep((sec)*1000000) #define DelayMS(millisec) usleep((millisec)*1000) #define DelayUS(microsec) usleep((microsec)) -/*~jjtseng 2005/11/21 */ Bool Volari_AccelInit(ScreenPtr pScreen) ; -/* void XGI_UnLockCRT2(PXGI_HW_DEVICE_INFO,USHORT BaseAddr); */ -/* void XGI_LockCRT2(PXGI_HW_DEVICE_INFO,USHORT BaseAddr); */ -/* void XGI_DisableBridge(PXGI_HW_DEVICE_INFO,USHORT BaseAddr); */ -/* void XGI_EnableBridge(PXGI_HW_DEVICE_INFO,USHORT BaseAddr); */ #endif extern void XGI_New_GetVBType(VB_DEVICE_INFO *XGI_Pr, PXGI_HW_DEVICE_INFO); diff --git a/src/xgi_accel.c b/src/xgi_accel.c index f87a130..86ebcad 100644 --- a/src/xgi_accel.c +++ b/src/xgi_accel.c @@ -362,7 +362,6 @@ void ResetVariableFor2DRegister() g_Fg = -1; g_trans_color=0; - /*----------------------------------------------------*/ } static void @@ -373,7 +372,6 @@ Volari_InitCmdQueue(ScrnInfoPtr pScrn) unsigned long ulCR55 ; unsigned long ulSR26 ; unsigned long temp ; - /* unsigned long ulFlag = 0 ; */ ResetVariableFor2DRegister(); @@ -512,11 +510,8 @@ Volari_InitCmdQueue(ScrnInfoPtr pScrn) /* XGI315 */ pXGI->cmdQueue_shareWP_only2D = ulXGITempRP; - /* pXGI->pCQ_shareWritePort = &(pXGI->cmdQueue_shareWP_only2D); */ Volari_UpdateHwWP(ulXGITempRP) ; - - MMIO_OUT32(pXGI->IOBase, 0x85C0, pXGI->cmdQueueOffset) ; @@ -584,17 +579,12 @@ Volari_DisableAccelerator(ScrnInfoPtr pScrn) | SR1E_ENABLE_3D_AGP_VERTEX_FETCH | SR1E_ENABLE_3D_COMMAND_PARSER | SR1E_ENABLE_3D)); -/* PDEBUG(ErrorF("Volari_DisableAccelerator(pScrn) Done, GBCount = %ld\n",GBCount)) ; */ } static void Volari_DisableCmdQueue(ScrnInfoPtr pScrn) { XGIPtr pXGI = XGIPTR(pScrn) ; - - /* Jong@08112009; bug fixing */ - /* andXGIIDXREG(XGISR, 0x26, 0x0F) ; */ - orXGIIDXREG(XGISR, 0x26, 0x01) ; andXGIIDXREG(XGISR, 0x26, 0x0C) ; } @@ -623,8 +613,7 @@ Volari_AccelInit(ScreenPtr pScreen) PDEBUG1(ErrorF("Volari_AccelInit()\n" )) ; -/* Jong 01/13/2009; support EXA */ -#ifdef XGI_USE_EXA /* ----------------------- EXA ----------------------- */ +#ifdef XGI_USE_EXA PDEBUG(ErrorF("--- EXA ---\n" )) ; if(pXGI->useEXA) { @@ -687,9 +676,7 @@ Volari_AccelInit(ScreenPtr pScreen) pXGI->EXADriverPtr->Composite = XGIComposite; pXGI->EXADriverPtr->DoneComposite = XGIDoneComposite; } -#endif /* EXA */ -#ifdef XGI_USE_EXA if(pXGI->useEXA) { /* if(!pSiS->NoAccel) { */ @@ -781,7 +768,6 @@ XGIPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg) uint16_t pitch; PACCELDEBUG(ErrorF("XGIPrepareSolid...\n")); - /* DisableDrawingFunctionDynamically(TRUE); */ /* Planemask not supported */ if((planemask & ((1 << pPixmap->drawable.depth) - 1)) != @@ -827,7 +813,6 @@ XGISolid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2) PACCELDEBUG(ErrorF("XGISolid...\n")); PACCELDEBUG(ErrorF("pXGI->CommandReg = 0x%x...\n", pXGI->CommandReg)); - /* DisableDrawingFunctionDynamically(FALSE); */ Volari_SetupDSTXY(x1, y1) Volari_SetupRect(x2-x1, y2-y1) ; @@ -853,7 +838,6 @@ XGIPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, int ydir, PACCELDEBUG(ErrorF("XGIPrepareCopy()...\n")); PACCELDEBUG(ErrorF("pSrcPixmap->devPrivate.ptr=0x%x, pDstPixmap->devPrivate.ptr=0x%x...\n", pSrcPixmap->devPrivate.ptr, pDstPixmap->devPrivate.ptr)); - /* DisableDrawingFunctionDynamically(TRUE); */ /* Planemask not supported */ if((planemask & ((1 << pSrcPixmap->drawable.depth) - 1)) != @@ -912,7 +896,6 @@ XGICopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY, int width, PACCELDEBUG(ErrorF("XGICopy()...\n")); PACCELDEBUG(ErrorF("srcX=%d, srcY=%d, dstX=%d, dstY=%d...\n", srcX, srcY, dstX, dstY)); PACCELDEBUG(ErrorF("pDstPixmap->devPrivate.ptr=0x%x...\n", pDstPixmap->devPrivate.ptr)); - /* DisableDrawingFunctionDynamically(FALSE); */ Volari_SetupSRCXY(srcX, srcY) Volari_SetupDSTXY(dstX, dstY) @@ -935,7 +918,6 @@ XGICheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, XGIPtr pXGI = XGIPTR(pScrn); PACCELDEBUG(ErrorF("XGICheckComposite()...\n")); - /* DisableDrawingFunctionDynamically(TRUE); */ xf86DrvMsg(0, 0, "CC: %d Src %x (fi %d ca %d) Msk %x (%d %d) Dst %x (%d %d)\n", op, pSrcPicture->format, pSrcPicture->filter, pSrcPicture->componentAlpha, @@ -961,7 +943,6 @@ XGIPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, XGIPtr pXGI = XGIPTR(pScrn); PACCELDEBUG(ErrorF("XGIPrepareComposite()...\n")); - /* DisableDrawingFunctionDynamically(TRUE); */ Volari_ResetCmd ; @@ -976,7 +957,6 @@ XGIComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, int dstX, XGIPtr pXGI = XGIPTR(pScrn); PACCELDEBUG(ErrorF("XGIComposite()...\n")); - /* DisableDrawingFunctionDynamically(FALSE); */ } static void diff --git a/src/xgi_accel.h b/src/xgi_accel.h index 5eb5801..d6347fd 100644 --- a/src/xgi_accel.h +++ b/src/xgi_accel.h @@ -46,19 +46,6 @@ #define XGIG2_SOLIDFILL #define XGIG2_8X8MONOPATFILL - -/* -#define XGIG2_COLOREXPSCANLN -#define XGIG2_SOLIDLINE -#define XGIG2_DASHEDLINE -#define XGIG2_S2SCOLOREXPANFILL -#define XGIG2_8X8COLORPATFILL -#define XGIG2_C2SCOLOREXPANFILL -#define XGIG2_IMAGEWRITE -#define XGIG2_COLOREXPSCANLN -#define XGIG2_IMAGEWRITE -*/ - #undef BR #define BR(x) (0x8200 | (x) << 2) @@ -123,7 +110,6 @@ extern unsigned long r_port, w_port ; extern int G2CmdQueLen; extern int Alignment ; -/* int GBCount = 0 ; */ extern void Volari_SetDefaultIdleWait(XGIPtr pXGI, unsigned HDisplay, unsigned depth); @@ -166,7 +152,6 @@ void XGIDumpCMDQueue(ScrnInfoPtr pScrn); #define Volari_SetupCMDFlag(flags) \ pXGI->CommandReg |= (flags); -#if 1 #define GuardBand(CS)\ {\ unsigned long lTemp ;\ @@ -190,46 +175,6 @@ void XGIDumpCMDQueue(ScrnInfoPtr pScrn); }while(lTemp < (CS)) ;\ }\ } -#else -#define GuardBand(CS)\ - {\ - unsigned long lTemp ; \ - \ - w_port = Volari_GetSwWP(); \ - lTemp = r_port - w_port + pXGI->cmdQueueSize ; \ - \ - if( ((lTemp & pXGI->cmdQueueSizeMask ) < (BandSize + CS)) && ( r_port != w_port ) ) \ - { \ - while ( 1 ) \ - { \ - r_port = Volari_GetHwRP(); \ - if(r_port == w_port) \ - break; \ - lTemp = r_port - w_port + pXGI->cmdQueueSize ; \ - if( (lTemp & pXGI->cmdQueueSizeMask ) >= (BandSize + CS) ) \ - break; \ - usleep(1);/*usleep(100);*//* Jong Lin 08-29-2005 */\ - } \ - } \ - } -#endif - -/* -#define GuardBand(CS)\ - {\ - long lTemp ; \ - w_port = Volari_GetSwWP(); \ - while ( 1 ) \ - { \ - r_port = Volari_GetHwRP(); \ - if(r_port == w_port)\ - break; \ - lTemp = r_port - w_port + pXGI->cmdQueueSize ; \ - if( (lTemp & pXGI->cmdQueueSizeMask ) >= (BandSize + CS) ) \ - break; \ - }\ - } -*/ #define Volari_DoCMD\ {\ @@ -258,13 +203,6 @@ void XGIDumpCMDQueue(ScrnInfoPtr pScrn); \ } -/********************************************************************** -#define Volari_SetupSRCBase(base) \ - if (G2CmdQueLen <= 0) Volari_Idle(pXGI);\ - MMIO_OUT32(pXGI->IOBase, BR(0), base);\ - G2CmdQueLen --; - **********************************************************************/ - #define Volari_SetupSRCBase(base) \ {\ unsigned long ulTemp ;\ @@ -294,14 +232,6 @@ void XGIDumpCMDQueue(ScrnInfoPtr pScrn); } -/*********************************************************************** -#define Volari_SetupSRCPitch(pitch) \ - if (G2CmdQueLen <= 0) Volari_Idle(pXGI);\ - MMIO_OUT16(pXGI->IOBase, BR(1), pitch);\ - G2CmdQueLen --; - -***********************************************************************/ - #define Volari_SetupSRCPitch(pitch) \ {\ unsigned long ulTemp ;\ @@ -331,13 +261,6 @@ void XGIDumpCMDQueue(ScrnInfoPtr pScrn); \ } -/*********************************************************************** -#define Volari_SetupSRCXY(x,y) \ - if (G2CmdQueLen <= 0) Volari_Idle(pXGI);\ - MMIO_OUT32(pXGI->IOBase, BR(2), (x)<<16 | (y) );\ - G2CmdQueLen --; -***********************************************************************/ - #define Volari_SetupSRCXY(x,y) \ {\ unsigned long ulTemp ;\ @@ -367,14 +290,6 @@ void XGIDumpCMDQueue(ScrnInfoPtr pScrn); } \ } -/*********************************************************************** -#define Volari_SetupDSTBase(base) \ - if (G2CmdQueLen <= 0) Volari_Idle(pXGI);\ - MMIO_OUT32(pXGI->IOBase, BR(4), base);\ - G2CmdQueLen --; - -***********************************************************************/ - #define Volari_SetupDSTBase(base) \ {\ unsigned long ulTemp ;\ @@ -403,14 +318,6 @@ void XGIDumpCMDQueue(ScrnInfoPtr pScrn); } \ } -/*********************************************************************** -#define Volari_SetupDSTXY(x,y) \ - if (G2CmdQueLen <= 0) Volari_Idle(pXGI);\ - MMIO_OUT32(pXGI->IOBase, BR(3), (x)<<16 | (y) );\ - G2CmdQueLen --; - -***********************************************************************/ - #define Volari_SetupDSTXY(x,y) \ {\ unsigned long ulTemp ;\ @@ -440,14 +347,6 @@ void XGIDumpCMDQueue(ScrnInfoPtr pScrn); } \ } -/*********************************************************************** -#define Volari_SetupDSTRect(x,y) \ - if (G2CmdQueLen <= 0) Volari_Idle(pXGI);\ - MMIO_OUT32(pXGI->IOBase, BR(5), (y)<<16 | (x) );\ - G2CmdQueLen --; - -***********************************************************************/ - #define Volari_SetupDSTRect(x,y) \ {\ unsigned long ulTemp ;\ @@ -479,23 +378,9 @@ void XGIDumpCMDQueue(ScrnInfoPtr pScrn); \ } -/*********************************************************************** -#define Volari_SetupDSTColorDepth(bpp) \ - if (G2CmdQueLen <= 0) Volari_Idle(pXGI);\ - MMIO_OUT16(pXGI->IOBase, BR(1)+2, bpp);\ - G2CmdQueLen --; -***********************************************************************/ - #define Volari_SetupDSTColorDepth(bpp) \ pXGI->CommandReg |= ((ulong)(bpp))&(GENMASK(17:16)) ; -/*********************************************************************** -#define Volari_SetupRect(w,h) \ - if (G2CmdQueLen <= 0) Volari_Idle(pXGI);\ - MMIO_OUT32(pXGI->IOBase, BR(6), (h)<<16 | (w) );\ - G2CmdQueLen --; -***********************************************************************/ - #define Volari_SetupRect(w,h) \ {\ unsigned long ulTemp ;\ @@ -525,31 +410,6 @@ void XGIDumpCMDQueue(ScrnInfoPtr pScrn); } \ } -/*********************************************************************** -#define Volari_SetupPATFG(color) \ - if (G2CmdQueLen <= 0) Volari_Idle(pXGI);\ - MMIO_OUT32(pXGI->IOBase, BR(7), color);\ - G2CmdQueLen --; -***********************************************************************/ -/*********************************************************************** -#define Volari_SetupPATBG(color) \ - if (G2CmdQueLen <= 0) Volari_Idle(pXGI);\ - MMIO_OUT32(pXGI->IOBase, BR(8), color);\ - G2CmdQueLen --; -***********************************************************************/ -/*********************************************************************** -#define Volari_SetupSRCFG(color) \ - if (G2CmdQueLen <= 0) Volari_Idle(pXGI);\ - MMIO_OUT32(pXGI->IOBase, BR(9), color);\ - G2CmdQueLen --; -***********************************************************************/ -/*********************************************************************** -#define Volari_SetupSRCBG(color) \ - if (G2CmdQueLen <= 0) Volari_Idle(pXGI);\ - MMIO_OUT32(pXGI->IOBase, BR(10), color);\ - G2CmdQueLen --; -***********************************************************************/ - #define Volari_SetupPATFG(color) \ {\ unsigned long ulTemp ;\ @@ -659,14 +519,6 @@ void XGIDumpCMDQueue(ScrnInfoPtr pScrn); \ } -/*********************************************************************** -#define Volari_SetupMONOPAT(p0,p1) \ - if (G2CmdQueLen <= 1) Volari_Idle(pXGI);\ - MMIO_OUT32(pXGI->IOBase, BR(11), p0);\ - MMIO_OUT32(pXGI->IOBase, BR(12), p1);\ - G2CmdQueLen =G2CmdQueLen-2; -***********************************************************************/ - #define Volari_SetupMONOPAT0(p0) \ {\ unsigned long ulTemp ;\ @@ -716,18 +568,6 @@ void XGIDumpCMDQueue(ScrnInfoPtr pScrn); Volari_UpdateSwWP(ulTemp) ;\ \ } -/*********************************************************************** -#define Volari_SetupClipLT(left,top) \ - if (G2CmdQueLen <= 0) Volari_Idle(pXGI);\ - MMIO_OUT32(pXGI->IOBase, BR(13), ((left) & 0xFFFF) | (top)<<16 );\ - G2CmdQueLen--; -***********************************************************************/ -/*********************************************************************** -#define Volari_SetupClipRB(right,bottom) \ - if (G2CmdQueLen <= 0) Volari_Idle(pXGI);\ - MMIO_OUT32(pXGI->IOBase, BR(14), ((right) & 0xFFFF) | (bottom)<<16 );\ - G2CmdQueLen --; -***********************************************************************/ #define Volari_SetupClip(left,top,right,bottom) \ {\ @@ -805,48 +645,6 @@ void XGIDumpCMDQueue(ScrnInfoPtr pScrn); } /*********************************************************************** -#define Volari_SetupROP(rop) \ - pXGI->CommandReg = (rop) << 8; - -#define Volari_SetupCMDFlag(flags) \ - pXGI->CommandReg |= (flags); - -#define Volari_DoCMD \ - if (G2CmdQueLen <= 1) Volari_Idle(pXGI);\ - MMIO_OUT32(pXGI->IOBase, BR(15), pXGI->CommandReg); \ - MMIO_OUT32(pXGI->IOBase, BR(16), 0);\ - G2CmdQueLen =G2CmdQueLen-2; -***********************************************************************/ - -/*********************************************************************** -#define Volari_SetupX0Y0(x,y) \ - if (G2CmdQueLen <= 0) Volari_Idle(pXGI);\ - MMIO_OUT32(pXGI->IOBase, BR(2), (y)<<16 | (x) );\ - G2CmdQueLen --; -#define Volari_SetupX1Y1(x,y) \ - if (G2CmdQueLen <= 0) Volari_Idle(pXGI);\ - MMIO_OUT32(pXGI->IOBase, BR(3), (y)<<16 | (x) );\ - G2CmdQueLen --; -#define Volari_SetupLineCount(c) \ - if (G2CmdQueLen <= 0) Volari_Idle(pXGI);\ - MMIO_OUT16(pXGI->IOBase, BR(6), c);\ - G2CmdQueLen --; -#define Volari_SetupStylePeriod(p) \ - if (G2CmdQueLen <= 0) Volari_Idle(pXGI);\ - MMIO_OUT16(pXGI->IOBase, BR(6)+2, p);\ - G2CmdQueLen --; -#define Volari_SetupStyleLow(ls) \ - if (G2CmdQueLen <= 0) Volari_Idle(pXGI);\ - MMIO_OUT32(pXGI->IOBase, BR(11), ls);\ - G2CmdQueLen --; -#define Volari_SetupStyleHigh(ls) \ - if (G2CmdQueLen <= 0) Volari_Idle(pXGI);\ - MMIO_OUT32(pXGI->IOBase, BR(12), ls);\ - G2CmdQueLen --; -***********************************************************************/ - - -/*********************************************************************** * For Line Drawing ***********************************************************************/ @@ -1019,4 +817,3 @@ void XGIDumpCMDQueue(ScrnInfoPtr pScrn); } #endif /* _XGI_315_ACCEL_H_ */ - diff --git a/src/xgi_cursor.c b/src/xgi_cursor.c index d52e69e..ca77852 100644 --- a/src/xgi_cursor.c +++ b/src/xgi_cursor.c @@ -66,7 +66,6 @@ Volari_ShowCursor(ScrnInfoPtr pScrn) /* unsigned long cursor_addr = pXGI->CursorOffset ; */ unsigned long cursor_base = pXGI->CursorOffset/1024 ; - /* Jong 09/19/2007; bug fixing for ??? */ if( pXGI->HWARGBCursor ) { xgiG2CRT1_EnableARGBHWCursor(cursor_base, 0); @@ -85,9 +84,6 @@ Volari_ShowCursor(ScrnInfoPtr pScrn) } XGIG1_SetCursorPosition(pScrn, currX, currY) ; - - /* Jong 02/05/2009; improve performance of WinBench 99 */ - /* XGI_WaitEndRetrace(pXGI->RelIO); */ } static void @@ -102,9 +98,6 @@ Volari_HideCursor(ScrnInfoPtr pScrn) } XGIG1_SetCursorPosition(pScrn, currX, currY) ; - - /* Jong 02/05/2009; improve performance of WinBench 99 */ - /* XGI_WaitEndRetrace(pXGI->RelIO); */ } static void @@ -118,7 +111,6 @@ XGIG1_SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) currX = x ; currY = y ; -/* ErrorF("\nHWC Set pos x:%d y:%d",x,y);*/ if (x < 0) { x_preset = (-x); x = 0; @@ -181,7 +173,6 @@ Volari_UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) return TRUE; } -/* Jong 09/19/2007; Is this required? */ Bool Volari_UseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs) { @@ -194,8 +185,6 @@ Volari_UseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs) return FALSE; } - /* DumpDDIName("Volari_UserHWCursorARGB()\n") ; */ - return TRUE ; } @@ -210,8 +199,6 @@ Volari_LoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCursor) int i , j ; uint32_t *pDest,*pSrc ; CursorBitsPtr pCursorBits = pCursor->bits ; - - /* DumpDDIName("Volari_LoadCursorARGB()\n") ; */ pXGI->HWARGBCursor = TRUE ; pCursorShape = pXGI->FbBase + cursor_addr ; @@ -233,8 +220,6 @@ Volari_LoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCursor) if (pXGI->VBFlags & CRT2_ENABLE) { xgiG2CRT2_SetCursorAddressPattern(cursor_base,0) ; - /* xgiG1CRT2_SetCursorAddress(cursor_base) ; */ - /* xgiG1CRT2_SetCursorPatternSelect(0) ; */ } XGIG1_SetCursorPosition(pScrn, currX, currY) ; PDEBUG4(vWaitCRT1VerticalRetrace(pScrn)) ; @@ -263,15 +248,12 @@ XGIHWCursorInit(ScreenPtr pScreen) PDEBUG(ErrorF("--- HWCursorInit() \n")); infoPtr->MaxWidth = 64; infoPtr->MaxHeight = 64; -/* infoPtr->ShowCursor = Volari_ShowCursorColor; // */ infoPtr->ShowCursor = Volari_ShowCursor; infoPtr->HideCursor = Volari_HideCursor; infoPtr->SetCursorPosition = XGIG1_SetCursorPosition; infoPtr->SetCursorColors = Volari_SetCursorColors; -/* infoPtr->LoadCursorImage = Volari_LoadCursorImageColors; // */ infoPtr->LoadCursorImage = Volari_LoadCursorImage; infoPtr->UseHWCursor = Volari_UseHWCursor; -/* infoPtr->RealizeCursor = XGIRealizeCursorColor ; // */ infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | diff --git a/src/xgi_dac.c b/src/xgi_dac.c index fe311a9..67a7061 100644 --- a/src/xgi_dac.c +++ b/src/xgi_dac.c @@ -167,7 +167,6 @@ compute_vclk( void XGICalcClock(ScrnInfoPtr pScrn, int clock, int max_VLD, unsigned int *vclk) { -/* XGIPtr pXGI = XGIPTR(pScrn); */ int M, N, P , PSN, VLD , PSNx ; int bestM=0, bestN=0, bestP=0, bestPSN=0, bestVLD=0; double abest = 42.0; @@ -279,17 +278,6 @@ XGICalcClock(ScrnInfoPtr pScrn, int clock, int max_VLD, unsigned int *vclk) vclk[VLDidx] = bestVLD; vclk[Pidx] = bestP; vclk[PSNidx] = bestPSN; -/* - PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Freq. selected: %.2f MHz, M=%d, N=%d, VLD=%d, P=%d, PSN=%d\n", - (float)(clock / 1000.), vclk[Midx], vclk[Nidx], vclk[VLDidx], - vclk[Pidx], vclk[PSNidx])); - PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Freq. set: %.2f MHz\n", bestFout / 1.0e6)); - PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "VCO Freq.: %.2f MHz\n", bestFout*bestP / 1.0e6)); -*/ - } static void @@ -312,12 +300,7 @@ Volari_Save(ScrnInfoPtr pScrn, XGIRegPtr xgiReg) #endif for (i = 0x06; i <= 0x3F; i++) { - /* outb(VGA_SEQ_INDEX, i); */ outb(XGISR, i); - - /* xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, - "XR%02X Contents - %02X \n", i, inb(VGA_SEQ_DATA)); - xgiReg->xgiRegs3C4[i] = inb(VGA_SEQ_DATA); */ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, "XR%02X Contents - %02X \n", i, inb(XGISR+1)); xgiReg->xgiRegs3C4[i] = inb(XGISR+1); @@ -327,8 +310,6 @@ Volari_Save(ScrnInfoPtr pScrn, XGIRegPtr xgiReg) inXGIIDXREG(XGICR, i, xgiReg->xgiRegs3D4[i]); } - /*xgiReg->xgiRegs3C2 = inb(0x3CC);*/ - xgiReg->xgiRegs3C2 = inb(pXGI->RelIO+0x4c); for (i=0x19; i<0x5C; i++) { @@ -376,50 +357,17 @@ Volari_Restore(ScrnInfoPtr pScrn, XGIRegPtr xgiReg) outXGIIDXREG(XGISR, 0x05, 0x86); - -#if 1 - /* Jong@08112009; recover this line */ - /* Volari_DisableAccelerator(pScrn) ; */ -#else - inXGIIDXREG(XGISR, 0x1E, temp); - - if (temp & (SR1E_ENABLE_2D | SR1E_ENABLE_3D)) { - Volari_Idle(pXGI); - } - - PDEBUG(XGIDumpRegs(pScrn)); - - outXGIIDXREG(XGICR, 0x55, 0); - andXGIIDXREG(XGISR, 0x1E, - ~(SR1E_ENABLE_3D_TRANSFORM_ENGINE - | SR1E_ENABLE_2D - | SR1E_ENABLE_3D)); - PDEBUG(XGIDumpRegs(pScrn)); -#endif - PDEBUG(XGIDumpRegs(pScrn)) ; //yilin for (i = 0x19; i < 0x5C; i++) { - /* Jong 09/19/2007; added for ??? */ if((i!=0x48 && i!=0x4a)|| ((pXGI->Chipset != PCI_CHIP_XGIXG20)&&(pXGI->Chipset != PCI_CHIP_XGIXG21)&&(pXGI->Chipset != PCI_CHIP_XGIXG27))) outXGIIDXREG(XGICR, i, xgiReg->xgiRegs3D4[i]); } for (i = 0x06; i <= 0x3F; i++) { - /* if( !(i==0x16 || i==0x18 || i==0x19 || i==0x28 || i==0x29 || i==0x2E || i==0x2F) ) { */ if( !(i==0x16 ) ) { - /* outb(VGA_SEQ_INDEX,i); */ outb(XGISR,i); - /* xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO,4, - "XR%X Contents - %02X ", i, inb(VGA_SEQ_DATA)); - - outb(VGA_SEQ_DATA,xgiReg->xgiRegs3C4[i]); - - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO,4, - "Restore to - %02X Read after - %02X\n", - xgiReg->xgiRegs3C4[i], inb(VGA_SEQ_DATA)); */ - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO,4, "XR%X Contents - %02X ", i, inb(XGISR+1)); @@ -431,28 +379,6 @@ Volari_Restore(ScrnInfoPtr pScrn, XGIRegPtr xgiReg) } } - -#if 0 - // yilin restore the VB register - outXGIIDXREG(XGIPART1, 0x2f, 0x01); - for (i=0; i<0x50; i++) - { - outXGIIDXREG(XGIPART1, i, xgiReg->VBPart1[i]); - } - for (i=0; i<0x50; i++) - { - outXGIIDXREG(XGIPART2, i, xgiReg->VBPart2[i]); - } - for (i=0; i<0x50; i++) - { - outXGIIDXREG(XGIPART3, i, xgiReg->VBPart3[i]); - } - for (i=0; i<0x50; i++) - { - outXGIIDXREG(XGIPART4, i, xgiReg->VBPart4[i]); - } -#endif - outb(pXGI->RelIO+0x42, xgiReg->xgiRegs3C2); /* MemClock needs this to take effect */ @@ -466,8 +392,6 @@ Volari_Restore(ScrnInfoPtr pScrn, XGIRegPtr xgiReg) PDEBUG(XGIDumpRegs(pScrn)) ; //yilin xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, "Volari_Restore(ScrnInfoPtr pScrn, XGIRegPtr xgiReg) Done\n"); - - } static void @@ -605,10 +529,8 @@ XGILoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, { XGIPtr pXGI = XGIPTR(pScrn); int i, j, index; -/* unsigned char backup = 0; */ unsigned char SR7; Bool dogamma1 = pXGI->CRT1gamma; -/* Bool resetxvgamma = FALSE; */ if (IS_DUAL_HEAD(pXGI)) { XGIEntPtr pXGIEnt = ENTITY_PRIVATE(pXGI); @@ -720,12 +642,10 @@ XG40Mclk(XGIPtr pXGI) unsigned char Num, Denum; /* Numerator */ - /* inXGIIDXREG(0x3c4, 0x28, Num); */ inXGIIDXREG(XGISR, 0x28, Num); mclk = 14318 * ((Num & 0x7f) + 1); /* Denumerator */ - /* inXGIIDXREG(0x3c4, 0x29, Denum); */ inXGIIDXREG(XGISR, 0x29, Denum); mclk = mclk / ((Denum & 0x1f) + 1); diff --git a/src/xgi_dri.c b/src/xgi_dri.c index 225a7fc..46f28ac 100644 --- a/src/xgi_dri.c +++ b/src/xgi_dri.c @@ -273,15 +273,11 @@ Bool XGIDRIScreenInit(ScreenPtr pScreen) break; } - /* TODO: default value is 2x? */ -/* if (drmAgpEnable(pXGI->drmSubFD, drmAgpGetMode(pXGI->drmSubFD)&~0x0) < 0) { -*/ /* Default to 1X agp mode */ if (drmAgpEnable(pXGI->drmSubFD, drmAgpGetMode(pXGI->drmSubFD)&~0x00000002) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpEnable failed\n"); break; } -/* ErrorF("[drm] drmAgpEnabled succeeded\n"); */ if (drmAgpAlloc(pXGI->drmSubFD, pXGI->agpSize, 0, NULL, &pXGI->agpHandle) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, @@ -303,9 +299,7 @@ Bool XGIDRIScreenInit(ScreenPtr pScreen) break; } -/* pXGI->agpSize = AGP_SIZE; */ pXGI->agpAddr = drmAgpBase(pXGI->drmSubFD); - /* pXGI->agpBase = */ /* Xserver cannot access VtxBuf, bc. not mem-map */ /* any client can access this VtxBuf AGP area */ /* by mem-map pXGIDRI->agp.handle */ @@ -320,7 +314,7 @@ Bool XGIDRIScreenInit(ScreenPtr pScreen) break; } -#if 1 /* chiawen : remove this to 3d driver */ + /* chiawen : remove this to 3d driver */ pXGI->agpVtxBufSize = AGP_VTXBUF_SIZE; /* 2MB */ pXGI->agpVtxBufAddr = pXGI->agpAddr; pXGI->agpVtxBufBase = pXGI->agpVtxBufAddr - pXGI->agpAddr + @@ -341,7 +335,6 @@ Bool XGIDRIScreenInit(ScreenPtr pScreen) #ifdef DRM_IOCTL_XGI_AGP_INIT ioctl(pXGI->drmSubFD, DRM_IOCTL_XGI_AGP_INIT, &agp); #endif -#endif } } while(0); @@ -427,10 +420,8 @@ XGIDRIFinishScreenInit(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); XGIPtr pXGI = XGIPTR(pScrn); -/* XGIPtr pXGI = XGIPTR(pScrn); */ XGIDRIPtr pXGIDRI; - /*pXGI->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT;*/ pXGI->pDRIInfo->driverSwapMethod = DRI_SERVER_SWAP; pXGIDRI=(XGIDRIPtr)pXGI->pDRIInfo->devPrivate; @@ -444,14 +435,6 @@ XGIDRIFinishScreenInit(ScreenPtr pScreen) pXGIDRI->scrnX=pXGIDRI->width; pXGIDRI->scrnY=pXGIDRI->height; -/* - pXGIDRI->textureOffset=pXGI->texOffset; - pXGIDRI->textureSize=pXGI->texSize; - pXGIDRI->fbOffset=pXGI->fbOffset; - pXGIDRI->backOffset=pXGI->backOffset; - pXGIDRI->depthOffset=pXGI->depthOffset; -*/ - /* set SAREA value */ { XGISAREAPriv *saPriv; @@ -464,12 +447,9 @@ XGIDRIFinishScreenInit(ScreenPtr pScreen) pXGI->cmdQueueLenPtr = &(saPriv->QueueLength); saPriv->AGPVtxBufNext = 0; - saPriv->shareWPoffset = pXGI->cmdQueue_shareWP_only2D; pXGI->pCQ_shareWritePort = &(saPriv->shareWPoffset); - - Volari_Idle(pXGI); } @@ -483,17 +463,6 @@ XGIDRISwapContext(ScreenPtr pScreen, DRISyncType syncType, { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); XGIPtr pXGI = XGIPTR(pScrn); - - /* mEndPrimitive */ - /* - * TODO: do this only if X-Server get lock. If kernel supports delayed - * signal, needless to do this - */ - /* - *(pXGI->IOBase + 0X8B50) = 0xff; - *(unsigned int *)(pXGI->IOBase + 0x8B60) = -1; - */ - Volari_Idle(pXGI); } diff --git a/src/xgi_dri.h b/src/xgi_dri.h index 9971a50..77e64ea 100644 --- a/src/xgi_dri.h +++ b/src/xgi_dri.h @@ -49,17 +49,11 @@ typedef struct { unsigned int FrameCount; unsigned long shareWPoffset; - /*uint16_t*/ - /*unsigned short RelIO;*/ - - /* 2001/12/16 added by jjtseng for some bala reasons .... */ unsigned char *AGPCmdBufBase; unsigned long AGPCmdBufAddr; unsigned long AGPCmdBufOffset; unsigned int AGPCmdBufSize; unsigned long AGPCmdBufNext; - /*~ 2001/12/16 added by jjtseng for some bala reasons .... */ - /* chiawen@2005/0601 for agp heap */ int isAGPHeapCreated; } XGISAREAPriv; @@ -90,13 +84,11 @@ typedef struct { int textureSize; unsigned int AGPVtxBufOffset; unsigned int AGPVtxBufSize; - /* 2001/12/16 added by jjtseng for some bala reasons .... */ unsigned char *AGPCmdBufBase; unsigned long AGPCmdBufAddr; unsigned long AGPCmdBufOffset; unsigned int AGPCmdBufSize; unsigned long *pAGPCmdBufNext; - /*~ 2001/12/16 added by jjtseng for some bala reasons .... */ int irqEnabled; unsigned int scrnX, scrnY; } XGIDRIRec, *XGIDRIPtr; diff --git a/src/xgi_driver.c b/src/xgi_driver.c index f00bb11..c1adddb 100644 --- a/src/xgi_driver.c +++ b/src/xgi_driver.c @@ -476,7 +476,6 @@ XGIDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "XGIDisplayPowerManagementSet(%d)\n", PowerManagementMode); -#if 1 PVB_DEVICE_INFO pVBInfo = pXGI->XGI_Pr; PXGI_HW_DEVICE_INFO pHwDevInfo = &pXGI->xgi_HwDevExt; ULONG PowerState = 0xFFFFFFFF; @@ -487,113 +486,6 @@ XGIDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, PowerState = 0x0; XGISetDPMS(pScrn, pVBInfo, pHwDevInfo, PowerState); -#else - if (IS_DUAL_HEAD(pXGI)) { - if (IS_SECOND_HEAD(pXGI)) - docrt2 = FALSE; - else - docrt1 = FALSE; - } - - xgiSaveUnlockExtRegisterLock(pXGI, NULL, NULL); - - switch (PowerManagementMode) { - - case DPMSModeOn: /* HSync: On, VSync: On */ - PDEBUG(ErrorF("!-DPMSMode-On...\n")); - - if (docrt1) - pXGI->Blank = FALSE; - - sr1 = 0x00; - cr17 = 0x80; - pmreg = 0x00; - cr63 = 0x00; - sr7 = 0x10; - sr11 = (pXGI->LCDon & 0x0C); - p2_0 = 0x20; - p1_13 = 0x00; - backlight = TRUE; - break; - - case DPMSModeSuspend: /* HSync: On, VSync: Off */ - PDEBUG(ErrorF("!-DPMSMode-Suspend...\n")); - - if (docrt1) - pXGI->Blank = TRUE; - - sr1 = 0x20; - cr17 = 0x80; - pmreg = 0x80; - cr63 = 0x40; - sr7 = 0x00; - sr11 = 0x08; - p2_0 = 0x40; - p1_13 = 0x80; - backlight = FALSE; - break; - - case DPMSModeStandby: /* HSync: Off, VSync: On */ - PDEBUG(ErrorF("!-DPMSMode-Standby...\n")); - - if (docrt1) - pXGI->Blank = TRUE; - - sr1 = 0x20; - cr17 = 0x80; - pmreg = 0x40; - cr63 = 0x40; - sr7 = 0x00; - sr11 = 0x08; - p2_0 = 0x80; - p1_13 = 0x40; - backlight = FALSE; - break; - - case DPMSModeOff: /* HSync: Off, VSync: Off */ - PDEBUG(ErrorF("!-DPMSMode-Off...\n")); - - if (docrt1) - pXGI->Blank = TRUE; - - sr1 = 0x20; - cr17 = 0x00; - pmreg = 0xc0; - cr63 = 0x40; - sr7 = 0x00; - sr11 = 0x08; - p2_0 = 0xc0; - p1_13 = 0xc0; - backlight = FALSE; - break; - - default: - return; - } - - if (docrt1) { - /* Set/Clear "Display On" bit - */ - setXGIIDXREG(XGISR, 0x01, ~0x20, sr1); - - if ((!(pXGI->VBFlags & CRT1_LCDA)) - || (pXGI->XGI_Pr->VBType & VB_XGI301C)) { - inXGIIDXREG(XGISR, 0x1f, oldpmreg); - if (!pXGI->CRT1off) { - setXGIIDXREG(XGISR, 0x1f, 0x3f, pmreg); - } - } - oldpmreg &= 0xc0; - } - - if ((docrt1) && (pmreg != oldpmreg) - && ((!(pXGI->VBFlags & CRT1_LCDA)) - || (pXGI->XGI_Pr->VBType & VB_XGI301C))) { - outXGIIDXREG(XGISR, 0x00, 0x01); /* Synchronous Reset */ - usleep(10000); - outXGIIDXREG(XGISR, 0x00, 0x03); /* End Reset */ - } -#endif } typedef struct @@ -641,8 +533,6 @@ void XGIAddAvailableModes(DisplayModePtr availModes) last = q; } - /* first = availModes->next; */ - /* Add all modes of ExtraAvailableModeTiming[] */ for(i=0; /* i < ExtraAvailableModeTimingCount */ xf86NameCmp(ExtraAvailableModeTiming[i].name, "0x0") != 0 ; i++) { @@ -652,13 +542,6 @@ void XGIAddAvailableModes(DisplayModePtr availModes) p->next = NULL; last->next = p; - /* - first->next->prev = p; - p->prev = first; - p->next = first->next; - first->next = p; - */ - p->name = XNFalloc(strlen(ExtraAvailableModeTiming[i].name) + 1); p->name = ExtraAvailableModeTiming[i].name; p->status = MODE_OK; @@ -1418,7 +1301,6 @@ XGIInternalDDC(ScrnInfoPtr pScrn, int crtno) } /* Jong 08/03/2009; get EDID with I2C function instead of VBIOS call */ -#if 1 ErrorF("get EDID with I2C function instead of VBIOS call...\n"); PXGI_HW_DEVICE_INFO pHwDevInfo = &pXGI->xgi_HwDevExt; @@ -1428,55 +1310,9 @@ XGIInternalDDC(ScrnInfoPtr pScrn, int crtno) pHwDevInfo->crtno = crtno; int bEDID = bGetEDID(pHwDevInfo, crtno, pjEDIDBuffer, ulBufferSize); -#else - ErrorF("get EDID with VBIOS call...\n"); - if (xf86LoadSubModule(pScrn, "int10")) - { - pInt = xf86InitInt10(pXGI->pEnt->index); - if (pInt == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "XGIInternalDDC(): Can not initialize pInt, abort.\n"); - return NULL; - } - - page = xf86Int10AllocPages(pInt, 1, &RealOff); - if (page == NULL) { - xf86FreeInt10(pInt); - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "XGIInternalDDC(): Can not initialize real mode buffer, abort.\n"); - return NULL; - } - } - - if (pInt) - { - pInt->ax = 0x4f15; /* VESA DDC supporting */ - pInt->bx = 1; /* get EDID */ - pInt->cx = crtno; /* port 0 or 1 for CRT 1 or 2 */ - pInt->es = SEG_ADDR(RealOff); - pInt->di = SEG_OFF(RealOff); - pInt->num = 0x10; - xf86ExecX86int10(pInt); - - PDEBUG3(ErrorF - ("ax = %04X bx = %04X cx = %04X dx = %04X si = %04X di = %04X es = %04X\n", - pInt->ax, pInt->bx, pInt->cx, pInt->dx, pInt->si, pInt->di, - pInt->es)); -#endif - -#if 0 - if ((pInt->ax & 0xff00) == 0) - { - int i; - - for (i = 0; i < 128; i++) { - buffer[i] = page[i]; - } -#else /* Jong 08/03/2009; get EDID with I2C function instead of VBIOS call */ if(bEDID == 1) { int i; -#endif xf86DrvMsg(pScrn->scrnIndex, X_INFO, "XGIInternalDDC(): VESA get DDC success for output channel %d.\n", crtno + 1); @@ -1493,8 +1329,6 @@ XGIInternalDDC(ScrnInfoPtr pScrn, int crtno) g_DVI_I_SignalType = (buffer[20] & 0x80) >> 7; ErrorF("DVI-I : %s signal ...\n", (g_DVI_I_SignalType == 0x01) ? "DVI" : "CRT" ); - /* Jong 09/04/2007; Alan fixed abnormal EDID data */ - /* pMonitor = xf86InterpretEDID(pScrn->scrnIndex, buffer) ; */ if ( (buffer[0]==0) && (buffer[7]==0) ) { for (i=1;i<7;i++) @@ -1520,47 +1354,9 @@ XGIInternalDDC(ScrnInfoPtr pScrn, int crtno) crtno + 1); } -/* Jong 08/03/2009; get EDID with I2C function instead of VBIOS call */ -#if 0 - xf86Int10FreePages(pInt, page, 1); - xf86FreeInt10(pInt); - } -#endif - return pMonitor; } -/* static xf86MonPtr -XGIDoPrivateDDC(ScrnInfoPtr pScrn, int *crtnum) -{ - XGIPtr pXGI = XGIPTR(pScrn); - - if(IS_DUAL_HEAD(pXGI)) - { - if(IS_SECOND_HEAD(pXGI)) - { - *crtnum = 1; - return(XGIInternalDDC(pScrn, 0)); - } - else - { - *crtnum = 2; - return(XGIInternalDDC(pScrn, 1)); - } - } - else if(pXGI->CRT1off) - { - *crtnum = 2; - return(XGIInternalDDC(pScrn, 1)); - } - else - { - *crtnum = 1; - return(XGIInternalDDC(pScrn, 0)); - } -} */ - - #ifdef DEBUG5 static void XGIDumpMonitorInfo(xf86MonPtr pMonitor) @@ -1957,22 +1753,10 @@ XGISyncDDCMonitorRange(MonPtr monitor, MonitorRangePtr range) monitor->nHsync++; monitor->nVrefresh++; -#if 1 monitor->hsync[monitor->nHsync-1].lo = range->loH; monitor->hsync[monitor->nHsync-1].hi = range->hiH; monitor->vrefresh[monitor->nVrefresh-1].lo = range->loV; monitor->vrefresh[monitor->nVrefresh-1].hi = range->hiV; -#else - for (i = 0; i < monitor->nHsync; i++) { - monitor->hsync[i].lo = range->loH; - monitor->hsync[i].hi = range->hiH; - } - - for (i = 0; i < monitor->nVrefresh; i++) { - monitor->vrefresh[i].lo = range->loV; - monitor->vrefresh[i].hi = range->hiV; - } -#endif } /* Jong@08212009; defined in vb_ext.c */ @@ -2041,13 +1825,11 @@ XGIDDCPreInit(ScrnInfoPtr pScrn) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Could not retrieve DDC data for CRT1\n"); - /* PowerSavingStatus |= 0x01; */ /* device is not detected through DAC1 */ ErrorF("Getting DVI EDID (DVO)...\n"); pMonitorDVI = XGIInternalDDC(pScrn, 1); if (pMonitorDVI == NULL) { - /* PowerSavingStatus |= 0x02; */ /* device is not detected through DVO */ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Could not retrieve DDC data for DVI\n"); } @@ -2074,7 +1856,6 @@ XGIDDCPreInit(ScrnInfoPtr pScrn) pMonitorCRT2 = XGIInternalDDC(pScrn, 2); if (pMonitorCRT2 == NULL) { - /* PowerSavingStatus |= 0x04; */ /* device is not detected through DAC2 */ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Could not retrieve DDC data for CRT2\n"); } @@ -2132,14 +1913,6 @@ XGIDDCPreInit(ScrnInfoPtr pScrn) if(PowerSavingStatus == 0xFF) PowerSavingStatus = 0x00; - -/* if((pXGI->xgi_HwDevExt.jChipType == XG27) && (PowerSavingStatus == 0x07)) - PowerSavingStatus = 0x00; - - if((pXGI->xgi_HwDevExt.jChipType == XG21) && (PowerSavingStatus == 0x03)) - PowerSavingStatus = 0x00; -*/ - XGIPowerSaving(pXGI->XGI_Pr, PowerSavingStatus); g_PowerSavingStatus = PowerSavingStatus; @@ -2219,8 +1992,6 @@ XGIDDCPreInit(ScrnInfoPtr pScrn) } } - /* Jong@08132009 */ - /* if (pXGI->xgi_HwDevExt.jChipType == XG21) { */ if ((pXGI->xgi_HwDevExt.jChipType == XG21) || (pXGI->xgi_HwDevExt.jChipType == XG27) ) { /* Mode range intersecting */ if (pXGI->CRT1Range.loH < pXGI->CRT2Range.loH) { @@ -2365,9 +2136,6 @@ XGIDumpMonPtr(MonPtr pMonitor) { #ifdef DEBUG5 int i; -# if 0 - DisplayModePtr mode; -#endif ErrorF("XGIDumpMonPtr() ... \n"); if (pMonitor == NULL) { @@ -2392,16 +2160,6 @@ XGIDumpMonPtr(MonPtr pMonitor) ErrorF("widthmm = %d, heightmm = %d\n", pMonitor->widthmm, pMonitor->heightmm); ErrorF("options = %p, DDC = %p\n", pMonitor->options, pMonitor->DDC); -# if 0 - mode = pMonitor->Modes; - while (1) { - XGIDumpModePtr(mode); - if (mode == pMonitor->Last) { - break; - } - mode = mode->next; - } -# endif #endif /* DEBUG5 */ } @@ -2413,7 +2171,6 @@ int ModifyTypeOfSupportMode(DisplayModePtr availModes) while(p) { - /* if( (p->HDisplay == 1440) && (p->VDisplay == 900)) */ if( p->type == 0) /* external support modeline */ { p->type = M_T_USERDEF; @@ -2981,7 +2738,6 @@ XGIPreInit(ScrnInfoPtr pScrn, int flags) */ { Gamma zeros = { 0.0, 0.0, 0.0 }; - /* Gamma zeros = { 0.5, 0.5, 0.5 }; */ if (!xf86SetGamma(pScrn, zeros)) { XGIErrorLog(pScrn, "xf86SetGamma() error\n"); @@ -3568,8 +3324,6 @@ XGIPreInit(ScrnInfoPtr pScrn, int flags) XGIAddAvailableModes(pScrn->monitor->Modes); - /* XGIFilterModeByDDC(pScrn->monitor->Modes, g_pMonitorDVI); */ /* Do it in XGIValidMode() */ - ErrorF("Call xf86ValidateModes()...Use Virtual Size-1-Virtual Size=%d\n", pScrn->display->virtualX); i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, NULL, 256, 2048, /* min / max pitch */ pScrn->bitsPerPixel * 8, 128, 2048, /* min / max height */ @@ -3829,15 +3583,6 @@ XGIPreInit(ScrnInfoPtr pScrn, int flags) /* Jong 07/30/2009; might cause small font size */ xf86SetDpi(pScrn, 0, 0); -#if 0 - /*yilin@20080407 fix the font too small problem at low resolution*/ - if((pScrn->xDpi < 65)||(pScrn->yDpi < 65)) - { - pScrn->xDpi = 75; - pScrn->yDpi = 75; - } -#endif - /* Load fb module */ switch (pScrn->bitsPerPixel) { case 8: @@ -4181,8 +3926,6 @@ XGIModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) PDEBUG(ErrorF("pScrn->frameX1 = %d\n", pScrn->frameX1)); PDEBUG(ErrorF("pScrn->frameY1 = %d\n", pScrn->frameY1)); - /* pScrn->displayWidth=mode->HDisplay; */ - if(pXGI->TargetRefreshRate) mode->VRefresh = pXGI->TargetRefreshRate; @@ -4193,7 +3936,6 @@ XGIModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) mode->VRefresh = pXGI->Non_DDC_DefaultRefreshRate; } - /* PDEBUG(ErrorF("XGIModeInit(). \n")); */ PDEBUG(ErrorF ("XGIModeInit Resolution (%d, %d) \n", mode->HDisplay, mode->VDisplay)); @@ -4276,10 +4018,8 @@ XGIModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) if((pXGI->Chipset == PCI_CHIP_XGIXG40)||(pXGI->Chipset == PCI_CHIP_XGIXG20)||(pXGI->Chipset == PCI_CHIP_XGIXG21)||(pXGI->Chipset == PCI_CHIP_XGIXG27)) { - /* PDEBUG(XGIDumpRegs(pScrn)) ; */ PDEBUG(ErrorF(" *** PreSetMode(). \n")); XGIPreSetMode(pScrn, mode, XGI_MODE_SIMU); - /* PDEBUG(XGIDumpRegs(pScrn)) ; */ PDEBUG(ErrorF(" *** Start SetMode() \n")); if (!XGIBIOSSetMode(pXGI->XGI_Pr, &pXGI->xgi_HwDevExt, pScrn, mode)) { @@ -4287,9 +4027,6 @@ XGIModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) return FALSE; } Volari_EnableAccelerator(pScrn); - /* XGIPostSetMode(pScrn, &pXGI->ModeReg); */ - /* outXGIIDXREG(XGISR, 0x20, 0xA1) ; */ - /* PDEBUG(XGIDumpRegs(pScrn)) ; */ } /* Update Currentlayout */ @@ -4331,7 +4068,6 @@ XGIRestore(ScrnInfoPtr pScrn) xgiSaveUnlockExtRegisterLock(pXGI, NULL, NULL); - /* Volari_Restore() */ (*pXGI->XGIRestore) (pScrn, xgiReg); pXGI->xgi_HwDevExt.SpecifyTiming = FALSE; @@ -4429,33 +4165,16 @@ XGIScreenInit(ScreenPtr pScreen, int argc, char **argv) PDEBUG(ErrorF("pScrn->frameY1 = %d\n", pScrn->frameY1)); /* Jong 07/29/2009; fix bug of switch mode */ -#if 1 /* Jong 08/30/2007; no virtual screen for all cases */ /* Jong 08/22/2007; support modeline */ - /* if(g_CountOfUserDefinedModes > 0) */ { - /* Jong@08122009 */ g_virtualX = pScrn->virtualX; g_virtualY = pScrn->virtualY; g_frameX0 = pScrn->frameX0; g_frameY0 = pScrn->frameY0; g_frameX1 = pScrn->frameX1; g_frameY1 = pScrn->frameY1; - - /* - pScrn->virtualX=pScrn->currentMode->HDisplay; - pScrn->virtualY=pScrn->currentMode->VDisplay; - */ - - //pScrn->displayWidth=pScrn->currentMode->HDisplay; - - /* - pScrn->frameX0=0; - pScrn->frameY0=0; - pScrn->frameX1=pScrn->currentMode->HDisplay-1; - pScrn->frameY1=pScrn->currentMode->VDisplay-1; */ } -#endif PDEBUG(ErrorF("After update...\n")); PDEBUG(ErrorF("pScrn->virtualX = %d\n", pScrn->virtualX)); @@ -4568,15 +4287,6 @@ XGIScreenInit(ScreenPtr pScreen, int argc, char **argv) return FALSE; } - /*xgiRestoreVirtual(pScrn); */ - -#if 0 - ErrorF("Use Virtual Size - *1\n"); - width = pScrn->virtualX; - height = pScrn->virtualY; - displayWidth = pScrn->displayWidth; -#endif - if (pXGI->Rotate) { height = pScrn->virtualX; width = pScrn->virtualY; @@ -4630,8 +4340,6 @@ XGIScreenInit(ScreenPtr pScreen, int argc, char **argv) } #endif - /* xgiRestoreVirtual(pScrn); */ - /* * Call the framebuffer layer's ScreenInit function, and fill in other * pScreen fields. @@ -4643,25 +4351,17 @@ XGIScreenInit(ScreenPtr pScreen, int argc, char **argv) case 32: /* Jong 07/30/2009; fix bug of small font */ -#if 1 PDEBUG(ErrorF("Use Virtual Size - *1\n")); width = /* pScrn->virtualX; */ pScrn->currentMode->HDisplay; height = /* pScrn->virtualY;*/ pScrn->currentMode->VDisplay; /* Jong@10022009 */ displayWidth = pScrn->displayWidth; /* important to set pitch correctly */ -#endif + PDEBUG(ErrorF("Call fbScreenInit()...\n")); PDEBUG(ErrorF("width=%d, height=%d, pScrn->xDpi=%d, pScrn->yDpi=%d, displayWidth=%d, pScrn->bitsPerPixel=%d...\n", width, height, pScrn->xDpi, pScrn->yDpi,displayWidth, pScrn->bitsPerPixel)); - /* in fbscreen.c */ - /* (xsize, ysize) : virtual size (1600, 1200) - (dpix, dpiy) : (75, 75) - (542) pScreen->mmWidth = (xsize * 254 + dpix * 5) / (dpix * 10); - (406) pScreen->mmHeight = (ysize * 254 + dpiy * 5) / (dpiy * 10); */ - - /* ret = fbScreenInit(pScreen, FBStart, width, */ ret = fbScreenInit(pScreen, FBStart , width, height, pScrn->xDpi, pScrn->yDpi, displayWidth, pScrn->bitsPerPixel); @@ -4705,13 +4405,9 @@ XGIScreenInit(ScreenPtr pScreen, int argc, char **argv) } } - /* xgiRestoreVirtual(pScrn); */ - /* Initialize RENDER ext; must be after RGB ordering fixed */ fbPictureInit(pScreen, 0, 0); - /* xgiRestoreVirtual(pScrn); */ - /* hardware cursor needs to wrap this layer <-- TW: what does that mean? */ if (!pXGI->ShadowFB) XGIDGAInit(pScreen); @@ -4878,12 +4574,6 @@ XGISwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) PDEBUG(ErrorF("pScreen->mmWidth = %d\n", pScrn->pScreen->mmWidth)); PDEBUG(ErrorF("pScreen->mmHeight = %d\n", pScrn->pScreen->mmHeight)); - /* Jong@08122009 */ - //pScrn->frameX0 = 0; - //pScrn->frameY0 = 0; - //pScrn->frameX1 = mode->HDisplay; - //pScrn->frameY1 = mode->VDisplay; - PDEBUG(ErrorF ("XGISwitchMode (%d, %d) \n", mode->HDisplay, mode->VDisplay)); @@ -4893,61 +4583,10 @@ XGISwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) if (!(XGIModeInit(pScrn, mode))) return FALSE; - -#if 0 - int height, width, displayWidth; - unsigned char *FBStart; - int ret; - - if (pXGI->ShadowFB) { - displayWidth = pXGI->ShadowPitch / (pScrn->bitsPerPixel >> 3); - FBStart = pXGI->ShadowPtr; - } - else { - pXGI->ShadowPtr = NULL; - FBStart = pXGI->FbBase; - } - - width = pScrn->virtualX; /* 1024; */ /* pScrn->currentMode->HDisplay; */ - height = pScrn->virtualY; /* 768; */ /* pScrn->currentMode->VDisplay; */ - displayWidth = pScrn->displayWidth; /* important to set pitch correctly */ - - ErrorF("Call fbScreenInit()...\n"); - ErrorF("width=%d, height=%d, pScrn->xDpi=%d, pScrn->yDpi=%d, displayWidth=%d, pScrn->bitsPerPixel=%d...\n", - width, height, pScrn->xDpi, pScrn->yDpi,displayWidth, pScrn->bitsPerPixel); - - /* in fbscreen.c */ - /* (xsize, ysize) : virtual size (1600, 1200) - (dpix, dpiy) : (75, 75) - (542) pScreen->mmWidth = (xsize * 254 + dpix * 5) / (dpix * 10); - (406) pScreen->mmHeight = (ysize * 254 + dpiy * 5) / (dpiy * 10); */ - - ret = fbScreenInit(pScrn->pScreen, FBStart, width, - height, pScrn->xDpi, pScrn->yDpi, - displayWidth, pScrn->bitsPerPixel); -#endif - /* Jong 07/30/2009; bug fixing for small font size */ pScrn->pScreen->mmWidth = (pScrn->virtualX * 254 + pScrn->xDpi * 5) / (pScrn->xDpi * 10); pScrn->pScreen->mmHeight = (pScrn->virtualY * 254 + pScrn->yDpi * 5) / (pScrn->yDpi * 10); -#if 0 - /* Jong 08/30/2007; no virtual screen for all cases */ - /* Jong 08/22/2007; support modeline */ - /* if(g_CountOfUserDefinedModes > 0) */ - { - - pScrn->virtualX=mode->HDisplay; - pScrn->virtualY=mode->VDisplay; - - pScrn->displayWidth=mode->HDisplay; - pScrn->frameX0=0; - pScrn->frameY0=0; - pScrn->frameX1=mode->HDisplay-1; - pScrn->frameY1=mode->VDisplay-1; - } -#endif - PDEBUG(ErrorF("After update...\n")); PDEBUG(ErrorF("pScrn->virtualX = %d\n", pScrn->virtualX)); PDEBUG(ErrorF("pScrn->virtualY = %d\n", pScrn->virtualY)); @@ -4962,275 +4601,9 @@ XGISwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) PDEBUG(ErrorF("pScreen->mmWidth = %d\n", pScrn->pScreen->mmWidth)); PDEBUG(ErrorF("pScreen->mmHeight = %d\n", pScrn->pScreen->mmHeight)); - /* Since RandR (indirectly) uses SwitchMode(), we need to - * update our Xinerama info here, too, in case of resizing - */ - - /* sleep(3); */ /* Jong 07/30/2009; wait to be ready for drawing */; - return TRUE; } -/* static void -XGISetStartAddressCRT1(XGIPtr pXGI, unsigned long base) -{ - unsigned char cr11backup; - - inXGIIDXREG(XGICR, 0x11, cr11backup); - andXGIIDXREG(XGICR, 0x11, 0x7F); - outXGIIDXREG(XGICR, 0x0D, base & 0xFF); - outXGIIDXREG(XGICR, 0x0C, (base >> 8) & 0xFF); - outXGIIDXREG(XGISR, 0x0D, (base >> 16) & 0xFF); - - - setXGIIDXREG(XGICR, 0x11, 0x7F,(cr11backup & 0x80)); -} */ - -/* static Bool -InRegion(int x, int y, region r) -{ - return (r.x0 <= x) && (x <= r.x1) && (r.y0 <= y) && (y <= r.y1); -} */ - -/* static void -XGIAdjustFrameHW_CRT1(ScrnInfoPtr pScrn, int x, int y) -{ - XGIPtr pXGI = XGIPTR(pScrn); - unsigned long base; - - base = y * pXGI->CurrentLayout.displayWidth + x; - switch(pXGI->CurrentLayout.bitsPerPixel) - { - case 16: base >>= 1; break; - case 32: break; - default: base >>= 2; - } - XGISetStartAddressCRT1(pXGI, base); -} */ - -/* static void -XGIMergePointerMoved(int scrnIndex, int x, int y) -{ - ScrnInfoPtr pScrn1 = xf86Screens[scrnIndex]; - XGIPtr pXGI = XGIPTR(pScrn1); - ScrnInfoPtr pScrn2 = pXGI->CRT2pScrn; - region out, in1, in2, f2, f1; - int deltax, deltay; - - f1.x0 = pXGI->CRT1frameX0; - f1.x1 = pXGI->CRT1frameX1; - f1.y0 = pXGI->CRT1frameY0; - f1.y1 = pXGI->CRT1frameY1; - f2.x0 = pScrn2->frameX0; - f2.x1 = pScrn2->frameX1; - f2.y0 = pScrn2->frameY0; - f2.y1 = pScrn2->frameY1; - - out.x0 = pScrn1->frameX0; - out.x1 = pScrn1->frameX1; - out.y0 = pScrn1->frameY0; - out.y1 = pScrn1->frameY1; - - in1 = out; - in2 = out; - switch(((XGIMergedDisplayModePtr)pXGI->CurrentLayout.mode->Private)->CRT2Position) - { - case xgiLeftOf: - in1.x0 = f1.x0; - in2.x1 = f2.x1; - break; - case xgiRightOf: - in1.x1 = f1.x1; - in2.x0 = f2.x0; - break; - case xgiBelow: - in1.y1 = f1.y1; - in2.y0 = f2.y0; - break; - case xgiAbove: - in1.y0 = f1.y0; - in2.y1 = f2.y1; - break; - case xgiClone: - break; - } - - deltay = 0; - deltax = 0; - - if(InRegion(x, y, out)) - { - - if(InRegion(x, y, in1) && !InRegion(x, y, f1)) - { - REBOUND(f1.x0, f1.x1, x); - REBOUND(f1.y0, f1.y1, y); - deltax = 1; - } - if(InRegion(x, y, in2) && !InRegion(x, y, f2)) - { - REBOUND(f2.x0, f2.x1, x); - REBOUND(f2.y0, f2.y1, y); - deltax = 1; - } - - } - else - { - - if(out.x0 > x) - { - deltax = x - out.x0; - } - if(out.x1 < x) - { - deltax = x - out.x1; - } - if(deltax) - { - pScrn1->frameX0 += deltax; - pScrn1->frameX1 += deltax; - f1.x0 += deltax; - f1.x1 += deltax; - f2.x0 += deltax; - f2.x1 += deltax; - } - - if(out.y0 > y) - { - deltay = y - out.y0; - } - if(out.y1 < y) - { - deltay = y - out.y1; - } - if(deltay) - { - pScrn1->frameY0 += deltay; - pScrn1->frameY1 += deltay; - f1.y0 += deltay; - f1.y1 += deltay; - f2.y0 += deltay; - f2.y1 += deltay; - } - - switch(((XGIMergedDisplayModePtr)pXGI->CurrentLayout.mode->Private)->CRT2Position) - { - case xgiLeftOf: - if(x >= f1.x0) - { REBOUND(f1.y0, f1.y1, y); } - if(x <= f2.x1) - { REBOUND(f2.y0, f2.y1, y); } - break; - case xgiRightOf: - if(x <= f1.x1) - { REBOUND(f1.y0, f1.y1, y); } - if(x >= f2.x0) - { REBOUND(f2.y0, f2.y1, y); } - break; - case xgiBelow: - if(y <= f1.y1) - { REBOUND(f1.x0, f1.x1, x); } - if(y >= f2.y0) - { REBOUND(f2.x0, f2.x1, x); } - break; - case xgiAbove: - if(y >= f1.y0) - { REBOUND(f1.x0, f1.x1, x); } - if(y <= f2.y1) - { REBOUND(f2.x0, f2.x1, x); } - break; - case xgiClone: - break; - } - - } - - if(deltax || deltay) - { - pXGI->CRT1frameX0 = f1.x0; - pXGI->CRT1frameY0 = f1.y0; - pScrn2->frameX0 = f2.x0; - pScrn2->frameY0 = f2.y0; - - pXGI->CRT1frameX1 = pXGI->CRT1frameX0 + CDMPTR->CRT1->HDisplay - 1; - pXGI->CRT1frameY1 = pXGI->CRT1frameY0 + CDMPTR->CRT1->VDisplay - 1; - pScrn2->frameX1 = pScrn2->frameX0 + CDMPTR->CRT2->HDisplay - 1; - pScrn2->frameY1 = pScrn2->frameY0 + CDMPTR->CRT2->VDisplay - 1; - pScrn1->frameX1 = pScrn1->frameX0 + pXGI->CurrentLayout.mode->HDisplay - 1; - pScrn1->frameY1 = pScrn1->frameY0 + pXGI->CurrentLayout.mode->VDisplay - 1; - - XGIAdjustFrameHW_CRT1(pScrn1, pXGI->CRT1frameX0, pXGI->CRT1frameY0); - } -} */ - - -/* static void -XGIAdjustFrameMerged(int scrnIndex, int x, int y, int flags) -{ - ScrnInfoPtr pScrn1 = xf86Screens[scrnIndex]; - XGIPtr pXGI = XGIPTR(pScrn1); - ScrnInfoPtr pScrn2 = pXGI->CRT2pScrn; - int VTotal = pXGI->CurrentLayout.mode->VDisplay; - int HTotal = pXGI->CurrentLayout.mode->HDisplay; - int VMax = VTotal; - int HMax = HTotal; - - BOUND(x, 0, pScrn1->virtualX - HTotal); - BOUND(y, 0, pScrn1->virtualY - VTotal); - - switch(SDMPTR(pScrn1)->CRT2Position) - { - case xgiLeftOf: - pScrn2->frameX0 = x; - BOUND(pScrn2->frameY0, y, y + VMax - CDMPTR->CRT2->VDisplay); - pXGI->CRT1frameX0 = x + CDMPTR->CRT2->HDisplay; - BOUND(pXGI->CRT1frameY0, y, y + VMax - CDMPTR->CRT1->VDisplay); - break; - case xgiRightOf: - pXGI->CRT1frameX0 = x; - BOUND(pXGI->CRT1frameY0, y, y + VMax - CDMPTR->CRT1->VDisplay); - pScrn2->frameX0 = x + CDMPTR->CRT1->HDisplay; - BOUND(pScrn2->frameY0, y, y + VMax - CDMPTR->CRT2->VDisplay); - break; - case xgiAbove: - BOUND(pScrn2->frameX0, x, x + HMax - CDMPTR->CRT2->HDisplay); - pScrn2->frameY0 = y; - BOUND(pXGI->CRT1frameX0, x, x + HMax - CDMPTR->CRT1->HDisplay); - pXGI->CRT1frameY0 = y + CDMPTR->CRT2->VDisplay; - break; - case xgiBelow: - BOUND(pXGI->CRT1frameX0, x, x + HMax - CDMPTR->CRT1->HDisplay); - pXGI->CRT1frameY0 = y; - BOUND(pScrn2->frameX0, x, x + HMax - CDMPTR->CRT2->HDisplay); - pScrn2->frameY0 = y + CDMPTR->CRT1->VDisplay; - break; - case xgiClone: - BOUND(pXGI->CRT1frameX0, x, x + HMax - CDMPTR->CRT1->HDisplay); - BOUND(pXGI->CRT1frameY0, y, y + VMax - CDMPTR->CRT1->VDisplay); - BOUND(pScrn2->frameX0, x, x + HMax - CDMPTR->CRT2->HDisplay); - BOUND(pScrn2->frameY0, y, y + VMax - CDMPTR->CRT2->VDisplay); - break; - } - - BOUND(pXGI->CRT1frameX0, 0, pScrn1->virtualX - CDMPTR->CRT1->HDisplay); - BOUND(pXGI->CRT1frameY0, 0, pScrn1->virtualY - CDMPTR->CRT1->VDisplay); - BOUND(pScrn2->frameX0, 0, pScrn1->virtualX - CDMPTR->CRT2->HDisplay); - BOUND(pScrn2->frameY0, 0, pScrn1->virtualY - CDMPTR->CRT2->VDisplay); - - pScrn1->frameX0 = x; - pScrn1->frameY0 = y; - - pXGI->CRT1frameX1 = pXGI->CRT1frameX0 + CDMPTR->CRT1->HDisplay - 1; - pXGI->CRT1frameY1 = pXGI->CRT1frameY0 + CDMPTR->CRT1->VDisplay - 1; - pScrn2->frameX1 = pScrn2->frameX0 + CDMPTR->CRT2->HDisplay - 1; - pScrn2->frameY1 = pScrn2->frameY0 + CDMPTR->CRT2->VDisplay - 1; - pScrn1->frameX1 = pScrn1->frameX0 + pXGI->CurrentLayout.mode->HDisplay - 1; - pScrn1->frameY1 = pScrn1->frameY0 + pXGI->CurrentLayout.mode->VDisplay - 1; - - XGIAdjustFrameHW_CRT1(pScrn1, pXGI->CRT1frameX0, pXGI->CRT1frameY0); -} */ - /* * This function is used to initialize the Start Address - the first * displayed location in the video memory. @@ -5270,24 +4643,10 @@ XGIAdjustFrame(ScrnInfoPtr pScrn, int x, int y) outXGIIDXREG(XGISR, 0x0D, ucTemp); ucTemp = (base >> 24) & 0x01; setXGIIDXREG(XGISR, 0x37, 0xFE, ucTemp); - -/* if (pXGI->VBFlags) { - XGI_UnLockCRT2(&(pXGI->xgi_HwDevExt),pXGI->pVBInfo); - ucTemp = base & 0xFF ; outXGIIDXREG( XGIPART1, 6 , ucTemp ) ; - ucTemp = (base>>8) & 0xFF ; outXGIIDXREG( XGIPART1, 5 , ucTemp ) ; - ucTemp = (base>>16) & 0xFF ; outXGIIDXREG( XGIPART1, 4 , ucTemp ) ; - ucTemp = (base>>24) & 0x01 ; ucTemp <<= 7 ; - setXGIIDXREG( XGIPART1, 0x2, 0x7F, ucTemp ) ; - - XGI_LockCRT2(&(pXGI->xgi_HwDevExt),pXGI->pVBInfo); - } - */ break; - } outXGIIDXREG(XGISR, 0x05, ucSR5Stat); - } /* @@ -5467,8 +4826,6 @@ int XGIValidateUserDefMode(XGIPtr pXGI, DisplayModePtr mode) { UShort i = (pXGI->CurrentLayout.bitsPerPixel+7)/8 - 1; - -#if 1 if((mode->HDisplay >= 1600) && (mode->VDisplay >= 1200) && (mode->VRefresh > 60)) { ErrorF("Not support over (1600,1200) 60Hz ... Reduce to (1600,1200) 60Hz\n"); @@ -5479,19 +4836,6 @@ int XGIValidateUserDefMode(XGIPtr pXGI, DisplayModePtr mode) ErrorF("Update clock to %d...\n", mode->Clock); return(-111) ; } -#endif - -#if 0 - if(XGI_GetModeID(0, mode->HDisplay, mode->VDisplay, i, 0, 0) == 0) - { - /* Jong 11/10/2008; support custom mode without ModeID */ - if( !((pXGI->HaveCustomModes) && (!(mode->type & M_T_DEFAULT))) ) - { - ErrorF("Can't get Mode ID...\n"); - return(MODE_NOMODE) ; - } - } -#endif return(MODE_OK); } @@ -5534,7 +4878,6 @@ XGIValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose, int flags) if(flags == MODECHECK_FINAL) PDEBUG5(ErrorF("This is a final check...\n")); -#if 1 if((mode->type == M_T_USERDEF) || ((mode->type & M_T_CLOCK_CRTC_C) == M_T_CLOCK_CRTC_C)) { if(pScrn->monitor->DDC) @@ -5549,50 +4892,10 @@ XGIValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose, int flags) PDEBUG5(ErrorF("It's a user-defined mode...return MODE_OK (might need more checking here) \n")); return(MODE_OK); } -#else - if((mode->type == M_T_USERDEF) || ((mode->type & M_T_CLOCK_CRTC_C) == M_T_CLOCK_CRTC_C)) - { - iRet=XGIValidateUserDefMode(pXGI, mode); - if(iRet != -111) - { - if(iRet == MODE_OK) - ErrorF("User-defined mode---MODE_OK\n"); - else - ErrorF("User-defined mode---MODE_NOMODE\n"); - - return(iRet); - } - } -#endif if(mode->VRefresh == 0) mode->VRefresh = VRefresh; -#if 0 - if (pXGI->VBFlags & CRT2_LCD) { - if ((HDisplay > 1600 && VDisplay > 1200) - || (HDisplay < 640 && VDisplay < 480)) { - PDEBUG5(ErrorF("skip by LCD limit\n")); - return (MODE_NOMODE); - } - /* if( VRefresh != 60) return(MODE_NOMODE) ; */ - } - else if (pXGI->VBFlags & CRT2_TV) { - if ((HDisplay > 1024 && VDisplay > 768) || - (HDisplay < 640 && VDisplay < 480) || (VRefresh != 60)) { - PDEBUG5(ErrorF("skip by TV limit\n")); - return (MODE_NOMODE); - } - } - else if (pXGI->VBFlags & CRT2_VGA) { - if ((HDisplay > 1600 && VDisplay > 1200) || - (HDisplay < 640 && VDisplay < 480)) { - PDEBUG5(ErrorF("skip by CRT2 limit\n")); - return (MODE_NOMODE); - } - } -#endif - if ((pXGI->Chipset == PCI_CHIP_XGIXG20) ||(pXGI->Chipset == PCI_CHIP_XGIXG21) ||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) { XgiMode = XG20_Mode; } @@ -6006,9 +5309,6 @@ static void XGIPostSetMode(ScrnInfoPtr pScrn, XGIRegPtr xgiReg) { XGIPtr pXGI = XGIPTR(pScrn); -/* unsigned char usScratchCR17; - Bool flag = FALSE; - Bool doit = TRUE; */ int myclock; unsigned char sr2b, sr2c, tmpreg; float num, denum, postscalar, divider; @@ -6033,10 +5333,6 @@ XGIPostSetMode(ScrnInfoPtr pScrn, XGIRegPtr xgiReg) (int) ((14318 * (divider / postscalar) * (num / denum)) / 1000); pXGI->MiscFlags &= ~(MISC_CRT1OVERLAY | MISC_CRT1OVERLAYGAMMA); -/* switch(pXGI->xgi_HwDevExt.jChipType) { - break; - } - */ if (!(pXGI->MiscFlags & MISC_CRT1OVERLAY)) { if (!IS_DUAL_HEAD(pXGI) || IS_SECOND_HEAD(pXGI)) xf86DrvMsgVerb(pScrn->scrnIndex, X_WARNING, 3, @@ -6394,13 +5690,6 @@ xgiSaveUnlockExtRegisterLock(XGIPtr pXGI, unsigned char *reg1, /* save State */ if (reg1) *reg1 = val; - /* unlock */ -/* - outb (0x3c4, 0x20); - val4 = inb (0x3c5); - val4 |= 0x20; - outb (0x3c5, val4); -*/ outXGIIDXREG(XGISR, 0x05, 0x86); inXGIIDXREG(XGISR, 0x05, val); if (val != 0xA1) { @@ -6415,7 +5704,6 @@ xgiSaveUnlockExtRegisterLock(XGIPtr pXGI, unsigned char *reg1, #ifdef TWDEBUG for (i = 0; i <= 0x3f; i++) { inXGIIDXREG(XGISR, i, val1); - /* inXGIIDXREG(0x3c4, i, val2); */ inXGIIDXREG(XGISR, i, val2); xf86DrvMsg(pXGI->pScrn->scrnIndex, X_INFO, "SR%02d: RelIO=0x%02x 0x3c4=0x%02x (%d)\n", @@ -6433,24 +5721,6 @@ xgiRestoreExtRegisterLock(XGIPtr pXGI, unsigned char reg1, unsigned char reg2) outXGIIDXREG(XGISR, 0x05, reg1 == 0xA1 ? 0x86 : 0x00); } -/* Jong 12/03/2007; */ -/* -void XGICheckModeForMonitor(ScrnInfoPtr pScrn, ) -{ - DisplayModePtr pCRT1Modes=pScrn->monitor->Modes; - - if ((p = first = pScrn->monitor->Modes)) { - do { - xf86CheckModeForMonitor(p, - n = p->next; - p = n; - } while (p != NULL && p != first); - } - - xf86PruneDriverModes(pXGI->CRT2pScrn); -} -*/ - /* Jong 12/05/2007; filter mode list by monitor DDC */ static void XGIFilterModeByDDC(DisplayModePtr pModeList, xf86MonPtr pMonitorDDC) { @@ -6527,83 +5797,6 @@ static bool XGICheckModeByDDC(DisplayModePtr pMode, xf86MonPtr pMonitorDDC) return(TRUE); } -/* Jong 12/05/2007; Don't know how to do? */ -#if 0 - for (i = 0; i < 4; i++) - { - switch (pMonitorDDC->det_mon[i].type) - { - case DS_RANGES: - pranges = &(pMonitorDDC->det_mon[i].section.ranges); - PDEBUG5(ErrorF - ("min_v = %d max_v = %d min_h = %d max_h = %d max_clock = %d\n", - pranges->min_v, pranges->max_v, pranges->min_h, - pranges->max_h, pranges->max_clock)); - - if (range->loH > pranges->min_h) - range->loH = pranges->min_h; - if (range->loV > pranges->min_v) - range->loV = pranges->min_v; - if (range->hiH < pranges->max_h) - range->hiH = pranges->max_h; - if (range->hiV < pranges->max_v) - range->hiV = pranges->max_v; - PDEBUG5(ErrorF - ("range(%8.3f %8.3f %8.3f %8.3f)\n", range->loH, - range->loV, range->hiH, range->hiV)); - break; - - case DS_STD_TIMINGS: - pstd_t = pMonitorDDC->det_mon[i].section.std_t; - for (j = 0; j < 5; j++) { - int k; - PDEBUG5(ErrorF - ("std_t[%d] hsize = %d vsize = %d refresh = %d id = %d\n", - j, pstd_t[j].hsize, pstd_t[j].vsize, - pstd_t[j].refresh, pstd_t[j].id)); - for (k = 0; StdTiming[k].width != -1; k++) { - if ((StdTiming[k].width == pstd_t[j].hsize) && - (StdTiming[k].height == pstd_t[j].vsize) && - (StdTiming[k].VRefresh == pstd_t[j].refresh)) { - if (range->loH > StdTiming[k].HSync) - range->loH = StdTiming[k].HSync; - if (range->hiH < StdTiming[k].HSync) - range->hiH = StdTiming[k].HSync; - if (range->loV > StdTiming[k].VRefresh) - range->loV = StdTiming[k].VRefresh; - if (range->hiV < StdTiming[k].VRefresh) - range->hiV = StdTiming[k].VRefresh; - break; - } - - } - } - break; - - case DT: - - pd_timings = &pMonitorDDC->det_mon[i].section.d_timings; - - HF = pd_timings->clock / (pd_timings->h_active + - pd_timings->h_blanking); - VF = HF / (pd_timings->v_active + pd_timings->v_blanking); - HF /= 1000; /* into KHz Domain */ - if (range->loH > HF) - range->loH = HF; - if (range->hiH < HF) - range->hiH = HF; - if (range->loV > VF) - range->loV = VF; - if (range->hiV < VF) - range->hiV = VF; - PDEBUG(ErrorF - ("Detailing Timing: HF = %f VF = %f range (%8.3f %8.3f %8.3f %8.3f)\n", - HF, VF, range->loH, range->loV, range->hiH, range->hiV)); - break; - } - } -#endif - return(FALSE); } @@ -6676,164 +5869,9 @@ XGIDumpGR(ScrnInfoPtr pScrn) ErrorF("\n"); } -#if 0 -void -XGIDumpPart0(ScrnInfoPtr pScrn) -{ - XGIPtr pXGI = XGIPTR(pScrn); - int i, j; - unsigned long temp; - - ErrorF - ("----------------------------------------------------------------------\n"); - ErrorF("PART0 xx\n"); - ErrorF - ("----------------------------------------------------------------------\n"); - for (i = 0; i < 0x50; i += 0x10) { - ErrorF("PART0[%02X]:", i); - for (j = 0; j < 0x10; j++) { - inXGIIDXREG(XGIPART0, (i + j), temp); - ErrorF(" %02lX", temp); - } - ErrorF("\n"); - } -} - -void -XGIDumpPart05(ScrnInfoPtr pScrn) -{ - XGIPtr pXGI = XGIPTR(pScrn); - int i, j; - unsigned long temp; - ErrorF - ("----------------------------------------------------------------------\n"); - ErrorF("PART05 xx\n"); - ErrorF - ("----------------------------------------------------------------------\n"); - for (i = 0; i < 0x50; i += 0x10) { - ErrorF("PART05[%02X]:", i); - for (j = 0; j < 0x10; j++) { - inXGIIDXREG(XGIPART05, (i + j), temp); - ErrorF(" %02lX", temp); - } - ErrorF("\n"); - } -} - -void -XGIDumpPart1(ScrnInfoPtr pScrn) -{ - XGIPtr pXGI = XGIPTR(pScrn); - - int i, j; - unsigned long temp; - - ErrorF - ("----------------------------------------------------------------------\n"); - ErrorF("PART1 xx\n"); - ErrorF - ("----------------------------------------------------------------------\n"); - for (i = 0; i < 0x100; i += 0x10) { - ErrorF("PART1[%02X]:", i); - for (j = 0; j < 0x10; j++) { - inXGIIDXREG(XGIPART1, (i + j), temp); - ErrorF(" %02lX", temp); - } - ErrorF("\n"); - } -} - -void -XGIDumpPart2(ScrnInfoPtr pScrn) -{ - XGIPtr pXGI = XGIPTR(pScrn); - - int i, j; - unsigned long temp; - - ErrorF - ("----------------------------------------------------------------------\n"); - ErrorF("PART2 xx\n"); - ErrorF - ("----------------------------------------------------------------------\n"); - for (i = 0; i < 0x100; i += 0x10) { - ErrorF("PART2[%02X]:", i); - for (j = 0; j < 0x10; j++) { - inXGIIDXREG(XGIPART2, (i + j), temp); - ErrorF(" %02lX", temp); - } - ErrorF("\n"); - } -} - -void -XGIDumpPart3(ScrnInfoPtr pScrn) -{ - XGIPtr pXGI = XGIPTR(pScrn); - - int i, j; - unsigned long temp; - - ErrorF - ("----------------------------------------------------------------------\n"); - ErrorF("PART3 xx\n"); - ErrorF - ("----------------------------------------------------------------------\n"); - - for (i = 0; i < 0x100; i += 0x10) { - ErrorF("PART3[%02X]:", i); - for (j = 0; j < 0x10; j++) { - inXGIIDXREG(XGIPART3, (i + j), temp); - ErrorF(" %02lX", temp); - } - ErrorF("\n"); - } -} - -void -XGIDumpPart4(ScrnInfoPtr pScrn) -{ - XGIPtr pXGI = XGIPTR(pScrn); - - int i, j; - unsigned long temp; - - ErrorF - ("----------------------------------------------------------------------\n"); - ErrorF("PART4 xx\n"); - ErrorF - ("----------------------------------------------------------------------\n"); - for (i = 0; i < 0x100; i += 0x10) { - ErrorF("PART4[%02X]:", i); - for (j = 0; j < 0x10; j++) { - inXGIIDXREG(XGIPART4, (i + j), temp); - ErrorF(" %02lX", temp); - } - ErrorF("\n"); - } -} -#endif - void XGIDumpMMIO(ScrnInfoPtr pScrn) { - XGIPtr pXGI = XGIPTR(pScrn); - - int i; - unsigned long temp; -/* - ErrorF("----------------------------------------------------------------------\n") ; - ErrorF("MMIO 85xx\n") ; - ErrorF("----------------------------------------------------------------------\n") ; - for( i = 0x8500 ; i < 0x8600 ; i+=0x10 ) - { - ErrorF("[%04X]: %08lX %08lX %08lX %08lX\n",i, - XGIMMIOLONG(i), - XGIMMIOLONG(i+4), - XGIMMIOLONG(i+8), - XGIMMIOLONG(i+12)) ; - } -*/ } #endif /* DEBUG */ @@ -6846,20 +5884,7 @@ XGIDumpRegs(ScrnInfoPtr pScrn) XGIDumpSR(pScrn); XGIDumpCR(pScrn); -// XGIDumpGR(pScrn); -// XGIDumpPalette(pScrn); XGIDumpMMIO(pScrn); - - /* - if (pXGI->Chipset != PCI_CHIP_XGIXG20) { - XGIDumpPart0(pScrn); - XGIDumpPart05(pScrn); - XGIDumpPart1(pScrn); - XGIDumpPart2(pScrn); - XGIDumpPart3(pScrn); - XGIDumpPart4(pScrn); - } */ - #endif /* DEBUG */ } @@ -6879,13 +5904,7 @@ XGIDumpPalette(ScrnInfoPtr pScrn) ("----------------------------------------------------------------------\n"); for (i = 0; i < 0xFF; i += 0x04) { for (j = 0; j < 16; j++) { - /* outb(0x3c7, i + j); */ outb(XGISR+3, i + j); - - /* - temp[0] = inb(0x3c9); - temp[1] = inb(0x3c9); - temp[2] = inb(0x3c9); */ temp[0] = inb(XGISR+5); temp[1] = inb(XGISR+5); temp[2] = inb(XGISR+5); @@ -6898,4 +5917,3 @@ XGIDumpPalette(ScrnInfoPtr pScrn) ErrorF("\n"); #endif } - diff --git a/src/xgi_memcpy.c b/src/xgi_memcpy.c index 483b4d8..4e31d92 100644 --- a/src/xgi_memcpy.c +++ b/src/xgi_memcpy.c @@ -31,12 +31,6 @@ #include "config.h" #endif -/* #include "xgi.h" */ - -/* Jong 07/10/2008; use run-time debug instead except for HW acceleration routines */ -/* extern bool g_bRunTimeDebug; -#define RUNTIMEDEBUG(p) if(g_bRunTimeDebug)p; */ - /* #define DEBUG */ #ifdef DEBUG #define PDEBUG(p) p /* RUNTIMEDEBUG(p) */ @@ -55,24 +49,6 @@ #define XGI_CPUFL_SSE2 0x0080 #define XGI_CPUFL_FLAG 0x8000 -#if 0 /* Debug */ -#define XGIDGBMC -#endif - -/* Jong 01/07/2009; debug */ -/* -#ifdef XGI_DEBUG -#define PDEBUG(p) p -#else -#define PDEBUG(p) -#endif -*/ - -#if 0 /* Jong 01/15/2009; ignore at the moment */ -extern unsigned int XGIAllocateFBMemory(ScrnInfoPtr pScrn, void **handle, int bytesize); -extern void XGIFreeFBMemory(ScrnInfoPtr pScrn, void **handle); -#endif - #define CPUBUFFERSIZE 2048 /* Size of /proc/cpuinfo buffer */ #define BUFFERSIZE (576 * 1152) /* Matches 720x576 YUV420 */ @@ -386,21 +362,6 @@ extern void XGIFreeFBMemory(ScrnInfoPtr pScrn, void **handle); /* Other archs */ -/* ... */ - - -#if 0 /* Jong 01/15/2009; ignore at the moment */ -/* Type for table for benchmark list */ -typedef struct { - vidCopyFunc mFunc; - char *mName; - unsigned int mycpuflag; - int grade; - int gradefrom; - Bool reqAlignment; -} XGIMCFuncData; -#endif - /************************************************************************/ /* libc memcpy() wrapper - generic */ /************************************************************************/ @@ -703,196 +664,6 @@ static void XGI_builtin_memcpy(UChar *dst, const UChar *src, int size) } #endif -#if 0 /* Jong 01/15/2009; ignore at the moment */ -/************************************************************************/ -/* Generic routines if Benchmark can be performed (all archs, all OSes) */ -/************************************************************************/ - -#ifdef XGI_canBenchmark - -/* Get time (unsigned int) */ -static unsigned int time_function(vidCopyFunc mf, UChar *buf1, UChar *buf2, int size) -{ - unsigned int t1, t2; - - t1 = taketime(); - - (*mf)(buf1, buf2, size); - - t2 = taketime(); - - return((t1 < t2) ? t2 - t1 : 0xFFFFFFFFU - (t1 - t2 - 1)); -} - -/* Allocate an area of offscreen FB memory (buf1), a simulated video - * player buffer (buf2) and a pool of uninitialized "video" data (buf3). - */ -static void * -XGI_AllocBuffers(ScrnInfoPtr pScrn, UChar **buf1, UChar **buf2, UChar **buf3) -{ - XGIPtr pXGI = XGIPTR(pScrn); - unsigned int offset; - void *handle = NULL; - - if(!(offset = XGIAllocateFBMemory(pScrn, &handle, BUFFERSIZE + 31))) { - return NULL; - } - (*buf1) = (UChar *)pXGI->FbBase + offset; - (*buf1) = (UChar *)(((ULong)(*buf1) + 31) & ~31); - - if(!((*buf2) = (UChar *)malloc(BUFFERSIZE + 15))) { - XGIFreeFBMemory(pScrn, &handle); - return NULL; - } - - if(!((*buf3) = (UChar *)malloc(BUFFERSIZE + 15))) { - free((*buf2)); - XGIFreeFBMemory(pScrn, &handle); - return NULL; - } - - return handle; -} -#endif - -/* Perform Benchmark */ -static int XGI_BenchmarkMemcpy(ScrnInfoPtr pScrn, XGIMCFuncData *MCFunctions, - unsigned int myCPUflags, UChar *buf1, UChar *buf2, - UChar *buf3, char *frqBuf, double cpuFreq, - vidCopyFunc *UMemCpy, int *best2, Bool from) -{ - XGIMCFuncData *curData; - int j = 0, bestSoFar = 0; - unsigned int tmp1, tmp2, best = 0xFFFFFFFFU, sbest = 0xFFFFFFFFU; - - (*best2) = 0; - - /* Make probable buf1 and buf2 are not paged out by referencing them */ - XGI_libc_memcpy(buf1, buf2, BUFFERSIZE); - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Benchmarking %s RAM to %s RAM memory transfer methods:\n", - from ? "video" : "system", - from ? "system" : "video"); - -#ifdef TWDEBUG - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Benchmark: CPUFlags %x\n", myCPUflags); -#endif - - j = 0; - while(MCFunctions[j].mFunc) { - PDEBUG(ErrorF("Check function[%d]-%s...\n", j, MCFunctions[j].mName)); - - curData = MCFunctions + j; - - if(myCPUflags & curData->mycpuflag) { - - /* Simulate setup of the video buffer and copy result to framebuffer */ - /* Do this 4 times to verify results */ - if(!from) { - XGI_builtin_memcpy(buf2, buf3, BUFFERSIZE); - tmp1 = time_function(curData->mFunc, buf1, buf2, BUFFERSIZE); - XGI_builtin_memcpy(buf2, buf3, BUFFERSIZE); - tmp2 = time_function(curData->mFunc, buf1, buf2, BUFFERSIZE); - tmp1 = (tmp2 < tmp1) ? tmp2 : tmp1; - XGI_builtin_memcpy(buf2, buf3, BUFFERSIZE); - tmp2 = time_function(curData->mFunc, buf1, buf2, BUFFERSIZE); - tmp1 = (tmp2 < tmp1) ? tmp2 : tmp1; - XGI_builtin_memcpy(buf2, buf3, BUFFERSIZE); - tmp2 = time_function(curData->mFunc, buf1, buf2, BUFFERSIZE); - tmp1 = (tmp2 < tmp1) ? tmp2 : tmp1; - } else { - XGI_builtin_memcpy(buf3, buf2, BUFFERSIZE); - tmp1 = time_function(curData->mFunc, buf2, buf1, BUFFERSIZE); - XGI_builtin_memcpy(buf3, buf2, BUFFERSIZE); - tmp2 = time_function(curData->mFunc, buf2, buf1, BUFFERSIZE); - tmp1 = (tmp2 < tmp1) ? tmp2 : tmp1; - XGI_builtin_memcpy(buf3, buf2, BUFFERSIZE); - tmp2 = time_function(curData->mFunc, buf2, buf1, BUFFERSIZE); - tmp1 = (tmp2 < tmp1) ? tmp2 : tmp1; - XGI_builtin_memcpy(buf3, buf2, BUFFERSIZE); - tmp2 = time_function(curData->mFunc, buf2, buf1, BUFFERSIZE); - tmp1 = (tmp2 < tmp1) ? tmp2 : tmp1; - } - - if((!frqBuf) || (tmp1 == 0)) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "\tChecked %s memcpy()... \t%u\n",curData->mName, tmp1); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "\tChecked %s memcpy()... \t%.1f MiB/s\n", - curData->mName, - cpuFreq * 1.e6 * (double)BUFFERSIZE / ((double)(tmp1) * (double)(0x100000))); - } - - if(tmp1 < best) { - best = tmp1; - bestSoFar = j; - PDEBUG(ErrorF("* bestSoFar is %d...\n", bestSoFar)); - } - - if(!curData->reqAlignment) { - if(tmp1 < sbest) { - sbest = tmp1; - (*best2) = j; - } - } - - } - - j++; - } - - PDEBUG(ErrorF("***** The best is func(%d)-%s...\n", bestSoFar, MCFunctions[bestSoFar].mName)); - - /* Jong 01/07/2009; test for performance */ - /* bestSoFar = 2; */ /* the worst case; buit-in-2 */ - return bestSoFar; -} - -static vidCopyFunc XGI_GetBestByGrade(ScrnInfoPtr pScrn, XGIMCFuncData *MCFunctions, - unsigned int myCPUflags, vidCopyFunc *UMemCpy, Bool from) -{ - int j = 0, best = -1, secondbest = -1, bestSoFar = 10, best2SoFar = 10; - int grade; - - *UMemCpy = XGI_libc_memcpy; - - while(MCFunctions[j].mFunc) { - if(myCPUflags & MCFunctions[j].mycpuflag) { - grade = from ? MCFunctions[j].gradefrom : MCFunctions[j].grade; - if(grade < bestSoFar) { - best = j; - bestSoFar = grade; - } - if(grade < best2SoFar) { - if(!MCFunctions[j].reqAlignment) { - secondbest = j; - best2SoFar = grade; - } - } - } - j++; - } - if(best >= 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Chose %s method for aligned data transfers %s video RAM\n", - MCFunctions[best].mName, - from ? "from" : "to"); - if(secondbest >= 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Chose %s method for unaligned data transfers %s video RAM\n", - MCFunctions[secondbest].mName, - from ? "from" : "to"); - *UMemCpy = MCFunctions[secondbest].mFunc; - } - return MCFunctions[best].mFunc; - } - - return XGI_libc_memcpy; -} -#endif /* canBenchmark */ - /**********************************************************************/ /* Generic routines if /proc filesystem is available (Linux) */ /**********************************************************************/ @@ -966,58 +737,6 @@ static void sigill_handler(void) } #endif -#if 0 /* Jong 01/15/2009; ignore at the moment */ -static Bool CheckOSforSSE(ScrnInfoPtr pScrn) -{ -#ifdef XGICHECKOSSSE /* Check OS for SSE possible: */ - int signo = -1; - -#ifdef XGIDGBMC - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Checking OS SSE support\n"); -#endif - - xf86InterceptSigIll(&sigill_handler); - - if(setjmp(sigill_return)) { - signo = 4; - } else { - __asm__ __volatile__ (" xorps %xmm0, %xmm0\n"); - /* __asm__ __volatile__ (" .byte 0xff\n"); */ /* For test */ - } - - xf86InterceptSigIll(NULL); - -#ifdef XGIDGBMC - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "OS SSE support signal %d\n", signo); -#endif - - if(signo != -1) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "OS does not support SSE instructions\n"); - } - - return (signo >= 0) ? FALSE : TRUE; - -#else /* no check for SSE possible: */ - - XGIPtr pXGI = XGIPTR(pScrn); - - xf86DrvMsg(pScrn->scrnIndex, pXGI->XvSSEMemcpy ? X_WARNING : X_INFO, - "Checking OS for SSE support is not supported in this version of " XGIMYSERVERNAME "\n"); - - if(pXGI->XvSSEMemcpy) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "If you get a signal 4 here, set the option \"UseSSE\" to \"off\".\n"); - return TRUE; - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "If your OS supports SSE, set the option \"UseSSE\" to \"on\".\n"); - return FALSE; - } -#endif -} - -#endif /* XGI_checkosforsse */ #endif #ifdef __i386__ /* i386 specific *************************************/ @@ -1028,19 +747,6 @@ PREFETCH_FUNC(XGI_mmxext,MMXEXT,SSE,EMMS,FENCEMMS,small_memcpy_i386) PREFETCH_FUNC(XGI_now,MMX,NOW,FEMMS,FEMMS,small_memcpy_i386) NOPREFETCH_FUNC(XGI_mmx,MMX,EMMS,EMMS,small_memcpy_i386) -#if 0 /* Jong 01/15/2009; ignore at the moment */ -static XGIMCFuncData MCFunctions_i386[] = { - {XGI_libc_memcpy, "libc", XGI_CPUFL_LIBC, 4, 4, FALSE}, - {XGI_builtin_memcpy,"built-in-1",XGI_CPUFL_BI, 5, 5, FALSE}, - {XGI_builtin_memcp2,"built-in-2",XGI_CPUFL_BI2, 6, 6, FALSE}, - {XGI_mmx_memcpy, "MMX", XGI_CPUFL_MMX, 3, 3, FALSE}, - {XGI_sse_memcpy, "SSE", XGI_CPUFL_SSE, 1, 0, TRUE}, - {XGI_now_memcpy, "3DNow!", XGI_CPUFL_3DNOW, 2, 2, FALSE}, - {XGI_mmxext_memcpy, "MMX2", XGI_CPUFL_MMX2, 0, 1, FALSE}, - {NULL, "", 0, 10, 10, FALSE} -}; -#endif - #define Def_FL (XGI_CPUFL_LIBC | XGI_CPUFL_BI | XGI_CPUFL_BI2) /* Default methods */ #define cpuid(op, eax, ebx, ecx, edx) \ @@ -1054,252 +760,10 @@ static XGIMCFuncData MCFunctions_i386[] = { : "a" (op) \ : "cc") -#if 0 /* Jong 01/15/2009; ignore at the moment */ -static Bool cpuIDSupported(ScrnInfoPtr pScrn) -{ - int eax, ebx, ecx, edx; - - /* Check for cpuid instruction */ - __asm__ __volatile__ ( - " pushf\n" - " popl %0\n" - " movl %0, %1\n" - " xorl $0x200000, %0\n" - " push %0\n" - " popf\n" - " pushf\n" - " popl %0\n" - : "=a" (eax), "=c" (ecx) - : - : "cc"); - - if(eax == ecx) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CPU does not support CPUID instruction\n"); - return FALSE; - } - - /* Check for cpuid level */ - cpuid(0x00000000, eax, ebx, ecx, edx); - if(!eax) { - return FALSE; - } - - /* Check for RDTSC */ - cpuid(0x00000001, eax, ebx, ecx, edx); - - if(!(edx & 0x10)) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CPU does not support RDTSC instruction\n"); - return FALSE; - } - - return TRUE; -} - -static unsigned int XGI_GetCpuFeatures(ScrnInfoPtr pScrn) -{ - unsigned int flags = 0, eax, ebx, ecx, edx; - Bool IsAMD; - - /* Check if cpuid and rdtsc instructions are supported */ - if(!cpuIDSupported(pScrn)) { - return 0; - } - - cpuid(0x00000000, eax, ebx, ecx, edx); - - IsAMD = (ebx == 0x68747541) && (edx == 0x69746e65) && (ecx == 0x444d4163); - - cpuid(0x00000001, eax, ebx, ecx, edx); - /* MMX */ - if(edx & 0x00800000) flags |= XGI_CPUFL_MMX; - /* SSE, MMXEXT */ - if(edx & 0x02000000) flags |= (XGI_CPUFL_SSE | XGI_CPUFL_MMX2); - /* SSE2 - don't need this one directly, set SSE instead */ - if(edx & 0x04000000) flags |= (XGI_CPUFL_SSE | XGI_CPUFL_SSE2); - - cpuid(0x80000000, eax, ebx, ecx, edx); - if(eax >= 0x80000001) { - cpuid(0x80000001, eax, ebx, ecx, edx); - /* 3DNow! */ - if(edx & 0x80000000) flags |= XGI_CPUFL_3DNOW; - /* AMD MMXEXT */ - if(IsAMD && (edx & 0x00400000)) flags |= XGI_CPUFL_MMX2; - } - - return flags; -} -#endif - #elif defined(__AMD64__) || defined(__amd64__) || defined(__x86_64__) /* AMD64 specific ***** */ PREFETCH_FUNC(XGI_sse,SSE64,SSE,,FENCE,small_memcpy_amd64) -#if 0 /* Jong 01/15/2009; ignore at the moment */ - -static XGIMCFuncData MCFunctions_AMD64[] = { - {XGI_libc_memcpy, "libc", XGI_CPUFL_LIBC, 2, 2, FALSE}, - {XGI_builtin_memcpy,"built-in-1",XGI_CPUFL_BI, 1, 1, FALSE}, - {XGI_builtin_memcp2,"built-in-2",XGI_CPUFL_BI2, 3, 3, FALSE}, - {XGI_sse_memcpy, "SSE", XGI_CPUFL_SSE, 0, 0, TRUE}, - {NULL, "", 0, 10, 10, FALSE} -}; - -#define Def_FL (XGI_CPUFL_LIBC | XGI_CPUFL_BI | XGI_CPUFL_BI2) - -static unsigned int XGI_GetCpuFeatures(ScrnInfoPtr pScrn) -{ - return((unsigned int)(XGI_CPUFL_SSE|XGI_CPUFL_SSE2)); -} -#endif - -#else /* Specific for other archs ******************************** */ - -/* Fill in here */ -#if 0 /* Jong 01/15/2009; ignore at the moment */ - -#define Def_FL (XGI_CPUFL_LIBC) - -static unsigned int XGI_GetCpuFeatures(ScrnInfoPtr pScrn) -{ - return((unsigned int)(0)); -} - -#endif - -#endif - -/**********************************************************************/ -/* Benchmark the video copy routines and choose the fastest */ -/**********************************************************************/ - -#if 0 /* Jong 01/15/2009; ignore at the moment */ -#ifdef XGI_canBenchmark -static vidCopyFunc -XGIVidCopyInitGen(ScreenPtr pScreen, XGIMCFuncData *MCFunctions, vidCopyFunc *UMemCpy, Bool from) -{ - ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); - XGIPtr pXGI = XGIPTR(pScrn); - void *fbhandle = NULL; - char *frqBuf = NULL; - UChar *buf1, *buf2, *buf3; - double cpuFreq = 0.0; - unsigned int myCPUflags = pXGI->CPUFlags | Def_FL; - int best, secondbest; -#ifdef XGI_haveProc - char buf[CPUBUFFERSIZE]; -#endif - - PDEBUG(ErrorF("---XGIVidCopyInitGen()...begin\n")); - *UMemCpy = XGI_libc_memcpy; - - /* Bail out if user disabled benchmarking */ - if(!pXGI->BenchMemCpy) { - PDEBUG(ErrorF("---return XGI_libc_memcpy() as vidCopyFunc...\n")); - return XGI_libc_memcpy; - } - -#ifdef XGI_haveProc - /* Read /proc/cpuinfo into buf */ - if(XGI_ReadProc(buf, "/proc/cpuinfo")) { - - /* Extract CPU frequency */ - frqBuf = XGI_GetCPUFreq(pScrn, buf, &cpuFreq); - - } -#endif - - /* Allocate buffers; buf1:LFB; buf2,buf3:system memory */ - if(!(fbhandle = XGI_AllocBuffers(pScrn, &buf1, &buf2, &buf3))) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Failed to allocate video RAM for video data transfer benchmark\n"); - return XGI_GetBestByGrade(pScrn, MCFunctions, myCPUflags, UMemCpy, from); - } - - /* Perform Benchmark */ - PDEBUG(ErrorF("---Perform XGI_BenchmarkMemcpy()...\n")); - best = XGI_BenchmarkMemcpy(pScrn, MCFunctions, myCPUflags, buf1, - (UChar *)(((unsigned long)buf2 + 15) & ~15), - (UChar *)(((unsigned long)buf3 + 15) & ~15), - frqBuf, cpuFreq, UMemCpy, &secondbest, from); - - /* Free buffers */ - XGIFreeFBMemory(pScrn, &fbhandle); - free(buf2); - free(buf3); - - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Using %s method for aligned data transfers %s video RAM\n", - MCFunctions[best].mName, - from ? "from" : "to"); - - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Using %s method for unaligned data transfers %s video RAM\n", - MCFunctions[secondbest].mName, - from ? "from" : "to"); - - return MCFunctions[best].mFunc; -} -#endif /* canBenchmark */ -#endif - -/**********************************************************************/ -/* main(): Get CPU capabilities */ -/* (called externally) */ -/**********************************************************************/ -#if 0 /* Jong 01/15/2009; ignore at the moment */ - -unsigned int -XGIGetCPUFlags(ScrnInfoPtr pScrn) -{ - unsigned int myCPUflags = XGI_GetCpuFeatures(pScrn); - -#ifdef XGI_checkosforsse - if(myCPUflags & (XGI_CPUFL_SSE | XGI_CPUFL_SSE2)) { - - /* Check if OS supports usage of SSE instructions */ - if(!(CheckOSforSSE(pScrn))) { - myCPUflags &= ~(XGI_CPUFL_SSE | XGI_CPUFL_SSE2); - } - - } -#endif - - return myCPUflags; -} - -#endif - -/**********************************************************************/ -/* main(): XGIVidCopyInit() */ -/* (called externally) */ -/* (XGIGetCPUFlags must be called before this one) */ -/**********************************************************************/ - -#if 0 /* Jong 01/15/2009; ignore at the moment */ -vidCopyFunc XGIVidCopyInit(ScreenPtr pScreen, vidCopyFunc *UMemCpy, Bool from) -{ -/* Jong 01/08/2009; test for performance */ -#if defined(__i386__) && defined(XGI_canBenchmark) - PDEBUG(ErrorF("XGIVidCopyInit()-i386...\n")); - return(XGIVidCopyInitGen(pScreen, MCFunctions_i386, UMemCpy, from)); -#elif (defined(__AMD64__) || defined(__amd64__) || defined(__x86_64__)) && defined(XGI_canBenchmark) - PDEBUG(ErrorF("XGIVidCopyInit()-AMD64-x86_64...\n")); - return(XGIVidCopyInitGen(pScreen, MCFunctions_AMD64, UMemCpy, from)); -#else /* Other cases: Use libc memcpy() */ - *UMemCpy = XGI_libc_memcpy; - PDEBUG(ErrorF("XGIVidCopyInit()-generic...\n")); - return XGI_libc_memcpy; -#endif -} -#endif - -#if 0 /* Jong 01/15/2009; ignore at the moment */ -vidCopyFunc XGIVidCopyGetDefault(void) -{ - return XGI_libc_memcpy; -} #endif #endif /* GNU C */ - - diff --git a/src/xgi_opt.c b/src/xgi_opt.c index 635d375..db5bcee 100644 --- a/src/xgi_opt.c +++ b/src/xgi_opt.c @@ -190,12 +190,6 @@ xgiOptions(ScrnInfoPtr pScrn) xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pXGI->Options); - /* Set defaults */ -/* -#ifdef __powerpc__ - pXGI->NoAccel = TRUE; -#endif -*/ pXGI->TurboQueue = TRUE; /* TODO: Option (315 series VRAM command queue) */ /* But beware: xgifb does not know about this!!! */ @@ -266,13 +260,6 @@ xgiOptions(ScrnInfoPtr pScrn) if(pXGI->IgnoreDDC == TRUE) xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Monitor (Option) : IgnoreDDC \n"); } -#if 0 /* can support 1280x768 but not being applied */ - else - { - pXGI->IgnoreDDC = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Monitor (Option) : set IgnoreDDC as default\n"); - } -#endif pXGI->Non_DDC_DefaultMode = FALSE; pXGI->Non_DDC_DefaultResolutionX = 1024; @@ -285,8 +272,6 @@ xgiOptions(ScrnInfoPtr pScrn) char Non_DDCDefaultResolutionY[8] = ""; char Non_DDCDefaultRefreshRate[8] = ""; - /* strcpy(ModeStringFormat, "%[^+]x%[^+]@%[^\n]"); */ - if((Non_DDCDefaultMode = xf86GetOptValString(pXGI->Options, OPTION_NONDDC_DEFAULT_MODE))) { sscanf(Non_DDCDefaultMode, ModeStringFormat, diff --git a/src/xgi_setup.c b/src/xgi_setup.c index 69ee862..b29bec2 100644 --- a/src/xgi_setup.c +++ b/src/xgi_setup.c @@ -46,7 +46,6 @@ #include "xgi.h" #include "xgi_regs.h" #include "xgi_dac.h" -/* #include "valid_mode.h" */ #define _XF86DGA_SERVER_ #include <X11/extensions/xf86dgaproto.h> @@ -71,7 +70,6 @@ static Bool XGI_IsXG21(ScrnInfoPtr pScrn); static void XGI_InitHwDevInfo(ScrnInfoPtr pScrn); -/* Jong 10/16/2007; merge code */ static void xgiXG2X_Setup(ScrnInfoPtr pScrn) { @@ -245,7 +243,6 @@ xgiXG2X_Setup(ScrnInfoPtr pScrn) if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) { pXGI->cmdQueueSize = VOLARI_CQSIZEXG20; - /* XgiMode = XG20_Mode ; */ PDEBUG(ErrorF(" ---XG20_Mode \n")); } @@ -637,7 +634,6 @@ XGI_InitHwDevInfo(ScrnInfoPtr pScrn) XGI_New_GetVBType(pXGI->XGI_Pr, pHwDevInfo); //yilin ErrorF("XGI_New_GetVBType VBType = %x\n", pXGI->XGI_Pr->VBType); - // pHwDevInfo->ujVBChipID = VB_CHIP_301 ; //yilin if( pXGI->XGI_Pr->VBType & (VB_XGI301 | VB_XGI301B | VB_XGI301C)) { PDEBUG(ErrorF("VB chip = 301 \n")) ; @@ -647,12 +643,6 @@ XGI_InitHwDevInfo(ScrnInfoPtr pScrn) { pHwDevInfo->ujVBChipID = VB_CHIP_302 ; } -/* - else if (pXGI->VBFlags & VB_LVDS) { - pHwDevInfo->ulExternalChip |= 0x01 ; - } -*/ //yilin - PDEBUG(ErrorF("pHwDevInfo->jChipType = %08lX done\n",pHwDevInfo->jChipType)) ; } diff --git a/src/xgi_vb.c b/src/xgi_vb.c index 13f1f58..417a4dc 100644 --- a/src/xgi_vb.c +++ b/src/xgi_vb.c @@ -47,15 +47,7 @@ extern unsigned char XGI_GetSetBIOSScratch(ScrnInfoPtr pScrn, USHORT offset, uns static Bool TestDDC1(ScrnInfoPtr pScrn) { -/* XGIPtr pXGI = XGIPTR(pScrn); - unsigned short old; */ int count = 48; -/* - old = XGI_ReadDDC1Bit(pXGI->XGI_Pr); - do { - if(old != XGI_ReadDDC1Bit(pXGI->XGI_Pr)) break; - } while(count--); -*/ return (count == -1) ? FALSE : TRUE; } @@ -142,8 +134,6 @@ void XGILCDPreInit(ScrnInfoPtr pScrn) pXGI->LCDwidth = 0; - /* if(!(pXGI->XGI_Pr->VBType & VB_XGIVB)) return; */ - inXGIIDXREG(XGICR, 0x32, CR32); if(CR32 & 0x08) pXGI->VBFlags |= CRT2_LCD; @@ -280,5 +270,3 @@ void XGICRT2PreInit(ScrnInfoPtr pScrn) xf86DrvMsg(pScrn->scrnIndex, X_PROBED,"%sCRT2 (VGA) connection detected\n", CRT2Detected ? "" : "No "); } - - diff --git a/src/xgi_vga.c b/src/xgi_vga.c index c314b2b..72832c0 100644 --- a/src/xgi_vga.c +++ b/src/xgi_vga.c @@ -231,7 +231,6 @@ PDEBUG(ErrorF("XG40Init()\n")); pReg->xgiRegs3C4[0x32] &= 0xF7; } - /*pReg->xgiRegs3C2 = inb(0x3CC) | 0x0C;*/ /* Programmable Clock */ pReg->xgiRegs3C2 = inb(pXGI->RelIO+0x4c) | 0x0C; /*Programmable Clock*/ if (!pXGI->NoAccel) { @@ -273,7 +272,4 @@ void XGIVGAPreInit(ScrnInfoPtr pScrn) pXGI->ModeInit = XG40Init; break; } - - } - diff --git a/src/xgi_video.c b/src/xgi_video.c index 05b3919..1dbb8a7 100644 --- a/src/xgi_video.c +++ b/src/xgi_video.c @@ -177,23 +177,6 @@ static XF86VideoFormatRec XGIFormats[NUM_FORMATS] = # ifdef VC #define ENCODING_ATTRIB_NUM 13 /* 0~12 */ -/* -static XF86VideoEncodingRec InputVideoEncodings[] = -{ - {0,"XV_IMAGE", 1024,1024,{1,1}}, - {1,"pal-composite", 720, 288, {1,50}}, - {2,"pal-tuner", 720, 288, {1,50}}, - {3,"pal-svideo", 720, 288, {1,50}}, - {4,"ntsc-composite", 720, 240, {1001,60000}}, - {5,"ntsc-tuner", 720, 240, {1001,60000}}, - {6,"ntsc-svideo", 720, 240, {1001,60000}}, - {7,"secam-composite", 720, 240, {1,50}}, - {8,"secam-tuner", 720, 240, {1,50}}, - {9,"secam-svideo", 720, 240, {1,50}}, - {10,"pal_60-composite", 768, 288, {1,50}}, - {11,"pal_60-tuner", 768, 288, {1,50}}, - {12,"pal_60-svideo", 768, 288, {1,50}}, -};*/ static XF86VideoEncodingRec InputVideoEncodings[] = { {0,"XV_IMAGE", 1024,1024,{1,1}}, @@ -397,7 +380,6 @@ XGISetupImageVideo(ScreenPtr pScreen) adapt->type = XvWindowMask | XvInputMask | XvImageMask | XvVideoMask; adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; - /*adapt->name = "XGI Video Overlay"; */ adapt->name = "XGI Video"; # ifdef VC adapt->nEncodings = ENCODING_ATTRIB_NUM; @@ -979,7 +961,6 @@ XGIDisplayVideo(ScrnInfoPtr pScrn, XGIPortPrivPtr pPriv) break; default: - /* ErrorF("UnSurpported Format"); */ break; } # ifdef VC @@ -1030,7 +1011,6 @@ XGIStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) ErrorF("Giwas: XGIStopVideo--CAPTURE_ON\n"); if (pPriv->fd != -1){ - //ioctl(pPriv->fd, VIDIOC_OVERLAY, &zero); XGICloseV4l(pPriv); } EnableCaptureAutoFlip(pXGI, FALSE); @@ -1615,17 +1595,14 @@ XGIPutVideo( short drw_w, short drw_h, RegionPtr clipBoxes, pointer data) { - /* XGIPtr pXGI = XGIPTR(pScrn); */ XGIPortPrivPtr pPriv = (XGIPortPrivPtr)data; # ifdef VC struct v4l2_format fmt; -/* struct xgi_framebuf xgifbuf;*/ - int width, height /*, id*/; + int width, height; int last_width, last_height; # endif //VC - //EnableCaptureAutoFlip(pXGI, TRUE); pPriv->id = PIXEL_FMT_UYVY; pPriv->videoStatus = CLIENT_VIDEO_ON | CLIENT_CAPTURE_ON; @@ -1639,10 +1616,6 @@ XGIPutVideo( pPriv->src_h = src_h; pPriv->height = src_h; - /* ImageInfo(src_x, src_y, drw_x, drw_y, src_w, src_h, drw_w, drw_h, - id, buf, width, height); - */ - # ifdef VC { struct v4l2_standard standard; @@ -1705,11 +1678,6 @@ XGIPutVideo( ErrorF("ioctl:VIDIOC_G_FMT Fail!\n"); } - /* if (width > fmt.fmt.pix.width && fmt.fmt.pix.width) - width = fmt.fmt.pix.width; - if (height > fmt.fmt.pix.height && fmt.fmt.pix.height) - height = fmt.fmt.pix.height; */ - fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_UYVY; fmt.fmt.pix.width = width; fmt.fmt.pix.height= height; @@ -1728,28 +1696,8 @@ XGIPutVideo( } pPriv->srcPitch = (((fmt.fmt.pix.width*16)/8) + 63) & ~63; - ErrorF("Giwas : PutVideo srcPitch = %x\n", pPriv->srcPitch); - -/* //To get the frame buff addrs allocated by v4l2 module - //so that I can make sure the capture buffs are valid - if (0 == ioctl(pPriv->fd, XGIIOC_G_FBUF, &xgifbuf)) - { - static int offset; - ErrorF("ioctl:XGIIOC_G_FBUF success!\n"); - pPriv->bufAddr[0] = offset = xgifbuf.fboffset[0]; - ErrorF("capture buf offset 0 = %x\n",offset); - pPriv->bufAddr[1] = offset = xgifbuf.fboffset[1]; - ErrorF("capture buf offset 1 = %x\n",offset); - - } - else - { - ErrorF("ioctl:XGIIOC_G_FBUF Fail!\n"); - } -*/ - + ErrorF("Giwas : PutVideo srcPitch = %x\n", pPriv->srcPitch); }//VIDEO_OFF - } if ((last_width != width) || (last_height != height)) @@ -1758,7 +1706,6 @@ XGIPutVideo( last_width = width; last_height = height; } - } # endif //VC @@ -1863,8 +1810,6 @@ static int XGIOpenV4l(XGIPortPrivPtr pPriv) struct v4l2_capability cap; ErrorF("Giwas: XGIOpenV4l called\n"); - - /*if (pPriv->overlay == TRUE) */ { if (-1 == pPriv->fd) { @@ -1891,7 +1836,6 @@ static int XGIOpenV4l(XGIPortPrivPtr pPriv) ErrorF("Giwas: XGI Xv open V4l: refcount=%d\n",pPriv->usecount); return 0; } - } static void XGICloseV4l(XGIPortPrivPtr pPriv) @@ -1905,4 +1849,3 @@ static void XGICloseV4l(XGIPortPrivPtr pPriv) } } # endif //VC - diff --git a/src/xgi_videohw.c b/src/xgi_videohw.c index 993cced..a1c2765 100644 --- a/src/xgi_videohw.c +++ b/src/xgi_videohw.c @@ -40,17 +40,7 @@ #include "fourcc.h" #define CAPTURE_340A1 -/* -static uint32_t _XGIRead(XGIPtr pXGI, uint32_t reg) -{ - return *(pXGI->IOBase + reg); -} -static void _XGIWrite(XGIPtr pXGI, uint32_t reg, uint32_t data) -{ - *(pXGI->IOBase + reg) = data; -} -*/ static uint8_t GetVideoReg(XGIPtr pXGI, uint8_t reg) { outb (pXGI->RelIO + vi_index_offset, reg); @@ -103,13 +93,7 @@ void SetSRRegMask(XGIPtr pXGI, uint8_t reg, uint8_t data, uint8_t mask) data = (data & mask) | (old & (~mask)); outb (pXGI->RelIO + sr_data_offset, data); } -/* -static void SetVCReg(XGIPtr pXGI, uint8_t reg, uint8_t data) -{ - outb (pXGI->RelIO + vc_index_offset, reg); - outb (pXGI->RelIO + vc_data_offset, data); -} -*/ + static void SetVCRegMask(XGIPtr pXGI, uint8_t reg, uint8_t data, uint8_t mask) { uint8_t old; @@ -119,19 +103,7 @@ static void SetVCRegMask(XGIPtr pXGI, uint8_t reg, uint8_t data, uint8_t mask) data = (data & mask) | (old & (~mask)); outb (pXGI->RelIO + vc_data_offset, data); } -/* -static uint8_t GetXGIReg(XGIPtr pXGI, uint8_t index_offset, uint8_t reg) -{ - outb (pXGI->RelIO + index_offset, reg); - return inb(pXGI->RelIO + index_offset+1); -} -static void SetXGIReg(XGIPtr pXGI, uint8_t index_offset, uint8_t reg, uint8_t data) -{ - outb (pXGI->RelIO + index_offset, reg); - outb (pXGI->RelIO + index_offset+1, data); -} -*/ static float tap_dda_func(float x) { double pi = 3.14159265358979; @@ -425,16 +397,12 @@ XGIResetVideo(ScrnInfoPtr pScrn) SetSRReg (pXGI, 0x05, 0x86); if (GetSRReg (pXGI, 0x05) != 0xa1) {} - /* xf86DrvMsg(pScrn->scrnIndex, X_ERROR, */ - /* "Standard password not initialize\n"); */ } if (GetVideoReg (pXGI, Index_VI_Passwd) != 0xa1) { SetVideoReg (pXGI, Index_VI_Passwd, 0x86); if (GetVideoReg (pXGI, Index_VI_Passwd) != 0xa1) {} - /* xf86DrvMsg(pScrn->scrnIndex, X_ERROR, */ - /* "Video password not initialize\n"); */ } /* Initial Overlay 1 */ @@ -724,9 +692,7 @@ SetOverlayReg(XGIPtr pXGI, XGIOverlayPtr pOverlay) if(pOverlay->pixelFormat == PIXEL_FMT_YV12) uvpitch >>= 1; -/* - bYUV_Pitch_High = (HIBYTE(LOWORD(uvpitch))<<4) & 0xf0 | - (HIBYTE(LOWORD(tmpYPitch))) & 0x0f; */ + bYUV_Pitch_High = ((HIBYTE(LOWORD(uvpitch))<<4) & 0xf0) | ((HIBYTE(LOWORD(tmpYPitch))) & 0x0f); SetVideoReg (pXGI, Index_VI_Disp_UV_Buf_Pitch_Low, LOBYTE(LOWORD(uvpitch))); SetVideoReg (pXGI, Index_VI_Disp_Y_UV_Buf_Pitch_High, bYUV_Pitch_High); @@ -758,13 +724,8 @@ SetOverlayReg(XGIPtr pXGI, XGIOverlayPtr pOverlay) /* [16:12] save in the D[4:0] */ SetVideoRegMask(pXGI, Index_VI_Disp_Y_Buf_Pitch_EXT_High, (tmpYPitch>>12)&0x1f , 0x1f); - /* start address ready */ SetVideoRegMask(pXGI, Index_VI_Control_Misc3, 0x03, 0x03); - - /* set contrast factor */ - /* SetVideoRegMask(pXGI, Index_VI_Contrast_Enh_Ctrl, pOverlay->contrastCtrl<<6, 0xc0); */ - /* SetVideoReg (pXGI, Index_VI_Contrast_Factor, pOverlay->contrastFactor); */ } void diff --git a/src/xgi_videohw.h b/src/xgi_videohw.h index 24d751c..ea1e8d9 100644 --- a/src/xgi_videohw.h +++ b/src/xgi_videohw.h @@ -336,10 +336,6 @@ typedef struct { #define I2C_SDA 0x01 #define I2C_DELAY 10 -/******************************* -* Function * -*******************************/ -/* static uint8_t vblank_active_CRT1(XGIPtr); */ void SetOverlayReg(XGIPtr, XGIOverlayPtr); void SetColorkeyReg(XGIPtr, uint32_t); void SetSelectOverlayReg(XGIPtr, uint8_t); |
