From: Ville Syrjälä <[email protected]>

If no planes appear in an async flip commit there will be
no flip done interrupt. Complete the commit by hand in
that case. Shouldn't really matter where we do this exactly,
but just before the wait stuff near the end of the commit
seems reasonable.

This can't happen via the legacy page flip ioctl path,
but nothing prevents fully no-op (as far as planes are
concerned) "async flips" via the atomic ioctl.

TODO: igt tests for atomic+async uapi don't really exist :(

Cc: [email protected]
Cc: André Almeida <[email protected]>
Cc: Boris Brezillon <[email protected]>
Cc: Christopher Snowhill <[email protected]>
Cc: Dave Stevenson <[email protected]>
Cc: Dharma Balasubiramani <[email protected]>
Cc: Dmitry Baryshkov <[email protected]>
Cc: [email protected]
Cc: Gustavo Padovan <[email protected]>
Cc: Huacai Chen <[email protected]>
Cc: Icenowy Zheng <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: Jianmin Lv <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: Liviu Dudau <[email protected]>
Cc: Maíra Canal <[email protected]>
Cc: Manikandan Muralidharan <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Mingcong Bai <[email protected]>
Cc: [email protected]
Cc: Qianhai Wu <[email protected]>
Cc: Raspberry Pi Kernel Maintenance <[email protected]>
Cc: Simon Ser <[email protected]>
Cc: [email protected]
Cc: Xaver Hugl <[email protected]>
Cc: Xi Ruoyao <[email protected]>
Signed-off-by: Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 38 ++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index f4d9148efde3..afaaf3fc4646 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -1190,6 +1190,42 @@ static void intel_crtc_disable_flip_done(struct 
intel_atomic_state *state,
        }
 }
 
+static void intel_crtc_complete_noop_async_flip(struct intel_crtc_state 
*crtc_state)
+{
+       struct intel_display *display = to_intel_display(crtc_state);
+       struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+
+       if (!crtc_state->do_async_flip)
+               return;
+
+       /*
+        * If there are planes actually performing the async flip then
+        * the commit will be completed via the flip done interrupt
+        * handler. For a fully no-op "async flip" the commit must
+        * be completed by hand as no interrupt will be raised.
+        */
+       if (crtc_state->update_planes)
+               return;
+
+       if (crtc_state->uapi.event) {
+               spin_lock_irq(&display->drm->event_lock);
+               drm_crtc_send_vblank_event(&crtc->base,
+                                          crtc_state->uapi.event);
+               spin_unlock_irq(&display->drm->event_lock);
+
+               crtc_state->uapi.event = NULL;
+       }
+}
+
+static void intel_atomic_complete_noop_async_flips(struct intel_atomic_state 
*state)
+{
+       struct intel_crtc_state *new_crtc_state;
+       struct intel_crtc *crtc;
+
+       for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state)
+               intel_crtc_complete_noop_async_flip(new_crtc_state);
+}
+
 static void intel_crtc_async_flip_disable_wa(struct intel_atomic_state *state,
                                             struct intel_crtc *crtc)
 {
@@ -7852,6 +7888,8 @@ static void intel_atomic_commit_tail(struct 
intel_atomic_state *state)
        if (intel_display_power_dc3co_allowed(display))
                intel_cmtg_program(state);
 
+       intel_atomic_complete_noop_async_flips(state);
+
        intel_wait_for_vblank_workers(state);
 
        /* FIXME: We should call drm_atomic_helper_commit_hw_done() here
-- 
2.56.0

Reply via email to