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

Commit 9806639c authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "disp: msm: sde: modify clone_mode in wb phys_enc post cwb detection logic"

parents 22f326ff 6979db41
Loading
Loading
Loading
Loading
+13 −11
Original line number Diff line number Diff line
@@ -589,18 +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,
static bool _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;

	/* Check if WB has CWB support */
	if (!(wb_cfg->features & BIT(SDE_WB_HAS_CWB)))
		return;
		return false;

	/* if any other encoder is connected to same crtc enable clone mode*/
	drm_for_each_encoder(encoder, crtc_state->crtc->dev) {
@@ -608,12 +606,11 @@ static void _sde_enc_phys_wb_detect_cwb(struct sde_encoder_phys *phys_enc,
			continue;

		if (phys_enc->parent != encoder) {
			phys_enc->in_clone_mode = true;
			break;
			return true;
		}
	}

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

static int _sde_enc_phys_wb_validate_cwb(struct sde_encoder_phys *phys_enc,
@@ -709,15 +706,20 @@ static int sde_encoder_phys_wb_atomic_check(
		return -EINVAL;
	}

	clone_mode_curr = phys_enc->in_clone_mode;

	_sde_enc_phys_wb_detect_cwb(phys_enc, crtc_state);
	clone_mode_curr = _sde_enc_phys_wb_detect_cwb(phys_enc, crtc_state);

	if (clone_mode_curr && !phys_enc->in_clone_mode) {
	/**
	 * Fail the WB commit when there is a CWB session enabled in HW.
	 * CWB session needs to be disabled since WB and CWB share the same
	 * writeback hardware block.
	 */
	if (phys_enc->in_clone_mode && !clone_mode_curr) {
		SDE_ERROR("WB commit before CWB disable\n");
		return -EINVAL;
	}

	SDE_DEBUG("detect CWB - status:%d\n", clone_mode_curr);
	phys_enc->in_clone_mode = clone_mode_curr;
	memset(&wb_roi, 0, sizeof(struct sde_rect));

	rc = sde_wb_connector_state_get_output_roi(conn_state, &wb_roi);