Commit 9d3f8d2f authored by Chris Wilson's avatar Chris Wilson

drm/i915: Be defensive and don't assume PSR has any commit to sync against

If the previous modeset commit has completed and is no longer part of
the crtc state, skip waiting for it.

Ville pointed out that, in fact, the commit is never removed after a
modeset so the only way we could see a NULL here should be if there was
never a commit attached. Nevertheless, we have the evidence it can be
NULL and it has been defended against elsewhere, for example commit
93313538 ("drm/i915: Pass idle crtc_state to intel_dp_sink_crc").

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107792
Fixes: c44301fc ("drm/i915: Allow control of PSR at runtime through debugfs, v6")
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180904162902.2578-1-chris@chris-wilson.co.uk
parent a167b1e1
...@@ -834,6 +834,7 @@ int intel_psr_set_debugfs_mode(struct drm_i915_private *dev_priv, ...@@ -834,6 +834,7 @@ int intel_psr_set_debugfs_mode(struct drm_i915_private *dev_priv,
struct drm_device *dev = &dev_priv->drm; struct drm_device *dev = &dev_priv->drm;
struct drm_connector_state *conn_state; struct drm_connector_state *conn_state;
struct intel_crtc_state *crtc_state = NULL; struct intel_crtc_state *crtc_state = NULL;
struct drm_crtc_commit *commit;
struct drm_crtc *crtc; struct drm_crtc *crtc;
struct intel_dp *dp; struct intel_dp *dp;
int ret; int ret;
...@@ -860,12 +861,15 @@ int intel_psr_set_debugfs_mode(struct drm_i915_private *dev_priv, ...@@ -860,12 +861,15 @@ int intel_psr_set_debugfs_mode(struct drm_i915_private *dev_priv,
return ret; return ret;
crtc_state = to_intel_crtc_state(crtc->state); crtc_state = to_intel_crtc_state(crtc->state);
ret = wait_for_completion_interruptible(&crtc_state->base.commit->hw_done); commit = crtc_state->base.commit;
} else } else {
ret = wait_for_completion_interruptible(&conn_state->commit->hw_done); commit = conn_state->commit;
}
if (ret) if (commit) {
return ret; ret = wait_for_completion_interruptible(&commit->hw_done);
if (ret)
return ret;
}
ret = mutex_lock_interruptible(&dev_priv->psr.lock); ret = mutex_lock_interruptible(&dev_priv->psr.lock);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment