drm/i915: Switch fbc over to for_each_new_intel_plane_in_state()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 17 Nov 2017 19:19:14 +0000 (21:19 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 21 Nov 2017 17:50:43 +0000 (19:50 +0200)
Stop using the old for_each_intel_plane_in_state() type iteration
macro and replace it with for_each_new_intel_plane_in_state().
And similarly replace drm_atomic_get_existing_crtc_state() with
intel_atomic_get_new_crtc_state(). Switch over to intel_ types
as well to make the code less cluttered.

v2: s/plane/i9xx_plane/ etc. (James)

Cc: James Ausmus <james.ausmus@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171117191917.11506-8-ville.syrjala@linux.intel.com
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_fbc.c

index a1268d706c5e13251065cbc92809e37298b54f3d..9a890f6ad2df5ae0a2c0c211a19ef605e8a14776 100644 (file)
@@ -560,13 +560,13 @@ struct i915_hotplug {
        for_each_power_well_rev(__dev_priv, __power_well)                       \
                for_each_if ((__power_well)->domains & (__domain_mask))
 
-#define for_each_intel_plane_in_state(__state, plane, plane_state, __i) \
+#define for_each_new_intel_plane_in_state(__state, plane, new_plane_state, __i) \
        for ((__i) = 0; \
             (__i) < (__state)->base.dev->mode_config.num_total_plane && \
                     ((plane) = to_intel_plane((__state)->base.planes[__i].ptr), \
-                     (plane_state) = to_intel_plane_state((__state)->base.planes[__i].state), 1); \
+                     (new_plane_state) = to_intel_plane_state((__state)->base.planes[__i].new_state), 1); \
             (__i)++) \
-               for_each_if (plane_state)
+               for_each_if (plane)
 
 #define for_each_new_intel_crtc_in_state(__state, crtc, new_crtc_state, __i) \
        for ((__i) = 0; \
@@ -576,7 +576,6 @@ struct i915_hotplug {
             (__i)++) \
                for_each_if (crtc)
 
-
 #define for_each_oldnew_intel_plane_in_state(__state, plane, old_plane_state, new_plane_state, __i) \
        for ((__i) = 0; \
             (__i) < (__state)->base.dev->mode_config.num_total_plane && \
index c1d7547c145774fcfe33807e36847836004d3efe..b1ead3f95cde687fabd4af9136bf56373085d528 100644 (file)
@@ -12080,7 +12080,7 @@ static int intel_atomic_check(struct drm_device *dev,
        if (ret)
                return ret;
 
-       intel_fbc_choose_crtc(dev_priv, state);
+       intel_fbc_choose_crtc(dev_priv, intel_state);
        return calc_watermark_data(state);
 }
 
index d1fe7be94b62fc1e7b304452a61527f4286a72e5..3ebe626661083367717a0bbd63d2dd850bc7fdf0 100644 (file)
@@ -1652,7 +1652,7 @@ static inline void intel_fbdev_restore_mode(struct drm_device *dev)
 
 /* intel_fbc.c */
 void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
-                          struct drm_atomic_state *state);
+                          struct intel_atomic_state *state);
 bool intel_fbc_is_active(struct drm_i915_private *dev_priv);
 void intel_fbc_pre_update(struct intel_crtc *crtc,
                          struct intel_crtc_state *crtc_state,
index 3133131306a9c5ae569fbd0a24caa8c603c4ddc9..474234322b8bb643c03a7fe404a9e6143e7d7b01 100644 (file)
@@ -1054,11 +1054,11 @@ out:
  * enable FBC for the chosen CRTC. If it does, it will set dev_priv->fbc.crtc.
  */
 void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
-                          struct drm_atomic_state *state)
+                          struct intel_atomic_state *state)
 {
        struct intel_fbc *fbc = &dev_priv->fbc;
-       struct drm_plane *plane;
-       struct drm_plane_state *plane_state;
+       struct intel_plane *plane;
+       struct intel_plane_state *plane_state;
        bool crtc_chosen = false;
        int i;
 
@@ -1066,7 +1066,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
 
        /* Does this atomic commit involve the CRTC currently tied to FBC? */
        if (fbc->crtc &&
-           !drm_atomic_get_existing_crtc_state(state, &fbc->crtc->base))
+           !intel_atomic_get_new_crtc_state(state, fbc->crtc))
                goto out;
 
        if (!intel_fbc_can_enable(dev_priv))
@@ -1076,13 +1076,11 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
         * plane. We could go for fancier schemes such as checking the plane
         * size, but this would just affect the few platforms that don't tie FBC
         * to pipe or plane A. */
-       for_each_new_plane_in_state(state, plane, plane_state, i) {
-               struct intel_plane_state *intel_plane_state =
-                       to_intel_plane_state(plane_state);
-               struct intel_crtc_state *intel_crtc_state;
-               struct intel_crtc *crtc = to_intel_crtc(plane_state->crtc);
+       for_each_new_intel_plane_in_state(state, plane, plane_state, i) {
+               struct intel_crtc_state *crtc_state;
+               struct intel_crtc *crtc = to_intel_crtc(plane_state->base.crtc);
 
-               if (!intel_plane_state->base.visible)
+               if (!plane_state->base.visible)
                        continue;
 
                if (fbc_on_pipe_a_only(dev_priv) && crtc->pipe != PIPE_A)
@@ -1091,10 +1089,9 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
                if (fbc_on_plane_a_only(dev_priv) && crtc->i9xx_plane != PLANE_A)
                        continue;
 
-               intel_crtc_state = to_intel_crtc_state(
-                       drm_atomic_get_existing_crtc_state(state, &crtc->base));
+               crtc_state = intel_atomic_get_new_crtc_state(state, crtc);
 
-               intel_crtc_state->enable_fbc = true;
+               crtc_state->enable_fbc = true;
                crtc_chosen = true;
                break;
        }