Re: [PATCH 2/6] drm/i915/cdclk: Convert CDCLK code to intel_display

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 06, 2024 at 06:18:58PM +0300, Jani Nikula wrote:
> On Fri, 06 Sep 2024, Ville Syrjala <ville.syrjala@xxxxxxxxxxxxxxx> wrote:
> > From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> >
> > 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@xxxxxxxxxxxxxxx>
> 
> Some nitpicks inline, but overall
> 
> Reviewed-by: Jani Nikula <jani.nikula@xxxxxxxxx>
> 
> [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



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux