diff options
author | Egbert Eich <eich@suse.de> | 2014-04-25 04:56:22 -0400 |
---|---|---|
committer | Jani Nikula <jani.nikula@intel.com> | 2014-04-25 09:07:11 -0400 |
commit | 7f1950fbb989e8fc5463b307e062b4529d51c862 (patch) | |
tree | a6ffd5bd6767bfef8897cdbc4d2a1ca706317c99 | |
parent | 78f2975eec9faff353a6194e854d3d39907bab68 (diff) |
drm/i915: Break encoder->crtc link separately in intel_sanitize_crtc()
Depending on the SDVO output_flags SDVO may have multiple connectors
linking to the same encoder (in intel_connector->encoder->base).
Only one of those connectors should be active (ie link to the encoder
thru drm_connector->encoder).
If intel_connector_break_all_links() is called from intel_sanitize_crtc()
we may break the crtc connection of an encoder thru an inactive connector
in which case intel_connector_break_all_links() will not be called again
for the active connector if this happens to come later in the list due to:
if (connector->encoder->base.crtc != &crtc->base)
continue;
in intel_sanitize_crtc().
This will however leave the drm_connector->encoder linkage for this
active connector in place. Subsequently this will cause multiple
warnings in intel_connector_check_state() to trigger and the driver
will eventually die in drm_encoder_crtc_ok() (because of crtc == NULL).
To avoid this remove intel_connector_break_all_links() and move its
code to its two calling functions: intel_sanitize_crtc() and
intel_sanitize_encoder().
This allows to implement the link breaking more flexibly matching
the surrounding code: ie. in intel_sanitize_crtc() we can break the
crtc link separatly after the links to the encoders have been
broken which avoids above problem.
This regression has been introduced in:
commit 24929352481f085c5f85d4d4cbc919ddf106d381
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Mon Jul 2 20:28:59 2012 +0200
drm/i915: read out the modeset hw state at load and resume time
so goes back to the very beginning of the modeset rework.
v2: This patch takes care of the concernes voiced by Chris Wilson
and Daniel Vetter that only breaking links if the drm_connector
is linked to an encoder may miss some links.
v3: move all encoder handling to encoder loop as suggested by
Daniel Vetter.
Signed-off-by: Egbert Eich <eich@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: stable@vger.kernel.org
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 69bcc42a0e44..48aa516a1ac0 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -11395,15 +11395,6 @@ void intel_modeset_init(struct drm_device *dev) | |||
11395 | } | 11395 | } |
11396 | } | 11396 | } |
11397 | 11397 | ||
11398 | static void | ||
11399 | intel_connector_break_all_links(struct intel_connector *connector) | ||
11400 | { | ||
11401 | connector->base.dpms = DRM_MODE_DPMS_OFF; | ||
11402 | connector->base.encoder = NULL; | ||
11403 | connector->encoder->connectors_active = false; | ||
11404 | connector->encoder->base.crtc = NULL; | ||
11405 | } | ||
11406 | |||
11407 | static void intel_enable_pipe_a(struct drm_device *dev) | 11398 | static void intel_enable_pipe_a(struct drm_device *dev) |
11408 | { | 11399 | { |
11409 | struct intel_connector *connector; | 11400 | struct intel_connector *connector; |
@@ -11485,8 +11476,17 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc) | |||
11485 | if (connector->encoder->base.crtc != &crtc->base) | 11476 | if (connector->encoder->base.crtc != &crtc->base) |
11486 | continue; | 11477 | continue; |
11487 | 11478 | ||
11488 | intel_connector_break_all_links(connector); | 11479 | connector->base.dpms = DRM_MODE_DPMS_OFF; |
11480 | connector->base.encoder = NULL; | ||
11489 | } | 11481 | } |
11482 | /* multiple connectors may have the same encoder: | ||
11483 | * handle them and break crtc link separately */ | ||
11484 | list_for_each_entry(connector, &dev->mode_config.connector_list, | ||
11485 | base.head) | ||
11486 | if (connector->encoder->base.crtc == &crtc->base) { | ||
11487 | connector->encoder->base.crtc = NULL; | ||
11488 | connector->encoder->connectors_active = false; | ||
11489 | } | ||
11490 | 11490 | ||
11491 | WARN_ON(crtc->active); | 11491 | WARN_ON(crtc->active); |
11492 | crtc->base.enabled = false; | 11492 | crtc->base.enabled = false; |
@@ -11568,6 +11568,8 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder) | |||
11568 | drm_get_encoder_name(&encoder->base)); | 11568 | drm_get_encoder_name(&encoder->base)); |
11569 | encoder->disable(encoder); | 11569 | encoder->disable(encoder); |
11570 | } | 11570 | } |
11571 | encoder->base.crtc = NULL; | ||
11572 | encoder->connectors_active = false; | ||
11571 | 11573 | ||
11572 | /* Inconsistent output/port/pipe state happens presumably due to | 11574 | /* Inconsistent output/port/pipe state happens presumably due to |
11573 | * a bug in one of the get_hw_state functions. Or someplace else | 11575 | * a bug in one of the get_hw_state functions. Or someplace else |
@@ -11578,8 +11580,8 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder) | |||
11578 | base.head) { | 11580 | base.head) { |
11579 | if (connector->encoder != encoder) | 11581 | if (connector->encoder != encoder) |
11580 | continue; | 11582 | continue; |
11581 | 11583 | connector->base.dpms = DRM_MODE_DPMS_OFF; | |
11582 | intel_connector_break_all_links(connector); | 11584 | connector->base.encoder = NULL; |
11583 | } | 11585 | } |
11584 | } | 11586 | } |
11585 | /* Enabled encoders without active connectors will be fixed in | 11587 | /* Enabled encoders without active connectors will be fixed in |