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

Commit 85d278bd authored by Christopher Braga's avatar Christopher Braga
Browse files

drm/msm/sde: Prevent modeset resource management on encoders in off state



Currently pre and post modeset resource management can be performed on
virtual encoders regardless of them having a physical encoder tied to
them. This operation is invalid, and can result in cascading and fatal
errors occurring during an atomic_commit.

Update the SDE encoder resource control to quietly return from pre and
post modeset management when the encoder is in the OFF state. This
prevents improper attempts to access the physical encoder, and allows
atomic commit execution to continue as intended.

Change-Id: I4292742dfbde2a611474d3921a8da7d95eff0f12
Signed-off-by: default avatarChristopher Braga <cbraga@codeaurora.org>
parent 392a07a7
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -2489,8 +2489,14 @@ static int sde_encoder_resource_control(struct drm_encoder *drm_enc,

		mutex_lock(&sde_enc->rc_lock);

		/* return if the resource control is already in ON state */
		if (sde_enc->rc_state != SDE_ENC_RC_STATE_ON) {
		/* Nothing to do in off state */
		if (sde_enc->rc_state == SDE_ENC_RC_STATE_OFF) {
			SDE_DEBUG_ENC(sde_enc, "sw_event:%d, rc in OFF state\n",
					sw_event);
			SDE_EVT32(DRMID(drm_enc), sw_event, sde_enc->rc_state);
			mutex_unlock(&sde_enc->rc_lock);
			return 0;
		} else if (sde_enc->rc_state != SDE_ENC_RC_STATE_ON) {
			/* enable all the clks and resources */
			ret = _sde_encoder_resource_control_helper(drm_enc,
					true);
@@ -2536,8 +2542,14 @@ static int sde_encoder_resource_control(struct drm_encoder *drm_enc,
	case SDE_ENC_RC_EVENT_POST_MODESET:
		mutex_lock(&sde_enc->rc_lock);

		/* return if the resource control is already in ON state */
		if (sde_enc->rc_state != SDE_ENC_RC_STATE_MODESET) {
		/* Nothing to do in off state */
		if (sde_enc->rc_state == SDE_ENC_RC_STATE_OFF) {
			SDE_DEBUG_ENC(sde_enc, "sw_event:%d, rc in OFF state\n",
					sw_event);
			SDE_EVT32(DRMID(drm_enc), sw_event, sde_enc->rc_state);
			mutex_unlock(&sde_enc->rc_lock);
			return 0;
		} else if (sde_enc->rc_state != SDE_ENC_RC_STATE_MODESET) {
			SDE_ERROR_ENC(sde_enc,
					"sw_event:%d, rc:%d !MODESET state\n",
					sw_event, sde_enc->rc_state);