summaryrefslogtreecommitdiff
path: root/linux/memory.c
diff options
context:
space:
mode:
authorRik Faith <faith@alephnull.com>2000-11-15 15:47:51 +0000
committerRik Faith <faith@alephnull.com>2000-11-15 15:47:51 +0000
commit679531e1669085115bac5f6fc982d54a4a9608e8 (patch)
treefb11ac227a9c2b02cdca70210ec86716892b66ca /linux/memory.c
parent0636342ef84da23f30b838b4f933e3aa15d5c2ce (diff)
Sync with Linux 2.4.0-test11-pre5 Provide backward compatibility tested
against 2.2.18pre21 As usual, since all 2.4.0-test* kernels set LINUX_VERSION_CODE to the same value, if you are running a 2.4.0-test kernel, you MUST be running 2.4.0-test11-pre4 or later (although anything after 2.4.0-test11-pre1 should work fine -- I tested with pre4/pre5). I expect 2.2.x support to continue to work for all recent kernels, but I tested with 2.2.18pre21 -- we use the old intermodule symbol communication for 2.2.x kernels, so they should all continue to work.
Diffstat (limited to 'linux/memory.c')
-rw-r--r--linux/memory.c64
1 files changed, 26 insertions, 38 deletions
diff --git a/linux/memory.c b/linux/memory.c
index 34d19b20..261fb34a 100644
--- a/linux/memory.c
+++ b/linux/memory.c
@@ -352,16 +352,13 @@ agp_memory *drm_alloc_agp(int pages, u32 type)
return NULL;
}
- if (drm_agp.allocate_memory) {
- if ((handle = (*drm_agp.allocate_memory)(pages,
- type))) {
- spin_lock(&drm_mem_lock);
- ++drm_mem_stats[DRM_MEM_TOTALAGP].succeed_count;
- drm_mem_stats[DRM_MEM_TOTALAGP].bytes_allocated
- += pages << PAGE_SHIFT;
- spin_unlock(&drm_mem_lock);
- return handle;
- }
+ if ((handle = drm_agp_allocate_memory(pages, type))) {
+ spin_lock(&drm_mem_lock);
+ ++drm_mem_stats[DRM_MEM_TOTALAGP].succeed_count;
+ drm_mem_stats[DRM_MEM_TOTALAGP].bytes_allocated
+ += pages << PAGE_SHIFT;
+ spin_unlock(&drm_mem_lock);
+ return handle;
}
spin_lock(&drm_mem_lock);
++drm_mem_stats[DRM_MEM_TOTALAGP].fail_count;
@@ -381,8 +378,7 @@ int drm_free_agp(agp_memory *handle, int pages)
return retval;;
}
- if (drm_agp.free_memory) {
- (*drm_agp.free_memory)(handle);
+ if (drm_agp_free_memory(handle)) {
spin_lock(&drm_mem_lock);
free_count = ++drm_mem_stats[DRM_MEM_TOTALAGP].free_count;
alloc_count = drm_mem_stats[DRM_MEM_TOTALAGP].succeed_count;
@@ -403,24 +399,19 @@ int drm_bind_agp(agp_memory *handle, unsigned int start)
{
int retcode = -EINVAL;
- DRM_DEBUG("drm_bind_agp called\n");
if (!handle) {
DRM_MEM_ERROR(DRM_MEM_BOUNDAGP,
"Attempt to bind NULL AGP handle\n");
return retcode;
}
- DRM_DEBUG("drm_agp.bind_memory : %p\n", drm_agp.bind_memory);
- if (drm_agp.bind_memory) {
- if (!(retcode = (*drm_agp.bind_memory)(handle, start))) {
- spin_lock(&drm_mem_lock);
- ++drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count;
- drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_allocated
- += handle->page_count << PAGE_SHIFT;
- spin_unlock(&drm_mem_lock);
- DRM_DEBUG("drm_agp.bind_memory: retcode %d\n", retcode);
- return retcode;
- }
+ if (!(retcode = drm_agp_bind_memory(handle, start))) {
+ spin_lock(&drm_mem_lock);
+ ++drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count;
+ drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_allocated
+ += handle->page_count << PAGE_SHIFT;
+ spin_unlock(&drm_mem_lock);
+ return retcode;
}
spin_lock(&drm_mem_lock);
++drm_mem_stats[DRM_MEM_BOUNDAGP].fail_count;
@@ -440,20 +431,17 @@ int drm_unbind_agp(agp_memory *handle)
return retcode;
}
- if (drm_agp.unbind_memory) {
- int c = handle->page_count;
- if ((retcode = (*drm_agp.unbind_memory)(handle)))
- return retcode;
- spin_lock(&drm_mem_lock);
- free_count = ++drm_mem_stats[DRM_MEM_BOUNDAGP].free_count;
- alloc_count = drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count;
- drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_freed += c << PAGE_SHIFT;
- spin_unlock(&drm_mem_lock);
- if (free_count > alloc_count) {
- DRM_MEM_ERROR(DRM_MEM_BOUNDAGP,
- "Excess frees: %d frees, %d allocs\n",
- free_count, alloc_count);
- }
+ if ((retcode = drm_agp_unbind_memory(handle))) return retcode;
+ spin_lock(&drm_mem_lock);
+ free_count = ++drm_mem_stats[DRM_MEM_BOUNDAGP].free_count;
+ alloc_count = drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count;
+ drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_freed
+ += handle->page_count << PAGE_SHIFT;
+ spin_unlock(&drm_mem_lock);
+ if (free_count > alloc_count) {
+ DRM_MEM_ERROR(DRM_MEM_BOUNDAGP,
+ "Excess frees: %d frees, %d allocs\n",
+ free_count, alloc_count);
}
return retcode;
}