]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Stop using drm_atomic_helper_check_planes()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 8 Jul 2019 12:53:14 +0000 (15:53 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 15 Oct 2019 13:37:32 +0000 (16:37 +0300)
We need to insert stuff between the plane and crtc .atomic_check()
drm_atomic_helper_check_planes() doesn't allow us to do that so
stop using it and hand roll the loops instead.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190708125325.16576-9-ville.syrjala@linux.intel.com
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
drivers/gpu/drm/i915/display/intel_atomic_plane.c
drivers/gpu/drm/i915/display/intel_atomic_plane.h
drivers/gpu/drm/i915/display/intel_display.c

index 98b7766eaa7af2a974840c98f10764dcdae6cfd1..a6cff5a160fb8d9c5d479988abda9feb061e7c18 100644 (file)
@@ -195,14 +195,11 @@ get_crtc_from_states(const struct intel_plane_state *old_plane_state,
        return NULL;
 }
 
-static int intel_plane_atomic_check(struct drm_plane *_plane,
-                                   struct drm_plane_state *_new_plane_state)
+int intel_plane_atomic_check(struct intel_atomic_state *state,
+                            struct intel_plane *plane)
 {
-       struct intel_plane *plane = to_intel_plane(_plane);
-       struct intel_atomic_state *state =
-               to_intel_atomic_state(_new_plane_state->state);
        struct intel_plane_state *new_plane_state =
-               to_intel_plane_state(_new_plane_state);
+               intel_atomic_get_new_plane_state(state, plane);
        const struct intel_plane_state *old_plane_state =
                intel_atomic_get_old_plane_state(state, plane);
        struct intel_crtc *crtc =
@@ -369,5 +366,4 @@ void i9xx_update_planes_on_crtc(struct intel_atomic_state *state,
 const struct drm_plane_helper_funcs intel_plane_helper_funcs = {
        .prepare_fb = intel_prepare_plane_fb,
        .cleanup_fb = intel_cleanup_plane_fb,
-       .atomic_check = intel_plane_atomic_check,
 };
index cb7ef4f9eafd475d6cd240274a3207d7c6d8b186..dc85af02e9b7e09edd384c5d23405bf8c53e4d52 100644 (file)
@@ -41,6 +41,8 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
                                        struct intel_crtc_state *crtc_state,
                                        const struct intel_plane_state *old_plane_state,
                                        struct intel_plane_state *intel_state);
+int intel_plane_atomic_check(struct intel_atomic_state *state,
+                            struct intel_plane *plane);
 int intel_plane_atomic_calc_changes(const struct intel_crtc_state *old_crtc_state,
                                    struct intel_crtc_state *crtc_state,
                                    const struct intel_plane_state *old_plane_state,
index 5d77f5bae0d962f5a2cf5618edc9f4101cfd8171..00bee5abf87ad97148b333d20412e59ec2b2087e 100644 (file)
@@ -11783,15 +11783,14 @@ static bool c8_planes_changed(const struct intel_crtc_state *new_crtc_state)
        return !old_crtc_state->c8_planes != !new_crtc_state->c8_planes;
 }
 
-static int intel_crtc_atomic_check(struct drm_crtc *_crtc,
-                                  struct drm_crtc_state *_crtc_state)
+static int intel_crtc_atomic_check(struct intel_atomic_state *state,
+                                  struct intel_crtc *crtc)
 {
-       struct intel_crtc *crtc = to_intel_crtc(_crtc);
        struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
        struct intel_crtc_state *crtc_state =
-               to_intel_crtc_state(_crtc_state);
-       int ret;
+               intel_atomic_get_new_crtc_state(state, crtc);
        bool mode_changed = needs_modeset(crtc_state);
+       int ret;
 
        if (INTEL_GEN(dev_priv) < 5 && !IS_G4X(dev_priv) &&
            mode_changed && !crtc_state->base.active)
@@ -11863,10 +11862,6 @@ static int intel_crtc_atomic_check(struct drm_crtc *_crtc,
        return ret;
 }
 
-static const struct drm_crtc_helper_funcs intel_helper_funcs = {
-       .atomic_check = intel_crtc_atomic_check,
-};
-
 static void intel_modeset_update_connector_atomic_state(struct drm_device *dev)
 {
        struct intel_connector *connector;
@@ -13541,6 +13536,42 @@ static void intel_crtc_check_fastset(const struct intel_crtc_state *old_crtc_sta
        new_crtc_state->has_drrs = old_crtc_state->has_drrs;
 }
 
+static int intel_atomic_check_planes(struct intel_atomic_state *state)
+{
+       struct intel_plane_state *plane_state;
+       struct intel_plane *plane;
+       int i, ret;
+
+       for_each_new_intel_plane_in_state(state, plane, plane_state, i) {
+               ret = intel_plane_atomic_check(state, plane);
+               if (ret) {
+                       DRM_DEBUG_ATOMIC("[PLANE:%d:%s] atomic driver check failed\n",
+                                        plane->base.base.id, plane->base.name);
+                       return ret;
+               }
+       }
+
+       return 0;
+}
+
+static int intel_atomic_check_crtcs(struct intel_atomic_state *state)
+{
+       struct intel_crtc_state *crtc_state;
+       struct intel_crtc *crtc;
+       int i;
+
+       for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) {
+               int ret = intel_crtc_atomic_check(state, crtc);
+               if (ret) {
+                       DRM_DEBUG_ATOMIC("[CRTC:%d:%s] atomic driver check failed\n",
+                                        crtc->base.base.id, crtc->base.name);
+                       return ret;
+               }
+       }
+
+       return 0;
+}
+
 /**
  * intel_atomic_check - validate state object
  * @dev: drm device
@@ -13604,7 +13635,11 @@ static int intel_atomic_check(struct drm_device *dev,
        if (ret)
                goto fail;
 
-       ret = drm_atomic_helper_check_planes(dev, &state->base);
+       ret = intel_atomic_check_planes(state);
+       if (ret)
+               goto fail;
+
+       ret = intel_atomic_check_crtcs(state);
        if (ret)
                goto fail;
 
@@ -15175,8 +15210,6 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
                dev_priv->plane_to_crtc_mapping[i9xx_plane] = intel_crtc;
        }
 
-       drm_crtc_helper_add(&intel_crtc->base, &intel_helper_funcs);
-
        intel_color_init(intel_crtc);
 
        WARN_ON(drm_crtc_index(&intel_crtc->base) != intel_crtc->pipe);