diff options
author | Gareth Hughes <gareth@users.sourceforge.net> | 2001-03-21 13:10:27 +0000 |
---|---|---|
committer | Gareth Hughes <gareth@users.sourceforge.net> | 2001-03-21 13:10:27 +0000 |
commit | 92b0aaa6fe787c2e17bba1973d19d6fd5a61d03a (patch) | |
tree | a3e5c187618eea1fcc0381cdef540b4b88822dfc /linux/mga_dma.c | |
parent | b90028231c5c73783ee45124903794970f244978 (diff) |
- Fix MGA header info.
- Update date strings.
- Fix MGA hangs (undocumented side effects of DWGSYNC).
- Remove idle before ILOAD??? Seems fine with the above fix.
Diffstat (limited to 'linux/mga_dma.c')
-rw-r--r-- | linux/mga_dma.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/linux/mga_dma.c b/linux/mga_dma.c index bfc661c3..66c9df9f 100644 --- a/linux/mga_dma.c +++ b/linux/mga_dma.c @@ -64,7 +64,10 @@ int mga_do_wait_for_idle( drm_mga_private_t *dev_priv ) udelay( 1 ); } - DRM_DEBUG( "failed! status=0x%08x\n", status ); +#if MGA_DMA_DEBUG + DRM_ERROR( "failed!\n" ); + DRM_INFO( " status=0x%08x\n", status ); +#endif return -EBUSY; } @@ -80,7 +83,9 @@ int mga_do_dma_idle( drm_mga_private_t *dev_priv ) udelay( 1 ); } - DRM_DEBUG( "failed! status=0x%08x\n", status ); +#if MGA_DMA_DEBUG + DRM_ERROR( "failed! status=0x%08x\n", status ); +#endif return -EBUSY; } @@ -209,7 +214,7 @@ void mga_do_dma_wrap_start( drm_mga_private_t *dev_priv ) DMA_BLOCK( MGA_DMAPAD, 0x00000000, MGA_DMAPAD, 0x00000000, MGA_DMAPAD, 0x00000000, - MGA_DWGSYNC, 0x12345678 ); + MGA_DMAPAD, 0x00000000 ); ADVANCE_DMA(); @@ -236,11 +241,13 @@ void mga_do_dma_wrap_start( drm_mga_private_t *dev_priv ) mga_flush_write_combine(); MGA_WRITE( MGA_PRIMEND, tail | MGA_PAGPXFER ); + set_bit( 0, &primary->wrapped ); DRM_DEBUG( "%s: done.\n", __FUNCTION__ ); } void mga_do_dma_wrap_end( drm_mga_private_t *dev_priv ) { + drm_mga_primary_buffer_t *primary = &dev_priv->prim; drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; u32 head = dev_priv->primary->offset; DRM_DEBUG( "%s:\n", __FUNCTION__ ); @@ -251,6 +258,7 @@ void mga_do_dma_wrap_end( drm_mga_private_t *dev_priv ) mga_flush_write_combine(); MGA_WRITE( MGA_PRIMADDRESS, head | MGA_DMA_GENERAL ); + clear_bit( 0, &primary->wrapped ); DRM_DEBUG( "%s: done.\n", __FUNCTION__ ); } @@ -542,6 +550,7 @@ static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init ) dev_priv->prim.tail = 0; dev_priv->prim.space = dev_priv->prim.size; + dev_priv->prim.wrapped = 0; dev_priv->prim.last_flush = 0; dev_priv->prim.last_wrap = 0; @@ -633,15 +642,21 @@ int mga_dma_flush( struct inode *inode, struct file *filp, (lock.flags & _DRM_LOCK_FLUSH_ALL) ? "flush all, " : "", (lock.flags & _DRM_LOCK_QUIESCENT) ? "idle, " : "" ); - WRAP_TEST_WITH_RETURN( dev_priv ); + WRAP_WAIT_WITH_RETURN( dev_priv ); -#if 0 if ( lock.flags & (_DRM_LOCK_FLUSH | _DRM_LOCK_FLUSH_ALL) ) { mga_do_dma_flush( dev_priv ); } -#endif + if ( lock.flags & _DRM_LOCK_QUIESCENT ) { +#if MGA_DMA_DEBUG + int ret = mga_do_wait_for_idle( dev_priv ); + if ( ret < 0 ) + DRM_INFO( __FUNCTION__": -EBUSY\n" ); + return ret; +#else return mga_do_wait_for_idle( dev_priv ); +#endif } else { return 0; } @@ -693,6 +708,7 @@ int mga_dma_buffers( struct inode *inode, struct file *filp, drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; drm_device_dma_t *dma = dev->dma; + drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; drm_dma_t d; int ret = 0; @@ -717,6 +733,8 @@ int mga_dma_buffers( struct inode *inode, struct file *filp, return -EINVAL; } + WRAP_TEST_WITH_RETURN( dev_priv ); + d.granted_count = 0; if ( d.request_count ) { |