[Freedreno] [PATCH 13/25] drm/msm/dpu: make RM iterator hw type specific
Sean Paul
sean at poorly.run
Wed Oct 10 15:00:34 UTC 2018
On Mon, Oct 08, 2018 at 09:27:30PM -0700, Jeykumar Sankaran wrote:
> Usage of hw block iterators are only RM internal. Instead
> of using generic void pointers for HW blocks, use dpu
> specific structure. It helps us to get rid of duplicate
> hw block id's maintained in RM wrapper.
>
> Signed-off-by: Jeykumar Sankaran <jsanka at codeaurora.org>
Reviewed-by: Sean Paul <seanpaul at chromium.org>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 27 ++++++++++++---------------
> 1 file changed, 12 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
> index 561120d..303f1b3 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
> @@ -38,13 +38,11 @@ struct dpu_rm_requirements {
> /**
> * struct dpu_rm_hw_blk - hardware block tracking list member
> * @list: List head for list of all hardware blocks tracking items
> - * @id: Hardware ID number, within it's own space, ie. LM_X
> * @enc_id: Encoder id to which this blk is binded
> * @hw: Pointer to the hardware register access object for this block
> */
> struct dpu_rm_hw_blk {
> struct list_head list;
> - uint32_t id;
> uint32_t enc_id;
> struct dpu_hw_blk *hw;
> };
> @@ -57,7 +55,7 @@ struct dpu_rm_hw_blk {
> * @type: Hardware Block Type client wishes to search for.
> */
> struct dpu_rm_hw_iter {
> - void *hw;
> + struct dpu_hw_blk *hw;
> struct dpu_rm_hw_blk *blk;
> uint32_t enc_id;
> enum dpu_hw_blk_type type;
> @@ -96,7 +94,7 @@ static bool _dpu_rm_get_hw_locked(struct dpu_rm *rm, struct dpu_rm_hw_iter *i)
> if (i->enc_id == i->blk->enc_id) {
> i->hw = i->blk->hw;
> DPU_DEBUG("found type %d id %d for enc %d\n",
> - i->type, i->blk->id, i->enc_id);
> + i->type, i->blk->hw->id, i->enc_id);
> return true;
> }
> }
> @@ -197,7 +195,6 @@ static int _dpu_rm_hw_blk_create(
> return -ENOMEM;
> }
>
> - blk->id = id;
> blk->hw = hw;
> blk->enc_id = 0;
> list_add_tail(&blk->list, &rm->hw_blks[type]);
> @@ -350,7 +347,7 @@ static bool _dpu_rm_check_lm_and_get_connected_blks(
>
> _dpu_rm_init_hw_iter(&iter, 0, DPU_HW_BLK_PINGPONG);
> while (_dpu_rm_get_hw_locked(rm, &iter)) {
> - if (iter.blk->id == lm_cfg->pingpong) {
> + if (iter.blk->hw->id == lm_cfg->pingpong) {
> *pp = iter.blk;
> break;
> }
> @@ -362,8 +359,8 @@ static bool _dpu_rm_check_lm_and_get_connected_blks(
> }
>
> if (RESERVED_BY_OTHER(*pp, enc_id)) {
> - DPU_DEBUG("lm %d pp %d already reserved\n", lm->id,
> - (*pp)->id);
> + DPU_DEBUG("lm %d pp %d already reserved\n", lm->hw->id,
> + (*pp)->hw->id);
> return false;
> }
>
> @@ -436,8 +433,8 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, uint32_t enc_id,
> dpu_cstate->mixers[i].hw_lm = to_dpu_hw_mixer(lm[i]->hw);
> dpu_cstate->mixers[i].hw_pp = to_dpu_hw_pingpong(pp[i]->hw);
>
> - trace_dpu_rm_reserve_lms(lm[i]->id, DPU_HW_BLK_LM, enc_id,
> - pp[i]->id);
> + trace_dpu_rm_reserve_lms(lm[i]->hw->id, DPU_HW_BLK_LM, enc_id,
> + pp[i]->hw->id);
> }
>
> dpu_cstate->num_mixers = lm_count;
> @@ -474,13 +471,13 @@ static int _dpu_rm_reserve_ctls(
>
> has_split_display = BIT(DPU_CTL_SPLIT_DISPLAY) & features;
>
> - DPU_DEBUG("ctl %d caps 0x%lX\n", iter.blk->id, features);
> + DPU_DEBUG("ctl %d caps 0x%lX\n", iter.blk->hw->id, features);
>
> if (needs_split_display != has_split_display)
> continue;
>
> ctls[i] = iter.blk;
> - DPU_DEBUG("ctl %d match\n", iter.blk->id);
> + DPU_DEBUG("ctl %d match\n", iter.blk->hw->id);
>
> if (++i == num_ctls)
> break;
> @@ -493,7 +490,7 @@ static int _dpu_rm_reserve_ctls(
> ctls[i]->enc_id = enc_id;
> dpu_cstate->hw_ctls[i] = to_dpu_hw_ctl(ctls[i]->hw);
>
> - trace_dpu_rm_reserve_ctls(ctls[i]->id, DPU_HW_BLK_CTL,
> + trace_dpu_rm_reserve_ctls(ctls[i]->hw->id, DPU_HW_BLK_CTL,
> enc_id);
> }
>
> @@ -513,7 +510,7 @@ static struct dpu_rm_hw_blk *_dpu_rm_reserve_intf(
> /* Find the block entry in the rm, and note the reservation */
> _dpu_rm_init_hw_iter(&iter, 0, type);
> while (_dpu_rm_get_hw_locked(rm, &iter)) {
> - if (iter.blk->id != id)
> + if (iter.blk->hw->id != id)
> continue;
>
> if (RESERVED_BY_OTHER(iter.blk, enc_id)) {
> @@ -522,7 +519,7 @@ static struct dpu_rm_hw_blk *_dpu_rm_reserve_intf(
> }
>
> iter.blk->enc_id = enc_id;
> - trace_dpu_rm_reserve_intf(iter.blk->id, DPU_HW_BLK_INTF,
> + trace_dpu_rm_reserve_intf(iter.blk->hw->id, DPU_HW_BLK_INTF,
> enc_id);
> break;
> }
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>
--
Sean Paul, Software Engineer, Google / Chromium OS
More information about the Freedreno
mailing list