diff mbox series

[3/6] drm/i915/display: Embed the new struct steps for squashing

Message ID 20220917004404.414981-4-anusha.srivatsa@intel.com (mailing list archive)
State New, archived
Headers show
Series Introduce struct cdclk_step | expand

Commit Message

Srivatsa, Anusha Sept. 17, 2022, 12:44 a.m. UTC
Populate the new struct steps for squash case.

Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
---
 drivers/gpu/drm/i915/display/intel_cdclk.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Jani Nikula Sept. 19, 2022, 9:27 a.m. UTC | #1
On Fri, 16 Sep 2022, Anusha Srivatsa <anusha.srivatsa@intel.com> wrote:
> Populate the new struct steps for squash case.
>
> Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_cdclk.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
> index 220d32adbd12..d2e81134b6f2 100644
> --- a/drivers/gpu/drm/i915/display/intel_cdclk.c
> +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
> @@ -1973,8 +1973,9 @@ static bool intel_cdclk_can_crawl(struct drm_i915_private *dev_priv,
>  
>  static bool intel_cdclk_can_squash(struct drm_i915_private *dev_priv,
>  				   const struct intel_cdclk_config *a,
> -				   const struct intel_cdclk_config *b)
> +				   struct intel_cdclk_config *b)

Why are you dropping const?

