drm/amdgpu/vcn: use amdgpu_ring_test_helper
authorLeo Liu <leo.liu@amd.com>
Tue, 1 Oct 2019 22:08:46 +0000 (18:08 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 4 Oct 2019 13:52:53 +0000 (08:52 -0500)
Instead of amdgpu_ring_test_ring, so the helper function determines
whether the ring is ready

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
Acked-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Cc: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c

index 93b3500..b4f84a8 100644 (file)
@@ -202,7 +202,6 @@ static int vcn_v1_0_hw_init(void *handle)
 
        for (i = 0; i < adev->vcn.num_enc_rings; ++i) {
                ring = &adev->vcn.inst->ring_enc[i];
-               ring->sched.ready = true;
                r = amdgpu_ring_test_helper(ring);
                if (r)
                        goto done;
index 4628fd1..38f787a 100644 (file)
@@ -247,30 +247,21 @@ static int vcn_v2_0_hw_init(void *handle)
        adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell,
                                             ring->doorbell_index, 0);
 
-       ring->sched.ready = true;
-       r = amdgpu_ring_test_ring(ring);
-       if (r) {
-               ring->sched.ready = false;
+       r = amdgpu_ring_test_helper(ring);
+       if (r)
                goto done;
-       }
 
        for (i = 0; i < adev->vcn.num_enc_rings; ++i) {
                ring = &adev->vcn.inst->ring_enc[i];
-               ring->sched.ready = true;
-               r = amdgpu_ring_test_ring(ring);
-               if (r) {
-                       ring->sched.ready = false;
+               r = amdgpu_ring_test_helper(ring);
+               if (r)
                        goto done;
-               }
        }
 
        ring = &adev->vcn.inst->ring_jpeg;
-       ring->sched.ready = true;
-       r = amdgpu_ring_test_ring(ring);
-       if (r) {
-               ring->sched.ready = false;
+       r = amdgpu_ring_test_helper(ring);
+       if (r)
                goto done;
-       }
 
 done:
        if (!r)
index bf8626e..cc19444 100644 (file)
@@ -258,29 +258,23 @@ static int vcn_v2_5_hw_init(void *handle)
                adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell,
                                                     ring->doorbell_index, j);
 
-               r = amdgpu_ring_test_ring(ring);
-               if (r) {
-                       ring->sched.ready = false;
+               r = amdgpu_ring_test_helper(ring);
+               if (r)
                        goto done;
-               }
 
                for (i = 0; i < adev->vcn.num_enc_rings; ++i) {
                        ring = &adev->vcn.inst[j].ring_enc[i];
                        ring->sched.ready = false;
                        continue;
-                       r = amdgpu_ring_test_ring(ring);
-                       if (r) {
-                               ring->sched.ready = false;
+                       r = amdgpu_ring_test_helper(ring);
+                       if (r)
                                goto done;
-                       }
                }
 
                ring = &adev->vcn.inst[j].ring_jpeg;
-               r = amdgpu_ring_test_ring(ring);
-               if (r) {
-                       ring->sched.ready = false;
+               r = amdgpu_ring_test_helper(ring);
+               if (r)
                        goto done;
-               }
        }
 done:
        if (!r)