intel_frontbuffer_flip(dev, atomic->fb_bits);
 
+       if (atomic->disable_cxsr)
+               crtc->wm.cxsr_allowed = true;
+
        if (crtc->atomic.update_wm_post)
                intel_update_watermarks(&crtc->base);
 
 
        if (atomic->pre_disable_primary)
                intel_pre_disable_primary(&crtc->base);
+
+       if (atomic->disable_cxsr) {
+               crtc->wm.cxsr_allowed = false;
+               intel_set_memory_cxsr(dev_priv, false);
+       }
 }
 
 static void intel_crtc_disable_planes(struct drm_crtc *crtc, unsigned plane_mask)
                         plane->base.id, was_visible, visible,
                         turn_off, turn_on, mode_changed);
 
-       if (turn_on)
+       if (turn_on) {
                intel_crtc->atomic.update_wm_pre = true;
-       else if (turn_off)
+               /* must disable cxsr around plane enable/disable */
+               if (plane->type != DRM_PLANE_TYPE_CURSOR) {
+                       intel_crtc->atomic.disable_cxsr = true;
+                       /* to potentially re-enable cxsr */
+                       intel_crtc->atomic.wait_vblank = true;
+                       intel_crtc->atomic.update_wm_post = true;
+               }
+       } else if (turn_off) {
                intel_crtc->atomic.update_wm_post = true;
-       else if (intel_wm_need_update(plane, plane_state))
+               /* must disable cxsr around plane enable/disable */
+               if (plane->type != DRM_PLANE_TYPE_CURSOR) {
+                       if (is_crtc_enabled)
+                               intel_crtc->atomic.wait_vblank = true;
+                       intel_crtc->atomic.disable_cxsr = true;
+               }
+       } else if (intel_wm_need_update(plane, plane_state)) {
                intel_crtc->atomic.update_wm_pre = true;
+       }
 
        if (visible)
                intel_crtc->atomic.fb_bits |=
        if (pipe_config->quirks & PIPE_CONFIG_QUIRK_INITIAL_PLANES)
                intel_crtc_check_initial_planes(crtc, crtc_state);
 
-       if (mode_changed)
-               intel_crtc->atomic.update_wm_post = !crtc_state->active;
+       if (mode_changed && !crtc_state->active)
+               intel_crtc->atomic.update_wm_post = true;
 
        if (mode_changed && crtc_state->enable &&
            dev_priv->display.crtc_compute_clock &&
                if (!needs_modeset(crtc->state))
                        continue;
 
+               intel_pre_plane_update(intel_crtc);
+
                any_ms = true;
                intel_pre_plane_update(intel_crtc);
 
        intel_crtc->cursor_cntl = ~0;
        intel_crtc->cursor_size = ~0;
 
+       intel_crtc->wm.cxsr_allowed = true;
+
        BUG_ON(pipe >= ARRAY_SIZE(dev_priv->plane_to_crtc_mapping) ||
               dev_priv->plane_to_crtc_mapping[intel_crtc->plane] != NULL);
        dev_priv->plane_to_crtc_mapping[intel_crtc->plane] = &intel_crtc->base;
 
        if (IS_VALLEYVIEW(dev)) {
                I915_WRITE(FW_BLC_SELF_VLV, enable ? FW_CSPWRDWNEN : 0);
                POSTING_READ(FW_BLC_SELF_VLV);
+               dev_priv->wm.vlv.cxsr = enable;
        } else if (IS_G4X(dev) || IS_CRESTLINE(dev)) {
                I915_WRITE(FW_BLC_SELF, enable ? FW_BLC_SELF_EN : 0);
                POSTING_READ(FW_BLC_SELF);
 
        memset(wm_state, 0, sizeof(*wm_state));
 
-       wm_state->cxsr = crtc->pipe != PIPE_C;
+       wm_state->cxsr = crtc->pipe != PIPE_C && crtc->wm.cxsr_allowed;
        if (IS_CHERRYVIEW(dev))
                wm_state->num_levels = CHV_WM_NUM_LEVELS;
        else
            dev_priv->wm.vlv.level >= VLV_WM_LEVEL_PM5)
                chv_set_memory_pm5(dev_priv, false);
 
-       if (!wm.cxsr && dev_priv->wm.vlv.cxsr) {
+       if (!wm.cxsr && dev_priv->wm.vlv.cxsr)
                intel_set_memory_cxsr(dev_priv, false);
-               intel_wait_for_vblank(dev, pipe);
-       }
 
        /* FIXME should be part of crtc atomic commit */
        vlv_pipe_set_fifo_size(intel_crtc);
                      wm.pipe[pipe].sprite[0], wm.pipe[pipe].sprite[1],
                      wm.sr.plane, wm.sr.cursor, wm.level, wm.cxsr);
 
-       if (wm.cxsr && !dev_priv->wm.vlv.cxsr) {
-               intel_wait_for_vblank(dev, pipe);
+       if (wm.cxsr && !dev_priv->wm.vlv.cxsr)
                intel_set_memory_cxsr(dev_priv, true);
-       }
 
        if (wm.level >= VLV_WM_LEVEL_PM5 &&
            dev_priv->wm.vlv.level < VLV_WM_LEVEL_PM5)