diff options
author | Keith Whitwell <keith@tungstengraphics.com> | 2005-02-10 12:52:52 +0000 |
---|---|---|
committer | Keith Whitwell <keith@tungstengraphics.com> | 2005-02-10 12:52:52 +0000 |
commit | 5d89db5b2802787bf94dbb38cd156318db8b2369 (patch) | |
tree | 6cd13da0754fc1824ddf5ee0b3e4788ac259fd6c | |
parent | e1f5b78917918763a2e3958825c330bf941becfb (diff) |
fix minor locking bugs
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_ioctl.c | 29 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_ioctl.h | 1 |
2 files changed, 29 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c index 6acf4252d8..7c5cad236f 100644 --- a/src/mesa/drivers/dri/unichrome/via_ioctl.c +++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c @@ -457,6 +457,32 @@ void viaWaitIdle( struct via_context *vmesa ) } +void viaWaitIdleLocked( struct via_context *vmesa ) +{ + if (vmesa->dmaLow) + viaFlushDmaLocked(vmesa, 0); + + if (VIA_DEBUG & DEBUG_IOCTL) + fprintf(stderr, "%s lastDma %d lastBreadcrumbWrite %d\n", + __FUNCTION__, vmesa->lastDma, vmesa->lastBreadcrumbWrite); + + /* Need to emit a new breadcrumb? + */ + if (vmesa->lastDma == vmesa->lastBreadcrumbWrite) { + viaEmitBreadcrumbLocked( vmesa ); + } + + /* Need to wait? + */ + if (vmesa->lastDma >= vmesa->lastBreadcrumbRead) + viaWaitBreadcrumb( vmesa, vmesa->lastDma ); + + while(!viaCheckIdle(vmesa)) + ; +} + + + /* Wait for command stream to be processed *and* the next vblank to * occur. Equivalent to calling WAIT_IDLE() and then WaitVBlank, * except that WAIT_IDLE() will spin the CPU polling, while this is @@ -578,6 +604,7 @@ void viaCopyBuffer(const __DRIdrawablePrivate *dPriv) */ if (dPriv->numClipRects && vmesa->sarea->pfCurrentOffset != 0) { viaResetPageFlippingLocked(vmesa); + UNLOCK_HARDWARE(vmesa);xo return; } @@ -670,7 +697,7 @@ static int fire_buffer(struct via_context *vmesa) /* Fall through to PCI handling?!? */ - viaWaitIdle(vmesa); + viaWaitIdleLocked(vmesa); } ret = drmCommandWrite(vmesa->driFd, DRM_VIA_PCICMD, &bufI, sizeof(bufI)); diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.h b/src/mesa/drivers/dri/unichrome/via_ioctl.h index 19df625b70..88bc52b7c4 100644 --- a/src/mesa/drivers/dri/unichrome/via_ioctl.h +++ b/src/mesa/drivers/dri/unichrome/via_ioctl.h @@ -38,6 +38,7 @@ void viaPageFlip(const __DRIdrawablePrivate *dpriv); void viaCheckDma(struct via_context *vmesa, GLuint bytes); void viaResetPageFlippingLocked(struct via_context *vmesa); void viaWaitIdle(struct via_context *vmesa); +void viaWaitIdleLocked(struct via_context *vmesa); GLboolean viaCheckBreadcrumb( struct via_context *vmesa, GLuint value ); void viaEmitBreadcrumb( struct via_context *vmesa ); |