All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: "Hogander, Jouni" <jouni.hogander@intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>
Cc: "ville.syrjala@linux.intel.com" <ville.syrjala@linux.intel.com>
Subject: Re: [PATCH v2 1/2] drm/i915/display: Add own counter for Panel Replay vblank workaround
Date: Thu, 10 Oct 2024 16:22:01 +0300	[thread overview]
Message-ID: <87cyk86qkm.fsf@intel.com> (raw)
In-Reply-To: <68bae7f78e000411bf89b5a7dfb1233735451148.camel@intel.com>

On Thu, 10 Oct 2024, "Hogander, Jouni" <jouni.hogander@intel.com> wrote:
> On Wed, 2024-10-09 at 17:15 +0300, Jani Nikula wrote:
>> On Wed, 09 Oct 2024, Jouni Högander <jouni.hogander@intel.com> wrote:
>> > We are about to change meaning of vblank_enabled to fix Panel
>> > Replay vblank
>> > workaround. For sake of clarity we need to rename it.
>> > Vblank_enabled is
>> > used for i915gm/i945gm vblank irq workaround as well -> instead of
>> > rename
>> > add new counter named as vblank_wa_pipes.
>> > 
>> > v2:
>> >   - s/vblank_wa_pipes/vblank_wa_num_pipes/
>> >   - use int as a type for the counter
>> > 
>> > Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
>> > ---
>> >  drivers/gpu/drm/i915/display/intel_display_core.h | 2 ++
>> >  drivers/gpu/drm/i915/display/intel_display_irq.c  | 8 ++++----
>> >  2 files changed, 6 insertions(+), 4 deletions(-)
>> > 
>> > diff --git a/drivers/gpu/drm/i915/display/intel_display_core.h
>> > b/drivers/gpu/drm/i915/display/intel_display_core.h
>> > index 982dd9469195..45697af25fa9 100644
>> > --- a/drivers/gpu/drm/i915/display/intel_display_core.h
>> > +++ b/drivers/gpu/drm/i915/display/intel_display_core.h
>> > @@ -455,6 +455,8 @@ struct intel_display {
>> >                 /* For i915gm/i945gm vblank irq workaround */
>> >                 u8 vblank_enabled;
>> 
>> Maybe we want to rename this one too?
>
> I tried to explain it in commit message. Seems I didn't succeed in it.
>
> vblank_enabled is currently used by two workarounds:
>
> 1. i915gm/i945gm vblank irq workaround
> 2. LNL Panel Replay vblank workaround
>
> 1. and 2. are currently using vblank_enabled in a way they are
> respecting it's meaning: is vblank enabled/disabled.

Crucially, they're both using the same member, but never on the same
platform. The member is "overloaded" for two different things. (See the
otherwise unrelated series [1], it's the same thing with sb_lock.)

> It was found out that 2. as it is implemented currently doesn't work
> properly. Instead of information on vblank enabled/disabled we need to
> know if there are pipes that need the workaround.
>
> Renaming vblank_enabled wouldn't reflect how it's used in 1. This is
> why I decided to add own variable for 2. and this is what this patch is
> about: Keep vblank_enabled as it is for 1. and add own variable for 2.

My point is more generic, and it was not intended as a comment on *this*
patch. Having a "vblank_enabled" member is misleading, when it's really
just used for a very narrow case on a few platforms.

Does that make more sense?


BR,
Jani.


[1] https://lore.kernel.org/r/cover.1727890136.git.jani.nikula@intel.com

>
> BR,
>
> Jouni Högander
>  
>> 
>> BR,
>> Jani.
>> 
>> >  
>> > +               int vblank_wa_num_pipes;
>> > +
>> >                 struct work_struct vblank_dc_work;
>> >  
>> >                 u32 de_irq_mask[I915_MAX_PIPES];
>> > diff --git a/drivers/gpu/drm/i915/display/intel_display_irq.c
>> > b/drivers/gpu/drm/i915/display/intel_display_irq.c
>> > index a4367ddc7a44..8226ea218d77 100644
>> > --- a/drivers/gpu/drm/i915/display/intel_display_irq.c
>> > +++ b/drivers/gpu/drm/i915/display/intel_display_irq.c
>> > @@ -1424,7 +1424,7 @@ static void
>> > intel_display_vblank_dc_work(struct work_struct *work)
>> >         struct intel_display *display =
>> >                 container_of(work, typeof(*display),
>> > irq.vblank_dc_work);
>> >         struct drm_i915_private *i915 = to_i915(display->drm);
>> > -       u8 vblank_enabled = READ_ONCE(display->irq.vblank_enabled);
>> > +       int vblank_wa_num_pipes = READ_ONCE(display-
>> > >irq.vblank_wa_num_pipes);
>> >  
>> >         /*
>> >          * NOTE: intel_display_power_set_target_dc_state is used
>> > only by PSR
>> > @@ -1432,7 +1432,7 @@ static void
>> > intel_display_vblank_dc_work(struct work_struct *work)
>> >          * PSR code. If DC3CO is taken into use we need take that
>> > into account
>> >          * here as well.
>> >          */
>> > -       intel_display_power_set_target_dc_state(i915,
>> > vblank_enabled ? DC_STATE_DISABLE :
>> > +       intel_display_power_set_target_dc_state(i915,
>> > vblank_wa_num_pipes ? DC_STATE_DISABLE :
>> >                                                 DC_STATE_EN_UPTO_DC
>> > 6);
>> >  }
>> >  
>> > @@ -1447,7 +1447,7 @@ int bdw_enable_vblank(struct drm_crtc *_crtc)
>> >         if (gen11_dsi_configure_te(crtc, true))
>> >                 return 0;
>> >  
>> > -       if (display->irq.vblank_enabled++ == 0 && crtc-
>> > >block_dc_for_vblank)
>> > +       if (display->irq.vblank_wa_num_pipes++ == 0 && crtc-
>> > >block_dc_for_vblank)
>> >                 schedule_work(&display->irq.vblank_dc_work);
>> >  
>> >         spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
>> > @@ -1478,7 +1478,7 @@ void bdw_disable_vblank(struct drm_crtc
>> > *_crtc)
>> >         bdw_disable_pipe_irq(dev_priv, pipe, GEN8_PIPE_VBLANK);
>> >         spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
>> >  
>> > -       if (--display->irq.vblank_enabled == 0 && crtc-
>> > >block_dc_for_vblank)
>> > +       if (--display->irq.vblank_wa_num_pipes == 0 && crtc-
>> > >block_dc_for_vblank)
>> >                 schedule_work(&display->irq.vblank_dc_work);
>> >  }
>> 
>

-- 
Jani Nikula, Intel

  reply	other threads:[~2024-10-10 13:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-09 13:42 [PATCH v2 1/2] drm/i915/display: Add own counter for Panel Replay vblank workaround Jouni Högander
2024-10-09 13:42 ` [PATCH v2 2/2] drm/i915/display: Fix Panel Replay vblank enable workaround Jouni Högander
2024-10-09 14:41   ` Cavitt, Jonathan
2024-10-09 14:15 ` [PATCH v2 1/2] drm/i915/display: Add own counter for Panel Replay vblank workaround Jani Nikula
2024-10-10  5:26   ` Hogander, Jouni
2024-10-10 13:22     ` Jani Nikula [this message]
2024-10-15  7:29       ` Hogander, Jouni
2024-10-09 14:40 ` Cavitt, Jonathan
2024-10-15  7:28   ` Hogander, Jouni
2024-10-09 15:38 ` ✗ Fi.CI.SPARSE: warning for series starting with [v2,1/2] " Patchwork
2024-10-09 15:47 ` ✓ Fi.CI.BAT: success " Patchwork
2024-10-10 20:26 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-10-14 12:47   ` Hogander, Jouni

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=87cyk86qkm.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jouni.hogander@intel.com \
    --cc=ville.syrjala@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.