[PATCH 2/3] drm/amdgpu/uvd:Allocate enc session bo for uvd6.0 ring IB test

Zhu, James James.Zhu at amd.com
Tue Oct 15 22:08:08 UTC 2019


Allocate 256K enc session bo for uvd6.0 ring IB test to fix S3 resume
corruption issue.

Signed-off-by: James Zhu <James.Zhu at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
index 670784a..c79ce73 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
@@ -220,7 +220,7 @@ static int uvd_v6_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle
 		return r;
 
 	ib = &job->ibs[0];
-	dummy = ib->gpu_addr + 1024;
+	dummy = ring->adev->vcn.enc_session_gpu_addr;
 
 	ib->length_dw = 0;
 	ib->ptr[ib->length_dw++] = 0x00000018;
@@ -282,7 +282,7 @@ static int uvd_v6_0_enc_get_destroy_msg(struct amdgpu_ring *ring,
 		return r;
 
 	ib = &job->ibs[0];
-	dummy = ib->gpu_addr + 1024;
+	dummy = ring->adev->vcn.enc_session_gpu_addr + 128 * PAGE_SIZE;
 
 	ib->length_dw = 0;
 	ib->ptr[ib->length_dw++] = 0x00000018;
@@ -326,9 +326,16 @@ static int uvd_v6_0_enc_get_destroy_msg(struct amdgpu_ring *ring,
  */
 static int uvd_v6_0_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout)
 {
+	struct amdgpu_device *adev = ring->adev;
 	struct dma_fence *fence = NULL;
 	long r;
 
+	r = amdgpu_bo_create_kernel(adev, 2 * 128, PAGE_SIZE,
+			AMDGPU_GEM_DOMAIN_VRAM, &adev->vcn.enc_session_bo,
+			&adev->vcn.enc_session_gpu_addr, &adev->vcn.enc_session_cpu_addr);
+	if (r)
+		return r;
+
 	r = uvd_v6_0_enc_get_create_msg(ring, 1, NULL);
 	if (r)
 		goto error;
@@ -345,6 +352,11 @@ static int uvd_v6_0_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout)
 
 error:
 	dma_fence_put(fence);
+
+	amdgpu_bo_free_kernel(&adev->vcn.enc_session_bo,
+				  &adev->vcn.enc_session_gpu_addr,
+				  (void **)&adev->vcn.enc_session_cpu_addr);
+
 	return r;
 }
 
-- 
2.7.4



More information about the amd-gfx mailing list