On Tue, Dec 19, 2023 at 03:07:56PM +0200, Ville Syrjala wrote: > From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > > Pull all the state swap stuff into its own function to declutter > intel_atomic_commit() a bit. > > Note that currently the state swap is spread across both > sides of the unprepare branch in intel_atomic_commit(), but > we can pull all of it ahead a bit since we bail on the first > error, and thus there is no change in behaviour from the > reordering. For that one, guess can give r-b rightaway, will check global state serialize then, seems to be major change.. Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@xxxxxxxxx> > > Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > --- > drivers/gpu/drm/i915/display/intel_display.c | 23 +++++++++++++++----- > 1 file changed, 18 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c > index 46eff0ee5519..bf37bfcf350e 100644 > --- a/drivers/gpu/drm/i915/display/intel_display.c > +++ b/drivers/gpu/drm/i915/display/intel_display.c > @@ -7311,6 +7311,23 @@ static int intel_atomic_setup_commit(struct intel_atomic_state *state, bool nonb > return 0; > } > > +static int intel_atomic_swap_state(struct intel_atomic_state *state) > +{ > + int ret; > + > + ret = drm_atomic_helper_swap_state(&state->base, true); > + if (ret) > + return ret; > + > + intel_atomic_swap_global_state(state); > + > + intel_shared_dpll_swap_state(state); > + > + intel_atomic_track_fbs(state); > + > + return 0; > +} > + > int intel_atomic_commit(struct drm_device *dev, struct drm_atomic_state *_state, > bool nonblock) > { > @@ -7358,9 +7375,7 @@ int intel_atomic_commit(struct drm_device *dev, struct drm_atomic_state *_state, > > ret = intel_atomic_setup_commit(state, nonblock); > if (!ret) > - ret = drm_atomic_helper_swap_state(&state->base, true); > - if (!ret) > - intel_atomic_swap_global_state(state); > + ret = intel_atomic_swap_state(state); > > if (ret) { > struct intel_crtc_state *new_crtc_state; > @@ -7374,8 +7389,6 @@ int intel_atomic_commit(struct drm_device *dev, struct drm_atomic_state *_state, > intel_runtime_pm_put(&dev_priv->runtime_pm, state->wakeref); > return ret; > } > - intel_shared_dpll_swap_state(state); > - intel_atomic_track_fbs(state); > > drm_atomic_state_get(&state->base); > INIT_WORK(&state->base.commit_work, intel_atomic_commit_work); > -- > 2.41.0 >