drm: msm: sde: reserve DSC in pairs for 4DSC topologies
Reserve DSC in the sequence of primary-peer and then primary-peer again until all required DSC are reserved. Searching sequence will not change for single/dual DSC reservation. For single DSC reservation it will return right after the first primary DSC is found. For dual DSC reservation it will return after the first primary-peer pair is found. The logic can also work for triple/quad or any number of DSC reservetion and make sure that all the reserved DSCs are in pairs except the last one if total DSC number is odd. Change-Id: I5b90d54822ce16ef829e7c657c1b14e7a484c65a Signed-off-by: Thomas Dedinsky <tdedinsk@codeaurora.org>
This commit is contained in:
@@ -1279,6 +1279,7 @@ static int _sde_rm_reserve_dsc(
|
||||
{
|
||||
struct sde_rm_hw_iter iter_i, iter_j;
|
||||
struct sde_rm_hw_blk *dsc[MAX_BLOCKS];
|
||||
u32 reserve_mask = 0;
|
||||
int alloc_count = 0;
|
||||
int num_dsc_enc = top->num_comp_enc;
|
||||
int i;
|
||||
@@ -1301,8 +1302,8 @@ static int _sde_rm_reserve_dsc(
|
||||
bool has_422_420_support =
|
||||
BIT(SDE_DSC_NATIVE_422_EN) & features;
|
||||
|
||||
memset(&dsc, 0, sizeof(dsc));
|
||||
alloc_count = 0;
|
||||
if (reserve_mask & (1 << iter_i.blk->id))
|
||||
continue;
|
||||
|
||||
if (_dsc_ids && (iter_i.blk->id != _dsc_ids[alloc_count]))
|
||||
continue;
|
||||
@@ -1320,6 +1321,7 @@ static int _sde_rm_reserve_dsc(
|
||||
alloc_count,
|
||||
_dsc_ids ? _dsc_ids[alloc_count] : -1);
|
||||
|
||||
reserve_mask |= (1 << iter_i.blk->id);
|
||||
dsc[alloc_count++] = iter_i.blk;
|
||||
|
||||
/* Valid first dsc found, find matching peers */
|
||||
@@ -1327,7 +1329,7 @@ static int _sde_rm_reserve_dsc(
|
||||
|
||||
while (alloc_count != num_dsc_enc &&
|
||||
_sde_rm_get_hw_locked(rm, &iter_j)) {
|
||||
if (iter_i.blk == iter_j.blk)
|
||||
if (reserve_mask & (1 << iter_j.blk->id))
|
||||
continue;
|
||||
|
||||
if (_dsc_ids && (iter_j.blk->id !=
|
||||
@@ -1343,7 +1345,15 @@ static int _sde_rm_reserve_dsc(
|
||||
alloc_count,
|
||||
_dsc_ids ? _dsc_ids[alloc_count] : -1);
|
||||
|
||||
reserve_mask |= (1 << iter_j.blk->id);
|
||||
dsc[alloc_count++] = iter_j.blk;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Rollback primary DSC if peer is not found */
|
||||
if (!iter_j.hw) {
|
||||
reserve_mask &= ~(1 << iter_i.blk->id);
|
||||
--alloc_count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1353,7 +1363,7 @@ static int _sde_rm_reserve_dsc(
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(dsc); i++) {
|
||||
for (i = 0; i < alloc_count; i++) {
|
||||
if (!dsc[i])
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user