diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_test.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c index df202999fbfe..962dd5552137 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | |||
@@ -116,7 +116,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev) | |||
116 | goto out_lclean_unpin; | 116 | goto out_lclean_unpin; |
117 | } | 117 | } |
118 | 118 | ||
119 | r = amdgpu_fence_wait(fence, false); | 119 | r = fence_wait(&fence->base, false); |
120 | if (r) { | 120 | if (r) { |
121 | DRM_ERROR("Failed to wait for GTT->VRAM fence %d\n", i); | 121 | DRM_ERROR("Failed to wait for GTT->VRAM fence %d\n", i); |
122 | goto out_lclean_unpin; | 122 | goto out_lclean_unpin; |
@@ -161,7 +161,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev) | |||
161 | goto out_lclean_unpin; | 161 | goto out_lclean_unpin; |
162 | } | 162 | } |
163 | 163 | ||
164 | r = amdgpu_fence_wait(fence, false); | 164 | r = fence_wait(&fence->base, false); |
165 | if (r) { | 165 | if (r) { |
166 | DRM_ERROR("Failed to wait for VRAM->GTT fence %d\n", i); | 166 | DRM_ERROR("Failed to wait for VRAM->GTT fence %d\n", i); |
167 | goto out_lclean_unpin; | 167 | goto out_lclean_unpin; |
@@ -238,7 +238,7 @@ void amdgpu_test_moves(struct amdgpu_device *adev) | |||
238 | 238 | ||
239 | static int amdgpu_test_create_and_emit_fence(struct amdgpu_device *adev, | 239 | static int amdgpu_test_create_and_emit_fence(struct amdgpu_device *adev, |
240 | struct amdgpu_ring *ring, | 240 | struct amdgpu_ring *ring, |
241 | struct amdgpu_fence **fence) | 241 | struct fence **fence) |
242 | { | 242 | { |
243 | uint32_t handle = ring->idx ^ 0xdeafbeef; | 243 | uint32_t handle = ring->idx ^ 0xdeafbeef; |
244 | int r; | 244 | int r; |
@@ -269,15 +269,16 @@ static int amdgpu_test_create_and_emit_fence(struct amdgpu_device *adev, | |||
269 | DRM_ERROR("Failed to get dummy destroy msg\n"); | 269 | DRM_ERROR("Failed to get dummy destroy msg\n"); |
270 | return r; | 270 | return r; |
271 | } | 271 | } |
272 | |||
273 | } else { | 272 | } else { |
273 | struct amdgpu_fence *a_fence = NULL; | ||
274 | r = amdgpu_ring_lock(ring, 64); | 274 | r = amdgpu_ring_lock(ring, 64); |
275 | if (r) { | 275 | if (r) { |
276 | DRM_ERROR("Failed to lock ring A %d\n", ring->idx); | 276 | DRM_ERROR("Failed to lock ring A %d\n", ring->idx); |
277 | return r; | 277 | return r; |
278 | } | 278 | } |
279 | amdgpu_fence_emit(ring, AMDGPU_FENCE_OWNER_UNDEFINED, fence); | 279 | amdgpu_fence_emit(ring, AMDGPU_FENCE_OWNER_UNDEFINED, &a_fence); |
280 | amdgpu_ring_unlock_commit(ring); | 280 | amdgpu_ring_unlock_commit(ring); |
281 | *fence = &a_fence->base; | ||
281 | } | 282 | } |
282 | return 0; | 283 | return 0; |
283 | } | 284 | } |
@@ -286,7 +287,7 @@ void amdgpu_test_ring_sync(struct amdgpu_device *adev, | |||
286 | struct amdgpu_ring *ringA, | 287 | struct amdgpu_ring *ringA, |
287 | struct amdgpu_ring *ringB) | 288 | struct amdgpu_ring *ringB) |
288 | { | 289 | { |
289 | struct amdgpu_fence *fence1 = NULL, *fence2 = NULL; | 290 | struct fence *fence1 = NULL, *fence2 = NULL; |
290 | struct amdgpu_semaphore *semaphore = NULL; | 291 | struct amdgpu_semaphore *semaphore = NULL; |
291 | int r; | 292 | int r; |
292 | 293 | ||
@@ -322,7 +323,7 @@ void amdgpu_test_ring_sync(struct amdgpu_device *adev, | |||
322 | 323 | ||
323 | mdelay(1000); | 324 | mdelay(1000); |
324 | 325 | ||
325 | if (amdgpu_fence_signaled(fence1)) { | 326 | if (fence_is_signaled(fence1)) { |
326 | DRM_ERROR("Fence 1 signaled without waiting for semaphore.\n"); | 327 | DRM_ERROR("Fence 1 signaled without waiting for semaphore.\n"); |
327 | goto out_cleanup; | 328 | goto out_cleanup; |
328 | } | 329 | } |
@@ -335,7 +336,7 @@ void amdgpu_test_ring_sync(struct amdgpu_device *adev, | |||
335 | amdgpu_semaphore_emit_signal(ringB, semaphore); | 336 | amdgpu_semaphore_emit_signal(ringB, semaphore); |
336 | amdgpu_ring_unlock_commit(ringB); | 337 | amdgpu_ring_unlock_commit(ringB); |
337 | 338 | ||
338 | r = amdgpu_fence_wait(fence1, false); | 339 | r = fence_wait(fence1, false); |
339 | if (r) { | 340 | if (r) { |
340 | DRM_ERROR("Failed to wait for sync fence 1\n"); | 341 | DRM_ERROR("Failed to wait for sync fence 1\n"); |
341 | goto out_cleanup; | 342 | goto out_cleanup; |
@@ -343,7 +344,7 @@ void amdgpu_test_ring_sync(struct amdgpu_device *adev, | |||
343 | 344 | ||
344 | mdelay(1000); | 345 | mdelay(1000); |
345 | 346 | ||
346 | if (amdgpu_fence_signaled(fence2)) { | 347 | if (fence_is_signaled(fence2)) { |
347 | DRM_ERROR("Fence 2 signaled without waiting for semaphore.\n"); | 348 | DRM_ERROR("Fence 2 signaled without waiting for semaphore.\n"); |
348 | goto out_cleanup; | 349 | goto out_cleanup; |
349 | } | 350 | } |
@@ -356,7 +357,7 @@ void amdgpu_test_ring_sync(struct amdgpu_device *adev, | |||
356 | amdgpu_semaphore_emit_signal(ringB, semaphore); | 357 | amdgpu_semaphore_emit_signal(ringB, semaphore); |
357 | amdgpu_ring_unlock_commit(ringB); | 358 | amdgpu_ring_unlock_commit(ringB); |
358 | 359 | ||
359 | r = amdgpu_fence_wait(fence2, false); | 360 | r = fence_wait(fence2, false); |
360 | if (r) { | 361 | if (r) { |
361 | DRM_ERROR("Failed to wait for sync fence 1\n"); | 362 | DRM_ERROR("Failed to wait for sync fence 1\n"); |
362 | goto out_cleanup; | 363 | goto out_cleanup; |
@@ -366,10 +367,10 @@ out_cleanup: | |||
366 | amdgpu_semaphore_free(adev, &semaphore, NULL); | 367 | amdgpu_semaphore_free(adev, &semaphore, NULL); |
367 | 368 | ||
368 | if (fence1) | 369 | if (fence1) |
369 | amdgpu_fence_unref(&fence1); | 370 | fence_put(fence1); |
370 | 371 | ||
371 | if (fence2) | 372 | if (fence2) |
372 | amdgpu_fence_unref(&fence2); | 373 | fence_put(fence2); |
373 | 374 | ||
374 | if (r) | 375 | if (r) |
375 | printk(KERN_WARNING "Error while testing ring sync (%d).\n", r); | 376 | printk(KERN_WARNING "Error while testing ring sync (%d).\n", r); |
@@ -380,7 +381,7 @@ static void amdgpu_test_ring_sync2(struct amdgpu_device *adev, | |||
380 | struct amdgpu_ring *ringB, | 381 | struct amdgpu_ring *ringB, |
381 | struct amdgpu_ring *ringC) | 382 | struct amdgpu_ring *ringC) |
382 | { | 383 | { |
383 | struct amdgpu_fence *fenceA = NULL, *fenceB = NULL; | 384 | struct fence *fenceA = NULL, *fenceB = NULL; |
384 | struct amdgpu_semaphore *semaphore = NULL; | 385 | struct amdgpu_semaphore *semaphore = NULL; |
385 | bool sigA, sigB; | 386 | bool sigA, sigB; |
386 | int i, r; | 387 | int i, r; |
@@ -416,11 +417,11 @@ static void amdgpu_test_ring_sync2(struct amdgpu_device *adev, | |||
416 | 417 | ||
417 | mdelay(1000); | 418 | mdelay(1000); |
418 | 419 | ||
419 | if (amdgpu_fence_signaled(fenceA)) { | 420 | if (fence_is_signaled(fenceA)) { |
420 | DRM_ERROR("Fence A signaled without waiting for semaphore.\n"); | 421 | DRM_ERROR("Fence A signaled without waiting for semaphore.\n"); |
421 | goto out_cleanup; | 422 | goto out_cleanup; |
422 | } | 423 | } |
423 | if (amdgpu_fence_signaled(fenceB)) { | 424 | if (fence_is_signaled(fenceB)) { |
424 | DRM_ERROR("Fence B signaled without waiting for semaphore.\n"); | 425 | DRM_ERROR("Fence B signaled without waiting for semaphore.\n"); |
425 | goto out_cleanup; | 426 | goto out_cleanup; |
426 | } | 427 | } |
@@ -435,8 +436,8 @@ static void amdgpu_test_ring_sync2(struct amdgpu_device *adev, | |||
435 | 436 | ||
436 | for (i = 0; i < 30; ++i) { | 437 | for (i = 0; i < 30; ++i) { |
437 | mdelay(100); | 438 | mdelay(100); |
438 | sigA = amdgpu_fence_signaled(fenceA); | 439 | sigA = fence_is_signaled(fenceA); |
439 | sigB = amdgpu_fence_signaled(fenceB); | 440 | sigB = fence_is_signaled(fenceB); |
440 | if (sigA || sigB) | 441 | if (sigA || sigB) |
441 | break; | 442 | break; |
442 | } | 443 | } |
@@ -461,12 +462,12 @@ static void amdgpu_test_ring_sync2(struct amdgpu_device *adev, | |||
461 | 462 | ||
462 | mdelay(1000); | 463 | mdelay(1000); |
463 | 464 | ||
464 | r = amdgpu_fence_wait(fenceA, false); | 465 | r = fence_wait(fenceA, false); |
465 | if (r) { | 466 | if (r) { |
466 | DRM_ERROR("Failed to wait for sync fence A\n"); | 467 | DRM_ERROR("Failed to wait for sync fence A\n"); |
467 | goto out_cleanup; | 468 | goto out_cleanup; |
468 | } | 469 | } |
469 | r = amdgpu_fence_wait(fenceB, false); | 470 | r = fence_wait(fenceB, false); |
470 | if (r) { | 471 | if (r) { |
471 | DRM_ERROR("Failed to wait for sync fence B\n"); | 472 | DRM_ERROR("Failed to wait for sync fence B\n"); |
472 | goto out_cleanup; | 473 | goto out_cleanup; |
@@ -476,10 +477,10 @@ out_cleanup: | |||
476 | amdgpu_semaphore_free(adev, &semaphore, NULL); | 477 | amdgpu_semaphore_free(adev, &semaphore, NULL); |
477 | 478 | ||
478 | if (fenceA) | 479 | if (fenceA) |
479 | amdgpu_fence_unref(&fenceA); | 480 | fence_put(fenceA); |
480 | 481 | ||
481 | if (fenceB) | 482 | if (fenceB) |
482 | amdgpu_fence_unref(&fenceB); | 483 | fence_put(fenceB); |
483 | 484 | ||
484 | if (r) | 485 | if (r) |
485 | printk(KERN_WARNING "Error while testing ring sync (%d).\n", r); | 486 | printk(KERN_WARNING "Error while testing ring sync (%d).\n", r); |