From eeb66b8516fa5a3aee22fd7063e4163e54092230 Mon Sep 17 00:00:00 2001 From: Veera Sundaram Sankaran Date: Thu, 24 Jun 2021 10:07:20 -0700 Subject: [PATCH] disp: msm: sde: wait for tx-done during cwb disable Currently, cwb disable path issues a cleanup flush & waits for the commit-done. Wait for the tx-done to ensure the transfer is complete. Change-Id: I509711c157f1d6646646ad96ed140d6bc76d2dba Signed-off-by: Veera Sundaram Sankaran --- msm/sde/sde_encoder_phys_wb.c | 34 ++++++++++++++++------------------ msm/sde/sde_kms.c | 3 ++- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/msm/sde/sde_encoder_phys_wb.c b/msm/sde/sde_encoder_phys_wb.c index 02f9d5d5f6..9cc8d0075b 100644 --- a/msm/sde/sde_encoder_phys_wb.c +++ b/msm/sde/sde_encoder_phys_wb.c @@ -1442,7 +1442,7 @@ static void _sde_encoder_phys_wb_reset_state( } static int _sde_encoder_phys_wb_wait_for_commit_done( - struct sde_encoder_phys *phys_enc, bool is_disable) + struct sde_encoder_phys *phys_enc, bool force_wait) { struct sde_encoder_phys_wb *wb_enc = to_sde_encoder_phys_wb(phys_enc); u32 event = 0; @@ -1457,9 +1457,9 @@ static int _sde_encoder_phys_wb_wait_for_commit_done( SDE_EVT32(DRMID(phys_enc->parent), WBID(wb_enc), phys_enc->in_clone_mode, atomic_read(&phys_enc->pending_retire_fence_cnt), - !!wb_enc->wb_fb, is_disable); + !!wb_enc->wb_fb, force_wait); - if (!is_disable && phys_enc->in_clone_mode && + if (!force_wait && phys_enc->in_clone_mode && (atomic_read(&phys_enc->pending_retire_fence_cnt) <= 1)) goto skip_wait; @@ -1515,30 +1515,28 @@ skip_wait: * sde_encoder_phys_wb_wait_for_commit_done - wait until request is committed * @phys_enc: Pointer to physical encoder */ -static int sde_encoder_phys_wb_wait_for_commit_done( - struct sde_encoder_phys *phys_enc) +static int sde_encoder_phys_wb_wait_for_commit_done(struct sde_encoder_phys *phys_enc) { - int rc; - - if (phys_enc->enable_state == SDE_ENC_DISABLING && - phys_enc->in_clone_mode) { - rc = _sde_encoder_phys_wb_wait_for_commit_done(phys_enc, true); - _sde_encoder_phys_wb_reset_state(phys_enc); - sde_encoder_phys_wb_irq_ctrl(phys_enc, false); - } else { - rc = _sde_encoder_phys_wb_wait_for_commit_done(phys_enc, false); - } - - return rc; + return _sde_encoder_phys_wb_wait_for_commit_done(phys_enc, false); } static int sde_encoder_phys_wb_wait_for_tx_complete( struct sde_encoder_phys *phys_enc) { + int rc; + if (!atomic_read(&phys_enc->pending_retire_fence_cnt)) return 0; - return _sde_encoder_phys_wb_wait_for_commit_done(phys_enc, true); + rc = _sde_encoder_phys_wb_wait_for_commit_done(phys_enc, true); + + /* cleanup for cwb disable case */ + if ((phys_enc->enable_state == SDE_ENC_DISABLING) && phys_enc->in_clone_mode) { + _sde_encoder_phys_wb_reset_state(phys_enc); + sde_encoder_phys_wb_irq_ctrl(phys_enc, false); + } + + return rc; } /** diff --git a/msm/sde/sde_kms.c b/msm/sde/sde_kms.c index b05d4ff53c..bf375e488c 100644 --- a/msm/sde/sde_kms.c +++ b/msm/sde/sde_kms.c @@ -1582,7 +1582,8 @@ static void sde_kms_wait_for_commit_done(struct msm_kms *kms, * mode panels. This may be a no-op for command mode panels. */ SDE_EVT32_VERBOSE(DRMID(crtc)); - ret = sde_encoder_wait_for_event(encoder, MSM_ENC_COMMIT_DONE); + ret = sde_encoder_wait_for_event(encoder, cwb_disabling ? + MSM_ENC_TX_COMPLETE : MSM_ENC_COMMIT_DONE); if (ret && ret != -EWOULDBLOCK) { SDE_ERROR("wait for commit done returned %d\n", ret); sde_crtc_request_frame_reset(crtc, encoder);