All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/i915: Pass down rc in intel_encoder->compute_config()
@ 2019-01-15 20:08 ` Lyude Paul
  0 siblings, 0 replies; 12+ messages in thread
From: Lyude Paul @ 2019-01-15 20:08 UTC (permalink / raw)
  To: intel-gfx
  Cc: Ville Syrjälä,
	Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, David Airlie,
	Daniel Vetter, dri-devel, linux-kernel

Something that I completely missed when implementing the new MST VCPI
atomic helpers is that with those helpers, there's technically a chance
of us having to grab additional modeset locks in ->compute_config() and
furthermore, that means we have the potential to hit a normal modeset
deadlock. However, because ->compute_config() only returns a bool this
means we can't return -EDEADLK when we need to drop locks and try again
which means we end up just failing the atomic check permanently. Whoops.

So, fix this by modifying ->compute_config() to pass down an actual
error code instead of a bool so that the atomic check can be restarted
on modeset deadlocks.

Thanks to Ville Syrjälä for pointing this out!

Changes since v1:
* Add some newlines
* Return only -EINVAL from hsw_crt_compute_config()
* Propogate return code from intel_dp_compute_dsc_params()
* Change all of the intel_dp_compute_link_config*() variants
* Don't miss if (hdmi_port_clock_valid()) branch in
  intel_hdmi_compute_config()

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Fixes: eceae1472467 ("drm/dp_mst: Start tracking per-port VCPI allocations")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109320
---
 drivers/gpu/drm/i915/icl_dsi.c       |  8 ++--
 drivers/gpu/drm/i915/intel_crt.c     | 35 +++++++-------
 drivers/gpu/drm/i915/intel_ddi.c     |  6 +--
 drivers/gpu/drm/i915/intel_display.c | 11 +++--
 drivers/gpu/drm/i915/intel_dp.c      | 71 +++++++++++++++-------------
 drivers/gpu/drm/i915/intel_dp_mst.c  | 12 ++---
 drivers/gpu/drm/i915/intel_drv.h     | 18 +++----
 drivers/gpu/drm/i915/intel_dvo.c     | 11 +++--
 drivers/gpu/drm/i915/intel_hdmi.c    | 14 +++---
 drivers/gpu/drm/i915/intel_lvds.c    | 12 ++---
 drivers/gpu/drm/i915/intel_sdvo.c    | 14 +++---
 drivers/gpu/drm/i915/intel_tv.c      |  8 ++--
 drivers/gpu/drm/i915/vlv_dsi.c       | 14 +++---
 13 files changed, 122 insertions(+), 112 deletions(-)

diff --git a/drivers/gpu/drm/i915/icl_dsi.c b/drivers/gpu/drm/i915/icl_dsi.c
index f3a5f03646ce..355b48d1c937 100644
--- a/drivers/gpu/drm/i915/icl_dsi.c
+++ b/drivers/gpu/drm/i915/icl_dsi.c
@@ -1188,9 +1188,9 @@ static void gen11_dsi_get_config(struct intel_encoder *encoder,
 	pipe_config->output_types |= BIT(INTEL_OUTPUT_DSI);
 }
 
-static bool gen11_dsi_compute_config(struct intel_encoder *encoder,
-				     struct intel_crtc_state *pipe_config,
-				     struct drm_connector_state *conn_state)
+static int gen11_dsi_compute_config(struct intel_encoder *encoder,
+				    struct intel_crtc_state *pipe_config,
+				    struct drm_connector_state *conn_state)
 {
 	struct intel_dsi *intel_dsi = container_of(encoder, struct intel_dsi,
 						   base);
@@ -1215,7 +1215,7 @@ static bool gen11_dsi_compute_config(struct intel_encoder *encoder,
 	pipe_config->clock_set = true;
 	pipe_config->port_clock = intel_dsi_bitrate(intel_dsi) / 5;
 
-	return true;
+	return 0;
 }
 
 static u64 gen11_dsi_get_power_domains(struct intel_encoder *encoder,
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 33bd2addcbdd..081c333f30d2 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -345,51 +345,52 @@ intel_crt_mode_valid(struct drm_connector *connector,
 	return MODE_OK;
 }
 
-static bool intel_crt_compute_config(struct intel_encoder *encoder,
-				     struct intel_crtc_state *pipe_config,
-				     struct drm_connector_state *conn_state)
+static int intel_crt_compute_config(struct intel_encoder *encoder,
+				    struct intel_crtc_state *pipe_config,
+				    struct drm_connector_state *conn_state)
 {
 	struct drm_display_mode *adjusted_mode =
 		&pipe_config->base.adjusted_mode;
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return false;
+		return -EINVAL;
 
 	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
-	return true;
+
+	return 0;
 }
 
-static bool pch_crt_compute_config(struct intel_encoder *encoder,
-				   struct intel_crtc_state *pipe_config,
-				   struct drm_connector_state *conn_state)
+static int pch_crt_compute_config(struct intel_encoder *encoder,
+				  struct intel_crtc_state *pipe_config,
+				  struct drm_connector_state *conn_state)
 {
 	struct drm_display_mode *adjusted_mode =
 		&pipe_config->base.adjusted_mode;
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return false;
+		return -EINVAL;
 
 	pipe_config->has_pch_encoder = true;
 	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
 
-	return true;
+	return 0;
 }
 
-static bool hsw_crt_compute_config(struct intel_encoder *encoder,
-				   struct intel_crtc_state *pipe_config,
-				   struct drm_connector_state *conn_state)
+static int hsw_crt_compute_config(struct intel_encoder *encoder,
+				  struct intel_crtc_state *pipe_config,
+				  struct drm_connector_state *conn_state)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	struct drm_display_mode *adjusted_mode =
 		&pipe_config->base.adjusted_mode;
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return false;
+		return -EINVAL;
 
 	/* HSW/BDW FDI limited to 4k */
 	if (adjusted_mode->crtc_hdisplay > 4096 ||
 	    adjusted_mode->crtc_hblank_start > 4096)
-		return false;
+		return -EINVAL;
 
 	pipe_config->has_pch_encoder = true;
 	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
@@ -398,7 +399,7 @@ static bool hsw_crt_compute_config(struct intel_encoder *encoder,
 	if (HAS_PCH_LPT(dev_priv)) {
 		if (pipe_config->bw_constrained && pipe_config->pipe_bpp < 24) {
 			DRM_DEBUG_KMS("LPT only supports 24bpp\n");
-			return false;
+			return -EINVAL;
 		}
 
 		pipe_config->pipe_bpp = 24;
@@ -407,7 +408,7 @@ static bool hsw_crt_compute_config(struct intel_encoder *encoder,
 	/* FDI must always be 2.7 GHz */
 	pipe_config->port_clock = 135000 * 2;
 
-	return true;
+	return 0;
 }
 
 static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector)
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 7f3cd055de50..ce44744a5f9d 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -3837,9 +3837,9 @@ intel_ddi_compute_output_type(struct intel_encoder *encoder,
 	}
 }
 
-static bool intel_ddi_compute_config(struct intel_encoder *encoder,
-				     struct intel_crtc_state *pipe_config,
-				     struct drm_connector_state *conn_state)
+static int intel_ddi_compute_config(struct intel_encoder *encoder,
+				    struct intel_crtc_state *pipe_config,
+				    struct drm_connector_state *conn_state)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	enum port port = encoder->port;
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 0a5ba45f5eb0..af164d712e9e 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -11553,10 +11553,13 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
 			continue;
 
 		encoder = to_intel_encoder(connector_state->best_encoder);
-
-		if (!(encoder->compute_config(encoder, pipe_config, connector_state))) {
-			DRM_DEBUG_KMS("Encoder config failure\n");
-			return -EINVAL;
+		ret = encoder->compute_config(encoder, pipe_config,
+					      connector_state);
+		if (ret < 0) {
+			if (ret != -EDEADLK)
+				DRM_DEBUG_KMS("Encoder config failure: %d\n",
+					      ret);
+			return ret;
 		}
 	}
 
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 0a3ac98a779e..df4292bb1a4f 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1819,7 +1819,7 @@ intel_dp_adjust_compliance_config(struct intel_dp *intel_dp,
 }
 
 /* Optimize link config in order: max bpp, min clock, min lanes */
-static bool
+static int
 intel_dp_compute_link_config_wide(struct intel_dp *intel_dp,
 				  struct intel_crtc_state *pipe_config,
 				  const struct link_config_limits *limits)
@@ -1845,17 +1845,17 @@ intel_dp_compute_link_config_wide(struct intel_dp *intel_dp,
 					pipe_config->pipe_bpp = bpp;
 					pipe_config->port_clock = link_clock;
 
-					return true;
+					return 0;
 				}
 			}
 		}
 	}
 
-	return false;
+	return -EINVAL;
 }
 
 /* Optimize link config in order: max bpp, min lanes, min clock */
-static bool
+static int
 intel_dp_compute_link_config_fast(struct intel_dp *intel_dp,
 				  struct intel_crtc_state *pipe_config,
 				  const struct link_config_limits *limits)
@@ -1881,13 +1881,13 @@ intel_dp_compute_link_config_fast(struct intel_dp *intel_dp,
 					pipe_config->pipe_bpp = bpp;
 					pipe_config->port_clock = link_clock;
 
-					return true;
+					return 0;
 				}
 			}
 		}
 	}
 
-	return false;
+	return -EINVAL;
 }
 
 static int intel_dp_dsc_compute_bpp(struct intel_dp *intel_dp, u8 dsc_max_bpc)
@@ -1905,19 +1905,20 @@ static int intel_dp_dsc_compute_bpp(struct intel_dp *intel_dp, u8 dsc_max_bpc)
 	return 0;
 }
 
-static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
-					struct intel_crtc_state *pipe_config,
-					struct drm_connector_state *conn_state,
-					struct link_config_limits *limits)
+static int intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
+				       struct intel_crtc_state *pipe_config,
+				       struct drm_connector_state *conn_state,
+				       struct link_config_limits *limits)
 {
 	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
 	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
 	struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
 	u8 dsc_max_bpc;
 	int pipe_bpp;
+	int ret;
 
 	if (!intel_dp_supports_dsc(intel_dp, pipe_config))
-		return false;
+		return -EINVAL;
 
 	dsc_max_bpc = min_t(u8, DP_DSC_MAX_SUPPORTED_BPC,
 			    conn_state->max_requested_bpc);
@@ -1925,7 +1926,7 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
 	pipe_bpp = intel_dp_dsc_compute_bpp(intel_dp, dsc_max_bpc);
 	if (pipe_bpp < DP_DSC_MIN_SUPPORTED_BPC * 3) {
 		DRM_DEBUG_KMS("No DSC support for less than 8bpc\n");
-		return false;
+		return -EINVAL;
 	}
 
 	/*
@@ -1959,7 +1960,7 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
 						     adjusted_mode->crtc_hdisplay);
 		if (!dsc_max_output_bpp || !dsc_dp_slice_count) {
 			DRM_DEBUG_KMS("Compressed BPP/Slice Count not supported\n");
-			return false;
+			return -EINVAL;
 		}
 		pipe_config->dsc_params.compressed_bpp = min_t(u16,
 							       dsc_max_output_bpp >> 4,
@@ -1976,16 +1977,19 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
 			pipe_config->dsc_params.dsc_split = true;
 		} else {
 			DRM_DEBUG_KMS("Cannot split stream to use 2 VDSC instances\n");
-			return false;
+			return -EINVAL;
 		}
 	}
-	if (intel_dp_compute_dsc_params(intel_dp, pipe_config) < 0) {
+
+	ret = intel_dp_compute_dsc_params(intel_dp, pipe_config);
+	if (ret < 0) {
 		DRM_DEBUG_KMS("Cannot compute valid DSC parameters for Input Bpp = %d "
 			      "Compressed BPP = %d\n",
 			      pipe_config->pipe_bpp,
 			      pipe_config->dsc_params.compressed_bpp);
-		return false;
+		return ret;
 	}
+
 	pipe_config->dsc_params.compression_enable = true;
 	DRM_DEBUG_KMS("DP DSC computed with Input Bpp = %d "
 		      "Compressed Bpp = %d Slice Count = %d\n",
@@ -1993,10 +1997,10 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
 		      pipe_config->dsc_params.compressed_bpp,
 		      pipe_config->dsc_params.slice_count);
 
-	return true;
+	return 0;
 }
 
-static bool
+static int
 intel_dp_compute_link_config(struct intel_encoder *encoder,
 			     struct intel_crtc_state *pipe_config,
 			     struct drm_connector_state *conn_state)
@@ -2005,7 +2009,7 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
 	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
 	struct link_config_limits limits;
 	int common_len;
-	bool ret;
+	int ret;
 
 	common_len = intel_dp_common_len_rate_limit(intel_dp,
 						    intel_dp->max_link_rate);
@@ -2063,10 +2067,11 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
 
 	/* enable compression if the mode doesn't fit available BW */
 	DRM_DEBUG_KMS("Force DSC en = %d\n", intel_dp->force_dsc_en);
-	if (!ret || intel_dp->force_dsc_en) {
-		if (!intel_dp_dsc_compute_config(intel_dp, pipe_config,
-						 conn_state, &limits))
-			return false;
+	if (ret || intel_dp->force_dsc_en) {
+		ret = intel_dp_dsc_compute_config(intel_dp, pipe_config,
+						  conn_state, &limits);
+		if (ret < 0)
+			return ret;
 	}
 
 	if (pipe_config->dsc_params.compression_enable) {
@@ -2091,10 +2096,10 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
 			      intel_dp_max_data_rate(pipe_config->port_clock,
 						     pipe_config->lane_count));
 	}
-	return true;
+	return 0;
 }
 
-bool
+int
 intel_dp_compute_config(struct intel_encoder *encoder,
 			struct intel_crtc_state *pipe_config,
 			struct drm_connector_state *conn_state)
@@ -2110,6 +2115,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 		to_intel_digital_connector_state(conn_state);
 	bool constant_n = drm_dp_has_quirk(&intel_dp->desc,
 					   DP_DPCD_QUIRK_CONSTANT_N);
+	int ret;
 
 	if (HAS_PCH_SPLIT(dev_priv) && !HAS_DDI(dev_priv) && port != PORT_A)
 		pipe_config->has_pch_encoder = true;
@@ -2131,8 +2137,6 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 				       adjusted_mode);
 
 		if (INTEL_GEN(dev_priv) >= 9) {
-			int ret;
-
 			ret = skl_update_scaler_crtc(pipe_config);
 			if (ret)
 				return ret;
@@ -2147,20 +2151,21 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 	}
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return false;
+		return -EINVAL;
 
 	if (HAS_GMCH_DISPLAY(dev_priv) &&
 	    adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
-		return false;
+		return -EINVAL;
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
-		return false;
+		return -EINVAL;
 
 	pipe_config->fec_enable = !intel_dp_is_edp(intel_dp) &&
 				  intel_dp_supports_fec(intel_dp, pipe_config);
 
-	if (!intel_dp_compute_link_config(encoder, pipe_config, conn_state))
-		return false;
+	ret = intel_dp_compute_link_config(encoder, pipe_config, conn_state);
+	if (ret < 0)
+		return ret;
 
 	if (intel_conn_state->broadcast_rgb == INTEL_BROADCAST_RGB_AUTO) {
 		/*
@@ -2208,7 +2213,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 
 	intel_psr_compute_config(intel_dp, pipe_config);
 
-	return true;
+	return 0;
 }
 
 void intel_dp_set_link_params(struct intel_dp *intel_dp,
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
index 3f83429333c7..a19699023db1 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -29,9 +29,9 @@
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_edid.h>
 
-static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
-					struct intel_crtc_state *pipe_config,
-					struct drm_connector_state *conn_state)
+static int intel_dp_mst_compute_config(struct intel_encoder *encoder,
+				       struct intel_crtc_state *pipe_config,
+				       struct drm_connector_state *conn_state)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
@@ -52,7 +52,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
 					   DP_DPCD_QUIRK_CONSTANT_N);
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return false;
+		return -EINVAL;
 
 	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
 	pipe_config->has_pch_encoder = false;
@@ -89,7 +89,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
 		if (slots < 0) {
 			DRM_DEBUG_KMS("failed finding vcpi slots:%d\n",
 				      slots);
-			return false;
+			return slots;
 		}
 	}
 
@@ -107,7 +107,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
 
 	intel_ddi_compute_min_voltage_level(dev_priv, pipe_config);
 
-	return true;
+	return 0;
 }
 
 static int
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 7977843ce26a..e5a436c33307 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -225,9 +225,9 @@ struct intel_encoder {
 	enum intel_output_type (*compute_output_type)(struct intel_encoder *,
 						      struct intel_crtc_state *,
 						      struct drm_connector_state *);
-	bool (*compute_config)(struct intel_encoder *,
-			       struct intel_crtc_state *,
-			       struct drm_connector_state *);
+	int (*compute_config)(struct intel_encoder *,
+			      struct intel_crtc_state *,
+			      struct drm_connector_state *);
 	void (*pre_pll_enable)(struct intel_encoder *,
 			       const struct intel_crtc_state *,
 			       const struct drm_connector_state *);
@@ -1816,9 +1816,9 @@ void intel_dp_sink_set_decompression_state(struct intel_dp *intel_dp,
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
 void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
 void intel_dp_encoder_flush_work(struct drm_encoder *encoder);
-bool intel_dp_compute_config(struct intel_encoder *encoder,
-			     struct intel_crtc_state *pipe_config,
-			     struct drm_connector_state *conn_state);
+int intel_dp_compute_config(struct intel_encoder *encoder,
+			    struct intel_crtc_state *pipe_config,
+			    struct drm_connector_state *conn_state);
 bool intel_dp_is_edp(struct intel_dp *intel_dp);
 bool intel_dp_is_port_edp(struct drm_i915_private *dev_priv, enum port port);
 enum irqreturn intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port,
@@ -1978,9 +1978,9 @@ void intel_hdmi_init(struct drm_i915_private *dev_priv, i915_reg_t hdmi_reg,
 void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
 			       struct intel_connector *intel_connector);
 struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder);
-bool intel_hdmi_compute_config(struct intel_encoder *encoder,
-			       struct intel_crtc_state *pipe_config,
-			       struct drm_connector_state *conn_state);
+int intel_hdmi_compute_config(struct intel_encoder *encoder,
+			      struct intel_crtc_state *pipe_config,
+			      struct drm_connector_state *conn_state);
 bool intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder,
 				       struct drm_connector *connector,
 				       bool high_tmds_clock_ratio,
diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
index bc3c3cb57ec6..a6c82482a841 100644
--- a/drivers/gpu/drm/i915/intel_dvo.c
+++ b/drivers/gpu/drm/i915/intel_dvo.c
@@ -234,9 +234,9 @@ intel_dvo_mode_valid(struct drm_connector *connector,
 	return intel_dvo->dev.dev_ops->mode_valid(&intel_dvo->dev, mode);
 }
 
-static bool intel_dvo_compute_config(struct intel_encoder *encoder,
-				     struct intel_crtc_state *pipe_config,
-				     struct drm_connector_state *conn_state)
+static int intel_dvo_compute_config(struct intel_encoder *encoder,
+				    struct intel_crtc_state *pipe_config,
+				    struct drm_connector_state *conn_state)
 {
 	struct intel_dvo *intel_dvo = enc_to_dvo(encoder);
 	const struct drm_display_mode *fixed_mode =
@@ -253,10 +253,11 @@ static bool intel_dvo_compute_config(struct intel_encoder *encoder,
 		intel_fixed_panel_mode(fixed_mode, adjusted_mode);
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return false;
+		return -EINVAL;
 
 	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
-	return true;
+
+	return 0;
 }
 
 static void intel_dvo_pre_enable(struct intel_encoder *encoder,
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 74f4021b760c..97a98e1bea56 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1704,9 +1704,9 @@ intel_hdmi_ycbcr420_config(struct drm_connector *connector,
 	return true;
 }
 
-bool intel_hdmi_compute_config(struct intel_encoder *encoder,
-			       struct intel_crtc_state *pipe_config,
-			       struct drm_connector_state *conn_state)
+int intel_hdmi_compute_config(struct intel_encoder *encoder,
+			      struct intel_crtc_state *pipe_config,
+			      struct drm_connector_state *conn_state)
 {
 	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
@@ -1722,7 +1722,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
 	bool force_dvi = intel_conn_state->force_audio == HDMI_AUDIO_OFF_DVI;
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return false;
+		return -EINVAL;
 
 	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
 	pipe_config->has_hdmi_sink = !force_dvi && intel_hdmi->has_hdmi_sink;
@@ -1753,7 +1753,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
 						&clock_12bpc, &clock_10bpc,
 						&clock_8bpc)) {
 			DRM_ERROR("Can't support YCBCR420 output\n");
-			return false;
+			return -EINVAL;
 		}
 	}
 
@@ -1803,7 +1803,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
 	if (hdmi_port_clock_valid(intel_hdmi, pipe_config->port_clock,
 				  false, force_dvi) != MODE_OK) {
 		DRM_DEBUG_KMS("unsupported HDMI clock, rejecting mode\n");
-		return false;
+		return -EINVAL;
 	}
 
 	/* Set user selected PAR to incoming mode's member */
@@ -1822,7 +1822,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
 		}
 	}
 
-	return true;
+	return 0;
 }
 
 static void
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index b01aacb5d73d..46a5dfd5cdf7 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -380,9 +380,9 @@ intel_lvds_mode_valid(struct drm_connector *connector,
 	return MODE_OK;
 }
 
-static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
-				      struct intel_crtc_state *pipe_config,
-				      struct drm_connector_state *conn_state)
+static int intel_lvds_compute_config(struct intel_encoder *intel_encoder,
+				     struct intel_crtc_state *pipe_config,
+				     struct drm_connector_state *conn_state)
 {
 	struct drm_i915_private *dev_priv = to_i915(intel_encoder->base.dev);
 	struct intel_lvds_encoder *lvds_encoder =
@@ -396,7 +396,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
 	/* Should never happen!! */
 	if (INTEL_GEN(dev_priv) < 4 && intel_crtc->pipe == 0) {
 		DRM_ERROR("Can't support LVDS on pipe A\n");
-		return false;
+		return -EINVAL;
 	}
 
 	if (lvds_encoder->a3_power == LVDS_A3_POWER_UP)
@@ -422,7 +422,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
 			       adjusted_mode);
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return false;
+		return -EINVAL;
 
 	if (HAS_PCH_SPLIT(dev_priv)) {
 		pipe_config->has_pch_encoder = true;
@@ -441,7 +441,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
 	 * user's requested refresh rate.
 	 */
 
-	return true;
+	return 0;
 }
 
 static enum drm_connector_status
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 4db7aefa88f9..df2d830a7405 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1107,9 +1107,9 @@ static void i9xx_adjust_sdvo_tv_clock(struct intel_crtc_state *pipe_config)
 	pipe_config->clock_set = true;
 }
 
-static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
-				      struct intel_crtc_state *pipe_config,
-				      struct drm_connector_state *conn_state)
+static int intel_sdvo_compute_config(struct intel_encoder *encoder,
+				     struct intel_crtc_state *pipe_config,
+				     struct drm_connector_state *conn_state)
 {
 	struct intel_sdvo *intel_sdvo = to_sdvo(encoder);
 	struct intel_sdvo_connector_state *intel_sdvo_state =
@@ -1134,7 +1134,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
 	 */
 	if (IS_TV(intel_sdvo_connector)) {
 		if (!intel_sdvo_set_output_timings_from_mode(intel_sdvo, mode))
-			return false;
+			return -EINVAL;
 
 		(void) intel_sdvo_get_preferred_input_mode(intel_sdvo,
 							   intel_sdvo_connector,
@@ -1144,7 +1144,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
 	} else if (IS_LVDS(intel_sdvo_connector)) {
 		if (!intel_sdvo_set_output_timings_from_mode(intel_sdvo,
 							     intel_sdvo_connector->base.panel.fixed_mode))
-			return false;
+			return -EINVAL;
 
 		(void) intel_sdvo_get_preferred_input_mode(intel_sdvo,
 							   intel_sdvo_connector,
@@ -1153,7 +1153,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
 	}
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return false;
+		return -EINVAL;
 
 	/*
 	 * Make the CRTC code factor in the SDVO pixel multiplier.  The
@@ -1193,7 +1193,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
 	if (intel_sdvo_connector->is_hdmi)
 		adjusted_mode->picture_aspect_ratio = conn_state->picture_aspect_ratio;
 
-	return true;
+	return 0;
 }
 
 #define UPDATE_PROPERTY(input, NAME) \
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index d7a414ce2774..bd5536f0ec92 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -869,7 +869,7 @@ intel_tv_get_config(struct intel_encoder *encoder,
 	pipe_config->base.adjusted_mode.crtc_clock = pipe_config->port_clock;
 }
 
-static bool
+static int
 intel_tv_compute_config(struct intel_encoder *encoder,
 			struct intel_crtc_state *pipe_config,
 			struct drm_connector_state *conn_state)
@@ -879,10 +879,10 @@ intel_tv_compute_config(struct intel_encoder *encoder,
 		&pipe_config->base.adjusted_mode;
 
 	if (!tv_mode)
-		return false;
+		return -EINVAL;
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return false;
+		return -EINVAL;
 
 	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
 	adjusted_mode->crtc_clock = tv_mode->clock;
@@ -897,7 +897,7 @@ intel_tv_compute_config(struct intel_encoder *encoder,
 	 * or whether userspace is doing something stupid.
 	 */
 
-	return true;
+	return 0;
 }
 
 static void
diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
index d116fead8514..c247ce74b71a 100644
--- a/drivers/gpu/drm/i915/vlv_dsi.c
+++ b/drivers/gpu/drm/i915/vlv_dsi.c
@@ -256,9 +256,9 @@ static void band_gap_reset(struct drm_i915_private *dev_priv)
 	mutex_unlock(&dev_priv->sb_lock);
 }
 
-static bool intel_dsi_compute_config(struct intel_encoder *encoder,
-				     struct intel_crtc_state *pipe_config,
-				     struct drm_connector_state *conn_state)
+static int intel_dsi_compute_config(struct intel_encoder *encoder,
+				    struct intel_crtc_state *pipe_config,
+				    struct drm_connector_state *conn_state)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	struct intel_dsi *intel_dsi = container_of(encoder, struct intel_dsi,
@@ -284,7 +284,7 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
 	}
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return false;
+		return -EINVAL;
 
 	/* DSI uses short packets for sync events, so clear mode flags for DSI */
 	adjusted_mode->flags = 0;
@@ -302,16 +302,16 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
 
 		ret = bxt_dsi_pll_compute(encoder, pipe_config);
 		if (ret)
-			return false;
+			return -EINVAL;
 	} else {
 		ret = vlv_dsi_pll_compute(encoder, pipe_config);
 		if (ret)
-			return false;
+			return -EINVAL;
 	}
 
 	pipe_config->clock_set = true;
 
-	return true;
+	return 0;
 }
 
 static bool glk_dsi_enable_io(struct intel_encoder *encoder)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2] drm/i915: Pass down rc in intel_encoder->compute_config()
@ 2019-01-15 20:08 ` Lyude Paul
  0 siblings, 0 replies; 12+ messages in thread
From: Lyude Paul @ 2019-01-15 20:08 UTC (permalink / raw)
  To: intel-gfx; +Cc: David Airlie, linux-kernel, dri-devel, Rodrigo Vivi

Something that I completely missed when implementing the new MST VCPI
atomic helpers is that with those helpers, there's technically a chance
of us having to grab additional modeset locks in ->compute_config() and
furthermore, that means we have the potential to hit a normal modeset
deadlock. However, because ->compute_config() only returns a bool this
means we can't return -EDEADLK when we need to drop locks and try again
which means we end up just failing the atomic check permanently. Whoops.

So, fix this by modifying ->compute_config() to pass down an actual
error code instead of a bool so that the atomic check can be restarted
on modeset deadlocks.

Thanks to Ville Syrjälä for pointing this out!

Changes since v1:
* Add some newlines
* Return only -EINVAL from hsw_crt_compute_config()
* Propogate return code from intel_dp_compute_dsc_params()
* Change all of the intel_dp_compute_link_config*() variants
* Don't miss if (hdmi_port_clock_valid()) branch in
  intel_hdmi_compute_config()

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Fixes: eceae1472467 ("drm/dp_mst: Start tracking per-port VCPI allocations")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109320
---
 drivers/gpu/drm/i915/icl_dsi.c       |  8 ++--
 drivers/gpu/drm/i915/intel_crt.c     | 35 +++++++-------
 drivers/gpu/drm/i915/intel_ddi.c     |  6 +--
 drivers/gpu/drm/i915/intel_display.c | 11 +++--
 drivers/gpu/drm/i915/intel_dp.c      | 71 +++++++++++++++-------------
 drivers/gpu/drm/i915/intel_dp_mst.c  | 12 ++---
 drivers/gpu/drm/i915/intel_drv.h     | 18 +++----
 drivers/gpu/drm/i915/intel_dvo.c     | 11 +++--
 drivers/gpu/drm/i915/intel_hdmi.c    | 14 +++---
 drivers/gpu/drm/i915/intel_lvds.c    | 12 ++---
 drivers/gpu/drm/i915/intel_sdvo.c    | 14 +++---
 drivers/gpu/drm/i915/intel_tv.c      |  8 ++--
 drivers/gpu/drm/i915/vlv_dsi.c       | 14 +++---
 13 files changed, 122 insertions(+), 112 deletions(-)

diff --git a/drivers/gpu/drm/i915/icl_dsi.c b/drivers/gpu/drm/i915/icl_dsi.c
index f3a5f03646ce..355b48d1c937 100644
--- a/drivers/gpu/drm/i915/icl_dsi.c
+++ b/drivers/gpu/drm/i915/icl_dsi.c
@@ -1188,9 +1188,9 @@ static void gen11_dsi_get_config(struct intel_encoder *encoder,
 	pipe_config->output_types |= BIT(INTEL_OUTPUT_DSI);
 }
 
