diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-07-31 23:17:50 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-07-31 23:17:50 -0700 |
commit | 996fdaed696c989fdafe12dc18e90639dfc96f87 (patch) | |
tree | 92a977d4bf29591826ed699ef5a17c17bd999eae | |
parent | 15b22ad50df0dff78a2db9fb4c536ab7faf92f07 (diff) |
Cleanup leading/trailing whitespace in source files
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | src/ast.h | 74 | ||||
-rw-r--r-- | src/ast_2dtool.c | 258 | ||||
-rw-r--r-- | src/ast_2dtool.h | 146 | ||||
-rw-r--r-- | src/ast_accel.c | 986 | ||||
-rw-r--r-- | src/ast_cursor.c | 256 | ||||
-rw-r--r-- | src/ast_driver.c | 718 | ||||
-rw-r--r-- | src/ast_mode.c | 888 | ||||
-rw-r--r-- | src/ast_mode.h | 22 | ||||
-rw-r--r-- | src/ast_pcirename.h | 2 | ||||
-rw-r--r-- | src/ast_tool.c | 20 | ||||
-rw-r--r-- | src/ast_vgatool.c | 996 |
11 files changed, 2183 insertions, 2183 deletions
@@ -40,11 +40,11 @@ /* Vendor & Device Info */ #ifndef PCI_VENDOR_AST -#define PCI_VENDOR_AST 0x1A03 -#endif +#define PCI_VENDOR_AST 0x1A03 +#endif #ifndef PCI_CHIP_AST2000 -#define PCI_CHIP_AST2000 0x2000 +#define PCI_CHIP_AST2000 0x2000 #endif #ifndef PCI_CHIP_AST2100 @@ -94,18 +94,18 @@ typedef CARD32 ULONG; /* Data Structure Definition */ typedef struct _ASTRegRec { - + UCHAR ExtCRTC[0x50]; - UCHAR MISC; + UCHAR MISC; UCHAR SEQ[4]; UCHAR CRTC[25]; - UCHAR AR[20]; + UCHAR AR[20]; UCHAR GR[9]; UCHAR DAC[256][3]; - + ULONG GFX[12]; - + } ASTRegRec, *ASTRegPtr; typedef struct _VIDEOMODE { @@ -114,30 +114,30 @@ typedef struct _VIDEOMODE { int ScreenHeight; int bitsPerPixel; int ScreenPitch; - + } VIDEOMODE, *PVIDEOMODE; typedef struct { ULONG ulCMDQSize; ULONG ulCMDQType; - + ULONG ulCMDQOffsetAddr; UCHAR *pjCMDQVirtualAddr; - + UCHAR *pjCmdQBasePort; - UCHAR *pjWritePort; - UCHAR *pjReadPort; + UCHAR *pjWritePort; + UCHAR *pjReadPort; UCHAR *pjEngStatePort; - + ULONG ulCMDQMask; ULONG ulCurCMDQueueLen; - + ULONG ulWritePointer; ULONG ulReadPointer; - + ULONG ulReadPointer_OK; /* for Eng_DBGChk */ - + } CMDQINFO, *PCMDQINFO; typedef struct { @@ -147,17 +147,17 @@ typedef struct { ULONG ulHWCOffsetAddr; UCHAR *pjHWCVirtualAddr; - + USHORT cursortype; USHORT width; - USHORT height; + USHORT height; USHORT offset_x; USHORT offset_y; ULONG fg; ULONG bg; - UCHAR cursorpattern[1024]; - + UCHAR cursorpattern[1024]; + } HWCINFO, *PHWCINFO; typedef struct _ASTPortPrivRec{ @@ -177,7 +177,7 @@ typedef struct _ASTPortPrivRec{ INT32 contrast; INT32 saturation; INT32 hue; - + INT32 gammaR; INT32 gammaG; INT32 gammaB; @@ -188,7 +188,7 @@ typedef struct _ASTPortPrivRec{ CARD32 videoStatus; Time offTime; Time freeTime; - + CARD32 displayMode; int pitch; @@ -196,9 +196,9 @@ typedef struct _ASTPortPrivRec{ } ASTPortPrivRec, *ASTPortPrivPtr; typedef struct _ASTRec { - + EntityInfoPtr pEnt; -#ifndef XSERVER_LIBPCIACCESS +#ifndef XSERVER_LIBPCIACCESS pciVideoPtr PciInfo; PCITAG PciTag; #else @@ -206,13 +206,13 @@ typedef struct _ASTRec { #endif OptionInfoPtr Options; - DisplayModePtr ModePtr; - FBLinearPtr pCMDQPtr; + DisplayModePtr ModePtr; + FBLinearPtr pCMDQPtr; #ifdef HAVE_XAA_H XAAInfoRecPtr AccelInfoPtr; #endif xf86CursorInfoPtr HWCInfoPtr; - FBLinearPtr pHWCPtr; + FBLinearPtr pHWCPtr; CloseScreenProcPtr CloseScreen; ScreenBlockHandlerProcPtr BlockHandler; @@ -224,7 +224,7 @@ typedef struct _ASTRec { ULONG ulVRAMSize; ULONG ulVRAMBase; ULONG ulMCLK; - + Bool noAccel; Bool noHWC; Bool MMIO2D; @@ -232,32 +232,32 @@ typedef struct _ASTRec { int DBGSelect; Bool VGA2Clone; Bool SupportWideScreen; - + ULONG FBPhysAddr; /* Frame buffer physical address */ ULONG MMIOPhysAddr; /* MMIO region physical address */ ULONG BIOSPhysAddr; /* BIOS physical address */ - + UCHAR *FBVirtualAddr; /* Map of frame buffer */ UCHAR *MMIOVirtualAddr; /* Map of MMIO region */ unsigned long FbMapSize; unsigned long MMIOMapSize; - + IOADDRESS IODBase; /* Base of PIO memory area */ IOADDRESS PIOOffset; IOADDRESS RelocateIO; - + VIDEOMODE VideoModeInfo; ASTRegRec SavedReg; CMDQINFO CMDQInfo; HWCINFO HWCInfo; - ULONG ulCMDReg; + ULONG ulCMDReg; Bool EnableClip; - int clip_left; + int clip_left; int clip_top; - int clip_right; - int clip_bottom; + int clip_right; + int clip_bottom; int mon_h_active; /* Monitor Info. */ int mon_v_active; diff --git a/src/ast_2dtool.c b/src/ast_2dtool.c index 684e400..73c9b37 100644 --- a/src/ast_2dtool.c +++ b/src/ast_2dtool.c @@ -59,7 +59,7 @@ 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); +void vWaitEngIdle(ScrnInfoPtr pScrn, ASTRecPtr pAST); UCHAR *pjRequestCMDQ(ASTRecPtr pAST, ULONG ulDataLen); Bool bGetLineTerm(_LINEInfo *LineInfo, LINEPARAM *dsLineParam); @@ -69,51 +69,51 @@ bInitCMDQInfo(ScrnInfoPtr pScrn, ASTRecPtr pAST) ScreenPtr pScreen; - pAST->CMDQInfo.pjCmdQBasePort = pAST->MMIOVirtualAddr+ 0x8044; + 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; - + pAST->CMDQInfo.ulCMDQType = VM_CMD_QUEUE; + pScreen = xf86ScrnToScreen(pScrn); - + do { pAST->pCMDQPtr = xf86AllocateOffscreenLinear (pScreen, pAST->CMDQInfo.ulCMDQSize, 8, NULL, NULL, NULL); - + if (pAST->pCMDQPtr) break; - + pAST->CMDQInfo.ulCMDQSize >>= 1; - + } while (pAST->CMDQInfo.ulCMDQSize >= MIN_CMDQ_SIZE); - + if (pAST->pCMDQPtr) { xf86DrvMsg(pScrn->scrnIndex, X_INFO,"Allocate CMDQ size is %ld kbyte \n", (unsigned long) (pAST->CMDQInfo.ulCMDQSize/1024)); - + pAST->CMDQInfo.ulCMDQOffsetAddr = pAST->pCMDQPtr->offset*((pScrn->bitsPerPixel + 1) / 8); pAST->CMDQInfo.pjCMDQVirtualAddr = pAST->FBVirtualAddr + pAST->CMDQInfo.ulCMDQOffsetAddr; - + pAST->CMDQInfo.ulCurCMDQueueLen = pAST->CMDQInfo.ulCMDQSize - CMD_QUEUE_GUARD_BAND; - pAST->CMDQInfo.ulCMDQMask = pAST->CMDQInfo.ulCMDQSize - 1 ; - - } + pAST->CMDQInfo.ulCMDQMask = pAST->CMDQInfo.ulCMDQSize - 1 ; + + } else - { + { xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"Allocate CMDQ failed \n"); pAST->MMIO2D = TRUE; /* set to MMIO mode if CMDQ allocate failed */ - } - + } + } - - /* MMIO mode init */ - if (pAST->MMIO2D) { - pAST->CMDQInfo.ulCMDQType = VM_CMD_MMIO; + + /* MMIO mode init */ + if (pAST->MMIO2D) { + pAST->CMDQInfo.ulCMDQType = VM_CMD_MMIO; } - - return (TRUE); + + return (TRUE); } Bool @@ -121,65 +121,65 @@ bEnableCMDQ(ScrnInfoPtr pScrn, ASTRecPtr pAST) { ULONG ulVMCmdQBasePort = 0; - vWaitEngIdle(pScrn, pAST); + vWaitEngIdle(pScrn, pAST); /* set DBG Select Info */ if (pAST->DBGSelect) { - *(ULONG *) (pAST->MMIOVirtualAddr + 0x804C) = (ULONG) (pAST->DBGSelect); + *(ULONG *) (pAST->MMIOVirtualAddr + 0x804C) = (ULONG) (pAST->DBGSelect); } - + /* set CMDQ base */ switch (pAST->CMDQInfo.ulCMDQType) { case VM_CMD_QUEUE: ulVMCmdQBasePort = (pAST->CMDQInfo.ulCMDQOffsetAddr - 0) >> 3; - + /* set CMDQ Threshold */ - ulVMCmdQBasePort |= 0xF0000000; + ulVMCmdQBasePort |= 0xF0000000; /* set CMDQ Size */ switch (pAST->CMDQInfo.ulCMDQSize) { case CMD_QUEUE_SIZE_256K: - ulVMCmdQBasePort |= 0x00000000; + ulVMCmdQBasePort |= 0x00000000; break; - + case CMD_QUEUE_SIZE_512K: - ulVMCmdQBasePort |= 0x04000000; + ulVMCmdQBasePort |= 0x04000000; break; - + case CMD_QUEUE_SIZE_1M: - ulVMCmdQBasePort |= 0x08000000; + ulVMCmdQBasePort |= 0x08000000; break; - + case CMD_QUEUE_SIZE_2M: - ulVMCmdQBasePort |= 0x0C000000; - break; - + ulVMCmdQBasePort |= 0x0C000000; + break; + default: return(FALSE); break; - } - - *(ULONG *) (pAST->CMDQInfo.pjCmdQBasePort) = ulVMCmdQBasePort; + } + + *(ULONG *) (pAST->CMDQInfo.pjCmdQBasePort) = ulVMCmdQBasePort; pAST->CMDQInfo.ulWritePointer = *(ULONG *) (pAST->CMDQInfo.pjWritePort) << 3; break; - + case VM_CMD_MMIO: /* set CMDQ Threshold */ - ulVMCmdQBasePort |= 0xF0000000; - + ulVMCmdQBasePort |= 0xF0000000; + ulVMCmdQBasePort |= 0x02000000; /* MMIO mode */ - *(ULONG *) (pAST->CMDQInfo.pjCmdQBasePort) = ulVMCmdQBasePort; + *(ULONG *) (pAST->CMDQInfo.pjCmdQBasePort) = ulVMCmdQBasePort; break; - + default: return (FALSE); break; } - return (TRUE); + return (TRUE); } Bool @@ -187,14 +187,14 @@ bEnableCMDQ2300(ScrnInfoPtr pScrn, ASTRecPtr pAST) { ULONG ulVMCmdQBasePort = 0, ulNewModeData; - vWaitEngIdle(pScrn, pAST); + vWaitEngIdle(pScrn, pAST); /* set DBG Select Info */ if (pAST->DBGSelect) { - *(ULONG *) (pAST->MMIOVirtualAddr + 0x804C) = (ULONG) (pAST->DBGSelect); + *(ULONG *) (pAST->MMIOVirtualAddr + 0x804C) = (ULONG) (pAST->DBGSelect); } - + /* set CMDQ base */ switch (pAST->CMDQInfo.ulCMDQType) { @@ -205,46 +205,46 @@ bEnableCMDQ2300(ScrnInfoPtr pScrn, ASTRecPtr pAST) switch (pAST->CMDQInfo.ulCMDQSize) { case CMD_QUEUE_SIZE_256K: - ulNewModeData |= 0x00000000; + ulNewModeData |= 0x00000000; break; - + case CMD_QUEUE_SIZE_512K: - ulNewModeData |= 0x00000004; + ulNewModeData |= 0x00000004; break; - + case CMD_QUEUE_SIZE_1M: - ulNewModeData |= 0x00000008; + ulNewModeData |= 0x00000008; break; - + case CMD_QUEUE_SIZE_2M: - ulNewModeData |= 0x0000000C; - break; - + 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; + /* 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 @@ -252,54 +252,54 @@ 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 AST2300: + case AST2300: *(ULONG *) (pAST->MMIOVirtualAddr + 0xF004) = 0x1e6e0000; - *(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x1; - + *(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x1; + ulData = *(ULONG *) (pAST->MMIOVirtualAddr + 0x1200c); *(ULONG *) (pAST->MMIOVirtualAddr + 0x1200c) = (ulData & 0xFFFFFFFD); - case AST2000: - SetIndexRegMask(CRTC_PORT, 0xA4, 0xFE, 0x01); /* enable 2D */ - + case AST2000: + SetIndexRegMask(CRTC_PORT, 0xA4, 0xFE, 0x01); /* enable 2D */ + break; } - + if (!bInitCMDQInfo(pScrn, pAST)) { - vDisable2D(pScrn, pAST); + vDisable2D(pScrn, pAST); return (FALSE); } - + if (!pfnEnableCMDQ(pScrn, pAST)) { - vDisable2D(pScrn, pAST); + vDisable2D(pScrn, pAST); return (FALSE); } - - return (TRUE); + + return (TRUE); } void vDisable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST) { - + vWaitEngIdle(pScrn, pAST); vWaitEngIdle(pScrn, pAST); if (pAST->jChipType != AST1180) - SetIndexRegMask(CRTC_PORT, 0xA4, 0xFE, 0x00); - + SetIndexRegMask(CRTC_PORT, 0xA4, 0xFE, 0x00); + } @@ -308,9 +308,9 @@ vWaitEngIdle(ScrnInfoPtr pScrn, ASTRecPtr pAST) { ULONG ulEngState, ulEngState2; UCHAR jReg; - ULONG ulEngCheckSetting; - - if (pAST->MMIO2D) + ULONG ulEngCheckSetting; + + if (pAST->MMIO2D) ulEngCheckSetting = 0x10000000; else ulEngCheckSetting = 0x80000000; @@ -319,15 +319,15 @@ vWaitEngIdle(ScrnInfoPtr pScrn, ASTRecPtr pAST) { /* 2D disable if 0xA4 D[0] = 1 */ - GetIndexRegMask(CRTC_PORT, 0xA4, 0x01, jReg); + GetIndexRegMask(CRTC_PORT, 0xA4, 0x01, jReg); if (!jReg) goto Exit_vWaitEngIdle; - + /* 2D not work if in std. mode */ - GetIndexRegMask(CRTC_PORT, 0xA3, 0x0F, jReg); + GetIndexRegMask(CRTC_PORT, 0xA3, 0x0F, jReg); if (!jReg) goto Exit_vWaitEngIdle; } - do + do { ulEngState = (*(volatile ULONG *)(pAST->CMDQInfo.pjEngStatePort)) & 0xFFFC0000; ulEngState2 = (*(volatile ULONG *)(pAST->CMDQInfo.pjEngStatePort)) & 0xFFFC0000; @@ -335,25 +335,25 @@ vWaitEngIdle(ScrnInfoPtr pScrn, ASTRecPtr pAST) ulEngState2 = (*(volatile ULONG *)(pAST->CMDQInfo.pjEngStatePort)) & 0xFFFC0000; ulEngState2 = (*(volatile ULONG *)(pAST->CMDQInfo.pjEngStatePort)) & 0xFFFC0000; ulEngState2 = (*(volatile ULONG *)(pAST->CMDQInfo.pjEngStatePort)) & 0xFFFC0000; - + } while ((ulEngState & ulEngCheckSetting) || (ulEngState != ulEngState2)); - + Exit_vWaitEngIdle: - ; -} + ; +} /* ULONG ulGetCMDQLength() */ static __inline ULONG ulGetCMDQLength(ASTRecPtr pAST, ULONG ulWritePointer, ULONG ulCMDQMask) { ULONG ulReadPointer, ulReadPointer2; - + do { - ulReadPointer = *((volatile ULONG *)(pAST->CMDQInfo.pjReadPort)) & 0x0003FFFF; + 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; - ulReadPointer2 = *((volatile ULONG *)(pAST->CMDQInfo.pjReadPort)) & 0x0003FFFF; } while (ulReadPointer != ulReadPointer2); return ((ulReadPointer << 3) - ulWritePointer - CMD_QUEUE_GUARD_BAND) & ulCMDQMask; @@ -367,34 +367,34 @@ ASTRecPtr pAST, ULONG ulDataLen) ulWritePointer = pAST->CMDQInfo.ulWritePointer; ulContinueCMDQLen = pAST->CMDQInfo.ulCMDQSize - ulWritePointer; - ulCMDQMask = pAST->CMDQInfo.ulCMDQMask; - + ulCMDQMask = pAST->CMDQInfo.ulCMDQMask; + if (ulContinueCMDQLen >= ulDataLen) { - /* Get CMDQ Buffer */ + /* Get CMDQ Buffer */ if (pAST->CMDQInfo.ulCurCMDQueueLen >= ulDataLen) { ; } else { - + do { ulCurCMDQLen = ulGetCMDQLength(pAST, ulWritePointer, ulCMDQMask); } while (ulCurCMDQLen < ulDataLen); - + pAST->CMDQInfo.ulCurCMDQueueLen = ulCurCMDQLen; } - + pjBuffer = pAST->CMDQInfo.pjCMDQVirtualAddr + ulWritePointer; - pAST->CMDQInfo.ulCurCMDQueueLen -= ulDataLen; + pAST->CMDQInfo.ulCurCMDQueueLen -= ulDataLen; pAST->CMDQInfo.ulWritePointer = (ulWritePointer + ulDataLen) & ulCMDQMask; - return pjBuffer; + return pjBuffer; } else - { + { /* Fill NULL CMD to the last of the CMDQ */ if (pAST->CMDQInfo.ulCurCMDQueueLen >= ulContinueCMDQLen) @@ -403,87 +403,87 @@ ASTRecPtr pAST, ULONG ulDataLen) } else { - + do { ulCurCMDQLen = ulGetCMDQLength(pAST, ulWritePointer, ulCMDQMask); } while (ulCurCMDQLen < ulContinueCMDQLen); - + pAST->CMDQInfo.ulCurCMDQueueLen = ulCurCMDQLen; } - + pjBuffer = pAST->CMDQInfo.pjCMDQVirtualAddr + ulWritePointer; for (i = 0; i<ulContinueCMDQLen/8; i++, pjBuffer+=8) { *(ULONG *)pjBuffer = (ULONG) PKT_NULL_CMD; *(ULONG *) (pjBuffer+4) = 0; - + } pAST->CMDQInfo.ulCurCMDQueueLen -= ulContinueCMDQLen; pAST->CMDQInfo.ulWritePointer = ulWritePointer = 0; - - /* Get CMDQ Buffer */ + + /* Get CMDQ Buffer */ if (pAST->CMDQInfo.ulCurCMDQueueLen >= ulDataLen) { - ; + ; } else { - + do { ulCurCMDQLen = ulGetCMDQLength(pAST, ulWritePointer, ulCMDQMask); } while (ulCurCMDQLen < ulDataLen); - + pAST->CMDQInfo.ulCurCMDQueueLen = ulCurCMDQLen; } - + pAST->CMDQInfo.ulCurCMDQueueLen -= ulDataLen; pjBuffer = pAST->CMDQInfo.pjCMDQVirtualAddr + ulWritePointer; pAST->CMDQInfo.ulWritePointer = (ulWritePointer + ulDataLen) & ulCMDQMask; - return pjBuffer; - + return pjBuffer; + } - + } /* end of pjRequestCmdQ() */ Bool bGetLineTerm(_LINEInfo *LineInfo, LINEPARAM *dsLineParam) { LONG GAbsX, GAbsY, GXInc, GYInc, GXMajor; LONG MM, mm, Error0, K1, K2; - + /* Init */ -#ifdef LONG64 +#ifdef LONG64 GAbsX = abs (LineInfo->X1 - LineInfo->X2); GAbsY = abs (LineInfo->Y1 - LineInfo->Y2); #else GAbsX = labs (LineInfo->X1 - LineInfo->X2); GAbsY = labs (LineInfo->Y1 - LineInfo->Y2); -#endif +#endif GXInc = (LineInfo->X1 < LineInfo->X2) ? 1:0; GYInc = (LineInfo->Y1 < LineInfo->Y2) ? 1:0; GXMajor = (GAbsX >= GAbsY) ? 1:0; - + /* Calculate */ if (GXMajor) { MM = GAbsX; - mm = GAbsY; + mm = GAbsY; } else { MM = GAbsY; - mm = GAbsX; + mm = GAbsX; } Error0 = (signed) (2*mm - MM); - + K1 = 2* mm; K2 = (signed) (2*mm - 2*MM); - + /*save the Param to dsLineParam */ dsLineParam->dsLineX = (USHORT) LineInfo->X1; dsLineParam->dsLineY = (USHORT) LineInfo->Y1; @@ -496,9 +496,9 @@ Bool bGetLineTerm(_LINEInfo *LineInfo, LINEPARAM *dsLineParam) if (GXMajor) dsLineParam->dwLineAttributes |= LINEPARAM_XM; if (!GXInc) dsLineParam->dwLineAttributes |= LINEPARAM_X_DEC; if (!GYInc) dsLineParam->dwLineAttributes |= LINEPARAM_Y_DEC; - + return(TRUE); - + } #endif /* end of Accel_2D */ diff --git a/src/ast_2dtool.h b/src/ast_2dtool.h index 5bc437f..888bbf2 100644 --- a/src/ast_2dtool.h +++ b/src/ast_2dtool.h @@ -30,7 +30,7 @@ #define ENG_CAP_Color8x8PatternFill 0x0040 #define ENG_CAP_CPUToScreenColorExpand 0x0080 #define ENG_CAP_ScreenToScreenColorExpand 0x0100 -#define ENG_CAP_Clipping 0x0200 +#define ENG_CAP_Clipping 0x0200 #define ENG_CAP_ALL (ENG_CAP_Sync | ENG_CAP_ScreenToScreenCopy | ENG_CAP_SolidFill | \ ENG_CAP_SolidLine | ENG_CAP_DashedLine | \ ENG_CAP_Mono8x8PatternFill | ENG_CAP_Color8x8PatternFill | \ @@ -67,13 +67,13 @@ typedef struct _PKT_SC { ULONG PKT_SC_dwHeader; ULONG PKT_SC_dwData[1]; - + } PKT_SC, *PPKT_SC; /* Packet CMD Scale */ #define PKT_TYPESCALE_LENGTH 56 -#define PKT_TYPESCALE_DATALENGTH (0xC<<16) -#define PKT_TYPESCALE_ADDRSTART 0x00000000 +#define PKT_TYPESCALE_DATALENGTH (0xC<<16) +#define PKT_TYPESCALE_ADDRSTART 0x00000000 typedef struct _BURSTSCALECMD { @@ -97,7 +97,7 @@ typedef struct _BURSTSCALECMD USHORT wDstPitch; /* 800E */ }; ULONG dwDstHeightPitch; /* 800C */ - }; + }; union { struct @@ -115,7 +115,7 @@ typedef struct _BURSTSCALECMD short wSrcX; /* 8016 */ }; ULONG dwSrcXY; /* 8014 */ - }; + }; union { struct @@ -132,7 +132,7 @@ typedef struct _BURSTSCALECMD ULONG dwCmd; /* 823C */ ULONG NullData[1]; -} BURSTSCALECMD, *PBURSTSCALECMD; +} BURSTSCALECMD, *PBURSTSCALECMD; /* Eng Reg. Limitation */ #define MAX_SRC_X 0x7FF @@ -151,20 +151,20 @@ typedef struct _BURSTSCALECMD #define MASK_RECT_HEIGHT 0x7FF #define MASK_CLIP 0xFFF -#define MASK_LINE_X 0xFFF +#define MASK_LINE_X 0xFFF #define MASK_LINE_Y 0xFFF -#define MASK_LINE_ERR 0x3FFFFF -#define MASK_LINE_WIDTH 0x7FF -#define MASK_LINE_K1 0x3FFFFF +#define MASK_LINE_ERR 0x3FFFFF +#define MASK_LINE_WIDTH 0x7FF +#define MASK_LINE_K1 0x3FFFFF #define MASK_LINE_K2 0x3FFFFF -#define MASK_AIPLINE_X 0xFFF +#define MASK_AIPLINE_X 0xFFF #define MASK_AIPLINE_Y 0xFFF #define MAX_PATReg_Size 256 -/* Eng Reg. Definition */ +/* Eng Reg. Definition */ /* MMIO Reg */ -#define MMIOREG_SRC_BASE (pAST->MMIOVirtualAddr + 0x8000) +#define MMIOREG_SRC_BASE (pAST->MMIOVirtualAddr + 0x8000) #define MMIOREG_SRC_PITCH (pAST->MMIOVirtualAddr + 0x8004) #define MMIOREG_DST_BASE (pAST->MMIOVirtualAddr + 0x8008) #define MMIOREG_DST_PITCH (pAST->MMIOVirtualAddr + 0x800C) @@ -179,21 +179,21 @@ typedef struct _BURSTSCALECMD #define MMIOREG_MONO2 (pAST->MMIOVirtualAddr + 0x8030) #define MMIOREG_CLIP1 (pAST->MMIOVirtualAddr + 0x8034) #define MMIOREG_CLIP2 (pAST->MMIOVirtualAddr + 0x8038) -#define MMIOREG_CMD (pAST->MMIOVirtualAddr + 0x803C) -#define MMIOREG_PAT (pAST->MMIOVirtualAddr + 0x8100) - -#define MMIOREG_LINE_XY (pAST->MMIOVirtualAddr + 0x8010) -#define MMIOREG_LINE_Err (pAST->MMIOVirtualAddr + 0x8014) -#define MMIOREG_LINE_WIDTH (pAST->MMIOVirtualAddr + 0x8018) -#define MMIOREG_LINE_K1 (pAST->MMIOVirtualAddr + 0x8024) -#define MMIOREG_LINE_K2 (pAST->MMIOVirtualAddr + 0x8028) -#define MMIOREG_LINE_STYLE1 (pAST->MMIOVirtualAddr + 0x802C) -#define MMIOREG_LINE_STYLE2 (pAST->MMIOVirtualAddr + 0x8030) +#define MMIOREG_CMD (pAST->MMIOVirtualAddr + 0x803C) +#define MMIOREG_PAT (pAST->MMIOVirtualAddr + 0x8100) + +#define MMIOREG_LINE_XY (pAST->MMIOVirtualAddr + 0x8010) +#define MMIOREG_LINE_Err (pAST->MMIOVirtualAddr + 0x8014) +#define MMIOREG_LINE_WIDTH (pAST->MMIOVirtualAddr + 0x8018) +#define MMIOREG_LINE_K1 (pAST->MMIOVirtualAddr + 0x8024) +#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) +#define MMIOREG_LINE_NUMBER (pAST->MMIOVirtualAddr + 0x8018) /* CMDQ Reg */ -#define CMDQREG_SRC_BASE (0x00 << 24) +#define CMDQREG_SRC_BASE (0x00 << 24) #define CMDQREG_SRC_PITCH (0x01 << 24) #define CMDQREG_DST_BASE (0x02 << 24) #define CMDQREG_DST_PITCH (0x03 << 24) @@ -211,15 +211,15 @@ typedef struct _BURSTSCALECMD #define CMDQREG_CMD (0x0F << 24) #define CMDQREG_PAT (0x40 << 24) -#define CMDQREG_LINE_XY (0x04 << 24) -#define CMDQREG_LINE_Err (0x05 << 24) -#define CMDQREG_LINE_WIDTH (0x06 << 24) -#define CMDQREG_LINE_K1 (0x09 << 24) +#define CMDQREG_LINE_XY (0x04 << 24) +#define CMDQREG_LINE_Err (0x05 << 24) +#define CMDQREG_LINE_WIDTH (0x06 << 24) +#define CMDQREG_LINE_K1 (0x09 << 24) #define CMDQREG_LINE_K2 (0x0A << 24) -#define CMDQREG_LINE_STYLE1 (0x0B << 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) +#define CMDQREG_LINE_NUMBER (0x06 << 24) /* CMD Reg. Definition */ #define CMD_BITBLT 0x00000000 @@ -229,8 +229,8 @@ typedef struct _BURSTSCALECMD #define CMD_TRANSPARENTBLT 0x00000004 #define CMD_TYPE_SCALE 0x00000005 #define CMD_MASK 0x00000007 - -#define CMD_DISABLE_CLIP 0x00000000 + +#define CMD_DISABLE_CLIP 0x00000000 #define CMD_ENABLE_CLIP 0x00000008 #define CMD_COLOR_08 0x00000000 @@ -248,10 +248,10 @@ typedef struct _BURSTSCALECMD #define CMD_OPAQUE 0x00000000 #define CMD_FONT_TRANSPARENT 0x00040000 -#define CMD_X_INC 0x00000000 +#define CMD_X_INC 0x00000000 #define CMD_X_DEC 0x00200000 -#define CMD_Y_INC 0x00000000 +#define CMD_Y_INC 0x00000000 #define CMD_Y_DEC 0x00100000 #define CMD_NT_LINE 0x00000000 @@ -293,16 +293,16 @@ typedef struct _LINEPARAM { ULONG dwErrorTerm; ULONG dwK1Term; ULONG dwK2Term; - ULONG dwLineAttributes; + ULONG dwLineAttributes; } LINEPARAM, *PLINEPARAM; typedef struct { - + LONG X1; LONG Y1; LONG X2; - LONG Y2; - + LONG Y2; + } _LINEInfo; /* Macro */ @@ -324,7 +324,7 @@ typedef struct { do { \ *(ULONG *)(MMIOREG_DST_BASE) = (ULONG)(base); \ } while (*(volatile ULONG *)(MMIOREG_DST_BASE) != (ULONG)(base)); \ - } + } #define ASTSetupDSTPitchHeight_MMIO(pitch, height) \ { \ ULONG dstpitch; \ @@ -332,7 +332,7 @@ typedef struct { do { \ *(ULONG *)(MMIOREG_DST_PITCH) = dstpitch; \ } while (*(volatile ULONG *)(MMIOREG_DST_PITCH) != dstpitch); \ - } + } #define ASTSetupDSTXY_MMIO(x, y) \ { \ ULONG dstxy; \ @@ -340,7 +340,7 @@ typedef struct { do { \ *(ULONG *)(MMIOREG_DST_XY) = dstxy; \ } while (*(volatile ULONG *)(MMIOREG_DST_XY) != dstxy); \ - } + } #define ASTSetupSRCXY_MMIO(x, y) \ { \ ULONG srcxy; \ @@ -348,7 +348,7 @@ typedef struct { do { \ *(ULONG *)(MMIOREG_SRC_XY) = srcxy; \ } while (*(volatile ULONG *)(MMIOREG_SRC_XY) != srcxy); \ - } + } #define ASTSetupRECTXY_MMIO(x, y) \ { \ ULONG rectxy; \ @@ -356,13 +356,13 @@ typedef struct { do { \ *(ULONG *)(MMIOREG_RECT_XY) = rectxy; \ } while (*(volatile ULONG *)(MMIOREG_RECT_XY) != rectxy); \ - } + } #define ASTSetupFG_MMIO(color) \ { \ do { \ *(ULONG *)(MMIOREG_FG) = (ULONG)(color); \ } while (*(volatile ULONG *)(MMIOREG_FG) != (ULONG)(color)); \ - } + } #define ASTSetupBG_MMIO(color) \ { \ do { \ @@ -374,7 +374,7 @@ typedef struct { do { \ *(ULONG *)(MMIOREG_MONO1) = (ULONG)(pat); \ } while (*(volatile ULONG *)(MMIOREG_MONO1) != (ULONG)(pat)); \ - } + } #define ASTSetupMONO2_MMIO(pat) \ { \ do { \ @@ -388,7 +388,7 @@ typedef struct { do { \ *(ULONG *)(MMIOREG_CLIP1) = clip1; \ } while (*(volatile ULONG *)(MMIOREG_CLIP1) != clip1); \ - } + } #define ASTSetupCLIP2_MMIO(right, bottom) \ { \ ULONG clip2; \ @@ -396,7 +396,7 @@ typedef struct { do { \ *(ULONG *)(MMIOREG_CLIP2) = clip2; \ } while (*(volatile ULONG *)(MMIOREG_CLIP2) != clip2); \ - } + } #define ASTSetupCMDReg_MMIO(reg) \ { \ *(ULONG *)(MMIOREG_CMD) = (ULONG)(reg); \ @@ -406,8 +406,8 @@ typedef struct { do { \ *(ULONG *)(MMIOREG_PAT + patreg*4) = (ULONG)(pat); \ } while (*(volatile ULONG *)(MMIOREG_PAT + patreg*4) != (ULONG)(pat)); \ - } - + } + /* Line CMD */ #define ASTSetupLineXY_MMIO(x, y) \ { \ @@ -424,7 +424,7 @@ typedef struct { do { \ *(ULONG *)(MMIOREG_LINE_Err) = lineerr; \ } while (*(volatile ULONG *)(MMIOREG_LINE_Err) != lineerr); \ - } + } #define ASTSetupLineWidth_MMIO(width) \ { \ ULONG linewidth; \ @@ -438,7 +438,7 @@ typedef struct { do { \ *(ULONG *)(MMIOREG_LINE_K1) = (ULONG)(err & MASK_LINE_K1); \ } while (*(volatile ULONG *)(MMIOREG_LINE_K1) != (ULONG)(err & MASK_LINE_K1)); \ - } + } #define ASTSetupLineK2Term_MMIO(err) \ { \ do { \ @@ -450,13 +450,13 @@ typedef struct { do { \ *(ULONG *)(MMIOREG_LINE_STYLE1) = (ULONG)(pat); \ } while (*(volatile ULONG *)(MMIOREG_LINE_STYLE1) != (ULONG)(pat)); \ - } + } #define ASTSetupLineStyle2_MMIO(pat) \ { \ do { \ *(ULONG *)(MMIOREG_LINE_STYLE2) = (ULONG)(pat); \ } while (*(volatile ULONG *)(MMIOREG_LINE_STYLE2) != (ULONG)(pat)); \ - } + } /* AIP Line CMD */ #define AIPSetupLineXY_MMIO(x, y) \ @@ -481,8 +481,8 @@ typedef struct { *(ULONG *)(MMIOREG_LINE_NUMBER) = (ULONG) no; \ } while (*(volatile ULONG *)(MMIOREG_LINE_NUMBER) != (ULONG) no); \ } - -/* CMDQ Mode Macro */ + +/* CMDQ Mode Macro */ #define mUpdateWritePointer *(ULONG *) (pAST->CMDQInfo.pjWritePort) = (pAST->CMDQInfo.ulWritePointer >>3) /* General CMD */ @@ -500,27 +500,27 @@ typedef struct { { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_DST_BASE); \ addr->PKT_SC_dwData[0] = (ULONG)(base); \ - } + } #define ASTSetupDSTPitchHeight(addr, pitch, height) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_DST_PITCH); \ addr->PKT_SC_dwData[0] = (ULONG)((pitch << 16) + ((height) & MASK_DST_HEIGHT)); \ - } + } #define ASTSetupDSTXY(addr, x, y) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_DST_XY); \ addr->PKT_SC_dwData[0] = (ULONG)(((x & MASK_DST_X) << 16) + (y & MASK_DST_Y)); \ - } + } #define ASTSetupSRCXY(addr, x, y) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_SRC_XY); \ addr->PKT_SC_dwData[0] = (ULONG)(((x & MASK_SRC_X) << 16) + (y & MASK_SRC_Y)); \ - } + } #define ASTSetupRECTXY(addr, x, y) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_RECT_XY); \ addr->PKT_SC_dwData[0] = (ULONG)(((x & MASK_RECT_WIDTH) << 16) + (y & MASK_RECT_WIDTH)); \ - } + } #define ASTSetupFG(addr, color) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_FG); \ @@ -535,22 +535,22 @@ typedef struct { { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_MONO1); \ addr->PKT_SC_dwData[0] = (ULONG)(pat); \ - } + } #define ASTSetupMONO2(addr, pat) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_MONO2); \ addr->PKT_SC_dwData[0] = (ULONG)(pat); \ - } + } #define ASTSetupCLIP1(addr, left, top) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_CLIP1); \ addr->PKT_SC_dwData[0] = (ULONG)(((left & MASK_CLIP) << 16) + (top & MASK_CLIP)); \ - } + } #define ASTSetupCLIP2(addr, right, bottom) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_CLIP2); \ addr->PKT_SC_dwData[0] = (ULONG)(((right & MASK_CLIP) << 16) + (bottom & MASK_CLIP)); \ - } + } #define ASTSetupCMDReg(addr, reg) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_CMD); \ @@ -560,7 +560,7 @@ typedef struct { { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + (CMDQREG_PAT + (patreg << 24))); \ addr->PKT_SC_dwData[0] = (ULONG)(pat); \ - } + } /* Line CMD */ #define ASTSetupLineXY(addr, x, y) \ @@ -572,32 +572,32 @@ typedef struct { { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_Err); \ addr->PKT_SC_dwData[0] = (ULONG)((xm << 24) + (err & MASK_LINE_ERR)); \ - } + } #define ASTSetupLineWidth(addr, width) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_WIDTH); \ addr->PKT_SC_dwData[0] = (ULONG)((width & MASK_LINE_WIDTH) << 16); \ - } + } #define ASTSetupLineK1Term(addr, err) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_K1); \ addr->PKT_SC_dwData[0] = (ULONG)(err & MASK_LINE_K1); \ - } + } #define ASTSetupLineK2Term(addr, err) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_K2); \ addr->PKT_SC_dwData[0] = (ULONG)(err & MASK_LINE_K2); \ - } + } #define ASTSetupLineStyle1(addr, pat) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_STYLE1); \ addr->PKT_SC_dwData[0] = (ULONG)(pat); \ - } + } #define ASTSetupLineStyle2(addr, pat) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_STYLE2); \ addr->PKT_SC_dwData[0] = (ULONG)(pat); \ - } + } #define ASTSetupNULLCMD(addr) \ { \ diff --git a/src/ast_accel.c b/src/ast_accel.c index 0e7e5d3..193666f 100644 --- a/src/ast_accel.c +++ b/src/ast_accel.c @@ -105,27 +105,27 @@ extern Bool bGetLineTerm(_LINEInfo *LineInfo, LINEPARAM *dsLineParam); Bool ASTAccelInit(ScreenPtr pScreen); #ifdef HAVE_XAA_H static void ASTSync(ScrnInfoPtr pScrn); -static void ASTSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, +static void ASTSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, unsigned int planemask, int trans_color); static void ASTSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, - int y2, int w, int h); + int y2, int w, int h); static void ASTSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask); static void ASTSubsequentSolidFillRect(ScrnInfoPtr pScrn, - int dst_x, int dst_y, int width, int height); + int dst_x, int dst_y, int width, int height); static void ASTSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask); static void ASTSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, int x, int y, int len, int dir); static void ASTSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, int flags); + int x1, int y1, int x2, int y2, int flags); static void ASTSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask, int length, UCHAR *pattern); static void ASTSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, - int flags, int phase); + int flags, int phase); static void ASTSetupForMonoPatternFill(ScrnInfoPtr pScrn, int patx, int paty, int fg, int bg, int rop, unsigned int planemask); @@ -150,11 +150,11 @@ static void ASTSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, int src_x, int src_y, int offset); static void ASTSetClippingRectangle(ScrnInfoPtr pScrn, int left, int top, int right, int bottom); -static void ASTDisableClipping(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); + 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); @@ -181,7 +181,7 @@ ASTAccelInit(ScreenPtr pScreen) /* Screen To Screen copy */ if (pAST->ENGCaps & ENG_CAP_ScreenToScreenCopy) - { + { infoPtr->SetupForScreenToScreenCopy = ASTSetupForScreenToScreenCopy; infoPtr->SubsequentScreenToScreenCopy = ASTSubsequentScreenToScreenCopy; infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | NO_PLANEMASK; @@ -189,15 +189,15 @@ ASTAccelInit(ScreenPtr pScreen) /* Solid fill */ if (pAST->ENGCaps & ENG_CAP_SolidFill) - { + { infoPtr->SetupForSolidFill = ASTSetupForSolidFill; infoPtr->SubsequentSolidFillRect = ASTSubsequentSolidFillRect; infoPtr->SolidFillFlags = NO_PLANEMASK; - } - + } + /* Solid Lines */ if (pAST->ENGCaps & ENG_CAP_SolidLine) - { + { if ( (pAST->jChipType == AST2300) || (pAST->jChipType == AST1180) ) { infoPtr->SubsequentSolidTwoPointLine = AIPSubsequentSolidTwoPointLine; @@ -207,8 +207,8 @@ ASTAccelInit(ScreenPtr pScreen) infoPtr->SubsequentSolidTwoPointLine = ASTSubsequentSolidTwoPointLine; } - infoPtr->SetupForSolidLine = ASTSetupForSolidLine; - infoPtr->SubsequentSolidHorVertLine = ASTSubsequentSolidHorVertLine; + infoPtr->SetupForSolidLine = ASTSetupForSolidLine; + infoPtr->SubsequentSolidHorVertLine = ASTSubsequentSolidHorVertLine; infoPtr->SolidLineFlags = NO_PLANEMASK; } @@ -222,17 +222,17 @@ ASTAccelInit(ScreenPtr pScreen) else { infoPtr->SubsequentDashedTwoPointLine = ASTSubsequentDashedTwoPointLine; - } + } - infoPtr->SetupForDashedLine = ASTSetupForDashedLine; + infoPtr->SetupForDashedLine = ASTSetupForDashedLine; infoPtr->DashPatternMaxLength = 64; infoPtr->DashedLineFlags = NO_PLANEMASK | LINE_PATTERN_MSBFIRST_LSBJUSTIFIED; - } + } /* 8x8 mono pattern fill */ if (pAST->ENGCaps & ENG_CAP_Mono8x8PatternFill) - { + { infoPtr->SetupForMono8x8PatternFill = ASTSetupForMonoPatternFill; infoPtr->SubsequentMono8x8PatternFillRect = ASTSubsequentMonoPatternFill; infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK | @@ -240,50 +240,50 @@ ASTAccelInit(ScreenPtr pScreen) HARDWARE_PATTERN_SCREEN_ORIGIN | HARDWARE_PATTERN_PROGRAMMED_BITS | BIT_ORDER_IN_BYTE_MSBFIRST; - } - + } + /* 8x8 color pattern fill */ if (pAST->ENGCaps & ENG_CAP_Color8x8PatternFill) - { + { infoPtr->SetupForColor8x8PatternFill = ASTSetupForColor8x8PatternFill; infoPtr->SubsequentColor8x8PatternFillRect = ASTSubsequentColor8x8PatternFillRect; infoPtr->Color8x8PatternFillFlags = NO_PLANEMASK | - NO_TRANSPARENCY | + NO_TRANSPARENCY | HARDWARE_PATTERN_SCREEN_ORIGIN; - } - + } + /* CPU To Screen Color Expand */ if (pAST->ENGCaps & ENG_CAP_CPUToScreenColorExpand) - { + { infoPtr->SetupForCPUToScreenColorExpandFill = ASTSetupForCPUToScreenColorExpandFill; infoPtr->SubsequentCPUToScreenColorExpandFill = ASTSubsequentCPUToScreenColorExpandFill; infoPtr->ColorExpandRange = MAX_PATReg_Size; infoPtr->ColorExpandBase = MMIOREG_PAT; infoPtr->CPUToScreenColorExpandFillFlags = NO_PLANEMASK | BIT_ORDER_IN_BYTE_MSBFIRST; - } + } /* Screen To Screen Color Expand */ if (pAST->ENGCaps & ENG_CAP_ScreenToScreenColorExpand) - { + { infoPtr->SetupForScreenToScreenColorExpandFill = ASTSetupForScreenToScreenColorExpandFill; infoPtr->SubsequentScreenToScreenColorExpandFill = ASTSubsequentScreenToScreenColorExpandFill; infoPtr->ScreenToScreenColorExpandFillFlags = NO_PLANEMASK | BIT_ORDER_IN_BYTE_MSBFIRST; - } - + } + /* Clipping */ if (pAST->ENGCaps & ENG_CAP_Clipping) - { + { infoPtr->SetClippingRectangle = ASTSetClippingRectangle; infoPtr->DisableClipping = ASTDisableClipping; infoPtr->ClippingFlags = HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY | HARDWARE_CLIP_MONO_8x8_FILL | HARDWARE_CLIP_COLOR_8x8_FILL | - HARDWARE_CLIP_SOLID_LINE | - HARDWARE_CLIP_DASHED_LINE | - HARDWARE_CLIP_SOLID_LINE; - } + HARDWARE_CLIP_SOLID_LINE | + HARDWARE_CLIP_DASHED_LINE | + HARDWARE_CLIP_SOLID_LINE; + } return(XAAInit(pScreen, infoPtr)); #else @@ -307,14 +307,14 @@ static void ASTSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, unsigned int planemask, int trans_color) { - + ASTRecPtr pAST = ASTPTR(pScrn); PKT_SC *pSingleCMD; ULONG cmdreg; - + /* xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForScreenToScreenCopy\n"); -*/ +*/ /* Modify Reg. Value */ cmdreg = CMD_BITBLT; switch (pAST->VideoModeInfo.bitsPerPixel) @@ -325,35 +325,35 @@ static void ASTSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, case 15: case 16: cmdreg |= CMD_COLOR_16; - break; + break; case 24: case 32: cmdreg |= CMD_COLOR_32; - break; + break; } cmdreg |= (ASTXAACopyROP[rop] << 8); pAST->ulCMDReg = cmdreg; - + if (!pAST->MMIO2D) - { + { /* Write to CMDQ */ pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*2); - - ASTSetupSRCPitch(pSingleCMD, pAST->VideoModeInfo.ScreenPitch); + + ASTSetupSRCPitch(pSingleCMD, pAST->VideoModeInfo.ScreenPitch); pSingleCMD++; ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); - + /* Update Write Pointer */ mUpdateWritePointer; - + } else { - /* Write to MMIO */ - ASTSetupSRCPitch_MMIO(pAST->VideoModeInfo.ScreenPitch); - ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1); + /* Write to MMIO */ + ASTSetupSRCPitch_MMIO(pAST->VideoModeInfo.ScreenPitch); + ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1); } - + } /* end of ASTSetupForScreenToScreenCopy */ static void @@ -370,34 +370,34 @@ ASTSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, */ if ((width != 0) && (height != 0)) - { + { /* Modify Reg. Value */ cmdreg = pAST->ulCMDReg; if (pAST->EnableClip) cmdreg |= CMD_ENABLE_CLIP; else - cmdreg &= ~CMD_ENABLE_CLIP; + cmdreg &= ~CMD_ENABLE_CLIP; srcbase = dstbase = 0; if (x1 < x2) - cmdreg |= CMD_X_DEC; + cmdreg |= CMD_X_DEC; if (y1 < y2) - cmdreg |= CMD_Y_DEC; - + cmdreg |= CMD_Y_DEC; + if ((y1 + height) >= MAX_SRC_Y) - { + { srcbase=pAST->VideoModeInfo.ScreenPitch*y1; y1 = 0; - } - - if ((y2 + height) >= pScrn->virtualY) - { + } + + if ((y2 + height) >= pScrn->virtualY) + { delta_y = y2; dstbase=pAST->VideoModeInfo.ScreenPitch*y2; y2 = 0; } - + if (cmdreg & CMD_X_DEC) { src_x = x1 + width - 1; @@ -406,56 +406,56 @@ ASTSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, else { src_x = x1; - dst_x = x2; + dst_x = x2; } - + if (cmdreg & CMD_Y_DEC) - { + { src_y = y1 + height - 1; dst_y = y2 + height - 1; } else { src_y = y1; - dst_y = y2; + dst_y = y2; } - - if (pAST->EnableClip) + + if (pAST->EnableClip) ASTSetHWClipping(pScrn, delta_y); - - if (!pAST->MMIO2D) + + if (!pAST->MMIO2D) { /* Write to CMDQ */ pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*6); - + ASTSetupSRCBase(pSingleCMD, srcbase); - pSingleCMD++; + pSingleCMD++; ASTSetupDSTBase(pSingleCMD, dstbase); - pSingleCMD++; - ASTSetupDSTXY(pSingleCMD, dst_x, dst_y); - pSingleCMD++; - ASTSetupSRCXY(pSingleCMD, src_x, src_y); - pSingleCMD++; - ASTSetupRECTXY(pSingleCMD, width, height); - pSingleCMD++; - ASTSetupCMDReg(pSingleCMD, cmdreg); - + pSingleCMD++; + ASTSetupDSTXY(pSingleCMD, dst_x, dst_y); + pSingleCMD++; + ASTSetupSRCXY(pSingleCMD, src_x, src_y); + pSingleCMD++; + ASTSetupRECTXY(pSingleCMD, width, height); + pSingleCMD++; + ASTSetupCMDReg(pSingleCMD, cmdreg); + /* Update Write Pointer */ mUpdateWritePointer; - + } else { ASTSetupSRCBase_MMIO(srcbase); ASTSetupDSTBase_MMIO(dstbase); - ASTSetupDSTXY_MMIO(dst_x, dst_y); - ASTSetupSRCXY_MMIO(src_x, src_y); - ASTSetupRECTXY_MMIO(width, height); - ASTSetupCMDReg_MMIO(cmdreg); - + ASTSetupDSTXY_MMIO(dst_x, dst_y); + ASTSetupSRCXY_MMIO(src_x, src_y); + ASTSetupRECTXY_MMIO(width, height); + ASTSetupCMDReg_MMIO(cmdreg); + vWaitEngIdle(pScrn, pAST); } - + } /* width & height check */ } /* end of ASTSubsequentScreenToScreenCopy */ @@ -464,14 +464,14 @@ static void ASTSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask) { - + ASTRecPtr pAST = ASTPTR(pScrn); PKT_SC *pSingleCMD; ULONG cmdreg; -/* +/* xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForSolidFill\n"); -*/ +*/ /* Modify Reg. Value */ cmdreg = CMD_BITBLT | CMD_PAT_FGCOLOR; switch (pAST->VideoModeInfo.bitsPerPixel) @@ -482,16 +482,16 @@ ASTSetupForSolidFill(ScrnInfoPtr pScrn, case 15: case 16: cmdreg |= CMD_COLOR_16; - break; + break; case 24: case 32: cmdreg |= CMD_COLOR_32; - break; + break; } cmdreg |= (ASTXAAPatternROP[rop] << 8); pAST->ulCMDReg = cmdreg; - - if (!pAST->MMIO2D) + + if (!pAST->MMIO2D) { /* Write to CMDQ */ pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*2); @@ -499,17 +499,17 @@ ASTSetupForSolidFill(ScrnInfoPtr pScrn, ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); pSingleCMD++; ASTSetupFG(pSingleCMD, color); - + /* Update Write Pointer */ mUpdateWritePointer; - + } else { ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1); - ASTSetupFG_MMIO(color); + ASTSetupFG_MMIO(color); } - + } /* end of ASTSetupForSolidFill */ @@ -519,10 +519,10 @@ 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"); */ @@ -533,54 +533,54 @@ ASTSubsequentSolidFillRect(ScrnInfoPtr pScrn, if (pAST->EnableClip) cmdreg |= CMD_ENABLE_CLIP; else - cmdreg &= ~CMD_ENABLE_CLIP; + cmdreg &= ~CMD_ENABLE_CLIP; dstbase = 0; - - if (dst_y >= pScrn->virtualY) + + if (dst_y >= pScrn->virtualY) { - delta_y = dst_y; + delta_y = dst_y; dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y; dst_y=0; } - if (pAST->EnableClip) + if (pAST->EnableClip) ASTSetHWClipping(pScrn, delta_y); - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ + + if (!pAST->MMIO2D) + { + /* Write to CMDQ */ pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*4); - + ASTSetupDSTBase(pSingleCMD, dstbase); - pSingleCMD++; + pSingleCMD++; ASTSetupDSTXY(pSingleCMD, dst_x, dst_y); - pSingleCMD++; + pSingleCMD++; ASTSetupRECTXY(pSingleCMD, width, height); - pSingleCMD++; - ASTSetupCMDReg(pSingleCMD, cmdreg); - + pSingleCMD++; + ASTSetupCMDReg(pSingleCMD, cmdreg); + /* Update Write Pointer */ mUpdateWritePointer; - + } else - { + { ASTSetupDSTBase_MMIO(dstbase); ASTSetupDSTXY_MMIO(dst_x, dst_y); ASTSetupRECTXY_MMIO(width, height); - ASTSetupCMDReg_MMIO(cmdreg); - + ASTSetupCMDReg_MMIO(cmdreg); + vWaitEngIdle(pScrn, pAST); - + } - + } /* width & height check */ } /* end of ASTSubsequentSolidFillRect */ /* Line */ -static void ASTSetupForSolidLine(ScrnInfoPtr pScrn, +static void ASTSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask) { @@ -589,7 +589,7 @@ static void ASTSetupForSolidLine(ScrnInfoPtr pScrn, ULONG cmdreg; /* xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForSolidLine\n"); -*/ +*/ /* Modify Reg. Value */ cmdreg = CMD_BITBLT; switch (pAST->VideoModeInfo.bitsPerPixel) @@ -600,38 +600,38 @@ static void ASTSetupForSolidLine(ScrnInfoPtr pScrn, case 15: case 16: cmdreg |= CMD_COLOR_16; - break; + break; case 24: case 32: cmdreg |= CMD_COLOR_32; - break; + break; } - cmdreg |= (ASTXAAPatternROP[rop] << 8); + cmdreg |= (ASTXAAPatternROP[rop] << 8); pAST->ulCMDReg = cmdreg; - + if (!pAST->MMIO2D) - { + { /* Write to CMDQ */ pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*3); ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); pSingleCMD++; - ASTSetupFG(pSingleCMD, color); + ASTSetupFG(pSingleCMD, color); pSingleCMD++; ASTSetupBG(pSingleCMD, 0); - + /* Update Write Pointer */ - mUpdateWritePointer; - + mUpdateWritePointer; + } else { - /* Write to MMIO */ - ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1); - ASTSetupFG_MMIO(color); - ASTSetupBG_MMIO(0); + /* Write to MMIO */ + ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1); + ASTSetupFG_MMIO(color); + ASTSetupBG_MMIO(0); } - + } /* end of ASTSetupForSolidLine */ @@ -641,10 +641,10 @@ static void ASTSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, ASTRecPtr pAST = ASTPTR(pScrn); PKT_SC *pSingleCMD; - ULONG dstbase, cmdreg; + ULONG dstbase, cmdreg; int width, height; int delta_y = 0; -/* +/* xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentSolidHorVertLine\n"); */ @@ -655,75 +655,75 @@ static void ASTSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, if (pAST->EnableClip) cmdreg |= CMD_ENABLE_CLIP; else - cmdreg &= ~CMD_ENABLE_CLIP; + cmdreg &= ~CMD_ENABLE_CLIP; dstbase = 0; - + if(dir == DEGREES_0) { /* horizontal */ width = len; - height = 1; + height = 1; } else { /* vertical */ width = 1; - height = len; + height = len; } - - if ((y + height) >= pScrn->virtualY) - { - delta_y = y; + + if ((y + height) >= pScrn->virtualY) + { + delta_y = y; dstbase=pAST->VideoModeInfo.ScreenPitch*y; y=0; } - - if (pAST->EnableClip) + + if (pAST->EnableClip) ASTSetHWClipping(pScrn, delta_y); - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ + + if (!pAST->MMIO2D) + { + /* Write to CMDQ */ pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*4); - + ASTSetupDSTBase(pSingleCMD, dstbase); - pSingleCMD++; + pSingleCMD++; ASTSetupDSTXY(pSingleCMD, x, y); - pSingleCMD++; + pSingleCMD++; ASTSetupRECTXY(pSingleCMD, width, height); - pSingleCMD++; - ASTSetupCMDReg(pSingleCMD, cmdreg); - + pSingleCMD++; + ASTSetupCMDReg(pSingleCMD, cmdreg); + /* Update Write Pointer */ mUpdateWritePointer; - + } else - { + { ASTSetupDSTBase_MMIO(dstbase); ASTSetupDSTXY_MMIO(x, y); ASTSetupRECTXY_MMIO(width, height); - ASTSetupCMDReg_MMIO(cmdreg); - + ASTSetupCMDReg_MMIO(cmdreg); + vWaitEngIdle(pScrn, pAST); - + } - + } /* len check */ - + } /* end of ASTSubsequentSolidHorVertLine */ static void ASTSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int flags) { - + ASTRecPtr pAST = ASTPTR(pScrn); PKT_SC *pSingleCMD; LINEPARAM dsLineParam; - _LINEInfo LineInfo; + _LINEInfo LineInfo; ULONG dstbase, ulCommand; - ULONG miny, maxy; + ULONG miny, maxy; USHORT usXM; int delta_y = 0; - + /* xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentSolidTwoPointLine\n"); -*/ +*/ /* Modify Reg. Value */ ulCommand = (pAST->ulCMDReg & (~CMD_MASK)) | CMD_LINEDRAW; @@ -734,7 +734,7 @@ static void ASTSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, if (pAST->EnableClip) ulCommand |= CMD_ENABLE_CLIP; else - ulCommand &= ~CMD_ENABLE_CLIP; + ulCommand &= ~CMD_ENABLE_CLIP; dstbase = 0; miny = (y1 > y2) ? y2 : y1; maxy = (y1 > y2) ? y1 : y2; @@ -744,62 +744,62 @@ static void ASTSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, y1 -= miny; y2 -= miny; } - + LineInfo.X1 = x1; LineInfo.Y1 = y1; LineInfo.X2 = x2; LineInfo.Y2 = y2; - + bGetLineTerm(&LineInfo, &dsLineParam); /* Get Line Parameter */ - - if (dsLineParam.dwLineAttributes & LINEPARAM_X_DEC) - ulCommand |= CMD_X_DEC; - if (dsLineParam.dwLineAttributes & LINEPARAM_Y_DEC) - ulCommand |= CMD_Y_DEC; - - usXM = (dsLineParam.dwLineAttributes & LINEPARAM_XM) ? 1:0; - - if (pAST->EnableClip) + + if (dsLineParam.dwLineAttributes & LINEPARAM_X_DEC) + ulCommand |= CMD_X_DEC; + if (dsLineParam.dwLineAttributes & LINEPARAM_Y_DEC) + ulCommand |= CMD_Y_DEC; + + usXM = (dsLineParam.dwLineAttributes & LINEPARAM_XM) ? 1:0; + + if (pAST->EnableClip) ASTSetHWClipping(pScrn, delta_y); - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ + + if (!pAST->MMIO2D) + { + /* Write to CMDQ */ pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*7); ASTSetupDSTBase(pSingleCMD, dstbase); - pSingleCMD++; + pSingleCMD++; ASTSetupLineXY(pSingleCMD, dsLineParam.dsLineX, dsLineParam.dsLineY); - pSingleCMD++; + pSingleCMD++; ASTSetupLineXMErrTerm(pSingleCMD, usXM , dsLineParam.dwErrorTerm); - pSingleCMD++; + pSingleCMD++; ASTSetupLineWidth(pSingleCMD, dsLineParam.dsLineWidth); - pSingleCMD++; + pSingleCMD++; ASTSetupLineK1Term(pSingleCMD, dsLineParam.dwK1Term); - pSingleCMD++; + pSingleCMD++; ASTSetupLineK2Term(pSingleCMD, dsLineParam.dwK2Term); - pSingleCMD++; - ASTSetupCMDReg(pSingleCMD, ulCommand); - + pSingleCMD++; + ASTSetupCMDReg(pSingleCMD, ulCommand); + /* Update Write Pointer */ - mUpdateWritePointer; + mUpdateWritePointer; /* Patch KDE pass abnormal point, ycchen@052507 */ vWaitEngIdle(pScrn, pAST); - + } else - { + { ASTSetupDSTBase_MMIO(dstbase); ASTSetupLineXY_MMIO(dsLineParam.dsLineX, dsLineParam.dsLineY); ASTSetupLineXMErrTerm_MMIO( usXM , dsLineParam.dwErrorTerm); ASTSetupLineWidth_MMIO(dsLineParam.dsLineWidth); ASTSetupLineK1Term_MMIO(dsLineParam.dwK1Term); ASTSetupLineK2Term_MMIO(dsLineParam.dwK2Term); - ASTSetupCMDReg_MMIO(ulCommand); - + ASTSetupCMDReg_MMIO(ulCommand); + vWaitEngIdle(pScrn, pAST); - + } @@ -817,10 +817,10 @@ ASTSetupForDashedLine(ScrnInfoPtr pScrn, ULONG cmdreg; /* xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForDashedLine\n"); -*/ +*/ /* Modify Reg. Value */ cmdreg = CMD_LINEDRAW | CMD_RESET_STYLE_COUNTER | CMD_ENABLE_LINE_STYLE; - + switch (pAST->VideoModeInfo.bitsPerPixel) { case 8: @@ -829,50 +829,50 @@ ASTSetupForDashedLine(ScrnInfoPtr pScrn, case 15: case 16: cmdreg |= CMD_COLOR_16; - break; + break; case 24: case 32: cmdreg |= CMD_COLOR_32; - break; + break; } - cmdreg |= (ASTXAAPatternROP[rop] << 8); + cmdreg |= (ASTXAAPatternROP[rop] << 8); if(bg == -1) { - cmdreg |= CMD_TRANSPARENT; + cmdreg |= CMD_TRANSPARENT; bg = 0; } cmdreg |= (((length-1) & 0x3F) << 24); /* line period */ pAST->ulCMDReg = cmdreg; - + if (!pAST->MMIO2D) - { + { /* Write to CMDQ */ pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*5); ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); pSingleCMD++; - ASTSetupFG(pSingleCMD, fg); + ASTSetupFG(pSingleCMD, fg); pSingleCMD++; - ASTSetupBG(pSingleCMD, bg); + ASTSetupBG(pSingleCMD, bg); pSingleCMD++; ASTSetupLineStyle1(pSingleCMD, *pattern); pSingleCMD++; ASTSetupLineStyle2(pSingleCMD, *(pattern+4)); - + /* Update Write Pointer */ - mUpdateWritePointer; - + mUpdateWritePointer; + } else { - /* Write to MMIO */ + /* Write to MMIO */ ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1); - ASTSetupFG_MMIO(fg); - ASTSetupBG_MMIO(bg); + ASTSetupFG_MMIO(fg); + ASTSetupBG_MMIO(bg); ASTSetupLineStyle1_MMIO(*pattern); - ASTSetupLineStyle2_MMIO(*(pattern+4)); + ASTSetupLineStyle2_MMIO(*(pattern+4)); } - + } static void @@ -880,19 +880,19 @@ ASTSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int flags, int phase) { - + ASTRecPtr pAST = ASTPTR(pScrn); PKT_SC *pSingleCMD; LINEPARAM dsLineParam; - _LINEInfo LineInfo; - ULONG dstbase, ulCommand; - ULONG miny, maxy; + _LINEInfo LineInfo; + ULONG dstbase, ulCommand; + ULONG miny, maxy; USHORT usXM; int delta_y = 0; - + /* xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentDashedTwoPointLine\n"); -*/ +*/ /* Modify Reg. Value */ ulCommand = pAST->ulCMDReg; @@ -903,8 +903,8 @@ ASTSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, if (pAST->EnableClip) ulCommand |= CMD_ENABLE_CLIP; else - ulCommand &= ~CMD_ENABLE_CLIP; - dstbase = 0; + ulCommand &= ~CMD_ENABLE_CLIP; + dstbase = 0; miny = (y1 > y2) ? y2 : y1; maxy = (y1 > y2) ? y1 : y2; if(maxy >= pScrn->virtualY) { @@ -913,64 +913,64 @@ ASTSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, y1 -= miny; y2 -= miny; } - + LineInfo.X1 = x1; LineInfo.Y1 = y1; LineInfo.X2 = x2; LineInfo.Y2 = y2; - + bGetLineTerm(&LineInfo, &dsLineParam); /* Get Line Parameter */ - - if (dsLineParam.dwLineAttributes & LINEPARAM_X_DEC) - ulCommand |= CMD_X_DEC; - if (dsLineParam.dwLineAttributes & LINEPARAM_Y_DEC) - ulCommand |= CMD_Y_DEC; - - usXM = (dsLineParam.dwLineAttributes & LINEPARAM_XM) ? 1:0; - - if (pAST->EnableClip) + + if (dsLineParam.dwLineAttributes & LINEPARAM_X_DEC) + ulCommand |= CMD_X_DEC; + if (dsLineParam.dwLineAttributes & LINEPARAM_Y_DEC) + ulCommand |= CMD_Y_DEC; + + usXM = (dsLineParam.dwLineAttributes & LINEPARAM_XM) ? 1:0; + + if (pAST->EnableClip) ASTSetHWClipping(pScrn, delta_y); - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ + + if (!pAST->MMIO2D) + { + /* Write to CMDQ */ pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*7); ASTSetupDSTBase(pSingleCMD, dstbase); - pSingleCMD++; + pSingleCMD++; ASTSetupLineXY(pSingleCMD, dsLineParam.dsLineX, dsLineParam.dsLineY); - pSingleCMD++; + pSingleCMD++; ASTSetupLineXMErrTerm(pSingleCMD, usXM , dsLineParam.dwErrorTerm); - pSingleCMD++; + pSingleCMD++; ASTSetupLineWidth(pSingleCMD, dsLineParam.dsLineWidth); - pSingleCMD++; + pSingleCMD++; ASTSetupLineK1Term(pSingleCMD, dsLineParam.dwK1Term); - pSingleCMD++; + pSingleCMD++; ASTSetupLineK2Term(pSingleCMD, dsLineParam.dwK2Term); - pSingleCMD++; - ASTSetupCMDReg(pSingleCMD, ulCommand); - + pSingleCMD++; + ASTSetupCMDReg(pSingleCMD, ulCommand); + /* Update Write Pointer */ mUpdateWritePointer; /* Patch KDE pass abnormal point, ycchen@052507 */ vWaitEngIdle(pScrn, pAST); - + } else - { + { ASTSetupDSTBase_MMIO(dstbase); ASTSetupLineXY_MMIO(dsLineParam.dsLineX, dsLineParam.dsLineY); ASTSetupLineXMErrTerm_MMIO( usXM , dsLineParam.dwErrorTerm); ASTSetupLineWidth_MMIO(dsLineParam.dsLineWidth); ASTSetupLineK1Term_MMIO(dsLineParam.dwK1Term); ASTSetupLineK2Term_MMIO(dsLineParam.dwK2Term); - ASTSetupCMDReg_MMIO(ulCommand); - + ASTSetupCMDReg_MMIO(ulCommand); + vWaitEngIdle(pScrn, pAST); - + } - + } /* Mono Pattern Fill */ @@ -979,14 +979,14 @@ ASTSetupForMonoPatternFill(ScrnInfoPtr pScrn, int patx, int paty, int fg, int bg, int rop, unsigned int planemask) { - + ASTRecPtr pAST = ASTPTR(pScrn); PKT_SC *pSingleCMD; ULONG cmdreg; -/* +/* xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForMonoPatternFill\n"); -*/ +*/ /* Modify Reg. Value */ cmdreg = CMD_BITBLT | CMD_PAT_MONOMASK; switch (pAST->VideoModeInfo.bitsPerPixel) @@ -997,43 +997,43 @@ ASTSetupForMonoPatternFill(ScrnInfoPtr pScrn, case 15: case 16: cmdreg |= CMD_COLOR_16; - break; + break; case 24: case 32: cmdreg |= CMD_COLOR_32; - break; + break; } cmdreg |= (ASTXAAPatternROP[rop] << 8); pAST->ulCMDReg = cmdreg; - - if (!pAST->MMIO2D) + + if (!pAST->MMIO2D) { /* Write to CMDQ */ pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*5); ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); pSingleCMD++; - ASTSetupFG(pSingleCMD, fg); + ASTSetupFG(pSingleCMD, fg); pSingleCMD++; ASTSetupBG(pSingleCMD, bg); pSingleCMD++; - ASTSetupMONO1(pSingleCMD, patx); + ASTSetupMONO1(pSingleCMD, patx); pSingleCMD++; ASTSetupMONO2(pSingleCMD, paty); - + /* Update Write Pointer */ mUpdateWritePointer; - + } else { ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1); - ASTSetupFG_MMIO(fg); + ASTSetupFG_MMIO(fg); ASTSetupBG_MMIO(bg); - ASTSetupMONO1_MMIO(patx); - ASTSetupMONO2_MMIO(paty); + ASTSetupMONO1_MMIO(patx); + ASTSetupMONO2_MMIO(paty); } - + } /* end of ASTSetupForMonoPatternFill */ @@ -1046,55 +1046,55 @@ ASTSubsequentMonoPatternFill(ScrnInfoPtr pScrn, PKT_SC *pSingleCMD; ULONG dstbase, cmdreg; int delta_y = 0; - -/* + +/* xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentMonoPatternFill\n"); -*/ - +*/ + /* Modify Reg. Value */ cmdreg = pAST->ulCMDReg; if (pAST->EnableClip) cmdreg |= CMD_ENABLE_CLIP; else - cmdreg &= ~CMD_ENABLE_CLIP; + cmdreg &= ~CMD_ENABLE_CLIP; dstbase = 0; - if (dst_y >= pScrn->virtualY) - { + if (dst_y >= pScrn->virtualY) + { delta_y = dst_y; dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y; dst_y=0; } - if (pAST->EnableClip) + if (pAST->EnableClip) ASTSetHWClipping(pScrn, delta_y); - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ + + if (!pAST->MMIO2D) + { + /* Write to CMDQ */ pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*4); ASTSetupDSTBase(pSingleCMD, dstbase); - pSingleCMD++; + pSingleCMD++; ASTSetupDSTXY(pSingleCMD, dst_x, dst_y); - pSingleCMD++; + pSingleCMD++; ASTSetupRECTXY(pSingleCMD, width, height); - pSingleCMD++; - ASTSetupCMDReg(pSingleCMD, cmdreg); - + pSingleCMD++; + ASTSetupCMDReg(pSingleCMD, cmdreg); + /* Update Write Pointer */ mUpdateWritePointer; - + } else - { + { ASTSetupDSTBase_MMIO(dstbase); ASTSetupDSTXY_MMIO(dst_x, dst_y); ASTSetupRECTXY_MMIO(width, height); - ASTSetupCMDReg_MMIO(cmdreg); - - vWaitEngIdle(pScrn, pAST); - } + ASTSetupCMDReg_MMIO(cmdreg); + + vWaitEngIdle(pScrn, pAST); + } } /* end of ASTSubsequentMonoPatternFill */ @@ -1102,16 +1102,16 @@ static void ASTSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, int rop, unsigned int planemask, int trans_col) { - + ASTRecPtr pAST = ASTPTR(pScrn); PKT_SC *pSingleCMD; ULONG cmdreg; CARD32 *pataddr; ULONG ulPatSize; int i, j, cpp; -/* +/* xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForColor8x8PatternFill\n"); -*/ +*/ /* Modify Reg. Value */ cmdreg = CMD_BITBLT | CMD_PAT_PATREG; switch (pAST->VideoModeInfo.bitsPerPixel) @@ -1122,22 +1122,22 @@ ASTSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, case 15: case 16: cmdreg |= CMD_COLOR_16; - break; + break; case 24: case 32: cmdreg |= CMD_COLOR_32; - break; + break; } cmdreg |= (ASTXAAPatternROP[rop] << 8); pAST->ulCMDReg = cmdreg; cpp = (pScrn->bitsPerPixel + 1) / 8; pataddr = (CARD32 *)(pAST->FBVirtualAddr + - (paty * pAST->VideoModeInfo.ScreenPitch) + (patx * cpp)); + (paty * pAST->VideoModeInfo.ScreenPitch) + (patx * cpp)); ulPatSize = 8*8*cpp; - - if (!pAST->MMIO2D) + + if (!pAST->MMIO2D) { - /* Write to CMDQ */ + /* Write to CMDQ */ pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*(1 + ulPatSize/4)); ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); pSingleCMD++; @@ -1146,29 +1146,29 @@ ASTSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, for (j=0; j<8*cpp/4; j++) { ASTSetupPatReg(pSingleCMD, (i*j + j) , (*(CARD32 *) (pataddr++))); - pSingleCMD++; - } + pSingleCMD++; + } } - + /* Update Write Pointer */ mUpdateWritePointer; - + } else - { + { ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1); for (i=0; i<8; i++) { for (j=0; j<8*cpp/4; j++) { ASTSetupPatReg_MMIO((i*j + j) , (*(CARD32 *) (pataddr++))); - } - } - + } + } + } } /* end of ASTSetupForColor8x8PatternFill */ - + static void ASTSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty, int dst_x, int dst_y, int width, int height) @@ -1177,56 +1177,56 @@ ASTSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty, PKT_SC *pSingleCMD; ULONG dstbase, cmdreg; int delta_y = 0; - -/* + +/* xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentColor8x8PatternFillRect\n"); */ - + /* Modify Reg. Value */ cmdreg = pAST->ulCMDReg; if (pAST->EnableClip) cmdreg |= CMD_ENABLE_CLIP; else - cmdreg &= ~CMD_ENABLE_CLIP; + cmdreg &= ~CMD_ENABLE_CLIP; dstbase = 0; - if (dst_y >= pScrn->virtualY) - { + if (dst_y >= pScrn->virtualY) + { delta_y = dst_y; dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y; dst_y=0; } - if (pAST->EnableClip) + if (pAST->EnableClip) ASTSetHWClipping(pScrn, delta_y); - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ + + if (!pAST->MMIO2D) + { + /* Write to CMDQ */ pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*4); ASTSetupDSTBase(pSingleCMD, dstbase); - pSingleCMD++; + pSingleCMD++; ASTSetupDSTXY(pSingleCMD, dst_x, dst_y); - pSingleCMD++; + pSingleCMD++; ASTSetupRECTXY(pSingleCMD, width, height); - pSingleCMD++; - ASTSetupCMDReg(pSingleCMD, cmdreg); - + pSingleCMD++; + ASTSetupCMDReg(pSingleCMD, cmdreg); + /* Update Write Pointer */ mUpdateWritePointer; - + } else - { + { ASTSetupDSTBase_MMIO(dstbase); ASTSetupDSTXY_MMIO(dst_x, dst_y); ASTSetupRECTXY_MMIO(width, height); - ASTSetupCMDReg_MMIO(cmdreg); - - vWaitEngIdle(pScrn, pAST); - } - + ASTSetupCMDReg_MMIO(cmdreg); + + vWaitEngIdle(pScrn, pAST); + } + } /* ASTSubsequentColor8x8PatternFillRect */ /* CPU to Screen Expand */ @@ -1240,9 +1240,9 @@ ASTSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, PKT_SC *pSingleCMD; ULONG cmdreg; -/* +/* xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForCPUToScreenColorExpandFill\n"); -*/ +*/ /* Modify Reg. Value */ cmdreg = CMD_COLOREXP; switch (pAST->VideoModeInfo.bitsPerPixel) @@ -1253,44 +1253,44 @@ ASTSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, case 15: case 16: cmdreg |= CMD_COLOR_16; - break; + break; case 24: case 32: cmdreg |= CMD_COLOR_32; - break; + break; } cmdreg |= (ASTXAAPatternROP[rop] << 8); if(bg == -1) { - cmdreg |= CMD_FONT_TRANSPARENT; + cmdreg |= CMD_FONT_TRANSPARENT; bg = 0; - } + } pAST->ulCMDReg = cmdreg; - - if (!pAST->MMIO2D) + + if (!pAST->MMIO2D) { /* Write to CMDQ */ pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*3); ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); pSingleCMD++; - ASTSetupFG(pSingleCMD, fg); + ASTSetupFG(pSingleCMD, fg); pSingleCMD++; - ASTSetupBG(pSingleCMD, bg); + ASTSetupBG(pSingleCMD, bg); /* Update Write Pointer */ mUpdateWritePointer; - + } else { ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1); - ASTSetupFG_MMIO(fg); - ASTSetupBG_MMIO(bg); - + ASTSetupFG_MMIO(fg); + ASTSetupBG_MMIO(bg); + } - + } - + static void ASTSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int dst_x, int dst_y, @@ -1302,61 +1302,61 @@ ASTSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, ULONG dstbase, cmdreg; int delta_y = 0; -/* +/* xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentCPUToScreenColorExpandFill\n"); */ - + /* Modify Reg. Value */ cmdreg = pAST->ulCMDReg; if (pAST->EnableClip) cmdreg |= CMD_ENABLE_CLIP; else - cmdreg &= ~CMD_ENABLE_CLIP; + cmdreg &= ~CMD_ENABLE_CLIP; dstbase = 0; - if (dst_y >= pScrn->virtualY) - { + if (dst_y >= pScrn->virtualY) + { delta_y = dst_y; dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y; dst_y=0; } - if (pAST->EnableClip) + if (pAST->EnableClip) ASTSetHWClipping(pScrn, delta_y); - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ + + if (!pAST->MMIO2D) + { + /* Write to CMDQ */ pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*5); - ASTSetupSRCPitch(pSingleCMD, ((width+7)/8)); - pSingleCMD++; + ASTSetupSRCPitch(pSingleCMD, ((width+7)/8)); + pSingleCMD++; ASTSetupDSTBase(pSingleCMD, dstbase); - pSingleCMD++; + pSingleCMD++; ASTSetupDSTXY(pSingleCMD, dst_x, dst_y); - pSingleCMD++; + pSingleCMD++; ASTSetupRECTXY(pSingleCMD, width, height); - pSingleCMD++; - ASTSetupCMDReg(pSingleCMD, cmdreg); - + pSingleCMD++; + ASTSetupCMDReg(pSingleCMD, cmdreg); + /* Update Write Pointer */ mUpdateWritePointer; - + } else - { - ASTSetupSRCPitch_MMIO((width+7)/8); + { + ASTSetupSRCPitch_MMIO((width+7)/8); ASTSetupDSTBase_MMIO(dstbase); ASTSetupDSTXY_MMIO(dst_x, dst_y); ASTSetupSRCXY_MMIO(0, 0); - + ASTSetupRECTXY_MMIO(width, height); - ASTSetupCMDReg_MMIO(cmdreg); - + ASTSetupCMDReg_MMIO(cmdreg); + vWaitEngIdle(pScrn, pAST); - + } - + } @@ -1371,10 +1371,10 @@ ASTSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, PKT_SC *pSingleCMD; ULONG cmdreg; -/* +/* xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForScreenToScreenColorExpandFill\n"); */ - + /* Modify Reg. Value */ cmdreg = CMD_ENHCOLOREXP; switch (pAST->VideoModeInfo.bitsPerPixel) @@ -1385,42 +1385,42 @@ ASTSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, case 15: case 16: cmdreg |= CMD_COLOR_16; - break; + break; case 24: case 32: cmdreg |= CMD_COLOR_32; - break; + break; } cmdreg |= (ASTXAAPatternROP[rop] << 8); if(bg == -1) { - cmdreg |= CMD_FONT_TRANSPARENT; + cmdreg |= CMD_FONT_TRANSPARENT; bg = 0; - } + } pAST->ulCMDReg = cmdreg; - - if (!pAST->MMIO2D) + + if (!pAST->MMIO2D) { /* Write to CMDQ */ pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*3); ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); pSingleCMD++; - ASTSetupFG(pSingleCMD, fg); + ASTSetupFG(pSingleCMD, fg); pSingleCMD++; - ASTSetupBG(pSingleCMD, bg); + ASTSetupBG(pSingleCMD, bg); /* Update Write Pointer */ mUpdateWritePointer; - + } else { ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1); - ASTSetupFG_MMIO(fg); - ASTSetupBG_MMIO(bg); - + ASTSetupFG_MMIO(fg); + ASTSetupBG_MMIO(bg); + } - + } @@ -1436,63 +1436,63 @@ ASTSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, USHORT srcpitch; int delta_y = 0; -/* +/* xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentScreenToScreenColorExpandFill\n"); */ - + /* Modify Reg. Value */ cmdreg = pAST->ulCMDReg; if (pAST->EnableClip) cmdreg |= CMD_ENABLE_CLIP; else - cmdreg &= ~CMD_ENABLE_CLIP; + cmdreg &= ~CMD_ENABLE_CLIP; dstbase = 0; - if (dst_y >= pScrn->virtualY) - { + 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; + srcbase = pAST->VideoModeInfo.ScreenPitch*src_y + ((pScrn->bitsPerPixel+1)/8)*src_x; srcpitch = (pScrn->displayWidth+7)/8; - if (pAST->EnableClip) + if (pAST->EnableClip) ASTSetHWClipping(pScrn, delta_y); - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ + + if (!pAST->MMIO2D) + { + /* Write to CMDQ */ pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*6); ASTSetupSRCBase(pSingleCMD, srcbase); - pSingleCMD++; - ASTSetupSRCPitch(pSingleCMD,srcpitch); - pSingleCMD++; + pSingleCMD++; + ASTSetupSRCPitch(pSingleCMD,srcpitch); + pSingleCMD++; ASTSetupDSTBase(pSingleCMD, dstbase); - pSingleCMD++; + pSingleCMD++; ASTSetupDSTXY(pSingleCMD, dst_x, dst_y); - pSingleCMD++; + pSingleCMD++; ASTSetupRECTXY(pSingleCMD, width, height); - pSingleCMD++; - ASTSetupCMDReg(pSingleCMD, cmdreg); - + pSingleCMD++; + ASTSetupCMDReg(pSingleCMD, cmdreg); + /* Update Write Pointer */ mUpdateWritePointer; - + } else - { - ASTSetupSRCBase_MMIO(srcbase); - ASTSetupSRCPitch_MMIO(srcpitch); + { + ASTSetupSRCBase_MMIO(srcbase); + ASTSetupSRCPitch_MMIO(srcpitch); ASTSetupDSTBase_MMIO(dstbase); ASTSetupDSTXY_MMIO(dst_x, dst_y); ASTSetupRECTXY_MMIO(width, height); - ASTSetupCMDReg_MMIO(cmdreg); - + ASTSetupCMDReg_MMIO(cmdreg); + vWaitEngIdle(pScrn, pAST); - + } - + } @@ -1503,7 +1503,7 @@ ASTSetHWClipping(ScrnInfoPtr pScrn, int delta_y) ASTRecPtr pAST = ASTPTR(pScrn); PKT_SC *pSingleCMD; - if (!pAST->MMIO2D) + if (!pAST->MMIO2D) { /* Write to CMDQ */ pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*2); @@ -1511,59 +1511,59 @@ ASTSetHWClipping(ScrnInfoPtr pScrn, int delta_y) ASTSetupCLIP1(pSingleCMD, pAST->clip_left, pAST->clip_top - delta_y); pSingleCMD++; ASTSetupCLIP2(pSingleCMD, pAST->clip_right + 1, pAST->clip_bottom - delta_y + 1); - + /* Update Write Pointer */ mUpdateWritePointer; - + } else { ASTSetupCLIP1_MMIO(pAST->clip_left, pAST->clip_top - delta_y); - ASTSetupCLIP2_MMIO(pAST->clip_right + 1, pAST->clip_bottom - delta_y + 1); + 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; - + } static void ASTDisableClipping(ScrnInfoPtr pScrn) { ASTRecPtr pAST = ASTPTR(pScrn); -/* +/* xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTDisableClipping\n"); -*/ +*/ 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; + ULONG miny, maxy; /* xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentSolidTwoPointLine\n"); -*/ +*/ /* Modify Reg. Value */ ulCommand = (pAST->ulCMDReg & (~CMD_MASK)) | CMD_LINEDRAW | CMD_NORMAL_LINE; @@ -1574,7 +1574,7 @@ static void AIPSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, if (pAST->EnableClip) ulCommand |= CMD_ENABLE_CLIP; else - ulCommand &= ~CMD_ENABLE_CLIP; + ulCommand &= ~CMD_ENABLE_CLIP; dstbase = 0; miny = (y1 > y2) ? y2 : y1; maxy = (y1 > y2) ? y1 : y2; @@ -1584,38 +1584,38 @@ static void AIPSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, y2 -= miny; } - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ + if (!pAST->MMIO2D) + { + /* Write to CMDQ */ pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*5); ASTSetupDSTBase(pSingleCMD, dstbase); - pSingleCMD++; + pSingleCMD++; AIPSetupLineXY(pSingleCMD, x1, y1); pSingleCMD++; AIPSetupLineXY2(pSingleCMD, x2, y2); pSingleCMD++; AIPSetupLineNumber(pSingleCMD, 0); - pSingleCMD++; - ASTSetupCMDReg(pSingleCMD, ulCommand); - + pSingleCMD++; + ASTSetupCMDReg(pSingleCMD, ulCommand); + /* Update Write Pointer */ - mUpdateWritePointer; + 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); - + ASTSetupCMDReg_MMIO(ulCommand); + vWaitEngIdle(pScrn, pAST); - + } @@ -1626,14 +1626,14 @@ 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; + ULONG dstbase, ulCommand; + ULONG miny, maxy; /* xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentDashedTwoPointLine\n"); -*/ +*/ /* Modify Reg. Value */ ulCommand = pAST->ulCMDReg | CMD_NORMAL_LINE; @@ -1644,8 +1644,8 @@ AIPSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, if (pAST->EnableClip) ulCommand |= CMD_ENABLE_CLIP; else - ulCommand &= ~CMD_ENABLE_CLIP; - dstbase = 0; + ulCommand &= ~CMD_ENABLE_CLIP; + dstbase = 0; miny = (y1 > y2) ? y2 : y1; maxy = (y1 > y2) ? y1 : y2; if(maxy >= pScrn->virtualY) { @@ -1654,40 +1654,40 @@ AIPSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, y2 -= miny; } - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ + if (!pAST->MMIO2D) + { + /* Write to CMDQ */ pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*5); ASTSetupDSTBase(pSingleCMD, dstbase); - pSingleCMD++; + pSingleCMD++; AIPSetupLineXY(pSingleCMD, x1, y1); pSingleCMD++; AIPSetupLineXY2(pSingleCMD, x2, y2); pSingleCMD++; AIPSetupLineNumber(pSingleCMD, 0); - pSingleCMD++; - ASTSetupCMDReg(pSingleCMD, ulCommand); - + 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 @@ -1701,7 +1701,7 @@ AIPSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, void ASTDisplayVideo(ScrnInfoPtr pScrn, ASTPortPrivPtr pPriv, RegionPtr clipBoxes, int id) { ASTPtr pAST = ASTPTR(pScrn); - int nBoxs; + int nBoxs; int ScaleFactorH, ScaleFactorV; ULONG InitScaleFactorH, InitScaleFactorV; BURSTSCALECMD CopyCmd = {0}; @@ -1712,12 +1712,12 @@ void ASTDisplayVideo(ScrnInfoPtr pScrn, ASTPortPrivPtr pPriv, RegionPtr clipBoxe short lSrcX, lSrcY; ULONG dwCmd = 0; int i; - + pBox = REGION_RECTS(clipBoxes); nBoxs = REGION_NUM_RECTS(clipBoxes); xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "MMIO=%x,pBox=%x, nBoxs=%x\n", pAST->MMIO2D, pBox, nBoxs); - + if(0==pPriv->drw_w || 0==pPriv->drw_h) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "drwx=%x, drwy=%x\n", pPriv->drw_w, pPriv->drw_h); @@ -1727,7 +1727,7 @@ void ASTDisplayVideo(ScrnInfoPtr pScrn, ASTPortPrivPtr pPriv, RegionPtr clipBoxe /* calc scaling factor */ fScaleX = (float)pPriv->src_w /(float)pPriv->drw_w; fScaleY = (float)pPriv->src_h /(float)pPriv->drw_h; - + if (pPriv->src_w == pPriv->drw_w) ScaleFactorH = 0x8000; else @@ -1753,7 +1753,7 @@ void ASTDisplayVideo(ScrnInfoPtr pScrn, ASTPortPrivPtr pPriv, RegionPtr clipBoxe else InitScaleFactorV = 0x4000; - switch(pScrn->bitsPerPixel) + switch(pScrn->bitsPerPixel) { case 32: dwCmd = CMD_COLOR_32; @@ -1776,30 +1776,30 @@ void ASTDisplayVideo(ScrnInfoPtr pScrn, ASTPortPrivPtr pPriv, RegionPtr clipBoxe switch(id) { case PIXEL_FMT_YUY2: - dwCmd |= YUV_FORMAT_YUYV; + dwCmd |= YUV_FORMAT_YUYV; break; - case PIXEL_FMT_UYVY: - dwCmd |= YUV_FORMAT_UYVY; + case PIXEL_FMT_UYVY: + dwCmd |= YUV_FORMAT_UYVY; break; default: xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Other pix format:%x\n", id); break; } - + for(i = 0; i < nBoxs; i++, pBox++) { rect.x = pBox->x1 - pPriv->drw_x; rect.y = pBox->y1 - pPriv->drw_y; rect.width = pBox->x2 - pBox->x1; - rect.height = pBox->y2 - pBox->y1; - + rect.height = pBox->y2 - pBox->y1; + lSrcX = (ULONG)((float)rect.x * fScaleX + pPriv->src_x + 0.5f); lSrcY = (ULONG)((float)rect.y * fScaleY + pPriv->src_y + 0.5f); - - pCopyCmd = (BURSTSCALECMD*)pjRequestCMDQ(pAST, PKT_TYPESCALE_LENGTH); - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "pCopyCmd=%p, pBox=%x,%x,%x,%x\n", pCopyCmd, pBox->x1, pBox->y1, pBox->x2, pBox->y2); - + + pCopyCmd = (BURSTSCALECMD*)pjRequestCMDQ(pAST, PKT_TYPESCALE_LENGTH); + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "pCopyCmd=%p, pBox=%x,%x,%x,%x\n", pCopyCmd, pBox->x1, pBox->y1, pBox->x2, pBox->y2); + CopyCmd.dwHeader0 = (ULONG) PKT_BURST_CMD_HEADER0 | PKT_TYPESCALE_DATALENGTH | PKT_TYPESCALE_ADDRSTART | @@ -1808,16 +1808,16 @@ void ASTDisplayVideo(ScrnInfoPtr pScrn, ASTPortPrivPtr pPriv, RegionPtr clipBoxe xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CopyCmd.dwHeader0=%x\n", CopyCmd.dwHeader0); CopyCmd.dwSrcPitch = (ULONG)(pPriv->srcPitch << 16); - + CopyCmd.dwDstHeightPitch = (ULONG) ((pAST->VideoModeInfo.ScreenPitch << 16) | 0xFFFF); - - CopyCmd.dwDstXY = (ULONG) ((pBox->x1 << 16) | (pBox->y1 & 0xFFFF)); - CopyCmd.dwSrcXY = (ULONG) ((lSrcX << 16) | (lSrcY & 0xFFFF)); - CopyCmd.dwRecHeightWidth = (ULONG) ((rect.width << 16) | rect.height); - + + CopyCmd.dwDstXY = (ULONG) ((pBox->x1 << 16) | (pBox->y1 & 0xFFFF)); + CopyCmd.dwSrcXY = (ULONG) ((lSrcX << 16) | (lSrcY & 0xFFFF)); + CopyCmd.dwRecHeightWidth = (ULONG) ((rect.width << 16) | rect.height); + CopyCmd.dwInitScaleFactorH = InitScaleFactorH; CopyCmd.dwInitScaleFactorV = InitScaleFactorV; - CopyCmd.dwScaleFactorH = ScaleFactorH; + CopyCmd.dwScaleFactorH = ScaleFactorH; CopyCmd.dwScaleFactorV = ScaleFactorV; CopyCmd.dwSrcBaseAddr = pPriv->bufAddr[pPriv->currentBuf]; @@ -1825,10 +1825,10 @@ void ASTDisplayVideo(ScrnInfoPtr pScrn, ASTPortPrivPtr pPriv, RegionPtr clipBoxe CopyCmd.dwCmd = dwCmd; CopyCmd.NullData[0] = 0; /* for alignment */ memcpy(pCopyCmd, &CopyCmd, sizeof(CopyCmd)); - + mUpdateWritePointer; - -#if 0 + +#if 0 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%08x, %08x, %08x, %08x\n", *(ULONG *)(pAST->MMIOVirtualAddr+0x8000), *(ULONG *)(pAST->MMIOVirtualAddr+0x8004), @@ -1852,7 +1852,7 @@ void ASTDisplayVideo(ScrnInfoPtr pScrn, ASTPortPrivPtr pPriv, RegionPtr clipBoxe #endif } /* End of for-loop */ - + } /* ASTDisplayVideo */ #endif /* AstVideo */ diff --git a/src/ast_cursor.c b/src/ast_cursor.c index c672564..80d787a 100644 --- a/src/ast_cursor.c +++ b/src/ast_cursor.c @@ -57,7 +57,7 @@ Bool ASTCursorInit(ScreenPtr pScreen); Bool bInitHWC(ScrnInfoPtr pScrn, ASTRecPtr pAST); void ASTDisableHWC(ScrnInfoPtr pScrn); -static void ASTShowCursor(ScrnInfoPtr pScrn); +static void ASTShowCursor(ScrnInfoPtr pScrn); static void ASTHideCursor(ScrnInfoPtr pScrn); static void ASTSetCursorPosition(ScrnInfoPtr pScrn, int x, int y); static void ASTSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg); @@ -65,8 +65,8 @@ static void ASTLoadCursorImage(ScrnInfoPtr pScrn, UCHAR *src); static Bool ASTUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs); static void ASTLoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCurs); static Bool ASTUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs); -static void ASTFireCursor(ScrnInfoPtr pScrn); -static void ASTShowCursor_AST1180(ScrnInfoPtr pScrn); +static void ASTFireCursor(ScrnInfoPtr pScrn); +static void ASTShowCursor_AST1180(ScrnInfoPtr pScrn); static void ASTHideCursor_AST1180(ScrnInfoPtr pScrn); static void ASTSetCursorPosition_AST1180(ScrnInfoPtr pScrn, int x, int y); @@ -83,7 +83,7 @@ ASTCursorInit(ScreenPtr pScreen) pAST->HWCInfoPtr = infoPtr; infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | - HARDWARE_CURSOR_INVERT_MASK | + HARDWARE_CURSOR_INVERT_MASK | HARDWARE_CURSOR_BIT_ORDER_MSBFIRST; infoPtr->MaxWidth = MAX_HWC_WIDTH; @@ -93,14 +93,14 @@ ASTCursorInit(ScreenPtr pScreen) infoPtr->ShowCursor = ASTShowCursor_AST1180; infoPtr->HideCursor = ASTHideCursor_AST1180; infoPtr->SetCursorPosition = ASTSetCursorPosition_AST1180; - } + } else { infoPtr->ShowCursor = ASTShowCursor; infoPtr->HideCursor = ASTHideCursor; infoPtr->SetCursorPosition = ASTSetCursorPosition; } - infoPtr->SetCursorColors = ASTSetCursorColors; + infoPtr->SetCursorColors = ASTSetCursorColors; infoPtr->LoadCursorImage = ASTLoadCursorImage; infoPtr->UseHWCursor = ASTUseHWCursor; #ifdef ARGB_CURSOR @@ -109,7 +109,7 @@ ASTCursorInit(ScreenPtr pScreen) #endif return(xf86InitCursor(pScreen, infoPtr)); - + } Bool bInitHWC(ScrnInfoPtr pScrn, ASTRecPtr pAST) @@ -117,76 +117,76 @@ Bool bInitHWC(ScrnInfoPtr pScrn, ASTRecPtr pAST) ScreenPtr pScreen; /* init cursor cache info */ - /* Set HWC_NUM in Options instead */ + /* Set HWC_NUM in Options instead */ /* pAST->HWCInfo.HWC_NUM = DEFAULT_HWC_NUM; */ - pAST->HWCInfo.HWC_NUM_Next = 0; - - /* allocate HWC cache */ - if (!pAST->pHWCPtr) { + pAST->HWCInfo.HWC_NUM_Next = 0; + + /* allocate HWC cache */ + if (!pAST->pHWCPtr) { pScreen = xf86ScrnToScreen(pScrn); pAST->pHWCPtr = xf86AllocateOffscreenLinear (pScreen, (HWC_SIZE+HWC_SIGNATURE_SIZE)*pAST->HWCInfo.HWC_NUM, HWC_ALIGN, NULL, NULL, NULL); - if (!pAST->pHWCPtr) { + if (!pAST->pHWCPtr) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"Allocate HWC Cache failed \n"); return (FALSE); } - + pAST->HWCInfo.ulHWCOffsetAddr = pAST->pHWCPtr->offset*((pScrn->bitsPerPixel + 1) / 8); - pAST->HWCInfo.pjHWCVirtualAddr = pAST->FBVirtualAddr + pAST->HWCInfo.ulHWCOffsetAddr; + pAST->HWCInfo.pjHWCVirtualAddr = pAST->FBVirtualAddr + pAST->HWCInfo.ulHWCOffsetAddr; } - return (TRUE); + return (TRUE); } void ASTDisableHWC(ScrnInfoPtr pScrn) { - ASTRecPtr pAST = ASTPTR(pScrn); - + ASTRecPtr pAST = ASTPTR(pScrn); + if (pAST->jChipType == AST1180) - ASTHideCursor_AST1180(pScrn); - else + ASTHideCursor_AST1180(pScrn); + else ASTHideCursor(pScrn); -} +} static void ASTShowCursor(ScrnInfoPtr pScrn) { - ASTRecPtr pAST = ASTPTR(pScrn); + ASTRecPtr pAST = ASTPTR(pScrn); UCHAR jReg; jReg= 0x02; if (pAST->HWCInfo.cursortype ==HWC_COLOR) jReg |= 0x01; - - SetIndexRegMask(CRTC_PORT, 0xCB, 0xFC, jReg); /* enable mono */ - + + SetIndexRegMask(CRTC_PORT, 0xCB, 0xFC, jReg); /* enable mono */ + } static void ASTHideCursor(ScrnInfoPtr pScrn) { ASTRecPtr pAST = ASTPTR(pScrn); - - SetIndexRegMask(CRTC_PORT, 0xCB, 0xFC, 0x00); /* disable HWC */ - + + SetIndexRegMask(CRTC_PORT, 0xCB, 0xFC, 0x00); /* disable HWC */ + } static void ASTSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) { ASTRecPtr pAST = ASTPTR(pScrn); - DisplayModePtr mode = pAST->ModePtr; + DisplayModePtr mode = pAST->ModePtr; int x_offset, y_offset; - UCHAR *pjSignature; - - /* Set cursor info to Offscreen */ - pjSignature = (UCHAR *) pAST->HWCInfo.pjHWCVirtualAddr + (HWC_SIZE+HWC_SIGNATURE_SIZE)*pAST->HWCInfo.HWC_NUM_Next + HWC_SIZE; + UCHAR *pjSignature; + + /* Set cursor info to Offscreen */ + pjSignature = (UCHAR *) pAST->HWCInfo.pjHWCVirtualAddr + (HWC_SIZE+HWC_SIGNATURE_SIZE)*pAST->HWCInfo.HWC_NUM_Next + HWC_SIZE; *((ULONG *) (pjSignature + HWC_SIGNATURE_X)) = x; *((ULONG *) (pjSignature + HWC_SIGNATURE_Y)) = y; - + x_offset = pAST->HWCInfo.offset_x; y_offset = pAST->HWCInfo.offset_y; - + if(x < 0) { x_offset = (-x) + pAST->HWCInfo.offset_x; x = 0; @@ -198,50 +198,50 @@ ASTSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) } if(mode->Flags & V_DBLSCAN) y *= 2; - + /* Set to Reg. */ - SetIndexReg(CRTC_PORT, 0xC2, (UCHAR) (x_offset)); - SetIndexReg(CRTC_PORT, 0xC3, (UCHAR) (y_offset)); - SetIndexReg(CRTC_PORT, 0xC4, (UCHAR) (x & 0xFF)); - SetIndexReg(CRTC_PORT, 0xC5, (UCHAR) ((x >> 8) & 0x0F)); - SetIndexReg(CRTC_PORT, 0xC6, (UCHAR) (y & 0xFF)); - SetIndexReg(CRTC_PORT, 0xC7, (UCHAR) ((y >> 8) & 0x07)); - + SetIndexReg(CRTC_PORT, 0xC2, (UCHAR) (x_offset)); + SetIndexReg(CRTC_PORT, 0xC3, (UCHAR) (y_offset)); + SetIndexReg(CRTC_PORT, 0xC4, (UCHAR) (x & 0xFF)); + SetIndexReg(CRTC_PORT, 0xC5, (UCHAR) ((x >> 8) & 0x0F)); + SetIndexReg(CRTC_PORT, 0xC6, (UCHAR) (y & 0xFF)); + SetIndexReg(CRTC_PORT, 0xC7, (UCHAR) ((y >> 8) & 0x07)); + /* Fire HWC */ ASTFireCursor(pScrn); - -} + +} static void ASTSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) { ASTRecPtr pAST = ASTPTR(pScrn); 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); + bg1 = (bg & 0x0F) | (((bg>>8) & 0x0F) << 4) | (((bg>>16) & 0x0F) << 8); /* Fixed xorg bugzilla #20609, ycchen@031209 */ - if ( (fg1 != pAST->HWCInfo.fg) || (bg1 != pAST->HWCInfo.bg) ) + if ( (fg1 != pAST->HWCInfo.fg) || (bg1 != pAST->HWCInfo.bg) ) { pAST->HWCInfo.fg = fg1; pAST->HWCInfo.bg = bg1; ASTLoadCursorImage(pScrn, pAST->HWCInfo.cursorpattern); - } + } } static void ASTLoadCursorImage(ScrnInfoPtr pScrn, UCHAR *src) { - ASTRecPtr pAST = ASTPTR(pScrn); + ASTRecPtr pAST = ASTPTR(pScrn); int i, j, k; UCHAR *pjSrcAnd, *pjSrcXor, *pjDstData; ULONG ulTempDstAnd32[2], ulTempDstXor32[2], ulTempDstData32[2]; UCHAR jTempSrcAnd32, jTempSrcXor32; - ULONG ulCheckSum = 0; - ULONG ulPatternAddr; - + ULONG ulCheckSum = 0; + ULONG ulPatternAddr; + /* init cursor info. */ pAST->HWCInfo.cursortype = HWC_MONO; pAST->HWCInfo.width = (USHORT) MAX_HWC_WIDTH; @@ -252,12 +252,12 @@ 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); pjDstData = pAST->HWCInfo.pjHWCVirtualAddr+(HWC_SIZE+HWC_SIGNATURE_SIZE)*pAST->HWCInfo.HWC_NUM_Next; - + for (j = 0; j < MAX_HWC_HEIGHT; j++) { for (i = 0; i < (MAX_HWC_WIDTH/8); i++ ) @@ -267,107 +267,107 @@ ASTLoadCursorImage(ScrnInfoPtr pScrn, UCHAR *src) jTempSrcAnd32 = *((UCHAR *) pjSrcAnd); jTempSrcXor32 = *((UCHAR *) pjSrcXor); ulTempDstAnd32[0] = ((jTempSrcAnd32 >> k) & 0x01) ? 0x00008000L:0x00L; - ulTempDstXor32[0] = ((jTempSrcXor32 >> k) & 0x01) ? 0x00004000L:0x00L; - ulTempDstData32[0] = ((jTempSrcXor32 >> k) & 0x01) ? pAST->HWCInfo.fg:pAST->HWCInfo.bg; - ulTempDstAnd32[1] = ((jTempSrcAnd32 >> (k-1)) & 0x01) ? 0x80000000L:0x00L; - ulTempDstXor32[1] = ((jTempSrcXor32 >> (k-1)) & 0x01) ? 0x40000000L:0x00L; + ulTempDstXor32[0] = ((jTempSrcXor32 >> k) & 0x01) ? 0x00004000L:0x00L; + ulTempDstData32[0] = ((jTempSrcXor32 >> k) & 0x01) ? pAST->HWCInfo.fg:pAST->HWCInfo.bg; + 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); /* 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); + ulCheckSum += *((ULONG *) pjDstData); pjDstData += 4; } pjSrcAnd ++; pjSrcXor ++; - - } - - } + + } + + } if (pAST->jChipType == AST1180) { - ulPatternAddr = pAST->ulVRAMBase + (pAST->HWCInfo.ulHWCOffsetAddr+(HWC_SIZE+HWC_SIGNATURE_SIZE)*pAST->HWCInfo.HWC_NUM_Next); - WriteAST1180SOC(AST1180_GFX_BASE+AST1180_HWC1_PATTERNADDR, ulPatternAddr); - } + ulPatternAddr = pAST->ulVRAMBase + (pAST->HWCInfo.ulHWCOffsetAddr+(HWC_SIZE+HWC_SIGNATURE_SIZE)*pAST->HWCInfo.HWC_NUM_Next); + WriteAST1180SOC(AST1180_GFX_BASE+AST1180_HWC1_PATTERNADDR, ulPatternAddr); + } else { /* Write Checksum as signature */ - pjDstData = (UCHAR *) pAST->HWCInfo.pjHWCVirtualAddr + (HWC_SIZE+HWC_SIGNATURE_SIZE)*pAST->HWCInfo.HWC_NUM_Next + HWC_SIZE; + pjDstData = (UCHAR *) pAST->HWCInfo.pjHWCVirtualAddr + (HWC_SIZE+HWC_SIGNATURE_SIZE)*pAST->HWCInfo.HWC_NUM_Next + HWC_SIZE; *((ULONG *) pjDstData) = ulCheckSum; *((ULONG *) (pjDstData + HWC_SIGNATURE_SizeX)) = pAST->HWCInfo.width; *((ULONG *) (pjDstData + HWC_SIGNATURE_SizeY)) = pAST->HWCInfo.height; *((ULONG *) (pjDstData + HWC_SIGNATURE_HOTSPOTX)) = 0; *((ULONG *) (pjDstData + HWC_SIGNATURE_HOTSPOTY)) = 0; - + /* set pattern offset */ ulPatternAddr = ((pAST->HWCInfo.ulHWCOffsetAddr+(HWC_SIZE+HWC_SIGNATURE_SIZE)*pAST->HWCInfo.HWC_NUM_Next) >> 3); - SetIndexReg(CRTC_PORT, 0xC8, (UCHAR) (ulPatternAddr & 0xFF)); - SetIndexReg(CRTC_PORT, 0xC9, (UCHAR) ((ulPatternAddr >> 8) & 0xFF)); - SetIndexReg(CRTC_PORT, 0xCA, (UCHAR) ((ulPatternAddr >> 16) & 0xFF)); + SetIndexReg(CRTC_PORT, 0xC8, (UCHAR) (ulPatternAddr & 0xFF)); + SetIndexReg(CRTC_PORT, 0xC9, (UCHAR) ((ulPatternAddr >> 8) & 0xFF)); + SetIndexReg(CRTC_PORT, 0xCA, (UCHAR) ((ulPatternAddr >> 16) & 0xFF)); } - + /* update HWC_NUM_Next */ pAST->HWCInfo.HWC_NUM_Next = (pAST->HWCInfo.HWC_NUM_Next+1) % pAST->HWCInfo.HWC_NUM; - + } -static Bool +static Bool ASTUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) { if ( (pCurs->bits->width > MAX_HWC_WIDTH) || (pCurs->bits->height > MAX_HWC_HEIGHT) ) return FALSE; - + return TRUE; } static void ASTLoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) { - ASTRecPtr pAST = ASTPTR(pScrn); + ASTRecPtr pAST = ASTPTR(pScrn); UCHAR *pjDstXor, *pjSrcXor; ULONG i, j, ulSrcWidth, ulSrcHeight; - ULONG ulPerPixelCopy, ulTwoPixelCopy; + ULONG ulPerPixelCopy, ulTwoPixelCopy; LONG lAlphaDstDelta, lLastAlphaDstDelta; union { ULONG ul; UCHAR b[4]; - } ulSrcData32[2], ulData32; + } ulSrcData32[2], ulData32; union { USHORT us; UCHAR b[2]; } usData16; - ULONG ulCheckSum = 0; + ULONG ulCheckSum = 0; ULONG ulPatternAddr; - + /* init cursor info. */ pAST->HWCInfo.cursortype = HWC_COLOR; pAST->HWCInfo.width = pCurs->bits->width; pAST->HWCInfo.height = pCurs->bits->height; pAST->HWCInfo.offset_x = MAX_HWC_WIDTH - pAST->HWCInfo.width; pAST->HWCInfo.offset_y = MAX_HWC_HEIGHT - pAST->HWCInfo.height; - + /* copy cursor image to cache */ - ulSrcWidth = pAST->HWCInfo.width; - ulSrcHeight = pAST->HWCInfo.height; - + ulSrcWidth = pAST->HWCInfo.width; + ulSrcHeight = pAST->HWCInfo.height; + lAlphaDstDelta = MAX_HWC_WIDTH << 1; lLastAlphaDstDelta = lAlphaDstDelta - (ulSrcWidth << 1); pjSrcXor = (UCHAR *) pCurs->bits->argb;; pjDstXor = (UCHAR *) pAST->HWCInfo.pjHWCVirtualAddr + (HWC_SIZE+HWC_SIGNATURE_SIZE)*pAST->HWCInfo.HWC_NUM_Next + lLastAlphaDstDelta + (MAX_HWC_HEIGHT - ulSrcHeight) * lAlphaDstDelta; - + ulPerPixelCopy = ulSrcWidth & 1; ulTwoPixelCopy = ulSrcWidth >> 1; - + for (j = 0; j < ulSrcHeight; j++) { @@ -378,62 +378,62 @@ ASTLoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) ulData32.b[0] = ulSrcData32[0].b[1] | (ulSrcData32[0].b[0] >> 4); ulData32.b[1] = ulSrcData32[0].b[3] | (ulSrcData32[0].b[2] >> 4); ulData32.b[2] = ulSrcData32[1].b[1] | (ulSrcData32[1].b[0] >> 4); - ulData32.b[3] = ulSrcData32[1].b[3] | (ulSrcData32[1].b[2] >> 4); + ulData32.b[3] = ulSrcData32[1].b[3] | (ulSrcData32[1].b[2] >> 4); *((ULONG *) pjDstXor) = ulData32.ul; - ulCheckSum += (ULONG) ulData32.ul; + ulCheckSum += (ULONG) ulData32.ul; pjDstXor += 4; pjSrcXor += 8; - } - + } + for (i = 0; i < ulPerPixelCopy; i++ ) { ulSrcData32[0].ul = *((ULONG *) pjSrcXor) & 0xF0F0F0F0; usData16.b[0] = ulSrcData32[0].b[1] | (ulSrcData32[0].b[0] >> 4); usData16.b[1] = ulSrcData32[0].b[3] | (ulSrcData32[0].b[2] >> 4); *((USHORT *) pjDstXor) = usData16.us; - ulCheckSum += (ULONG) usData16.us; + ulCheckSum += (ULONG) usData16.us; pjDstXor += 2; pjSrcXor += 4; - } + } /* Point to next source and dest scans */ pjDstXor += lLastAlphaDstDelta; - + } /* end of for-loop */ if (pAST->jChipType == AST1180) { - ulPatternAddr = pAST->ulVRAMBase + (pAST->HWCInfo.ulHWCOffsetAddr+(HWC_SIZE+HWC_SIGNATURE_SIZE)*pAST->HWCInfo.HWC_NUM_Next); - WriteAST1180SOC(AST1180_GFX_BASE+AST1180_HWC1_PATTERNADDR, ulPatternAddr); - } + ulPatternAddr = pAST->ulVRAMBase + (pAST->HWCInfo.ulHWCOffsetAddr+(HWC_SIZE+HWC_SIGNATURE_SIZE)*pAST->HWCInfo.HWC_NUM_Next); + WriteAST1180SOC(AST1180_GFX_BASE+AST1180_HWC1_PATTERNADDR, ulPatternAddr); + } else { /* Write Checksum as signature */ - pjDstXor = (UCHAR *) pAST->HWCInfo.pjHWCVirtualAddr + (HWC_SIZE+HWC_SIGNATURE_SIZE)*pAST->HWCInfo.HWC_NUM_Next + HWC_SIZE; + pjDstXor = (UCHAR *) pAST->HWCInfo.pjHWCVirtualAddr + (HWC_SIZE+HWC_SIGNATURE_SIZE)*pAST->HWCInfo.HWC_NUM_Next + HWC_SIZE; *((ULONG *) pjDstXor) = ulCheckSum; *((ULONG *) (pjDstXor + HWC_SIGNATURE_SizeX)) = pAST->HWCInfo.width; *((ULONG *) (pjDstXor + HWC_SIGNATURE_SizeY)) = pAST->HWCInfo.height; *((ULONG *) (pjDstXor + HWC_SIGNATURE_HOTSPOTX)) = 0; *((ULONG *) (pjDstXor + HWC_SIGNATURE_HOTSPOTY)) = 0; - + /* set pattern offset */ ulPatternAddr = ((pAST->HWCInfo.ulHWCOffsetAddr +(HWC_SIZE+HWC_SIGNATURE_SIZE)*pAST->HWCInfo.HWC_NUM_Next) >> 3); - SetIndexReg(CRTC_PORT, 0xC8, (UCHAR) (ulPatternAddr & 0xFF)); - SetIndexReg(CRTC_PORT, 0xC9, (UCHAR) ((ulPatternAddr >> 8) & 0xFF)); - SetIndexReg(CRTC_PORT, 0xCA, (UCHAR) ((ulPatternAddr >> 16) & 0xFF)); + SetIndexReg(CRTC_PORT, 0xC8, (UCHAR) (ulPatternAddr & 0xFF)); + SetIndexReg(CRTC_PORT, 0xC9, (UCHAR) ((ulPatternAddr >> 8) & 0xFF)); + SetIndexReg(CRTC_PORT, 0xCA, (UCHAR) ((ulPatternAddr >> 16) & 0xFF)); } - + /* update HWC_NUM_Next */ pAST->HWCInfo.HWC_NUM_Next = (pAST->HWCInfo.HWC_NUM_Next+1) % pAST->HWCInfo.HWC_NUM; - + } -static Bool +static Bool ASTUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs) { if ( (pCurs->bits->width > MAX_HWC_WIDTH) || (pCurs->bits->height > MAX_HWC_HEIGHT) ) return FALSE; - + return TRUE; } @@ -441,30 +441,30 @@ static void ASTFireCursor(ScrnInfoPtr pScrn) { ASTRecPtr pAST = ASTPTR(pScrn); - - SetIndexRegMask(CRTC_PORT, 0xCB, 0xFF, 0x00); /* dummp write to fire HWC */ - + + SetIndexRegMask(CRTC_PORT, 0xCB, 0xFF, 0x00); /* dummp write to fire HWC */ + } /* AST1180 */ static void ASTShowCursor_AST1180(ScrnInfoPtr pScrn) { - ASTRecPtr pAST = ASTPTR(pScrn); + ASTRecPtr pAST = ASTPTR(pScrn); ULONG ulData, ulTemp; - ReadAST1180SOC(AST1180_GFX_BASE+AST1180_HWC1_POSITION, ulTemp); + ReadAST1180SOC(AST1180_GFX_BASE+AST1180_HWC1_POSITION, ulTemp); ReadAST1180SOC(AST1180_GFX_BASE+AST1180_VGA1_CTRL, ulData); ulData &= ~AST1180_ALPHAHWC; if (pAST->HWCInfo.cursortype ==HWC_COLOR) - ulData |= AST1180_ALPHAHWC; + ulData |= AST1180_ALPHAHWC; ulData |= AST1180_ENABLEHWC; - WriteAST1180SOC(AST1180_GFX_BASE+AST1180_VGA1_CTRL, ulData); + WriteAST1180SOC(AST1180_GFX_BASE+AST1180_VGA1_CTRL, ulData); /* fire cursor */ - WriteAST1180SOC(AST1180_GFX_BASE+AST1180_HWC1_POSITION, ulTemp); - + WriteAST1180SOC(AST1180_GFX_BASE+AST1180_HWC1_POSITION, ulTemp); + } /* ASTShowCursor_AST1180 */ static void @@ -475,24 +475,24 @@ ASTHideCursor_AST1180(ScrnInfoPtr pScrn) ReadAST1180SOC(AST1180_GFX_BASE+AST1180_VGA1_CTRL, ulData); ulData &= ~AST1180_ENABLEHWC; - WriteAST1180SOC(AST1180_GFX_BASE+AST1180_VGA1_CTRL, ulData); - + WriteAST1180SOC(AST1180_GFX_BASE+AST1180_VGA1_CTRL, ulData); + /* fire cursor */ - WriteAST1180SOC(AST1180_GFX_BASE+AST1180_HWC1_POSITION, 0x07ff07ff); - + WriteAST1180SOC(AST1180_GFX_BASE+AST1180_HWC1_POSITION, 0x07ff07ff); + } /* ASTHideCursor_AST1180 */ static void ASTSetCursorPosition_AST1180(ScrnInfoPtr pScrn, int x, int y) { ASTRecPtr pAST = ASTPTR(pScrn); - DisplayModePtr mode = pAST->ModePtr; + DisplayModePtr mode = pAST->ModePtr; int x_offset, y_offset; ULONG ulData; - + x_offset = pAST->HWCInfo.offset_x; y_offset = pAST->HWCInfo.offset_y; - + if(x < 0) { x_offset = (-x) + pAST->HWCInfo.offset_x; x = 0; @@ -504,13 +504,13 @@ ASTSetCursorPosition_AST1180(ScrnInfoPtr pScrn, int x, int y) } if(mode->Flags & V_DBLSCAN) y *= 2; - + /* Set to Reg. */ ulData = (x_offset) | (y_offset << 8); - WriteAST1180SOC(AST1180_GFX_BASE+AST1180_HWC1_OFFSET, ulData); + WriteAST1180SOC(AST1180_GFX_BASE+AST1180_HWC1_OFFSET, ulData); ulData = (x) | (y << 16); - WriteAST1180SOC(AST1180_GFX_BASE+AST1180_HWC1_POSITION, ulData); - -} /* ASTSetCursorPosition_AST1180 */ + WriteAST1180SOC(AST1180_GFX_BASE+AST1180_HWC1_POSITION, ulData); + +} /* ASTSetCursorPosition_AST1180 */ #endif /* End of HWC */ diff --git a/src/ast_driver.c b/src/ast_driver.c index 4de6c78..c6f8728 100644 --- a/src/ast_driver.c +++ b/src/ast_driver.c @@ -142,23 +142,23 @@ _X_EXPORT DriverRec AST = { static SymTabRec ASTChipsets[] = { {PCI_CHIP_AST2000, "ASPEED Graphics Family"}, {PCI_CHIP_AST2100, "ASPEED Graphics Family"}, - {PCI_CHIP_AST1180, "ASPEED AST1180 Graphics"}, + {PCI_CHIP_AST1180, "ASPEED AST1180 Graphics"}, {-1, NULL} }; static PciChipsets ASTPciChipsets[] = { {PCI_CHIP_AST2000, PCI_CHIP_AST2000, RES_SHARED_VGA}, {PCI_CHIP_AST2100, PCI_CHIP_AST2100, RES_SHARED_VGA}, - {PCI_CHIP_AST1180, PCI_CHIP_AST1180, RES_SHARED_VGA}, + {PCI_CHIP_AST1180, PCI_CHIP_AST1180, RES_SHARED_VGA}, {-1, -1, RES_UNDEFINED } }; typedef enum { OPTION_NOACCEL, - OPTION_MMIO2D, + OPTION_MMIO2D, OPTION_SW_CURSOR, OPTION_HWC_NUM, - OPTION_ENG_CAPS, + OPTION_ENG_CAPS, OPTION_DBG_SELECT, OPTION_NO_DDC, OPTION_VGA2_CLONE @@ -190,7 +190,7 @@ static XF86ModuleVersionInfo astVersRec = { ABI_CLASS_VIDEODRV, #ifdef PATCH_ABI_VERSION ABI_VIDEODRV_VERSION_PATCH, -#else +#else ABI_VIDEODRV_VERSION, #endif MOD_CLASS_VIDEODRV, @@ -241,7 +241,7 @@ ASTIdentify(int flags) const OptionInfoRec * ASTAvailableOptions(int chipid, int busid) { - + return ASTOptions; } @@ -258,7 +258,7 @@ ASTProbe(DriverPtr drv, int flags) { int i, numUsed, numDevSections, *usedChips; Bool foundScreen = FALSE; - GDevPtr *devSections; + GDevPtr *devSections; /* * Find the config file Device sections that match this @@ -319,22 +319,22 @@ ASTProbe(DriverPtr drv, int flags) pScrn->driverVersion = AST_VERSION; pScrn->driverName = AST_DRIVER_NAME; pScrn->name = AST_NAME; - + pScrn->Probe = ASTProbe; pScrn->PreInit = ASTPreInit; pScrn->ScreenInit = ASTScreenInit; pScrn->SwitchMode = ASTSwitchMode; - pScrn->AdjustFrame = ASTAdjustFrame; + pScrn->AdjustFrame = ASTAdjustFrame; pScrn->EnterVT = ASTEnterVT; pScrn->LeaveVT = ASTLeaveVT; pScrn->FreeScreen = ASTFreeScreen; pScrn->ValidMode = ASTValidMode; - - foundScreen = TRUE; + + foundScreen = TRUE; } /* end of if */ } /* end of for-loop */ - } /* end of if flags */ + } /* end of if flags */ free(usedChips); @@ -354,12 +354,12 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) EntityInfoPtr pEnt; int flags24; rgb defaultWeight = { 0, 0, 0 }; -#if !(defined(__sparc__)) && !(defined(__mips__)) +#if !(defined(__sparc__)) && !(defined(__mips__)) vgaHWPtr hwp; #endif - + ASTRecPtr pAST; - + ClockRangePtr clockRanges; int i; MessageType from; @@ -384,7 +384,7 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; #endif -#if !(defined(__sparc__)) && !(defined(__mips__)) +#if !(defined(__sparc__)) && !(defined(__mips__)) /* The vgahw module should be loaded here when needed */ if (!xf86LoadSubModule(pScrn, "vgahw")) return FALSE; @@ -393,14 +393,14 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) /* The fb module should be loaded here when needed */ if (!xf86LoadSubModule(pScrn, "fb")) return FALSE; - -#if !(defined(__sparc__)) && !(defined(__mips__)) + +#if !(defined(__sparc__)) && !(defined(__mips__)) /* Allocate a vgaHWRec */ if (!vgaHWGetHWRec(pScrn)) return FALSE; hwp = VGAHWPTR(pScrn); vgaHWSetStdFuncs(hwp); -#endif +#endif /* Color Depth Check */ flags24 = Support32bppFb; @@ -432,16 +432,16 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) pScrn->bitsPerPixel); return FALSE; } - + /* fill pScrn misc. */ pScrn->progClock = TRUE; pScrn->rgbBits = 6; pScrn->monitor = pScrn->confScreen->monitor; /* should be initialized before set gamma */ #ifndef XSERVER_LIBPCIACCESS pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; - pScrn->racIoFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; + pScrn->racIoFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; #endif - + /* * If the driver can do gamma correction, it should call xf86SetGamma() * here. @@ -450,7 +450,7 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) Gamma zeros = { 0.0, 0.0, 0.0 }; if (!xf86SetGamma(pScrn, zeros)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "call xf86SetGamma failed \n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "call xf86SetGamma failed \n"); return FALSE; } } @@ -458,17 +458,17 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) if (!xf86SetWeight(pScrn, defaultWeight, defaultWeight)) { return FALSE; - } + } if (!xf86SetDefaultVisual(pScrn, -1)) { return FALSE; - } + } /* Allocate driverPrivate */ if (!ASTGetRec(pScrn)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "call ASTGetRec failed \n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "call ASTGetRec failed \n"); return FALSE; - } + } /* Fill AST Info */ pAST = ASTPTR(pScrn); @@ -480,18 +480,18 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) #endif /* Process the options - * pScrn->confScreen, pScrn->display, pScrn->monitor, pScrn->numEntities, + * pScrn->confScreen, pScrn->display, pScrn->monitor, pScrn->numEntities, * and pScrn->entityList should be initialized before */ - xf86CollectOptions(pScrn, NULL); + xf86CollectOptions(pScrn, NULL); if (!(pAST->Options = malloc(sizeof(ASTOptions)))) - { - ASTFreeRec(pScrn); + { + ASTFreeRec(pScrn); return FALSE; - } + } memcpy(pAST->Options, ASTOptions, sizeof(ASTOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pAST->Options); - + /* * Set the Chipset and ChipRev, allowing config file entries to * override. @@ -520,7 +520,7 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) /* Resource Allocation */ #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12 - pAST->IODBase = pScrn->domainIOBase; + pAST->IODBase = pScrn->domainIOBase; #else pAST->IODBase = 0; #endif @@ -533,9 +533,9 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) #endif pAST->PIOOffset = pAST->IODBase + PCI_REGION_BASE(pAST->PciInfo, 2, REGION_IO) - 0x380; - + pAST->RelocateIO = (IOADDRESS)(PCI_REGION_BASE(pAST->PciInfo, 2, REGION_IO) + pAST->IODBase); - + if (pAST->pEnt->device->MemBase != 0) { pAST->FBPhysAddr = pAST->pEnt->device->MemBase; from = X_CONFIG; @@ -569,44 +569,44 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) } xf86DrvMsg(pScrn->scrnIndex, X_INFO, "IO registers at addr 0x%lX\n", (unsigned long) pAST->MMIOPhysAddr); - + /* Map MMIO */ - pAST->MMIOMapSize = DEFAULT_MMIO_SIZE; + pAST->MMIOMapSize = DEFAULT_MMIO_SIZE; if (!ASTMapMMIO(pScrn)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Map Memory Map IO Failed \n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Map Memory Map IO Failed \n"); return FALSE; } if (PCI_DEV_DEVICE_ID(pAST->PciInfo) == PCI_CHIP_AST1180) - { + { pAST->jChipType = AST1180; - + /* validate mode */ if ( (pScrn->bitsPerPixel == 8) || (pScrn->depth == 8) ) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given bpp (%d) is not supported by ast driver\n", pScrn->bitsPerPixel); - return FALSE; + return FALSE; } - + /* Init AST1180 */ bInitAST1180(pScrn); - + /* Get AST1180 Information */ - GetAST1180DRAMInfo(pScrn); + GetAST1180DRAMInfo(pScrn); pScrn->videoRam = pAST->ulVRAMSize / 1024; - + } - else - { - /* Enable VGA MMIO Access */ + else + { + /* Enable VGA MMIO Access */ vEnableASTVGAMMIO(pScrn); - + /* Init VGA Adapter */ if (!xf86IsPrimaryPci(pAST->PciInfo)) - { - InitVGA(pScrn, 0); + { + InitVGA(pScrn, 0); } vASTOpenKey(pScrn); @@ -614,9 +614,9 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) /* Get Chip Type */ if (PCI_DEV_REVISION(pAST->PciInfo) >= 0x20) - pAST->jChipType = AST2300; + pAST->jChipType = AST2300; else if (PCI_DEV_REVISION(pAST->PciInfo) >= 0x10) - GetChipType(pScrn); + GetChipType(pScrn); else pAST->jChipType = AST2000; @@ -624,23 +624,23 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) GetScratchOptions(pScrn); /* Get DRAM Info */ - GetDRAMInfo(pScrn); - pAST->ulVRAMSize = GetVRAMInfo(pScrn); - pScrn->videoRam = pAST->ulVRAMSize / 1024; + GetDRAMInfo(pScrn); + pAST->ulVRAMSize = GetVRAMInfo(pScrn); + pScrn->videoRam = pAST->ulVRAMSize / 1024; } - + /* Map Framebuffer */ from = X_DEFAULT; if (pAST->pEnt->device->videoRam) { pScrn->videoRam = pAST->pEnt->device->videoRam; from = X_CONFIG; } - + pAST->FbMapSize = pScrn->videoRam * 1024; -#if 0 +#if 0 if (!ASTMapMem(pScrn)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Map FB Memory Failed \n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Map FB Memory Failed \n"); return FALSE; } #endif @@ -648,16 +648,16 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) pScrn->memPhysBase = (ULONG)pAST->FBPhysAddr; pScrn->fbOffset = 0; - /* Do DDC + /* Do DDC * should be done after xf86CollectOptions */ - pScrn->monitor->DDC = ASTDoDDC(pScrn, pAST->pEnt->index); + pScrn->monitor->DDC = ASTDoDDC(pScrn, pAST->pEnt->index); /* Mode Valid */ clockRanges = xnfcalloc(sizeof(ClockRange), 1); clockRanges->next = NULL; clockRanges->minClock = 9500; - clockRanges->maxClock = GetMaxDCLK(pScrn) * 1000; + clockRanges->maxClock = GetMaxDCLK(pScrn) * 1000; clockRanges->clockIndex = -1; clockRanges->interlaceAllowed = FALSE; clockRanges->doubleScanAllowed = FALSE; @@ -666,14 +666,14 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) if ((pAST->jChipType == AST2100) || (pAST->jChipType == AST2200) || (pAST->jChipType == AST2300) || (pAST->jChipType == AST1180)) { maxPitch = 1920; - maxHeight = 1200; - } + maxHeight = 1200; + } else { maxPitch = 1600; - maxHeight = 1200; - } - + maxHeight = 1200; + } + i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, 0, 320, maxPitch, 8 * pScrn->bitsPerPixel, @@ -689,9 +689,9 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) 0, 320, maxPitch, 8 * pScrn->bitsPerPixel, 200, maxHeight, pAST->mon_h_active, pAST->mon_v_active, - pAST->FbMapSize, LOOKUP_BEST_REFRESH); + pAST->FbMapSize, LOOKUP_BEST_REFRESH); } - + if (i == -1) { ASTFreeRec(pScrn); return FALSE; @@ -716,10 +716,10 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) /* Accelaration Check */ pAST->noAccel = TRUE; #ifdef HAVE_XAA_H - pAST->AccelInfoPtr = NULL; + pAST->AccelInfoPtr = NULL; #endif - pAST->pCMDQPtr = NULL; - pAST->CMDQInfo.ulCMDQSize = 0; + pAST->pCMDQPtr = NULL; + pAST->CMDQInfo.ulCMDQSize = 0; #ifdef Accel_2D if (!xf86ReturnOptValBool(pAST->Options, OPTION_NOACCEL, FALSE)) { @@ -742,29 +742,29 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) pAST->DBGSelect = 0; if (!xf86GetOptValInteger(pAST->Options, OPTION_DBG_SELECT, &pAST->DBGSelect)) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No DBG Seleclt options found\n"); - } - } + } + } } #endif /* HW Cursor Check */ - pAST->noHWC = TRUE; + pAST->noHWC = TRUE; pAST->HWCInfoPtr = NULL; - pAST->pHWCPtr = NULL; -#ifdef HWC + pAST->pHWCPtr = NULL; +#ifdef HWC if (!xf86ReturnOptValBool(pAST->Options, OPTION_SW_CURSOR, FALSE)) { if (!xf86LoadSubModule(pScrn, "ramdac")) { ASTFreeRec(pScrn); return FALSE; } - - pAST->noHWC = FALSE; + + pAST->noHWC = FALSE; pAST->HWCInfo.HWC_NUM = DEFAULT_HWC_NUM; if (!xf86GetOptValInteger(pAST->Options, OPTION_HWC_NUM, &pAST->HWCInfo.HWC_NUM)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No HWC_NUM options found\n"); - } - - } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No HWC_NUM options found\n"); + } + + } #endif #ifndef XSERVER_LIBPCIACCESS @@ -784,28 +784,28 @@ ASTScreenInit(SCREEN_INIT_ARGS_DECL) ASTRecPtr pAST; VisualPtr visual; /* for FB Manager */ - BoxRec FBMemBox; - int AvailFBSize; + BoxRec FBMemBox; + int AvailFBSize; pScrn = xf86ScreenToScrn(pScreen); pAST = ASTPTR(pScrn); if (!ASTMapMem(pScrn)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Map FB Memory Failed \n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Map FB Memory Failed \n"); return FALSE; } - + /* if (!pAST->noAccel) */ { /* AvailFBSize = pAST->FbMapSize - pAST->CMDQInfo.ulCMDQSize; */ AvailFBSize = pAST->FbMapSize; - + FBMemBox.x1 = 0; FBMemBox.y1 = 0; FBMemBox.x2 = pScrn->displayWidth; FBMemBox.y2 = (AvailFBSize / (pScrn->displayWidth * ((pScrn->bitsPerPixel+1)/8))) - 1; - if (FBMemBox.y2 < 0) + if (FBMemBox.y2 < 0) FBMemBox.y2 = 32767; if (FBMemBox.y2 < pScrn->virtualY) return FALSE; @@ -813,23 +813,23 @@ ASTScreenInit(SCREEN_INIT_ARGS_DECL) if (!xf86InitFBManager(pScreen, &FBMemBox)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to init memory manager\n"); return FALSE; - } + } } - -#if !(defined(__sparc__)) && !(defined(__mips__)) - vgaHWPtr hwp; + +#if !(defined(__sparc__)) && !(defined(__mips__)) + vgaHWPtr hwp; hwp = VGAHWPTR(pScrn); vgaHWSetMmioFuncs(hwp, pAST->MMIOVirtualAddr, 0); #endif - vFillASTModeInfo (pScrn); + vFillASTModeInfo (pScrn); - ASTSave(pScrn); + ASTSave(pScrn); if (!ASTModeInit(pScrn, pScrn->currentMode)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Mode Init Failed \n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Mode Init Failed \n"); return FALSE; - } + } ASTSaveScreen(pScreen, FALSE); ASTAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0)); @@ -845,7 +845,7 @@ ASTScreenInit(SCREEN_INIT_ARGS_DECL) { ASTSaveScreen(pScreen, SCREEN_SAVER_OFF); return FALSE; - } + } switch(pScrn->bitsPerPixel) { case 8: @@ -858,8 +858,8 @@ ASTScreenInit(SCREEN_INIT_ARGS_DECL) return FALSE; break; default: - return FALSE; - + return FALSE; + } if (pScrn->bitsPerPixel > 8) { @@ -876,7 +876,7 @@ ASTScreenInit(SCREEN_INIT_ARGS_DECL) } } } - + fbPictureInit(pScreen, 0, 0); xf86SetBlackWhitePixels(pScreen); @@ -886,11 +886,11 @@ ASTScreenInit(SCREEN_INIT_ARGS_DECL) { if (!ASTAccelInit(pScreen)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"Hardware acceleration initialization failed\n"); - pAST->noAccel = TRUE; + pAST->noAccel = TRUE; } } #endif /* end of Accel_2D */ - + xf86SetBackingStore(pScreen); xf86SetSilkenMouse(pScreen); @@ -900,10 +900,10 @@ ASTScreenInit(SCREEN_INIT_ARGS_DECL) { if (!ASTCursorInit(pScreen)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"Hardware cursor initialization failed\n"); - pAST->noHWC = TRUE; + pAST->noHWC = TRUE; } } - + if (!miCreateDefColormap(pScreen)) return FALSE; @@ -915,17 +915,17 @@ ASTScreenInit(SCREEN_INIT_ARGS_DECL) return FALSE; } } - + xf86DPMSInit(pScreen, ASTDisplayPowerManagementSet, 0); #ifdef AstVideo if ( (pAST->jChipType == AST1180) || (pAST->jChipType == AST2300) ) - { + { xf86DrvMsg(pScrn->scrnIndex, X_INFO,"AST Initial Video()\n"); ASTInitVideo(pScreen); } #endif - + pScreen->SaveScreen = ASTSaveScreen; pAST->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = ASTCloseScreen; @@ -934,7 +934,7 @@ ASTScreenInit(SCREEN_INIT_ARGS_DECL) xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); return TRUE; - + } /* ASTScreenInit */ @@ -943,37 +943,37 @@ ASTSwitchMode(SWITCH_MODE_ARGS_DECL) { SCRN_INFO_PTR(arg); ASTRecPtr pAST = ASTPTR(pScrn); - + /* VideoMode validate */ if (mode->CrtcHDisplay > pScrn->displayWidth) return FALSE; if ((pAST->VideoModeInfo.ScreenPitch * mode->CrtcVDisplay) > pAST->ulVRAMSize) return FALSE; - + /* VideModeInfo Update */ - pAST->VideoModeInfo.ScreenWidth = mode->CrtcHDisplay; - pAST->VideoModeInfo.ScreenHeight = mode->CrtcVDisplay; + pAST->VideoModeInfo.ScreenWidth = mode->CrtcHDisplay; + pAST->VideoModeInfo.ScreenHeight = mode->CrtcVDisplay; pAST->VideoModeInfo.ScreenPitch = pScrn->displayWidth * ((pScrn->bitsPerPixel + 1) / 8) ; #ifdef HWC if (pAST->pHWCPtr) { xf86FreeOffscreenLinear(pAST->pHWCPtr); /* free HWC Cache */ - pAST->pHWCPtr = NULL; + pAST->pHWCPtr = NULL; } ASTDisableHWC(pScrn); #endif -#ifdef Accel_2D +#ifdef Accel_2D if (pAST->pCMDQPtr) { xf86FreeOffscreenLinear(pAST->pCMDQPtr); /* free CMDQ */ - pAST->pCMDQPtr = NULL; - } + pAST->pCMDQPtr = NULL; + } vDisable2D(pScrn, pAST); #endif - + /* Fixed display abnormal on the of the screen if run xvidtune, ycchen@122909 */ /* ASTRestore(pScrn); */ - + return ASTModeInit(pScrn, mode); } @@ -984,7 +984,7 @@ ASTAdjustFrame(ADJUST_FRAME_ARGS_DECL) SCRN_INFO_PTR(arg); ASTRecPtr pAST = ASTPTR(pScrn); ULONG base; - + base = y * pAST->VideoModeInfo.ScreenPitch + x * ((pAST->VideoModeInfo.bitsPerPixel + 1) / 8); /* base = base >> 2; */ /* DW unit */ @@ -992,7 +992,7 @@ ASTAdjustFrame(ADJUST_FRAME_ARGS_DECL) } -/* enter into X Server */ +/* enter into X Server */ static Bool ASTEnterVT(VT_FUNC_ARGS_DECL) { @@ -1004,15 +1004,15 @@ ASTEnterVT(VT_FUNC_ARGS_DECL) { if (pAST->jChipType == AST1180) bInitAST1180(pScrn); - else - InitVGA(pScrn, 1); + else + InitVGA(pScrn, 1); ASTRestore(pScrn); - } + } if (!ASTModeInit(pScrn, pScrn->currentMode)) return FALSE; ASTAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0)); - + return TRUE; } @@ -1021,36 +1021,36 @@ ASTEnterVT(VT_FUNC_ARGS_DECL) static void ASTLeaveVT(VT_FUNC_ARGS_DECL) { - + SCRN_INFO_PTR(arg); ASTRecPtr pAST = ASTPTR(pScrn); -#if !(defined(__sparc__)) && !(defined(__mips__)) +#if !(defined(__sparc__)) && !(defined(__mips__)) vgaHWPtr hwp = VGAHWPTR(pScrn); #endif #ifdef HWC if (pAST->pHWCPtr) { xf86FreeOffscreenLinear(pAST->pHWCPtr); /* free HWC Cache */ - pAST->pHWCPtr = NULL; + pAST->pHWCPtr = NULL; } ASTDisableHWC(pScrn); #endif -#ifdef Accel_2D +#ifdef Accel_2D if (pAST->pCMDQPtr) { xf86FreeOffscreenLinear(pAST->pCMDQPtr); /* free CMDQ */ - pAST->pCMDQPtr = NULL; - } + pAST->pCMDQPtr = NULL; + } vDisable2D(pScrn, pAST); #endif - + ASTRestore(pScrn); - + if (pAST->jChipType == AST1180) ASTBlankScreen(pScrn, 0); -#if !(defined(__sparc__)) && !(defined(__mips__)) - vgaHWLock(hwp); +#if !(defined(__sparc__)) && !(defined(__mips__)) + vgaHWLock(hwp); #endif } @@ -1060,10 +1060,10 @@ ASTFreeScreen(FREE_SCREEN_ARGS_DECL) { SCRN_INFO_PTR(arg); ASTFreeRec(pScrn); -#if !(defined(__sparc__)) && !(defined(__mips__)) +#if !(defined(__sparc__)) && !(defined(__mips__)) if (xf86LoaderCheckSymbol("vgaHWFreeHWRec")) vgaHWFreeHWRec(pScrn); -#endif +#endif } static ModeStatus @@ -1074,7 +1074,7 @@ ASTValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags) ModeStatus Flags = MODE_NOMODE; UCHAR jReg; ULONG RequestBufferSize; - + if (mode->Flags & V_INTERLACE) { if (verbose) { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, @@ -1095,9 +1095,9 @@ ASTValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags) RequestBufferSize = mode->CrtcHDisplay * ((pScrn->bitsPerPixel + 1) / 8) * mode->CrtcVDisplay; if (RequestBufferSize > pAST->ulVRAMSize) return Flags; - + /* Valid Wide Screen Mode */ - if (pAST->SupportWideScreen) + if (pAST->SupportWideScreen) { if ( (mode->CrtcHDisplay == 1680) && (mode->CrtcVDisplay == 1050) ) return MODE_OK; @@ -1109,22 +1109,22 @@ ASTValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags) return MODE_OK; if ( (mode->CrtcHDisplay == 1600) && (mode->CrtcVDisplay == 900) ) return MODE_OK; - - if ( (pAST->jChipType == AST2100) || (pAST->jChipType == AST2200) || (pAST->jChipType == AST2300) || (pAST->jChipType == AST1180) ) + + if ( (pAST->jChipType == AST2100) || (pAST->jChipType == AST2200) || (pAST->jChipType == AST2300) || (pAST->jChipType == AST1180) ) { if ( (mode->CrtcHDisplay == 1920) && (mode->CrtcVDisplay == 1080) ) return MODE_OK; - + if ( (mode->CrtcHDisplay == 1920) && (mode->CrtcVDisplay == 1200) ) { GetIndexRegMask(CRTC_PORT, 0xD1, 0xFF, jReg); if (jReg & 0x01) return MODE_NOMODE; - else + else return MODE_OK; - } + } } - } + } switch (mode->CrtcHDisplay) { @@ -1182,9 +1182,9 @@ ASTFreeRec(ScrnInfoPtr pScrn) static Bool ASTSaveScreen(ScreenPtr pScreen, Bool unblack) { -#if !(defined(__sparc__)) && !(defined(__mips__)) +#if !(defined(__sparc__)) && !(defined(__mips__)) /* replacement of vgaHWBlankScreen(pScrn, unblank) without seq reset */ - /* return vgaHWSaveScreen(pScreen, unblack); */ + /* return vgaHWSaveScreen(pScreen, unblack); */ ScrnInfoPtr pScrn = NULL; if (pScreen != NULL) @@ -1193,7 +1193,7 @@ ASTSaveScreen(ScreenPtr pScreen, Bool unblack) if ((pScrn != NULL) && pScrn->vtSema) { ASTBlankScreen(pScrn, unblack); } - return (TRUE); + return (TRUE); #endif } @@ -1202,40 +1202,40 @@ ASTCloseScreen(CLOSE_SCREEN_ARGS_DECL) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); ASTRecPtr pAST = ASTPTR(pScrn); -#if !(defined(__sparc__)) && !(defined(__mips__)) +#if !(defined(__sparc__)) && !(defined(__mips__)) vgaHWPtr hwp = VGAHWPTR(pScrn); -#endif +#endif if (pScrn->vtSema == TRUE) - { + { #ifdef HWC if (pAST->pHWCPtr) { xf86FreeOffscreenLinear(pAST->pHWCPtr); /* free HWC Cache */ - pAST->pHWCPtr = NULL; + pAST->pHWCPtr = NULL; } ASTDisableHWC(pScrn); #endif - -#ifdef Accel_2D + +#ifdef Accel_2D if (pAST->pCMDQPtr) { xf86FreeOffscreenLinear(pAST->pCMDQPtr); /* free CMDQ */ - pAST->pCMDQPtr = NULL; + pAST->pCMDQPtr = NULL; } vDisable2D(pScrn, pAST); #endif - + ASTRestore(pScrn); - + if (pAST->jChipType == AST1180) ASTBlankScreen(pScrn, 0); - -#if !(defined(__sparc__)) && !(defined(__mips__)) + +#if !(defined(__sparc__)) && !(defined(__mips__)) vgaHWLock(hwp); #endif } ASTUnmapMem(pScrn); -#if !(defined(__sparc__)) && !(defined(__mips__)) +#if !(defined(__sparc__)) && !(defined(__mips__)) vgaHWUnmapMem(pScrn); #endif @@ -1259,52 +1259,52 @@ static void ASTSave(ScrnInfoPtr pScrn) { ASTRecPtr pAST; - ASTRegPtr astReg; + ASTRegPtr astReg; int i, icount=0; ULONG ulData; pAST = ASTPTR(pScrn); - astReg = &pAST->SavedReg; - + astReg = &pAST->SavedReg; + if (pAST->jChipType == AST1180) { for (i=0; i<12; i++) { - ReadAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_CTRL+i*4, ulData); - astReg->GFX[i] = ulData; - } + ReadAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_CTRL+i*4, ulData); + astReg->GFX[i] = ulData; + } } else - { + { #if defined(__sparc__) || defined(__mips__) UCHAR jReg; - + /* Save Misc */ astReg->MISC = GetReg(MISC_PORT_READ); /* Save SR */ for (i=0; i<4; i++) GetIndexReg(SEQ_PORT, (UCHAR) (i), astReg->SEQ[i]); - + /* Save CR */ for (i=0; i<25; i++) GetIndexReg(CRTC_PORT, (UCHAR) (i), astReg->CRTC[i]); - + /* Save GR */ for (i=0; i<9; i++) GetIndexReg(GR_PORT, (UCHAR) (i), astReg->GR[i]); - + /* Save AR */ jReg = GetReg(INPUT_STATUS1_READ); for (i=0; i<20; i++) - GetIndexReg(AR_PORT_WRITE, (UCHAR) (i), astReg->AR[i]); + GetIndexReg(AR_PORT_WRITE, (UCHAR) (i), astReg->AR[i]); jReg = GetReg(INPUT_STATUS1_READ); SetReg (AR_PORT_WRITE, 0x20); /* set POS */ -#else +#else vgaRegPtr vgaReg; vgaReg = &VGAHWPTR(pScrn)->SavedReg; - - /* do save */ + + /* do save */ if (xf86IsPrimaryPci(pAST->PciInfo)) { vgaHWSave(pScrn, vgaReg, VGA_SR_MODE | VGA_SR_FONTS); } @@ -1312,102 +1312,102 @@ ASTSave(ScrnInfoPtr pScrn) vgaHWSave(pScrn, vgaReg, VGA_SR_MODE); } #endif - + /* Save Ext. */ vASTOpenKey(pScrn); - - /* fixed Console Switch Refresh Rate Incorrect issue, ycchen@051106 */ + + /* fixed Console Switch Refresh Rate Incorrect issue, ycchen@051106 */ for (i=0x81; i<=0xB6; i++) GetIndexReg(CRTC_PORT, (UCHAR) (i), astReg->ExtCRTC[icount++]); for (i=0xBC; i<=0xC1; i++) GetIndexReg(CRTC_PORT, (UCHAR) (i), astReg->ExtCRTC[icount++]); GetIndexReg(CRTC_PORT, (UCHAR) (0xBB), astReg->ExtCRTC[icount]); - + /* 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]); - } - + VGA_GET_PALETTE_INDEX (i, astReg->DAC[i][0], astReg->DAC[i][1], astReg->DAC[i][2]); + } + } static void ASTRestore(ScrnInfoPtr pScrn) { ASTRecPtr pAST; - ASTRegPtr astReg; + ASTRegPtr astReg; int i, icount=0; ULONG ulData; pAST = ASTPTR(pScrn); - astReg = &pAST->SavedReg; - + astReg = &pAST->SavedReg; + if (pAST->jChipType == AST1180) { for (i=0; i<12; i++) { - ulData = astReg->GFX[i]; - WriteAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_CTRL+i*4, ulData); - } + ulData = astReg->GFX[i]; + WriteAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_CTRL+i*4, ulData); + } } else { #if defined(__sparc__) || defined(__mips__) UCHAR jReg; - + /* Restore Misc */ SetReg(MISC_PORT_WRITE, astReg->MISC); /* Restore SR */ for (i=0; i<4; i++) SetIndexReg(SEQ_PORT, (UCHAR) (i), astReg->SEQ[i]); - + /* Restore CR */ - SetIndexRegMask(CRTC_PORT,0x11, 0x7F, 0x00); + SetIndexRegMask(CRTC_PORT,0x11, 0x7F, 0x00); for (i=0; i<25; i++) SetIndexReg(CRTC_PORT, (UCHAR) (i), astReg->CRTC[i]); - + /* Restore GR */ for (i=0; i<9; i++) SetIndexReg(GR_PORT, (UCHAR) (i), astReg->GR[i]); - + /* Restore AR */ jReg = GetReg(INPUT_STATUS1_READ); for (i=0; i<20; i++) { - SetReg(AR_PORT_WRITE, (UCHAR) i); - SetReg(AR_PORT_WRITE, astReg->AR[i]); + SetReg(AR_PORT_WRITE, (UCHAR) i); + SetReg(AR_PORT_WRITE, astReg->AR[i]); } - SetReg(AR_PORT_WRITE, 0x14); - SetReg(AR_PORT_WRITE, 0x00); - + SetReg(AR_PORT_WRITE, 0x14); + SetReg(AR_PORT_WRITE, 0x00); + jReg = GetReg(INPUT_STATUS1_READ); - SetReg (AR_PORT_WRITE, 0x20); /* set POS */ -#else + SetReg (AR_PORT_WRITE, 0x20); /* set POS */ +#else vgaRegPtr vgaReg; vgaReg = &VGAHWPTR(pScrn)->SavedReg; - - /* do restore */ + + /* do restore */ vgaHWProtect(pScrn, TRUE); if (xf86IsPrimaryPci(pAST->PciInfo)) vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE | VGA_SR_FONTS); else - vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE); - vgaHWProtect(pScrn, FALSE); + vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE); + vgaHWProtect(pScrn, FALSE); #endif - + /* Ext. restore */ vASTOpenKey(pScrn); - + /* 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]); + VGA_LOAD_PALETTE_INDEX (i, astReg->DAC[i][0], astReg->DAC[i][1], astReg->DAC[i][2]); } } @@ -1415,35 +1415,35 @@ ASTRestore(ScrnInfoPtr pScrn) static void ASTProbeDDC(ScrnInfoPtr pScrn, int index) { - ASTRecPtr pAST = ASTPTR(pScrn); + ASTRecPtr pAST = ASTPTR(pScrn); unsigned char DDC_data[128]; Bool Flags; if (xf86LoadSubModule(pScrn, "ddc")) { - if (pAST->jChipType == AST1180) + if (pAST->jChipType == AST1180) Flags = GetVGA2EDID(pScrn, DDC_data); else Flags = GetVGAEDID(pScrn, DDC_data); - if (Flags) + if (Flags) { ConfiguredMonitor = xf86InterpretEDID(pScrn->scrnIndex, DDC_data); } else - xf86DrvMsg(pScrn->scrnIndex, X_INFO,"[ASTProbeDDC] Can't Get EDID Properly \n"); - } + xf86DrvMsg(pScrn->scrnIndex, X_INFO,"[ASTProbeDDC] Can't Get EDID Properly \n"); + } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO,"[ASTProbeDDC] Can't Load DDC Sub-Modules or Read EDID Failed \n"); - } + xf86DrvMsg(pScrn->scrnIndex, X_INFO,"[ASTProbeDDC] Can't Load DDC Sub-Modules or Read EDID Failed \n"); + } } #define SkipDT 0x00 #define DT1 0x01 #define DT2 0x02 - + static xf86MonPtr ASTDoDDC(ScrnInfoPtr pScrn, int index) { @@ -1457,7 +1457,7 @@ ASTDoDDC(ScrnInfoPtr pScrn, int index) struct monitor_ranges ranges, ranges1, ranges2; int DTSelect, dclock1=0, h_active1=0, v_active1=0, dclock2=0, h_active2=0, v_active2=0; struct std_timings stdtiming, *stdtiming1, *stdtiming2; - + /* Honour Option "noDDC" */ if (xf86ReturnOptValBool(pAST->Options, OPTION_NO_DDC, FALSE)) { return MonInfo; @@ -1465,27 +1465,27 @@ ASTDoDDC(ScrnInfoPtr pScrn, int index) if (xf86LoadSubModule(pScrn, "ddc")) { - if (pAST->jChipType == AST1180) + if (pAST->jChipType == AST1180) Flags = GetVGA2EDID(pScrn, DDC_data); else Flags = GetVGAEDID(pScrn, DDC_data); - + if (Flags) - { + { MonInfo = MonInfo1 = xf86InterpretEDID(pScrn->scrnIndex, DDC_data); - + /* Valid Wide Screen Support */ if ( (MonInfo) && (MonInfo->det_mon[0].type == 0x00) ) { if ( (MonInfo->det_mon[0].section.d_timings.h_active * 10 / MonInfo->det_mon[0].section.d_timings.v_active) < 14 ) - pAST->SupportWideScreen = FALSE; - } + pAST->SupportWideScreen = FALSE; + } } - + /* For VGA2 CLONE Support, ycchen@012508 */ if ((xf86ReturnOptValBool(pAST->Options, OPTION_VGA2_CLONE, FALSE)) || pAST->VGA2Clone) { if (GetVGA2EDID(pScrn, DDC_data) == TRUE) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Get VGA2 EDID Correctly!! \n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Get VGA2 EDID Correctly!! \n"); MonInfo2 = xf86InterpretEDID(pScrn->scrnIndex, DDC_data); if (MonInfo1 == NULL) /* No DDC1 EDID */ MonInfo = MonInfo2; @@ -1494,50 +1494,50 @@ ASTDoDDC(ScrnInfoPtr pScrn, int index) MonInfo->timings1.t1 = MonInfo1->timings1.t1 & MonInfo2->timings1.t1; MonInfo->timings1.t2 = MonInfo1->timings1.t2 & MonInfo2->timings1.t2; MonInfo->timings1.t_manu = MonInfo1->timings1.t_manu & MonInfo2->timings1.t_manu; - + /* Update Std. Timing */ for (i=0; i<8; i++) { - stdtiming.hsize = stdtiming.vsize = stdtiming.refresh = stdtiming.id = 0; - for (j=0; j<8; j++) { + stdtiming.hsize = stdtiming.vsize = stdtiming.refresh = stdtiming.id = 0; + for (j=0; j<8; j++) { if ((MonInfo1->timings2[i].hsize == MonInfo2->timings2[j].hsize) && \ (MonInfo1->timings2[i].vsize == MonInfo2->timings2[j].vsize) && \ (MonInfo1->timings2[i].refresh == MonInfo2->timings2[j].refresh)) { stdtiming = MonInfo1->timings2[i]; break; - } + } } - + MonInfo->timings2[i] = stdtiming; } /* Std. Timing */ - + /* Get Detailed Timing */ for (i=0;i<4;i++) { if (MonInfo1->det_mon[i].type == 0xFD) ranges1 = MonInfo1->det_mon[i].section.ranges; else if (MonInfo1->det_mon[i].type == 0xFA) - stdtiming1 = MonInfo1->det_mon[i].section.std_t; + stdtiming1 = MonInfo1->det_mon[i].section.std_t; else if (MonInfo1->det_mon[i].type == 0x00) { if (MonInfo1->det_mon[i].section.d_timings.clock > dclock1) dclock1 = MonInfo1->det_mon[i].section.d_timings.clock; if (MonInfo1->det_mon[i].section.d_timings.h_active > h_active1) h_active1 = MonInfo1->det_mon[i].section.d_timings.h_active; if (MonInfo1->det_mon[i].section.d_timings.v_active > v_active1) - v_active1 = MonInfo1->det_mon[i].section.d_timings.v_active; - } + v_active1 = MonInfo1->det_mon[i].section.d_timings.v_active; + } if (MonInfo2->det_mon[i].type == 0xFD) ranges2 = MonInfo2->det_mon[i].section.ranges; else if (MonInfo1->det_mon[i].type == 0xFA) - stdtiming2 = MonInfo2->det_mon[i].section.std_t; + stdtiming2 = MonInfo2->det_mon[i].section.std_t; else if (MonInfo2->det_mon[i].type == 0x00) { if (MonInfo2->det_mon[i].section.d_timings.clock > dclock2) dclock2 = MonInfo2->det_mon[i].section.d_timings.clock; if (MonInfo2->det_mon[i].section.d_timings.h_active > h_active2) h_active2 = MonInfo2->det_mon[i].section.d_timings.h_active; if (MonInfo2->det_mon[i].section.d_timings.v_active > v_active2) - v_active2 = MonInfo2->det_mon[i].section.d_timings.v_active; - } + v_active2 = MonInfo2->det_mon[i].section.d_timings.v_active; + } } /* Get Detailed Timing */ - + /* Chk Detailed Timing */ if ((dclock1 >= dclock2) && (h_active1 >= h_active2) && (v_active1 >= v_active2)) DTSelect = DT2; @@ -1545,21 +1545,21 @@ ASTDoDDC(ScrnInfoPtr pScrn, int index) DTSelect = DT1; else DTSelect = SkipDT; - - /* Chk Monitor Descriptor */ + + /* Chk Monitor Descriptor */ ranges = ranges1; ranges.min_h = ranges1.min_h > ranges2.min_h ? ranges1.min_h:ranges2.min_h; - ranges.min_v = ranges1.min_v > ranges2.min_v ? ranges1.min_v:ranges2.min_v; + ranges.min_v = ranges1.min_v > ranges2.min_v ? ranges1.min_v:ranges2.min_v; ranges.max_h = ranges1.max_h < ranges2.max_h ? ranges1.max_h:ranges2.max_h; ranges.max_v = ranges1.max_v < ranges2.max_v ? ranges1.max_v:ranges2.max_v; ranges.max_clock = ranges1.max_clock < ranges2.max_clock ? ranges1.max_clock:ranges2.max_clock; - + /* Update Detailed Timing */ for (i=0; i<4; i++) { if (MonInfo->det_mon[i].type == 0xFD) { MonInfo->det_mon[i].section.ranges = ranges; - } + } else if (MonInfo->det_mon[i].type == 0xFA) { for (j=0; j<5; j++) { stdtiming.hsize = stdtiming.vsize = stdtiming.refresh = stdtiming.id = 0; @@ -1569,10 +1569,10 @@ ASTDoDDC(ScrnInfoPtr pScrn, int index) (stdtiming1[j].refresh == stdtiming2[k].refresh)) { stdtiming = stdtiming1[j]; break; - } + } } stdtiming1[j] = stdtiming; - } /* Std. Timing */ + } /* Std. Timing */ } /* FA */ else if (MonInfo->det_mon[i].type == 0x00) { if (DTSelect == DT2) @@ -1591,57 +1591,57 @@ ASTDoDDC(ScrnInfoPtr pScrn, int index) MonInfo->det_mon[i].section.d_timings.h_sync_width = 136; MonInfo->det_mon[i].section.d_timings.v_sync_off = 3; MonInfo->det_mon[i].section.d_timings.v_sync_width = 6; - } + } } /* 00 */ else { /* use Monitor 1 as default */ - MonInfo->det_mon[i] = MonInfo1->det_mon[i]; + MonInfo->det_mon[i] = MonInfo1->det_mon[i]; } - + } /* Update Detailed Timing */ - + /* set feature size */ if (DTSelect == DT2) { MonInfo->features.hsize = MonInfo2->features.hsize; - MonInfo->features.vsize = MonInfo2->features.vsize; + MonInfo->features.vsize = MonInfo2->features.vsize; } else if (DTSelect == DT1) { MonInfo->features.hsize = MonInfo1->features.hsize; - MonInfo->features.vsize = MonInfo1->features.vsize; + MonInfo->features.vsize = MonInfo1->features.vsize; } else /* Skip DT */ { /* use 1024x768 as default */ MonInfo->features.hsize = 0x20; - MonInfo->features.vsize = 0x18; - } - + MonInfo->features.vsize = 0x18; + } + } /* Check with VGA1 & VGA2 EDID */ - + } /* GetVGA2EDID */ else { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Can't Get VGA2 EDID Correctly!! \n"); - } + } } /* VGA2Clone */ - + xf86PrintEDID(MonInfo); - xf86SetDDCproperties(pScrn, MonInfo); - } + xf86SetDDCproperties(pScrn, MonInfo); + } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO,"[ASTDoDDC] Can't Load DDC Sub-Modules or Read EDID Failed \n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO,"[ASTDoDDC] Can't Load DDC Sub-Modules or Read EDID Failed \n"); } /* Fill pAST Monitor Info */ if (MonInfo == NULL) { /* default for Non-EDID */ pAST->mon_h_active = 1024; - pAST->mon_v_active = 768; - } + pAST->mon_v_active = 768; + } else { /* save MonInfo to Private */ pAST->mon_h_active = MonInfo->det_mon[0].section.d_timings.h_active; pAST->mon_v_active = MonInfo->det_mon[0].section.d_timings.v_active; - } - + } + return MonInfo; } @@ -1649,12 +1649,12 @@ static void vFillASTModeInfo (ScrnInfoPtr pScrn) { ASTRecPtr pAST; - + pAST = ASTPTR(pScrn); - - pAST->VideoModeInfo.ScreenWidth = pScrn->virtualX; - pAST->VideoModeInfo.ScreenHeight = pScrn->virtualY; - pAST->VideoModeInfo.bitsPerPixel = pScrn->bitsPerPixel; + + pAST->VideoModeInfo.ScreenWidth = pScrn->virtualX; + pAST->VideoModeInfo.ScreenHeight = pScrn->virtualY; + pAST->VideoModeInfo.bitsPerPixel = pScrn->bitsPerPixel; /* Fixed screen pitch incorrect in some specific monitor, ycchen@071707 */ pAST->VideoModeInfo.ScreenPitch = pScrn->displayWidth * ((pScrn->bitsPerPixel + 1) / 8) ; @@ -1669,10 +1669,10 @@ ASTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) pScrn->vtSema = TRUE; pAST->ModePtr = mode; - + #if defined(__sparc__) || defined(__mips__) if (!ASTSetMode(pScrn, mode)) - return FALSE; + return FALSE; #else vgaHWPtr hwp; @@ -1688,7 +1688,7 @@ ASTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) if (!ASTSetMode(pScrn, mode)) return FALSE; - + vgaHWProtect(pScrn, FALSE); #endif @@ -1758,12 +1758,12 @@ static void ASTStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) { ASTPortPrivPtr pPriv = (ASTPortPrivPtr)data; ASTPtr pAST = ASTPTR(pScrn); - + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); - + if(exit) { - if(pPriv->fbAreaPtr) + if(pPriv->fbAreaPtr) { xf86FreeOffscreenArea(pPriv->fbAreaPtr); pPriv->fbAreaPtr = NULL; @@ -1771,14 +1771,14 @@ static void ASTStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) } /* clear all flag */ pPriv->videoStatus = 0; - } + } else { -#if 0 - if(pPriv->videoStatus & CLIENT_VIDEO_ON) +#if 0 + if(pPriv->videoStatus & CLIENT_VIDEO_ON) { pPriv->videoStatus |= OFF_TIMER; - + } #endif } @@ -1788,65 +1788,65 @@ static int ASTSetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 value, p { ASTPortPrivPtr pPriv = (ASTPortPrivPtr)data; ASTPtr pAST = ASTPTR(pScrn); - + xf86DrvMsg(pScrn->scrnIndex, X_INFO,"ASTSetPortAttribute(),attribute=%x\n", attribute); - - if (attribute == pAST->xvBrightness) + + if (attribute == pAST->xvBrightness) { if((value < -128) || (value > 127)) return BadValue; - + pPriv->brightness = value; } - else if (attribute == pAST->xvContrast) + else if (attribute == pAST->xvContrast) { if ((value < 0) || (value > 255)) return BadValue; - + pPriv->contrast = value; } else if (attribute == pAST->xvSaturation) { if ((value < -180) || (value > 180)) return BadValue; - + pPriv->saturation = value; } else if (attribute == pAST->xvHue) { if ((value < -180) || (value > 180)) return BadValue; - + pPriv->hue = value; } - else if (attribute == pAST->xvColorKey) + else if (attribute == pAST->xvColorKey) { pPriv->colorKey = value; REGION_EMPTY(pScrn->pScreen, &pPriv->clip); } - else if(attribute == pAST->xvGammaRed) + else if(attribute == pAST->xvGammaRed) { if((value < 100) || (value > 10000)) return BadValue; pPriv->gammaR = value; } - else if(attribute == pAST->xvGammaGreen) + else if(attribute == pAST->xvGammaGreen) { if((value < 100) || (value > 10000)) return BadValue; - pPriv->gammaG = value; - } - else if(attribute == pAST->xvGammaBlue) + pPriv->gammaG = value; + } + else if(attribute == pAST->xvGammaBlue) { if((value < 100) || (value > 10000)) return BadValue; pPriv->gammaB = value; - } + } else { return BadMatch; } - + return Success; } @@ -1854,50 +1854,50 @@ static int ASTGetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 *value, { ASTPortPrivPtr pPriv = (ASTPortPrivPtr)data; ASTPtr pAST = ASTPTR(pScrn); - + xf86DrvMsg(pScrn->scrnIndex, X_INFO,"ASTGetPortAttribute(),attribute=%x\n", attribute); - - if (attribute == pAST->xvBrightness) + + if (attribute == pAST->xvBrightness) { *value = pPriv->brightness; } - else if (attribute == pAST->xvContrast) + else if (attribute == pAST->xvContrast) { *value = pPriv->contrast; } - else if (attribute == pAST->xvSaturation) + else if (attribute == pAST->xvSaturation) { *value = pPriv->saturation; } - else if (attribute == pAST->xvHue) + else if (attribute == pAST->xvHue) { *value = pPriv->hue; - } - else if(attribute == pAST->xvGammaRed) + } + else if(attribute == pAST->xvGammaRed) { *value = pPriv->gammaR; - + } - else if(attribute == pAST->xvGammaGreen) + else if(attribute == pAST->xvGammaGreen) { *value = pPriv->gammaG; } - else if(attribute == pAST->xvGammaBlue) + else if(attribute == pAST->xvGammaBlue) { *value = pPriv->gammaB; } - else if (attribute == pAST->xvColorKey) + else if (attribute == pAST->xvColorKey) { *value = pPriv->colorKey; } else return BadMatch; - + return Success; } -static void ASTQueryBestSize(ScrnInfoPtr pScrn, Bool motion, - short vid_w, short vid_h, +static void ASTQueryBestSize(ScrnInfoPtr pScrn, Bool motion, + short vid_w, short vid_h, short drw_w, short drw_h, unsigned int *p_w, unsigned int *p_h, pointer data) @@ -1986,7 +1986,7 @@ static int ASTPutImage(ScrnInfoPtr pScrn, Bool sync, RegionPtr clipBoxes, pointer data ) -{ +{ ASTPtr pAST = ASTPTR(pScrn); ASTPortPrivPtr pPriv = (ASTPortPrivPtr)data; int i; @@ -1994,7 +1994,7 @@ static int ASTPutImage(ScrnInfoPtr pScrn, xf86DrvMsg(pScrn->scrnIndex, X_INFO,"ASTPutImage()\n"); /* int depth = pAST->CurrentLayout.bitsPerPixel >> 3; */ - + pPriv->drw_x = drw_x; pPriv->drw_y = drw_y; pPriv->drw_w = drw_w; @@ -2005,7 +2005,7 @@ static int ASTPutImage(ScrnInfoPtr pScrn, pPriv->src_h = src_h; pPriv->id = id; pPriv->height = height; - + switch(id) { case PIXEL_FMT_YV12: @@ -2023,52 +2023,52 @@ static int ASTPutImage(ScrnInfoPtr pScrn, pPriv->srcPitch = ((width << 1) + 3) & ~3; /* Verified */ totalSize = pPriv->srcPitch * height; } - + totalSize += 15; totalSize &= ~15; /* allocate memory */ - + if(totalSize == pPriv->fbSize) { - ; - } + ; + } else { - int lines, pitch, depth; + int lines, pitch, depth; BoxPtr pBox = NULL; - + pPriv->fbSize = totalSize; - - if(pPriv->fbAreaPtr) + + if(pPriv->fbAreaPtr) { xf86FreeOffscreenArea(pPriv->fbAreaPtr); } - + depth = (pScrn->bitsPerPixel + 7 ) / 8; pitch = pScrn->displayWidth * depth; lines = ((totalSize * 2) / pitch) + 1; xf86DrvMsg(pScrn->scrnIndex, X_INFO,"ASTPutImagelines=%x, pitch=%x, displayWidth=%x\n", lines, pitch, pScrn->displayWidth); - - - pPriv->fbAreaPtr = xf86AllocateOffscreenArea(pScrn->pScreen, + + + pPriv->fbAreaPtr = xf86AllocateOffscreenArea(pScrn->pScreen, pScrn->displayWidth, lines, 0, NULL, NULL, NULL); - - if(!pPriv->fbAreaPtr) + + if(!pPriv->fbAreaPtr) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Allocate video memory fails\n"); return BadAlloc; } - - pBox = &(pPriv->fbAreaPtr->box); - pPriv->bufAddr[0] = (pBox->y1 * pitch) + (pBox->x1 * depth); + + pBox = &(pPriv->fbAreaPtr->box); + pPriv->bufAddr[0] = (pBox->y1 * pitch) + (pBox->x1 * depth); pPriv->bufAddr[1] = pPriv->bufAddr[0] + totalSize; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Put Image, pPriv->bufAddr[0]=0x%08X\n", pPriv->bufAddr[0]); - + } - + /* copy data */ - if(totalSize < 16) + if(totalSize < 16) { #ifdef NewPath memcpy(pAST->FBVirtualAddr + pPriv->bufAddr[pPriv->currentBuf], buf, totalSize); @@ -2078,22 +2078,22 @@ static int ASTPutImage(ScrnInfoPtr pScrn, case PIXEL_FMT_YUY2: case PIXEL_FMT_UYVY: case PIXEL_FMT_YVYU: - { + { BYTE *Base = (BYTE *)(pAST->FBVirtualAddr + pPriv->bufAddr[pPriv->currentBuf]); for(i=0; i<height; i++) memcpy( Base + i * pPriv->srcPitch, buf + i*width*2, width*2); break; - } + } default: memcpy(pAST->FBVirtualAddr + pPriv->bufAddr[pPriv->currentBuf], buf, totalSize); break; } /* switch */ #endif /* NewPath */ - } + } else { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Put Image, copy buf\n"); - + #ifdef NewPath memcpy(pAST->FBVirtualAddr + pPriv->bufAddr[pPriv->currentBuf], buf, totalSize); #else /* NewPath */ @@ -2106,7 +2106,7 @@ static int ASTPutImage(ScrnInfoPtr pScrn, BYTE *Base = (BYTE *)(pAST->FBVirtualAddr + pPriv->bufAddr[pPriv->currentBuf]); for(i=0; i<height; i++) memcpy( Base + i * pPriv->srcPitch, buf + i*width*2, width*2); - + /*for(i=0; i<height; i++) for(j=0; j<width*2; j++) *(Base+i*pPriv->srcPitch+j) = *(buf + width*i + j);*/ @@ -2123,21 +2123,21 @@ static int ASTPutImage(ScrnInfoPtr pScrn, } /* end of switch */ #endif /* NewPath */ } - + ASTDisplayVideo(pScrn, pPriv, clipBoxes, id); - - /* update cliplist - if(!REGION_EQUAL(pScrn->pScreen, &pPriv->clip, clipBoxes)) - { + + /* update cliplist + if(!REGION_EQUAL(pScrn->pScreen, &pPriv->clip, clipBoxes)) + { REGION_COPY(pScrn->pScreen, &pPriv->clip, clipBoxes); } - else + else { xf86XVFillKeyHelper(pScrn->pScreen, 0xFFFFFFFF, clipBoxes); } */ pPriv->currentBuf ^= 1; - + return Success; } @@ -2147,10 +2147,10 @@ static XF86VideoAdaptorPtr ASTSetupImageVideo(ScreenPtr pScreen) ASTPtr pAST = ASTPTR(pScrn); XF86VideoAdaptorPtr adapt; ASTPortPrivPtr pPriv; - + if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) + - sizeof(DevUnion) + + sizeof(DevUnion) + sizeof(ASTPortPrivRec)))) return NULL; @@ -2160,7 +2160,7 @@ static XF86VideoAdaptorPtr ASTSetupImageVideo(ScreenPtr pScreen) adapt->nEncodings = 1; adapt->pEncodings = &DummyEncoding; - + adapt->nFormats = NUM_FORMATS; adapt->pFormats = ASTFormats; adapt->nPorts = 1; @@ -2175,7 +2175,7 @@ static XF86VideoAdaptorPtr ASTSetupImageVideo(ScreenPtr pScreen) adapt->pImages = ASTImages; adapt->PutVideo = NULL; - + adapt->PutStill = NULL; adapt->GetVideo = NULL; adapt->GetStill = NULL; @@ -2207,7 +2207,7 @@ static XF86VideoAdaptorPtr ASTSetupImageVideo(ScreenPtr pScreen) #endif pAST->adaptor = adapt; - + pAST->xvBrightness = MAKE_ATOM(astxvbrightness); pAST->xvContrast = MAKE_ATOM(astxvcontrast); pAST->xvColorKey = MAKE_ATOM(astxvcolorkey); @@ -2216,7 +2216,7 @@ static XF86VideoAdaptorPtr ASTSetupImageVideo(ScreenPtr pScreen) pAST->xvGammaRed = MAKE_ATOM(astxvgammared); pAST->xvGammaGreen = MAKE_ATOM(astxvgammagreen); pAST->xvGammaBlue = MAKE_ATOM(astxvgammablue); - + return adapt; } @@ -2228,20 +2228,20 @@ void ASTInitVideo(ScreenPtr pScreen) int num_adaptors; ASTAdaptor = ASTSetupImageVideo(pScreen); - + num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); - if(ASTAdaptor) + if(ASTAdaptor) { - if(!num_adaptors) + if(!num_adaptors) { num_adaptors = 1; adaptors = &ASTAdaptor; } - else + else { newAdaptors = malloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); - if(newAdaptors) + if(newAdaptors) { memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr)); diff --git a/src/ast_mode.c b/src/ast_mode.c index 47ab02b..5911bb5 100644 --- a/src/ast_mode.c +++ b/src/ast_mode.c @@ -19,7 +19,7 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ - + #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -60,74 +60,74 @@ extern Bool bInitAST1180(ScrnInfoPtr pScrn); VBIOS_STDTABLE_STRUCT StdTable[] = { /* MD_2_3_400 */ { - 0x67, - {0x00,0x03,0x00,0x02}, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x67, + {0x00,0x03,0x00,0x02}, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, 0x0c,0x00,0x0f,0x08}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, 0xff} - }, + }, /* Mode12/ExtEGATable */ { - 0xe3, - {0x01,0x0f,0x00,0x06}, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e, - 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 0xe9,0x8b,0xdf,0x28,0x00,0xe7,0x04,0xe3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, - 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, - 0x01,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, - 0xff} + 0xe3, + {0x01,0x0f,0x00,0x06}, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0xe9,0x8b,0xdf,0x28,0x00,0xe7,0x04,0xe3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, + 0xff} }, /* ExtVGATable */ { - 0x2f, - {0x01,0x0f,0x00,0x0e}, - {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e, - 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, - 0x01,0x00,0x00,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f, + 0x2f, + {0x01,0x0f,0x00,0x0e}, + {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, + 0x01,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f, 0xff} }, /* ExtHiCTable */ { - 0x2f, - {0x01,0x0f,0x00,0x0e}, - {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e, - 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, - 0x01,0x00,0x00,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, + 0x2f, + {0x01,0x0f,0x00,0x0e}, + {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, + 0x01,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, 0xff} - }, + }, /* ExtTrueCTable */ { - 0x2f, - {0x01,0x0f,0x00,0x0e}, - {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e, - 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, - 0x01,0x00,0x00,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, + 0x2f, + {0x01,0x0f,0x00,0x0e}, + {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, + 0x01,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, 0xff} - }, + }, }; VBIOS_ENHTABLE_STRUCT Res640x480Table[] = { @@ -136,117 +136,117 @@ VBIOS_ENHTABLE_STRUCT Res640x480Table[] = { { 832, 640, 16, 40, 520, 480, 1, 3, VCLK31_5, /* 72Hz */ (SyncNN | HBorder | VBorder | Charx8Dot), 72, 2, 0x2E }, { 840, 640, 16, 64, 500, 480, 1, 3, VCLK31_5, /* 75Hz */ - (SyncNN | Charx8Dot) , 75, 3, 0x2E }, + (SyncNN | Charx8Dot) , 75, 3, 0x2E }, { 832, 640, 56, 56, 509, 480, 1, 3, VCLK36, /* 85Hz */ (SyncNN | Charx8Dot) , 85, 4, 0x2E }, { 832, 640, 56, 56, 509, 480, 1, 3, VCLK36, /* end */ - (SyncNN | Charx8Dot) , 0xFF, 4, 0x2E }, + (SyncNN | Charx8Dot) , 0xFF, 4, 0x2E }, }; VBIOS_ENHTABLE_STRUCT Res800x600Table[] = { {1024, 800, 24, 72, 625, 600, 1, 2, VCLK36, /* 56Hz */ - (SyncPP | Charx8Dot), 56, 1, 0x30 }, - {1056, 800, 40, 128, 628, 600, 1, 4, VCLK40, /* 60Hz */ + (SyncPP | Charx8Dot), 56, 1, 0x30 }, + {1056, 800, 40, 128, 628, 600, 1, 4, VCLK40, /* 60Hz */ (SyncPP | Charx8Dot), 60, 2, 0x30 }, - {1040, 800, 56, 120, 666, 600, 37, 6, VCLK50, /* 72Hz */ - (SyncPP | Charx8Dot), 72, 3, 0x30 }, - {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), 84, 5, 0x30 }, - {1048, 800, 32, 64, 631, 600, 1, 3, VCLK56_25, /* end */ - (SyncPP | Charx8Dot), 0xFF, 5, 0x30 }, + {1040, 800, 56, 120, 666, 600, 37, 6, VCLK50, /* 72Hz */ + (SyncPP | Charx8Dot), 72, 3, 0x30 }, + {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), 84, 5, 0x30 }, + {1048, 800, 32, 64, 631, 600, 1, 3, VCLK56_25, /* end */ + (SyncPP | Charx8Dot), 0xFF, 5, 0x30 }, }; -VBIOS_ENHTABLE_STRUCT Res1024x768Table[] = { - {1344, 1024, 24, 136, 806, 768, 3, 6, VCLK65, /* 60Hz */ - (SyncNN | Charx8Dot), 60, 1, 0x31 }, - {1328, 1024, 24, 136, 806, 768, 3, 6, VCLK75, /* 70Hz */ +VBIOS_ENHTABLE_STRUCT Res1024x768Table[] = { + {1344, 1024, 24, 136, 806, 768, 3, 6, VCLK65, /* 60Hz */ + (SyncNN | Charx8Dot), 60, 1, 0x31 }, + {1328, 1024, 24, 136, 806, 768, 3, 6, VCLK75, /* 70Hz */ (SyncNN | Charx8Dot), 70, 2, 0x31 }, - {1312, 1024, 16, 96, 800, 768, 1, 3, VCLK78_75, /* 75Hz */ - (SyncPP | Charx8Dot), 75, 3, 0x31 }, - {1376, 1024, 48, 96, 808, 768, 1, 3, VCLK94_5, /* 85Hz */ - (SyncPP | Charx8Dot), 84, 4, 0x31 }, - {1376, 1024, 48, 96, 808, 768, 1, 3, VCLK94_5, /* end */ - (SyncPP | Charx8Dot), 0xFF, 4, 0x31 }, + {1312, 1024, 16, 96, 800, 768, 1, 3, VCLK78_75, /* 75Hz */ + (SyncPP | Charx8Dot), 75, 3, 0x31 }, + {1376, 1024, 48, 96, 808, 768, 1, 3, VCLK94_5, /* 85Hz */ + (SyncPP | Charx8Dot), 84, 4, 0x31 }, + {1376, 1024, 48, 96, 808, 768, 1, 3, VCLK94_5, /* end */ + (SyncPP | Charx8Dot), 0xFF, 4, 0x31 }, }; -VBIOS_ENHTABLE_STRUCT Res1280x1024Table[] = { - {1688, 1280, 48, 112, 1066, 1024, 1, 3, VCLK108, /* 60Hz */ - (SyncPP | Charx8Dot), 60, 1, 0x32 }, - {1688, 1280, 16, 144, 1066, 1024, 1, 3, VCLK135, /* 75Hz */ - (SyncPP | Charx8Dot), 75, 2, 0x32 }, - {1728, 1280, 64, 160, 1072, 1024, 1, 3, VCLK157_5, /* 85Hz */ - (SyncPP | Charx8Dot), 85, 3, 0x32 }, - {1728, 1280, 64, 160, 1072, 1024, 1, 3, VCLK157_5, /* end */ - (SyncPP | Charx8Dot), 0xFF, 3, 0x32 }, +VBIOS_ENHTABLE_STRUCT Res1280x1024Table[] = { + {1688, 1280, 48, 112, 1066, 1024, 1, 3, VCLK108, /* 60Hz */ + (SyncPP | Charx8Dot), 60, 1, 0x32 }, + {1688, 1280, 16, 144, 1066, 1024, 1, 3, VCLK135, /* 75Hz */ + (SyncPP | Charx8Dot), 75, 2, 0x32 }, + {1728, 1280, 64, 160, 1072, 1024, 1, 3, VCLK157_5, /* 85Hz */ + (SyncPP | Charx8Dot), 85, 3, 0x32 }, + {1728, 1280, 64, 160, 1072, 1024, 1, 3, VCLK157_5, /* end */ + (SyncPP | Charx8Dot), 0xFF, 3, 0x32 }, }; -VBIOS_ENHTABLE_STRUCT Res1600x1200Table[] = { - {2160, 1600, 64, 192, 1250, 1200, 1, 3, VCLK162, /* 60Hz */ - (SyncPP | Charx8Dot), 60, 1, 0x33 }, - {2160, 1600, 64, 192, 1250, 1200, 1, 3, VCLK162, /* end */ - (SyncPP | Charx8Dot), 0xFF, 1, 0x33 }, +VBIOS_ENHTABLE_STRUCT Res1600x1200Table[] = { + {2160, 1600, 64, 192, 1250, 1200, 1, 3, VCLK162, /* 60Hz */ + (SyncPP | Charx8Dot), 60, 1, 0x33 }, + {2160, 1600, 64, 192, 1250, 1200, 1, 3, VCLK162, /* end */ + (SyncPP | Charx8Dot), 0xFF, 1, 0x33 }, }; /* 16:9 */ VBIOS_ENHTABLE_STRUCT Res1360x768Table[] = { {1792, 1360, 64,112, 795, 768, 3, 6, VCLK85_5, /* 60Hz */ - (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x39 }, + (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x39 }, {1792, 1360, 64,112, 795, 768, 3, 6, VCLK85_5, /* end */ - (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x39 }, + (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x39 }, }; VBIOS_ENHTABLE_STRUCT Res1600x900Table[] = { {1760, 1600, 48, 32, 926, 900, 3, 5, VCLK97_75, /* 60Hz CVT RB */ - (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x3A }, + (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x3A }, {1760, 1600, 48, 32, 926, 900, 3, 5, VCLK97_75, /* end */ - (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x3A }, + (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x3A }, }; VBIOS_ENHTABLE_STRUCT Res1920x1080Table[] = { {2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5, /* HDTV 60Hz */ (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x38 }, {2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5, /* end */ - (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x38 }, + (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x38 }, }; /* 16:10 */ VBIOS_ENHTABLE_STRUCT Res1280x800Table[] = { {1440, 1280, 48, 32, 823, 800, 3, 6, VCLK71, /* 60Hz RB */ - (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 35 }, + (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 35 }, {1680, 1280, 72,128, 831, 800, 3, 6, VCLK83_5, /* 60Hz */ - (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 2, 0x35 }, + (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 2, 0x35 }, {1680, 1280, 72,128, 831, 800, 3, 6, VCLK83_5, /* 60Hz */ - (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x35 }, - + (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x35 }, + }; VBIOS_ENHTABLE_STRUCT Res1440x900Table[] = { {1600, 1440, 48, 32, 926, 900, 3, 6, VCLK88_75, /* 60Hz RB */ - (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x36 }, + (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x36 }, {1904, 1440, 80,152, 934, 900, 3, 6, VCLK106_5, /* 60Hz */ (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 2, 0x36 }, {1904, 1440, 80,152, 934, 900, 3, 6, VCLK106_5, /* 60Hz */ - (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x36 }, + (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x36 }, }; VBIOS_ENHTABLE_STRUCT Res1680x1050Table[] = { {1840, 1680, 48, 32, 1080, 1050, 3, 6, VCLK119, /* 60Hz RB */ - (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x37 }, + (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x37 }, {2240, 1680,104,176, 1089, 1050, 3, 6, VCLK146_25, /* 60Hz */ (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 2, 0x37 }, {2240, 1680,104,176, 1089, 1050, 3, 6, VCLK146_25, /* 60Hz */ - (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x37 }, + (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x37 }, }; VBIOS_ENHTABLE_STRUCT Res1920x1200Table[] = { {2080, 1920, 48, 32, 1235, 1200, 3, 6, VCLK154, /* 60Hz */ - (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x34 }, + (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x34 }, {2080, 1920, 48, 32, 1235, 1200, 3, 6, VCLK154, /* 60Hz */ - (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x34 }, + (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x34 }, }; VBIOS_DCLK_INFO DCLKTable [] = { @@ -268,13 +268,13 @@ VBIOS_DCLK_INFO DCLKTable [] = { {0x6A, 0x22, 0x00}, /* 0F: VCLK162 */ {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 */ + {0x28, 0x49, 0x80}, /* 12: VCLK106.5 */ + {0x37, 0x49, 0x80}, /* 13: VCLK146.25 */ + {0x1f, 0x45, 0x80}, /* 14: VCLK148.5 */ {0x47, 0x6c, 0x80}, /* 15: VCLK71 */ {0x25, 0x65, 0x80}, /* 16: VCLK88.75 */ {0x77, 0x58, 0x80}, /* 17: VCLK119 */ - {0x32, 0x67, 0x80}, /* 18: VCLK85_5 */ + {0x32, 0x67, 0x80}, /* 18: VCLK85_5 */ }; VBIOS_DCLK_INFO DCLKTable_AST2100 [] = { @@ -296,118 +296,118 @@ VBIOS_DCLK_INFO DCLKTable_AST2100 [] = { {0x6A, 0x22, 0x00}, /* 0F: VCLK162 */ {0x4d, 0x4c, 0x80}, /* 10: VCLK154 */ {0x68, 0x6f, 0x80}, /* 11: VCLK83.5 */ - {0x28, 0x49, 0x80}, /* 12: VCLK106.5 */ - {0x37, 0x49, 0x80}, /* 13: VCLK146.25 */ + {0x28, 0x49, 0x80}, /* 12: VCLK106.5 */ + {0x37, 0x49, 0x80}, /* 13: VCLK146.25 */ {0x1f, 0x45, 0x80}, /* 14: VCLK148.5 */ - {0x47, 0x6c, 0x80}, /* 15: VCLK71 */ - {0x25, 0x65, 0x80}, /* 16: VCLK88.75 */ + {0x47, 0x6c, 0x80}, /* 15: VCLK71 */ + {0x25, 0x65, 0x80}, /* 16: VCLK88.75 */ {0x77, 0x58, 0x80}, /* 17: VCLK119 */ - {0x32, 0x67, 0x80}, /* 18: VCLK85_5 */ + {0x32, 0x67, 0x80}, /* 18: VCLK85_5 */ }; VBIOS_DAC_INFO DAC_TEXT[] = { - { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x2a }, { 0x00, 0x2a, 0x00 }, { 0x00, 0x2a, 0x2a }, - { 0x2a, 0x00, 0x00 }, { 0x2a, 0x00, 0x2a }, { 0x2a, 0x2a, 0x00 }, { 0x2a, 0x2a, 0x2a }, - { 0x00, 0x00, 0x15 }, { 0x00, 0x00, 0x3f }, { 0x00, 0x2a, 0x15 }, { 0x00, 0x2a, 0x3f }, - { 0x2a, 0x00, 0x15 }, { 0x2a, 0x00, 0x3f }, { 0x2a, 0x2a, 0x15 }, { 0x2a, 0x2a, 0x3f }, - { 0x00, 0x15, 0x00 }, { 0x00, 0x15, 0x2a }, { 0x00, 0x3f, 0x00 }, { 0x00, 0x3f, 0x2a }, - { 0x2a, 0x15, 0x00 }, { 0x2a, 0x15, 0x2a }, { 0x2a, 0x3f, 0x00 }, { 0x2a, 0x3f, 0x2a }, - { 0x00, 0x15, 0x15 }, { 0x00, 0x15, 0x3f }, { 0x00, 0x3f, 0x15 }, { 0x00, 0x3f, 0x3f }, - { 0x2a, 0x15, 0x15 }, { 0x2a, 0x15, 0x3f }, { 0x2a, 0x3f, 0x15 }, { 0x2a, 0x3f, 0x3f }, - { 0x15, 0x00, 0x00 }, { 0x15, 0x00, 0x2a }, { 0x15, 0x2a, 0x00 }, { 0x15, 0x2a, 0x2a }, - { 0x3f, 0x00, 0x00 }, { 0x3f, 0x00, 0x2a }, { 0x3f, 0x2a, 0x00 }, { 0x3f, 0x2a, 0x2a }, - { 0x15, 0x00, 0x15 }, { 0x15, 0x00, 0x3f }, { 0x15, 0x2a, 0x15 }, { 0x15, 0x2a, 0x3f }, - { 0x3f, 0x00, 0x15 }, { 0x3f, 0x00, 0x3f }, { 0x3f, 0x2a, 0x15 }, { 0x3f, 0x2a, 0x3f }, - { 0x15, 0x15, 0x00 }, { 0x15, 0x15, 0x2a }, { 0x15, 0x3f, 0x00 }, { 0x15, 0x3f, 0x2a }, - { 0x3f, 0x15, 0x00 }, { 0x3f, 0x15, 0x2a }, { 0x3f, 0x3f, 0x00 }, { 0x3f, 0x3f, 0x2a }, - { 0x15, 0x15, 0x15 }, { 0x15, 0x15, 0x3f }, { 0x15, 0x3f, 0x15 }, { 0x15, 0x3f, 0x3f }, - { 0x3f, 0x15, 0x15 }, { 0x3f, 0x15, 0x3f }, { 0x3f, 0x3f, 0x15 }, { 0x3f, 0x3f, 0x3f }, + { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x2a }, { 0x00, 0x2a, 0x00 }, { 0x00, 0x2a, 0x2a }, + { 0x2a, 0x00, 0x00 }, { 0x2a, 0x00, 0x2a }, { 0x2a, 0x2a, 0x00 }, { 0x2a, 0x2a, 0x2a }, + { 0x00, 0x00, 0x15 }, { 0x00, 0x00, 0x3f }, { 0x00, 0x2a, 0x15 }, { 0x00, 0x2a, 0x3f }, + { 0x2a, 0x00, 0x15 }, { 0x2a, 0x00, 0x3f }, { 0x2a, 0x2a, 0x15 }, { 0x2a, 0x2a, 0x3f }, + { 0x00, 0x15, 0x00 }, { 0x00, 0x15, 0x2a }, { 0x00, 0x3f, 0x00 }, { 0x00, 0x3f, 0x2a }, + { 0x2a, 0x15, 0x00 }, { 0x2a, 0x15, 0x2a }, { 0x2a, 0x3f, 0x00 }, { 0x2a, 0x3f, 0x2a }, + { 0x00, 0x15, 0x15 }, { 0x00, 0x15, 0x3f }, { 0x00, 0x3f, 0x15 }, { 0x00, 0x3f, 0x3f }, + { 0x2a, 0x15, 0x15 }, { 0x2a, 0x15, 0x3f }, { 0x2a, 0x3f, 0x15 }, { 0x2a, 0x3f, 0x3f }, + { 0x15, 0x00, 0x00 }, { 0x15, 0x00, 0x2a }, { 0x15, 0x2a, 0x00 }, { 0x15, 0x2a, 0x2a }, + { 0x3f, 0x00, 0x00 }, { 0x3f, 0x00, 0x2a }, { 0x3f, 0x2a, 0x00 }, { 0x3f, 0x2a, 0x2a }, + { 0x15, 0x00, 0x15 }, { 0x15, 0x00, 0x3f }, { 0x15, 0x2a, 0x15 }, { 0x15, 0x2a, 0x3f }, + { 0x3f, 0x00, 0x15 }, { 0x3f, 0x00, 0x3f }, { 0x3f, 0x2a, 0x15 }, { 0x3f, 0x2a, 0x3f }, + { 0x15, 0x15, 0x00 }, { 0x15, 0x15, 0x2a }, { 0x15, 0x3f, 0x00 }, { 0x15, 0x3f, 0x2a }, + { 0x3f, 0x15, 0x00 }, { 0x3f, 0x15, 0x2a }, { 0x3f, 0x3f, 0x00 }, { 0x3f, 0x3f, 0x2a }, + { 0x15, 0x15, 0x15 }, { 0x15, 0x15, 0x3f }, { 0x15, 0x3f, 0x15 }, { 0x15, 0x3f, 0x3f }, + { 0x3f, 0x15, 0x15 }, { 0x3f, 0x15, 0x3f }, { 0x3f, 0x3f, 0x15 }, { 0x3f, 0x3f, 0x3f }, }; VBIOS_DAC_INFO DAC_EGA[] = { - { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x2a }, { 0x00, 0x2a, 0x00 }, { 0x00, 0x2a, 0x2a }, - { 0x2a, 0x00, 0x00 }, { 0x2a, 0x00, 0x2a }, { 0x2a, 0x2a, 0x00 }, { 0x2a, 0x2a, 0x2a }, - { 0x00, 0x00, 0x15 }, { 0x00, 0x00, 0x3f }, { 0x00, 0x2a, 0x15 }, { 0x00, 0x2a, 0x3f }, - { 0x2a, 0x00, 0x15 }, { 0x2a, 0x00, 0x3f }, { 0x2a, 0x2a, 0x15 }, { 0x2a, 0x2a, 0x3f }, - { 0x00, 0x15, 0x00 }, { 0x00, 0x15, 0x2a }, { 0x00, 0x3f, 0x00 }, { 0x00, 0x3f, 0x2a }, - { 0x2a, 0x15, 0x00 }, { 0x2a, 0x15, 0x2a }, { 0x2a, 0x3f, 0x00 }, { 0x2a, 0x3f, 0x2a }, - { 0x00, 0x15, 0x15 }, { 0x00, 0x15, 0x3f }, { 0x00, 0x3f, 0x15 }, { 0x00, 0x3f, 0x3f }, - { 0x2a, 0x15, 0x15 }, { 0x2a, 0x15, 0x3f }, { 0x2a, 0x3f, 0x15 }, { 0x2a, 0x3f, 0x3f }, - { 0x15, 0x00, 0x00 }, { 0x15, 0x00, 0x2a }, { 0x15, 0x2a, 0x00 }, { 0x15, 0x2a, 0x2a }, - { 0x3f, 0x00, 0x00 }, { 0x3f, 0x00, 0x2a }, { 0x3f, 0x2a, 0x00 }, { 0x3f, 0x2a, 0x2a }, - { 0x15, 0x00, 0x15 }, { 0x15, 0x00, 0x3f }, { 0x15, 0x2a, 0x15 }, { 0x15, 0x2a, 0x3f }, - { 0x3f, 0x00, 0x15 }, { 0x3f, 0x00, 0x3f }, { 0x3f, 0x2a, 0x15 }, { 0x3f, 0x2a, 0x3f }, - { 0x15, 0x15, 0x00 }, { 0x15, 0x15, 0x2a }, { 0x15, 0x3f, 0x00 }, { 0x15, 0x3f, 0x2a }, - { 0x3f, 0x15, 0x00 }, { 0x3f, 0x15, 0x2a }, { 0x3f, 0x3f, 0x00 }, { 0x3f, 0x3f, 0x2a }, - { 0x15, 0x15, 0x15 }, { 0x15, 0x15, 0x3f }, { 0x15, 0x3f, 0x15 }, { 0x15, 0x3f, 0x3f }, - { 0x3f, 0x15, 0x15 }, { 0x3f, 0x15, 0x3f }, { 0x3f, 0x3f, 0x15 }, { 0x3f, 0x3f, 0x3f }, + { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x2a }, { 0x00, 0x2a, 0x00 }, { 0x00, 0x2a, 0x2a }, + { 0x2a, 0x00, 0x00 }, { 0x2a, 0x00, 0x2a }, { 0x2a, 0x2a, 0x00 }, { 0x2a, 0x2a, 0x2a }, + { 0x00, 0x00, 0x15 }, { 0x00, 0x00, 0x3f }, { 0x00, 0x2a, 0x15 }, { 0x00, 0x2a, 0x3f }, + { 0x2a, 0x00, 0x15 }, { 0x2a, 0x00, 0x3f }, { 0x2a, 0x2a, 0x15 }, { 0x2a, 0x2a, 0x3f }, + { 0x00, 0x15, 0x00 }, { 0x00, 0x15, 0x2a }, { 0x00, 0x3f, 0x00 }, { 0x00, 0x3f, 0x2a }, + { 0x2a, 0x15, 0x00 }, { 0x2a, 0x15, 0x2a }, { 0x2a, 0x3f, 0x00 }, { 0x2a, 0x3f, 0x2a }, + { 0x00, 0x15, 0x15 }, { 0x00, 0x15, 0x3f }, { 0x00, 0x3f, 0x15 }, { 0x00, 0x3f, 0x3f }, + { 0x2a, 0x15, 0x15 }, { 0x2a, 0x15, 0x3f }, { 0x2a, 0x3f, 0x15 }, { 0x2a, 0x3f, 0x3f }, + { 0x15, 0x00, 0x00 }, { 0x15, 0x00, 0x2a }, { 0x15, 0x2a, 0x00 }, { 0x15, 0x2a, 0x2a }, + { 0x3f, 0x00, 0x00 }, { 0x3f, 0x00, 0x2a }, { 0x3f, 0x2a, 0x00 }, { 0x3f, 0x2a, 0x2a }, + { 0x15, 0x00, 0x15 }, { 0x15, 0x00, 0x3f }, { 0x15, 0x2a, 0x15 }, { 0x15, 0x2a, 0x3f }, + { 0x3f, 0x00, 0x15 }, { 0x3f, 0x00, 0x3f }, { 0x3f, 0x2a, 0x15 }, { 0x3f, 0x2a, 0x3f }, + { 0x15, 0x15, 0x00 }, { 0x15, 0x15, 0x2a }, { 0x15, 0x3f, 0x00 }, { 0x15, 0x3f, 0x2a }, + { 0x3f, 0x15, 0x00 }, { 0x3f, 0x15, 0x2a }, { 0x3f, 0x3f, 0x00 }, { 0x3f, 0x3f, 0x2a }, + { 0x15, 0x15, 0x15 }, { 0x15, 0x15, 0x3f }, { 0x15, 0x3f, 0x15 }, { 0x15, 0x3f, 0x3f }, + { 0x3f, 0x15, 0x15 }, { 0x3f, 0x15, 0x3f }, { 0x3f, 0x3f, 0x15 }, { 0x3f, 0x3f, 0x3f }, }; VBIOS_DAC_INFO DAC_VGA[] = { - { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x2a }, { 0x00, 0x2a, 0x00 }, { 0x00, 0x2a, 0x2a }, - { 0x2a, 0x00, 0x00 }, { 0x2a, 0x00, 0x2a }, { 0x2a, 0x15, 0x00 }, { 0x2a, 0x2a, 0x2a }, - { 0x15, 0x15, 0x15 }, { 0x15, 0x15, 0x3f }, { 0x15, 0x3f, 0x15 }, { 0x15, 0x3f, 0x3f }, - { 0x3f, 0x15, 0x15 }, { 0x3f, 0x15, 0x3f }, { 0x3f, 0x3f, 0x15 }, { 0x3f, 0x3f, 0x3f }, - { 0x00, 0x00, 0x00 }, { 0x05, 0x05, 0x05 }, { 0x08, 0x08, 0x08 }, { 0x0b, 0x0b, 0x0b }, - { 0x0e, 0x0e, 0x0e }, { 0x11, 0x11, 0x11 }, { 0x14, 0x14, 0x14 }, { 0x18, 0x18, 0x18 }, - { 0x1c, 0x1c, 0x1c }, { 0x20, 0x20, 0x20 }, { 0x24, 0x24, 0x24 }, { 0x28, 0x28, 0x28 }, - { 0x2d, 0x2d, 0x2d }, { 0x32, 0x32, 0x32 }, { 0x38, 0x38, 0x38 }, { 0x3f, 0x3f, 0x3f }, - { 0x00, 0x00, 0x3f }, { 0x10, 0x00, 0x3f }, { 0x1f, 0x00, 0x3f }, { 0x2f, 0x00, 0x3f }, - { 0x3f, 0x00, 0x3f }, { 0x3f, 0x00, 0x2f }, { 0x3f, 0x00, 0x1f }, { 0x3f, 0x00, 0x10 }, - { 0x3f, 0x00, 0x00 }, { 0x3f, 0x10, 0x00 }, { 0x3f, 0x1f, 0x00 }, { 0x3f, 0x2f, 0x00 }, - { 0x3f, 0x3f, 0x00 }, { 0x2f, 0x3f, 0x00 }, { 0x1f, 0x3f, 0x00 }, { 0x10, 0x3f, 0x00 }, - { 0x00, 0x3f, 0x00 }, { 0x00, 0x3f, 0x10 }, { 0x00, 0x3f, 0x1f }, { 0x00, 0x3f, 0x2f }, - { 0x00, 0x3f, 0x3f }, { 0x00, 0x2f, 0x3f }, { 0x00, 0x1f, 0x3f }, { 0x00, 0x10, 0x3f }, - { 0x1f, 0x1f, 0x3f }, { 0x27, 0x1f, 0x3f }, { 0x2f, 0x1f, 0x3f }, { 0x37, 0x1f, 0x3f }, - { 0x3f, 0x1f, 0x3f }, { 0x3f, 0x1f, 0x37 }, { 0x3f, 0x1f, 0x2f }, { 0x3f, 0x1f, 0x27 }, - { 0x3f, 0x1f, 0x1f }, { 0x3f, 0x27, 0x1f }, { 0x3f, 0x2f, 0x1f }, { 0x3f, 0x37, 0x1f }, - { 0x3f, 0x3f, 0x1f }, { 0x37, 0x3f, 0x1f }, { 0x2f, 0x3f, 0x1f }, { 0x27, 0x3f, 0x1f }, - { 0x1f, 0x3f, 0x1f }, { 0x1f, 0x3f, 0x27 }, { 0x1f, 0x3f, 0x2f }, { 0x1f, 0x3f, 0x37 }, - { 0x1f, 0x3f, 0x3f }, { 0x1f, 0x37, 0x3f }, { 0x1f, 0x2f, 0x3f }, { 0x1f, 0x27, 0x3f }, - { 0x2d, 0x2d, 0x3f }, { 0x31, 0x2d, 0x3f }, { 0x36, 0x2d, 0x3f }, { 0x3a, 0x2d, 0x3f }, - { 0x3f, 0x2d, 0x3f }, { 0x3f, 0x2d, 0x3a }, { 0x3f, 0x2d, 0x36 }, { 0x3f, 0x2d, 0x31 }, - { 0x3f, 0x2d, 0x2d }, { 0x3f, 0x31, 0x2d }, { 0x3f, 0x36, 0x2d }, { 0x3f, 0x3a, 0x2d }, - { 0x3f, 0x3f, 0x2d }, { 0x3a, 0x3f, 0x2d }, { 0x36, 0x3f, 0x2d }, { 0x31, 0x3f, 0x2d }, - { 0x2d, 0x3f, 0x2d }, { 0x2d, 0x3f, 0x31 }, { 0x2d, 0x3f, 0x36 }, { 0x2d, 0x3f, 0x3a }, - { 0x2d, 0x3f, 0x3f }, { 0x2d, 0x3a, 0x3f }, { 0x2d, 0x36, 0x3f }, { 0x2d, 0x31, 0x3f }, - { 0x00, 0x00, 0x1c }, { 0x07, 0x00, 0x1c }, { 0x0e, 0x00, 0x1c }, { 0x15, 0x00, 0x1c }, - { 0x1c, 0x00, 0x1c }, { 0x1c, 0x00, 0x15 }, { 0x1c, 0x00, 0x0e }, { 0x1c, 0x00, 0x07 }, - { 0x1c, 0x00, 0x00 }, { 0x1c, 0x07, 0x00 }, { 0x1c, 0x0e, 0x00 }, { 0x1c, 0x15, 0x00 }, - { 0x1c, 0x1c, 0x00 }, { 0x15, 0x1c, 0x00 }, { 0x0e, 0x1c, 0x00 }, { 0x07, 0x1c, 0x00 }, - { 0x00, 0x1c, 0x00 }, { 0x00, 0x1c, 0x07 }, { 0x00, 0x1c, 0x0e }, { 0x00, 0x1c, 0x15 }, - { 0x00, 0x1c, 0x1c }, { 0x00, 0x15, 0x1c }, { 0x00, 0x0e, 0x1c }, { 0x00, 0x07, 0x1c }, - { 0x0e, 0x0e, 0x1c }, { 0x11, 0x0e, 0x1c }, { 0x15, 0x0e, 0x1c }, { 0x18, 0x0e, 0x1c }, - { 0x1c, 0x0e, 0x1c }, { 0x1c, 0x0e, 0x18 }, { 0x1c, 0x0e, 0x15 }, { 0x1c, 0x0e, 0x11 }, - { 0x1c, 0x0e, 0x0e }, { 0x1c, 0x11, 0x0e }, { 0x1c, 0x15, 0x0e }, { 0x1c, 0x18, 0x0e }, - { 0x1c, 0x1c, 0x0e }, { 0x18, 0x1c, 0x0e }, { 0x15, 0x1c, 0x0e }, { 0x11, 0x1c, 0x0e }, - { 0x0e, 0x1c, 0x0e }, { 0x0e, 0x1c, 0x11 }, { 0x0e, 0x1c, 0x15 }, { 0x0e, 0x1c, 0x18 }, - { 0x0e, 0x1c, 0x1c }, { 0x0e, 0x18, 0x1c }, { 0x0e, 0x15, 0x1c }, { 0x0e, 0x11, 0x1c }, - { 0x14, 0x14, 0x1c }, { 0x16, 0x14, 0x1c }, { 0x18, 0x14, 0x1c }, { 0x1a, 0x14, 0x1c }, - { 0x1c, 0x14, 0x1c }, { 0x1c, 0x14, 0x1a }, { 0x1c, 0x14, 0x18 }, { 0x1c, 0x14, 0x16 }, - { 0x1c, 0x14, 0x14 }, { 0x1c, 0x16, 0x14 }, { 0x1c, 0x18, 0x14 }, { 0x1c, 0x1a, 0x14 }, - { 0x1c, 0x1c, 0x14 }, { 0x1a, 0x1c, 0x14 }, { 0x18, 0x1c, 0x14 }, { 0x16, 0x1c, 0x14 }, - { 0x14, 0x1c, 0x14 }, { 0x14, 0x1c, 0x16 }, { 0x14, 0x1c, 0x18 }, { 0x14, 0x1c, 0x1a }, - { 0x14, 0x1c, 0x1c }, { 0x14, 0x1a, 0x1c }, { 0x14, 0x18, 0x1c }, { 0x14, 0x16, 0x1c }, - { 0x00, 0x00, 0x10 }, { 0x04, 0x00, 0x10 }, { 0x08, 0x00, 0x10 }, { 0x0c, 0x00, 0x10 }, - { 0x10, 0x00, 0x10 }, { 0x10, 0x00, 0x0c }, { 0x10, 0x00, 0x08 }, { 0x10, 0x00, 0x04 }, - { 0x10, 0x00, 0x00 }, { 0x10, 0x04, 0x00 }, { 0x10, 0x08, 0x00 }, { 0x10, 0x0c, 0x00 }, - { 0x10, 0x10, 0x00 }, { 0x0c, 0x10, 0x00 }, { 0x08, 0x10, 0x00 }, { 0x04, 0x10, 0x00 }, - { 0x00, 0x10, 0x00 }, { 0x00, 0x10, 0x04 }, { 0x00, 0x10, 0x08 }, { 0x00, 0x10, 0x0c }, - { 0x00, 0x10, 0x10 }, { 0x00, 0x0c, 0x10 }, { 0x00, 0x08, 0x10 }, { 0x00, 0x04, 0x10 }, - { 0x08, 0x08, 0x10 }, { 0x0a, 0x08, 0x10 }, { 0x0c, 0x08, 0x10 }, { 0x0e, 0x08, 0x10 }, - { 0x10, 0x08, 0x10 }, { 0x10, 0x08, 0x0e }, { 0x10, 0x08, 0x0c }, { 0x10, 0x08, 0x0a }, - { 0x10, 0x08, 0x08 }, { 0x10, 0x0a, 0x08 }, { 0x10, 0x0c, 0x08 }, { 0x10, 0x0e, 0x08 }, - { 0x10, 0x10, 0x08 }, { 0x0e, 0x10, 0x08 }, { 0x0c, 0x10, 0x08 }, { 0x0a, 0x10, 0x08 }, - { 0x08, 0x10, 0x08 }, { 0x08, 0x10, 0x0a }, { 0x08, 0x10, 0x0c }, { 0x08, 0x10, 0x0e }, - { 0x08, 0x10, 0x10 }, { 0x08, 0x0e, 0x10 }, { 0x08, 0x0c, 0x10 }, { 0x08, 0x0a, 0x10 }, - { 0x0b, 0x0b, 0x10 }, { 0x0c, 0x0b, 0x10 }, { 0x0d, 0x0b, 0x10 }, { 0x0f, 0x0b, 0x10 }, - { 0x10, 0x0b, 0x10 }, { 0x10, 0x0b, 0x0f }, { 0x10, 0x0b, 0x0d }, { 0x10, 0x0b, 0x0c }, - { 0x10, 0x0b, 0x0b }, { 0x10, 0x0c, 0x0b }, { 0x10, 0x0d, 0x0b }, { 0x10, 0x0f, 0x0b }, - { 0x10, 0x10, 0x0b }, { 0x0f, 0x10, 0x0b }, { 0x0d, 0x10, 0x0b }, { 0x0c, 0x10, 0x0b }, - { 0x0b, 0x10, 0x0b }, { 0x0b, 0x10, 0x0c }, { 0x0b, 0x10, 0x0d }, { 0x0b, 0x10, 0x0f }, - { 0x0b, 0x10, 0x10 }, { 0x0b, 0x0f, 0x10 }, { 0x0b, 0x0d, 0x10 }, { 0x0b, 0x0c, 0x10 }, - { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x2a }, { 0x00, 0x2a, 0x00 }, { 0x00, 0x2a, 0x2a }, + { 0x2a, 0x00, 0x00 }, { 0x2a, 0x00, 0x2a }, { 0x2a, 0x15, 0x00 }, { 0x2a, 0x2a, 0x2a }, + { 0x15, 0x15, 0x15 }, { 0x15, 0x15, 0x3f }, { 0x15, 0x3f, 0x15 }, { 0x15, 0x3f, 0x3f }, + { 0x3f, 0x15, 0x15 }, { 0x3f, 0x15, 0x3f }, { 0x3f, 0x3f, 0x15 }, { 0x3f, 0x3f, 0x3f }, + { 0x00, 0x00, 0x00 }, { 0x05, 0x05, 0x05 }, { 0x08, 0x08, 0x08 }, { 0x0b, 0x0b, 0x0b }, + { 0x0e, 0x0e, 0x0e }, { 0x11, 0x11, 0x11 }, { 0x14, 0x14, 0x14 }, { 0x18, 0x18, 0x18 }, + { 0x1c, 0x1c, 0x1c }, { 0x20, 0x20, 0x20 }, { 0x24, 0x24, 0x24 }, { 0x28, 0x28, 0x28 }, + { 0x2d, 0x2d, 0x2d }, { 0x32, 0x32, 0x32 }, { 0x38, 0x38, 0x38 }, { 0x3f, 0x3f, 0x3f }, + { 0x00, 0x00, 0x3f }, { 0x10, 0x00, 0x3f }, { 0x1f, 0x00, 0x3f }, { 0x2f, 0x00, 0x3f }, + { 0x3f, 0x00, 0x3f }, { 0x3f, 0x00, 0x2f }, { 0x3f, 0x00, 0x1f }, { 0x3f, 0x00, 0x10 }, + { 0x3f, 0x00, 0x00 }, { 0x3f, 0x10, 0x00 }, { 0x3f, 0x1f, 0x00 }, { 0x3f, 0x2f, 0x00 }, + { 0x3f, 0x3f, 0x00 }, { 0x2f, 0x3f, 0x00 }, { 0x1f, 0x3f, 0x00 }, { 0x10, 0x3f, 0x00 }, + { 0x00, 0x3f, 0x00 }, { 0x00, 0x3f, 0x10 }, { 0x00, 0x3f, 0x1f }, { 0x00, 0x3f, 0x2f }, + { 0x00, 0x3f, 0x3f }, { 0x00, 0x2f, 0x3f }, { 0x00, 0x1f, 0x3f }, { 0x00, 0x10, 0x3f }, + { 0x1f, 0x1f, 0x3f }, { 0x27, 0x1f, 0x3f }, { 0x2f, 0x1f, 0x3f }, { 0x37, 0x1f, 0x3f }, + { 0x3f, 0x1f, 0x3f }, { 0x3f, 0x1f, 0x37 }, { 0x3f, 0x1f, 0x2f }, { 0x3f, 0x1f, 0x27 }, + { 0x3f, 0x1f, 0x1f }, { 0x3f, 0x27, 0x1f }, { 0x3f, 0x2f, 0x1f }, { 0x3f, 0x37, 0x1f }, + { 0x3f, 0x3f, 0x1f }, { 0x37, 0x3f, 0x1f }, { 0x2f, 0x3f, 0x1f }, { 0x27, 0x3f, 0x1f }, + { 0x1f, 0x3f, 0x1f }, { 0x1f, 0x3f, 0x27 }, { 0x1f, 0x3f, 0x2f }, { 0x1f, 0x3f, 0x37 }, + { 0x1f, 0x3f, 0x3f }, { 0x1f, 0x37, 0x3f }, { 0x1f, 0x2f, 0x3f }, { 0x1f, 0x27, 0x3f }, + { 0x2d, 0x2d, 0x3f }, { 0x31, 0x2d, 0x3f }, { 0x36, 0x2d, 0x3f }, { 0x3a, 0x2d, 0x3f }, + { 0x3f, 0x2d, 0x3f }, { 0x3f, 0x2d, 0x3a }, { 0x3f, 0x2d, 0x36 }, { 0x3f, 0x2d, 0x31 }, + { 0x3f, 0x2d, 0x2d }, { 0x3f, 0x31, 0x2d }, { 0x3f, 0x36, 0x2d }, { 0x3f, 0x3a, 0x2d }, + { 0x3f, 0x3f, 0x2d }, { 0x3a, 0x3f, 0x2d }, { 0x36, 0x3f, 0x2d }, { 0x31, 0x3f, 0x2d }, + { 0x2d, 0x3f, 0x2d }, { 0x2d, 0x3f, 0x31 }, { 0x2d, 0x3f, 0x36 }, { 0x2d, 0x3f, 0x3a }, + { 0x2d, 0x3f, 0x3f }, { 0x2d, 0x3a, 0x3f }, { 0x2d, 0x36, 0x3f }, { 0x2d, 0x31, 0x3f }, + { 0x00, 0x00, 0x1c }, { 0x07, 0x00, 0x1c }, { 0x0e, 0x00, 0x1c }, { 0x15, 0x00, 0x1c }, + { 0x1c, 0x00, 0x1c }, { 0x1c, 0x00, 0x15 }, { 0x1c, 0x00, 0x0e }, { 0x1c, 0x00, 0x07 }, + { 0x1c, 0x00, 0x00 }, { 0x1c, 0x07, 0x00 }, { 0x1c, 0x0e, 0x00 }, { 0x1c, 0x15, 0x00 }, + { 0x1c, 0x1c, 0x00 }, { 0x15, 0x1c, 0x00 }, { 0x0e, 0x1c, 0x00 }, { 0x07, 0x1c, 0x00 }, + { 0x00, 0x1c, 0x00 }, { 0x00, 0x1c, 0x07 }, { 0x00, 0x1c, 0x0e }, { 0x00, 0x1c, 0x15 }, + { 0x00, 0x1c, 0x1c }, { 0x00, 0x15, 0x1c }, { 0x00, 0x0e, 0x1c }, { 0x00, 0x07, 0x1c }, + { 0x0e, 0x0e, 0x1c }, { 0x11, 0x0e, 0x1c }, { 0x15, 0x0e, 0x1c }, { 0x18, 0x0e, 0x1c }, + { 0x1c, 0x0e, 0x1c }, { 0x1c, 0x0e, 0x18 }, { 0x1c, 0x0e, 0x15 }, { 0x1c, 0x0e, 0x11 }, + { 0x1c, 0x0e, 0x0e }, { 0x1c, 0x11, 0x0e }, { 0x1c, 0x15, 0x0e }, { 0x1c, 0x18, 0x0e }, + { 0x1c, 0x1c, 0x0e }, { 0x18, 0x1c, 0x0e }, { 0x15, 0x1c, 0x0e }, { 0x11, 0x1c, 0x0e }, + { 0x0e, 0x1c, 0x0e }, { 0x0e, 0x1c, 0x11 }, { 0x0e, 0x1c, 0x15 }, { 0x0e, 0x1c, 0x18 }, + { 0x0e, 0x1c, 0x1c }, { 0x0e, 0x18, 0x1c }, { 0x0e, 0x15, 0x1c }, { 0x0e, 0x11, 0x1c }, + { 0x14, 0x14, 0x1c }, { 0x16, 0x14, 0x1c }, { 0x18, 0x14, 0x1c }, { 0x1a, 0x14, 0x1c }, + { 0x1c, 0x14, 0x1c }, { 0x1c, 0x14, 0x1a }, { 0x1c, 0x14, 0x18 }, { 0x1c, 0x14, 0x16 }, + { 0x1c, 0x14, 0x14 }, { 0x1c, 0x16, 0x14 }, { 0x1c, 0x18, 0x14 }, { 0x1c, 0x1a, 0x14 }, + { 0x1c, 0x1c, 0x14 }, { 0x1a, 0x1c, 0x14 }, { 0x18, 0x1c, 0x14 }, { 0x16, 0x1c, 0x14 }, + { 0x14, 0x1c, 0x14 }, { 0x14, 0x1c, 0x16 }, { 0x14, 0x1c, 0x18 }, { 0x14, 0x1c, 0x1a }, + { 0x14, 0x1c, 0x1c }, { 0x14, 0x1a, 0x1c }, { 0x14, 0x18, 0x1c }, { 0x14, 0x16, 0x1c }, + { 0x00, 0x00, 0x10 }, { 0x04, 0x00, 0x10 }, { 0x08, 0x00, 0x10 }, { 0x0c, 0x00, 0x10 }, + { 0x10, 0x00, 0x10 }, { 0x10, 0x00, 0x0c }, { 0x10, 0x00, 0x08 }, { 0x10, 0x00, 0x04 }, + { 0x10, 0x00, 0x00 }, { 0x10, 0x04, 0x00 }, { 0x10, 0x08, 0x00 }, { 0x10, 0x0c, 0x00 }, + { 0x10, 0x10, 0x00 }, { 0x0c, 0x10, 0x00 }, { 0x08, 0x10, 0x00 }, { 0x04, 0x10, 0x00 }, + { 0x00, 0x10, 0x00 }, { 0x00, 0x10, 0x04 }, { 0x00, 0x10, 0x08 }, { 0x00, 0x10, 0x0c }, + { 0x00, 0x10, 0x10 }, { 0x00, 0x0c, 0x10 }, { 0x00, 0x08, 0x10 }, { 0x00, 0x04, 0x10 }, + { 0x08, 0x08, 0x10 }, { 0x0a, 0x08, 0x10 }, { 0x0c, 0x08, 0x10 }, { 0x0e, 0x08, 0x10 }, + { 0x10, 0x08, 0x10 }, { 0x10, 0x08, 0x0e }, { 0x10, 0x08, 0x0c }, { 0x10, 0x08, 0x0a }, + { 0x10, 0x08, 0x08 }, { 0x10, 0x0a, 0x08 }, { 0x10, 0x0c, 0x08 }, { 0x10, 0x0e, 0x08 }, + { 0x10, 0x10, 0x08 }, { 0x0e, 0x10, 0x08 }, { 0x0c, 0x10, 0x08 }, { 0x0a, 0x10, 0x08 }, + { 0x08, 0x10, 0x08 }, { 0x08, 0x10, 0x0a }, { 0x08, 0x10, 0x0c }, { 0x08, 0x10, 0x0e }, + { 0x08, 0x10, 0x10 }, { 0x08, 0x0e, 0x10 }, { 0x08, 0x0c, 0x10 }, { 0x08, 0x0a, 0x10 }, + { 0x0b, 0x0b, 0x10 }, { 0x0c, 0x0b, 0x10 }, { 0x0d, 0x0b, 0x10 }, { 0x0f, 0x0b, 0x10 }, + { 0x10, 0x0b, 0x10 }, { 0x10, 0x0b, 0x0f }, { 0x10, 0x0b, 0x0d }, { 0x10, 0x0b, 0x0c }, + { 0x10, 0x0b, 0x0b }, { 0x10, 0x0c, 0x0b }, { 0x10, 0x0d, 0x0b }, { 0x10, 0x0f, 0x0b }, + { 0x10, 0x10, 0x0b }, { 0x0f, 0x10, 0x0b }, { 0x0d, 0x10, 0x0b }, { 0x0c, 0x10, 0x0b }, + { 0x0b, 0x10, 0x0b }, { 0x0b, 0x10, 0x0c }, { 0x0b, 0x10, 0x0d }, { 0x0b, 0x10, 0x0f }, + { 0x0b, 0x10, 0x10 }, { 0x0b, 0x0f, 0x10 }, { 0x0b, 0x0d, 0x10 }, { 0x0b, 0x0c, 0x10 }, + { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, }; /* extern. function */ @@ -441,85 +441,85 @@ Bool ASTSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { ASTRecPtr pAST; - VBIOS_MODE_INFO vgamodeinfo; - + VBIOS_MODE_INFO vgamodeinfo; + pAST = ASTPTR(pScrn); - /* pre set mode */ - bGetAST1000VGAModeInfo(pScrn, mode, &vgamodeinfo); - + /* pre set mode */ + bGetAST1000VGAModeInfo(pScrn, mode, &vgamodeinfo); + /* set mode */ if (pAST->jChipType == AST1180) { bInitAST1180(pScrn); - + bSetAST1180CRTCReg(pScrn, mode, &vgamodeinfo); bSetAST1180OffsetReg(pScrn, mode, &vgamodeinfo); bSetAST1180DCLKReg(pScrn, mode, &vgamodeinfo); bSetAST1180ExtReg(pScrn, mode, &vgamodeinfo); - + vInitChontelReg(pScrn, mode, &vgamodeinfo); } else { vASTOpenKey(pScrn); bASTRegInit(pScrn); - - vSetStdReg(pScrn, mode, &vgamodeinfo); + + vSetStdReg(pScrn, mode, &vgamodeinfo); vSetCRTCReg(pScrn, mode, &vgamodeinfo); - vSetOffsetReg(pScrn, mode, &vgamodeinfo); + vSetOffsetReg(pScrn, mode, &vgamodeinfo); vSetDCLKReg(pScrn, mode, &vgamodeinfo); vSetExtReg(pScrn, mode, &vgamodeinfo); vSetSyncReg(pScrn, mode, &vgamodeinfo); - bSetDACReg(pScrn, mode, &vgamodeinfo); + bSetDACReg(pScrn, mode, &vgamodeinfo); } - + /* post set mode */ #ifdef Accel_2D if (!pAST->noAccel) { if (!bEnable2D(pScrn, pAST)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"Enable 2D failed\n"); - pAST->noAccel = TRUE; - } + xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"Enable 2D failed\n"); + pAST->noAccel = TRUE; + } } -#endif +#endif #ifdef HWC if (!pAST->noHWC) { if (!bInitHWC(pScrn, pAST)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"Init HWC failed\n"); - pAST->noHWC = TRUE; - } + xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"Init HWC failed\n"); + pAST->noHWC = TRUE; + } } -#endif +#endif vAST1000DisplayOn(pAST); - - return (TRUE); + + return (TRUE); } Bool bGetAST1000VGAModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo) { - ASTRecPtr pAST; + ASTRecPtr pAST; ULONG ulModeID, ulColorIndex, ulRefreshRate, ulRefreshRateIndex = 0; ULONG ulHBorder, ulVBorder; - + pAST = ASTPTR(pScrn); - + switch (pScrn->bitsPerPixel) { case 8: - pVGAModeInfo->pStdTableEntry = (PVBIOS_STDTABLE_STRUCT) &StdTable[VGAModeIndex]; - ulColorIndex = VGAModeIndex-1; - break; + pVGAModeInfo->pStdTableEntry = (PVBIOS_STDTABLE_STRUCT) &StdTable[VGAModeIndex]; + ulColorIndex = VGAModeIndex-1; + break; case 16: pVGAModeInfo->pStdTableEntry = (PVBIOS_STDTABLE_STRUCT) &StdTable[HiCModeIndex]; - ulColorIndex = HiCModeIndex; + ulColorIndex = HiCModeIndex; break; - case 24: + case 24: case 32: - pVGAModeInfo->pStdTableEntry = (PVBIOS_STDTABLE_STRUCT) &StdTable[TrueCModeIndex]; - ulColorIndex = TrueCModeIndex; - break; + pVGAModeInfo->pStdTableEntry = (PVBIOS_STDTABLE_STRUCT) &StdTable[TrueCModeIndex]; + ulColorIndex = TrueCModeIndex; + break; default: return (FALSE); } @@ -537,19 +537,19 @@ Bool bGetAST1000VGAModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_ break; case 1280: if (mode->CrtcVDisplay == 800) - pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1280x800Table[ulRefreshRateIndex]; + pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1280x800Table[ulRefreshRateIndex]; else - pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1280x1024Table[ulRefreshRateIndex]; + pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1280x1024Table[ulRefreshRateIndex]; break; case 1360: pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1360x768Table[ulRefreshRateIndex]; - break; + break; case 1440: pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1440x900Table[ulRefreshRateIndex]; - break; + break; case 1600: if (mode->CrtcVDisplay == 900) - pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1600x900Table[ulRefreshRateIndex]; + pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1600x900Table[ulRefreshRateIndex]; else pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1600x1200Table[ulRefreshRateIndex]; break; @@ -558,26 +558,26 @@ Bool bGetAST1000VGAModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_ break; case 1920: if (mode->CrtcVDisplay == 1080) - pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1920x1080Table[ulRefreshRateIndex]; + pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1920x1080Table[ulRefreshRateIndex]; else pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1920x1200Table[ulRefreshRateIndex]; - break; + break; default: return (FALSE); } /* Get Proper Mode Index */ - ulRefreshRate = (mode->Clock * 1000) / (mode->HTotal * mode->VTotal); - + ulRefreshRate = (mode->Clock * 1000) / (mode->HTotal * mode->VTotal); + while (pVGAModeInfo->pEnhTableEntry->ulRefreshRate < ulRefreshRate) { pVGAModeInfo->pEnhTableEntry++; - if ((pVGAModeInfo->pEnhTableEntry->ulRefreshRate > ulRefreshRate) || - (pVGAModeInfo->pEnhTableEntry->ulRefreshRate == 0xFF)) + if ((pVGAModeInfo->pEnhTableEntry->ulRefreshRate > ulRefreshRate) || + (pVGAModeInfo->pEnhTableEntry->ulRefreshRate == 0xFF)) { pVGAModeInfo->pEnhTableEntry--; - break; - } + break; + } } /* parsing for wide scrren reduced blank mode */ @@ -588,12 +588,12 @@ Bool bGetAST1000VGAModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_ } /* Update mode CRTC info */ - ulHBorder = (pVGAModeInfo->pEnhTableEntry->Flags & HBorder) ? 8:0; - ulVBorder = (pVGAModeInfo->pEnhTableEntry->Flags & VBorder) ? 8: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); - mode->CrtcHBlankEnd = (int) (pVGAModeInfo->pEnhTableEntry->HT - ulHBorder); + mode->CrtcHBlankEnd = (int) (pVGAModeInfo->pEnhTableEntry->HT - ulHBorder); mode->CrtcHSyncStart = (int) (pVGAModeInfo->pEnhTableEntry->HDE + ulHBorder + pVGAModeInfo->pEnhTableEntry->HFP); mode->CrtcHSyncEnd = (int) (pVGAModeInfo->pEnhTableEntry->HDE + ulHBorder @@ -602,55 +602,55 @@ Bool bGetAST1000VGAModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_ mode->CrtcVTotal = (int) pVGAModeInfo->pEnhTableEntry->VT; mode->CrtcVBlankStart = (int) (pVGAModeInfo->pEnhTableEntry->VDE + ulVBorder); - mode->CrtcVBlankEnd = (int) (pVGAModeInfo->pEnhTableEntry->VT - ulVBorder); + mode->CrtcVBlankEnd = (int) (pVGAModeInfo->pEnhTableEntry->VT - ulVBorder); mode->CrtcVSyncStart = (int) (pVGAModeInfo->pEnhTableEntry->VDE + ulVBorder + pVGAModeInfo->pEnhTableEntry->VFP); mode->CrtcVSyncEnd = (int) (pVGAModeInfo->pEnhTableEntry->VDE + ulVBorder + pVGAModeInfo->pEnhTableEntry->VFP + pVGAModeInfo->pEnhTableEntry->VSYNC); - + /* Write mode info to scratch */ ulRefreshRateIndex = pVGAModeInfo->pEnhTableEntry->ulRefreshRateIndex; ulModeID = pVGAModeInfo->pEnhTableEntry->ulModeID; if (pAST->jChipType == AST1180) { - /* TODO */ + /* TODO */ } else - { + { SetIndexReg(CRTC_PORT, 0x8C, (UCHAR) ((ulColorIndex & 0x0F) << 4)); SetIndexReg(CRTC_PORT, 0x8D, (UCHAR) (ulRefreshRateIndex & 0xFF)); SetIndexReg(CRTC_PORT, 0x8E, (UCHAR) (ulModeID & 0xFF)); - + /* NewModeInfo */ SetIndexReg(CRTC_PORT, 0x91, 0x00); /* clear signature */ if (pVGAModeInfo->pEnhTableEntry->Flags & NewModeInfo) { SetIndexReg(CRTC_PORT, 0x91, 0xA8); /* signature */ SetIndexReg(CRTC_PORT, 0x92, (UCHAR) (pScrn->bitsPerPixel) ); - SetIndexReg(CRTC_PORT, 0x93, (UCHAR) (mode->Clock / 1000) ); + SetIndexReg(CRTC_PORT, 0x93, (UCHAR) (mode->Clock / 1000) ); SetIndexReg(CRTC_PORT, 0x94, (UCHAR) (mode->CrtcHDisplay) ); SetIndexReg(CRTC_PORT, 0x95, (UCHAR) (mode->CrtcHDisplay >> 8) ); /* color depth */ SetIndexReg(CRTC_PORT, 0x96, (UCHAR) (mode->CrtcVDisplay) ); SetIndexReg(CRTC_PORT, 0x97, (UCHAR) (mode->CrtcVDisplay >> 8) ); /* color depth */ } - } - + } + return (TRUE); } - + void vSetStdReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo) { - + PVBIOS_STDTABLE_STRUCT pStdModePtr; - ASTRecPtr pAST; + ASTRecPtr pAST; ULONG i; - UCHAR jReg; - + UCHAR jReg; + pStdModePtr = pVGAModeInfo->pStdTableEntry; - pAST = ASTPTR(pScrn); - + pAST = ASTPTR(pScrn); + /* Set Misc */ jReg = pStdModePtr->MISC; SetReg(MISC_PORT_WRITE,jReg); @@ -661,15 +661,15 @@ void vSetStdReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAMod { jReg = pStdModePtr->SEQ[i]; if (!i) (jReg |= 0x20); /* display off */ - SetIndexReg(SEQ_PORT,(UCHAR) (i+1), jReg); + SetIndexReg(SEQ_PORT,(UCHAR) (i+1), jReg); } - + /* Set CRTC */ SetIndexRegMask(CRTC_PORT,0x11, 0x7F, 0x00); for (i=0; i<25; i++) { jReg = pStdModePtr->CRTC[i]; - SetIndexReg(CRTC_PORT,(UCHAR) i, jReg); + SetIndexReg(CRTC_PORT,(UCHAR) i, jReg); } /* Set AR */ @@ -677,167 +677,167 @@ void vSetStdReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAMod for (i=0; i<20; i++) { jReg = pStdModePtr->AR[i]; - SetReg(AR_PORT_WRITE, (UCHAR) i); - SetReg(AR_PORT_WRITE, jReg); - } - SetReg(AR_PORT_WRITE, 0x14); - SetReg(AR_PORT_WRITE, 0x00); - + SetReg(AR_PORT_WRITE, (UCHAR) i); + SetReg(AR_PORT_WRITE, jReg); + } + SetReg(AR_PORT_WRITE, 0x14); + SetReg(AR_PORT_WRITE, 0x00); + jReg = GetReg(INPUT_STATUS1_READ); SetReg (AR_PORT_WRITE, 0x20); /* set POS */ - + /* Set GR */ for (i=0; i<9; i++) { jReg = pStdModePtr->GR[i]; - SetIndexReg(GR_PORT,(UCHAR) i, jReg); - - } - - + SetIndexReg(GR_PORT,(UCHAR) i, jReg); + + } + + } void vSetCRTCReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo) { - ASTRecPtr pAST; - USHORT usTemp; + ASTRecPtr pAST; + USHORT usTemp; UCHAR jReg05, jReg07, jReg09, jRegAC, jRegAD, jRegAE; pAST = ASTPTR(pScrn); jReg05 = jReg07 = jReg09 = jRegAC = jRegAD = jRegAE = 0; - + /* unlock CRTC */ - SetIndexRegMask(CRTC_PORT,0x11, 0x7F, 0x00); - + SetIndexRegMask(CRTC_PORT,0x11, 0x7F, 0x00); + /* Horizontal Timing Programming */ usTemp = (mode->CrtcHTotal >> 3) - 5; if (usTemp & 0x100) jRegAC |= 0x01; /* HT D[8] */ SetIndexRegMask(CRTC_PORT,0x00, 0x00, (UCHAR) usTemp); usTemp = (mode->CrtcHDisplay >> 3) - 1; if (usTemp & 0x100) jRegAC |= 0x04; /* HDE D[8] */ - SetIndexRegMask(CRTC_PORT,0x01, 0x00, (UCHAR) usTemp); + SetIndexRegMask(CRTC_PORT,0x01, 0x00, (UCHAR) usTemp); usTemp = (mode->CrtcHBlankStart >> 3) - 1; if (usTemp & 0x100) jRegAC |= 0x10; /* HBS D[8] */ - SetIndexRegMask(CRTC_PORT,0x02, 0x00, (UCHAR) usTemp); + SetIndexRegMask(CRTC_PORT,0x02, 0x00, (UCHAR) usTemp); usTemp = ((mode->CrtcHBlankEnd >> 3) - 1) & 0x7F; if (usTemp & 0x20) jReg05 |= 0x80; /* HBE D[5] */ - if (usTemp & 0x40) jRegAD |= 0x01; /* HBE D[6] */ + if (usTemp & 0x40) jRegAD |= 0x01; /* HBE D[6] */ SetIndexRegMask(CRTC_PORT,0x03, 0xE0, (UCHAR) (usTemp & 0x1F)); usTemp = (mode->CrtcHSyncStart >> 3 ) - 1; - if (usTemp & 0x100) jRegAC |= 0x40; /* HRS D[5] */ - SetIndexRegMask(CRTC_PORT,0x04, 0x00, (UCHAR) (usTemp)); + if (usTemp & 0x100) jRegAC |= 0x40; /* HRS D[5] */ + SetIndexRegMask(CRTC_PORT,0x04, 0x00, (UCHAR) (usTemp)); usTemp = ((mode->CrtcHSyncEnd >> 3 ) - 1) & 0x3F; - if (usTemp & 0x20) jRegAD |= 0x04; /* HRE D[5] */ + if (usTemp & 0x20) jRegAD |= 0x04; /* HRE D[5] */ SetIndexRegMask(CRTC_PORT,0x05, 0x60, (UCHAR) ((usTemp & 0x1F) | jReg05)); - - SetIndexRegMask(CRTC_PORT,0xAC, 0x00, (UCHAR) jRegAC); - SetIndexRegMask(CRTC_PORT,0xAD, 0x00, (UCHAR) jRegAD); - + + SetIndexRegMask(CRTC_PORT,0xAC, 0x00, (UCHAR) jRegAC); + SetIndexRegMask(CRTC_PORT,0xAD, 0x00, (UCHAR) jRegAD); + /* Vetical Timing Programming */ usTemp = (mode->CrtcVTotal) - 2; if (usTemp & 0x100) jReg07 |= 0x01; /* VT D[8] */ - if (usTemp & 0x200) jReg07 |= 0x20; - if (usTemp & 0x400) jRegAE |= 0x01; /* VT D[10] */ - SetIndexRegMask(CRTC_PORT,0x06, 0x00, (UCHAR) usTemp); + if (usTemp & 0x200) jReg07 |= 0x20; + if (usTemp & 0x400) jRegAE |= 0x01; /* VT D[10] */ + SetIndexRegMask(CRTC_PORT,0x06, 0x00, (UCHAR) usTemp); usTemp = (mode->CrtcVSyncStart) - 1; if (usTemp & 0x100) jReg07 |= 0x04; /* VRS D[8] */ if (usTemp & 0x200) jReg07 |= 0x80; /* VRS D[9] */ - if (usTemp & 0x400) jRegAE |= 0x08; /* VRS D[10] */ - SetIndexRegMask(CRTC_PORT,0x10, 0x00, (UCHAR) usTemp); + if (usTemp & 0x400) jRegAE |= 0x08; /* VRS D[10] */ + SetIndexRegMask(CRTC_PORT,0x10, 0x00, (UCHAR) usTemp); usTemp = ((mode->CrtcVSyncEnd) - 1) & 0x3F; if (usTemp & 0x10) jRegAE |= 0x20; /* VRE D[4] */ if (usTemp & 0x20) jRegAE |= 0x40; /* VRE D[5] */ - SetIndexRegMask(CRTC_PORT,0x11, 0x70, (UCHAR) (usTemp & 0x0F)); + SetIndexRegMask(CRTC_PORT,0x11, 0x70, (UCHAR) (usTemp & 0x0F)); usTemp = (mode->CrtcVDisplay) - 1; if (usTemp & 0x100) jReg07 |= 0x02; /* VDE D[8] */ if (usTemp & 0x200) jReg07 |= 0x40; /* VDE D[9] */ - if (usTemp & 0x400) jRegAE |= 0x02; /* VDE D[10] */ - SetIndexRegMask(CRTC_PORT,0x12, 0x00, (UCHAR) usTemp); + if (usTemp & 0x400) jRegAE |= 0x02; /* VDE D[10] */ + SetIndexRegMask(CRTC_PORT,0x12, 0x00, (UCHAR) usTemp); usTemp = (mode->CrtcVBlankStart) - 1; if (usTemp & 0x100) jReg07 |= 0x08; /* VBS D[8] */ if (usTemp & 0x200) jReg09 |= 0x20; /* VBS D[9] */ - if (usTemp & 0x400) jRegAE |= 0x04; /* VBS D[10] */ - SetIndexRegMask(CRTC_PORT,0x15, 0x00, (UCHAR) usTemp); + if (usTemp & 0x400) jRegAE |= 0x04; /* VBS D[10] */ + SetIndexRegMask(CRTC_PORT,0x15, 0x00, (UCHAR) usTemp); usTemp = (mode->CrtcVBlankEnd) - 1 ; if (usTemp & 0x100) jRegAE |= 0x10; /* VBE D[8] */ - SetIndexRegMask(CRTC_PORT,0x16, 0x00, (UCHAR) usTemp); + SetIndexRegMask(CRTC_PORT,0x16, 0x00, (UCHAR) usTemp); - SetIndexRegMask(CRTC_PORT,0x07, 0x00, (UCHAR) jReg07); - SetIndexRegMask(CRTC_PORT,0x09, 0xDF, (UCHAR) jReg09); + SetIndexRegMask(CRTC_PORT,0x07, 0x00, (UCHAR) jReg07); + SetIndexRegMask(CRTC_PORT,0x09, 0xDF, (UCHAR) jReg09); SetIndexRegMask(CRTC_PORT,0xAE, 0x00, (UCHAR) (jRegAE | 0x80)); /* disable line compare */ - + /* lock CRTC */ - SetIndexRegMask(CRTC_PORT,0x11, 0x7F, 0x80); - + SetIndexRegMask(CRTC_PORT,0x11, 0x7F, 0x80); + } void vSetOffsetReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo) { - ASTRecPtr pAST; - USHORT usOffset; + ASTRecPtr pAST; + USHORT usOffset; pAST = ASTPTR(pScrn); usOffset = pAST->VideoModeInfo.ScreenPitch >> 3; /* Unit: char */ - - SetIndexReg(CRTC_PORT,0x13, (UCHAR) (usOffset & 0xFF)); - SetIndexReg(CRTC_PORT,0xB0, (UCHAR) ((usOffset >> 8) & 0x3F)); - + + SetIndexReg(CRTC_PORT,0x13, (UCHAR) (usOffset & 0xFF)); + SetIndexReg(CRTC_PORT,0xB0, (UCHAR) ((usOffset >> 8) & 0x3F)); + } void vSetDCLKReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo) { PVBIOS_ENHTABLE_STRUCT pEnhModePtr; PVBIOS_DCLK_INFO pDCLKPtr; - ASTRecPtr pAST; - + ASTRecPtr pAST; + pAST = ASTPTR(pScrn); pEnhModePtr = pVGAModeInfo->pEnhTableEntry; - if ((pAST->jChipType == AST2100) || (pAST->jChipType == AST1100) || (pAST->jChipType == AST2200) || (pAST->jChipType == AST2150) || (pAST->jChipType == AST2300)) - pDCLKPtr = &DCLKTable_AST2100[pEnhModePtr->DCLKIndex]; + if ((pAST->jChipType == AST2100) || (pAST->jChipType == AST1100) || (pAST->jChipType == AST2200) || (pAST->jChipType == AST2150) || (pAST->jChipType == AST2300)) + pDCLKPtr = &DCLKTable_AST2100[pEnhModePtr->DCLKIndex]; else pDCLKPtr = &DCLKTable[pEnhModePtr->DCLKIndex]; - SetIndexRegMask(CRTC_PORT,0xC0, 0x00, pDCLKPtr->Param1); - SetIndexRegMask(CRTC_PORT,0xC1, 0x00, pDCLKPtr->Param2); - SetIndexRegMask(CRTC_PORT,0xBB, 0x0F, (pDCLKPtr->Param3 & 0x80) | ((pDCLKPtr->Param3 & 0x03) << 4) ); - + SetIndexRegMask(CRTC_PORT,0xC0, 0x00, pDCLKPtr->Param1); + SetIndexRegMask(CRTC_PORT,0xC1, 0x00, pDCLKPtr->Param2); + SetIndexRegMask(CRTC_PORT,0xBB, 0x0F, (pDCLKPtr->Param3 & 0x80) | ((pDCLKPtr->Param3 & 0x03) << 4) ); + } void vSetExtReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo) { - + ASTRecPtr pAST; UCHAR jRegA0, jRegA3, jRegA8; - + pAST = ASTPTR(pScrn); - jRegA0=jRegA3=jRegA8=0; - /* Mode Type Setting */ + jRegA0=jRegA3=jRegA8=0; + /* Mode Type Setting */ switch (pScrn->bitsPerPixel) { case 8: jRegA0 = 0x70; jRegA3 = 0x01; - jRegA8 = 0x00; + jRegA8 = 0x00; break; - case 15: + case 15: case 16: - jRegA0 = 0x70; + jRegA0 = 0x70; jRegA3 = 0x04; - jRegA8 = 0x02; - break; + jRegA8 = 0x02; + break; case 32: - jRegA0 = 0x70; + jRegA0 = 0x70; jRegA3 = 0x08; - jRegA8 = 0x02; + jRegA8 = 0x02; break; - } - SetIndexRegMask(CRTC_PORT,0xA0, 0x8F, (UCHAR) jRegA0); - SetIndexRegMask(CRTC_PORT,0xA3, 0xF0, (UCHAR) jRegA3); - SetIndexRegMask(CRTC_PORT,0xA8, 0xFD, (UCHAR) jRegA8); + } + SetIndexRegMask(CRTC_PORT,0xA0, 0x8F, (UCHAR) jRegA0); + SetIndexRegMask(CRTC_PORT,0xA3, 0xF0, (UCHAR) jRegA3); + SetIndexRegMask(CRTC_PORT,0xA8, 0xFD, (UCHAR) jRegA8); #if defined(__sparc__) UCHAR jRegA2 = 0x80; @@ -845,49 +845,49 @@ void vSetExtReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAMod jRegA2 |= 0x40; SetIndexRegMask(CRTC_PORT,0xA2, 0x3F, (UCHAR) jRegA2); #endif - + /* Set Threshold */ if (pAST->jChipType == AST2300) { SetIndexReg(CRTC_PORT,0xA7, 0x78); - SetIndexReg(CRTC_PORT,0xA6, 0x60); - } - else if ((pAST->jChipType == AST2100) || (pAST->jChipType == AST1100) || (pAST->jChipType == AST2200) || (pAST->jChipType == AST2150) ) + SetIndexReg(CRTC_PORT,0xA6, 0x60); + } + else if ((pAST->jChipType == AST2100) || (pAST->jChipType == AST1100) || (pAST->jChipType == AST2200) || (pAST->jChipType == AST2150) ) { SetIndexReg(CRTC_PORT,0xA7, 0x3F); - SetIndexReg(CRTC_PORT,0xA6, 0x2F); + SetIndexReg(CRTC_PORT,0xA6, 0x2F); } else - { + { SetIndexReg(CRTC_PORT,0xA7, 0x2F); SetIndexReg(CRTC_PORT,0xA6, 0x1F); - } - + } + } void vSetSyncReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo) { PVBIOS_ENHTABLE_STRUCT pEnhModePtr; ASTRecPtr pAST; - UCHAR jReg; - + UCHAR jReg; + pAST = ASTPTR(pScrn); pEnhModePtr = pVGAModeInfo->pEnhTableEntry; jReg = GetReg(MISC_PORT_READ); jReg |= (UCHAR) (pEnhModePtr->Flags & SyncNN); SetReg(MISC_PORT_WRITE,jReg); - + } Bool bSetDACReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo) { PVBIOS_DAC_INFO pDACPtr; - ASTRecPtr pAST; + ASTRecPtr pAST; ULONG i, ulDACNumber; UCHAR DACR, DACG, DACB; - pAST = ASTPTR(pScrn); + pAST = ASTPTR(pScrn); switch (pScrn->bitsPerPixel) { @@ -906,7 +906,7 @@ Bool bSetDACReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAMod DACB = pDACPtr->DACB; VGA_LOAD_PALETTE_INDEX (i, DACR, DACG, DACB); - + pDACPtr++; } @@ -915,11 +915,11 @@ Bool bSetDACReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAMod } ULONG AST1180DCLKTable [] = { - 0x0008676b, /* 00: VCLK25_175 */ + 0x0008676b, /* 00: VCLK25_175 */ 0x00086342, /* 01: VCLK28_322 */ 0x00086568, /* 02: VCLK31_5 */ 0x00082118, /* 03: VCLK36 */ - 0x0008232e, /* 04: VCLK40 */ + 0x0008232e, /* 04: VCLK40 */ 0x000c256d, /* 05: VCLK49_5 */ 0x00082016, /* 06: VCLK50 */ 0x000c0010, /* 07: VCLK56_25 */ @@ -931,45 +931,45 @@ ULONG AST1180DCLKTable [] = { 0x00040334, /* 0D: VCLK135 */ 0x0004033d, /* 0E: VCLK157_5 */ 0x00040018, /* 0F: VCLK162 */ - 0x00040123, /* 10: VCLK154 */ - 0x000c0669, /* 11: VCLK83_5 */ - 0x0004074b, /* 12: VCLK106_5 */ - 0x0004022d, /* 13: VCLK146_25 */ - 0x00040769, /* 14: VCLK148_5 */ + 0x00040123, /* 10: VCLK154 */ + 0x000c0669, /* 11: VCLK83_5 */ + 0x0004074b, /* 12: VCLK106_5 */ + 0x0004022d, /* 13: VCLK146_25 */ + 0x00040769, /* 14: VCLK148_5 */ }; BOOL bSetAST1180CRTCReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo) { - ASTRecPtr pAST = ASTPTR(pScrn); + ASTRecPtr pAST = ASTPTR(pScrn); - ULONG HTIndex, HRIndex, VTIndex, VRIndex; + ULONG HTIndex, HRIndex, VTIndex, VRIndex; ULONG HT, HDE, HBS, HBE, HRS, HRE; - ULONG VT, VDE, VBS, VBE, VRS, VRE; + ULONG VT, VDE, VBS, VBE, VRS, VRE; ULONG HT2, HDE2, HRS2, HRE2; - ULONG VT2, VDE2, VRS2, VRE2; - + ULONG VT2, VDE2, VRS2, VRE2; + /* Reg. Index Select */ { HTIndex = AST1180_VGA1_HTREG; HRIndex = AST1180_VGA1_HRREG; VTIndex = AST1180_VGA1_VTREG; - VRIndex = AST1180_VGA1_VRREG; - } - + VRIndex = AST1180_VGA1_VRREG; + } + /* Get CRTC Info */ HT = mode->CrtcHTotal; HDE= mode->CrtcHDisplay; HBS= mode->CrtcHBlankStart; - HBE= mode->CrtcHBlankEnd; + HBE= mode->CrtcHBlankEnd; HRS= mode->CrtcHSyncStart; HRE= mode->CrtcHSyncEnd; VT = mode->CrtcVTotal; VDE= mode->CrtcVDisplay; VBS= mode->CrtcVBlankStart; - VBE= mode->CrtcVBlankEnd; + VBE= mode->CrtcVBlankEnd; VRS= mode->CrtcVSyncStart; - VRE= mode->CrtcVSyncEnd; - + VRE= mode->CrtcVSyncEnd; + /* Calculate CRTC Reg Setting */ HT2 = HT - 1; HDE2 = HDE - 1; @@ -977,45 +977,45 @@ BOOL bSetAST1180CRTCReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INF HRE2 = HRE - 1; VT2 = VT - 1; VDE2 = VDE - 1; - VRS2 = VRS - 1; + VRS2 = VRS - 1; VRE2 = VRE - 1; - + /* Write Reg */ - WriteAST1180SOC(AST1180_GFX_BASE + HTIndex, (ULONG)(HDE2 << 16) | (ULONG) (HT2)); - WriteAST1180SOC(AST1180_GFX_BASE + HRIndex, (ULONG)(HRE2 << 16) | (ULONG) (HRS2)); - WriteAST1180SOC(AST1180_GFX_BASE + VTIndex, (ULONG)(VDE2 << 16) | (ULONG) (VT2)); - WriteAST1180SOC(AST1180_GFX_BASE + VRIndex, (ULONG)(VRE2 << 16) | (ULONG) (VRS2)); - + WriteAST1180SOC(AST1180_GFX_BASE + HTIndex, (ULONG)(HDE2 << 16) | (ULONG) (HT2)); + WriteAST1180SOC(AST1180_GFX_BASE + HRIndex, (ULONG)(HRE2 << 16) | (ULONG) (HRS2)); + WriteAST1180SOC(AST1180_GFX_BASE + VTIndex, (ULONG)(VDE2 << 16) | (ULONG) (VT2)); + WriteAST1180SOC(AST1180_GFX_BASE + VRIndex, (ULONG)(VRE2 << 16) | (ULONG) (VRS2)); + return (TRUE); - + } /* bSetAST1180CRTCReg */ BOOL bSetAST1180OffsetReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo) { - ASTRecPtr pAST = ASTPTR(pScrn); - ULONG ulOffset, ulTermalCount; - + ASTRecPtr pAST = ASTPTR(pScrn); + ULONG ulOffset, ulTermalCount; + ulOffset = pAST->VideoModeInfo.ScreenPitch; ulTermalCount = (pAST->VideoModeInfo.ScreenPitch + 7) >> 3; /* Write Reg */ - WriteAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_OFFSET, (ULONG) (ulTermalCount << 16) | (ULONG) (ulOffset)); - + WriteAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_OFFSET, (ULONG) (ulTermalCount << 16) | (ULONG) (ulOffset)); + return (TRUE); - + } /* bSetAST1180OffsetReg */ BOOL bSetAST1180DCLKReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo) { PVBIOS_ENHTABLE_STRUCT pEnhModePtr; - ASTRecPtr pAST = ASTPTR(pScrn); + ASTRecPtr pAST = ASTPTR(pScrn); ULONG ulDCLK; - + pEnhModePtr = pVGAModeInfo->pEnhTableEntry; ulDCLK = AST1180DCLKTable[pEnhModePtr->DCLKIndex]; if (pEnhModePtr->Flags & HalfDCLK) ulDCLK |= 0x00400000; /* D[22]: div by 2 */ - WriteAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_PLL, ulDCLK); + WriteAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_PLL, ulDCLK); return (TRUE); } @@ -1023,51 +1023,51 @@ BOOL bSetAST1180DCLKReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INF BOOL bSetAST1180ExtReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo) { PVBIOS_ENHTABLE_STRUCT pEnhModePtr; - ASTRecPtr pAST = ASTPTR(pScrn); - + ASTRecPtr pAST = ASTPTR(pScrn); + ULONG ulCtlRegIndex, ulCtlReg; /* enable display */ - ULONG ulCtlReg2Index, ulCtlReg2 = 0x80; /* single edge */ + ULONG ulCtlReg2Index, ulCtlReg2 = 0x80; /* single edge */ ULONG ulThresholdRegIndex ; /* Threshold */ ULONG ulStartAddressIndex; /* ulStartAddress */ ULONG ulStartAddress = pAST->ulVRAMBase; - + /* Reg. Index Select */ { ulCtlRegIndex = AST1180_VGA1_CTRL; - ulCtlReg2Index = AST1180_VGA1_CTRL2; + ulCtlReg2Index = AST1180_VGA1_CTRL2; ulThresholdRegIndex = AST1180_VGA1_THRESHOLD; - ulStartAddressIndex = AST1180_VGA1_STARTADDR; + ulStartAddressIndex = AST1180_VGA1_STARTADDR; } /* Mode Type Setting */ ulCtlReg = 0x30000000; - { + { switch (pScrn->bitsPerPixel) { - case 15: + case 15: case 16: - ulCtlReg |= 0x100001; /* RGB565, SCREEN OFF, ENABLE */ - break; + ulCtlReg |= 0x100001; /* RGB565, SCREEN OFF, ENABLE */ + break; case 32: - ulCtlReg |= 0x100101; /* XRGB8888, SCREEN OFF, ENABLE */ + ulCtlReg |= 0x100101; /* XRGB8888, SCREEN OFF, ENABLE */ break; - } - } + } + } /* Polarity */ pEnhModePtr = pVGAModeInfo->pEnhTableEntry; ulCtlReg |= (ULONG) (pEnhModePtr->Flags & SyncNN) << 10; - + /* Single/Dual Edge */ ulCtlReg2 |= 0x40; /* dual-edge */ - + /* Write Reg */ - WriteAST1180SOC(AST1180_GFX_BASE + ulStartAddressIndex, ulStartAddress); - WriteAST1180SOC(AST1180_GFX_BASE + ulThresholdRegIndex, ((ULONG) CRT_HIGH_THRESHOLD_VALUE << 8) | (ULONG) (CRT_LOW_THRESHOLD_VALUE)); - WriteAST1180SOC(AST1180_GFX_BASE + ulCtlReg2Index, ulCtlReg2); - WriteAST1180SOC(AST1180_GFX_BASE + ulCtlRegIndex, ulCtlReg); - + WriteAST1180SOC(AST1180_GFX_BASE + ulStartAddressIndex, ulStartAddress); + WriteAST1180SOC(AST1180_GFX_BASE + ulThresholdRegIndex, ((ULONG) CRT_HIGH_THRESHOLD_VALUE << 8) | (ULONG) (CRT_LOW_THRESHOLD_VALUE)); + WriteAST1180SOC(AST1180_GFX_BASE + ulCtlReg2Index, ulCtlReg2); + WriteAST1180SOC(AST1180_GFX_BASE + ulCtlRegIndex, ulCtlReg); + return (TRUE); - + } /* bSetAST1180ExtReg */ #define I2C_BASE_AST1180 0x80fcb000 @@ -1075,13 +1075,13 @@ BOOL bSetAST1180ExtReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO void SetChrontelReg(ASTRecPtr pAST, UCHAR jChannel, UCHAR jIndex, UCHAR jData ) { - ULONG ulData, ulI2CAddr, ulI2CPortBase; + ULONG ulData, ulI2CAddr, ulI2CPortBase; ULONG retry; - + { - ulI2CPortBase = I2C_BASE_AST1180 + 0x40 * jChannel; - ulI2CAddr = I2C_DEVICEADDR_AST1180; - } + ulI2CPortBase = I2C_BASE_AST1180 + 0x40 * jChannel; + ulI2CAddr = I2C_DEVICEADDR_AST1180; + } WriteAST1180SOC(ulI2CPortBase + 0x00, 0x00); WriteAST1180SOC(ulI2CPortBase + 0x04, 0x77743355); @@ -1131,14 +1131,14 @@ Exit_SetChrontelReg: UCHAR GetChrontelReg(ASTRecPtr pAST, UCHAR jChannel, UCHAR jIndex) { - ULONG ulData, ulI2CAddr, ulI2CPortBase; + ULONG ulData, ulI2CAddr, ulI2CPortBase; UCHAR jData; ULONG retry; - + { - ulI2CPortBase = I2C_BASE_AST1180 + 0x40 * jChannel; - ulI2CAddr = I2C_DEVICEADDR_AST1180; - } + ulI2CPortBase = I2C_BASE_AST1180 + 0x40 * jChannel; + ulI2CAddr = I2C_DEVICEADDR_AST1180; + } WriteAST1180SOC(ulI2CPortBase + 0x00, 0x00); WriteAST1180SOC(ulI2CPortBase + 0x04, 0x77743355); @@ -1181,28 +1181,28 @@ UCHAR GetChrontelReg(ASTRecPtr pAST, UCHAR jChannel, UCHAR jIndex) ulData &= 0xffffffef; WriteAST1180SOC(ulI2CPortBase + 0x0C, ulData); WriteAST1180SOC(ulI2CPortBase + 0x10, 0xffffffff); - + ReadAST1180SOC(ulI2CPortBase + 0x20, ulData); jData = (UCHAR) ((ulData & 0xFF00) >> 8); - - return (jData); + + return (jData); } void vInitChontelReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo) { - PVBIOS_ENHTABLE_STRUCT pEnhModePtr = pVGAModeInfo->pEnhTableEntry; - ASTRecPtr pAST = ASTPTR(pScrn); + PVBIOS_ENHTABLE_STRUCT pEnhModePtr = pVGAModeInfo->pEnhTableEntry; + ASTRecPtr pAST = ASTPTR(pScrn); ULONG ulDCLK = 65; /* todo */ UCHAR jReg; - + jReg = GetChrontelReg(pAST, 1, 0x4A); /* get vendor id */ - if (jReg == 0x95) - { - jReg = GetChrontelReg(pAST, 1, 0x20); /* DVI/D-Sub */ + if (jReg == 0x95) + { + jReg = GetChrontelReg(pAST, 1, 0x20); /* DVI/D-Sub */ if (jReg & 0x20) /* DVI */ { - + /* DVI PLL Filter */ if (ulDCLK > 65) { @@ -1216,17 +1216,17 @@ void vInitChontelReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pV SetChrontelReg(pAST, 1, 0x34, 0x16); SetChrontelReg(pAST, 1, 0x36, 0x60); } - - SetChrontelReg(pAST, 1, 0x49, 0xc0); + + SetChrontelReg(pAST, 1, 0x49, 0xc0); } else /* D-Sub */ { - + SetChrontelReg(pAST, 1, 0x21, 0x09); SetChrontelReg(pAST, 1, 0x49, 0x00); - SetChrontelReg(pAST, 1, 0x56, 0x00); - } - } - + SetChrontelReg(pAST, 1, 0x56, 0x00); + } + } + } diff --git a/src/ast_mode.h b/src/ast_mode.h index 950bbce..13bb23c 100644 --- a/src/ast_mode.h +++ b/src/ast_mode.h @@ -23,7 +23,7 @@ /* Mode Limitation */ #define MAX_HResolution 1920 #define MAX_VResolution 1200 - + /* Std. Table Index Definition */ #define TextModeIndex 0 #define EGAModeIndex 1 @@ -81,17 +81,17 @@ /* Data Structure decalration for internal use */ typedef struct { - - UCHAR MISC; + + UCHAR MISC; UCHAR SEQ[4]; UCHAR CRTC[25]; - UCHAR AR[20]; + UCHAR AR[20]; UCHAR GR[9]; - + } VBIOS_STDTABLE_STRUCT, *PVBIOS_STDTABLE_STRUCT; typedef struct { - + ULONG HT; ULONG HDE; ULONG HFP; @@ -100,29 +100,29 @@ typedef struct { ULONG VDE; ULONG VFP; ULONG VSYNC; - ULONG DCLKIndex; + ULONG DCLKIndex; ULONG Flags; ULONG ulRefreshRate; ULONG ulRefreshRateIndex; ULONG ulModeID; - + } VBIOS_ENHTABLE_STRUCT, *PVBIOS_ENHTABLE_STRUCT; typedef struct { UCHAR Param1; UCHAR Param2; - UCHAR Param3; + UCHAR Param3; } VBIOS_DCLK_INFO, *PVBIOS_DCLK_INFO; typedef struct { UCHAR DACR; UCHAR DACG; - UCHAR DACB; + UCHAR DACB; } VBIOS_DAC_INFO, *PVBIOS_DAC_INFO; typedef struct { PVBIOS_STDTABLE_STRUCT pStdTableEntry; PVBIOS_ENHTABLE_STRUCT pEnhTableEntry; - + } VBIOS_MODE_INFO, *PVBIOS_MODE_INFO; diff --git a/src/ast_pcirename.h b/src/ast_pcirename.h index f5085bd..19144f6 100644 --- a/src/ast_pcirename.h +++ b/src/ast_pcirename.h @@ -31,7 +31,7 @@ enum region_type { REGION_MEM, - REGION_IO + REGION_IO }; #ifndef XSERVER_LIBPCIACCESS diff --git a/src/ast_tool.c b/src/ast_tool.c index c2bfac6..7f1362e 100644 --- a/src/ast_tool.c +++ b/src/ast_tool.c @@ -19,7 +19,7 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ - + #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -75,12 +75,12 @@ ASTMapMem(ScrnInfoPtr pScrn) PCI_DEV_MAP_FLAG_WRITABLE | PCI_DEV_MAP_FLAG_WRITE_COMBINE, result); - - if (err) + + if (err) return FALSE; } #endif - + if (!pAST->FBVirtualAddr) return FALSE; @@ -92,15 +92,15 @@ ASTUnmapMem(ScrnInfoPtr pScrn) { ASTRecPtr pAST = ASTPTR(pScrn); -#ifndef XSERVER_LIBPCIACCESS +#ifndef XSERVER_LIBPCIACCESS xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pAST->FBVirtualAddr, pAST->FbMapSize); #else pci_device_unmap_range(pAST->PciInfo, pAST->FBVirtualAddr, pAST->FbMapSize); #endif - + pAST->FBVirtualAddr = 0; - + return TRUE; } @@ -130,8 +130,8 @@ ASTMapMMIO(ScrnInfoPtr pScrn) pAST->MMIOMapSize, PCI_DEV_MAP_FLAG_WRITABLE, result); - - if (err) + + if (err) return FALSE; } @@ -154,7 +154,7 @@ ASTUnmapMMIO(ScrnInfoPtr pScrn) pci_device_unmap_range(pAST->PciInfo, pAST->MMIOVirtualAddr, pAST->MMIOMapSize); #endif pAST->MMIOVirtualAddr = 0; - + } diff --git a/src/ast_vgatool.c b/src/ast_vgatool.c index 964b826..04d311c 100644 --- a/src/ast_vgatool.c +++ b/src/ast_vgatool.c @@ -78,11 +78,11 @@ void GetAST1180DRAMInfo(ScrnInfoPtr pScrn); void vASTOpenKey(ScrnInfoPtr pScrn) -{ +{ ASTRecPtr pAST = ASTPTR(pScrn); - - SetIndexReg(CRTC_PORT,0x80, 0xA8); - + + SetIndexReg(CRTC_PORT,0x80, 0xA8); + } Bool @@ -97,34 +97,34 @@ bASTRegInit(ScrnInfoPtr pScrn) #if defined(__sparc__) SetIndexRegMask(CRTC_PORT,0xA2, 0xFF, 0x80); #endif - + return (TRUE); - + } void GetDRAMInfo(ScrnInfoPtr pScrn) { ASTRecPtr pAST = ASTPTR(pScrn); - ULONG ulRefPLL, ulDeNumerator, ulNumerator, ulDivider; + ULONG ulRefPLL, ulDeNumerator, ulNumerator, ulDivider; ULONG ulData, ulData2; - + *(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); - + /* Get BusWidth */ if (ulData & 0x40) pAST->ulDRAMBusWidth = 16; - else + else pAST->ulDRAMBusWidth = 32; - + /* Get DRAM Type */ if (pAST->jChipType == AST2300) { @@ -132,67 +132,67 @@ GetDRAMInfo(ScrnInfoPtr pScrn) { case 0x00: pAST->jDRAMType = DRAMTYPE_512Mx16; - break; - default: + break; + default: case 0x01: pAST->jDRAMType = DRAMTYPE_1Gx16; - break; + break; case 0x02: pAST->jDRAMType = DRAMTYPE_2Gx16; - break; - case 0x03: + break; + case 0x03: pAST->jDRAMType = DRAMTYPE_4Gx16; - break; - } + break; + } } else { switch (ulData & 0x0C) { - case 0x00: + case 0x00: case 0x04: pAST->jDRAMType = DRAMTYPE_512Mx16; - break; - + 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; } - } - + } + /* Get MCLK */ - ulData = *(ULONG *) (pAST->MMIOVirtualAddr + 0x10120); - ulData2 = *(ULONG *) (pAST->MMIOVirtualAddr + 0x10170); + ulData = *(ULONG *) (pAST->MMIOVirtualAddr + 0x10120); + ulData2 = *(ULONG *) (pAST->MMIOVirtualAddr + 0x10170); if (ulData2 & 0x2000) ulRefPLL = 14318; else ulRefPLL = 12000; - + ulDeNumerator = ulData & 0x1F; ulNumerator = (ulData & 0x3FE0) >> 5; - - ulData = (ulData & 0xC000) >> 14; + + ulData = (ulData & 0xC000) >> 14; switch (ulData) { case 0x03: ulDivider = 0x04; break; case 0x02: - case 0x01: + case 0x01: ulDivider = 0x02; break; default: - ulDivider = 0x01; - } - pAST->ulMCLK = ulRefPLL * (ulNumerator + 2) / ((ulDeNumerator + 2) * ulDivider * 1000); - + ulDivider = 0x01; + } + pAST->ulMCLK = ulRefPLL * (ulNumerator + 2) / ((ulDeNumerator + 2) * ulDivider * 1000); + } /* GetDRAMInfo */ ULONG @@ -203,22 +203,22 @@ GetVRAMInfo(ScrnInfoPtr pScrn) vASTOpenKey(pScrn); - GetIndexRegMask(CRTC_PORT, 0xAA, 0xFF, jReg); + GetIndexRegMask(CRTC_PORT, 0xAA, 0xFF, jReg); switch (jReg & 0x03) { case 0x00: - return (VIDEOMEM_SIZE_08M); + return (VIDEOMEM_SIZE_08M); case 0x01: - return (VIDEOMEM_SIZE_16M); + return (VIDEOMEM_SIZE_16M); case 0x02: - return (VIDEOMEM_SIZE_32M); - case 0x03: - return (VIDEOMEM_SIZE_64M); - } - + return (VIDEOMEM_SIZE_32M); + case 0x03: + return (VIDEOMEM_SIZE_64M); + } + return (DEFAULT_VIDEOMEM_SIZE); - + } ULONG @@ -230,32 +230,32 @@ GetMaxDCLK(ScrnInfoPtr pScrn) ULONG ulDCLK; ulMCLK = pAST->ulMCLK; - ulDRAMBusWidth = pAST->ulDRAMBusWidth; - + ulDRAMBusWidth = pAST->ulDRAMBusWidth; + /* 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) ) DRAMEfficiency = 600; else if (pAST->jChipType == AST2300) - DRAMEfficiency = 400; + DRAMEfficiency = 400; ulDRAMBandwidth = ulMCLK * ulDRAMBusWidth * 2 / 8; ActualDRAMBandwidth = ulDRAMBandwidth * DRAMEfficiency / 1000; - + /* Get Max DCLK */ if (pAST->jChipType == AST1180) { ulDCLK = ActualDRAMBandwidth / ((pScrn->bitsPerPixel+1) / 8); } else - { - /* Fixed Fixed KVM + CRT threshold issue on AST2100 8bpp modes, ycchen@100708 */ - GetIndexRegMask(CRTC_PORT, 0xD0, 0xFF, jReg); - if ((jReg & 0x08) && (pAST->jChipType == AST2000)) - ulDCLK = ActualDRAMBandwidth / ((pScrn->bitsPerPixel+1+16) / 8); + { + /* Fixed Fixed KVM + CRT threshold issue on AST2100 8bpp modes, ycchen@100708 */ + GetIndexRegMask(CRTC_PORT, 0xD0, 0xFF, jReg); + if ((jReg & 0x08) && (pAST->jChipType == AST2000)) + ulDCLK = ActualDRAMBandwidth / ((pScrn->bitsPerPixel+1+16) / 8); else if ((jReg & 0x08) && (pScrn->bitsPerPixel == 8)) - ulDCLK = ActualDRAMBandwidth / ((pScrn->bitsPerPixel+1+24) / 8); - else - ulDCLK = ActualDRAMBandwidth / ((pScrn->bitsPerPixel+1) / 8); + ulDCLK = ActualDRAMBandwidth / ((pScrn->bitsPerPixel+1+24) / 8); + else + ulDCLK = ActualDRAMBandwidth / ((pScrn->bitsPerPixel+1) / 8); } /* Add for AST2100, ycchen@061807 */ @@ -265,11 +265,11 @@ GetMaxDCLK(ScrnInfoPtr pScrn) } else { - if (ulDCLK > 165) ulDCLK = 165; + if (ulDCLK > 165) ulDCLK = 165; } - + return(ulDCLK); - + } void @@ -278,30 +278,30 @@ GetChipType(ScrnInfoPtr pScrn) ASTRecPtr pAST = ASTPTR(pScrn); ULONG ulData; UCHAR jReg; - + pAST->jChipType = AST2100; *(ULONG *) (pAST->MMIOVirtualAddr + 0xF004) = 0x1e6e0000; - *(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x1; - ulData = *(ULONG *) (pAST->MMIOVirtualAddr + 0x1207c); + *(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x1; + ulData = *(ULONG *) (pAST->MMIOVirtualAddr + 0x1207c); switch (ulData & 0x0300) { case 0x0200: xf86DrvMsg(pScrn->scrnIndex, X_INFO, "AST1100 Detected.\n"); - pAST->jChipType = AST1100; + pAST->jChipType = AST1100; break; case 0x0100: - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "AST2200 Detected.\n"); - pAST->jChipType = AST2200; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "AST2200 Detected.\n"); + pAST->jChipType = AST2200; break; case 0x0000: - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "AST2150 Detected.\n"); - pAST->jChipType = AST2150; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "AST2150 Detected.\n"); + pAST->jChipType = AST2150; break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "AST2100 Detected.\n"); + default: + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "AST2100 Detected.\n"); pAST->jChipType = AST2100; - } + } } @@ -311,18 +311,18 @@ GetScratchOptions(ScrnInfoPtr pScrn) ASTRecPtr pAST = ASTPTR(pScrn); ULONG ulData; UCHAR jReg; - - /* VGA2 Clone Support */ + + /* VGA2 Clone Support */ GetIndexRegMask(CRTC_PORT, 0x90, 0xFF, jReg); if (jReg & 0x10) pAST->VGA2Clone = TRUE; - + /* WideScreen Support */ switch (pAST->jChipType) { case AST1180: pAST->SupportWideScreen = TRUE; - break; + break; case AST2000: pAST->SupportWideScreen = FALSE; break; @@ -330,7 +330,7 @@ GetScratchOptions(ScrnInfoPtr pScrn) GetIndexRegMask(CRTC_PORT, 0xD0, 0xFF, jReg); if (!(jReg & 0x80)) pAST->SupportWideScreen = TRUE; - else if (jReg & 0x01) + else if (jReg & 0x01) pAST->SupportWideScreen = TRUE; else { @@ -338,34 +338,34 @@ GetScratchOptions(ScrnInfoPtr pScrn) if (pAST->jChipType == AST2300) /* for AST1300 */ { *(ULONG *) (pAST->MMIOVirtualAddr + 0xF004) = 0x1e6e0000; - *(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x1; - ulData = *(ULONG *) (pAST->MMIOVirtualAddr + 0x1207c); + *(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x1; + ulData = *(ULONG *) (pAST->MMIOVirtualAddr + 0x1207c); if ((ulData & 0x0300) == 0) /* AST1300 */ - pAST->SupportWideScreen = TRUE; - } - } + pAST->SupportWideScreen = TRUE; + } + } } /* switch case */ - + } /* GetScratchOptions */ void vSetStartAddressCRT1(ASTRecPtr pAST, ULONG base) { ULONG addr; - + if (pAST->jChipType == AST1180) { addr = pAST->ulVRAMBase + base; - WriteAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_STARTADDR, addr); + WriteAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_STARTADDR, addr); } else { addr = base >> 2; /* DW unit */ - + SetIndexReg(CRTC_PORT,0x0D, (UCHAR) (addr & 0xFF)); SetIndexReg(CRTC_PORT,0x0C, (UCHAR) ((addr >> 8) & 0xFF)); SetIndexReg(CRTC_PORT,0xAF, (UCHAR) ((addr >> 16) & 0xFF)); - } + } } @@ -373,14 +373,14 @@ void vAST1000DisplayOff(ASTRecPtr pAST) { ULONG ulData; - + if (pAST->jChipType == AST1180) { - ReadAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_CTRL, ulData); - ulData |= 0x00100000; - WriteAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_CTRL, ulData); + ReadAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_CTRL, ulData); + ulData |= 0x00100000; + WriteAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_CTRL, ulData); } - else + else SetIndexRegMask(SEQ_PORT,0x01, 0xDF, 0x20); } @@ -389,38 +389,38 @@ void vAST1000DisplayOn(ASTRecPtr pAST) { ULONG ulData; - + if (pAST->jChipType == AST1180) { - ReadAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_CTRL, ulData); - ulData &= 0xFFEFFFFF; - WriteAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_CTRL, ulData); + ReadAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_CTRL, ulData); + ulData &= 0xFFEFFFFF; + WriteAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_CTRL, ulData); } else SetIndexRegMask(SEQ_PORT,0x01, 0xDF, 0x00); -} +} void ASTBlankScreen(ScrnInfoPtr pScrn, Bool unblack) { ASTRecPtr pAST; pAST = ASTPTR(pScrn); - + if (unblack) vAST1000DisplayOn(pAST); else - vAST1000DisplayOff(pAST); -} + vAST1000DisplayOff(pAST); +} void vASTLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual) { - + ASTRecPtr pAST = ASTPTR(pScrn); int i, j, index; UCHAR DACIndex, DACR, DACG, DACB; - + switch (pScrn->bitsPerPixel) { case 15: for(i=0; i<numColors; i++) { @@ -430,12 +430,12 @@ vASTLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, DACR = colors[index].red << (8- pScrn->rgbBits); DACG = colors[index].green << (8- pScrn->rgbBits); DACB = colors[index].blue << (8- pScrn->rgbBits); - - VGA_LOAD_PALETTE_INDEX (DACIndex, DACR, DACG, DACB); + + VGA_LOAD_PALETTE_INDEX (DACIndex, DACR, DACG, DACB); } } break; - + case 16: for(i=0; i<numColors; i++) { index = indices[i]; @@ -444,12 +444,12 @@ vASTLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, DACR = colors[index/2].red << (8- pScrn->rgbBits); DACG = colors[index].green << (8- pScrn->rgbBits); DACB = colors[index/2].blue << (8- pScrn->rgbBits); - - VGA_LOAD_PALETTE_INDEX (DACIndex, DACR, DACG, DACB); + + VGA_LOAD_PALETTE_INDEX (DACIndex, DACR, DACG, DACB); } } break; - + case 24: for(i=0; i<numColors; i++) { index = indices[i]; @@ -457,11 +457,11 @@ vASTLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, DACR = colors[index].red; DACG = colors[index].green; DACB = colors[index].blue; - - VGA_LOAD_PALETTE_INDEX (DACIndex, DACR, DACG, DACB); - } + + VGA_LOAD_PALETTE_INDEX (DACIndex, DACR, DACG, DACB); + } break; - + default: for(i=0; i<numColors; i++) { index = indices[i]; @@ -469,12 +469,12 @@ vASTLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, DACR = colors[index].red >> (8 - pScrn->rgbBits); DACG = colors[index].green >> (8 - pScrn->rgbBits); DACB = colors[index].blue >> (8 - pScrn->rgbBits); - - VGA_LOAD_PALETTE_INDEX (DACIndex, DACR, DACG, DACB); - } + + VGA_LOAD_PALETTE_INDEX (DACIndex, DACR, DACG, DACB); + } } /* end of switch */ - + } /* end of vASTLoadPalette */ void @@ -483,7 +483,7 @@ ASTDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int fla ASTRecPtr pAST; UCHAR SEQ01, CRB6; ULONG ulData, ulTemp; - + pAST = ASTPTR(pScrn); SEQ01=CRB6=0; ulData = 0; @@ -501,34 +501,34 @@ ASTDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int fla /* Screen: Off; HSync: Off, VSync: On */ SEQ01 = 0x20; CRB6 = 0x01; - ulData = 0x00140000; + ulData = 0x00140000; break; case DPMSModeSuspend: /* Screen: Off; HSync: On, VSync: Off */ SEQ01 = 0x20; CRB6 = 0x02; - ulData = 0x00180000; + ulData = 0x00180000; break; case DPMSModeOff: /* Screen: Off; HSync: Off, VSync: Off */ SEQ01 = 0x20; CRB6 = 0x03; - ulData = 0x001C0000; + ulData = 0x001C0000; break; } if (pAST->jChipType == AST1180) { - ReadAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_CTRL, ulTemp); - ulTemp &= 0xFFE3FFFF; - ulTemp |= ulData; - WriteAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_CTRL, ulTemp); + ReadAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_CTRL, ulTemp); + ulTemp &= 0xFFE3FFFF; + ulTemp |= ulData; + WriteAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_CTRL, ulTemp); } else - { + { SetIndexRegMask(SEQ_PORT,0x01, 0xDF, SEQ01); SetIndexRegMask(CRTC_PORT,0xB6, 0xFC, CRB6); - } + } } @@ -545,11 +545,11 @@ Bool GetVGA2EDID(ScrnInfoPtr pScrn, unsigned char *pEDIDBuffer) { ASTRecPtr pAST = ASTPTR(pScrn); - ULONG i, ulData; + ULONG i, ulData; UCHAR *pjEDID; ULONG base, deviceaddr; UCHAR *offset; - + pjEDID = pEDIDBuffer; if (pAST->jChipType == AST1180) @@ -563,16 +563,16 @@ GetVGA2EDID(ScrnInfoPtr pScrn, unsigned char *pEDIDBuffer) base = I2C_BASE; offset = pAST->MMIOVirtualAddr + 0x10000 + I2C_OFFSET; deviceaddr = I2C_DEVICEADDR; - + /* SCU settings */ *(ULONG *) (pAST->MMIOVirtualAddr + 0xF004) = 0x1e6e0000; *(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x1; usleep(10000); - - *(ULONG *) (pAST->MMIOVirtualAddr + 0x12000) = 0x1688A8A8; + + *(ULONG *) (pAST->MMIOVirtualAddr + 0x12000) = 0x1688A8A8; ulData = *(ULONG *) (pAST->MMIOVirtualAddr + 0x12004); ulData &= 0xfffffffb; - *(ULONG *) (pAST->MMIOVirtualAddr + 0x12004) = ulData; + *(ULONG *) (pAST->MMIOVirtualAddr + 0x12004) = ulData; usleep(10000); } @@ -580,7 +580,7 @@ GetVGA2EDID(ScrnInfoPtr pScrn, unsigned char *pEDIDBuffer) *(ULONG *) (pAST->MMIOVirtualAddr + 0xF004) = base; *(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x1; usleep(10000); - + /* I2C Start */ *(ULONG *) (offset + 0x00) = 0x0; *(ULONG *) (offset + 0x04) = 0x77777355; @@ -603,11 +603,11 @@ GetVGA2EDID(ScrnInfoPtr pScrn, unsigned char *pEDIDBuffer) } while (!(ulData & 0x01)); *(ULONG *) (offset + 0x10) = 0xffffffff; *(ULONG *) (offset + 0x20) = deviceaddr + 1; - *(ULONG *) (offset + 0x14) = 0x03; + *(ULONG *) (offset + 0x14) = 0x03; do { ulData = *(volatile ULONG *) (offset + 0x10); } while (!(ulData & 0x01)); - + /* I2C Read */ for (i=0; i<127; i++) { @@ -618,7 +618,7 @@ GetVGA2EDID(ScrnInfoPtr pScrn, unsigned char *pEDIDBuffer) ulData = *(volatile ULONG *) (offset + 0x10); } while (!(ulData & 0x04)); *(ULONG *) (offset + 0x10) = 0xffffffff; - *(UCHAR *) (pjEDID++) = (UCHAR) ((*(ULONG *) (offset + 0x20) & 0xFF00) >> 8); + *(UCHAR *) (pjEDID++) = (UCHAR) ((*(ULONG *) (offset + 0x20) & 0xFF00) >> 8); } /* Read Last Byte */ @@ -629,7 +629,7 @@ GetVGA2EDID(ScrnInfoPtr pScrn, unsigned char *pEDIDBuffer) ulData = *(volatile ULONG *) (offset + 0x10); } while (!(ulData & 0x04)); *(ULONG *) (offset + 0x10) = 0xffffffff; - *(UCHAR *) (pjEDID++) = (UCHAR) ((*(ULONG *) (offset + 0x20) & 0xFF00) >> 8); + *(UCHAR *) (pjEDID++) = (UCHAR) ((*(ULONG *) (offset + 0x20) & 0xFF00) >> 8); /* I2C Stop */ *(ULONG *) (offset + 0x10) = 0xffffffff; @@ -637,9 +637,9 @@ GetVGA2EDID(ScrnInfoPtr pScrn, unsigned char *pEDIDBuffer) do { ulData = *(volatile ULONG *) (offset + 0x10); } while (!(ulData & 0x10)); - *(ULONG *) (offset + 0x0C) &= 0xffffffef; + *(ULONG *) (offset + 0x0C) &= 0xffffffef; *(ULONG *) (offset + 0x10) = 0xffffffff; - + return (TRUE); } /* GetVGA2EDID */ @@ -650,44 +650,44 @@ Bool bIsVGAEnabled(ScrnInfoPtr pScrn) ASTRecPtr pAST; UCHAR ch; ULONG ulData; - + pAST = ASTPTR(pScrn); if (pAST->jChipType == AST1180) { WriteAST1180SOC(AST1180_MMC_BASE+0x00, 0xFC600309); /* unlock */ ReadAST1180SOC(AST1180_MMC_BASE+0x08, ulData); - return (ulData); - } - else + return (ulData); + } + else { - + ch = GetReg(VGA_ENABLE_PORT); if (ch) { - + vASTOpenKey(pScrn); - - GetIndexRegMask(CRTC_PORT, 0xB6, 0xFF, ch); - + + GetIndexRegMask(CRTC_PORT, 0xB6, 0xFF, ch); + return (ch & 0x04); } } - - return (0); -} + + return (0); +} void vEnableVGA(ScrnInfoPtr pScrn) { ASTRecPtr pAST; - + pAST = ASTPTR(pScrn); SetReg(VGA_ENABLE_PORT, 0x01); - SetReg(MISC_PORT_WRITE, 0x01); - -} + SetReg(MISC_PORT_WRITE, 0x01); + +} UCHAR ExtRegInfo[] = { 0x0F, @@ -714,7 +714,7 @@ void vSetDefExtReg(ScrnInfoPtr pScrn) { ASTRecPtr pAST; UCHAR i, jIndex, jReg, *pjExtRegInfo; - + pAST = ASTPTR(pScrn); /* Reset Scratch */ @@ -729,8 +729,8 @@ void vSetDefExtReg(ScrnInfoPtr pScrn) if (PCI_DEV_REVISION(pAST->PciInfo) > 0x20) pjExtRegInfo = ExtRegInfo_AST2300; else - pjExtRegInfo = ExtRegInfo_AST2300A0; - } + pjExtRegInfo = ExtRegInfo_AST2300A0; + } else pjExtRegInfo = ExtRegInfo; @@ -744,18 +744,18 @@ void vSetDefExtReg(ScrnInfoPtr pScrn) /* disable standard IO/MEM decode if secondary */ if (!xf86IsPrimaryPci(pAST->PciInfo)) - SetIndexRegMask(CRTC_PORT,0xA1, 0xFF, 0x03); + SetIndexRegMask(CRTC_PORT,0xA1, 0xFF, 0x03); /* Set Ext. Default */ - SetIndexRegMask(CRTC_PORT,0x8C, 0x00, 0x01); - SetIndexRegMask(CRTC_PORT,0xB7, 0x00, 0x00); - + SetIndexRegMask(CRTC_PORT,0x8C, 0x00, 0x01); + SetIndexRegMask(CRTC_PORT,0xB7, 0x00, 0x00); + /* Enable RAMDAC for A1, ycchen@113005 */ jReg = 0x04; if (pAST->jChipType == AST2300) jReg |= 0x20; - SetIndexRegMask(CRTC_PORT,0xB6, 0xFF, jReg); - + SetIndexRegMask(CRTC_PORT,0xB6, 0xFF, jReg); + } __inline ULONG MIndwm(UCHAR *mmiobase, ULONG r) @@ -764,15 +764,15 @@ __inline ULONG MIndwm(UCHAR *mmiobase, ULONG r) *(ULONG *) (mmiobase + 0xF000) = 0x1; return ( *(volatile ULONG *) (mmiobase + 0x10000 + (r & 0x0000FFFF)) ); - + } __inline void MOutdwm(UCHAR *mmiobase, ULONG r, ULONG v) { - + *(ULONG *) (mmiobase + 0xF004) = r & 0xFFFF0000; *(ULONG *) (mmiobase + 0xF000) = 0x1; - + *(volatile ULONG *) (mmiobase + 0x10000 + (r & 0x0000FFFF)) = v; } @@ -810,7 +810,7 @@ typedef struct _AST2150DRAMParam { ULONG MMCTestBurst2_AST2150(PAST2150DRAMParam param, ULONG datagen) { ULONG data, timeout; - UCHAR *mmiobase; + UCHAR *mmiobase; mmiobase = param->pjMMIOVirtualAddress; @@ -842,7 +842,7 @@ ULONG MMCTestBurst2_AST2150(PAST2150DRAMParam param, ULONG datagen) ULONG MMCTestSingle2_AST2150(PAST2150DRAMParam param, ULONG datagen) { ULONG data, timeout; - UCHAR *mmiobase; + UCHAR *mmiobase; mmiobase = param->pjMMIOVirtualAddress; @@ -863,7 +863,7 @@ ULONG MMCTestSingle2_AST2150(PAST2150DRAMParam param, ULONG datagen) int CBRTest_AST2150(PAST2150DRAMParam param) { - UCHAR *mmiobase; + UCHAR *mmiobase; mmiobase = param->pjMMIOVirtualAddress; @@ -882,7 +882,7 @@ int CBRTest_AST2150(PAST2150DRAMParam param) int CBRScan_AST2150(PAST2150DRAMParam param, int busw) { ULONG patcnt, loop; - UCHAR *mmiobase; + UCHAR *mmiobase; mmiobase = param->pjMMIOVirtualAddress; @@ -904,7 +904,7 @@ int CBRScan_AST2150(PAST2150DRAMParam param, int busw) void CBRDLLI_AST2150(PAST2150DRAMParam param, int busw) { ULONG dllmin[4], dllmax[4], dlli, data, passcnt; - UCHAR *mmiobase; + UCHAR *mmiobase; mmiobase = param->pjMMIOVirtualAddress; @@ -938,22 +938,22 @@ void CBRDLLI_AST2150(PAST2150DRAMParam param, int busw) } typedef struct _AST_DRAMStruct { - + USHORT Index; ULONG Data; - -} AST_DRAMStruct, *PAST_DRAMStruct; + +} AST_DRAMStruct, *PAST_DRAMStruct; AST_DRAMStruct AST2000DRAMTableData[] = { { 0x0108, 0x00000000 }, { 0x0120, 0x00004a21 }, - { 0xFF00, 0x00000043 }, + { 0xFF00, 0x00000043 }, { 0x0000, 0xFFFFFFFF }, { 0x0004, 0x00000089 }, { 0x0008, 0x22331353 }, { 0x000C, 0x0d07000b }, { 0x0010, 0x11113333 }, - { 0x0020, 0x00110350 }, + { 0x0020, 0x00110350 }, { 0x0028, 0x1e0828f0 }, { 0x0024, 0x00000001 }, { 0x001C, 0x00000000 }, @@ -972,7 +972,7 @@ AST_DRAMStruct AST2000DRAMTableData[] = { { 0xFFFF, 0xFFFFFFFF } }; -AST_DRAMStruct AST1100DRAMTableData[] = { +AST_DRAMStruct AST1100DRAMTableData[] = { { 0x2000, 0x1688a8a8 }, { 0x2020, 0x000041f0 }, { 0xFF00, 0x00000043 }, @@ -1025,7 +1025,7 @@ AST_DRAMStruct AST1100DRAMTableData[] = { { 0xffff, 0xffffffff }, }; -AST_DRAMStruct AST2100DRAMTableData[] = { +AST_DRAMStruct AST2100DRAMTableData[] = { { 0x2000, 0x1688a8a8 }, { 0x2020, 0x00004120 }, { 0xFF00, 0x00000043 }, @@ -1086,71 +1086,71 @@ void vInitDRAMReg(ScrnInfoPtr pScrn) UCHAR jReg; AST2150DRAMParam param; - GetIndexRegMask(CRTC_PORT, 0xD0, 0xFF, jReg); - + GetIndexRegMask(CRTC_PORT, 0xD0, 0xFF, jReg); + if ((jReg & 0x80) == 0) /* VGA only */ { if (pAST->jChipType == AST2000) { pjDRAMRegInfo = AST2000DRAMTableData; - + *(ULONG *) (pAST->MMIOVirtualAddr + 0xF004) = 0x1e6e0000; - *(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x1; + *(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x1; *(ULONG *) (pAST->MMIOVirtualAddr + 0x10100) = 0xa8; do { - ; + ; } while (*(volatile ULONG *) (pAST->MMIOVirtualAddr + 0x10100) != 0xa8); - + } - else /* AST2100/1100 */ - { + else /* AST2100/1100 */ + { if ((pAST->jChipType == AST2100) || (pAST->jChipType == AST2200)) pjDRAMRegInfo = AST2100DRAMTableData; else pjDRAMRegInfo = AST1100DRAMTableData; - + *(ULONG *) (pAST->MMIOVirtualAddr + 0xF004) = 0x1e6e0000; *(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x1; - + *(ULONG *) (pAST->MMIOVirtualAddr + 0x12000) = 0x1688A8A8; do { - ; + ; } while (*(volatile ULONG *) (pAST->MMIOVirtualAddr + 0x12000) != 0x01); - + *(ULONG *) (pAST->MMIOVirtualAddr + 0x10000) = 0xFC600309; do { - ; + ; } while (*(volatile ULONG *) (pAST->MMIOVirtualAddr + 0x10000) != 0x01); } - + while (pjDRAMRegInfo->Index != 0xFFFF) { if (pjDRAMRegInfo->Index == 0xFF00) /* Delay function */ { - for (i=0; i<15; i++) + for (i=0; i<15; i++) usleep(pjDRAMRegInfo->Data); } 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; - ulTemp <<= 2; - *(ULONG *) (pAST->MMIOVirtualAddr + 0x10000 + pjDRAMRegInfo->Index) = (ulData | ulTemp); - } + ulTemp <<= 2; + *(ULONG *) (pAST->MMIOVirtualAddr + 0x10000 + pjDRAMRegInfo->Index) = (ulData | ulTemp); + } else - { + { *(ULONG *) (pAST->MMIOVirtualAddr + 0x10000 + pjDRAMRegInfo->Index) = pjDRAMRegInfo->Data; } - pjDRAMRegInfo++; + pjDRAMRegInfo++; } /* AST2100/2150 DRAM Calibration, ycchen@021511 */ @@ -1161,37 +1161,37 @@ void vInitDRAMReg(ScrnInfoPtr pScrn) ulData = *(ULONG *) (pAST->MMIOVirtualAddr + 0x10004); if (ulData & 0x40) CBRDLLI_AST2150(¶m, 16); /* 16bits */ - else + else CBRDLLI_AST2150(¶m, 32); /* 32bits */ - } + } switch (pAST->jChipType) { case AST2000: *(ULONG *) (pAST->MMIOVirtualAddr + 0x10140) |= 0x40; break; - + case AST1100: case AST2100: case AST2200: - case AST2150: + case AST2150: ulTemp = *(ULONG *) (pAST->MMIOVirtualAddr + 0x1200c); *(ULONG *) (pAST->MMIOVirtualAddr + 0x1200c) = (ulTemp & 0xFFFFFFFD); *(ULONG *) (pAST->MMIOVirtualAddr + 0x12040) |= 0x40; break; } - + } /* Init DRAM */ - + /* wait ready */ do { - GetIndexRegMask(CRTC_PORT, 0xD0, 0xFF, jReg); + GetIndexRegMask(CRTC_PORT, 0xD0, 0xFF, jReg); } while ((jReg & 0x40) == 0); - + } /* vInitDRAMReg */ -/* +/* * AST2300 DRAM settings modules */ #define DDR3 0 @@ -1208,7 +1208,7 @@ typedef struct _AST2300DRAMParam { ULONG RODT; ULONG DRAM_CONFIG; - ULONG REG_PERIOD; + ULONG REG_PERIOD; ULONG REG_MADJ; ULONG REG_SADJ; ULONG REG_MRS; @@ -1216,13 +1216,13 @@ typedef struct _AST2300DRAMParam { ULONG REG_AC1; ULONG REG_AC2; ULONG REG_DQSIC; - ULONG REG_DRV; + ULONG REG_DRV; ULONG REG_IOZ; ULONG REG_DQIDLY; ULONG REG_FREQ; ULONG MADJ_MAX; ULONG DLL2_FINETUNE_STEP; - + } AST2300DRAMParam, *PAST2300DRAMParam; /* @@ -1250,10 +1250,10 @@ ULONG pattern[8] ={ int MMCTestBurst(PAST2300DRAMParam param, ULONG datagen) { ULONG data, timeout; - UCHAR *mmiobase; + UCHAR *mmiobase; mmiobase = param->pjMMIOVirtualAddress; - + MOutdwm(mmiobase, 0x1E6E0070, 0x00000000); MOutdwm(mmiobase, 0x1E6E0070, 0x000000C1 | (datagen << 3)); timeout = 0; @@ -1274,7 +1274,7 @@ int MMCTestBurst(PAST2300DRAMParam param, ULONG datagen) int MMCTestBurst2(PAST2300DRAMParam param, ULONG datagen) { ULONG data, timeout; - UCHAR *mmiobase; + UCHAR *mmiobase; mmiobase = param->pjMMIOVirtualAddress; @@ -1297,7 +1297,7 @@ int MMCTestBurst2(PAST2300DRAMParam param, ULONG datagen) int MMCTestSingle(PAST2300DRAMParam param, ULONG datagen) { ULONG data, timeout; - UCHAR *mmiobase; + UCHAR *mmiobase; mmiobase = param->pjMMIOVirtualAddress; @@ -1321,7 +1321,7 @@ int MMCTestSingle(PAST2300DRAMParam param, ULONG datagen) int MMCTestSingle2(PAST2300DRAMParam param, ULONG datagen) { ULONG data, timeout; - UCHAR *mmiobase; + UCHAR *mmiobase; mmiobase = param->pjMMIOVirtualAddress; @@ -1344,7 +1344,7 @@ int MMCTestSingle2(PAST2300DRAMParam param, ULONG datagen) int CBRTest(PAST2300DRAMParam param) { ULONG data; - UCHAR *mmiobase; + UCHAR *mmiobase; mmiobase = param->pjMMIOVirtualAddress; @@ -1359,14 +1359,14 @@ int CBRTest(PAST2300DRAMParam param) data |= MMCTestBurst2(param, 07); if((data & 0xff) && (data & 0xff00)) return(0); if(!data) return(3); else if(data & 0xff) return(2); - + return(1); } int CBRScan(PAST2300DRAMParam param) { ULONG data, data2, patcnt, loop; - UCHAR *mmiobase; + UCHAR *mmiobase; mmiobase = param->pjMMIOVirtualAddress; @@ -1392,7 +1392,7 @@ int CBRScan(PAST2300DRAMParam param) ULONG CBRTest2(PAST2300DRAMParam param) { ULONG data; - UCHAR *mmiobase; + UCHAR *mmiobase; mmiobase = param->pjMMIOVirtualAddress; @@ -1404,7 +1404,7 @@ ULONG CBRTest2(PAST2300DRAMParam param) ULONG CBRScan2(PAST2300DRAMParam param) { ULONG data, data2, patcnt, loop; - UCHAR *mmiobase; + UCHAR *mmiobase; mmiobase = param->pjMMIOVirtualAddress; @@ -1430,7 +1430,7 @@ ULONG CBRScan2(PAST2300DRAMParam param) void finetuneDQI(PAST2300DRAMParam param) { ULONG gold_sadj[2], dllmin[16], dllmax[16], dlli, data, cnt, mask, passcnt; - UCHAR *mmiobase; + UCHAR *mmiobase; mmiobase = param->pjMMIOVirtualAddress; @@ -1527,7 +1527,7 @@ void finetuneDQI(PAST2300DRAMParam param) Bool finetuneDQI_L(PAST2300DRAMParam param) { ULONG gold_sadj[2], dllmin[16], dllmax[16], dlli, data, cnt, mask, passcnt, retry = 0; - UCHAR *mmiobase; + UCHAR *mmiobase; Bool status = FALSE; mmiobase = param->pjMMIOVirtualAddress; @@ -1582,8 +1582,8 @@ Bool finetuneDQI_L(PAST2300DRAMParam param) goto FINETUNE_START; } status = TRUE; - -FINETUNE_DONE: + +FINETUNE_DONE: gold_sadj[0] = gold_sadj[0] >> 4; gold_sadj[1] = gold_sadj[0]; @@ -1635,13 +1635,13 @@ FINETUNE_DONE: MOutdwm(mmiobase, 0x1E6E0084, data); return status; - + } /* finetuneDQI_L */ void finetuneDQI_L2(PAST2300DRAMParam param) { ULONG gold_sadj[2], dllmin[16], dllmax[16], dlli, data, cnt, mask, passcnt, data2; - UCHAR *mmiobase; + UCHAR *mmiobase; mmiobase = param->pjMMIOVirtualAddress; @@ -1767,13 +1767,13 @@ void finetuneDQI_L2(PAST2300DRAMParam param) data |= data2 << 21; } MOutdwm(mmiobase, 0x1E6E0084, data); - + } /* finetuneDQI_L2 */ Bool CBRDLL2(PAST2300DRAMParam param) { ULONG dllmin[2], dllmax[2], dlli, data, data2, passcnt, retry=0; - UCHAR *mmiobase; + UCHAR *mmiobase; BOOL status = FALSE; mmiobase = param->pjMMIOVirtualAddress; @@ -1829,7 +1829,7 @@ Bool CBRDLL2(PAST2300DRAMParam param) goto CBR_START2; } status = TRUE; - + CBR_DONE2: dlli = (dllmin[1] + dllmax[1]) >> 1; dlli <<= 8; @@ -1852,32 +1852,32 @@ CBR_DONE2: data = MIndwm(mmiobase, 0x1E6E0070); }while(!(data & 0x00001000)); MOutdwm(mmiobase, 0x1E6E0070, 0x00000000); - + return status; - + } /* CBRDLL2 */ void GetDDR2Info(PAST2300DRAMParam param) { UCHAR *mmiobase; ULONG trap, TRAP_AC2, TRAP_MRS; - + mmiobase = param->pjMMIOVirtualAddress; MOutdwm(mmiobase, 0x1E6E2000, 0x1688A8A8); - /* Ger trap info */ + /* Ger trap info */ trap = (MIndwm(mmiobase, 0x1E6E2070) >> 25) & 0x3; TRAP_AC2 = (trap << 20) | (trap << 16); TRAP_AC2 += 0x00110000; TRAP_MRS = 0x00000040 | (trap << 4); - - + + param->REG_MADJ = 0x00034C4C; param->REG_SADJ = 0x00001800; param->REG_DRV = 0x000000F0; param->REG_PERIOD = param->DRAM_Freq; param->RODT = 0; - + switch(param->DRAM_Freq){ case 264 : MOutdwm(mmiobase, 0x1E6E2020, 0x0130); param->WODT = 0; @@ -1906,24 +1906,24 @@ void GetDDR2Info(PAST2300DRAMParam param) param->REG_FREQ = 0x00004DC0; param->MADJ_MAX = 96; param->DLL2_FINETUNE_STEP = 3; - + switch (param->DRAM_ChipID) { - case DRAMTYPE_512Mx16: + case DRAMTYPE_512Mx16: param->REG_AC2 = 0xAA009012 | TRAP_AC2; break; - default: - case DRAMTYPE_1Gx16: + default: + case DRAMTYPE_1Gx16: param->REG_AC2 = 0xAA009016 | TRAP_AC2; break; - case DRAMTYPE_2Gx16: + case DRAMTYPE_2Gx16: param->REG_AC2 = 0xAA009023 | TRAP_AC2; break; - case DRAMTYPE_4Gx16: + case DRAMTYPE_4Gx16: param->REG_AC2 = 0xAA00903B | TRAP_AC2; - break; + break; } - + break; default: case 396 : MOutdwm(mmiobase, 0x1E6E2020, 0x03F1); @@ -1940,26 +1940,26 @@ void GetDDR2Info(PAST2300DRAMParam param) param->REG_FREQ = 0x000050C0; param->MADJ_MAX = 96; param->DLL2_FINETUNE_STEP = 4; - + switch (param->DRAM_ChipID) { - case DRAMTYPE_512Mx16: + case DRAMTYPE_512Mx16: param->REG_AC2 = 0xCC00B016 | TRAP_AC2; break; - default: - case DRAMTYPE_1Gx16: + default: + case DRAMTYPE_1Gx16: param->REG_AC2 = 0xCC00B01B | TRAP_AC2; break; - case DRAMTYPE_2Gx16: + case DRAMTYPE_2Gx16: param->REG_AC2 = 0xCC00B02B | TRAP_AC2; break; - case DRAMTYPE_4Gx16: + case DRAMTYPE_4Gx16: param->REG_AC2 = 0xCC00B03F | TRAP_AC2; - break; + break; } - + break; - + case 408 : MOutdwm(mmiobase, 0x1E6E2020, 0x01F0); param->WODT = 1; param->RODT = 0; @@ -1974,24 +1974,24 @@ void GetDDR2Info(PAST2300DRAMParam param) param->REG_FREQ = 0x000050C0; param->MADJ_MAX = 96; param->DLL2_FINETUNE_STEP = 4; - + switch (param->DRAM_ChipID) { - case DRAMTYPE_512Mx16: + case DRAMTYPE_512Mx16: param->REG_AC2 = 0xCC00B016 | TRAP_AC2; break; - default: - case DRAMTYPE_1Gx16: + default: + case DRAMTYPE_1Gx16: param->REG_AC2 = 0xCC00B01B | TRAP_AC2; break; - case DRAMTYPE_2Gx16: + case DRAMTYPE_2Gx16: param->REG_AC2 = 0xCC00B02B | TRAP_AC2; break; - case DRAMTYPE_4Gx16: + case DRAMTYPE_4Gx16: param->REG_AC2 = 0xCC00B03F | TRAP_AC2; - break; + break; } - + break; case 456 : MOutdwm(mmiobase, 0x1E6E2020, 0x0230); param->WODT = 0; @@ -2071,24 +2071,24 @@ void GetDDR2Info(PAST2300DRAMParam param) switch (param->DRAM_ChipID) { - case DRAMTYPE_512Mx16: + case DRAMTYPE_512Mx16: param->DRAM_CONFIG = 0x100; break; - default: - case DRAMTYPE_1Gx16: + default: + case DRAMTYPE_1Gx16: param->DRAM_CONFIG = 0x121; break; - case DRAMTYPE_2Gx16: + case DRAMTYPE_2Gx16: param->DRAM_CONFIG = 0x122; break; - case DRAMTYPE_4Gx16: + case DRAMTYPE_4Gx16: param->DRAM_CONFIG = 0x123; - break; + break; }; /* switch size */ - + switch (param->VRAM_Size) { - default: + default: case VIDEOMEM_SIZE_08M: param->DRAM_CONFIG |= 0x00; break; @@ -2100,16 +2100,16 @@ void GetDDR2Info(PAST2300DRAMParam param) break; case VIDEOMEM_SIZE_64M: param->DRAM_CONFIG |= 0x0c; - break; + break; } - + } void GetDDR3Info(PAST2300DRAMParam param) { UCHAR *mmiobase; ULONG trap, TRAP_AC2, TRAP_MRS; - + mmiobase = param->pjMMIOVirtualAddress; MOutdwm(mmiobase, 0x1E6E2000, 0x1688A8A8); @@ -2119,7 +2119,7 @@ void GetDDR3Info(PAST2300DRAMParam param) TRAP_AC2 |= 0x00300000 +((trap & 0x2) << 19); TRAP_MRS = 0x00000010 + (trap << 4); TRAP_MRS |= ((trap & 0x2) << 18); - + param->REG_MADJ = 0x00034C4C; param->REG_SADJ = 0x00001800; param->REG_DRV = 0x000000F0; @@ -2139,22 +2139,22 @@ void GetDDR3Info(PAST2300DRAMParam param) param->REG_FREQ = 0x00004DC0; param->MADJ_MAX = 96; param->DLL2_FINETUNE_STEP = 3; - + switch (param->DRAM_ChipID) { - default: + default: case DRAMTYPE_512Mx16: - case DRAMTYPE_1Gx16: + case DRAMTYPE_1Gx16: param->REG_AC2 = 0xAA007613 | TRAP_AC2; break; - case DRAMTYPE_2Gx16: + case DRAMTYPE_2Gx16: param->REG_AC2 = 0xAA00761c | TRAP_AC2; break; - case DRAMTYPE_4Gx16: + case DRAMTYPE_4Gx16: param->REG_AC2 = 0xAA007636 | TRAP_AC2; - break; + break; } - + break; default: case 396 : MOutdwm(mmiobase, 0x1E6E2020, 0x03F1); @@ -2165,29 +2165,29 @@ void GetDDR3Info(PAST2300DRAMParam param) param->REG_MRS = 0x04001600 | TRAP_MRS; param->REG_EMRS = 0x00000000; param->REG_IOZ = 0x00000034; - param->REG_DRV = 0x000000FA; + param->REG_DRV = 0x000000FA; param->REG_DQIDLY = 0x00000089; param->REG_FREQ = 0x000050C0; param->MADJ_MAX = 96; param->DLL2_FINETUNE_STEP = 4; - + switch (param->DRAM_ChipID) { - default: - case DRAMTYPE_512Mx16: - case DRAMTYPE_1Gx16: + default: + case DRAMTYPE_512Mx16: + case DRAMTYPE_1Gx16: param->REG_AC2 = 0xCC009617 | TRAP_AC2; break; - case DRAMTYPE_2Gx16: + case DRAMTYPE_2Gx16: param->REG_AC2 = 0xCC009622 | TRAP_AC2; break; - case DRAMTYPE_4Gx16: + case DRAMTYPE_4Gx16: param->REG_AC2 = 0xCC00963F | TRAP_AC2; - break; + break; } - + break; - + case 408 : MOutdwm(mmiobase, 0x1E6E2020, 0x01F0); param->WODT = 1; param->REG_AC1 = 0x33302825; @@ -2196,27 +2196,27 @@ void GetDDR3Info(PAST2300DRAMParam param) param->REG_MRS = 0x04001600 | TRAP_MRS; param->REG_EMRS = 0x00000000; param->REG_IOZ = 0x00000034; - param->REG_DRV = 0x000000FA; + param->REG_DRV = 0x000000FA; param->REG_DQIDLY = 0x00000089; param->REG_FREQ = 0x000050C0; param->MADJ_MAX = 96; param->DLL2_FINETUNE_STEP = 4; - + switch (param->DRAM_ChipID) { - default: - case DRAMTYPE_512Mx16: - case DRAMTYPE_1Gx16: + default: + case DRAMTYPE_512Mx16: + case DRAMTYPE_1Gx16: param->REG_AC2 = 0xCC009617 | TRAP_AC2; break; - case DRAMTYPE_2Gx16: + case DRAMTYPE_2Gx16: param->REG_AC2 = 0xCC009622 | TRAP_AC2; break; - case DRAMTYPE_4Gx16: + case DRAMTYPE_4Gx16: param->REG_AC2 = 0xCC00963F | TRAP_AC2; - break; + break; } - + break; case 456 : MOutdwm(mmiobase, 0x1E6E2020, 0x0230); param->WODT = 0; @@ -2237,7 +2237,7 @@ void GetDDR3Info(PAST2300DRAMParam param) param->REG_AC2 = 0xDE44A61D; param->REG_DQSIC = 0x00000117; param->REG_MRS = 0x00081A30; - param->REG_EMRS = 0x00000000; + param->REG_EMRS = 0x00000000; param->REG_IOZ = 0x070000BB; param->REG_DQIDLY = 0x000000A0; param->REG_FREQ = 0x000054C0; @@ -2252,7 +2252,7 @@ void GetDDR3Info(PAST2300DRAMParam param) param->REG_DQSIC = 0x00000125; param->REG_MRS = 0x00081A30; param->REG_EMRS = 0x00000040; - param->REG_DRV = 0x000000F5; + param->REG_DRV = 0x000000F5; param->REG_IOZ = 0x00000023; param->REG_DQIDLY = 0x00000088; param->REG_FREQ = 0x000055C0; @@ -2269,7 +2269,7 @@ void GetDDR3Info(PAST2300DRAMParam param) param->REG_DQSIC = 0x0000013F; param->REG_MRS = 0x00101A50; param->REG_EMRS = 0x00000040; - param->REG_DRV = 0x000000FA; + param->REG_DRV = 0x000000FA; param->REG_IOZ = 0x00000023; param->REG_DQIDLY = 0x00000078; param->REG_FREQ = 0x000057C0; @@ -2278,7 +2278,7 @@ void GetDDR3Info(PAST2300DRAMParam param) break; case 600 : MOutdwm(mmiobase, 0x1E6E2020, 0x02E1); param->REG_MADJ = 0x00136868; - param->REG_SADJ = 0x00004534; + param->REG_SADJ = 0x00004534; param->WODT = 1; param->RODT = 1; param->REG_AC1 = 0x32302A37; @@ -2286,7 +2286,7 @@ void GetDDR3Info(PAST2300DRAMParam param) param->REG_DQSIC = 0x0000014D; param->REG_MRS = 0x00101A50; param->REG_EMRS = 0x00000004; - param->REG_DRV = 0x000000F5; + param->REG_DRV = 0x000000F5; param->REG_IOZ = 0x00000023; param->REG_DQIDLY = 0x00000078; param->REG_FREQ = 0x000058C0; @@ -2295,7 +2295,7 @@ void GetDDR3Info(PAST2300DRAMParam param) break; case 624 : MOutdwm(mmiobase, 0x1E6E2020, 0x0160); param->REG_MADJ = 0x00136868; - param->REG_SADJ = 0x00004534; + param->REG_SADJ = 0x00004534; param->WODT = 1; param->RODT = 1; param->REG_AC1 = 0x32302A37; @@ -2303,7 +2303,7 @@ void GetDDR3Info(PAST2300DRAMParam param) param->REG_DQSIC = 0x0000015A; param->REG_MRS = 0x02101A50; param->REG_EMRS = 0x00000004; - param->REG_DRV = 0x000000F5; + param->REG_DRV = 0x000000F5; param->REG_IOZ = 0x00000034; param->REG_DQIDLY = 0x00000078; param->REG_FREQ = 0x000059C0; @@ -2314,24 +2314,24 @@ void GetDDR3Info(PAST2300DRAMParam param) switch (param->DRAM_ChipID) { - case DRAMTYPE_512Mx16: + case DRAMTYPE_512Mx16: param->DRAM_CONFIG = 0x130; break; - default: - case DRAMTYPE_1Gx16: + default: + case DRAMTYPE_1Gx16: param->DRAM_CONFIG = 0x131; break; - case DRAMTYPE_2Gx16: + case DRAMTYPE_2Gx16: param->DRAM_CONFIG = 0x132; break; - case DRAMTYPE_4Gx16: + case DRAMTYPE_4Gx16: param->DRAM_CONFIG = 0x133; - break; + break; }; /* switch size */ switch (param->VRAM_Size) { - default: + default: case VIDEOMEM_SIZE_08M: param->DRAM_CONFIG |= 0x00; break; @@ -2343,22 +2343,22 @@ void GetDDR3Info(PAST2300DRAMParam param) break; case VIDEOMEM_SIZE_64M: param->DRAM_CONFIG |= 0x0c; - break; + break; } - + } void DDR2_Init(PAST2300DRAMParam param) { ULONG data, data2, retry = 0; UCHAR *mmiobase; - + mmiobase = param->pjMMIOVirtualAddress; -DDR2_Init_Start: +DDR2_Init_Start: MOutdwm(mmiobase, 0x1E6E0000, 0xFC600309); MOutdwm(mmiobase, 0x1E6E0064, 0x00000000); - MOutdwm(mmiobase, 0x1E6E0034, 0x00000000); + MOutdwm(mmiobase, 0x1E6E0034, 0x00000000); MOutdwm(mmiobase, 0x1E6E0018, 0x00000100); MOutdwm(mmiobase, 0x1E6E0024, 0x00000000); MOutdwm(mmiobase, 0x1E6E0064, param->REG_MADJ); @@ -2376,7 +2376,7 @@ DDR2_Init_Start: MOutdwm(mmiobase, 0x1E6E0084, 0x00FFFFFF); MOutdwm(mmiobase, 0x1E6E0088, param->REG_DQIDLY); MOutdwm(mmiobase, 0x1E6E0018, 0x4040A130); - MOutdwm(mmiobase, 0x1E6E0018, 0x20402330); + MOutdwm(mmiobase, 0x1E6E0018, 0x20402330); MOutdwm(mmiobase, 0x1E6E0038, 0x00000000); MOutdwm(mmiobase, 0x1E6E0040, 0xFF808000); MOutdwm(mmiobase, 0x1E6E0044, 0x88848466); @@ -2398,7 +2398,7 @@ DDR2_Init_Start: }while(!(data & 0x08000000)); MOutdwm(mmiobase, 0x1E6E0034, 0x00000001); MOutdwm(mmiobase, 0x1E6E000C, 0x00005C04); - usleep(10); + usleep(10); MOutdwm(mmiobase, 0x1E6E000C, 0x00000000); MOutdwm(mmiobase, 0x1E6E0034, 0x00000000); data = MIndwm(mmiobase, 0x1E6E001C); @@ -2431,7 +2431,7 @@ DDR2_Init_Start: MOutdwm(mmiobase, 0x1E6E0034, 0x00000001); MOutdwm(mmiobase, 0x1E6E000C, 0x00005C04); - usleep(10); + usleep(10); MOutdwm(mmiobase, 0x1E6E000C, 0x00000000); MOutdwm(mmiobase, 0x1E6E0034, 0x00000000); data = MIndwm(mmiobase, 0x1E6E001C); @@ -2439,7 +2439,7 @@ DDR2_Init_Start: } data = MIndwm(mmiobase, 0x1E6E0018) | 0xC00; MOutdwm(mmiobase, 0x1E6E0018, data); - + MOutdwm(mmiobase, 0x1E6E0034, 0x00000001); MOutdwm(mmiobase, 0x1E6E000C, 0x00000000); usleep(50); @@ -2499,13 +2499,13 @@ void DDR3_Init(PAST2300DRAMParam param) { ULONG data, data2, retry = 0; UCHAR *mmiobase; - + mmiobase = param->pjMMIOVirtualAddress; DDR3_Init_Start: MOutdwm(mmiobase, 0x1E6E0000, 0xFC600309); MOutdwm(mmiobase, 0x1E6E0064, 0x00000000); - MOutdwm(mmiobase, 0x1E6E0034, 0x00000000); + MOutdwm(mmiobase, 0x1E6E0034, 0x00000000); MOutdwm(mmiobase, 0x1E6E0018, 0x00000100); MOutdwm(mmiobase, 0x1E6E0024, 0x00000000); usleep(10); @@ -2546,7 +2546,7 @@ DDR3_Init_Start: }while(!(data & 0x08000000)); MOutdwm(mmiobase, 0x1E6E0034, 0x00000001); MOutdwm(mmiobase, 0x1E6E000C, 0x00005C04); - usleep(10); + usleep(10); MOutdwm(mmiobase, 0x1E6E000C, 0x00000000); MOutdwm(mmiobase, 0x1E6E0034, 0x00000000); data = MIndwm(mmiobase, 0x1E6E001C); @@ -2579,7 +2579,7 @@ DDR3_Init_Start: MOutdwm(mmiobase, 0x1E6E0034, 0x00000001); MOutdwm(mmiobase, 0x1E6E000C, 0x00005C04); - usleep(10); + usleep(10); MOutdwm(mmiobase, 0x1E6E000C, 0x00000000); MOutdwm(mmiobase, 0x1E6E0034, 0x00000000); data = MIndwm(mmiobase, 0x1E6E001C); @@ -2645,64 +2645,64 @@ void vInitAST2300DRAMReg(ScrnInfoPtr pScrn) ULONG i, ulTemp; UCHAR jReg; - GetIndexRegMask(CRTC_PORT, 0xD0, 0xFF, jReg); - + GetIndexRegMask(CRTC_PORT, 0xD0, 0xFF, jReg); + if ((jReg & 0x80) == 0) /* VGA only */ { *(ULONG *) (pAST->MMIOVirtualAddr + 0xF004) = 0x1e6e0000; *(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x1; - + *(ULONG *) (pAST->MMIOVirtualAddr + 0x12000) = 0x1688A8A8; do { - ; + ; } while (*(volatile ULONG *) (pAST->MMIOVirtualAddr + 0x12000) != 0x01); - + *(ULONG *) (pAST->MMIOVirtualAddr + 0x10000) = 0xFC600309; do { - ; + ; } while (*(volatile ULONG *) (pAST->MMIOVirtualAddr + 0x10000) != 0x01); /* Slow down CPU/AHB CLK in VGA only mode */ ulTemp = *(ULONG *) (pAST->MMIOVirtualAddr + 0x12008); ulTemp |= 0x73; *(ULONG *) (pAST->MMIOVirtualAddr + 0x12008) = ulTemp; - + param.pjMMIOVirtualAddress = pAST->MMIOVirtualAddr; param.DRAM_Type = DDR3; /* DDR3 */ - ulTemp = MIndwm(param.pjMMIOVirtualAddress, 0x1E6E2070); + ulTemp = MIndwm(param.pjMMIOVirtualAddress, 0x1E6E2070); if (ulTemp & 0x01000000) param.DRAM_Type = DDR2; /* DDR2 */ param.DRAM_ChipID = (ULONG) pAST->jDRAMType; param.DRAM_Freq = pAST->ulMCLK; param.VRAM_Size = pAST->ulVRAMSize; - + if (param.DRAM_Type == DDR3) { - GetDDR3Info(¶m); + GetDDR3Info(¶m); DDR3_Init(¶m); } else { GetDDR2Info(¶m); - DDR2_Init(¶m); + DDR2_Init(¶m); } - - ulTemp = MIndwm(param.pjMMIOVirtualAddress, 0x1E6E2040); + + ulTemp = MIndwm(param.pjMMIOVirtualAddress, 0x1E6E2040); MOutdwm(param.pjMMIOVirtualAddress, 0x1E6E2040, ulTemp | 0x40); } /* wait ready */ do { - GetIndexRegMask(CRTC_PORT, 0xD0, 0xFF, jReg); + GetIndexRegMask(CRTC_PORT, 0xD0, 0xFF, jReg); } while ((jReg & 0x40) == 0); - -} /* vInitAST2300DRAMReg */ + +} /* vInitAST2300DRAMReg */ void vGetDefaultSettings(ScrnInfoPtr pScrn) { ASTRecPtr pAST = ASTPTR(pScrn); - ULONG ulData; - + ULONG ulData; + if (pAST->jChipType == AST2300) { *(ULONG *) (pAST->MMIOVirtualAddr + 0xF004) = 0x1e6e0000; @@ -2711,29 +2711,29 @@ void vGetDefaultSettings(ScrnInfoPtr pScrn) switch (ulData & 0x18000000) { case 0x00000000: - pAST->jDRAMType = DRAMTYPE_512Mx16; - break; + pAST->jDRAMType = DRAMTYPE_512Mx16; + break; case 0x08000000: - pAST->jDRAMType = DRAMTYPE_1Gx16; + pAST->jDRAMType = DRAMTYPE_1Gx16; break; case 0x10000000: - pAST->jDRAMType = DRAMTYPE_2Gx16; - break; + pAST->jDRAMType = DRAMTYPE_2Gx16; + break; case 0x18000000: - pAST->jDRAMType = DRAMTYPE_4Gx16; - break; - } - } + pAST->jDRAMType = DRAMTYPE_4Gx16; + break; + } + } else if ((pAST->jChipType == AST2100) || (pAST->jChipType == AST2200)) { - pAST->jDRAMType = DRAMTYPE_512Mx32; + pAST->jDRAMType = DRAMTYPE_512Mx32; } else if ((pAST->jChipType == AST1100) || (pAST->jChipType == AST2150)) { - pAST->jDRAMType = DRAMTYPE_1Gx16; - } - -} /* vGetDefaultSettings */ + pAST->jDRAMType = DRAMTYPE_1Gx16; + } + +} /* vGetDefaultSettings */ /* * Flags: 0: POST init @@ -2750,34 +2750,34 @@ Bool InitVGA(ScrnInfoPtr pScrn, ULONG Flags) /* Enable PCI */ PCI_READ_LONG(pAST->PciInfo, &ulData, 0x04); ulData |= 0x03; - PCI_WRITE_LONG(pAST->PciInfo, ulData, 0x04); + PCI_WRITE_LONG(pAST->PciInfo, ulData, 0x04); /* Enable VGA */ vEnableVGA(pScrn); - + vASTOpenKey(pScrn); vSetDefExtReg(pScrn); if (Flags == 0) vGetDefaultSettings(pScrn); - + if (pAST->jChipType == AST2300) vInitAST2300DRAMReg(pScrn); else - vInitDRAMReg(pScrn); - + vInitDRAMReg(pScrn); + } - return (TRUE); + return (TRUE); } /* Init VGA */ /* Get EDID */ -void +void I2CWriteClock(ASTRecPtr pAST, UCHAR data) { UCHAR ujCRB7, jtemp; ULONG i; - + for (i=0;i<0x10000; i++) { ujCRB7 = ((data & 0x01) ? 0:1); /* low active */ @@ -2785,44 +2785,44 @@ I2CWriteClock(ASTRecPtr pAST, UCHAR data) GetIndexRegMask(CRTC_PORT, 0xB7, 0x01, jtemp); if (ujCRB7 == jtemp) break; } - + } -void +void I2CWriteData(ASTRecPtr pAST, UCHAR data) { UCHAR volatile ujCRB7, jtemp; ULONG i; - + for (i=0;i<0x1000; i++) - { + { ujCRB7 = ((data & 0x01) ? 0:1) << 2; /* low active */ SetIndexRegMask(CRTC_PORT, 0xB7, 0xFB, ujCRB7); GetIndexRegMask(CRTC_PORT, 0xB7, 0x04, jtemp); - if (ujCRB7 == jtemp) break; + if (ujCRB7 == jtemp) break; } - + } -Bool +Bool I2CReadClock(ASTRecPtr pAST) -{ +{ UCHAR volatile ujCRB7; - + GetIndexRegMask(CRTC_PORT, 0xB7, 0x10, ujCRB7); ujCRB7 >>= 4; - + return ((ujCRB7 & 0x01) ? 1:0); } -Bool +Bool I2CReadData(ASTRecPtr pAST) -{ +{ UCHAR volatile ujCRB7; - + GetIndexRegMask(CRTC_PORT, 0xB7, 0x20, ujCRB7); ujCRB7 >>= 5; - + return ((ujCRB7 & 0x01) ? 1:0); } @@ -2833,88 +2833,88 @@ I2CDelay(ASTRecPtr pAST) { ULONG i; UCHAR jtemp; - + for (i=0;i<150;i++) jtemp = GetReg(SEQ_PORT); - + } - -void + +void I2CStart(ASTRecPtr pAST) -{ +{ I2CWriteClock(pAST, 0x00); /* Set Clk Low */ I2CDelay(pAST); I2CWriteData(pAST, 0x01); /* Set Data High */ - I2CDelay(pAST); + I2CDelay(pAST); I2CWriteClock(pAST, 0x01); /* Set Clk High */ - I2CDelay(pAST); + I2CDelay(pAST); I2CWriteData(pAST, 0x00); /* Set Data Low */ - I2CDelay(pAST); + I2CDelay(pAST); I2CWriteClock(pAST, 0x01); /* Set Clk High */ - I2CDelay(pAST); -} + I2CDelay(pAST); +} -void +void I2CStop(ASTRecPtr pAST) { I2CWriteClock(pAST, 0x00); /* Set Clk Low */ - I2CDelay(pAST); + I2CDelay(pAST); I2CWriteData(pAST, 0x00); /* Set Data Low */ - I2CDelay(pAST); + I2CDelay(pAST); I2CWriteClock(pAST, 0x01); /* Set Clk High */ - I2CDelay(pAST); + I2CDelay(pAST); I2CWriteData(pAST, 0x01); /* Set Data High */ - I2CDelay(pAST); + I2CDelay(pAST); I2CWriteClock(pAST, 0x01); /* Set Clk High */ - I2CDelay(pAST); - + I2CDelay(pAST); + } -Bool +Bool CheckACK(ASTRecPtr pAST) { UCHAR Data; I2CWriteClock(pAST, 0x00); /* Set Clk Low */ - I2CDelay(pAST); + I2CDelay(pAST); I2CWriteData(pAST, 0x01); /* Set Data High */ - I2CDelay(pAST); + I2CDelay(pAST); I2CWriteClock(pAST, 0x01); /* Set Clk High */ - I2CDelay(pAST); + I2CDelay(pAST); Data = (UCHAR) I2CReadData(pAST); /* Set Data High */ - - return ((Data & 0x01) ? 0:1); - + + return ((Data & 0x01) ? 0:1); + } -void +void SendACK(ASTRecPtr pAST) { I2CWriteClock(pAST, 0x00); /* Set Clk Low */ - I2CDelay(pAST); + I2CDelay(pAST); I2CWriteData(pAST, 0x00); /* Set Data low */ - I2CDelay(pAST); + I2CDelay(pAST); I2CWriteClock(pAST, 0x01); /* Set Clk High */ - I2CDelay(pAST); - + I2CDelay(pAST); + } -void +void SendNACK(ASTRecPtr pAST) { I2CWriteClock(pAST, 0x00); /* Set Clk Low */ - I2CDelay(pAST); + I2CDelay(pAST); I2CWriteData(pAST, 0x01); /* Set Data high */ - I2CDelay(pAST); + I2CDelay(pAST); I2CWriteClock(pAST, 0x01); /* Set Clk High */ - I2CDelay(pAST); - + I2CDelay(pAST); + } -void +void SendI2CDataByte(ASTRecPtr pAST, UCHAR data) { UCHAR jData; @@ -2923,143 +2923,143 @@ SendI2CDataByte(ASTRecPtr pAST, UCHAR data) for (i=7;i>=0;i--) { I2CWriteClock(pAST, 0x00); /* Set Clk Low */ - I2CDelay(pAST); - + I2CDelay(pAST); + jData = ((data >> i) & 0x01) ? 1:0; I2CWriteData(pAST, jData); /* Set Data Low */ - I2CDelay(pAST); - + I2CDelay(pAST); + I2CWriteClock(pAST, 0x01); /* Set Clk High */ - I2CDelay(pAST); - } + I2CDelay(pAST); + } } -UCHAR +UCHAR ReceiveI2CDataByte(ASTRecPtr pAST) { - UCHAR jData=0, jTempData; + UCHAR jData=0, jTempData; LONG i, j; for (i=7;i>=0;i--) { I2CWriteClock(pAST, 0x00); /* Set Clk Low */ - I2CDelay(pAST); - + I2CDelay(pAST); + I2CWriteData(pAST, 0x01); /* Set Data High */ - I2CDelay(pAST); - + I2CDelay(pAST); + I2CWriteClock(pAST, 0x01); /* Set Clk High */ - I2CDelay(pAST); - + I2CDelay(pAST); + for (j=0; j<0x1000; j++) - { + { if (I2CReadClock(pAST)) break; - } - + } + jTempData = I2CReadData(pAST); - jData |= ((jTempData & 0x01) << i); + jData |= ((jTempData & 0x01) << i); I2CWriteClock(pAST, 0x0); /* Set Clk Low */ - I2CDelay(pAST); - } - - return ((UCHAR)jData); -} + I2CDelay(pAST); + } + + return ((UCHAR)jData); +} Bool GetVGAEDID(ScrnInfoPtr pScrn, unsigned char *pEDIDBuffer) { - ASTRecPtr pAST; + ASTRecPtr pAST; UCHAR *pjDstEDID; UCHAR jData; ULONG i; - pAST = ASTPTR(pScrn); + pAST = ASTPTR(pScrn); pjDstEDID = (UCHAR *) pEDIDBuffer; - + /* Force to DDC2 */ I2CWriteClock(pAST, 0x01); /* Set Clk High */ - I2CDelay(pAST); + I2CDelay(pAST); I2CWriteClock(pAST, 0x00); /* Set Clk Low */ - I2CDelay(pAST); + I2CDelay(pAST); I2CWriteClock(pAST, 0x01); /* Set Clk High */ - I2CDelay(pAST); + I2CDelay(pAST); /* Validate SCL */ if (I2CReadClock(pAST) == 0) /* chk SCL failed */ { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[GetVGAEDID] Check SCL Failed \n"); - return (FALSE); - } - + return (FALSE); + } + I2CStart(pAST); - + SendI2CDataByte(pAST, 0xA0); if (!CheckACK(pAST)) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[GetVGAEDID] Check ACK Failed \n"); return (FALSE); - } - + } + SendI2CDataByte(pAST, 0x00); if (!CheckACK(pAST)) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[GetVGAEDID] Check ACK Failed \n"); return (FALSE); - } - + } + I2CStart(pAST); - + SendI2CDataByte(pAST, 0xA1); if (!CheckACK(pAST)) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[GetVGAEDID] Check ACK Failed \n"); return (FALSE); - } - + } + for (i=0; i<127; i++) { jData = ReceiveI2CDataByte(pAST); SendACK(pAST); - - *pjDstEDID++ = jData; + + *pjDstEDID++ = jData; } - + jData = ReceiveI2CDataByte(pAST); SendNACK(pAST); - *pjDstEDID = jData; - + *pjDstEDID = jData; + I2CStop(pAST); - + return (TRUE); - + } /* GetVGAEDID */ Bool bInitAST1180(ScrnInfoPtr pScrn) { - ASTRecPtr pAST; + ASTRecPtr pAST; uint32_t ulData; - pAST = ASTPTR(pScrn); + pAST = ASTPTR(pScrn); /* Enable PCI */ PCI_READ_LONG(pAST->PciInfo, &ulData, 0x04); ulData |= 0x03; - PCI_WRITE_LONG(pAST->PciInfo, ulData, 0x04); - + PCI_WRITE_LONG(pAST->PciInfo, ulData, 0x04); + /* init DRAM if no F/W */ /* TODO */ WriteAST1180SOC(AST1180_MMC_BASE+0x00, 0xFC600309); /* unlock */ WriteAST1180SOC(AST1180_SCU_BASE+0x00, 0x1688a8a8); /* unlock */ usleep(100); - - WriteAST1180SOC(AST1180_MMC_BASE+0x08, 0x000011e3); /* req. */ - + + WriteAST1180SOC(AST1180_MMC_BASE+0x08, 0x000011e3); /* req. */ + /* init SCU */ #if 0 ReadAST1180SOC(AST1180_SCU_BASE+0x08, ulData); /* delay compensation */ - ulData &= 0xFFFFE0FF; + ulData &= 0xFFFFE0FF; ulData |= 0x00000C00; WriteAST1180SOC(AST1180_SCU_BASE+0x08, ulData); #endif @@ -3067,38 +3067,38 @@ Bool bInitAST1180(ScrnInfoPtr pScrn) ReadAST1180SOC(AST1180_SCU_BASE+0x0c, ulData); /* 2d clk */ ulData &= 0xFFFFFFFD; WriteAST1180SOC(AST1180_SCU_BASE+0x0c, ulData); - + return (TRUE); - + } /* bInitAST1180 */ - + void GetAST1180DRAMInfo(ScrnInfoPtr pScrn) { ASTRecPtr pAST = ASTPTR(pScrn); ULONG ulData; - + WriteAST1180SOC(AST1180_MMC_BASE+0x00, 0xFC600309); /* unlock */ ReadAST1180SOC(AST1180_MMC_BASE+0x04, ulData); pAST->ulDRAMBusWidth = 32; if (ulData & 0x40) pAST->ulDRAMBusWidth = 16; - - /* DRAM size */ + + /* DRAM size */ switch (ulData & 0x0C) { case 0x00: pAST->ulDRAMSize = DRAM_SIZE_032M; - break; + break; case 0x04: pAST->ulDRAMSize = DRAM_SIZE_064M; - break; + break; case 0x08: pAST->ulDRAMSize = DRAM_SIZE_128M; - break; - case 0x0c: + break; + case 0x0c: pAST->ulDRAMSize = DRAM_SIZE_256M; - break; - } + break; + } /* Get framebuffer size */ switch (ulData & 0x30) @@ -3108,23 +3108,23 @@ void GetAST1180DRAMInfo(ScrnInfoPtr pScrn) break; case 0x10: pAST->ulVRAMSize = DRAM_SIZE_032M; - break; + break; case 0x20: pAST->ulVRAMSize = DRAM_SIZE_064M; - break; + break; case 0x30: pAST->ulVRAMSize = DRAM_SIZE_128M; - break; - } + break; + } /* VRAM base */ if (pAST->ulVRAMSize >= pAST->ulDRAMSize) - pAST->ulVRAMSize = pAST->ulDRAMSize; + pAST->ulVRAMSize = pAST->ulDRAMSize; pAST->ulVRAMBase = pAST->ulDRAMSize - pAST->ulVRAMSize; - + /* MCLK */ pAST->ulMCLK = 200; - + } /* GetAST1180DRAMInfo */ void vEnableASTVGAMMIO(ScrnInfoPtr pScrn) @@ -3132,7 +3132,7 @@ void vEnableASTVGAMMIO(ScrnInfoPtr pScrn) ASTRecPtr pAST = ASTPTR(pScrn); ULONG ulData; UCHAR jReg; - + if (!xf86IsPrimaryPci(pAST->PciInfo)) { /* Enable PCI */ @@ -3141,14 +3141,14 @@ void vEnableASTVGAMMIO(ScrnInfoPtr pScrn) PCI_WRITE_LONG(pAST->PciInfo, ulData, 0x04); outb(pAST->RelocateIO + 0x43, 0x01); - outb(pAST->RelocateIO + 0x42, 0x01); - } - + outb(pAST->RelocateIO + 0x42, 0x01); + } + jReg = GetReg(VGA_ENABLE_PORT); if (jReg == 0xFF) /* MMIO Access is disabled */ { outw(pAST->RelocateIO + 0x54, 0xa880); - outw(pAST->RelocateIO + 0x54, 0x04a1); + outw(pAST->RelocateIO + 0x54, 0x04a1); } - + } /* vEnableASTVGAMMIO */ |