From c425ad1a34439d019edd589c32a7161d01b4d822 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 26 Aug 2005 20:56:11 +0000 Subject: 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. --- bsd-core/drm_drv.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'bsd-core/drm_drv.c') 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 ) { -- cgit v1.2.3