• Sean Paul's avatar
    drm/msm: dpu: Separate crtc assignment from vblank enable · a796ba2c
    Sean Paul authored
    Instead of assigning/clearing the crtc on vblank enable/disable, we can
    just assign and clear the crtc on modeset. That allows us to just toggle
    the encoder's vblank interrupts on vblank_enable.
    
    So why is this important? Previously the driver was using the legacy
    pointers to assign/clear the crtc. Legacy pointers are cleared _after_
    disabling the hardware, so the legacy pointer was valid during
    vblank_disable, but that's not something we should rely on.
    
    Instead of relying on the core ordering the legacy pointer assignments
    just so, we'll assign the crtc in dpu_crtc enable/disable. This is the
    only place that mapping can change, so we're covered there.
    
    We're also taking advantage of drm_crtc_vblank_on/off. By using this, we
    ensure that vblank_enable/disable can never be called while the crtc is
    off (which means the assigned crtc will always be valid). As such, we
    don't need to use modeset locks or the crtc_lock in the
    vblank_enable/disable routine to be sure state is consistent.
    
    ...I think.
    
    Changes in v2:
    - Changed crtc check in toggle_vblank to != (Jeykumar)
    
    Cc: Jeykumar Sankaran <jsanka@codeaurora.org>
    Reviewed-by: default avatarJeykumar Sankaran <jsanka@codeaurora.org>
    Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
    [dpu_crtc.c change needed to be manually applied b/c of the dpu_crtc_reset change]
    Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
    a796ba2c
dpu_crtc.c 40.3 KB