diff options
author | Keith Whitwell <keith@tungstengraphics.com> | 2003-01-02 18:38:07 +0000 |
---|---|---|
committer | Keith Whitwell <keith@tungstengraphics.com> | 2003-01-02 18:38:07 +0000 |
commit | 208c0779b65242159bbb87153269faef9370670c (patch) | |
tree | 478f4b427dbdc6c1be7e8ccab178acf50a73465c /shared/radeon_cp.c | |
parent | ab9eb685c002bc875e9a7d81b7ac7bd5fd0be1d4 (diff) |
Make the radeon drm module better at cleaning up after itself if all the
clients (particularly the X server) exit without doing so for it.
Diffstat (limited to 'shared/radeon_cp.c')
-rw-r--r-- | shared/radeon_cp.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/shared/radeon_cp.c b/shared/radeon_cp.c index 7c869c02..02fceced 100644 --- a/shared/radeon_cp.c +++ b/shared/radeon_cp.c @@ -1354,6 +1354,9 @@ int radeon_cp_stop( DRM_IOCTL_ARGS ) DRM_COPY_FROM_USER_IOCTL( stop, (drm_radeon_cp_stop_t *)data, sizeof(stop) ); + if (!dev_priv->cp_running) + return 0; + /* Flush any pending CP commands. This ensures any outstanding * commands are exectuted by the engine before we turn it off. */ @@ -1381,6 +1384,31 @@ int radeon_cp_stop( DRM_IOCTL_ARGS ) return 0; } + +void radeon_do_release( drm_device_t *dev ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + + printk("radeon_do_release: %p\n", dev_priv); + + if (dev_priv) { + /* Stop the cp */ + radeon_do_cp_flush( dev_priv ); + radeon_do_cp_idle( dev_priv ); + radeon_do_cp_stop( dev_priv ); + radeon_do_engine_reset( dev ); + + /* Disable *all* interrupts */ + RADEON_WRITE( RADEON_GEN_INT_CNTL, 0 ); + + /* Destroy agp heap ??? */ +/* radeon_mem_takedown( &(dev_priv->agp_heap) ); */ + + /* deallocate kernel resources */ + radeon_do_cleanup_cp( dev ); + } +} + /* Just reset the CP ring. Called as part of an X Server engine reset. */ int radeon_cp_reset( DRM_IOCTL_ARGS ) @@ -1412,9 +1440,6 @@ int radeon_cp_idle( DRM_IOCTL_ARGS ) LOCK_TEST_WITH_RETURN( dev ); -/* if (dev->irq) */ -/* radeon_emit_and_wait_irq( dev ); */ - return radeon_do_cp_idle( dev_priv ); } |