Skip to content

Commit e4eb11b

Browse files
right-0903lumag
authored andcommitted
drm/msm/dsi: fix pclk rate calculation for bonded dsi
Recently, we round up new_hdisplay once at most, for bonded dsi, we may need twice, since they are independent links, we should round up each half separately. This also aligns with the hdisplay we program later in dsi_timing_setup() Example: full_hdisplay = 1904, dsc_bpp = 8, bpc = 8 new_full_hdisplay = DIV_ROUND_UP(1904 * 8, 8 * 3) = 635 if we use half display new_half_hdisplay = DIV_ROUND_UP(952 * 8, 8 * 3) = 318 new_full_display = 636 Fixes: 7c9e4a5 ("drm/msm/dsi: Reduce pclk rate for compression") Signed-off-by: Pengyu Luo <mitltlatltl@gmail.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Patchwork: https://patchwork.freedesktop.org/patch/709716/ Link: https://lore.kernel.org/r/20260306163255.215456-1-mitltlatltl@gmail.com Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
1 parent 4355b13 commit e4eb11b

1 file changed

Lines changed: 23 additions & 6 deletions

File tree

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

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -584,13 +584,30 @@ void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host)
584584
* FIXME: Reconsider this if/when CMD mode handling is rewritten to use
585585
* transfer time and data overhead as a starting point of the calculations.
586586
*/
587-
static unsigned long dsi_adjust_pclk_for_compression(const struct drm_display_mode *mode,
588-
const struct drm_dsc_config *dsc)
587+
static unsigned long
588+
dsi_adjust_pclk_for_compression(const struct drm_display_mode *mode,
589+
const struct drm_dsc_config *dsc,
590+
bool is_bonded_dsi)
589591
{
590-
int new_hdisplay = DIV_ROUND_UP(mode->hdisplay * drm_dsc_get_bpp_int(dsc),
591-
dsc->bits_per_component * 3);
592+
int hdisplay, new_hdisplay, new_htotal;
592593

593-
int new_htotal = mode->htotal - mode->hdisplay + new_hdisplay;
594+
/*
595+
* For bonded DSI, split hdisplay across two links and round up each
596+
* half separately, passing the full hdisplay would only round up once.
597+
* This also aligns with the hdisplay we program later in
598+
* dsi_timing_setup()
599+
*/
600+
hdisplay = mode->hdisplay;
601+
if (is_bonded_dsi)
602+
hdisplay /= 2;
603+
604+
new_hdisplay = DIV_ROUND_UP(hdisplay * drm_dsc_get_bpp_int(dsc),
605+
dsc->bits_per_component * 3);
606+
607+
if (is_bonded_dsi)
608+
new_hdisplay *= 2;
609+
610+
new_htotal = mode->htotal - mode->hdisplay + new_hdisplay;
594611

595612
return mult_frac(mode->clock * 1000u, new_htotal, mode->htotal);
596613
}
@@ -603,7 +620,7 @@ static unsigned long dsi_get_pclk_rate(const struct drm_display_mode *mode,
603620
pclk_rate = mode->clock * 1000u;
604621

605622
if (dsc)
606-
pclk_rate = dsi_adjust_pclk_for_compression(mode, dsc);
623+
pclk_rate = dsi_adjust_pclk_for_compression(mode, dsc, is_bonded_dsi);
607624

608625
/*
609626
* For bonded DSI mode, the current DRM mode has the complete width of the

0 commit comments

Comments
 (0)