OSDN Git Service

drm/i915/fbc: Extract intel_fbc_update()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 2 Jul 2021 20:45:57 +0000 (23:45 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 20 Aug 2021 13:48:51 +0000 (16:48 +0300)
Pull the fbc enable vs. disable stuff into a small helper so
we don't have to have it pollute the higher level modeset code.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210702204603.596-3-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/display/intel_display.c
drivers/gpu/drm/i915/display/intel_fbc.c
drivers/gpu/drm/i915/display/intel_fbc.h

index 2bf41e6..a7cba75 100644 (file)
@@ -10405,10 +10405,7 @@ static void intel_update_crtc(struct intel_atomic_state *state,
                        intel_encoders_update_pipe(state, crtc);
        }
 
-       if (new_crtc_state->update_pipe && !new_crtc_state->enable_fbc)
-               intel_fbc_disable(crtc);
-       else
-               intel_fbc_enable(state, crtc);
+       intel_fbc_update(state, crtc);
 
        /* Perform vblank evasion around commit operation */
        intel_pipe_update_start(new_crtc_state);
index c4552e8..49b8c06 100644 (file)
@@ -1236,8 +1236,8 @@ out:
  * intel_fbc_enable multiple times for the same pipe without an
  * intel_fbc_disable in the middle, as long as it is deactivated.
  */
-void intel_fbc_enable(struct intel_atomic_state *state,
-                     struct intel_crtc *crtc)
+static void intel_fbc_enable(struct intel_atomic_state *state,
+                            struct intel_crtc *crtc)
 {
        struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
        struct intel_plane *plane = to_intel_plane(crtc->base.primary);
@@ -1313,6 +1313,28 @@ void intel_fbc_disable(struct intel_crtc *crtc)
 }
 
 /**
+ * intel_fbc_update: enable/disable FBC on the CRTC
+ * @state: atomic state
+ * @crtc: the CRTC
+ *
+ * This function checks if the given CRTC was chosen for FBC, then enables it if
+ * possible. Notice that it doesn't activate FBC. It is valid to call
+ * intel_fbc_update multiple times for the same pipe without an
+ * intel_fbc_disable in the middle.
+ */
+void intel_fbc_update(struct intel_atomic_state *state,
+                     struct intel_crtc *crtc)
+{
+       const struct intel_crtc_state *crtc_state =
+               intel_atomic_get_new_crtc_state(state, crtc);
+
+       if (crtc_state->update_pipe && !crtc_state->enable_fbc)
+               intel_fbc_disable(crtc);
+       else
+               intel_fbc_enable(state, crtc);
+}
+
+/**
  * intel_fbc_global_disable - globally disable FBC
  * @dev_priv: i915 device instance
  *
index 6dc1ede..b97d908 100644 (file)
@@ -24,7 +24,7 @@ bool intel_fbc_pre_update(struct intel_atomic_state *state,
 void intel_fbc_post_update(struct intel_atomic_state *state,
                           struct intel_crtc *crtc);
 void intel_fbc_init(struct drm_i915_private *dev_priv);
-void intel_fbc_enable(struct intel_atomic_state *state,
+void intel_fbc_update(struct intel_atomic_state *state,
                      struct intel_crtc *crtc);
 void intel_fbc_disable(struct intel_crtc *crtc);
 void intel_fbc_global_disable(struct drm_i915_private *dev_priv);