disp: msm: sde: fix cwb enable detection logic

Existing cwb enable detection logic relies on
crtc id matching with each encoder->crtc. This
may not be available on first power on commit
because it updated after encoder_atomic_check
call. This patch fixes the cwb enable detection
logic by checking the encoder_mask on crtc_state.

It also fixes the cwb concurrency with mode_set
and secure display.

Change-Id: I70f656dd9e7d94d3ba761c25745b473a1c204173
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
This commit is contained in:
Dhaval Patel 2020-06-16 00:03:46 -07:00
parent 0545182f17
commit 1eda6392b0

View File

@ -589,26 +589,16 @@ static void sde_encoder_phys_wb_setup_cdp(struct sde_encoder_phys *phys_enc,
static void _sde_enc_phys_wb_detect_cwb(struct sde_encoder_phys *phys_enc,
struct drm_crtc_state *crtc_state)
{
struct drm_encoder *encoder;
struct sde_encoder_phys_wb *wb_enc = to_sde_encoder_phys_wb(phys_enc);
const struct sde_wb_cfg *wb_cfg = wb_enc->hw_wb->caps;
phys_enc->in_clone_mode = false;
u32 encoder_mask = 0;
/* Check if WB has CWB support */
if (!(wb_cfg->features & BIT(SDE_WB_HAS_CWB)))
return;
/* if any other encoder is connected to same crtc enable clone mode*/
drm_for_each_encoder(encoder, crtc_state->crtc->dev) {
if (encoder->crtc != crtc_state->crtc)
continue;
if (phys_enc->parent != encoder) {
phys_enc->in_clone_mode = true;
break;
}
if (wb_cfg->features & BIT(SDE_WB_HAS_CWB)) {
encoder_mask = crtc_state->encoder_mask;
encoder_mask &= ~drm_encoder_mask(phys_enc->parent);
}
phys_enc->in_clone_mode = encoder_mask ? true : false;
SDE_DEBUG("detect CWB - status:%d\n", phys_enc->in_clone_mode);
}
@ -1296,6 +1286,15 @@ static int sde_encoder_phys_wb_wait_for_commit_done(
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)
{
if (!atomic_read(&phys_enc->pending_retire_fence_cnt))
return 0;
return _sde_encoder_phys_wb_wait_for_commit_done(phys_enc, true);
}
/**
* sde_encoder_phys_wb_prepare_for_kickoff - pre-kickoff processing
* @phys_enc: Pointer to physical encoder
@ -1724,6 +1723,7 @@ static void sde_encoder_phys_wb_init_ops(struct sde_encoder_phys_ops *ops)
ops->atomic_check = sde_encoder_phys_wb_atomic_check;
ops->get_hw_resources = sde_encoder_phys_wb_get_hw_resources;
ops->wait_for_commit_done = sde_encoder_phys_wb_wait_for_commit_done;
ops->wait_for_tx_complete = sde_encoder_phys_wb_wait_for_tx_complete;
ops->prepare_for_kickoff = sde_encoder_phys_wb_prepare_for_kickoff;
ops->handle_post_kickoff = sde_encoder_phys_wb_handle_post_kickoff;
ops->trigger_flush = sde_encoder_phys_wb_trigger_flush;