summaryrefslogtreecommitdiff
path: root/linux-core/drm_stub.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-10-18 17:33:19 +0200
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-10-18 17:33:19 +0200
commite22b04f807b9869c8c89b6316214517f5da13322 (patch)
treee2bf963e8704a0a9e0ec37a791c119e6e0995ed2 /linux-core/drm_stub.c
parent11aaa358a0f56afb64df44c737ec331d90118537 (diff)
parente172945d668f1de1243ac2ae91ab77f3b2bda40a (diff)
Merging drm-ttm-0-2-branch
Conflicts: linux-core/drmP.h linux-core/drm_drv.c linux-core/drm_irq.c linux-core/drm_stub.c shared-core/drm.h shared-core/i915_drv.h shared-core/i915_irq.c
Diffstat (limited to 'linux-core/drm_stub.c')
-rw-r--r--linux-core/drm_stub.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/linux-core/drm_stub.c b/linux-core/drm_stub.c
index 839cf441..c03a56a1 100644
--- a/linux-core/drm_stub.c
+++ b/linux-core/drm_stub.c
@@ -54,6 +54,11 @@ drm_head_t **drm_heads;
struct drm_sysfs_class *drm_class;
struct proc_dir_entry *drm_proc_root;
+drm_cache_t drm_cache =
+{ .mm = NULL,
+ .fence_object = NULL
+};
+
static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
const struct pci_device_id *ent,
struct drm_driver *driver)
@@ -66,6 +71,7 @@ static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
init_timer(&dev->timer);
mutex_init(&dev->struct_mutex);
mutex_init(&dev->ctxlist_mutex);
+ mutex_init(&dev->bm.init_mutex);
dev->pdev = pdev;
dev->pci_device = pdev->device;
@@ -76,15 +82,29 @@ static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
#endif
dev->irq = pdev->irq;
- dev->maplist = drm_calloc(1, sizeof(*dev->maplist), DRM_MEM_MAPS);
- if (dev->maplist == NULL)
+ if (drm_ht_create(&dev->map_hash, DRM_MAP_HASH_ORDER)) {
+ drm_free(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS);
return -ENOMEM;
- INIT_LIST_HEAD(&dev->maplist->head);
- if (drm_ht_create(&dev->map_hash, 12)) {
+ }
+ if (drm_mm_init(&dev->offset_manager, DRM_FILE_PAGE_OFFSET_START,
+ DRM_FILE_PAGE_OFFSET_SIZE)) {
drm_free(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS);
+ drm_ht_remove(&dev->map_hash);
+ return -ENOMEM;
+ }
+
+ if (drm_ht_create(&dev->object_hash, DRM_OBJECT_HASH_ORDER)) {
+ drm_free(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS);
+ drm_ht_remove(&dev->map_hash);
+ drm_mm_takedown(&dev->offset_manager);
return -ENOMEM;
}
+ dev->maplist = drm_calloc(1, sizeof(*dev->maplist), DRM_MEM_MAPS);
+ if (dev->maplist == NULL)
+ return -ENOMEM;
+ INIT_LIST_HEAD(&dev->maplist->head);
+
/* the DRM has 6 counters */
dev->counters = 6;
dev->types[0] = _DRM_STAT_LOCK;
@@ -125,6 +145,7 @@ static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
goto error_out_unreg;
}
+ drm_fence_manager_init(dev);
return 0;
error_out_unreg: