[PATCH 3/3] drm/amdgpu/uvd:Allocate enc session bo for uvd7.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_v7_0.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
index 01f658f..1b17fc9 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
@@ -228,7 +228,7 @@ static int uvd_v7_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;
@@ -289,7 +289,7 @@ static int uvd_v7_0_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handl
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;
@@ -333,9 +333,16 @@ static int uvd_v7_0_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handl
*/
static int uvd_v7_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_v7_0_enc_get_create_msg(ring, 1, NULL);
if (r)
goto error;
@@ -352,6 +359,11 @@ static int uvd_v7_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