Validate layer mixer pairs for compatibility before retrieving the connected pingpong blocks. Signed-off-by: Jeykumar Sankaran <jsanka@xxxxxxxxxxxxxx> --- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 61 ++++++++++------------------------ 1 file changed, 17 insertions(+), 44 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c index 85a0fe2..f794d13 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c @@ -235,61 +235,32 @@ static bool _dpu_rm_needs_split_display(const struct dpu_crtc_state *dpu_cstate) } /** - * _dpu_rm_check_lm_and_get_connected_blks - check if proposed layer mixer meets - * proposed use case requirements, incl. hardwired dependent blocks like - * pingpong + * _dpu_rm_get_connected_pp - retrieve hardwired pingpong block * @rm: dpu resource manager handle * @lm: proposed layer mixer, function checks if lm, and all other hardwired - * blocks connected to the lm (pp) is available and appropriate - * @pp: output parameter, pingpong block attached to the layer mixer. - * NULL if pp was not available, or not matching requirements. - * @primary_lm: if non-null, this function check if lm is compatible primary_lm - * as well as satisfying all other requirements - * @Return: true if lm matches all requirements, false otherwise + * @Return: handle to ping pong rm block */ -static bool _dpu_rm_check_lm_and_get_connected_blks( - struct dpu_rm *rm, - struct dpu_rm_hw_blk *lm, - struct dpu_rm_hw_blk **pp, - struct dpu_rm_hw_blk *primary_lm) +static struct dpu_rm_hw_blk * +_dpu_rm_get_connected_pp(struct dpu_rm *rm, struct dpu_rm_hw_blk *lm) { const struct dpu_lm_cfg *lm_cfg = to_dpu_hw_mixer(lm->hw)->cap; - struct dpu_rm_hw_blk *iter; struct list_head *blk_list = &rm->hw_blks[DPU_HW_BLK_PINGPONG]; - - *pp = NULL; - - DPU_DEBUG("check lm %d pp %d\n", - lm_cfg->id, lm_cfg->pingpong); - - /* Check if this layer mixer is a peer of the proposed primary LM */ - if (primary_lm) { - const struct dpu_lm_cfg *prim_lm_cfg = - to_dpu_hw_mixer(primary_lm->hw)->cap; - - if (!test_bit(lm_cfg->id, &prim_lm_cfg->lm_pair_mask)) { - DPU_DEBUG("lm %d not peer of lm %d\n", lm_cfg->id, - prim_lm_cfg->id); - return false; - } - } + struct dpu_rm_hw_blk *iter, *pp = NULL; list_for_each_entry(iter, blk_list, list) { if (iter->in_use) continue; if (iter->hw->id == lm_cfg->pingpong) { - *pp = iter; + pp = iter; break; } } - if (!*pp) { - DPU_ERROR("failed to get pp on lm %d\n", lm_cfg->pingpong); - return false; - } + if (!pp) + DPU_ERROR("failed to get pp on lm %d\n", lm->hw->id); - return true; + return pp; } static int _dpu_rm_reserve_lms(struct dpu_rm *rm, @@ -315,15 +286,15 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, lm_count = 0; lm[lm_count] = iter_i; - - if (!_dpu_rm_check_lm_and_get_connected_blks( - rm, lm[lm_count], &pp[lm_count], NULL)) - continue; + pp[lm_count] = _dpu_rm_get_connected_pp(rm, iter_i); ++lm_count; /* Valid primary mixer found, find matching peers */ list_for_each_entry(iter_j, blk_list, list) { + const struct dpu_lm_cfg *prim_lm_cfg = + to_dpu_hw_mixer(iter_i->hw)->cap; + if (iter_j->in_use) continue; @@ -333,11 +304,13 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, if (iter_i == iter_j) continue; - if (!_dpu_rm_check_lm_and_get_connected_blks( - rm, iter_j, &pp[lm_count], iter_i)) + if (!test_bit(iter_j->hw->id, + &prim_lm_cfg->lm_pair_mask)) continue; lm[lm_count] = iter_j; + pp[lm_count] = _dpu_rm_get_connected_pp(rm, iter_j); + ++lm_count; } } -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project