summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas@tungstengraphics.com>2006-06-19 09:12:50 +0000
committerThomas Hellstrom <thomas@tungstengraphics.com>2006-06-19 09:12:50 +0000
commit58b63ee5ccc1427a6835ef5112fe556faa9e1be3 (patch)
treef4c109974601d12474da77898918355011403c7b /linux-core
parent96f272884d6caf7940c9bc3c95dcac75b0a8cd3f (diff)
Fix buffer cleanup on close. Move memory manager reset from final_context
to lastclose.
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/sis_drv.c4
-rw-r--r--linux-core/sis_mm.c23
2 files changed, 14 insertions, 13 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)