AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: "Zhu, James" <James.Zhu-5C7GfCeVMHo@public.gmane.org>,
	"amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH 3/3] drm/amdgpu/uvd:Allocate enc session bo for uvd7.0 ring IB test
Date: Wed, 16 Oct 2019 11:01:16 +0200	[thread overview]
Message-ID: <1e95326e-3015-3a47-99c1-e44c826171db@gmail.com> (raw)
In-Reply-To: <1571177279-9435-4-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org>

Am 16.10.19 um 00:08 schrieb Zhu, James:
> Allocate 256K enc session bo for uvd6.0 ring IB test to fix S3 resume
> corruption issue.
>
> Signed-off-by: James Zhu <James.Zhu@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;
> +

Looks like you actually do allocate that on demand, but please don't put 
the bo and addresses into the adev->vcn structure. It is only valid 
temporary.

Regards,
Christian.

>   	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;
>   }
>   

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

      parent reply	other threads:[~2019-10-16  9:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15 22:08 [PATCH 0/3] Fixed amdgpu resume failure from suspend Zhu, James
     [not found] ` <1571177279-9435-1-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org>
2019-10-15 22:08   ` [PATCH 1/3] drm/amdgpu/uvd:Add uvd enc session bo Zhu, James
     [not found]     ` <1571177279-9435-2-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org>
2019-10-16  8:59       ` Christian König
     [not found]         ` <3198889b-9df5-dd90-0457-79a1a886ec4d-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-10-16 13:01           ` James Zhu
2019-10-15 22:08   ` [PATCH 2/3] drm/amdgpu/uvd:Allocate enc session bo for uvd6.0 ring IB test Zhu, James
     [not found]     ` <1571177279-9435-3-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org>
2019-10-15 22:32       ` Alex Deucher
2019-10-15 22:08   ` [PATCH 3/3] drm/amdgpu/uvd:Allocate enc session bo for uvd7.0 " Zhu, James
     [not found]     ` <1571177279-9435-4-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org>
2019-10-16  9:01       ` Christian König [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1e95326e-3015-3a47-99c1-e44c826171db@gmail.com \
    --to=ckoenig.leichtzumerken-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=James.Zhu-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox