aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_test.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_test.c46
1 files changed, 22 insertions, 24 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
index 251b1ebef722..afb57de16521 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
@@ -238,49 +238,47 @@ void amdgpu_test_moves(struct amdgpu_device *adev)
238 238
239static int amdgpu_test_create_and_emit_fence(struct amdgpu_device *adev, 239static 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;
245 245
246 if (ring == &adev->uvd.ring) { 246 if (ring == &adev->uvd.ring) {
247 struct fence *f = NULL;
248 r = amdgpu_uvd_get_create_msg(ring, handle, NULL); 247 r = amdgpu_uvd_get_create_msg(ring, handle, NULL);
249 if (r) { 248 if (r) {
250 DRM_ERROR("Failed to get dummy create msg\n"); 249 DRM_ERROR("Failed to get dummy create msg\n");
251 return r; 250 return r;
252 } 251 }
253 252
254 r = amdgpu_uvd_get_destroy_msg(ring, handle, &f); 253 r = amdgpu_uvd_get_destroy_msg(ring, handle, fence);
255 if (r) { 254 if (r) {
256 DRM_ERROR("Failed to get dummy destroy msg\n"); 255 DRM_ERROR("Failed to get dummy destroy msg\n");
257 return r; 256 return r;
258 } 257 }
259 *fence = to_amdgpu_fence(f);
260 258
261 } else if (ring == &adev->vce.ring[0] || 259 } else if (ring == &adev->vce.ring[0] ||
262 ring == &adev->vce.ring[1]) { 260 ring == &adev->vce.ring[1]) {
263 struct fence *f = NULL;
264 r = amdgpu_vce_get_create_msg(ring, handle, NULL); 261 r = amdgpu_vce_get_create_msg(ring, handle, NULL);
265 if (r) { 262 if (r) {
266 DRM_ERROR("Failed to get dummy create msg\n"); 263 DRM_ERROR("Failed to get dummy create msg\n");
267 return r; 264 return r;
268 } 265 }
269 266
270 r = amdgpu_vce_get_destroy_msg(ring, handle, &f); 267 r = amdgpu_vce_get_destroy_msg(ring, handle, fence);
271 if (r) { 268 if (r) {
272 DRM_ERROR("Failed to get dummy destroy msg\n"); 269 DRM_ERROR("Failed to get dummy destroy msg\n");
273 return r; 270 return r;
274 } 271 }
275 *fence = to_amdgpu_fence(f);
276 } else { 272 } else {
273 struct amdgpu_fence *a_fence = NULL;
277 r = amdgpu_ring_lock(ring, 64); 274 r = amdgpu_ring_lock(ring, 64);
278 if (r) { 275 if (r) {
279 DRM_ERROR("Failed to lock ring A %d\n", ring->idx); 276 DRM_ERROR("Failed to lock ring A %d\n", ring->idx);
280 return r; 277 return r;
281 } 278 }
282 amdgpu_fence_emit(ring, AMDGPU_FENCE_OWNER_UNDEFINED, fence); 279 amdgpu_fence_emit(ring, AMDGPU_FENCE_OWNER_UNDEFINED, &a_fence);
283 amdgpu_ring_unlock_commit(ring); 280 amdgpu_ring_unlock_commit(ring);
281 *fence = &a_fence->base;
284 } 282 }
285 return 0; 283 return 0;
286} 284}
@@ -289,7 +287,7 @@ void amdgpu_test_ring_sync(struct amdgpu_device *adev,
289 struct amdgpu_ring *ringA, 287 struct amdgpu_ring *ringA,
290 struct amdgpu_ring *ringB) 288 struct amdgpu_ring *ringB)
291{ 289{
292 struct amdgpu_fence *fence1 = NULL, *fence2 = NULL; 290 struct fence *fence1 = NULL, *fence2 = NULL;
293 struct amdgpu_semaphore *semaphore = NULL; 291 struct amdgpu_semaphore *semaphore = NULL;
294 int r; 292 int r;
295 293
@@ -325,7 +323,7 @@ void amdgpu_test_ring_sync(struct amdgpu_device *adev,
325 323
326 mdelay(1000); 324 mdelay(1000);
327 325
328 if (amdgpu_fence_signaled(fence1)) { 326 if (fence_is_signaled(fence1)) {
329 DRM_ERROR("Fence 1 signaled without waiting for semaphore.\n"); 327 DRM_ERROR("Fence 1 signaled without waiting for semaphore.\n");
330 goto out_cleanup; 328 goto out_cleanup;
331 } 329 }
@@ -338,7 +336,7 @@ void amdgpu_test_ring_sync(struct amdgpu_device *adev,
338 amdgpu_semaphore_emit_signal(ringB, semaphore); 336 amdgpu_semaphore_emit_signal(ringB, semaphore);
339 amdgpu_ring_unlock_commit(ringB); 337 amdgpu_ring_unlock_commit(ringB);
340 338
341 r = amdgpu_fence_wait(fence1, false); 339 r = fence_wait(fence1, false);
342 if (r) { 340 if (r) {
343 DRM_ERROR("Failed to wait for sync fence 1\n"); 341 DRM_ERROR("Failed to wait for sync fence 1\n");
344 goto out_cleanup; 342 goto out_cleanup;
@@ -346,7 +344,7 @@ void amdgpu_test_ring_sync(struct amdgpu_device *adev,
346 344
347 mdelay(1000); 345 mdelay(1000);
348 346
349 if (amdgpu_fence_signaled(fence2)) { 347 if (fence_is_signaled(fence2)) {
350 DRM_ERROR("Fence 2 signaled without waiting for semaphore.\n"); 348 DRM_ERROR("Fence 2 signaled without waiting for semaphore.\n");
351 goto out_cleanup; 349 goto out_cleanup;
352 } 350 }
@@ -359,7 +357,7 @@ void amdgpu_test_ring_sync(struct amdgpu_device *adev,
359 amdgpu_semaphore_emit_signal(ringB, semaphore); 357 amdgpu_semaphore_emit_signal(ringB, semaphore);
360 amdgpu_ring_unlock_commit(ringB); 358 amdgpu_ring_unlock_commit(ringB);
361 359
362 r = amdgpu_fence_wait(fence2, false); 360 r = fence_wait(fence2, false);
363 if (r) { 361 if (r) {
364 DRM_ERROR("Failed to wait for sync fence 1\n"); 362 DRM_ERROR("Failed to wait for sync fence 1\n");
365 goto out_cleanup; 363 goto out_cleanup;
@@ -369,10 +367,10 @@ out_cleanup:
369 amdgpu_semaphore_free(adev, &semaphore, NULL); 367 amdgpu_semaphore_free(adev, &semaphore, NULL);
370 368
371 if (fence1) 369 if (fence1)
372 amdgpu_fence_unref(&fence1); 370 fence_put(fence1);
373 371
374 if (fence2) 372 if (fence2)
375 amdgpu_fence_unref(&fence2); 373 fence_put(fence2);
376 374
377 if (r) 375 if (r)
378 printk(KERN_WARNING "Error while testing ring sync (%d).\n", r); 376 printk(KERN_WARNING "Error while testing ring sync (%d).\n", r);
@@ -383,7 +381,7 @@ static void amdgpu_test_ring_sync2(struct amdgpu_device *adev,
383 struct amdgpu_ring *ringB, 381 struct amdgpu_ring *ringB,
384 struct amdgpu_ring *ringC) 382 struct amdgpu_ring *ringC)
385{ 383{
386 struct amdgpu_fence *fenceA = NULL, *fenceB = NULL; 384 struct fence *fenceA = NULL, *fenceB = NULL;
387 struct amdgpu_semaphore *semaphore = NULL; 385 struct amdgpu_semaphore *semaphore = NULL;
388 bool sigA, sigB; 386 bool sigA, sigB;
389 int i, r; 387 int i, r;
@@ -419,11 +417,11 @@ static void amdgpu_test_ring_sync2(struct amdgpu_device *adev,
419 417
420 mdelay(1000); 418 mdelay(1000);
421 419
422 if (amdgpu_fence_signaled(fenceA)) { 420 if (fence_is_signaled(fenceA)) {
423 DRM_ERROR("Fence A signaled without waiting for semaphore.\n"); 421 DRM_ERROR("Fence A signaled without waiting for semaphore.\n");
424 goto out_cleanup; 422 goto out_cleanup;
425 } 423 }
426 if (amdgpu_fence_signaled(fenceB)) { 424 if (fence_is_signaled(fenceB)) {
427 DRM_ERROR("Fence B signaled without waiting for semaphore.\n"); 425 DRM_ERROR("Fence B signaled without waiting for semaphore.\n");
428 goto out_cleanup; 426 goto out_cleanup;
429 } 427 }
@@ -438,8 +436,8 @@ static void amdgpu_test_ring_sync2(struct amdgpu_device *adev,
438 436
439 for (i = 0; i < 30; ++i) { 437 for (i = 0; i < 30; ++i) {
440 mdelay(100); 438 mdelay(100);
441 sigA = amdgpu_fence_signaled(fenceA); 439 sigA = fence_is_signaled(fenceA);
442 sigB = amdgpu_fence_signaled(fenceB); 440 sigB = fence_is_signaled(fenceB);
443 if (sigA || sigB) 441 if (sigA || sigB)
444 break; 442 break;
445 } 443 }
@@ -464,12 +462,12 @@ static void amdgpu_test_ring_sync2(struct amdgpu_device *adev,
464 462
465 mdelay(1000); 463 mdelay(1000);
466 464
467 r = amdgpu_fence_wait(fenceA, false); 465 r = fence_wait(fenceA, false);
468 if (r) { 466 if (r) {
469 DRM_ERROR("Failed to wait for sync fence A\n"); 467 DRM_ERROR("Failed to wait for sync fence A\n");
470 goto out_cleanup; 468 goto out_cleanup;
471 } 469 }
472 r = amdgpu_fence_wait(fenceB, false); 470 r = fence_wait(fenceB, false);
473 if (r) { 471 if (r) {
474 DRM_ERROR("Failed to wait for sync fence B\n"); 472 DRM_ERROR("Failed to wait for sync fence B\n");
475 goto out_cleanup; 473 goto out_cleanup;
@@ -479,10 +477,10 @@ out_cleanup:
479 amdgpu_semaphore_free(adev, &semaphore, NULL); 477 amdgpu_semaphore_free(adev, &semaphore, NULL);
480 478
481 if (fenceA) 479 if (fenceA)
482 amdgpu_fence_unref(&fenceA); 480 fence_put(fenceA);
483 481
484 if (fenceB) 482 if (fenceB)
485 amdgpu_fence_unref(&fenceB); 483 fence_put(fenceB);
486 484
487 if (r) 485 if (r)
488 printk(KERN_WARNING "Error while testing ring sync (%d).\n", r); 486 printk(KERN_WARNING "Error while testing ring sync (%d).\n", r);