Skip to contentSkip to conversation

Forward Error Correction

PATCH Superseded Anusha Srivatsa 4 participants 23 messages Oct 31, 2018 – Nov 3, 2018

Subsystems (3)

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v3 cover Forward Error Correction

With Display Compression, the bit error in the pixel stream can turn into a significant corruption on the screen. The DP1.4 adds FEC - Forward Error Correction scheme which uses Reed-Solomon parity/correction check generated by the source and used by the sink to detect and correct small numbers of bit errors in the compressed stream.

v2: Avoid doing aux channel read eberytime we check for FEC support. Instead cache the value of the DPCD registers, similar to the DSC implementaion (Jani)

v3: Add fec as a state to crtc. Move around the code. (Ville)

v4: s/can_fec/fec_enable; s/intel_dp_can_fec/intel_de_supports_fec; Add intel_dp_source supports_fec() (Ville)

This is rebased on top of Manasi's End-to-end DSC
Implementation: https://patchwork.freedesktop.org/series/47514/

Anusha Srivatsa (7):
i915/dp/fec: Cache the FEC_CAPABLE DPCD register drm/dp/fec: DRM helper for Forward Error Correction i915/dp/fec: Check for FEC Support
i915/dp/fec: Add can_fec to the crtc state. drm/i915/fec: Set FEC_READY in FEC_CONFIGURATION i915/dp/fec: Configure the Forward Error Correction bits. drm/i915/fec: Disable FEC state.

 drivers/gpu/drm/i915/i915_reg.h  |  2 ++
 drivers/gpu/drm/i915/intel_ddi.c | 60 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_dp.c  | 58 ++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/intel_drv.h | 11 ++++++
 include/drm/drm_dp_helper.h      |  7 ++++
 5 files changed, 136 insertions(+), 2 deletions(-)
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH v4 1/7 i915/dp/fec: Cache the FEC_CAPABLE DPCD register

Similar to DSC DPCD registers, let us cache FEC_CAPABLE register to avoid using stale values. With this we can avoid aux reads everytime and instead read the cached values.

v2: Avoid using memset and array for a single field. (Manasi,Jani)

v3:

Cc Jani Nikula <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Manasi Navare <[email protected]>
---
 drivers/gpu/drm/i915/intel_dp.c  | 9 +++++++++
 drivers/gpu/drm/i915/intel_drv.h | 1 +
 2 files changed, 10 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +9 -0
index 5a638503e36a..8ae7cf3d4ee1 100644
@@ -4201,6 +4201,9 @@ static void intel_dp_get_dsc_sink_cap(struct intel_dp *intel_dp)
 	 */
 	memset(intel_dp->dsc_dpcd, 0, sizeof(intel_dp->dsc_dpcd));
 
+	/* Clear fec_capable to avoid using stale values */
+	intel_dp->fec_capable = 0;
+
 	/* Cache the DSC DPCD if eDP or DP rev >= 1.4 */
 	if (intel_dp->dpcd[DP_DPCD_REV] >= 0x14 ||
 	    intel_dp->edp_dpcd[0] >= DP_EDP_14) {
@@ -4213,6 +4216,12 @@ static void intel_dp_get_dsc_sink_cap(struct intel_dp *intel_dp)
 		DRM_DEBUG_KMS("DSC DPCD: %*ph\n",
 			      (int)sizeof(intel_dp->dsc_dpcd),
 			      intel_dp->dsc_dpcd);
+		/* FEC is supported only on DP 1.4 */
+		if (!intel_dp_is_edp(intel_dp)) {
+			if (drm_dp_dpcd_readb(&intel_dp->aux, DP_FEC_CAPABILITY,
+					      &intel_dp->fec_capable) < 0)
+				DRM_ERROR("Failed to read FEC DPCD register\n");
+		}
 	}
 }
 
drivers/gpu/drm/i915/intel_drv.h +1 -0
index 16bbc3768e02..9a94c6544bf5 100644
@@ -1119,6 +1119,7 @@ struct intel_dp {
 	uint8_t downstream_ports[DP_MAX_DOWNSTREAM_PORTS];
 	uint8_t edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE];
 	u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE];
+	u8 fec_capable;
 	/* source rates */
 	int num_source_rates;
 	const int *source_rates;
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v4 1/7
#2 lore raw

Re: [v4 1/7] i915/dp/fec: Cache the FEC_CAPABLE DPCD register

Quoted 35 lines · Anusha Srivatsa

Similar to DSC DPCD registers, let us cache FEC_CAPABLE register to avoid using stale values. With this we can avoid aux reads everytime and instead read the cached values.

v2: Avoid using memset and array for a single field. (Manasi,Jani)

v3:

Cc Jani Nikula <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Manasi Navare <[email protected]>
---
 drivers/gpu/drm/i915/intel_dp.c  | 9 +++++++++
 drivers/gpu/drm/i915/intel_drv.h | 1 +
 2 files changed, 10 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +3 -0
index 5a638503e36a..8ae7cf3d4ee1 100644
@@ -4201,6 +4201,9 @@ static void intel_dp_get_dsc_sink_cap(struct intel_dp *intel_dp)
 	 */
 	memset(intel_dp->dsc_dpcd, 0, sizeof(intel_dp->dsc_dpcd));
 
+	/* Clear fec_capable to avoid using stale values */
+	intel_dp->fec_capable = 0;
+
 	/* Cache the DSC DPCD if eDP or DP rev >= 1.4 */
 	if (intel_dp->dpcd[DP_DPCD_REV] >= 0x14 ||
 	    intel_dp->edp_dpcd[0] >= DP_EDP_14) {

drivers/gpu/drm/i915/intel_dp.c static void intel_dp_get_dsc_sink_cap(struct intel_dp *intel_dp) · line 4223

Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +5 -0
@@ -4213,6 +4216,12 @@ static void intel_dp_get_dsc_sink_cap(struct intel_dp *intel_dp)
 		DRM_DEBUG_KMS("DSC DPCD: %*ph\n",
 			      (int)sizeof(intel_dp->dsc_dpcd),
 			      intel_dp->dsc_dpcd);
+		/* FEC is supported only on DP 1.4 */
+		if (!intel_dp_is_edp(intel_dp)) {
+			if (drm_dp_dpcd_readb(&intel_dp->aux, DP_FEC_CAPABILITY,
+					      &intel_dp->fec_capable) < 0)
+				DRM_ERROR("Failed to read FEC DPCD register\n");

Would be nice to print the value of FEC_CAPABLE in th above DRM_DEBUG_KMS right after DSC DPCD. With that change:

You can make this change, add my r-b , rebase and submit 1st and 2nd patch with CI prefix.

Manasi

Quoted 19 lines
drivers/gpu/drm/i915/intel_dp.c +1 -0
+		}
 	}
 }
 
drivers/gpu/drm/i915/intel_drv.h +1 -0
index 16bbc3768e02..9a94c6544bf5 100644
@@ -1119,6 +1119,7 @@ struct intel_dp {
 	uint8_t downstream_ports[DP_MAX_DOWNSTREAM_PORTS];
 	uint8_t edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE];
 	u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE];
+	u8 fec_capable;
 	/* source rates */
 	int num_source_rates;
 	const int *source_rates;
Signature · 1 line
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Re: [v4 1/7] i915/dp/fec: Cache the FEC_CAPABLE DPCD register

Quoted 53 lines

-----Original Message-----
From: Navare, Manasi D
Sent: Thursday, November 1, 2018 3:31 PM
To: Srivatsa, Anusha <[email protected]>
Cc: [email protected]; Jani Nikula <[email protected]>; Ville Syrjala <[email protected]>
Subject: Re: [v4 1/7] i915/dp/fec: Cache the FEC_CAPABLE DPCD register

drivers/gpu/drm/i915/intel_dp.c static void intel_dp_get_dsc_sink_cap(struct intel_dp

Quoted 24 lines · Anusha Srivatsa

Similar to DSC DPCD registers, let us cache FEC_CAPABLE register to avoid using stale values. With this we can avoid aux reads everytime and instead read the cached values.

v2: Avoid using memset and array for a single field. (Manasi,Jani)

v3:

Cc Jani Nikula <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Manasi Navare <[email protected]>
---
 drivers/gpu/drm/i915/intel_dp.c  | 9 +++++++++
drivers/gpu/drm/i915/intel_drv.h | 1 +
 2 files changed, 10 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_dp.c index 5a638503e36a..8ae7cf3d4ee1 100644

drivers/gpu/drm/i915/intel_dp.c +0 -0
@@ -4201,6 +4201,9 @@ static void intel_dp_get_dsc_sink_cap(struct intel_dp

*intel_dp)

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +3 -0
 	 */
 	memset(intel_dp->dsc_dpcd, 0, sizeof(intel_dp->dsc_dpcd));
 
+	/* Clear fec_capable to avoid using stale values */
+	intel_dp->fec_capable = 0;
+
 	/* Cache the DSC DPCD if eDP or DP rev >= 1.4 */
 	if (intel_dp->dpcd[DP_DPCD_REV] >= 0x14 ||
 	    intel_dp->edp_dpcd[0] >= DP_EDP_14) { @@ -4213,6 +4216,12 @@

static void intel_dp_get_dsc_sink_cap(struct intel_dp *intel_dp)

drivers/gpu/drm/i915/intel_dp.c static void intel_dp_get_dsc_sink_cap(struct intel_dp *intel_dp)

Quoted 6 lines
drivers/gpu/drm/i915/intel_dp.c +3 -0
 		DRM_DEBUG_KMS("DSC DPCD: %*ph\n",
 			      (int)sizeof(intel_dp->dsc_dpcd),
 			      intel_dp->dsc_dpcd);
+		/* FEC is supported only on DP 1.4 */
+		if (!intel_dp_is_edp(intel_dp)) {
+			if (drm_dp_dpcd_readb(&intel_dp->aux,

DP_FEC_CAPABILITY,

Quoted 6 lines

drivers/gpu/drm/i915/intel_dp.c

Quoted 2 lines
drivers/gpu/drm/i915/intel_dp.c +2 -0
+					      &intel_dp->fec_capable) < 0)
+				DRM_ERROR("Failed to read FEC DPCD

register\n");

Would be nice to print the value of FEC_CAPABLE in th above DRM_DEBUG_KMS right after DSC DPCD.

So unlike DSC DPCD, the FEC_CAPABLE is just one byte. Would we gain much by printing the value?

Anusha

Quoted 13 lines

With that change:

You can make this change, add my r-b , rebase and submit 1st and 2nd patch with CI prefix.

Manasi

Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c +1 -0
+		}
 	}
 }
Quoted 16 lines
Quoted 14 lines
drivers/gpu/drm/i915/intel_drv.h +1 -1
index 16bbc3768e02..9a94c6544bf5 100644
@@ -1119,6 +1119,7 @@ struct intel_dp {
 	uint8_t downstream_ports[DP_MAX_DOWNSTREAM_PORTS];
 	uint8_t edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE];
 	u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE];
+	u8 fec_capable;
 	/* source rates */
 	int num_source_rates;
 	const int *source_rates;
--
Quoted 2 lines

2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

Re: [v4 1/7] i915/dp/fec: Cache the FEC_CAPABLE DPCD register

Quoted 53 lines · Anusha
Quoted 53 lines

-----Original Message-----
From: Navare, Manasi D
Sent: Thursday, November 1, 2018 3:31 PM
To: Srivatsa, Anusha <[email protected]>
Cc: [email protected]; Jani Nikula <[email protected]>; Ville Syrjala <[email protected]>
Subject: Re: [v4 1/7] i915/dp/fec: Cache the FEC_CAPABLE DPCD register

drivers/gpu/drm/i915/intel_dp.c static void intel_dp_get_dsc_sink_cap(struct intel_dp

Quoted 24 lines · Anusha Srivatsa

Similar to DSC DPCD registers, let us cache FEC_CAPABLE register to avoid using stale values. With this we can avoid aux reads everytime and instead read the cached values.

v2: Avoid using memset and array for a single field. (Manasi,Jani)

v3:

Cc Jani Nikula <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Manasi Navare <[email protected]>
---
 drivers/gpu/drm/i915/intel_dp.c  | 9 +++++++++
drivers/gpu/drm/i915/intel_drv.h | 1 +
 2 files changed, 10 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_dp.c index 5a638503e36a..8ae7cf3d4ee1 100644

drivers/gpu/drm/i915/intel_dp.c +0 -0
@@ -4201,6 +4201,9 @@ static void intel_dp_get_dsc_sink_cap(struct intel_dp

*intel_dp)

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +3 -0
 	 */
 	memset(intel_dp->dsc_dpcd, 0, sizeof(intel_dp->dsc_dpcd));
 
+	/* Clear fec_capable to avoid using stale values */
+	intel_dp->fec_capable = 0;
+
 	/* Cache the DSC DPCD if eDP or DP rev >= 1.4 */
 	if (intel_dp->dpcd[DP_DPCD_REV] >= 0x14 ||
 	    intel_dp->edp_dpcd[0] >= DP_EDP_14) { @@ -4213,6 +4216,12 @@

static void intel_dp_get_dsc_sink_cap(struct intel_dp *intel_dp)

drivers/gpu/drm/i915/intel_dp.c static void intel_dp_get_dsc_sink_cap(struct intel_dp *intel_dp)

Quoted 6 lines
drivers/gpu/drm/i915/intel_dp.c +3 -0
 		DRM_DEBUG_KMS("DSC DPCD: %*ph\n",
 			      (int)sizeof(intel_dp->dsc_dpcd),
 			      intel_dp->dsc_dpcd);
+		/* FEC is supported only on DP 1.4 */
+		if (!intel_dp_is_edp(intel_dp)) {
+			if (drm_dp_dpcd_readb(&intel_dp->aux,

DP_FEC_CAPABILITY,

Quoted 9 lines
Quoted 6 lines

drivers/gpu/drm/i915/intel_dp.c

Quoted 2 lines
drivers/gpu/drm/i915/intel_dp.c +2 -0
+					      &intel_dp->fec_capable) < 0)
+				DRM_ERROR("Failed to read FEC DPCD

register\n");

Would be nice to print the value of FEC_CAPABLE in th above DRM_DEBUG_KMS right after DSC DPCD.

So unlike DSC DPCD, the FEC_CAPABLE is just one byte. Would we gain much by printing the value?

I think it will still be useful since its the contents of DPCD regsiter and will be printed where we print all DPCDs, DSC DPCD and then this.
Else for debugging, people will need to add a debug print after the macro and rebuild the kernel.

Manasi

Quoted 14 lines

Anusha

Quoted 13 lines

With that change:

You can make this change, add my r-b , rebase and submit 1st and 2nd patch with CI prefix.

Manasi

Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c +1 -0
+		}
 	}
 }
Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_drv.h +0 -0
index 16bbc3768e02..9a94c6544bf5 100644
@@ -1119,6 +1119,7 @@ struct intel_dp {
 	uint8_t downstream_ports[DP_MAX_DOWNSTREAM_PORTS];
 	uint8_t edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE];
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_drv.h +1 -1
 	u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE];
+	u8 fec_capable;
 	/* source rates */
 	int num_source_rates;
 	const int *source_rates;
--

2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

PATCH v4 2/7 drm/dp/fec: DRM helper for Forward Error Correction

In reply to Anusha Srivatsa

DP 1.4 has Forward Error Correction Support(FEC).
Add helper function to check if the sink device
supports FEC.

v2: Separate the helper and the code that uses the helper into two separate patches. (Manasi)

v3:
- Move the code to drm_dp_helper.c (Manasi)
- change the return type, code style changes (Gaurav)
- Use drm_dp_dpcd_readb instead of drm_dp_dpcd_read. (Jani)

v4:
- Avoid aux reads everytime, instead read cached
values of dpcd register (jani)
- Move helper to drm_dp_helper.h like other dsc
helpers.(Anusha)

v5: rebased. Change the helper parameter suitably.

---
 include/drm/drm_dp_helper.h | 7 +++++++
 1 file changed, 7 insertions(+)
include/drm/drm_dp_helper.h +7 -0
index 2649529d0d8f..b08f50b852f5 100644
@@ -1101,6 +1101,13 @@ drm_dp_dsc_sink_max_slice_width(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE])
 		DP_DSC_SLICE_WIDTH_MULTIPLIER;
 }
 
+/* Forward Error Correction Support on DP 1.4 */
+static inline bool
+drm_dp_sink_supports_fec(const u8 fec_capable)
+{
+	return fec_capable & DP_FEC_CAPABLE;
+}
+
 /*
  * DisplayPort AUX channel
  */
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

PATCH v4 3/7 i915/dp/fec: Check for FEC Support

In reply to Anusha Srivatsa

For DP 1.4 and above, Display Stream compression can be enabled only if Forward Error Correctin can be performed.

Check if the sink supports FEC using the helper.

v2: Mention External DP where ever FEC is mentioned in the code.Check return status of dpcd reads. (Gaurav)
- Do regular mode check even if FEC is not supported. (manasi)

v3: Do not perform any dpcd writes in the atomic check phase. (DK, Manasi)

v4: Use debug level logging for scenario where sink does not support a feature. (DK)

v5: Correct commit message. rebase.

v6: pass single field instead of an array for helper function. (manasi)

Cc Gaurav K Singh <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Manasi Navare <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
---
 drivers/gpu/drm/i915/intel_dp.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +10 -2
