[Intel-gfx] [PATCH v2] drm/i915: Fix the i915_dsc_fec_support debugfs file for DP MST connectors

Imre Deak imre.deak at intel.com
Mon Jun 8 18:26:50 UTC 2020


DSC is not supported on DP MST streams so just return -EINVAL when
reading/writing the i915_dsc_fec_support debugfs file for such
connectors.

This also fixes an OOPS, caused by the encoder->digport cast, which is
not valid for MST encoders.

v2:
- Check encoder, which is unset for an MST connector, before it gets
  enabled.

Signed-off-by: Imre Deak <imre.deak at intel.com>
---
 .../drm/i915/display/intel_display_debugfs.c  | 36 +++++++++++++++----
 1 file changed, 29 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
index 2b640d8ab9d2..9db6f7e0ccaa 100644
--- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
+++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
@@ -2094,6 +2094,8 @@ static int i915_dsc_fec_support_show(struct seq_file *m, void *data)
 	drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
 
 	do {
+		struct intel_encoder *encoder;
+
 		try_again = false;
 		ret = drm_modeset_lock(&dev->mode_config.connection_mutex,
 				       &ctx);
@@ -2120,8 +2122,17 @@ static int i915_dsc_fec_support_show(struct seq_file *m, void *data)
 		} else if (ret) {
 			break;
 		}
-		intel_dp = intel_attached_dp(to_intel_connector(connector));
+
+		encoder = intel_attached_encoder(to_intel_connector(connector));
+		/* TODO: Add DSC support for MST streams */
+		if (encoder->type == INTEL_OUTPUT_DP_MST) {
+			ret = -EINVAL;
+			break;
+		}
+
+		intel_dp = &enc_to_dig_port(encoder)->dp;
 		crtc_state = to_intel_crtc_state(crtc->state);
+
 		seq_printf(m, "DSC_Enabled: %s\n",
 			   yesno(crtc_state->dsc.compression_enable));
 		seq_printf(m, "DSC_Sink_Support: %s\n",
@@ -2147,9 +2158,8 @@ static ssize_t i915_dsc_fec_support_write(struct file *file,
 	int ret;
 	struct drm_connector *connector =
 		((struct seq_file *)file->private_data)->private;
-	struct intel_encoder *encoder = intel_attached_encoder(to_intel_connector(connector));
-	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
-	struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+	struct drm_i915_private *i915 = to_i915(connector->dev);
+	struct intel_encoder *encoder;
 
 	if (len == 0)
 		return 0;
@@ -2163,10 +2173,22 @@ static ssize_t i915_dsc_fec_support_write(struct file *file,
 
 	drm_dbg(&i915->drm, "Got %s for DSC Enable\n",
 		(dsc_enable) ? "true" : "false");
-	intel_dp->force_dsc_en = dsc_enable;
 
-	*offp += len;
-	return len;
+	drm_modeset_lock(&i915->drm.mode_config.connection_mutex, NULL);
+
+	encoder = intel_attached_encoder(to_intel_connector(connector));
+	/* TODO: Add DSC support for MST streams */
+	if (!encoder || encoder->type == INTEL_OUTPUT_DP_MST) {
+		ret = -EINVAL;
+	} else {
+		enc_to_intel_dp(encoder)->force_dsc_en = dsc_enable;
+		*offp += len;
+		ret = len;
+	}
+
+	drm_modeset_unlock(&i915->drm.mode_config.connection_mutex);
+
+	return ret;
 }
 
 static int i915_dsc_fec_support_open(struct inode *inode,
-- 
2.23.1



More information about the Intel-gfx mailing list