[PATCH 2/3] drm/amdgpu/uvd:Allocate enc session bo for uvd6.0 ring IB test
Alex Deucher
alexdeucher at gmail.com
Tue Oct 15 22:32:45 UTC 2019
On Tue, Oct 15, 2019 at 6:08 PM Zhu, James <James.Zhu at amd.com> wrote:
>
> 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,
I just sent a similar patch set. Note that the amdgpu_bo functions
takes the size in bytes, so this is only 256 bytes (well, probably 4K
due to page alignment). I think VCN also needs this fix. Do the
create and destroy need to reference the same session info?
Alex
> + 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
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
More information about the amd-gfx
mailing list