summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorY.C. Chen <yc_chen@aspeedtech.com>2009-06-04 14:24:31 +0800
committerY.C. Chen <yc_chen@aspeedtech.com>2009-06-04 14:24:31 +0800
commit2eb00170bfb9defe99a10dbfd4039952670fd099 (patch)
tree5a843f4db10474ff5f9d43254a720c1e5ae71a0d
parente7e38d2ba0fcd6c1debbfd1062663a18f25f6266 (diff)
xf86-video-ast-v.0.89.8
-rw-r--r--ChangeLog6
-rw-r--r--[-rwxr-xr-x]autogen.sh0
-rw-r--r--configure.ac2
-rw-r--r--src/ast.h6
-rw-r--r--src/ast_accel.c107
-rw-r--r--src/ast_cursor.c21
-rw-r--r--src/ast_driver.c36
-rw-r--r--src/ast_vgatool.c160
-rw-r--r--src/ast_vgatool.h10
9 files changed, 298 insertions, 50 deletions
diff --git a/ChangeLog b/ChangeLog
index 3d05159..0175832 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-06-03 Y.C. Chen <yc_chen@aspedtech.com>
+ * src/ast_driver.c, ast_vgatool.c
+ - Fixed the screen flashing issue while running x11perf
+ * src/ast.h, ast_driver.c, ast_vgatool.c/h
+ - Fixed Suspend can't resume issue
+
2009-04-13 Y.C. Chen <yc_chen@aspedtech.com>
* src/ast.h, ast_cursor.c
- Fixed xorg bugzilla #20606
diff --git a/autogen.sh b/autogen.sh
index 904cd67..904cd67 100755..100644
--- a/autogen.sh
+++ b/autogen.sh
diff --git a/configure.ac b/configure.ac
index e34f736..8350c6d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@
AC_PREREQ(2.57)
AC_INIT([xf86-video-ast],
- 0.89.0,
+ 0.89.8,
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
xf86-video-ast)
diff --git a/src/ast.h b/src/ast.h
index bafd29b..0757e64 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -158,6 +158,7 @@ typedef struct _ASTRec {
ScreenBlockHandlerProcPtr BlockHandler;
UCHAR jChipType;
+ UCHAR jDRAMType;
Bool noAccel;
Bool noHWC;
@@ -186,6 +187,11 @@ typedef struct _ASTRec {
HWCINFO HWCInfo;
ULONG ulCMDReg;
Bool EnableClip;
+
+ int clip_left;
+ int clip_top;
+ int clip_right;
+ int clip_bottom;
} ASTRec, *ASTRecPtr;
diff --git a/src/ast_accel.c b/src/ast_accel.c
index ef21462..2c37050 100644
--- a/src/ast_accel.c
+++ b/src/ast_accel.c
@@ -152,6 +152,7 @@ static void ASTSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
static void ASTSetClippingRectangle(ScrnInfoPtr pScrn,
int left, int top, int right, int bottom);
static void ASTDisableClipping(ScrnInfoPtr pScrn);
+static void ASTSetHWClipping(ScrnInfoPtr pScrn, int delta_y);
Bool
ASTAccelInit(ScreenPtr pScreen)
@@ -338,6 +339,7 @@ ASTSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2,
PKT_SC *pSingleCMD;
int src_x, src_y, dst_x, dst_y;
ULONG srcbase, dstbase, cmdreg;
+ int delta_y = 0;
/*
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentScreenToScreenCopy\n");
*/
@@ -365,7 +367,8 @@ ASTSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2,
}
if ((y2 + height) >= pScrn->virtualY)
- {
+ {
+ delta_y = y2;
dstbase=pAST->VideoModeInfo.ScreenPitch*y2;
y2 = 0;
}
@@ -391,6 +394,9 @@ ASTSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2,
src_y = y1;
dst_y = y2;
}
+
+ if (pAST->EnableClip)
+ ASTSetHWClipping(pScrn, delta_y);
if (!pAST->MMIO2D)
{
@@ -488,7 +494,9 @@ ASTSubsequentSolidFillRect(ScrnInfoPtr pScrn,
{
ASTRecPtr pAST = ASTPTR(pScrn);
PKT_SC *pSingleCMD;
- ULONG dstbase, cmdreg;
+ ULONG dstbase, cmdreg;
+ int delta_y = 0;
+
/*
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentSolidFillRect\n");
*/
@@ -504,11 +512,15 @@ ASTSubsequentSolidFillRect(ScrnInfoPtr pScrn,
dstbase = 0;
if (dst_y >= pScrn->virtualY)
- {
+ {
+ delta_y = dst_y;
dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y;
dst_y=0;
}
-
+
+ if (pAST->EnableClip)
+ ASTSetHWClipping(pScrn, delta_y);
+
if (!pAST->MMIO2D)
{
/* Write to CMDQ */
@@ -606,6 +618,7 @@ static void ASTSubsequentSolidHorVertLine(ScrnInfoPtr pScrn,
PKT_SC *pSingleCMD;
ULONG dstbase, cmdreg;
int width, height;
+ int delta_y = 0;
/*
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentSolidHorVertLine\n");
*/
@@ -629,12 +642,15 @@ static void ASTSubsequentSolidHorVertLine(ScrnInfoPtr pScrn,
}
if ((y + height) >= pScrn->virtualY)
- {
+ {
+ delta_y = y;
dstbase=pAST->VideoModeInfo.ScreenPitch*y;
y=0;
}
-
+ if (pAST->EnableClip)
+ ASTSetHWClipping(pScrn, delta_y);
+
if (!pAST->MMIO2D)
{
/* Write to CMDQ */
@@ -678,6 +694,8 @@ static void ASTSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
ULONG dstbase, ulCommand;
ULONG miny, maxy;
USHORT usXM;
+ int delta_y = 0;
+
/*
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentSolidTwoPointLine\n");
*/
@@ -696,6 +714,7 @@ static void ASTSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
miny = (y1 > y2) ? y2 : y1;
maxy = (y1 > y2) ? y1 : y2;
if(maxy >= pScrn->virtualY) {
+ delta_y = miny;
dstbase = pAST->VideoModeInfo.ScreenPitch * miny;
y1 -= miny;
y2 -= miny;
@@ -714,6 +733,9 @@ static void ASTSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
ulCommand |= CMD_Y_DEC;
usXM = (dsLineParam.dwLineAttributes & LINEPARAM_XM) ? 1:0;
+
+ if (pAST->EnableClip)
+ ASTSetHWClipping(pScrn, delta_y);
if (!pAST->MMIO2D)
{
@@ -841,6 +863,8 @@ ASTSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
ULONG dstbase, ulCommand;
ULONG miny, maxy;
USHORT usXM;
+ int delta_y = 0;
+
/*
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentDashedTwoPointLine\n");
*/
@@ -859,6 +883,7 @@ ASTSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
miny = (y1 > y2) ? y2 : y1;
maxy = (y1 > y2) ? y1 : y2;
if(maxy >= pScrn->virtualY) {
+ delta_y = miny;
dstbase = pAST->VideoModeInfo.ScreenPitch * miny;
y1 -= miny;
y2 -= miny;
@@ -877,6 +902,9 @@ ASTSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
ulCommand |= CMD_Y_DEC;
usXM = (dsLineParam.dwLineAttributes & LINEPARAM_XM) ? 1:0;
+
+ if (pAST->EnableClip)
+ ASTSetHWClipping(pScrn, delta_y);
if (!pAST->MMIO2D)
{
@@ -991,7 +1019,9 @@ ASTSubsequentMonoPatternFill(ScrnInfoPtr pScrn,
{
ASTRecPtr pAST = ASTPTR(pScrn);
PKT_SC *pSingleCMD;
- ULONG dstbase, cmdreg;
+ ULONG dstbase, cmdreg;
+ int delta_y = 0;
+
/*
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentMonoPatternFill\n");
*/
@@ -1006,10 +1036,14 @@ ASTSubsequentMonoPatternFill(ScrnInfoPtr pScrn,
if (dst_y >= pScrn->virtualY)
{
+ delta_y = dst_y;
dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y;
dst_y=0;
}
-
+
+ if (pAST->EnableClip)
+ ASTSetHWClipping(pScrn, delta_y);
+
if (!pAST->MMIO2D)
{
/* Write to CMDQ */
@@ -1116,7 +1150,9 @@ ASTSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty,
{
ASTRecPtr pAST = ASTPTR(pScrn);
PKT_SC *pSingleCMD;
- ULONG dstbase, cmdreg;
+ ULONG dstbase, cmdreg;
+ int delta_y = 0;
+
/*
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentColor8x8PatternFillRect\n");
*/
@@ -1131,9 +1167,13 @@ ASTSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty,
if (dst_y >= pScrn->virtualY)
{
+ delta_y = dst_y;
dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y;
dst_y=0;
}
+
+ if (pAST->EnableClip)
+ ASTSetHWClipping(pScrn, delta_y);
if (!pAST->MMIO2D)
{
@@ -1235,6 +1275,7 @@ ASTSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
ASTRecPtr pAST = ASTPTR(pScrn);
PKT_SC *pSingleCMD;
ULONG dstbase, cmdreg;
+ int delta_y = 0;
/*
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentCPUToScreenColorExpandFill\n");
@@ -1250,10 +1291,14 @@ ASTSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
if (dst_y >= pScrn->virtualY)
{
+ delta_y = dst_y;
dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y;
dst_y=0;
}
-
+
+ if (pAST->EnableClip)
+ ASTSetHWClipping(pScrn, delta_y);
+
if (!pAST->MMIO2D)
{
/* Write to CMDQ */
@@ -1364,6 +1409,7 @@ ASTSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
PKT_SC *pSingleCMD;
ULONG srcbase, dstbase, cmdreg;
USHORT srcpitch;
+ int delta_y = 0;
/*
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentScreenToScreenColorExpandFill\n");
@@ -1378,11 +1424,15 @@ ASTSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
dstbase = 0;
if (dst_y >= pScrn->virtualY)
{
+ delta_y = dst_y;
dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y;
dst_y=0;
}
srcbase = pAST->VideoModeInfo.ScreenPitch*src_y + ((pScrn->bitsPerPixel+1)/8)*src_x;
srcpitch = (pScrn->displayWidth+7)/8;
+
+ if (pAST->EnableClip)
+ ASTSetHWClipping(pScrn, delta_y);
if (!pAST->MMIO2D)
{
@@ -1423,25 +1473,19 @@ ASTSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
/* Clipping */
static void
-ASTSetClippingRectangle(ScrnInfoPtr pScrn,
- int left, int top, int right, int bottom)
+ASTSetHWClipping(ScrnInfoPtr pScrn, int delta_y)
{
-
ASTRecPtr pAST = ASTPTR(pScrn);
PKT_SC *pSingleCMD;
-/*
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetClippingRectangle\n");
-*/
- pAST->EnableClip = TRUE;
-
+
if (!pAST->MMIO2D)
{
/* Write to CMDQ */
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*2);
- ASTSetupCLIP1(pSingleCMD, left, top);
+ ASTSetupCLIP1(pSingleCMD, pAST->clip_left, pAST->clip_top - delta_y);
pSingleCMD++;
- ASTSetupCLIP2(pSingleCMD, right, bottom);
+ ASTSetupCLIP2(pSingleCMD, pAST->clip_right + 1, pAST->clip_bottom - delta_y + 1);
/* Update Write Pointer */
mUpdateWritePointer;
@@ -1449,9 +1493,28 @@ ASTSetClippingRectangle(ScrnInfoPtr pScrn,
}
else
{
- ASTSetupCLIP1_MMIO(left, top);
- ASTSetupCLIP2_MMIO(right, bottom);
+ ASTSetupCLIP1_MMIO(pAST->clip_left, pAST->clip_top - delta_y);
+ ASTSetupCLIP2_MMIO(pAST->clip_right + 1, pAST->clip_bottom - delta_y + 1);
}
+
+}
+
+static void
+ASTSetClippingRectangle(ScrnInfoPtr pScrn,
+ int left, int top, int right, int bottom)
+{
+
+ ASTRecPtr pAST = ASTPTR(pScrn);
+ PKT_SC *pSingleCMD;
+/*
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetClippingRectangle\n");
+*/
+ pAST->EnableClip = TRUE;
+
+ pAST->clip_left = left;
+ pAST->clip_top = top;
+ pAST->clip_right = right;
+ pAST->clip_bottom = bottom;
}
diff --git a/src/ast_cursor.c b/src/ast_cursor.c
index 8c9757a..650e115 100644
--- a/src/ast_cursor.c
+++ b/src/ast_cursor.c
@@ -200,12 +200,18 @@ static void
ASTSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
{
ASTRecPtr pAST = ASTPTR(pScrn);
-
- pAST->HWCInfo.fg = (fg & 0x0F) | (((fg>>8) & 0x0F) << 4) | (((fg>>16) & 0x0F) << 8);
- pAST->HWCInfo.bg = (bg & 0x0F) | (((bg>>8) & 0x0F) << 4) | (((bg>>16) & 0x0F) << 8);
+ ULONG fg1, bg1;
+
+ fg1 = (fg & 0x0F) | (((fg>>8) & 0x0F) << 4) | (((fg>>16) & 0x0F) << 8);
+ bg1 = (bg & 0x0F) | (((bg>>8) & 0x0F) << 4) | (((bg>>16) & 0x0F) << 8);
- /* Fixed xorg bugzilla #20609, ycchen@031209 */
- ASTLoadCursorImage(pScrn, pAST->HWCInfo.cursorpattern);
+ /* Fixed xorg bugzilla #20609, ycchen@031209 */
+ if ( (fg1 != pAST->HWCInfo.fg) || (bg1 != pAST->HWCInfo.bg) )
+ {
+ pAST->HWCInfo.fg = fg1;
+ pAST->HWCInfo.bg = bg1;
+ ASTLoadCursorImage(pScrn, pAST->HWCInfo.cursorpattern);
+ }
}
@@ -230,7 +236,7 @@ ASTLoadCursorImage(ScrnInfoPtr pScrn, UCHAR *src)
/* copy to hwc info */
for (i=0; i< MAX_HWC_WIDTH*MAX_HWC_HEIGHT/4; i+=4)
*(ULONG *) (pAST->HWCInfo.cursorpattern + i) = *(ULONG *) (src + i);
-
+
/* copy cursor image to cache */
pjSrcXor = src;
pjSrcAnd = src + (MAX_HWC_WIDTH*MAX_HWC_HEIGHT/8);
@@ -250,12 +256,11 @@ ASTLoadCursorImage(ScrnInfoPtr pScrn, UCHAR *src)
ulTempDstAnd32[1] = ((jTempSrcAnd32 >> (k-1)) & 0x01) ? 0x80000000L:0x00L;
ulTempDstXor32[1] = ((jTempSrcXor32 >> (k-1)) & 0x01) ? 0x40000000L:0x00L;
ulTempDstData32[1] = ((jTempSrcXor32 >> (k-1)) & 0x01) ? (pAST->HWCInfo.fg << 16):(pAST->HWCInfo.bg << 16);
- ulTempDstData32[1] = ((jTempSrcXor32 >> (k-1)) & 0x01) ? (pAST->HWCInfo.fg << 16):(pAST->HWCInfo.bg << 16);
/* No inverse for X Window cursor, ycchen@111808 */
if (ulTempDstAnd32[0])
ulTempDstXor32[0] = 0;
if (ulTempDstAnd32[1])
- ulTempDstXor32[1] = 0;
+ ulTempDstXor32[1] = 0;
*((ULONG *) pjDstData) = ulTempDstAnd32[0] | ulTempDstXor32[0] | ulTempDstData32[0] | ulTempDstAnd32[1] | ulTempDstXor32[1] | ulTempDstData32[1];
ulCheckSum += *((ULONG *) pjDstData);
pjDstData += 4;
diff --git a/src/ast_driver.c b/src/ast_driver.c
index 741414c..ac78321 100644
--- a/src/ast_driver.c
+++ b/src/ast_driver.c
@@ -64,6 +64,7 @@ extern void ASTUnmapMMIO(ScrnInfoPtr pScrn);
extern void vASTOpenKey(ScrnInfoPtr pScrn);
extern Bool bASTRegInit(ScrnInfoPtr pScrn);
+extern void GetDRAMInfo(ScrnInfoPtr pScrn);
extern ULONG GetVRAMInfo(ScrnInfoPtr pScrn);
extern ULONG GetMaxDCLK(ScrnInfoPtr pScrn);
extern void GetChipType(ScrnInfoPtr pScrn);
@@ -73,6 +74,9 @@ extern void vSetStartAddressCRT1(ASTRecPtr pAST, ULONG base);
extern Bool ASTSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
extern Bool GetVGA2EDID(ScrnInfoPtr pScrn, unsigned char *pEDIDBuffer);
extern void vInitDRAMReg(ScrnInfoPtr pScrn);
+extern Bool bIsVGAEnabled(ScrnInfoPtr pScrn);
+extern void ASTBlankScreen(ScrnInfoPtr pScreen, Bool unblack);
+extern Bool InitVGA(ScrnInfoPtr pScrn);
extern Bool bInitCMDQInfo(ScrnInfoPtr pScrn, ASTRecPtr pAST);
extern Bool bEnableCMDQ(ScrnInfoPtr pScrn, ASTRecPtr pAST);
@@ -526,12 +530,7 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
/* Init VGA Adapter */
if (!xf86IsPrimaryPci(pAST->PciInfo))
{
- if (xf86LoadSubModule(pScrn, "int10")) {
- xf86Int10InfoPtr pInt10;
- xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n");
- pInt10 = xf86InitInt10(pAST->pEnt->index);
- xf86FreeInt10(pInt10);
- }
+ InitVGA(pScrn);
}
vASTOpenKey(pScrn);
@@ -543,10 +542,8 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
else
pAST->jChipType = AST2000;
- if (!xf86IsPrimaryPci(pAST->PciInfo))
- {
- vInitDRAMReg (pScrn);
- }
+ /* Get DRAM Info */
+ GetDRAMInfo(pScrn);
/* Map Framebuffer */
pScrn->videoRam = GetVRAMInfo(pScrn) / 1024;
@@ -876,6 +873,13 @@ ASTEnterVT(int scrnIndex, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ /* Fixed suspend can't resume issue */
+ if (!bIsVGAEnabled(pScrn))
+ {
+ InitVGA(pScrn);
+ ASTRestore(pScrn);
+ }
+
if (!ASTModeInit(pScrn, pScrn->currentMode))
return FALSE;
ASTAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
@@ -1012,7 +1016,17 @@ ASTFreeRec(ScrnInfoPtr pScrn)
static Bool
ASTSaveScreen(ScreenPtr pScreen, Bool unblack)
{
- return vgaHWSaveScreen(pScreen, unblack);
+ /* replacement of vgaHWBlankScreen(pScrn, unblank) without seq reset */
+ /* return vgaHWSaveScreen(pScreen, unblack); */
+ ScrnInfoPtr pScrn = NULL;
+
+ if (pScreen != NULL)
+ pScrn = xf86Screens[pScreen->myNum];
+
+ if ((pScrn != NULL) && pScrn->vtSema) {
+ ASTBlankScreen(pScrn, unblack);
+ }
+ return (TRUE);
}
static Bool
diff --git a/src/ast_vgatool.c b/src/ast_vgatool.c
index 9990cda..c39c238 100644
--- a/src/ast_vgatool.c
+++ b/src/ast_vgatool.c
@@ -59,16 +59,20 @@
/* Prototype type declaration*/
void vASTOpenKey(ScrnInfoPtr pScrn);
Bool bASTRegInit(ScrnInfoPtr pScrn);
+void GetDRAMInfo(ScrnInfoPtr pScrn);
ULONG GetVRAMInfo(ScrnInfoPtr pScrn);
ULONG GetMaxDCLK(ScrnInfoPtr pScrn);
void GetChipType(ScrnInfoPtr pScrn);
void vAST1000DisplayOn(ASTRecPtr pAST);
void vAST1000DisplayOff(ASTRecPtr pAST);
+void ASTBlankScreen(ScrnInfoPtr pScrn, Bool unblack);
void vSetStartAddressCRT1(ASTRecPtr pAST, ULONG base);
void vASTLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual);
void ASTDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
Bool GetVGA2EDID(ScrnInfoPtr pScrn, unsigned char *pEDIDBuffer);
void vInitDRAMReg(ScrnInfoPtr pScrn);
+Bool bIsVGAEnabled(ScrnInfoPtr pScrn);
+Bool InitVGA(ScrnInfoPtr pScrn);
void
vASTOpenKey(ScrnInfoPtr pScrn)
@@ -91,6 +95,46 @@ bASTRegInit(ScrnInfoPtr pScrn)
}
+void
+GetDRAMInfo(ScrnInfoPtr pScrn)
+{
+ ASTRecPtr pAST = ASTPTR(pScrn);
+ ULONG ulData;
+
+ if ( (pAST->jChipType != AST2000) )
+ {
+ *(ULONG *) (pAST->MMIOVirtualAddr + 0xF004) = 0x1e6e0000;
+ *(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x1;
+
+ *(ULONG *) (pAST->MMIOVirtualAddr + 0x10000) = 0xFC600309;
+ do {
+ ;
+ } while (*(volatile ULONG *) (pAST->MMIOVirtualAddr + 0x10000) != 0x01);
+
+ ulData = *(volatile ULONG *) (pAST->MMIOVirtualAddr + 0x10004);
+
+ switch (ulData & 0x0C)
+ {
+ case 0x00:
+ case 0x04:
+ pAST->jDRAMType = DRAMTYPE_512Mx16;
+ break;
+
+ case 0x08:
+ if (ulData & 0x40) /* 16bits */
+ pAST->jDRAMType = DRAMTYPE_1Gx16;
+ else /* 32bits */
+ pAST->jDRAMType = DRAMTYPE_512Mx32;
+ break;
+
+ case 0x0C:
+ pAST->jDRAMType = DRAMTYPE_1Gx32;
+ break;
+ }
+ }
+
+} /* GetDRAMInfo */
+
ULONG
GetVRAMInfo(ScrnInfoPtr pScrn)
{
@@ -275,6 +319,17 @@ vAST1000DisplayOn(ASTRecPtr pAST)
}
+void ASTBlankScreen(ScrnInfoPtr pScrn, Bool unblack)
+{
+ ASTRecPtr pAST;
+
+ pAST = ASTPTR(pScrn);
+
+ if (unblack)
+ vAST1000DisplayOn(pAST);
+ else
+ vAST1000DisplayOff(pAST);
+}
void
vASTLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
@@ -474,6 +529,69 @@ GetVGA2EDID(ScrnInfoPtr pScrn, unsigned char *pEDIDBuffer)
} /* GetVGA2EDID */
+/* Init VGA */
+Bool bIsVGAEnabled(ScrnInfoPtr pScrn)
+{
+ ASTRecPtr pAST;
+ UCHAR ch;
+
+ pAST = ASTPTR(pScrn);
+
+ ch = GetReg(pAST->RelocateIO+0x43);
+
+ return (ch & 0x01);
+}
+
+void vEnableVGA(ScrnInfoPtr pScrn)
+{
+ ASTRecPtr pAST;
+
+ pAST = ASTPTR(pScrn);
+
+ SetReg(pAST->RelocateIO+0x43, 0x01);
+ SetReg(pAST->RelocateIO+0x42, 0x01);
+
+}
+
+UCHAR ExtRegInfo[] = {
+ 0x0F,
+ 0x07,
+ 0x1C,
+ 0xFF
+};
+
+void vSetDefExtReg(ScrnInfoPtr pScrn)
+{
+ ASTRecPtr pAST;
+ UCHAR i, jIndex, *pjExtRegInfo;
+
+ pAST = ASTPTR(pScrn);
+
+ /* Reset Scratch */
+ for (i=0x81; i<=0x8F; i++)
+ {
+ SetIndexReg(CRTC_PORT, i, 0x00);
+ }
+
+ /* Set Ext. Reg */
+ pjExtRegInfo = ExtRegInfo;
+ jIndex = 0xA0;
+ while (*(UCHAR *) (pjExtRegInfo) != 0xFF)
+ {
+ SetIndexRegMask(CRTC_PORT,jIndex, 0x00, *(UCHAR *) (pjExtRegInfo));
+ jIndex++;
+ pjExtRegInfo++;
+ }
+
+ /* Set Ext. Default */
+ SetIndexRegMask(CRTC_PORT,0x8C, 0x00, 0x01);
+ SetIndexRegMask(CRTC_PORT,0xB7, 0x00, 0x00);
+
+ /* Enable RAMDAC for A1, ycchen@113005 */
+ SetIndexRegMask(CRTC_PORT,0xB6, 0xFF, 0x04);
+
+}
+
typedef struct _AST_DRAMStruct {
USHORT Index;
@@ -619,7 +737,7 @@ void vInitDRAMReg(ScrnInfoPtr pScrn)
{
AST_DRAMStruct *pjDRAMRegInfo;
ASTRecPtr pAST = ASTPTR(pScrn);
- ULONG i, ulTemp;
+ ULONG i, ulTemp, ulData;
UCHAR jReg;
GetIndexRegMask(CRTC_PORT, 0xD0, 0xFF, jReg);
@@ -640,9 +758,7 @@ void vInitDRAMReg(ScrnInfoPtr pScrn)
}
else /* AST2100/1100 */
- {
- GetChipType(pScrn);
-
+ {
if ((pAST->jChipType == AST2100) || (pAST->jChipType == AST2200))
pjDRAMRegInfo = AST2100DRAMTableData;
else
@@ -672,9 +788,17 @@ void vInitDRAMReg(ScrnInfoPtr pScrn)
}
else if ( (pjDRAMRegInfo->Index == 0x0004) && (pAST->jChipType != AST2000) )
{
+ ulData = pjDRAMRegInfo->Data;
+
+ if (pAST->jDRAMType == DRAMTYPE_1Gx16)
+ ulData = 0x00000d89;
+ else if (pAST->jDRAMType == DRAMTYPE_1Gx32)
+ ulData = 0x00000c8d;
+
ulTemp = *(ULONG *) (pAST->MMIOVirtualAddr + 0x12070);
ulTemp &= 0x0000000C;
- *(ULONG *) (pAST->MMIOVirtualAddr + 0x10000 + pjDRAMRegInfo->Index) = (pjDRAMRegInfo->Data | ulTemp);
+ ulTemp <<= 2;
+ *(ULONG *) (pAST->MMIOVirtualAddr + 0x10000 + pjDRAMRegInfo->Index) = (ulData | ulTemp);
}
else
{
@@ -708,3 +832,29 @@ void vInitDRAMReg(ScrnInfoPtr pScrn)
} while ((jReg & 0x40) == 0);
} /* vInitDRAMReg */
+
+Bool InitVGA(ScrnInfoPtr pScrn)
+{
+ ASTRecPtr pAST;
+ ULONG ulData;
+
+ pAST = ASTPTR(pScrn);
+
+ {
+ /* Enable PCI */
+ PCI_READ_LONG(pAST->PciInfo, &ulData, 0x04);
+ ulData |= 0x03;
+ PCI_WRITE_LONG(pAST->PciInfo, ulData, 0x04);
+
+ /* Enable VGA */
+ vEnableVGA(pScrn);
+
+ vASTOpenKey(pScrn);
+ vSetDefExtReg(pScrn);
+
+ vInitDRAMReg(pScrn);
+
+ }
+
+ return (TRUE);
+} /* Init VGA */
diff --git a/src/ast_vgatool.h b/src/ast_vgatool.h
index 9ce00fb..42c866a 100644
--- a/src/ast_vgatool.h
+++ b/src/ast_vgatool.h
@@ -27,6 +27,11 @@
#define VIDEOMEM_SIZE_64M 0x04000000
#define VIDEOMEM_SIZE_128M 0x08000000
+#define DRAMTYPE_512Mx16 0
+#define DRAMTYPE_1Gx16 1
+#define DRAMTYPE_512Mx32 2
+#define DRAMTYPE_1Gx32 3
+
#define AR_PORT_WRITE (pAST->RelocateIO + 0x40)
#define MISC_PORT_WRITE (pAST->RelocateIO + 0x42)
#define SEQ_PORT (pAST->RelocateIO + 0x44)
@@ -44,9 +49,8 @@
val = inb(base+1); \
} while (0)
#define SetIndexReg(base,index, val) do { \
- outb(base,index); \
- outb(base+1,val); \
- } while (0)
+ outw(base, ((USHORT)(val) << 8) | index); \
+ } while (0)
#define GetIndexRegMask(base,index, and, val) do { \
outb(base,index); \
val = (inb(base+1) & and); \