On Mon, 13 Sep 2021, Ville Syrjala <[email protected]> wrote:
> From: Ville Syrjälä <[email protected]>
>
> Suck the "do we need bigjoiner?" checks into a helper instead of
> duplicating them in two differentt places.

Could've called it intel_dp_need_bigjoiner() but meh.

Reviewed-by: Jani Nikula <[email protected]>


>
> Signed-off-by: Ville Syrjälä <[email protected]>
> ---
>  drivers/gpu/drm/i915/display/intel_dp.c | 19 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
> b/drivers/gpu/drm/i915/display/intel_dp.c
> index 161c33b2c869..e898834cc5f9 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -805,6 +805,17 @@ intel_dp_mode_valid_downstream(struct intel_connector 
> *connector,
>       return MODE_OK;
>  }
>  
> +static bool intel_dp_use_bigjoiner(struct intel_dp *intel_dp,
> +                                int hdisplay, int clock)
> +{
> +     struct drm_i915_private *i915 = dp_to_i915(intel_dp);
> +
> +     if (!intel_dp_can_bigjoiner(intel_dp))
> +             return false;
> +
> +     return clock > i915->max_dotclk_freq || hdisplay > 5120;
> +}
> +
>  static enum drm_mode_status
>  intel_dp_mode_valid(struct drm_connector *connector,
>                   struct drm_display_mode *mode)
> @@ -840,8 +851,7 @@ intel_dp_mode_valid(struct drm_connector *connector,
>       if (mode->clock < 10000)
>               return MODE_CLOCK_LOW;
>  
> -     if ((target_clock > max_dotclk || mode->hdisplay > 5120) &&
> -         intel_dp_can_bigjoiner(intel_dp)) {
> +     if (intel_dp_use_bigjoiner(intel_dp, mode->hdisplay, target_clock)) {
>               bigjoiner = true;
>               max_dotclk *= 2;
>       }
> @@ -1457,9 +1467,8 @@ intel_dp_compute_link_config(struct intel_encoder 
> *encoder,
>                   limits.max_lane_count, limits.max_rate,
>                   limits.max_bpp, adjusted_mode->crtc_clock);
>  
> -     if ((adjusted_mode->crtc_clock > i915->max_dotclk_freq ||
> -          adjusted_mode->crtc_hdisplay > 5120) &&
> -         intel_dp_can_bigjoiner(intel_dp))
> +     if (intel_dp_use_bigjoiner(intel_dp, adjusted_mode->crtc_hdisplay,
> +                                adjusted_mode->crtc_clock))
>               pipe_config->bigjoiner = true;
>  
>       /*

-- 
Jani Nikula, Intel Open Source Graphics Center

Reply via email to