Browse Source

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: Raviteja Tamatam <[email protected]>
Raviteja Tamatam 5 years ago
parent
commit
c763a14ba0
1 changed files with 23 additions and 0 deletions
  1. 23 0
      msm/sde/sde_encoder_phys_cmd.c

+ 23 - 0
msm/sde/sde_encoder_phys_cmd.c

@@ -1450,6 +1450,7 @@ static int _sde_encoder_phys_cmd_wait_for_wr_ptr(
 	int ret;
 	int ret;
 	bool frame_pending = true;
 	bool frame_pending = true;
 	struct sde_hw_ctl *ctl;
 	struct sde_hw_ctl *ctl;
+	unsigned long lock_flags;
 
 
 	if (!phys_enc || !phys_enc->hw_ctl) {
 	if (!phys_enc || !phys_enc->hw_ctl) {
 		SDE_ERROR("invalid argument(s)\n");
 		SDE_ERROR("invalid argument(s)\n");
@@ -1474,6 +1475,28 @@ static int _sde_encoder_phys_cmd_wait_for_wr_ptr(
 			frame_pending = ctl->ops.get_start_state(ctl);
 			frame_pending = ctl->ops.get_start_state(ctl);
 
 
 		ret = frame_pending ? ret : 0;
 		ret = frame_pending ? ret : 0;
+
+		/*
+		 * 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) {
+			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)) {
+				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);
+				spin_unlock_irqrestore(phys_enc->enc_spinlock,
+					lock_flags);
+			}
+		}
 	}
 	}
 
 
 	cmd_enc->wr_ptr_wait_success = (ret == 0) ? true : false;
 	cmd_enc->wr_ptr_wait_success = (ret == 0) ? true : false;