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

Commit 5eb64992 authored by Raviteja Tamatam's avatar Raviteja Tamatam Committed by Ray Zhang
Browse files

disp: msm: sde: signal retire fence in wr_ptr timeout



There can be few cases of ESD where CTL_START is cleared but
wr_ptr interrupt does not come. Signaling retire fence in these
cases to avoid freeze and dangling pending_retire_fence_cnt.

Change-Id: I167f69dce5cbe43b4771e5056d8a73bd7587e76e
Signed-off-by: default avatarRaviteja Tamatam <travitej@codeaurora.org>
Signed-off-by: default avatarRay Zhang <rayz@codeaurora.org>
parent b57ddc53
Loading
Loading
Loading
Loading
+23 −11
Original line number Diff line number Diff line
@@ -1392,6 +1392,7 @@ static int _sde_encoder_phys_cmd_wait_for_wr_ptr(
	int ret;
	bool frame_pending = true;
	struct sde_hw_ctl *ctl;
	unsigned long lock_flags;

	if (!phys_enc || !phys_enc->hw_ctl) {
		SDE_ERROR("invalid argument(s)\n");
@@ -1422,18 +1423,29 @@ static int _sde_encoder_phys_cmd_wait_for_wr_ptr(
			ret = 0;

		/*
		 * Signaling the retire fence at wr_ptr timeout
		 * to allow the next commit and avoid device freeze.
		 * As wr_ptr timeout can occurs due to no read ptr,
		 * updating pending_rd_ptr_cnt here may not cover all
		 * cases. Hence signaling the retire fence.
		 * There can be few cases of ESD where CTL_START is cleared but
		 * wr_ptr irq doesn't come. Signaling retire fence in these
		 * cases to avoid freeze and dangling pending_retire_fence_cnt
		 */
		if (!ret) {
			u32 signal_retire_event =
				SDE_ENCODER_FRAME_EVENT_SIGNAL_RETIRE_FENCE;

			SDE_EVT32(DRMID(phys_enc->parent),
					SDE_EVTLOG_FUNC_CASE1);

			if (sde_encoder_phys_cmd_is_master(phys_enc) &&
			atomic_add_unless(&phys_enc->pending_retire_fence_cnt,
				-1, 0))
				atomic_add_unless(
				&phys_enc->pending_retire_fence_cnt, -1, 0)) {
				spin_lock_irqsave(phys_enc->enc_spinlock,
					lock_flags);
				phys_enc->parent_ops.handle_frame_done(
					phys_enc->parent, phys_enc,
				SDE_ENCODER_FRAME_EVENT_SIGNAL_RETIRE_FENCE);
					signal_retire_event);
				spin_unlock_irqrestore(phys_enc->enc_spinlock,
					lock_flags);
			}
		}
	}

	cmd_enc->wr_ptr_wait_success = (ret == 0) ? true : false;