* [PATCH] drm/msm/dpu: round up the compressed INTF width
@ 2026-10-04 10:27 Joonhoe Kim
2026-10-04 11:46 ` Pengyu Luo
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Joonhoe Kim @ 2026-10-04 10:27 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov
Cc: Abhinav Kumar, Jessica Zhang, Sean Paul, Marijn Suijten,
David Airlie, Simona Vetter, Jun Nie, Jonathan Marek, Pengyu Luo,
Alexander Koskovich, Neil Armstrong, linux-arm-msm, dri-devel,
freedreno, linux-kernel
For DSI with DSC, drm_mode_to_intf_timing_params() scales the INTF
active width by bpp / (3 * bits_per_component) and rounds down. The DSI
host computes the same width with DIV_ROUND_UP, both for the pixel clock
(dsi_adjust_pclk_for_compression()) and for the active width it programs
(dsi_timing_setup(), from bytes per line). When the division is not
exact the INTF line is one pclk shorter than the DSI line, and the DSI
FIFO overflows.
Example: a bonded DSI video-mode panel, 952 pixels per link, DSC 8 bpp at
10 bpc: 952 * 8 / 30 = 253.87, so the INTF uses 253 and the DSI 254.
Round up, as the DSI host does. Qualcomm's downstream SDE driver also
rounds this width up, and Pengyu Luo needed the same rounding on the
Legion Y700 gen 4 [1].
Tested on a Lenovo Legion Tab Y700 gen 5 (SM8850) with that panel, with a
module parameter selecting the rounding: rounding down, DPMS off/on gives
no vblank and 14000-17000 DSI FIFO error interrupts per second
(dsi_err_worker: status=4); rounding up, the picture comes back and there
are no errors. Only tested on this device.
Link: https://lore.kernel.org/all/CAH2e8h6oinKxN1ndcvHCSc+=bFLXVVDZVAVF0cQHoiaMvEwhPQ@mail.gmail.com/ [1]
Fixes: f9ce482d7dc0 ("drm/msm/dpu: fix video mode DSC for DSI")
Assisted-by: LLM
Signed-off-by: Joonhoe Kim <26rote@gmail.com>
---
This does not touch the divisor discussed in the RGB101010 thread
(bits_per_component * 3 vs 24, with and without widebus); that patch
was dropped from the series pending that discussion [2]. This one only
makes the rounding match the DSI host. The panel here uses widebus.
[2] https://lore.kernel.org/all/20260321-dsi-rgb101010-support-v4-0-eb28ecebbfe8@pm.me/
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c
index ba810f26ea30..2ac517db50fc 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c
@@ -134,8 +134,8 @@ static void drm_mode_to_intf_timing_params(
* TODO: replace drm_dsc_get_bpp_int with logic to handle
* fractional part if there is fraction
*/
- timing->width = timing->width * drm_dsc_get_bpp_int(dsc) /
- (dsc->bits_per_component * 3);
+ timing->width = DIV_ROUND_UP(timing->width * drm_dsc_get_bpp_int(dsc),
+ dsc->bits_per_component * 3);
timing->xres = timing->width;
timing->dce_bytes_per_line = msm_dsc_get_bytes_per_line(dsc);
}
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/msm/dpu: round up the compressed INTF width
2026-10-04 10:27 [PATCH] drm/msm/dpu: round up the compressed INTF width Joonhoe Kim
@ 2026-10-04 11:46 ` Pengyu Luo
2026-10-05 3:25 ` Dmitry Baryshkov
2026-10-06 6:55 ` Dmitry Baryshkov
2 siblings, 0 replies; 4+ messages in thread
From: Pengyu Luo @ 2026-10-04 11:46 UTC (permalink / raw)
To: Joonhoe Kim
Cc: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter, Jun Nie,
Jonathan Marek, Alexander Koskovich, Neil Armstrong,
linux-arm-msm, dri-devel, freedreno, linux-kernel, P. Lewis
On Sun, Oct 4, 2026 at 6:28 PM Joonhoe Kim <26rote@gmail.com> wrote:
>
> For DSI with DSC, drm_mode_to_intf_timing_params() scales the INTF
> active width by bpp / (3 * bits_per_component) and rounds down. The DSI
> host computes the same width with DIV_ROUND_UP, both for the pixel clock
> (dsi_adjust_pclk_for_compression()) and for the active width it programs
> (dsi_timing_setup(), from bytes per line). When the division is not
> exact the INTF line is one pclk shorter than the DSI line, and the DSI
> FIFO overflows.
>
> Example: a bonded DSI video-mode panel, 952 pixels per link, DSC 8 bpp at
> 10 bpc: 952 * 8 / 30 = 253.87, so the INTF uses 253 and the DSI 254.
>
> Round up, as the DSI host does. Qualcomm's downstream SDE driver also
> rounds this width up, and Pengyu Luo needed the same rounding on the
> Legion Y700 gen 4 [1].
>
> Tested on a Lenovo Legion Tab Y700 gen 5 (SM8850) with that panel, with a
> module parameter selecting the rounding: rounding down, DPMS off/on gives
> no vblank and 14000-17000 DSI FIFO error interrupts per second
> (dsi_err_worker: status=4); rounding up, the picture comes back and there
> are no errors. Only tested on this device.
>
> Link: https://lore.kernel.org/all/CAH2e8h6oinKxN1ndcvHCSc+=bFLXVVDZVAVF0cQHoiaMvEwhPQ@mail.gmail.com/ [1]
> Fixes: f9ce482d7dc0 ("drm/msm/dpu: fix video mode DSC for DSI")
> Assisted-by: LLM
> Signed-off-by: Joonhoe Kim <26rote@gmail.com>
> ---
Thank you, Joonhoe.
I am glad to see someone is raising this. For most tablets, the
horizontal pixel count is not divisible by 3, so rounding up is
necessary for them. Besides lenovo Y700 gen4, rounding up also helps
dsc display on gaokun([1], patch initially provided by White Lewis)
whose horizontal pixel is 800 * 2.
[1]: https://github.com/whitelewi1-ctrl/matebook-e-go-linux/blob/master/kernel-patches/0003-drm-msm-dpu-encoder-fix-DSC-width-truncation.patch
Reviewed-by: Pengyu Luo <mitltlatltl@gmail.com>
Best wishes,
Pengyu
> This does not touch the divisor discussed in the RGB101010 thread
> (bits_per_component * 3 vs 24, with and without widebus); that patch
> was dropped from the series pending that discussion [2]. This one only
> makes the rounding match the DSI host. The panel here uses widebus.
>
> [2] https://lore.kernel.org/all/20260321-dsi-rgb101010-support-v4-0-eb28ecebbfe8@pm.me/
>
> drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c
> index ba810f26ea30..2ac517db50fc 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c
> @@ -134,8 +134,8 @@ static void drm_mode_to_intf_timing_params(
> * TODO: replace drm_dsc_get_bpp_int with logic to handle
> * fractional part if there is fraction
> */
> - timing->width = timing->width * drm_dsc_get_bpp_int(dsc) /
> - (dsc->bits_per_component * 3);
> + timing->width = DIV_ROUND_UP(timing->width * drm_dsc_get_bpp_int(dsc),
> + dsc->bits_per_component * 3);
> timing->xres = timing->width;
> timing->dce_bytes_per_line = msm_dsc_get_bytes_per_line(dsc);
> }
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/msm/dpu: round up the compressed INTF width
2026-10-04 10:27 [PATCH] drm/msm/dpu: round up the compressed INTF width Joonhoe Kim
2026-10-04 11:46 ` Pengyu Luo
@ 2026-10-05 3:25 ` Dmitry Baryshkov
2026-10-06 6:55 ` Dmitry Baryshkov
2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2026-10-05 3:25 UTC (permalink / raw)
To: Joonhoe Kim
Cc: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter, Jun Nie,
Jonathan Marek, Pengyu Luo, Alexander Koskovich, Neil Armstrong,
linux-arm-msm, dri-devel, freedreno, linux-kernel
On Sun, Oct 04, 2026 at 07:27:58PM +0900, Joonhoe Kim wrote:
> For DSI with DSC, drm_mode_to_intf_timing_params() scales the INTF
> active width by bpp / (3 * bits_per_component) and rounds down. The DSI
> host computes the same width with DIV_ROUND_UP, both for the pixel clock
> (dsi_adjust_pclk_for_compression()) and for the active width it programs
> (dsi_timing_setup(), from bytes per line). When the division is not
> exact the INTF line is one pclk shorter than the DSI line, and the DSI
> FIFO overflows.
>
> Example: a bonded DSI video-mode panel, 952 pixels per link, DSC 8 bpp at
> 10 bpc: 952 * 8 / 30 = 253.87, so the INTF uses 253 and the DSI 254.
>
> Round up, as the DSI host does. Qualcomm's downstream SDE driver also
> rounds this width up, and Pengyu Luo needed the same rounding on the
> Legion Y700 gen 4 [1].
>
> Tested on a Lenovo Legion Tab Y700 gen 5 (SM8850) with that panel, with a
> module parameter selecting the rounding: rounding down, DPMS off/on gives
> no vblank and 14000-17000 DSI FIFO error interrupts per second
> (dsi_err_worker: status=4); rounding up, the picture comes back and there
> are no errors. Only tested on this device.
>
> Link: https://lore.kernel.org/all/CAH2e8h6oinKxN1ndcvHCSc+=bFLXVVDZVAVF0cQHoiaMvEwhPQ@mail.gmail.com/ [1]
> Fixes: f9ce482d7dc0 ("drm/msm/dpu: fix video mode DSC for DSI")
> Assisted-by: LLM
> Signed-off-by: Joonhoe Kim <26rote@gmail.com>
> ---
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/msm/dpu: round up the compressed INTF width
2026-10-04 10:27 [PATCH] drm/msm/dpu: round up the compressed INTF width Joonhoe Kim
2026-10-04 11:46 ` Pengyu Luo
2026-10-05 3:25 ` Dmitry Baryshkov
@ 2026-10-06 6:55 ` Dmitry Baryshkov
2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2026-10-06 6:55 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Joonhoe Kim
Cc: Abhinav Kumar, Jessica Zhang, Sean Paul, Marijn Suijten,
David Airlie, Simona Vetter, Jun Nie, Jonathan Marek, Pengyu Luo,
Alexander Koskovich, Neil Armstrong, linux-arm-msm, dri-devel,
freedreno, linux-kernel
On Sun, 04 Oct 2026 19:27:58 +0900, Joonhoe Kim wrote:
> For DSI with DSC, drm_mode_to_intf_timing_params() scales the INTF
> active width by bpp / (3 * bits_per_component) and rounds down. The DSI
> host computes the same width with DIV_ROUND_UP, both for the pixel clock
> (dsi_adjust_pclk_for_compression()) and for the active width it programs
> (dsi_timing_setup(), from bytes per line). When the division is not
> exact the INTF line is one pclk shorter than the DSI line, and the DSI
> FIFO overflows.
>
> [...]
Applied to msm-next, thanks!
[1/1] drm/msm/dpu: round up the compressed INTF width
https://gitlab.freedesktop.org/lumag/msm/-/commit/6b93e8b453fa
Best regards,
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-06 6:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-04 10:27 [PATCH] drm/msm/dpu: round up the compressed INTF width Joonhoe Kim
2026-10-04 11:46 ` Pengyu Luo
2026-10-05 3:25 ` Dmitry Baryshkov
2026-10-06 6:55 ` Dmitry Baryshkov
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®