Skip to content

Commit 7570e56

Browse files
MarijnS95gregkh
authored andcommitted
drm/msm/dsi: Use existing per-interface slice count in DSC timing
[ Upstream commit 14ad809ceb66d0874cbe4bd5ca9edf0de8d9ad96 ] When configuring the timing of DSI hosts (interfaces) in dsi_timing_setup() all values written to registers are taking bonded-mode into account by dividing the original mode width by 2 (half the data is sent over each of the two DSI hosts), but the full width instead of the interface width is passed as hdisplay parameter to dsi_update_dsc_timing(). Currently only msm_dsc_get_slices_per_intf() is called within dsi_update_dsc_timing() with the `hdisplay` argument which clearly documents that it wants the width of a single interface (which, again, in bonded DSI mode is half the total width of the mode) resulting in all subsequent values to be completely off. However, as soon as we start to pass the halved hdisplay into dsi_update_dsc_timing() we might as well discard msm_dsc_get_slices_per_intf() since the value it calculates is already available in dsc->slice_count which is per-interface by the current design of MSM DPU/DSI implementations and their use of the DRM DSC helpers. Fixes: 08802f5 ("drm/msm/dsi: Add support for DSC configuration") Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Reviewed-by: Jessica Zhang <quic_jesszhan@quicinc.com> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org> Patchwork: https://patchwork.freedesktop.org/patch/637648/ Link: https://lore.kernel.org/r/20250217-drm-msm-initial-dualpipe-dsc-fixes-v3-1-913100d6103f@somainline.org Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 45e0334 commit 7570e56

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

drivers/gpu/drm/msm/dsi/dsi_host.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ static void dsi_ctrl_enable(struct msm_dsi_host *msm_host,
825825
dsi_write(msm_host, REG_DSI_CPHY_MODE_CTRL, BIT(0));
826826
}
827827

828-
static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mode, u32 hdisplay)
828+
static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mode)
829829
{
830830
struct drm_dsc_config *dsc = msm_host->dsc;
831831
u32 reg, reg_ctrl, reg_ctrl2;
@@ -837,7 +837,7 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod
837837
/* first calculate dsc parameters and then program
838838
* compress mode registers
839839
*/
840-
slice_per_intf = msm_dsc_get_slices_per_intf(dsc, hdisplay);
840+
slice_per_intf = dsc->slice_count;
841841

842842
total_bytes_per_intf = dsc->slice_chunk_size * slice_per_intf;
843843
bytes_per_pkt = dsc->slice_chunk_size; /* * slice_per_pkt; */
@@ -948,7 +948,7 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)
948948

949949
if (msm_host->mode_flags & MIPI_DSI_MODE_VIDEO) {
950950
if (msm_host->dsc)
951-
dsi_update_dsc_timing(msm_host, false, mode->hdisplay);
951+
dsi_update_dsc_timing(msm_host, false);
952952

953953
dsi_write(msm_host, REG_DSI_ACTIVE_H,
954954
DSI_ACTIVE_H_START(ha_start) |
@@ -969,7 +969,7 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)
969969
DSI_ACTIVE_VSYNC_VPOS_END(vs_end));
970970
} else { /* command mode */
971971
if (msm_host->dsc)
972-
dsi_update_dsc_timing(msm_host, true, mode->hdisplay);
972+
dsi_update_dsc_timing(msm_host, true);
973973

974974
/* image data and 1 byte write_memory_start cmd */
975975
if (!msm_host->dsc)

drivers/gpu/drm/msm/msm_dsc_helper.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,6 @@
1212
#include <linux/math.h>
1313
#include <drm/display/drm_dsc_helper.h>
1414

15-
/**
16-
* msm_dsc_get_slices_per_intf() - calculate number of slices per interface
17-
* @dsc: Pointer to drm dsc config struct
18-
* @intf_width: interface width in pixels
19-
* Returns: Integer representing the number of slices for the given interface
20-
*/
21-
static inline u32 msm_dsc_get_slices_per_intf(const struct drm_dsc_config *dsc, u32 intf_width)
22-
{
23-
return DIV_ROUND_UP(intf_width, dsc->slice_width);
24-
}
25-
2615
/**
2716
* msm_dsc_get_bytes_per_line() - calculate bytes per line
2817
* @dsc: Pointer to drm dsc config struct

0 commit comments

Comments
 (0)