Эх сурвалжийг харах

drm: msm: sde: reserve LM in pairs for 4LM topologies

Reserve LM in the sequence of primary-peer and then
primary-peer again until all required LM are reserved.
Searching sequence will not change for single/dual LM
reservation. For single LM reservation it will return
right after the first primary LM is found. For dual LM
reservation it will return after the first primary-peer
pair is found.

The logic can also work for triple/quad or any number
of LM reservetion and make sure that all the reserved
LMs are in pairs except the last one if total LM number
is odd.

Change-Id: Ia28bb64fedeb43430039775051943d751259a3d2
Signed-off-by: Amine Najahi <[email protected]>
Signed-off-by: satbir singh <[email protected]>
Signed-off-by: Xiaowen Wu <[email protected]>
Amine Najahi 5 жил өмнө
parent
commit
8dd5deed11
1 өөрчлөгдсөн 28 нэмэгдсэн , 14 устгасан
  1. 28 14
      msm/sde/sde_rm.c

+ 28 - 14
msm/sde/sde_rm.c

@@ -1071,6 +1071,7 @@ static int _sde_rm_reserve_lms(
 	struct sde_rm_hw_blk *ds[MAX_BLOCKS];
 	struct sde_rm_hw_blk *ds[MAX_BLOCKS];
 	struct sde_rm_hw_blk *pp[MAX_BLOCKS];
 	struct sde_rm_hw_blk *pp[MAX_BLOCKS];
 	struct sde_rm_hw_iter iter_i, iter_j;
 	struct sde_rm_hw_iter iter_i, iter_j;
+	u32 lm_mask = 0;
 	int lm_count = 0;
 	int lm_count = 0;
 	int i, rc = 0;
 	int i, rc = 0;
 
 
@@ -1083,13 +1084,13 @@ static int _sde_rm_reserve_lms(
 	sde_rm_init_hw_iter(&iter_i, 0, SDE_HW_BLK_LM);
 	sde_rm_init_hw_iter(&iter_i, 0, SDE_HW_BLK_LM);
 	while (lm_count != reqs->topology->num_lm &&
 	while (lm_count != reqs->topology->num_lm &&
 			_sde_rm_get_hw_locked(rm, &iter_i)) {
 			_sde_rm_get_hw_locked(rm, &iter_i)) {
-		memset(&lm, 0, sizeof(lm));
-		memset(&dspp, 0, sizeof(dspp));
-		memset(&ds, 0, sizeof(ds));
-		memset(&pp, 0, sizeof(pp));
+		if (lm_mask & (1 << iter_i.blk->id))
+			continue;
 
 
-		lm_count = 0;
 		lm[lm_count] = iter_i.blk;
 		lm[lm_count] = iter_i.blk;
+		dspp[lm_count] = NULL;
+		ds[lm_count] = NULL;
+		pp[lm_count] = NULL;
 
 
 		SDE_DEBUG("blk id = %d, _lm_ids[%d] = %d\n",
 		SDE_DEBUG("blk id = %d, _lm_ids[%d] = %d\n",
 			iter_i.blk->id,
 			iter_i.blk->id,
@@ -1105,32 +1106,48 @@ static int _sde_rm_reserve_lms(
 				&pp[lm_count], NULL))
 				&pp[lm_count], NULL))
 			continue;
 			continue;
 
 
+		lm_mask |= (1 << iter_i.blk->id);
 		++lm_count;
 		++lm_count;
 
 
+		/* Return if peer is not needed */
+		if (lm_count == reqs->topology->num_lm)
+			break;
+
 		/* Valid primary mixer found, find matching peers */
 		/* Valid primary mixer found, find matching peers */
 		sde_rm_init_hw_iter(&iter_j, 0, SDE_HW_BLK_LM);
 		sde_rm_init_hw_iter(&iter_j, 0, SDE_HW_BLK_LM);
 
 
-		while (lm_count != reqs->topology->num_lm &&
-				_sde_rm_get_hw_locked(rm, &iter_j)) {
-			if (iter_i.blk == iter_j.blk)
+		while (_sde_rm_get_hw_locked(rm, &iter_j)) {
+			if (lm_mask & (1 << iter_j.blk->id))
 				continue;
 				continue;
 
 
+			lm[lm_count] = iter_j.blk;
+			dspp[lm_count] = NULL;
+			ds[lm_count] = NULL;
+			pp[lm_count] = NULL;
+
 			if (!_sde_rm_check_lm_and_get_connected_blks(
 			if (!_sde_rm_check_lm_and_get_connected_blks(
 					rm, rsvp, reqs, iter_j.blk,
 					rm, rsvp, reqs, iter_j.blk,
 					&dspp[lm_count], &ds[lm_count],
 					&dspp[lm_count], &ds[lm_count],
 					&pp[lm_count], iter_i.blk))
 					&pp[lm_count], iter_i.blk))
 				continue;
 				continue;
 
 
-			lm[lm_count] = iter_j.blk;
 			SDE_DEBUG("blk id = %d, _lm_ids[%d] = %d\n",
 			SDE_DEBUG("blk id = %d, _lm_ids[%d] = %d\n",
-				iter_i.blk->id,
+				iter_j.blk->id,
 				lm_count,
 				lm_count,
 				_lm_ids ? _lm_ids[lm_count] : -1);
 				_lm_ids ? _lm_ids[lm_count] : -1);
 
 
 			if (_lm_ids && (lm[lm_count])->id != _lm_ids[lm_count])
 			if (_lm_ids && (lm[lm_count])->id != _lm_ids[lm_count])
 				continue;
 				continue;
 
 
+			lm_mask |= (1 << iter_j.blk->id);
 			++lm_count;
 			++lm_count;
+			break;
+		}
+
+		/* Rollback primary LM if peer is not found */
+		if (!iter_j.hw) {
+			lm_mask &= ~(1 << iter_i.blk->id);
+			--lm_count;
 		}
 		}
 	}
 	}
 
 
@@ -1139,10 +1156,7 @@ static int _sde_rm_reserve_lms(
 		return -ENAVAIL;
 		return -ENAVAIL;
 	}
 	}
 
 
-	for (i = 0; i < ARRAY_SIZE(lm); i++) {
-		if (!lm[i])
-			break;
-
+	for (i = 0; i < lm_count; i++) {
 		lm[i]->rsvp_nxt = rsvp;
 		lm[i]->rsvp_nxt = rsvp;
 		pp[i]->rsvp_nxt = rsvp;
 		pp[i]->rsvp_nxt = rsvp;
 		if (dspp[i])
 		if (dspp[i])