From 9e8d8489922d8b647b28de06045e8fddf0ffc62f Mon Sep 17 00:00:00 2001 From: "Y.C. Chen" Date: Tue, 22 Jun 2010 15:17:27 +0800 Subject: modified: autogen.sh modified: configure.ac modified: src/ast.h modified: src/ast_2dtool.c modified: src/ast_2dtool.h modified: src/ast_accel.c modified: src/ast_driver.c modified: src/ast_mode.c modified: src/ast_mode.h modified: src/ast_vgatool.c --- autogen.sh | 0 configure.ac | 2 +- src/ast.h | 3 +- src/ast_2dtool.c | 78 ++++++++++++++++++++++++- src/ast_2dtool.h | 51 ++++++++++++++++ src/ast_accel.c | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- src/ast_driver.c | 27 +++++++-- src/ast_mode.c | 95 +++++++++++++++++++++++------- src/ast_mode.h | 4 ++ src/ast_vgatool.c | 35 +++++++++-- 10 files changed, 423 insertions(+), 41 deletions(-) mode change 100755 => 100644 autogen.sh diff --git a/autogen.sh b/autogen.sh old mode 100755 new mode 100644 diff --git a/configure.ac b/configure.ac index 3398c1c..3ea98f7 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ AC_PREREQ(2.57) AC_INIT([xf86-video-ast], - 0.89.9, + 0.91.9, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xf86-video-ast) diff --git a/src/ast.h b/src/ast.h index 0757e64..d27fa48 100644 --- a/src/ast.h +++ b/src/ast.h @@ -50,7 +50,8 @@ typedef enum _CHIP_ID { AST2100, AST1100, AST2200, - AST2150 + AST2150, + AST2300 } CHIP_ID; /* AST REC Info */ diff --git a/src/ast_2dtool.c b/src/ast_2dtool.c index 63a059d..61f549c 100644 --- a/src/ast_2dtool.c +++ b/src/ast_2dtool.c @@ -55,10 +55,12 @@ #include "ast.h" #ifdef Accel_2D +typedef Bool (*PFN_bENABLE_CMDQ)(ScrnInfoPtr , ASTRecPtr); /* Prototype type declaration */ Bool bInitCMDQInfo(ScrnInfoPtr pScrn, ASTRecPtr pAST); Bool bEnableCMDQ(ScrnInfoPtr pScrn, ASTRecPtr pAST); +Bool bEnableCMDQ2300(ScrnInfoPtr pScrn, ASTRecPtr pAST); Bool bEnable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST); void vDisable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST); void vWaitEngIdle(ScrnInfoPtr pScrn, ASTRecPtr pAST); @@ -184,17 +186,87 @@ bEnableCMDQ(ScrnInfoPtr pScrn, ASTRecPtr pAST) return (TRUE); } +Bool +bEnableCMDQ2300(ScrnInfoPtr pScrn, ASTRecPtr pAST) +{ + ULONG ulVMCmdQBasePort = 0, ulNewModeData; + + vWaitEngIdle(pScrn, pAST); + + /* set DBG Select Info */ + if (pAST->DBGSelect) + { + *(ULONG *) (pAST->MMIOVirtualAddr + 0x804C) = (ULONG) (pAST->DBGSelect); + } + + /* set CMDQ base */ + switch (pAST->CMDQInfo.ulCMDQType) + { + case VM_CMD_QUEUE: + /* enable new CMDQ mode */ + ulNewModeData = 0xc00000f0; + /* set CMDQ Size */ + switch (pAST->CMDQInfo.ulCMDQSize) + { + case CMD_QUEUE_SIZE_256K: + ulNewModeData |= 0x00000000; + break; + + case CMD_QUEUE_SIZE_512K: + ulNewModeData |= 0x00000004; + break; + + case CMD_QUEUE_SIZE_1M: + ulNewModeData |= 0x00000008; + break; + + case CMD_QUEUE_SIZE_2M: + ulNewModeData |= 0x0000000C; + break; + + default: + return(FALSE); + break; + } + *(ULONG *) (pAST->MMIOVirtualAddr + 0x8060) = ulNewModeData; + + /* Set CMDQ Base */ + ulVMCmdQBasePort = (pAST->CMDQInfo.ulCMDQOffsetAddr - 0) >> 3; + *(ULONG *) (pAST->CMDQInfo.pjCmdQBasePort) = ulVMCmdQBasePort; + pAST->CMDQInfo.ulWritePointer = *(ULONG *) (pAST->CMDQInfo.pjWritePort) << 3; + break; + + case VM_CMD_MMIO: + /* enable new CMDQ mode */ + ulNewModeData = 0xc00000f2; + *(ULONG *) (pAST->MMIOVirtualAddr + 0x8060) = ulNewModeData; + break; + + default: + return (FALSE); + break; + } + + return (TRUE); + +} /* bEnableCMDQ2300 */ + Bool bEnable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST) { ULONG ulData; - + PFN_bENABLE_CMDQ pfnEnableCMDQ = bEnableCMDQ; + + if (pAST->jChipType == AST2300) + pfnEnableCMDQ = bEnableCMDQ2300; + switch (pAST->jChipType) { case AST2100: case AST1100: case AST2200: - case AST2150: + case AST2150: + case AST2300: *(ULONG *) (pAST->MMIOVirtualAddr + 0xF004) = 0x1e6e0000; *(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x1; @@ -211,7 +283,7 @@ bEnable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST) return (FALSE); } - if (!bEnableCMDQ(pScrn, pAST)) + if (!pfnEnableCMDQ(pScrn, pAST)) { vDisable2D(pScrn, pAST); return (FALSE); diff --git a/src/ast_2dtool.h b/src/ast_2dtool.h index b6ca79d..9af388b 100644 --- a/src/ast_2dtool.h +++ b/src/ast_2dtool.h @@ -83,6 +83,8 @@ typedef struct _PKT_SC #define MASK_LINE_WIDTH 0x7FF #define MASK_LINE_K1 0x3FFFFF #define MASK_LINE_K2 0x3FFFFF +#define MASK_AIPLINE_X 0xFFF +#define MASK_AIPLINE_Y 0xFFF #define MAX_PATReg_Size 256 @@ -113,6 +115,8 @@ typedef struct _PKT_SC #define MMIOREG_LINE_K2 (pAST->MMIOVirtualAddr + 0x8028) #define MMIOREG_LINE_STYLE1 (pAST->MMIOVirtualAddr + 0x802C) #define MMIOREG_LINE_STYLE2 (pAST->MMIOVirtualAddr + 0x8030) +#define MMIOREG_LINE_XY2 (pAST->MMIOVirtualAddr + 0x8014) +#define MMIOREG_LINE_NUMBER (pAST->MMIOVirtualAddr + 0x8018) /* CMDQ Reg */ #define CMDQREG_SRC_BASE (0x00 << 24) @@ -140,12 +144,15 @@ typedef struct _PKT_SC #define CMDQREG_LINE_K2 (0x0A << 24) #define CMDQREG_LINE_STYLE1 (0x0B << 24) #define CMDQREG_LINE_STYLE2 (0x0C << 24) +#define CMDQREG_LINE_XY2 (0x05 << 24) +#define CMDQREG_LINE_NUMBER (0x06 << 24) /* CMD Reg. Definition */ #define CMD_BITBLT 0x00000000 #define CMD_LINEDRAW 0x00000001 #define CMD_COLOREXP 0x00000002 #define CMD_ENHCOLOREXP 0x00000003 +#define CMD_TRANSPARENTBLT 0x00000004 #define CMD_MASK 0x00000007 #define CMD_DISABLE_CLIP 0x00000000 @@ -172,6 +179,9 @@ typedef struct _PKT_SC #define CMD_Y_INC 0x00000000 #define CMD_Y_DEC 0x00100000 +#define CMD_NT_LINE 0x00000000 +#define CMD_NORMAL_LINE 0x00400000 + #define CMD_DRAW_LAST_PIXEL 0x00000000 #define CMD_NOT_DRAW_LAST_PIXEL 0x00800000 @@ -359,6 +369,30 @@ typedef struct { *(ULONG *)(MMIOREG_LINE_STYLE2) = (ULONG)(pat); \ } while (*(volatile ULONG *)(MMIOREG_LINE_STYLE2) != (ULONG)(pat)); \ } + +/* AIP Line CMD */ +#define AIPSetupLineXY_MMIO(x, y) \ + { \ + ULONG linexy; \ + linexy = (ULONG)(((x & MASK_AIPLINE_X) << 16) + (y & MASK_AIPLINE_Y)); \ + do { \ + *(ULONG *)(MMIOREG_LINE_XY) = linexy; \ + } while (*(volatile ULONG *)(MMIOREG_LINE_XY) != linexy); \ + } +#define AIPSetupLineXY2_MMIO(x, y) \ + { \ + ULONG linexy; \ + linexy = (ULONG)(((x & MASK_AIPLINE_X) << 16) + (y & MASK_AIPLINE_Y)); \ + do { \ + *(ULONG *)(MMIOREG_LINE_XY2) = linexy; \ + } while (*(volatile ULONG *)(MMIOREG_LINE_XY2) != linexy); \ + } +#define AIPSetupLineNumber_MMIO(no) \ + { \ + do { \ + *(ULONG *)(MMIOREG_LINE_NUMBER) = (ULONG) no; \ + } while (*(volatile ULONG *)(MMIOREG_LINE_NUMBER) != (ULONG) no); \ + } /* CMDQ Mode Macro */ #define mUpdateWritePointer *(ULONG *) (pAST->CMDQInfo.pjWritePort) = (pAST->CMDQInfo.ulWritePointer >>3) @@ -482,3 +516,20 @@ typedef struct { addr->PKT_SC_dwHeader = (ULONG) (PKT_NULL_CMD); \ addr->PKT_SC_dwData[0] = (ULONG) 0; \ } + +/* AIP Line CMD */ +#define AIPSetupLineXY(addr, x, y) \ + { \ + addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_XY); \ + addr->PKT_SC_dwData[0] = (ULONG)(((x & MASK_AIPLINE_X) << 16) + (y & MASK_AIPLINE_Y)); \ + } +#define AIPSetupLineXY2(addr, x, y) \ + { \ + addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_XY2); \ + addr->PKT_SC_dwData[0] = (ULONG)(((x & MASK_AIPLINE_X) << 16) + (y & MASK_AIPLINE_Y)); \ + } +#define AIPSetupLineNumber(addr, no) \ + { \ + addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_NUMBER); \ + addr->PKT_SC_dwData[0] = (ULONG)(no); \ + } diff --git a/src/ast_accel.c b/src/ast_accel.c index b15da59..ad8f1b1 100644 --- a/src/ast_accel.c +++ b/src/ast_accel.c @@ -152,6 +152,12 @@ static void ASTSetClippingRectangle(ScrnInfoPtr pScrn, static void ASTDisableClipping(ScrnInfoPtr pScrn); static void ASTSetHWClipping(ScrnInfoPtr pScrn, int delta_y); +static void AIPSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, + int x1, int y1, int x2, int y2, int flags); +static void AIPSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, + int x1, int y1, int x2, int y2, + int flags, int phase); + Bool ASTAccelInit(ScreenPtr pScreen) { @@ -189,17 +195,33 @@ ASTAccelInit(ScreenPtr pScreen) /* Solid Lines */ if (pAST->ENGCaps & ENG_CAP_SolidLine) { - infoPtr->SetupForSolidLine = ASTSetupForSolidLine; + if (pAST->jChipType == AST2300) + { + infoPtr->SubsequentSolidTwoPointLine = AIPSubsequentSolidTwoPointLine; + } + else + { + infoPtr->SubsequentSolidTwoPointLine = ASTSubsequentSolidTwoPointLine; + } + + infoPtr->SetupForSolidLine = ASTSetupForSolidLine; infoPtr->SubsequentSolidHorVertLine = ASTSubsequentSolidHorVertLine; - infoPtr->SubsequentSolidTwoPointLine = ASTSubsequentSolidTwoPointLine; infoPtr->SolidLineFlags = NO_PLANEMASK; } /* Dashed Lines */ if (pAST->ENGCaps & ENG_CAP_DashedLine) - { - infoPtr->SetupForDashedLine = ASTSetupForDashedLine; - infoPtr->SubsequentDashedTwoPointLine = ASTSubsequentDashedTwoPointLine; + { + if (pAST->jChipType == AST2300) + { + infoPtr->SubsequentDashedTwoPointLine = AIPSubsequentDashedTwoPointLine; + } + else + { + infoPtr->SubsequentDashedTwoPointLine = ASTSubsequentDashedTwoPointLine; + } + + infoPtr->SetupForDashedLine = ASTSetupForDashedLine; infoPtr->DashPatternMaxLength = 64; infoPtr->DashedLineFlags = NO_PLANEMASK | LINE_PATTERN_MSBFIRST_LSBJUSTIFIED; @@ -1526,4 +1548,141 @@ ASTDisableClipping(ScrnInfoPtr pScrn) pAST->EnableClip = FALSE; } +static void AIPSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, + int x1, int y1, int x2, int y2, int flags) +{ + + ASTRecPtr pAST = ASTPTR(pScrn); + PKT_SC *pSingleCMD; + ULONG dstbase, ulCommand; + ULONG miny, maxy; +/* + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentSolidTwoPointLine\n"); +*/ + + /* Modify Reg. Value */ + ulCommand = (pAST->ulCMDReg & (~CMD_MASK)) | CMD_LINEDRAW | CMD_NORMAL_LINE; + if(flags & OMIT_LAST) + ulCommand |= CMD_NOT_DRAW_LAST_PIXEL; + else + ulCommand &= ~CMD_NOT_DRAW_LAST_PIXEL; + if (pAST->EnableClip) + ulCommand |= CMD_ENABLE_CLIP; + else + ulCommand &= ~CMD_ENABLE_CLIP; + dstbase = 0; + miny = (y1 > y2) ? y2 : y1; + maxy = (y1 > y2) ? y1 : y2; + if(maxy >= pScrn->virtualY) { + dstbase = pAST->VideoModeInfo.ScreenPitch * miny; + y1 -= miny; + y2 -= miny; + } + + if (!pAST->MMIO2D) + { + /* Write to CMDQ */ + pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*5); + + ASTSetupDSTBase(pSingleCMD, dstbase); + pSingleCMD++; + AIPSetupLineXY(pSingleCMD, x1, y1); + pSingleCMD++; + AIPSetupLineXY2(pSingleCMD, x2, y2); + pSingleCMD++; + AIPSetupLineNumber(pSingleCMD, 0); + pSingleCMD++; + ASTSetupCMDReg(pSingleCMD, ulCommand); + + /* Update Write Pointer */ + mUpdateWritePointer; + + /* Patch KDE pass abnormal point, ycchen@052507 */ + vWaitEngIdle(pScrn, pAST); + + } + else + { + ASTSetupDSTBase_MMIO(dstbase); + AIPSetupLineXY_MMIO(x1, y1); + AIPSetupLineXY2_MMIO(x2, y2); + AIPSetupLineNumber_MMIO(0); + ASTSetupCMDReg_MMIO(ulCommand); + + vWaitEngIdle(pScrn, pAST); + + } + + +} /* end of AIPSubsequentSolidTwoPointLine */ + +static void +AIPSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, + int x1, int y1, int x2, int y2, + int flags, int phase) +{ + + ASTRecPtr pAST = ASTPTR(pScrn); + PKT_SC *pSingleCMD; + ULONG dstbase, ulCommand; + ULONG miny, maxy; +/* + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentDashedTwoPointLine\n"); +*/ + + /* Modify Reg. Value */ + ulCommand = pAST->ulCMDReg | CMD_NORMAL_LINE; + if(flags & OMIT_LAST) + ulCommand |= CMD_NOT_DRAW_LAST_PIXEL; + else + ulCommand &= ~CMD_NOT_DRAW_LAST_PIXEL; + if (pAST->EnableClip) + ulCommand |= CMD_ENABLE_CLIP; + else + ulCommand &= ~CMD_ENABLE_CLIP; + dstbase = 0; + miny = (y1 > y2) ? y2 : y1; + maxy = (y1 > y2) ? y1 : y2; + if(maxy >= pScrn->virtualY) { + dstbase = pAST->VideoModeInfo.ScreenPitch * miny; + y1 -= miny; + y2 -= miny; + } + + if (!pAST->MMIO2D) + { + /* Write to CMDQ */ + pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*5); + + ASTSetupDSTBase(pSingleCMD, dstbase); + pSingleCMD++; + AIPSetupLineXY(pSingleCMD, x1, y1); + pSingleCMD++; + AIPSetupLineXY2(pSingleCMD, x2, y2); + pSingleCMD++; + AIPSetupLineNumber(pSingleCMD, 0); + pSingleCMD++; + ASTSetupCMDReg(pSingleCMD, ulCommand); + + /* Update Write Pointer */ + mUpdateWritePointer; + + /* Patch KDE pass abnormal point, ycchen@052507 */ + vWaitEngIdle(pScrn, pAST); + + } + else + { + ASTSetupDSTBase_MMIO(dstbase); + AIPSetupLineXY_MMIO(x1, y1); + AIPSetupLineXY2_MMIO(x2, y2); + AIPSetupLineNumber_MMIO(0); + ASTSetupCMDReg_MMIO(ulCommand); + + vWaitEngIdle(pScrn, pAST); + + } + +} + #endif /* end of Accel_2D */ diff --git a/src/ast_driver.c b/src/ast_driver.c index 4b10055..bb46119 100644 --- a/src/ast_driver.c +++ b/src/ast_driver.c @@ -543,8 +543,10 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) bASTRegInit(pScrn); /* Get Chip Type */ - if (PCI_DEV_REVISION(pAST->PciInfo) >= 0x10) - GetChipType(pScrn); + if (PCI_DEV_REVISION(pAST->PciInfo) >= 0x20) + pAST->jChipType = AST2300; + else if (PCI_DEV_REVISION(pAST->PciInfo) >= 0x10) + GetChipType(pScrn); else pAST->jChipType = AST2000; @@ -587,7 +589,7 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) clockRanges->doubleScanAllowed = FALSE; /* Add for AST2100, ycchen@061807 */ - if ((pAST->jChipType == AST2100) || (pAST->jChipType == AST2200)) + if ((pAST->jChipType == AST2100) || (pAST->jChipType == AST2200) || (pAST->jChipType == AST2300)) i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, 0, 320, 1920, 8 * pScrn->bitsPerPixel, @@ -855,7 +857,8 @@ ASTSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) vDisable2D(pScrn, pAST); #endif - ASTRestore(pScrn); + /* Fixed display abnormal on the of the screen if run xvidtune, ycchen@122909 */ + /* ASTRestore(pScrn); */ return ASTModeInit(pScrn, mode); @@ -960,10 +963,24 @@ ASTValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) } /* Add for AST2100, ycchen@061807 */ - if ((pAST->jChipType == AST2100) || (pAST->jChipType == AST2200)) + if ( (pAST->jChipType == AST2100) || (pAST->jChipType == AST2200) || (pAST->jChipType == AST2300) ) { if ( (mode->CrtcHDisplay == 1920) && (mode->CrtcVDisplay == 1200) ) return MODE_OK; + if ( (mode->CrtcHDisplay == 1920) && (mode->CrtcVDisplay == 1080) ) + return MODE_OK; + } + + if ((pAST->jChipType == AST1100) || (pAST->jChipType == AST2100) || (pAST->jChipType == AST2200) || (pAST->jChipType == AST2150) || (pAST->jChipType == AST2300)) + { + + if ( (mode->CrtcHDisplay == 1680) && (mode->CrtcVDisplay == 1050) ) + return MODE_OK; + if ( (mode->CrtcHDisplay == 1440) && (mode->CrtcVDisplay == 900) ) + return MODE_OK; + if ( (mode->CrtcHDisplay == 1280) && (mode->CrtcVDisplay == 800) ) + return MODE_OK; + } switch (mode->CrtcHDisplay) diff --git a/src/ast_mode.c b/src/ast_mode.c index b4ca02f..ed24c54 100644 --- a/src/ast_mode.c +++ b/src/ast_mode.c @@ -151,7 +151,7 @@ VBIOS_ENHTABLE_STRUCT Res800x600Table[] = { {1056, 800, 16, 80, 625, 600, 1, 3, VCLK49_5, /* 75Hz */ (SyncPP | Charx8Dot), 75, 4, 0x30 }, {1048, 800, 32, 64, 631, 600, 1, 3, VCLK56_25, /* 85Hz */ - (SyncPP | Charx8Dot), 85, 5, 0x30 }, + (SyncPP | Charx8Dot), 84, 5, 0x30 }, {1048, 800, 32, 64, 631, 600, 1, 3, VCLK56_25, /* end */ (SyncPP | Charx8Dot), 0xFF, 5, 0x30 }, }; @@ -195,6 +195,37 @@ VBIOS_ENHTABLE_STRUCT Res1920x1200Table[] = { (SyncNP | Charx8Dot), 0xFF, 1, 0x34 }, }; +/* 16:10 */ +VBIOS_ENHTABLE_STRUCT Res1280x800Table[] = { + {1680, 1280, 72,128, 831, 800, 3, 6, VCLK83_5, /* 60Hz */ + (SyncPN | Charx8Dot | LineCompareOff), 60, 1, 0x35 }, + {1680, 1280, 72,128, 831, 800, 3, 6, VCLK83_5, /* 60Hz */ + (SyncPN | Charx8Dot | LineCompareOff), 0xFF, 1, 0x35 }, + +}; + +VBIOS_ENHTABLE_STRUCT Res1440x900Table[] = { + {1904, 1440, 80,152, 934, 900, 3, 6, VCLK106_5, /* 60Hz */ + (SyncPN | Charx8Dot | LineCompareOff), 60, 1, 0x36 }, + {1904, 1440, 80,152, 934, 900, 3, 6, VCLK106_5, /* 60Hz */ + (SyncPN | Charx8Dot | LineCompareOff), 0xFF, 1, 0x36 }, +}; + +VBIOS_ENHTABLE_STRUCT Res1680x1050Table[] = { + {2240, 1680,104,176, 1089, 1050, 3, 6, VCLK146_25, /* 60Hz */ + (SyncPN | Charx8Dot | LineCompareOff), 60, 1, 0x37 }, + {2240, 1680,104,176, 1089, 1050, 3, 6, VCLK146_25, /* 60Hz */ + (SyncPN | Charx8Dot | LineCompareOff), 0xFF, 1, 0x37 }, +}; + +/* HDTV */ +VBIOS_ENHTABLE_STRUCT Res1920x1080Table[] = { + {2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5, /* 60Hz */ + (SyncNP | Charx8Dot | LineCompareOff), 60, 1, 0x38 }, + {2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5, /* 60Hz */ + (SyncNP | Charx8Dot | LineCompareOff), 0xFF, 1, 0x38 }, +}; + VBIOS_DCLK_INFO DCLKTable [] = { {0x2C, 0xE7, 0x03}, /* 00: VCLK25_175 */ {0x95, 0x62, 0x03}, /* 01: VCLK28_322 */ @@ -212,7 +243,11 @@ VBIOS_DCLK_INFO DCLKTable [] = { {0x85, 0x24, 0x00}, /* 0D: VCLK135 */ {0x67, 0x22, 0x00}, /* 0E: VCLK157_5 */ {0x6A, 0x22, 0x00}, /* 0F: VCLK162 */ - {0x4d, 0x4c, 0x80}, /* 10: VCLK193_25 */ + {0x4d, 0x4c, 0x80}, /* 10: VCLK154 */ + {0xa7, 0x78, 0x80}, /* 11: VCLK83.5 */ + {0x28, 0x49, 0x80}, /* 12: VCLK106.5 */ + {0x37, 0x49, 0x80}, /* 13: VCLK146.25 */ + {0x1f, 0x45, 0x80}, /* 14: VCLK148.5 */ }; VBIOS_DAC_INFO DAC_TEXT[] = { @@ -404,12 +439,12 @@ Bool bGetAST1000VGAModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_ break; case 16: pVGAModeInfo->pStdTableEntry = (PVBIOS_STDTABLE_STRUCT) &StdTable[HiCModeIndex]; - ulColorIndex = HiCModeIndex-1; + ulColorIndex = HiCModeIndex; break; case 24: case 32: pVGAModeInfo->pStdTableEntry = (PVBIOS_STDTABLE_STRUCT) &StdTable[TrueCModeIndex]; - ulColorIndex = TrueCModeIndex-1; + ulColorIndex = TrueCModeIndex; break; default: return (FALSE); @@ -418,24 +453,37 @@ Bool bGetAST1000VGAModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_ switch (mode->CrtcHDisplay) { case 640: - pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res640x480Table[ulRefreshRateIndex]; - break; + pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res640x480Table[ulRefreshRateIndex]; + break; case 800: - pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res800x600Table[ulRefreshRateIndex]; - break; + pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res800x600Table[ulRefreshRateIndex]; + break; case 1024: - pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1024x768Table[ulRefreshRateIndex]; - break; + pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1024x768Table[ulRefreshRateIndex]; + break; case 1280: - pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1280x1024Table[ulRefreshRateIndex]; - break; + if (mode->CrtcVDisplay == 800) + pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1280x800Table[ulRefreshRateIndex]; + else + pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1280x1024Table[ulRefreshRateIndex]; + break; + case 1440: + pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1440x900Table[ulRefreshRateIndex]; + break; case 1600: - pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1600x1200Table[ulRefreshRateIndex]; + pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1600x1200Table[ulRefreshRateIndex]; + break; + case 1680: + pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1680x1050Table[ulRefreshRateIndex]; break; case 1920: - pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1920x1200Table[ulRefreshRateIndex]; - break; default: - return (FALSE); + if (mode->CrtcVDisplay == 1080) + pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1920x1080Table[ulRefreshRateIndex]; + else + pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1920x1200Table[ulRefreshRateIndex]; + break; + default: + return (FALSE); } /* Get Proper Mode Index */ @@ -453,8 +501,8 @@ Bool bGetAST1000VGAModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_ } /* Update mode CRTC info */ - ulHBorder = (pVGAModeInfo->pEnhTableEntry->Flags & HBorder) ? 1:0; - ulVBorder = (pVGAModeInfo->pEnhTableEntry->Flags & VBorder) ? 1:0; + ulHBorder = (pVGAModeInfo->pEnhTableEntry->Flags & HBorder) ? 8:0; + ulVBorder = (pVGAModeInfo->pEnhTableEntry->Flags & VBorder) ? 8:0; mode->CrtcHTotal = (int) pVGAModeInfo->pEnhTableEntry->HT; mode->CrtcHBlankStart = (int) (pVGAModeInfo->pEnhTableEntry->HDE + ulHBorder); @@ -569,10 +617,10 @@ vSetCRTCReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInf if (usTemp & 0x20) jReg05 |= 0x80; /* HBE D[5] */ if (usTemp & 0x40) jRegAD |= 0x01; /* HBE D[6] */ SetIndexRegMask(CRTC_PORT,0x03, 0xE0, (UCHAR) (usTemp & 0x1F)); - usTemp = (mode->CrtcHSyncStart >> 3 ) + 2; + usTemp = (mode->CrtcHSyncStart >> 3 ) - 1; if (usTemp & 0x100) jRegAC |= 0x40; /* HRS D[5] */ SetIndexRegMask(CRTC_PORT,0x04, 0x00, (UCHAR) (usTemp)); - usTemp = ((mode->CrtcHSyncEnd >> 3 ) + 2) & 0x3F; + usTemp = ((mode->CrtcHSyncEnd >> 3 ) - 1) & 0x3F; if (usTemp & 0x20) jRegAD |= 0x04; /* HRE D[5] */ SetIndexRegMask(CRTC_PORT,0x05, 0x60, (UCHAR) ((usTemp & 0x1F) | jReg05)); @@ -682,7 +730,12 @@ void vSetExtReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAMod SetIndexRegMask(CRTC_PORT,0xA8, 0xFD, (UCHAR) jRegA8); /* Set Threshold */ - if ((pAST->jChipType == AST2100) || (pAST->jChipType == AST1100) || (pAST->jChipType == AST2200) || (pAST->jChipType == AST2150) ) + if (pAST->jChipType == AST2300) + { + SetIndexReg(CRTC_PORT,0xA7, 0x6F); + SetIndexReg(CRTC_PORT,0xA6, 0x3F); + } + else if ((pAST->jChipType == AST2100) || (pAST->jChipType == AST1100) || (pAST->jChipType == AST2200) || (pAST->jChipType == AST2150) ) { SetIndexReg(CRTC_PORT,0xA7, 0x3F); SetIndexReg(CRTC_PORT,0xA6, 0x2F); diff --git a/src/ast_mode.h b/src/ast_mode.h index 054d414..1b3cd66 100644 --- a/src/ast_mode.h +++ b/src/ast_mode.h @@ -50,6 +50,10 @@ #define VCLK162 0x0F /* #define VCLK193_25 0x10 */ #define VCLK154 0x10 +#define VCLK83_5 0x11 +#define VCLK106_5 0x12 +#define VCLK146_25 0x13 +#define VCLK148_5 0x14 /* Flags Definition */ #define Charx8Dot 0x00000001 diff --git a/src/ast_vgatool.c b/src/ast_vgatool.c index 5629b85..356e7ba 100644 --- a/src/ast_vgatool.c +++ b/src/ast_vgatool.c @@ -219,7 +219,7 @@ GetMaxDCLK(ScrnInfoPtr pScrn) /* Get Bandwidth */ /* Modify DARM utilization to 60% for AST1100/2100 16bits DRAM, ycchen@032508 */ - if ( ((pAST->jChipType == AST2100) || (pAST->jChipType == AST1100) || (pAST->jChipType == AST2200) || (pAST->jChipType == AST2150)) && (ulDRAMBusWidth == 16) ) + if ( ((pAST->jChipType == AST2100) || (pAST->jChipType == AST1100) || (pAST->jChipType == AST2200) || (pAST->jChipType == AST2150) || (pAST->jChipType == AST2300)) && (ulDRAMBusWidth == 16) ) DRAMEfficiency = 600; ulDRAMBandwidth = ulMCLK * ulDRAMBusWidth * 2 / 8; ActualDRAMBandwidth = ulDRAMBandwidth * DRAMEfficiency / 1000; @@ -235,7 +235,7 @@ GetMaxDCLK(ScrnInfoPtr pScrn) ulDCLK = ActualDRAMBandwidth / ((pScrn->bitsPerPixel+1) / 8); /* Add for AST2100, ycchen@061807 */ - if ((pAST->jChipType == AST2100) || (pAST->jChipType == AST2200)) + if ((pAST->jChipType == AST2100) || (pAST->jChipType == AST2200) || (pAST->jChipType == AST2300)) { if (ulDCLK > 200) ulDCLK = 200; } @@ -537,7 +537,17 @@ Bool bIsVGAEnabled(ScrnInfoPtr pScrn) ch = GetReg(pAST->RelocateIO+0x43); - return (ch & 0x01); + if (ch) + { + + vASTOpenKey(pScrn); + + GetIndexRegMask(CRTC_PORT, 0xB6, 0xFF, ch); + + return (ch & 0x04); + } + + return (0); } void vEnableVGA(ScrnInfoPtr pScrn) @@ -553,11 +563,18 @@ void vEnableVGA(ScrnInfoPtr pScrn) UCHAR ExtRegInfo[] = { 0x0F, - 0x07, + 0x04, 0x1C, 0xFF }; +UCHAR ExtRegInfo_AST2300[] = { + 0x0F, + 0x04, + 0x1D, + 0xFF +}; + void vSetDefExtReg(ScrnInfoPtr pScrn) { ASTRecPtr pAST; @@ -572,7 +589,11 @@ void vSetDefExtReg(ScrnInfoPtr pScrn) } /* Set Ext. Reg */ - pjExtRegInfo = ExtRegInfo; + if (pAST->jChipType == AST2300) + pjExtRegInfo = ExtRegInfo_AST2300; + else + pjExtRegInfo = ExtRegInfo; + jIndex = 0xA0; while (*(UCHAR *) (pjExtRegInfo) != 0xFF) { @@ -581,6 +602,10 @@ void vSetDefExtReg(ScrnInfoPtr pScrn) pjExtRegInfo++; } + /* disable standard IO/MEM decode if secondary */ + if (!xf86IsPrimaryPci(pAST->PciInfo)) + SetIndexRegMask(CRTC_PORT,0xA1, 0xFF, 0x03); + /* Set Ext. Default */ SetIndexRegMask(CRTC_PORT,0x8C, 0x00, 0x01); SetIndexRegMask(CRTC_PORT,0xB7, 0x00, 0x00); -- cgit v1.2.3