dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Wentland, Harry" <Harry.Wentland@amd.com>
To: Mario Kleiner <mario.kleiner.de@gmail.com>,
	"Kazlauskas, Nicholas" <Nicholas.Kazlauskas@amd.com>
Cc: "dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 3/4] drm/amd/display: In VRR mode, do DRM core vblank handling at end of vblank.
Date: Thu, 21 Mar 2019 15:38:39 +0000	[thread overview]
Message-ID: <929bad72-fb12-661e-d7e3-ac837d32c01c@amd.com> (raw)
In-Reply-To: <CAEsyxyhFfkZ-bB1hUW659By4Jc3oUomFY30pjpehq=4F3Uum5w@mail.gmail.com>



On 2019-03-21 5:39 a.m., Mario Kleiner wrote:
> On Wed, Mar 20, 2019 at 1:53 PM Kazlauskas, Nicholas
> <Nicholas.Kazlauskas@amd.com> wrote:
>>
>> On 3/20/19 3:51 AM, Mario Kleiner wrote:
>>> Ok, fixed all the style issues and ran checkpatch over the patches. Thanks.
>>>
>>> On Tue, Mar 19, 2019 at 2:32 PM Kazlauskas, Nicholas
>>> <Nicholas.Kazlauskas@amd.com> wrote:
>>>>
>>>> On 3/19/19 9:23 AM, Kazlauskas, Nicholas wrote:
>>>>> On 3/18/19 1:19 PM, Mario Kleiner wrote:

...snip...

