]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/msm/dsi: Use existing per-interface slice count in DSC timing
authorMarijn Suijten <marijn.suijten@somainline.org>
Mon, 17 Feb 2025 11:17:41 +0000 (12:17 +0100)
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Wed, 26 Feb 2025 10:15:48 +0000 (12:15 +0200)
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: 08802f515c3c ("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>
drivers/gpu/drm/msm/dsi/dsi_host.c
drivers/gpu/drm/msm/msm_dsc_helper.h

index 2218d4f0c5130a0b13f428e89aa30ba2921da572..b6ae9717a5d36d238769d1c2faf868ee354ea84c 100644 (file)
@@ -834,7 +834,7 @@ static void dsi_ctrl_enable(struct msm_dsi_host *msm_host,
                dsi_write(msm_host, REG_DSI_CPHY_MODE_CTRL, BIT(0));
 }
 
-static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mode, u32 hdisplay)
+static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mode)
 {
        struct drm_dsc_config *dsc = msm_host->dsc;
        u32 reg, reg_ctrl, reg_ctrl2;
@@ -846,7 +846,7 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod
        /* first calculate dsc parameters and then program
         * compress mode registers
         */
-       slice_per_intf = msm_dsc_get_slices_per_intf(dsc, hdisplay);
+       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; */
@@ -979,7 +979,7 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)
 
        if (msm_host->mode_flags & MIPI_DSI_MODE_VIDEO) {
                if (msm_host->dsc)
-                       dsi_update_dsc_timing(msm_host, false, mode->hdisplay);
+                       dsi_update_dsc_timing(msm_host, false);
 
                dsi_write(msm_host, REG_DSI_ACTIVE_H,
                        DSI_ACTIVE_H_START(ha_start) |
@@ -1000,7 +1000,7 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)
                        DSI_ACTIVE_VSYNC_VPOS_END(vs_end));
        } else {                /* command mode */
                if (msm_host->dsc)
-                       dsi_update_dsc_timing(msm_host, true, mode->hdisplay);
+                       dsi_update_dsc_timing(msm_host, true);
 
                /* image data and 1 byte write_memory_start cmd */
                if (!msm_host->dsc)
index b9049fe1e2790703a6f42dd7e6cd3fa5eea29389..63f95523b2cbb48f822210ac47cdd3526f231a89 100644 (file)
 #include <linux/math.h>
 #include <drm/display/drm_dsc_helper.h>
 
-/**
- * msm_dsc_get_slices_per_intf() - calculate number of slices per interface
- * @dsc: Pointer to drm dsc config struct
- * @intf_width: interface width in pixels
- * Returns: Integer representing the number of slices for the given interface
- */
-static inline u32 msm_dsc_get_slices_per_intf(const struct drm_dsc_config *dsc, u32 intf_width)
-{
-       return DIV_ROUND_UP(intf_width, dsc->slice_width);
-}
-
 /**
  * msm_dsc_get_bytes_per_line() - calculate bytes per line
  * @dsc: Pointer to drm dsc config struct