aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2016-07-05 15:07:17 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-07-29 14:37:04 -0400
commitbbec97aae660adafa5208c5defc54e3cbbe6b129 (patch)
treedeb3ede843224998cbb28f895b6f26828583770d /drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
parent8de190c9f44204810440e26ac09913a1fa40aa36 (diff)
drm/amdgpu: add a fence timeout for the IB tests v2
10ms should be enough for now. v2: fix some typos in CIK code Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Chunming Zhou <david1.zhou@amd.com> Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
index 6b49d406daf6..0afa73c82a9f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
@@ -844,10 +844,10 @@ int amdgpu_vce_ring_test_ring(struct amdgpu_ring *ring)
844 * @ring: the engine to test on 844 * @ring: the engine to test on
845 * 845 *
846 */ 846 */
847int amdgpu_vce_ring_test_ib(struct amdgpu_ring *ring) 847int amdgpu_vce_ring_test_ib(struct amdgpu_ring *ring, long timeout)
848{ 848{
849 struct fence *fence = NULL; 849 struct fence *fence = NULL;
850 int r; 850 long r;
851 851
852 /* skip vce ring1 ib test for now, since it's not reliable */ 852 /* skip vce ring1 ib test for now, since it's not reliable */
853 if (ring == &ring->adev->vce.ring[1]) 853 if (ring == &ring->adev->vce.ring[1])
@@ -855,21 +855,25 @@ int amdgpu_vce_ring_test_ib(struct amdgpu_ring *ring)
855 855
856 r = amdgpu_vce_get_create_msg(ring, 1, NULL); 856 r = amdgpu_vce_get_create_msg(ring, 1, NULL);
857 if (r) { 857 if (r) {
858 DRM_ERROR("amdgpu: failed to get create msg (%d).\n", r); 858 DRM_ERROR("amdgpu: failed to get create msg (%ld).\n", r);
859 goto error; 859 goto error;
860 } 860 }
861 861
862 r = amdgpu_vce_get_destroy_msg(ring, 1, true, &fence); 862 r = amdgpu_vce_get_destroy_msg(ring, 1, true, &fence);
863 if (r) { 863 if (r) {
864 DRM_ERROR("amdgpu: failed to get destroy ib (%d).\n", r); 864 DRM_ERROR("amdgpu: failed to get destroy ib (%ld).\n", r);
865 goto error; 865 goto error;
866 } 866 }
867 867
868 r = fence_wait(fence, false); 868 r = fence_wait_timeout(fence, false, timeout);
869 if (r) { 869 if (r == 0) {
870 DRM_ERROR("amdgpu: fence wait failed (%d).\n", r); 870 DRM_ERROR("amdgpu: IB test timed out.\n");
871 r = -ETIMEDOUT;
872 } else if (r < 0) {
873 DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r);
871 } else { 874 } else {
872 DRM_INFO("ib test on ring %d succeeded\n", ring->idx); 875 DRM_INFO("ib test on ring %d succeeded\n", ring->idx);
876 r = 0;
873 } 877 }
874error: 878error:
875 fence_put(fence); 879 fence_put(fence);