drm/i915: Switch intel_crtc_disable_noatomic() to intel_ types
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 5 Nov 2019 17:14:47 +0000 (19:14 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 2 Dec 2019 16:38:40 +0000 (18:38 +0200)
It's hard to see what is going on when the function mixes drm_
and intel_ types. Switch to intel_ types.

v2: Deal with another use of 'intel_crtc' being introduced

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191105171447.22111-2-ville.syrjala@linux.intel.com
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
drivers/gpu/drm/i915/display/intel_display.c

index 7ba12d603f59d8d764f39536a0d536771b03377c..5adc48aacbda1bb6ddf5b3739a65b0fad0787314 100644 (file)
@@ -7203,84 +7203,84 @@ static void i9xx_crtc_disable(struct intel_atomic_state *state,
                i830_enable_pipe(dev_priv, pipe);
 }
 
-static void intel_crtc_disable_noatomic(struct drm_crtc *crtc,
+static void intel_crtc_disable_noatomic(struct intel_crtc *crtc,
                                        struct drm_modeset_acquire_ctx *ctx)
 {
        struct intel_encoder *encoder;
-       struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-       struct drm_i915_private *dev_priv = to_i915(crtc->dev);
+       struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
        struct intel_bw_state *bw_state =
                to_intel_bw_state(dev_priv->bw_obj.state);
        struct intel_crtc_state *crtc_state =
-               to_intel_crtc_state(crtc->state);
+               to_intel_crtc_state(crtc->base.state);
        enum intel_display_power_domain domain;
        struct intel_plane *plane;
-       u64 domains;
        struct drm_atomic_state *state;
        struct intel_crtc_state *temp_crtc_state;
+       enum pipe pipe = crtc->pipe;
+       u64 domains;
        int ret;
 
-       if (!intel_crtc->active)
+       if (!crtc_state->hw.active)
                return;
 
-       for_each_intel_plane_on_crtc(&dev_priv->drm, intel_crtc, plane) {
+       for_each_intel_plane_on_crtc(&dev_priv->drm, crtc, plane) {
                const struct intel_plane_state *plane_state =
                        to_intel_plane_state(plane->base.state);
 
                if (plane_state->uapi.visible)
-                       intel_plane_disable_noatomic(intel_crtc, plane);
+                       intel_plane_disable_noatomic(crtc, plane);
        }
 
-       state = drm_atomic_state_alloc(crtc->dev);
+       state = drm_atomic_state_alloc(&dev_priv->drm);
        if (!state) {
                DRM_DEBUG_KMS("failed to disable [CRTC:%d:%s], out of memory",
-                             crtc->base.id, crtc->name);
+                             crtc->base.base.id, crtc->base.name);
                return;
        }
 
        state->acquire_ctx = ctx;
 
        /* Everything's already locked, -EDEADLK can't happen. */
-       temp_crtc_state = intel_atomic_get_crtc_state(state, intel_crtc);
-       ret = drm_atomic_add_affected_connectors(state, crtc);
+       temp_crtc_state = intel_atomic_get_crtc_state(state, crtc);
+       ret = drm_atomic_add_affected_connectors(state, &crtc->base);
 
        WARN_ON(IS_ERR(temp_crtc_state) || ret);
 
-       dev_priv->display.crtc_disable(to_intel_atomic_state(state),
-                                      intel_crtc);
+       dev_priv->display.crtc_disable(to_intel_atomic_state(state), crtc);
 
        drm_atomic_state_put(state);
 
        DRM_DEBUG_KMS("[CRTC:%d:%s] hw state adjusted, was enabled, now disabled\n",
-                     crtc->base.id, crtc->name);
-
-       WARN_ON(drm_atomic_set_mode_for_crtc(crtc->state, NULL) < 0);
-       crtc->state->active = false;
-       intel_crtc->active = false;
-       crtc->enabled = false;
-       crtc->state->connector_mask = 0;
-       crtc->state->encoder_mask = 0;
+                     crtc->base.base.id, crtc->base.name);
+
+       crtc->active = false;
+       crtc->base.enabled = false;
+
+       WARN_ON(drm_atomic_set_mode_for_crtc(&crtc_state->uapi, NULL) < 0);
+       crtc_state->uapi.active = false;
+       crtc_state->uapi.connector_mask = 0;
+       crtc_state->uapi.encoder_mask = 0;
        intel_crtc_free_hw_state(crtc_state);
        memset(&crtc_state->hw, 0, sizeof(crtc_state->hw));
 
-       for_each_encoder_on_crtc(crtc->dev, crtc, encoder)
+       for_each_encoder_on_crtc(&dev_priv->drm, &crtc->base, encoder)
                encoder->base.crtc = NULL;
 
-       intel_fbc_disable(intel_crtc);
-       intel_update_watermarks(intel_crtc);
-       intel_disable_shared_dpll(to_intel_crtc_state(crtc->state));
+       intel_fbc_disable(crtc);
+       intel_update_watermarks(crtc);
+       intel_disable_shared_dpll(crtc_state);
 
-       domains = intel_crtc->enabled_power_domains;
+       domains = crtc->enabled_power_domains;
        for_each_power_domain(domain, domains)
                intel_display_power_put_unchecked(dev_priv, domain);
-       intel_crtc->enabled_power_domains = 0;
+       crtc->enabled_power_domains = 0;
 
-       dev_priv->active_pipes &= ~BIT(intel_crtc->pipe);
-       dev_priv->min_cdclk[intel_crtc->pipe] = 0;
-       dev_priv->min_voltage_level[intel_crtc->pipe] = 0;
+       dev_priv->active_pipes &= ~BIT(pipe);
+       dev_priv->min_cdclk[pipe] = 0;
+       dev_priv->min_voltage_level[pipe] = 0;
 
-       bw_state->data_rate[intel_crtc->pipe] = 0;
-       bw_state->num_active_planes[intel_crtc->pipe] = 0;
+       bw_state->data_rate[pipe] = 0;
+       bw_state->num_active_planes[pipe] = 0;
 }
 
 /*
@@ -17319,7 +17319,7 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc,
        /* Adjust the state of the output pipe according to whether we
         * have active connectors/encoders. */
        if (crtc_state->hw.active && !intel_crtc_has_encoders(crtc))
-               intel_crtc_disable_noatomic(&crtc->base, ctx);
+               intel_crtc_disable_noatomic(crtc, ctx);
 
        if (crtc_state->hw.active || HAS_GMCH(dev_priv)) {
                /*