diff options
-rw-r--r-- | linux/mga_dma.c | 92 | ||||
-rw-r--r-- | linux/mga_drv.h | 9 | ||||
-rw-r--r-- | linux/mga_warp.c | 6 |
3 files changed, 30 insertions, 77 deletions
diff --git a/linux/mga_dma.c b/linux/mga_dma.c index d314a1a8b..952617c68 100644 --- a/linux/mga_dma.c +++ b/linux/mga_dma.c @@ -83,37 +83,33 @@ int mga_do_dma_idle( drm_mga_private_t *dev_priv ) return -EBUSY; } -int mga_do_dma_reset( drm_device_t *dev ) +int mga_do_dma_reset( drm_mga_private_t *dev_priv ) { - drm_mga_private_t *dev_priv = dev->dev_private; drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; drm_mga_primary_buffer_t *primary = &dev_priv->prim; - DRM_INFO( "%s\n", __FUNCTION__ ); + DRM_DEBUG( "%s\n", __FUNCTION__ ); /* The primary DMA stream should look like new right about now. */ primary->tail = 0; primary->space = primary->size; primary->last_flush = 0; - primary->last_wrap = 0; - - primary->status[0] = dev_priv->primary->offset; - primary->status[1] = 0; sarea_priv->last_wrap = 0; - sarea_priv->last_frame.head = 0; - sarea_priv->last_frame.wrap = 0; - mga_freelist_reset( dev ); + /* FIXME: Reset counters, buffer ages etc... + */ + + /* FIXME: What else do we need to reinitialize? WARP stuff? + */ return 0; } -int mga_do_engine_reset( drm_device_t *dev ) +int mga_do_engine_reset( drm_mga_private_t *dev_priv ) { - drm_mga_private_t *dev_priv = dev->dev_private; - DRM_INFO( "%s\n", __FUNCTION__ ); + DRM_DEBUG( "%s\n", __FUNCTION__ ); /* Okay, so we've completely screwed up and locked the engine. * How about we clean up after ourselves? @@ -129,21 +125,19 @@ int mga_do_engine_reset( drm_device_t *dev ) * 3D clients should probably die after calling this. The X * server should reset the engine state to known values. */ +#if 0 MGA_WRITE( MGA_PRIMPTR, - virt_to_bus((void *)dev_priv->prim.status) | - MGA_PRIMPTREN0 | /* Soft trap, SECEND, SETUPEND */ - MGA_PRIMPTREN1 ); /* DWGSYNC */ + virt_to_bus((void *)dev_priv->prim.status_page) | + MGA_PRIMPTREN0 | + MGA_PRIMPTREN1 ); +#endif - /* The primary DMA stream should look like new right about now. - */ - mga_do_dma_reset( dev ); + MGA_WRITE( MGA_ICLEAR, MGA_SOFTRAPICLR ); + MGA_WRITE( MGA_IEN, MGA_SOFTRAPIEN ); - /* Initialize the WARP engine again. + /* The primary DMA stream should look like new right about now. */ - if ( mga_warp_init( dev_priv ) < 0 ) { - /* Can we do anything else? */ - DRM_ERROR( "failed to reinit WARP engine!\n" ); - } + mga_do_dma_reset( dev_priv ); /* This bad boy will never fail. */ @@ -493,14 +487,14 @@ static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init ) DRM_IOREMAP( dev_priv->primary ); DRM_IOREMAP( dev_priv->buffers ); - ret = mga_warp_install_microcode( dev_priv ); + ret = mga_warp_install_microcode( dev ); if ( ret < 0 ) { DRM_ERROR( "failed to install WARP ucode!\n" ); mga_do_cleanup_dma( dev ); return ret; } - ret = mga_warp_init( dev_priv ); + ret = mga_warp_init( dev ); if ( ret < 0 ) { DRM_ERROR( "failed to init WARP engine!\n" ); mga_do_cleanup_dma( dev ); @@ -550,49 +544,6 @@ static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init ) return -ENOMEM; } - - if ( 0 ) { - drm_mga_primary_buffer_t *primary = &dev_priv->prim; - u32 tail; - DMA_LOCALS; - - BEGIN_DMA( 4 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000 ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000 ); - - ADVANCE_DMA(); - - tail = primary->tail + dev_priv->primary->offset - 4096; - - mga_flush_write_combine(); - MGA_WRITE( MGA_PRIMEND, tail | MGA_PAGPXFER ); - - - if ( mga_do_wait_for_idle( dev_priv ) < 0 ) { - DRM_INFO( "cool, we're fucked!\n" ); - mga_do_engine_reset( dev ); - } - } - - return 0; } @@ -681,10 +632,11 @@ int mga_dma_reset( struct inode *inode, struct file *filp, { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; + drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; LOCK_TEST_WITH_RETURN( dev ); - return mga_do_dma_reset( dev ); + return mga_do_dma_reset( dev_priv ); } diff --git a/linux/mga_drv.h b/linux/mga_drv.h index 349a9c64c..f56186e1e 100644 --- a/linux/mga_drv.h +++ b/linux/mga_drv.h @@ -114,9 +114,8 @@ extern int mga_dma_buffers( struct inode *inode, struct file *filp, extern int mga_do_wait_for_idle( drm_mga_private_t *dev_priv ); extern int mga_do_dma_idle( drm_mga_private_t *dev_priv ); - -extern int mga_do_dma_reset( drm_device_t *dev ); -extern int mga_do_engine_reset( drm_device_t *dev ); +extern int mga_do_dma_reset( drm_mga_private_t *dev_priv ); +extern int mga_do_engine_reset( drm_mga_private_t *dev_priv ); extern int mga_do_cleanup_dma( drm_device_t *dev ); extern void mga_do_dma_flush( drm_mga_private_t *dev_priv ); @@ -141,8 +140,8 @@ extern int mga_dma_blit( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); /* mga_warp.c */ -extern int mga_warp_install_microcode( drm_mga_private_t *dev_priv ); -extern int mga_warp_init( drm_mga_private_t *dev_priv ); +extern int mga_warp_install_microcode( drm_device_t *dev ); +extern int mga_warp_init( drm_device_t *dev ); #define mga_flush_write_combine() mb() diff --git a/linux/mga_warp.c b/linux/mga_warp.c index 436e24f5d..5994ab0c0 100644 --- a/linux/mga_warp.c +++ b/linux/mga_warp.c @@ -160,8 +160,9 @@ static int mga_warp_install_g200_microcode( drm_mga_private_t *dev_priv ) return 0; } -int mga_warp_install_microcode( drm_mga_private_t *dev_priv ) +int mga_warp_install_microcode( drm_device_t *dev ) { + drm_mga_private_t *dev_priv = dev->dev_private; DRM_DEBUG( "%s\n", __FUNCTION__ ); switch ( dev_priv->chipset ) { @@ -176,8 +177,9 @@ int mga_warp_install_microcode( drm_mga_private_t *dev_priv ) #define WMISC_EXPECTED (MGA_WUCODECACHE_ENABLE | MGA_WMASTER_ENABLE) -int mga_warp_init( drm_mga_private_t *dev_priv ) +int mga_warp_init( drm_device_t *dev ) { + drm_mga_private_t *dev_priv = dev->dev_private; u32 wmisc; DRM_DEBUG( "%s\n", __FUNCTION__ ); |