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

Sharma, Shashank shashank.sharma at intel.com
Wed Sep 4 10:38:05 UTC 2019


On 9/4/2019 1:08 PM, Ramalingam C wrote:
> On 2019-09-03 at 22:22:26 +0530, Shashank Sharma 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 at intel.com>
>> Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
>> Cc: Daniel Vetter <daniel.vetter at intel.com>
>> Cc: Vivi, Rodrigo <rodrigo.vivi at intel.com>
>> Signed-off-by: Shashank Sharma <shashank.sharma at intel.com>
>> ---
>>   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
>> +scaling_ratio_integer(int src_w, int dst_w, int src_h, int dst_h)
> Just a suggestion: scaling_ratio_is_integer() might sound better here!?
Agree, certainly sounds better.
>> +{
>> +	/* 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
> Typo: Gives.
got it.
>
> -Ram
>> +	 * the upscaling ratio is a complete integer. This bool is to indicate
>> +	 * such an opportunity.
>> +	 */
>> +	bool integer_scaling;
>>   };
>>   
>>   /* drm_mode->private_flags */
>> -- 
>> 2.17.1
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx


More information about the Intel-gfx mailing list