diff mbox series

drm/i915/mtl: Use int for entry setup frames

Message ID 20231113093737.358137-1-mika.kahola@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/mtl: Use int for entry setup frames | expand

Commit Message

Kahola, Mika Nov. 13, 2023, 9:37 a.m. UTC
At least one TGL had regression when using u8 types
for entry setup frames calculation. So, let's switch
to use ints instead.

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 drivers/gpu/drm/i915/display/intel_psr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Hogander, Jouni Nov. 14, 2023, 10:17 a.m. UTC | #1
On Mon, 2023-11-13 at 11:37 +0200, Mika Kahola wrote:
> At least one TGL had regression when using u8 types
> for entry setup frames calculation. So, let's switch
> to use ints instead.

I think you need to add Fixes tag here? With this change:

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>

> 
> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_psr.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_psr.c
> b/drivers/gpu/drm/i915/display/intel_psr.c
> index 3691f882e1c0..a4417e85f92a 100644
> --- a/drivers/gpu/drm/i915/display/intel_psr.c
> +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> @@ -1093,12 +1093,12 @@ static bool _compute_psr2_wake_times(struct
> intel_dp *intel_dp,
>         return true;
>  }
>  
> -static u8 intel_psr_entry_setup_frames(struct intel_dp *intel_dp,
> -                                      const struct drm_display_mode
> *adjusted_mode)
> +static int intel_psr_entry_setup_frames(struct intel_dp *intel_dp,
> +                                       const struct drm_display_mode
> *adjusted_mode)
>  {
>         struct drm_i915_private *i915 = dp_to_i915(intel_dp);
>         int psr_setup_time = drm_dp_psr_setup_time(intel_dp-
> >psr_dpcd);
> -       u8 entry_setup_frames = 0;
> +       int entry_setup_frames = 0;
>  
>         if (psr_setup_time < 0) {
>                 drm_dbg_kms(&i915->drm,
Andrzej Hajda Nov. 14, 2023, 10:22 a.m. UTC | #2
On 13.11.2023 10:37, Mika Kahola wrote:
> At least one TGL had regression when using u8 types
> for entry setup frames calculation. So, let's switch
> to use ints instead.

This explanation is missing the most important part - why int?

I guess it is because intel_psr_entry_setup_frames can return -ETIME, 
which converted to u8 and then int becomes not what we would expect.
And fixes tag is missing.

Regards
Andrzej

> 
> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> ---
>   drivers/gpu/drm/i915/display/intel_psr.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
> index 3691f882e1c0..a4417e85f92a 100644
> --- a/drivers/gpu/drm/i915/display/intel_psr.c
> +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> @@ -1093,12 +1093,12 @@ static bool _compute_psr2_wake_times(struct intel_dp *intel_dp,
>   	return true;
>   }
>   
> -static u8 intel_psr_entry_setup_frames(struct intel_dp *intel_dp,
> -				       const struct drm_display_mode *adjusted_mode)
> +static int intel_psr_entry_setup_frames(struct intel_dp *intel_dp,
> +					const struct drm_display_mode *adjusted_mode)
>   {
>   	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
>   	int psr_setup_time = drm_dp_psr_setup_time(intel_dp->psr_dpcd);
> -	u8 entry_setup_frames = 0;
> +	int entry_setup_frames = 0;
>   
>   	if (psr_setup_time < 0) {
>   		drm_dbg_kms(&i915->drm,
Kahola, Mika Nov. 14, 2023, 10:24 a.m. UTC | #3
> -----Original Message-----
> From: Hajda, Andrzej <andrzej.hajda@intel.com>
> Sent: Tuesday, November 14, 2023 12:22 PM
> To: Kahola, Mika <mika.kahola@intel.com>; intel-gfx@lists.freedesktop.org
> Subject: Re: [Intel-gfx] [PATCH] drm/i915/mtl: Use int for entry setup frames
> 
> On 13.11.2023 10:37, Mika Kahola wrote:
> > At least one TGL had regression when using u8 types for entry setup
> > frames calculation. So, let's switch to use ints instead.
> 
> This explanation is missing the most important part - why int?
> 
> I guess it is because intel_psr_entry_setup_frames can return -ETIME, which converted to u8 and then int becomes not what we
> would expect.
> And fixes tag is missing.

I will add the fixes and improve the explanation.

Thanks for the comments and reviews.

-Mika-
> 
> Regards
> Andrzej
> 
> >
> > Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> > ---
> >   drivers/gpu/drm/i915/display/intel_psr.c | 6 +++---
> >   1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_psr.c
> > b/drivers/gpu/drm/i915/display/intel_psr.c
> > index 3691f882e1c0..a4417e85f92a 100644
> > --- a/drivers/gpu/drm/i915/display/intel_psr.c
> > +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> > @@ -1093,12 +1093,12 @@ static bool _compute_psr2_wake_times(struct intel_dp *intel_dp,
> >   	return true;
> >   }
> >
> > -static u8 intel_psr_entry_setup_frames(struct intel_dp *intel_dp,
> > -				       const struct drm_display_mode *adjusted_mode)
> > +static int intel_psr_entry_setup_frames(struct intel_dp *intel_dp,
> > +					const struct drm_display_mode *adjusted_mode)
> >   {
> >   	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
> >   	int psr_setup_time = drm_dp_psr_setup_time(intel_dp->psr_dpcd);
> > -	u8 entry_setup_frames = 0;
> > +	int entry_setup_frames = 0;
> >
> >   	if (psr_setup_time < 0) {
> >   		drm_dbg_kms(&i915->drm,
Ville Syrjala Nov. 15, 2023, 9:58 p.m. UTC | #4
On Mon, Nov 13, 2023 at 11:37:37AM +0200, Mika Kahola wrote:
> At least one TGL had regression when using u8 types
> for entry setup frames calculation. So, let's switch
> to use ints instead.
> 
> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_psr.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
> index 3691f882e1c0..a4417e85f92a 100644
> --- a/drivers/gpu/drm/i915/display/intel_psr.c
> +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> @@ -1093,12 +1093,12 @@ static bool _compute_psr2_wake_times(struct intel_dp *intel_dp,
>  	return true;
>  }
>  
> -static u8 intel_psr_entry_setup_frames(struct intel_dp *intel_dp,
> -				       const struct drm_display_mode *adjusted_mode)
> +static int intel_psr_entry_setup_frames(struct intel_dp *intel_dp,
> +					const struct drm_display_mode *adjusted_mode)
>  {
>  	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
>  	int psr_setup_time = drm_dp_psr_setup_time(intel_dp->psr_dpcd);
> -	u8 entry_setup_frames = 0;
> +	int entry_setup_frames = 0;

You didn't change the other one in _psr_compute_config()
so this still looks broken to me.

>  
>  	if (psr_setup_time < 0) {
>  		drm_dbg_kms(&i915->drm,
> -- 
> 2.34.1
Kahola, Mika Nov. 16, 2023, 8:59 a.m. UTC | #5
> -----Original Message-----
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Sent: Wednesday, November 15, 2023 11:58 PM
> To: Kahola, Mika <mika.kahola@intel.com>
> Cc: intel-gfx@lists.freedesktop.org; Hogander, Jouni <jouni.hogander@intel.com>
> Subject: Re: [PATCH] drm/i915/mtl: Use int for entry setup frames
> 
> On Mon, Nov 13, 2023 at 11:37:37AM +0200, Mika Kahola wrote:
> > At least one TGL had regression when using u8 types for entry setup
> > frames calculation. So, let's switch to use ints instead.
> >
> > Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_psr.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_psr.c
> > b/drivers/gpu/drm/i915/display/intel_psr.c
> > index 3691f882e1c0..a4417e85f92a 100644
> > --- a/drivers/gpu/drm/i915/display/intel_psr.c
> > +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> > @@ -1093,12 +1093,12 @@ static bool _compute_psr2_wake_times(struct intel_dp *intel_dp,
> >  	return true;
> >  }
> >
> > -static u8 intel_psr_entry_setup_frames(struct intel_dp *intel_dp,
> > -				       const struct drm_display_mode *adjusted_mode)
> > +static int intel_psr_entry_setup_frames(struct intel_dp *intel_dp,
> > +					const struct drm_display_mode *adjusted_mode)
> >  {
> >  	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
> >  	int psr_setup_time = drm_dp_psr_setup_time(intel_dp->psr_dpcd);
> > -	u8 entry_setup_frames = 0;
> > +	int entry_setup_frames = 0;
> 
> You didn't change the other one in _psr_compute_config() so this still looks broken to me.

Indeed, I missed that one. Thanks for spotting!

-Mika-
> 
> >
> >  	if (psr_setup_time < 0) {
> >  		drm_dbg_kms(&i915->drm,
> > --
> > 2.34.1
> 
> --
> Ville Syrjälä
> Intel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
index 3691f882e1c0..a4417e85f92a 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -1093,12 +1093,12 @@  static bool _compute_psr2_wake_times(struct intel_dp *intel_dp,
 	return true;
 }
 
-static u8 intel_psr_entry_setup_frames(struct intel_dp *intel_dp,
-				       const struct drm_display_mode *adjusted_mode)
+static int intel_psr_entry_setup_frames(struct intel_dp *intel_dp,
+					const struct drm_display_mode *adjusted_mode)
 {
 	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
 	int psr_setup_time = drm_dp_psr_setup_time(intel_dp->psr_dpcd);
-	u8 entry_setup_frames = 0;
+	int entry_setup_frames = 0;
 
 	if (psr_setup_time < 0) {
 		drm_dbg_kms(&i915->drm,