-static bool gen11_dsi_compute_config(struct intel_encoder *encoder,
-				     struct intel_crtc_state *pipe_config,
-				     struct drm_connector_state *conn_state)
+static int gen11_dsi_compute_config(struct intel_encoder *encoder,
+				    struct intel_crtc_state *pipe_config,
+				    struct drm_connector_state *conn_state)
 {
 	struct intel_dsi *intel_dsi = container_of(encoder, struct intel_dsi,
 						   base);
@@ -1215,7 +1215,7 @@ static bool gen11_dsi_compute_config(struct intel_encoder *encoder,
 	pipe_config->clock_set = true;
 	pipe_config->port_clock = intel_dsi_bitrate(intel_dsi) / 5;
 
-	return true;
+	return 0;
 }
 
 static u64 gen11_dsi_get_power_domains(struct intel_encoder *encoder,
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 33bd2addcbdd..081c333f30d2 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -345,51 +345,52 @@ intel_crt_mode_valid(struct drm_connector *connector,
 	return MODE_OK;
 }
 
-static bool intel_crt_compute_config(struct intel_encoder *encoder,
-				     struct intel_crtc_state *pipe_config,
-				     struct drm_connector_state *conn_state)
+static int intel_crt_compute_config(struct intel_encoder *encoder,
+				    struct intel_crtc_state *pipe_config,
+				    struct drm_connector_state *conn_state)
 {
 	struct drm_display_mode *adjusted_mode =
 		&pipe_config->base.adjusted_mode;
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return false;
+		return -EINVAL;
 
 	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
-	return true;
+
+	return 0;
 }
 
-static bool pch_crt_compute_config(struct intel_encoder *encoder,
-				   struct intel_crtc_state *pipe_config,
-				   struct drm_connector_state *conn_state)
+static int pch_crt_compute_config(struct intel_encoder *encoder,
+				  struct intel_crtc_state *pipe_config,
+				  struct drm_connector_state *conn_state)
 {
 	struct drm_display_mode *adjusted_mode =
 		&pipe_config->base.adjusted_mode;
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return false;
+		return -EINVAL;
 
 	pipe_config->has_pch_encoder = true;
 	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
 
-	return true;
+	return 0;
 }
 
-static bool hsw_crt_compute_config(struct intel_encoder *encoder,
-				   struct intel_crtc_state *pipe_config,
-				   struct drm_connector_state *conn_state)
+static int hsw_crt_compute_config(struct intel_encoder *encoder,
+				  struct intel_crtc_state *pipe_config,
+				  struct drm_connector_state *conn_state)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	struct drm_display_mode *adjusted_mode =
 		&pipe_config->base.adjusted_mode;
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return false;
+		return -EINVAL;
 
 	/* HSW/BDW FDI limited to 4k */
 	if (adjusted_mode->crtc_hdisplay > 4096 ||
 	    adjusted_mode->crtc_hblank_start > 4096)
-		return false;
+		return -EINVAL;
 
 	pipe_config->has_pch_encoder = true;
 	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
@@ -398,7 +399,7 @@ static bool hsw_crt_compute_config(struct intel_encoder *encoder,
 	if (HAS_PCH_LPT(dev_priv)) {
 		if (pipe_config->bw_constrained && pipe_config->pipe_bpp < 24) {
 			DRM_DEBUG_KMS("LPT only supports 24bpp\n");
-			return false;
+			return -EINVAL;
 		}
 
 		pipe_config->pipe_bpp = 24;
@@ -407,7 +408,7 @@ static bool hsw_crt_compute_config(struct intel_encoder *encoder,
 	/* FDI must always be 2.7 GHz */
 	pipe_config->port_clock = 135000 * 2;
 
-	return true;
+	return 0;
 }
 
 static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector)
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 7f3cd055de50..ce44744a5f9d 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -3837,9 +3837,9 @@ intel_ddi_compute_output_type(struct intel_encoder *encoder,
 	}
 }
 
-static bool intel_ddi_compute_config(struct intel_encoder *encoder,
-				     struct intel_crtc_state *pipe_config,
-				     struct drm_connector_state *conn_state)
+static int intel_ddi_compute_config(struct intel_encoder *encoder,
+				    struct intel_crtc_state *pipe_config,
+				    struct drm_connector_state *conn_state)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	enum port port = encoder->port;
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 0a5ba45f5eb0..af164d712e9e 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -11553,10 +11553,13 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
 			continue;
 
 		encoder = to_intel_encoder(connector_state->best_encoder);
-
-		if (!(encoder->compute_config(encoder, pipe_config, connector_state))) {
-			DRM_DEBUG_KMS("Encoder config failure\n");
-			return -EINVAL;
+		ret = encoder->compute_config(encoder, pipe_config,
+					      connector_state);
+		if (ret < 0) {
+			if (ret != -EDEADLK)
+				DRM_DEBUG_KMS("Encoder config failure: %d\n",
+					      ret);
+			return ret;
 		}
 	}
 
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 0a3ac98a779e..df4292bb1a4f 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1819,7 +1819,7 @@ intel_dp_adjust_compliance_config(struct intel_dp *intel_dp,
 }
 
 /* Optimize link config in order: max bpp, min clock, min lanes */
-static bool
+static int
 intel_dp_compute_link_config_wide(struct intel_dp *intel_dp,
 				  struct intel_crtc_state *pipe_config,
 				  const struct link_config_limits *limits)
@@ -1845,17 +1845,17 @@ intel_dp_compute_link_config_wide(struct intel_dp *intel_dp,
 					pipe_config->pipe_bpp = bpp;
 					pipe_config->port_clock = link_clock;
 
-					return true;
+					return 0;
 				}
 			}
 		}
 	}
 
-	return false;
+	return -EINVAL;
 }
 
 /* Optimize link config in order: max bpp, min lanes, min clock */
-static bool
+static int
 intel_dp_compute_link_config_fast(struct intel_dp *intel_dp,
 				  struct intel_crtc_state *pipe_config,
 				  const struct link_config_limits *limits)
@@ -1881,13 +1881,13 @@ intel_dp_compute_link_config_fast(struct intel_dp *intel_dp,
 					pipe_config->pipe_bpp = bpp;
 					pipe_config->port_clock = link_clock;
 
-					return true;
+					return 0;
 				}
 			}
 		}
 	}
 
-	return false;
+	return -EINVAL;
 }
 
 static int intel_dp_dsc_compute_bpp(struct intel_dp *intel_dp, u8 dsc_max_bpc)
@@ -1905,19 +1905,20 @@ static int intel_dp_dsc_compute_bpp(struct intel_dp *intel_dp, u8 dsc_max_bpc)
 	return 0;
 }
 
-static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
-					struct intel_crtc_state *pipe_config,
-					struct drm_connector_state *conn_state,
-					struct link_config_limits *limits)
+static int intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
+				       struct intel_crtc_state *pipe_config,
+				       struct drm_connector_state *conn_state,
+				       struct link_config_limits *limits)
 {
 	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
 	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
 	struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
 	u8 dsc_max_bpc;
 	int pipe_bpp;
+	int ret;
 
 	if (!intel_dp_supports_dsc(intel_dp, pipe_config))
-		return false;
+		return -EINVAL;
 
 	dsc_max_bpc = min_t(u8, DP_DSC_MAX_SUPPORTED_BPC,
 			    conn_state->max_requested_bpc);
@@ -1925,7 +1926,7 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
 	pipe_bpp = intel_dp_dsc_compute_bpp(intel_dp, dsc_max_bpc);
 	if (pipe_bpp < DP_DSC_MIN_SUPPORTED_BPC * 3) {
 		DRM_DEBUG_KMS("No DSC support for less than 8bpc\n");
-		return false;
+		return -EINVAL;
 	}
 
 	/*
@@ -1959,7 +1960,7 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
 						     adjusted_mode->crtc_hdisplay);
 		if (!dsc_max_output_bpp || !dsc_dp_slice_count) {
 			DRM_DEBUG_KMS("Compressed BPP/Slice Count not supported\n");
-			return false;
+			return -EINVAL;
 		}
 		pipe_config->dsc_params.compressed_bpp = min_t(u16,
 							       dsc_max_output_bpp >> 4,
@@ -1976,16 +1977,19 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
 			pipe_config->dsc_params.dsc_split = true;
 		} else {
 			DRM_DEBUG_KMS("Cannot split stream to use 2 VDSC instances\n");
-			return false;
+			return -EINVAL;
 		}
 	}
-	if (intel_dp_compute_dsc_params(intel_dp, pipe_config) < 0) {
+
+	ret = intel_dp_compute_dsc_params(intel_dp, pipe_config);
+	if (ret < 0) {
 		DRM_DEBUG_KMS("Cannot compute valid DSC parameters for Input Bpp = %d "
 			      "Compressed BPP = %d\n",
 			      pipe_config->pipe_bpp,
 			      pipe_config->dsc_params.compressed_bpp);
-		return false;
+		return ret;
 	}
+
 	pipe_config->dsc_params.compression_enable = true;
 	DRM_DEBUG_KMS("DP DSC computed with Input Bpp = %d "
 		      "Compressed Bpp = %d Slice Count = %d\n",
@@ -1993,10 +1997,10 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
 		      pipe_config->dsc_params.compressed_bpp,
 		      pipe_config->dsc_params.slice_count);
 
-	return true;
+	return 0;
 }
 
-static bool
+static int
 intel_dp_compute_link_config(struct intel_encoder *encoder,
 			     struct intel_crtc_state *pipe_config,
 			     struct drm_connector_state *conn_state)
@@ -2005,7 +2009,7 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
 	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
 	struct link_config_limits limits;
 	int common_len;
-	bool ret;
+	int ret;
 
 	common_len = intel_dp_common_len_rate_limit(intel_dp,
 						    intel_dp->max_link_rate);
@@ -2063,10 +2067,11 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
 
 	/* enable compression if the mode doesn't fit available BW */
 	DRM_DEBUG_KMS("Force DSC en = %d\n", intel_dp->force_dsc_en);
-	if (!ret || intel_dp->force_dsc_en) {
-		if (!intel_dp_dsc_compute_config(intel_dp, pipe_config,
-						 conn_state, &limits))
-			return false;
+	if (ret || intel_dp->force_dsc_en) {
+		ret = intel_dp_dsc_compute_config(intel_dp, pipe_config,
+						  conn_state, &limits);
+		if (ret < 0)
+			return ret;
 	}
 
 	if (pipe_config->dsc_params.compression_enable) {
@@ -2091,10 +2096,10 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
 			      intel_dp_max_data_rate(pipe_config->port_clock,
 						     pipe_config->lane_count));
 	}
-	return true;
+	return 0;
 }
 
-bool
+int
 intel_dp_compute_config(struct intel_encoder *encoder,
 			struct intel_crtc_state *pipe_config,
 			struct drm_connector_state *conn_state)
@@ -2110,6 +2115,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 		to_intel_digital_connector_state(conn_state);
 	bool constant_n = drm_dp_has_quirk(&intel_dp->desc,
 					   DP_DPCD_QUIRK_CONSTANT_N);
+	int ret;
 
 	if (HAS_PCH_SPLIT(dev_priv) && !HAS_DDI(dev_priv) && port != PORT_A)
 		pipe_config->has_pch_encoder = true;
@@ -2131,8 +2137,6 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 				       adjusted_mode);
 
 		if (INTEL_GEN(dev_priv) >= 9) {
-			int ret;
-
 			ret = skl_update_scaler_crtc(pipe_config);
 			if (ret)
 				return ret;
@@ -2147,20 +2151,21 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 	}
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return false;
+		return -EINVAL;
 
 	if (HAS_GMCH_DISPLAY(dev_priv) &&
 	    adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
-		return false;
+		return -EINVAL;
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
-		return false;
+		return -EINVAL;
 
 	pipe_config->fec_enable = !intel_dp_is_edp(intel_dp) &&
 				  intel_dp_supports_fec(intel_dp, pipe_config);
 
-	if (!intel_dp_compute_link_config(encoder, pipe_config, conn_state))
-		return false;
+	ret = intel_dp_compute_link_config(encoder, pipe_config, conn_state);
+	if (ret < 0)
+		return ret;
 
 	if (intel_conn_state->broadcast_rgb == INTEL_BROADCAST_RGB_AUTO) {
 		/*
@@ -2208,7 +2213,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 
 	intel_psr_compute_config(intel_dp, pipe_config);
 
-	return true;
+	return 0;
 }
 
 void intel_dp_set_link_params(struct intel_dp *intel_dp,
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
index 3f83429333c7..a19699023db1 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -29,9 +29,9 @@
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_edid.h>
 
-static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
-					struct intel_crtc_state *pipe_config,
-					struct drm_connector_state *conn_state)
+static int intel_dp_mst_compute_config(struct intel_encoder *encoder,
+				       struct intel_crtc_state *pipe_config,
+				       struct drm_connector_state *conn_state)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
@@ -52,7 +52,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
 					   DP_DPCD_QUIRK_CONSTANT_N);
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return false;
+		return -EINVAL;
 
 	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
 	pipe_config->has_pch_encoder = false;
@@ -89,7 +89,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
 		if (slots < 0) {
 			DRM_DEBUG_KMS("failed finding vcpi slots:%d\n",
 				      slots);
-			return false;
+			return slots;
 		}
 	}
 
@@ -107,7 +107,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
 
 	intel_ddi_compute_min_voltage_level(dev_priv, pipe_config);
 
-	return true;
+	return 0;
 }
 
 static int
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 7977843ce26a..e5a436c33307 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -225,9 +225,9 @@ struct intel_encoder {
 	enum intel_output_type (*compute_output_type)(struct intel_encoder *,
 						      struct intel_crtc_state *,
 						      struct drm_connector_state *);
-	bool (*compute_config)(struct intel_encoder *,
-			       struct intel_crtc_state *,
-			       struct drm_connector_state *);
+	int (*compute_config)(struct intel_encoder *,
+			      struct intel_crtc_state *,
+			      struct drm_connector_state *);
 	void (*pre_pll_enable)(struct intel_encoder *,
 			       const struct intel_crtc_state *,
 			       const struct drm_connector_state *);
@@ -1816,9 +1816,9 @@ void intel_dp_sink_set_decompression_state(struct intel_dp *intel_dp,
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
 void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
 void intel_dp_encoder_flush_work(struct drm_encoder *encoder);
-bool intel_dp_compute_config(struct intel_encoder *encoder,
-			     struct intel_crtc_state *pipe_config,
-			     struct drm_connector_state *conn_state);
+int intel_dp_compute_config(struct intel_encoder *encoder,
+			    struct intel_crtc_state *pipe_config,
+			    struct drm_connector_state *conn_state);
 bool intel_dp_is_edp(struct intel_dp *intel_dp);
 bool intel_dp_is_port_edp(struct drm_i915_private *dev_priv, enum port port);
 enum irqreturn intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port,
@@ -1978,9 +1978,9 @@ void intel_hdmi_init(struct drm_i915_private *dev_priv, i915_reg_t hdmi_reg,
 void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
 			       struct intel_connector *intel_connector);
 struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder);
-bool intel_hdmi_compute_config(struct intel_encoder *encoder,
-			       struct intel_crtc_state *pipe_config,
-			       struct drm_connector_state *conn_state);
+int intel_hdmi_compute_config(struct intel_encoder *encoder,
+			      struct intel_crtc_state *pipe_config,
+			      struct drm_connector_state *conn_state);
 bool intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder,
 				       struct drm_connector *connector,
 				       bool high_tmds_clock_ratio,
diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
index bc3c3cb57ec6..a6c82482a841 100644
--- a/drivers/gpu/drm/i915/intel_dvo.c
+++ b/drivers/gpu/drm/i915/intel_dvo.c
@@ -234,9 +234,9 @@ intel_dvo_mode_valid(struct drm_connector *connector,
 	return intel_dvo->dev.dev_ops->mode_valid(&intel_dvo->dev, mode);
 }
 
-static bool intel_dvo_compute_config(struct intel_encoder *encoder,
-				     struct intel_crtc_state *pipe_config,
-				     struct drm_connector_state *conn_state)
+static int intel_dvo_compute_config(struct intel_encoder *encoder,
+				    struct intel_crtc_state *pipe_config,
+				    struct drm_connector_state *conn_state)
 {
 	struct intel_dvo *intel_dvo = enc_to_dvo(encoder);
 	const struct drm_display_mode *fixed_mode =
@@ -253,10 +253,11 @@ static bool intel_dvo_compute_config(struct intel_encoder *encoder,
 		intel_fixed_panel_mode(fixed_mode, adjusted_mode);
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return false;
+		return -EINVAL;
 
 	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
-	return true;
+
+	return 0;
 }
 
 static void intel_dvo_pre_enable(struct intel_encoder *encoder,
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 74f4021b760c..97a98e1bea56 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1704,9 +1704,9 @@ intel_hdmi_ycbcr420_config(struct drm_connector *connector,
 	return true;
 }
 
-bool intel_hdmi_compute_config(struct intel_encoder *encoder,
-			       struct intel_crtc_state *pipe_config,
-			       struct drm_connector_state *conn_state)
+int intel_hdmi_compute_config(struct intel_encoder *encoder,
+			      struct intel_crtc_state *pipe_config,
+			      struct drm_connector_state *conn_state)
 {
 	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
@@ -1722,7 +1722,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
 	bool force_dvi = intel_conn_state->force_audio == HDMI_AUDIO_OFF_DVI;
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return false;
+		return -EINVAL;
 
 	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
 	pipe_config->has_hdmi_sink = !force_dvi && intel_hdmi->has_hdmi_sink;
@@ -1753,7 +1753,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
 						&clock_12bpc, &clock_10bpc,
 						&clock_8bpc)) {
 			DRM_ERROR("Can't support YCBCR420 output\n");
-			return false;
+			return -EINVAL;
 		}
 	}
 
@@ -1803,7 +1803,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
 	if (hdmi_port_clock_valid(intel_hdmi, pipe_config->port_clock,
 				  false, force_dvi) != MODE_OK) {
 		DRM_DEBUG_KMS("unsupported HDMI clock, rejecting mode\n");
-		return false;
+		return -EINVAL;
 	}
 
 	/* Set user selected PAR to incoming mode's member */
@@ -1822,7 +1822,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
 		}
 	}
 
-	return true;
+	return 0;
 }
 
 static void
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index b01aacb5d73d..46a5dfd5cdf7 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -380,9 +380,9 @@ intel_lvds_mode_valid(struct drm_connector *connector,
 	return MODE_OK;
 }
 
-static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
-				      struct intel_crtc_state *pipe_config,
-				      struct drm_connector_state *conn_state)
+static int intel_lvds_compute_config(struct intel_encoder *intel_encoder,
+				     struct intel_crtc_state *pipe_config,
+				     struct drm_connector_state *conn_state)
 {
 	struct drm_i915_private *dev_priv = to_i915(intel_encoder->base.dev);
 	struct intel_lvds_encoder *lvds_encoder =
@@ -396,7 +396,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
 	/* Should never happen!! */
 	if (INTEL_GEN(dev_priv) < 4 && intel_crtc->pipe == 0) {
 		DRM_ERROR("Can't support LVDS on pipe A\n");
-		return false;
+		return -EINVAL;
 	}
 
 	if (lvds_encoder->a3_power == LVDS_A3_POWER_UP)
@@ -422,7 +422,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
 			       adjusted_mode);
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return false;
+		return -EINVAL;
 
 	if (HAS_PCH_SPLIT(dev_priv)) {
 		pipe_config->has_pch_encoder = true;
@@ -441,7 +441,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
 	 * user's requested refresh rate.
 	 */
 
-	return true;
+	return 0;
 }
 
 static enum drm_connector_status
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 4db7aefa88f9..df2d830a7405 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1107,9 +1107,9 @@ static void i9xx_adjust_sdvo_tv_clock(struct intel_crtc_state *pipe_config)
 	pipe_config->clock_set = true;
 }
 
-static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
-				      struct intel_crtc_state *pipe_config,
-				      struct drm_connector_state *conn_state)
+static int intel_sdvo_compute_config(struct intel_encoder *encoder,
+				     struct intel_crtc_state *pipe_config,
+				     struct drm_connector_state *conn_state)
 {
 	struct intel_sdvo *intel_sdvo = to_sdvo(encoder);
 	struct intel_sdvo_connector_state *intel_sdvo_state =
@@ -1134,7 +1134,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
 	 */
 	if (IS_TV(intel_sdvo_connector)) {
 		if (!intel_sdvo_set_output_timings_from_mode(intel_sdvo, mode))
-			return false;
+			return -EINVAL;
 
 		(void) intel_sdvo_get_preferred_input_mode(intel_sdvo,
 							   intel_sdvo_connector,
@@ -1144,7 +1144,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
 	} else if (IS_LVDS(intel_sdvo_connector)) {
 		if (!intel_sdvo_set_output_timings_from_mode(intel_sdvo,
 							     intel_sdvo_connector->base.panel.fixed_mode))
-			return false;
+			return -EINVAL;
 
 		(void) intel_sdvo_get_preferred_input_mode(intel_sdvo,
 							   intel_sdvo_connector,
@@ -1153,7 +1153,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
 	}
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return false;
+		return -EINVAL;
 
 	/*
 	 * Make the CRTC code factor in the SDVO pixel multiplier.  The
@@ -1193,7 +1193,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
 	if (intel_sdvo_connector->is_hdmi)
 		adjusted_mode->picture_aspect_ratio = conn_state->picture_aspect_ratio;
 
-	return true;
+	return 0;
 }
 
 #define UPDATE_PROPERTY(input, NAME) \
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index d7a414ce2774..bd5536f0ec92 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -869,7 +869,7 @@ intel_tv_get_config(struct intel_encoder *encoder,
 	pipe_config->base.adjusted_mode.crtc_clock = pipe_config->port_clock;
 }
 
-static bool
+static int
 intel_tv_compute_config(struct intel_encoder *encoder,
 			struct intel_crtc_state *pipe_config,
 			struct drm_connector_state *conn_state)
@@ -879,10 +879,10 @@ intel_tv_compute_config(struct intel_encoder *encoder,
 		&pipe_config->base.adjusted_mode;
 
 	if (!tv_mode)
-		return false;
+		return -EINVAL;
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return false;
+		return -EINVAL;
 
 	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
 	adjusted_mode->crtc_clock = tv_mode->clock;
@@ -897,7 +897,7 @@ intel_tv_compute_config(struct intel_encoder *encoder,
 	 * or whether userspace is doing something stupid.
 	 */
 
-	return true;
+	return 0;
 }
 
 static void
diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
index d116fead8514..c247ce74b71a 100644
--- a/drivers/gpu/drm/i915/vlv_dsi.c
+++ b/drivers/gpu/drm/i915/vlv_dsi.c
@@ -256,9 +256,9 @@ static void band_gap_reset(struct drm_i915_private *dev_priv)
 	mutex_unlock(&dev_priv->sb_lock);
 }
 
-static bool intel_dsi_compute_config(struct intel_encoder *encoder,
-				     struct intel_crtc_state *pipe_config,
-				     struct drm_connector_state *conn_state)
+static int intel_dsi_compute_config(struct intel_encoder *encoder,
+				    struct intel_crtc_state *pipe_config,
+				    struct drm_connector_state *conn_state)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	struct intel_dsi *intel_dsi = container_of(encoder, struct intel_dsi,
@@ -284,7 +284,7 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
 	}
 
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
-		return false;
+		return -EINVAL;
 
 	/* DSI uses short packets for sync events, so clear mode flags for DSI */
 	adjusted_mode->flags = 0;
@@ -302,16 +302,16 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
 
 		ret = bxt_dsi_pll_compute(encoder, pipe_config);
 		if (ret)
-			return false;
+			return -EINVAL;
 	} else {
 		ret = vlv_dsi_pll_compute(encoder, pipe_config);
 		if (ret)
-			return false;
+			return -EINVAL;
 	}
 
 	pipe_config->clock_set = true;
 
-	return true;
+	return 0;
 }
 
 static bool glk_dsi_enable_io(struct intel_encoder *encoder)
-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Pass down rc in intel_encoder->compute_config() (rev2)
  2019-01-15 20:08 ` Lyude Paul
  (?)
@ 2019-01-15 20:14 ` Patchwork
  -1 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2019-01-15 20:14 UTC (permalink / raw)
  To: Lyude Paul; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Pass down rc in intel_encoder->compute_config() (rev2)
URL   : https://patchwork.freedesktop.org/series/55203/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
1238102f7caa drm/i915: Pass down rc in intel_encoder->compute_config()
-:26: WARNING:TYPO_SPELLING: 'Propogate' may be misspelled - perhaps 'Propagate'?
#26: 
* Propogate return code from intel_dp_compute_dsc_params()

