Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 2/6] drm/i915/cdclk: Convert CDCLK code to intel_display
Date: Fri, 6 Sep 2024 19:17:21 +0300	[thread overview]
Message-ID: <ZtsrEZ1poYDVwGOm@intel.com> (raw)
In-Reply-To: <87mskkn731.fsf@intel.com>

On Fri, Sep 06, 2024 at 06:18:58PM +0300, Jani Nikula wrote:
> On Fri, 06 Sep 2024, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > struct intel_display will replace struct drm_i915_private as
> > the main thing for display code. Convert the CDCLK code to
> > use it (as much as possible at this stage).
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Some nitpicks inline, but overall
> 
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> 
> [snip]
> 
> > @@ -2685,20 +2712,21 @@ intel_set_cdclk_post_plane_update(struct intel_atomic_state *state)
> >  	else
> >  		pipe = INVALID_PIPE;
> >  
> > -	drm_WARN_ON(&i915->drm, !new_cdclk_state->base.changed);
> > +	drm_WARN_ON(display->drm, !new_cdclk_state->base.changed);
> >  
> > -	intel_set_cdclk(i915, &new_cdclk_state->actual, pipe,
> > +	intel_set_cdclk(display, &new_cdclk_state->actual, pipe,
> >  			"Post changing CDCLK to");
> >  }
> >  
> >  static int intel_pixel_rate_to_cdclk(const struct intel_crtc_state *crtc_state)
> >  {
> > -	struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
> > +	struct intel_display *display = to_intel_display(crtc_state->uapi.crtc->dev);
> 
> This works, but to_intel_display(crtc_state) is enough.

Not entirely sure I like the magic going quite that deep.
Though I suppose we do have a lot of that, so maybe it's
best to make it simple as possible.

> > +	struct drm_i915_private *dev_priv = to_i915(display->drm);
> 
> I usually don't bother with changing the dev_priv initialization if it
> keeps working. I just put the display stuff first. But this works.
> 
> >  	int pixel_rate = crtc_state->pixel_rate;
> >  
> > -	if (DISPLAY_VER(dev_priv) >= 10)
> > +	if (DISPLAY_VER(display) >= 10)
> >  		return DIV_ROUND_UP(pixel_rate, 2);
> > -	else if (DISPLAY_VER(dev_priv) == 9 ||
> > +	else if (DISPLAY_VER(display) == 9 ||
> >  		 IS_BROADWELL(dev_priv) || IS_HASWELL(dev_priv))
> >  		return pixel_rate;
> >  	else if (IS_CHERRYVIEW(dev_priv))
> > @@ -2712,11 +2740,11 @@ static int intel_pixel_rate_to_cdclk(const struct intel_crtc_state *crtc_state)
> 
> [snip]
> 
> > diff --git a/drivers/gpu/drm/i915/display/intel_display_device.c b/drivers/gpu/drm/i915/display/intel_display_device.c
> > index 408c76852495..9ff08dbefc76 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display_device.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display_device.c
> > @@ -1678,7 +1678,7 @@ static void __intel_display_device_info_runtime_init(struct drm_i915_private *i9
> >  		}
> >  	}
> >  
> > -	display_runtime->rawclk_freq = intel_read_rawclk(i915);
> > +	display_runtime->rawclk_freq = intel_read_rawclk(&i915->display);
> 
> I generally prefer adding that struct intel_display local variable when
> I need it the first time, so the subsequent changes are less churn.

Yeah, I tried to follow that, unless the surrounding code already has
tons of &i915->display stuff in it. But here that isn't the case, so
apparently I just failed to follow the procedure fully.

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2024-09-06 16:17 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-06 14:33 [PATCH 0/6] drm/i915: Some intel_display conversions Ville Syrjala
2024-09-06 14:33 ` [PATCH 1/6] drm/i915/cdclk: Add missing braces Ville Syrjala
2024-09-06 15:10   ` Rodrigo Vivi
2024-09-06 15:19   ` Jani Nikula
2024-09-06 14:33 ` [PATCH 2/6] drm/i915/cdclk: Convert CDCLK code to intel_display Ville Syrjala
2024-09-06 15:09   ` Rodrigo Vivi
2024-09-06 15:18   ` Jani Nikula
2024-09-06 16:17     ` Ville Syrjälä [this message]
2024-09-06 14:33 ` [PATCH 3/6] drm/i915/power: Convert low level DC state " Ville Syrjala
2024-09-06 15:10   ` Rodrigo Vivi
2024-09-06 14:33 ` [PATCH 4/6] drm/i915/vga: Convert VGA " Ville Syrjala
2024-09-06 15:12   ` Rodrigo Vivi
2024-09-06 14:33 ` [PATCH 5/6] drm/i915/power: Convert "i830 power well" " Ville Syrjala
2024-09-06 15:13   ` Rodrigo Vivi
2024-09-06 14:33 ` [PATCH 6/6] drm/i915/dmc: Convert DMC " Ville Syrjala
2024-09-06 15:16   ` Rodrigo Vivi
2024-09-06 15:43 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Some intel_display conversions Patchwork
2024-09-06 15:43 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-09-06 16:08 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-09-09 14:15   ` Ville Syrjälä
2024-09-10  8:14     ` Illipilli, TejasreeX
2024-09-10  5:34 ` ✓ Fi.CI.BAT: success " Patchwork
2024-09-11  0:54 ` ✗ Fi.CI.IGT: failure " Patchwork

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=ZtsrEZ1poYDVwGOm@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox