diff options
Diffstat (limited to 'src/nv_dma.c')
-rw-r--r-- | src/nv_dma.c | 78 |
1 files changed, 43 insertions, 35 deletions
diff --git a/src/nv_dma.c b/src/nv_dma.c index e248902..ca5e122 100644 --- a/src/nv_dma.c +++ b/src/nv_dma.c @@ -23,6 +23,33 @@ void NVDmaKickoffCallback(NVPtr pNv) */ #define SKIPS 8 +static void NVDumpLockupInfo(NVPtr pNv) +{ + int i,start; + start=READ_GET(pNv)-20; + if (start<0) start=0; + xf86DrvMsg(0, X_INFO, "Fifo dump (lockup 0x%04x,0x%04x):\n",READ_GET(pNv),pNv->dmaPut); + for(i=start;i<pNv->dmaPut+10;i++) + xf86DrvMsg(0, X_INFO, "[0x%04x] 0x%08x\n", i, pNv->dmaBase[i]); + xf86DrvMsg(0, X_INFO, "End of fifo dump\n"); +} + +static void +NVLockedUp(ScrnInfoPtr pScrn) +{ + NVPtr pNv = NVPTR(pScrn); + + /* avoid re-entering FatalError on shutdown */ + if (pNv->LockedUp) + return; + pNv->LockedUp = TRUE; + + NVDumpLockupInfo(pNv); + + FatalError("DMA queue hang: dmaPut=%x, current=%x, status=%x\n", + pNv->dmaPut, READ_GET(pNv), pNv->PGRAPH[NV_PGRAPH_STATUS/4]); +} + void NVDmaWait (ScrnInfoPtr pScrn, int size) { NVPtr pNv = NVPTR(pScrn); @@ -44,7 +71,7 @@ void NVDmaWait (ScrnInfoPtr pScrn, int size) WRITE_PUT(pNv, SKIPS + 1); do { if (GetTimeInMillis() - t_start > 2000) - NVSync(pScrn); + NVLockedUp(pScrn); dmaGet = READ_GET(pNv); } while(dmaGet <= SKIPS); } @@ -52,45 +79,20 @@ void NVDmaWait (ScrnInfoPtr pScrn, int size) pNv->dmaCurrent = pNv->dmaPut = SKIPS; pNv->dmaFree = dmaGet - (SKIPS + 1); } - } else + } else { pNv->dmaFree = dmaGet - pNv->dmaCurrent - 1; + } if (GetTimeInMillis() - t_start > 2000) - NVSync(pScrn); + NVLockedUp(pScrn); } } -static void NVDumpLockupInfo(NVPtr pNv) -{ - int i,start; - start=READ_GET(pNv)-20; - if (start<0) start=0; - xf86DrvMsg(0, X_INFO, "Fifo dump (lockup 0x%04x,0x%04x):\n",READ_GET(pNv),pNv->dmaPut); - for(i=start;i<pNv->dmaPut+10;i++) - xf86DrvMsg(0, X_INFO, "[0x%04x] 0x%08x\n", i, pNv->dmaBase[i]); - xf86DrvMsg(0, X_INFO, "End of fifo dump\n"); -} - -static void -NVLockedUp(ScrnInfoPtr pScrn) -{ - NVPtr pNv = NVPTR(pScrn); - - /* avoid re-entering FatalError on shutdown */ - if (pNv->LockedUp) - return; - pNv->LockedUp = TRUE; - - NVDumpLockupInfo(pNv); - - FatalError("DMA queue hang: dmaPut=%x, current=%x, status=%x\n", - pNv->dmaPut, READ_GET(pNv), pNv->PGRAPH[NV_PGRAPH_STATUS/4]); -} - void NVSync(ScrnInfoPtr pScrn) { NVPtr pNv = NVPTR(pScrn); int t_start, timeout = 2000; + int subc; if(pNv->NoAccel) return; @@ -108,10 +110,11 @@ void NVSync(ScrnInfoPtr pScrn) } /* Wait for channel to go completely idle */ + subc = (pNv->Architecture >= NV_ARCH_50) ? NvSub2D : NvSubImageBlit; NVNotifierReset(pScrn, pNv->Notifier0); - NVDmaStart(pNv, NvSubImageBlit, 0x104, 1); + NVDmaStart(pNv, subc, 0x104, 1); NVDmaNext (pNv, 0); - NVDmaStart(pNv, NvSubImageBlit, 0x100, 1); + NVDmaStart(pNv, subc, 0x100, 1); NVDmaNext (pNv, 0); NVDmaKickoff(pNv); if (!NVNotifierWaitStatus(pScrn, pNv->Notifier0, 0, timeout)) @@ -128,8 +131,9 @@ void NVResetGraphics(ScrnInfoPtr pScrn) pitch = pNv->CurrentLayout.displayWidth * (pNv->CurrentLayout.bitsPerPixel >> 3); +#if 0 pNv->dmaPut = pNv->dmaCurrent = READ_GET(pNv); - pNv->dmaMax = (pNv->fifo.cmdbuf_size >> 2) - 1; + pNv->dmaMax = (pNv->fifo.cmdbuf_size >> 2) - 2; pNv->dmaFree = pNv->dmaMax - pNv->dmaCurrent; /* assert there's enough room for the skips */ @@ -140,9 +144,13 @@ void NVResetGraphics(ScrnInfoPtr pScrn) pNv->dmaBase[i]=0; } pNv->dmaFree -= SKIPS; +#endif NVAccelCommonInit(pScrn); + if (pNv->Architecture >= NV_ARCH_50) + return; + /* EXA + XAA + Xv */ NVDmaSetObjectOnSubchannel(pNv, NvSubContextSurfaces, NvContextSurfaces); NVDmaSetObjectOnSubchannel(pNv, NvSubRectangle , NvRectangle ); @@ -304,8 +312,8 @@ Bool NVInitDma(ScrnInfoPtr pScrn) xf86DrvMsg(pScrn->scrnIndex, X_INFO, " DMA base PUT : 0x%08x\n", pNv->fifo.put_base); - pNv->dmaPut = pNv->dmaCurrent = READ_GET(pNv); - pNv->dmaMax = (pNv->fifo.cmdbuf_size >> 2) - 1; + pNv->dmaPut = pNv->dmaCurrent = 0; + pNv->dmaMax = (pNv->fifo.cmdbuf_size >> 2) - 2; pNv->dmaFree = pNv->dmaMax - pNv->dmaCurrent; for (i=0; i<SKIPS; i++) |