drm/msm/sde: update CWB detection logic
Modify CWB use case detection based on encoders on a crtc.
Other than wb parent encoder, if any other drm encoder is
connected to same crtc, treat wb encoder is in clone mode.
Change-Id: I05d7b52887aa01df682fe1e93a205efdcc2fa5c0
Signed-off-by: Prabhanjan Kandula <pkandula@codeaurora.org>
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
diff --git a/drivers/gpu/drm/msm/sde/sde_encoder_phys_wb.c b/drivers/gpu/drm/msm/sde/sde_encoder_phys_wb.c
index 82dd64a..4bbcb3a 100644
--- a/drivers/gpu/drm/msm/sde/sde_encoder_phys_wb.c
+++ b/drivers/gpu/drm/msm/sde/sde_encoder_phys_wb.c
@@ -32,7 +32,6 @@
#define TO_S15D16(_x_) ((_x_) << 7)
-#define MULTIPLE_CONN_DETECTED(x) (x > 1)
/**
* sde_rgb2yuv_601l - rgb to yuv color space conversion matrix
*
@@ -453,11 +452,9 @@
static void _sde_enc_phys_wb_detect_cwb(struct sde_encoder_phys *phys_enc,
struct drm_crtc_state *crtc_state)
{
- struct drm_connector *conn;
- struct drm_connector_state *conn_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;
- int conn_count = 0;
phys_enc->in_clone_mode = false;
@@ -465,21 +462,16 @@
if (!(wb_cfg->features & BIT(SDE_WB_HAS_CWB)))
return;
- /* Count the number of connectors on the given crtc */
- drm_for_each_connector(conn, crtc_state->crtc->dev) {
- conn_state =
- drm_atomic_get_connector_state(crtc_state->state, conn);
- if ((conn->state && conn->state->crtc == crtc_state->crtc) ||
- (conn_state &&
- conn_state->crtc == crtc_state->crtc))
- conn_count++;
+ /* 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;
+ }
}
-
- /* Enable clone mode If crtc has multiple connectors & one is WB */
- if (MULTIPLE_CONN_DETECTED(conn_count))
- phys_enc->in_clone_mode = true;
-
SDE_DEBUG("detect CWB - status:%d\n", phys_enc->in_clone_mode);
}