Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ba1216fb authored by Prabhanjan Kandula's avatar Prabhanjan Kandula Committed by Jayant Shekhar
Browse files

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: default avatarPrabhanjan Kandula <pkandula@codeaurora.org>
Signed-off-by: default avatarJayant Shekhar <jshekhar@codeaurora.org>
parent 7d5af490
Loading
Loading
Loading
Loading
+9 −17
Original line number Diff line number Diff line
@@ -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_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_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,20 +462,15 @@ static void _sde_enc_phys_wb_detect_cwb(struct sde_encoder_phys *phys_enc,
	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++;
	}


	/* Enable clone mode If crtc has multiple connectors & one is WB */
	if (MULTIPLE_CONN_DETECTED(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;
		}
	}

	SDE_DEBUG("detect CWB - status:%d\n", phys_enc->in_clone_mode);
}