diff mbox series

[2/4] drm/i915: Use old mbus_join value when increasing CDCLK

Message ID 20240325112329.7922-3-stanislav.lisovskiy@intel.com (mailing list archive)
State New, archived
Headers show
Series Enable fastset for mbus_join state change | expand

Commit Message

Stanislav Lisovskiy March 25, 2024, 11:23 a.m. UTC
In order to make sure we are not breaking the proper sequence
lets to updates step by step and don't change MBUS join value
during MDCLK/CDCLK programming stage.
MBUS join programming would be taken care by pre/post ddb hooks.

v2: - Reworded comment about using old mbus_join value in
      intel_set_cdclk(Ville Syrjälä)

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
---
 drivers/gpu/drm/i915/display/intel_cdclk.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Comments

Ville Syrjala March 25, 2024, 2:30 p.m. UTC | #1
On Mon, Mar 25, 2024 at 01:23:27PM +0200, Stanislav Lisovskiy wrote:
> In order to make sure we are not breaking the proper sequence
> lets to updates step by step and don't change MBUS join value
> during MDCLK/CDCLK programming stage.
> MBUS join programming would be taken care by pre/post ddb hooks.
> 
> v2: - Reworded comment about using old mbus_join value in
>       intel_set_cdclk(Ville Syrjälä)
> 
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_cdclk.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
> index 31aaa9780dfcf..c7813d433c424 100644
> --- a/drivers/gpu/drm/i915/display/intel_cdclk.c
> +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
> @@ -2611,9 +2611,19 @@ intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state)
>  
>  	if (pipe == INVALID_PIPE ||
>  	    old_cdclk_state->actual.cdclk <= new_cdclk_state->actual.cdclk) {
> +		struct intel_cdclk_config cdclk_config;
> +
>  		drm_WARN_ON(&i915->drm, !new_cdclk_state->base.changed);
>  
> -		intel_set_cdclk(i915, &new_cdclk_state->actual, pipe);
> +		/*
> +		 * By this hack we want to prevent mbus_join to be changed
> +		 * beforehand

That sentence is still confusing.

> - we will take care of this later in
> +		 * intel_dbuf_mbus_post_ddb_update
> +		 */
> +		cdclk_config = new_cdclk_state->actual;
> +		cdclk_config.joined_mbus = old_cdclk_state->actual.joined_mbus;
> +
> +		intel_set_cdclk(i915, &cdclk_config, pipe);
>  	}
>  }
>  
> -- 
> 2.37.3
Stanislav Lisovskiy March 25, 2024, 4:55 p.m. UTC | #2
On Mon, Mar 25, 2024 at 04:30:14PM +0200, Ville Syrjälä wrote:
> On Mon, Mar 25, 2024 at 01:23:27PM +0200, Stanislav Lisovskiy wrote:
> > In order to make sure we are not breaking the proper sequence
> > lets to updates step by step and don't change MBUS join value
> > during MDCLK/CDCLK programming stage.
> > MBUS join programming would be taken care by pre/post ddb hooks.
> > 
> > v2: - Reworded comment about using old mbus_join value in
> >       intel_set_cdclk(Ville Syrjälä)
> > 
> > Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_cdclk.c | 12 +++++++++++-
> >  1 file changed, 11 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
> > index 31aaa9780dfcf..c7813d433c424 100644
> > --- a/drivers/gpu/drm/i915/display/intel_cdclk.c
> > +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
> > @@ -2611,9 +2611,19 @@ intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state)
> >  
> >  	if (pipe == INVALID_PIPE ||
> >  	    old_cdclk_state->actual.cdclk <= new_cdclk_state->actual.cdclk) {
> > +		struct intel_cdclk_config cdclk_config;
> > +
> >  		drm_WARN_ON(&i915->drm, !new_cdclk_state->base.changed);
> >  
> > -		intel_set_cdclk(i915, &new_cdclk_state->actual, pipe);
> > +		/*
> > +		 * By this hack we want to prevent mbus_join to be changed
> > +		 * beforehand
> 
> That sentence is still confusing.

Write it yourself then. I'm not going to rephrase it anymore.

> 
> > - we will take care of this later in
> > +		 * intel_dbuf_mbus_post_ddb_update
> > +		 */
> > +		cdclk_config = new_cdclk_state->actual;
> > +		cdclk_config.joined_mbus = old_cdclk_state->actual.joined_mbus;
> > +
> > +		intel_set_cdclk(i915, &cdclk_config, pipe);
> >  	}
> >  }
> >  
> > -- 
> > 2.37.3
> 
> -- 
> Ville Syrjälä
> Intel
Ville Syrjala March 25, 2024, 5:01 p.m. UTC | #3
On Mon, Mar 25, 2024 at 06:55:21PM +0200, Lisovskiy, Stanislav wrote:
> On Mon, Mar 25, 2024 at 04:30:14PM +0200, Ville Syrjälä wrote:
> > On Mon, Mar 25, 2024 at 01:23:27PM +0200, Stanislav Lisovskiy wrote:
> > > In order to make sure we are not breaking the proper sequence
> > > lets to updates step by step and don't change MBUS join value
> > > during MDCLK/CDCLK programming stage.
> > > MBUS join programming would be taken care by pre/post ddb hooks.
> > > 
> > > v2: - Reworded comment about using old mbus_join value in
> > >       intel_set_cdclk(Ville Syrjälä)
> > > 
> > > Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/display/intel_cdclk.c | 12 +++++++++++-
> > >  1 file changed, 11 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
> > > index 31aaa9780dfcf..c7813d433c424 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_cdclk.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
> > > @@ -2611,9 +2611,19 @@ intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state)
> > >  
> > >  	if (pipe == INVALID_PIPE ||
> > >  	    old_cdclk_state->actual.cdclk <= new_cdclk_state->actual.cdclk) {
> > > +		struct intel_cdclk_config cdclk_config;
> > > +
> > >  		drm_WARN_ON(&i915->drm, !new_cdclk_state->base.changed);
> > >  
> > > -		intel_set_cdclk(i915, &new_cdclk_state->actual, pipe);
> > > +		/*
> > > +		 * By this hack we want to prevent mbus_join to be changed
> > > +		 * beforehand
> > 
> > That sentence is still confusing.
> 
> Write it yourself then. I'm not going to rephrase it anymore.

You didn't rephrase it at all AFAIK.

Something like
"MBUS joining will be changed later by
 intel_dbuf_mbus_{pre,post}_ddb_update(), thus
 keep using the old joined_mbus state during cdclk
 programming to match the actual hardware state."

> 
> > 
> > > - we will take care of this later in
> > > +		 * intel_dbuf_mbus_post_ddb_update
> > > +		 */
> > > +		cdclk_config = new_cdclk_state->actual;
> > > +		cdclk_config.joined_mbus = old_cdclk_state->actual.joined_mbus;
> > > +
> > > +		intel_set_cdclk(i915, &cdclk_config, pipe);
> > >  	}
> > >  }
> > >  
> > > -- 
> > > 2.37.3
> > 
> > -- 
> > Ville Syrjälä
> > Intel
Stanislav Lisovskiy March 25, 2024, 6:16 p.m. UTC | #4
On Mon, Mar 25, 2024 at 07:01:48PM +0200, Ville Syrjälä wrote:
> On Mon, Mar 25, 2024 at 06:55:21PM +0200, Lisovskiy, Stanislav wrote:
> > On Mon, Mar 25, 2024 at 04:30:14PM +0200, Ville Syrjälä wrote:
> > > On Mon, Mar 25, 2024 at 01:23:27PM +0200, Stanislav Lisovskiy wrote:
> > > > In order to make sure we are not breaking the proper sequence
> > > > lets to updates step by step and don't change MBUS join value
> > > > during MDCLK/CDCLK programming stage.
> > > > MBUS join programming would be taken care by pre/post ddb hooks.
> > > > 
> > > > v2: - Reworded comment about using old mbus_join value in
> > > >       intel_set_cdclk(Ville Syrjälä)
> > > > 
> > > > Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> > > > ---
> > > >  drivers/gpu/drm/i915/display/intel_cdclk.c | 12 +++++++++++-
> > > >  1 file changed, 11 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
> > > > index 31aaa9780dfcf..c7813d433c424 100644
> > > > --- a/drivers/gpu/drm/i915/display/intel_cdclk.c
> > > > +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
> > > > @@ -2611,9 +2611,19 @@ intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state)
> > > >  
> > > >  	if (pipe == INVALID_PIPE ||
> > > >  	    old_cdclk_state->actual.cdclk <= new_cdclk_state->actual.cdclk) {
> > > > +		struct intel_cdclk_config cdclk_config;
> > > > +
> > > >  		drm_WARN_ON(&i915->drm, !new_cdclk_state->base.changed);
> > > >  
> > > > -		intel_set_cdclk(i915, &new_cdclk_state->actual, pipe);
> > > > +		/*
> > > > +		 * By this hack we want to prevent mbus_join to be changed
> > > > +		 * beforehand
> > > 
> > > That sentence is still confusing.
> > 
> > Write it yourself then. I'm not going to rephrase it anymore.
> 
> You didn't rephrase it at all AFAIK.
> 
> Something like
> "MBUS joining will be changed later by
>  intel_dbuf_mbus_{pre,post}_ddb_update(), thus
>  keep using the old joined_mbus state during cdclk
>  programming to match the actual hardware state."

Basically my comment says exactly same stuff but with other
words, i.e preventing changing mbus join value beforehand,
until intel_dbuf_mbus_post_ddb_update takes care of that.

> 
> > 
> > > 
> > > > - we will take care of this later in
> > > > +		 * intel_dbuf_mbus_post_ddb_update
> > > > +		 */
> > > > +		cdclk_config = new_cdclk_state->actual;
> > > > +		cdclk_config.joined_mbus = old_cdclk_state->actual.joined_mbus;
> > > > +
> > > > +		intel_set_cdclk(i915, &cdclk_config, pipe);
> > > >  	}
> > > >  }
> > > >  
> > > > -- 
> > > > 2.37.3
> > > 
> > > -- 
> > > Ville Syrjälä
> > > Intel
> 
> -- 
> Ville Syrjälä
> Intel
Ville Syrjala March 25, 2024, 6:22 p.m. UTC | #5
On Mon, Mar 25, 2024 at 08:16:55PM +0200, Lisovskiy, Stanislav wrote:
> On Mon, Mar 25, 2024 at 07:01:48PM +0200, Ville Syrjälä wrote:
> > On Mon, Mar 25, 2024 at 06:55:21PM +0200, Lisovskiy, Stanislav wrote:
> > > On Mon, Mar 25, 2024 at 04:30:14PM +0200, Ville Syrjälä wrote:
> > > > On Mon, Mar 25, 2024 at 01:23:27PM +0200, Stanislav Lisovskiy wrote:
> > > > > In order to make sure we are not breaking the proper sequence
> > > > > lets to updates step by step and don't change MBUS join value
> > > > > during MDCLK/CDCLK programming stage.
> > > > > MBUS join programming would be taken care by pre/post ddb hooks.
> > > > > 
> > > > > v2: - Reworded comment about using old mbus_join value in
> > > > >       intel_set_cdclk(Ville Syrjälä)
> > > > > 
> > > > > Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > > Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> > > > > ---
> > > > >  drivers/gpu/drm/i915/display/intel_cdclk.c | 12 +++++++++++-
> > > > >  1 file changed, 11 insertions(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
> > > > > index 31aaa9780dfcf..c7813d433c424 100644
> > > > > --- a/drivers/gpu/drm/i915/display/intel_cdclk.c
> > > > > +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
> > > > > @@ -2611,9 +2611,19 @@ intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state)
> > > > >  
> > > > >  	if (pipe == INVALID_PIPE ||
> > > > >  	    old_cdclk_state->actual.cdclk <= new_cdclk_state->actual.cdclk) {
> > > > > +		struct intel_cdclk_config cdclk_config;
> > > > > +
> > > > >  		drm_WARN_ON(&i915->drm, !new_cdclk_state->base.changed);
> > > > >  
> > > > > -		intel_set_cdclk(i915, &new_cdclk_state->actual, pipe);
> > > > > +		/*
> > > > > +		 * By this hack we want to prevent mbus_join to be changed
> > > > > +		 * beforehand
> > > > 
> > > > That sentence is still confusing.
> > > 
> > > Write it yourself then. I'm not going to rephrase it anymore.
> > 
> > You didn't rephrase it at all AFAIK.
> > 
> > Something like
> > "MBUS joining will be changed later by
> >  intel_dbuf_mbus_{pre,post}_ddb_update(), thus
> >  keep using the old joined_mbus state during cdclk
> >  programming to match the actual hardware state."
> 
> Basically my comment says exactly same stuff but with other
> words, i.e preventing changing mbus join value beforehand,
> until intel_dbuf_mbus_post_ddb_update takes care of that.

To me your comment literally says
"we massage cdclk_config in order to prevent mbus
 joining changes from happening here"
Which is a lie; mbus joining will not change here
no matter what we do to the cdclk_config.

What we do is make sure the cdclk_config actually
matches the real hardware state of mbus joining.

> 
> > 
> > > 
> > > > 
> > > > > - we will take care of this later in
> > > > > +		 * intel_dbuf_mbus_post_ddb_update
> > > > > +		 */
> > > > > +		cdclk_config = new_cdclk_state->actual;
> > > > > +		cdclk_config.joined_mbus = old_cdclk_state->actual.joined_mbus;
> > > > > +
> > > > > +		intel_set_cdclk(i915, &cdclk_config, pipe);
> > > > >  	}
> > > > >  }
> > > > >  
> > > > > -- 
> > > > > 2.37.3
> > > > 
> > > > -- 
> > > > Ville Syrjälä
> > > > Intel
> > 
> > -- 
> > Ville Syrjälä
> > Intel
Stanislav Lisovskiy March 25, 2024, 6:49 p.m. UTC | #6
On Mon, Mar 25, 2024 at 08:22:41PM +0200, Ville Syrjälä wrote:
> On Mon, Mar 25, 2024 at 08:16:55PM +0200, Lisovskiy, Stanislav wrote:
> > On Mon, Mar 25, 2024 at 07:01:48PM +0200, Ville Syrjälä wrote:
> > > On Mon, Mar 25, 2024 at 06:55:21PM +0200, Lisovskiy, Stanislav wrote:
> > > > On Mon, Mar 25, 2024 at 04:30:14PM +0200, Ville Syrjälä wrote:
> > > > > On Mon, Mar 25, 2024 at 01:23:27PM +0200, Stanislav Lisovskiy wrote:
> > > > > > In order to make sure we are not breaking the proper sequence
> > > > > > lets to updates step by step and don't change MBUS join value
> > > > > > during MDCLK/CDCLK programming stage.
> > > > > > MBUS join programming would be taken care by pre/post ddb hooks.
> > > > > > 
> > > > > > v2: - Reworded comment about using old mbus_join value in
> > > > > >       intel_set_cdclk(Ville Syrjälä)
> > > > > > 
> > > > > > Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > > > Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> > > > > > ---
> > > > > >  drivers/gpu/drm/i915/display/intel_cdclk.c | 12 +++++++++++-
> > > > > >  1 file changed, 11 insertions(+), 1 deletion(-)
> > > > > > 
> > > > > > diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
> > > > > > index 31aaa9780dfcf..c7813d433c424 100644
> > > > > > --- a/drivers/gpu/drm/i915/display/intel_cdclk.c
> > > > > > +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
> > > > > > @@ -2611,9 +2611,19 @@ intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state)
> > > > > >  
> > > > > >  	if (pipe == INVALID_PIPE ||
> > > > > >  	    old_cdclk_state->actual.cdclk <= new_cdclk_state->actual.cdclk) {
> > > > > > +		struct intel_cdclk_config cdclk_config;
> > > > > > +
> > > > > >  		drm_WARN_ON(&i915->drm, !new_cdclk_state->base.changed);
> > > > > >  
> > > > > > -		intel_set_cdclk(i915, &new_cdclk_state->actual, pipe);
> > > > > > +		/*
> > > > > > +		 * By this hack we want to prevent mbus_join to be changed
> > > > > > +		 * beforehand
> > > > > 
> > > > > That sentence is still confusing.
> > > > 
> > > > Write it yourself then. I'm not going to rephrase it anymore.
> > > 
> > > You didn't rephrase it at all AFAIK.
> > > 
> > > Something like
> > > "MBUS joining will be changed later by
> > >  intel_dbuf_mbus_{pre,post}_ddb_update(), thus
> > >  keep using the old joined_mbus state during cdclk
> > >  programming to match the actual hardware state."
> > 
> > Basically my comment says exactly same stuff but with other
> > words, i.e preventing changing mbus join value beforehand,
> > until intel_dbuf_mbus_post_ddb_update takes care of that.
> 
> To me your comment literally says
> "we massage cdclk_config in order to prevent mbus
>  joining changes from happening here"
> Which is a lie; mbus joining will not change here
> no matter what we do to the cdclk_config.
> 
> What we do is make sure the cdclk_config actually
> matches the real hardware state of mbus joining.

Couple of revisions ago we discussed that here we use
old_cdclk state in order to prevent mbus join state to be
changed here so that we kind of do it in steps.
That is what I exactly meant.
To be honest I had some kind of impression from your words
that eventually it might get changed here as well, otherwise
it seems to be quite too much hassle for just keeping
hw/sw in sync.
Arguing about comments is of course really required here.

> 
> > 
> > > 
> > > > 
> > > > > 
> > > > > > - we will take care of this later in
> > > > > > +		 * intel_dbuf_mbus_post_ddb_update
> > > > > > +		 */
> > > > > > +		cdclk_config = new_cdclk_state->actual;
> > > > > > +		cdclk_config.joined_mbus = old_cdclk_state->actual.joined_mbus;
> > > > > > +
> > > > > > +		intel_set_cdclk(i915, &cdclk_config, pipe);
> > > > > >  	}
> > > > > >  }
> > > > > >  
> > > > > > -- 
> > > > > > 2.37.3
> > > > > 
> > > > > -- 
> > > > > Ville Syrjälä
> > > > > Intel
> > > 
> > > -- 
> > > Ville Syrjälä
> > > Intel
> 
> -- 
> Ville Syrjälä
> Intel
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 31aaa9780dfcf..c7813d433c424 100644
--- a/drivers/gpu/drm/i915/display/intel_cdclk.c
+++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
@@ -2611,9 +2611,19 @@  intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state)
 
 	if (pipe == INVALID_PIPE ||
 	    old_cdclk_state->actual.cdclk <= new_cdclk_state->actual.cdclk) {
+		struct intel_cdclk_config cdclk_config;
+
 		drm_WARN_ON(&i915->drm, !new_cdclk_state->base.changed);
 
-		intel_set_cdclk(i915, &new_cdclk_state->actual, pipe);
+		/*
+		 * By this hack we want to prevent mbus_join to be changed
+		 * beforehand - we will take care of this later in
+		 * intel_dbuf_mbus_post_ddb_update
+		 */
+		cdclk_config = new_cdclk_state->actual;
+		cdclk_config.joined_mbus = old_cdclk_state->actual.joined_mbus;
+
+		intel_set_cdclk(i915, &cdclk_config, pipe);
 	}
 }