diff --git a/msm/sde/sde_kms.c b/msm/sde/sde_kms.c index e466c0fc02ca..0b36b0b2d0e7 100644 --- a/msm/sde/sde_kms.c +++ b/msm/sde/sde_kms.c @@ -1341,6 +1341,7 @@ int sde_kms_vm_pre_release(struct sde_kms *sde_kms, struct drm_encoder *encoder; struct drm_connector *connector; int rc = 0; + struct msm_drm_private *priv; ddev = sde_kms->dev; @@ -1348,6 +1349,7 @@ int sde_kms_vm_pre_release(struct sde_kms *sde_kms, if (!crtc) return 0; + priv = crtc->dev->dev_private; /* if vm_req is enabled, once CRTC on the commit is guaranteed */ sde_kms_wait_for_frame_transfer_complete(&sde_kms->base, crtc); @@ -1373,6 +1375,12 @@ int sde_kms_vm_pre_release(struct sde_kms *sde_kms, /* disable vblank events */ drm_crtc_vblank_off(crtc); + /* + * Flush event thread queue for any pending events as vblank work + * might get scheduled from drm_crtc_vblank_off + */ + kthread_flush_worker(&priv->event_thread[crtc->index].worker); + /* reset sw state */ sde_crtc_reset_sw_state(crtc);