summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorY.C. Chen <yc_chen@aspeedtech.com>2013-08-07 13:39:29 +0800
committerY.C. Chen <yc_chen@aspeedtech.com>2013-08-07 13:39:29 +0800
commit2e57123b7c68868d0b1fe1d591f6236a23c4f3aa (patch)
tree8962482d34a9ff439e8cc15c6407122883b65895
parent9ab60c6383055569874cff7f8c19973ef78bf0f9 (diff)
Fixed Display Abnormal Issue with GOP Driver
-rw-r--r--src/ast.h2
-rw-r--r--src/ast_2dtool.c43
-rw-r--r--src/ast_accel.c22
-rw-r--r--src/ast_driver.c31
4 files changed, 58 insertions, 40 deletions
diff --git a/src/ast.h b/src/ast.h
index 294801e..a5af6d8 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -106,6 +106,8 @@ typedef struct _ASTRegRec {
ULONG GFX[12];
+ UCHAR REGA4;
+ ULONG ENG8044;
} ASTRegRec, *ASTRegPtr;
typedef struct _VIDEOMODE {
diff --git a/src/ast_2dtool.c b/src/ast_2dtool.c
index 73c9b37..603697c 100644
--- a/src/ast_2dtool.c
+++ b/src/ast_2dtool.c
@@ -69,11 +69,6 @@ bInitCMDQInfo(ScrnInfoPtr pScrn, ASTRecPtr pAST)
ScreenPtr pScreen;
- pAST->CMDQInfo.pjCmdQBasePort = pAST->MMIOVirtualAddr+ 0x8044;
- pAST->CMDQInfo.pjWritePort = pAST->MMIOVirtualAddr+ 0x8048;
- pAST->CMDQInfo.pjReadPort = pAST->MMIOVirtualAddr+ 0x804C;
- pAST->CMDQInfo.pjEngStatePort = pAST->MMIOVirtualAddr+ 0x804C;
-
/* CMDQ mode Init */
if (!pAST->MMIO2D) {
pAST->CMDQInfo.ulCMDQType = VM_CMD_QUEUE;
@@ -297,9 +292,19 @@ vDisable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST)
vWaitEngIdle(pScrn, pAST);
vWaitEngIdle(pScrn, pAST);
+ /* restore 2D settings */
if (pAST->jChipType != AST1180)
- SetIndexRegMask(CRTC_PORT, 0xA4, 0xFE, 0x00);
-
+ {
+ if (pAST->SavedReg.REGA4 & 0x01) /* 2D enabled */
+ {
+ SetIndexRegMask(CRTC_PORT, 0xA4, 0xFE, 0x01);
+ *(ULONG *) (pAST->MMIOVirtualAddr + 0x8044) = pAST->SavedReg.ENG8044;
+ }
+ else /* 2D disabled */
+ {
+ SetIndexRegMask(CRTC_PORT, 0xA4, 0xFE, 0x00);
+ }
+ }
}
@@ -308,12 +313,7 @@ vWaitEngIdle(ScrnInfoPtr pScrn, ASTRecPtr pAST)
{
ULONG ulEngState, ulEngState2;
UCHAR jReg;
- ULONG ulEngCheckSetting;
-
- if (pAST->MMIO2D)
- ulEngCheckSetting = 0x10000000;
- else
- ulEngCheckSetting = 0x80000000;
+ ULONG ulEngCheckSetting = 0x80000000;
if (pAST->jChipType != AST1180)
{
@@ -327,6 +327,9 @@ vWaitEngIdle(ScrnInfoPtr pScrn, ASTRecPtr pAST)
if (!jReg) goto Exit_vWaitEngIdle;
}
+ if (*(ULONG *) (pAST->CMDQInfo.pjCmdQBasePort) & 0x02000000) /* MMIO Mode */
+ ulEngCheckSetting = 0x10000000;
+
do
{
ulEngState = (*(volatile ULONG *)(pAST->CMDQInfo.pjEngStatePort)) & 0xFFFC0000;
@@ -348,13 +351,13 @@ static __inline ULONG ulGetCMDQLength(ASTRecPtr pAST, ULONG ulWritePointer, ULON
ULONG ulReadPointer, ulReadPointer2;
do {
- ulReadPointer = *((volatile ULONG *)(pAST->CMDQInfo.pjReadPort)) & 0x0003FFFF;
- ulReadPointer2 = *((volatile ULONG *)(pAST->CMDQInfo.pjReadPort)) & 0x0003FFFF;
- ulReadPointer2 = *((volatile ULONG *)(pAST->CMDQInfo.pjReadPort)) & 0x0003FFFF;
- ulReadPointer2 = *((volatile ULONG *)(pAST->CMDQInfo.pjReadPort)) & 0x0003FFFF;
- ulReadPointer2 = *((volatile ULONG *)(pAST->CMDQInfo.pjReadPort)) & 0x0003FFFF;
- ulReadPointer2 = *((volatile ULONG *)(pAST->CMDQInfo.pjReadPort)) & 0x0003FFFF;
- } while (ulReadPointer != ulReadPointer2);
+ ulReadPointer = *((volatile ULONG *)(pAST->CMDQInfo.pjReadPort));
+ ulReadPointer2 = *((volatile ULONG *)(pAST->CMDQInfo.pjReadPort));
+ ulReadPointer2 = *((volatile ULONG *)(pAST->CMDQInfo.pjReadPort));
+ ulReadPointer2 = *((volatile ULONG *)(pAST->CMDQInfo.pjReadPort));
+ ulReadPointer2 = *((volatile ULONG *)(pAST->CMDQInfo.pjReadPort));
+ ulReadPointer2 = *((volatile ULONG *)(pAST->CMDQInfo.pjReadPort));
+ } while ( ((ulReadPointer & 0x0003FFFF) != (ulReadPointer2 & 0x0003FFFF)) || (ulReadPointer == 0xFFFFEEEE) );
return ((ulReadPointer << 3) - ulWritePointer - CMD_QUEUE_GUARD_BAND) & ulCMDQMask;
}
diff --git a/src/ast_accel.c b/src/ast_accel.c
index 193666f..a8fd206 100644
--- a/src/ast_accel.c
+++ b/src/ast_accel.c
@@ -45,8 +45,8 @@
/* include xaa includes */
#ifdef HAVE_XAA_H
#include "xaa.h"
-#endif
#include "xaarop.h"
+#endif
/* H/W cursor support */
#include "xf86Cursor.h"
@@ -55,6 +55,8 @@
#include "ast.h"
#ifdef Accel_2D
+
+#ifdef HAVE_XAA_H
/* ROP Translation Table */
int ASTXAACopyROP[16] =
{
@@ -103,7 +105,6 @@ extern Bool bGetLineTerm(_LINEInfo *LineInfo, LINEPARAM *dsLineParam);
/* Prototype type declaration */
Bool ASTAccelInit(ScreenPtr pScreen);
-#ifdef HAVE_XAA_H
static void ASTSync(ScrnInfoPtr pScrn);
static void ASTSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
int xdir, int ydir, int rop,
@@ -158,12 +159,10 @@ static void AIPSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
static void AIPSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
int x1, int y1, int x2, int y2,
int flags, int phase);
-#endif
Bool
ASTAccelInit(ScreenPtr pScreen)
{
-#ifdef HAVE_XAA_H
XAAInfoRecPtr infoPtr;
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
ASTRecPtr pAST = ASTPTR(pScrn);
@@ -286,12 +285,9 @@ ASTAccelInit(ScreenPtr pScreen)
}
return(XAAInit(pScreen, infoPtr));
-#else
- return TRUE;
-#endif
+
} /* end of ASTAccelInit */
-#ifdef HAVE_XAA_H
static void
ASTSync(ScrnInfoPtr pScrn)
{
@@ -802,7 +798,7 @@ static void ASTSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
}
-
+
} /* end of ASTSubsequentSolidTwoPointLine */
/* Dash Line */
@@ -1036,7 +1032,7 @@ ASTSetupForMonoPatternFill(ScrnInfoPtr pScrn,
} /* end of ASTSetupForMonoPatternFill */
-
+
static void
ASTSubsequentMonoPatternFill(ScrnInfoPtr pScrn,
int patx, int paty,
@@ -1495,7 +1491,7 @@ ASTSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
}
-
+
/* Clipping */
static void
ASTSetHWClipping(ScrnInfoPtr pScrn, int delta_y)
@@ -1618,7 +1614,7 @@ static void AIPSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
}
-
+
} /* end of AIPSubsequentSolidTwoPointLine */
static void
@@ -1689,7 +1685,7 @@ AIPSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
}
}
-#endif
+#endif /* HAVE_XAA_H */
#ifdef AstVideo
/*
diff --git a/src/ast_driver.c b/src/ast_driver.c
index 2ff3a06..09972b5 100644
--- a/src/ast_driver.c
+++ b/src/ast_driver.c
@@ -47,7 +47,10 @@
#include "xf86fbman.h"
/* include xaa includes */
+#ifdef HAVE_XAA_H
+#include "xaa.h"
#include "xaarop.h"
+#endif
/* H/W cursor support */
#include "xf86Cursor.h"
@@ -86,7 +89,9 @@ extern Bool bInitCMDQInfo(ScrnInfoPtr pScrn, ASTRecPtr pAST);
extern Bool bEnableCMDQ(ScrnInfoPtr pScrn, ASTRecPtr pAST);
extern void vDisable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST);
+#ifdef HAVE_XAA_H
extern Bool ASTAccelInit(ScreenPtr pScreen);
+#endif
extern Bool ASTCursorInit(ScreenPtr pScreen);
extern void ASTDisableHWC(ScrnInfoPtr pScrn);
@@ -715,11 +720,14 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
/* Accelaration Check */
pAST->noAccel = TRUE;
+ pAST->pCMDQPtr = NULL;
+ pAST->CMDQInfo.ulCMDQSize = 0;
+ pAST->CMDQInfo.pjCmdQBasePort = pAST->MMIOVirtualAddr+ 0x8044;
+ pAST->CMDQInfo.pjWritePort = pAST->MMIOVirtualAddr+ 0x8048;
+ pAST->CMDQInfo.pjReadPort = pAST->MMIOVirtualAddr+ 0x804C;
+ pAST->CMDQInfo.pjEngStatePort = pAST->MMIOVirtualAddr+ 0x804C;
#ifdef HAVE_XAA_H
pAST->AccelInfoPtr = NULL;
-#endif
- pAST->pCMDQPtr = NULL;
- pAST->CMDQInfo.ulCMDQSize = 0;
#ifdef Accel_2D
if (!xf86ReturnOptValBool(pAST->Options, OPTION_NOACCEL, FALSE))
{
@@ -746,6 +754,7 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
}
}
#endif
+#endif /* HAVE_XAA_H */
/* HW Cursor Check */
pAST->noHWC = TRUE;
@@ -881,6 +890,7 @@ ASTScreenInit(SCREEN_INIT_ARGS_DECL)
xf86SetBlackWhitePixels(pScreen);
+#ifdef HAVE_XAA_H
#ifdef Accel_2D
if (!pAST->noAccel)
{
@@ -890,6 +900,7 @@ ASTScreenInit(SCREEN_INIT_ARGS_DECL)
}
}
#endif /* end of Accel_2D */
+#endif
xf86SetBackingStore(pScreen);
xf86SetSilkenMouse(pScreen);
@@ -1329,6 +1340,12 @@ ASTSave(ScrnInfoPtr pScrn)
/* Save DAC */
for (i=0; i<256; i++)
VGA_GET_PALETTE_INDEX (i, astReg->DAC[i][0], astReg->DAC[i][1], astReg->DAC[i][2]);
+
+ /* Save 2D */
+ astReg->ENG8044 = 0;
+ GetIndexReg(CRTC_PORT, 0xA4, astReg->REGA4);
+ if (astReg->REGA4 & 0x01) /* 2D enabled */
+ astReg->ENG8044 = *(ULONG *) (pAST->MMIOVirtualAddr + 0x8044);
}
}
@@ -1403,16 +1420,16 @@ ASTRestore(ScrnInfoPtr pScrn)
/* Ext. restore */
vASTOpenKey(pScrn);
+ /* Restore DAC */
+ for (i=0; i<256; i++)
+ VGA_LOAD_PALETTE_INDEX (i, astReg->DAC[i][0], astReg->DAC[i][1], astReg->DAC[i][2]);
+
/* fixed Console Switch Refresh Rate Incorrect issue, ycchen@051106 */
for (i=0x81; i<=0xB6; i++)
SetIndexReg(CRTC_PORT, (UCHAR) (i), astReg->ExtCRTC[icount++]);
for (i=0xBC; i<=0xC1; i++)
SetIndexReg(CRTC_PORT, (UCHAR) (i), astReg->ExtCRTC[icount++]);
SetIndexReg(CRTC_PORT, (UCHAR) (0xBB), astReg->ExtCRTC[icount]);
-
- /* Restore DAC */
- for (i=0; i<256; i++)
- VGA_LOAD_PALETTE_INDEX (i, astReg->DAC[i][0], astReg->DAC[i][1], astReg->DAC[i][2]);
}
}