Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: "Murthy, Arun R" <arun.r.murthy@intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH 2/7] drm/i915/display: move more scanline functions to intel_vblank.[ch]
Date: Wed, 14 Dec 2022 11:15:07 +0200	[thread overview]
Message-ID: <87k02uwdlw.fsf@intel.com> (raw)
In-Reply-To: <BL0PR11MB31703B1D64C3125DE1B3EADDBAE09@BL0PR11MB3170.namprd11.prod.outlook.com>

On Wed, 14 Dec 2022, "Murthy, Arun R" <arun.r.murthy@intel.com> wrote:
>> -----Original Message-----
>> From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Jani
>> Nikula
>> Sent: Monday, December 12, 2022 7:59 PM
>> To: intel-gfx@lists.freedesktop.org
>> Cc: Nikula, Jani <jani.nikula@intel.com>
>> Subject: [Intel-gfx] [PATCH 2/7] drm/i915/display: move more scanline
>> functions to intel_vblank.[ch]
>>
>> Reduce clutter in intel_display.c by moving the scanline moving/stopped wait
>> functions to intel_vblank.[ch].
>>
>> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>>  drivers/gpu/drm/i915/display/intel_display.c | 36 +-------------------
>> drivers/gpu/drm/i915/display/intel_vblank.c  | 35 +++++++++++++++++++
>> drivers/gpu/drm/i915/display/intel_vblank.h  |  2 ++
>>  3 files changed, 38 insertions(+), 35 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_display.c
>> b/drivers/gpu/drm/i915/display/intel_display.c
>> index 6cdfdae2c712..0cdb514d7ee0 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display.c
>> +++ b/drivers/gpu/drm/i915/display/intel_display.c
>> @@ -115,6 +115,7 @@
>>  #include "intel_quirks.h"
>>  #include "intel_sprite.h"
>>  #include "intel_tc.h"
>> +#include "intel_vblank.h"
>>  #include "intel_vga.h"
>>  #include "i9xx_plane.h"
>>  #include "skl_scaler.h"
>> @@ -386,41 +387,6 @@ struct intel_crtc *intel_master_crtc(const struct
>> intel_crtc_state *crtc_state)
>>               return to_intel_crtc(crtc_state->uapi.crtc);
>>  }
>>
>> -static bool pipe_scanline_is_moving(struct drm_i915_private *dev_priv,
>> -                                 enum pipe pipe)
>> -{
>> -     i915_reg_t reg = PIPEDSL(pipe);
>> -     u32 line1, line2;
>> -
>> -     line1 = intel_de_read(dev_priv, reg) & PIPEDSL_LINE_MASK;
>> -     msleep(5);
>> -     line2 = intel_de_read(dev_priv, reg) & PIPEDSL_LINE_MASK;
>> -
>> -     return line1 != line2;
>> -}
>> -
>> -static void wait_for_pipe_scanline_moving(struct intel_crtc *crtc, bool state)
>> -{
>> -     struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
>> -     enum pipe pipe = crtc->pipe;
>> -
>> -     /* Wait for the display line to settle/start moving */
>> -     if (wait_for(pipe_scanline_is_moving(dev_priv, pipe) == state, 100))
>> -             drm_err(&dev_priv->drm,
>> -                     "pipe %c scanline %s wait timed out\n",
>> -                     pipe_name(pipe), str_on_off(state));
>> -}
>> -
>> -static void intel_wait_for_pipe_scanline_stopped(struct intel_crtc *crtc) -{
>> -     wait_for_pipe_scanline_moving(crtc, false);
>> -}
>> -
>> -static void intel_wait_for_pipe_scanline_moving(struct intel_crtc *crtc) -{
>> -     wait_for_pipe_scanline_moving(crtc, true);
>> -}
>> -
>>  static void
>>  intel_wait_for_pipe_off(const struct intel_crtc_state *old_crtc_state)  { diff --
>> git a/drivers/gpu/drm/i915/display/intel_vblank.c
>> b/drivers/gpu/drm/i915/display/intel_vblank.c
>> index 78a579496ad1..f25ec643a0a3 100644
>> --- a/drivers/gpu/drm/i915/display/intel_vblank.c
>> +++ b/drivers/gpu/drm/i915/display/intel_vblank.c
>> @@ -417,3 +417,38 @@ int intel_get_crtc_scanline(struct intel_crtc *crtc)
>>
>>       return position;
>>  }
>> +
>> +static bool pipe_scanline_is_moving(struct drm_i915_private *dev_priv,
>> +                                 enum pipe pipe)
>> +{
>> +     i915_reg_t reg = PIPEDSL(pipe);
>> +     u32 line1, line2;
>> +
>> +     line1 = intel_de_read(dev_priv, reg) & PIPEDSL_LINE_MASK;
>> +     msleep(5);
>> +     line2 = intel_de_read(dev_priv, reg) & PIPEDSL_LINE_MASK;
>> +
>> +     return line1 != line2;
>> +}
>> +
>> +static void wait_for_pipe_scanline_moving(struct intel_crtc *crtc, bool
>> +state) {
>> +     struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
>> +     enum pipe pipe = crtc->pipe;
>> +
>> +     /* Wait for the display line to settle/start moving */
>> +     if (wait_for(pipe_scanline_is_moving(dev_priv, pipe) == state, 100))
>> +             drm_err(&dev_priv->drm,
>> +                     "pipe %c scanline %s wait timed out\n",
>> +                     pipe_name(pipe), str_on_off(state)); }
>> +
>> +void intel_wait_for_pipe_scanline_stopped(struct intel_crtc *crtc) {
>> +     wait_for_pipe_scanline_moving(crtc, false); }
>> +
> Is this wrapper function required, since nothing else is being other
> than calling the function wait_for_pipe_scanline_moving, can this be
> replaced?

