dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mahadevan P" <mahadevan.p@oss.qualcomm.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v4 3/6] drm/msm/dpu: check mode against PINGPONG or DSC max width
Date: Thu, 08 Oct 2026 17:33:39 +0000	[thread overview]
Message-ID: <sashiko-outbox-164416@kernel.org> (raw)
In-Reply-To: <20261008-lm_fixes_final-v4-3-fa986071c3c1@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/msm/dpu: DSC max width limits are bypassed and threshold logic is dead code
--

commit f43daa2877be8ec1ed9bc6b650068210b82d6ffb
Author: Jessica Zhang <jesszhan0024@gmail.com>

drm/msm/dpu: check mode against PINGPONG or DSC max width

This commit replaces the hardcoded max_mixer_width and MAX_HDISPLAY_SPLIT
limits with dynamically determined pingpong or DSC buffer widths. It aims to
support higher refresh rate modes by passing the derived split threshold to
the layer-mixer count logic.

> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> index 209b25dbeb6c8..41f986ca2a683 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> @@ -765,13 +781,14 @@ static int _dpu_crtc_check_and_setup_lm_bounds(struct drm_crtc *crtc,
>  	struct drm_display_mode *adj_mode = &state->adjusted_mode;
>  	u32 crtc_split_width = adj_mode->hdisplay / cstate->num_mixers;
>  	struct dpu_kms *dpu_kms = _dpu_crtc_get_kms(crtc);
> +	int max_pingpong_width = msm_display_get_max_pingpong_width(dpu_kms);
>  	int i;
>  
>  	/* if we cannot merge 2 LMs (no 3d mux) better to fail earlier
>  	 * before even checking the width after the split
>  	 */
>  	if (!dpu_kms->catalog->caps->has_3d_merge &&
> -	    adj_mode->hdisplay > dpu_kms->catalog->caps->max_mixer_width)
> +	    adj_mode->hdisplay > max_pingpong_width)
>  		return -E2BIG;
>  
>  	for (i = 0; i < cstate->num_mixers; i++) {
> @@ -783,7 +800,7 @@ static int _dpu_crtc_check_and_setup_lm_bounds(struct drm_crtc *crtc,
>  
>  		trace_dpu_crtc_setup_lm_bounds(DRMID(crtc), i, r);
>  
> -		if (drm_rect_width(r) > dpu_kms->catalog->caps->max_mixer_width)
> +		if (drm_rect_width(r) > max_pingpong_width)
>  			return -E2BIG;
>  	}

[Severity: High]
Does this inadvertently allow DSC modes to exceed their narrower hardware
limits?

Because the bounds checks in _dpu_crtc_check_and_setup_lm_bounds() no longer
consider max_dsc_encoder_width, a DSC mode with a split width exceeding the
DSC hardware limit (e.g., width 3000 on a single DSC) will incorrectly pass
validation against the wider max_pingpong_width instead of returning -E2BIG.

This could lead to hardware configuration failures when programmed. None of
the follow-up patches in the series appear to resolve the bypassed DSC bounds.

[ ... ]

> @@ -1410,6 +1428,19 @@ static struct msm_display_topology dpu_crtc_get_topology(
>  
>  	topology.cwb_enabled = drm_crtc_in_clone_mode(crtc_state);
>  
> +	max_hdisplay_split = msm_display_get_max_pingpong_width(dpu_kms);
> +
> +	if (topology.num_dsc > 0) {
> +		u32 max_dsc_encoder_width;
> +
> +		if (dpu_kms->catalog->mdss_ver->core_major_ver < 6)
> +			max_dsc_encoder_width = DPU_1_x_MAX_DSC_ENCODER_WIDTH;
> +		else
> +			max_dsc_encoder_width = DPU_8_x_MAX_DSC_ENCODER_WIDTH;
> +
> +		max_hdisplay_split = min(max_hdisplay_split, max_dsc_encoder_width);
> +	}
> +
>  	/*
>  	 * Datapath topology selection
>  	 *
> @@ -1438,7 +1469,8 @@ static struct msm_display_topology dpu_crtc_get_topology(
>  		topology.num_lm = 2;
>  	else if (dpu_kms->catalog->caps->has_3d_merge &&
>  		 topology.num_dsc == 0)
> -		topology.num_lm = dpu_crtc_num_lm_for_mode(dpu_kms, mode);
> +		topology.num_lm = dpu_crtc_num_lm_for_mode(dpu_kms, mode,
> +							   max_hdisplay_split);
>  	else
>  		topology.num_lm = 1;

[Severity: High]
Is the max_hdisplay_split threshold logic for DSC topologies dead code here?

In dpu_crtc_get_topology(), max_hdisplay_split is clamped to
max_dsc_encoder_width when topology.num_dsc > 0. However, this updated
variable is exclusively passed to dpu_crtc_num_lm_for_mode() which is only
called in the branch where topology.num_dsc == 0.

As a result, the computed max_hdisplay_split for DSC topologies is entirely
dead code and never actually utilized.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261008-lm_fixes_final-v4-0-fa986071c3c1@oss.qualcomm.com?part=3

  reply	other threads:[~2026-10-08 17:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08 17:23 [PATCH v4 0/6] drm/msm/dpu: rework layer mixer allocation and mode limits Mahadevan P
2026-10-08 17:23 ` [PATCH v4 1/6] drm/msm/dpu: split modes a single layer mixer cannot clock Mahadevan P
2026-10-08 17:23 ` [PATCH v4 2/6] drm/msm/dpu: do not assume a merged datapath when validating mode clock Mahadevan P
2026-10-08 17:31   ` sashiko-bot
2026-10-12 12:09   ` Dmitry Baryshkov
2026-10-12 18:13     ` Mahadevan P
2026-10-08 17:23 ` [PATCH v4 3/6] drm/msm/dpu: check mode against PINGPONG or DSC max width Mahadevan P
2026-10-08 17:33   ` sashiko-bot [this message]
2026-10-12 12:14   ` Dmitry Baryshkov
2026-10-12 18:38     ` Mahadevan P
2026-10-08 17:23 ` [PATCH v4 4/6] drm/msm/dpu: filter writeback modes using writeback maxlinewidth Mahadevan P
2026-10-12 12:15   ` Dmitry Baryshkov
2026-10-08 17:23 ` [PATCH v4 5/6] drm/msm/dpu: remove max_mixer_width from catalog Mahadevan P
2026-10-08 17:23 ` [PATCH v4 6/6] drm/msm/dpu: limit the mode width to a pipe if the LM has no source split Mahadevan P
2026-10-12 12:21   ` Dmitry Baryshkov
2026-10-10 19:52 ` [PATCH v4 0/6] drm/msm/dpu: rework layer mixer allocation and mode limits Mahadevan P
2026-10-12 12:05 ` Dmitry Baryshkov
2026-10-13  7:33   ` Mahadevan P

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=sashiko-outbox-164416@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=mahadevan.p@oss.qualcomm.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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