On Wed, 14 Apr 2021, Ville Syrjala <ville.syrjala@xxxxxxxxxxxxxxx> wrote: > From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > > Pull the fbc enable vs. disable stuff into a small helper so > we don't have to have it pollute the higher level modeset code. > > Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> Reviewed-by: Jani Nikula <jani.nikula@xxxxxxxxx> > --- > drivers/gpu/drm/i915/display/intel_display.c | 5 +--- > drivers/gpu/drm/i915/display/intel_fbc.c | 26 ++++++++++++++++++-- > drivers/gpu/drm/i915/display/intel_fbc.h | 2 +- > 3 files changed, 26 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c > index 411b46c012f8..a4b8fb5c20f0 100644 > --- a/drivers/gpu/drm/i915/display/intel_display.c > +++ b/drivers/gpu/drm/i915/display/intel_display.c > @@ -9799,10 +9799,7 @@ static void intel_update_crtc(struct intel_atomic_state *state, > intel_encoders_update_pipe(state, crtc); > } > > - if (new_crtc_state->update_pipe && !new_crtc_state->enable_fbc) > - intel_fbc_disable(crtc); > - else > - intel_fbc_enable(state, crtc); > + intel_fbc_update(state, crtc); > > /* Perform vblank evasion around commit operation */ > intel_pipe_update_start(new_crtc_state); > diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c > index 178243a6d3a2..4968e79a6235 100644 > --- a/drivers/gpu/drm/i915/display/intel_fbc.c > +++ b/drivers/gpu/drm/i915/display/intel_fbc.c > @@ -1250,8 +1250,8 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv, > * intel_fbc_enable multiple times for the same pipe without an > * intel_fbc_disable in the middle, as long as it is deactivated. > */ > -void intel_fbc_enable(struct intel_atomic_state *state, > - struct intel_crtc *crtc) > +static void intel_fbc_enable(struct intel_atomic_state *state, > + struct intel_crtc *crtc) > { > struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); > struct intel_plane *plane = to_intel_plane(crtc->base.primary); > @@ -1324,6 +1324,28 @@ void intel_fbc_disable(struct intel_crtc *crtc) > mutex_unlock(&fbc->lock); > } > > +/** > + * intel_fbc_update: enable/disable FBC on the CRTC > + * @state: atomic state > + * @crtc: the CRTC > + * > + * This function checks if the given CRTC was chosen for FBC, then enables it if > + * possible. Notice that it doesn't activate FBC. It is valid to call > + * intel_fbc_update multiple times for the same pipe without an > + * intel_fbc_disable in the middle. > + */ > +void intel_fbc_update(struct intel_atomic_state *state, > + struct intel_crtc *crtc) > +{ > + const struct intel_crtc_state *crtc_state = > + intel_atomic_get_new_crtc_state(state, crtc); > + > + if (crtc_state->update_pipe && !crtc_state->enable_fbc) > + intel_fbc_disable(crtc); > + else > + intel_fbc_enable(state, crtc); > +} > + > /** > * intel_fbc_global_disable - globally disable FBC > * @dev_priv: i915 device instance > diff --git a/drivers/gpu/drm/i915/display/intel_fbc.h b/drivers/gpu/drm/i915/display/intel_fbc.h > index 6dc1edefe81b..b97d908738e6 100644 > --- a/drivers/gpu/drm/i915/display/intel_fbc.h > +++ b/drivers/gpu/drm/i915/display/intel_fbc.h > @@ -24,7 +24,7 @@ bool intel_fbc_pre_update(struct intel_atomic_state *state, > void intel_fbc_post_update(struct intel_atomic_state *state, > struct intel_crtc *crtc); > void intel_fbc_init(struct drm_i915_private *dev_priv); > -void intel_fbc_enable(struct intel_atomic_state *state, > +void intel_fbc_update(struct intel_atomic_state *state, > struct intel_crtc *crtc); > void intel_fbc_disable(struct intel_crtc *crtc); > void intel_fbc_global_disable(struct drm_i915_private *dev_priv); -- Jani Nikula, Intel Open Source Graphics Center _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx