drm/i915: Pass idle crtc_state to intel_dp_sink_crc
IPS can only be enabled if the primary plane is visible, so
first make sure sw state matches hw state by waiting for hw_done.
After this pass crtc_state to intel_dp_sink_crc() so that can be used,
instead of using legacy pointers.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171110113503.16253-7-maarten.lankhorst@linux.intel.com
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index ff8f508..df3852c 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2746,6 +2746,7 @@ static int i915_sink_crc(struct seq_file *m, void *data)
for_each_intel_connector_iter(connector, &conn_iter) {
struct drm_crtc *crtc;
struct drm_connector_state *state;
+ struct intel_crtc_state *crtc_state;
if (connector->base.connector_type != DRM_MODE_CONNECTOR_eDP)
continue;
@@ -2764,12 +2765,24 @@ static int i915_sink_crc(struct seq_file *m, void *data)
if (ret)
goto err;
- if (!crtc->state->active)
+ crtc_state = to_intel_crtc_state(crtc->state);
+ if (!crtc_state->base.active)
continue;
+ /*
+ * We need to wait for all crtc updates to complete, to make
+ * sure any pending modesets and plane updates are completed.
+ */
+ if (crtc_state->base.commit) {
+ ret = wait_for_completion_interruptible(&crtc_state->base.commit->hw_done);
+
+ if (ret)
+ goto err;
+ }
+
intel_dp = enc_to_intel_dp(state->best_encoder);
- ret = intel_dp_sink_crc(intel_dp, crc);
+ ret = intel_dp_sink_crc(intel_dp, crtc_state, crc);
if (ret)
goto err;