diff options
Diffstat (limited to 'src/rdc_2dtool.c')
-rw-r--r-- | src/rdc_2dtool.c | 59 |
1 files changed, 26 insertions, 33 deletions
diff --git a/src/rdc_2dtool.c b/src/rdc_2dtool.c index 16d9e26..12b2a63 100644 --- a/src/rdc_2dtool.c +++ b/src/rdc_2dtool.c @@ -18,6 +18,7 @@ * <jason.lin@rdc.com.tw> */ + #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -42,22 +43,22 @@ #include "xf86PciInfo.h" #include "xf86Pci.h" -/* framebuffer offscreen manager */ + #include "xf86fbman.h" -/* include xaa includes */ + #include "xaa.h" #include "xaarop.h" -/* H/W cursor support */ + #include "xf86Cursor.h" -/* Driver specific headers */ + #include "rdc.h" #ifdef Accel_2D -/* Prototype type declaration */ + Bool bInitCMDQInfo(ScrnInfoPtr pScrn, RDCRecPtr pRDC); Bool bEnableCMDQ(ScrnInfoPtr pScrn, RDCRecPtr pRDC); Bool bEnable2D(ScrnInfoPtr pScrn, RDCRecPtr pRDC); @@ -78,7 +79,7 @@ bInitCMDQInfo(ScrnInfoPtr pScrn, RDCRecPtr pRDC) pRDC->CMDQInfo.pjReadPort = pRDC->MMIOVirtualAddr+ 0x804C; pRDC->CMDQInfo.pjEngStatePort = pRDC->MMIOVirtualAddr+ 0x804C; - /* CMDQ mode Init */ + if (!pRDC->MMIO2D) { pRDC->CMDQInfo.ulCMDQType = VM_CMD_QUEUE; @@ -90,7 +91,7 @@ bInitCMDQInfo(ScrnInfoPtr pScrn, RDCRecPtr pRDC) pRDC->CMDQInfo.ulCMDQMask = pRDC->CMDQInfo.ulCMDQSize - 1 ; } - /* MMIO mode init */ + if (pRDC->MMIO2D) { pRDC->CMDQInfo.ulCMDQType = VM_CMD_MMIO; @@ -108,22 +109,22 @@ bEnableCMDQ(ScrnInfoPtr pScrn, RDCRecPtr pRDC) vWaitEngIdle(pScrn, pRDC); - /* set DBG Select Info */ + if (pRDC->DBGSelect) { *(ULONG *) (pRDC->MMIOVirtualAddr + 0x804C) = (ULONG) (pRDC->DBGSelect); } - /* set CMDQ base */ + switch (pRDC->CMDQInfo.ulCMDQType) { case VM_CMD_QUEUE: ulVMCmdQBasePort = pRDC->CMDQInfo.ulCMDQOffsetAddr >> 3; - /* set CMDQ Threshold */ + ulVMCmdQBasePort |= 0xF0000000; - /* set CMDQ Size */ + switch (pRDC->CMDQInfo.ulCMDQSize) { case CMD_QUEUE_SIZE_256K: @@ -152,9 +153,9 @@ bEnableCMDQ(ScrnInfoPtr pScrn, RDCRecPtr pRDC) break; case VM_CMD_MMIO: - /* set CMDQ Threshold */ + ulVMCmdQBasePort |= 0xF0000000; - ulVMCmdQBasePort |= 0x02000000; /* MMIO mode */ + ulVMCmdQBasePort |= 0x02000000; *(ULONG *) (pRDC->CMDQInfo.pjCmdQBasePort) = ulVMCmdQBasePort; break; @@ -172,9 +173,9 @@ bEnable2D(ScrnInfoPtr pScrn, RDCRecPtr pRDC) xf86DrvMsgVerb(0, X_INFO, InternalLevel, "==Enable 2D== \n"); - SetIndexRegMask(CRTC_PORT, 0xA4, 0xFE, 0x01); /* enable 2D */ + SetIndexRegMask(CRTC_PORT, 0xA4, 0xFE, 0x01); - SetIndexRegMask(CRTC_PORT, 0xA3, ~0x20, 0x20); /* enable flip */ + SetIndexRegMask(CRTC_PORT, 0xA3, ~0x20, 0x20); *(ULONG *)MMIOREG_1ST_FLIP |= 0x80000000; if (!bInitCMDQInfo(pScrn, pRDC)) @@ -198,10 +199,9 @@ vDisable2D(ScrnInfoPtr pScrn, RDCRecPtr pRDC) xf86DrvMsgVerb(0, X_INFO, InternalLevel, "==Engine Disable 2D== \n"); vWaitEngIdle(pScrn, pRDC); - vWaitEngIdle(pScrn, pRDC); SetIndexRegMask(CRTC_PORT, 0xA4, 0xFE, 0x00); - SetIndexRegMask(CRTC_PORT, 0xA3, ~0x20, 0x00); /* disable flip */ + SetIndexRegMask(CRTC_PORT, 0xA3, ~0x20, 0x00); *(ULONG *)MMIOREG_1ST_FLIP &= ~0x80000000; } @@ -213,7 +213,7 @@ vWaitEngIdle(ScrnInfoPtr pScrn, RDCRecPtr pRDC) xf86DrvMsgVerb(0, X_INFO, 10, "==Entry Wait Idle== \n"); - do /* wait engine idle */ + do { ulEngState = *((volatile ULONG*)(pRDC->MMIOVirtualAddr + 0x804c)); ulEngState2 = *((volatile ULONG*)(pRDC->MMIOVirtualAddr + 0x8048)); @@ -223,19 +223,12 @@ vWaitEngIdle(ScrnInfoPtr pScrn, RDCRecPtr pRDC) xf86DrvMsgVerb(0, X_INFO, 10, "==Exit Wait Idle== \n"); } -/* ULONG ulGetCMDQLength() */ + __inline ULONG ulGetCMDQLength(RDCRecPtr pRDC, ULONG ulWritePointer, ULONG ulCMDQMask) { - ULONG ulReadPointer, ulReadPointer2; + ULONG ulReadPointer; - do { - ulReadPointer = *((volatile ULONG *)(pRDC->CMDQInfo.pjReadPort)) & 0x0003FFFF; - ulReadPointer2 = *((volatile ULONG *)(pRDC->CMDQInfo.pjReadPort)) & 0x0003FFFF; - ulReadPointer2 = *((volatile ULONG *)(pRDC->CMDQInfo.pjReadPort)) & 0x0003FFFF; - ulReadPointer2 = *((volatile ULONG *)(pRDC->CMDQInfo.pjReadPort)) & 0x0003FFFF; - ulReadPointer2 = *((volatile ULONG *)(pRDC->CMDQInfo.pjReadPort)) & 0x0003FFFF; - ulReadPointer2 = *((volatile ULONG *)(pRDC->CMDQInfo.pjReadPort)) & 0x0003FFFF; - } while (ulReadPointer != ulReadPointer2); + ulReadPointer = *((volatile ULONG *)(pRDC->CMDQInfo.pjReadPort)) & 0x0003FFFF; return ((ulReadPointer << 3) - ulWritePointer - CMD_QUEUE_GUARD_BAND) & ulCMDQMask; } @@ -252,7 +245,7 @@ RDCRecPtr pRDC, ULONG ulDataLen) if (ulContinueCMDQLen >= ulDataLen) { - /* Get CMDQ Buffer */ + if (pRDC->CMDQInfo.ulCurCMDQueueLen < ulDataLen) { do @@ -271,7 +264,7 @@ RDCRecPtr pRDC, ULONG ulDataLen) else { - /* Fill NULL CMD to the last of the CMDQ */ + if (pRDC->CMDQInfo.ulCurCMDQueueLen < ulContinueCMDQLen) { do @@ -293,7 +286,7 @@ RDCRecPtr pRDC, ULONG ulDataLen) pRDC->CMDQInfo.ulCurCMDQueueLen -= ulContinueCMDQLen; pRDC->CMDQInfo.ulWritePointer = ulWritePointer = 0; - /* Get CMDQ Buffer */ + if (pRDC->CMDQInfo.ulCurCMDQueueLen < ulDataLen) { do @@ -310,6 +303,6 @@ RDCRecPtr pRDC, ULONG ulDataLen) return pjBuffer; } -} /* end of pjRequestCmdQ() */ +} -#endif /* end of Accel_2D */ +#endif |