Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Abhinav Kumar <quic_abhinavk@quicinc.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>,
	Marijn Suijten <marijn.suijten@somainline.org>
Cc: Stephen Boyd <swboyd@chromium.org>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	Bjorn Andersson <andersson@kernel.org>,
	<linux-arm-msm@vger.kernel.org>,
	<dri-devel@lists.freedesktop.org>,
	<freedreno@lists.freedesktop.org>
Subject: Re: [PATCH v4 12/13] drm/msm/dpu: allow sharing of blending stages
Date: Tue, 11 Jun 2024 18:47:59 -0700	[thread overview]
Message-ID: <0996ccd1-32b1-eaa9-0331-e0270da80da2@quicinc.com> (raw)
In-Reply-To: <20240314000216.392549-13-dmitry.baryshkov@linaro.org>



On 3/13/2024 5:02 PM, Dmitry Baryshkov wrote:
> It is possible to slightly bend the limitations of the HW blender. If
> two rectangles are contiguous (like two rectangles of a single plane)
> they can be blended using a single LM blending stage, allowing one to
> blend more planes via a single LM.
> 

Can you pls let me know the source of this optimization (assuming its 
present downstream) ?

Otherwise I will have to lookup some more docs to confirm this.

It certainly makes sense, that if the same layer is being split across 
two SSPP's we can certainly use the same blend stage. But want to make 
sure this is already in place somewhere and not something which was 
tried and just worked.


> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>   drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c  |  9 ++++--
>   drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 37 ++++++++++++++++++-----
>   2 files changed, 37 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> index 794c5643584f..fbbd7f635d04 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> @@ -445,6 +445,7 @@ static void _dpu_crtc_blend_setup_mixer(struct drm_crtc *crtc,
>   
>   	uint32_t lm_idx;
>   	bool bg_alpha_enable = false;
> +	unsigned int stage_indices[DPU_STAGE_MAX] = {};
>   	DECLARE_BITMAP(fetch_active, SSPP_MAX);
>   
>   	memset(fetch_active, 0, sizeof(fetch_active));
> @@ -469,7 +470,9 @@ static void _dpu_crtc_blend_setup_mixer(struct drm_crtc *crtc,
>   					   mixer, cstate->num_mixers,
>   					   pstate->stage,
>   					   format, fb ? fb->modifier : 0,
> -					   &pstate->pipe, 0, stage_cfg);
> +					   &pstate->pipe,
> +					   stage_indices[pstate->stage]++,
> +					   stage_cfg);
>   
>   		if (pstate->r_pipe.sspp) {
>   			set_bit(pstate->r_pipe.sspp->idx, fetch_active);
> @@ -477,7 +480,9 @@ static void _dpu_crtc_blend_setup_mixer(struct drm_crtc *crtc,
>   						   mixer, cstate->num_mixers,
>   						   pstate->stage,
>   						   format, fb ? fb->modifier : 0,
> -						   &pstate->r_pipe, 1, stage_cfg);
> +						   &pstate->r_pipe,
> +						   stage_indices[pstate->stage]++,
> +						   stage_cfg);
>   		}

Is this part of the change related to this patch? We moved from 
hard-coding 0 and 1 for the stage_idx to stage_indices[pstate->stage] 
will still result in the same values of 0 and 1 right?

The sharing will be achieved with the change below of doing
pstate->stage = prev_pstate->stage.

Rest of the change LGTM.


