summaryrefslogtreecommitdiff
path: root/linux-core/drm_stub.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-09-01 15:41:55 +0200
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-09-01 15:41:55 +0200
commit11f51a9a877d1231551e8c6482a6f70daf380cdd (patch)
treed3e6731ca1641ed0107336d8c41e1620cfe80b4f /linux-core/drm_stub.c
parent4edb95d6e0a00a9a8885603cab2c99e3c6daa705 (diff)
Bugfixes,
Memory allocation optimizations. Buffer manager takedown.
Diffstat (limited to 'linux-core/drm_stub.c')
-rw-r--r--linux-core/drm_stub.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/linux-core/drm_stub.c b/linux-core/drm_stub.c
index 16e50a55..2d0f1d24 100644
--- a/linux-core/drm_stub.c
+++ b/linux-core/drm_stub.c
@@ -54,6 +54,30 @@ drm_head_t **drm_heads;
struct drm_sysfs_class *drm_class;
struct proc_dir_entry *drm_proc_root;
+
+static int drm_create_memory_caches(drm_device_t *dev)
+{
+ dev->mm_cache = kmem_cache_create("drm_mm_node_t",
+ sizeof(drm_mm_node_t),
+ 0,
+ SLAB_HWCACHE_ALIGN,
+ NULL,NULL);
+ if (!dev->mm_cache)
+ return -ENOMEM;
+
+ drm_mm_set_cache(dev->mm_cache);
+ dev->fence_object_cache = kmem_cache_create("drm_fence_object_t",
+ sizeof(drm_fence_object_t),
+ 0,
+ SLAB_HWCACHE_ALIGN,
+ NULL,NULL);
+ if (!dev->fence_object_cache)
+ return -ENOMEM;
+
+ return 0;
+}
+
+
static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
const struct pci_device_id *ent,
struct drm_driver *driver)
@@ -127,6 +151,12 @@ static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
goto error_out_unreg;
}
+ retcode = drm_create_memory_caches(dev);
+ if (retcode) {
+ DRM_ERROR("Failed creating memory caches\n");
+ goto error_out_unreg;
+ }
+
drm_fence_manager_init(dev);
return 0;