-:467: WARNING:FUNCTION_ARGUMENTS: function definition argument 'struct intel_encoder *' should also have an identifier name
#467: FILE: drivers/gpu/drm/i915/intel_drv.h:228:
+	int (*compute_config)(struct intel_encoder *,

-:467: WARNING:FUNCTION_ARGUMENTS: function definition argument 'struct intel_crtc_state *' should also have an identifier name
#467: FILE: drivers/gpu/drm/i915/intel_drv.h:228:
+	int (*compute_config)(struct intel_encoder *,

-:467: WARNING:FUNCTION_ARGUMENTS: function definition argument 'struct drm_connector_state *' should also have an identifier name
#467: FILE: drivers/gpu/drm/i915/intel_drv.h:228:
+	int (*compute_config)(struct intel_encoder *,

total: 0 errors, 4 warnings, 0 checks, 622 lines checked

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* ✗ Fi.CI.SPARSE: warning for drm/i915: Pass down rc in intel_encoder->compute_config() (rev2)
  2019-01-15 20:08 ` Lyude Paul
  (?)
  (?)
@ 2019-01-15 20:15 ` Patchwork
  -1 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2019-01-15 20:15 UTC (permalink / raw)
  To: Lyude Paul; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Pass down rc in intel_encoder->compute_config() (rev2)
URL   : https://patchwork.freedesktop.org/series/55203/
State : warning

== Summary ==

$ dim sparse origin/drm-tip
Sparse version: v0.5.2
Commit: drm/i915: Pass down rc in intel_encoder->compute_config()
-O:drivers/gpu/drm/i915/intel_dp.c:1922:23: warning: expression using sizeof(void)
+drivers/gpu/drm/i915/intel_dp.c:1923:23: warning: expression using sizeof(void)
-O:drivers/gpu/drm/i915/intel_dp.c:1964:58: warning: expression using sizeof(void)
-O:drivers/gpu/drm/i915/intel_dp.c:1964:58: warning: expression using sizeof(void)
+drivers/gpu/drm/i915/intel_dp.c:1965:58: warning: expression using sizeof(void)
+drivers/gpu/drm/i915/intel_dp.c:1965:58: warning: expression using sizeof(void)

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] drm/i915: Pass down rc in intel_encoder->compute_config()
  2019-01-15 20:08 ` Lyude Paul
@ 2019-01-15 20:19   ` Ville Syrjälä
  -1 siblings, 0 replies; 12+ messages in thread
From: Ville Syrjälä @ 2019-01-15 20:19 UTC (permalink / raw)
  To: Lyude Paul
  Cc: intel-gfx, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	David Airlie, Daniel Vetter, dri-devel, linux-kernel

On Tue, Jan 15, 2019 at 03:08:00PM -0500, Lyude Paul wrote:
> Something that I completely missed when implementing the new MST VCPI
> atomic helpers is that with those helpers, there's technically a chance
> of us having to grab additional modeset locks in ->compute_config() and
> furthermore, that means we have the potential to hit a normal modeset
> deadlock. However, because ->compute_config() only returns a bool this
> means we can't return -EDEADLK when we need to drop locks and try again
> which means we end up just failing the atomic check permanently. Whoops.
> 
> So, fix this by modifying ->compute_config() to pass down an actual
> error code instead of a bool so that the atomic check can be restarted
> on modeset deadlocks.
> 
> Thanks to Ville Syrjälä for pointing this out!
> 
> Changes since v1:
> * Add some newlines
> * Return only -EINVAL from hsw_crt_compute_config()
> * Propogate return code from intel_dp_compute_dsc_params()
> * Change all of the intel_dp_compute_link_config*() variants
> * Don't miss if (hdmi_port_clock_valid()) branch in
>   intel_hdmi_compute_config()
> 
> Signed-off-by: Lyude Paul <lyude@redhat.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Fixes: eceae1472467 ("drm/dp_mst: Start tracking per-port VCPI allocations")
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109320

Patch looks great. Hopefully we got them all.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/icl_dsi.c       |  8 ++--
>  drivers/gpu/drm/i915/intel_crt.c     | 35 +++++++-------
>  drivers/gpu/drm/i915/intel_ddi.c     |  6 +--
>  drivers/gpu/drm/i915/intel_display.c | 11 +++--
>  drivers/gpu/drm/i915/intel_dp.c      | 71 +++++++++++++++-------------
>  drivers/gpu/drm/i915/intel_dp_mst.c  | 12 ++---
>  drivers/gpu/drm/i915/intel_drv.h     | 18 +++----
>  drivers/gpu/drm/i915/intel_dvo.c     | 11 +++--
>  drivers/gpu/drm/i915/intel_hdmi.c    | 14 +++---
>  drivers/gpu/drm/i915/intel_lvds.c    | 12 ++---
>  drivers/gpu/drm/i915/intel_sdvo.c    | 14 +++---
>  drivers/gpu/drm/i915/intel_tv.c      |  8 ++--
>  drivers/gpu/drm/i915/vlv_dsi.c       | 14 +++---
>  13 files changed, 122 insertions(+), 112 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/icl_dsi.c b/drivers/gpu/drm/i915/icl_dsi.c
> index f3a5f03646ce..355b48d1c937 100644
> --- a/drivers/gpu/drm/i915/icl_dsi.c
> +++ b/drivers/gpu/drm/i915/icl_dsi.c
> @@ -1188,9 +1188,9 @@ static void gen11_dsi_get_config(struct intel_encoder *encoder,
>  	pipe_config->output_types |= BIT(INTEL_OUTPUT_DSI);
>  }
>  
> -static bool gen11_dsi_compute_config(struct intel_encoder *encoder,
> -				     struct intel_crtc_state *pipe_config,
> -				     struct drm_connector_state *conn_state)
> +static int gen11_dsi_compute_config(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	struct intel_dsi *intel_dsi = container_of(encoder, struct intel_dsi,
>  						   base);
> @@ -1215,7 +1215,7 @@ static bool gen11_dsi_compute_config(struct intel_encoder *encoder,
>  	pipe_config->clock_set = true;
>  	pipe_config->port_clock = intel_dsi_bitrate(intel_dsi) / 5;
>  
> -	return true;
> +	return 0;
>  }
>  
>  static u64 gen11_dsi_get_power_domains(struct intel_encoder *encoder,
> diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
> index 33bd2addcbdd..081c333f30d2 100644
> --- a/drivers/gpu/drm/i915/intel_crt.c
> +++ b/drivers/gpu/drm/i915/intel_crt.c
> @@ -345,51 +345,52 @@ intel_crt_mode_valid(struct drm_connector *connector,
>  	return MODE_OK;
>  }
>  
> -static bool intel_crt_compute_config(struct intel_encoder *encoder,
> -				     struct intel_crtc_state *pipe_config,
> -				     struct drm_connector_state *conn_state)
> +static int intel_crt_compute_config(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	struct drm_display_mode *adjusted_mode =
>  		&pipe_config->base.adjusted_mode;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> -	return true;
> +
> +	return 0;
>  }
>  
> -static bool pch_crt_compute_config(struct intel_encoder *encoder,
> -				   struct intel_crtc_state *pipe_config,
> -				   struct drm_connector_state *conn_state)
> +static int pch_crt_compute_config(struct intel_encoder *encoder,
> +				  struct intel_crtc_state *pipe_config,
> +				  struct drm_connector_state *conn_state)
>  {
>  	struct drm_display_mode *adjusted_mode =
>  		&pipe_config->base.adjusted_mode;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->has_pch_encoder = true;
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
>  
> -	return true;
> +	return 0;
>  }
>  
> -static bool hsw_crt_compute_config(struct intel_encoder *encoder,
> -				   struct intel_crtc_state *pipe_config,
> -				   struct drm_connector_state *conn_state)
> +static int hsw_crt_compute_config(struct intel_encoder *encoder,
> +				  struct intel_crtc_state *pipe_config,
> +				  struct drm_connector_state *conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct drm_display_mode *adjusted_mode =
>  		&pipe_config->base.adjusted_mode;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	/* HSW/BDW FDI limited to 4k */
>  	if (adjusted_mode->crtc_hdisplay > 4096 ||
>  	    adjusted_mode->crtc_hblank_start > 4096)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->has_pch_encoder = true;
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> @@ -398,7 +399,7 @@ static bool hsw_crt_compute_config(struct intel_encoder *encoder,
>  	if (HAS_PCH_LPT(dev_priv)) {
>  		if (pipe_config->bw_constrained && pipe_config->pipe_bpp < 24) {
>  			DRM_DEBUG_KMS("LPT only supports 24bpp\n");
> -			return false;
> +			return -EINVAL;
>  		}
>  
>  		pipe_config->pipe_bpp = 24;
> @@ -407,7 +408,7 @@ static bool hsw_crt_compute_config(struct intel_encoder *encoder,
>  	/* FDI must always be 2.7 GHz */
>  	pipe_config->port_clock = 135000 * 2;
>  
> -	return true;
> +	return 0;
>  }
>  
>  static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector)
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 7f3cd055de50..ce44744a5f9d 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -3837,9 +3837,9 @@ intel_ddi_compute_output_type(struct intel_encoder *encoder,
>  	}
>  }
>  
> -static bool intel_ddi_compute_config(struct intel_encoder *encoder,
> -				     struct intel_crtc_state *pipe_config,
> -				     struct drm_connector_state *conn_state)
> +static int intel_ddi_compute_config(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	enum port port = encoder->port;
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 0a5ba45f5eb0..af164d712e9e 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -11553,10 +11553,13 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
>  			continue;
>  
>  		encoder = to_intel_encoder(connector_state->best_encoder);
> -
> -		if (!(encoder->compute_config(encoder, pipe_config, connector_state))) {
> -			DRM_DEBUG_KMS("Encoder config failure\n");
> -			return -EINVAL;
> +		ret = encoder->compute_config(encoder, pipe_config,
> +					      connector_state);
> +		if (ret < 0) {
> +			if (ret != -EDEADLK)
> +				DRM_DEBUG_KMS("Encoder config failure: %d\n",
> +					      ret);
> +			return ret;
>  		}
>  	}
>  
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 0a3ac98a779e..df4292bb1a4f 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -1819,7 +1819,7 @@ intel_dp_adjust_compliance_config(struct intel_dp *intel_dp,
>  }
>  
>  /* Optimize link config in order: max bpp, min clock, min lanes */
> -static bool
> +static int
>  intel_dp_compute_link_config_wide(struct intel_dp *intel_dp,
>  				  struct intel_crtc_state *pipe_config,
>  				  const struct link_config_limits *limits)
> @@ -1845,17 +1845,17 @@ intel_dp_compute_link_config_wide(struct intel_dp *intel_dp,
>  					pipe_config->pipe_bpp = bpp;
>  					pipe_config->port_clock = link_clock;
>  
> -					return true;
> +					return 0;
>  				}
>  			}
>  		}
>  	}
>  
> -	return false;
> +	return -EINVAL;
>  }
>  
>  /* Optimize link config in order: max bpp, min lanes, min clock */
> -static bool
> +static int
>  intel_dp_compute_link_config_fast(struct intel_dp *intel_dp,
>  				  struct intel_crtc_state *pipe_config,
>  				  const struct link_config_limits *limits)
> @@ -1881,13 +1881,13 @@ intel_dp_compute_link_config_fast(struct intel_dp *intel_dp,
>  					pipe_config->pipe_bpp = bpp;
>  					pipe_config->port_clock = link_clock;
>  
> -					return true;
> +					return 0;
>  				}
>  			}
>  		}
>  	}
>  
> -	return false;
> +	return -EINVAL;
>  }
>  
>  static int intel_dp_dsc_compute_bpp(struct intel_dp *intel_dp, u8 dsc_max_bpc)
> @@ -1905,19 +1905,20 @@ static int intel_dp_dsc_compute_bpp(struct intel_dp *intel_dp, u8 dsc_max_bpc)
>  	return 0;
>  }
>  
> -static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
> -					struct intel_crtc_state *pipe_config,
> -					struct drm_connector_state *conn_state,
> -					struct link_config_limits *limits)
> +static int intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
> +				       struct intel_crtc_state *pipe_config,
> +				       struct drm_connector_state *conn_state,
> +				       struct link_config_limits *limits)
>  {
>  	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
>  	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
>  	struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
>  	u8 dsc_max_bpc;
>  	int pipe_bpp;
> +	int ret;
>  
>  	if (!intel_dp_supports_dsc(intel_dp, pipe_config))
> -		return false;
> +		return -EINVAL;
>  
>  	dsc_max_bpc = min_t(u8, DP_DSC_MAX_SUPPORTED_BPC,
>  			    conn_state->max_requested_bpc);
> @@ -1925,7 +1926,7 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
>  	pipe_bpp = intel_dp_dsc_compute_bpp(intel_dp, dsc_max_bpc);
>  	if (pipe_bpp < DP_DSC_MIN_SUPPORTED_BPC * 3) {
>  		DRM_DEBUG_KMS("No DSC support for less than 8bpc\n");
> -		return false;
> +		return -EINVAL;
>  	}
>  
>  	/*
> @@ -1959,7 +1960,7 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
>  						     adjusted_mode->crtc_hdisplay);
>  		if (!dsc_max_output_bpp || !dsc_dp_slice_count) {
>  			DRM_DEBUG_KMS("Compressed BPP/Slice Count not supported\n");
> -			return false;
> +			return -EINVAL;
>  		}
>  		pipe_config->dsc_params.compressed_bpp = min_t(u16,
>  							       dsc_max_output_bpp >> 4,
> @@ -1976,16 +1977,19 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
>  			pipe_config->dsc_params.dsc_split = true;
>  		} else {
>  			DRM_DEBUG_KMS("Cannot split stream to use 2 VDSC instances\n");
> -			return false;
> +			return -EINVAL;
>  		}
>  	}
> -	if (intel_dp_compute_dsc_params(intel_dp, pipe_config) < 0) {
> +
> +	ret = intel_dp_compute_dsc_params(intel_dp, pipe_config);
> +	if (ret < 0) {
>  		DRM_DEBUG_KMS("Cannot compute valid DSC parameters for Input Bpp = %d "
>  			      "Compressed BPP = %d\n",
>  			      pipe_config->pipe_bpp,
>  			      pipe_config->dsc_params.compressed_bpp);
> -		return false;
> +		return ret;
>  	}
> +
>  	pipe_config->dsc_params.compression_enable = true;
>  	DRM_DEBUG_KMS("DP DSC computed with Input Bpp = %d "
>  		      "Compressed Bpp = %d Slice Count = %d\n",
> @@ -1993,10 +1997,10 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
>  		      pipe_config->dsc_params.compressed_bpp,
>  		      pipe_config->dsc_params.slice_count);
>  
> -	return true;
> +	return 0;
>  }
>  
> -static bool
> +static int
>  intel_dp_compute_link_config(struct intel_encoder *encoder,
>  			     struct intel_crtc_state *pipe_config,
>  			     struct drm_connector_state *conn_state)
> @@ -2005,7 +2009,7 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
>  	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
>  	struct link_config_limits limits;
>  	int common_len;
> -	bool ret;
> +	int ret;
>  
>  	common_len = intel_dp_common_len_rate_limit(intel_dp,
>  						    intel_dp->max_link_rate);
> @@ -2063,10 +2067,11 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
>  
>  	/* enable compression if the mode doesn't fit available BW */
>  	DRM_DEBUG_KMS("Force DSC en = %d\n", intel_dp->force_dsc_en);
> -	if (!ret || intel_dp->force_dsc_en) {
> -		if (!intel_dp_dsc_compute_config(intel_dp, pipe_config,
> -						 conn_state, &limits))
> -			return false;
> +	if (ret || intel_dp->force_dsc_en) {
> +		ret = intel_dp_dsc_compute_config(intel_dp, pipe_config,
> +						  conn_state, &limits);
> +		if (ret < 0)
> +			return ret;
>  	}
>  
>  	if (pipe_config->dsc_params.compression_enable) {
> @@ -2091,10 +2096,10 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
>  			      intel_dp_max_data_rate(pipe_config->port_clock,
>  						     pipe_config->lane_count));
>  	}
> -	return true;
> +	return 0;
>  }
>  
> -bool
> +int
>  intel_dp_compute_config(struct intel_encoder *encoder,
>  			struct intel_crtc_state *pipe_config,
>  			struct drm_connector_state *conn_state)
> @@ -2110,6 +2115,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>  		to_intel_digital_connector_state(conn_state);
>  	bool constant_n = drm_dp_has_quirk(&intel_dp->desc,
>  					   DP_DPCD_QUIRK_CONSTANT_N);
> +	int ret;
>  
>  	if (HAS_PCH_SPLIT(dev_priv) && !HAS_DDI(dev_priv) && port != PORT_A)
>  		pipe_config->has_pch_encoder = true;
> @@ -2131,8 +2137,6 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>  				       adjusted_mode);
>  
>  		if (INTEL_GEN(dev_priv) >= 9) {
> -			int ret;
> -
>  			ret = skl_update_scaler_crtc(pipe_config);
>  			if (ret)
>  				return ret;
> @@ -2147,20 +2151,21 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>  	}
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	if (HAS_GMCH_DISPLAY(dev_priv) &&
>  	    adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
> -		return false;
> +		return -EINVAL;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->fec_enable = !intel_dp_is_edp(intel_dp) &&
>  				  intel_dp_supports_fec(intel_dp, pipe_config);
>  
> -	if (!intel_dp_compute_link_config(encoder, pipe_config, conn_state))
> -		return false;
> +	ret = intel_dp_compute_link_config(encoder, pipe_config, conn_state);
> +	if (ret < 0)
> +		return ret;
>  
>  	if (intel_conn_state->broadcast_rgb == INTEL_BROADCAST_RGB_AUTO) {
>  		/*
> @@ -2208,7 +2213,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>  
>  	intel_psr_compute_config(intel_dp, pipe_config);
>  
> -	return true;
> +	return 0;
>  }
>  
>  void intel_dp_set_link_params(struct intel_dp *intel_dp,
> diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
> index 3f83429333c7..a19699023db1 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -29,9 +29,9 @@
>  #include <drm/drm_crtc_helper.h>
>  #include <drm/drm_edid.h>
>  
> -static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
> -					struct intel_crtc_state *pipe_config,
> -					struct drm_connector_state *conn_state)
> +static int intel_dp_mst_compute_config(struct intel_encoder *encoder,
> +				       struct intel_crtc_state *pipe_config,
> +				       struct drm_connector_state *conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
> @@ -52,7 +52,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
>  					   DP_DPCD_QUIRK_CONSTANT_N);
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
>  	pipe_config->has_pch_encoder = false;
> @@ -89,7 +89,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
>  		if (slots < 0) {
>  			DRM_DEBUG_KMS("failed finding vcpi slots:%d\n",
>  				      slots);
> -			return false;
> +			return slots;
>  		}
>  	}
>  
> @@ -107,7 +107,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
>  
>  	intel_ddi_compute_min_voltage_level(dev_priv, pipe_config);
>  
> -	return true;
> +	return 0;
>  }
>  
>  static int
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 7977843ce26a..e5a436c33307 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -225,9 +225,9 @@ struct intel_encoder {
>  	enum intel_output_type (*compute_output_type)(struct intel_encoder *,
>  						      struct intel_crtc_state *,
>  						      struct drm_connector_state *);
> -	bool (*compute_config)(struct intel_encoder *,
> -			       struct intel_crtc_state *,
> -			       struct drm_connector_state *);
> +	int (*compute_config)(struct intel_encoder *,
> +			      struct intel_crtc_state *,
> +			      struct drm_connector_state *);
>  	void (*pre_pll_enable)(struct intel_encoder *,
>  			       const struct intel_crtc_state *,
>  			       const struct drm_connector_state *);
> @@ -1816,9 +1816,9 @@ void intel_dp_sink_set_decompression_state(struct intel_dp *intel_dp,
>  void intel_dp_encoder_reset(struct drm_encoder *encoder);
>  void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
>  void intel_dp_encoder_flush_work(struct drm_encoder *encoder);
> -bool intel_dp_compute_config(struct intel_encoder *encoder,
> -			     struct intel_crtc_state *pipe_config,
> -			     struct drm_connector_state *conn_state);
> +int intel_dp_compute_config(struct intel_encoder *encoder,
> +			    struct intel_crtc_state *pipe_config,
> +			    struct drm_connector_state *conn_state);
>  bool intel_dp_is_edp(struct intel_dp *intel_dp);
>  bool intel_dp_is_port_edp(struct drm_i915_private *dev_priv, enum port port);
>  enum irqreturn intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port,
> @@ -1978,9 +1978,9 @@ void intel_hdmi_init(struct drm_i915_private *dev_priv, i915_reg_t hdmi_reg,
>  void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
>  			       struct intel_connector *intel_connector);
>  struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder);
> -bool intel_hdmi_compute_config(struct intel_encoder *encoder,
> -			       struct intel_crtc_state *pipe_config,
> -			       struct drm_connector_state *conn_state);
> +int intel_hdmi_compute_config(struct intel_encoder *encoder,
> +			      struct intel_crtc_state *pipe_config,
> +			      struct drm_connector_state *conn_state);
>  bool intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder,
>  				       struct drm_connector *connector,
>  				       bool high_tmds_clock_ratio,
> diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
> index bc3c3cb57ec6..a6c82482a841 100644
> --- a/drivers/gpu/drm/i915/intel_dvo.c
> +++ b/drivers/gpu/drm/i915/intel_dvo.c
> @@ -234,9 +234,9 @@ intel_dvo_mode_valid(struct drm_connector *connector,
>  	return intel_dvo->dev.dev_ops->mode_valid(&intel_dvo->dev, mode);
>  }
>  
> -static bool intel_dvo_compute_config(struct intel_encoder *encoder,
> -				     struct intel_crtc_state *pipe_config,
> -				     struct drm_connector_state *conn_state)
> +static int intel_dvo_compute_config(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	struct intel_dvo *intel_dvo = enc_to_dvo(encoder);
>  	const struct drm_display_mode *fixed_mode =
> @@ -253,10 +253,11 @@ static bool intel_dvo_compute_config(struct intel_encoder *encoder,
>  		intel_fixed_panel_mode(fixed_mode, adjusted_mode);
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> -	return true;
> +
> +	return 0;
>  }
>  
>  static void intel_dvo_pre_enable(struct intel_encoder *encoder,
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 74f4021b760c..97a98e1bea56 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -1704,9 +1704,9 @@ intel_hdmi_ycbcr420_config(struct drm_connector *connector,
>  	return true;
>  }
>  
> -bool intel_hdmi_compute_config(struct intel_encoder *encoder,
> -			       struct intel_crtc_state *pipe_config,
> -			       struct drm_connector_state *conn_state)
> +int intel_hdmi_compute_config(struct intel_encoder *encoder,
> +			      struct intel_crtc_state *pipe_config,
> +			      struct drm_connector_state *conn_state)
>  {
>  	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> @@ -1722,7 +1722,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
>  	bool force_dvi = intel_conn_state->force_audio == HDMI_AUDIO_OFF_DVI;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
>  	pipe_config->has_hdmi_sink = !force_dvi && intel_hdmi->has_hdmi_sink;
> @@ -1753,7 +1753,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
>  						&clock_12bpc, &clock_10bpc,
>  						&clock_8bpc)) {
>  			DRM_ERROR("Can't support YCBCR420 output\n");
> -			return false;
> +			return -EINVAL;
>  		}
>  	}
>  
> @@ -1803,7 +1803,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
>  	if (hdmi_port_clock_valid(intel_hdmi, pipe_config->port_clock,
>  				  false, force_dvi) != MODE_OK) {
>  		DRM_DEBUG_KMS("unsupported HDMI clock, rejecting mode\n");
> -		return false;
> +		return -EINVAL;
>  	}
>  
>  	/* Set user selected PAR to incoming mode's member */
> @@ -1822,7 +1822,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
>  		}
>  	}
>  
> -	return true;
> +	return 0;
>  }
>  
>  static void
> diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
> index b01aacb5d73d..46a5dfd5cdf7 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -380,9 +380,9 @@ intel_lvds_mode_valid(struct drm_connector *connector,
>  	return MODE_OK;
>  }
>  
> -static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
> -				      struct intel_crtc_state *pipe_config,
> -				      struct drm_connector_state *conn_state)
> +static int intel_lvds_compute_config(struct intel_encoder *intel_encoder,
> +				     struct intel_crtc_state *pipe_config,
> +				     struct drm_connector_state *conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(intel_encoder->base.dev);
>  	struct intel_lvds_encoder *lvds_encoder =
> @@ -396,7 +396,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
>  	/* Should never happen!! */
>  	if (INTEL_GEN(dev_priv) < 4 && intel_crtc->pipe == 0) {
>  		DRM_ERROR("Can't support LVDS on pipe A\n");
> -		return false;
> +		return -EINVAL;
>  	}
>  
>  	if (lvds_encoder->a3_power == LVDS_A3_POWER_UP)
> @@ -422,7 +422,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
>  			       adjusted_mode);
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	if (HAS_PCH_SPLIT(dev_priv)) {
>  		pipe_config->has_pch_encoder = true;
> @@ -441,7 +441,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
>  	 * user's requested refresh rate.
>  	 */
>  
> -	return true;
> +	return 0;
>  }
>  
>  static enum drm_connector_status
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> index 4db7aefa88f9..df2d830a7405 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -1107,9 +1107,9 @@ static void i9xx_adjust_sdvo_tv_clock(struct intel_crtc_state *pipe_config)
>  	pipe_config->clock_set = true;
>  }
>  
> -static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
> -				      struct intel_crtc_state *pipe_config,
> -				      struct drm_connector_state *conn_state)
> +static int intel_sdvo_compute_config(struct intel_encoder *encoder,
> +				     struct intel_crtc_state *pipe_config,
> +				     struct drm_connector_state *conn_state)
>  {
>  	struct intel_sdvo *intel_sdvo = to_sdvo(encoder);
>  	struct intel_sdvo_connector_state *intel_sdvo_state =
> @@ -1134,7 +1134,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
>  	 */
>  	if (IS_TV(intel_sdvo_connector)) {
>  		if (!intel_sdvo_set_output_timings_from_mode(intel_sdvo, mode))
> -			return false;
> +			return -EINVAL;
>  
>  		(void) intel_sdvo_get_preferred_input_mode(intel_sdvo,
>  							   intel_sdvo_connector,
> @@ -1144,7 +1144,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
>  	} else if (IS_LVDS(intel_sdvo_connector)) {
>  		if (!intel_sdvo_set_output_timings_from_mode(intel_sdvo,
>  							     intel_sdvo_connector->base.panel.fixed_mode))
> -			return false;
> +			return -EINVAL;
>  
>  		(void) intel_sdvo_get_preferred_input_mode(intel_sdvo,
>  							   intel_sdvo_connector,
> @@ -1153,7 +1153,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
>  	}
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	/*
>  	 * Make the CRTC code factor in the SDVO pixel multiplier.  The
> @@ -1193,7 +1193,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
>  	if (intel_sdvo_connector->is_hdmi)
>  		adjusted_mode->picture_aspect_ratio = conn_state->picture_aspect_ratio;
>  
> -	return true;
> +	return 0;
>  }
>  
>  #define UPDATE_PROPERTY(input, NAME) \
> diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
> index d7a414ce2774..bd5536f0ec92 100644
> --- a/drivers/gpu/drm/i915/intel_tv.c
> +++ b/drivers/gpu/drm/i915/intel_tv.c
> @@ -869,7 +869,7 @@ intel_tv_get_config(struct intel_encoder *encoder,
>  	pipe_config->base.adjusted_mode.crtc_clock = pipe_config->port_clock;
>  }
>  
> -static bool
> +static int
>  intel_tv_compute_config(struct intel_encoder *encoder,
>  			struct intel_crtc_state *pipe_config,
>  			struct drm_connector_state *conn_state)
> @@ -879,10 +879,10 @@ intel_tv_compute_config(struct intel_encoder *encoder,
>  		&pipe_config->base.adjusted_mode;
>  
>  	if (!tv_mode)
> -		return false;
> +		return -EINVAL;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
>  	adjusted_mode->crtc_clock = tv_mode->clock;
> @@ -897,7 +897,7 @@ intel_tv_compute_config(struct intel_encoder *encoder,
>  	 * or whether userspace is doing something stupid.
>  	 */
>  
> -	return true;
> +	return 0;
>  }
>  
>  static void
> diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
> index d116fead8514..c247ce74b71a 100644
> --- a/drivers/gpu/drm/i915/vlv_dsi.c
> +++ b/drivers/gpu/drm/i915/vlv_dsi.c
> @@ -256,9 +256,9 @@ static void band_gap_reset(struct drm_i915_private *dev_priv)
>  	mutex_unlock(&dev_priv->sb_lock);
>  }
>  
> -static bool intel_dsi_compute_config(struct intel_encoder *encoder,
> -				     struct intel_crtc_state *pipe_config,
> -				     struct drm_connector_state *conn_state)
> +static int intel_dsi_compute_config(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct intel_dsi *intel_dsi = container_of(encoder, struct intel_dsi,
> @@ -284,7 +284,7 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
>  	}
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	/* DSI uses short packets for sync events, so clear mode flags for DSI */
>  	adjusted_mode->flags = 0;
> @@ -302,16 +302,16 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
>  
>  		ret = bxt_dsi_pll_compute(encoder, pipe_config);
>  		if (ret)
> -			return false;
> +			return -EINVAL;
>  	} else {
>  		ret = vlv_dsi_pll_compute(encoder, pipe_config);
>  		if (ret)
> -			return false;
> +			return -EINVAL;
>  	}
>  
>  	pipe_config->clock_set = true;
>  
> -	return true;
> +	return 0;
>  }
>  
>  static bool glk_dsi_enable_io(struct intel_encoder *encoder)
> -- 
> 2.20.1

