[PATCH 07/17] drm/amdgpu: add jpeg enc sw and hw init

boyuan.zhang at amd.com boyuan.zhang at amd.com
Thu Jul 4 16:04:19 UTC 2019


From: Boyuan Zhang <boyuan.zhang at amd.com>

Add software and hardware init for jpeg encode ring.

Signed-off-by: Boyuan Zhang <boyuan.zhang at amd.com>
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
index 767f8ce92875..cb77554cc692 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
@@ -219,6 +219,14 @@ static int vcn_v2_0_sw_init(void *handle)
 	adev->vcn.internal.jpeg_pitch = mmUVD_JPEG_PITCH_INTERNAL_OFFSET;
 	adev->vcn.external.jpeg_pitch = SOC15_REG_OFFSET(UVD, 0, mmUVD_JPEG_PITCH);
 
+	ring = &adev->vcn.ring_jpeg_enc;
+	ring->use_doorbell = true;
+	ring->doorbell_index = (adev->doorbell_index.vcn.vcn_ring0_1 << 1) + 7;
+	sprintf(ring->name, "vcn_jpeg_enc");
+	r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.irq, 0);
+	if (r)
+		return r;
+
 	return 0;
 }
 
@@ -284,6 +292,14 @@ static int vcn_v2_0_hw_init(void *handle)
 		goto done;
 	}
 
+	ring = &adev->vcn.ring_jpeg_enc;
+	ring->sched.ready = true;
+	r = amdgpu_ring_test_ring(ring);
+	if (r) {
+		ring->sched.ready = false;
+		goto done;
+	}
+
 done:
 	if (!r)
 		DRM_INFO("VCN decode and encode initialized successfully.\n");
-- 
2.17.1



More information about the amd-gfx mailing list