Commit fdac4bc5 authored by Dmitry Baryshkov's avatar Dmitry Baryshkov

drm/msm/dpu: simplify peer LM handling

For each LM there is at max 1 peer LM. Thus there is no need to have a
mask for the peer LM enumeration. Change that to have an ID of the peer LM.
Reviewed-by: default avatarMarijn Suijten <marijn.suijten@somainline.org>
Tested-by: default avatarMarijn Suijten <marijn.suijten@somainline.org>
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/545352/
Link: https://lore.kernel.org/r/20230704022136.130522-4-dmitry.baryshkov@linaro.org
parent 2d3b0d74
...@@ -394,7 +394,7 @@ static const struct dpu_sspp_sub_blks qcm2290_dma_sblk_0 = _DMA_SBLK("8", 1); ...@@ -394,7 +394,7 @@ static const struct dpu_sspp_sub_blks qcm2290_dma_sblk_0 = _DMA_SBLK("8", 1);
.features = _fmask, \ .features = _fmask, \
.sblk = _sblk, \ .sblk = _sblk, \
.pingpong = _pp, \ .pingpong = _pp, \
.lm_pair_mask = (1 << _lmpair), \ .lm_pair = _lmpair, \
.dspp = _dspp \ .dspp = _dspp \
} }
......
...@@ -554,14 +554,14 @@ struct dpu_sspp_cfg { ...@@ -554,14 +554,14 @@ struct dpu_sspp_cfg {
* @features bit mask identifying sub-blocks/features * @features bit mask identifying sub-blocks/features
* @sblk: LM Sub-blocks information * @sblk: LM Sub-blocks information
* @pingpong: ID of connected PingPong, PINGPONG_NONE if unsupported * @pingpong: ID of connected PingPong, PINGPONG_NONE if unsupported
* @lm_pair_mask: Bitmask of LMs that can be controlled by same CTL * @lm_pair: ID of LM that can be controlled by same CTL
*/ */
struct dpu_lm_cfg { struct dpu_lm_cfg {
DPU_HW_BLK_INFO; DPU_HW_BLK_INFO;
const struct dpu_lm_sub_blks *sblk; const struct dpu_lm_sub_blks *sblk;
u32 pingpong; u32 pingpong;
u32 dspp; u32 dspp;
unsigned long lm_pair_mask; unsigned long lm_pair;
}; };
/** /**
......
...@@ -253,28 +253,19 @@ static bool _dpu_rm_needs_split_display(const struct msm_display_topology *top) ...@@ -253,28 +253,19 @@ static bool _dpu_rm_needs_split_display(const struct msm_display_topology *top)
} }
/** /**
* _dpu_rm_check_lm_peer - check if a mixer is a peer of the primary * _dpu_rm_get_lm_peer - get the id of a mixer which is a peer of the primary
* @rm: dpu resource manager handle * @rm: dpu resource manager handle
* @primary_idx: index of primary mixer in rm->mixer_blks[] * @primary_idx: index of primary mixer in rm->mixer_blks[]
* @peer_idx: index of other mixer in rm->mixer_blks[]
* Return: true if rm->mixer_blks[peer_idx] is a peer of
* rm->mixer_blks[primary_idx]
*/ */
static bool _dpu_rm_check_lm_peer(struct dpu_rm *rm, int primary_idx, static int _dpu_rm_get_lm_peer(struct dpu_rm *rm, int primary_idx)
int peer_idx)
{ {
const struct dpu_lm_cfg *prim_lm_cfg; const struct dpu_lm_cfg *prim_lm_cfg;
const struct dpu_lm_cfg *peer_cfg;
prim_lm_cfg = to_dpu_hw_mixer(rm->mixer_blks[primary_idx])->cap; prim_lm_cfg = to_dpu_hw_mixer(rm->mixer_blks[primary_idx])->cap;
peer_cfg = to_dpu_hw_mixer(rm->mixer_blks[peer_idx])->cap;
if (!test_bit(peer_cfg->id, &prim_lm_cfg->lm_pair_mask)) { if (prim_lm_cfg->lm_pair >= LM_0 && prim_lm_cfg->lm_pair < LM_MAX)
DPU_DEBUG("lm %d not peer of lm %d\n", peer_cfg->id, return prim_lm_cfg->lm_pair - LM_0;
peer_cfg->id); return -EINVAL;
return false;
}
return true;
} }
/** /**
...@@ -351,7 +342,7 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, ...@@ -351,7 +342,7 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm,
int lm_idx[MAX_BLOCKS]; int lm_idx[MAX_BLOCKS];
int pp_idx[MAX_BLOCKS]; int pp_idx[MAX_BLOCKS];
int dspp_idx[MAX_BLOCKS] = {0}; int dspp_idx[MAX_BLOCKS] = {0};
int i, j, lm_count = 0; int i, lm_count = 0;
if (!reqs->topology.num_lm) { if (!reqs->topology.num_lm) {
DPU_ERROR("invalid number of lm: %d\n", reqs->topology.num_lm); DPU_ERROR("invalid number of lm: %d\n", reqs->topology.num_lm);
...@@ -376,16 +367,15 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, ...@@ -376,16 +367,15 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm,
++lm_count; ++lm_count;
/* Valid primary mixer found, find matching peers */ /* Valid primary mixer found, find matching peers */
for (j = i + 1; j < ARRAY_SIZE(rm->mixer_blks) && if (lm_count < reqs->topology.num_lm) {
lm_count < reqs->topology.num_lm; j++) { int j = _dpu_rm_get_lm_peer(rm, i);
if (!rm->mixer_blks[j])
/* ignore the peer if there is an error or if the peer was already processed */
if (j < 0 || j < i)
continue; continue;
if (!_dpu_rm_check_lm_peer(rm, i, j)) { if (!rm->mixer_blks[j])
DPU_DEBUG("lm %d not peer of lm %d\n", LM_0 + j,
LM_0 + i);
continue; continue;
}
if (!_dpu_rm_check_lm_and_get_connected_blks(rm, if (!_dpu_rm_check_lm_and_get_connected_blks(rm,
global_state, enc_id, j, global_state, enc_id, j,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment