diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_gart.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_gart.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index a68d7566178c..e73d56e83fa6 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c | |||
@@ -78,11 +78,9 @@ int radeon_gart_table_vram_alloc(struct radeon_device *rdev) | |||
78 | int r; | 78 | int r; |
79 | 79 | ||
80 | if (rdev->gart.table.vram.robj == NULL) { | 80 | if (rdev->gart.table.vram.robj == NULL) { |
81 | r = radeon_object_create(rdev, NULL, | 81 | r = radeon_bo_create(rdev, NULL, rdev->gart.table_size, |
82 | rdev->gart.table_size, | 82 | true, RADEON_GEM_DOMAIN_VRAM, |
83 | true, | 83 | &rdev->gart.table.vram.robj); |
84 | RADEON_GEM_DOMAIN_VRAM, | ||
85 | false, &rdev->gart.table.vram.robj); | ||
86 | if (r) { | 84 | if (r) { |
87 | return r; | 85 | return r; |
88 | } | 86 | } |
@@ -95,32 +93,38 @@ int radeon_gart_table_vram_pin(struct radeon_device *rdev) | |||
95 | uint64_t gpu_addr; | 93 | uint64_t gpu_addr; |
96 | int r; | 94 | int r; |
97 | 95 | ||
98 | r = radeon_object_pin(rdev->gart.table.vram.robj, | 96 | r = radeon_bo_reserve(rdev->gart.table.vram.robj, false); |
99 | RADEON_GEM_DOMAIN_VRAM, &gpu_addr); | 97 | if (unlikely(r != 0)) |
100 | if (r) { | ||
101 | radeon_object_unref(&rdev->gart.table.vram.robj); | ||
102 | return r; | 98 | return r; |
103 | } | 99 | r = radeon_bo_pin(rdev->gart.table.vram.robj, |
104 | r = radeon_object_kmap(rdev->gart.table.vram.robj, | 100 | RADEON_GEM_DOMAIN_VRAM, &gpu_addr); |
105 | (void **)&rdev->gart.table.vram.ptr); | ||
106 | if (r) { | 101 | if (r) { |
107 | radeon_object_unpin(rdev->gart.table.vram.robj); | 102 | radeon_bo_unreserve(rdev->gart.table.vram.robj); |
108 | radeon_object_unref(&rdev->gart.table.vram.robj); | ||
109 | DRM_ERROR("radeon: failed to map gart vram table.\n"); | ||
110 | return r; | 103 | return r; |
111 | } | 104 | } |
105 | r = radeon_bo_kmap(rdev->gart.table.vram.robj, | ||
106 | (void **)&rdev->gart.table.vram.ptr); | ||
107 | if (r) | ||
108 | radeon_bo_unpin(rdev->gart.table.vram.robj); | ||
109 | radeon_bo_unreserve(rdev->gart.table.vram.robj); | ||
112 | rdev->gart.table_addr = gpu_addr; | 110 | rdev->gart.table_addr = gpu_addr; |
113 | return 0; | 111 | return r; |
114 | } | 112 | } |
115 | 113 | ||
116 | void radeon_gart_table_vram_free(struct radeon_device *rdev) | 114 | void radeon_gart_table_vram_free(struct radeon_device *rdev) |
117 | { | 115 | { |
116 | int r; | ||
117 | |||
118 | if (rdev->gart.table.vram.robj == NULL) { | 118 | if (rdev->gart.table.vram.robj == NULL) { |
119 | return; | 119 | return; |
120 | } | 120 | } |
121 | radeon_object_kunmap(rdev->gart.table.vram.robj); | 121 | r = radeon_bo_reserve(rdev->gart.table.vram.robj, false); |
122 | radeon_object_unpin(rdev->gart.table.vram.robj); | 122 | if (likely(r == 0)) { |
123 | radeon_object_unref(&rdev->gart.table.vram.robj); | 123 | radeon_bo_kunmap(rdev->gart.table.vram.robj); |
124 | radeon_bo_unpin(rdev->gart.table.vram.robj); | ||
125 | radeon_bo_unreserve(rdev->gart.table.vram.robj); | ||
126 | } | ||
127 | radeon_bo_unref(&rdev->gart.table.vram.robj); | ||
124 | } | 128 | } |
125 | 129 | ||
126 | 130 | ||