aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon_ttm.c
diff options
context:
space:
mode:
authorChristian König <deathsimple@vodafone.de>2012-05-08 08:24:01 -0400
committerChristian König <deathsimple@vodafone.de>2012-06-21 03:38:35 -0400
commit876dc9f32907e57e0298bcd0f1607cb7a2582f63 (patch)
treee7bd45fff5d2ddff8c8805ee83116e02b75d2a6a /drivers/gpu/drm/radeon/radeon_ttm.c
parent9c19415c233499c26081798b880910ec0e1d7bad (diff)
drm/radeon: remove radeon_fence_create
It is completely unnecessary to create fences before they are emitted, so remove it and a bunch of checks if fences are emitted or not. Signed-off-by: Christian König <deathsimple@vodafone.de> Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_ttm.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_ttm.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index c94a2257761f..2d36bdda9327 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -222,15 +222,12 @@ static int radeon_move_blit(struct ttm_buffer_object *bo,
222{ 222{
223 struct radeon_device *rdev; 223 struct radeon_device *rdev;
224 uint64_t old_start, new_start; 224 uint64_t old_start, new_start;
225 struct radeon_fence *fence, *old_fence; 225 struct radeon_fence *fence;
226 struct radeon_semaphore *sem = NULL; 226 struct radeon_semaphore *sem = NULL;
227 int r; 227 int r, ridx;
228 228
229 rdev = radeon_get_rdev(bo->bdev); 229 rdev = radeon_get_rdev(bo->bdev);
230 r = radeon_fence_create(rdev, &fence, radeon_copy_ring_index(rdev)); 230 ridx = radeon_copy_ring_index(rdev);
231 if (unlikely(r)) {
232 return r;
233 }
234 old_start = old_mem->start << PAGE_SHIFT; 231 old_start = old_mem->start << PAGE_SHIFT;
235 new_start = new_mem->start << PAGE_SHIFT; 232 new_start = new_mem->start << PAGE_SHIFT;
236 233
@@ -243,7 +240,6 @@ static int radeon_move_blit(struct ttm_buffer_object *bo,
243 break; 240 break;
244 default: 241 default:
245 DRM_ERROR("Unknown placement %d\n", old_mem->mem_type); 242 DRM_ERROR("Unknown placement %d\n", old_mem->mem_type);
246 radeon_fence_unref(&fence);
247 return -EINVAL; 243 return -EINVAL;
248 } 244 }
249 switch (new_mem->mem_type) { 245 switch (new_mem->mem_type) {
@@ -255,42 +251,38 @@ static int radeon_move_blit(struct ttm_buffer_object *bo,
255 break; 251 break;
256 default: 252 default:
257 DRM_ERROR("Unknown placement %d\n", old_mem->mem_type); 253 DRM_ERROR("Unknown placement %d\n", old_mem->mem_type);
258 radeon_fence_unref(&fence);
259 return -EINVAL; 254 return -EINVAL;
260 } 255 }
261 if (!rdev->ring[radeon_copy_ring_index(rdev)].ready) { 256 if (!rdev->ring[ridx].ready) {
262 DRM_ERROR("Trying to move memory with ring turned off.\n"); 257 DRM_ERROR("Trying to move memory with ring turned off.\n");
263 radeon_fence_unref(&fence);
264 return -EINVAL; 258 return -EINVAL;
265 } 259 }
266 260
267 BUILD_BUG_ON((PAGE_SIZE % RADEON_GPU_PAGE_SIZE) != 0); 261 BUILD_BUG_ON((PAGE_SIZE % RADEON_GPU_PAGE_SIZE) != 0);
268 262
269 /* sync other rings */ 263 /* sync other rings */
270 old_fence = bo->sync_obj; 264 fence = bo->sync_obj;
271 if (old_fence && old_fence->ring != fence->ring 265 if (fence && fence->ring != ridx
272 && !radeon_fence_signaled(old_fence)) { 266 && !radeon_fence_signaled(fence)) {
273 bool sync_to_ring[RADEON_NUM_RINGS] = { }; 267 bool sync_to_ring[RADEON_NUM_RINGS] = { };
274 sync_to_ring[old_fence->ring] = true; 268 sync_to_ring[fence->ring] = true;
275 269
276 r = radeon_semaphore_create(rdev, &sem); 270 r = radeon_semaphore_create(rdev, &sem);
277 if (r) { 271 if (r) {
278 radeon_fence_unref(&fence);
279 return r; 272 return r;
280 } 273 }
281 274
282 r = radeon_semaphore_sync_rings(rdev, sem, 275 r = radeon_semaphore_sync_rings(rdev, sem, sync_to_ring, ridx);
283 sync_to_ring, fence->ring);
284 if (r) { 276 if (r) {
285 radeon_semaphore_free(rdev, sem, NULL); 277 radeon_semaphore_free(rdev, sem, NULL);
286 radeon_fence_unref(&fence);
287 return r; 278 return r;
288 } 279 }
289 } 280 }
290 281
282 fence = NULL;
291 r = radeon_copy(rdev, old_start, new_start, 283 r = radeon_copy(rdev, old_start, new_start,
292 new_mem->num_pages * (PAGE_SIZE / RADEON_GPU_PAGE_SIZE), /* GPU pages */ 284 new_mem->num_pages * (PAGE_SIZE / RADEON_GPU_PAGE_SIZE), /* GPU pages */
293 fence); 285 &fence);
294 /* FIXME: handle copy error */ 286 /* FIXME: handle copy error */
295 r = ttm_bo_move_accel_cleanup(bo, (void *)fence, NULL, 287 r = ttm_bo_move_accel_cleanup(bo, (void *)fence, NULL,
296 evict, no_wait_reserve, no_wait_gpu, new_mem); 288 evict, no_wait_reserve, no_wait_gpu, new_mem);