>  {
> +	struct cdclk_step *cdclk_transition = b->steps;

The type name has step, the array is named steps, why is the variable
"transition"?

>  	/*
>  	 * FIXME should store a bit more state in intel_cdclk_config
>  	 * to differentiate squasher vs. cd2x divider properly. For
> @@ -1984,6 +1985,12 @@ static bool intel_cdclk_can_squash(struct drm_i915_private *dev_priv,
>  	if (!has_cdclk_squasher(dev_priv))
>  		return false;
>  
> +	if (a->cdclk != b->cdclk && a->vco != 0 &&
> +	    a->vco == b->vco &&	a->ref == b->ref) {
> +		cdclk_transition->action = CDCLK_SQUASH_ONLY;
> +		cdclk_transition->cdclk = b->cdclk;
> +	}
> +
>  	return a->cdclk != b->cdclk &&
>  		a->vco != 0 &&
>  		a->vco == b->vco &&
Navare, Manasi Sept. 19, 2022, 7:39 p.m. UTC | #2
On Mon, Sep 19, 2022 at 12:27:55PM +0300, Jani Nikula wrote:
> On Fri, 16 Sep 2022, Anusha Srivatsa <anusha.srivatsa@intel.com> wrote:
> > Populate the new struct steps for squash case.
> >
> > Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_cdclk.c | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
> > index 220d32adbd12..d2e81134b6f2 100644
> > --- a/drivers/gpu/drm/i915/display/intel_cdclk.c
> > +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
> > @@ -1973,8 +1973,9 @@ static bool intel_cdclk_can_crawl(struct drm_i915_private *dev_priv,
> >  
> >  static bool intel_cdclk_can_squash(struct drm_i915_private *dev_priv,
> >  				   const struct intel_cdclk_config *a,
> > -				   const struct intel_cdclk_config *b)
> > +				   struct intel_cdclk_config *b)
> 
> Why are you dropping const?
> 
> >  {
> > +	struct cdclk_step *cdclk_transition = b->steps;
> 
> The type name has step, the array is named steps, why is the variable
> "transition"?

Yes I agree that the name cdclk_tranistion is confusing rather having
cdclk_transition is unnecessary.
Why cant you directly access b->steps->action, b->steps->cdclk


Manasi

> 
> >  	/*
> >  	 * FIXME should store a bit more state in intel_cdclk_config
> >  	 * to differentiate squasher vs. cd2x divider properly. For
> > @@ -1984,6 +1985,12 @@ static bool intel_cdclk_can_squash(struct drm_i915_private *dev_priv,
> >  	if (!has_cdclk_squasher(dev_priv))
> >  		return false;
> >  
> > +	if (a->cdclk != b->cdclk && a->vco != 0 &&
> > +	    a->vco == b->vco &&	a->ref == b->ref) {
> > +		cdclk_transition->action = CDCLK_SQUASH_ONLY;
> > +		cdclk_transition->cdclk = b->cdclk;
> > +	}
> > +
> >  	return a->cdclk != b->cdclk &&
> >  		a->vco != 0 &&
> >  		a->vco == b->vco &&
> 
> -- 
> Jani Nikula, Intel Open Source Graphics Center
Srivatsa, Anusha Sept. 19, 2022, 10:54 p.m. UTC | #3
> -----Original Message-----
> From: Navare, Manasi D <manasi.d.navare@intel.com>
> Sent: Monday, September 19, 2022 12:39 PM
> To: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Srivatsa, Anusha <anusha.srivatsa@intel.com>; intel-
> gfx@lists.freedesktop.org
> Subject: Re: [Intel-gfx] [PATCH 3/6] drm/i915/display: Embed the new struct
> steps for squashing
> 
> On Mon, Sep 19, 2022 at 12:27:55PM +0300, Jani Nikula wrote:
> > On Fri, 16 Sep 2022, Anusha Srivatsa <anusha.srivatsa@intel.com> wrote:
> > > Populate the new struct steps for squash case.
> > >
> > > Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/display/intel_cdclk.c | 9 ++++++++-
> > >  1 file changed, 8 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c
> > > b/drivers/gpu/drm/i915/display/intel_cdclk.c
> > > index 220d32adbd12..d2e81134b6f2 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_cdclk.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
> > > @@ -1973,8 +1973,9 @@ static bool intel_cdclk_can_crawl(struct
> > > drm_i915_private *dev_priv,
> > >
> > >  static bool intel_cdclk_can_squash(struct drm_i915_private *dev_priv,
> > >  				   const struct intel_cdclk_config *a,
> > > -				   const struct intel_cdclk_config *b)
> > > +				   struct intel_cdclk_config *b)
> >
> > Why are you dropping const?
@Jani Nikula @Navare, Manasi D
Looking at intel_modeset_calc_cdclk() from where this function is called, new_cdclk_state is not a const. Since we are going to be populating it in intel_cdclk_can_squash() and in intel_cdclk_can_crawl() in the next patch, keeping it non-const made sense.


> >
> > >  {
> > > +	struct cdclk_step *cdclk_transition = b->steps;
> >
> > The type name has step, the array is named steps, why is the variable
> > "transition"?
> 
> Yes I agree that the name cdclk_tranistion is confusing rather having
> cdclk_transition is unnecessary.
> Why cant you directly access b->steps->action, b->steps->cdclk
> 
Now that I look at it again, I see that cdclk_transition might be confusing. I will either rename it or directly access it as Manasi suggested.

Anusha
> Manasi
> 
> >
> > >  	/*
> > >  	 * FIXME should store a bit more state in intel_cdclk_config
> > >  	 * to differentiate squasher vs. cd2x divider properly. For @@
> > > -1984,6 +1985,12 @@ static bool intel_cdclk_can_squash(struct
> drm_i915_private *dev_priv,
> > >  	if (!has_cdclk_squasher(dev_priv))
> > >  		return false;
> > >
> > > +	if (a->cdclk != b->cdclk && a->vco != 0 &&
> > > +	    a->vco == b->vco &&	a->ref == b->ref) {
> > > +		cdclk_transition->action = CDCLK_SQUASH_ONLY;
> > > +		cdclk_transition->cdclk = b->cdclk;
> > > +	}
> > > +
> > >  	return a->cdclk != b->cdclk &&
> > >  		a->vco != 0 &&
> > >  		a->vco == b->vco &&
> >
> > --
> > Jani Nikula, Intel Open Source Graphics Center
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
index 220d32adbd12..d2e81134b6f2 100644
--- a/drivers/gpu/drm/i915/display/intel_cdclk.c
+++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
@@ -1973,8 +1973,9 @@  static bool intel_cdclk_can_crawl(struct drm_i915_private *dev_priv,
 
 static bool intel_cdclk_can_squash(struct drm_i915_private *dev_priv,
 				   const struct intel_cdclk_config *a,
-				   const struct intel_cdclk_config *b)
+				   struct intel_cdclk_config *b)
 {
+	struct cdclk_step *cdclk_transition = b->steps;
 	/*
 	 * FIXME should store a bit more state in intel_cdclk_config
 	 * to differentiate squasher vs. cd2x divider properly. For
@@ -1984,6 +1985,12 @@  static bool intel_cdclk_can_squash(struct drm_i915_private *dev_priv,
 	if (!has_cdclk_squasher(dev_priv))
 		return false;
 
+	if (a->cdclk != b->cdclk && a->vco != 0 &&
+	    a->vco == b->vco &&	a->ref == b->ref) {
+		cdclk_transition->action = CDCLK_SQUASH_ONLY;
+		cdclk_transition->cdclk = b->cdclk;
+	}
+
 	return a->cdclk != b->cdclk &&
 		a->vco != 0 &&
 		a->vco == b->vco &&