drm/i915: Remove crtc->config dereferences in intel_modeset_setup_hw_state
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Thu, 11 Oct 2018 10:04:54 +0000 (12:04 +0200)
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Tue, 16 Oct 2018 13:49:30 +0000 (15:49 +0200)
The CRTC is idle at this point, so we can dereference crtc->state safely.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
[mlankhorst: Keep dev_priv->drm in for_each_intel_crtc (Ville)]
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181011100457.8776-8-maarten.lankhorst@linux.intel.com
drivers/gpu/drm/i915/intel_display.c

index 6ea31ed81789c616179c328dd482512b83071120..f93e17a237edab94939aa7cc3644ed40b431546e 100644 (file)
@@ -15739,6 +15739,7 @@ intel_modeset_setup_hw_state(struct drm_device *dev,
 {
        struct drm_i915_private *dev_priv = to_i915(dev);
        struct intel_crtc *crtc;
+       struct intel_crtc_state *crtc_state;
        struct intel_encoder *encoder;
        int i;
 
@@ -15757,7 +15758,7 @@ intel_modeset_setup_hw_state(struct drm_device *dev,
        for_each_intel_crtc(&dev_priv->drm, crtc) {
                drm_crtc_vblank_reset(&crtc->base);
 
-               if (crtc->active)
+               if (crtc->base.state->active)
                        drm_crtc_vblank_on(&crtc->base);
        }
 
@@ -15767,8 +15768,9 @@ intel_modeset_setup_hw_state(struct drm_device *dev,
                intel_sanitize_encoder(encoder);
 
        for_each_intel_crtc(&dev_priv->drm, crtc) {
+               crtc_state = to_intel_crtc_state(crtc->base.state);
                intel_sanitize_crtc(crtc, ctx);
-               intel_dump_pipe_config(crtc, crtc->config,
+               intel_dump_pipe_config(crtc, crtc_state,
                                       "[setup_hw_state]");
        }
 
@@ -15802,7 +15804,8 @@ intel_modeset_setup_hw_state(struct drm_device *dev,
        for_each_intel_crtc(dev, crtc) {
                u64 put_domains;
 
-               put_domains = modeset_get_crtc_power_domains(&crtc->base, crtc->config);
+               crtc_state = to_intel_crtc_state(crtc->base.state);
+               put_domains = modeset_get_crtc_power_domains(&crtc->base, crtc_state);
                if (WARN_ON(put_domains))
                        modeset_put_power_domains(dev_priv, put_domains);
        }