>>>>>> diff --git a/drivers/gpu/drm/amd/display/dc/irq/dcn10/irq_service_dcn10.c b/drivers/gpu/drm/amd/display/dc/irq/dcn10/irq_service_dcn10.c
>>>>>> index e04ae49..10ac6de 100644
>>>>>> --- a/drivers/gpu/drm/amd/display/dc/irq/dcn10/irq_service_dcn10.c
>>>>>> +++ b/drivers/gpu/drm/amd/display/dc/irq/dcn10/irq_service_dcn10.c
>>>>>> @@ -56,6 +56,18 @@ enum dc_irq_source to_dal_irq_source_dcn10(
>>>>>>               return DC_IRQ_SOURCE_VBLANK5;
>>>>>>       case DCN_1_0__SRCID__DC_D6_OTG_VSTARTUP:
>>>>>>               return DC_IRQ_SOURCE_VBLANK6;
>>>>>> +    case DCN_1_0__SRCID__OTG0_IHC_V_UPDATE_NO_LOCK_INTERRUPT:
>>>>>> +            return DC_IRQ_SOURCE_VUPDATE1;
>>>>>> +    case DCN_1_0__SRCID__OTG1_IHC_V_UPDATE_NO_LOCK_INTERRUPT:
>>>>>> +            return DC_IRQ_SOURCE_VUPDATE2;
>>>>>> +    case DCN_1_0__SRCID__OTG2_IHC_V_UPDATE_NO_LOCK_INTERRUPT:
>>>>>> +            return DC_IRQ_SOURCE_VUPDATE3;
>>>>>> +    case DCN_1_0__SRCID__OTG3_IHC_V_UPDATE_NO_LOCK_INTERRUPT:
>>>>>> +            return DC_IRQ_SOURCE_VUPDATE4;
>>>>>> +    case DCN_1_0__SRCID__OTG4_IHC_V_UPDATE_NO_LOCK_INTERRUPT:
>>>>>> +            return DC_IRQ_SOURCE_VUPDATE5;
>>>>>> +    case DCN_1_0__SRCID__OTG5_IHC_V_UPDATE_NO_LOCK_INTERRUPT:
>>>>>> +            return DC_IRQ_SOURCE_VUPDATE6;
>>>>
>>>> I'm not sure we necessarily want to reuse the same
>>>> DC_IRQ_SOURCE_VUPDATE1...6 definitions here again when it's really
>>>> V_UPDATE_NO_LOCK.
>>>>
>>>
>>> Hm. The problem is that if we use different ones for DCE and DCN we
>>> need special-case handling in amdgpu_dm.c, e.g., in
>>> amdgpu_dm_set_vupdate_irq_state() and dm_set_vupdate_irq() to detect
>>> if it is caling DCE or DCN (how to detect this?) to select different
>>> irq sources IRQ_TYPE_VUPDATE vs IRQ_TYPE_VUPDATE_NO_LOCK and such?
>>> And definitions like "struct amdgpu_irq_src vupdate_irq;" should then
>>> also exist twice as vupdate_irq and vupdate_irq_no_lock for correct
>>> naming?
>>>
>>> Or we'd name the IRQ source and all relevant data structures and
>>> functions something like DC_IRQ_SOURCE_VBLANK_END1..6 to describe what
>>> it signals instead of to what it corresponds in hardware? That would
>>> be what was done with the regular DC_IRQ_SOURCE_VBLANK1..6. It signals
>>> start of vblank, but the underlying hw interrupts are actually a
>>> properly programmed VLINE0 irq on DCE and a VSTARTUP irq on DCN.
>>
>>
>> Ah, I see what you mean. Maybe this is for the better to share the same
>> names then. I'll defer this to Harry.
>>

I'd tend to agree with Mario. I think it's best to keep the same semantic for VUPDATE.

The regular VUPDATE has some interaction with the master lock. I imagine we want something that fires independently of it, which looks to be the _NO_LOCK version.

That said, both VSTARTUP and VUPDATE can occur before VSYNC on DCN. With most timings this probably won't occur but if our back porch is really small we'd see that happening. If we need to guarantee that this interrupt occurs no sooner than vline 0 we will need to register a vline IRQ.

As for VSTARTUP and VUPDATE, VSTARTUP is the IRQ that has an impact on the behavior of render clients as it's the deadline for frame submissions. After VSTARTUP any new framebuffer address update is postponed to the next frame (unless we do immediate flip).

So for now VUPDATE_NO_LOCK is probably fine and will improve our situation except for VRR displays with a really short back porch. Not sure those even exist.

>>>
>>> Of course this all assumes we need to use the NO_LOCK variant on DCN?
>>> We haven't tested what the regular VUPDATE_IRQ does, because i don't
>>> have a suitable test machine, and my use of the NO_LOCK variant was
>>> just based on my interpretation of this little comment in the DCN
>>> header file:
>>>
>>> #define DCN_1_0__SRCID__OTG0_IHC_V_UPDATE_NO_LOCK_INTERRUPT 0x57 //
>>> "OTG0 VUPDATE event without lock interrupt, VUPDATE is update event
>>> for double buffered registers"
>>>
>>> and the absence of any explanatory comment in the define of regular V_UPDATE:
>>>
>>> #define DCN_1_0__SRCID__DC_D1_OTG_V_UPDATE 0x18 // D1 : OTG V_update
>>> OTG1_IHC_V_UPDATE_INTERRUPT
>>>
>>> I assumed the NO_LOCK means not affected by the state of any of the hw
>>> locks, so regular V_UPDATE might be affected by them. You agreed with
>>> that, but we never tested what regular V_UPDATE would do on DCN. Do we
>>> actually know for sure from hw specs that it would not work, ie. not
>>> unconditionally fire the IRQ at every end of VBLANK, as we need?
>>
>> FWIW, I did try your original patches with V_UPDATE. I don't know off
>> the top of my head what specifically V_UPDATE does that V_UPDATE_NO_LOCK
>> doesn't, but at the very least the HW won't be flipping anything to the
>> screen if you're using the former. You'll end up with a static screen
>> that looks like a system hang.
>>
> 
> Yes, but that was because that iteration of the patch had a bug, where
> i defined the irq sources / irq hw sources as _NO_LOCK variants as i
> intended, but forgot to adapt the irq en/disable register macros. You
> fixed my bug during your testing and so we know the _NO_LOCK variant
> works perfectly for our purpose. But we never tesed if the standard
> variant would have worked just as well.
> 
> I will test this later today, because since today i'm the proud owner
> of a PC with Ryzen 5 2400G with Vega11 Raven / DCN-1.0 :). So i'll
> give it a try. Would be good though if you could have a look at the
> hardware docs i assume you have internally to verify what the V_UPDATE
> irq hw source actually does?
> 

