AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lang Yu <Lang.Yu@amd.com>
To: "Christian König" <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>,
	Huang Rui <ray.huang@amd.com>,
	amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu: add workarounds for Raven VCN TMZ issue
Date: Fri, 4 Mar 2022 17:38:28 +0800	[thread overview]
Message-ID: <YiHeFIKaBk6b63gj@lang-desktop> (raw)
In-Reply-To: <6edf5bbd-e498-5979-9449-a824706532d3@amd.com>

O 03/04/ , Christian König wrote:
> Am 04.03.22 um 10:15 schrieb Lang Yu:
> > It is a hardware issue that VCN can't handle a GTT
> > backing stored TMZ buffer on Raven.
> > 
> > Move such a TMZ buffer to VRAM domain before command
> > submission.
> 
> Please don't touch the CS code with that. What you can do is to implement a
> Raven specific patch_cs_in_place callback in the vcn_v*.c file.
> 
> See amdgpu_uvd_force_into_uvd_segment() how we handle the 256MiB window on
> really old UVD blocks. You just don't need to implement the full parsing of
> the command stream (yet).

Thanks for comments and suggestions. I will have a try.

Regards,
Lang

> Regards,
> Christian.
> 
> > 
> > Signed-off-by: Lang Yu <Lang.Yu@amd.com>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 27 ++++++++++++++++++++++++++
> >   1 file changed, 27 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> > index af12256e1bd3..66345f2ce6ba 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> > @@ -393,6 +393,24 @@ void amdgpu_cs_report_moved_bytes(struct amdgpu_device *adev, u64 num_bytes,
> >   	spin_unlock(&adev->mm_stats.lock);
> >   }
> > +static int raven_vcn_tmz_quirks(struct amdgpu_cs_parser *p, struct amdgpu_bo *bo, uint32_t *domain)
> > +{
> > +	struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
> > +	struct amdgpu_ring *ring = to_amdgpu_ring(p->entity->rq->sched);
> > +
> > +	if ((adev->asic_type == CHIP_RAVEN) &&
> > +	    (bo->flags & AMDGPU_GEM_CREATE_ENCRYPTED) &&
> > +	    (ring->funcs->type == AMDGPU_HW_IP_VCN_DEC ||
> > +	    ring->funcs->type == AMDGPU_HW_IP_VCN_ENC ||
> > +	    ring->funcs->type == AMDGPU_HW_IP_VCN_JPEG)) {
> > +		if (domain)
> > +			*domain = AMDGPU_GEM_DOMAIN_VRAM;
> > +		return 1;
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> >   static int amdgpu_cs_bo_validate(void *param, struct amdgpu_bo *bo)
> >   {
> >   	struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
> > @@ -403,6 +421,7 @@ static int amdgpu_cs_bo_validate(void *param, struct amdgpu_bo *bo)
> >   		.resv = bo->tbo.base.resv
> >   	};
> >   	uint32_t domain;
> > +	bool need_retry = 1;
> >   	int r;
> >   	if (bo->tbo.pin_count)
> > @@ -431,6 +450,8 @@ static int amdgpu_cs_bo_validate(void *param, struct amdgpu_bo *bo)
> >   		domain = bo->allowed_domains;
> >   	}
> > +	raven_vcn_tmz_quirks(p, bo, &domain);
> > +
> >   retry:
> >   	amdgpu_bo_placement_from_domain(bo, domain);
> >   	r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);
> > @@ -442,6 +463,12 @@ static int amdgpu_cs_bo_validate(void *param, struct amdgpu_bo *bo)
> >   	if (unlikely(r == -ENOMEM) && domain != bo->allowed_domains) {
> >   		domain = bo->allowed_domains;
> > +		if (raven_vcn_tmz_quirks(p, bo, &domain)) {
> > +			if (need_retry)
> > +				need_retry = 0;
> > +			else
> > +				return r;
> > +		}
> >   		goto retry;
> >   	}
> 

      reply	other threads:[~2022-03-04  9:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-04  9:15 [PATCH] drm/amdgpu: add workarounds for Raven VCN TMZ issue Lang Yu
2022-03-04  9:25 ` Christian König
2022-03-04  9:38   ` Lang Yu [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=YiHeFIKaBk6b63gj@lang-desktop \
    --to=lang.yu@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=ray.huang@amd.com \
    /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