* [PATCH v19 1/4] drm/msm/dpu: Extract plane splitting into a dedicated function
2026-03-12 8:28 [PATCH v19 0/4] drm/msm/dpu: Support quad pipe with dual-interface Jun Nie
@ 2026-03-12 8:28 ` Jun Nie
2026-03-13 4:21 ` Claude review: " Claude Code Review Bot
2026-03-12 8:28 ` [PATCH v19 2/4] drm/msm/dpu: Defer SSPP allocation until CRTC check Jun Nie
` (3 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Jun Nie @ 2026-03-12 8:28 UTC (permalink / raw)
To: Abhinav Kumar, Dmitry Baryshkov, Sean Paul, Marijn Suijten,
David Airlie, Simona Vetter, Rob Clark, Neil Armstrong
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel, Jun Nie,
Dmitry Baryshkov
dpu_plane_atomic_check_nosspp() currently handles both plane
validation and plane splitting. For better simplicity and to
facilitate future refactoring, move the splitting logic into
its own dedicated function.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Jun Nie <jun.nie@linaro.org>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 48 +++++++++++++++++++++----------
1 file changed, 33 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
index 9b7a8b46bfa91..4ed14f203c315 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
@@ -821,13 +821,8 @@ static int dpu_plane_atomic_check_nosspp(struct drm_plane *plane,
{
int i, ret = 0, min_scale, max_scale;
struct dpu_plane *pdpu = to_dpu_plane(plane);
- struct dpu_kms *kms = _dpu_plane_get_kms(&pdpu->base);
- u64 max_mdp_clk_rate = kms->perf.max_core_clk_rate;
struct dpu_plane_state *pstate = to_dpu_plane_state(new_plane_state);
- struct dpu_sw_pipe_cfg *pipe_cfg;
- struct dpu_sw_pipe_cfg *r_pipe_cfg;
struct drm_rect fb_rect = { 0 };
- uint32_t max_linewidth;
min_scale = FRAC_16_16(1, MAX_UPSCALE_RATIO);
max_scale = MAX_DOWNSCALE_RATIO << 16;
@@ -850,14 +845,6 @@ static int dpu_plane_atomic_check_nosspp(struct drm_plane *plane,
return -EINVAL;
}
- /* move the assignment here, to ease handling to another pairs later */
- pipe_cfg = &pstate->pipe_cfg[0];
- r_pipe_cfg = &pstate->pipe_cfg[1];
- /* state->src is 16.16, src_rect is not */
- drm_rect_fp_to_int(&pipe_cfg->src_rect, &new_plane_state->src);
-
- pipe_cfg->dst_rect = new_plane_state->dst;
-
fb_rect.x2 = new_plane_state->fb->width;
fb_rect.y2 = new_plane_state->fb->height;
@@ -879,6 +866,31 @@ static int dpu_plane_atomic_check_nosspp(struct drm_plane *plane,
if (pstate->layout.plane_pitch[i] > DPU_SSPP_MAX_PITCH_SIZE)
return -E2BIG;
+ pstate->needs_qos_remap = drm_atomic_crtc_needs_modeset(crtc_state);
+
+ return 0;
+}
+
+static int dpu_plane_split(struct drm_plane *plane,
+ struct drm_plane_state *new_plane_state,
+ const struct drm_crtc_state *crtc_state)
+{
+ struct dpu_plane *pdpu = to_dpu_plane(plane);
+ struct dpu_kms *kms = _dpu_plane_get_kms(&pdpu->base);
+ u64 max_mdp_clk_rate = kms->perf.max_core_clk_rate;
+ struct dpu_plane_state *pstate = to_dpu_plane_state(new_plane_state);
+ struct dpu_sw_pipe_cfg *pipe_cfg;
+ struct dpu_sw_pipe_cfg *r_pipe_cfg;
+ uint32_t max_linewidth;
+
+ /* move the assignment here, to ease handling to another pairs later */
+ pipe_cfg = &pstate->pipe_cfg[0];
+ r_pipe_cfg = &pstate->pipe_cfg[1];
+ /* state->src is 16.16, src_rect is not */
+ drm_rect_fp_to_int(&pipe_cfg->src_rect, &new_plane_state->src);
+
+ pipe_cfg->dst_rect = new_plane_state->dst;
+
max_linewidth = pdpu->catalog->caps->max_linewidth;
drm_rect_rotate(&pipe_cfg->src_rect,
@@ -910,8 +922,6 @@ static int dpu_plane_atomic_check_nosspp(struct drm_plane *plane,
new_plane_state->fb->width, new_plane_state->fb->height,
new_plane_state->rotation);
- pstate->needs_qos_remap = drm_atomic_crtc_needs_modeset(crtc_state);
-
return 0;
}
@@ -1132,6 +1142,10 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
if (!new_plane_state->visible)
return 0;
+ ret = dpu_plane_split(plane, new_plane_state, crtc_state);
+ if (ret)
+ return ret;
+
if (!dpu_plane_try_multirect_parallel(pipe, pipe_cfg, r_pipe, r_pipe_cfg,
pipe->sspp,
msm_framebuffer_format(new_plane_state->fb),
@@ -1180,6 +1194,10 @@ static int dpu_plane_virtual_atomic_check(struct drm_plane *plane,
return 0;
}
+ ret = dpu_plane_split(plane, plane_state, crtc_state);
+ if (ret)
+ return ret;
+
/*
* Force resource reallocation if the format of FB or src/dst have
* changed. We might need to allocate different SSPP or SSPPs for this
--
2.43.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* Claude review: drm/msm/dpu: Extract plane splitting into a dedicated function
2026-03-12 8:28 ` [PATCH v19 1/4] drm/msm/dpu: Extract plane splitting into a dedicated function Jun Nie
@ 2026-03-13 4:21 ` Claude Code Review Bot
0 siblings, 0 replies; 10+ messages in thread
From: Claude Code Review Bot @ 2026-03-13 4:21 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Review: Low-risk refactor, looks correct.**
This patch extracts the plane-splitting logic (src/dst rect computation, wide-plane splitting) from `dpu_plane_atomic_check_nosspp()` into a new `dpu_plane_split()` function. The `needs_qos_remap` assignment stays in the check function while rect manipulation moves to the new function.
The extraction is clean. Both `dpu_plane_atomic_check()` and `dpu_plane_virtual_atomic_check()` now call `dpu_plane_split()` after `dpu_plane_atomic_check_nosspp()`. The ordering is preserved — validation first, then splitting.
One minor observation: the old comment `/* move the assignment here, to ease handling to another pairs later */` is carried over verbatim into the new function. This comment made sense in the original context but is a bit stale now. Not blocking.
Has Reviewed-by from Dmitry Baryshkov. **No issues found.**
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v19 2/4] drm/msm/dpu: Defer SSPP allocation until CRTC check
2026-03-12 8:28 [PATCH v19 0/4] drm/msm/dpu: Support quad pipe with dual-interface Jun Nie
2026-03-12 8:28 ` [PATCH v19 1/4] drm/msm/dpu: Extract plane splitting into a dedicated function Jun Nie
@ 2026-03-12 8:28 ` Jun Nie
2026-03-13 4:21 ` Claude review: " Claude Code Review Bot
2026-03-12 8:28 ` [PATCH v19 3/4] drm/msm/dpu: support plane splitting in quad-pipe case Jun Nie
` (2 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Jun Nie @ 2026-03-12 8:28 UTC (permalink / raw)
To: Abhinav Kumar, Dmitry Baryshkov, Sean Paul, Marijn Suijten,
David Airlie, Simona Vetter, Rob Clark, Neil Armstrong
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel, Jun Nie
Currently, mapping plane to SSPP occurs during the plane check phase for
non-virtual plane case. The SSPP allocation and plane mapping occurs during
CRTC check phase for virtual plane case. Defer these SSPP operations until
CRTC check stage to unify the 2 cases, and ease later revisement for
quad-pipe change.
Signed-off-by: Jun Nie <jun.nie@linaro.org>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 25 ++++--
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 136 ++++++++++++++----------------
2 files changed, 80 insertions(+), 81 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 6bf7c46379aed..e97456d4fbb8c 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1325,7 +1325,7 @@ static bool dpu_crtc_needs_dirtyfb(struct drm_crtc_state *cstate)
return false;
}
-static int dpu_crtc_reassign_planes(struct drm_crtc *crtc, struct drm_crtc_state *crtc_state)
+static int dpu_crtc_assign_planes(struct drm_crtc *crtc, struct drm_crtc_state *crtc_state)
{
int total_planes = crtc->dev->mode_config.num_total_plane;
struct drm_atomic_state *state = crtc_state->state;
@@ -1338,8 +1338,6 @@ static int dpu_crtc_reassign_planes(struct drm_crtc *crtc, struct drm_crtc_state
if (IS_ERR(global_state))
return PTR_ERR(global_state);
- dpu_rm_release_all_sspp(global_state, crtc);
-
if (!crtc_state->enable)
return 0;
@@ -1366,6 +1364,19 @@ static int dpu_crtc_reassign_planes(struct drm_crtc *crtc, struct drm_crtc_state
return ret;
}
+static int dpu_crtc_reassign_planes(struct drm_crtc *crtc, struct drm_crtc_state *crtc_state)
+{
+ struct dpu_global_state *global_state;
+
+ global_state = dpu_kms_get_global_state(crtc_state->state);
+ if (IS_ERR(global_state))
+ return PTR_ERR(global_state);
+
+ dpu_rm_release_all_sspp(global_state, crtc);
+
+ return dpu_crtc_assign_planes(crtc, crtc_state);
+}
+
#define MAX_CHANNELS_PER_CRTC PIPES_PER_PLANE
#define MAX_HDISPLAY_SPLIT 1080
@@ -1534,9 +1545,11 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
return rc;
}
- if (dpu_use_virtual_planes &&
- (crtc_state->planes_changed || crtc_state->zpos_changed)) {
- rc = dpu_crtc_reassign_planes(crtc, crtc_state);
+ if (crtc_state->planes_changed || crtc_state->zpos_changed) {
+ if (dpu_use_virtual_planes)
+ rc = dpu_crtc_reassign_planes(crtc, crtc_state);
+ else
+ rc = dpu_crtc_assign_planes(crtc, crtc_state);
if (rc < 0)
return rc;
}
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
index 4ed14f203c315..70992a4401d69 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
@@ -1112,65 +1112,13 @@ static int dpu_plane_try_multirect_shared(struct dpu_plane_state *pstate,
static int dpu_plane_atomic_check(struct drm_plane *plane,
struct drm_atomic_state *state)
-{
- struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state,
- plane);
- int ret = 0;
- struct dpu_plane *pdpu = to_dpu_plane(plane);
- struct dpu_plane_state *pstate = to_dpu_plane_state(new_plane_state);
- struct dpu_kms *dpu_kms = _dpu_plane_get_kms(plane);
- struct dpu_sw_pipe *pipe = &pstate->pipe[0];
- struct dpu_sw_pipe *r_pipe = &pstate->pipe[1];
- struct dpu_sw_pipe_cfg *pipe_cfg = &pstate->pipe_cfg[0];
- struct dpu_sw_pipe_cfg *r_pipe_cfg = &pstate->pipe_cfg[1];
- const struct drm_crtc_state *crtc_state = NULL;
- uint32_t max_linewidth = dpu_kms->catalog->caps->max_linewidth;
-
- if (new_plane_state->crtc)
- crtc_state = drm_atomic_get_new_crtc_state(state,
- new_plane_state->crtc);
-
- pipe->sspp = dpu_rm_get_sspp(&dpu_kms->rm, pdpu->pipe);
-
- if (!pipe->sspp)
- return -EINVAL;
-
- ret = dpu_plane_atomic_check_nosspp(plane, new_plane_state, crtc_state);
- if (ret)
- return ret;
-
- if (!new_plane_state->visible)
- return 0;
-
- ret = dpu_plane_split(plane, new_plane_state, crtc_state);
- if (ret)
- return ret;
-
- if (!dpu_plane_try_multirect_parallel(pipe, pipe_cfg, r_pipe, r_pipe_cfg,
- pipe->sspp,
- msm_framebuffer_format(new_plane_state->fb),
- max_linewidth)) {
- DPU_DEBUG_PLANE(pdpu, "invalid " DRM_RECT_FMT " /" DRM_RECT_FMT
- " max_line:%u, can't use split source\n",
- DRM_RECT_ARG(&pipe_cfg->src_rect),
- DRM_RECT_ARG(&r_pipe_cfg->src_rect),
- max_linewidth);
- return -E2BIG;
- }
-
- return dpu_plane_atomic_check_sspp(plane, state, crtc_state);
-}
-
-static int dpu_plane_virtual_atomic_check(struct drm_plane *plane,
- struct drm_atomic_state *state)
{
struct drm_plane_state *plane_state =
drm_atomic_get_plane_state(state, plane);
struct drm_plane_state *old_plane_state =
drm_atomic_get_old_plane_state(state, plane);
- struct dpu_plane_state *pstate = to_dpu_plane_state(plane_state);
+ int ret = 0;
struct drm_crtc_state *crtc_state = NULL;
- int ret, i;
if (IS_ERR(plane_state))
return PTR_ERR(plane_state);
@@ -1183,20 +1131,8 @@ static int dpu_plane_virtual_atomic_check(struct drm_plane *plane,
if (ret)
return ret;
- if (!plane_state->visible) {
- /*
- * resources are freed by dpu_crtc_assign_plane_resources(),
- * but clean them here.
- */
- for (i = 0; i < PIPES_PER_PLANE; i++)
- pstate->pipe[i].sspp = NULL;
-
+ if (!plane_state->visible)
return 0;
- }
-
- ret = dpu_plane_split(plane, plane_state, crtc_state);
- if (ret)
- return ret;
/*
* Force resource reallocation if the format of FB or src/dst have
@@ -1211,7 +1147,6 @@ static int dpu_plane_virtual_atomic_check(struct drm_plane *plane,
msm_framebuffer_format(old_plane_state->fb) !=
msm_framebuffer_format(plane_state->fb))
crtc_state->planes_changed = true;
-
return 0;
}
@@ -1258,9 +1193,9 @@ static int dpu_plane_virtual_assign_resources(struct drm_crtc *crtc,
struct dpu_global_state *global_state,
struct drm_atomic_state *state,
struct drm_plane_state *plane_state,
+ const struct drm_crtc_state *crtc_state,
struct drm_plane_state **prev_adjacent_plane_state)
{
- const struct drm_crtc_state *crtc_state = NULL;
struct drm_plane *plane = plane_state->plane;
struct dpu_kms *dpu_kms = _dpu_plane_get_kms(plane);
struct dpu_rm_sspp_requirements reqs;
@@ -1270,10 +1205,6 @@ static int dpu_plane_virtual_assign_resources(struct drm_crtc *crtc,
const struct msm_format *fmt;
int i, ret;
- if (plane_state->crtc)
- crtc_state = drm_atomic_get_new_crtc_state(state,
- plane_state->crtc);
-
pstate = to_dpu_plane_state(plane_state);
for (i = 0; i < STAGES_PER_PLANE; i++)
prev_adjacent_pstate[i] = prev_adjacent_plane_state[i] ?
@@ -1285,6 +1216,10 @@ static int dpu_plane_virtual_assign_resources(struct drm_crtc *crtc,
if (!plane_state->fb)
return -EINVAL;
+ ret = dpu_plane_split(plane, plane_state, crtc_state);
+ if (ret)
+ return ret;
+
fmt = msm_framebuffer_format(plane_state->fb);
reqs.yuv = MSM_FORMAT_IS_YUV(fmt);
reqs.scale = (plane_state->src_w >> 16 != plane_state->crtc_w) ||
@@ -1315,14 +1250,55 @@ static int dpu_plane_virtual_assign_resources(struct drm_crtc *crtc,
return dpu_plane_atomic_check_sspp(plane, state, crtc_state);
}
+static int dpu_plane_assign_resources(struct drm_crtc *crtc,
+ struct dpu_global_state *global_state,
+ struct drm_atomic_state *state,
+ struct drm_plane_state *plane_state,
+ const struct drm_crtc_state *crtc_state)
+{
+ struct drm_plane *plane = plane_state->plane;
+ struct dpu_kms *dpu_kms = _dpu_plane_get_kms(plane);
+ struct dpu_plane_state *pstate = to_dpu_plane_state(plane_state);
+ struct dpu_sw_pipe *pipe = &pstate->pipe[0];
+ struct dpu_sw_pipe *r_pipe = &pstate->pipe[1];
+ struct dpu_sw_pipe_cfg *pipe_cfg = &pstate->pipe_cfg[0];
+ struct dpu_sw_pipe_cfg *r_pipe_cfg = &pstate->pipe_cfg[1];
+ struct dpu_plane *pdpu = to_dpu_plane(plane);
+ int ret;
+
+ pipe->sspp = dpu_rm_get_sspp(&dpu_kms->rm, pdpu->pipe);
+ if (!pipe->sspp)
+ return -EINVAL;
+
+ ret = dpu_plane_split(plane, plane_state, crtc_state);
+ if (ret)
+ return ret;
+
+ if (!dpu_plane_try_multirect_parallel(pipe, pipe_cfg, r_pipe, r_pipe_cfg,
+ pipe->sspp,
+ msm_framebuffer_format(plane_state->fb),
+ dpu_kms->catalog->caps->max_linewidth)) {
+ DPU_DEBUG_PLANE(pdpu, "invalid " DRM_RECT_FMT " /" DRM_RECT_FMT
+ " max_line:%u, can't use split source\n",
+ DRM_RECT_ARG(&pipe_cfg->src_rect),
+ DRM_RECT_ARG(&r_pipe_cfg->src_rect),
+ dpu_kms->catalog->caps->max_linewidth);
+ return -E2BIG;
+ }
+
+ return dpu_plane_atomic_check_sspp(plane, state, crtc_state);
+}
+
int dpu_assign_plane_resources(struct dpu_global_state *global_state,
struct drm_atomic_state *state,
struct drm_crtc *crtc,
struct drm_plane_state **states,
unsigned int num_planes)
{
- unsigned int i;
struct drm_plane_state *prev_adjacent_plane_state[STAGES_PER_PLANE] = { NULL };
+ const struct drm_crtc_state *crtc_state = NULL;
+ unsigned int i;
+ int ret;
for (i = 0; i < num_planes; i++) {
struct drm_plane_state *plane_state = states[i];
@@ -1331,8 +1307,18 @@ int dpu_assign_plane_resources(struct dpu_global_state *global_state,
!plane_state->visible)
continue;
- int ret = dpu_plane_virtual_assign_resources(crtc, global_state,
+ if (plane_state->crtc)
+ crtc_state = drm_atomic_get_new_crtc_state(state,
+ plane_state->crtc);
+
+ if (!dpu_use_virtual_planes)
+ ret = dpu_plane_assign_resources(crtc, global_state,
+ state, plane_state,
+ crtc_state);
+ else
+ ret = dpu_plane_virtual_assign_resources(crtc, global_state,
state, plane_state,
+ crtc_state,
prev_adjacent_plane_state);
if (ret)
return ret;
@@ -1769,7 +1755,7 @@ static const struct drm_plane_helper_funcs dpu_plane_helper_funcs = {
static const struct drm_plane_helper_funcs dpu_plane_virtual_helper_funcs = {
.prepare_fb = dpu_plane_prepare_fb,
.cleanup_fb = dpu_plane_cleanup_fb,
- .atomic_check = dpu_plane_virtual_atomic_check,
+ .atomic_check = dpu_plane_atomic_check,
.atomic_update = dpu_plane_atomic_update,
};
--
2.43.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* Claude review: drm/msm/dpu: Defer SSPP allocation until CRTC check
2026-03-12 8:28 ` [PATCH v19 2/4] drm/msm/dpu: Defer SSPP allocation until CRTC check Jun Nie
@ 2026-03-13 4:21 ` Claude Code Review Bot
0 siblings, 0 replies; 10+ messages in thread
From: Claude Code Review Bot @ 2026-03-13 4:21 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Review: Significant refactor, generally correct but has notable observations.**
This patch unifies the virtual and non-virtual plane paths. Key changes:
- Merges `dpu_plane_virtual_atomic_check()` into `dpu_plane_atomic_check()` (the vtable entry is unified)
- Creates `dpu_plane_assign_resources()` for the non-virtual case (mirroring `dpu_plane_virtual_assign_resources()`)
- Both are called from `dpu_assign_plane_resources()` in CRTC check
- `dpu_crtc_assign_planes()` is factored out and called for non-virtual planes too
Observations:
1. **Blank line removal at line 803:** The patch removes a blank line between `crtc_state->planes_changed = true;` and `return 0;` in the virtual path. This is a trivial cosmetic change mixed into a functional patch. Minor nit.
2. **The `dpu_plane_atomic_check` now always calls `drm_atomic_get_plane_state()`** which can add the plane to the atomic state even in non-virtual mode. Previously the non-virtual path used `drm_atomic_get_new_plane_state()` (which is read-only). This is a behavioral change — `drm_atomic_get_plane_state()` can trigger plane state duplication. This may be intentional to ensure the plane state is writable since `dpu_plane_split` now runs from the CRTC check phase, but it's worth confirming there are no side effects.
3. **The clearing of `pstate->pipe[i].sspp = NULL` for invisible planes was removed.** The comment said "resources are freed by `dpu_crtc_assign_plane_resources()`" — since the non-virtual path now also goes through `dpu_crtc_assign_planes()`, this should still be handled. But verify that the non-virtual path properly handles invisible planes (the `!plane_state->visible` continue at line 1307 skips assignment, but doesn't clear stale SSPP pointers).
4. **`crtc_state` variable is declared outside the loop in `dpu_assign_plane_resources()`** but assigned inside. If `plane_state->crtc` is NULL, `crtc_state` retains its previous value (NULL or from a prior iteration). This should be fine since the continue guards check `!plane_state->fb || !plane_state->visible`, but it would be cleaner to initialize inside the loop or NULL it explicitly.
**No Reviewed-by tag.** This is the most complex patch and warrants careful review.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v19 3/4] drm/msm/dpu: support plane splitting in quad-pipe case
2026-03-12 8:28 [PATCH v19 0/4] drm/msm/dpu: Support quad pipe with dual-interface Jun Nie
2026-03-12 8:28 ` [PATCH v19 1/4] drm/msm/dpu: Extract plane splitting into a dedicated function Jun Nie
2026-03-12 8:28 ` [PATCH v19 2/4] drm/msm/dpu: Defer SSPP allocation until CRTC check Jun Nie
@ 2026-03-12 8:28 ` Jun Nie
2026-03-13 4:21 ` Claude review: " Claude Code Review Bot
2026-03-12 8:28 ` [PATCH v19 4/4] drm/msm/dpu: Enable quad-pipe for DSC and dual-DSI case Jun Nie
2026-03-13 4:21 ` Claude review: drm/msm/dpu: Support quad pipe with dual-interface Claude Code Review Bot
4 siblings, 1 reply; 10+ messages in thread
From: Jun Nie @ 2026-03-12 8:28 UTC (permalink / raw)
To: Abhinav Kumar, Dmitry Baryshkov, Sean Paul, Marijn Suijten,
David Airlie, Simona Vetter, Rob Clark, Neil Armstrong
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel, Jun Nie,
Dmitry Baryshkov
The content of every half of screen is sent out via one interface in
dual-DSI case. The content for every interface is blended by a LM
pair in quad-pipe case, thus a LM pair should not blend any content
that cross the half of screen in this case. Clip plane into pipes per
left and right half screen ROI if topology is quad pipe case.
The clipped rectangle on every half of screen is futher handled by two
pipes if its width exceeds a limit for a single pipe.
For non-virtual-plane case, there is always one stage config to serve
a LM or LM pair. So the clipping does not occur when interating stages
in this case. The plane is mapped to 2 pipes only when width or clock
rate exceeds hardware constrain within stage check.
Signed-off-by: Jun Nie <jun.nie@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Jessica Zhang <jessica.zhang@oss.qualcomm.com>
Patchwork: https://patchwork.freedesktop.org/patch/675416/
Link: https://lore.kernel.org/r/20250918-v6-16-rc2-quad-pipe-upstream-4-v16-9-ff6232e3472f@linaro.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 11 +++
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h | 2 +
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 146 +++++++++++++++++++++---------
3 files changed, 117 insertions(+), 42 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index e97456d4fbb8c..321fe13ee4eb0 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1670,6 +1670,17 @@ int dpu_crtc_vblank(struct drm_crtc *crtc, bool en)
return 0;
}
+/**
+ * dpu_crtc_get_num_lm - Get mixer number in this CRTC pipeline
+ * @state: Pointer to drm crtc state object
+ */
+unsigned int dpu_crtc_get_num_lm(const struct drm_crtc_state *state)
+{
+ struct dpu_crtc_state *cstate = to_dpu_crtc_state(state);
+
+ return cstate->num_mixers;
+}
+
#ifdef CONFIG_DEBUG_FS
static int _dpu_debugfs_status_show(struct seq_file *s, void *data)
{
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
index 94392b9b92454..6eaba5696e8e6 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
@@ -267,4 +267,6 @@ static inline enum dpu_crtc_client_type dpu_crtc_get_client_type(
void dpu_crtc_frame_event_cb(struct drm_crtc *crtc, u32 event);
+unsigned int dpu_crtc_get_num_lm(const struct drm_crtc_state *state);
+
#endif /* _DPU_CRTC_H_ */
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
index 70992a4401d69..5d83ff689de7c 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
@@ -881,47 +881,111 @@ static int dpu_plane_split(struct drm_plane *plane,
struct dpu_plane_state *pstate = to_dpu_plane_state(new_plane_state);
struct dpu_sw_pipe_cfg *pipe_cfg;
struct dpu_sw_pipe_cfg *r_pipe_cfg;
+ const struct drm_display_mode *mode = &crtc_state->adjusted_mode;
uint32_t max_linewidth;
+ u32 num_lm;
+ int stage_id, num_stages;
- /* move the assignment here, to ease handling to another pairs later */
- pipe_cfg = &pstate->pipe_cfg[0];
- r_pipe_cfg = &pstate->pipe_cfg[1];
- /* state->src is 16.16, src_rect is not */
- drm_rect_fp_to_int(&pipe_cfg->src_rect, &new_plane_state->src);
+ max_linewidth = pdpu->catalog->caps->max_linewidth;
- pipe_cfg->dst_rect = new_plane_state->dst;
+ /* In non-virtual plane case, one mixer pair is always needed. */
+ num_lm = dpu_crtc_get_num_lm(crtc_state);
+ if (dpu_use_virtual_planes)
+ num_stages = (num_lm + 1) / 2;
+ else
+ num_stages = 1;
- max_linewidth = pdpu->catalog->caps->max_linewidth;
+ /*
+ * For wide plane that exceeds SSPP rectangle constrain, it needed to
+ * be split and mapped to 2 rectangles with 1 config for 2:2:1.
+ * For 2 interfaces cases, such as dual DSI, 2:2:2 topology is needed.
+ * If the width or clock exceeds hardware limitation in every half of
+ * screen, 4:4:2 topology is needed and virtual plane feature should
+ * be enabled to map plane to more than 1 SSPP. 2 stage configs are
+ * needed to serve 2 mixer pairs in this 4:4:2 case. So both left/right
+ * half of plane splitting, and splitting within the half of screen is
+ * needed in quad-pipe case. Check dest rectangle left/right clipping
+ * and iterate mixer configs for this plane first, then check wide
+ * rectangle splitting in every half next.
+ */
+ for (stage_id = 0; stage_id < num_stages; stage_id++) {
+ struct drm_rect mixer_rect = {
+ .x1 = stage_id * mode->hdisplay / num_stages,
+ .y1 = 0,
+ .x2 = (stage_id + 1) * mode->hdisplay / num_stages,
+ .y2 = mode->vdisplay
+ };
+ int cfg_idx = stage_id * PIPES_PER_STAGE;
- drm_rect_rotate(&pipe_cfg->src_rect,
- new_plane_state->fb->width, new_plane_state->fb->height,
- new_plane_state->rotation);
+ pipe_cfg = &pstate->pipe_cfg[cfg_idx];
+ r_pipe_cfg = &pstate->pipe_cfg[cfg_idx + 1];
- if ((drm_rect_width(&pipe_cfg->src_rect) > max_linewidth) ||
- _dpu_plane_calc_clk(&crtc_state->adjusted_mode, pipe_cfg) > max_mdp_clk_rate) {
- if (drm_rect_width(&pipe_cfg->src_rect) > 2 * max_linewidth) {
- DPU_DEBUG_PLANE(pdpu, "invalid src " DRM_RECT_FMT " line:%u\n",
- DRM_RECT_ARG(&pipe_cfg->src_rect), max_linewidth);
- return -E2BIG;
+ drm_rect_fp_to_int(&pipe_cfg->src_rect, &new_plane_state->src);
+
+ drm_rect_rotate(&pipe_cfg->src_rect,
+ new_plane_state->fb->width, new_plane_state->fb->height,
+ new_plane_state->rotation);
+
+ pipe_cfg->dst_rect = new_plane_state->dst;
+
+ DPU_DEBUG_PLANE(pdpu, "checking src " DRM_RECT_FMT
+ " vs clip window " DRM_RECT_FMT "\n",
+ DRM_RECT_ARG(&pipe_cfg->src_rect),
+ DRM_RECT_ARG(&mixer_rect));
+
+ /*
+ * If this plane does not fall into mixer rect, check next
+ * mixer rect.
+ */
+ if (!drm_rect_clip_scaled(&pipe_cfg->src_rect,
+ &pipe_cfg->dst_rect,
+ &mixer_rect)) {
+ memset(pipe_cfg, 0, 2 * sizeof(struct dpu_sw_pipe_cfg));
+
+ continue;
}
- *r_pipe_cfg = *pipe_cfg;
- pipe_cfg->src_rect.x2 = (pipe_cfg->src_rect.x1 + pipe_cfg->src_rect.x2) >> 1;
- pipe_cfg->dst_rect.x2 = (pipe_cfg->dst_rect.x1 + pipe_cfg->dst_rect.x2) >> 1;
- r_pipe_cfg->src_rect.x1 = pipe_cfg->src_rect.x2;
- r_pipe_cfg->dst_rect.x1 = pipe_cfg->dst_rect.x2;
- } else {
- memset(r_pipe_cfg, 0, sizeof(*r_pipe_cfg));
- }
+ pipe_cfg->dst_rect.x1 -= mixer_rect.x1;
+ pipe_cfg->dst_rect.x2 -= mixer_rect.x1;
+
+ DPU_DEBUG_PLANE(pdpu, "Got clip src:" DRM_RECT_FMT " dst: " DRM_RECT_FMT "\n",
+ DRM_RECT_ARG(&pipe_cfg->src_rect), DRM_RECT_ARG(&pipe_cfg->dst_rect));
+
+ /* Split wide rect into 2 rect */
+ if ((drm_rect_width(&pipe_cfg->src_rect) > max_linewidth) ||
+ _dpu_plane_calc_clk(mode, pipe_cfg) > max_mdp_clk_rate) {
+
+ if (drm_rect_width(&pipe_cfg->src_rect) > 2 * max_linewidth) {
+ DPU_DEBUG_PLANE(pdpu, "invalid src " DRM_RECT_FMT " line:%u\n",
+ DRM_RECT_ARG(&pipe_cfg->src_rect), max_linewidth);
+ return -E2BIG;
+ }
+
+ memcpy(r_pipe_cfg, pipe_cfg, sizeof(struct dpu_sw_pipe_cfg));
+ pipe_cfg->src_rect.x2 = (pipe_cfg->src_rect.x1 + pipe_cfg->src_rect.x2) >> 1;
+ pipe_cfg->dst_rect.x2 = (pipe_cfg->dst_rect.x1 + pipe_cfg->dst_rect.x2) >> 1;
+ r_pipe_cfg->src_rect.x1 = pipe_cfg->src_rect.x2;
+ r_pipe_cfg->dst_rect.x1 = pipe_cfg->dst_rect.x2;
+ DPU_DEBUG_PLANE(pdpu, "Split wide plane into:"
+ DRM_RECT_FMT " and " DRM_RECT_FMT "\n",
+ DRM_RECT_ARG(&pipe_cfg->src_rect),
+ DRM_RECT_ARG(&r_pipe_cfg->src_rect));
+ } else {
+ memset(r_pipe_cfg, 0, sizeof(struct dpu_sw_pipe_cfg));
+ }
- drm_rect_rotate_inv(&pipe_cfg->src_rect,
- new_plane_state->fb->width, new_plane_state->fb->height,
- new_plane_state->rotation);
- if (drm_rect_width(&r_pipe_cfg->src_rect) != 0)
- drm_rect_rotate_inv(&r_pipe_cfg->src_rect,
- new_plane_state->fb->width, new_plane_state->fb->height,
+ drm_rect_rotate_inv(&pipe_cfg->src_rect,
+ new_plane_state->fb->width,
+ new_plane_state->fb->height,
new_plane_state->rotation);
+ if (drm_rect_width(&r_pipe_cfg->src_rect) != 0)
+ drm_rect_rotate_inv(&r_pipe_cfg->src_rect,
+ new_plane_state->fb->width,
+ new_plane_state->fb->height,
+ new_plane_state->rotation);
+ }
+
return 0;
}
@@ -995,20 +1059,18 @@ static int dpu_plane_atomic_check_sspp(struct drm_plane *plane,
drm_atomic_get_new_plane_state(state, plane);
struct dpu_plane *pdpu = to_dpu_plane(plane);
struct dpu_plane_state *pstate = to_dpu_plane_state(new_plane_state);
- struct dpu_sw_pipe *pipe = &pstate->pipe[0];
- struct dpu_sw_pipe *r_pipe = &pstate->pipe[1];
- struct dpu_sw_pipe_cfg *pipe_cfg = &pstate->pipe_cfg[0];
- struct dpu_sw_pipe_cfg *r_pipe_cfg = &pstate->pipe_cfg[1];
- int ret = 0;
- ret = dpu_plane_atomic_check_pipe(pdpu, pipe, pipe_cfg,
- &crtc_state->adjusted_mode,
- new_plane_state);
- if (ret)
- return ret;
+ struct dpu_sw_pipe *pipe;
+ struct dpu_sw_pipe_cfg *pipe_cfg;
+ int ret = 0, i;
- if (drm_rect_width(&r_pipe_cfg->src_rect) != 0) {
- ret = dpu_plane_atomic_check_pipe(pdpu, r_pipe, r_pipe_cfg,
+ for (i = 0; i < PIPES_PER_PLANE; i++) {
+ pipe = &pstate->pipe[i];
+ pipe_cfg = &pstate->pipe_cfg[i];
+ if (!drm_rect_width(&pipe_cfg->src_rect))
+ continue;
+ DPU_DEBUG_PLANE(pdpu, "pipe %d is in use, validate it\n", i);
+ ret = dpu_plane_atomic_check_pipe(pdpu, pipe, pipe_cfg,
&crtc_state->adjusted_mode,
new_plane_state);
if (ret)
--
2.43.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* Claude review: drm/msm/dpu: support plane splitting in quad-pipe case
2026-03-12 8:28 ` [PATCH v19 3/4] drm/msm/dpu: support plane splitting in quad-pipe case Jun Nie
@ 2026-03-13 4:21 ` Claude Code Review Bot
0 siblings, 0 replies; 10+ messages in thread
From: Claude Code Review Bot @ 2026-03-13 4:21 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Review: Core logic change, mostly correct but with some concerns.**
This extends `dpu_plane_split()` to iterate over multiple mixer stages. Key logic:
- `num_stages = (num_lm + 1) / 2` for virtual planes (1 stage for 1-2 LMs, 2 stages for 3-4 LMs)
- Each stage covers a horizontal band of the display
- For each stage, the plane's dst_rect is clipped against the mixer rectangle
- Within each stage, a wide-plane split may further divide into 2 pipes
Concerns:
1. **`dpu_crtc_get_num_lm()` is called before topology is finalized in some paths.** The function reads `cstate->num_mixers`. In patch 2, `dpu_plane_split()` is called from `dpu_plane_assign_resources()` / `dpu_plane_virtual_assign_resources()`, which happens during CRTC check after `dpu_crtc_assign_resources()` has run. So `num_mixers` should be set by then. But this ordering dependency is subtle and fragile.
2. **`dpu_plane_atomic_check_sspp()` now loops over all `PIPES_PER_PLANE` (4) entries.** This is correct but changes from checking exactly pipe[0] and pipe[1] to checking any non-zero-width pipe_cfg. For the non-virtual case with `num_stages=1`, only pipe_cfg[0] and pipe_cfg[1] are populated, and pipe_cfg[2]/pipe_cfg[3] should be zero-initialized from `dpu_plane_state` allocation. This should be safe.
3. **The `memset(pipe_cfg, 0, 2 * sizeof(struct dpu_sw_pipe_cfg))` at line 943** clears both pipe_cfg and r_pipe_cfg when the plane doesn't intersect a mixer rect. This relies on `pipe_cfg` and `r_pipe_cfg` being contiguous in the array, which they are (`pipe_cfg[cfg_idx]` and `pipe_cfg[cfg_idx + 1]`). Correct but uses a fragile assumption about memory layout.
4. **The mixer_rect calculation** `stage_id * mode->hdisplay / num_stages` uses integer division. For odd hdisplay values with num_stages=2, the split might not be perfectly symmetric (e.g., 1081/2 = 540 vs 541). This should match the hardware configuration but is worth verifying.
Has Reviewed-by from Dmitry Baryshkov and Jessica Zhang. **Minor concerns noted above.**
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v19 4/4] drm/msm/dpu: Enable quad-pipe for DSC and dual-DSI case
2026-03-12 8:28 [PATCH v19 0/4] drm/msm/dpu: Support quad pipe with dual-interface Jun Nie
` (2 preceding siblings ...)
2026-03-12 8:28 ` [PATCH v19 3/4] drm/msm/dpu: support plane splitting in quad-pipe case Jun Nie
@ 2026-03-12 8:28 ` Jun Nie
2026-03-13 4:21 ` Claude review: " Claude Code Review Bot
2026-03-13 4:21 ` Claude review: drm/msm/dpu: Support quad pipe with dual-interface Claude Code Review Bot
4 siblings, 1 reply; 10+ messages in thread
From: Jun Nie @ 2026-03-12 8:28 UTC (permalink / raw)
To: Abhinav Kumar, Dmitry Baryshkov, Sean Paul, Marijn Suijten,
David Airlie, Simona Vetter, Rob Clark, Neil Armstrong
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel, Jun Nie,
Dmitry Baryshkov
To support high-resolution cases that exceed the width constrain
or scenarios that surpass the maximum MDP clock rate, additional
pipes are necessary to enable parallel data processing within
the width constraints and MDP clock rate.
Expand pipe array size to 4. Request 4 mixers and 4 DSCs for
high-resolution cases where dual interfaces are enabled for virtual
plane case. More use cases can be incorporated later if quad-pipe
capabilities are required.
Signed-off-by: Jun Nie <jun.nie@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Jessica Zhang <quic_jesszhan@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/675418/
Link: https://lore.kernel.org/r/20250918-v6-16-rc2-quad-pipe-upstream-4-v16-10-ff6232e3472f@linaro.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 48 ++++++++++++++++--------
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h | 6 +--
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 29 +++++---------
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h | 2 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 2 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h | 2 +-
6 files changed, 47 insertions(+), 42 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 321fe13ee4eb0..de6fbc5e33a60 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -200,7 +200,7 @@ static int dpu_crtc_get_lm_crc(struct drm_crtc *crtc,
struct dpu_crtc_state *crtc_state)
{
struct dpu_crtc_mixer *m;
- u32 crcs[CRTC_DUAL_MIXERS];
+ u32 crcs[CRTC_QUAD_MIXERS];
int rc = 0;
int i;
@@ -1388,6 +1388,9 @@ 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;
+ struct msm_drm_private *priv = crtc->dev->dev_private;
+ struct dpu_kms *kms = to_dpu_kms(priv->kms);
+ u32 num_rt_intf;
drm_for_each_encoder_mask(drm_enc, crtc->dev, crtc_state->encoder_mask)
dpu_encoder_update_topology(drm_enc, &topology, crtc_state->state,
@@ -1400,31 +1403,44 @@ static struct msm_display_topology dpu_crtc_get_topology(
*
* Dual display
* 2 LM, 2 INTF ( Split display using 2 interfaces)
+ * 4 LM, 2 INTF ( Split display using 2 interfaces and stream merge
+ to support high resolution interfaces if virtual
+ plane is enabled)
+ * If DSC is enabled, use 2:2:2 for 2 LMs case, and 4:4:2 for 4 LMs
+ * case.
*
* Single display
* 1 LM, 1 INTF
* 2 LM, 1 INTF (stream merge to support high resolution interfaces)
*
- * If DSC is enabled, use 2 LMs for 2:2:1 topology
+ * If DSC is enabled, use 2 LMs for 2:2:1 topology for single display
+ * to support legacy devices that use this topology.
*
* Add dspps to the reservation requirements if ctm or gamma_lut are requested
- *
- * Only hardcode num_lm to 2 for cases where num_intf == 2 and CWB is not
- * enabled. This is because in cases where CWB is enabled, num_intf will
- * 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.
*/
- if (topology.num_intf == 2 && !topology.cwb_enabled)
- topology.num_lm = 2;
- 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;
+ num_rt_intf = topology.num_intf;
+ if (topology.cwb_enabled)
+ num_rt_intf--;
+
+ if ((mode->hdisplay > (MAX_HDISPLAY_SPLIT * num_rt_intf)) ||
+ ((u64)mode->hdisplay * mode->vtotal * drm_mode_vrefresh(mode) >
+ kms->perf.max_core_clk_rate))
+ topology.num_lm = num_rt_intf * 2;
else
- topology.num_lm = 1;
+ topology.num_lm = num_rt_intf;
+
+ if (!dpu_use_virtual_planes)
+ topology.num_lm = min(2, topology.num_lm);
+
+ if (!dpu_kms->catalog->caps->has_3d_merge)
+ topology.num_lm = min(num_rt_intf, topology.num_lm);
+
+ if (topology.num_dsc) {
+ if (num_rt_intf == 1)
+ topology.num_lm = 2;
+ topology.num_dsc = topology.num_lm;
+ }
if (crtc_state->ctm || crtc_state->gamma_lut)
topology.num_dspp = topology.num_lm;
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
index 6eaba5696e8e6..455073c7025b0 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
@@ -210,7 +210,7 @@ struct dpu_crtc_state {
bool bw_control;
bool bw_split_vote;
- struct drm_rect lm_bounds[CRTC_DUAL_MIXERS];
+ struct drm_rect lm_bounds[CRTC_QUAD_MIXERS];
uint64_t input_fence_timeout_ns;
@@ -218,10 +218,10 @@ struct dpu_crtc_state {
/* HW Resources reserved for the crtc */
u32 num_mixers;
- struct dpu_crtc_mixer mixers[CRTC_DUAL_MIXERS];
+ struct dpu_crtc_mixer mixers[CRTC_QUAD_MIXERS];
u32 num_ctls;
- struct dpu_hw_ctl *hw_ctls[CRTC_DUAL_MIXERS];
+ struct dpu_hw_ctl *hw_ctls[CRTC_QUAD_MIXERS];
enum dpu_crtc_crc_source crc_source;
int crc_frame_skip_count;
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index eba1d52211f68..058a7c8727f7c 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -55,7 +55,7 @@
#define MAX_PHYS_ENCODERS_PER_VIRTUAL \
(MAX_H_TILES_PER_DISPLAY * NUM_PHYS_ENCODER_TYPES)
-#define MAX_CHANNELS_PER_ENC 2
+#define MAX_CHANNELS_PER_ENC 4
#define MAX_CWB_PER_ENC 2
#define IDLE_SHORT_TIMEOUT 1
@@ -661,7 +661,6 @@ void dpu_encoder_update_topology(struct drm_encoder *drm_enc,
struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc);
struct msm_drm_private *priv = dpu_enc->base.dev->dev_private;
struct msm_display_info *disp_info = &dpu_enc->disp_info;
- struct dpu_kms *dpu_kms = to_dpu_kms(priv->kms);
struct drm_connector *connector;
struct drm_connector_state *conn_state;
struct drm_framebuffer *fb;
@@ -675,22 +674,12 @@ void dpu_encoder_update_topology(struct drm_encoder *drm_enc,
dsc = dpu_encoder_get_dsc_config(drm_enc);
- /* We only support 2 DSC mode (with 2 LM and 1 INTF) */
- if (dsc) {
- /*
- * Use 2 DSC encoders, 2 layer mixers and 1 or 2 interfaces
- * when Display Stream Compression (DSC) is enabled,
- * and when enough DSC blocks are available.
- * This is power-optimal and can drive up to (including) 4k
- * screens.
- */
- WARN(topology->num_intf > 2,
- "DSC topology cannot support more than 2 interfaces\n");
- if (topology->num_intf >= 2 || dpu_kms->catalog->dsc_count >= 2)
- topology->num_dsc = 2;
- else
- topology->num_dsc = 1;
- }
+ /*
+ * Set DSC number as 1 to mark the enabled status, will be adjusted
+ * in dpu_crtc_get_topology()
+ */
+ if (dsc)
+ topology->num_dsc = 1;
connector = drm_atomic_get_new_connector_for_encoder(state, drm_enc);
if (!connector)
@@ -2180,8 +2169,8 @@ static void dpu_encoder_helper_reset_mixers(struct dpu_encoder_phys *phys_enc)
{
int i, num_lm;
struct dpu_global_state *global_state;
- struct dpu_hw_blk *hw_lm[2];
- struct dpu_hw_mixer *hw_mixer[2];
+ struct dpu_hw_blk *hw_lm[MAX_CHANNELS_PER_ENC];
+ struct dpu_hw_mixer *hw_mixer[MAX_CHANNELS_PER_ENC];
struct dpu_hw_ctl *ctl = phys_enc->hw_ctl;
/* reset all mixers for this encoder */
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
index 61b22d9494546..09395d7910ac8 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
@@ -302,7 +302,7 @@ static inline enum dpu_3d_blend_mode dpu_encoder_helper_get_3d_blend_mode(
/* Use merge_3d unless DSC MERGE topology is used */
if (phys_enc->split_role == ENC_ROLE_SOLO &&
- dpu_cstate->num_mixers == CRTC_DUAL_MIXERS &&
+ (dpu_cstate->num_mixers != 1) &&
!dpu_encoder_use_dsc_merge(phys_enc->parent))
return BLEND_3D_H_ROW_INT;
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 70d5ed4732f2e..b93442f75c2eb 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
@@ -24,7 +24,7 @@
#define DPU_MAX_IMG_WIDTH 0x3fff
#define DPU_MAX_IMG_HEIGHT 0x3fff
-#define CRTC_DUAL_MIXERS 2
+#define CRTC_QUAD_MIXERS 4
#define MAX_XIN_COUNT 16
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h
index 046b683d4c66d..31451241f0839 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h
@@ -34,7 +34,7 @@
#define DPU_MAX_PLANES 4
#endif
-#define STAGES_PER_PLANE 1
+#define STAGES_PER_PLANE 2
#define PIPES_PER_STAGE 2
#define PIPES_PER_PLANE (PIPES_PER_STAGE * STAGES_PER_PLANE)
#ifndef DPU_MAX_DE_CURVES
--
2.43.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* Claude review: drm/msm/dpu: Enable quad-pipe for DSC and dual-DSI case
2026-03-12 8:28 ` [PATCH v19 4/4] drm/msm/dpu: Enable quad-pipe for DSC and dual-DSI case Jun Nie
@ 2026-03-13 4:21 ` Claude Code Review Bot
0 siblings, 0 replies; 10+ messages in thread
From: Claude Code Review Bot @ 2026-03-13 4:21 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Review: Enables the feature, several issues.**
1. **Shadowed `kms` variable in `dpu_crtc_get_topology()`:** The function takes `struct dpu_kms *dpu_kms` as a parameter but also declares a local:
```c
struct msm_drm_private *priv = crtc->dev->dev_private;
struct dpu_kms *kms = to_dpu_kms(priv->kms);
```
The local `kms` is used at line 1428 (`kms->perf.max_core_clk_rate`) while `dpu_kms` is used at line 1436 (`dpu_kms->catalog->caps->has_3d_merge`). Both should be the same object, but having two variables referring to the same thing is confusing and error-prone. The `dpu_kms` parameter should be used consistently, and the local `kms`/`priv` declarations should be removed.
2. **`dpu_encoder_helper_get_3d_blend_mode()` condition change:**
```c
// Before:
dpu_cstate->num_mixers == CRTC_DUAL_MIXERS
// After:
(dpu_cstate->num_mixers != 1)
```
This changes the semantics. Previously, 3D merge was only used when exactly 2 mixers were present. Now it's used for any number of mixers > 1, including 3 or 4. For quad-pipe with 4 mixers, 3D merge should indeed be used for each pair, but this inline helper returns a single `BLEND_3D_H_ROW_INT` regardless of which mixer pair is being configured. Is this correct for the quad-pipe case where you'd want merge on pairs (0,1) and (2,3) but not across all 4? The callers need to handle this per-pair — verify they do.
3. **DSC topology logic:**
```c
if (topology.num_dsc) {
if (num_rt_intf == 1)
topology.num_lm = 2;
topology.num_dsc = topology.num_lm;
}
```
For single-interface DSC, this forces `num_lm = 2` regardless of the resolution check above. This seems intentional for backward compatibility with existing 2:2:1 DSC topologies. But for dual-interface with DSC, `topology.num_dsc` is set to `topology.num_lm`, which could be 2 or 4. When `num_lm = 2` and `num_rt_intf = 2`, you get `num_dsc = 2` (2:2:2). When `num_lm = 4`, you get `num_dsc = 4` (4:4:2). This seems correct.
However, the original code had a guard: `if (topology.num_intf >= 2 || dpu_kms->catalog->dsc_count >= 2)` checking DSC block availability. The new code removes this check — if the hardware has fewer than `num_lm` DSC blocks, this could fail later during resource allocation. The resource manager should catch this, but the early check was a useful safety net.
4. **`STAGES_PER_PLANE` changed from 1 to 2 unconditionally** — this doubles the size of `pipe[]` and `pipe_cfg[]` arrays in `dpu_plane_state` for all platforms, even those that never use quad-pipe. This increases memory usage per plane state. For embedded/mobile this is a minor concern but worth noting.
5. **`MAX_CHANNELS_PER_ENC` changed from 2 to 4** — the `hw_lm` and `hw_mixer` arrays in `dpu_encoder_helper_reset_mixers()` are now sized 4. The `dpu_rm_get_assigned_resources()` call that fills these arrays must also be capable of returning up to 4 entries. Verify this is the case.
6. **`min(2, topology.num_lm)` type mismatch**: `topology.num_lm` is `u32` while `2` is `int`. The `min()` macro in the kernel requires matching types. This should use `min_t(u32, 2, topology.num_lm)` or similar, otherwise it may trigger a compile warning/error depending on kernel version and config.
Has Reviewed-by from Dmitry Baryshkov and Jessica Zhang. **The shadowed variable and `min()` type issues should be addressed.**
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 10+ messages in thread
* Claude review: drm/msm/dpu: Support quad pipe with dual-interface
2026-03-12 8:28 [PATCH v19 0/4] drm/msm/dpu: Support quad pipe with dual-interface Jun Nie
` (3 preceding siblings ...)
2026-03-12 8:28 ` [PATCH v19 4/4] drm/msm/dpu: Enable quad-pipe for DSC and dual-DSI case Jun Nie
@ 2026-03-13 4:21 ` Claude Code Review Bot
4 siblings, 0 replies; 10+ messages in thread
From: Claude Code Review Bot @ 2026-03-13 4:21 UTC (permalink / raw)
To: dri-devel-reviews
Overall Series Review
Subject: drm/msm/dpu: Support quad pipe with dual-interface
Author: Jun Nie <jun.nie@linaro.org>
Patches: 5
Reviewed: 2026-03-13T14:21:21.740694
---
This is v19 of a series by Jun Nie (Linaro) that adds quad-pipe support to the DPU display driver for Qualcomm MSM platforms. The series enables 4:4:2 topology (4 SSPPs, 4 LMs, 2 interfaces) for high-resolution dual-DSI panels that exceed the width or clock-rate capabilities of a single pipe pair. The series is well-structured as a 4-patch progression: refactor, defer, extend splitting, enable. Patches 1 and 3 already carry Reviewed-by tags from Dmitry Baryshkov.
Overall the series is in reasonably good shape at v19, but there are several issues worth flagging.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 10+ messages in thread