* [PATCH 0/5] drm/msm/dpu: enable quad-pipe for DSC and dual-DSI case
@ 2026-10-03 0:02 Dmitry Baryshkov
2026-10-03 0:02 ` [PATCH 1/5] drm/msm/dpu: don't flush a legacy CTL after its interface has stopped Dmitry Baryshkov
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Dmitry Baryshkov @ 2026-10-03 0:02 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, Jun Nie, David Airlie, Simona Vetter,
Vinod Polimera
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel,
Dmitry Baryshkov, Jessica Zhang
This feels bad, but I ended up picking Jun's last remaining patch and
reworking it until it stopped producing issues in my hardware lab. This
patchset is based on Jun's v21.
Jun thanks for your previous work.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
Dmitry Baryshkov (4):
drm/msm/dpu: don't flush a legacy CTL after its interface has stopped
drm/msm/dpu: don't count the cloned writeback as an interface
drm/msm/dpu: assign the mixers to the CTLs per interface
drm/msm/dpu: enable 3D merge when there are more mixers than interfaces
Jun Nie (1):
drm/msm/dpu: enable quad-pipe for DSC and dual-DSI case
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 64 ++++++++++++++++--------
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h | 6 +--
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 43 ++++------------
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h | 2 +
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h | 7 ++-
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 2 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h | 2 +-
7 files changed, 63 insertions(+), 63 deletions(-)
---
base-commit: 820493753c467135a7083379f0d547a942b56db3
change-id: 20261003-dpu-quad-pipe-fixed-4adc8e47fcea
Best regards,
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/5] drm/msm/dpu: don't flush a legacy CTL after its interface has stopped
2026-10-03 0:02 [PATCH 0/5] drm/msm/dpu: enable quad-pipe for DSC and dual-DSI case Dmitry Baryshkov
@ 2026-10-03 0:02 ` Dmitry Baryshkov
2026-10-03 0:03 ` [PATCH 2/5] drm/msm/dpu: don't count the cloned writeback as an interface Dmitry Baryshkov
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Dmitry Baryshkov @ 2026-10-03 0:02 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, Jun Nie, David Airlie, Simona Vetter,
Vinod Polimera
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
On DPU < 5.0 the CTL latches a flush at the next vsync of the interface
it drives. dpu_encoder_helper_phys_cleanup() runs after the video
encoder has switched the timing engine off, and still flushes the mixers
it has just reset, so the flush is never taken: the bits stay pending in
CTL_FLUSH, where a CTL soft reset doesn't clear them either.
The next display on that CTL then waits for a flush which can't
complete. On SDA660, going back to fbcon from a two-mixer mode leaves
the LM_1 bit pending, and every following frame of the single-mixer
mode times out:
[dpu error]vblank timeout: 80
[dpu error]wait for commit done returned -110
Only trigger the flush from the teardown on DPU >= 5.0. The legacy CTL
gets its registers flushed by its next user, as downstream does, which
rewrites CTL_TOP without a flush when it stops a CTL.
Fixes: 22cb02bc96ff ("drm/msm/disp/dpu: reset the datapath after timing engine disable")
Assisted-by: LLM
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index 1f20695f81e3..5a06a0fbc7e1 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -2339,8 +2339,11 @@ void dpu_encoder_helper_phys_cleanup(struct dpu_encoder_phys *phys_enc)
if (ctl->ops.reset_intf_cfg)
ctl->ops.reset_intf_cfg(ctl, &intf_cfg);
- ctl->ops.trigger_flush(ctl);
- ctl->ops.trigger_start(ctl);
+ /* a legacy CTL latches its flush at the vsync of a stopped interface */
+ if (phys_enc->dpu_kms->catalog->mdss_ver->core_major_ver >= 5) {
+ ctl->ops.trigger_flush(ctl);
+ ctl->ops.trigger_start(ctl);
+ }
ctl->ops.clear_pending_flush(ctl);
}
--
2.47.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/5] drm/msm/dpu: don't count the cloned writeback as an interface
2026-10-03 0:02 [PATCH 0/5] drm/msm/dpu: enable quad-pipe for DSC and dual-DSI case Dmitry Baryshkov
2026-10-03 0:02 ` [PATCH 1/5] drm/msm/dpu: don't flush a legacy CTL after its interface has stopped Dmitry Baryshkov
@ 2026-10-03 0:03 ` Dmitry Baryshkov
2026-10-03 0:03 ` [PATCH 3/5] drm/msm/dpu: assign the mixers to the CTLs per interface Dmitry Baryshkov
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Dmitry Baryshkov @ 2026-10-03 0:03 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, Jun Nie, David Airlie, Simona Vetter,
Vinod Polimera
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
In the clone mode dpu_encoder_update_topology() is called both for the
real-time and for the writeback encoder, so topology.num_intf also
counts the writeback. However the cloned writeback has no datapath of
its own, it taps the mixers of the real-time encoder. Each user of
num_intf has to compensate for that, and not all of them get it right:
- dpu_crtc_get_topology() skips the "two interfaces use two mixers"
rule if CWB is enabled, so a dual-DSI display in the clone mode gets
a single mixer for its two interfaces if the mode is narrow enough;
- _dpu_rm_reserve_dsc() compares num_dsc to num_intf to detect the DSC
merge, so it doesn't allocate a DSC pair for a single DSI interface
using two DSC blocks while being cloned.
Count only the real-time interfaces if the CRTC is in the clone mode.
The standalone writeback is still counted as an interface.
Assisted-by: LLM
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 13 +++----------
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 8 +++-----
2 files changed, 6 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 42d0a529b4d5..828187f46eae 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1385,12 +1385,12 @@ static struct msm_display_topology dpu_crtc_get_topology(
struct msm_display_topology topology = {0};
struct drm_encoder *drm_enc;
+ topology.cwb_enabled = drm_crtc_in_clone_mode(crtc_state);
+
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);
-
/*
* Datapath topology selection
*
@@ -1404,16 +1404,9 @@ static struct msm_display_topology dpu_crtc_get_topology(
* If DSC is enabled, use 2 LMs for 2:2:1 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)
+ if (topology.num_intf == 2)
topology.num_lm = 2;
else if (topology.num_dsc == 2)
topology.num_lm = 2;
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index 5a06a0fbc7e1..65161efc4294 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -667,11 +667,9 @@ void dpu_encoder_update_topology(struct drm_encoder *drm_enc,
struct drm_framebuffer *fb;
struct drm_dsc_config *dsc;
- int i;
-
- for (i = 0; i < MAX_PHYS_ENCODERS_PER_VIRTUAL; i++)
- if (dpu_enc->phys_encs[i])
- topology->num_intf++;
+ /* a cloned writeback taps the datapath of the real-time encoder */
+ if (!topology->cwb_enabled || disp_info->intf_type != INTF_WB)
+ topology->num_intf += dpu_enc->num_phys_encs;
dsc = dpu_encoder_get_dsc_config(drm_enc);
--
2.47.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/5] drm/msm/dpu: assign the mixers to the CTLs per interface
2026-10-03 0:02 [PATCH 0/5] drm/msm/dpu: enable quad-pipe for DSC and dual-DSI case Dmitry Baryshkov
2026-10-03 0:02 ` [PATCH 1/5] drm/msm/dpu: don't flush a legacy CTL after its interface has stopped Dmitry Baryshkov
2026-10-03 0:03 ` [PATCH 2/5] drm/msm/dpu: don't count the cloned writeback as an interface Dmitry Baryshkov
@ 2026-10-03 0:03 ` Dmitry Baryshkov
2026-10-03 0:03 ` [PATCH 4/5] drm/msm/dpu: enable 3D merge when there are more mixers than interfaces Dmitry Baryshkov
2026-10-03 0:03 ` [PATCH 5/5] drm/msm/dpu: enable quad-pipe for DSC and dual-DSI case Dmitry Baryshkov
4 siblings, 0 replies; 7+ messages in thread
From: Dmitry Baryshkov @ 2026-10-03 0:03 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, Jun Nie, David Airlie, Simona Vetter,
Vinod Polimera
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
On DPU < 5.0 each interface is driven by its own CTL, which has to
control all the mixers feeding that interface. However
dpu_crtc_assign_resources() gives a single mixer to each of the CTLs
but the last one, which gets all the remaining mixers. This works while
there is at most one mixer per interface, but it breaks with four mixers
driving two interfaces: the first CTL would get LM_0 only, while LM_1
would be programmed through the CTL of the second interface together
with LM_2 and LM_5, leaving the first interface with a half of its
picture.
Split the mixers evenly, so that each CTL gets the mixers of its
interface. Nothing changes for the existing topologies.
Assisted-by: LLM
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 828187f46eae..57f50a3cd9cf 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1469,7 +1469,7 @@ static int dpu_crtc_assign_resources(struct drm_crtc *crtc,
ARRAY_SIZE(hw_dspp));
for (i = 0; i < num_lm; i++) {
- int ctl_idx = (i < num_ctl) ? i : (num_ctl-1);
+ int ctl_idx = i * num_ctl / num_lm;
cstate->mixers[i].hw_lm = to_dpu_hw_mixer(hw_lm[i]);
cstate->mixers[i].lm_ctl = to_dpu_hw_ctl(hw_ctl[ctl_idx]);
--
2.47.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 4/5] drm/msm/dpu: enable 3D merge when there are more mixers than interfaces
2026-10-03 0:02 [PATCH 0/5] drm/msm/dpu: enable quad-pipe for DSC and dual-DSI case Dmitry Baryshkov
` (2 preceding siblings ...)
2026-10-03 0:03 ` [PATCH 3/5] drm/msm/dpu: assign the mixers to the CTLs per interface Dmitry Baryshkov
@ 2026-10-03 0:03 ` Dmitry Baryshkov
2026-10-03 0:03 ` [PATCH 5/5] drm/msm/dpu: enable quad-pipe for DSC and dual-DSI case Dmitry Baryshkov
4 siblings, 0 replies; 7+ messages in thread
From: Dmitry Baryshkov @ 2026-10-03 0:03 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, Jun Nie, David Airlie, Simona Vetter,
Vinod Polimera
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
dpu_encoder_helper_get_3d_blend_mode() enables the 3D merge only for a
solo physical encoder driven by two mixers. This covers all the current
topologies, but not four mixers driving two interfaces without DSC:
each interface is then fed by a pair of mixers, which has to be merged
too, while the physical encoders have the master and slave roles. The
3D mux would stay disabled and each interface would output the data of
a single mixer.
Enable the 3D merge whenever there are more mixers than interfaces,
unless the DSC merge is used. Nothing changes for the existing
topologies.
Assisted-by: LLM
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
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 61b22d949454..d24e39597f2f 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
@@ -294,15 +294,16 @@ static inline enum dpu_3d_blend_mode dpu_encoder_helper_get_3d_blend_mode(
struct dpu_encoder_phys *phys_enc)
{
struct dpu_crtc_state *dpu_cstate;
+ unsigned int num_intf;
if (!phys_enc || phys_enc->enable_state == DPU_ENC_DISABLING)
return BLEND_3D_NONE;
dpu_cstate = to_dpu_crtc_state(phys_enc->parent->crtc->state);
+ num_intf = phys_enc->split_role == ENC_ROLE_SOLO ? 1 : 2;
/* Use merge_3d unless DSC MERGE topology is used */
- if (phys_enc->split_role == ENC_ROLE_SOLO &&
- dpu_cstate->num_mixers == CRTC_DUAL_MIXERS &&
+ if (dpu_cstate->num_mixers > num_intf &&
!dpu_encoder_use_dsc_merge(phys_enc->parent))
return BLEND_3D_H_ROW_INT;
--
2.47.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 5/5] drm/msm/dpu: enable quad-pipe for DSC and dual-DSI case
2026-10-03 0:02 [PATCH 0/5] drm/msm/dpu: enable quad-pipe for DSC and dual-DSI case Dmitry Baryshkov
` (3 preceding siblings ...)
2026-10-03 0:03 ` [PATCH 4/5] drm/msm/dpu: enable 3D merge when there are more mixers than interfaces Dmitry Baryshkov
@ 2026-10-03 0:03 ` Dmitry Baryshkov
2026-12-01 10:38 ` Jayant Shekhar
4 siblings, 1 reply; 7+ messages in thread
From: Dmitry Baryshkov @ 2026-10-03 0:03 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, Jun Nie, David Airlie, Simona Vetter,
Vinod Polimera
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel,
Dmitry Baryshkov, Jessica Zhang
From: Jun Nie <jun.nie@linaro.org>
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>
[DB: reworked the mixer and DSC selection in dpu_crtc_get_topology()]
[DB: dropped the DPU < 5 limitation]
[DB: compare the clock rate per interface]
[DB: limited the clone mode to two mixers]
Assisted-by: LLM
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 51 ++++++++++++++++++------
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h | 6 +--
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 28 ++-----------
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h | 2 +
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 +-
7 files changed, 49 insertions(+), 44 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 57f50a3cd9cf..0e4f2fd0a8f3 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;
@@ -1382,39 +1382,66 @@ static struct msm_display_topology dpu_crtc_get_topology(
struct drm_crtc_state *crtc_state)
{
struct drm_display_mode *mode = &crtc_state->adjusted_mode;
+ const struct dpu_caps *caps = dpu_kms->catalog->caps;
struct msm_display_topology topology = {0};
struct drm_encoder *drm_enc;
+ bool dsc = false;
+ u64 mode_rate;
topology.cwb_enabled = drm_crtc_in_clone_mode(crtc_state);
- drm_for_each_encoder_mask(drm_enc, crtc->dev, crtc_state->encoder_mask)
+ 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);
+ if (dpu_encoder_get_dsc_config(drm_enc))
+ dsc = true;
+ }
/*
* Datapath topology selection
*
* 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. Use 1:1:1 topology
+ * if there is only one DSC engine in SoC.
*
* Add dspps to the reservation requirements if ctm or gamma_lut are requested
*/
- if (topology.num_intf == 2)
- 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_dsc == 0)
- topology.num_lm = (mode->hdisplay > MAX_HDISPLAY_SPLIT) ? 2 : 1;
- else
- topology.num_lm = 1;
+ mode_rate = (u64)mode->hdisplay * mode->vtotal * drm_mode_vrefresh(mode);
+
+ if (topology.num_intf == 2) {
+ if (dpu_use_virtual_planes && caps->has_3d_merge &&
+ !topology.cwb_enabled &&
+ (mode->hdisplay > 2 * caps->max_mixer_width ||
+ mode_rate > 2 * dpu_kms->perf.max_core_clk_rate))
+ topology.num_lm = 4;
+ else
+ topology.num_lm = 2;
+ } else {
+ if (dsc)
+ topology.num_lm = min(2, dpu_kms->catalog->dsc_count);
+ else if (caps->has_3d_merge &&
+ (mode->hdisplay > MAX_HDISPLAY_SPLIT ||
+ mode_rate > dpu_kms->perf.max_core_clk_rate))
+ topology.num_lm = 2;
+ else
+ topology.num_lm = 1;
+ }
+
+ if (dsc)
+ 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 6eaba5696e8e..455073c7025b 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 65161efc4294..2c2b98ce1093 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
@@ -659,37 +659,15 @@ void dpu_encoder_update_topology(struct drm_encoder *drm_enc,
const struct drm_display_mode *adj_mode)
{
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;
- struct drm_dsc_config *dsc;
/* a cloned writeback taps the datapath of the real-time encoder */
if (!topology->cwb_enabled || disp_info->intf_type != INTF_WB)
topology->num_intf += dpu_enc->num_phys_encs;
- 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;
- }
-
connector = drm_atomic_get_new_connector_for_encoder(state, drm_enc);
if (!connector)
return;
@@ -2177,8 +2155,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.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
index 4942097e7613..7dfaa3ed4dff 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
@@ -82,6 +82,8 @@ int dpu_encoder_get_crc(const struct drm_encoder *drm_enc, u32 *crcs, int pos);
bool dpu_encoder_use_dsc_merge(struct drm_encoder *drm_enc);
+struct drm_dsc_config *dpu_encoder_get_dsc_config(struct drm_encoder *drm_enc);
+
void dpu_encoder_update_topology(struct drm_encoder *drm_enc,
struct msm_display_topology *topology,
struct drm_atomic_commit *state,
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 d24e39597f2f..0bfbce317575 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
@@ -314,8 +314,6 @@ unsigned int dpu_encoder_helper_get_cwb_mask(struct dpu_encoder_phys *phys_enc);
unsigned int dpu_encoder_helper_get_dsc(struct dpu_encoder_phys *phys_enc);
-struct drm_dsc_config *dpu_encoder_get_dsc_config(struct drm_encoder *drm_enc);
-
u32 dpu_encoder_get_drm_fmt(struct dpu_encoder_phys *phys_enc);
bool dpu_encoder_needs_periph_flush(struct dpu_encoder_phys *phys_enc);
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 f45faf87333e..ba1554095a33 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 0e65bf5ddc4a..fd1f3e798206 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.47.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 5/5] drm/msm/dpu: enable quad-pipe for DSC and dual-DSI case
2026-10-03 0:03 ` [PATCH 5/5] drm/msm/dpu: enable quad-pipe for DSC and dual-DSI case Dmitry Baryshkov
@ 2026-12-01 10:38 ` Jayant Shekhar
0 siblings, 0 replies; 7+ messages in thread
From: Jayant Shekhar @ 2026-12-01 10:38 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Dmitry Baryshkov, Abhinav Kumar,
Jessica Zhang, Sean Paul, Marijn Suijten, Jun Nie, David Airlie,
Simona Vetter, Vinod Polimera
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
On 03-10-2026 05:33, Dmitry Baryshkov wrote:
> From: Jun Nie <jun.nie@linaro.org>
>
> 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>
> [DB: reworked the mixer and DSC selection in dpu_crtc_get_topology()]
> [DB: dropped the DPU < 5 limitation]
> [DB: compare the clock rate per interface]
> [DB: limited the clone mode to two mixers]
> Assisted-by: LLM
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 51 ++++++++++++++++++------
> drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h | 6 +--
> drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 28 ++-----------
> drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h | 2 +
> 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 +-
> 7 files changed, 49 insertions(+), 44 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> index 57f50a3cd9cf..0e4f2fd0a8f3 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;
> @@ -1382,39 +1382,66 @@ static struct msm_display_topology dpu_crtc_get_topology(
> struct drm_crtc_state *crtc_state)
> {
> struct drm_display_mode *mode = &crtc_state->adjusted_mode;
> + const struct dpu_caps *caps = dpu_kms->catalog->caps;
> struct msm_display_topology topology = {0};
> struct drm_encoder *drm_enc;
> + bool dsc = false;
> + u64 mode_rate;
>
> topology.cwb_enabled = drm_crtc_in_clone_mode(crtc_state);
>
> - drm_for_each_encoder_mask(drm_enc, crtc->dev, crtc_state->encoder_mask)
> + 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);
> + if (dpu_encoder_get_dsc_config(drm_enc))
> + dsc = true;
> + }
>
> /*
> * Datapath topology selection
> *
> * 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. Use 1:1:1 topology
> + * if there is only one DSC engine in SoC.
> *
> * Add dspps to the reservation requirements if ctm or gamma_lut are requested
> */
>
> - if (topology.num_intf == 2)
> - 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_dsc == 0)
> - topology.num_lm = (mode->hdisplay > MAX_HDISPLAY_SPLIT) ? 2 : 1;
> - else
> - topology.num_lm = 1;
> + mode_rate = (u64)mode->hdisplay * mode->vtotal * drm_mode_vrefresh(mode);
> +
> + if (topology.num_intf == 2) {
> + if (dpu_use_virtual_planes && caps->has_3d_merge &&
> + !topology.cwb_enabled &&
> + (mode->hdisplay > 2 * caps->max_mixer_width ||
> + mode_rate > 2 * dpu_kms->perf.max_core_clk_rate))
> + topology.num_lm = 4;
> + else
> + topology.num_lm = 2;
> + } else {
> + if (dsc)
> + topology.num_lm = min(2, dpu_kms->catalog->dsc_count);
> + else if (caps->has_3d_merge &&
> + (mode->hdisplay > MAX_HDISPLAY_SPLIT ||
> + mode_rate > dpu_kms->perf.max_core_clk_rate))
> + topology.num_lm = 2;
> + else
> + topology.num_lm = 1;
> + }
> +
> + if (dsc)
> + topology.num_dsc = topology.num_lm;
This may not work for Eliza, which has 4 LMs but only 3 DSCs. Should
num_dsc be derived from the available DSC resources instead of 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 6eaba5696e8e..455073c7025b 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 65161efc4294..2c2b98ce1093 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
> @@ -659,37 +659,15 @@ void dpu_encoder_update_topology(struct drm_encoder *drm_enc,
> const struct drm_display_mode *adj_mode)
> {
> 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;
> - struct drm_dsc_config *dsc;
>
> /* a cloned writeback taps the datapath of the real-time encoder */
> if (!topology->cwb_enabled || disp_info->intf_type != INTF_WB)
> topology->num_intf += dpu_enc->num_phys_encs;
>
> - 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;
> - }
> -
> connector = drm_atomic_get_new_connector_for_encoder(state, drm_enc);
> if (!connector)
> return;
> @@ -2177,8 +2155,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.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
> index 4942097e7613..7dfaa3ed4dff 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
> @@ -82,6 +82,8 @@ int dpu_encoder_get_crc(const struct drm_encoder *drm_enc, u32 *crcs, int pos);
>
> bool dpu_encoder_use_dsc_merge(struct drm_encoder *drm_enc);
>
> +struct drm_dsc_config *dpu_encoder_get_dsc_config(struct drm_encoder *drm_enc);
> +
> void dpu_encoder_update_topology(struct drm_encoder *drm_enc,
> struct msm_display_topology *topology,
> struct drm_atomic_commit *state,
> 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 d24e39597f2f..0bfbce317575 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
> @@ -314,8 +314,6 @@ unsigned int dpu_encoder_helper_get_cwb_mask(struct dpu_encoder_phys *phys_enc);
>
> unsigned int dpu_encoder_helper_get_dsc(struct dpu_encoder_phys *phys_enc);
>
> -struct drm_dsc_config *dpu_encoder_get_dsc_config(struct drm_encoder *drm_enc);
> -
> u32 dpu_encoder_get_drm_fmt(struct dpu_encoder_phys *phys_enc);
>
> bool dpu_encoder_needs_periph_flush(struct dpu_encoder_phys *phys_enc);
> 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 f45faf87333e..ba1554095a33 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 0e65bf5ddc4a..fd1f3e798206 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
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-12-01 10:38 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-03 0:02 [PATCH 0/5] drm/msm/dpu: enable quad-pipe for DSC and dual-DSI case Dmitry Baryshkov
2026-10-03 0:02 ` [PATCH 1/5] drm/msm/dpu: don't flush a legacy CTL after its interface has stopped Dmitry Baryshkov
2026-10-03 0:03 ` [PATCH 2/5] drm/msm/dpu: don't count the cloned writeback as an interface Dmitry Baryshkov
2026-10-03 0:03 ` [PATCH 3/5] drm/msm/dpu: assign the mixers to the CTLs per interface Dmitry Baryshkov
2026-10-03 0:03 ` [PATCH 4/5] drm/msm/dpu: enable 3D merge when there are more mixers than interfaces Dmitry Baryshkov
2026-10-03 0:03 ` [PATCH 5/5] drm/msm/dpu: enable quad-pipe for DSC and dual-DSI case Dmitry Baryshkov
2026-12-01 10:38 ` Jayant Shekhar
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®