diff --git a/drivers/gpu/drm/i915/intel_pipe_crc.c b/drivers/gpu/drm/i915/intel_pipe_crc.c index 8fbd2bd0877f..c6e8a9cd2390 100644 --- a/drivers/gpu/drm/i915/intel_pipe_crc.c +++ b/drivers/gpu/drm/i915/intel_pipe_crc.c @@ -919,6 +919,7 @@ int intel_crtc_set_crc_source(struct drm_crtc *crtc, const char *source_name, enum intel_pipe_crc_source source; u32 val = 0; /* shut up gcc */ int ret = 0; + bool has_ips = false; if (display_crc_ctl_parse_source(source_name, &source) < 0) { DRM_DEBUG_DRIVER("unknown source %s\n", source_name); @@ -935,7 +936,17 @@ int intel_crtc_set_crc_source(struct drm_crtc *crtc, const char *source_name, if (ret != 0) goto out; - if (source) { + ret = drm_modeset_lock_interruptible(&crtc->mutex, NULL); + if (ret) + goto out; + + if (to_intel_crtc_state(crtc->state)->ips_enabled && + crtc->state->plane_mask & BIT(drm_plane_index(crtc->primary))) + has_ips = crtc->primary->state->visible; + + drm_modeset_unlock(&crtc->mutex); + + if (source && has_ips) { /* * When IPS gets enabled, the pipe CRC changes. Since IPS gets * enabled and disabled dynamically based on package C states, @@ -956,7 +967,8 @@ int intel_crtc_set_crc_source(struct drm_crtc *crtc, const char *source_name, else if (IS_HASWELL(dev_priv) && crtc->index == PIPE_A) hsw_trans_edp_pipe_A_crc_wa(dev_priv, false); - hsw_enable_ips(intel_crtc); + if (has_ips) + hsw_enable_ips(intel_crtc); } pipe_crc->skipped = 0;