I couldn't find much regarding the _NO_LOCK part in the HW docs, unfortunately. The other stuff is in my blurb up top.

I think this change is fine. With the comments from Nick and Paul addressed this is
Acked-by: Harry Wentland <harry.wentland@amd.com>

I recommend trying the VLINE IRQ, though. Nick can you create a task for us to look into that?

Harry

> -mario
> 
>> Nicholas Kazlauskas
>>
>>>
>>>
>>>>>>       case DCN_1_0__SRCID__HUBP0_FLIP_INTERRUPT:
>>>>>>               return DC_IRQ_SOURCE_PFLIP1;
>>>>>>       case DCN_1_0__SRCID__HUBP1_FLIP_INTERRUPT:
>>>>>> @@ -153,6 +165,11 @@ static const struct irq_source_info_funcs vblank_irq_info_funcs = {
>>>>>>       .ack = NULL
>>>>>>     };
>>>>>>
>>>>>> +static const struct irq_source_info_funcs vupdate_no_lock_irq_info_funcs = {
>>>>>> +    .set = NULL,
>>>>>> +    .ack = NULL
>>>>>> +};
>>>>>> +
>>>>>>     #define BASE_INNER(seg) \
>>>>>>       DCE_BASE__INST0_SEG ## seg
>>>>>>
>>>>>> @@ -203,12 +220,15 @@ static const struct irq_source_info_funcs vblank_irq_info_funcs = {
>>>>>>               .funcs = &pflip_irq_info_funcs\
>>>>>>       }
>>>>>>
>>>>>> -#define vupdate_int_entry(reg_num)\
>>>>>> +/* vupdate_no_lock_int_entry maps to DC_IRQ_SOURCE_VUPDATEx, to match semantic
>>>>>> + * of DCE's DC_IRQ_SOURCE_VUPDATEx.
>>>>>> + */
>>>>>> +#define vupdate_no_lock_int_entry(reg_num)\
>>>>>>       [DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
>>>>>>               IRQ_REG_ENTRY(OTG, reg_num,\
>>>>>> -                    OTG_GLOBAL_SYNC_STATUS, VUPDATE_INT_EN,\
>>>>>> -                    OTG_GLOBAL_SYNC_STATUS, VUPDATE_EVENT_CLEAR),\
>>>>>> -            .funcs = &vblank_irq_info_funcs\
>>>>>> +                    OTG_GLOBAL_SYNC_STATUS, VUPDATE_NO_LOCK_INT_EN,\
>>>>>> +                    OTG_GLOBAL_SYNC_STATUS, VUPDATE_NO_LOCK_EVENT_CLEAR),\
>>>>>> +            .funcs = &vupdate_no_lock_irq_info_funcs\
>>>>>>       }
>>>>>>
>>>>>>     #define vblank_int_entry(reg_num)\
>>>>>> @@ -315,12 +335,12 @@ irq_source_info_dcn10[DAL_IRQ_SOURCES_NUMBER] = {
>>>>>>       dc_underflow_int_entry(6),
>>>>>>       [DC_IRQ_SOURCE_DMCU_SCP] = dummy_irq_entry(),
>>>>>>       [DC_IRQ_SOURCE_VBIOS_SW] = dummy_irq_entry(),
>>>>>> -    vupdate_int_entry(0),
>>>>>> -    vupdate_int_entry(1),
>>>>>> -    vupdate_int_entry(2),
>>>>>> -    vupdate_int_entry(3),
>>>>>> -    vupdate_int_entry(4),
>>>>>> -    vupdate_int_entry(5),
>>>>
>>>> I don't think we should be necessarily dropping these, but I guess it
>>>> could go either way since these IRQs technically aren't defined.
>>>>
>>>
>>> We could keep both definitions around, original vupdate_int_entry +
>>> the new vupdate_no_lock_int_entry.
>>>
>>> -mario
>>>
>>>>>> +    vupdate_no_lock_int_entry(0),
>>>>>> +    vupdate_no_lock_int_entry(1),
>>>>>> +    vupdate_no_lock_int_entry(2),
>>>>>> +    vupdate_no_lock_int_entry(3),
>>>>>> +    vupdate_no_lock_int_entry(4),
>>>>>> +    vupdate_no_lock_int_entry(5),
>>>>>>       vblank_int_entry(0),
>>>>>>       vblank_int_entry(1),
>>>>>>       vblank_int_entry(2),
>>>>>>
>>>>>
>>>>> Nicholas Kazlauskas
>>>>> _______________________________________________
>>>>> amd-gfx mailing list
>>>>> amd-gfx@lists.freedesktop.org
>>>>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>>>>>
>>>>
>>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2019-03-21 15:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-18 17:19 AMD Freesync patches for proper vblank and pageflip timestamping in VRR mode Mario Kleiner
2019-03-18 17:19 ` [PATCH 1/4] drm/amd/display: Prevent vblank irq disable while VRR is active Mario Kleiner
     [not found]   ` <20190318171952.24302-2-mario.kleiner.de-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-03-18 17:29     ` Kazlauskas, Nicholas
2019-03-20  8:14       ` Mario Kleiner
     [not found] ` <20190318171952.24302-1-mario.kleiner.de-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-03-18 17:19   ` [PATCH 2/4] drm/amd/display: Rework vrr flip throttling for late vblank irq Mario Kleiner
2019-03-18 17:59     ` Kazlauskas, Nicholas
2019-03-18 17:19   ` [PATCH 4/4] drm/amd/display: Make pageflip event delivery compatible with VRR Mario Kleiner
     [not found]     ` <20190318171952.24302-5-mario.kleiner.de-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-03-19 13:05       ` Kazlauskas, Nicholas
2019-03-18 17:19 ` [PATCH 3/4] drm/amd/display: In VRR mode, do DRM core vblank handling at end of vblank Mario Kleiner
     [not found]   ` <20190318171952.24302-4-mario.kleiner.de-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-03-19  7:17     ` Paul Menzel
2019-03-19 13:23     ` Kazlauskas, Nicholas
     [not found]       ` <8ef78169-1893-0aee-9cb1-cce4054ebbcc-5C7GfCeVMHo@public.gmane.org>
2019-03-19 13:32         ` Kazlauskas, Nicholas
2019-03-20  7:51           ` Mario Kleiner
2019-03-20 12:53             ` Kazlauskas, Nicholas
     [not found]               ` <b00cc1c5-f710-6c75-cdd2-c9ad30c633aa-5C7GfCeVMHo@public.gmane.org>
2019-03-21  9:39                 ` Mario Kleiner
2019-03-21 15:38                   ` Wentland, Harry [this message]
     [not found]                     ` <929bad72-fb12-661e-d7e3-ac837d32c01c-5C7GfCeVMHo@public.gmane.org>
2019-03-21 15:48                       ` Kazlauskas, Nicholas

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=929bad72-fb12-661e-d7e3-ac837d32c01c@amd.com \
    --to=harry.wentland@amd.com \
    --cc=Nicholas.Kazlauskas@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=mario.kleiner.de@gmail.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;
as well as URLs for NNTP newsgroup(s).