> -----Original Message----- > From: Intel-gfx <intel-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of Ville > Syrjala > Sent: Tuesday, June 25, 2024 12:40 AM > To: intel-gfx@xxxxxxxxxxxxxxxxxxxxx > Subject: [PATCH 02/14] drm/i915: Make vrr_{enabling, disabling}() usable > outside intel_display.c > > From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > > Give vrr_enabling() and vrr_disabling() slightly fancier names, and pass in the > whole atomic state so that they'll be easier to use. > We'll need to call at least the disabling part from the DSB code soon enough > (so that we can do vblank evasions/etc. correctly on the DSB). > > Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> Reviewed-by: Animesh Manna <animesh.manna@xxxxxxxxx> > --- > drivers/gpu/drm/i915/display/intel_display.c | 26 +++++++++++++------- > 1 file changed, 17 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_display.c > b/drivers/gpu/drm/i915/display/intel_display.c > index c2c388212e2e..01a5faa3fea5 100644 > --- a/drivers/gpu/drm/i915/display/intel_display.c > +++ b/drivers/gpu/drm/i915/display/intel_display.c > @@ -1014,9 +1014,14 @@ static bool cmrr_params_changed(const struct > intel_crtc_state *old_crtc_state, > old_crtc_state->cmrr.cmrr_n != new_crtc_state- > >cmrr.cmrr_n; } > > -static bool vrr_enabling(const struct intel_crtc_state *old_crtc_state, > - const struct intel_crtc_state *new_crtc_state) > +static bool intel_crtc_vrr_enabling(struct intel_atomic_state *state, > + struct intel_crtc *crtc) > { > + const struct intel_crtc_state *old_crtc_state = > + intel_atomic_get_old_crtc_state(state, crtc); > + const struct intel_crtc_state *new_crtc_state = > + intel_atomic_get_new_crtc_state(state, crtc); > + > if (!new_crtc_state->hw.active) > return false; > > @@ -1026,9 +1031,14 @@ static bool vrr_enabling(const struct > intel_crtc_state *old_crtc_state, > vrr_params_changed(old_crtc_state, new_crtc_state))); } > > -static bool vrr_disabling(const struct intel_crtc_state *old_crtc_state, > - const struct intel_crtc_state *new_crtc_state) > +static bool intel_crtc_vrr_disabling(struct intel_atomic_state *state, > + struct intel_crtc *crtc) > { > + const struct intel_crtc_state *old_crtc_state = > + intel_atomic_get_old_crtc_state(state, crtc); > + const struct intel_crtc_state *new_crtc_state = > + intel_atomic_get_new_crtc_state(state, crtc); > + > if (!old_crtc_state->hw.active) > return false; > > @@ -1181,7 +1191,7 @@ static void intel_pre_plane_update(struct > intel_atomic_state *state, > intel_atomic_get_new_crtc_state(state, crtc); > enum pipe pipe = crtc->pipe; > > - if (vrr_disabling(old_crtc_state, new_crtc_state)) { > + if (intel_crtc_vrr_disabling(state, crtc)) { > intel_vrr_disable(old_crtc_state); > intel_crtc_update_active_timings(old_crtc_state, false); > } > @@ -6830,8 +6840,6 @@ static void commit_pipe_post_planes(struct > intel_atomic_state *state, > struct intel_crtc *crtc) > { > struct drm_i915_private *dev_priv = to_i915(state->base.dev); > - const struct intel_crtc_state *old_crtc_state = > - intel_atomic_get_old_crtc_state(state, crtc); > const struct intel_crtc_state *new_crtc_state = > intel_atomic_get_new_crtc_state(state, crtc); > > @@ -6844,7 +6852,7 @@ static void commit_pipe_post_planes(struct > intel_atomic_state *state, > !intel_crtc_needs_modeset(new_crtc_state)) > skl_detach_scalers(new_crtc_state); > > - if (vrr_enabling(old_crtc_state, new_crtc_state)) > + if (intel_crtc_vrr_enabling(state, crtc)) > intel_vrr_enable(new_crtc_state); > } > > @@ -6944,7 +6952,7 @@ static void intel_update_crtc(struct > intel_atomic_state *state, > * > * FIXME Should be synchronized with the start of vblank somehow... > */ > - if (vrr_enabling(old_crtc_state, new_crtc_state) || > + if (intel_crtc_vrr_enabling(state, crtc) || > new_crtc_state->update_m_n || new_crtc_state->update_lrr) > intel_crtc_update_active_timings(new_crtc_state, > new_crtc_state->vrr.enable); > -- > 2.44.2