Well, first, this patch is only about code *movement*. Any changes like
that would have to be separate.

And how would you propose to drop the wrapper? The wrappers are all
about readability in the caller side:

intel_wait_for_pipe_scanline_stopped(crtc)

vs. 

intel_wait_for_pipe_scanline_moving(crtc, false)

BR,
Jani.

>
> Thanks and Regards,
> Arun R Murthy
> --------------------
>
>> +void intel_wait_for_pipe_scanline_moving(struct intel_crtc *crtc) {
>> +     wait_for_pipe_scanline_moving(crtc, true); }
>> diff --git a/drivers/gpu/drm/i915/display/intel_vblank.h
>> b/drivers/gpu/drm/i915/display/intel_vblank.h
>> index 9c0034d7454d..54870cabd734 100644
>> --- a/drivers/gpu/drm/i915/display/intel_vblank.h
>> +++ b/drivers/gpu/drm/i915/display/intel_vblank.h
>> @@ -17,5 +17,7 @@ u32 g4x_get_vblank_counter(struct drm_crtc *crtc);
>> bool intel_crtc_get_vblank_timestamp(struct drm_crtc *crtc, int *max_error,
>>                                    ktime_t *vblank_time, bool in_vblank_irq);
>> int intel_get_crtc_scanline(struct intel_crtc *crtc);
>> +void intel_wait_for_pipe_scanline_stopped(struct intel_crtc *crtc);
>> +void intel_wait_for_pipe_scanline_moving(struct intel_crtc *crtc);
>>
>>  #endif /* __INTEL_VBLANK_H__ */
>> --
>> 2.34.1
>

-- 
Jani Nikula, Intel Open Source Graphics Center

  reply	other threads:[~2022-12-14  9:15 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-12 14:29 [Intel-gfx] [PATCH 0/7] drm/i915: extract vblank/scanline code to a separate file Jani Nikula
2022-12-12 14:29 ` [Intel-gfx] [PATCH 1/7] drm/i915/irq: split out vblank/scanline code to intel_vblank.[ch] Jani Nikula
2022-12-12 14:29 ` [Intel-gfx] [PATCH 2/7] drm/i915/display: move more scanline functions " Jani Nikula
2022-12-14  4:15   ` Murthy, Arun R
2022-12-14  9:15     ` Jani Nikula [this message]
2022-12-15  2:11       ` Murthy, Arun R
2022-12-15  9:12         ` Jani Nikula
2022-12-15  9:59           ` Murthy, Arun R
2022-12-15 10:20             ` Jani Nikula
2022-12-15 10:39               ` Murthy, Arun R
2022-12-15 11:03                 ` Jani Nikula
2022-12-12 14:29 ` [Intel-gfx] [PATCH 3/7] drm/i915/display: use common function for checking scanline is moving Jani Nikula
2022-12-14  4:01   ` Murthy, Arun R
2022-12-12 14:29 ` [Intel-gfx] [PATCH 4/7] drm/i915/hdmi: abstract scanline range wait into intel_vblank.[ch] Jani Nikula
2022-12-14  4:17   ` Murthy, Arun R
2022-12-14 14:16   ` Ville Syrjälä
2022-12-12 14:29 ` [Intel-gfx] [PATCH 5/7] drm/i915/vblank: use intel_de_read() Jani Nikula
2022-12-14  4:05   ` Murthy, Arun R
2022-12-12 14:29 ` [Intel-gfx] [PATCH 6/7] drm/i915/vblank: add and use intel_de_read64_2x32() to read vblank counter Jani Nikula
2022-12-12 14:29 ` [Intel-gfx] [PATCH 7/7] drm/i915/reg: split out vblank/scanline regs Jani Nikula
2022-12-14  4:24   ` Murthy, Arun R
2022-12-14 13:42   ` Ville Syrjälä
2022-12-12 14:46 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: extract vblank/scanline code to a separate file Patchwork
2022-12-12 14:46 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-12-12 15:05 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2022-12-14  4:12 ` [Intel-gfx] [PATCH 0/7] " Murthy, Arun R
2022-12-14  9:18   ` Jani Nikula
2022-12-15  2:05     ` Murthy, Arun R

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=87k02uwdlw.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=arun.r.murthy@intel.com \
    --cc=intel-gfx@lists.freedesktop.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