Re: [PATCH 26/26] drm/i915: Round TMDS clock to nearest

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

 



On Tue, 03 May 2022, Ville Syrjala <ville.syrjala@xxxxxxxxxxxxxxx> wrote:
> From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
>
> Use round-to-nearest behavour when calculating the TMDS clock.
> Matches what we co for most other clock related things.

*do

Acked-by: Jani Nikula <jani.nikula@xxxxxxxxx>


>
> Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/display/intel_ddi.c  | 3 ++-
>  drivers/gpu/drm/i915/display/intel_hdmi.c | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 0cf2d4fba6a8..8b3e6ae85a08 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -330,7 +330,8 @@ int intel_crtc_dotclock(const struct intel_crtc_state *pipe_config)
>  		dotclock = intel_dotclock_calculate(pipe_config->port_clock,
>  						    &pipe_config->dp_m_n);
>  	else if (pipe_config->has_hdmi_sink && pipe_config->pipe_bpp > 24)
> -		dotclock = pipe_config->port_clock * 24 / pipe_config->pipe_bpp;
> +		dotclock = DIV_ROUND_CLOSEST(pipe_config->port_clock * 24,
> +					     pipe_config->pipe_bpp);
>  	else
>  		dotclock = pipe_config->port_clock;
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
> index 1ae09431f53a..0b04b3800cd4 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
> @@ -1891,7 +1891,7 @@ int intel_hdmi_tmds_clock(int clock, int bpc, bool ycbcr420_output)
>  	 *  1.5x for 12bpc
>  	 *  1.25x for 10bpc
>  	 */
> -	return clock * bpc / 8;
> +	return DIV_ROUND_CLOSEST(clock * bpc, 8);
>  }
>  
>  static bool intel_hdmi_source_bpc_possible(struct drm_i915_private *i915, int bpc)

-- 
Jani Nikula, Intel Open Source Graphics Center




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

  Powered by Linux