index 8ae7cf3d4ee1..a344be555dd6 100644
@@ -680,7 +680,7 @@ intel_dp_mode_valid(struct drm_connector *connector,
 			dsc_slice_count =
 				drm_dp_dsc_sink_max_slice_count(intel_dp->dsc_dpcd,
 								true);
-		} else {
+		} else if (drm_dp_sink_supports_fec(intel_dp->fec_capable)) {
 			dsc_max_output_bpp =
 				intel_dp_dsc_get_output_bpp(max_link_clock,
 							    max_lanes,
@@ -690,7 +690,8 @@ intel_dp_mode_valid(struct drm_connector *connector,
 				intel_dp_dsc_get_slice_count(intel_dp,
 							     target_clock,
 							     mode->hdisplay);
-		}
+		} else
+			DRM_DEBUG_KMS("Sink device does not Support FEC\n");
 	}
 
 	if ((mode_rate > max_rate && !(dsc_max_output_bpp && dsc_slice_count)) ||
@@ -2063,6 +2064,13 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
 	if (pipe == PIPE_A && !intel_dp_is_edp(intel_dp))
 		return false;
 
+	/* DSC not supported if external DP sink does not support FEC */
+	if (!intel_dp_is_edp(intel_dp) &&
+	    !drm_dp_sink_supports_fec(intel_dp->fec_capable)) {
+		DRM_DEBUG_KMS("Sink does not support Forward Error Correction, disabling Display Compression\n");
+		return false;
+	}
+
 	/* DSC not supported for DSC sink BPC < 8 */
 	if (limits->max_bpp < 3 * DP_DSC_MIN_SUPPORTED_BPC) {
 		DRM_DEBUG_KMS("No DSC support for less than 8bpc\n");
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

Re: [v4 3/7] i915/dp/fec: Check for FEC Support

Quoted 45 lines · Anusha Srivatsa

For DP 1.4 and above, Display Stream compression can be enabled only if Forward Error Correctin can be performed.

Check if the sink supports FEC using the helper.

v2: Mention External DP where ever FEC is mentioned in the code.Check return status of dpcd reads. (Gaurav)
- Do regular mode check even if FEC is not supported. (manasi)

v3: Do not perform any dpcd writes in the atomic check phase. (DK, Manasi)

v4: Use debug level logging for scenario where sink does not support a feature. (DK)

v5: Correct commit message. rebase.

v6: pass single field instead of an array for helper function. (manasi)

Cc Gaurav K Singh <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Manasi Navare <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
---
 drivers/gpu/drm/i915/intel_dp.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +1 -1
index 8ae7cf3d4ee1..a344be555dd6 100644
@@ -680,7 +680,7 @@ intel_dp_mode_valid(struct drm_connector *connector,
 			dsc_slice_count =
 				drm_dp_dsc_sink_max_slice_count(intel_dp->dsc_dpcd,
 								true);
-		} else {
+		} else if (drm_dp_sink_supports_fec(intel_dp->fec_capable)) {
 			dsc_max_output_bpp =
 				intel_dp_dsc_get_output_bpp(max_link_clock,
 							    max_lanes,

drivers/gpu/drm/i915/intel_dp.c intel_dp_mode_valid(struct drm_connector *connector, · line 694

Quoted 6 lines
drivers/gpu/drm/i915/intel_dp.c +2 -1
@@ -690,7 +690,8 @@ intel_dp_mode_valid(struct drm_connector *connector,
 				intel_dp_dsc_get_slice_count(intel_dp,
 							     target_clock,
 							     mode->hdisplay);
-		}
+		} else
+			DRM_DEBUG_KMS("Sink device does not Support FEC\n");

Please no debug prints in the mode_valid() that would spam a lot.

Not enough context in the patch for me to see what happens if FEC isn't supported. Do we just check against the uncompressed limits?

drivers/gpu/drm/i915/intel_dp.c static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp, · line 2069

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +3 -0
 	}
 
 	if ((mode_rate > max_rate && !(dsc_max_output_bpp && dsc_slice_count)) ||
@@ -2063,6 +2064,13 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
 	if (pipe == PIPE_A && !intel_dp_is_edp(intel_dp))
 		return false;
 
+	/* DSC not supported if external DP sink does not support FEC */
+	if (!intel_dp_is_edp(intel_dp) &&
+	    !drm_dp_sink_supports_fec(intel_dp->fec_capable)) {

Why aren't we checking the source capabilities here as well?

drivers/gpu/drm/i915/intel_dp.c static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp, · line 2070

Quoted 1 line
drivers/gpu/drm/i915/intel_dp.c +1 -0
+		DRM_DEBUG_KMS("Sink does not support Forward Error Correction, disabling Display Compression\n");

"disabling Display Compression" is not true. We're rejecting the entire thing.

Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +3 -0
+		return false;
+	}
+
 	/* DSC not supported for DSC sink BPC < 8 */
 	if (limits->max_bpp < 3 * DP_DSC_MIN_SUPPORTED_BPC) {
 		DRM_DEBUG_KMS("No DSC support for less than 8bpc\n");
Signature · 1 line
2.17.1
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

Re: [v4 3/7] i915/dp/fec: Check for FEC Support

Quoted 70 lines

-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Wednesday, October 31, 2018 2:01 PM
To: Srivatsa, Anusha <[email protected]>
Cc: [email protected]; Singh, Gaurav K <[email protected]>; Jani Nikula <[email protected]>; Navare, Manasi D <[email protected]>; Pandiyan, Dhinakaran <[email protected]>
Subject: Re: [v4 3/7] i915/dp/fec: Check for FEC Support

drivers/gpu/drm/i915/intel_dp.c intel_dp_mode_valid(struct drm_connector

Quoted 37 lines · Anusha Srivatsa

For DP 1.4 and above, Display Stream compression can be enabled only if Forward Error Correctin can be performed.

Check if the sink supports FEC using the helper.

v2: Mention External DP where ever FEC is mentioned in the code.Check return status of dpcd reads. (Gaurav)
- Do regular mode check even if FEC is not supported. (manasi)

v3: Do not perform any dpcd writes in the atomic check phase. (DK, Manasi)

v4: Use debug level logging for scenario where sink does not support a feature. (DK)

v5: Correct commit message. rebase.

v6: pass single field instead of an array for helper function. (manasi)

Cc Gaurav K Singh <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Manasi Navare <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
---
 drivers/gpu/drm/i915/intel_dp.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_dp.c index 8ae7cf3d4ee1..a344be555dd6 100644

drivers/gpu/drm/i915/intel_dp.c +0 -0
@@ -680,7 +680,7 @@ intel_dp_mode_valid(struct drm_connector

*connector,

drivers/gpu/drm/i915/intel_dp.c intel_dp_mode_valid(struct drm_connector

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +1 -1
 			dsc_slice_count =
 				drm_dp_dsc_sink_max_slice_count(intel_dp-
 dsc_dpcd,
 								true);
-		} else {
+		} else if (drm_dp_sink_supports_fec(intel_dp->fec_capable)) {
 			dsc_max_output_bpp =
 				intel_dp_dsc_get_output_bpp(max_link_clock,
drivers/gpu/drm/i915/intel_dp.c +0 -0
 							    max_lanes,
@@ -690,7 +690,8 @@ intel_dp_mode_valid(struct drm_connector

*connector,

drivers/gpu/drm/i915/intel_dp.c intel_dp_mode_valid(struct drm_connector *connector,

Quoted 6 lines
drivers/gpu/drm/i915/intel_dp.c +2 -1
 				intel_dp_dsc_get_slice_count(intel_dp,
 							     target_clock,
 							     mode->hdisplay);
-		}
+		} else
+			DRM_DEBUG_KMS("Sink device does not Support

FEC\n");

Quoted 4 lines

Please no debug prints in the mode_valid() that would spam a lot.

Not enough context in the patch for me to see what happens if FEC isn't supported. Do we just check against the uncompressed limits?

In cases where we cannot do FEC for DP cases, we should be disabling DSC.
Combining the checking of FEC support (this patch) with the patch 4 of the series which checks for state and disables DSC suitably.

Anusha

Quoted 20 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c +0 -0
 	}
 
 	if ((mode_rate > max_rate && !(dsc_max_output_bpp &&

dsc_slice_count)) || @@ -2063,6 +2064,13 @@ static bool

intel_dp_dsc_compute_config(struct intel_dp *intel_dp,

drivers/gpu/drm/i915/intel_dp.c static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp, · line 2069

Quoted 6 lines
drivers/gpu/drm/i915/intel_dp.c +3 -0
 	if (pipe == PIPE_A && !intel_dp_is_edp(intel_dp))
 		return false;
 
+	/* DSC not supported if external DP sink does not support FEC */
+	if (!intel_dp_is_edp(intel_dp) &&
+	    !drm_dp_sink_supports_fec(intel_dp->fec_capable)) {

Why aren't we checking the source capabilities here as well?

drivers/gpu/drm/i915/intel_dp.c

Quoted 1 line
drivers/gpu/drm/i915/intel_dp.c +1 -0
+		DRM_DEBUG_KMS("Sink does not support Forward Error

Correction,

Quoted 1 line

+disabling Display Compression\n");

"disabling Display Compression" is not true. We're rejecting the entire thing.

Quoted 12 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +3 -1
+		return false;
+	}
+
 	/* DSC not supported for DSC sink BPC < 8 */
 	if (limits->max_bpp < 3 * DP_DSC_MIN_SUPPORTED_BPC) {
 		DRM_DEBUG_KMS("No DSC support for less than 8bpc\n");
--

2.17.1

--
Ville Syrjälä
Intel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw

PATCH v4 4/7 i915/dp/fec: Add fec_enable to the crtc state.

In reply to Anusha Srivatsa

Add a crtc state for FEC. Currently, the state
is determined by platform, DP and DSC being
enabled. Moving forward we can use the state
to have error correction on other scenarios too
if needed.

v2:
- Control compression_enable with the fec_enable parameter in crtc state and with intel_dp_supports_fec() (Ville)

- intel_dp_can_fec()/intel_dp_supports_fec()(manasi)

---
 drivers/gpu/drm/i915/intel_dp.c  | 25 ++++++++++++++++++++++++-
 drivers/gpu/drm/i915/intel_drv.h |  3 +++
 2 files changed, 27 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +24 -1
index a344be555dd6..5ae3855925f3 100644
@@ -2045,6 +2045,21 @@ intel_dp_compute_link_config_fast(struct intel_dp *intel_dp,
 	return false;
 }
 
+static bool intel_dp_source_supports_fec(struct intel_dp *intel_dp)
+{
+	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);
+	enum port port = dig_port->base.port;
+
+	return INTEL_GEN(dev_priv) >= 11 && port != PORT_A;
+}
+
+static bool intel_dp_supports_fec(struct intel_dp *intel_dp,
+				  struct intel_crtc_state *pipe_config)
+{
+	return intel_dp_source_supports_fec(intel_dp) &&
+		drm_dp_sink_supports_fec(intel_dp->fec_capable);
+}
 static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
 					struct intel_crtc_state *pipe_config,
 					struct link_config_limits *limits)
@@ -2056,6 +2071,8 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
 	u16 dsc_max_output_bpp = 0;
 	u8 dsc_dp_slice_count = 0;
 
+	pipe_config->fec_enable = !intel_dp_is_edp(intel_dp);
+
 	if (INTEL_GEN(dev_priv) < 10 ||
 	    !drm_dp_sink_supports_dsc(intel_dp->dsc_dpcd))
 		return false;
@@ -2122,7 +2139,13 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
 			  pipe_config->dsc_params.compressed_bpp);
 		return false;
 	}
-	pipe_config->dsc_params.compression_enable = true;
+
+	if (pipe_config->fec_enable && !intel_dp_supports_fec(intel_dp, pipe_config)) {
+		DRM_DEBUG_KMS("No FEC Support, disabling Compression");
+		pipe_config->dsc_params.compression_enable = false;
+	} else {
+		pipe_config->dsc_params.compression_enable = true;
+	}
 	DRM_DEBUG_KMS("DP DSC computed with Input Bpp = %d "
 		      "Compressed Bpp = %d Slice Count = %d\n",
 		      pipe_config->pipe_bpp,
drivers/gpu/drm/i915/intel_drv.h +3 -0
index 9a94c6544bf5..9f701463219b 100644
@@ -940,6 +940,9 @@ struct intel_crtc_state {
 		u8 slice_count;
 	} dsc_params;
 	struct drm_dsc_config dp_dsc_cfg;
+
+	/* Forward Error correction State */
+	bool fec_enable;
 };
 
 struct intel_crtc {
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

Re: [v4 4/7] i915/dp/fec: Add fec_enable to the crtc state.

Quoted 60 lines · Anusha Srivatsa

Add a crtc state for FEC. Currently, the state
is determined by platform, DP and DSC being
enabled. Moving forward we can use the state
to have error correction on other scenarios too
if needed.

v2:
- Control compression_enable with the fec_enable parameter in crtc state and with intel_dp_supports_fec() (Ville)

- intel_dp_can_fec()/intel_dp_supports_fec()(manasi)

---
 drivers/gpu/drm/i915/intel_dp.c  | 25 ++++++++++++++++++++++++-
 drivers/gpu/drm/i915/intel_drv.h |  3 +++
 2 files changed, 27 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +17 -0
index a344be555dd6..5ae3855925f3 100644
@@ -2045,6 +2045,21 @@ intel_dp_compute_link_config_fast(struct intel_dp *intel_dp,
 	return false;
 }
 
+static bool intel_dp_source_supports_fec(struct intel_dp *intel_dp)
+{
+	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);
+	enum port port = dig_port->base.port;
+
+	return INTEL_GEN(dev_priv) >= 11 && port != PORT_A;
+}
+
+static bool intel_dp_supports_fec(struct intel_dp *intel_dp,
+				  struct intel_crtc_state *pipe_config)
+{
+	return intel_dp_source_supports_fec(intel_dp) &&
+		drm_dp_sink_supports_fec(intel_dp->fec_capable);
+}
 static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
 					struct intel_crtc_state *pipe_config,
 					struct link_config_limits *limits)
@@ -2056,6 +2071,8 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
 	u16 dsc_max_output_bpp = 0;
 	u8 dsc_dp_slice_count = 0;
 
+	pipe_config->fec_enable = !intel_dp_is_edp(intel_dp);
+
 	if (INTEL_GEN(dev_priv) < 10 ||
 	    !drm_dp_sink_supports_dsc(intel_dp->dsc_dpcd))
 		return false;
@@ -2122,7 +2139,13 @@ static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
 			  pipe_config->dsc_params.compressed_bpp);

drivers/gpu/drm/i915/intel_dp.c static bool intel_dp_dsc_compute_config(struct intel_dp *intel_dp, · line 2148

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +7 -1
 		return false;
 	}
-	pipe_config->dsc_params.compression_enable = true;
+
+	if (pipe_config->fec_enable && !intel_dp_supports_fec(intel_dp, pipe_config)) {
+		DRM_DEBUG_KMS("No FEC Support, disabling Compression");
+		pipe_config->dsc_params.compression_enable = false;
+	} else {
+		pipe_config->dsc_params.compression_enable = true;
+	}

Didn't the previous patch already reject the entire operation?

Quoted 19 lines
drivers/gpu/drm/i915/intel_dp.c +0 -0
 	DRM_DEBUG_KMS("DP DSC computed with Input Bpp = %d "
 		      "Compressed Bpp = %d Slice Count = %d\n",
 		      pipe_config->pipe_bpp,
drivers/gpu/drm/i915/intel_drv.h +3 -0
index 9a94c6544bf5..9f701463219b 100644
@@ -940,6 +940,9 @@ struct intel_crtc_state {
 		u8 slice_count;
 	} dsc_params;
 	struct drm_dsc_config dp_dsc_cfg;
+
+	/* Forward Error correction State */
+	bool fec_enable;
 };
 
 struct intel_crtc {
Signature · 1 line
2.17.1
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

PATCH v4 5/7 drm/i915/fec: Set FEC_READY in FEC_CONFIGURATION

In reply to Anusha Srivatsa

If the panel supports FEC, the driver has to set the FEC_READY bit in the dpcd register:
FEC_CONFIGURATION.

This has to happen before link training.

v2: s/intel_dp_set_fec_ready/intel_dp_sink_set_fec_ready
- change commit message. (Gaurav)

v3: rebased. (r-b Manasi)

v4: Use fec crtc state, before setting FEC_READY bit. (Anusha)

Cc Gaurav K Singh <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Manasi Navare <[email protected]>
---
 drivers/gpu/drm/i915/intel_ddi.c |  1 +
 drivers/gpu/drm/i915/intel_dp.c  | 18 ++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |  3 +++
 3 files changed, 22 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +1 -0
index 1de0a3917d7f..efbada95dc4e 100644
@@ -2932,6 +2932,7 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
 	intel_dp_sink_set_decompression_state(intel_dp, crtc_state,
 					      DP_DECOMPRESSION_EN);
+	intel_dp_sink_set_fec_ready(intel_dp, crtc_state, DP_FEC_READY);
 	intel_dp_start_link_train(intel_dp);
 	if (port != PORT_A || INTEL_GEN(dev_priv) >= 9)
 		intel_dp_stop_link_train(intel_dp);
drivers/gpu/drm/i915/intel_dp.c +18 -0
index 5ae3855925f3..a750415d1ec0 100644
@@ -3058,6 +3058,24 @@ void intel_dp_sink_set_decompression_state(struct intel_dp *intel_dp,
 			      state == DP_DECOMPRESSION_EN ? "enable" : "disable");
 }
 
+void intel_dp_sink_set_fec_ready(struct intel_dp *intel_dp,
+				 const struct intel_crtc_state *crtc_state,
+				 int state)
+{
+	int ret;
+
+	if (!crtc_state->fec_enable)
+		return;
+
+	/* If compression is not enabled, do not set FEC bits */
+	if (!crtc_state->dsc_params.compression_enable)
+		return;
+
+	ret = drm_dp_dpcd_writeb(&intel_dp->aux, DP_FEC_CONFIGURATION, state);
+	if (ret < 0)
+		DRM_DEBUG_KMS("Failed to get FEC enabled in sink\n");
+}
+
 /* If the sink supports it, try to set the power state appropriately */
 void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode)
 {
drivers/gpu/drm/i915/intel_drv.h +3 -0
index 9f701463219b..2a080205968d 100644
@@ -1796,6 +1796,9 @@ void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
 void intel_dp_sink_set_decompression_state(struct intel_dp *intel_dp,
 					   const struct intel_crtc_state *crtc_state,
 					   int state);
+void intel_dp_sink_set_fec_ready(struct intel_dp *intel_dp,
+				 const struct intel_crtc_state *crtc_state,
+				 int state);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
 void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
 void intel_dp_encoder_destroy(struct drm_encoder *encoder);
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#12 lore raw

Re: [v4 5/7] drm/i915/fec: Set FEC_READY in FEC_CONFIGURATION

Quoted 52 lines

-----Original Message-----
From: Srivatsa, Anusha
Sent: Tuesday, October 30, 2018 5:45 PM
To: [email protected]
Cc: Srivatsa, Anusha <[email protected]>; Singh, Gaurav K <[email protected]>; Jani Nikula <[email protected]>; Ville Syrjala <[email protected]>; Navare, Manasi D <[email protected]>
Subject: [v4 5/7] drm/i915/fec: Set FEC_READY in FEC_CONFIGURATION

If the panel supports FEC, the driver has to set the FEC_READY bit in the dpcd register:
FEC_CONFIGURATION.

This has to happen before link training.

v2: s/intel_dp_set_fec_ready/intel_dp_sink_set_fec_ready
- change commit message. (Gaurav)

v3: rebased. (r-b Manasi)

v4: Use fec crtc state, before setting FEC_READY bit. (Anusha)

Cc Gaurav K Singh <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Manasi Navare <[email protected]>

---
drivers/gpu/drm/i915/intel_ddi.c | 1 + drivers/gpu/drm/i915/intel_dp.c | 18 ++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 3 +++

3 files changed, 22 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +1 -0
index 1de0a3917d7f..efbada95dc4e 100644
@@ -2932,6 +2932,7 @@ static void intel_ddi_pre_enable_dp(struct
 intel_encoder *encoder,
 		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
 	intel_dp_sink_set_decompression_state(intel_dp, crtc_state,
 					      DP_DECOMPRESSION_EN);
+	intel_dp_sink_set_fec_ready(intel_dp, crtc_state, DP_FEC_READY);
 	intel_dp_start_link_train(intel_dp);
 	if (port != PORT_A || INTEL_GEN(dev_priv) >= 9)
		intel_dp_stop_link_train(intel_dp);
drivers/gpu/drm/i915/intel_dp.c +0 -0
index 5ae3855925f3..a750415d1ec0 100644

drivers/gpu/drm/i915/intel_dp.c void intel_dp_sink_set_decompression_state(struct · line 3064

Quoted 7 lines
drivers/gpu/drm/i915/intel_dp.c +3 -0
@@ -3058,6 +3058,24 @@ void intel_dp_sink_set_decompression_state(struct
 intel_dp *intel_dp,
 			      state == DP_DECOMPRESSION_EN ? "enable" :
 "disable");  }
 
+void intel_dp_sink_set_fec_ready(struct intel_dp *intel_dp,
+				 const struct intel_crtc_state *crtc_state,
+				 int state)

Manasi, Ville,
Since enable_fec and disable_fec (next two patches in the series) are being moved to intel_ddi.c, this function might also be moved to intel_ddi.c?

Anusha

Quoted 29 lines
drivers/gpu/drm/i915/intel_dp.c +14 -0
+{
+	int ret;
+
+	if (!crtc_state->fec_enable)
+		return;
+
+	/* If compression is not enabled, do not set FEC bits */
+	if (!crtc_state->dsc_params.compression_enable)
+		return;
+
+	ret = drm_dp_dpcd_writeb(&intel_dp->aux, DP_FEC_CONFIGURATION,
 state);
+	if (ret < 0)
+		DRM_DEBUG_KMS("Failed to get FEC enabled in sink\n"); }
+
 /* If the sink supports it, try to set the power state appropriately */  void

intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode) { diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 9f701463219b..2a080205968d 100644

drivers/gpu/drm/i915/intel_drv.h +3 -0
@@ -1796,6 +1796,9 @@ void intel_dp_sink_dpms(struct intel_dp *intel_dp, int
 mode);  void intel_dp_sink_set_decompression_state(struct intel_dp *intel_dp,
 					   const struct intel_crtc_state
 *crtc_state,
 					   int state);
+void intel_dp_sink_set_fec_ready(struct intel_dp *intel_dp,
+				 const struct intel_crtc_state *crtc_state,
+				 int state);
Quoted 5 lines

void intel_dp_encoder_reset(struct drm_encoder *encoder); void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder); void intel_dp_encoder_destroy(struct drm_encoder *encoder);
--
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#13 lore raw

PATCH v4 6/7 i915/dp/fec: Configure the Forward Error Correction bits.

In reply to Anusha Srivatsa

If FEC is supported, the corresponding
DP_TP_CTL register bits have to be configured.

The driver has to program the FEC_ENABLE in DP_TP_CTL[30] register and wait till FEC_STATUS in DP_TP_CTL[28] is 1.
Also add the warn message to make sure that the control register is already active while enabling FEC.

v2:
- Change commit message. Configure fec state after link training (Manasi, Gaurav)
- Remove redundent checks (Manasi)
- Remove the registers that get added automagically (Anusha)

v3: s/intel_dp_set_fec_state()/intel_dp_enable_fec_state() (Gaurav)

v4: rebased.

v5:
- Move the code to the proper spot, according to spec.(Ville)
- Use fec state as a check too.

Cc Gaurav K Singh <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Manasi Navare <[email protected]>
---
 drivers/gpu/drm/i915/i915_reg.h  |  2 ++
 drivers/gpu/drm/i915/intel_ddi.c | 30 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |  2 ++
 3 files changed, 34 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +2 -0
index e85f53cb9cdd..8b1753939299 100644
@@ -9134,6 +9134,7 @@ enum skl_power_gate {
 #define _DP_TP_CTL_B			0x64140
 #define DP_TP_CTL(port) _MMIO_PORT(port, _DP_TP_CTL_A, _DP_TP_CTL_B)
 #define  DP_TP_CTL_ENABLE			(1 << 31)
+#define  DP_TP_CTL_FEC_ENABLE			(1 << 30)
 #define  DP_TP_CTL_MODE_SST			(0 << 27)
 #define  DP_TP_CTL_MODE_MST			(1 << 27)
 #define  DP_TP_CTL_FORCE_ACT			(1 << 25)
@@ -9152,6 +9153,7 @@ enum skl_power_gate {
 #define _DP_TP_STATUS_A			0x64044
 #define _DP_TP_STATUS_B			0x64144
 #define DP_TP_STATUS(port) _MMIO_PORT(port, _DP_TP_STATUS_A, _DP_TP_STATUS_B)
+#define  DP_TP_STATUS_FEC_ENABLE_LIVE		(1 << 28)
 #define  DP_TP_STATUS_IDLE_DONE			(1 << 25)
 #define  DP_TP_STATUS_ACT_SENT			(1 << 24)
 #define  DP_TP_STATUS_MODE_STATUS_MST		(1 << 23)
drivers/gpu/drm/i915/intel_ddi.c +30 -0
index efbada95dc4e..f03f44f332c7 100644
@@ -2889,6 +2889,32 @@ static void intel_ddi_clk_disable(struct intel_encoder *encoder)
 	}
 }
 
+void intel_dp_enable_fec_state(struct intel_dp *intel_dp,
+			       const struct intel_crtc_state *crtc_state)
+{
+	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
+	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
+	enum port port = intel_dig_port->base.port;
+	u32 val;
+
+	/* FEC support exists for DP 1.4 only */
+	if (!crtc_state->fec_enable)
+		return;
+
+	if (!crtc_state->dsc_params.compression_enable)
+		return;
+
+	val = I915_READ(DP_TP_CTL(port));
+	val |= DP_TP_CTL_FEC_ENABLE;
+	I915_WRITE(DP_TP_CTL(port), val);
+
+	if (intel_wait_for_register(dev_priv, DP_TP_STATUS(port),
+				    DP_TP_STATUS_FEC_ENABLE_LIVE,
+				    DP_TP_STATUS_FEC_ENABLE_LIVE,
+				    1))
+		DRM_ERROR("Timed out waiting for FEC Enable Status\n");
+}
+
 static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 				    const struct intel_crtc_state *crtc_state,
 				    const struct drm_connector_state *conn_state)
@@ -2934,9 +2960,13 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 					      DP_DECOMPRESSION_EN);
 	intel_dp_sink_set_fec_ready(intel_dp, crtc_state, DP_FEC_READY);
 	intel_dp_start_link_train(intel_dp);
+
 	if (port != PORT_A || INTEL_GEN(dev_priv) >= 9)
 		intel_dp_stop_link_train(intel_dp);
 
+	/* Set FEC state after link training */
+	intel_dp_enable_fec_state(intel_dp, crtc_state);
+
 	icl_enable_phy_clock_gating(dig_port);
 
 	if (!is_mst)
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 2a080205968d..1cdfa9c5da43 100644
@@ -1799,6 +1799,8 @@ void intel_dp_sink_set_decompression_state(struct intel_dp *intel_dp,
 void intel_dp_sink_set_fec_ready(struct intel_dp *intel_dp,
 				 const struct intel_crtc_state *crtc_state,
 				 int state);
+void intel_dp_enable_fec_state(struct intel_dp *intel_dp,
+			       const struct intel_crtc_state *crtc_state);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
 void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
 void intel_dp_encoder_destroy(struct drm_encoder *encoder);
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw

Re: [v4 6/7] i915/dp/fec: Configure the Forward Error Correction bits.

Quoted 58 lines · Anusha Srivatsa

If FEC is supported, the corresponding
DP_TP_CTL register bits have to be configured.

The driver has to program the FEC_ENABLE in DP_TP_CTL[30] register and wait till FEC_STATUS in DP_TP_CTL[28] is 1.
Also add the warn message to make sure that the control register is already active while enabling FEC.

v2:
- Change commit message. Configure fec state after link training (Manasi, Gaurav)
- Remove redundent checks (Manasi)
- Remove the registers that get added automagically (Anusha)

v3: s/intel_dp_set_fec_state()/intel_dp_enable_fec_state() (Gaurav)

v4: rebased.

v5:
- Move the code to the proper spot, according to spec.(Ville)
- Use fec state as a check too.

Cc Gaurav K Singh <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Manasi Navare <[email protected]>
---
 drivers/gpu/drm/i915/i915_reg.h  |  2 ++
 drivers/gpu/drm/i915/intel_ddi.c | 30 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |  2 ++
 3 files changed, 34 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +2 -0
index e85f53cb9cdd..8b1753939299 100644
@@ -9134,6 +9134,7 @@ enum skl_power_gate {
 #define _DP_TP_CTL_B			0x64140
 #define DP_TP_CTL(port) _MMIO_PORT(port, _DP_TP_CTL_A, _DP_TP_CTL_B)
 #define  DP_TP_CTL_ENABLE			(1 << 31)
+#define  DP_TP_CTL_FEC_ENABLE			(1 << 30)
 #define  DP_TP_CTL_MODE_SST			(0 << 27)
 #define  DP_TP_CTL_MODE_MST			(1 << 27)
 #define  DP_TP_CTL_FORCE_ACT			(1 << 25)
@@ -9152,6 +9153,7 @@ enum skl_power_gate {
 #define _DP_TP_STATUS_A			0x64044
 #define _DP_TP_STATUS_B			0x64144
 #define DP_TP_STATUS(port) _MMIO_PORT(port, _DP_TP_STATUS_A, _DP_TP_STATUS_B)
+#define  DP_TP_STATUS_FEC_ENABLE_LIVE		(1 << 28)
 #define  DP_TP_STATUS_IDLE_DONE			(1 << 25)
 #define  DP_TP_STATUS_ACT_SENT			(1 << 24)
 #define  DP_TP_STATUS_MODE_STATUS_MST		(1 << 23)
drivers/gpu/drm/i915/intel_ddi.c +0 -0
index efbada95dc4e..f03f44f332c7 100644

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_clk_disable(struct intel_encoder *encoder) · line 2893

Quoted 5 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
@@ -2889,6 +2889,32 @@ static void intel_ddi_clk_disable(struct intel_encoder *encoder)
 	}
 }
 
+void intel_dp_enable_fec_state(struct intel_dp *intel_dp,
+			       const struct intel_crtc_state *crtc_state)

Can be static. intel_ddi_enable_fec() seems like a better name, and we can just pass the intel_encoder to this I think. No need to do all the "intel_dp to encoder" gynmastics then.

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_clk_disable(struct intel_encoder *encoder) · line 2900

Quoted 7 lines
drivers/gpu/drm/i915/intel_ddi.c +7 -0
+{
+	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
+	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
+	enum port port = intel_dig_port->base.port;
+	u32 val;
+
+	/* FEC support exists for DP 1.4 only */

This comment is misleading. There are other reasons besides < DP 1.4 for not using FEC. IMO just drop the comment.

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_clk_disable(struct intel_encoder *encoder) · line 2905

Quoted 5 lines
drivers/gpu/drm/i915/intel_ddi.c +5 -0
+	if (!crtc_state->fec_enable)
+		return;
+
+	if (!crtc_state->dsc_params.compression_enable)
+		return;

That check can be removed now.

Quoted 16 lines
drivers/gpu/drm/i915/intel_ddi.c +12 -0
+
+	val = I915_READ(DP_TP_CTL(port));
+	val |= DP_TP_CTL_FEC_ENABLE;
+	I915_WRITE(DP_TP_CTL(port), val);
+
+	if (intel_wait_for_register(dev_priv, DP_TP_STATUS(port),
+				    DP_TP_STATUS_FEC_ENABLE_LIVE,
+				    DP_TP_STATUS_FEC_ENABLE_LIVE,
+				    1))
+		DRM_ERROR("Timed out waiting for FEC Enable Status\n");
+}
+
 static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 				    const struct intel_crtc_state *crtc_state,
 				    const struct drm_connector_state *conn_state)

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, · line 2963

Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +1 -0
@@ -2934,9 +2960,13 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 					      DP_DECOMPRESSION_EN);
 	intel_dp_sink_set_fec_ready(intel_dp, crtc_state, DP_FEC_READY);
 	intel_dp_start_link_train(intel_dp);
+

Unrelated whitespace change.

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, · line 2967

Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +1 -0
 	if (port != PORT_A || INTEL_GEN(dev_priv) >= 9)
 		intel_dp_stop_link_train(intel_dp);
 
+	/* Set FEC state after link training */

Redundant comment.

Quoted 20 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
+	intel_dp_enable_fec_state(intel_dp, crtc_state);
+
 	icl_enable_phy_clock_gating(dig_port);
 
 	if (!is_mst)
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 2a080205968d..1cdfa9c5da43 100644
@@ -1799,6 +1799,8 @@ void intel_dp_sink_set_decompression_state(struct intel_dp *intel_dp,
 void intel_dp_sink_set_fec_ready(struct intel_dp *intel_dp,
 				 const struct intel_crtc_state *crtc_state,
 				 int state);
+void intel_dp_enable_fec_state(struct intel_dp *intel_dp,
+			       const struct intel_crtc_state *crtc_state);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
 void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
 void intel_dp_encoder_destroy(struct drm_encoder *encoder);
Signature · 1 line
2.17.1
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#15 lore raw

Re: [v4 6/7] i915/dp/fec: Configure the Forward Error Correction bits.

Quoted 77 lines

-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Wednesday, October 31, 2018 2:08 PM
To: Srivatsa, Anusha <[email protected]>
Cc: [email protected]; Singh, Gaurav K <[email protected]>; Jani Nikula <[email protected]>; Navare, Manasi D <[email protected]>
Subject: Re: [v4 6/7] i915/dp/fec: Configure the Forward Error Correction bits.

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_clk_disable(struct

Quoted 61 lines · Anusha Srivatsa

If FEC is supported, the corresponding DP_TP_CTL register bits have to be configured.

The driver has to program the FEC_ENABLE in DP_TP_CTL[30] register and wait till FEC_STATUS in DP_TP_CTL[28] is 1.
Also add the warn message to make sure that the control register is already active while enabling FEC.

v2:
- Change commit message. Configure fec state after link training (Manasi, Gaurav)
- Remove redundent checks (Manasi)
- Remove the registers that get added automagically (Anusha)

v3: s/intel_dp_set_fec_state()/intel_dp_enable_fec_state() (Gaurav)

v4: rebased.

v5:
- Move the code to the proper spot, according to spec.(Ville)
- Use fec state as a check too.

Cc Gaurav K Singh <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Manasi Navare <[email protected]>
---
 drivers/gpu/drm/i915/i915_reg.h  |  2 ++
drivers/gpu/drm/i915/intel_ddi.c | 30 ++++++++++++++++++++++++++++++
drivers/gpu/drm/i915/intel_drv.h |  2 ++
 3 files changed, 34 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/i915_reg.h index e85f53cb9cdd..8b1753939299 100644

drivers/gpu/drm/i915/i915_reg.h +2 -0
@@ -9134,6 +9134,7 @@ enum skl_power_gate {
 #define _DP_TP_CTL_B			0x64140
 #define DP_TP_CTL(port) _MMIO_PORT(port, _DP_TP_CTL_A, _DP_TP_CTL_B)
 #define  DP_TP_CTL_ENABLE			(1 << 31)
+#define  DP_TP_CTL_FEC_ENABLE			(1 << 30)
 #define  DP_TP_CTL_MODE_SST			(0 << 27)
 #define  DP_TP_CTL_MODE_MST			(1 << 27)
 #define  DP_TP_CTL_FORCE_ACT			(1 << 25)
@@ -9152,6 +9153,7 @@ enum skl_power_gate {
 #define _DP_TP_STATUS_A			0x64044
 #define _DP_TP_STATUS_B			0x64144
 #define DP_TP_STATUS(port) _MMIO_PORT(port, _DP_TP_STATUS_A,
 _DP_TP_STATUS_B)
+#define  DP_TP_STATUS_FEC_ENABLE_LIVE		(1 << 28)
 #define  DP_TP_STATUS_IDLE_DONE			(1 << 25)
 #define  DP_TP_STATUS_ACT_SENT			(1 << 24)

#define DP_TP_STATUS_MODE_STATUS_MST (1 << 23)

drivers/gpu/drm/i915/intel_ddi.c +0 -0
index efbada95dc4e..f03f44f332c7 100644
@@ -2889,6 +2889,32 @@ static void intel_ddi_clk_disable(struct

intel_encoder *encoder)

Quoted 3 lines
drivers/gpu/drm/i915/intel_ddi.c +0 -0
 	}
 }
 
Quoted 6 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_clk_disable(struct intel_encoder *encoder) · line 2893

Quoted 2 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
+void intel_dp_enable_fec_state(struct intel_dp *intel_dp,
+			       const struct intel_crtc_state *crtc_state)

Can be static. intel_ddi_enable_fec() seems like a better name, and we can just pass the intel_encoder to this I think. No need to do all the "intel_dp to encoder" gynmastics then.

intel_ddi_enable_fec() is a better name.

Quoted 10 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_clk_disable(struct intel_encoder *encoder) · line 2900

Quoted 7 lines
drivers/gpu/drm/i915/intel_ddi.c +7 -0
+{
+	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
+	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
+	enum port port = intel_dig_port->base.port;
+	u32 val;
+
+	/* FEC support exists for DP 1.4 only */

This comment is misleading. There are other reasons besides < DP 1.4 for not using FEC. IMO just drop the comment.

Ok.

Quoted 7 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_clk_disable(struct intel_encoder *encoder) · line 2905

Quoted 5 lines
drivers/gpu/drm/i915/intel_ddi.c +5 -0
+	if (!crtc_state->fec_enable)
+		return;
+
+	if (!crtc_state->dsc_params.compression_enable)
+		return;

That check can be removed now.

No we will still need this. The fec_enable state is not coupled with compression. So we have to check fec state and the compression ....

Anusha

Quoted 44 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +4 -0
+
+	val = I915_READ(DP_TP_CTL(port));
+	val |= DP_TP_CTL_FEC_ENABLE;
+	I915_WRITE(DP_TP_CTL(port), val);

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_clk_disable(struct intel_encoder *encoder)

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +7 -0
+
+	if (intel_wait_for_register(dev_priv, DP_TP_STATUS(port),
+				    DP_TP_STATUS_FEC_ENABLE_LIVE,
+				    DP_TP_STATUS_FEC_ENABLE_LIVE,
+				    1))
+		DRM_ERROR("Timed out waiting for FEC Enable Status\n"); }
+
 static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 				    const struct intel_crtc_state *crtc_state,
 				    const struct drm_connector_state

*conn_state) @@ -2934,9

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_clk_disable(struct · line 2920

Quoted 1 line
drivers/gpu/drm/i915/intel_ddi.c +1 -0
+2960,13 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder

*encoder,

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, · line 2963

Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +1 -0
 					      DP_DECOMPRESSION_EN);
 	intel_dp_sink_set_fec_ready(intel_dp, crtc_state, DP_FEC_READY);
 	intel_dp_start_link_train(intel_dp);
+

Unrelated whitespace change.

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, · line 2967

Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +1 -0
 	if (port != PORT_A || INTEL_GEN(dev_priv) >= 9)
 		intel_dp_stop_link_train(intel_dp);
 
+	/* Set FEC state after link training */

Redundant comment.

Quoted 11 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
+	intel_dp_enable_fec_state(intel_dp, crtc_state);
+
 	icl_enable_phy_clock_gating(dig_port);
 
 	if (!is_mst)
drivers/gpu/drm/i915/intel_drv.h +0 -0
index 2a080205968d..1cdfa9c5da43 100644
@@ -1799,6 +1799,8 @@ void
Quoted 1 line

intel_dp_sink_set_decompression_state(struct intel_dp *intel_dp, void

intel_dp_sink_set_fec_ready(struct intel_dp *intel_dp,

Quoted 13 lines
Quoted 9 lines
drivers/gpu/drm/i915/intel_drv.h +2 -0
 				 const struct intel_crtc_state *crtc_state,
 				 int state);
+void intel_dp_enable_fec_state(struct intel_dp *intel_dp,
+			       const struct intel_crtc_state *crtc_state);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);  void

intel_dp_encoder_suspend(struct intel_encoder *intel_encoder); void intel_dp_encoder_destroy(struct drm_encoder *encoder);
--
2.17.1

--
Ville Syrjälä
Intel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#16 lore raw

Re: [v4 6/7] i915/dp/fec: Configure the Forward Error Correction bits.

Quoted 98 lines · Anusha
Quoted 77 lines

-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Wednesday, October 31, 2018 2:08 PM
To: Srivatsa, Anusha <[email protected]>
Cc: [email protected]; Singh, Gaurav K <[email protected]>; Jani Nikula <[email protected]>; Navare, Manasi D <[email protected]>
Subject: Re: [v4 6/7] i915/dp/fec: Configure the Forward Error Correction bits.

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_clk_disable(struct

Quoted 61 lines · Anusha Srivatsa

If FEC is supported, the corresponding DP_TP_CTL register bits have to be configured.

The driver has to program the FEC_ENABLE in DP_TP_CTL[30] register and wait till FEC_STATUS in DP_TP_CTL[28] is 1.
Also add the warn message to make sure that the control register is already active while enabling FEC.

v2:
- Change commit message. Configure fec state after link training (Manasi, Gaurav)
- Remove redundent checks (Manasi)
- Remove the registers that get added automagically (Anusha)

v3: s/intel_dp_set_fec_state()/intel_dp_enable_fec_state() (Gaurav)

v4: rebased.

v5:
- Move the code to the proper spot, according to spec.(Ville)
- Use fec state as a check too.

Cc Gaurav K Singh <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Manasi Navare <[email protected]>
---
 drivers/gpu/drm/i915/i915_reg.h  |  2 ++
drivers/gpu/drm/i915/intel_ddi.c | 30 ++++++++++++++++++++++++++++++
drivers/gpu/drm/i915/intel_drv.h |  2 ++
 3 files changed, 34 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/i915_reg.h index e85f53cb9cdd..8b1753939299 100644

drivers/gpu/drm/i915/i915_reg.h +2 -0
@@ -9134,6 +9134,7 @@ enum skl_power_gate {
 #define _DP_TP_CTL_B			0x64140
 #define DP_TP_CTL(port) _MMIO_PORT(port, _DP_TP_CTL_A, _DP_TP_CTL_B)
 #define  DP_TP_CTL_ENABLE			(1 << 31)
+#define  DP_TP_CTL_FEC_ENABLE			(1 << 30)
 #define  DP_TP_CTL_MODE_SST			(0 << 27)
 #define  DP_TP_CTL_MODE_MST			(1 << 27)
 #define  DP_TP_CTL_FORCE_ACT			(1 << 25)
@@ -9152,6 +9153,7 @@ enum skl_power_gate {
 #define _DP_TP_STATUS_A			0x64044
 #define _DP_TP_STATUS_B			0x64144
 #define DP_TP_STATUS(port) _MMIO_PORT(port, _DP_TP_STATUS_A,
 _DP_TP_STATUS_B)
+#define  DP_TP_STATUS_FEC_ENABLE_LIVE		(1 << 28)
 #define  DP_TP_STATUS_IDLE_DONE			(1 << 25)
 #define  DP_TP_STATUS_ACT_SENT			(1 << 24)

#define DP_TP_STATUS_MODE_STATUS_MST (1 << 23)

drivers/gpu/drm/i915/intel_ddi.c +0 -0
index efbada95dc4e..f03f44f332c7 100644
@@ -2889,6 +2889,32 @@ static void intel_ddi_clk_disable(struct

intel_encoder *encoder)

Quoted 3 lines
drivers/gpu/drm/i915/intel_ddi.c +0 -0
 	}
 }
 
Quoted 6 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_clk_disable(struct intel_encoder *encoder) · line 2893

Quoted 2 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
+void intel_dp_enable_fec_state(struct intel_dp *intel_dp,
+			       const struct intel_crtc_state *crtc_state)

Can be static. intel_ddi_enable_fec() seems like a better name, and we can just pass the intel_encoder to this I think. No need to do all the "intel_dp to encoder" gynmastics then.

intel_ddi_enable_fec() is a better name.

Quoted 10 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_clk_disable(struct intel_encoder *encoder) · line 2900

Quoted 7 lines
drivers/gpu/drm/i915/intel_ddi.c +7 -0
+{
+	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
+	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
+	enum port port = intel_dig_port->base.port;
+	u32 val;
+
+	/* FEC support exists for DP 1.4 only */

This comment is misleading. There are other reasons besides < DP 1.4 for not using FEC. IMO just drop the comment.

Ok.

Quoted 9 lines
Quoted 7 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_clk_disable(struct intel_encoder *encoder) · line 2905

Quoted 5 lines
drivers/gpu/drm/i915/intel_ddi.c +5 -0
+	if (!crtc_state->fec_enable)
+		return;
+
+	if (!crtc_state->dsc_params.compression_enable)
+		return;

That check can be removed now.

No we will still need this. The fec_enable state is not coupled with compression. So we have to check fec state and the compression ....

Either we enable/disable fec or not. Whatever linkage with DSC only exists in compute_config().

Quoted 58 lines

Anusha

Quoted 57 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +4 -0
+
+	val = I915_READ(DP_TP_CTL(port));
+	val |= DP_TP_CTL_FEC_ENABLE;
+	I915_WRITE(DP_TP_CTL(port), val);

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_clk_disable(struct intel_encoder *encoder)

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +7 -0
+
+	if (intel_wait_for_register(dev_priv, DP_TP_STATUS(port),
+				    DP_TP_STATUS_FEC_ENABLE_LIVE,
+				    DP_TP_STATUS_FEC_ENABLE_LIVE,
+				    1))
+		DRM_ERROR("Timed out waiting for FEC Enable Status\n"); }
+
 static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 				    const struct intel_crtc_state *crtc_state,
 				    const struct drm_connector_state

*conn_state) @@ -2934,9

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_clk_disable(struct · line 2920

Quoted 1 line
drivers/gpu/drm/i915/intel_ddi.c +1 -0
+2960,13 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder

*encoder,

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, · line 2963

Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +1 -0
 					      DP_DECOMPRESSION_EN);
 	intel_dp_sink_set_fec_ready(intel_dp, crtc_state, DP_FEC_READY);
 	intel_dp_start_link_train(intel_dp);
+

Unrelated whitespace change.

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, · line 2967

Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +1 -0
 	if (port != PORT_A || INTEL_GEN(dev_priv) >= 9)
 		intel_dp_stop_link_train(intel_dp);
 
+	/* Set FEC state after link training */

Redundant comment.

Quoted 11 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
+	intel_dp_enable_fec_state(intel_dp, crtc_state);
+
 	icl_enable_phy_clock_gating(dig_port);
 
 	if (!is_mst)
drivers/gpu/drm/i915/intel_drv.h +0 -0
index 2a080205968d..1cdfa9c5da43 100644
@@ -1799,6 +1799,8 @@ void
Quoted 1 line

intel_dp_sink_set_decompression_state(struct intel_dp *intel_dp, void

intel_dp_sink_set_fec_ready(struct intel_dp *intel_dp,

Quoted 9 lines
drivers/gpu/drm/i915/intel_drv.h +2 -0
 				 const struct intel_crtc_state *crtc_state,
 				 int state);
+void intel_dp_enable_fec_state(struct intel_dp *intel_dp,
+			       const struct intel_crtc_state *crtc_state);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);  void

intel_dp_encoder_suspend(struct intel_encoder *intel_encoder); void intel_dp_encoder_destroy(struct drm_encoder *encoder);
--
2.17.1

--
Ville Syrjälä
Intel

Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#17 lore raw

Re: [v4 6/7] i915/dp/fec: Configure the Forward Error Correction bits.

Quoted 121 lines

-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Friday, November 2, 2018 4:16 AM
To: Srivatsa, Anusha <[email protected]>
Cc: [email protected]; Singh, Gaurav K <[email protected]>; Jani Nikula <[email protected]>; Navare, Manasi D <[email protected]>
Subject: Re: [v4 6/7] i915/dp/fec: Configure the Forward Error Correction bits.

Quoted 47 lines · Anusha
Quoted 47 lines

-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Wednesday, October 31, 2018 2:08 PM
To: Srivatsa, Anusha <[email protected]>
Cc: [email protected]; Singh, Gaurav K <[email protected]>; Jani Nikula <[email protected]>; Navare, Manasi D <[email protected]>
Subject: Re: [v4 6/7] i915/dp/fec: Configure the Forward Error Correction bits.

Quoted 34 lines · Anusha Srivatsa

If FEC is supported, the corresponding DP_TP_CTL register bits have to be configured.

The driver has to program the FEC_ENABLE in DP_TP_CTL[30] register and wait till FEC_STATUS in DP_TP_CTL[28] is 1.
Also add the warn message to make sure that the control register is already active while enabling FEC.

v2:
- Change commit message. Configure fec state after link training (Manasi, Gaurav)
- Remove redundent checks (Manasi)
- Remove the registers that get added automagically (Anusha)

v3: s/intel_dp_set_fec_state()/intel_dp_enable_fec_state() (Gaurav)

v4: rebased.

v5:
- Move the code to the proper spot, according to spec.(Ville)
- Use fec state as a check too.

Cc Gaurav K Singh <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Manasi Navare <[email protected]>
---
 drivers/gpu/drm/i915/i915_reg.h  |  2 ++
drivers/gpu/drm/i915/intel_ddi.c | 30
++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h |
2 ++
 3 files changed, 34 insertions(+)
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/i915/i915_reg.h enum skl_power_gate { · line 9135

Quoted 8 lines
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/i915_reg.h index e85f53cb9cdd..8b1753939299 100644

drivers/gpu/drm/i915/i915_reg.h +0 -0
@@ -9134,6 +9134,7 @@ enum skl_power_gate {
 #define _DP_TP_CTL_B			0x64140
 #define DP_TP_CTL(port) _MMIO_PORT(port, _DP_TP_CTL_A,

_DP_TP_CTL_B)

Quoted 21 lines
Quoted 21 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_clk_disable(struct

Quoted 20 lines
drivers/gpu/drm/i915/i915_reg.h +2 -0
 #define  DP_TP_CTL_ENABLE			(1 << 31)
+#define  DP_TP_CTL_FEC_ENABLE			(1 << 30)
 #define  DP_TP_CTL_MODE_SST			(0 << 27)
 #define  DP_TP_CTL_MODE_MST			(1 << 27)
 #define  DP_TP_CTL_FORCE_ACT			(1 << 25)
@@ -9152,6 +9153,7 @@ enum skl_power_gate {
 #define _DP_TP_STATUS_A			0x64044
 #define _DP_TP_STATUS_B			0x64144
 #define DP_TP_STATUS(port) _MMIO_PORT(port, _DP_TP_STATUS_A,
 _DP_TP_STATUS_B)
+#define  DP_TP_STATUS_FEC_ENABLE_LIVE		(1 << 28)
 #define  DP_TP_STATUS_IDLE_DONE			(1 << 25)
 #define  DP_TP_STATUS_ACT_SENT			(1 << 24)

#define DP_TP_STATUS_MODE_STATUS_MST (1 << 23)

drivers/gpu/drm/i915/intel_ddi.c +0 -0
index efbada95dc4e..f03f44f332c7 100644
@@ -2889,6 +2889,32 @@ static void intel_ddi_clk_disable(struct

intel_encoder *encoder)

Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_clk_disable(struct intel_encoder *encoder) · line 2893

Quoted 5 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
 	}
 }
 
+void intel_dp_enable_fec_state(struct intel_dp *intel_dp,
+			       const struct intel_crtc_state *crtc_state)

Can be static. intel_ddi_enable_fec() seems like a better name, and we can just pass the intel_encoder to this I think. No need to do all the

"intel_dp to encoder"

Quoted 23 lines
Quoted 1 line

gynmastics then.

intel_ddi_enable_fec() is a better name.

Quoted 10 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_clk_disable(struct intel_encoder *encoder) · line 2900

Quoted 7 lines
drivers/gpu/drm/i915/intel_ddi.c +7 -0
+{
+	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
+	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
+	enum port port = intel_dig_port->base.port;
+	u32 val;
+
+	/* FEC support exists for DP 1.4 only */

This comment is misleading. There are other reasons besides < DP 1.4 for not using FEC. IMO just drop the comment.

Ok.

Quoted 7 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_clk_disable(struct intel_encoder *encoder) · line 2905

Quoted 5 lines
drivers/gpu/drm/i915/intel_ddi.c +5 -0
+	if (!crtc_state->fec_enable)
+		return;
+
+	if (!crtc_state->dsc_params.compression_enable)
+		return;

That check can be removed now.

Quoted 6 lines
Quoted 1 line

No we will still need this. The fec_enable state is not coupled with compression.

So we have to check fec state and the compression ....

Quoted 1 line

Either we enable/disable fec or not. Whatever linkage with DSC only exists in compute_config().

True, I have changed this in v5.

Anusha

Quoted 61 lines
Quoted 60 lines

Anusha

Quoted 59 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +4 -0
+
+	val = I915_READ(DP_TP_CTL(port));
+	val |= DP_TP_CTL_FEC_ENABLE;
+	I915_WRITE(DP_TP_CTL(port), val);

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_clk_disable(struct intel_encoder *encoder)

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +7 -0
+
+	if (intel_wait_for_register(dev_priv, DP_TP_STATUS(port),
+				    DP_TP_STATUS_FEC_ENABLE_LIVE,
+				    DP_TP_STATUS_FEC_ENABLE_LIVE,
+				    1))
+		DRM_ERROR("Timed out waiting for FEC Enable Status\n"); }
+
 static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 				    const struct intel_crtc_state *crtc_state,
 				    const struct drm_connector_state

*conn_state) @@ -2934,9

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_clk_disable(struct

Quoted 2 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
+2960,13 @@ static void intel_ddi_pre_enable_dp(struct
+intel_encoder

*encoder,

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, · line 2963

Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +1 -0
 					      DP_DECOMPRESSION_EN);
 	intel_dp_sink_set_fec_ready(intel_dp, crtc_state, DP_FEC_READY);
 	intel_dp_start_link_train(intel_dp);
+

Unrelated whitespace change.

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, · line 2967

Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +1 -0
 	if (port != PORT_A || INTEL_GEN(dev_priv) >= 9)
 		intel_dp_stop_link_train(intel_dp);
 
+	/* Set FEC state after link training */

Redundant comment.

Quoted 12 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
+	intel_dp_enable_fec_state(intel_dp, crtc_state);
+
 	icl_enable_phy_clock_gating(dig_port);
 
 	if (!is_mst)
drivers/gpu/drm/i915/intel_drv.h +0 -0
index 2a080205968d..1cdfa9c5da43 100644
@@ -1799,6 +1799,8 @@ void
 intel_dp_sink_set_decompression_state(struct intel_dp *intel_dp,
Quoted 1 line

void

intel_dp_sink_set_fec_ready(struct intel_dp *intel_dp,

Quoted 9 lines
drivers/gpu/drm/i915/intel_drv.h +2 -0
 				 const struct intel_crtc_state *crtc_state,
 				 int state);
+void intel_dp_enable_fec_state(struct intel_dp *intel_dp,
+			       const struct intel_crtc_state *crtc_state);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);  void

intel_dp_encoder_suspend(struct intel_encoder *intel_encoder); void intel_dp_encoder_destroy(struct drm_encoder *encoder); --
2.17.1

--
Ville Syrjälä
Intel

Quoted 3 lines

--
Ville Syrjälä
Intel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#18 lore raw

PATCH v4 7/7 drm/i915/fec: Disable FEC state.

In reply to Anusha Srivatsa

Set the suitable bits in DP_TP_CTL to stop bit correction when DSC is disabled.

v2:
- rebased.
- Add additional check for compression state. (Gaurav)

v3: rebased.

v4:
- Move the code to the proper spot according to spec (Ville)
- Use proper checks (manasi)

Cc Gaurav K Singh <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Manasi Navare <[email protected]>
---
 drivers/gpu/drm/i915/intel_ddi.c | 32 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |  2 ++
 2 files changed, 34 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +32 -0
index f03f44f332c7..d28280c3b299 100644
@@ -2915,6 +2915,31 @@ void intel_dp_enable_fec_state(struct intel_dp *intel_dp,
 		DRM_ERROR("Timed out waiting for FEC Enable Status\n");
 }
 
+void intel_dp_disable_fec_state(struct intel_dp *intel_dp,
+				const struct intel_crtc_state *crtc_state)
+{
+	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
+	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
+	enum port port = intel_dig_port->base.port;
+	u32 val;
+	u8 dsc_en_state;
+
+	if (!crtc_state->fec_enable)
+		return;
+
+	if (!crtc_state->dsc_params.compression_enable)
+		return;
+
+	drm_dp_dpcd_readb(&intel_dp->aux, DP_DSC_ENABLE, &dsc_en_state);
+
+	if (!dsc_en_state) {
+		val = I915_READ(DP_TP_CTL(port));
+		val &= ~DP_TP_CTL_FEC_ENABLE;
+		I915_WRITE(DP_TP_CTL(port), val);
+		POSTING_READ(DP_TP_CTL(port));
+	}
+}
+
 static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 				    const struct intel_crtc_state *crtc_state,
 				    const struct drm_connector_state *conn_state)
@@ -3055,7 +3080,11 @@ static void intel_ddi_pre_enable(struct intel_encoder *encoder,
 static void intel_disable_ddi_buf(struct intel_encoder *encoder)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
+	struct intel_dp *intel_dp = &dig_port->dp;
+	struct intel_crtc_state *crtc_state;
 	enum port port = encoder->port;
+
 	bool wait = false;
 	u32 val;
 
@@ -3071,6 +3100,9 @@ static void intel_disable_ddi_buf(struct intel_encoder *encoder)
 	val |= DP_TP_CTL_LINK_TRAIN_PAT1;
 	I915_WRITE(DP_TP_CTL(port), val);
 
+	/* Disable FEC in DP Sink */
+	intel_dp_disable_fec_state(intel_dp, crtc_state);
+
 	if (wait)
 		intel_wait_ddi_buf_idle(dev_priv, port);
 }
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 1cdfa9c5da43..4ed04fad83b7 100644
@@ -1801,6 +1801,8 @@ void intel_dp_sink_set_fec_ready(struct intel_dp *intel_dp,
 				 int state);
 void intel_dp_enable_fec_state(struct intel_dp *intel_dp,
 			       const struct intel_crtc_state *crtc_state);
+void intel_dp_disable_fec_state(struct intel_dp *intel_dp,
+				const struct intel_crtc_state *crtc_state);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
 void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
 void intel_dp_encoder_destroy(struct drm_encoder *encoder);
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#19 lore raw

Re: [v4 7/7] drm/i915/fec: Disable FEC state.

Quoted 28 lines · Anusha Srivatsa

Set the suitable bits in DP_TP_CTL to stop bit correction when DSC is disabled.

v2:
- rebased.
- Add additional check for compression state. (Gaurav)

v3: rebased.

v4:
- Move the code to the proper spot according to spec (Ville)
- Use proper checks (manasi)

Cc Gaurav K Singh <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Manasi Navare <[email protected]>
---
 drivers/gpu/drm/i915/intel_ddi.c | 32 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |  2 ++
 2 files changed, 34 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +0 -0
index f03f44f332c7..d28280c3b299 100644

drivers/gpu/drm/i915/intel_ddi.c void intel_dp_enable_fec_state(struct intel_dp *intel_dp, · line 2919

Quoted 5 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
@@ -2915,6 +2915,31 @@ void intel_dp_enable_fec_state(struct intel_dp *intel_dp,
 		DRM_ERROR("Timed out waiting for FEC Enable Status\n");
 }
 
+void intel_dp_disable_fec_state(struct intel_dp *intel_dp,
+				const struct intel_crtc_state *crtc_state)

Same comments as for the enable.

drivers/gpu/drm/i915/intel_ddi.c void intel_dp_enable_fec_state(struct intel_dp *intel_dp, · line 2931

Quoted 12 lines
drivers/gpu/drm/i915/intel_ddi.c +12 -0
+{
+	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
+	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
+	enum port port = intel_dig_port->base.port;
+	u32 val;
+	u8 dsc_en_state;
+
+	if (!crtc_state->fec_enable)
+		return;
+
+	if (!crtc_state->dsc_params.compression_enable)
+		return;

Not needed.

drivers/gpu/drm/i915/intel_ddi.c void intel_dp_enable_fec_state(struct intel_dp *intel_dp, · line 2933

Quoted 2 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
+
+	drm_dp_dpcd_readb(&intel_dp->aux, DP_DSC_ENABLE, &dsc_en_state);

Why? Just disable FEC. fec_enable has already told us that it was enabled.

Quoted 13 lines
drivers/gpu/drm/i915/intel_ddi.c +9 -0
+
+	if (!dsc_en_state) {
+		val = I915_READ(DP_TP_CTL(port));
+		val &= ~DP_TP_CTL_FEC_ENABLE;
+		I915_WRITE(DP_TP_CTL(port), val);
+		POSTING_READ(DP_TP_CTL(port));
+	}
+}
+
 static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 				    const struct intel_crtc_state *crtc_state,
 				    const struct drm_connector_state *conn_state)

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_pre_enable(struct intel_encoder *encoder, · line 3087

Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +4 -0
@@ -3055,7 +3080,11 @@ static void intel_ddi_pre_enable(struct intel_encoder *encoder,
 static void intel_disable_ddi_buf(struct intel_encoder *encoder)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
+	struct intel_dp *intel_dp = &dig_port->dp;
+	struct intel_crtc_state *crtc_state;
 	enum port port = encoder->port;
+

Bogus whitespace.

drivers/gpu/drm/i915/intel_ddi.c static void intel_disable_ddi_buf(struct intel_encoder *encoder) · line 3103

Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +1 -0
 	bool wait = false;
 	u32 val;
 
@@ -3071,6 +3100,9 @@ static void intel_disable_ddi_buf(struct intel_encoder *encoder)
 	val |= DP_TP_CTL_LINK_TRAIN_PAT1;
 	I915_WRITE(DP_TP_CTL(port), val);
 
+	/* Disable FEC in DP Sink */

Incorrect comment.

Quoted 20 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
+	intel_dp_disable_fec_state(intel_dp, crtc_state);
+
 	if (wait)
 		intel_wait_ddi_buf_idle(dev_priv, port);
 }
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 1cdfa9c5da43..4ed04fad83b7 100644
@@ -1801,6 +1801,8 @@ void intel_dp_sink_set_fec_ready(struct intel_dp *intel_dp,
 				 int state);
 void intel_dp_enable_fec_state(struct intel_dp *intel_dp,
 			       const struct intel_crtc_state *crtc_state);
+void intel_dp_disable_fec_state(struct intel_dp *intel_dp,
+				const struct intel_crtc_state *crtc_state);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
 void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
 void intel_dp_encoder_destroy(struct drm_encoder *encoder);
Signature · 1 line
2.17.1
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#20 lore raw

Re: [v4 7/7] drm/i915/fec: Disable FEC state.

In reply to Anusha Srivatsa
Quoted 72 lines · Anusha Srivatsa

Set the suitable bits in DP_TP_CTL to stop bit correction when DSC is disabled.

v2:
- rebased.
- Add additional check for compression state. (Gaurav)

v3: rebased.

v4:
- Move the code to the proper spot according to spec (Ville)
- Use proper checks (manasi)

Cc Gaurav K Singh <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Manasi Navare <[email protected]>
---
 drivers/gpu/drm/i915/intel_ddi.c | 32 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |  2 ++
 2 files changed, 34 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +29 -0
index f03f44f332c7..d28280c3b299 100644
@@ -2915,6 +2915,31 @@ void intel_dp_enable_fec_state(struct intel_dp *intel_dp,
 		DRM_ERROR("Timed out waiting for FEC Enable Status\n");
 }
 
+void intel_dp_disable_fec_state(struct intel_dp *intel_dp,
+				const struct intel_crtc_state *crtc_state)
+{
+	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
+	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
+	enum port port = intel_dig_port->base.port;
+	u32 val;
+	u8 dsc_en_state;
+
+	if (!crtc_state->fec_enable)
+		return;
+
+	if (!crtc_state->dsc_params.compression_enable)
+		return;
+
+	drm_dp_dpcd_readb(&intel_dp->aux, DP_DSC_ENABLE, &dsc_en_state);
+
+	if (!dsc_en_state) {
+		val = I915_READ(DP_TP_CTL(port));
+		val &= ~DP_TP_CTL_FEC_ENABLE;
+		I915_WRITE(DP_TP_CTL(port), val);
+		POSTING_READ(DP_TP_CTL(port));
+	}
+}
+
 static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 				    const struct intel_crtc_state *crtc_state,
 				    const struct drm_connector_state *conn_state)
@@ -3055,7 +3080,11 @@ static void intel_ddi_pre_enable(struct intel_encoder *encoder,
 static void intel_disable_ddi_buf(struct intel_encoder *encoder)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
+	struct intel_dp *intel_dp = &dig_port->dp;
+	struct intel_crtc_state *crtc_state;
 	enum port port = encoder->port;
+
 	bool wait = false;
 	u32 val;
 

drivers/gpu/drm/i915/intel_ddi.c static void intel_disable_ddi_buf(struct intel_encoder *encoder) · line 3104

Quoted 5 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
@@ -3071,6 +3100,9 @@ static void intel_disable_ddi_buf(struct intel_encoder *encoder)
 	val |= DP_TP_CTL_LINK_TRAIN_PAT1;
 	I915_WRITE(DP_TP_CTL(port), val);
 
+	/* Disable FEC in DP Sink */
+	intel_dp_disable_fec_state(intel_dp, crtc_state);

crtc_state is uninitialized here. You need to pass crtc_state to intel_disable_ddi_buf() or just call intel_dp_disable_fec_state() from the caller of intel_disable_ddi_buf() right after it.

Manasi

Quoted 20 lines
drivers/gpu/drm/i915/intel_ddi.c +1 -0
+
 	if (wait)
 		intel_wait_ddi_buf_idle(dev_priv, port);
 }
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 1cdfa9c5da43..4ed04fad83b7 100644
@@ -1801,6 +1801,8 @@ void intel_dp_sink_set_fec_ready(struct intel_dp *intel_dp,
 				 int state);
 void intel_dp_enable_fec_state(struct intel_dp *intel_dp,
 			       const struct intel_crtc_state *crtc_state);
+void intel_dp_disable_fec_state(struct intel_dp *intel_dp,
+				const struct intel_crtc_state *crtc_state);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
 void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
 void intel_dp_encoder_destroy(struct drm_encoder *encoder);
Signature · 1 line
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#21 lore raw

✗ Fi.CI.BAT: failure for Forward Error Correction (rev4)

In reply to Anusha Srivatsa
== Series Details ==

== Series Details ==

Series: Forward Error Correction (rev4)
URL : https://patchwork.freedesktop.org/series/47848/
State : failure

== Summary ==

Applying: i915/dp/fec: Cache the FEC_CAPABLE DPCD register
error: sha1 information is lacking or useless (drivers/gpu/drm/i915/intel_dp.c).
error: could not build fake ancestor
Patch failed at 0001 i915/dp/fec: Cache the FEC_CAPABLE DPCD register Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#22 lore raw
In reply to Anusha Srivatsa
Quoted 8 lines · Anusha Srivatsa

With Display Compression, the bit error in the pixel stream can turn into a significant corruption on the screen. The DP1.4 adds FEC - Forward Error Correction scheme which uses Reed-Solomon parity/correction check generated by the source and used by the sink to detect and correct small numbers of bit errors in the compressed stream.

Quoted 8 lines

v2: Avoid doing aux channel read eberytime we check for FEC support. Instead cache the value of the DPCD registers, similar to the DSC implementaion (Jani)

v3: Add fec as a state to crtc. Move around the code. (Ville)

v4: s/can_fec/fec_enable; s/intel_dp_can_fec/intel_de_supports_fec; Add intel_dp_source supports_fec() (Ville)

One clear thing missing is from this series is the state readout + PIPE_CONF_CHECK

Quoted 27 lines

This is rebased on top of Manasi's End-to-end DSC
Implementation: https://patchwork.freedesktop.org/series/47514/

Anusha Srivatsa (7):
i915/dp/fec: Cache the FEC_CAPABLE DPCD register drm/dp/fec: DRM helper for Forward Error Correction i915/dp/fec: Check for FEC Support
i915/dp/fec: Add can_fec to the crtc state. drm/i915/fec: Set FEC_READY in FEC_CONFIGURATION i915/dp/fec: Configure the Forward Error Correction bits. drm/i915/fec: Disable FEC state.

 drivers/gpu/drm/i915/i915_reg.h  |  2 ++
 drivers/gpu/drm/i915/intel_ddi.c | 60 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_dp.c  | 58 ++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/intel_drv.h | 11 ++++++
 include/drm/drm_dp_helper.h      |  7 ++++
 5 files changed, 136 insertions(+), 2 deletions(-)
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx