Skip to content

Commit 377569f

Browse files
MarijnS95robclark
authored andcommitted
drm/msm/mdp5: Do not multiply vclk line count by 100
Neither vtotal nor drm_mode_vrefresh contain a value that is premultiplied by 100 making the x100 variable name incorrect and resulting in vclks_line to become 100 times larger than it is supposed to be. The hardware counts 100 clockticks too many before tearcheck, leading to severe panel issues on at least the Sony Xperia lineup. This is likely an artifact from the original MDSS DSI panel driver where the calculation [1] corrected for a premultiplied reference framerate by 100 [2]. It does not appear that the above values were ever premultiplied in the history of the DRM MDP5 driver. With this change applied the value written to the SYNC_CONFIG_VSYNC register is now identical to downstream kernels. [1]: https://source.codeaurora.org/quic/la/kernel/msm-3.18/tree/drivers/video/msm/mdss/mdss_mdp_intf_cmd.c?h=LA.UM.8.6.c26-02400-89xx.0#n288 [2]: https://source.codeaurora.org/quic/la/kernel/msm-3.18/tree/drivers/video/msm/mdss/mdss_dsi_panel.c?h=LA.UM.8.6.c26-02400-89xx.0#n1648 Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Marijn Suijten <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Clark <[email protected]>
1 parent 2ad52bd commit 377569f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/gpu/drm/msm/disp/mdp5/mdp5_cmd_encoder.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ static int pingpong_tearcheck_setup(struct drm_encoder *encoder,
2020
{
2121
struct mdp5_kms *mdp5_kms = get_kms(encoder);
2222
struct device *dev = encoder->dev->dev;
23-
u32 total_lines_x100, vclks_line, cfg;
23+
u32 total_lines, vclks_line, cfg;
2424
long vsync_clk_speed;
2525
struct mdp5_hw_mixer *mixer = mdp5_crtc_get_mixer(encoder->crtc);
2626
int pp_id = mixer->pp;
@@ -30,8 +30,8 @@ static int pingpong_tearcheck_setup(struct drm_encoder *encoder,
3030
return -EINVAL;
3131
}
3232

33-
total_lines_x100 = mode->vtotal * drm_mode_vrefresh(mode);
34-
if (!total_lines_x100) {
33+
total_lines = mode->vtotal * drm_mode_vrefresh(mode);
34+
if (!total_lines) {
3535
DRM_DEV_ERROR(dev, "%s: vtotal(%d) or vrefresh(%d) is 0\n",
3636
__func__, mode->vtotal, drm_mode_vrefresh(mode));
3737
return -EINVAL;
@@ -43,7 +43,7 @@ static int pingpong_tearcheck_setup(struct drm_encoder *encoder,
4343
vsync_clk_speed);
4444
return -EINVAL;
4545
}
46-
vclks_line = vsync_clk_speed * 100 / total_lines_x100;
46+
vclks_line = vsync_clk_speed / total_lines;
4747

4848
cfg = MDP5_PP_SYNC_CONFIG_VSYNC_COUNTER_EN
4949
| MDP5_PP_SYNC_CONFIG_VSYNC_IN_EN;

0 commit comments

Comments
 (0)