summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm/drm_drv.c
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2008-09-09 21:02:07 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2008-09-09 21:02:07 +0000
commit46934e53f9b57425f055db09b473257cbe091a84 (patch)
treee61fc6fb25295c3bd98b7152d158a22c1f619ac6 /sys/dev/pci/drm/drm_drv.c
parent944a7a5ee1793b3167671ed5bf7acc319f00e2e4 (diff)
Kill some stupid agp api wrapper functions, just use the agp api
directly. While i'm here, factor out some common functionality into a separate function, and kill some typedefs (man this code is full of them...). Shaves another 450 bytes off the kernel. Tested by ckuethe and Paul de Weerd, thanks.
Diffstat (limited to 'sys/dev/pci/drm/drm_drv.c')
-rw-r--r--sys/dev/pci/drm/drm_drv.c34
1 files changed, 10 insertions, 24 deletions
diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c
index fd8ad5519cc..7a39ee79b51 100644
--- a/sys/dev/pci/drm/drm_drv.c
+++ b/sys/dev/pci/drm/drm_drv.c
@@ -392,38 +392,25 @@ drm_lastclose(struct drm_device *dev)
dev->unique_len = 0;
}
- drm_drawable_free_all(dev);
/* Clear pid list */
while ((pt = SPLAY_ROOT(&dev->magiclist)) != NULL) {
SPLAY_REMOVE(drm_magic_tree, &dev->magiclist, pt);
drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC);
}
- /* Clear AGP information */
- if (dev->agp != NULL) {
- struct drm_agp_mem *entry;
-
- /*
- * Remove AGP resources, but leave dev->agp intact until
- * we detach the device
- */
- while ((entry = TAILQ_FIRST(&dev->agp->memory)) != NULL) {
- if (entry->bound)
- drm_agp_unbind_memory(entry->handle);
- drm_agp_free_memory(entry->handle);
- TAILQ_REMOVE(&dev->agp->memory, entry, link);
- drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
- }
-
- if (dev->agp->acquired)
- drm_agp_release(dev);
+ DRM_UNLOCK();
+ drm_agp_takedown(dev);
+ drm_drawable_free_all(dev);
+ drm_dma_takedown(dev);
+ DRM_LOCK();
- dev->agp->acquired = 0;
- dev->agp->enabled = 0;
- }
if (dev->sg != NULL) {
- drm_sg_cleanup(dev->sg);
+ drm_sg_mem_t *sg = dev->sg;
dev->sg = NULL;
+
+ DRM_UNLOCK();
+ drm_sg_cleanup(sg);
+ DRM_LOCK();
}
for (map = TAILQ_FIRST(&dev->maplist); map != TAILQ_END(&dev->maplist);
@@ -433,7 +420,6 @@ drm_lastclose(struct drm_device *dev)
drm_rmmap(dev, map);
}
- drm_dma_takedown(dev);
if (dev->lock.hw_lock != NULL) {
dev->lock.hw_lock = NULL; /* SHM removed */
dev->lock.file_priv = NULL;