dsi_populate_dsc_params() always programs the pre-SCR (DSC 1.1)
rate-control parameters.  A panel that advertises DSC 1.2 needs the
1.2 table: with the 1.1 values the decoder reconstructs the wrong
quantisation parameters, and the result is horizontal banding across
the whole picture.  Solid colours still look correct, which makes the
problem easy to miss and easy to blame on the panel or the PHY.

Pick the table from dsc_version_minor, as the DRM DSC helpers expect.
Panels that report 1.1 keep the pre-SCR table, so existing devices are
unaffected.

Tested on Xiaomi Redmi K80 Pro (SM8750, o11u panel: DSC 1.2,
1440x3200, slice 720x20, 10 bpc).  Before: every non-uniform image
shows horizontal stripes.  After: the panel renders correctly.

Signed-off-by: Zhixiang Yu <[email protected]>
---
 drivers/gpu/drm/msm/dsi/dsi_host.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c 
b/drivers/gpu/drm/msm/dsi/dsi_host.c
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -1910,8 +1910,12 @@ static int dsi_populate_dsc_params(struct msm_dsi_host 
*msm_host, struct drm_dsc
        drm_dsc_set_const_params(dsc);
        drm_dsc_set_rc_buf_thresh(dsc);
 
-       /* DPU supports only pre-SCR panels */
-       ret = drm_dsc_setup_rc_params(dsc, DRM_DSC_1_1_PRE_SCR);
+       /*
+        * Match the rate-control table to the panel: a DSC 1.2 panel given the
+        * pre-SCR (1.1) table decodes into horizontal bands.
+        */
+       ret = drm_dsc_setup_rc_params(dsc, dsc->dsc_version_minor == 2 ?
+                                     DRM_DSC_1_2_444 : DRM_DSC_1_1_PRE_SCR);
        if (ret) {
                DRM_DEV_ERROR(&msm_host->pdev->dev, "could not find DSC RC 
parameters\n");
                return ret;
-- 
2.43.0

Reply via email to