From: Leo Liu Date: Tue, 21 Feb 2017 15:38:42 +0000 (-0500) Subject: drm/amdgpu: enable vcn encode ring tests X-Git-Tag: v5.15~10870^2~24^2~196 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c3bd304009dee48adbb2b6937b7f4a07c5e4e281;p=platform%2Fkernel%2Flinux-starfive.git drm/amdgpu: enable vcn encode ring tests Wire up the callback and enable them. Signed-off-by: Leo Liu Reviewed-by: Christian König Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c index 91050ca..18fd565 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c @@ -497,7 +497,7 @@ int amdgpu_vcn_enc_ring_test_ring(struct amdgpu_ring *ring) ring->idx, r); return r; } - amdgpu_ring_write(ring, VCE_CMD_END); + amdgpu_ring_write(ring, VCN_ENC_CMD_END); amdgpu_ring_commit(ring); for (i = 0; i < adev->usec_timeout; i++) { diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c index f09d2ae..4ddaec3 100644 --- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c @@ -144,7 +144,7 @@ static int vcn_v1_0_hw_init(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct amdgpu_ring *ring = &adev->vcn.ring_dec; - int r; + int i, r; r = vcn_v1_0_start(adev); if (r) @@ -157,9 +157,19 @@ static int vcn_v1_0_hw_init(void *handle) goto done; } + for (i = 0; i < adev->vcn.num_enc_rings; ++i) { + ring = &adev->vcn.ring_enc[i]; + ring->ready = true; + r = amdgpu_ring_test_ring(ring); + if (r) { + ring->ready = false; + goto done; + } + } + done: if (!r) - DRM_INFO("VCN decode initialized successfully.\n"); + DRM_INFO("VCN decode and encode initialized successfully.\n"); return r; } @@ -930,6 +940,7 @@ static const struct amdgpu_ring_funcs vcn_v1_0_enc_ring_vm_funcs = { .emit_ib = vcn_v1_0_enc_ring_emit_ib, .emit_fence = vcn_v1_0_enc_ring_emit_fence, .emit_vm_flush = vcn_v1_0_enc_ring_emit_vm_flush, + .test_ring = amdgpu_vcn_enc_ring_test_ring, .insert_nop = amdgpu_ring_insert_nop, .insert_end = vcn_v1_0_enc_ring_insert_end, .pad_ib = amdgpu_ring_generic_pad_ib,