-- 
Ville Syrjälä
Intel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] drm/i915: Pass down rc in intel_encoder->compute_config()
@ 2019-01-15 20:19   ` Ville Syrjälä
  0 siblings, 0 replies; 12+ messages in thread
From: Ville Syrjälä @ 2019-01-15 20:19 UTC (permalink / raw)
  To: Lyude Paul; +Cc: David Airlie, intel-gfx, linux-kernel, dri-devel

On Tue, Jan 15, 2019 at 03:08:00PM -0500, Lyude Paul wrote:
> Something that I completely missed when implementing the new MST VCPI
> atomic helpers is that with those helpers, there's technically a chance
> of us having to grab additional modeset locks in ->compute_config() and
> furthermore, that means we have the potential to hit a normal modeset
> deadlock. However, because ->compute_config() only returns a bool this
> means we can't return -EDEADLK when we need to drop locks and try again
> which means we end up just failing the atomic check permanently. Whoops.
> 
> So, fix this by modifying ->compute_config() to pass down an actual
> error code instead of a bool so that the atomic check can be restarted
> on modeset deadlocks.
> 
> Thanks to Ville Syrjälä for pointing this out!
> 
> Changes since v1:
> * Add some newlines
> * Return only -EINVAL from hsw_crt_compute_config()
> * Propogate return code from intel_dp_compute_dsc_params()
> * Change all of the intel_dp_compute_link_config*() variants
> * Don't miss if (hdmi_port_clock_valid()) branch in
>   intel_hdmi_compute_config()
> 
> Signed-off-by: Lyude Paul <lyude@redhat.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Fixes: eceae1472467 ("drm/dp_mst: Start tracking per-port VCPI allocations")
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109320

Patch looks great. Hopefully we got them all.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/icl_dsi.c       |  8 ++--
>  drivers/gpu/drm/i915/intel_crt.c     | 35 +++++++-------
>  drivers/gpu/drm/i915/intel_ddi.c     |  6 +--
>  drivers/gpu/drm/i915/intel_display.c | 11 +++--
>  drivers/gpu/drm/i915/intel_dp.c      | 71 +++++++++++++++-------------
>  drivers/gpu/drm/i915/intel_dp_mst.c  | 12 ++---
>  drivers/gpu/drm/i915/intel_drv.h     | 18 +++----
>  drivers/gpu/drm/i915/intel_dvo.c     | 11 +++--
>  drivers/gpu/drm/i915/intel_hdmi.c    | 14 +++---
>  drivers/gpu/drm/i915/intel_lvds.c    | 12 ++---
>  drivers/gpu/drm/i915/intel_sdvo.c    | 14 +++---
>  drivers/gpu/drm/i915/intel_tv.c      |  8 ++--
>  drivers/gpu/drm/i915/vlv_dsi.c       | 14 +++---
>  13 files changed, 122 insertions(+), 112 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/icl_dsi.c b/drivers/gpu/drm/i915/icl_dsi.c
> index f3a5f03646ce..355b48d1c937 100644
> --- a/drivers/gpu/drm/i915/icl_dsi.c
> +++ b/drivers/gpu/drm/i915/icl_dsi.c
> @@ -1188,9 +1188,9 @@ static void gen11_dsi_get_config(struct intel_encoder *encoder,
>  	pipe_config->output_types |= BIT(INTEL_OUTPUT_DSI);
>  }
>  
> -static bool gen11_dsi_compute_config(struct intel_encoder *encoder,
> -				     struct intel_crtc_state *pipe_config,
> -				     struct drm_connector_state *conn_state)
> +static int gen11_dsi_compute_config(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	struct intel_dsi *intel_dsi = container_of(encoder, struct intel_dsi,
>  						   base);
> @@ -1215,7 +1215,7 @@ static bool gen11_dsi_compute_config(struct intel_encoder *encoder,
>  	pipe_config->clock_set = true;
>  	pipe_config->port_clock = intel_dsi_bitrate(intel_dsi) / 5;
>  
> -	return true;
> +	return 0;
>  }
>  
>  static u64 gen11_dsi_get_power_domains(struct intel_encoder *encoder,
> diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
> index 33bd2addcbdd..081c333f30d2 100644
> --- a/drivers/gpu/drm/i915/intel_crt.c
> +++ b/drivers/gpu/drm/i915/intel_crt.c
> @@ -345,51 +345,52 @@ intel_crt_mode_valid(struct drm_connector *connector,
>  	return MODE_OK;
>  }
>  
> -static bool intel_crt_compute_config(struct intel_encoder *encoder,
> -				     struct intel_crtc_state *pipe_config,
> -				     struct drm_connector_state *conn_state)
> +static int intel_crt_compute_config(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	struct drm_display_mode *adjusted_mode =
>  		&pipe_config->base.adjusted_mode;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> -	return true;
> +
> +	return 0;
>  }
>  
> -static bool pch_crt_compute_config(struct intel_encoder *encoder,
> -				   struct intel_crtc_state *pipe_config,
> -				   struct drm_connector_state *conn_state)
> +static int pch_crt_compute_config(struct intel_encoder *encoder,
> +				  struct intel_crtc_state *pipe_config,
> +				  struct drm_connector_state *conn_state)
>  {
>  	struct drm_display_mode *adjusted_mode =
>  		&pipe_config->base.adjusted_mode;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->has_pch_encoder = true;
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
>  
> -	return true;
> +	return 0;
>  }
>  
> -static bool hsw_crt_compute_config(struct intel_encoder *encoder,
> -				   struct intel_crtc_state *pipe_config,
> -				   struct drm_connector_state *conn_state)
> +static int hsw_crt_compute_config(struct intel_encoder *encoder,
> +				  struct intel_crtc_state *pipe_config,
> +				  struct drm_connector_state *conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct drm_display_mode *adjusted_mode =
>  		&pipe_config->base.adjusted_mode;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	/* HSW/BDW FDI limited to 4k */
>  	if (adjusted_mode->crtc_hdisplay > 4096 ||
>  	    adjusted_mode->crtc_hblank_start > 4096)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->has_pch_encoder = true;
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> @@ -398,7 +399,7 @@ static bool hsw_crt_compute_config(struct intel_encoder *encoder,
>  	if (HAS_PCH_LPT(dev_priv)) {
>  		if (pipe_config->bw_constrained && pipe_config->pipe_bpp < 24) {
>  			DRM_DEBUG_KMS("LPT only supports 24bpp\n");
> -			return false;
> +			return -EINVAL;
>  		}
>  
>  		pipe_config->pipe_bpp = 24;
> @@ -407,7 +408,7 @@ static bool hsw_crt_compute_config(struct intel_encoder *encoder,
>  	/* FDI must always be 2.7 GHz */
>  	pipe_config->port_clock = 135000 * 2;
>  
> -	return true;
> +	return 0;
>  }
>  
>  static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector)
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 7f3cd055de50..ce44744a5f9d 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -3837,9 +3837,9 @@ intel_ddi_compute_output_type(struct intel_encoder *encoder,
>  	}
>  }
>  
> -static bool intel_ddi_compute_config(struct intel_encoder *encoder,
> -				     struct intel_crtc_state *pipe_config,
> -				     struct drm_connector_state *conn_state)
> +static int intel_ddi_compute_config(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	enum port port = encoder->port;
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 0a5ba45f5eb0..af164d712e9e 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -11553,10 +11553,13 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
>  			continue;
>  
>  		encoder = to_intel_encoder(connector_state->best_encoder);
> -
> -		if (!(encoder->compute_config(encoder, pipe_config, connector_state))) {
> -			DRM_DEBUG_KMS("Encoder config failure\n");
> -			return -EINVAL;
> +		ret = encoder->compute_config(encoder, pipe_config,
> +					      connector_state);
> +		if (ret < 0) {
> +			if (ret != -EDEADLK)
> +				DRM_DEBUG_KMS("Encoder config failure: %d\n",
> +					      ret);
> +			return ret;
>  		}
>  	}
>  
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 0a3ac98a779e..df4292bb1a4f 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -1819,7 +1819,7 @@ intel_dp_adjust_compliance_config(struct intel_dp *intel_dp,
>  }
>  
>  /* Optimize link config in order: max bpp, min clock, min lanes */
> -static bool
> +static int
>  intel_dp_compute_link_config_wide(struct intel_dp *intel_dp,
>  				  struct intel_crtc_state *pipe_config,
>  				  const struct link_config_limits *limits)
> @@ -1845,17 +1845,17 @@ intel_dp_compute_link_config_wide(struct intel_dp *intel_dp,
>  					pipe_config->pipe_bpp = bpp;
>  					pipe_config->port_clock = link_clock;
>  
> -					return true;
> +					return 0;
>  				}
>  			}
>  		}
>  	}
>  
> -	return false;
> +	return -EINVAL;
>  }
>  
>  /* Optimize link config in order: max bpp, min lanes, min clock */
> -static bool
> +static int
>  intel_dp_compute_link_config_fast(struct intel_dp *intel_dp,
>  				  struct intel_crtc_state *pipe_config,
>  				  const struct link_config_limits *limits)
> @@ -1881,13 +1881,13 @@ intel_dp_compute_link_config_fast(struct intel_dp *intel_dp,
>  					pipe_config->pipe_bpp = bpp;
>  					pipe_config->port_clock = link_clock;
>  
> -					return true;
> +					return 0;
>  				}
>  			}
>  		}
>  	}
>  
> -	return false;
> +	return -EINVAL;
>  }
>  
>  static int intel_dp_dsc_compute_bpp(struct intel_dp *intel_dp, u8 dsc_max_bpc)
> @@ -1905,19 +1905,20 @@ static int intel_dp_dsc_compute_bpp(struct intel_dp *intel_dp, u8 dsc_max_bpc)
>  	return 0;
>  }
>  
> -static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
> -					struct intel_crtc_state *pipe_config,
> -					struct drm_connector_state *conn_state,
> -					struct link_config_limits *limits)
> +static int intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
> +				       struct intel_crtc_state *pipe_config,
> +				       struct drm_connector_state *conn_state,
> +				       struct link_config_limits *limits)
>  {
>  	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
>  	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
>  	struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
>  	u8 dsc_max_bpc;
>  	int pipe_bpp;
> +	int ret;
>  
>  	if (!intel_dp_supports_dsc(intel_dp, pipe_config))
> -		return false;
> +		return -EINVAL;
>  
>  	dsc_max_bpc = min_t(u8, DP_DSC_MAX_SUPPORTED_BPC,
>  			    conn_state->max_requested_bpc);
> @@ -1925,7 +1926,7 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
>  	pipe_bpp = intel_dp_dsc_compute_bpp(intel_dp, dsc_max_bpc);
>  	if (pipe_bpp < DP_DSC_MIN_SUPPORTED_BPC * 3) {
>  		DRM_DEBUG_KMS("No DSC support for less than 8bpc\n");
> -		return false;
> +		return -EINVAL;
>  	}
>  
>  	/*
> @@ -1959,7 +1960,7 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
>  						     adjusted_mode->crtc_hdisplay);
>  		if (!dsc_max_output_bpp || !dsc_dp_slice_count) {
>  			DRM_DEBUG_KMS("Compressed BPP/Slice Count not supported\n");
> -			return false;
> +			return -EINVAL;
>  		}
>  		pipe_config->dsc_params.compressed_bpp = min_t(u16,
>  							       dsc_max_output_bpp >> 4,
> @@ -1976,16 +1977,19 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
>  			pipe_config->dsc_params.dsc_split = true;
>  		} else {
>  			DRM_DEBUG_KMS("Cannot split stream to use 2 VDSC instances\n");
> -			return false;
> +			return -EINVAL;
>  		}
>  	}
> -	if (intel_dp_compute_dsc_params(intel_dp, pipe_config) < 0) {
> +
> +	ret = intel_dp_compute_dsc_params(intel_dp, pipe_config);
> +	if (ret < 0) {
>  		DRM_DEBUG_KMS("Cannot compute valid DSC parameters for Input Bpp = %d "
>  			      "Compressed BPP = %d\n",
>  			      pipe_config->pipe_bpp,
>  			      pipe_config->dsc_params.compressed_bpp);
> -		return false;
> +		return ret;
>  	}
> +
>  	pipe_config->dsc_params.compression_enable = true;
>  	DRM_DEBUG_KMS("DP DSC computed with Input Bpp = %d "
>  		      "Compressed Bpp = %d Slice Count = %d\n",
> @@ -1993,10 +1997,10 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
>  		      pipe_config->dsc_params.compressed_bpp,
>  		      pipe_config->dsc_params.slice_count);
>  
> -	return true;
> +	return 0;
>  }
>  
> -static bool
> +static int
>  intel_dp_compute_link_config(struct intel_encoder *encoder,
>  			     struct intel_crtc_state *pipe_config,
>  			     struct drm_connector_state *conn_state)
> @@ -2005,7 +2009,7 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
>  	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
>  	struct link_config_limits limits;
>  	int common_len;
> -	bool ret;
> +	int ret;
>  
>  	common_len = intel_dp_common_len_rate_limit(intel_dp,
>  						    intel_dp->max_link_rate);
> @@ -2063,10 +2067,11 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
>  
>  	/* enable compression if the mode doesn't fit available BW */
>  	DRM_DEBUG_KMS("Force DSC en = %d\n", intel_dp->force_dsc_en);
> -	if (!ret || intel_dp->force_dsc_en) {
> -		if (!intel_dp_dsc_compute_config(intel_dp, pipe_config,
> -						 conn_state, &limits))
> -			return false;
> +	if (ret || intel_dp->force_dsc_en) {
> +		ret = intel_dp_dsc_compute_config(intel_dp, pipe_config,
> +						  conn_state, &limits);
> +		if (ret < 0)
> +			return ret;
>  	}
>  
>  	if (pipe_config->dsc_params.compression_enable) {
> @@ -2091,10 +2096,10 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
>  			      intel_dp_max_data_rate(pipe_config->port_clock,
>  						     pipe_config->lane_count));
>  	}
> -	return true;
> +	return 0;
>  }
>  
> -bool
> +int
>  intel_dp_compute_config(struct intel_encoder *encoder,
>  			struct intel_crtc_state *pipe_config,
>  			struct drm_connector_state *conn_state)
> @@ -2110,6 +2115,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>  		to_intel_digital_connector_state(conn_state);
>  	bool constant_n = drm_dp_has_quirk(&intel_dp->desc,
>  					   DP_DPCD_QUIRK_CONSTANT_N);
> +	int ret;
>  
>  	if (HAS_PCH_SPLIT(dev_priv) && !HAS_DDI(dev_priv) && port != PORT_A)
>  		pipe_config->has_pch_encoder = true;
> @@ -2131,8 +2137,6 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>  				       adjusted_mode);
>  
>  		if (INTEL_GEN(dev_priv) >= 9) {
> -			int ret;
> -
>  			ret = skl_update_scaler_crtc(pipe_config);
>  			if (ret)
>  				return ret;
> @@ -2147,20 +2151,21 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>  	}
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	if (HAS_GMCH_DISPLAY(dev_priv) &&
>  	    adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
> -		return false;
> +		return -EINVAL;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->fec_enable = !intel_dp_is_edp(intel_dp) &&
>  				  intel_dp_supports_fec(intel_dp, pipe_config);
>  
> -	if (!intel_dp_compute_link_config(encoder, pipe_config, conn_state))
> -		return false;
> +	ret = intel_dp_compute_link_config(encoder, pipe_config, conn_state);
> +	if (ret < 0)
> +		return ret;
>  
>  	if (intel_conn_state->broadcast_rgb == INTEL_BROADCAST_RGB_AUTO) {
>  		/*
> @@ -2208,7 +2213,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>  
>  	intel_psr_compute_config(intel_dp, pipe_config);
>  
> -	return true;
> +	return 0;
>  }
>  
>  void intel_dp_set_link_params(struct intel_dp *intel_dp,
> diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
> index 3f83429333c7..a19699023db1 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -29,9 +29,9 @@
>  #include <drm/drm_crtc_helper.h>
>  #include <drm/drm_edid.h>
>  
> -static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
> -					struct intel_crtc_state *pipe_config,
> -					struct drm_connector_state *conn_state)
> +static int intel_dp_mst_compute_config(struct intel_encoder *encoder,
> +				       struct intel_crtc_state *pipe_config,
> +				       struct drm_connector_state *conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
> @@ -52,7 +52,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
>  					   DP_DPCD_QUIRK_CONSTANT_N);
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
>  	pipe_config->has_pch_encoder = false;
> @@ -89,7 +89,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
>  		if (slots < 0) {
>  			DRM_DEBUG_KMS("failed finding vcpi slots:%d\n",
>  				      slots);
> -			return false;
> +			return slots;
>  		}
>  	}
>  
> @@ -107,7 +107,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
>  
>  	intel_ddi_compute_min_voltage_level(dev_priv, pipe_config);
>  
> -	return true;
> +	return 0;
>  }
>  
>  static int
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 7977843ce26a..e5a436c33307 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -225,9 +225,9 @@ struct intel_encoder {
>  	enum intel_output_type (*compute_output_type)(struct intel_encoder *,
>  						      struct intel_crtc_state *,
>  						      struct drm_connector_state *);
> -	bool (*compute_config)(struct intel_encoder *,
> -			       struct intel_crtc_state *,
> -			       struct drm_connector_state *);
> +	int (*compute_config)(struct intel_encoder *,
> +			      struct intel_crtc_state *,
> +			      struct drm_connector_state *);
>  	void (*pre_pll_enable)(struct intel_encoder *,
>  			       const struct intel_crtc_state *,
>  			       const struct drm_connector_state *);
> @@ -1816,9 +1816,9 @@ void intel_dp_sink_set_decompression_state(struct intel_dp *intel_dp,
>  void intel_dp_encoder_reset(struct drm_encoder *encoder);
>  void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
>  void intel_dp_encoder_flush_work(struct drm_encoder *encoder);
> -bool intel_dp_compute_config(struct intel_encoder *encoder,
> -			     struct intel_crtc_state *pipe_config,
> -			     struct drm_connector_state *conn_state);
> +int intel_dp_compute_config(struct intel_encoder *encoder,
> +			    struct intel_crtc_state *pipe_config,
> +			    struct drm_connector_state *conn_state);
>  bool intel_dp_is_edp(struct intel_dp *intel_dp);
>  bool intel_dp_is_port_edp(struct drm_i915_private *dev_priv, enum port port);
>  enum irqreturn intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port,
> @@ -1978,9 +1978,9 @@ void intel_hdmi_init(struct drm_i915_private *dev_priv, i915_reg_t hdmi_reg,
>  void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
>  			       struct intel_connector *intel_connector);
>  struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder);
> -bool intel_hdmi_compute_config(struct intel_encoder *encoder,
> -			       struct intel_crtc_state *pipe_config,
> -			       struct drm_connector_state *conn_state);
> +int intel_hdmi_compute_config(struct intel_encoder *encoder,
> +			      struct intel_crtc_state *pipe_config,
> +			      struct drm_connector_state *conn_state);
>  bool intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder,
>  				       struct drm_connector *connector,
>  				       bool high_tmds_clock_ratio,
> diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
> index bc3c3cb57ec6..a6c82482a841 100644
> --- a/drivers/gpu/drm/i915/intel_dvo.c
> +++ b/drivers/gpu/drm/i915/intel_dvo.c
> @@ -234,9 +234,9 @@ intel_dvo_mode_valid(struct drm_connector *connector,
>  	return intel_dvo->dev.dev_ops->mode_valid(&intel_dvo->dev, mode);
>  }
>  
> -static bool intel_dvo_compute_config(struct intel_encoder *encoder,
> -				     struct intel_crtc_state *pipe_config,
> -				     struct drm_connector_state *conn_state)
> +static int intel_dvo_compute_config(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	struct intel_dvo *intel_dvo = enc_to_dvo(encoder);
>  	const struct drm_display_mode *fixed_mode =
> @@ -253,10 +253,11 @@ static bool intel_dvo_compute_config(struct intel_encoder *encoder,
>  		intel_fixed_panel_mode(fixed_mode, adjusted_mode);
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> -	return true;
> +
> +	return 0;
>  }
>  
>  static void intel_dvo_pre_enable(struct intel_encoder *encoder,
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 74f4021b760c..97a98e1bea56 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -1704,9 +1704,9 @@ intel_hdmi_ycbcr420_config(struct drm_connector *connector,
>  	return true;
>  }
>  
> -bool intel_hdmi_compute_config(struct intel_encoder *encoder,
> -			       struct intel_crtc_state *pipe_config,
> -			       struct drm_connector_state *conn_state)
> +int intel_hdmi_compute_config(struct intel_encoder *encoder,
> +			      struct intel_crtc_state *pipe_config,
> +			      struct drm_connector_state *conn_state)
>  {
>  	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> @@ -1722,7 +1722,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
>  	bool force_dvi = intel_conn_state->force_audio == HDMI_AUDIO_OFF_DVI;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
>  	pipe_config->has_hdmi_sink = !force_dvi && intel_hdmi->has_hdmi_sink;
> @@ -1753,7 +1753,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
>  						&clock_12bpc, &clock_10bpc,
>  						&clock_8bpc)) {
>  			DRM_ERROR("Can't support YCBCR420 output\n");
> -			return false;
> +			return -EINVAL;
>  		}
>  	}
>  
> @@ -1803,7 +1803,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
>  	if (hdmi_port_clock_valid(intel_hdmi, pipe_config->port_clock,
>  				  false, force_dvi) != MODE_OK) {
>  		DRM_DEBUG_KMS("unsupported HDMI clock, rejecting mode\n");
> -		return false;
> +		return -EINVAL;
>  	}
>  
>  	/* Set user selected PAR to incoming mode's member */
> @@ -1822,7 +1822,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
>  		}
>  	}
>  
> -	return true;
> +	return 0;
>  }
>  
>  static void
> diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
> index b01aacb5d73d..46a5dfd5cdf7 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -380,9 +380,9 @@ intel_lvds_mode_valid(struct drm_connector *connector,
>  	return MODE_OK;
>  }
>  
> -static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
> -				      struct intel_crtc_state *pipe_config,
> -				      struct drm_connector_state *conn_state)
> +static int intel_lvds_compute_config(struct intel_encoder *intel_encoder,
> +				     struct intel_crtc_state *pipe_config,
> +				     struct drm_connector_state *conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(intel_encoder->base.dev);
>  	struct intel_lvds_encoder *lvds_encoder =
> @@ -396,7 +396,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
>  	/* Should never happen!! */
>  	if (INTEL_GEN(dev_priv) < 4 && intel_crtc->pipe == 0) {
>  		DRM_ERROR("Can't support LVDS on pipe A\n");
> -		return false;
> +		return -EINVAL;
>  	}
>  
>  	if (lvds_encoder->a3_power == LVDS_A3_POWER_UP)
> @@ -422,7 +422,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
>  			       adjusted_mode);
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	if (HAS_PCH_SPLIT(dev_priv)) {
>  		pipe_config->has_pch_encoder = true;
> @@ -441,7 +441,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
>  	 * user's requested refresh rate.
>  	 */
>  
> -	return true;
> +	return 0;
>  }
>  
>  static enum drm_connector_status
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> index 4db7aefa88f9..df2d830a7405 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -1107,9 +1107,9 @@ static void i9xx_adjust_sdvo_tv_clock(struct intel_crtc_state *pipe_config)
>  	pipe_config->clock_set = true;
>  }
>  
> -static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
> -				      struct intel_crtc_state *pipe_config,
> -				      struct drm_connector_state *conn_state)
> +static int intel_sdvo_compute_config(struct intel_encoder *encoder,
> +				     struct intel_crtc_state *pipe_config,
> +				     struct drm_connector_state *conn_state)
>  {
>  	struct intel_sdvo *intel_sdvo = to_sdvo(encoder);
>  	struct intel_sdvo_connector_state *intel_sdvo_state =
> @@ -1134,7 +1134,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
>  	 */
>  	if (IS_TV(intel_sdvo_connector)) {
>  		if (!intel_sdvo_set_output_timings_from_mode(intel_sdvo, mode))
> -			return false;
> +			return -EINVAL;
>  
>  		(void) intel_sdvo_get_preferred_input_mode(intel_sdvo,
>  							   intel_sdvo_connector,
> @@ -1144,7 +1144,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
>  	} else if (IS_LVDS(intel_sdvo_connector)) {
>  		if (!intel_sdvo_set_output_timings_from_mode(intel_sdvo,
>  							     intel_sdvo_connector->base.panel.fixed_mode))
> -			return false;
> +			return -EINVAL;
>  
>  		(void) intel_sdvo_get_preferred_input_mode(intel_sdvo,
>  							   intel_sdvo_connector,
> @@ -1153,7 +1153,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
>  	}
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	/*
>  	 * Make the CRTC code factor in the SDVO pixel multiplier.  The
> @@ -1193,7 +1193,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
>  	if (intel_sdvo_connector->is_hdmi)
>  		adjusted_mode->picture_aspect_ratio = conn_state->picture_aspect_ratio;
>  
> -	return true;
> +	return 0;
>  }
>  
>  #define UPDATE_PROPERTY(input, NAME) \
> diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
> index d7a414ce2774..bd5536f0ec92 100644
> --- a/drivers/gpu/drm/i915/intel_tv.c
> +++ b/drivers/gpu/drm/i915/intel_tv.c
> @@ -869,7 +869,7 @@ intel_tv_get_config(struct intel_encoder *encoder,
>  	pipe_config->base.adjusted_mode.crtc_clock = pipe_config->port_clock;
>  }
>  
> -static bool
> +static int
>  intel_tv_compute_config(struct intel_encoder *encoder,
>  			struct intel_crtc_state *pipe_config,
>  			struct drm_connector_state *conn_state)
> @@ -879,10 +879,10 @@ intel_tv_compute_config(struct intel_encoder *encoder,
>  		&pipe_config->base.adjusted_mode;
>  
>  	if (!tv_mode)
> -		return false;
> +		return -EINVAL;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
>  	adjusted_mode->crtc_clock = tv_mode->clock;
> @@ -897,7 +897,7 @@ intel_tv_compute_config(struct intel_encoder *encoder,
>  	 * or whether userspace is doing something stupid.
>  	 */
>  
> -	return true;
> +	return 0;
>  }
>  
>  static void
> diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
> index d116fead8514..c247ce74b71a 100644
> --- a/drivers/gpu/drm/i915/vlv_dsi.c
> +++ b/drivers/gpu/drm/i915/vlv_dsi.c
> @@ -256,9 +256,9 @@ static void band_gap_reset(struct drm_i915_private *dev_priv)
>  	mutex_unlock(&dev_priv->sb_lock);
>  }
>  
> -static bool intel_dsi_compute_config(struct intel_encoder *encoder,
> -				     struct intel_crtc_state *pipe_config,
> -				     struct drm_connector_state *conn_state)
> +static int intel_dsi_compute_config(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct intel_dsi *intel_dsi = container_of(encoder, struct intel_dsi,
> @@ -284,7 +284,7 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
>  	}
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	/* DSI uses short packets for sync events, so clear mode flags for DSI */
>  	adjusted_mode->flags = 0;
> @@ -302,16 +302,16 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
>  
>  		ret = bxt_dsi_pll_compute(encoder, pipe_config);
>  		if (ret)
> -			return false;
> +			return -EINVAL;
>  	} else {
>  		ret = vlv_dsi_pll_compute(encoder, pipe_config);
>  		if (ret)
> -			return false;
> +			return -EINVAL;
>  	}
>  
>  	pipe_config->clock_set = true;
>  
> -	return true;
> +	return 0;
>  }
>  
>  static bool glk_dsi_enable_io(struct intel_encoder *encoder)
> -- 
> 2.20.1

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* ✓ Fi.CI.BAT: success for drm/i915: Pass down rc in intel_encoder->compute_config() (rev2)
  2019-01-15 20:08 ` Lyude Paul
                   ` (3 preceding siblings ...)
  (?)
@ 2019-01-15 20:32 ` Patchwork
  -1 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2019-01-15 20:32 UTC (permalink / raw)
  To: Lyude Paul; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Pass down rc in intel_encoder->compute_config() (rev2)
URL   : https://patchwork.freedesktop.org/series/55203/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5429 -> Patchwork_11301
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/55203/revisions/2/mbox/