>   
>   		/* blend config update */
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
> index 2e1c544efc4a..43dfe13eb298 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
> @@ -827,13 +827,6 @@ static int dpu_plane_atomic_check_nopipe(struct drm_plane *plane,
>   	if (!new_plane_state->visible)
>   		return 0;
>   
> -	pstate->stage = DPU_STAGE_0 + pstate->base.normalized_zpos;
> -	if (pstate->stage >= pdpu->catalog->caps->max_mixer_blendstages) {
> -		DPU_ERROR("> %d plane stages assigned\n",
> -			  pdpu->catalog->caps->max_mixer_blendstages - DPU_STAGE_0);
> -		return -EINVAL;
> -	}
> -
>   	/* state->src is 16.16, src_rect is not */
>   	drm_rect_fp_to_int(&pipe_cfg->src_rect, &new_plane_state->src);
>   
> @@ -971,6 +964,18 @@ static int dpu_plane_try_multirect(struct dpu_plane_state *pstate,
>   		prev_pipe->multirect_index = DPU_SSPP_RECT_0;
>   		prev_pipe->multirect_mode = DPU_SSPP_MULTIRECT_PARALLEL;
>   
> +		if (pipe_cfg->dst_rect.y1 == prev_pipe_cfg->dst_rect.y1 &&
> +		    pipe_cfg->dst_rect.y2 == prev_pipe_cfg->dst_rect.y2 &&
> +		    pipe_cfg->dst_rect.x1 == prev_pipe_cfg->dst_rect.x2) {
> +			pstate->stage = prev_pstate->stage;
> +		} else if (pipe_cfg->dst_rect.y1 == prev_pipe_cfg->dst_rect.y1 &&
> +			   pipe_cfg->dst_rect.y2 == prev_pipe_cfg->dst_rect.y2 &&
> +			   pipe_cfg->dst_rect.x2 == prev_pipe_cfg->dst_rect.x1) {
> +			pstate->stage = prev_pstate->stage;
> +			pipe->multirect_index = DPU_SSPP_RECT_0;
> +			prev_pipe->multirect_index = DPU_SSPP_RECT_1;
> +		}
> +
>   		return true;
>   	}
>   
> @@ -1080,6 +1085,13 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
>   	if (!new_plane_state->visible)
>   		return 0;
>   
> +	pstate->stage = DPU_STAGE_0 + pstate->base.normalized_zpos;
> +	if (pstate->stage >= pdpu->catalog->caps->max_mixer_blendstages) {
> +		DPU_ERROR("> %d plane stages assigned\n",
> +			  pdpu->catalog->caps->max_mixer_blendstages - DPU_STAGE_0);
> +		return -EINVAL;
> +	}
> +
>   	pipe->multirect_index = DPU_SSPP_RECT_SOLO;
>   	pipe->multirect_mode = DPU_SSPP_MULTIRECT_NONE;
>   	r_pipe->multirect_index = DPU_SSPP_RECT_SOLO;
> @@ -1221,6 +1233,11 @@ static int dpu_plane_virtual_assign_resources(struct drm_crtc *crtc,
>   
>   	max_linewidth = dpu_kms->catalog->caps->max_linewidth;
>   
> +	if (prev_pstate)
> +		pstate->stage = prev_pstate->stage + 1;
> +	else
> +		pstate->stage = DPU_STAGE_0 + pstate->base.normalized_zpos;
> +
>   	if (drm_rect_width(&r_pipe_cfg->src_rect) == 0) {
>   		if (!prev_pstate ||
>   		    !dpu_plane_try_multirect(pstate, prev_pstate, fmt, max_linewidth)) {
> @@ -1267,6 +1284,12 @@ static int dpu_plane_virtual_assign_resources(struct drm_crtc *crtc,
>   		}
>   	}
>   
> +	if (pstate->stage >= dpu_kms->catalog->caps->max_mixer_blendstages) {
> +		DPU_ERROR("> %d plane stages assigned\n",
> +			  dpu_kms->catalog->caps->max_mixer_blendstages - DPU_STAGE_0);
> +		return -EINVAL;
> +	}
> +
>   	return dpu_plane_atomic_check_pipes(plane, state, crtc_state);
>   }
>   

  reply	other threads:[~2024-06-12  1:48 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-14  0:02 [PATCH v4 00/13] drm/msm/dpu: support virtual wide planes Dmitry Baryshkov
2024-03-14  0:02 ` [PATCH v4 01/13] drm/msm/dpu: take plane rotation into account for " Dmitry Baryshkov
2024-05-30 22:51   ` Abhinav Kumar
2024-03-14  0:02 ` [PATCH v4 02/13] drm/msm/dpu: use drm_rect_fp_to_int() Dmitry Baryshkov
2024-05-30 23:14   ` Abhinav Kumar
2024-03-14  0:02 ` [PATCH v4 03/13] drm/msm/dpu: move pstate->pipe initialization to dpu_plane_atomic_check Dmitry Baryshkov
2024-05-31  0:28   ` Abhinav Kumar
2024-03-14  0:02 ` [PATCH v4 04/13] drm/msm/dpu: drop virt_formats from SSPP subblock configuration Dmitry Baryshkov
2024-05-31  0:32   ` Abhinav Kumar
2024-03-14  0:02 ` [PATCH v4 05/13] drm/msm/dpu: move scaling limitations out of the hw_catalog Dmitry Baryshkov
2024-05-31  1:02   ` Abhinav Kumar
2024-05-31  8:16     ` Dmitry Baryshkov
2024-05-31 19:20       ` Abhinav Kumar
2024-05-31 19:45         ` Dmitry Baryshkov
2024-03-14  0:02 ` [PATCH v4 06/13] drm/msm/dpu: split dpu_plane_atomic_check() Dmitry Baryshkov
2024-06-05 23:19   ` Abhinav Kumar
2024-06-05 23:32     ` Dmitry Baryshkov
2024-06-05 23:47       ` Abhinav Kumar
2024-06-06  8:53         ` Dmitry Baryshkov
2024-06-06  8:54           ` Dmitry Baryshkov
2024-03-14  0:02 ` [PATCH v4 07/13] drm/msm/dpu: move rot90 checking to dpu_plane_atomic_check_pipe() Dmitry Baryshkov
2024-06-05 23:34   ` Abhinav Kumar
2024-03-14  0:02 ` [PATCH v4 08/13] drm/msm/dpu: add support for virtual planes Dmitry Baryshkov
2024-03-14  8:04   ` [v4,08/13] " Sui Jingfeng
2024-06-06 22:21   ` [PATCH v4 08/13] " Abhinav Kumar
2024-06-07  7:16     ` Dmitry Baryshkov
2024-06-07 19:22       ` Abhinav Kumar
2024-06-07 21:10         ` Dmitry Baryshkov
2024-06-07 21:39           ` Abhinav Kumar
2024-06-07 22:26             ` Dmitry Baryshkov
2024-06-07 23:55               ` Abhinav Kumar
2024-06-08  0:57                 ` Dmitry Baryshkov
2024-06-08  2:45                   ` Abhinav Kumar
2024-06-10 21:01                     ` Abhinav Kumar
2024-03-14  0:02 ` [PATCH v4 09/13] drm/msm/dpu: allow using two SSPP blocks for a single plane Dmitry Baryshkov
2024-06-10 20:19   ` Abhinav Kumar
2024-03-14  0:02 ` [PATCH v4 10/13] drm/msm/dpu: allow sharing SSPP between planes Dmitry Baryshkov
2024-06-11 23:12   ` Abhinav Kumar
2024-06-12  9:08     ` Dmitry Baryshkov
2024-06-13  1:17       ` Abhinav Kumar
2024-06-13 10:05         ` Dmitry Baryshkov
2024-06-13 20:02           ` Abhinav Kumar
2024-03-14  0:02 ` [PATCH v4 11/13] drm/msm/dpu: create additional virtual planes Dmitry Baryshkov
2024-06-11 23:26   ` Abhinav Kumar
2024-03-14  0:02 ` [PATCH v4 12/13] drm/msm/dpu: allow sharing of blending stages Dmitry Baryshkov
2024-06-12  1:47   ` Abhinav Kumar [this message]
2024-06-12  8:50     ` Dmitry Baryshkov
2024-03-14  0:02 ` [PATCH v4 13/13] drm/msm/dpu: include SSPP allocation state into the dumped state Dmitry Baryshkov
2024-06-11 23:43   ` Abhinav Kumar
2024-03-14  0:04 ` [PATCH v4 00/13] drm/msm/dpu: support virtual wide planes Dmitry Baryshkov

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=0996ccd1-32b1-eaa9-0331-e0270da80da2@quicinc.com \
    --to=quic_abhinavk@quicinc.com \
    --cc=airlied@gmail.com \
    --cc=andersson@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=robdclark@gmail.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