On Fri, Jan 24, 2025 at 08:30:09PM +0530, Ankit Nautiyal wrote: > DP sink uses MSA timings for the fixed refresh rate mode. > For using VRR timing generator for fixed refresh rate mode, the HW prepares > the Vtotal for the MSA from the VMAX register. Since the MSA Vtotal is > one-based while Vmax is zero-based we need to take care of this while > setting Vtotal value for the fixed refresh rate mode. > > Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@xxxxxxxxx> > --- > drivers/gpu/drm/i915/display/intel_vrr.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c > index f485c3e35d68..5a1b0d61c483 100644 > --- a/drivers/gpu/drm/i915/display/intel_vrr.c > +++ b/drivers/gpu/drm/i915/display/intel_vrr.c > @@ -264,6 +264,18 @@ void intel_vrr_compute_vrr_timings(struct intel_crtc_state *crtc_state, int vmin > crtc_state->mode_flags |= I915_MODE_FLAG_VRR; > } > > +static > +int adjust_vtotal_for_msa(int vtotal) > +{ > + /* > + * DP sink uses MSA timings for the fixed refresh rate mode. > + * The HW prepares the Vtotal for the MSA from the VMAX register. > + * Since the MSA Vtotal is one-based while Vmax is zero-based we need to > + * take care of this while setting Vtotal value. Hang on. If the hardware is broken enough that it forgets to put the +1 into MSA then that means we should be increasing vmax if we want the proper number to appear there. But that would actually just increase the length of the frame and the MSA would still be off by one. > + */ > + return vtotal - 1; > +} > + > static > int intel_vrr_compute_vmin(struct intel_crtc_state *crtc_state) > { > @@ -274,7 +286,7 @@ int intel_vrr_compute_vmin(struct intel_crtc_state *crtc_state) > * For this set the vmin as crtc_vtotal. With this we never need to > * change anything to do with the guardband. > */ > - return crtc_state->hw.adjusted_mode.crtc_vtotal; > + return adjust_vtotal_for_msa(crtc_state->hw.adjusted_mode.crtc_vtotal); > } > > static > -- > 2.45.2 -- Ville Syrjälä Intel