Commit 749d98b8 authored by Maarten Lankhorst's avatar Maarten Lankhorst

drm/i915: Fix hw state verifier access to crtc->state.

We shouldn't inspect crtc->state, instead grab the crtc state.
At this point the hw state verifier should be able to run even if
crtc->state has been updated (which cannot currently happen).
Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170511082844.13965-1-maarten.lankhorst@linux.intel.comReviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent a8b9370f
...@@ -5935,9 +5935,10 @@ void intel_encoder_destroy(struct drm_encoder *encoder) ...@@ -5935,9 +5935,10 @@ void intel_encoder_destroy(struct drm_encoder *encoder)
/* Cross check the actual hw state with our own modeset state tracking (and it's /* Cross check the actual hw state with our own modeset state tracking (and it's
* internal consistency). */ * internal consistency). */
static void intel_connector_verify_state(struct intel_connector *connector) static void intel_connector_verify_state(struct drm_crtc_state *crtc_state,
struct drm_connector_state *conn_state)
{ {
struct drm_crtc *crtc = connector->base.state->crtc; struct intel_connector *connector = to_intel_connector(conn_state->connector);
DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
connector->base.base.id, connector->base.base.id,
...@@ -5945,15 +5946,14 @@ static void intel_connector_verify_state(struct intel_connector *connector) ...@@ -5945,15 +5946,14 @@ static void intel_connector_verify_state(struct intel_connector *connector)
if (connector->get_hw_state(connector)) { if (connector->get_hw_state(connector)) {
struct intel_encoder *encoder = connector->encoder; struct intel_encoder *encoder = connector->encoder;
struct drm_connector_state *conn_state = connector->base.state;
I915_STATE_WARN(!crtc, I915_STATE_WARN(!crtc_state,
"connector enabled without attached crtc\n"); "connector enabled without attached crtc\n");
if (!crtc) if (!crtc_state)
return; return;
I915_STATE_WARN(!crtc->state->active, I915_STATE_WARN(!crtc_state->active,
"connector is active, but attached crtc isn't\n"); "connector is active, but attached crtc isn't\n");
if (!encoder || encoder->type == INTEL_OUTPUT_DP_MST) if (!encoder || encoder->type == INTEL_OUTPUT_DP_MST)
...@@ -5965,9 +5965,9 @@ static void intel_connector_verify_state(struct intel_connector *connector) ...@@ -5965,9 +5965,9 @@ static void intel_connector_verify_state(struct intel_connector *connector)
I915_STATE_WARN(conn_state->crtc != encoder->base.crtc, I915_STATE_WARN(conn_state->crtc != encoder->base.crtc,
"attached encoder crtc differs from connector crtc\n"); "attached encoder crtc differs from connector crtc\n");
} else { } else {
I915_STATE_WARN(crtc && crtc->state->active, I915_STATE_WARN(crtc_state && crtc_state->active,
"attached crtc is active, but connector isn't\n"); "attached crtc is active, but connector isn't\n");
I915_STATE_WARN(!crtc && connector->base.state->best_encoder, I915_STATE_WARN(!crtc_state && conn_state->best_encoder,
"best encoder set without crtc!\n"); "best encoder set without crtc!\n");
} }
} }
...@@ -12122,11 +12122,15 @@ verify_connector_state(struct drm_device *dev, ...@@ -12122,11 +12122,15 @@ verify_connector_state(struct drm_device *dev,
for_each_new_connector_in_state(state, connector, new_conn_state, i) { for_each_new_connector_in_state(state, connector, new_conn_state, i) {
struct drm_encoder *encoder = connector->encoder; struct drm_encoder *encoder = connector->encoder;
struct drm_crtc_state *crtc_state = NULL;
if (new_conn_state->crtc != crtc) if (new_conn_state->crtc != crtc)
continue; continue;
intel_connector_verify_state(to_intel_connector(connector)); if (crtc)
crtc_state = drm_atomic_get_new_crtc_state(state, new_conn_state->crtc);
intel_connector_verify_state(crtc_state, new_conn_state);
I915_STATE_WARN(new_conn_state->best_encoder != encoder, I915_STATE_WARN(new_conn_state->best_encoder != encoder,
"connector's atomic encoder doesn't match legacy encoder\n"); "connector's atomic encoder doesn't match legacy encoder\n");
...@@ -12244,7 +12248,7 @@ verify_crtc_state(struct drm_crtc *crtc, ...@@ -12244,7 +12248,7 @@ verify_crtc_state(struct drm_crtc *crtc,
intel_pipe_config_sanity_check(dev_priv, pipe_config); intel_pipe_config_sanity_check(dev_priv, pipe_config);
sw_config = to_intel_crtc_state(crtc->state); sw_config = to_intel_crtc_state(new_crtc_state);
if (!intel_pipe_config_compare(dev_priv, sw_config, if (!intel_pipe_config_compare(dev_priv, sw_config,
pipe_config, false)) { pipe_config, false)) {
I915_STATE_WARN(1, "pipe state doesn't match!\n"); I915_STATE_WARN(1, "pipe state doesn't match!\n");
......
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