[PATCH v2] drm/msm/dpu: use single DSC encoder when slice_count is 1

From: Alexandru Andrieș via B4 Relay

Date: Mon Nov 30 2026 - 14:31:10 EST


From: Alexandru Andrieș <alex.andries.aa@xxxxxxxxx>

dpu_encoder_update_topology() currently selects 2 DSC encoders whenever
catalog->dsc_count >= 2, even when the panel only uses a single DSC
slice (dsc->slice_count == 1).

A single slice cannot be split across two DSC encoders: merge mode
halves the per-encoder input width below slice_width and, on DPU 7.0+,
computes num_active_slice_per_enc = dsc->slice_count / 2 = 0 in
dpu_hw_dsc_config_1_2(), dividing by zero in
_dsc_calc_output_buf_max_addr().

Require dsc->slice_count >= 2 before selecting 2 DSC encoders on a
single interface so single-slice panels use 1 DSC encoder.

Fixes: 7e9cc175b159 ("drm/msm/disp/dpu1: Add support for DSC in topology")
Cc: stable@xxxxxxxxxxxxxxx # 6.15+
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxxxxxxxx>
Signed-off-by: Alexandru Andrieș <alex.andries.aa@xxxxxxxxx>
---
Testing:
- Tested on a Xiaomi MIX 4 (SM8350, DPU 7.0) with a 1080x2400@120Hz
single-DSI single-slice DSC panel; dual-DSI topologies were not
hardware-tested.

AI disclosure:
- Debugged and drafted with assistance from Gemini 4 Carbon
(Antigravity), and reviewed and tested on hardware by the submitter.
---
Changes in v2:
- Point Fixes: tag to 7e9cc175b159 ("drm/msm/disp/dpu1: Add support for
DSC in topology") instead of b6090ffb30f3, and constrain Cc: stable to
6.15+ (where b6090ffb30f3 added 1:1:1 support) (Marijn Suijten).
- Pick up Dmitry Baryshkov's Reviewed-by tag.
- Link to v1: https://patch.msgid.link/20261119-upstream-drm-msm-dpu-dsc-single-slice-v1-v1-1-4744ad5b9747@xxxxxxxxx
---
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 5 +++--
1 file changed, 3 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 0a6be69a3e83..ffccee6b41f1 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -680,13 +680,14 @@ void dpu_encoder_update_topology(struct drm_encoder *drm_enc,
/*
* 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.
+ * and when enough DSC blocks and slices 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)
+ if (topology->num_intf >= 2 ||
+ (dpu_kms->catalog->dsc_count >= 2 && dsc->slice_count >= 2))
topology->num_dsc = 2;
else
topology->num_dsc = 1;

---
base-commit: 97d73c8251226cf27cc6656b4c542869bb8c69fa
change-id: 20261119-upstream-drm-msm-dpu-dsc-single-slice-v1-557cca7c984c

Best regards,
--
Alexandru Andrieș <alex.andries.aa@xxxxxxxxx>