From: Jessica Zhang <jessica.zhang@oss.qualcomm.com>
To: Rob Clark <robdclark@gmail.com>,
Dmitry Baryshkov <lumag@kernel.org>, Sean Paul <sean@poorly.run>,
Marijn Suijten <marijn.suijten@somainline.org>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Abhinav Kumar <quic_abhinavk@quicinc.com>
Cc: Abhinav Kumar <abhinav.kumar@oss.qualcomm.com>,
linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Jessica Zhang <jessica.zhang@oss.qualcomm.com>
Subject: [PATCH 3/5] drm/msm/dpu: Check mode against PINGPONG or DSC max width
Date: Wed, 14 May 2025 16:52:31 -0700 [thread overview]
Message-ID: <20250514-max-mixer-width-v1-3-c8ba0d9bb858@oss.qualcomm.com> (raw)
In-Reply-To: <20250514-max-mixer-width-v1-0-c8ba0d9bb858@oss.qualcomm.com>
Validate requested mode and topology based on the PINGPONG or DSC encoder
max width. In addition, drop MAX_HDISPLAY_SPLIT and base LM reservation
off of PINGPONG or DSC encoder max width
As noted in the patch, while DPU 8.x+ supports a max linewidth of 8960
for PINGPONG_0, there is some additional logic that needs to be added to
the resource manager to specifically try and reserve PINGPONG_0 for
modes that are greater than 5k.
Since this is out of the scope of this series, add a helper that will
get the overall minimum PINGPONG max linewidth for a given chipset.
Signed-off-by: Jessica Zhang <jessica.zhang@oss.qualcomm.com>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 46 +++++++++++++++++++++++++++-----
1 file changed, 39 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 0714936d8835..6131d071b051 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -723,6 +723,31 @@ void dpu_crtc_complete_commit(struct drm_crtc *crtc)
_dpu_crtc_complete_flip(crtc);
}
+static int msm_display_get_max_pingpong_width(struct dpu_kms *dpu_kms)
+{
+ const struct dpu_pingpong_cfg *pingpong;
+ u32 max_pingpong_width = dpu_kms->catalog->pingpong[0].max_linewidth;
+
+ /*
+ * Find the smallest overall PINGPONG max_linewidth in the catalog since
+ * max_linewidth can differ between PINGPONGs even within the same
+ * chipset.
+ *
+ * Note: While, for DPU 8.x+, PINGPONG_0 can technically support up to
+ * 8k resolutions, this requires reworking the RM to try to reserve
+ * PINGPONG_0 for modes greater than 5k.
+ *
+ * Once this additional logic is implemented, we can drop this helper
+ * and use the reserved PINGPONG's max_linewidth
+ */
+ for (int i = 1; i < dpu_kms->catalog->pingpong_count; i++) {
+ pingpong = &dpu_kms->catalog->pingpong[i];
+ max_pingpong_width = min(max_pingpong_width, pingpong->max_linewidth);
+ }
+
+ return max_pingpong_width;
+}
+
static int _dpu_crtc_check_and_setup_lm_bounds(struct drm_crtc *crtc,
struct drm_crtc_state *state)
{
@@ -730,13 +755,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++) {
@@ -748,7 +774,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;
}
@@ -1279,7 +1305,6 @@ static int dpu_crtc_reassign_planes(struct drm_crtc *crtc, struct drm_crtc_state
}
#define MAX_CHANNELS_PER_CRTC 2
-#define MAX_HDISPLAY_SPLIT 1080
static struct msm_display_topology dpu_crtc_get_topology(
struct drm_crtc *crtc,
@@ -1289,12 +1314,18 @@ static struct msm_display_topology dpu_crtc_get_topology(
struct drm_display_mode *mode = &crtc_state->adjusted_mode;
struct msm_display_topology topology = {0};
struct drm_encoder *drm_enc;
+ const struct dpu_caps *caps = dpu_kms->catalog->caps;
+ u32 max_hdisplay_split;
drm_for_each_encoder_mask(drm_enc, crtc->dev, crtc_state->encoder_mask)
dpu_encoder_update_topology(drm_enc, &topology, crtc_state->state,
&crtc_state->adjusted_mode);
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 && caps->max_dsc_encoder_width > 0)
+ max_hdisplay_split = min(max_hdisplay_split, caps->max_dsc_encoder_width);
/*
* Datapath topology selection
@@ -1315,7 +1346,7 @@ static struct msm_display_topology dpu_crtc_get_topology(
* count both the WB and real-time phys encoders.
*
* For non-DSC CWB usecases, have the num_lm be decided by the
- * (mode->hdisplay > MAX_HDISPLAY_SPLIT) check.
+ * (mode->hdisplay > max_hdisplay_split) check.
*/
if (topology.num_intf == 2 && !topology.cwb_enabled)
@@ -1323,7 +1354,7 @@ static struct msm_display_topology dpu_crtc_get_topology(
else if (topology.num_dsc == 2)
topology.num_lm = 2;
else if (dpu_kms->catalog->caps->has_3d_merge)
- topology.num_lm = (mode->hdisplay > MAX_HDISPLAY_SPLIT) ? 2 : 1;
+ topology.num_lm = (mode->hdisplay > max_hdisplay_split) ? 2 : 1;
else
topology.num_lm = 1;
@@ -1501,18 +1532,19 @@ static enum drm_mode_status dpu_crtc_mode_valid(struct drm_crtc *crtc,
const struct drm_display_mode *mode)
{
struct dpu_kms *dpu_kms = _dpu_crtc_get_kms(crtc);
+ int max_pingpong_width = msm_display_get_max_pingpong_width(dpu_kms);
/* if there is no 3d_mux block we cannot merge LMs so we cannot
* split the large layer into 2 LMs, filter out such modes
*/
if (!dpu_kms->catalog->caps->has_3d_merge &&
- mode->hdisplay > dpu_kms->catalog->caps->max_mixer_width)
+ mode->hdisplay > max_pingpong_width)
return MODE_BAD_HVALUE;
/*
* max crtc width is equal to the max mixer width * 2 and max height is 4K
*/
return drm_mode_validate_size(mode,
- 2 * dpu_kms->catalog->caps->max_mixer_width,
+ 2 * max_pingpong_width,
4096);
}
--
2.49.0
next prev parent reply other threads:[~2025-05-14 23:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-14 23:52 [PATCH 0/5] drm/msm/dpu: Drop max_mixer_width and MAX_HDISPLAY_SPLIT Jessica Zhang
2025-05-14 23:52 ` [PATCH 1/5] drm/msm/dpu: Drop maxwidth from dpu_lm_sub_blks struct Jessica Zhang
2025-05-15 0:32 ` Dmitry Baryshkov
2025-05-14 23:52 ` [PATCH 2/5] drm/msm/dpu: Add max pingpong and dsc width to HW catalog Jessica Zhang
2025-05-15 0:21 ` Dmitry Baryshkov
2025-05-15 17:13 ` Jessica Zhang
2025-05-14 23:52 ` Jessica Zhang [this message]
2025-05-15 0:28 ` [PATCH 3/5] drm/msm/dpu: Check mode against PINGPONG or DSC max width Dmitry Baryshkov
2025-05-16 0:39 ` Jessica Zhang
2025-05-16 16:19 ` Dmitry Baryshkov
2025-12-31 8:30 ` Xilin Wu
2026-01-03 17:43 ` Dmitry Baryshkov
2025-05-14 23:52 ` [PATCH 4/5] drm/msm/dpu: Filter writeback modes using writeback maxlinewidth Jessica Zhang
2025-05-15 0:17 ` Dmitry Baryshkov
2025-05-16 0:48 ` Jessica Zhang
2025-05-16 21:40 ` Dmitry Baryshkov
2025-05-14 23:52 ` [PATCH 5/5] drm/msm/dpu: Remove max_mixer_width from catalog Jessica Zhang
2025-05-15 0:32 ` 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=20250514-max-mixer-width-v1-3-c8ba0d9bb858@oss.qualcomm.com \
--to=jessica.zhang@oss.qualcomm.com \
--cc=abhinav.kumar@oss.qualcomm.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lumag@kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=quic_abhinavk@quicinc.com \
--cc=robdclark@gmail.com \
--cc=sean@poorly.run \
--cc=simona@ffwll.ch \
/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
all inboxes | Powered by JetHome®