aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/Makefile2
-rw-r--r--drivers/gpu/drm/drm_drv.c1
-rw-r--r--drivers/gpu/drm/drm_global.c (renamed from drivers/gpu/drm/ttm/ttm_global.c)30
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.h2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_ttm.c20
-rw-r--r--drivers/gpu/drm/radeon/radeon.h2
-rw-r--r--drivers/gpu/drm/radeon/radeon_ttm.c20
-rw-r--r--drivers/gpu/drm/ttm/Makefile2
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c4
-rw-r--r--drivers/gpu/drm/ttm/ttm_module.c4
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_drv.h2
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c20
12 files changed, 53 insertions, 56 deletions
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index df8f92322865..f3a23a329f4e 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -12,7 +12,7 @@ drm-y := drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \
12 drm_platform.o drm_sysfs.o drm_hashtab.o drm_sman.o drm_mm.o \ 12 drm_platform.o drm_sysfs.o drm_hashtab.o drm_sman.o drm_mm.o \
13 drm_crtc.o drm_modes.o drm_edid.o \ 13 drm_crtc.o drm_modes.o drm_edid.o \
14 drm_info.o drm_debugfs.o drm_encoder_slave.o \ 14 drm_info.o drm_debugfs.o drm_encoder_slave.o \
15 drm_trace_points.o 15 drm_trace_points.o drm_global.o
16 16
17drm-$(CONFIG_COMPAT) += drm_ioc32.o 17drm-$(CONFIG_COMPAT) += drm_ioc32.o
18 18
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index b5a51686f492..d5b349d279f5 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -288,6 +288,7 @@ static int __init drm_core_init(void)
288{ 288{
289 int ret = -ENOMEM; 289 int ret = -ENOMEM;
290 290
291 drm_global_init();
291 idr_init(&drm_minors_idr); 292 idr_init(&drm_minors_idr);
292 293
293 if (register_chrdev(DRM_MAJOR, "drm", &drm_stub_fops)) 294 if (register_chrdev(DRM_MAJOR, "drm", &drm_stub_fops))
diff --git a/drivers/gpu/drm/ttm/ttm_global.c b/drivers/gpu/drm/drm_global.c
index b17007178a36..c87dc96444de 100644
--- a/drivers/gpu/drm/ttm/ttm_global.c
+++ b/drivers/gpu/drm/drm_global.c
@@ -28,45 +28,45 @@
28 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com> 28 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
29 */ 29 */
30 30
31#include "ttm/ttm_module.h"
32#include <linux/mutex.h> 31#include <linux/mutex.h>
33#include <linux/slab.h> 32#include <linux/slab.h>
34#include <linux/module.h> 33#include <linux/module.h>
34#include "drm_global.h"
35 35
36struct ttm_global_item { 36struct drm_global_item {
37 struct mutex mutex; 37 struct mutex mutex;
38 void *object; 38 void *object;
39 int refcount; 39 int refcount;
40}; 40};
41 41
42static struct ttm_global_item glob[TTM_GLOBAL_NUM]; 42static struct drm_global_item glob[DRM_GLOBAL_NUM];
43 43
44void ttm_global_init(void) 44void drm_global_init(void)
45{ 45{
46 int i; 46 int i;
47 47
48 for (i = 0; i < TTM_GLOBAL_NUM; ++i) { 48 for (i = 0; i < DRM_GLOBAL_NUM; ++i) {
49 struct ttm_global_item *item = &glob[i]; 49 struct drm_global_item *item = &glob[i];
50 mutex_init(&item->mutex); 50 mutex_init(&item->mutex);
51 item->object = NULL; 51 item->object = NULL;
52 item->refcount = 0; 52 item->refcount = 0;
53 } 53 }
54} 54}
55 55
56void ttm_global_release(void) 56void drm_global_release(void)
57{ 57{
58 int i; 58 int i;
59 for (i = 0; i < TTM_GLOBAL_NUM; ++i) { 59 for (i = 0; i < DRM_GLOBAL_NUM; ++i) {
60 struct ttm_global_item *item = &glob[i]; 60 struct drm_global_item *item = &glob[i];
61 BUG_ON(item->object != NULL); 61 BUG_ON(item->object != NULL);
62 BUG_ON(item->refcount != 0); 62 BUG_ON(item->refcount != 0);
63 } 63 }
64} 64}
65 65
66int ttm_global_item_ref(struct ttm_global_reference *ref) 66int drm_global_item_ref(struct drm_global_reference *ref)
67{ 67{
68 int ret; 68 int ret;
69 struct ttm_global_item *item = &glob[ref->global_type]; 69 struct drm_global_item *item = &glob[ref->global_type];
70 void *object; 70 void *object;
71 71
72 mutex_lock(&item->mutex); 72 mutex_lock(&item->mutex);
@@ -93,11 +93,11 @@ out_err:
93 item->object = NULL; 93 item->object = NULL;
94 return ret; 94 return ret;
95} 95}
96EXPORT_SYMBOL(ttm_global_item_ref); 96EXPORT_SYMBOL(drm_global_item_ref);
97 97
98void ttm_global_item_unref(struct ttm_global_reference *ref) 98void drm_global_item_unref(struct drm_global_reference *ref)
99{ 99{
100 struct ttm_global_item *item = &glob[ref->global_type]; 100 struct drm_global_item *item = &glob[ref->global_type];
101 101
102 mutex_lock(&item->mutex); 102 mutex_lock(&item->mutex);
103 BUG_ON(item->refcount == 0); 103 BUG_ON(item->refcount == 0);
@@ -108,5 +108,5 @@ void ttm_global_item_unref(struct ttm_global_reference *ref)
108 } 108 }
109 mutex_unlock(&item->mutex); 109 mutex_unlock(&item->mutex);
110} 110}
111EXPORT_SYMBOL(ttm_global_item_unref); 111EXPORT_SYMBOL(drm_global_item_unref);
112 112
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index d0a35d9ba522..e15db15dca77 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -533,7 +533,7 @@ struct drm_nouveau_private {
533 struct list_head vbl_waiting; 533 struct list_head vbl_waiting;
534 534
535 struct { 535 struct {
536 struct ttm_global_reference mem_global_ref; 536 struct drm_global_reference mem_global_ref;
537 struct ttm_bo_global_ref bo_global_ref; 537 struct ttm_bo_global_ref bo_global_ref;
538 struct ttm_bo_device bdev; 538 struct ttm_bo_device bdev;
539 spinlock_t bo_list_lock; 539 spinlock_t bo_list_lock;
diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c b/drivers/gpu/drm/nouveau/nouveau_ttm.c
index c385d50f041b..bd35f930568c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_ttm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c
@@ -42,13 +42,13 @@ nouveau_ttm_mmap(struct file *filp, struct vm_area_struct *vma)
42} 42}
43 43
44static int 44static int
45nouveau_ttm_mem_global_init(struct ttm_global_reference *ref) 45nouveau_ttm_mem_global_init(struct drm_global_reference *ref)
46{ 46{
47 return ttm_mem_global_init(ref->object); 47 return ttm_mem_global_init(ref->object);
48} 48}
49 49
50static void 50static void
51nouveau_ttm_mem_global_release(struct ttm_global_reference *ref) 51nouveau_ttm_mem_global_release(struct drm_global_reference *ref)
52{ 52{
53 ttm_mem_global_release(ref->object); 53 ttm_mem_global_release(ref->object);
54} 54}
@@ -56,16 +56,16 @@ nouveau_ttm_mem_global_release(struct ttm_global_reference *ref)
56int 56int
57nouveau_ttm_global_init(struct drm_nouveau_private *dev_priv) 57nouveau_ttm_global_init(struct drm_nouveau_private *dev_priv)
58{ 58{
59 struct ttm_global_reference *global_ref; 59 struct drm_global_reference *global_ref;
60 int ret; 60 int ret;
61 61
62 global_ref = &dev_priv->ttm.mem_global_ref; 62 global_ref = &dev_priv->ttm.mem_global_ref;
63 global_ref->global_type = TTM_GLOBAL_TTM_MEM; 63 global_ref->global_type = DRM_GLOBAL_TTM_MEM;
64 global_ref->size = sizeof(struct ttm_mem_global); 64 global_ref->size = sizeof(struct ttm_mem_global);
65 global_ref->init = &nouveau_ttm_mem_global_init; 65 global_ref->init = &nouveau_ttm_mem_global_init;
66 global_ref->release = &nouveau_ttm_mem_global_release; 66 global_ref->release = &nouveau_ttm_mem_global_release;
67 67
68 ret = ttm_global_item_ref(global_ref); 68 ret = drm_global_item_ref(global_ref);
69 if (unlikely(ret != 0)) { 69 if (unlikely(ret != 0)) {
70 DRM_ERROR("Failed setting up TTM memory accounting\n"); 70 DRM_ERROR("Failed setting up TTM memory accounting\n");
71 dev_priv->ttm.mem_global_ref.release = NULL; 71 dev_priv->ttm.mem_global_ref.release = NULL;
@@ -74,15 +74,15 @@ nouveau_ttm_global_init(struct drm_nouveau_private *dev_priv)
74 74
75 dev_priv->ttm.bo_global_ref.mem_glob = global_ref->object; 75 dev_priv->ttm.bo_global_ref.mem_glob = global_ref->object;
76 global_ref = &dev_priv->ttm.bo_global_ref.ref; 76 global_ref = &dev_priv->ttm.bo_global_ref.ref;
77 global_ref->global_type = TTM_GLOBAL_TTM_BO; 77 global_ref->global_type = DRM_GLOBAL_TTM_BO;
78 global_ref->size = sizeof(struct ttm_bo_global); 78 global_ref->size = sizeof(struct ttm_bo_global);
79 global_ref->init = &ttm_bo_global_init; 79 global_ref->init = &ttm_bo_global_init;
80 global_ref->release = &ttm_bo_global_release; 80 global_ref->release = &ttm_bo_global_release;
81 81
82 ret = ttm_global_item_ref(global_ref); 82 ret = drm_global_item_ref(global_ref);
83 if (unlikely(ret != 0)) { 83 if (unlikely(ret != 0)) {
84 DRM_ERROR("Failed setting up TTM BO subsystem\n"); 84 DRM_ERROR("Failed setting up TTM BO subsystem\n");
85 ttm_global_item_unref(&dev_priv->ttm.mem_global_ref); 85 drm_global_item_unref(&dev_priv->ttm.mem_global_ref);
86 dev_priv->ttm.mem_global_ref.release = NULL; 86 dev_priv->ttm.mem_global_ref.release = NULL;
87 return ret; 87 return ret;
88 } 88 }
@@ -96,8 +96,8 @@ nouveau_ttm_global_release(struct drm_nouveau_private *dev_priv)
96 if (dev_priv->ttm.mem_global_ref.release == NULL) 96 if (dev_priv->ttm.mem_global_ref.release == NULL)
97 return; 97 return;
98 98
99 ttm_global_item_unref(&dev_priv->ttm.bo_global_ref.ref); 99 drm_global_item_unref(&dev_priv->ttm.bo_global_ref.ref);
100 ttm_global_item_unref(&dev_priv->ttm.mem_global_ref); 100 drm_global_item_unref(&dev_priv->ttm.mem_global_ref);
101 dev_priv->ttm.mem_global_ref.release = NULL; 101 dev_priv->ttm.mem_global_ref.release = NULL;
102} 102}
103 103
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 368fecf0c2b7..3cd1c470b777 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -235,7 +235,7 @@ struct radeon_surface_reg {
235 */ 235 */
236struct radeon_mman { 236struct radeon_mman {
237 struct ttm_bo_global_ref bo_global_ref; 237 struct ttm_bo_global_ref bo_global_ref;
238 struct ttm_global_reference mem_global_ref; 238 struct drm_global_reference mem_global_ref;
239 struct ttm_bo_device bdev; 239 struct ttm_bo_device bdev;
240 bool mem_global_referenced; 240 bool mem_global_referenced;
241 bool initialized; 241 bool initialized;
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index e9918d88f5b0..84c53e41a88f 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -59,28 +59,28 @@ static struct radeon_device *radeon_get_rdev(struct ttm_bo_device *bdev)
59/* 59/*
60 * Global memory. 60 * Global memory.
61 */ 61 */
62static int radeon_ttm_mem_global_init(struct ttm_global_reference *ref) 62static int radeon_ttm_mem_global_init(struct drm_global_reference *ref)
63{ 63{
64 return ttm_mem_global_init(ref->object); 64 return ttm_mem_global_init(ref->object);
65} 65}
66 66
67static void radeon_ttm_mem_global_release(struct ttm_global_reference *ref) 67static void radeon_ttm_mem_global_release(struct drm_global_reference *ref)
68{ 68{
69 ttm_mem_global_release(ref->object); 69 ttm_mem_global_release(ref->object);
70} 70}
71 71
72static int radeon_ttm_global_init(struct radeon_device *rdev) 72static int radeon_ttm_global_init(struct radeon_device *rdev)
73{ 73{
74 struct ttm_global_reference *global_ref; 74 struct drm_global_reference *global_ref;
75 int r; 75 int r;
76 76
77 rdev->mman.mem_global_referenced = false; 77 rdev->mman.mem_global_referenced = false;
78 global_ref = &rdev->mman.mem_global_ref; 78 global_ref = &rdev->mman.mem_global_ref;
79 global_ref->global_type = TTM_GLOBAL_TTM_MEM; 79 global_ref->global_type = DRM_GLOBAL_TTM_MEM;
80 global_ref->size = sizeof(struct ttm_mem_global); 80 global_ref->size = sizeof(struct ttm_mem_global);
81 global_ref->init = &radeon_ttm_mem_global_init; 81 global_ref->init = &radeon_ttm_mem_global_init;
82 global_ref->release = &radeon_ttm_mem_global_release; 82 global_ref->release = &radeon_ttm_mem_global_release;
83 r = ttm_global_item_ref(global_ref); 83 r = drm_global_item_ref(global_ref);
84 if (r != 0) { 84 if (r != 0) {
85 DRM_ERROR("Failed setting up TTM memory accounting " 85 DRM_ERROR("Failed setting up TTM memory accounting "
86 "subsystem.\n"); 86 "subsystem.\n");
@@ -90,14 +90,14 @@ static int radeon_ttm_global_init(struct radeon_device *rdev)
90 rdev->mman.bo_global_ref.mem_glob = 90 rdev->mman.bo_global_ref.mem_glob =
91 rdev->mman.mem_global_ref.object; 91 rdev->mman.mem_global_ref.object;
92 global_ref = &rdev->mman.bo_global_ref.ref; 92 global_ref = &rdev->mman.bo_global_ref.ref;
93 global_ref->global_type = TTM_GLOBAL_TTM_BO; 93 global_ref->global_type = DRM_GLOBAL_TTM_BO;
94 global_ref->size = sizeof(struct ttm_bo_global); 94 global_ref->size = sizeof(struct ttm_bo_global);
95 global_ref->init = &ttm_bo_global_init; 95 global_ref->init = &ttm_bo_global_init;
96 global_ref->release = &ttm_bo_global_release; 96 global_ref->release = &ttm_bo_global_release;
97 r = ttm_global_item_ref(global_ref); 97 r = drm_global_item_ref(global_ref);
98 if (r != 0) { 98 if (r != 0) {
99 DRM_ERROR("Failed setting up TTM BO subsystem.\n"); 99 DRM_ERROR("Failed setting up TTM BO subsystem.\n");
100 ttm_global_item_unref(&rdev->mman.mem_global_ref); 100 drm_global_item_unref(&rdev->mman.mem_global_ref);
101 return r; 101 return r;
102 } 102 }
103 103
@@ -108,8 +108,8 @@ static int radeon_ttm_global_init(struct radeon_device *rdev)
108static void radeon_ttm_global_fini(struct radeon_device *rdev) 108static void radeon_ttm_global_fini(struct radeon_device *rdev)
109{ 109{
110 if (rdev->mman.mem_global_referenced) { 110 if (rdev->mman.mem_global_referenced) {
111 ttm_global_item_unref(&rdev->mman.bo_global_ref.ref); 111 drm_global_item_unref(&rdev->mman.bo_global_ref.ref);
112 ttm_global_item_unref(&rdev->mman.mem_global_ref); 112 drm_global_item_unref(&rdev->mman.mem_global_ref);
113 rdev->mman.mem_global_referenced = false; 113 rdev->mman.mem_global_referenced = false;
114 } 114 }
115} 115}
diff --git a/drivers/gpu/drm/ttm/Makefile b/drivers/gpu/drm/ttm/Makefile
index 4256e2006476..b256d4adfafe 100644
--- a/drivers/gpu/drm/ttm/Makefile
+++ b/drivers/gpu/drm/ttm/Makefile
@@ -3,7 +3,7 @@
3 3
4ccflags-y := -Iinclude/drm 4ccflags-y := -Iinclude/drm
5ttm-y := ttm_agp_backend.o ttm_memory.o ttm_tt.o ttm_bo.o \ 5ttm-y := ttm_agp_backend.o ttm_memory.o ttm_tt.o ttm_bo.o \
6 ttm_bo_util.o ttm_bo_vm.o ttm_module.o ttm_global.o \ 6 ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
7 ttm_object.o ttm_lock.o ttm_execbuf_util.o ttm_page_alloc.o 7 ttm_object.o ttm_lock.o ttm_execbuf_util.o ttm_page_alloc.o
8 8
9obj-$(CONFIG_DRM_TTM) += ttm.o 9obj-$(CONFIG_DRM_TTM) += ttm.o
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 9763288c6b2d..cb4cf7ef4d1e 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1395,7 +1395,7 @@ static void ttm_bo_global_kobj_release(struct kobject *kobj)
1395 kfree(glob); 1395 kfree(glob);
1396} 1396}
1397 1397
1398void ttm_bo_global_release(struct ttm_global_reference *ref) 1398void ttm_bo_global_release(struct drm_global_reference *ref)
1399{ 1399{
1400 struct ttm_bo_global *glob = ref->object; 1400 struct ttm_bo_global *glob = ref->object;
1401 1401
@@ -1404,7 +1404,7 @@ void ttm_bo_global_release(struct ttm_global_reference *ref)
1404} 1404}
1405EXPORT_SYMBOL(ttm_bo_global_release); 1405EXPORT_SYMBOL(ttm_bo_global_release);
1406 1406
1407int ttm_bo_global_init(struct ttm_global_reference *ref) 1407int ttm_bo_global_init(struct drm_global_reference *ref)
1408{ 1408{
1409 struct ttm_bo_global_ref *bo_ref = 1409 struct ttm_bo_global_ref *bo_ref =
1410 container_of(ref, struct ttm_bo_global_ref, ref); 1410 container_of(ref, struct ttm_bo_global_ref, ref);
diff --git a/drivers/gpu/drm/ttm/ttm_module.c b/drivers/gpu/drm/ttm/ttm_module.c
index 9a6edbfeaa9e..902d7cf9fb4e 100644
--- a/drivers/gpu/drm/ttm/ttm_module.c
+++ b/drivers/gpu/drm/ttm/ttm_module.c
@@ -70,8 +70,6 @@ static int __init ttm_init(void)
70 if (unlikely(ret != 0)) 70 if (unlikely(ret != 0))
71 return ret; 71 return ret;
72 72
73 ttm_global_init();
74
75 atomic_set(&device_released, 0); 73 atomic_set(&device_released, 0);
76 ret = drm_class_device_register(&ttm_drm_class_device); 74 ret = drm_class_device_register(&ttm_drm_class_device);
77 if (unlikely(ret != 0)) 75 if (unlikely(ret != 0))
@@ -81,7 +79,6 @@ static int __init ttm_init(void)
81out_no_dev_reg: 79out_no_dev_reg:
82 atomic_set(&device_released, 1); 80 atomic_set(&device_released, 1);
83 wake_up_all(&exit_q); 81 wake_up_all(&exit_q);
84 ttm_global_release();
85 return ret; 82 return ret;
86} 83}
87 84
@@ -95,7 +92,6 @@ static void __exit ttm_exit(void)
95 */ 92 */
96 93
97 wait_event(exit_q, atomic_read(&device_released) == 1); 94 wait_event(exit_q, atomic_read(&device_released) == 1);
98 ttm_global_release();
99} 95}
100 96
101module_init(ttm_init); 97module_init(ttm_init);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
index eaad52095339..429f917b60bf 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
@@ -164,7 +164,7 @@ struct vmw_vga_topology_state {
164struct vmw_private { 164struct vmw_private {
165 struct ttm_bo_device bdev; 165 struct ttm_bo_device bdev;
166 struct ttm_bo_global_ref bo_global_ref; 166 struct ttm_bo_global_ref bo_global_ref;
167 struct ttm_global_reference mem_global_ref; 167 struct drm_global_reference mem_global_ref;
168 168
169 struct vmw_fifo_state fifo; 169 struct vmw_fifo_state fifo;
170 170
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c
index e3df4adfb4d8..83123287c60c 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c
@@ -44,29 +44,29 @@ int vmw_mmap(struct file *filp, struct vm_area_struct *vma)
44 return ttm_bo_mmap(filp, vma, &dev_priv->bdev); 44 return ttm_bo_mmap(filp, vma, &dev_priv->bdev);
45} 45}
46 46
47static int vmw_ttm_mem_global_init(struct ttm_global_reference *ref) 47static int vmw_ttm_mem_global_init(struct drm_global_reference *ref)
48{ 48{
49 DRM_INFO("global init.\n"); 49 DRM_INFO("global init.\n");
50 return ttm_mem_global_init(ref->object); 50 return ttm_mem_global_init(ref->object);
51} 51}
52 52
53static void vmw_ttm_mem_global_release(struct ttm_global_reference *ref) 53static void vmw_ttm_mem_global_release(struct drm_global_reference *ref)
54{ 54{
55 ttm_mem_global_release(ref->object); 55 ttm_mem_global_release(ref->object);
56} 56}
57 57
58int vmw_ttm_global_init(struct vmw_private *dev_priv) 58int vmw_ttm_global_init(struct vmw_private *dev_priv)
59{ 59{
60 struct ttm_global_reference *global_ref; 60 struct drm_global_reference *global_ref;
61 int ret; 61 int ret;
62 62
63 global_ref = &dev_priv->mem_global_ref; 63 global_ref = &dev_priv->mem_global_ref;
64 global_ref->global_type = TTM_GLOBAL_TTM_MEM; 64 global_ref->global_type = DRM_GLOBAL_TTM_MEM;
65 global_ref->size = sizeof(struct ttm_mem_global); 65 global_ref->size = sizeof(struct ttm_mem_global);
66 global_ref->init = &vmw_ttm_mem_global_init; 66 global_ref->init = &vmw_ttm_mem_global_init;
67 global_ref->release = &vmw_ttm_mem_global_release; 67 global_ref->release = &vmw_ttm_mem_global_release;
68 68
69 ret = ttm_global_item_ref(global_ref); 69 ret = drm_global_item_ref(global_ref);
70 if (unlikely(ret != 0)) { 70 if (unlikely(ret != 0)) {
71 DRM_ERROR("Failed setting up TTM memory accounting.\n"); 71 DRM_ERROR("Failed setting up TTM memory accounting.\n");
72 return ret; 72 return ret;
@@ -75,11 +75,11 @@ int vmw_ttm_global_init(struct vmw_private *dev_priv)
75 dev_priv->bo_global_ref.mem_glob = 75 dev_priv->bo_global_ref.mem_glob =
76 dev_priv->mem_global_ref.object; 76 dev_priv->mem_global_ref.object;
77 global_ref = &dev_priv->bo_global_ref.ref; 77 global_ref = &dev_priv->bo_global_ref.ref;
78 global_ref->global_type = TTM_GLOBAL_TTM_BO; 78 global_ref->global_type = DRM_GLOBAL_TTM_BO;
79 global_ref->size = sizeof(struct ttm_bo_global); 79 global_ref->size = sizeof(struct ttm_bo_global);
80 global_ref->init = &ttm_bo_global_init; 80 global_ref->init = &ttm_bo_global_init;
81 global_ref->release = &ttm_bo_global_release; 81 global_ref->release = &ttm_bo_global_release;
82 ret = ttm_global_item_ref(global_ref); 82 ret = drm_global_item_ref(global_ref);
83 83
84 if (unlikely(ret != 0)) { 84 if (unlikely(ret != 0)) {
85 DRM_ERROR("Failed setting up TTM buffer objects.\n"); 85 DRM_ERROR("Failed setting up TTM buffer objects.\n");
@@ -88,12 +88,12 @@ int vmw_ttm_global_init(struct vmw_private *dev_priv)
88 88
89 return 0; 89 return 0;
90out_no_bo: 90out_no_bo:
91 ttm_global_item_unref(&dev_priv->mem_global_ref); 91 drm_global_item_unref(&dev_priv->mem_global_ref);
92 return ret; 92 return ret;
93} 93}
94 94
95void vmw_ttm_global_release(struct vmw_private *dev_priv) 95void vmw_ttm_global_release(struct vmw_private *dev_priv)
96{ 96{
97 ttm_global_item_unref(&dev_priv->bo_global_ref.ref); 97 drm_global_item_unref(&dev_priv->bo_global_ref.ref);
98 ttm_global_item_unref(&dev_priv->mem_global_ref); 98 drm_global_item_unref(&dev_priv->mem_global_ref);
99} 99}