OSDN Git Service

drm/i915/display: Move the commit_tail() disable sequence to separate function
authorManasi Navare <manasi.d.navare@intel.com>
Wed, 28 Aug 2019 22:47:01 +0000 (15:47 -0700)
committerManasi Navare <manasi.d.navare@intel.com>
Thu, 29 Aug 2019 21:15:29 +0000 (14:15 -0700)
Create a new function intel_commit_modeset_disables() consistent
with the naming in drm atomic helpers and similar to the enable function.
This helps better organize the disable sequence in atomic_commit_tail()

No functional change

v4:
* Do not create a function pointer, just a function (Maarten)
v3:
* Rebase (Manasi)
v2:
* Create a helper for old_crtc_state disables (Lucas)

Suggested-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190828224701.422-1-manasi.d.navare@intel.com
drivers/gpu/drm/i915/display/intel_display.c
drivers/gpu/drm/i915/i915_drv.h

index 85183ef..b38d842 100644 (file)
@@ -13743,6 +13743,61 @@ static void intel_update_crtc(struct intel_crtc *crtc,
        intel_finish_crtc_commit(state, crtc);
 }
 
+static void intel_old_crtc_state_disables(struct intel_atomic_state *state,
+                                         struct intel_crtc_state *old_crtc_state,
+                                         struct intel_crtc_state *new_crtc_state,
+                                         struct intel_crtc *crtc)
+{
+       struct drm_i915_private *dev_priv = to_i915(state->base.dev);
+
+       intel_crtc_disable_planes(state, crtc);
+
+       /*
+        * We need to disable pipe CRC before disabling the pipe,
+        * or we race against vblank off.
+        */
+       intel_crtc_disable_pipe_crc(crtc);
+
+       dev_priv->display.crtc_disable(old_crtc_state, state);
+       crtc->active = false;
+       intel_fbc_disable(crtc);
+       intel_disable_shared_dpll(old_crtc_state);
+
+       /*
+        * Underruns don't always raise interrupts,
+        * so check manually.
+        */
+       intel_check_cpu_fifo_underruns(dev_priv);
+       intel_check_pch_fifo_underruns(dev_priv);
+
+       /* FIXME unify this for all platforms */
+       if (!new_crtc_state->base.active &&
+           !HAS_GMCH(dev_priv) &&
+           dev_priv->display.initial_watermarks)
+               dev_priv->display.initial_watermarks(state,
+                                                    new_crtc_state);
+}
+
+static void intel_commit_modeset_disables(struct intel_atomic_state *state)
+{
+       struct intel_crtc_state *new_crtc_state, *old_crtc_state;
+       struct intel_crtc *crtc;
+       int i;
+
+       for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
+               if (!needs_modeset(new_crtc_state))
+                       continue;
+
+               intel_pre_plane_update(old_crtc_state, new_crtc_state);
+
+               if (old_crtc_state->base.active)
+                       intel_old_crtc_state_disables(state,
+                                                     old_crtc_state,
+                                                     new_crtc_state,
+                                                     crtc);
+       }
+}
+
 static void intel_commit_modeset_enables(struct intel_atomic_state *state)
 {
        struct intel_crtc *crtc;
@@ -13923,42 +13978,10 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
                        put_domains[crtc->pipe] =
                                modeset_get_crtc_power_domains(new_crtc_state);
                }
-
-               if (!needs_modeset(new_crtc_state))
-                       continue;
-
-               intel_pre_plane_update(old_crtc_state, new_crtc_state);
-
-               if (old_crtc_state->base.active) {
-                       intel_crtc_disable_planes(state, crtc);
-
-                       /*
-                        * We need to disable pipe CRC before disabling the pipe,
-                        * or we race against vblank off.
-                        */
-                       intel_crtc_disable_pipe_crc(crtc);
-
-                       dev_priv->display.crtc_disable(old_crtc_state, state);
-                       crtc->active = false;
-                       intel_fbc_disable(crtc);
-                       intel_disable_shared_dpll(old_crtc_state);
-
-                       /*
-                        * Underruns don't always raise
-                        * interrupts, so check manually.
-                        */
-                       intel_check_cpu_fifo_underruns(dev_priv);
-                       intel_check_pch_fifo_underruns(dev_priv);
-
-                       /* FIXME unify this for all platforms */
-                       if (!new_crtc_state->base.active &&
-                           !HAS_GMCH(dev_priv) &&
-                           dev_priv->display.initial_watermarks)
-                               dev_priv->display.initial_watermarks(state,
-                                                                    new_crtc_state);
-               }
        }
 
+       intel_commit_modeset_disables(state);
+
        /* FIXME: Eventually get rid of our crtc->config pointer */
        for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i)
                crtc->config = new_crtc_state;
@@ -15909,6 +15932,7 @@ void intel_init_display_hooks(struct drm_i915_private *dev_priv)
                dev_priv->display.commit_modeset_enables = skl_commit_modeset_enables;
        else
                dev_priv->display.commit_modeset_enables = intel_commit_modeset_enables;
+
 }
 
 static i915_reg_t i915_vgacntrl_reg(struct drm_i915_private *dev_priv)
index 75a42e8..db74808 100644 (file)
@@ -289,6 +289,7 @@ struct drm_i915_display_funcs {
        void (*crtc_disable)(struct intel_crtc_state *old_crtc_state,
                             struct intel_atomic_state *old_state);
        void (*commit_modeset_enables)(struct intel_atomic_state *state);
+       void (*commit_modeset_disables)(struct intel_atomic_state *state);
        void (*audio_codec_enable)(struct intel_encoder *encoder,
                                   const struct intel_crtc_state *crtc_state,
                                   const struct drm_connector_state *conn_state);