diff mbox series

[3/8] drm/i915/scaler: Extract skl_scaler_min_dst_size()

Message ID 20241219130827.22830-4-ville.syrjala@linux.intel.com (mailing list archive)
State New
Headers show
Series drm/i915/scaler: Scaler cleanups and tracepoints | expand

Commit Message

Ville Syrjälä Dec. 19, 2024, 1:08 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The SKL_MIN_DST_* defines just make things hard to read.
Get rid of them and introduce an easy to read function
in their place.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/skl_scaler.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Luca Coelho Dec. 20, 2024, 8:50 a.m. UTC | #1
On Thu, 2024-12-19 at 15:08 +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> The SKL_MIN_DST_* defines just make things hard to read.
> Get rid of them and introduce an easy to read function
> in their place.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/skl_scaler.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/skl_scaler.c b/drivers/gpu/drm/i915/display/skl_scaler.c
> index d6bef6578867..cabbf4860cb3 100644
> --- a/drivers/gpu/drm/i915/display/skl_scaler.c
> +++ b/drivers/gpu/drm/i915/display/skl_scaler.c
> @@ -76,9 +76,7 @@ static u16 skl_scaler_calc_phase(int sub, int scale, bool chroma_cosited)
>  	return ((phase >> 2) & PS_PHASE_MASK) | trip;
>  }
>  
> -#define SKL_MIN_DST_W 8
>  #define SKL_MAX_DST_W 4096
> -#define SKL_MIN_DST_H 8
>  #define SKL_MAX_DST_H 4096
>  #define ICL_MAX_DST_W 5120
>  #define ICL_MAX_DST_H 4096
> @@ -119,6 +117,12 @@ static void skl_scaler_max_src_size(struct intel_crtc *crtc,
>  	}
>  }
>  
> +static void skl_scaler_min_dst_size(int *min_w, int *min_h)
> +{
> +	*min_w = 8;
> +	*min_h = 8;
> +}
> +
>  static int
>  skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
>  		  unsigned int scaler_user, int *scaler_id,
> @@ -186,8 +190,7 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
>  	skl_scaler_min_src_size(format, modifier, &min_src_w, &min_src_h);
>  	skl_scaler_max_src_size(crtc, &max_src_w, &max_src_h);
>  
> -	min_dst_w = SKL_MIN_DST_W;
> -	min_dst_h = SKL_MIN_DST_H;
> +	skl_scaler_min_dst_size(&min_dst_w, &min_dst_h);
>  
>  	if (DISPLAY_VER(display) < 11) {
>  		max_dst_w = SKL_MAX_DST_W;

Not sure this makes much difference in readability, but I guess it fits
the overall idea.

Reviewed-by: Luca Coelho <luciano.coelho@intel.com>

--
Cheers,
Luca.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/skl_scaler.c b/drivers/gpu/drm/i915/display/skl_scaler.c
index d6bef6578867..cabbf4860cb3 100644
--- a/drivers/gpu/drm/i915/display/skl_scaler.c
+++ b/drivers/gpu/drm/i915/display/skl_scaler.c
@@ -76,9 +76,7 @@  static u16 skl_scaler_calc_phase(int sub, int scale, bool chroma_cosited)
 	return ((phase >> 2) & PS_PHASE_MASK) | trip;
 }
 
-#define SKL_MIN_DST_W 8
 #define SKL_MAX_DST_W 4096
-#define SKL_MIN_DST_H 8
 #define SKL_MAX_DST_H 4096
 #define ICL_MAX_DST_W 5120
 #define ICL_MAX_DST_H 4096
@@ -119,6 +117,12 @@  static void skl_scaler_max_src_size(struct intel_crtc *crtc,
 	}
 }
 
+static void skl_scaler_min_dst_size(int *min_w, int *min_h)
+{
+	*min_w = 8;
+	*min_h = 8;
+}
+
 static int
 skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
 		  unsigned int scaler_user, int *scaler_id,
@@ -186,8 +190,7 @@  skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
 	skl_scaler_min_src_size(format, modifier, &min_src_w, &min_src_h);
 	skl_scaler_max_src_size(crtc, &max_src_w, &max_src_h);
 
-	min_dst_w = SKL_MIN_DST_W;
-	min_dst_h = SKL_MIN_DST_H;
+	skl_scaler_min_dst_size(&min_dst_w, &min_dst_h);
 
 	if (DISPLAY_VER(display) < 11) {
 		max_dst_w = SKL_MAX_DST_W;