drm/i915: Restore vblank interrupts earlier
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 3 Oct 2018 14:49:51 +0000 (17:49 +0300)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Thu, 18 Oct 2018 01:23:36 +0000 (18:23 -0700)
Plane sanitation needs vblank interrupts (on account of CxSR disable).
So let's restore vblank interrupts earlier.

v2: Make it actually build
v3: Add comment to explain why we need this (Daniel)

Cc: stable@vger.kernel.org
Cc: Dennis <dennis.nezic@utoronto.ca>
Tested-by: Dennis <dennis.nezic@utoronto.ca>
Tested-by: Peter Nowee <peter.nowee@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105637
Fixes: b1e01595a66d ("drm/i915: Redo plane sanitation during readout")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181003144951.4397-1-ville.syrjala@linux.intel.com
(cherry picked from commit 68bc30deac625b8be8d3950b30dc93d09a3645f5)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/i915/intel_display.c

index aa6e79dfd571ea8fd7b821d1ad24572bb23ec273..ce23b054640747596fda0d95485c74c1a1b2d5d4 100644 (file)
@@ -15526,13 +15526,9 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc,
                           I915_READ(reg) & ~PIPECONF_FRAME_START_DELAY_MASK);
        }
 
-       /* restore vblank interrupts to correct state */
-       drm_crtc_vblank_reset(&crtc->base);
        if (crtc->active) {
                struct intel_plane *plane;
 
-               drm_crtc_vblank_on(&crtc->base);
-
                /* Disable everything but the primary plane */
                for_each_intel_plane_on_crtc(dev, crtc, plane) {
                        const struct intel_plane_state *plane_state =
@@ -15874,7 +15870,6 @@ intel_modeset_setup_hw_state(struct drm_device *dev,
                             struct drm_modeset_acquire_ctx *ctx)
 {
        struct drm_i915_private *dev_priv = to_i915(dev);
-       enum pipe pipe;
        struct intel_crtc *crtc;
        struct intel_encoder *encoder;
        int i;
@@ -15887,15 +15882,23 @@ intel_modeset_setup_hw_state(struct drm_device *dev,
        /* HW state is read out, now we need to sanitize this mess. */
        get_encoder_power_domains(dev_priv);
 
-       intel_sanitize_plane_mapping(dev_priv);
+       /*
+        * intel_sanitize_plane_mapping() may need to do vblank
+        * waits, so we need vblank interrupts restored beforehand.
+        */
+       for_each_intel_crtc(&dev_priv->drm, crtc) {
+               drm_crtc_vblank_reset(&crtc->base);
 
-       for_each_intel_encoder(dev, encoder) {
-               intel_sanitize_encoder(encoder);
+               if (crtc->active)
+                       drm_crtc_vblank_on(&crtc->base);
        }
 
-       for_each_pipe(dev_priv, pipe) {
-               crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
+       intel_sanitize_plane_mapping(dev_priv);
 
+       for_each_intel_encoder(dev, encoder)
+               intel_sanitize_encoder(encoder);
+
+       for_each_intel_crtc(&dev_priv->drm, crtc) {
                intel_sanitize_crtc(crtc, ctx);
                intel_dump_pipe_config(crtc, crtc->config,
                                       "[setup_hw_state]");