AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Koenig, Christian" <Christian.Koenig-5C7GfCeVMHo@public.gmane.org>
To: "S, Shirish" <Shirish.S-5C7GfCeVMHo@public.gmane.org>,
	Alex Deucher
	<alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "Deucher,
	Alexander" <Alexander.Deucher-5C7GfCeVMHo@public.gmane.org>,
	"Deng, Emily" <Emily.Deng-5C7GfCeVMHo@public.gmane.org>,
	"Liu, Leo" <Leo.Liu-5C7GfCeVMHo@public.gmane.org>,
	"amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
	"Li,
	Ching-shih (Louis)" <Ching-shih.Li-5C7GfCeVMHo@public.gmane.org>
Subject: Re: [PATCH] drm/amdgpu/{uvd,vcn}: fetch ring's read_ptr after alloc
Date: Wed, 5 Jun 2019 11:16:33 +0000	[thread overview]
Message-ID: <9bc59436-8a5d-be74-9f53-97ef17955599@amd.com> (raw)
In-Reply-To: <1f3e3699-31ff-1806-97ea-cc8273d0380c-5C7GfCeVMHo@public.gmane.org>

Am 05.06.19 um 03:35 schrieb S, Shirish:
> Hi Alex,
>
> On 6/4/2019 9:43 PM, Alex Deucher wrote:
>> On Tue, Jun 4, 2019 at 12:07 PM S, Shirish <Shirish.S@amd.com> wrote:
>>> [What]
>>> readptr read always returns zero, since most likely
>>> UVD block is either power or clock gated.
>>>
>>> [How]
>>> fetch rptr after amdgpu_ring_alloc() which informs
>>> the power management code that the block is about to be
>>> used and hence the gating is turned off.
>>>
>>> Signed-off-by: Louis Li <Ching-shih.Li@amd.com>
>>> Signed-off-by: Shirish S <shirish.s@amd.com>
>>> ---
>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 4 +++-
>>>    drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c   | 5 ++++-
>>>    drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c   | 5 ++++-
>> What about uvd 4.2, 5.0 and VCE 2.0, 3.0, 4.0?
> amdgpu_vce_ring_test_ring() is the common function for VCE 2.0, 3.0 & 4.0
> and patch that fixes it, is already reviewed.
>
> UVD 4.2 & 5.0  use mmUVD_CONTEXT_ID instead of readptr,
> so i beleive this fix is not applicable for them.

Yeah, agree that should actually work fine for those.

This patch is Reviewed-by: Christian König <christian.koenig@amd.com>

Regards,
Christian.

> Regards,
> Shirish S
>> Alex
>>
>>>    3 files changed, 11 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
>>> index 118451f..d786098 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
>>> @@ -468,7 +468,7 @@ int amdgpu_vcn_dec_ring_test_ib(struct amdgpu_ring *ring, long timeout)
>>>    int amdgpu_vcn_enc_ring_test_ring(struct amdgpu_ring *ring)
>>>    {
>>>           struct amdgpu_device *adev = ring->adev;
>>> -       uint32_t rptr = amdgpu_ring_get_rptr(ring);
>>> +       uint32_t rptr;
>>>           unsigned i;
>>>           int r;
>>>
>>> @@ -476,6 +476,8 @@ int amdgpu_vcn_enc_ring_test_ring(struct amdgpu_ring *ring)
>>>           if (r)
>>>                   return r;
>>>
>>> +       rptr = amdgpu_ring_get_rptr(ring);
>>> +
>>>           amdgpu_ring_write(ring, VCN_ENC_CMD_END);
>>>           amdgpu_ring_commit(ring);
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
>>> index c61a314..16682b7 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
>>> @@ -170,13 +170,16 @@ static void uvd_v6_0_enc_ring_set_wptr(struct amdgpu_ring *ring)
>>>    static int uvd_v6_0_enc_ring_test_ring(struct amdgpu_ring *ring)
>>>    {
>>>           struct amdgpu_device *adev = ring->adev;
>>> -       uint32_t rptr = amdgpu_ring_get_rptr(ring);
>>> +       uint32_t rptr;
>>>           unsigned i;
>>>           int r;
>>>
>>>           r = amdgpu_ring_alloc(ring, 16);
>>>           if (r)
>>>                   return r;
>>> +
>>> +       rptr = amdgpu_ring_get_rptr(ring);
>>> +
>>>           amdgpu_ring_write(ring, HEVC_ENC_CMD_END);
>>>           amdgpu_ring_commit(ring);
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
>>> index cdb96d4..74811b2 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
>>> @@ -175,7 +175,7 @@ static void uvd_v7_0_enc_ring_set_wptr(struct amdgpu_ring *ring)
>>>    static int uvd_v7_0_enc_ring_test_ring(struct amdgpu_ring *ring)
>>>    {
>>>           struct amdgpu_device *adev = ring->adev;
>>> -       uint32_t rptr = amdgpu_ring_get_rptr(ring);
>>> +       uint32_t rptr;
>>>           unsigned i;
>>>           int r;
>>>
>>> @@ -185,6 +185,9 @@ static int uvd_v7_0_enc_ring_test_ring(struct amdgpu_ring *ring)
>>>           r = amdgpu_ring_alloc(ring, 16);
>>>           if (r)
>>>                   return r;
>>> +
>>> +       rptr = amdgpu_ring_get_rptr(ring);
>>> +
>>>           amdgpu_ring_write(ring, HEVC_ENC_CMD_END);
>>>           amdgpu_ring_commit(ring);
>>>
>>> --
>>> 2.7.4
>>>
>>> _______________________________________________
>>> amd-gfx mailing list
>>> amd-gfx@lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

      parent reply	other threads:[~2019-06-05 11:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-04 16:07 [PATCH] drm/amdgpu/{uvd,vcn}: fetch ring's read_ptr after alloc S, Shirish
     [not found] ` <1559664412-5512-1-git-send-email-shirish.s-5C7GfCeVMHo@public.gmane.org>
2019-06-04 16:13   ` Alex Deucher
     [not found]     ` <CADnq5_O2aB+5-tGSxo_ObqEGnCdgDEXyd99nnop6sDO2sKVVrw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-06-05  1:35       ` S, Shirish
     [not found]         ` <1f3e3699-31ff-1806-97ea-cc8273d0380c-5C7GfCeVMHo@public.gmane.org>
2019-06-05 11:16           ` Koenig, Christian [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=9bc59436-8a5d-be74-9f53-97ef17955599@amd.com \
    --to=christian.koenig-5c7gfcevmho@public.gmane.org \
    --cc=Alexander.Deucher-5C7GfCeVMHo@public.gmane.org \
    --cc=Ching-shih.Li-5C7GfCeVMHo@public.gmane.org \
    --cc=Emily.Deng-5C7GfCeVMHo@public.gmane.org \
    --cc=Leo.Liu-5C7GfCeVMHo@public.gmane.org \
    --cc=Shirish.S-5C7GfCeVMHo@public.gmane.org \
    --cc=alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@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