Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/msm: add support for per-CRTC max_vblank_count on mdp5

The mdp5 drm/kms driver currently does not work on command-mode DSI
panels due to 'vblank wait timed out' errors. This causes a latency
of seconds, or tens of seconds in some cases, before content is shown
on the panel. This hardware does not have the something that we can use
as a frame counter available when running in command mode, so we need to
fall back to using timestamps by setting the max_vblank_count to zero.
This can be done on a per-CRTC basis, so the convert mdp5 to use
drm_crtc_set_max_vblank_count().

This change was tested on a LG Nexus 5 (hammerhead) phone.

Suggested-by: Jeffrey Hugo <jeffrey.l.hugo@gmail.com>
Reviewed-by: Jeffrey Hugo <jeffrey.l.hugo@gmail.com>
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190531094619.31704-3-masneyb@onstation.org

authored by

Brian Masney and committed by
Sean Paul
2bab52af 3de433c5

+16 -2
+15 -1
drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
··· 439 439 mdp5_crtc->enabled = false; 440 440 } 441 441 442 + static void mdp5_crtc_vblank_on(struct drm_crtc *crtc) 443 + { 444 + struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state); 445 + struct mdp5_interface *intf = mdp5_cstate->pipeline.intf; 446 + u32 count; 447 + 448 + count = intf->mode == MDP5_INTF_DSI_MODE_COMMAND ? 0 : 0xffffffff; 449 + drm_crtc_set_max_vblank_count(crtc, count); 450 + 451 + drm_crtc_vblank_on(crtc); 452 + } 453 + 442 454 static void mdp5_crtc_atomic_enable(struct drm_crtc *crtc, 443 455 struct drm_crtc_state *old_state) 444 456 { ··· 487 475 } 488 476 489 477 /* Restore vblank irq handling after power is enabled */ 490 - drm_crtc_vblank_on(crtc); 478 + mdp5_crtc_vblank_on(crtc); 491 479 492 480 mdp5_crtc_mode_set_nofb(crtc); 493 481 ··· 1040 1028 mdp5_crtc_destroy_state(crtc, crtc->state); 1041 1029 1042 1030 __drm_atomic_helper_crtc_reset(crtc, &mdp5_cstate->base); 1031 + 1032 + drm_crtc_vblank_reset(crtc); 1043 1033 } 1044 1034 1045 1035 static const struct drm_crtc_funcs mdp5_crtc_funcs = {
+1 -1
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
··· 740 740 dev->driver->get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos; 741 741 dev->driver->get_scanout_position = mdp5_get_scanoutpos; 742 742 dev->driver->get_vblank_counter = mdp5_get_vblank_counter; 743 - dev->max_vblank_count = 0xffffffff; 743 + dev->max_vblank_count = 0; /* max_vblank_count is set on each CRTC */ 744 744 dev->vblank_disable_immediate = true; 745 745 746 746 return kms;