[PATCH 11/17] drm/amdgpu: add vcn jpeg enc ring test
boyuan.zhang at amd.com
boyuan.zhang at amd.com
Thu Jul 4 16:04:23 UTC 2019
From: Boyuan Zhang <boyuan.zhang at amd.com>
Add a ring test for jpeg encode.
Signed-off-by: Boyuan Zhang <boyuan.zhang at amd.com>
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 29 +++++++++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 2 ++
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c | 2 +-
3 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
index f9af465a00e0..15687cbb798b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
@@ -854,3 +854,32 @@ int amdgpu_vcn_jpeg_ring_test_ib(struct amdgpu_ring *ring, long timeout)
error:
return r;
}
+
+int amdgpu_vcn_jpeg_enc_ring_test_ring(struct amdgpu_ring *ring)
+{
+ struct amdgpu_device *adev = ring->adev;
+ uint32_t tmp = 0;
+ unsigned i;
+ int r;
+
+ WREG32(adev->vcn.external.jpeg_enc_scratch0, 0xCAFEDEAD);
+ r = amdgpu_ring_alloc(ring, 3);
+ if (r)
+ return r;
+
+ amdgpu_ring_write(ring, PACKET0(adev->vcn.internal.jpeg_enc_scratch0, 0));
+ amdgpu_ring_write(ring, 0xDEADBEEF);
+ amdgpu_ring_commit(ring);
+
+ for (i = 0; i < adev->usec_timeout; i++) {
+ tmp = RREG32(adev->vcn.external.jpeg_enc_scratch0);
+ if (tmp == 0xDEADBEEF)
+ break;
+ DRM_UDELAY(1);
+ }
+
+ if (i >= adev->usec_timeout)
+ r = -ETIMEDOUT;
+
+ return r;
+}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
index 8b344d6a1aca..528d9d3fa91c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
@@ -112,4 +112,6 @@ int amdgpu_vcn_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout);
int amdgpu_vcn_jpeg_ring_test_ring(struct amdgpu_ring *ring);
int amdgpu_vcn_jpeg_ring_test_ib(struct amdgpu_ring *ring, long timeout);
+int amdgpu_vcn_jpeg_enc_ring_test_ring(struct amdgpu_ring *ring);
+
#endif
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
index 5dab17e422c3..abd708e0e304 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
@@ -2192,7 +2192,7 @@ static const struct amdgpu_ring_funcs vcn_v2_0_jpeg_enc_ring_vm_funcs = {
.emit_ib = vcn_v2_0_jpeg_enc_ring_emit_ib,
.emit_fence = vcn_v2_0_jpeg_enc_ring_emit_fence,
.emit_vm_flush = vcn_v2_0_jpeg_enc_ring_emit_vm_flush,
- //.test_ring
+ .test_ring = amdgpu_vcn_jpeg_enc_ring_test_ring,
//.test_ib
.insert_nop = vcn_v2_0_jpeg_enc_ring_nop,
.insert_start = vcn_v2_0_jpeg_enc_ring_insert_start,
--
2.17.1
More information about the amd-gfx
mailing list