From cdd3e9fc562bd57e0272e4c4d1c0707776bd01a1 Mon Sep 17 00:00:00 2001 From: Robert Noland Date: Fri, 10 Oct 2008 13:06:22 -0400 Subject: [FreeBSD] Rework all of the memory allocations Allocate memory from different pools. This allows the OS to track memory allocations for us, much like the linux memory debugging. This will ease tracking down memory leaks since the OS can track the number of allocations from each pool and help to point us in the right direction. Also replace drm_alloc and friends with static __inline__ versions while we are here. --- bsd-core/drm_drv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'bsd-core/drm_drv.c') diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c index a35d60a7..725e5a9d 100644 --- a/bsd-core/drm_drv.c +++ b/bsd-core/drm_drv.c @@ -280,7 +280,7 @@ static int drm_lastclose(struct drm_device *dev) drm_irq_uninstall(dev); if (dev->unique) { - free(dev->unique, M_DRM); + free(dev->unique, DRM_MEM_DRIVER); dev->unique = NULL; dev->unique_len = 0; } @@ -288,7 +288,7 @@ static int drm_lastclose(struct drm_device *dev) for (i = 0; i < DRM_HASH_SIZE; i++) { for (pt = dev->magiclist[i].head; pt; pt = next) { next = pt->next; - free(pt, M_DRM); + free(pt, DRM_MEM_MAGIC); } dev->magiclist[i].head = dev->magiclist[i].tail = NULL; } @@ -310,7 +310,7 @@ static int drm_lastclose(struct drm_device *dev) if (entry->bound) drm_agp_unbind_memory(entry->handle); drm_agp_free_memory(entry->handle); - free(entry, M_DRM); + free(entry, DRM_MEM_AGPLISTS); } dev->agp->memory = NULL; @@ -479,7 +479,7 @@ static void drm_unload(struct drm_device *dev) } if (dev->agp) { - free(dev->agp, M_DRM); + free(dev->agp, DRM_MEM_AGPLISTS); dev->agp = NULL; } @@ -623,7 +623,7 @@ void drm_close(void *data) if (dev->driver->postclose != NULL) dev->driver->postclose(dev, file_priv); TAILQ_REMOVE(&dev->files, file_priv, link); - free(file_priv, M_DRM); + free(file_priv, DRM_MEM_FILES); /* ======================================================== * End inline drm_release -- cgit v1.2.3 From 8256c347cc80db0371b40b34ee8a163908d50079 Mon Sep 17 00:00:00 2001 From: Robert Noland Date: Thu, 23 Oct 2008 15:46:32 -0400 Subject: [FreeBSD] We should use dev2unit() rather than minor() --- bsd-core/drm_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bsd-core/drm_drv.c') diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c index 725e5a9d..afcad193 100644 --- a/bsd-core/drm_drv.c +++ b/bsd-core/drm_drv.c @@ -534,7 +534,7 @@ int drm_open(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p) struct drm_device *dev = NULL; int retcode = 0; - dev = DRIVER_SOFTC(minor(kdev)); + dev = DRIVER_SOFTC(dev2unit(kdev)); DRM_DEBUG("open_count = %d\n", dev->open_count); -- cgit v1.2.3