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_iter iter_i, iter_j;
|
||||||
struct sde_rm_hw_blk *dsc[MAX_BLOCKS];
|
struct sde_rm_hw_blk *dsc[MAX_BLOCKS];
|
||||||
|
u32 reserve_mask = 0;
|
||||||
int alloc_count = 0;
|
int alloc_count = 0;
|
||||||
int num_dsc_enc = top->num_comp_enc;
|
int num_dsc_enc = top->num_comp_enc;
|
||||||
int i;
|
int i;
|
||||||
@@ -1301,8 +1302,8 @@ static int _sde_rm_reserve_dsc(
|
|||||||
bool has_422_420_support =
|
bool has_422_420_support =
|
||||||
BIT(SDE_DSC_NATIVE_422_EN) & features;
|
BIT(SDE_DSC_NATIVE_422_EN) & features;
|
||||||
|
|
||||||
memset(&dsc, 0, sizeof(dsc));
|
if (reserve_mask & (1 << iter_i.blk->id))
|
||||||
alloc_count = 0;
|
continue;
|
||||||
|
|
||||||
if (_dsc_ids && (iter_i.blk->id != _dsc_ids[alloc_count]))
|
if (_dsc_ids && (iter_i.blk->id != _dsc_ids[alloc_count]))
|
||||||
continue;
|
continue;
|
||||||
@@ -1320,6 +1321,7 @@ static int _sde_rm_reserve_dsc(
|
|||||||
alloc_count,
|
alloc_count,
|
||||||
_dsc_ids ? _dsc_ids[alloc_count] : -1);
|
_dsc_ids ? _dsc_ids[alloc_count] : -1);
|
||||||
|
|
||||||
|
reserve_mask |= (1 << iter_i.blk->id);
|
||||||
dsc[alloc_count++] = iter_i.blk;
|
dsc[alloc_count++] = iter_i.blk;
|
||||||
|
|
||||||
/* Valid first dsc found, find matching peers */
|
/* Valid first dsc found, find matching peers */
|
||||||
@@ -1327,7 +1329,7 @@ static int _sde_rm_reserve_dsc(
|
|||||||
|
|
||||||
while (alloc_count != num_dsc_enc &&
|
while (alloc_count != num_dsc_enc &&
|
||||||
_sde_rm_get_hw_locked(rm, &iter_j)) {
|
_sde_rm_get_hw_locked(rm, &iter_j)) {
|
||||||
if (iter_i.blk == iter_j.blk)
|
if (reserve_mask & (1 << iter_j.blk->id))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (_dsc_ids && (iter_j.blk->id !=
|
if (_dsc_ids && (iter_j.blk->id !=
|
||||||
@@ -1343,7 +1345,15 @@ static int _sde_rm_reserve_dsc(
|
|||||||
alloc_count,
|
alloc_count,
|
||||||
_dsc_ids ? _dsc_ids[alloc_count] : -1);
|
_dsc_ids ? _dsc_ids[alloc_count] : -1);
|
||||||
|
|
||||||
|
reserve_mask |= (1 << iter_j.blk->id);
|
||||||
dsc[alloc_count++] = iter_j.blk;
|
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;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(dsc); i++) {
|
for (i = 0; i < alloc_count; i++) {
|
||||||
if (!dsc[i])
|
if (!dsc[i])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user