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

From: Alexandru Andrieș via B4 Relay

Date: Wed Nov 18 2026 - 19:48:32 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: b6090ffb30f3 ("drm/msm/dpu: Fall back to a single DSC encoder (1:1:1) on small SoCs")
Cc: stable@xxxxxxxxxxxxxxx
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.
---
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>