On Thu, 31 Oct 2024, Ville Syrjala <ville.syrjala@xxxxxxxxxxxxxxx> wrote: > From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > > We'll be wanting reprogram the MBUS_CTL register during an *to* :) And the same nitpick about intel_display. Reviewed-by: Jani Nikula <jani.nikula@xxxxxxxxx> > upcoming MBUS sanitation stage. Extract the reprogramming > into a helper that doesn't depend on the full atomic state > so that it can be reused. > > Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > --- > drivers/gpu/drm/i915/display/skl_watermark.c | 34 ++++++++++++-------- > 1 file changed, 21 insertions(+), 13 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/skl_watermark.c b/drivers/gpu/drm/i915/display/skl_watermark.c > index 8a31508f94bb..2eefeff6693a 100644 > --- a/drivers/gpu/drm/i915/display/skl_watermark.c > +++ b/drivers/gpu/drm/i915/display/skl_watermark.c > @@ -3427,22 +3427,13 @@ static enum pipe intel_mbus_joined_pipe(struct intel_atomic_state *state, > return INVALID_PIPE; > } > > -static void intel_dbuf_mbus_join_update(struct intel_atomic_state *state, > - enum pipe pipe) > +static void mbus_ctl_join_update(struct drm_i915_private *i915, > + const struct intel_dbuf_state *dbuf_state, > + enum pipe pipe) > { > - struct drm_i915_private *i915 = to_i915(state->base.dev); > - const struct intel_dbuf_state *old_dbuf_state = > - intel_atomic_get_old_dbuf_state(state); > - const struct intel_dbuf_state *new_dbuf_state = > - intel_atomic_get_new_dbuf_state(state); > u32 mbus_ctl; > > - drm_dbg_kms(&i915->drm, "Changing mbus joined: %s -> %s (pipe: %c)\n", > - str_yes_no(old_dbuf_state->joined_mbus), > - str_yes_no(new_dbuf_state->joined_mbus), > - pipe != INVALID_PIPE ? pipe_name(pipe) : '*'); > - > - if (new_dbuf_state->joined_mbus) > + if (dbuf_state->joined_mbus) > mbus_ctl = MBUS_HASHING_MODE_1x4 | MBUS_JOIN; > else > mbus_ctl = MBUS_HASHING_MODE_2x2; > @@ -3457,6 +3448,23 @@ static void intel_dbuf_mbus_join_update(struct intel_atomic_state *state, > MBUS_JOIN_PIPE_SELECT_MASK, mbus_ctl); > } > > +static void intel_dbuf_mbus_join_update(struct intel_atomic_state *state, > + enum pipe pipe) > +{ > + struct drm_i915_private *i915 = to_i915(state->base.dev); > + const struct intel_dbuf_state *old_dbuf_state = > + intel_atomic_get_old_dbuf_state(state); > + const struct intel_dbuf_state *new_dbuf_state = > + intel_atomic_get_new_dbuf_state(state); > + > + drm_dbg_kms(&i915->drm, "Changing mbus joined: %s -> %s (pipe: %c)\n", > + str_yes_no(old_dbuf_state->joined_mbus), > + str_yes_no(new_dbuf_state->joined_mbus), > + pipe != INVALID_PIPE ? pipe_name(pipe) : '*'); > + > + mbus_ctl_join_update(i915, new_dbuf_state, pipe); > +} > + > void intel_dbuf_mbus_pre_ddb_update(struct intel_atomic_state *state) > { > const struct intel_dbuf_state *new_dbuf_state = -- Jani Nikula, Intel