On Mon, Feb 24, 2025 at 11:47:00AM +0530, Ankit Nautiyal wrote:
> Separate out functions for computing cmrr and vrr timings.
> 
> Signed-off-by: Ankit Nautiyal <ankit.k.nauti...@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_vrr.c | 45 +++++++++++++++---------
>  1 file changed, 28 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c 
> b/drivers/gpu/drm/i915/display/intel_vrr.c
> index a435b8d5b631..008a9c3e152d 100644
> --- a/drivers/gpu/drm/i915/display/intel_vrr.c
> +++ b/drivers/gpu/drm/i915/display/intel_vrr.c
> @@ -222,6 +222,30 @@ cmrr_get_vtotal(struct intel_crtc_state *crtc_state, 
> bool video_mode_required)
>       return vtotal;
>  }
>  
> +static
> +void intel_vrr_compute_cmrr_timings(struct intel_crtc_state *crtc_state)
> +{
> +     crtc_state->vrr.enable = true;
> +     crtc_state->cmrr.enable = true;
> +     /*
> +      * TODO: Compute precise target refresh rate to determine
> +      * if video_mode_required should be true. Currently set to
> +      * false due to uncertainty about the precise target
> +      * refresh Rate.
> +      */
> +     crtc_state->vrr.vmax = cmrr_get_vtotal(crtc_state, false);
> +     crtc_state->vrr.vmin = crtc_state->vrr.vmax;
> +     crtc_state->vrr.flipline = crtc_state->vrr.vmin;
> +     crtc_state->mode_flags |= I915_MODE_FLAG_VRR;
> +}
> +
> +static
> +void intel_vrr_compute_vrr_timings(struct intel_crtc_state *crtc_state)
> +{
> +     crtc_state->vrr.enable = true;
> +     crtc_state->mode_flags |= I915_MODE_FLAG_VRR;
> +}

The name of that function is a bit misleading now, but I guess
it'll get more ppropriate once we get further along.

Reviewed-by: Ville Syrjälä <ville.syrj...@linux.intel.com>

> +
>  static
>  int intel_vrr_compute_vmin(struct intel_connector *connector,
>                          struct drm_display_mode *adjusted_mode)
> @@ -299,23 +323,10 @@ intel_vrr_compute_config(struct intel_crtc_state 
> *crtc_state,
>        */
>       crtc_state->vrr.vmin -= intel_vrr_flipline_offset(display);
>  
> -     if (crtc_state->uapi.vrr_enabled) {
> -             crtc_state->vrr.enable = true;
> -             crtc_state->mode_flags |= I915_MODE_FLAG_VRR;
> -     } else if (is_cmrr_frac_required(crtc_state) && is_edp) {
> -             crtc_state->vrr.enable = true;
> -             crtc_state->cmrr.enable = true;
> -             /*
> -              * TODO: Compute precise target refresh rate to determine
> -              * if video_mode_required should be true. Currently set to
> -              * false due to uncertainty about the precise target
> -              * refresh Rate.
> -              */
> -             crtc_state->vrr.vmax = cmrr_get_vtotal(crtc_state, false);
> -             crtc_state->vrr.vmin = crtc_state->vrr.vmax;
> -             crtc_state->vrr.flipline = crtc_state->vrr.vmin;
> -             crtc_state->mode_flags |= I915_MODE_FLAG_VRR;
> -     }
> +     if (crtc_state->uapi.vrr_enabled)
> +             intel_vrr_compute_vrr_timings(crtc_state);
> +     else if (is_cmrr_frac_required(crtc_state) && is_edp)
> +             intel_vrr_compute_cmrr_timings(crtc_state);
>  
>       if (HAS_AS_SDP(display)) {
>               crtc_state->vrr.vsync_start =
> -- 
> 2.45.2

-- 
Ville Syrjälä
Intel

Reply via email to