Skip to content

Commit c28d76d

Browse files
bebarinoAbhinav Kumar
authored andcommitted
drm/msm/dpu: Increment vsync_cnt before waking up userspace
The 'vsync_cnt' is used to count the number of frames for a crtc. Unfortunately, we increment the count after waking up userspace via dpu_crtc_vblank_callback() calling drm_crtc_handle_vblank(). drm_crtc_handle_vblank() wakes up userspace processes that have called drm_wait_vblank_ioctl(), and if that ioctl is expecting the count to increase it won't. Increment the count before calling into the drm APIs so that we don't have to worry about ordering the increment with anything else in drm. This fixes a software video decode test that fails to see frame counts increase on Trogdor boards. Cc: Mark Yacoub <[email protected]> Cc: Jessica Zhang <[email protected]> Fixes: 885455d ("drm/msm: Change dpu_crtc_get_vblank_counter to use vsync count.") Signed-off-by: Stephen Boyd <[email protected]> Reviewed-by: Abhinav Kumar <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Tested-by: Jessica Zhang <[email protected]> # Trogdor (sc7180) Patchwork: https://patchwork.freedesktop.org/patch/490531/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Abhinav Kumar <[email protected]>
1 parent a6e2af6 commit c28d76d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1251,12 +1251,13 @@ static void dpu_encoder_vblank_callback(struct drm_encoder *drm_enc,
12511251
DPU_ATRACE_BEGIN("encoder_vblank_callback");
12521252
dpu_enc = to_dpu_encoder_virt(drm_enc);
12531253

1254+
atomic_inc(&phy_enc->vsync_cnt);
1255+
12541256
spin_lock_irqsave(&dpu_enc->enc_spinlock, lock_flags);
12551257
if (dpu_enc->crtc)
12561258
dpu_crtc_vblank_callback(dpu_enc->crtc);
12571259
spin_unlock_irqrestore(&dpu_enc->enc_spinlock, lock_flags);
12581260

1259-
atomic_inc(&phy_enc->vsync_cnt);
12601261
DPU_ATRACE_END("encoder_vblank_callback");
12611262
}
12621263

0 commit comments

Comments
 (0)