Skip to content

Commit

Permalink
drm/i915: Introduce do_async_flip flag to intel_plane_state
Browse files Browse the repository at this point in the history
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.

v3: - Clear do_async_flip in intel_plane_duplicate_state(Ville Syrjälä)
    - Check with do_async_flip also when calling
      intel_crtc_{enable,disable}_flip_done(Ville Syrjälä)

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220124090653.14547-3-stanislav.lisovskiy@intel.com
  • Loading branch information
Stanislav Lisovskiy committed Jan 26, 2022
1 parent 41e096d commit 20f6ac2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion drivers/gpu/drm/i915/display/intel_atomic_plane.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ intel_plane_duplicate_state(struct drm_plane *plane)
intel_state->ggtt_vma = NULL;
intel_state->dpt_vma = NULL;
intel_state->flags = 0;
intel_state->do_async_flip = false;

/* add reference to fb */
if (intel_state->hw.fb)
Expand Down Expand Up @@ -491,7 +492,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);
Expand Down
9 changes: 7 additions & 2 deletions drivers/gpu/drm/i915/display/intel_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,8 @@ static void intel_crtc_enable_flip_done(struct intel_atomic_state *state,
for_each_new_intel_plane_in_state(state, plane, plane_state, i) {
if (plane->enable_flip_done &&
plane->pipe == crtc->pipe &&
update_planes & BIT(plane->id))
update_planes & BIT(plane->id) &&
plane_state->do_async_flip)
plane->enable_flip_done(plane);
}
}
Expand All @@ -1387,7 +1388,8 @@ static void intel_crtc_disable_flip_done(struct intel_atomic_state *state,
for_each_new_intel_plane_in_state(state, plane, plane_state, i) {
if (plane->disable_flip_done &&
plane->pipe == crtc->pipe &&
update_planes & BIT(plane->id))
update_planes & BIT(plane->id) &&
plane_state->do_async_flip)
plane->disable_flip_done(plane);
}
}
Expand Down Expand Up @@ -5024,6 +5026,9 @@ 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;

return 0;
}

Expand Down
3 changes: 3 additions & 0 deletions drivers/gpu/drm/i915/display/intel_display_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 20f6ac2

Please sign in to comment.