aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2018-03-15 05:11:59 -0400
committerPhilipp Zabel <p.zabel@pengutronix.de>2018-03-15 12:52:41 -0400
commit6a055b92de15af987b4027826d43aa103c65a3c4 (patch)
treecc31f87b70c42d341c811fd689f02fb8c5c83a58
parenta71d3241db6b9430e613cff168611bad97297ba2 (diff)
drm/imx: move arming of the vblank event to atomic_flush
Right now the vblank event completion is racing with the atomic update, which is especially bad when the PRE is in use, as one of the hardware issue workaround might extend the atomic commit for quite some time. If the vblank IRQ happens to trigger during that time, we will prematurely signal the atomic commit completion to userspace, which causes tearing when userspace re-uses a framebuffer we haven't managed to flip away from yet. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
-rw-r--r--drivers/gpu/drm/imx/ipuv3-crtc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c
index 9a9961802f5c..e83af0f2be86 100644
--- a/drivers/gpu/drm/imx/ipuv3-crtc.c
+++ b/drivers/gpu/drm/imx/ipuv3-crtc.c
@@ -225,7 +225,11 @@ static void ipu_crtc_atomic_begin(struct drm_crtc *crtc,
225 struct drm_crtc_state *old_crtc_state) 225 struct drm_crtc_state *old_crtc_state)
226{ 226{
227 drm_crtc_vblank_on(crtc); 227 drm_crtc_vblank_on(crtc);
228}
228 229
230static void ipu_crtc_atomic_flush(struct drm_crtc *crtc,
231 struct drm_crtc_state *old_crtc_state)
232{
229 spin_lock_irq(&crtc->dev->event_lock); 233 spin_lock_irq(&crtc->dev->event_lock);
230 if (crtc->state->event) { 234 if (crtc->state->event) {
231 WARN_ON(drm_crtc_vblank_get(crtc)); 235 WARN_ON(drm_crtc_vblank_get(crtc));
@@ -293,6 +297,7 @@ static const struct drm_crtc_helper_funcs ipu_helper_funcs = {
293 .mode_set_nofb = ipu_crtc_mode_set_nofb, 297 .mode_set_nofb = ipu_crtc_mode_set_nofb,
294 .atomic_check = ipu_crtc_atomic_check, 298 .atomic_check = ipu_crtc_atomic_check,
295 .atomic_begin = ipu_crtc_atomic_begin, 299 .atomic_begin = ipu_crtc_atomic_begin,
300 .atomic_flush = ipu_crtc_atomic_flush,
296 .atomic_disable = ipu_crtc_atomic_disable, 301 .atomic_disable = ipu_crtc_atomic_disable,
297 .atomic_enable = ipu_crtc_atomic_enable, 302 .atomic_enable = ipu_crtc_atomic_enable,
298}; 303};