summaryrefslogtreecommitdiff
path: root/bsd-core/drm_drv.c
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2005-08-26 20:56:11 +0000
committerEric Anholt <anholt@freebsd.org>2005-08-26 20:56:11 +0000
commitc425ad1a34439d019edd589c32a7161d01b4d822 (patch)
treebbb5ce64e4b791cb01c62e144e3b3e7e4b86d829 /bsd-core/drm_drv.c
parent5105f9ea59179c7129d3bf97734eb37e26ec68b0 (diff)
Previously, drm_get_resource_start() and drm_get_resource_len() would
allocate the resource RF_ACTIVE, pull out the appropriate value, and return it. However, allocating large framebuffers RF_ACTIVE would run the system out of KVA, and this also left open the possibility of the resource getting moved after getting the offset. Instead, when either of these are called, allocate the resource if it isn't allocated already (non-RF_ACTIVE) and store it in the DRM device, to be cleaned up on lastclose.
Diffstat (limited to 'bsd-core/drm_drv.c')
-rw-r--r--bsd-core/drm_drv.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c
index c4ee39cb..63024132 100644
--- a/bsd-core/drm_drv.c
+++ b/bsd-core/drm_drv.c
@@ -474,6 +474,13 @@ static int drm_lastclose(drm_device_t *dev)
TAILQ_FOREACH_SAFE(map, &dev->maplist, link, mapsave) {
drm_rmmap(dev, map);
}
+ for (i = 0; i < DRM_MAX_PCI_RESOURCE; i++) {
+ if (dev->pcir[i] == NULL)
+ continue;
+ bus_release_resource(dev->device, SYS_RES_MEMORY,
+ dev->pcirid[i], dev->pcir[i]);
+ dev->pcir[i] = NULL;
+ }
drm_dma_takedown(dev);
if ( dev->lock.hw_lock ) {