From: Jonathan Marek <jonathan@marek.ca>
Some panels support multiple slice to be sent in a single DSC packet and
this feature is a must for specific panels, such as the JDI LPM026M648C.
Use the MIPI_DSI_MODE_DSC_ALL_SLICES_IN_PKT flag to derive slice_per_pkt
from slice_count, note that most panels are expected to just work with
just one slice per packet.
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Alexander Koskovich <akoskovich@pm.me>
---
drivers/gpu/drm/msm/dsi/dsi_host.c | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index db6da99375a1..758b076ee4bf 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -166,6 +166,7 @@ struct msm_dsi_host {
struct drm_display_mode *mode;
struct drm_dsc_config *dsc;
+ unsigned int dsc_slice_per_pkt;
/* connected device info */
unsigned int channel;
@@ -927,17 +928,10 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod
slice_per_intf = dsc->slice_count;
total_bytes_per_intf = dsc->slice_chunk_size * slice_per_intf;
- bytes_per_pkt = dsc->slice_chunk_size; /* * slice_per_pkt; */
+ bytes_per_pkt = dsc->slice_chunk_size * msm_host->dsc_slice_per_pkt;
eol_byte_num = total_bytes_per_intf % 3;
-
- /*
- * Typically, pkt_per_line = slice_per_intf * slice_per_pkt.
- *
- * Since the current driver only supports slice_per_pkt = 1,
- * pkt_per_line will be equal to slice per intf for now.
- */
- pkt_per_line = slice_per_intf;
+ pkt_per_line = slice_per_intf / msm_host->dsc_slice_per_pkt;
if (is_cmd_mode) /* packet data type */
reg = DSI_COMMAND_COMPRESSION_MODE_CTRL_STREAM0_DATATYPE(MIPI_DSI_DCS_LONG_WRITE);
@@ -1088,12 +1082,8 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)
else
/*
* When DSC is enabled, WC = slice_chunk_size * slice_per_pkt + 1.
- * Currently, the driver only supports default value of slice_per_pkt = 1
- *
- * TODO: Expand mipi_dsi_device struct to hold slice_per_pkt info
- * and adjust DSC math to account for slice_per_pkt.
*/
- wc = msm_host->dsc->slice_chunk_size + 1;
+ wc = msm_host->dsc->slice_chunk_size * msm_host->dsc_slice_per_pkt + 1;
dsi_write(msm_host, REG_DSI_CMD_MDP_STREAM0_CTRL,
DSI_CMD_MDP_STREAM0_CTRL_WORD_COUNT(wc) |
@@ -1702,8 +1692,13 @@ static int dsi_host_attach(struct mipi_dsi_host *host,
msm_host->lanes = dsi->lanes;
msm_host->format = dsi->format;
msm_host->mode_flags = dsi->mode_flags;
- if (dsi->dsc)
+ if (dsi->dsc) {
msm_host->dsc = dsi->dsc;
+ if (dsi->mode_flags & MIPI_DSI_MODE_DSC_ALL_SLICES_IN_PKT)
+ msm_host->dsc_slice_per_pkt = dsi->dsc->slice_count;
+ else
+ msm_host->dsc_slice_per_pkt = 1;
+ }
ret = dsi_dev_attach(msm_host->pdev);
if (ret)
--
2.53.0
On 3/18/26 10:54 AM, Alexander Koskovich wrote: > From: Jonathan Marek <jonathan@marek.ca> > > Some panels support multiple slice to be sent in a single DSC packet and > this feature is a must for specific panels, such as the JDI LPM026M648C. > > Use the MIPI_DSI_MODE_DSC_ALL_SLICES_IN_PKT flag to derive slice_per_pkt > from slice_count, note that most panels are expected to just work with > just one slice per packet. > > Signed-off-by: Jonathan Marek <jonathan@marek.ca> > Signed-off-by: Alexander Koskovich <akoskovich@pm.me> > --- Matches various formulas in the docs Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Konrad
On 3/19/26 11:26 AM, Konrad Dybcio wrote: > On 3/18/26 10:54 AM, Alexander Koskovich wrote: >> From: Jonathan Marek <jonathan@marek.ca> >> >> Some panels support multiple slice to be sent in a single DSC packet and >> this feature is a must for specific panels, such as the JDI LPM026M648C. >> >> Use the MIPI_DSI_MODE_DSC_ALL_SLICES_IN_PKT flag to derive slice_per_pkt >> from slice_count, note that most panels are expected to just work with >> just one slice per packet. >> >> Signed-off-by: Jonathan Marek <jonathan@marek.ca> >> Signed-off-by: Alexander Koskovich <akoskovich@pm.me> >> --- > > Matches various formulas in the docs > > Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Sorry for a sloppy trailer, let me try again with the right From:.. Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Konrad
On Wed, Mar 18, 2026 at 09:54:08AM +0000, Alexander Koskovich wrote: > From: Jonathan Marek <jonathan@marek.ca> > > Some panels support multiple slice to be sent in a single DSC packet and > this feature is a must for specific panels, such as the JDI LPM026M648C. > > Use the MIPI_DSI_MODE_DSC_ALL_SLICES_IN_PKT flag to derive slice_per_pkt > from slice_count, note that most panels are expected to just work with > just one slice per packet. > > Signed-off-by: Jonathan Marek <jonathan@marek.ca> > Signed-off-by: Alexander Koskovich <akoskovich@pm.me> > --- > drivers/gpu/drm/msm/dsi/dsi_host.c | 25 ++++++++++--------------- > 1 file changed, 10 insertions(+), 15 deletions(-) > Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> -- With best wishes Dmitry
© 2016 - 2026 Red Hat, Inc.