diff options
| author | Chunming Zhou <david1.zhou@amd.com> | 2015-08-03 01:11:04 -0400 |
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2015-08-17 16:50:51 -0400 |
| commit | 0e3f154a9eb9f7a5ec365c4586a606ba882a3f15 (patch) | |
| tree | 00e8c0f2ad43e943005e7f47ecb4392909fb48fe /drivers/gpu/drm/amd | |
| parent | bb1e38a4bead5025ecca90544f0f733f59996b13 (diff) | |
drm/amdgpu: change uvd ib test to use kernel fence directly
Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <jammy.zhou@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | 4 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 14 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h | 4 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | 6 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c | 6 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 6 |
6 files changed, 21 insertions, 19 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c index df202999fbfe..567c5b3c6f3a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | |||
| @@ -244,17 +244,19 @@ static int amdgpu_test_create_and_emit_fence(struct amdgpu_device *adev, | |||
| 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; | ||
| 247 | r = amdgpu_uvd_get_create_msg(ring, handle, NULL); | 248 | r = amdgpu_uvd_get_create_msg(ring, handle, NULL); |
| 248 | if (r) { | 249 | if (r) { |
| 249 | DRM_ERROR("Failed to get dummy create msg\n"); | 250 | DRM_ERROR("Failed to get dummy create msg\n"); |
| 250 | return r; | 251 | return r; |
| 251 | } | 252 | } |
| 252 | 253 | ||
| 253 | r = amdgpu_uvd_get_destroy_msg(ring, handle, fence); | 254 | r = amdgpu_uvd_get_destroy_msg(ring, handle, &f); |
| 254 | if (r) { | 255 | if (r) { |
| 255 | DRM_ERROR("Failed to get dummy destroy msg\n"); | 256 | DRM_ERROR("Failed to get dummy destroy msg\n"); |
| 256 | return r; | 257 | return r; |
| 257 | } | 258 | } |
| 259 | *fence = to_amdgpu_fence(f); | ||
| 258 | 260 | ||
| 259 | } else if (ring == &adev->vce.ring[0] || | 261 | } else if (ring == &adev->vce.ring[0] || |
| 260 | ring == &adev->vce.ring[1]) { | 262 | ring == &adev->vce.ring[1]) { |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c index c1be7db36a69..9b2730599134 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | |||
| @@ -288,7 +288,7 @@ void amdgpu_uvd_free_handles(struct amdgpu_device *adev, struct drm_file *filp) | |||
| 288 | for (i = 0; i < AMDGPU_MAX_UVD_HANDLES; ++i) { | 288 | for (i = 0; i < AMDGPU_MAX_UVD_HANDLES; ++i) { |
| 289 | uint32_t handle = atomic_read(&adev->uvd.handles[i]); | 289 | uint32_t handle = atomic_read(&adev->uvd.handles[i]); |
| 290 | if (handle != 0 && adev->uvd.filp[i] == filp) { | 290 | if (handle != 0 && adev->uvd.filp[i] == filp) { |
| 291 | struct amdgpu_fence *fence; | 291 | struct fence *fence; |
| 292 | 292 | ||
| 293 | amdgpu_uvd_note_usage(adev); | 293 | amdgpu_uvd_note_usage(adev); |
| 294 | 294 | ||
| @@ -298,8 +298,8 @@ void amdgpu_uvd_free_handles(struct amdgpu_device *adev, struct drm_file *filp) | |||
| 298 | continue; | 298 | continue; |
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | amdgpu_fence_wait(fence, false); | 301 | fence_wait(fence, false); |
| 302 | amdgpu_fence_unref(&fence); | 302 | fence_put(fence); |
| 303 | 303 | ||
| 304 | adev->uvd.filp[i] = NULL; | 304 | adev->uvd.filp[i] = NULL; |
| 305 | atomic_set(&adev->uvd.handles[i], 0); | 305 | atomic_set(&adev->uvd.handles[i], 0); |
| @@ -819,7 +819,7 @@ static int amdgpu_uvd_free_job( | |||
| 819 | 819 | ||
| 820 | static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, | 820 | static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, |
| 821 | struct amdgpu_bo *bo, | 821 | struct amdgpu_bo *bo, |
| 822 | struct amdgpu_fence **fence) | 822 | struct fence **fence) |
| 823 | { | 823 | { |
| 824 | struct ttm_validate_buffer tv; | 824 | struct ttm_validate_buffer tv; |
| 825 | struct ww_acquire_ctx ticket; | 825 | struct ww_acquire_ctx ticket; |
| @@ -876,7 +876,7 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, | |||
| 876 | ttm_eu_fence_buffer_objects(&ticket, &head, &ib->fence->base); | 876 | ttm_eu_fence_buffer_objects(&ticket, &head, &ib->fence->base); |
| 877 | 877 | ||
| 878 | if (fence) | 878 | if (fence) |
| 879 | *fence = amdgpu_fence_ref(ib->fence); | 879 | *fence = fence_get(&ib->fence->base); |
| 880 | amdgpu_bo_unref(&bo); | 880 | amdgpu_bo_unref(&bo); |
| 881 | 881 | ||
| 882 | if (amdgpu_enable_scheduler) | 882 | if (amdgpu_enable_scheduler) |
| @@ -898,7 +898,7 @@ err: | |||
| 898 | crash the vcpu so just try to emmit a dummy create/destroy msg to | 898 | crash the vcpu so just try to emmit a dummy create/destroy msg to |
| 899 | avoid this */ | 899 | avoid this */ |
| 900 | int amdgpu_uvd_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, | 900 | int amdgpu_uvd_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, |
| 901 | struct amdgpu_fence **fence) | 901 | struct fence **fence) |
| 902 | { | 902 | { |
| 903 | struct amdgpu_device *adev = ring->adev; | 903 | struct amdgpu_device *adev = ring->adev; |
| 904 | struct amdgpu_bo *bo; | 904 | struct amdgpu_bo *bo; |
| @@ -945,7 +945,7 @@ int amdgpu_uvd_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, | |||
| 945 | } | 945 | } |
| 946 | 946 | ||
| 947 | int amdgpu_uvd_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle, | 947 | int amdgpu_uvd_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle, |
| 948 | struct amdgpu_fence **fence) | 948 | struct fence **fence) |
| 949 | { | 949 | { |
| 950 | struct amdgpu_device *adev = ring->adev; | 950 | struct amdgpu_device *adev = ring->adev; |
| 951 | struct amdgpu_bo *bo; | 951 | struct amdgpu_bo *bo; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h index 2255aa710e33..1724c2c86151 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h | |||
| @@ -29,9 +29,9 @@ int amdgpu_uvd_sw_fini(struct amdgpu_device *adev); | |||
| 29 | int amdgpu_uvd_suspend(struct amdgpu_device *adev); | 29 | int amdgpu_uvd_suspend(struct amdgpu_device *adev); |
| 30 | int amdgpu_uvd_resume(struct amdgpu_device *adev); | 30 | int amdgpu_uvd_resume(struct amdgpu_device *adev); |
| 31 | int amdgpu_uvd_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, | 31 | int amdgpu_uvd_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, |
| 32 | struct amdgpu_fence **fence); | 32 | struct fence **fence); |
| 33 | int amdgpu_uvd_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle, | 33 | int amdgpu_uvd_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle, |
| 34 | struct amdgpu_fence **fence); | 34 | struct fence **fence); |
| 35 | void amdgpu_uvd_free_handles(struct amdgpu_device *adev, | 35 | void amdgpu_uvd_free_handles(struct amdgpu_device *adev, |
| 36 | struct drm_file *filp); | 36 | struct drm_file *filp); |
| 37 | int amdgpu_uvd_ring_parse_cs(struct amdgpu_cs_parser *parser, uint32_t ib_idx); | 37 | int amdgpu_uvd_ring_parse_cs(struct amdgpu_cs_parser *parser, uint32_t ib_idx); |
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c index 4efd671d7a9b..9ac383bc6c1f 100644 --- a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | |||
| @@ -534,7 +534,7 @@ static void uvd_v4_2_ring_emit_ib(struct amdgpu_ring *ring, | |||
| 534 | static int uvd_v4_2_ring_test_ib(struct amdgpu_ring *ring) | 534 | static int uvd_v4_2_ring_test_ib(struct amdgpu_ring *ring) |
| 535 | { | 535 | { |
| 536 | struct amdgpu_device *adev = ring->adev; | 536 | struct amdgpu_device *adev = ring->adev; |
| 537 | struct amdgpu_fence *fence = NULL; | 537 | struct fence *fence = NULL; |
| 538 | int r; | 538 | int r; |
| 539 | 539 | ||
| 540 | r = amdgpu_asic_set_uvd_clocks(adev, 53300, 40000); | 540 | r = amdgpu_asic_set_uvd_clocks(adev, 53300, 40000); |
| @@ -555,14 +555,14 @@ static int uvd_v4_2_ring_test_ib(struct amdgpu_ring *ring) | |||
| 555 | goto error; | 555 | goto error; |
| 556 | } | 556 | } |
| 557 | 557 | ||
| 558 | r = amdgpu_fence_wait(fence, false); | 558 | r = fence_wait(fence, false); |
| 559 | if (r) { | 559 | if (r) { |
| 560 | DRM_ERROR("amdgpu: fence wait failed (%d).\n", r); | 560 | DRM_ERROR("amdgpu: fence wait failed (%d).\n", r); |
| 561 | goto error; | 561 | goto error; |
| 562 | } | 562 | } |
| 563 | DRM_INFO("ib test on ring %d succeeded\n", ring->idx); | 563 | DRM_INFO("ib test on ring %d succeeded\n", ring->idx); |
| 564 | error: | 564 | error: |
| 565 | amdgpu_fence_unref(&fence); | 565 | fence_put(fence); |
| 566 | amdgpu_asic_set_uvd_clocks(adev, 0, 0); | 566 | amdgpu_asic_set_uvd_clocks(adev, 0, 0); |
| 567 | return r; | 567 | return r; |
| 568 | } | 568 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c index b756bd99c0fd..de4b3f57902d 100644 --- a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c | |||
| @@ -580,7 +580,7 @@ static void uvd_v5_0_ring_emit_ib(struct amdgpu_ring *ring, | |||
| 580 | static int uvd_v5_0_ring_test_ib(struct amdgpu_ring *ring) | 580 | static int uvd_v5_0_ring_test_ib(struct amdgpu_ring *ring) |
| 581 | { | 581 | { |
| 582 | struct amdgpu_device *adev = ring->adev; | 582 | struct amdgpu_device *adev = ring->adev; |
| 583 | struct amdgpu_fence *fence = NULL; | 583 | struct fence *fence = NULL; |
| 584 | int r; | 584 | int r; |
| 585 | 585 | ||
| 586 | r = amdgpu_asic_set_uvd_clocks(adev, 53300, 40000); | 586 | r = amdgpu_asic_set_uvd_clocks(adev, 53300, 40000); |
| @@ -601,14 +601,14 @@ static int uvd_v5_0_ring_test_ib(struct amdgpu_ring *ring) | |||
| 601 | goto error; | 601 | goto error; |
| 602 | } | 602 | } |
| 603 | 603 | ||
| 604 | r = amdgpu_fence_wait(fence, false); | 604 | r = fence_wait(fence, false); |
| 605 | if (r) { | 605 | if (r) { |
| 606 | DRM_ERROR("amdgpu: fence wait failed (%d).\n", r); | 606 | DRM_ERROR("amdgpu: fence wait failed (%d).\n", r); |
| 607 | goto error; | 607 | goto error; |
| 608 | } | 608 | } |
| 609 | DRM_INFO("ib test on ring %d succeeded\n", ring->idx); | 609 | DRM_INFO("ib test on ring %d succeeded\n", ring->idx); |
| 610 | error: | 610 | error: |
| 611 | amdgpu_fence_unref(&fence); | 611 | fence_put(fence); |
| 612 | amdgpu_asic_set_uvd_clocks(adev, 0, 0); | 612 | amdgpu_asic_set_uvd_clocks(adev, 0, 0); |
| 613 | return r; | 613 | return r; |
| 614 | } | 614 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c index 49aa931b2cb4..66c975870e97 100644 --- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | |||
| @@ -575,7 +575,7 @@ static void uvd_v6_0_ring_emit_ib(struct amdgpu_ring *ring, | |||
| 575 | */ | 575 | */ |
| 576 | static int uvd_v6_0_ring_test_ib(struct amdgpu_ring *ring) | 576 | static int uvd_v6_0_ring_test_ib(struct amdgpu_ring *ring) |
| 577 | { | 577 | { |
| 578 | struct amdgpu_fence *fence = NULL; | 578 | struct fence *fence = NULL; |
| 579 | int r; | 579 | int r; |
| 580 | 580 | ||
| 581 | r = amdgpu_uvd_get_create_msg(ring, 1, NULL); | 581 | r = amdgpu_uvd_get_create_msg(ring, 1, NULL); |
| @@ -590,14 +590,14 @@ static int uvd_v6_0_ring_test_ib(struct amdgpu_ring *ring) | |||
| 590 | goto error; | 590 | goto error; |
| 591 | } | 591 | } |
| 592 | 592 | ||
| 593 | r = amdgpu_fence_wait(fence, false); | 593 | r = fence_wait(fence, false); |
| 594 | if (r) { | 594 | if (r) { |
| 595 | DRM_ERROR("amdgpu: fence wait failed (%d).\n", r); | 595 | DRM_ERROR("amdgpu: fence wait failed (%d).\n", r); |
| 596 | goto error; | 596 | goto error; |
| 597 | } | 597 | } |
| 598 | DRM_INFO("ib test on ring %d succeeded\n", ring->idx); | 598 | DRM_INFO("ib test on ring %d succeeded\n", ring->idx); |
| 599 | error: | 599 | error: |
| 600 | amdgpu_fence_unref(&fence); | 600 | fence_put(fence); |
| 601 | return r; | 601 | return r; |
| 602 | } | 602 | } |
| 603 | 603 | ||
