drm/msm/mdp5: dpms(OFF) cleanups
authorRob Clark <robdclark@gmail.com>
Thu, 20 Nov 2014 22:05:04 +0000 (17:05 -0500)
committerRob Clark <robdclark@gmail.com>
Fri, 21 Nov 2014 13:59:24 +0000 (08:59 -0500)
When disabling the interface (INTF), the change doesn't latch until next
vblank, so we need to wait for vblank.

Also, to be pedantic, in the crtc, set all the mixer stages to unused.
It shouldn't really matter, since at this point we have already disabled
the INTF and waited for necessary vblank.

Signed-off-by: Rob Clark <robdclark@gmail.com>
drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c

index a6728a80f7e04f79c5a4b411195bd70a6ed96fd8..0598bdea4ff4a5cf68926c1b22ca5ef98b093602 100644 (file)
@@ -150,6 +150,8 @@ static void mdp5_crtc_dpms(struct drm_crtc *crtc, int mode)
                        mdp5_enable(mdp5_kms);
                        mdp_irq_register(&mdp5_kms->base, &mdp5_crtc->err);
                } else {
+                       /* set STAGE_UNUSED for all layers */
+                       mdp5_ctl_blend(mdp5_crtc->ctl, mdp5_crtc->lm, 0x00000000);
                        mdp_irq_unregister(&mdp5_kms->base, &mdp5_crtc->err);
                        mdp5_disable(mdp5_kms);
                }
index 25c2fcb39ac3ace3321d396bf949dbb46777a3c8..0254bfdeb92feb1b9aa3ccbab03c20c447877947 100644 (file)
@@ -132,6 +132,17 @@ static void mdp5_encoder_dpms(struct drm_encoder *encoder, int mode)
                spin_lock_irqsave(&mdp5_encoder->intf_lock, flags);
                mdp5_write(mdp5_kms, REG_MDP5_INTF_TIMING_ENGINE_EN(intf), 0);
                spin_unlock_irqrestore(&mdp5_encoder->intf_lock, flags);
+
+               /*
+                * Wait for a vsync so we know the ENABLE=0 latched before
+                * the (connector) source of the vsync's gets disabled,
+                * otherwise we end up in a funny state if we re-enable
+                * before the disable latches, which results that some of
+                * the settings changes for the new modeset (like new
+                * scanout buffer) don't latch properly..
+                */
+               mdp_irq_wait(&mdp5_kms->base, intf2vblank(intf));
+
                bs_set(mdp5_encoder, 0);
        }