All of lore.kernel.org
 help / color / mirror / Atom feed
From: ville.syrjala@linux.intel.com
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 11/12] drm/i915: Check for invalid cloning earlier during modeset
Date: Wed,  8 Jun 2016 13:41:46 +0300	[thread overview]
Message-ID: <1465382507-23085-12-git-send-email-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <1465382507-23085-1-git-send-email-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Move the encoder cloning check to happen earlier in the modeset. The
main benefit will be that the debug output from a failed modeset will
be less confusing as output_types can not indicate an invalid
configuration during the later computation stages.

For instance, what happened to me was kms_setmode was attempting one
of its invalid cloning checks during which it asked for DP+VGA cloning
on HSW. In this case the DP .compute_config() was executed after
the FDI .compute_config() leaving the DP link clock (1.62 in this case)
in port_clock, and then later the FDI BW computation tried to use that
as the FDI link clock (which should always be 2.7). 1.62 x 2 wasn't
enough for the mode it was trying to use, and so it ended up rejecting
the modeset, not because of an invalid cloning configuration, but
because of supposedly running out of FDI bandwidth. Took me a while
to figure out what had actually happened.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 30 +++++-------------------------
 1 file changed, 5 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 3a0b590c4885..442ed6320082 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -11997,26 +11997,6 @@ static bool check_single_encoder_cloning(struct drm_atomic_state *state,
 	return true;
 }
 
-static bool check_encoder_cloning(struct drm_atomic_state *state,
-				  struct intel_crtc *crtc)
-{
-	struct intel_encoder *encoder;
-	struct drm_connector *connector;
-	struct drm_connector_state *connector_state;
-	int i;
-
-	for_each_connector_in_state(state, connector, connector_state, i) {
-		if (connector_state->crtc != &crtc->base)
-			continue;
-
-		encoder = to_intel_encoder(connector_state->best_encoder);
-		if (!check_single_encoder_cloning(state, crtc, encoder))
-			return false;
-	}
-
-	return true;
-}
-
 static int intel_crtc_atomic_check(struct drm_crtc *crtc,
 				   struct drm_crtc_state *crtc_state)
 {
@@ -12029,11 +12009,6 @@ static int intel_crtc_atomic_check(struct drm_crtc *crtc,
 	int ret;
 	bool mode_changed = needs_modeset(crtc_state);
 
-	if (mode_changed && !check_encoder_cloning(state, intel_crtc)) {
-		DRM_DEBUG_KMS("rejecting invalid cloning configuration\n");
-		return -EINVAL;
-	}
-
 	if (mode_changed && !crtc_state->active)
 		pipe_config->update_wm_post = true;
 
@@ -12472,6 +12447,11 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
 
 		encoder = to_intel_encoder(connector_state->best_encoder);
 
+		if (!check_single_encoder_cloning(state, to_intel_crtc(crtc), encoder)) {
+			DRM_DEBUG_KMS("rejecting invalid cloning configuration\n");
+			goto fail;
+		}
+
 		/*
 		 * Determine output_types before calling the .compute_config()
 		 * hooks so that the hooks can use this information safely.
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2016-06-08 10:42 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-08 10:41 [PATCH 00/12] drm/i915: Eliminate DDI encoder->type frobbery ville.syrjala
2016-06-08 10:41 ` [PATCH 01/12] drm/i915: Don't mark eDP encoders as MST capable ville.syrjala
2016-06-16 12:27   ` Sharma, Shashank
2016-06-16 20:35   ` Dave Airlie
2016-06-17 14:25     ` Ville Syrjälä
2016-06-08 10:41 ` [PATCH 02/12] drm/i915: Remove encoder type checks from MST suspend/resume ville.syrjala
2016-06-16 12:41   ` Sharma, Shashank
2016-06-16 13:40     ` Ville Syrjälä
2016-06-16 17:48       ` Sharma, Shashank
2016-06-08 10:41 ` [PATCH 03/12] drm/i915: Add output_types bitmask into the crtc state ville.syrjala
2016-06-08 13:25   ` Chris Wilson
2016-06-08 13:33     ` Ville Syrjälä
2016-06-13 14:25   ` Daniel Vetter
2016-06-13 16:24     ` Ville Syrjälä
2016-06-08 10:41 ` [PATCH 04/12] drm/i915: Unify intel_pipe_has_type() and intel_pipe_will_have_type() ville.syrjala
2016-06-08 10:41 ` [PATCH 05/12] drm/i915: Replace manual lvds and sdvo/hdmi counting with intel_crtc_has_type() ville.syrjala
2016-06-08 10:41 ` [PATCH 06/12] drm/i915: Kill has_dp_encoder from pipe_config ville.syrjala
2016-06-08 10:41 ` [PATCH 07/12] drm/i915: Replace some open coded intel_crtc_has_dp_encoder()s ville.syrjala
2016-06-08 10:41 ` [PATCH 08/12] drm/i915: s/INTEL_OUTPUT_DISPLAYPORT/INTEL_OUTPUT_DP/ ville.syrjala
2016-06-08 13:05   ` Kahola, Mika
2016-06-08 10:41 ` [PATCH 09/12] drm/i915: Kill has_dsi_encoder ville.syrjala
2016-06-08 10:41 ` [PATCH 10/12] drm/i915: Simplify hdmi_12bpc_possible() ville.syrjala
2016-06-08 10:41 ` ville.syrjala [this message]
2016-06-08 13:15   ` [PATCH 11/12] drm/i915: Check for invalid cloning earlier during modeset Chris Wilson
2016-06-08 13:27     ` Ville Syrjälä
2016-06-20 13:54       ` Maarten Lankhorst
2016-06-08 10:41 ` [PATCH 12/12] drm/i915: Stop frobbing with DDI encoder->type ville.syrjala
2016-06-08 11:13 ` ✓ Ro.CI.BAT: success for drm/i915: Eliminate DDI encoder->type frobbery Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1465382507-23085-12-git-send-email-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.