On Tue, Jan 18, 2022 at 12:48:37PM +0200, Stanislav Lisovskiy wrote: > There might be various logical contructs when we might want > to enable async flip, so lets calculate those and set this > flag, so that there is no need in long conditions in other > places. > > v2: - Set do_async_flip flag to False, if no async flip needed. > Lets not rely that it will be 0-initialized, but set > explicitly, so that the logic is clear as well. > > Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@xxxxxxxxx> > --- > drivers/gpu/drm/i915/display/intel_atomic_plane.c | 2 +- > drivers/gpu/drm/i915/display/intel_display.c | 5 +++++ > drivers/gpu/drm/i915/display/intel_display_types.h | 3 +++ > 3 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c > index d1344e9c06de..87bad665a2c8 100644 > --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c > +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c > @@ -491,7 +491,7 @@ void intel_plane_update_arm(struct intel_plane *plane, > > trace_intel_plane_update_arm(&plane->base, crtc); > > - if (crtc_state->uapi.async_flip && plane->async_flip) > + if (plane_state->do_async_flip) > plane->async_flip(plane, crtc_state, plane_state, true); > else > plane->update_arm(plane, crtc_state, plane_state); > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c > index 0964b2403e2d..f3ce29c42bc3 100644 > --- a/drivers/gpu/drm/i915/display/intel_display.c > +++ b/drivers/gpu/drm/i915/display/intel_display.c > @@ -5027,6 +5027,11 @@ int intel_plane_atomic_calc_changes(const struct intel_crtc_state *old_crtc_stat > needs_scaling(new_plane_state)))) > new_crtc_state->disable_lp_wm = true; > > + if (new_crtc_state->uapi.async_flip && plane->async_flip) > + new_plane_state->do_async_flip = true; > + else > + new_plane_state->do_async_flip = false; Clearing the flag should probably be in intel_plane_duplicate_state(). The decision to call intel_crtc_{enable,disable}_flip_done() should also be based on do_async_flip, otherwise we're going to try to complete the flip using two different mechanisms when we decide to do a sync flip instead of an async flip. Otherwise lgtm. > + > return 0; > } > > diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h > index 41e3dd25a78f..6b107872ad39 100644 > --- a/drivers/gpu/drm/i915/display/intel_display_types.h > +++ b/drivers/gpu/drm/i915/display/intel_display_types.h > @@ -634,6 +634,9 @@ struct intel_plane_state { > > struct intel_fb_view view; > > + /* Indicates if async flip is required */ > + bool do_async_flip; > + > /* Plane pxp decryption state */ > bool decrypt; > > -- > 2.24.1.485.gad05a3d8e5 -- Ville Syrjälä Intel