diff options
author | Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> | 2007-01-25 14:26:58 +0100 |
---|---|---|
committer | Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> | 2007-01-25 14:27:29 +0100 |
commit | 582637641abbadc75795ac7e0671e1a5e3b41880 (patch) | |
tree | 0df2009a7b164cac50485fd8dd241465f6c299b2 /linux-core/drm_drv.c | |
parent | 90ae39d2f07058dd128d2fb19ffad712ee75c9a0 (diff) |
Remove a scary error printed when we were leaking memory caches.
We don't use memory caches anymore...
Fix memory accounting initialization to only use low or DMA32 memory.
Diffstat (limited to 'linux-core/drm_drv.c')
-rw-r--r-- | linux-core/drm_drv.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c index 45f563ff..ff9b29e7 100644 --- a/linux-core/drm_drv.c +++ b/linux-core/drm_drv.c @@ -148,10 +148,11 @@ int drm_lastclose(drm_device_t * dev) DRM_DEBUG("\n"); - if (drm_bo_driver_finish(dev)) { - DRM_ERROR("DRM memory manager still busy. " - "System is unstable. Please reboot.\n"); - } + /* + * We can't do much about this function failing. + */ + + drm_bo_driver_finish(dev); if (dev->driver->lastclose) dev->driver->lastclose(dev); @@ -450,9 +451,28 @@ static int __init drm_core_init(void) { int ret; struct sysinfo si; - + unsigned long avail_memctl_mem; + unsigned long max_memctl_mem; + si_meminfo(&si); - drm_init_memctl(si.totalram/2, si.totalram*3/4); + + /* + * AGP only allows low / DMA32 memory ATM. + */ + + avail_memctl_mem = si.totalram - si.totalhigh; + + /* + * Avoid overflows + */ + + max_memctl_mem = 1UL << (32 - PAGE_SHIFT); + max_memctl_mem = (max_memctl_mem / si.mem_unit) * PAGE_SIZE; + + if (avail_memctl_mem >= max_memctl_mem) + avail_memctl_mem = max_memctl_mem; + + drm_init_memctl(avail_memctl_mem/2, avail_memctl_mem*3/4, si.mem_unit); ret = -ENOMEM; drm_cards_limit = |