• Quanyang Wang's avatar
    drm/tilcdc: send vblank event when disabling crtc · f1a75f4d
    Quanyang Wang authored
    When run xrandr to change resolution on Beaglebone Black board, it will
    print the error information:
    
    root@beaglebone:~# xrandr -display :0 --output HDMI-1 --mode 720x400
    [drm:drm_crtc_commit_wait] *ERROR* flip_done timed out
    [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:32:tilcdc crtc] commit wait timed out
    [drm:drm_crtc_commit_wait] *ERROR* flip_done timed out
    [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:34:HDMI-A-1] commit wait timed out
    [drm:drm_crtc_commit_wait] *ERROR* flip_done timed out
    [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:31:plane-0] commit wait timed out
    tilcdc 4830e000.lcdc: already pending page flip!
    
    This is because there is operation sequence as below:
    
    drm_atomic_connector_commit_dpms(mode is DRM_MODE_DPMS_OFF):
        ...
        drm_atomic_helper_setup_commit <- init_completion(commit_A->flip_done)
        drm_atomic_helper_commit_tail
            tilcdc_crtc_atomic_disable
            tilcdc_plane_atomic_update <- drm_crtc_send_vblank_event in tilcdc_crtc_irq
                                          is skipped since tilcdc_crtc->enabled is 0
            tilcdc_crtc_atomic_flush   <- drm_crtc_send_vblank_event is skipped since
                                          crtc->state->event is set to be NULL in
                                          tilcdc_plane_atomic_update
    drm_mode_setcrtc:
        ...
        drm_atomic_helper_setup_commit <- init_completion(commit_B->flip_done)
        drm_atomic_helper_wait_for_dependencies
            drm_crtc_commit_wait   <- wait for commit_A->flip_done completing
    
    Just as shown above, the steps which could complete commit_A->flip_done
    are all skipped and commit_A->flip_done will never be completed. This will
    result a time-out ERROR when drm_crtc_commit_wait check the commit_A->flip_done.
    So add drm_crtc_send_vblank_event in tilcdc_crtc_atomic_disable to
    complete commit_A->flip_done.
    
    Fixes: cb345dec ("drm/tilcdc: Use standard drm_atomic_helper_commit")
    Signed-off-by: default avatarQuanyang Wang <quanyang.wang@windriver.com>
    Reviewed-by: default avatarJyri Sarha <jyri.sarha@iki.fi>
    Tested-by: default avatarJyri Sarha <jyri.sarha@iki.fi>
    Signed-off-by: default avatarJyri Sarha <jyri.sarha@iki.fi>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210209082415.382602-1-quanyang.wang@windriver.com
    f1a75f4d
tilcdc_crtc.c 28.5 KB