summaryrefslogtreecommitdiff
path: root/bsd-core/drm_agpsupport.c
diff options
context:
space:
mode:
authorRobert Noland <rnoland@2hip.net>2008-10-10 13:06:22 -0400
committerRobert Noland <rnoland@2hip.net>2008-10-10 13:06:22 -0400
commitcdd3e9fc562bd57e0272e4c4d1c0707776bd01a1 (patch)
tree97d7b554a5c040630fabcb693b7b26ab4ca5a9f1 /bsd-core/drm_agpsupport.c
parent1150a42d4398b14c5db2f34a5beba613528df147 (diff)
[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.
Diffstat (limited to 'bsd-core/drm_agpsupport.c')
-rw-r--r--bsd-core/drm_agpsupport.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/bsd-core/drm_agpsupport.c b/bsd-core/drm_agpsupport.c
index a568c5a5..34b23af1 100644
--- a/bsd-core/drm_agpsupport.c
+++ b/bsd-core/drm_agpsupport.c
@@ -209,7 +209,7 @@ int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request)
if (!dev->agp || !dev->agp->acquired)
return EINVAL;
- entry = malloc(sizeof(*entry), M_DRM, M_NOWAIT | M_ZERO);
+ entry = malloc(sizeof(*entry), DRM_MEM_AGPLISTS, M_NOWAIT | M_ZERO);
if (entry == NULL)
return ENOMEM;
@@ -220,7 +220,7 @@ int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request)
handle = drm_agp_allocate_memory(pages, type);
DRM_LOCK();
if (handle == NULL) {
- free(entry, M_DRM);
+ free(entry, DRM_MEM_AGPLISTS);
return ENOMEM;
}
@@ -371,7 +371,7 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request)
drm_agp_free_memory(entry->handle);
DRM_LOCK();
- free(entry, M_DRM);
+ free(entry, DRM_MEM_AGPLISTS);
return 0;
@@ -405,7 +405,8 @@ drm_agp_head_t *drm_agp_init(void)
DRM_DEBUG("agp_available = %d\n", agp_available);
if (agp_available) {
- head = malloc(sizeof(*head), M_DRM, M_NOWAIT | M_ZERO);
+ head = malloc(sizeof(*head), DRM_MEM_AGPLISTS,
+ M_NOWAIT | M_ZERO);
if (head == NULL)
return NULL;
head->agpdev = agpdev;