dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Marijn Suijten <marijn.suijten@somainline.org>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: freedreno@lists.freedesktop.org, Sean Paul <sean@poorly.run>,
	Bjorn Andersson <andersson@kernel.org>,
	Abhinav Kumar <quic_abhinavk@quicinc.com>,
	dri-devel@lists.freedesktop.org,
	Stephen Boyd <swboyd@chromium.org>,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v2 06/22] drm/msm/dpu: simplify peer LM handling
Date: Fri, 16 Jun 2023 01:04:29 +0200	[thread overview]
Message-ID: <cjspdreamae7wvvxo45yiru2b6f57faxguf3er5vdmj62zesej@hwwik7mps7ru> (raw)
In-Reply-To: <20230613001004.3426676-7-dmitry.baryshkov@linaro.org>

On 2023-06-13 03:09:45, Dmitry Baryshkov wrote:
> For each LM there is at max 1 peer LM which can be driven by the same
> CTL, so there no need to have a mask instead of just an ID of the peer
> LM.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

Nit: I think you can describe the the patch contents in the title:

    Replace LM peer mask with index

Instead of the vague (IMHO) "simplify handling".

> ---
>  .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c    |  2 +-
>  .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h    |  4 +--
>  drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c        | 34 +++++++------------
>  3 files changed, 15 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
> index 0de507d4d7b7..30fb5b1f3966 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
> @@ -394,7 +394,7 @@ static const struct dpu_sspp_sub_blks qcm2290_dma_sblk_0 = _DMA_SBLK("8", 1);
>  	.features = _fmask, \
>  	.sblk = _sblk, \
>  	.pingpong = _pp, \
> -	.lm_pair_mask = (1 << _lmpair), \
> +	.lm_pair = _lmpair, \
>  	.dspp = _dspp \
>  	}
>  
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
> index b860784ade72..b07caa4b867e 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
> @@ -554,14 +554,14 @@ struct dpu_sspp_cfg {
>   * @features           bit mask identifying sub-blocks/features
>   * @sblk:              LM Sub-blocks information
>   * @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

Of *the* LM
By *the* same CTL

But then the rest of these comments have this borked hard-to-read style
as well.

>   */
>  struct dpu_lm_cfg {
>  	DPU_HW_BLK_INFO;
>  	const struct dpu_lm_sub_blks *sblk;
>  	u32 pingpong;
>  	u32 dspp;
> -	unsigned long lm_pair_mask;
> +	unsigned long lm_pair;
>  };
>  
>  /**
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
> index 471842bbb950..e333f4eeafc1 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
> @@ -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

... mixer?

>   * @rm: dpu resource manager handle
>   * @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,
> -		int peer_idx)
> +static int _dpu_rm_get_lm_peer(struct dpu_rm *rm, int primary_idx)
>  {
>  	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;
> -	peer_cfg = to_dpu_hw_mixer(rm->mixer_blks[peer_idx])->cap;
>  
> -	if (!test_bit(peer_cfg->id, &prim_lm_cfg->lm_pair_mask)) {
> -		DPU_DEBUG("lm %d not peer of lm %d\n", peer_cfg->id,
> -				peer_cfg->id);
> -		return false;
> -	}
> -	return true;
> +	if (prim_lm_cfg->lm_pair >= LM_0 && prim_lm_cfg->lm_pair < LM_MAX)
> +		return prim_lm_cfg->lm_pair - LM_0;
> +	return -EINVAL;
>  }
>  
>  /**
> @@ -351,7 +342,7 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm,
>  	int lm_idx[MAX_BLOCKS];
>  	int pp_idx[MAX_BLOCKS];
>  	int dspp_idx[MAX_BLOCKS] = {0};
> -	int i, j, lm_count = 0;
> +	int i, lm_count = 0;
>  
>  	if (!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,
>  		++lm_count;
>  
>  		/* Valid primary mixer found, find matching peers */
> -		for (j = i + 1; j < ARRAY_SIZE(rm->mixer_blks) &&
> -				lm_count < reqs->topology.num_lm; j++) {
> -			if (!rm->mixer_blks[j])
> +		if (lm_count < reqs->topology.num_lm) {
> +			int j = _dpu_rm_get_lm_peer(rm, i);
> +
> +			/* ignore the peer if there is an error or if the peer was already processed */

I would not call this an "error" (though it is -EINVAL): 0 (out of range
of LM_0 <= x M LM_MAX) is a valid value meaning "LM has no peer" and
maybe another error code is more fitting?

> +			if (j < 0 || j < i)
>  				continue;
>  
> -			if (!_dpu_rm_check_lm_peer(rm, i, j)) {
> -				DPU_DEBUG("lm %d not peer of lm %d\n", LM_0 + j,
> -						LM_0 + i);
> +			if (!rm->mixer_blks[j])
>  				continue;

This seems silly now, why would an existing LM have a pair to an LM that
might not be in the catalog?  Return -EINVAL?

Nits aside, this is some tight cleanup:

Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>

- Marijn

> -			}
>  
>  			if (!_dpu_rm_check_lm_and_get_connected_blks(rm,
>  					global_state, enc_id, j,
> -- 
> 2.39.2
> 

  reply	other threads:[~2023-06-15 23:04 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-13  0:09 [PATCH v2 00/22]drm/msm/dpu: another catalog rework Dmitry Baryshkov
2023-06-13  0:09 ` [PATCH v2 01/22] drm/msm/dpu: fix sc7280 and sc7180 PINGPONG done interrupts Dmitry Baryshkov
2023-06-13 21:41   ` Abhinav Kumar
2023-06-15 22:19   ` Marijn Suijten
2023-06-13  0:09 ` [PATCH v2 02/22] drm/msm/dpu: correct MERGE_3D length Dmitry Baryshkov
2023-06-13 21:54   ` Abhinav Kumar
2023-06-15 22:22   ` Marijn Suijten
2023-06-16  9:45     ` Dmitry Baryshkov
2023-06-13  0:09 ` [PATCH v2 03/22] drm/msm/dpu: remove unused INTF_NONE interfaces Dmitry Baryshkov
2023-06-13 22:06   ` Abhinav Kumar
2023-06-15 22:26   ` Marijn Suijten
2023-06-16  9:49     ` Dmitry Baryshkov
2023-06-16 12:28       ` Marijn Suijten
2023-06-13  0:09 ` [PATCH v2 04/22] drm/msm: enumerate DSI interfaces Dmitry Baryshkov
2023-06-13 22:07   ` Abhinav Kumar
2023-06-15 22:26   ` Marijn Suijten
2023-06-13  0:09 ` [PATCH v2 05/22] drm/msm/dpu: always use MSM_DP/DSI_CONTROLLER_n Dmitry Baryshkov
2023-06-13 23:47   ` Abhinav Kumar
2023-06-15 22:31   ` Marijn Suijten
2023-06-13  0:09 ` [PATCH v2 06/22] drm/msm/dpu: simplify peer LM handling Dmitry Baryshkov
2023-06-15 23:04   ` Marijn Suijten [this message]
2023-06-13  0:09 ` [PATCH v2 07/22] drm/msm/dpu: drop dpu_mdss_cfg::mdp_count field Dmitry Baryshkov
2023-06-13  0:09 ` [PATCH v2 08/22] drm/msm/dpu: drop enum dpu_mdp and MDP_TOP value Dmitry Baryshkov
2023-06-13  0:09 ` [PATCH v2 09/22] drm/msm/dpu: expand .clk_ctrls definitions Dmitry Baryshkov
2023-06-13  0:09 ` [PATCH v2 10/22] drm/msm/dpu: drop zero features from dpu_mdp_cfg data Dmitry Baryshkov
2023-06-13  0:09 ` [PATCH v2 11/22] drm/msm/dpu: drop zero features from dpu_ctl_cfg data Dmitry Baryshkov
2023-06-13  0:09 ` [PATCH v2 12/22] drm/msm/dpu: correct indentation for CTL definitions Dmitry Baryshkov
2023-06-13  0:09 ` [PATCH v2 13/22] drm/msm/dpu: inline SSPP_BLK macros Dmitry Baryshkov
2023-06-13  0:09 ` [PATCH v2 14/22] drm/msm/dpu: inline DSPP_BLK macros Dmitry Baryshkov
2023-06-13  0:09 ` [PATCH v2 15/22] drm/msm/dpu: inline LM_BLK macros Dmitry Baryshkov
2023-06-13  0:09 ` [PATCH v2 16/22] drm/msm/dpu: inline DSC_BLK and DSC_BLK_1_2 macros Dmitry Baryshkov
2023-06-13  0:09 ` [PATCH v2 16/21] drm/msm/dpu: inline DSC_BLK macros Dmitry Baryshkov
2023-06-15 22:05   ` Marijn Suijten
2023-06-15 22:06     ` Dmitry Baryshkov
2023-06-13  0:09 ` [PATCH v2 17/22] drm/msm/dpu: inline MERGE_3D_BLK macros Dmitry Baryshkov
2023-06-13  0:12 ` [PATCH v2 20/22] drm/msm/dpu: inline INTF_BLK and INTF_BLK_DSI_TE macros Dmitry Baryshkov
2023-06-13  0:12   ` [PATCH v2 21/22] drm/msm/dpu: drop empty features mask MERGE_3D_SM8150_MASK Dmitry Baryshkov
2023-06-13  0:12   ` [PATCH v2 22/22] drm/msm/dpu: drop empty features mask INTF_SDM845_MASK Dmitry Baryshkov
2023-06-13  0:14 ` [PATCH v2 18/22] drm/msm/dpu: inline various PP_BLK_* macros Dmitry Baryshkov
2023-06-13  0:14 ` [PATCH v2 19/22] drm/msm/dpu: inline WB_BLK macros Dmitry Baryshkov
2023-06-13  0:14 ` [PATCH v2 20/22] drm/msm/dpu: inline INTF_BLK and INTF_BLK_DSI_TE macros Dmitry Baryshkov
2023-06-13  0:14 ` [PATCH v2 21/22] drm/msm/dpu: drop empty features mask MERGE_3D_SM8150_MASK Dmitry Baryshkov
2023-06-13  0:14 ` [PATCH v2 22/22] drm/msm/dpu: drop empty features mask INTF_SDM845_MASK Dmitry Baryshkov
2023-06-15 11:31 ` [PATCH v2 00/22]drm/msm/dpu: another catalog rework Dmitry Baryshkov
2023-06-15 22:32   ` Marijn Suijten
2023-06-15 22:09 ` Marijn Suijten

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cjspdreamae7wvvxo45yiru2b6f57faxguf3er5vdmj62zesej@hwwik7mps7ru \
    --to=marijn.suijten@somainline.org \
    --cc=andersson@kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=sean@poorly.run \
    --cc=swboyd@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).