diff mbox series

[1/2] drm/msm/dpu: move vblank events to complete_commit()

Message ID 20200907170450.370122-1-robdclark@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/2] drm/msm/dpu: move vblank events to complete_commit() | expand

Commit Message

Rob Clark Sept. 7, 2020, 5:04 p.m. UTC
From: Rob Clark <robdclark@chromium.org>

We could get a vblank event racing with the current atomic commit,
resulting in sending the pageflip event to userspace early, causing
tearing.  On the other hand, complete_commit() ensures that the
pending flush is complete.

Signed-off-by: Rob Clark <robdclark@chromium.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Abhinav Kumar Sept. 8, 2020, 7:06 p.m. UTC | #1
On 2020-09-07 10:04, Rob Clark wrote:
> From: Rob Clark <robdclark@chromium.org>
> 
> We could get a vblank event racing with the current atomic commit,
> resulting in sending the pageflip event to userspace early, causing
> tearing.  On the other hand, complete_commit() ensures that the
> pending flush is complete.
> 
> Signed-off-by: Rob Clark <robdclark@chromium.org>

I checked our downstream code as well and yes we are not signaling
page flips inside the vblank_cb and are doing it after 
wait_for_commit_done
This aligns with that.
Hence,
Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> index c2729f71e2fa..89c0245b5de5 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> @@ -297,7 +297,6 @@ void dpu_crtc_vblank_callback(struct drm_crtc 
> *crtc)
>  		dpu_crtc->vblank_cb_time = ktime_get();
>  	else
>  		dpu_crtc->vblank_cb_count++;
> -	_dpu_crtc_complete_flip(crtc);
>  	drm_crtc_handle_vblank(crtc);
>  	trace_dpu_crtc_vblank_cb(DRMID(crtc));
>  }
> @@ -402,6 +401,7 @@ static void dpu_crtc_frame_event_cb(void *data, u32 
> event)
>  void dpu_crtc_complete_commit(struct drm_crtc *crtc)
>  {
>  	trace_dpu_crtc_complete_commit(DRMID(crtc));
> +	_dpu_crtc_complete_flip(crtc);
>  }
> 
>  static void _dpu_crtc_setup_lm_bounds(struct drm_crtc *crtc,
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index c2729f71e2fa..89c0245b5de5 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -297,7 +297,6 @@  void dpu_crtc_vblank_callback(struct drm_crtc *crtc)
 		dpu_crtc->vblank_cb_time = ktime_get();
 	else
 		dpu_crtc->vblank_cb_count++;
-	_dpu_crtc_complete_flip(crtc);
 	drm_crtc_handle_vblank(crtc);
 	trace_dpu_crtc_vblank_cb(DRMID(crtc));
 }
@@ -402,6 +401,7 @@  static void dpu_crtc_frame_event_cb(void *data, u32 event)
 void dpu_crtc_complete_commit(struct drm_crtc *crtc)
 {
 	trace_dpu_crtc_complete_commit(DRMID(crtc));
+	_dpu_crtc_complete_flip(crtc);
 }
 
 static void _dpu_crtc_setup_lm_bounds(struct drm_crtc *crtc,