diff options
author | Thomas Hellstrom <thomas@tungstengraphics.com> | 2006-06-19 09:12:50 +0000 |
---|---|---|
committer | Thomas Hellstrom <thomas@tungstengraphics.com> | 2006-06-19 09:12:50 +0000 |
commit | 58b63ee5ccc1427a6835ef5112fe556faa9e1be3 (patch) | |
tree | f4c109974601d12474da77898918355011403c7b | |
parent | 96f272884d6caf7940c9bc3c95dcac75b0a8cd3f (diff) |
Fix buffer cleanup on close. Move memory manager reset from final_context
to lastclose.
-rw-r--r-- | linux-core/sis_drv.c | 4 | ||||
-rw-r--r-- | linux-core/sis_mm.c | 23 | ||||
-rw-r--r-- | shared-core/sis_drv.h | 7 |
3 files changed, 18 insertions, 16 deletions
diff --git a/linux-core/sis_drv.c b/linux-core/sis_drv.c index 5d55357c..4119bc3c 100644 --- a/linux-core/sis_drv.c +++ b/linux-core/sis_drv.c @@ -72,8 +72,10 @@ static struct drm_driver driver = { .driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR, .load = sis_driver_load, .unload = sis_driver_unload, - .context_dtor = sis_final_context, + .context_dtor = NULL, .reclaim_buffers = NULL, + .reclaim_buffers_locked = sis_reclaim_buffers_locked, + .lastclose = sis_lastclose, .get_map_ofs = drm_core_get_map_ofs, .get_reg_ofs = drm_core_get_reg_ofs, .ioctls = sis_ioctls, diff --git a/linux-core/sis_mm.c b/linux-core/sis_mm.c index ee924535..a89ed64b 100644 --- a/linux-core/sis_mm.c +++ b/linux-core/sis_mm.c @@ -232,19 +232,18 @@ static int sis_ioctl_agp_alloc(DRM_IOCTL_ARGS) return sis_drm_alloc(dev, priv, data, AGP_TYPE); } -int sis_final_context(struct drm_device *dev, int context) +void sis_lastclose(struct drm_device *dev) { - if (dev->ctx_count == 1 && dev->dev_private) { - drm_sis_private_t *dev_priv = dev->dev_private; - - DRM_DEBUG("Last Context\n"); - down(&dev->struct_sem); - drm_sman_cleanup(&dev_priv->sman); - dev_priv->vram_initialized = FALSE; - dev_priv->agp_initialized = FALSE; - up(&dev->struct_sem); - } - return 1; + drm_sis_private_t *dev_priv = dev->dev_private; + + if (!dev_priv) + return; + + down(&dev->struct_sem); + drm_sman_cleanup(&dev_priv->sman); + dev_priv->vram_initialized = FALSE; + dev_priv->agp_initialized = FALSE; + up(&dev->struct_sem); } void sis_reclaim_buffers_locked(drm_device_t * dev, struct file *filp) diff --git a/shared-core/sis_drv.h b/shared-core/sis_drv.h index 037bc49d..636e5327 100644 --- a/shared-core/sis_drv.h +++ b/shared-core/sis_drv.h @@ -34,10 +34,10 @@ #define DRIVER_AUTHOR "SIS" #define DRIVER_NAME "sis" #define DRIVER_DESC "SIS 300/630/540" -#define DRIVER_DATE "20060529" +#define DRIVER_DATE "20060619" #define DRIVER_MAJOR 1 #define DRIVER_MINOR 2 -#define DRIVER_PATCHLEVEL 0 +#define DRIVER_PATCHLEVEL 1 #if defined(__linux__) #define SIS_HAVE_CORE_MM @@ -58,6 +58,7 @@ typedef struct drm_sis_private { } drm_sis_private_t; extern void sis_reclaim_buffers_locked(drm_device_t *dev, struct file *filp); +extern void sis_lastclose(drm_device_t *dev); #else #include "sis_ds.h" @@ -68,11 +69,11 @@ typedef struct drm_sis_private { } drm_sis_private_t; extern int sis_init_context(drm_device_t * dev, int context); +extern int sis_final_context(drm_device_t * dev, int context); #endif -extern int sis_final_context(drm_device_t * dev, int context); extern drm_ioctl_desc_t sis_ioctls[]; extern int sis_max_ioctl; |