Known issues
------------

  Here are the changes found in Patchwork_11301 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@amdgpu/amd_basic@cs-compute:
    - fi-kbl-8809g:       NOTRUN -> FAIL [fdo#108094]

  * igt@amdgpu/amd_prime@amd-to-i915:
    - fi-kbl-8809g:       NOTRUN -> FAIL [fdo#107341]

  * igt@gem_ctx_create@basic-files:
    - fi-kbl-7560u:       PASS -> INCOMPLETE [fdo#103665]

  * igt@gem_exec_suspend@basic-s4-devices:
    - fi-kbl-7500u:       PASS -> DMESG-WARN [fdo#105128] / [fdo#107139]
    - fi-blb-e6850:       PASS -> INCOMPLETE [fdo#107718]

  * igt@i915_selftest@live_evict:
    - fi-bsw-kefka:       PASS -> DMESG-WARN [fdo#107709]

  * igt@kms_chamelium@hdmi-hpd-fast:
    - fi-kbl-7500u:       PASS -> FAIL [fdo#108767]

  
#### Possible fixes ####

  * igt@amdgpu/amd_basic@userptr:
    - fi-kbl-8809g:       DMESG-WARN [fdo#108965] -> PASS

  * igt@i915_selftest@live_hangcheck:
    - fi-bwr-2160:        DMESG-FAIL [fdo#108735] -> PASS
    - fi-cfl-8109u:       DMESG-FAIL -> PASS

  * igt@kms_frontbuffer_tracking@basic:
    - fi-icl-u3:          FAIL [fdo#103167] -> PASS

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
  [fdo#105128]: https://bugs.freedesktop.org/show_bug.cgi?id=105128
  [fdo#107139]: https://bugs.freedesktop.org/show_bug.cgi?id=107139
  [fdo#107341]: https://bugs.freedesktop.org/show_bug.cgi?id=107341
  [fdo#107709]: https://bugs.freedesktop.org/show_bug.cgi?id=107709
  [fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
  [fdo#108094]: https://bugs.freedesktop.org/show_bug.cgi?id=108094
  [fdo#108735]: https://bugs.freedesktop.org/show_bug.cgi?id=108735
  [fdo#108767]: https://bugs.freedesktop.org/show_bug.cgi?id=108767
  [fdo#108965]: https://bugs.freedesktop.org/show_bug.cgi?id=108965
  [fdo#109241]: https://bugs.freedesktop.org/show_bug.cgi?id=109241
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271


Participating hosts (46 -> 42)
------------------------------

  Additional (2): fi-kbl-7567u fi-skl-6700hq 
  Missing    (6): fi-kbl-soraka fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-glk-j4005 fi-pnv-d510 


Build changes
-------------

    * Linux: CI_DRM_5429 -> Patchwork_11301

  CI_DRM_5429: b3e3bcfcefbc6f14bb30d54bcadddb63593b559c @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4773: 951e2b1a016b750544d0f42459b13b9c70631c68 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_11301: 1238102f7caa1322838b0039bba47441a3477552 @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

1238102f7caa drm/i915: Pass down rc in intel_encoder->compute_config()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_11301/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* ✗ Fi.CI.IGT: failure for drm/i915: Pass down rc in intel_encoder->compute_config() (rev2)
  2019-01-15 20:08 ` Lyude Paul
                   ` (4 preceding siblings ...)
  (?)
@ 2019-01-16  3:15 ` Patchwork
  -1 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2019-01-16  3:15 UTC (permalink / raw)
  To: Lyude Paul; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Pass down rc in intel_encoder->compute_config() (rev2)
URL   : https://patchwork.freedesktop.org/series/55203/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_5429_full -> Patchwork_11301_full
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with Patchwork_11301_full absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_11301_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in Patchwork_11301_full:

### IGT changes ###

#### Possible regressions ####

  * igt@gem_userptr_blits@map-fixed-invalidate-busy:
    - shard-skl:          NOTRUN -> INCOMPLETE +1

  * igt@gem_userptr_blits@map-fixed-invalidate-gup:
    - shard-iclb:         PASS -> INCOMPLETE
    - shard-skl:          PASS -> INCOMPLETE

  * igt@gem_userptr_blits@map-fixed-invalidate-overlap-busy:
    - shard-iclb:         NOTRUN -> INCOMPLETE

  * igt@kms_invalid_dotclock:
    - shard-glk:          PASS -> DMESG-WARN

  
Known issues
------------

  Here are the changes found in Patchwork_11301_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_ctx_isolation@vecs0-s3:
    - shard-skl:          PASS -> INCOMPLETE [fdo#104108] / [fdo#107773]

  * igt@gem_exec_schedule@pi-ringfull-vebox:
    - shard-skl:          NOTRUN -> FAIL [fdo#103158]

  * igt@gem_userptr_blits@map-fixed-invalidate-overlap-busy:
    - shard-kbl:          PASS -> INCOMPLETE [fdo#103665] +1

  * igt@gem_userptr_blits@map-fixed-invalidate-overlap-gup:
    - shard-snb:          PASS -> INCOMPLETE [fdo#105411]

  * igt@gem_userptr_blits@readonly-unsync:
    - shard-skl:          NOTRUN -> TIMEOUT [fdo#108887]

  * igt@i915_suspend@shrink:
    - shard-apl:          NOTRUN -> DMESG-WARN [fdo#107886] / [fdo#109244]

  * igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-a:
    - shard-skl:          NOTRUN -> DMESG-WARN [fdo#107956] +1

  * igt@kms_busy@extended-pageflip-hang-newfb-render-c:
    - shard-apl:          NOTRUN -> DMESG-WARN [fdo#107956]

  * igt@kms_chv_cursor_fail@pipe-b-256x256-right-edge:
    - shard-skl:          NOTRUN -> FAIL [fdo#104671]

  * igt@kms_cursor_crc@cursor-128x128-suspend:
    - shard-glk:          PASS -> FAIL [fdo#103232]

  * igt@kms_cursor_crc@cursor-128x42-sliding:
    - shard-skl:          NOTRUN -> FAIL [fdo#103232] +1

  * igt@kms_cursor_legacy@basic-flip-before-cursor-atomic:
    - shard-apl:          PASS -> DMESG-WARN [fdo#103558] / [fdo#105602] +6

  * igt@kms_fbcon_fbt@psr-suspend:
    - shard-skl:          NOTRUN -> FAIL [fdo#107882]

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-wc:
    - shard-skl:          NOTRUN -> FAIL [fdo#103167]

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-pwrite:
    - shard-iclb:         PASS -> FAIL [fdo#103167] +3

  * igt@kms_frontbuffer_tracking@fbc-1p-rte:
    - shard-apl:          PASS -> FAIL [fdo#103167] / [fdo#105682]

  * igt@kms_frontbuffer_tracking@fbc-2p-primscrn-cur-indfb-draw-blt:
    - shard-glk:          PASS -> FAIL [fdo#103167] +1

  * igt@kms_frontbuffer_tracking@fbc-stridechange:
    - shard-skl:          NOTRUN -> FAIL [fdo#105683]

  * igt@kms_frontbuffer_tracking@psr-1p-primscrn-spr-indfb-fullscreen:
    - shard-iclb:         NOTRUN -> FAIL [fdo#103167]

  * igt@kms_plane@pixel-format-pipe-a-planes-source-clamping:
    - shard-iclb:         NOTRUN -> FAIL [fdo#108948]

  * igt@kms_plane@pixel-format-pipe-b-planes:
    - shard-skl:          NOTRUN -> DMESG-WARN [fdo#106885]

  * igt@kms_plane@plane-panning-top-left-pipe-c-planes:
    - shard-skl:          NOTRUN -> FAIL [fdo#103166]

  * igt@kms_plane_alpha_blend@pipe-a-alpha-7efc:
    - shard-kbl:          NOTRUN -> FAIL [fdo#108145] / [fdo#108590]

  * igt@kms_plane_alpha_blend@pipe-b-alpha-transparant-fb:
    - shard-skl:          NOTRUN -> FAIL [fdo#108145] +2

  * igt@kms_plane_alpha_blend@pipe-b-coverage-7efc:
    - shard-skl:          NOTRUN -> FAIL [fdo#107815]

  * igt@kms_plane_alpha_blend@pipe-c-alpha-7efc:
    - shard-skl:          NOTRUN -> FAIL [fdo#107815] / [fdo#108145] +2

  * igt@kms_plane_alpha_blend@pipe-c-alpha-transparant-fb:
    - shard-apl:          NOTRUN -> FAIL [fdo#108145]

  * igt@kms_plane_multiple@atomic-pipe-a-tiling-y:
    - shard-glk:          PASS -> FAIL [fdo#103166]

  * igt@kms_plane_multiple@atomic-pipe-c-tiling-yf:
    - shard-apl:          PASS -> FAIL [fdo#103166]
    - shard-iclb:         PASS -> FAIL [fdo#103166]

  * igt@kms_setmode@basic:
    - shard-kbl:          NOTRUN -> FAIL [fdo#99912]

  * igt@kms_sysfs_edid_timing:
    - shard-apl:          NOTRUN -> FAIL [fdo#100047]

  * igt@kms_vblank@pipe-a-ts-continuation-dpms-suspend:
    - shard-apl:          PASS -> DMESG-WARN [fdo#103558]

  * igt@pm_rpm@legacy-planes:
    - shard-iclb:         PASS -> DMESG-WARN [fdo#108654]

  * igt@pm_rpm@pm-caching:
    - shard-iclb:         NOTRUN -> INCOMPLETE [fdo#108840]

  
#### Possible fixes ####

  * igt@gem_userptr_blits@map-fixed-invalidate-busy:
    - shard-hsw:          INCOMPLETE [fdo#103540] -> PASS

  * igt@gem_userptr_blits@map-fixed-invalidate-overlap-busy:
    - shard-apl:          INCOMPLETE [fdo#103927] -> PASS

  * igt@gem_userptr_blits@map-fixed-invalidate-overlap-busy-gup:
    - shard-snb:          INCOMPLETE [fdo#105411] -> PASS

  * igt@gem_userptr_blits@map-fixed-invalidate-overlap-gup:
    - shard-iclb:         INCOMPLETE -> PASS
    - shard-skl:          INCOMPLETE -> PASS

  * igt@kms_atomic_transition@plane-all-transition:
    - shard-iclb:         DMESG-WARN [fdo#107724] / [fdo#109225] -> PASS

  * igt@kms_color@pipe-b-degamma:
    - shard-apl:          FAIL [fdo#104782] -> PASS

  * igt@kms_cursor_crc@cursor-128x128-random:
    - shard-apl:          FAIL [fdo#103232] -> PASS

  * igt@kms_cursor_crc@cursor-64x64-sliding:
    - shard-glk:          FAIL [fdo#103232] -> PASS

  * igt@kms_cursor_crc@cursor-64x64-suspend:
    - shard-apl:          FAIL [fdo#103191] / [fdo#103232] -> PASS

  * igt@kms_cursor_legacy@2x-long-flip-vs-cursor-legacy:
    - shard-glk:          FAIL [fdo#104873] -> PASS

  * igt@kms_draw_crc@draw-method-xrgb2101010-mmap-gtt-ytiled:
    - shard-skl:          FAIL [fdo#103184] -> PASS

  * igt@kms_flip@2x-modeset-vs-vblank-race-interruptible:
    - shard-glk:          FAIL [fdo#103060] -> PASS

  * igt@kms_flip@flip-vs-expired-vblank-interruptible:
    - shard-skl:          FAIL [fdo#105363] -> PASS

  * igt@kms_flip@flip-vs-modeset-vs-hang-interruptible:
    - shard-iclb:         DMESG-WARN [fdo#107724] -> PASS

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-pwrite:
    - shard-glk:          FAIL [fdo#103167] -> PASS +2

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-move:
    - shard-iclb:         FAIL [fdo#103167] -> PASS +3

  * igt@kms_plane_alpha_blend@pipe-a-coverage-vs-premult-vs-constant:
    - shard-iclb:         DMESG-WARN [fdo#107724] / [fdo#108336] -> PASS

  * igt@kms_plane_alpha_blend@pipe-b-constant-alpha-max:
    - shard-glk:          FAIL [fdo#108145] -> PASS

  * igt@kms_plane_multiple@atomic-pipe-a-tiling-y:
    - shard-iclb:         FAIL [fdo#103166] -> PASS +1

  * igt@kms_psr@no_drrs:
    - shard-iclb:         FAIL [fdo#108341] -> PASS

  * igt@kms_rotation_crc@multiplane-rotation-cropping-top:
    - shard-glk:          DMESG-FAIL [fdo#105763] / [fdo#106538] -> PASS

  * igt@kms_setmode@basic:
    - shard-hsw:          FAIL [fdo#99912] -> PASS

  * igt@pm_rc6_residency@rc6-accuracy:
    - shard-kbl:          {SKIP} [fdo#109271] -> PASS
    - shard-snb:          {SKIP} [fdo#109271] -> PASS

  
#### Warnings ####

  * igt@kms_cursor_crc@cursor-128x128-suspend:
    - shard-apl:          FAIL [fdo#103191] / [fdo#103232] -> DMESG-WARN [fdo#103558]
    - shard-iclb:         INCOMPLETE [fdo#107713] -> FAIL [fdo#103232]

  * igt@kms_cursor_crc@cursor-256x85-random:
    - shard-iclb:         DMESG-WARN [fdo#107724] / [fdo#108336] -> FAIL [fdo#103232]

  * igt@pm_rpm@pc8-residency:
    - shard-iclb:         {SKIP} [fdo#109293] -> INCOMPLETE [fdo#107713] / [fdo#108840]

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#100047]: https://bugs.freedesktop.org/show_bug.cgi?id=100047
  [fdo#103060]: https://bugs.freedesktop.org/show_bug.cgi?id=103060
  [fdo#103158]: https://bugs.freedesktop.org/show_bug.cgi?id=103158
  [fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#103184]: https://bugs.freedesktop.org/show_bug.cgi?id=103184
  [fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
  [fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
  [fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
  [fdo#103558]: https://bugs.freedesktop.org/show_bug.cgi?id=103558
  [fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
  [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
  [fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
  [fdo#104671]: https://bugs.freedesktop.org/show_bug.cgi?id=104671
  [fdo#104782]: https://bugs.freedesktop.org/show_bug.cgi?id=104782
  [fdo#104873]: https://bugs.freedesktop.org/show_bug.cgi?id=104873
  [fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
  [fdo#105411]: https://bugs.freedesktop.org/show_bug.cgi?id=105411
  [fdo#105602]: https://bugs.freedesktop.org/show_bug.cgi?id=105602
  [fdo#105682]: https://bugs.freedesktop.org/show_bug.cgi?id=105682
  [fdo#105683]: https://bugs.freedesktop.org/show_bug.cgi?id=105683
  [fdo#105763]: https://bugs.freedesktop.org/show_bug.cgi?id=105763
  [fdo#106538]: https://bugs.freedesktop.org/show_bug.cgi?id=106538
  [fdo#106885]: https://bugs.freedesktop.org/show_bug.cgi?id=106885
  [fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
  [fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
  [fdo#107773]: https://bugs.freedesktop.org/show_bug.cgi?id=107773
  [fdo#107815]: https://bugs.freedesktop.org/show_bug.cgi?id=107815
  [fdo#107882]: https://bugs.freedesktop.org/show_bug.cgi?id=107882
  [fdo#107886]: https://bugs.freedesktop.org/show_bug.cgi?id=107886
  [fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956
  [fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
  [fdo#108336]: https://bugs.freedesktop.org/show_bug.cgi?id=108336
  [fdo#108341]: https://bugs.freedesktop.org/show_bug.cgi?id=108341
  [fdo#108590]: https://bugs.freedesktop.org/show_bug.cgi?id=108590
  [fdo#108654]: https://bugs.freedesktop.org/show_bug.cgi?id=108654
  [fdo#108756]: https://bugs.freedesktop.org/show_bug.cgi?id=108756
  [fdo#108840]: https://bugs.freedesktop.org/show_bug.cgi?id=108840
  [fdo#108887]: https://bugs.freedesktop.org/show_bug.cgi?id=108887
  [fdo#108948]: https://bugs.freedesktop.org/show_bug.cgi?id=108948
  [fdo#109225]: https://bugs.freedesktop.org/show_bug.cgi?id=109225
  [fdo#109241]: https://bugs.freedesktop.org/show_bug.cgi?id=109241
  [fdo#109244]: https://bugs.freedesktop.org/show_bug.cgi?id=109244
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
  [fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
  [fdo#109277]: https://bugs.freedesktop.org/show_bug.cgi?id=109277
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#109279]: https://bugs.freedesktop.org/show_bug.cgi?id=109279
  [fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
  [fdo#109281]: https://bugs.freedesktop.org/show_bug.cgi?id=109281
  [fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
  [fdo#109286]: https://bugs.freedesktop.org/show_bug.cgi?id=109286
  [fdo#109287]: https://bugs.freedesktop.org/show_bug.cgi?id=109287
  [fdo#109290]: https://bugs.freedesktop.org/show_bug.cgi?id=109290
  [fdo#109291]: https://bugs.freedesktop.org/show_bug.cgi?id=109291
  [fdo#109293]: https://bugs.freedesktop.org/show_bug.cgi?id=109293
  [fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
  [fdo#109302]: https://bugs.freedesktop.org/show_bug.cgi?id=109302
  [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
  [fdo#109349]: https://bugs.freedesktop.org/show_bug.cgi?id=109349
  [fdo#109350]: https://bugs.freedesktop.org/show_bug.cgi?id=109350
  [fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912


Participating hosts (7 -> 7)
------------------------------

  No changes in participating hosts


Build changes
-------------

    * Linux: CI_DRM_5429 -> Patchwork_11301

  CI_DRM_5429: b3e3bcfcefbc6f14bb30d54bcadddb63593b559c @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4773: 951e2b1a016b750544d0f42459b13b9c70631c68 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_11301: 1238102f7caa1322838b0039bba47441a3477552 @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_11301/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] drm/i915: Pass down rc in intel_encoder->compute_config()
  2019-01-15 20:08 ` Lyude Paul
@ 2019-01-16  7:47   ` Jani Nikula
  -1 siblings, 0 replies; 12+ messages in thread
From: Jani Nikula @ 2019-01-16  7:47 UTC (permalink / raw)
  To: Lyude Paul, intel-gfx
  Cc: Ville Syrjälä,
	Joonas Lahtinen, Rodrigo Vivi, David Airlie, Daniel Vetter,
	dri-devel, linux-kernel

On Tue, 15 Jan 2019, Lyude Paul <lyude@redhat.com> wrote:
> Something that I completely missed when implementing the new MST VCPI
> atomic helpers is that with those helpers, there's technically a chance
> of us having to grab additional modeset locks in ->compute_config() and
> furthermore, that means we have the potential to hit a normal modeset
> deadlock. However, because ->compute_config() only returns a bool this
> means we can't return -EDEADLK when we need to drop locks and try again
> which means we end up just failing the atomic check permanently. Whoops.
>
> So, fix this by modifying ->compute_config() to pass down an actual
> error code instead of a bool so that the atomic check can be restarted
> on modeset deadlocks.
>
> Thanks to Ville Syrjälä for pointing this out!
>
> Changes since v1:
> * Add some newlines
> * Return only -EINVAL from hsw_crt_compute_config()
> * Propogate return code from intel_dp_compute_dsc_params()
> * Change all of the intel_dp_compute_link_config*() variants
> * Don't miss if (hdmi_port_clock_valid()) branch in
>   intel_hdmi_compute_config()
>
> Signed-off-by: Lyude Paul <lyude@redhat.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Fixes: eceae1472467 ("drm/dp_mst: Start tracking per-port VCPI allocations")
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109320
> ---
>  drivers/gpu/drm/i915/icl_dsi.c       |  8 ++--
>  drivers/gpu/drm/i915/intel_crt.c     | 35 +++++++-------
>  drivers/gpu/drm/i915/intel_ddi.c     |  6 +--
>  drivers/gpu/drm/i915/intel_display.c | 11 +++--
>  drivers/gpu/drm/i915/intel_dp.c      | 71 +++++++++++++++-------------
>  drivers/gpu/drm/i915/intel_dp_mst.c  | 12 ++---
>  drivers/gpu/drm/i915/intel_drv.h     | 18 +++----
>  drivers/gpu/drm/i915/intel_dvo.c     | 11 +++--
>  drivers/gpu/drm/i915/intel_hdmi.c    | 14 +++---
>  drivers/gpu/drm/i915/intel_lvds.c    | 12 ++---
>  drivers/gpu/drm/i915/intel_sdvo.c    | 14 +++---
>  drivers/gpu/drm/i915/intel_tv.c      |  8 ++--
>  drivers/gpu/drm/i915/vlv_dsi.c       | 14 +++---
>  13 files changed, 122 insertions(+), 112 deletions(-)

Despite being an all i915 patch, this got applied to drm-misc-next,
causing conflicts where there really should have been none. :(

I am tempted to suggest reverting and re-applying to drm-intel, because
it will take weeks to sync both to drm-next and backmerge, and applying
further work on top in drm-intel will just cause more trouble.

Other ideas?

BR,
Jani.


>
> diff --git a/drivers/gpu/drm/i915/icl_dsi.c b/drivers/gpu/drm/i915/icl_dsi.c
> index f3a5f03646ce..355b48d1c937 100644
> --- a/drivers/gpu/drm/i915/icl_dsi.c
> +++ b/drivers/gpu/drm/i915/icl_dsi.c
> @@ -1188,9 +1188,9 @@ static void gen11_dsi_get_config(struct intel_encoder *encoder,
>  	pipe_config->output_types |= BIT(INTEL_OUTPUT_DSI);
>  }
>  
> -static bool gen11_dsi_compute_config(struct intel_encoder *encoder,
> -				     struct intel_crtc_state *pipe_config,
> -				     struct drm_connector_state *conn_state)
> +static int gen11_dsi_compute_config(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	struct intel_dsi *intel_dsi = container_of(encoder, struct intel_dsi,
>  						   base);
> @@ -1215,7 +1215,7 @@ static bool gen11_dsi_compute_config(struct intel_encoder *encoder,
>  	pipe_config->clock_set = true;
>  	pipe_config->port_clock = intel_dsi_bitrate(intel_dsi) / 5;
>  
> -	return true;
> +	return 0;
>  }
>  
>  static u64 gen11_dsi_get_power_domains(struct intel_encoder *encoder,
> diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
> index 33bd2addcbdd..081c333f30d2 100644
> --- a/drivers/gpu/drm/i915/intel_crt.c
> +++ b/drivers/gpu/drm/i915/intel_crt.c
> @@ -345,51 +345,52 @@ intel_crt_mode_valid(struct drm_connector *connector,
>  	return MODE_OK;
>  }
>  
> -static bool intel_crt_compute_config(struct intel_encoder *encoder,
> -				     struct intel_crtc_state *pipe_config,
> -				     struct drm_connector_state *conn_state)
> +static int intel_crt_compute_config(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	struct drm_display_mode *adjusted_mode =
>  		&pipe_config->base.adjusted_mode;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> -	return true;
> +
> +	return 0;
>  }
>  
> -static bool pch_crt_compute_config(struct intel_encoder *encoder,
> -				   struct intel_crtc_state *pipe_config,
> -				   struct drm_connector_state *conn_state)
> +static int pch_crt_compute_config(struct intel_encoder *encoder,
> +				  struct intel_crtc_state *pipe_config,
> +				  struct drm_connector_state *conn_state)
>  {
>  	struct drm_display_mode *adjusted_mode =
>  		&pipe_config->base.adjusted_mode;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->has_pch_encoder = true;
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
>  
> -	return true;
> +	return 0;
>  }
>  
> -static bool hsw_crt_compute_config(struct intel_encoder *encoder,
> -				   struct intel_crtc_state *pipe_config,
> -				   struct drm_connector_state *conn_state)
> +static int hsw_crt_compute_config(struct intel_encoder *encoder,
> +				  struct intel_crtc_state *pipe_config,
> +				  struct drm_connector_state *conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct drm_display_mode *adjusted_mode =
>  		&pipe_config->base.adjusted_mode;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	/* HSW/BDW FDI limited to 4k */
>  	if (adjusted_mode->crtc_hdisplay > 4096 ||
>  	    adjusted_mode->crtc_hblank_start > 4096)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->has_pch_encoder = true;
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> @@ -398,7 +399,7 @@ static bool hsw_crt_compute_config(struct intel_encoder *encoder,
>  	if (HAS_PCH_LPT(dev_priv)) {
>  		if (pipe_config->bw_constrained && pipe_config->pipe_bpp < 24) {
>  			DRM_DEBUG_KMS("LPT only supports 24bpp\n");
> -			return false;
> +			return -EINVAL;
>  		}
>  
>  		pipe_config->pipe_bpp = 24;
> @@ -407,7 +408,7 @@ static bool hsw_crt_compute_config(struct intel_encoder *encoder,
>  	/* FDI must always be 2.7 GHz */
>  	pipe_config->port_clock = 135000 * 2;
>  
> -	return true;
> +	return 0;
>  }
>  
>  static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector)
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 7f3cd055de50..ce44744a5f9d 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -3837,9 +3837,9 @@ intel_ddi_compute_output_type(struct intel_encoder *encoder,
>  	}
>  }
>  
> -static bool intel_ddi_compute_config(struct intel_encoder *encoder,
> -				     struct intel_crtc_state *pipe_config,
> -				     struct drm_connector_state *conn_state)
> +static int intel_ddi_compute_config(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	enum port port = encoder->port;
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 0a5ba45f5eb0..af164d712e9e 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -11553,10 +11553,13 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
>  			continue;
>  
>  		encoder = to_intel_encoder(connector_state->best_encoder);
> -
> -		if (!(encoder->compute_config(encoder, pipe_config, connector_state))) {
> -			DRM_DEBUG_KMS("Encoder config failure\n");
> -			return -EINVAL;
> +		ret = encoder->compute_config(encoder, pipe_config,
> +					      connector_state);
> +		if (ret < 0) {
> +			if (ret != -EDEADLK)
> +				DRM_DEBUG_KMS("Encoder config failure: %d\n",
> +					      ret);
> +			return ret;
>  		}
>  	}
>  
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 0a3ac98a779e..df4292bb1a4f 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -1819,7 +1819,7 @@ intel_dp_adjust_compliance_config(struct intel_dp *intel_dp,
>  }
>  
>  /* Optimize link config in order: max bpp, min clock, min lanes */
> -static bool
> +static int
>  intel_dp_compute_link_config_wide(struct intel_dp *intel_dp,
>  				  struct intel_crtc_state *pipe_config,
>  				  const struct link_config_limits *limits)
> @@ -1845,17 +1845,17 @@ intel_dp_compute_link_config_wide(struct intel_dp *intel_dp,
>  					pipe_config->pipe_bpp = bpp;
>  					pipe_config->port_clock = link_clock;
>  
> -					return true;
> +					return 0;
>  				}
>  			}
>  		}
>  	}
>  
> -	return false;
> +	return -EINVAL;
>  }
>  
>  /* Optimize link config in order: max bpp, min lanes, min clock */
> -static bool
> +static int
>  intel_dp_compute_link_config_fast(struct intel_dp *intel_dp,
>  				  struct intel_crtc_state *pipe_config,
>  				  const struct link_config_limits *limits)
> @@ -1881,13 +1881,13 @@ intel_dp_compute_link_config_fast(struct intel_dp *intel_dp,
>  					pipe_config->pipe_bpp = bpp;
>  					pipe_config->port_clock = link_clock;
>  
> -					return true;
> +					return 0;
>  				}
>  			}
>  		}
>  	}
>  
> -	return false;
> +	return -EINVAL;
>  }
>  
>  static int intel_dp_dsc_compute_bpp(struct intel_dp *intel_dp, u8 dsc_max_bpc)
> @@ -1905,19 +1905,20 @@ static int intel_dp_dsc_compute_bpp(struct intel_dp *intel_dp, u8 dsc_max_bpc)
>  	return 0;
>  }
>  
> -static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
> -					struct intel_crtc_state *pipe_config,
> -					struct drm_connector_state *conn_state,
> -					struct link_config_limits *limits)
> +static int intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
> +				       struct intel_crtc_state *pipe_config,
> +				       struct drm_connector_state *conn_state,
> +				       struct link_config_limits *limits)
>  {
>  	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
>  	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
>  	struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
>  	u8 dsc_max_bpc;
>  	int pipe_bpp;
> +	int ret;
>  
>  	if (!intel_dp_supports_dsc(intel_dp, pipe_config))
> -		return false;
> +		return -EINVAL;
>  
>  	dsc_max_bpc = min_t(u8, DP_DSC_MAX_SUPPORTED_BPC,
>  			    conn_state->max_requested_bpc);
> @@ -1925,7 +1926,7 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
>  	pipe_bpp = intel_dp_dsc_compute_bpp(intel_dp, dsc_max_bpc);
>  	if (pipe_bpp < DP_DSC_MIN_SUPPORTED_BPC * 3) {
>  		DRM_DEBUG_KMS("No DSC support for less than 8bpc\n");
> -		return false;
> +		return -EINVAL;
>  	}
>  
>  	/*
> @@ -1959,7 +1960,7 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
>  						     adjusted_mode->crtc_hdisplay);
>  		if (!dsc_max_output_bpp || !dsc_dp_slice_count) {
>  			DRM_DEBUG_KMS("Compressed BPP/Slice Count not supported\n");
> -			return false;
> +			return -EINVAL;
>  		}
>  		pipe_config->dsc_params.compressed_bpp = min_t(u16,
>  							       dsc_max_output_bpp >> 4,
> @@ -1976,16 +1977,19 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
>  			pipe_config->dsc_params.dsc_split = true;
>  		} else {
>  			DRM_DEBUG_KMS("Cannot split stream to use 2 VDSC instances\n");
> -			return false;
> +			return -EINVAL;
>  		}
>  	}
> -	if (intel_dp_compute_dsc_params(intel_dp, pipe_config) < 0) {
> +
> +	ret = intel_dp_compute_dsc_params(intel_dp, pipe_config);
> +	if (ret < 0) {
>  		DRM_DEBUG_KMS("Cannot compute valid DSC parameters for Input Bpp = %d "
>  			      "Compressed BPP = %d\n",
>  			      pipe_config->pipe_bpp,
>  			      pipe_config->dsc_params.compressed_bpp);
> -		return false;
> +		return ret;
>  	}
> +
>  	pipe_config->dsc_params.compression_enable = true;
>  	DRM_DEBUG_KMS("DP DSC computed with Input Bpp = %d "
>  		      "Compressed Bpp = %d Slice Count = %d\n",
> @@ -1993,10 +1997,10 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
>  		      pipe_config->dsc_params.compressed_bpp,
>  		      pipe_config->dsc_params.slice_count);
>  
> -	return true;
> +	return 0;
>  }
>  
> -static bool
> +static int
>  intel_dp_compute_link_config(struct intel_encoder *encoder,
>  			     struct intel_crtc_state *pipe_config,
>  			     struct drm_connector_state *conn_state)
> @@ -2005,7 +2009,7 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
>  	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
>  	struct link_config_limits limits;
>  	int common_len;
> -	bool ret;
> +	int ret;
>  
>  	common_len = intel_dp_common_len_rate_limit(intel_dp,
>  						    intel_dp->max_link_rate);
> @@ -2063,10 +2067,11 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
>  
>  	/* enable compression if the mode doesn't fit available BW */
>  	DRM_DEBUG_KMS("Force DSC en = %d\n", intel_dp->force_dsc_en);
> -	if (!ret || intel_dp->force_dsc_en) {
> -		if (!intel_dp_dsc_compute_config(intel_dp, pipe_config,
> -						 conn_state, &limits))
> -			return false;
> +	if (ret || intel_dp->force_dsc_en) {
> +		ret = intel_dp_dsc_compute_config(intel_dp, pipe_config,
> +						  conn_state, &limits);
> +		if (ret < 0)
> +			return ret;
>  	}
>  
>  	if (pipe_config->dsc_params.compression_enable) {
> @@ -2091,10 +2096,10 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
>  			      intel_dp_max_data_rate(pipe_config->port_clock,
>  						     pipe_config->lane_count));
>  	}
> -	return true;
> +	return 0;
>  }
>  
> -bool
> +int
>  intel_dp_compute_config(struct intel_encoder *encoder,
>  			struct intel_crtc_state *pipe_config,
>  			struct drm_connector_state *conn_state)
> @@ -2110,6 +2115,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>  		to_intel_digital_connector_state(conn_state);
>  	bool constant_n = drm_dp_has_quirk(&intel_dp->desc,
>  					   DP_DPCD_QUIRK_CONSTANT_N);
> +	int ret;
>  
>  	if (HAS_PCH_SPLIT(dev_priv) && !HAS_DDI(dev_priv) && port != PORT_A)
>  		pipe_config->has_pch_encoder = true;
> @@ -2131,8 +2137,6 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>  				       adjusted_mode);
>  
>  		if (INTEL_GEN(dev_priv) >= 9) {
> -			int ret;
> -
>  			ret = skl_update_scaler_crtc(pipe_config);
>  			if (ret)
>  				return ret;
> @@ -2147,20 +2151,21 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>  	}
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	if (HAS_GMCH_DISPLAY(dev_priv) &&
>  	    adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
> -		return false;
> +		return -EINVAL;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->fec_enable = !intel_dp_is_edp(intel_dp) &&
>  				  intel_dp_supports_fec(intel_dp, pipe_config);
>  
> -	if (!intel_dp_compute_link_config(encoder, pipe_config, conn_state))
> -		return false;
> +	ret = intel_dp_compute_link_config(encoder, pipe_config, conn_state);
> +	if (ret < 0)
> +		return ret;
>  
>  	if (intel_conn_state->broadcast_rgb == INTEL_BROADCAST_RGB_AUTO) {
>  		/*
> @@ -2208,7 +2213,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>  
>  	intel_psr_compute_config(intel_dp, pipe_config);
>  
> -	return true;
> +	return 0;
>  }
>  
>  void intel_dp_set_link_params(struct intel_dp *intel_dp,
> diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
> index 3f83429333c7..a19699023db1 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -29,9 +29,9 @@
>  #include <drm/drm_crtc_helper.h>
>  #include <drm/drm_edid.h>
>  
> -static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
> -					struct intel_crtc_state *pipe_config,
> -					struct drm_connector_state *conn_state)
> +static int intel_dp_mst_compute_config(struct intel_encoder *encoder,
> +				       struct intel_crtc_state *pipe_config,
> +				       struct drm_connector_state *conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
> @@ -52,7 +52,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
>  					   DP_DPCD_QUIRK_CONSTANT_N);
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
>  	pipe_config->has_pch_encoder = false;
> @@ -89,7 +89,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
>  		if (slots < 0) {
>  			DRM_DEBUG_KMS("failed finding vcpi slots:%d\n",
>  				      slots);
> -			return false;
> +			return slots;
>  		}
>  	}
>  
> @@ -107,7 +107,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
>  
>  	intel_ddi_compute_min_voltage_level(dev_priv, pipe_config);
>  
> -	return true;
> +	return 0;
>  }
>  
>  static int
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 7977843ce26a..e5a436c33307 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -225,9 +225,9 @@ struct intel_encoder {
>  	enum intel_output_type (*compute_output_type)(struct intel_encoder *,
>  						      struct intel_crtc_state *,
>  						      struct drm_connector_state *);
> -	bool (*compute_config)(struct intel_encoder *,
> -			       struct intel_crtc_state *,
> -			       struct drm_connector_state *);
> +	int (*compute_config)(struct intel_encoder *,
> +			      struct intel_crtc_state *,
> +			      struct drm_connector_state *);
>  	void (*pre_pll_enable)(struct intel_encoder *,
>  			       const struct intel_crtc_state *,
>  			       const struct drm_connector_state *);
> @@ -1816,9 +1816,9 @@ void intel_dp_sink_set_decompression_state(struct intel_dp *intel_dp,
>  void intel_dp_encoder_reset(struct drm_encoder *encoder);
>  void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
>  void intel_dp_encoder_flush_work(struct drm_encoder *encoder);
> -bool intel_dp_compute_config(struct intel_encoder *encoder,
> -			     struct intel_crtc_state *pipe_config,
> -			     struct drm_connector_state *conn_state);
> +int intel_dp_compute_config(struct intel_encoder *encoder,
> +			    struct intel_crtc_state *pipe_config,
> +			    struct drm_connector_state *conn_state);
>  bool intel_dp_is_edp(struct intel_dp *intel_dp);
>  bool intel_dp_is_port_edp(struct drm_i915_private *dev_priv, enum port port);
>  enum irqreturn intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port,
> @@ -1978,9 +1978,9 @@ void intel_hdmi_init(struct drm_i915_private *dev_priv, i915_reg_t hdmi_reg,
>  void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
>  			       struct intel_connector *intel_connector);
>  struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder);
> -bool intel_hdmi_compute_config(struct intel_encoder *encoder,
> -			       struct intel_crtc_state *pipe_config,
> -			       struct drm_connector_state *conn_state);
> +int intel_hdmi_compute_config(struct intel_encoder *encoder,
> +			      struct intel_crtc_state *pipe_config,
> +			      struct drm_connector_state *conn_state);
>  bool intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder,
>  				       struct drm_connector *connector,
>  				       bool high_tmds_clock_ratio,
> diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
> index bc3c3cb57ec6..a6c82482a841 100644
> --- a/drivers/gpu/drm/i915/intel_dvo.c
> +++ b/drivers/gpu/drm/i915/intel_dvo.c
> @@ -234,9 +234,9 @@ intel_dvo_mode_valid(struct drm_connector *connector,
>  	return intel_dvo->dev.dev_ops->mode_valid(&intel_dvo->dev, mode);
>  }
>  
> -static bool intel_dvo_compute_config(struct intel_encoder *encoder,
> -				     struct intel_crtc_state *pipe_config,
> -				     struct drm_connector_state *conn_state)
> +static int intel_dvo_compute_config(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	struct intel_dvo *intel_dvo = enc_to_dvo(encoder);
>  	const struct drm_display_mode *fixed_mode =
> @@ -253,10 +253,11 @@ static bool intel_dvo_compute_config(struct intel_encoder *encoder,
>  		intel_fixed_panel_mode(fixed_mode, adjusted_mode);
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> -	return true;
> +
> +	return 0;
>  }
>  
>  static void intel_dvo_pre_enable(struct intel_encoder *encoder,
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 74f4021b760c..97a98e1bea56 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -1704,9 +1704,9 @@ intel_hdmi_ycbcr420_config(struct drm_connector *connector,
>  	return true;
>  }
>  
> -bool intel_hdmi_compute_config(struct intel_encoder *encoder,
> -			       struct intel_crtc_state *pipe_config,
> -			       struct drm_connector_state *conn_state)
> +int intel_hdmi_compute_config(struct intel_encoder *encoder,
> +			      struct intel_crtc_state *pipe_config,
> +			      struct drm_connector_state *conn_state)
>  {
>  	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> @@ -1722,7 +1722,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
>  	bool force_dvi = intel_conn_state->force_audio == HDMI_AUDIO_OFF_DVI;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
>  	pipe_config->has_hdmi_sink = !force_dvi && intel_hdmi->has_hdmi_sink;
> @@ -1753,7 +1753,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
>  						&clock_12bpc, &clock_10bpc,
>  						&clock_8bpc)) {
>  			DRM_ERROR("Can't support YCBCR420 output\n");
> -			return false;
> +			return -EINVAL;
>  		}
>  	}
>  
> @@ -1803,7 +1803,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
>  	if (hdmi_port_clock_valid(intel_hdmi, pipe_config->port_clock,
>  				  false, force_dvi) != MODE_OK) {
>  		DRM_DEBUG_KMS("unsupported HDMI clock, rejecting mode\n");
> -		return false;
> +		return -EINVAL;
>  	}
>  
>  	/* Set user selected PAR to incoming mode's member */
> @@ -1822,7 +1822,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
>  		}
>  	}
>  
> -	return true;
> +	return 0;
>  }
>  
>  static void
> diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
> index b01aacb5d73d..46a5dfd5cdf7 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -380,9 +380,9 @@ intel_lvds_mode_valid(struct drm_connector *connector,
>  	return MODE_OK;
>  }
>  
> -static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
> -				      struct intel_crtc_state *pipe_config,
> -				      struct drm_connector_state *conn_state)
> +static int intel_lvds_compute_config(struct intel_encoder *intel_encoder,
> +				     struct intel_crtc_state *pipe_config,
> +				     struct drm_connector_state *conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(intel_encoder->base.dev);
>  	struct intel_lvds_encoder *lvds_encoder =
> @@ -396,7 +396,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
>  	/* Should never happen!! */
>  	if (INTEL_GEN(dev_priv) < 4 && intel_crtc->pipe == 0) {
>  		DRM_ERROR("Can't support LVDS on pipe A\n");
> -		return false;
> +		return -EINVAL;
>  	}
>  
>  	if (lvds_encoder->a3_power == LVDS_A3_POWER_UP)
> @@ -422,7 +422,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
>  			       adjusted_mode);
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	if (HAS_PCH_SPLIT(dev_priv)) {
>  		pipe_config->has_pch_encoder = true;
> @@ -441,7 +441,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
>  	 * user's requested refresh rate.
>  	 */
>  
> -	return true;
> +	return 0;
>  }
>  
>  static enum drm_connector_status
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> index 4db7aefa88f9..df2d830a7405 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -1107,9 +1107,9 @@ static void i9xx_adjust_sdvo_tv_clock(struct intel_crtc_state *pipe_config)
>  	pipe_config->clock_set = true;
>  }
>  
> -static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
> -				      struct intel_crtc_state *pipe_config,
> -				      struct drm_connector_state *conn_state)
> +static int intel_sdvo_compute_config(struct intel_encoder *encoder,
> +				     struct intel_crtc_state *pipe_config,
> +				     struct drm_connector_state *conn_state)
>  {
>  	struct intel_sdvo *intel_sdvo = to_sdvo(encoder);
>  	struct intel_sdvo_connector_state *intel_sdvo_state =
> @@ -1134,7 +1134,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
>  	 */
>  	if (IS_TV(intel_sdvo_connector)) {
>  		if (!intel_sdvo_set_output_timings_from_mode(intel_sdvo, mode))
> -			return false;
> +			return -EINVAL;
>  
>  		(void) intel_sdvo_get_preferred_input_mode(intel_sdvo,
>  							   intel_sdvo_connector,
> @@ -1144,7 +1144,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
>  	} else if (IS_LVDS(intel_sdvo_connector)) {
>  		if (!intel_sdvo_set_output_timings_from_mode(intel_sdvo,
>  							     intel_sdvo_connector->base.panel.fixed_mode))
> -			return false;
> +			return -EINVAL;
>  
>  		(void) intel_sdvo_get_preferred_input_mode(intel_sdvo,
>  							   intel_sdvo_connector,
> @@ -1153,7 +1153,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
>  	}
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	/*
>  	 * Make the CRTC code factor in the SDVO pixel multiplier.  The
> @@ -1193,7 +1193,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
>  	if (intel_sdvo_connector->is_hdmi)
>  		adjusted_mode->picture_aspect_ratio = conn_state->picture_aspect_ratio;
>  
> -	return true;
> +	return 0;
>  }
>  
>  #define UPDATE_PROPERTY(input, NAME) \
> diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
> index d7a414ce2774..bd5536f0ec92 100644
> --- a/drivers/gpu/drm/i915/intel_tv.c
> +++ b/drivers/gpu/drm/i915/intel_tv.c
> @@ -869,7 +869,7 @@ intel_tv_get_config(struct intel_encoder *encoder,
>  	pipe_config->base.adjusted_mode.crtc_clock = pipe_config->port_clock;
>  }
>  
> -static bool
> +static int
>  intel_tv_compute_config(struct intel_encoder *encoder,
>  			struct intel_crtc_state *pipe_config,
>  			struct drm_connector_state *conn_state)
> @@ -879,10 +879,10 @@ intel_tv_compute_config(struct intel_encoder *encoder,
>  		&pipe_config->base.adjusted_mode;
>  
>  	if (!tv_mode)
> -		return false;
> +		return -EINVAL;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
>  	adjusted_mode->crtc_clock = tv_mode->clock;
> @@ -897,7 +897,7 @@ intel_tv_compute_config(struct intel_encoder *encoder,
>  	 * or whether userspace is doing something stupid.
>  	 */
>  
> -	return true;
> +	return 0;
>  }
>  
>  static void
> diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
> index d116fead8514..c247ce74b71a 100644
> --- a/drivers/gpu/drm/i915/vlv_dsi.c
> +++ b/drivers/gpu/drm/i915/vlv_dsi.c
> @@ -256,9 +256,9 @@ static void band_gap_reset(struct drm_i915_private *dev_priv)
>  	mutex_unlock(&dev_priv->sb_lock);
>  }
>  
> -static bool intel_dsi_compute_config(struct intel_encoder *encoder,
> -				     struct intel_crtc_state *pipe_config,
> -				     struct drm_connector_state *conn_state)
> +static int intel_dsi_compute_config(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct intel_dsi *intel_dsi = container_of(encoder, struct intel_dsi,
> @@ -284,7 +284,7 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
>  	}
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	/* DSI uses short packets for sync events, so clear mode flags for DSI */
>  	adjusted_mode->flags = 0;
> @@ -302,16 +302,16 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
>  
>  		ret = bxt_dsi_pll_compute(encoder, pipe_config);
>  		if (ret)
> -			return false;
> +			return -EINVAL;
>  	} else {
>  		ret = vlv_dsi_pll_compute(encoder, pipe_config);
>  		if (ret)
> -			return false;
> +			return -EINVAL;
>  	}
>  
>  	pipe_config->clock_set = true;
>  
> -	return true;
> +	return 0;
>  }
>  
>  static bool glk_dsi_enable_io(struct intel_encoder *encoder)

-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] drm/i915: Pass down rc in intel_encoder->compute_config()
@ 2019-01-16  7:47   ` Jani Nikula
  0 siblings, 0 replies; 12+ messages in thread
From: Jani Nikula @ 2019-01-16  7:47 UTC (permalink / raw)
  To: Lyude Paul, intel-gfx; +Cc: David Airlie, linux-kernel, dri-devel

On Tue, 15 Jan 2019, Lyude Paul <lyude@redhat.com> wrote:
> Something that I completely missed when implementing the new MST VCPI
> atomic helpers is that with those helpers, there's technically a chance
> of us having to grab additional modeset locks in ->compute_config() and
> furthermore, that means we have the potential to hit a normal modeset
> deadlock. However, because ->compute_config() only returns a bool this
> means we can't return -EDEADLK when we need to drop locks and try again
> which means we end up just failing the atomic check permanently. Whoops.
>
> So, fix this by modifying ->compute_config() to pass down an actual
> error code instead of a bool so that the atomic check can be restarted
> on modeset deadlocks.
>
> Thanks to Ville Syrjälä for pointing this out!
>
> Changes since v1:
> * Add some newlines
> * Return only -EINVAL from hsw_crt_compute_config()
> * Propogate return code from intel_dp_compute_dsc_params()
> * Change all of the intel_dp_compute_link_config*() variants
> * Don't miss if (hdmi_port_clock_valid()) branch in
>   intel_hdmi_compute_config()
>
> Signed-off-by: Lyude Paul <lyude@redhat.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Fixes: eceae1472467 ("drm/dp_mst: Start tracking per-port VCPI allocations")
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109320
> ---
>  drivers/gpu/drm/i915/icl_dsi.c       |  8 ++--
>  drivers/gpu/drm/i915/intel_crt.c     | 35 +++++++-------
>  drivers/gpu/drm/i915/intel_ddi.c     |  6 +--
>  drivers/gpu/drm/i915/intel_display.c | 11 +++--
>  drivers/gpu/drm/i915/intel_dp.c      | 71 +++++++++++++++-------------
>  drivers/gpu/drm/i915/intel_dp_mst.c  | 12 ++---
>  drivers/gpu/drm/i915/intel_drv.h     | 18 +++----
>  drivers/gpu/drm/i915/intel_dvo.c     | 11 +++--
>  drivers/gpu/drm/i915/intel_hdmi.c    | 14 +++---
>  drivers/gpu/drm/i915/intel_lvds.c    | 12 ++---
>  drivers/gpu/drm/i915/intel_sdvo.c    | 14 +++---
>  drivers/gpu/drm/i915/intel_tv.c      |  8 ++--
>  drivers/gpu/drm/i915/vlv_dsi.c       | 14 +++---
>  13 files changed, 122 insertions(+), 112 deletions(-)

Despite being an all i915 patch, this got applied to drm-misc-next,
causing conflicts where there really should have been none. :(

I am tempted to suggest reverting and re-applying to drm-intel, because
it will take weeks to sync both to drm-next and backmerge, and applying
further work on top in drm-intel will just cause more trouble.

Other ideas?

BR,
Jani.


>
> diff --git a/drivers/gpu/drm/i915/icl_dsi.c b/drivers/gpu/drm/i915/icl_dsi.c
> index f3a5f03646ce..355b48d1c937 100644
> --- a/drivers/gpu/drm/i915/icl_dsi.c
> +++ b/drivers/gpu/drm/i915/icl_dsi.c
> @@ -1188,9 +1188,9 @@ static void gen11_dsi_get_config(struct intel_encoder *encoder,
>  	pipe_config->output_types |= BIT(INTEL_OUTPUT_DSI);
>  }
>  
> -static bool gen11_dsi_compute_config(struct intel_encoder *encoder,
> -				     struct intel_crtc_state *pipe_config,
> -				     struct drm_connector_state *conn_state)
> +static int gen11_dsi_compute_config(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	struct intel_dsi *intel_dsi = container_of(encoder, struct intel_dsi,
>  						   base);
> @@ -1215,7 +1215,7 @@ static bool gen11_dsi_compute_config(struct intel_encoder *encoder,
>  	pipe_config->clock_set = true;
>  	pipe_config->port_clock = intel_dsi_bitrate(intel_dsi) / 5;
>  
> -	return true;
> +	return 0;
>  }
>  
>  static u64 gen11_dsi_get_power_domains(struct intel_encoder *encoder,
> diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
> index 33bd2addcbdd..081c333f30d2 100644
> --- a/drivers/gpu/drm/i915/intel_crt.c
> +++ b/drivers/gpu/drm/i915/intel_crt.c
> @@ -345,51 +345,52 @@ intel_crt_mode_valid(struct drm_connector *connector,
>  	return MODE_OK;
>  }
>  
> -static bool intel_crt_compute_config(struct intel_encoder *encoder,
> -				     struct intel_crtc_state *pipe_config,
> -				     struct drm_connector_state *conn_state)
> +static int intel_crt_compute_config(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	struct drm_display_mode *adjusted_mode =
>  		&pipe_config->base.adjusted_mode;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> -	return true;
> +
> +	return 0;
>  }
>  
> -static bool pch_crt_compute_config(struct intel_encoder *encoder,
> -				   struct intel_crtc_state *pipe_config,
> -				   struct drm_connector_state *conn_state)
> +static int pch_crt_compute_config(struct intel_encoder *encoder,
> +				  struct intel_crtc_state *pipe_config,
> +				  struct drm_connector_state *conn_state)
>  {
>  	struct drm_display_mode *adjusted_mode =
>  		&pipe_config->base.adjusted_mode;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->has_pch_encoder = true;
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
>  
> -	return true;
> +	return 0;
>  }
>  
> -static bool hsw_crt_compute_config(struct intel_encoder *encoder,
> -				   struct intel_crtc_state *pipe_config,
> -				   struct drm_connector_state *conn_state)
> +static int hsw_crt_compute_config(struct intel_encoder *encoder,
> +				  struct intel_crtc_state *pipe_config,
> +				  struct drm_connector_state *conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct drm_display_mode *adjusted_mode =
>  		&pipe_config->base.adjusted_mode;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	/* HSW/BDW FDI limited to 4k */
>  	if (adjusted_mode->crtc_hdisplay > 4096 ||
>  	    adjusted_mode->crtc_hblank_start > 4096)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->has_pch_encoder = true;
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> @@ -398,7 +399,7 @@ static bool hsw_crt_compute_config(struct intel_encoder *encoder,
>  	if (HAS_PCH_LPT(dev_priv)) {
>  		if (pipe_config->bw_constrained && pipe_config->pipe_bpp < 24) {
>  			DRM_DEBUG_KMS("LPT only supports 24bpp\n");
> -			return false;
> +			return -EINVAL;
>  		}
>  
>  		pipe_config->pipe_bpp = 24;
> @@ -407,7 +408,7 @@ static bool hsw_crt_compute_config(struct intel_encoder *encoder,
>  	/* FDI must always be 2.7 GHz */
>  	pipe_config->port_clock = 135000 * 2;
>  
> -	return true;
> +	return 0;
>  }
>  
>  static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector)
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 7f3cd055de50..ce44744a5f9d 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -3837,9 +3837,9 @@ intel_ddi_compute_output_type(struct intel_encoder *encoder,
>  	}
>  }
>  
> -static bool intel_ddi_compute_config(struct intel_encoder *encoder,
> -				     struct intel_crtc_state *pipe_config,
> -				     struct drm_connector_state *conn_state)
> +static int intel_ddi_compute_config(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	enum port port = encoder->port;
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 0a5ba45f5eb0..af164d712e9e 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -11553,10 +11553,13 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
>  			continue;
>  
>  		encoder = to_intel_encoder(connector_state->best_encoder);
> -
> -		if (!(encoder->compute_config(encoder, pipe_config, connector_state))) {
> -			DRM_DEBUG_KMS("Encoder config failure\n");
> -			return -EINVAL;
> +		ret = encoder->compute_config(encoder, pipe_config,
> +					      connector_state);
> +		if (ret < 0) {
> +			if (ret != -EDEADLK)
> +				DRM_DEBUG_KMS("Encoder config failure: %d\n",
> +					      ret);
> +			return ret;
>  		}
>  	}
>  
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 0a3ac98a779e..df4292bb1a4f 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -1819,7 +1819,7 @@ intel_dp_adjust_compliance_config(struct intel_dp *intel_dp,
>  }
>  
>  /* Optimize link config in order: max bpp, min clock, min lanes */
> -static bool
> +static int
>  intel_dp_compute_link_config_wide(struct intel_dp *intel_dp,
>  				  struct intel_crtc_state *pipe_config,
>  				  const struct link_config_limits *limits)
> @@ -1845,17 +1845,17 @@ intel_dp_compute_link_config_wide(struct intel_dp *intel_dp,
>  					pipe_config->pipe_bpp = bpp;
>  					pipe_config->port_clock = link_clock;
>  
> -					return true;
> +					return 0;
>  				}
>  			}
>  		}
>  	}
>  
> -	return false;
> +	return -EINVAL;
>  }
>  
>  /* Optimize link config in order: max bpp, min lanes, min clock */
> -static bool
> +static int
>  intel_dp_compute_link_config_fast(struct intel_dp *intel_dp,
>  				  struct intel_crtc_state *pipe_config,
>  				  const struct link_config_limits *limits)
> @@ -1881,13 +1881,13 @@ intel_dp_compute_link_config_fast(struct intel_dp *intel_dp,
>  					pipe_config->pipe_bpp = bpp;
>  					pipe_config->port_clock = link_clock;
>  
> -					return true;
> +					return 0;
>  				}
>  			}
>  		}
>  	}
>  
> -	return false;
> +	return -EINVAL;
>  }
>  
>  static int intel_dp_dsc_compute_bpp(struct intel_dp *intel_dp, u8 dsc_max_bpc)
> @@ -1905,19 +1905,20 @@ static int intel_dp_dsc_compute_bpp(struct intel_dp *intel_dp, u8 dsc_max_bpc)
>  	return 0;
>  }
>  
> -static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
> -					struct intel_crtc_state *pipe_config,
> -					struct drm_connector_state *conn_state,
> -					struct link_config_limits *limits)
> +static int intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
> +				       struct intel_crtc_state *pipe_config,
> +				       struct drm_connector_state *conn_state,
> +				       struct link_config_limits *limits)
>  {
>  	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
>  	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
>  	struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
>  	u8 dsc_max_bpc;
>  	int pipe_bpp;
> +	int ret;
>  
>  	if (!intel_dp_supports_dsc(intel_dp, pipe_config))
> -		return false;
> +		return -EINVAL;
>  
>  	dsc_max_bpc = min_t(u8, DP_DSC_MAX_SUPPORTED_BPC,
>  			    conn_state->max_requested_bpc);
> @@ -1925,7 +1926,7 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
>  	pipe_bpp = intel_dp_dsc_compute_bpp(intel_dp, dsc_max_bpc);
>  	if (pipe_bpp < DP_DSC_MIN_SUPPORTED_BPC * 3) {
>  		DRM_DEBUG_KMS("No DSC support for less than 8bpc\n");
> -		return false;
> +		return -EINVAL;
>  	}
>  
>  	/*
> @@ -1959,7 +1960,7 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
>  						     adjusted_mode->crtc_hdisplay);
>  		if (!dsc_max_output_bpp || !dsc_dp_slice_count) {
>  			DRM_DEBUG_KMS("Compressed BPP/Slice Count not supported\n");
> -			return false;
> +			return -EINVAL;
>  		}
>  		pipe_config->dsc_params.compressed_bpp = min_t(u16,
>  							       dsc_max_output_bpp >> 4,
> @@ -1976,16 +1977,19 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
>  			pipe_config->dsc_params.dsc_split = true;
>  		} else {
>  			DRM_DEBUG_KMS("Cannot split stream to use 2 VDSC instances\n");
> -			return false;
> +			return -EINVAL;
>  		}
>  	}
> -	if (intel_dp_compute_dsc_params(intel_dp, pipe_config) < 0) {
> +
> +	ret = intel_dp_compute_dsc_params(intel_dp, pipe_config);
> +	if (ret < 0) {
>  		DRM_DEBUG_KMS("Cannot compute valid DSC parameters for Input Bpp = %d "
>  			      "Compressed BPP = %d\n",
>  			      pipe_config->pipe_bpp,
>  			      pipe_config->dsc_params.compressed_bpp);
> -		return false;
> +		return ret;
>  	}
> +
>  	pipe_config->dsc_params.compression_enable = true;
>  	DRM_DEBUG_KMS("DP DSC computed with Input Bpp = %d "
>  		      "Compressed Bpp = %d Slice Count = %d\n",
> @@ -1993,10 +1997,10 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
>  		      pipe_config->dsc_params.compressed_bpp,
>  		      pipe_config->dsc_params.slice_count);
>  
> -	return true;
> +	return 0;
>  }
>  
> -static bool
> +static int
>  intel_dp_compute_link_config(struct intel_encoder *encoder,
>  			     struct intel_crtc_state *pipe_config,
>  			     struct drm_connector_state *conn_state)
> @@ -2005,7 +2009,7 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
>  	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
>  	struct link_config_limits limits;
>  	int common_len;
> -	bool ret;
> +	int ret;
>  
>  	common_len = intel_dp_common_len_rate_limit(intel_dp,
>  						    intel_dp->max_link_rate);
> @@ -2063,10 +2067,11 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
>  
>  	/* enable compression if the mode doesn't fit available BW */
>  	DRM_DEBUG_KMS("Force DSC en = %d\n", intel_dp->force_dsc_en);
> -	if (!ret || intel_dp->force_dsc_en) {
> -		if (!intel_dp_dsc_compute_config(intel_dp, pipe_config,
> -						 conn_state, &limits))
> -			return false;
> +	if (ret || intel_dp->force_dsc_en) {
> +		ret = intel_dp_dsc_compute_config(intel_dp, pipe_config,
> +						  conn_state, &limits);
> +		if (ret < 0)
> +			return ret;
>  	}
>  
>  	if (pipe_config->dsc_params.compression_enable) {
> @@ -2091,10 +2096,10 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
>  			      intel_dp_max_data_rate(pipe_config->port_clock,
>  						     pipe_config->lane_count));
>  	}
> -	return true;
> +	return 0;
>  }
>  
> -bool
> +int
>  intel_dp_compute_config(struct intel_encoder *encoder,
>  			struct intel_crtc_state *pipe_config,
>  			struct drm_connector_state *conn_state)
> @@ -2110,6 +2115,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>  		to_intel_digital_connector_state(conn_state);
>  	bool constant_n = drm_dp_has_quirk(&intel_dp->desc,
>  					   DP_DPCD_QUIRK_CONSTANT_N);
> +	int ret;
>  
>  	if (HAS_PCH_SPLIT(dev_priv) && !HAS_DDI(dev_priv) && port != PORT_A)
>  		pipe_config->has_pch_encoder = true;
> @@ -2131,8 +2137,6 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>  				       adjusted_mode);
>  
>  		if (INTEL_GEN(dev_priv) >= 9) {
> -			int ret;
> -
>  			ret = skl_update_scaler_crtc(pipe_config);
>  			if (ret)
>  				return ret;
> @@ -2147,20 +2151,21 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>  	}
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	if (HAS_GMCH_DISPLAY(dev_priv) &&
>  	    adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
> -		return false;
> +		return -EINVAL;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->fec_enable = !intel_dp_is_edp(intel_dp) &&
>  				  intel_dp_supports_fec(intel_dp, pipe_config);
>  
> -	if (!intel_dp_compute_link_config(encoder, pipe_config, conn_state))
> -		return false;
> +	ret = intel_dp_compute_link_config(encoder, pipe_config, conn_state);
> +	if (ret < 0)
> +		return ret;
>  
>  	if (intel_conn_state->broadcast_rgb == INTEL_BROADCAST_RGB_AUTO) {
>  		/*
> @@ -2208,7 +2213,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>  
>  	intel_psr_compute_config(intel_dp, pipe_config);
>  
> -	return true;
> +	return 0;
>  }
>  
>  void intel_dp_set_link_params(struct intel_dp *intel_dp,
> diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
> index 3f83429333c7..a19699023db1 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -29,9 +29,9 @@
>  #include <drm/drm_crtc_helper.h>
>  #include <drm/drm_edid.h>
>  
> -static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
> -					struct intel_crtc_state *pipe_config,
> -					struct drm_connector_state *conn_state)
> +static int intel_dp_mst_compute_config(struct intel_encoder *encoder,
> +				       struct intel_crtc_state *pipe_config,
> +				       struct drm_connector_state *conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
> @@ -52,7 +52,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
>  					   DP_DPCD_QUIRK_CONSTANT_N);
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
>  	pipe_config->has_pch_encoder = false;
> @@ -89,7 +89,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
>  		if (slots < 0) {
>  			DRM_DEBUG_KMS("failed finding vcpi slots:%d\n",
>  				      slots);
> -			return false;
> +			return slots;
>  		}
>  	}
>  
> @@ -107,7 +107,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
>  
>  	intel_ddi_compute_min_voltage_level(dev_priv, pipe_config);
>  
> -	return true;
> +	return 0;
>  }
>  
>  static int
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 7977843ce26a..e5a436c33307 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -225,9 +225,9 @@ struct intel_encoder {
>  	enum intel_output_type (*compute_output_type)(struct intel_encoder *,
>  						      struct intel_crtc_state *,
>  						      struct drm_connector_state *);
> -	bool (*compute_config)(struct intel_encoder *,
> -			       struct intel_crtc_state *,
> -			       struct drm_connector_state *);
> +	int (*compute_config)(struct intel_encoder *,
> +			      struct intel_crtc_state *,
> +			      struct drm_connector_state *);
>  	void (*pre_pll_enable)(struct intel_encoder *,
>  			       const struct intel_crtc_state *,
>  			       const struct drm_connector_state *);
> @@ -1816,9 +1816,9 @@ void intel_dp_sink_set_decompression_state(struct intel_dp *intel_dp,
>  void intel_dp_encoder_reset(struct drm_encoder *encoder);
>  void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
>  void intel_dp_encoder_flush_work(struct drm_encoder *encoder);
> -bool intel_dp_compute_config(struct intel_encoder *encoder,
> -			     struct intel_crtc_state *pipe_config,
> -			     struct drm_connector_state *conn_state);
> +int intel_dp_compute_config(struct intel_encoder *encoder,
> +			    struct intel_crtc_state *pipe_config,
> +			    struct drm_connector_state *conn_state);
>  bool intel_dp_is_edp(struct intel_dp *intel_dp);
>  bool intel_dp_is_port_edp(struct drm_i915_private *dev_priv, enum port port);
>  enum irqreturn intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port,
> @@ -1978,9 +1978,9 @@ void intel_hdmi_init(struct drm_i915_private *dev_priv, i915_reg_t hdmi_reg,
>  void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
>  			       struct intel_connector *intel_connector);
>  struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder);
> -bool intel_hdmi_compute_config(struct intel_encoder *encoder,
> -			       struct intel_crtc_state *pipe_config,
> -			       struct drm_connector_state *conn_state);
> +int intel_hdmi_compute_config(struct intel_encoder *encoder,
> +			      struct intel_crtc_state *pipe_config,
> +			      struct drm_connector_state *conn_state);
>  bool intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder,
>  				       struct drm_connector *connector,
>  				       bool high_tmds_clock_ratio,
> diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
> index bc3c3cb57ec6..a6c82482a841 100644
> --- a/drivers/gpu/drm/i915/intel_dvo.c
> +++ b/drivers/gpu/drm/i915/intel_dvo.c
> @@ -234,9 +234,9 @@ intel_dvo_mode_valid(struct drm_connector *connector,
>  	return intel_dvo->dev.dev_ops->mode_valid(&intel_dvo->dev, mode);
>  }
>  
> -static bool intel_dvo_compute_config(struct intel_encoder *encoder,
> -				     struct intel_crtc_state *pipe_config,
> -				     struct drm_connector_state *conn_state)
> +static int intel_dvo_compute_config(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	struct intel_dvo *intel_dvo = enc_to_dvo(encoder);
>  	const struct drm_display_mode *fixed_mode =
> @@ -253,10 +253,11 @@ static bool intel_dvo_compute_config(struct intel_encoder *encoder,
>  		intel_fixed_panel_mode(fixed_mode, adjusted_mode);
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> -	return true;
> +
> +	return 0;
>  }
>  
>  static void intel_dvo_pre_enable(struct intel_encoder *encoder,
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 74f4021b760c..97a98e1bea56 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -1704,9 +1704,9 @@ intel_hdmi_ycbcr420_config(struct drm_connector *connector,
>  	return true;
>  }
>  
> -bool intel_hdmi_compute_config(struct intel_encoder *encoder,
> -			       struct intel_crtc_state *pipe_config,
> -			       struct drm_connector_state *conn_state)
> +int intel_hdmi_compute_config(struct intel_encoder *encoder,
> +			      struct intel_crtc_state *pipe_config,
> +			      struct drm_connector_state *conn_state)
>  {
>  	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> @@ -1722,7 +1722,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
>  	bool force_dvi = intel_conn_state->force_audio == HDMI_AUDIO_OFF_DVI;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
>  	pipe_config->has_hdmi_sink = !force_dvi && intel_hdmi->has_hdmi_sink;
> @@ -1753,7 +1753,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
>  						&clock_12bpc, &clock_10bpc,
>  						&clock_8bpc)) {
>  			DRM_ERROR("Can't support YCBCR420 output\n");
> -			return false;
> +			return -EINVAL;
>  		}
>  	}
>  
> @@ -1803,7 +1803,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
>  	if (hdmi_port_clock_valid(intel_hdmi, pipe_config->port_clock,
>  				  false, force_dvi) != MODE_OK) {
>  		DRM_DEBUG_KMS("unsupported HDMI clock, rejecting mode\n");
> -		return false;
> +		return -EINVAL;
>  	}
>  
>  	/* Set user selected PAR to incoming mode's member */
> @@ -1822,7 +1822,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
>  		}
>  	}
>  
> -	return true;
> +	return 0;
>  }
>  
>  static void
> diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
> index b01aacb5d73d..46a5dfd5cdf7 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -380,9 +380,9 @@ intel_lvds_mode_valid(struct drm_connector *connector,
>  	return MODE_OK;
>  }
>  
> -static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
> -				      struct intel_crtc_state *pipe_config,
> -				      struct drm_connector_state *conn_state)
> +static int intel_lvds_compute_config(struct intel_encoder *intel_encoder,
> +				     struct intel_crtc_state *pipe_config,
> +				     struct drm_connector_state *conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(intel_encoder->base.dev);
>  	struct intel_lvds_encoder *lvds_encoder =
> @@ -396,7 +396,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
>  	/* Should never happen!! */
>  	if (INTEL_GEN(dev_priv) < 4 && intel_crtc->pipe == 0) {
>  		DRM_ERROR("Can't support LVDS on pipe A\n");
> -		return false;
> +		return -EINVAL;
>  	}
>  
>  	if (lvds_encoder->a3_power == LVDS_A3_POWER_UP)
> @@ -422,7 +422,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
>  			       adjusted_mode);
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	if (HAS_PCH_SPLIT(dev_priv)) {
>  		pipe_config->has_pch_encoder = true;
> @@ -441,7 +441,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
>  	 * user's requested refresh rate.
>  	 */
>  
> -	return true;
> +	return 0;
>  }
>  
>  static enum drm_connector_status
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> index 4db7aefa88f9..df2d830a7405 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -1107,9 +1107,9 @@ static void i9xx_adjust_sdvo_tv_clock(struct intel_crtc_state *pipe_config)
>  	pipe_config->clock_set = true;
>  }
>  
> -static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
> -				      struct intel_crtc_state *pipe_config,
> -				      struct drm_connector_state *conn_state)
> +static int intel_sdvo_compute_config(struct intel_encoder *encoder,
> +				     struct intel_crtc_state *pipe_config,
> +				     struct drm_connector_state *conn_state)
>  {
>  	struct intel_sdvo *intel_sdvo = to_sdvo(encoder);
>  	struct intel_sdvo_connector_state *intel_sdvo_state =
> @@ -1134,7 +1134,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
>  	 */
>  	if (IS_TV(intel_sdvo_connector)) {
>  		if (!intel_sdvo_set_output_timings_from_mode(intel_sdvo, mode))
> -			return false;
> +			return -EINVAL;
>  
>  		(void) intel_sdvo_get_preferred_input_mode(intel_sdvo,
>  							   intel_sdvo_connector,
> @@ -1144,7 +1144,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
>  	} else if (IS_LVDS(intel_sdvo_connector)) {
>  		if (!intel_sdvo_set_output_timings_from_mode(intel_sdvo,
>  							     intel_sdvo_connector->base.panel.fixed_mode))
> -			return false;
> +			return -EINVAL;
>  
>  		(void) intel_sdvo_get_preferred_input_mode(intel_sdvo,
>  							   intel_sdvo_connector,
> @@ -1153,7 +1153,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
>  	}
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	/*
>  	 * Make the CRTC code factor in the SDVO pixel multiplier.  The
> @@ -1193,7 +1193,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
>  	if (intel_sdvo_connector->is_hdmi)
>  		adjusted_mode->picture_aspect_ratio = conn_state->picture_aspect_ratio;
>  
> -	return true;
> +	return 0;
>  }
>  
>  #define UPDATE_PROPERTY(input, NAME) \
> diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
> index d7a414ce2774..bd5536f0ec92 100644
> --- a/drivers/gpu/drm/i915/intel_tv.c
> +++ b/drivers/gpu/drm/i915/intel_tv.c
> @@ -869,7 +869,7 @@ intel_tv_get_config(struct intel_encoder *encoder,
>  	pipe_config->base.adjusted_mode.crtc_clock = pipe_config->port_clock;
>  }
>  
> -static bool
> +static int
>  intel_tv_compute_config(struct intel_encoder *encoder,
>  			struct intel_crtc_state *pipe_config,
>  			struct drm_connector_state *conn_state)
> @@ -879,10 +879,10 @@ intel_tv_compute_config(struct intel_encoder *encoder,
>  		&pipe_config->base.adjusted_mode;
>  
>  	if (!tv_mode)
> -		return false;
> +		return -EINVAL;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
>  	adjusted_mode->crtc_clock = tv_mode->clock;
> @@ -897,7 +897,7 @@ intel_tv_compute_config(struct intel_encoder *encoder,
>  	 * or whether userspace is doing something stupid.
>  	 */
>  
> -	return true;
> +	return 0;
>  }
>  
>  static void
> diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
> index d116fead8514..c247ce74b71a 100644
> --- a/drivers/gpu/drm/i915/vlv_dsi.c
> +++ b/drivers/gpu/drm/i915/vlv_dsi.c
> @@ -256,9 +256,9 @@ static void band_gap_reset(struct drm_i915_private *dev_priv)
>  	mutex_unlock(&dev_priv->sb_lock);
>  }
>  
> -static bool intel_dsi_compute_config(struct intel_encoder *encoder,
> -				     struct intel_crtc_state *pipe_config,
> -				     struct drm_connector_state *conn_state)
> +static int intel_dsi_compute_config(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct intel_dsi *intel_dsi = container_of(encoder, struct intel_dsi,
> @@ -284,7 +284,7 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
>  	}
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> -		return false;
> +		return -EINVAL;
>  
>  	/* DSI uses short packets for sync events, so clear mode flags for DSI */
>  	adjusted_mode->flags = 0;
> @@ -302,16 +302,16 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
>  
>  		ret = bxt_dsi_pll_compute(encoder, pipe_config);
>  		if (ret)
> -			return false;
> +			return -EINVAL;
>  	} else {
>  		ret = vlv_dsi_pll_compute(encoder, pipe_config);
>  		if (ret)
> -			return false;
> +			return -EINVAL;
>  	}
>  
>  	pipe_config->clock_set = true;
>  
> -	return true;
> +	return 0;
>  }
>  
>  static bool glk_dsi_enable_io(struct intel_encoder *encoder)

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] drm/i915: Pass down rc in intel_encoder->compute_config()
  2019-01-16  7:47   ` Jani Nikula
@ 2019-01-16 10:19     ` Daniel Vetter
  -1 siblings, 0 replies; 12+ messages in thread
From: Daniel Vetter @ 2019-01-16 10:19 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Lyude Paul, intel-gfx, Ville Syrjälä,
	Joonas Lahtinen, Rodrigo Vivi, David Airlie, Daniel Vetter,
	dri-devel, linux-kernel

On Wed, Jan 16, 2019 at 09:47:17AM +0200, Jani Nikula wrote:
> On Tue, 15 Jan 2019, Lyude Paul <lyude@redhat.com> wrote:
> > Something that I completely missed when implementing the new MST VCPI
> > atomic helpers is that with those helpers, there's technically a chance
> > of us having to grab additional modeset locks in ->compute_config() and
> > furthermore, that means we have the potential to hit a normal modeset
> > deadlock. However, because ->compute_config() only returns a bool this
> > means we can't return -EDEADLK when we need to drop locks and try again
> > which means we end up just failing the atomic check permanently. Whoops.
> >
> > So, fix this by modifying ->compute_config() to pass down an actual
> > error code instead of a bool so that the atomic check can be restarted
> > on modeset deadlocks.
> >
> > Thanks to Ville Syrjälä for pointing this out!
> >
> > Changes since v1:
> > * Add some newlines
> > * Return only -EINVAL from hsw_crt_compute_config()
> > * Propogate return code from intel_dp_compute_dsc_params()
> > * Change all of the intel_dp_compute_link_config*() variants
> > * Don't miss if (hdmi_port_clock_valid()) branch in
> >   intel_hdmi_compute_config()
> >
> > Signed-off-by: Lyude Paul <lyude@redhat.com>
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Fixes: eceae1472467 ("drm/dp_mst: Start tracking per-port VCPI allocations")
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109320
> > ---
> >  drivers/gpu/drm/i915/icl_dsi.c       |  8 ++--
> >  drivers/gpu/drm/i915/intel_crt.c     | 35 +++++++-------
> >  drivers/gpu/drm/i915/intel_ddi.c     |  6 +--
> >  drivers/gpu/drm/i915/intel_display.c | 11 +++--
> >  drivers/gpu/drm/i915/intel_dp.c      | 71 +++++++++++++++-------------
> >  drivers/gpu/drm/i915/intel_dp_mst.c  | 12 ++---
> >  drivers/gpu/drm/i915/intel_drv.h     | 18 +++----
> >  drivers/gpu/drm/i915/intel_dvo.c     | 11 +++--
> >  drivers/gpu/drm/i915/intel_hdmi.c    | 14 +++---
> >  drivers/gpu/drm/i915/intel_lvds.c    | 12 ++---
> >  drivers/gpu/drm/i915/intel_sdvo.c    | 14 +++---
> >  drivers/gpu/drm/i915/intel_tv.c      |  8 ++--
> >  drivers/gpu/drm/i915/vlv_dsi.c       | 14 +++---
> >  13 files changed, 122 insertions(+), 112 deletions(-)
> 
> Despite being an all i915 patch, this got applied to drm-misc-next,
> causing conflicts where there really should have been none. :(
> 
> I am tempted to suggest reverting and re-applying to drm-intel, because
> it will take weeks to sync both to drm-next and backmerge, and applying
> further work on top in drm-intel will just cause more trouble.
> 
> Other ideas?

We discussed this a bit on irc. I think the best option is to cherry-pick
this patch over to drm-intel-next-queued and try to get the backmerges
sorted asap.

With hindsight a topic branch for all the mst stuff would have been really
good choice. And as Jani mentioned on irc, pls get maintainer's ack when
merging stuff through different trees. I wanted to ask about that but
figured I have time until nouveau stuff is reviewed, but then it landed
right away. Anyway, conflict isn't bad enough that sfr couldn't handle it,
so we didn't screw up too badly :-)

Thanks, Daniel
> 
> BR,
> Jani.
> 
> 
> >
> > diff --git a/drivers/gpu/drm/i915/icl_dsi.c b/drivers/gpu/drm/i915/icl_dsi.c
> > index f3a5f03646ce..355b48d1c937 100644
> > --- a/drivers/gpu/drm/i915/icl_dsi.c
> > +++ b/drivers/gpu/drm/i915/icl_dsi.c
> > @@ -1188,9 +1188,9 @@ static void gen11_dsi_get_config(struct intel_encoder *encoder,
> >  	pipe_config->output_types |= BIT(INTEL_OUTPUT_DSI);
> >  }
> >  
> > -static bool gen11_dsi_compute_config(struct intel_encoder *encoder,
> > -				     struct intel_crtc_state *pipe_config,
> > -				     struct drm_connector_state *conn_state)
> > +static int gen11_dsi_compute_config(struct intel_encoder *encoder,
> > +				    struct intel_crtc_state *pipe_config,
> > +				    struct drm_connector_state *conn_state)
> >  {
> >  	struct intel_dsi *intel_dsi = container_of(encoder, struct intel_dsi,
> >  						   base);
> > @@ -1215,7 +1215,7 @@ static bool gen11_dsi_compute_config(struct intel_encoder *encoder,
> >  	pipe_config->clock_set = true;
> >  	pipe_config->port_clock = intel_dsi_bitrate(intel_dsi) / 5;
> >  
> > -	return true;
> > +	return 0;
> >  }
> >  
> >  static u64 gen11_dsi_get_power_domains(struct intel_encoder *encoder,
> > diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
> > index 33bd2addcbdd..081c333f30d2 100644
> > --- a/drivers/gpu/drm/i915/intel_crt.c
> > +++ b/drivers/gpu/drm/i915/intel_crt.c
> > @@ -345,51 +345,52 @@ intel_crt_mode_valid(struct drm_connector *connector,
> >  	return MODE_OK;
> >  }
> >  
> > -static bool intel_crt_compute_config(struct intel_encoder *encoder,
> > -				     struct intel_crtc_state *pipe_config,
> > -				     struct drm_connector_state *conn_state)
> > +static int intel_crt_compute_config(struct intel_encoder *encoder,
> > +				    struct intel_crtc_state *pipe_config,
> > +				    struct drm_connector_state *conn_state)
> >  {
> >  	struct drm_display_mode *adjusted_mode =
> >  		&pipe_config->base.adjusted_mode;
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> > -	return true;
> > +
> > +	return 0;
> >  }
> >  
> > -static bool pch_crt_compute_config(struct intel_encoder *encoder,
> > -				   struct intel_crtc_state *pipe_config,
> > -				   struct drm_connector_state *conn_state)
> > +static int pch_crt_compute_config(struct intel_encoder *encoder,
> > +				  struct intel_crtc_state *pipe_config,
> > +				  struct drm_connector_state *conn_state)
> >  {
> >  	struct drm_display_mode *adjusted_mode =
> >  		&pipe_config->base.adjusted_mode;
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	pipe_config->has_pch_encoder = true;
> >  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> >  
> > -	return true;
> > +	return 0;
> >  }
> >  
> > -static bool hsw_crt_compute_config(struct intel_encoder *encoder,
> > -				   struct intel_crtc_state *pipe_config,
> > -				   struct drm_connector_state *conn_state)
> > +static int hsw_crt_compute_config(struct intel_encoder *encoder,
> > +				  struct intel_crtc_state *pipe_config,
> > +				  struct drm_connector_state *conn_state)
> >  {
> >  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> >  	struct drm_display_mode *adjusted_mode =
> >  		&pipe_config->base.adjusted_mode;
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	/* HSW/BDW FDI limited to 4k */
> >  	if (adjusted_mode->crtc_hdisplay > 4096 ||
> >  	    adjusted_mode->crtc_hblank_start > 4096)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	pipe_config->has_pch_encoder = true;
> >  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> > @@ -398,7 +399,7 @@ static bool hsw_crt_compute_config(struct intel_encoder *encoder,
> >  	if (HAS_PCH_LPT(dev_priv)) {
> >  		if (pipe_config->bw_constrained && pipe_config->pipe_bpp < 24) {
> >  			DRM_DEBUG_KMS("LPT only supports 24bpp\n");
> > -			return false;
> > +			return -EINVAL;
> >  		}
> >  
> >  		pipe_config->pipe_bpp = 24;
> > @@ -407,7 +408,7 @@ static bool hsw_crt_compute_config(struct intel_encoder *encoder,
> >  	/* FDI must always be 2.7 GHz */
> >  	pipe_config->port_clock = 135000 * 2;
> >  
> > -	return true;
> > +	return 0;
> >  }
> >  
> >  static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector)
> > diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> > index 7f3cd055de50..ce44744a5f9d 100644
> > --- a/drivers/gpu/drm/i915/intel_ddi.c
> > +++ b/drivers/gpu/drm/i915/intel_ddi.c
> > @@ -3837,9 +3837,9 @@ intel_ddi_compute_output_type(struct intel_encoder *encoder,
> >  	}
> >  }
> >  
> > -static bool intel_ddi_compute_config(struct intel_encoder *encoder,
> > -				     struct intel_crtc_state *pipe_config,
> > -				     struct drm_connector_state *conn_state)
> > +static int intel_ddi_compute_config(struct intel_encoder *encoder,
> > +				    struct intel_crtc_state *pipe_config,
> > +				    struct drm_connector_state *conn_state)
> >  {
> >  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> >  	enum port port = encoder->port;
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index 0a5ba45f5eb0..af164d712e9e 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -11553,10 +11553,13 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
> >  			continue;
> >  
> >  		encoder = to_intel_encoder(connector_state->best_encoder);
> > -
> > -		if (!(encoder->compute_config(encoder, pipe_config, connector_state))) {
> > -			DRM_DEBUG_KMS("Encoder config failure\n");
> > -			return -EINVAL;
> > +		ret = encoder->compute_config(encoder, pipe_config,
> > +					      connector_state);
> > +		if (ret < 0) {
> > +			if (ret != -EDEADLK)
> > +				DRM_DEBUG_KMS("Encoder config failure: %d\n",
> > +					      ret);
> > +			return ret;
> >  		}
> >  	}
> >  
> > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> > index 0a3ac98a779e..df4292bb1a4f 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -1819,7 +1819,7 @@ intel_dp_adjust_compliance_config(struct intel_dp *intel_dp,
> >  }
> >  
> >  /* Optimize link config in order: max bpp, min clock, min lanes */
> > -static bool
> > +static int
> >  intel_dp_compute_link_config_wide(struct intel_dp *intel_dp,
> >  				  struct intel_crtc_state *pipe_config,
> >  				  const struct link_config_limits *limits)
> > @@ -1845,17 +1845,17 @@ intel_dp_compute_link_config_wide(struct intel_dp *intel_dp,
> >  					pipe_config->pipe_bpp = bpp;
> >  					pipe_config->port_clock = link_clock;
> >  
> > -					return true;
> > +					return 0;
> >  				}
> >  			}
> >  		}
> >  	}
> >  
> > -	return false;
> > +	return -EINVAL;
> >  }
> >  
> >  /* Optimize link config in order: max bpp, min lanes, min clock */
> > -static bool
> > +static int
> >  intel_dp_compute_link_config_fast(struct intel_dp *intel_dp,
> >  				  struct intel_crtc_state *pipe_config,
> >  				  const struct link_config_limits *limits)
> > @@ -1881,13 +1881,13 @@ intel_dp_compute_link_config_fast(struct intel_dp *intel_dp,
> >  					pipe_config->pipe_bpp = bpp;
> >  					pipe_config->port_clock = link_clock;
> >  
> > -					return true;
> > +					return 0;
> >  				}
> >  			}
> >  		}
> >  	}
> >  
> > -	return false;
> > +	return -EINVAL;
> >  }
> >  
> >  static int intel_dp_dsc_compute_bpp(struct intel_dp *intel_dp, u8 dsc_max_bpc)
> > @@ -1905,19 +1905,20 @@ static int intel_dp_dsc_compute_bpp(struct intel_dp *intel_dp, u8 dsc_max_bpc)
> >  	return 0;
> >  }
> >  
> > -static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
> > -					struct intel_crtc_state *pipe_config,
> > -					struct drm_connector_state *conn_state,
> > -					struct link_config_limits *limits)
> > +static int intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
> > +				       struct intel_crtc_state *pipe_config,
> > +				       struct drm_connector_state *conn_state,
> > +				       struct link_config_limits *limits)
> >  {
> >  	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
> >  	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
> >  	struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
> >  	u8 dsc_max_bpc;
> >  	int pipe_bpp;
> > +	int ret;
> >  
> >  	if (!intel_dp_supports_dsc(intel_dp, pipe_config))
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	dsc_max_bpc = min_t(u8, DP_DSC_MAX_SUPPORTED_BPC,
> >  			    conn_state->max_requested_bpc);
> > @@ -1925,7 +1926,7 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
> >  	pipe_bpp = intel_dp_dsc_compute_bpp(intel_dp, dsc_max_bpc);
> >  	if (pipe_bpp < DP_DSC_MIN_SUPPORTED_BPC * 3) {
> >  		DRM_DEBUG_KMS("No DSC support for less than 8bpc\n");
> > -		return false;
> > +		return -EINVAL;
> >  	}
> >  
> >  	/*
> > @@ -1959,7 +1960,7 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
> >  						     adjusted_mode->crtc_hdisplay);
> >  		if (!dsc_max_output_bpp || !dsc_dp_slice_count) {
> >  			DRM_DEBUG_KMS("Compressed BPP/Slice Count not supported\n");
> > -			return false;
> > +			return -EINVAL;
> >  		}
> >  		pipe_config->dsc_params.compressed_bpp = min_t(u16,
> >  							       dsc_max_output_bpp >> 4,
> > @@ -1976,16 +1977,19 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
> >  			pipe_config->dsc_params.dsc_split = true;
> >  		} else {
> >  			DRM_DEBUG_KMS("Cannot split stream to use 2 VDSC instances\n");
> > -			return false;
> > +			return -EINVAL;
> >  		}
> >  	}
> > -	if (intel_dp_compute_dsc_params(intel_dp, pipe_config) < 0) {
> > +
> > +	ret = intel_dp_compute_dsc_params(intel_dp, pipe_config);
> > +	if (ret < 0) {
> >  		DRM_DEBUG_KMS("Cannot compute valid DSC parameters for Input Bpp = %d "
> >  			      "Compressed BPP = %d\n",
> >  			      pipe_config->pipe_bpp,
> >  			      pipe_config->dsc_params.compressed_bpp);
> > -		return false;
> > +		return ret;
> >  	}
> > +
> >  	pipe_config->dsc_params.compression_enable = true;
> >  	DRM_DEBUG_KMS("DP DSC computed with Input Bpp = %d "
> >  		      "Compressed Bpp = %d Slice Count = %d\n",
> > @@ -1993,10 +1997,10 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
> >  		      pipe_config->dsc_params.compressed_bpp,
> >  		      pipe_config->dsc_params.slice_count);
> >  
> > -	return true;
> > +	return 0;
> >  }
> >  
> > -static bool
> > +static int
> >  intel_dp_compute_link_config(struct intel_encoder *encoder,
> >  			     struct intel_crtc_state *pipe_config,
> >  			     struct drm_connector_state *conn_state)
> > @@ -2005,7 +2009,7 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
> >  	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
> >  	struct link_config_limits limits;
> >  	int common_len;
> > -	bool ret;
> > +	int ret;
> >  
> >  	common_len = intel_dp_common_len_rate_limit(intel_dp,
> >  						    intel_dp->max_link_rate);
> > @@ -2063,10 +2067,11 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
> >  
> >  	/* enable compression if the mode doesn't fit available BW */
> >  	DRM_DEBUG_KMS("Force DSC en = %d\n", intel_dp->force_dsc_en);
> > -	if (!ret || intel_dp->force_dsc_en) {
> > -		if (!intel_dp_dsc_compute_config(intel_dp, pipe_config,
> > -						 conn_state, &limits))
> > -			return false;
> > +	if (ret || intel_dp->force_dsc_en) {
> > +		ret = intel_dp_dsc_compute_config(intel_dp, pipe_config,
> > +						  conn_state, &limits);
> > +		if (ret < 0)
> > +			return ret;
> >  	}
> >  
> >  	if (pipe_config->dsc_params.compression_enable) {
> > @@ -2091,10 +2096,10 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
> >  			      intel_dp_max_data_rate(pipe_config->port_clock,
> >  						     pipe_config->lane_count));
> >  	}
> > -	return true;
> > +	return 0;
> >  }
> >  
> > -bool
> > +int
> >  intel_dp_compute_config(struct intel_encoder *encoder,
> >  			struct intel_crtc_state *pipe_config,
> >  			struct drm_connector_state *conn_state)
> > @@ -2110,6 +2115,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
> >  		to_intel_digital_connector_state(conn_state);
> >  	bool constant_n = drm_dp_has_quirk(&intel_dp->desc,
> >  					   DP_DPCD_QUIRK_CONSTANT_N);
> > +	int ret;
> >  
> >  	if (HAS_PCH_SPLIT(dev_priv) && !HAS_DDI(dev_priv) && port != PORT_A)
> >  		pipe_config->has_pch_encoder = true;
> > @@ -2131,8 +2137,6 @@ intel_dp_compute_config(struct intel_encoder *encoder,
> >  				       adjusted_mode);
> >  
> >  		if (INTEL_GEN(dev_priv) >= 9) {
> > -			int ret;
> > -
> >  			ret = skl_update_scaler_crtc(pipe_config);
> >  			if (ret)
> >  				return ret;
> > @@ -2147,20 +2151,21 @@ intel_dp_compute_config(struct intel_encoder *encoder,
> >  	}
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	if (HAS_GMCH_DISPLAY(dev_priv) &&
> >  	    adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	pipe_config->fec_enable = !intel_dp_is_edp(intel_dp) &&
> >  				  intel_dp_supports_fec(intel_dp, pipe_config);
> >  
> > -	if (!intel_dp_compute_link_config(encoder, pipe_config, conn_state))
> > -		return false;
> > +	ret = intel_dp_compute_link_config(encoder, pipe_config, conn_state);
> > +	if (ret < 0)
> > +		return ret;
> >  
> >  	if (intel_conn_state->broadcast_rgb == INTEL_BROADCAST_RGB_AUTO) {
> >  		/*
> > @@ -2208,7 +2213,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
> >  
> >  	intel_psr_compute_config(intel_dp, pipe_config);
> >  
> > -	return true;
> > +	return 0;
> >  }
> >  
> >  void intel_dp_set_link_params(struct intel_dp *intel_dp,
> > diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
> > index 3f83429333c7..a19699023db1 100644
> > --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> > +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> > @@ -29,9 +29,9 @@
> >  #include <drm/drm_crtc_helper.h>
> >  #include <drm/drm_edid.h>
> >  
> > -static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
> > -					struct intel_crtc_state *pipe_config,
> > -					struct drm_connector_state *conn_state)
> > +static int intel_dp_mst_compute_config(struct intel_encoder *encoder,
> > +				       struct intel_crtc_state *pipe_config,
> > +				       struct drm_connector_state *conn_state)
> >  {
> >  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> >  	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
> > @@ -52,7 +52,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
> >  					   DP_DPCD_QUIRK_CONSTANT_N);
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> >  	pipe_config->has_pch_encoder = false;
> > @@ -89,7 +89,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
> >  		if (slots < 0) {
> >  			DRM_DEBUG_KMS("failed finding vcpi slots:%d\n",
> >  				      slots);
> > -			return false;
> > +			return slots;
> >  		}
> >  	}
> >  
> > @@ -107,7 +107,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
> >  
> >  	intel_ddi_compute_min_voltage_level(dev_priv, pipe_config);
> >  
> > -	return true;
> > +	return 0;
> >  }
> >  
> >  static int
> > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> > index 7977843ce26a..e5a436c33307 100644
> > --- a/drivers/gpu/drm/i915/intel_drv.h
> > +++ b/drivers/gpu/drm/i915/intel_drv.h
> > @@ -225,9 +225,9 @@ struct intel_encoder {
> >  	enum intel_output_type (*compute_output_type)(struct intel_encoder *,
> >  						      struct intel_crtc_state *,
> >  						      struct drm_connector_state *);
> > -	bool (*compute_config)(struct intel_encoder *,
> > -			       struct intel_crtc_state *,
> > -			       struct drm_connector_state *);
> > +	int (*compute_config)(struct intel_encoder *,
> > +			      struct intel_crtc_state *,
> > +			      struct drm_connector_state *);
> >  	void (*pre_pll_enable)(struct intel_encoder *,
> >  			       const struct intel_crtc_state *,
> >  			       const struct drm_connector_state *);
> > @@ -1816,9 +1816,9 @@ void intel_dp_sink_set_decompression_state(struct intel_dp *intel_dp,
> >  void intel_dp_encoder_reset(struct drm_encoder *encoder);
> >  void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
> >  void intel_dp_encoder_flush_work(struct drm_encoder *encoder);
> > -bool intel_dp_compute_config(struct intel_encoder *encoder,
> > -			     struct intel_crtc_state *pipe_config,
> > -			     struct drm_connector_state *conn_state);
> > +int intel_dp_compute_config(struct intel_encoder *encoder,
> > +			    struct intel_crtc_state *pipe_config,
> > +			    struct drm_connector_state *conn_state);
> >  bool intel_dp_is_edp(struct intel_dp *intel_dp);
> >  bool intel_dp_is_port_edp(struct drm_i915_private *dev_priv, enum port port);
> >  enum irqreturn intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port,
> > @@ -1978,9 +1978,9 @@ void intel_hdmi_init(struct drm_i915_private *dev_priv, i915_reg_t hdmi_reg,
> >  void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
> >  			       struct intel_connector *intel_connector);
> >  struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder);
> > -bool intel_hdmi_compute_config(struct intel_encoder *encoder,
> > -			       struct intel_crtc_state *pipe_config,
> > -			       struct drm_connector_state *conn_state);
> > +int intel_hdmi_compute_config(struct intel_encoder *encoder,
> > +			      struct intel_crtc_state *pipe_config,
> > +			      struct drm_connector_state *conn_state);
> >  bool intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder,
> >  				       struct drm_connector *connector,
> >  				       bool high_tmds_clock_ratio,
> > diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
> > index bc3c3cb57ec6..a6c82482a841 100644
> > --- a/drivers/gpu/drm/i915/intel_dvo.c
> > +++ b/drivers/gpu/drm/i915/intel_dvo.c
> > @@ -234,9 +234,9 @@ intel_dvo_mode_valid(struct drm_connector *connector,
> >  	return intel_dvo->dev.dev_ops->mode_valid(&intel_dvo->dev, mode);
> >  }
> >  
> > -static bool intel_dvo_compute_config(struct intel_encoder *encoder,
> > -				     struct intel_crtc_state *pipe_config,
> > -				     struct drm_connector_state *conn_state)
> > +static int intel_dvo_compute_config(struct intel_encoder *encoder,
> > +				    struct intel_crtc_state *pipe_config,
> > +				    struct drm_connector_state *conn_state)
> >  {
> >  	struct intel_dvo *intel_dvo = enc_to_dvo(encoder);
> >  	const struct drm_display_mode *fixed_mode =
> > @@ -253,10 +253,11 @@ static bool intel_dvo_compute_config(struct intel_encoder *encoder,
> >  		intel_fixed_panel_mode(fixed_mode, adjusted_mode);
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> > -	return true;
> > +
> > +	return 0;
> >  }
> >  
> >  static void intel_dvo_pre_enable(struct intel_encoder *encoder,
> > diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> > index 74f4021b760c..97a98e1bea56 100644
> > --- a/drivers/gpu/drm/i915/intel_hdmi.c
> > +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> > @@ -1704,9 +1704,9 @@ intel_hdmi_ycbcr420_config(struct drm_connector *connector,
> >  	return true;
> >  }
> >  
> > -bool intel_hdmi_compute_config(struct intel_encoder *encoder,
> > -			       struct intel_crtc_state *pipe_config,
> > -			       struct drm_connector_state *conn_state)
> > +int intel_hdmi_compute_config(struct intel_encoder *encoder,
> > +			      struct intel_crtc_state *pipe_config,
> > +			      struct drm_connector_state *conn_state)
> >  {
> >  	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
> >  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> > @@ -1722,7 +1722,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
> >  	bool force_dvi = intel_conn_state->force_audio == HDMI_AUDIO_OFF_DVI;
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> >  	pipe_config->has_hdmi_sink = !force_dvi && intel_hdmi->has_hdmi_sink;
> > @@ -1753,7 +1753,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
> >  						&clock_12bpc, &clock_10bpc,
> >  						&clock_8bpc)) {
> >  			DRM_ERROR("Can't support YCBCR420 output\n");
> > -			return false;
> > +			return -EINVAL;
> >  		}
> >  	}
> >  
> > @@ -1803,7 +1803,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
> >  	if (hdmi_port_clock_valid(intel_hdmi, pipe_config->port_clock,
> >  				  false, force_dvi) != MODE_OK) {
> >  		DRM_DEBUG_KMS("unsupported HDMI clock, rejecting mode\n");
> > -		return false;
> > +		return -EINVAL;
> >  	}
> >  
> >  	/* Set user selected PAR to incoming mode's member */
> > @@ -1822,7 +1822,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
> >  		}
> >  	}
> >  
> > -	return true;
> > +	return 0;
> >  }
> >  
> >  static void
> > diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
> > index b01aacb5d73d..46a5dfd5cdf7 100644
> > --- a/drivers/gpu/drm/i915/intel_lvds.c
> > +++ b/drivers/gpu/drm/i915/intel_lvds.c
> > @@ -380,9 +380,9 @@ intel_lvds_mode_valid(struct drm_connector *connector,
> >  	return MODE_OK;
> >  }
> >  
> > -static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
> > -				      struct intel_crtc_state *pipe_config,
> > -				      struct drm_connector_state *conn_state)
> > +static int intel_lvds_compute_config(struct intel_encoder *intel_encoder,
> > +				     struct intel_crtc_state *pipe_config,
> > +				     struct drm_connector_state *conn_state)
> >  {
> >  	struct drm_i915_private *dev_priv = to_i915(intel_encoder->base.dev);
> >  	struct intel_lvds_encoder *lvds_encoder =
> > @@ -396,7 +396,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
> >  	/* Should never happen!! */
> >  	if (INTEL_GEN(dev_priv) < 4 && intel_crtc->pipe == 0) {
> >  		DRM_ERROR("Can't support LVDS on pipe A\n");
> > -		return false;
> > +		return -EINVAL;
> >  	}
> >  
> >  	if (lvds_encoder->a3_power == LVDS_A3_POWER_UP)
> > @@ -422,7 +422,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
> >  			       adjusted_mode);
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	if (HAS_PCH_SPLIT(dev_priv)) {
> >  		pipe_config->has_pch_encoder = true;
> > @@ -441,7 +441,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
> >  	 * user's requested refresh rate.
> >  	 */
> >  
> > -	return true;
> > +	return 0;
> >  }
> >  
> >  static enum drm_connector_status
> > diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> > index 4db7aefa88f9..df2d830a7405 100644
> > --- a/drivers/gpu/drm/i915/intel_sdvo.c
> > +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> > @@ -1107,9 +1107,9 @@ static void i9xx_adjust_sdvo_tv_clock(struct intel_crtc_state *pipe_config)
> >  	pipe_config->clock_set = true;
> >  }
> >  
> > -static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
> > -				      struct intel_crtc_state *pipe_config,
> > -				      struct drm_connector_state *conn_state)
> > +static int intel_sdvo_compute_config(struct intel_encoder *encoder,
> > +				     struct intel_crtc_state *pipe_config,
> > +				     struct drm_connector_state *conn_state)
> >  {
> >  	struct intel_sdvo *intel_sdvo = to_sdvo(encoder);
> >  	struct intel_sdvo_connector_state *intel_sdvo_state =
> > @@ -1134,7 +1134,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
> >  	 */
> >  	if (IS_TV(intel_sdvo_connector)) {
> >  		if (!intel_sdvo_set_output_timings_from_mode(intel_sdvo, mode))
> > -			return false;
> > +			return -EINVAL;
> >  
> >  		(void) intel_sdvo_get_preferred_input_mode(intel_sdvo,
> >  							   intel_sdvo_connector,
> > @@ -1144,7 +1144,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
> >  	} else if (IS_LVDS(intel_sdvo_connector)) {
> >  		if (!intel_sdvo_set_output_timings_from_mode(intel_sdvo,
> >  							     intel_sdvo_connector->base.panel.fixed_mode))
> > -			return false;
> > +			return -EINVAL;
> >  
> >  		(void) intel_sdvo_get_preferred_input_mode(intel_sdvo,
> >  							   intel_sdvo_connector,
> > @@ -1153,7 +1153,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
> >  	}
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	/*
> >  	 * Make the CRTC code factor in the SDVO pixel multiplier.  The
> > @@ -1193,7 +1193,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
> >  	if (intel_sdvo_connector->is_hdmi)
> >  		adjusted_mode->picture_aspect_ratio = conn_state->picture_aspect_ratio;
> >  
> > -	return true;
> > +	return 0;
> >  }
> >  
> >  #define UPDATE_PROPERTY(input, NAME) \
> > diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
> > index d7a414ce2774..bd5536f0ec92 100644
> > --- a/drivers/gpu/drm/i915/intel_tv.c
> > +++ b/drivers/gpu/drm/i915/intel_tv.c
> > @@ -869,7 +869,7 @@ intel_tv_get_config(struct intel_encoder *encoder,
> >  	pipe_config->base.adjusted_mode.crtc_clock = pipe_config->port_clock;
> >  }
> >  
> > -static bool
> > +static int
> >  intel_tv_compute_config(struct intel_encoder *encoder,
> >  			struct intel_crtc_state *pipe_config,
> >  			struct drm_connector_state *conn_state)
> > @@ -879,10 +879,10 @@ intel_tv_compute_config(struct intel_encoder *encoder,
> >  		&pipe_config->base.adjusted_mode;
> >  
> >  	if (!tv_mode)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> >  	adjusted_mode->crtc_clock = tv_mode->clock;
> > @@ -897,7 +897,7 @@ intel_tv_compute_config(struct intel_encoder *encoder,
> >  	 * or whether userspace is doing something stupid.
> >  	 */
> >  
> > -	return true;
> > +	return 0;
> >  }
> >  
> >  static void
> > diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
> > index d116fead8514..c247ce74b71a 100644
> > --- a/drivers/gpu/drm/i915/vlv_dsi.c
> > +++ b/drivers/gpu/drm/i915/vlv_dsi.c
> > @@ -256,9 +256,9 @@ static void band_gap_reset(struct drm_i915_private *dev_priv)
> >  	mutex_unlock(&dev_priv->sb_lock);
> >  }
> >  
> > -static bool intel_dsi_compute_config(struct intel_encoder *encoder,
> > -				     struct intel_crtc_state *pipe_config,
> > -				     struct drm_connector_state *conn_state)
> > +static int intel_dsi_compute_config(struct intel_encoder *encoder,
> > +				    struct intel_crtc_state *pipe_config,
> > +				    struct drm_connector_state *conn_state)
> >  {
> >  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> >  	struct intel_dsi *intel_dsi = container_of(encoder, struct intel_dsi,
> > @@ -284,7 +284,7 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
> >  	}
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	/* DSI uses short packets for sync events, so clear mode flags for DSI */
> >  	adjusted_mode->flags = 0;
> > @@ -302,16 +302,16 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
> >  
> >  		ret = bxt_dsi_pll_compute(encoder, pipe_config);
> >  		if (ret)
> > -			return false;
> > +			return -EINVAL;
> >  	} else {
> >  		ret = vlv_dsi_pll_compute(encoder, pipe_config);
> >  		if (ret)
> > -			return false;
> > +			return -EINVAL;
> >  	}
> >  
> >  	pipe_config->clock_set = true;
> >  
> > -	return true;
> > +	return 0;
> >  }
> >  
> >  static bool glk_dsi_enable_io(struct intel_encoder *encoder)
> 
> -- 
> Jani Nikula, Intel Open Source Graphics Center

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] drm/i915: Pass down rc in intel_encoder->compute_config()
@ 2019-01-16 10:19     ` Daniel Vetter
  0 siblings, 0 replies; 12+ messages in thread
From: Daniel Vetter @ 2019-01-16 10:19 UTC (permalink / raw)
  To: Jani Nikula; +Cc: David Airlie, intel-gfx, linux-kernel, dri-devel

On Wed, Jan 16, 2019 at 09:47:17AM +0200, Jani Nikula wrote:
> On Tue, 15 Jan 2019, Lyude Paul <lyude@redhat.com> wrote:
> > Something that I completely missed when implementing the new MST VCPI
> > atomic helpers is that with those helpers, there's technically a chance
> > of us having to grab additional modeset locks in ->compute_config() and
> > furthermore, that means we have the potential to hit a normal modeset
> > deadlock. However, because ->compute_config() only returns a bool this
> > means we can't return -EDEADLK when we need to drop locks and try again
> > which means we end up just failing the atomic check permanently. Whoops.
> >
> > So, fix this by modifying ->compute_config() to pass down an actual
> > error code instead of a bool so that the atomic check can be restarted
> > on modeset deadlocks.
> >
> > Thanks to Ville Syrjälä for pointing this out!
> >
> > Changes since v1:
> > * Add some newlines
> > * Return only -EINVAL from hsw_crt_compute_config()
> > * Propogate return code from intel_dp_compute_dsc_params()
> > * Change all of the intel_dp_compute_link_config*() variants
> > * Don't miss if (hdmi_port_clock_valid()) branch in
> >   intel_hdmi_compute_config()
> >
> > Signed-off-by: Lyude Paul <lyude@redhat.com>
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Fixes: eceae1472467 ("drm/dp_mst: Start tracking per-port VCPI allocations")
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109320
> > ---
> >  drivers/gpu/drm/i915/icl_dsi.c       |  8 ++--
> >  drivers/gpu/drm/i915/intel_crt.c     | 35 +++++++-------
> >  drivers/gpu/drm/i915/intel_ddi.c     |  6 +--
> >  drivers/gpu/drm/i915/intel_display.c | 11 +++--
> >  drivers/gpu/drm/i915/intel_dp.c      | 71 +++++++++++++++-------------
> >  drivers/gpu/drm/i915/intel_dp_mst.c  | 12 ++---
> >  drivers/gpu/drm/i915/intel_drv.h     | 18 +++----
> >  drivers/gpu/drm/i915/intel_dvo.c     | 11 +++--
> >  drivers/gpu/drm/i915/intel_hdmi.c    | 14 +++---
> >  drivers/gpu/drm/i915/intel_lvds.c    | 12 ++---
> >  drivers/gpu/drm/i915/intel_sdvo.c    | 14 +++---
> >  drivers/gpu/drm/i915/intel_tv.c      |  8 ++--
> >  drivers/gpu/drm/i915/vlv_dsi.c       | 14 +++---
> >  13 files changed, 122 insertions(+), 112 deletions(-)
> 
> Despite being an all i915 patch, this got applied to drm-misc-next,
> causing conflicts where there really should have been none. :(
> 
> I am tempted to suggest reverting and re-applying to drm-intel, because
> it will take weeks to sync both to drm-next and backmerge, and applying
> further work on top in drm-intel will just cause more trouble.
> 
> Other ideas?

We discussed this a bit on irc. I think the best option is to cherry-pick
this patch over to drm-intel-next-queued and try to get the backmerges
sorted asap.

With hindsight a topic branch for all the mst stuff would have been really
good choice. And as Jani mentioned on irc, pls get maintainer's ack when
merging stuff through different trees. I wanted to ask about that but
figured I have time until nouveau stuff is reviewed, but then it landed
right away. Anyway, conflict isn't bad enough that sfr couldn't handle it,
so we didn't screw up too badly :-)

Thanks, Daniel
> 
> BR,
> Jani.
> 
> 
> >
> > diff --git a/drivers/gpu/drm/i915/icl_dsi.c b/drivers/gpu/drm/i915/icl_dsi.c
> > index f3a5f03646ce..355b48d1c937 100644
> > --- a/drivers/gpu/drm/i915/icl_dsi.c
> > +++ b/drivers/gpu/drm/i915/icl_dsi.c
> > @@ -1188,9 +1188,9 @@ static void gen11_dsi_get_config(struct intel_encoder *encoder,
> >  	pipe_config->output_types |= BIT(INTEL_OUTPUT_DSI);
> >  }
> >  
> > -static bool gen11_dsi_compute_config(struct intel_encoder *encoder,
> > -				     struct intel_crtc_state *pipe_config,
> > -				     struct drm_connector_state *conn_state)
> > +static int gen11_dsi_compute_config(struct intel_encoder *encoder,
> > +				    struct intel_crtc_state *pipe_config,
> > +				    struct drm_connector_state *conn_state)
> >  {
> >  	struct intel_dsi *intel_dsi = container_of(encoder, struct intel_dsi,
> >  						   base);
> > @@ -1215,7 +1215,7 @@ static bool gen11_dsi_compute_config(struct intel_encoder *encoder,
> >  	pipe_config->clock_set = true;
> >  	pipe_config->port_clock = intel_dsi_bitrate(intel_dsi) / 5;
> >  
> > -	return true;
> > +	return 0;
> >  }
> >  
> >  static u64 gen11_dsi_get_power_domains(struct intel_encoder *encoder,
> > diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
> > index 33bd2addcbdd..081c333f30d2 100644
> > --- a/drivers/gpu/drm/i915/intel_crt.c
> > +++ b/drivers/gpu/drm/i915/intel_crt.c
> > @@ -345,51 +345,52 @@ intel_crt_mode_valid(struct drm_connector *connector,
> >  	return MODE_OK;
> >  }
> >  
> > -static bool intel_crt_compute_config(struct intel_encoder *encoder,
> > -				     struct intel_crtc_state *pipe_config,
> > -				     struct drm_connector_state *conn_state)
> > +static int intel_crt_compute_config(struct intel_encoder *encoder,
> > +				    struct intel_crtc_state *pipe_config,
> > +				    struct drm_connector_state *conn_state)
> >  {
> >  	struct drm_display_mode *adjusted_mode =
> >  		&pipe_config->base.adjusted_mode;
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> > -	return true;
> > +
> > +	return 0;
> >  }
> >  
> > -static bool pch_crt_compute_config(struct intel_encoder *encoder,
> > -				   struct intel_crtc_state *pipe_config,
> > -				   struct drm_connector_state *conn_state)
> > +static int pch_crt_compute_config(struct intel_encoder *encoder,
> > +				  struct intel_crtc_state *pipe_config,
> > +				  struct drm_connector_state *conn_state)
> >  {
> >  	struct drm_display_mode *adjusted_mode =
> >  		&pipe_config->base.adjusted_mode;
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	pipe_config->has_pch_encoder = true;
> >  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> >  
> > -	return true;
> > +	return 0;
> >  }
> >  
> > -static bool hsw_crt_compute_config(struct intel_encoder *encoder,
> > -				   struct intel_crtc_state *pipe_config,
> > -				   struct drm_connector_state *conn_state)
> > +static int hsw_crt_compute_config(struct intel_encoder *encoder,
> > +				  struct intel_crtc_state *pipe_config,
> > +				  struct drm_connector_state *conn_state)
> >  {
> >  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> >  	struct drm_display_mode *adjusted_mode =
> >  		&pipe_config->base.adjusted_mode;
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	/* HSW/BDW FDI limited to 4k */
> >  	if (adjusted_mode->crtc_hdisplay > 4096 ||
> >  	    adjusted_mode->crtc_hblank_start > 4096)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	pipe_config->has_pch_encoder = true;
> >  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> > @@ -398,7 +399,7 @@ static bool hsw_crt_compute_config(struct intel_encoder *encoder,
> >  	if (HAS_PCH_LPT(dev_priv)) {
> >  		if (pipe_config->bw_constrained && pipe_config->pipe_bpp < 24) {
> >  			DRM_DEBUG_KMS("LPT only supports 24bpp\n");
> > -			return false;
> > +			return -EINVAL;
> >  		}
> >  
> >  		pipe_config->pipe_bpp = 24;
> > @@ -407,7 +408,7 @@ static bool hsw_crt_compute_config(struct intel_encoder *encoder,
> >  	/* FDI must always be 2.7 GHz */
> >  	pipe_config->port_clock = 135000 * 2;
> >  
> > -	return true;
> > +	return 0;
> >  }
> >  
> >  static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector)
> > diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> > index 7f3cd055de50..ce44744a5f9d 100644
> > --- a/drivers/gpu/drm/i915/intel_ddi.c
> > +++ b/drivers/gpu/drm/i915/intel_ddi.c
> > @@ -3837,9 +3837,9 @@ intel_ddi_compute_output_type(struct intel_encoder *encoder,
> >  	}
> >  }
> >  
> > -static bool intel_ddi_compute_config(struct intel_encoder *encoder,
> > -				     struct intel_crtc_state *pipe_config,
> > -				     struct drm_connector_state *conn_state)
> > +static int intel_ddi_compute_config(struct intel_encoder *encoder,
> > +				    struct intel_crtc_state *pipe_config,
> > +				    struct drm_connector_state *conn_state)
> >  {
> >  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> >  	enum port port = encoder->port;
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index 0a5ba45f5eb0..af164d712e9e 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -11553,10 +11553,13 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
> >  			continue;
> >  
> >  		encoder = to_intel_encoder(connector_state->best_encoder);
> > -
> > -		if (!(encoder->compute_config(encoder, pipe_config, connector_state))) {
> > -			DRM_DEBUG_KMS("Encoder config failure\n");
> > -			return -EINVAL;
> > +		ret = encoder->compute_config(encoder, pipe_config,
> > +					      connector_state);
> > +		if (ret < 0) {
> > +			if (ret != -EDEADLK)
> > +				DRM_DEBUG_KMS("Encoder config failure: %d\n",
> > +					      ret);
> > +			return ret;
> >  		}
> >  	}
> >  
> > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> > index 0a3ac98a779e..df4292bb1a4f 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -1819,7 +1819,7 @@ intel_dp_adjust_compliance_config(struct intel_dp *intel_dp,
> >  }
> >  
> >  /* Optimize link config in order: max bpp, min clock, min lanes */
> > -static bool
> > +static int
> >  intel_dp_compute_link_config_wide(struct intel_dp *intel_dp,
> >  				  struct intel_crtc_state *pipe_config,
> >  				  const struct link_config_limits *limits)
> > @@ -1845,17 +1845,17 @@ intel_dp_compute_link_config_wide(struct intel_dp *intel_dp,
> >  					pipe_config->pipe_bpp = bpp;
> >  					pipe_config->port_clock = link_clock;
> >  
> > -					return true;
> > +					return 0;
> >  				}
> >  			}
> >  		}
> >  	}
> >  
> > -	return false;
> > +	return -EINVAL;
> >  }
> >  
> >  /* Optimize link config in order: max bpp, min lanes, min clock */
> > -static bool
> > +static int
> >  intel_dp_compute_link_config_fast(struct intel_dp *intel_dp,
> >  				  struct intel_crtc_state *pipe_config,
> >  				  const struct link_config_limits *limits)
> > @@ -1881,13 +1881,13 @@ intel_dp_compute_link_config_fast(struct intel_dp *intel_dp,
> >  					pipe_config->pipe_bpp = bpp;
> >  					pipe_config->port_clock = link_clock;
> >  
> > -					return true;
> > +					return 0;
> >  				}
> >  			}
> >  		}
> >  	}
> >  
> > -	return false;
> > +	return -EINVAL;
> >  }
> >  
> >  static int intel_dp_dsc_compute_bpp(struct intel_dp *intel_dp, u8 dsc_max_bpc)
> > @@ -1905,19 +1905,20 @@ static int intel_dp_dsc_compute_bpp(struct intel_dp *intel_dp, u8 dsc_max_bpc)
> >  	return 0;
> >  }
> >  
> > -static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
> > -					struct intel_crtc_state *pipe_config,
> > -					struct drm_connector_state *conn_state,
> > -					struct link_config_limits *limits)
> > +static int intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
> > +				       struct intel_crtc_state *pipe_config,
> > +				       struct drm_connector_state *conn_state,
> > +				       struct link_config_limits *limits)
> >  {
> >  	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
> >  	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
> >  	struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
> >  	u8 dsc_max_bpc;
> >  	int pipe_bpp;
> > +	int ret;
> >  
> >  	if (!intel_dp_supports_dsc(intel_dp, pipe_config))
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	dsc_max_bpc = min_t(u8, DP_DSC_MAX_SUPPORTED_BPC,
> >  			    conn_state->max_requested_bpc);
> > @@ -1925,7 +1926,7 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
> >  	pipe_bpp = intel_dp_dsc_compute_bpp(intel_dp, dsc_max_bpc);
> >  	if (pipe_bpp < DP_DSC_MIN_SUPPORTED_BPC * 3) {
> >  		DRM_DEBUG_KMS("No DSC support for less than 8bpc\n");
> > -		return false;
> > +		return -EINVAL;
> >  	}
> >  
> >  	/*
> > @@ -1959,7 +1960,7 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
> >  						     adjusted_mode->crtc_hdisplay);
> >  		if (!dsc_max_output_bpp || !dsc_dp_slice_count) {
> >  			DRM_DEBUG_KMS("Compressed BPP/Slice Count not supported\n");
> > -			return false;
> > +			return -EINVAL;
> >  		}
> >  		pipe_config->dsc_params.compressed_bpp = min_t(u16,
> >  							       dsc_max_output_bpp >> 4,
> > @@ -1976,16 +1977,19 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
> >  			pipe_config->dsc_params.dsc_split = true;
> >  		} else {
> >  			DRM_DEBUG_KMS("Cannot split stream to use 2 VDSC instances\n");
> > -			return false;
> > +			return -EINVAL;
> >  		}
> >  	}
> > -	if (intel_dp_compute_dsc_params(intel_dp, pipe_config) < 0) {
> > +
> > +	ret = intel_dp_compute_dsc_params(intel_dp, pipe_config);
> > +	if (ret < 0) {
> >  		DRM_DEBUG_KMS("Cannot compute valid DSC parameters for Input Bpp = %d "
> >  			      "Compressed BPP = %d\n",
> >  			      pipe_config->pipe_bpp,
> >  			      pipe_config->dsc_params.compressed_bpp);
> > -		return false;
> > +		return ret;
> >  	}
> > +
> >  	pipe_config->dsc_params.compression_enable = true;
> >  	DRM_DEBUG_KMS("DP DSC computed with Input Bpp = %d "
> >  		      "Compressed Bpp = %d Slice Count = %d\n",
> > @@ -1993,10 +1997,10 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
> >  		      pipe_config->dsc_params.compressed_bpp,
> >  		      pipe_config->dsc_params.slice_count);
> >  
> > -	return true;
> > +	return 0;
> >  }
> >  
> > -static bool
> > +static int
> >  intel_dp_compute_link_config(struct intel_encoder *encoder,
> >  			     struct intel_crtc_state *pipe_config,
> >  			     struct drm_connector_state *conn_state)
> > @@ -2005,7 +2009,7 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
> >  	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
> >  	struct link_config_limits limits;
> >  	int common_len;
> > -	bool ret;
> > +	int ret;
> >  
> >  	common_len = intel_dp_common_len_rate_limit(intel_dp,
> >  						    intel_dp->max_link_rate);
> > @@ -2063,10 +2067,11 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
> >  
> >  	/* enable compression if the mode doesn't fit available BW */
> >  	DRM_DEBUG_KMS("Force DSC en = %d\n", intel_dp->force_dsc_en);
> > -	if (!ret || intel_dp->force_dsc_en) {
> > -		if (!intel_dp_dsc_compute_config(intel_dp, pipe_config,
> > -						 conn_state, &limits))
> > -			return false;
> > +	if (ret || intel_dp->force_dsc_en) {
> > +		ret = intel_dp_dsc_compute_config(intel_dp, pipe_config,
> > +						  conn_state, &limits);
> > +		if (ret < 0)
> > +			return ret;
> >  	}
> >  
> >  	if (pipe_config->dsc_params.compression_enable) {
> > @@ -2091,10 +2096,10 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
> >  			      intel_dp_max_data_rate(pipe_config->port_clock,
> >  						     pipe_config->lane_count));
> >  	}
> > -	return true;
> > +	return 0;
> >  }
> >  
> > -bool
> > +int
> >  intel_dp_compute_config(struct intel_encoder *encoder,
> >  			struct intel_crtc_state *pipe_config,
> >  			struct drm_connector_state *conn_state)
> > @@ -2110,6 +2115,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
> >  		to_intel_digital_connector_state(conn_state);
> >  	bool constant_n = drm_dp_has_quirk(&intel_dp->desc,
> >  					   DP_DPCD_QUIRK_CONSTANT_N);
> > +	int ret;
> >  
> >  	if (HAS_PCH_SPLIT(dev_priv) && !HAS_DDI(dev_priv) && port != PORT_A)
> >  		pipe_config->has_pch_encoder = true;
> > @@ -2131,8 +2137,6 @@ intel_dp_compute_config(struct intel_encoder *encoder,
> >  				       adjusted_mode);
> >  
> >  		if (INTEL_GEN(dev_priv) >= 9) {
> > -			int ret;
> > -
> >  			ret = skl_update_scaler_crtc(pipe_config);
> >  			if (ret)
> >  				return ret;
> > @@ -2147,20 +2151,21 @@ intel_dp_compute_config(struct intel_encoder *encoder,
> >  	}
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	if (HAS_GMCH_DISPLAY(dev_priv) &&
> >  	    adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	pipe_config->fec_enable = !intel_dp_is_edp(intel_dp) &&
> >  				  intel_dp_supports_fec(intel_dp, pipe_config);
> >  
> > -	if (!intel_dp_compute_link_config(encoder, pipe_config, conn_state))
> > -		return false;
> > +	ret = intel_dp_compute_link_config(encoder, pipe_config, conn_state);
> > +	if (ret < 0)
> > +		return ret;
> >  
> >  	if (intel_conn_state->broadcast_rgb == INTEL_BROADCAST_RGB_AUTO) {
> >  		/*
> > @@ -2208,7 +2213,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
> >  
> >  	intel_psr_compute_config(intel_dp, pipe_config);
> >  
> > -	return true;
> > +	return 0;
> >  }
> >  
> >  void intel_dp_set_link_params(struct intel_dp *intel_dp,
> > diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
> > index 3f83429333c7..a19699023db1 100644
> > --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> > +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> > @@ -29,9 +29,9 @@
> >  #include <drm/drm_crtc_helper.h>
> >  #include <drm/drm_edid.h>
> >  
> > -static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
> > -					struct intel_crtc_state *pipe_config,
> > -					struct drm_connector_state *conn_state)
> > +static int intel_dp_mst_compute_config(struct intel_encoder *encoder,
> > +				       struct intel_crtc_state *pipe_config,
> > +				       struct drm_connector_state *conn_state)
> >  {
> >  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> >  	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
> > @@ -52,7 +52,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
> >  					   DP_DPCD_QUIRK_CONSTANT_N);
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> >  	pipe_config->has_pch_encoder = false;
> > @@ -89,7 +89,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
> >  		if (slots < 0) {
> >  			DRM_DEBUG_KMS("failed finding vcpi slots:%d\n",
> >  				      slots);
> > -			return false;
> > +			return slots;
> >  		}
> >  	}
> >  
> > @@ -107,7 +107,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
> >  
> >  	intel_ddi_compute_min_voltage_level(dev_priv, pipe_config);
> >  
> > -	return true;
> > +	return 0;
> >  }
> >  
> >  static int
> > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> > index 7977843ce26a..e5a436c33307 100644
> > --- a/drivers/gpu/drm/i915/intel_drv.h
> > +++ b/drivers/gpu/drm/i915/intel_drv.h
> > @@ -225,9 +225,9 @@ struct intel_encoder {
> >  	enum intel_output_type (*compute_output_type)(struct intel_encoder *,
> >  						      struct intel_crtc_state *,
> >  						      struct drm_connector_state *);
> > -	bool (*compute_config)(struct intel_encoder *,
> > -			       struct intel_crtc_state *,
> > -			       struct drm_connector_state *);
> > +	int (*compute_config)(struct intel_encoder *,
> > +			      struct intel_crtc_state *,
> > +			      struct drm_connector_state *);
> >  	void (*pre_pll_enable)(struct intel_encoder *,
> >  			       const struct intel_crtc_state *,
> >  			       const struct drm_connector_state *);
> > @@ -1816,9 +1816,9 @@ void intel_dp_sink_set_decompression_state(struct intel_dp *intel_dp,
> >  void intel_dp_encoder_reset(struct drm_encoder *encoder);
> >  void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
> >  void intel_dp_encoder_flush_work(struct drm_encoder *encoder);
> > -bool intel_dp_compute_config(struct intel_encoder *encoder,
> > -			     struct intel_crtc_state *pipe_config,
> > -			     struct drm_connector_state *conn_state);
> > +int intel_dp_compute_config(struct intel_encoder *encoder,
> > +			    struct intel_crtc_state *pipe_config,
> > +			    struct drm_connector_state *conn_state);
> >  bool intel_dp_is_edp(struct intel_dp *intel_dp);
> >  bool intel_dp_is_port_edp(struct drm_i915_private *dev_priv, enum port port);
> >  enum irqreturn intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port,
> > @@ -1978,9 +1978,9 @@ void intel_hdmi_init(struct drm_i915_private *dev_priv, i915_reg_t hdmi_reg,
> >  void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
> >  			       struct intel_connector *intel_connector);
> >  struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder);
> > -bool intel_hdmi_compute_config(struct intel_encoder *encoder,
> > -			       struct intel_crtc_state *pipe_config,
> > -			       struct drm_connector_state *conn_state);
> > +int intel_hdmi_compute_config(struct intel_encoder *encoder,
> > +			      struct intel_crtc_state *pipe_config,
> > +			      struct drm_connector_state *conn_state);
> >  bool intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder,
> >  				       struct drm_connector *connector,
> >  				       bool high_tmds_clock_ratio,
> > diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
> > index bc3c3cb57ec6..a6c82482a841 100644
> > --- a/drivers/gpu/drm/i915/intel_dvo.c
> > +++ b/drivers/gpu/drm/i915/intel_dvo.c
> > @@ -234,9 +234,9 @@ intel_dvo_mode_valid(struct drm_connector *connector,
> >  	return intel_dvo->dev.dev_ops->mode_valid(&intel_dvo->dev, mode);
> >  }
> >  
> > -static bool intel_dvo_compute_config(struct intel_encoder *encoder,
> > -				     struct intel_crtc_state *pipe_config,
> > -				     struct drm_connector_state *conn_state)
> > +static int intel_dvo_compute_config(struct intel_encoder *encoder,
> > +				    struct intel_crtc_state *pipe_config,
> > +				    struct drm_connector_state *conn_state)
> >  {
> >  	struct intel_dvo *intel_dvo = enc_to_dvo(encoder);
> >  	const struct drm_display_mode *fixed_mode =
> > @@ -253,10 +253,11 @@ static bool intel_dvo_compute_config(struct intel_encoder *encoder,
> >  		intel_fixed_panel_mode(fixed_mode, adjusted_mode);
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> > -	return true;
> > +
> > +	return 0;
> >  }
> >  
> >  static void intel_dvo_pre_enable(struct intel_encoder *encoder,
> > diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> > index 74f4021b760c..97a98e1bea56 100644
> > --- a/drivers/gpu/drm/i915/intel_hdmi.c
> > +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> > @@ -1704,9 +1704,9 @@ intel_hdmi_ycbcr420_config(struct drm_connector *connector,
> >  	return true;
> >  }
> >  
> > -bool intel_hdmi_compute_config(struct intel_encoder *encoder,
> > -			       struct intel_crtc_state *pipe_config,
> > -			       struct drm_connector_state *conn_state)
> > +int intel_hdmi_compute_config(struct intel_encoder *encoder,
> > +			      struct intel_crtc_state *pipe_config,
> > +			      struct drm_connector_state *conn_state)
> >  {
> >  	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
> >  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> > @@ -1722,7 +1722,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
> >  	bool force_dvi = intel_conn_state->force_audio == HDMI_AUDIO_OFF_DVI;
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> >  	pipe_config->has_hdmi_sink = !force_dvi && intel_hdmi->has_hdmi_sink;
> > @@ -1753,7 +1753,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
> >  						&clock_12bpc, &clock_10bpc,
> >  						&clock_8bpc)) {
> >  			DRM_ERROR("Can't support YCBCR420 output\n");
> > -			return false;
> > +			return -EINVAL;
> >  		}
> >  	}
> >  
> > @@ -1803,7 +1803,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
> >  	if (hdmi_port_clock_valid(intel_hdmi, pipe_config->port_clock,
> >  				  false, force_dvi) != MODE_OK) {
> >  		DRM_DEBUG_KMS("unsupported HDMI clock, rejecting mode\n");
> > -		return false;
> > +		return -EINVAL;
> >  	}
> >  
> >  	/* Set user selected PAR to incoming mode's member */
> > @@ -1822,7 +1822,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
> >  		}
> >  	}
> >  
> > -	return true;
> > +	return 0;
> >  }
> >  
> >  static void
> > diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
> > index b01aacb5d73d..46a5dfd5cdf7 100644
> > --- a/drivers/gpu/drm/i915/intel_lvds.c
> > +++ b/drivers/gpu/drm/i915/intel_lvds.c
> > @@ -380,9 +380,9 @@ intel_lvds_mode_valid(struct drm_connector *connector,
> >  	return MODE_OK;
> >  }
> >  
> > -static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
> > -				      struct intel_crtc_state *pipe_config,
> > -				      struct drm_connector_state *conn_state)
> > +static int intel_lvds_compute_config(struct intel_encoder *intel_encoder,
> > +				     struct intel_crtc_state *pipe_config,
> > +				     struct drm_connector_state *conn_state)
> >  {
> >  	struct drm_i915_private *dev_priv = to_i915(intel_encoder->base.dev);
> >  	struct intel_lvds_encoder *lvds_encoder =
> > @@ -396,7 +396,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
> >  	/* Should never happen!! */
> >  	if (INTEL_GEN(dev_priv) < 4 && intel_crtc->pipe == 0) {
> >  		DRM_ERROR("Can't support LVDS on pipe A\n");
> > -		return false;
> > +		return -EINVAL;
> >  	}
> >  
> >  	if (lvds_encoder->a3_power == LVDS_A3_POWER_UP)
> > @@ -422,7 +422,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
> >  			       adjusted_mode);
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	if (HAS_PCH_SPLIT(dev_priv)) {
> >  		pipe_config->has_pch_encoder = true;
> > @@ -441,7 +441,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
> >  	 * user's requested refresh rate.
> >  	 */
> >  
> > -	return true;
> > +	return 0;
> >  }
> >  
> >  static enum drm_connector_status
> > diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> > index 4db7aefa88f9..df2d830a7405 100644
> > --- a/drivers/gpu/drm/i915/intel_sdvo.c
> > +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> > @@ -1107,9 +1107,9 @@ static void i9xx_adjust_sdvo_tv_clock(struct intel_crtc_state *pipe_config)
> >  	pipe_config->clock_set = true;
> >  }
> >  
> > -static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
> > -				      struct intel_crtc_state *pipe_config,
> > -				      struct drm_connector_state *conn_state)
> > +static int intel_sdvo_compute_config(struct intel_encoder *encoder,
> > +				     struct intel_crtc_state *pipe_config,
> > +				     struct drm_connector_state *conn_state)
> >  {
> >  	struct intel_sdvo *intel_sdvo = to_sdvo(encoder);
> >  	struct intel_sdvo_connector_state *intel_sdvo_state =
> > @@ -1134,7 +1134,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
> >  	 */
> >  	if (IS_TV(intel_sdvo_connector)) {
> >  		if (!intel_sdvo_set_output_timings_from_mode(intel_sdvo, mode))
> > -			return false;
> > +			return -EINVAL;
> >  
> >  		(void) intel_sdvo_get_preferred_input_mode(intel_sdvo,
> >  							   intel_sdvo_connector,
> > @@ -1144,7 +1144,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
> >  	} else if (IS_LVDS(intel_sdvo_connector)) {
> >  		if (!intel_sdvo_set_output_timings_from_mode(intel_sdvo,
> >  							     intel_sdvo_connector->base.panel.fixed_mode))
> > -			return false;
> > +			return -EINVAL;
> >  
> >  		(void) intel_sdvo_get_preferred_input_mode(intel_sdvo,
> >  							   intel_sdvo_connector,
> > @@ -1153,7 +1153,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
> >  	}
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	/*
> >  	 * Make the CRTC code factor in the SDVO pixel multiplier.  The
> > @@ -1193,7 +1193,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
> >  	if (intel_sdvo_connector->is_hdmi)
> >  		adjusted_mode->picture_aspect_ratio = conn_state->picture_aspect_ratio;
> >  
> > -	return true;
> > +	return 0;
> >  }
> >  
> >  #define UPDATE_PROPERTY(input, NAME) \
> > diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
> > index d7a414ce2774..bd5536f0ec92 100644
> > --- a/drivers/gpu/drm/i915/intel_tv.c
> > +++ b/drivers/gpu/drm/i915/intel_tv.c
> > @@ -869,7 +869,7 @@ intel_tv_get_config(struct intel_encoder *encoder,
> >  	pipe_config->base.adjusted_mode.crtc_clock = pipe_config->port_clock;
> >  }
> >  
> > -static bool
> > +static int
> >  intel_tv_compute_config(struct intel_encoder *encoder,
> >  			struct intel_crtc_state *pipe_config,
> >  			struct drm_connector_state *conn_state)
> > @@ -879,10 +879,10 @@ intel_tv_compute_config(struct intel_encoder *encoder,
> >  		&pipe_config->base.adjusted_mode;
> >  
> >  	if (!tv_mode)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> >  	adjusted_mode->crtc_clock = tv_mode->clock;
> > @@ -897,7 +897,7 @@ intel_tv_compute_config(struct intel_encoder *encoder,
> >  	 * or whether userspace is doing something stupid.
> >  	 */
> >  
> > -	return true;
> > +	return 0;
> >  }
> >  
> >  static void
> > diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
> > index d116fead8514..c247ce74b71a 100644
> > --- a/drivers/gpu/drm/i915/vlv_dsi.c
> > +++ b/drivers/gpu/drm/i915/vlv_dsi.c
> > @@ -256,9 +256,9 @@ static void band_gap_reset(struct drm_i915_private *dev_priv)
> >  	mutex_unlock(&dev_priv->sb_lock);
> >  }
> >  
> > -static bool intel_dsi_compute_config(struct intel_encoder *encoder,
> > -				     struct intel_crtc_state *pipe_config,
> > -				     struct drm_connector_state *conn_state)
> > +static int intel_dsi_compute_config(struct intel_encoder *encoder,
> > +				    struct intel_crtc_state *pipe_config,
> > +				    struct drm_connector_state *conn_state)
> >  {
> >  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> >  	struct intel_dsi *intel_dsi = container_of(encoder, struct intel_dsi,
> > @@ -284,7 +284,7 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
> >  	}
> >  
> >  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
> > -		return false;
> > +		return -EINVAL;
> >  
> >  	/* DSI uses short packets for sync events, so clear mode flags for DSI */
> >  	adjusted_mode->flags = 0;
> > @@ -302,16 +302,16 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
> >  
> >  		ret = bxt_dsi_pll_compute(encoder, pipe_config);
> >  		if (ret)
> > -			return false;
> > +			return -EINVAL;
> >  	} else {
> >  		ret = vlv_dsi_pll_compute(encoder, pipe_config);
> >  		if (ret)
> > -			return false;
> > +			return -EINVAL;
> >  	}
> >  
> >  	pipe_config->clock_set = true;
> >  
> > -	return true;
> > +	return 0;
> >  }
> >  
> >  static bool glk_dsi_enable_io(struct intel_encoder *encoder)
> 
> -- 
> Jani Nikula, Intel Open Source Graphics Center

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-01-16 10:19 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-15 20:08 [PATCH v2] drm/i915: Pass down rc in intel_encoder->compute_config() Lyude Paul
2019-01-15 20:08 ` Lyude Paul
2019-01-15 20:14 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Pass down rc in intel_encoder->compute_config() (rev2) Patchwork
2019-01-15 20:15 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-01-15 20:19 ` [PATCH v2] drm/i915: Pass down rc in intel_encoder->compute_config() Ville Syrjälä
2019-01-15 20:19   ` Ville Syrjälä
2019-01-15 20:32 ` ✓ Fi.CI.BAT: success for drm/i915: Pass down rc in intel_encoder->compute_config() (rev2) Patchwork
2019-01-16  3:15 ` ✗ Fi.CI.IGT: failure " Patchwork
2019-01-16  7:47 ` [PATCH v2] drm/i915: Pass down rc in intel_encoder->compute_config() Jani Nikula
2019-01-16  7:47   ` Jani Nikula
2019-01-16 10:19   ` Daniel Vetter
2019-01-16 10:19     ` Daniel Vetter

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.