Re: [RFC 1/2] drm/i915: Indicate integer up-scaling ratios

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

 



On Tue, 03 Sep 2019, Shashank Sharma <shashank.sharma@xxxxxxxxx> wrote:
> If the upscaling ratio is a complete integer, Intel display HW can
> pickup special scaling mode, which can produce better non-blurry
> outputs. This patch adds a check to indicate if this is such an upscaling
> opportunity, while calculating the scaler config, and stores it into scaler
> state.
>
> Cc: Jani Nikula <jani.nikula@xxxxxxxxx>
> Cc: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> Cc: Daniel Vetter <daniel.vetter@xxxxxxxxx>
> Cc: Vivi, Rodrigo <rodrigo.vivi@xxxxxxxxx>
> Signed-off-by: Shashank Sharma <shashank.sharma@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c  | 21 +++++++++++++++++++
>  .../drm/i915/display/intel_display_types.h    |  7 +++++++
>  2 files changed, 28 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index ee54d9659c99..613130db3c05 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -5388,6 +5388,19 @@ u16 skl_scaler_calc_phase(int sub, int scale, bool chroma_cosited)
>  #define SKL_MIN_YUV_420_SRC_W 16
>  #define SKL_MIN_YUV_420_SRC_H 16
>  
> +static inline bool

Please don't add superfluous inlines to static functions in .c
files. Let the compiler do its job.

BR,
Jani.

> +scaling_ratio_integer(int src_w, int dst_w, int src_h, int dst_h)
> +{
> +	/* Integer mode scaling is applicable only for upscaling scenarios */
> +	if (dst_w < src_w || dst_h < src_h)
> +		return false;
> +
> +	if (dst_w % src_w == 0 && dst_h % src_h == 0)
> +		return true;
> +
> +	return false;
> +}
> +
>  static int
>  skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
>  		  unsigned int scaler_user, int *scaler_id,
> @@ -5422,6 +5435,14 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
>  		return -EINVAL;
>  	}
>  
> +	/*
> +	 * If we are upscaling, and the scaling ratios are integer, we can
> +	 * pick nearest-neighbour method in HW for scaling, which produces
> +	 * blurless outputs in such scenarios.
> +	 */
> +	if (scaling_ratio_integer(src_w, dst_w, src_h, dst_h))
> +		scaler_state->integer_scaling = true;
> +
>  	/*
>  	 * if plane is being disabled or scaler is no more required or force detach
>  	 *  - free scaler binded to this plane/crtc
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
> index 3c1a5f3e1d22..6bb32fbf3153 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -613,6 +613,13 @@ struct intel_crtc_scaler_state {
>  
>  	/* scaler used by crtc for panel fitting purpose */
>  	int scaler_id;
> +
> +	/*
> +	 * Nearest-neighbor method of upscaling gieves blurless output if
> +	 * the upscaling ratio is a complete integer. This bool is to indicate
> +	 * such an opportunity.
> +	 */
> +	bool integer_scaling;
>  };
>  
>  /* drm_mode->private_flags */

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




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

  Powered by Linux