Browse Source

disp: msm: sde: Avoid releasing the committed RM reservations

RM allocated reservations for the ongoing commit are cleared when
there is a delay in ongoing commit scheduling and back to back
prepare comes. This clearing occurs in the subsequent checkonly
commit with modechange property set.

Timeline of the issue:
   --> C1 commit check_only + modeset, RM allocated resources
   --> C2 commit check_only scheduled before C1 commit with
       check_only + modeset, overridden C1 reservations with
       its own into rsvp_nxt
   --> C1 commit scheduled and RM committed reservations
       allocated by C2.

Change-Id: I46cc924fd6515590e32c8e97a82847d2bde97270
Signed-off-by: Jayaprakash <[email protected]>
Jayaprakash 5 years ago
parent
commit
e7f3931297
1 changed files with 18 additions and 0 deletions
  1. 18 0
      msm/sde/sde_rm.c

+ 18 - 0
msm/sde/sde_rm.c

@@ -2141,6 +2141,7 @@ void sde_rm_release(struct sde_rm *rm, struct drm_encoder *enc, bool nxt)
 	top_ctrl = sde_connector_get_property(conn->state,
 			CONNECTOR_PROP_TOPOLOGY_CONTROL);
 
+	SDE_EVT32(enc->base.id, conn->base.id, rsvp->seq, top_ctrl, nxt);
 	if (top_ctrl & BIT(SDE_RM_TOPCTL_RESERVE_LOCK)) {
 		SDE_DEBUG("rsvp[s%de%d] not releasing locked resources\n",
 				rsvp->seq, rsvp->enc_id);
@@ -2231,6 +2232,23 @@ int sde_rm_reserve(
 	rsvp_cur = _sde_rm_get_rsvp(rm, enc);
 	rsvp_nxt = _sde_rm_get_rsvp_nxt(rm, enc);
 
+	/*
+	 * RM currently relies on rsvp_nxt assigned to the hw blocks to
+	 * commit rsvps. This rsvp_nxt can be cleared by a back to back
+	 * check_only commit with modeset when its predecessor atomic
+	 * commit is delayed / not committed the reservation yet.
+	 * Bail out in such cases so that check only commit
+	 * comes again after earlier commit gets processed.
+	 */
+
+	if (test_only && rsvp_nxt) {
+		SDE_ERROR("cur %d nxt %d enc %d conn %d\n", rsvp_cur->seq,
+			 rsvp_nxt->seq, enc->base.id,
+			 conn_state->connector->base.id);
+		ret = -EINVAL;
+		goto end;
+	}
+
 	if (!test_only && rsvp_nxt)
 		goto commit_rsvp;