Skip to contentSkip to conversation

drm/i915: Restrict usage of live status check

PATCH Superseded Shashank Sharma 3 participants 7 messages Mar 10, 2016

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Restrict usage of live status check

This patch does the following:
- Restricts usage of live status check for HDMI detection. While testing certain (monitor + cable) combinations with various intel platforms, it seems that live status register doesn't work reliably on some older devices. So limit the live_status check for HDMI detection, only for platforms from gen7 onwards.
- Cleans up the retry logic.
There is an extra 'if (try)' check, which can be avoided by changing the logic slightly, keeping the delay as same(80ms)

---
 drivers/gpu/drm/i915/intel_hdmi.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_hdmi.c +15 -8
index e2dab48..3f6db91 100644
@@ -1397,24 +1397,31 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
 	enum drm_connector_status status;
 	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
 	struct drm_i915_private *dev_priv = to_i915(connector->dev);
-	bool live_status = false;
-	unsigned int try;
+	bool live_status = true;
+	unsigned int try = 9;
 
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
 		      connector->base.id, connector->name);
 
 	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
 
-	for (try = 0; !live_status && try < 9; try++) {
-		if (try)
-			msleep(10);
+	/*
+	 * When tested with specific set of monitors + cables,
+	 * live status behavior is not very consistent for older
+	 * platforms. So add live status check from GEN7
+	 * onwards.
+	 */
+	if (INTEL_INFO(dev_priv->dev)->gen >= 7) {
+retry_ls:
 		live_status = intel_digital_port_connected(dev_priv,
 				hdmi_to_dig_port(intel_hdmi));
+		if (!live_status && --try) {
+			msleep(10);
+			goto retry_ls;
+		}
+		DRM_DEBUG_KMS("Live status %s!\n", live_status ? "up" : "down");
 	}
 
-	if (!live_status)
-		DRM_DEBUG_KMS("Live status not up!");
-
 	intel_hdmi_unset_edid(connector);
 
 	if (intel_hdmi_set_edid(connector, live_status)) {
Signature · 6 lines
1.9.1

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

This patch does the following:
- Restricts usage of live status check for HDMI detection. While testing certain (monitor + cable) combinations with various intel platforms, it seems that live status register doesn't work reliably on some older devices. So limit the live_status check for HDMI detection, only for platforms from gen7 onwards.

Not good enough. We have regressions reported on IVB at least. Also I'm not convinced more recent platforms are any necessarily better here.

Quoted 3 lines

- Cleans up the retry logic.
There is an extra 'if (try)' check, which can be avoided by changing the logic slightly, keeping the delay as same(80ms)

I wouldn't call a goto loop clean.

Quoted 57 lines
---
 drivers/gpu/drm/i915/intel_hdmi.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_hdmi.c +15 -8
index e2dab48..3f6db91 100644
@@ -1397,24 +1397,31 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
 	enum drm_connector_status status;
 	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
 	struct drm_i915_private *dev_priv = to_i915(connector->dev);
-	bool live_status = false;
-	unsigned int try;
+	bool live_status = true;
+	unsigned int try = 9;
 
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
 		      connector->base.id, connector->name);
 
 	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
 
-	for (try = 0; !live_status && try < 9; try++) {
-		if (try)
-			msleep(10);
+	/*
+	 * When tested with specific set of monitors + cables,
+	 * live status behavior is not very consistent for older
+	 * platforms. So add live status check from GEN7
+	 * onwards.
+	 */
+	if (INTEL_INFO(dev_priv->dev)->gen >= 7) {
+retry_ls:
 		live_status = intel_digital_port_connected(dev_priv,
 				hdmi_to_dig_port(intel_hdmi));
+		if (!live_status && --try) {
+			msleep(10);
+			goto retry_ls;
+		}
+		DRM_DEBUG_KMS("Live status %s!\n", live_status ? "up" : "down");
 	}
 
-	if (!live_status)
-		DRM_DEBUG_KMS("Live status not up!");
-
 	intel_hdmi_unset_edid(connector);
 
 	if (intel_hdmi_set_edid(connector, live_status)) {
Signature · 6 lines
1.9.1

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

Thanks Ville,

Regards
Shashank

Quoted 9 lines · Ville Syrjälä
Quoted 7 lines · Shashank Sharma

This patch does the following:
- Restricts usage of live status check for HDMI detection. While testing certain (monitor + cable) combinations with various intel platforms, it seems that live status register doesn't work reliably on some older devices. So limit the live_status check for HDMI detection, only for platforms from gen7 onwards.

Quoted 3 lines

Not good enough. We have regressions reported on IVB at least. Also I'm not convinced more recent platforms are any necessarily better here.

Thanks for pointing out the miss for IVB. I will add skip for that.
We have tested VLV, CHT SKL and BXT with this code, so we should be good with those. Anything particular in your mind ?

Quoted 7 lines
Quoted 4 lines

- Cleans up the retry logic.
There is an extra 'if (try)' check, which can be avoided by changing the logic slightly, keeping the delay as same(80ms)

I wouldn't call a goto loop clean.

I know, its flushing my pipeline, and its not the best thing to do. But makes code more readable, and removes one (if) condition, which was getting executed for every run of the loop. So I guess still some CPU cycles saved in the end :)

Quoted 49 lines
Quoted 49 lines
---
  drivers/gpu/drm/i915/intel_hdmi.c | 23 +++++++++++++++--------
  1 file changed, 15 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_hdmi.c +15 -8
index e2dab48..3f6db91 100644
@@ -1397,24 +1397,31 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
  	enum drm_connector_status status;
  	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
  	struct drm_i915_private *dev_priv = to_i915(connector->dev);
-	bool live_status = false;
-	unsigned int try;
+	bool live_status = true;
+	unsigned int try = 9;
 
  	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
  		      connector->base.id, connector->name);
 
  	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
 
-	for (try = 0; !live_status && try < 9; try++) {
-		if (try)
-			msleep(10);
+	/*
+	 * When tested with specific set of monitors + cables,
+	 * live status behavior is not very consistent for older
+	 * platforms. So add live status check from GEN7
+	 * onwards.
+	 */
+	if (INTEL_INFO(dev_priv->dev)->gen >= 7) {
+retry_ls:
  		live_status = intel_digital_port_connected(dev_priv,
  				hdmi_to_dig_port(intel_hdmi));
+		if (!live_status && --try) {
+			msleep(10);
+			goto retry_ls;
+		}
+		DRM_DEBUG_KMS("Live status %s!\n", live_status ? "up" : "down");
  	}
 
-	if (!live_status)
-		DRM_DEBUG_KMS("Live status not up!");
-
  	intel_hdmi_unset_edid(connector);
 
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_hdmi.c +0 -1
  	if (intel_hdmi_set_edid(connector, live_status)) {
--

1.9.1

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

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

#3 lore raw
Quoted 15 lines · Shashank

Thanks Ville,

Regards
Shashank

Quoted 9 lines · Ville Syrjälä
Quoted 7 lines · Shashank Sharma

This patch does the following:
- Restricts usage of live status check for HDMI detection. While testing certain (monitor + cable) combinations with various intel platforms, it seems that live status register doesn't work reliably on some older devices. So limit the live_status check for HDMI detection, only for platforms from gen7 onwards.

Quoted 6 lines
Quoted 3 lines

Not good enough. We have regressions reported on IVB at least. Also I'm not convinced more recent platforms are any necessarily better here.

Thanks for pointing out the miss for IVB. I will add skip for that. We have tested VLV, CHT SKL and BXT with this code, so we should be good with those. Anything particular in your mind ?

I'm concerned it's more about the displays/cables than about the source. I don't think we had any reports so far where people would have been able to test a bad sink/cable with multiple platforms, and found some working and some not.

Quoted 11 lines
Quoted 7 lines
Quoted 4 lines

- Cleans up the retry logic.
There is an extra 'if (try)' check, which can be avoided by changing the logic slightly, keeping the delay as same(80ms)

I wouldn't call a goto loop clean.

I know, its flushing my pipeline, and its not the best thing to do. But makes code more readable, and removes one (if) condition, which was getting executed for every run of the loop. So I guess still some CPU cycles saved in the end :)

Any kind of real loop would be more clear than a goto. Though we did use some while/do while thing originally I think, and that was messy in other ways. Pn option would of course be to unroll the first iteration out from the loop so that the 'if' would disappear from the loop.

In any case, this sort of stuff should be a separate patch.

Quoted 58 lines
Quoted 58 lines
Quoted 57 lines
---
  drivers/gpu/drm/i915/intel_hdmi.c | 23 +++++++++++++++--------
  1 file changed, 15 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_hdmi.c +15 -9
index e2dab48..3f6db91 100644
@@ -1397,24 +1397,31 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
  	enum drm_connector_status status;
  	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
  	struct drm_i915_private *dev_priv = to_i915(connector->dev);
-	bool live_status = false;
-	unsigned int try;
+	bool live_status = true;
+	unsigned int try = 9;
 
  	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
  		      connector->base.id, connector->name);
 
  	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
 
-	for (try = 0; !live_status && try < 9; try++) {
-		if (try)
-			msleep(10);
+	/*
+	 * When tested with specific set of monitors + cables,
+	 * live status behavior is not very consistent for older
+	 * platforms. So add live status check from GEN7
+	 * onwards.
+	 */
+	if (INTEL_INFO(dev_priv->dev)->gen >= 7) {
+retry_ls:
  		live_status = intel_digital_port_connected(dev_priv,
  				hdmi_to_dig_port(intel_hdmi));
+		if (!live_status && --try) {
+			msleep(10);
+			goto retry_ls;
+		}
+		DRM_DEBUG_KMS("Live status %s!\n", live_status ? "up" : "down");
  	}
 
-	if (!live_status)
-		DRM_DEBUG_KMS("Live status not up!");
-
  	intel_hdmi_unset_edid(connector);
 
  	if (intel_hdmi_set_edid(connector, live_status)) {
--

1.9.1

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

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

Regards
Shashank

Quoted 19 lines · Ville Syrjälä
Quoted 18 lines · Shashank

Thanks Ville,

Regards
Shashank

Quoted 12 lines · Ville Syrjälä
Quoted 7 lines · Shashank Sharma

This patch does the following:
- Restricts usage of live status check for HDMI detection. While testing certain (monitor + cable) combinations with various intel platforms, it seems that live status register doesn't work reliably on some older devices. So limit the live_status check for HDMI detection, only for platforms from gen7 onwards.

Not good enough. We have regressions reported on IVB at least. Also I'm not convinced more recent platforms are any necessarily better here.

Quoted 9 lines
Quoted 3 lines

Thanks for pointing out the miss for IVB. I will add skip for that. We have tested VLV, CHT SKL and BXT with this code, so we should be good with those. Anything particular in your mind ?

I'm concerned it's more about the displays/cables than about the source. I don't think we had any reports so far where people would have been able to test a bad sink/cable with multiple platforms, and found some working and some not.

I agree, that it did seem to work fine till now. But the reason behind that was, we were probing EDID on every instance of detect(with out without interrupt), and it was hitting one or other time. So these issues were always there, but were hidden behind bugs in our driver.

Also, for newer platforms, live status check is a *must* as per bspec. If we dont do this, we will see improper hdmi_detect() replies for consecutive connector_probe, just like chrome and android is facing now. Passing compliance is again other concern.

IMHO, Now, when our driver is used between commercial/production devices and open source community, we have to let a cable/monitor vendor take the credit of the bug. Carrying this forward is gonna hit our performance and HDMI compliance certification.

Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
Quoted 4 lines

- Cleans up the retry logic.
There is an extra 'if (try)' check, which can be avoided by changing the logic slightly, keeping the delay as same(80ms)

I wouldn't call a goto loop clean.

I know, its flushing my pipeline, and its not the best thing to do. But makes code more readable, and removes one (if) condition, which was getting executed for every run of the loop. So I guess still some CPU cycles saved in the end :)

Quoted 4 lines

Any kind of real loop would be more clear than a goto. Though we did use some while/do while thing originally I think, and that was messy in other ways. Pn option would of course be to unroll the first iteration out from the loop so that the 'if' would disappear from the loop.

Yes, This will add code duplication, as I will be adding the same line after and before loop. Typical embedded system dilemma, space vs time :)

Quoted 2 lines

In any case, this sort of stuff should be a separate patch.

Agree, I can add another patch for this.

Quoted 54 lines
Quoted 54 lines
Quoted 54 lines
Quoted 54 lines
---
   drivers/gpu/drm/i915/intel_hdmi.c | 23 +++++++++++++++--------
   1 file changed, 15 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_hdmi.c +15 -9
index e2dab48..3f6db91 100644
@@ -1397,24 +1397,31 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
   	enum drm_connector_status status;
   	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
   	struct drm_i915_private *dev_priv = to_i915(connector->dev);
-	bool live_status = false;
-	unsigned int try;
+	bool live_status = true;
+	unsigned int try = 9;
 
   	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
   		      connector->base.id, connector->name);
 
   	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
 
-	for (try = 0; !live_status && try < 9; try++) {
-		if (try)
-			msleep(10);
+	/*
+	 * When tested with specific set of monitors + cables,
+	 * live status behavior is not very consistent for older
+	 * platforms. So add live status check from GEN7
+	 * onwards.
+	 */
+	if (INTEL_INFO(dev_priv->dev)->gen >= 7) {
+retry_ls:
   		live_status = intel_digital_port_connected(dev_priv,
   				hdmi_to_dig_port(intel_hdmi));
+		if (!live_status && --try) {
+			msleep(10);
+			goto retry_ls;
+		}
+		DRM_DEBUG_KMS("Live status %s!\n", live_status ? "up" : "down");
   	}
 
-	if (!live_status)
-		DRM_DEBUG_KMS("Live status not up!");
-
   	intel_hdmi_unset_edid(connector);
 
   	if (intel_hdmi_set_edid(connector, live_status)) {
--

1.9.1

Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

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

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

#5 lore raw

✗ Fi.CI.BAT: failure for drm/i915: Restrict usage of live status check

In reply to Shashank Sharma
== Series Details ==

== Series Details ==

Series: drm/i915: Restrict usage of live status check
URL : https://patchwork.freedesktop.org/series/4297/
State : failure

== Summary ==

Series 4297v1 drm/i915: Restrict usage of live status check
http://patchwork.freedesktop.org/api/1.0/series/4297/revisions/1/mbox/

Test drv_module_reload_basic:

                dmesg-warn -> PASS       (ilk-hp8440p)
Test kms_flip:
        Subgroup basic-flip-vs-dpms:
                pass       -> DMESG-WARN (ilk-hp8440p) UNSTABLE
        Subgroup basic-flip-vs-modeset:
                dmesg-warn -> PASS       (bdw-ultra)
        Subgroup basic-flip-vs-wf_vblank:
                pass       -> FAIL       (bsw-nuc-2)
        Subgroup basic-plain-flip:
                dmesg-warn -> PASS       (hsw-gt2)
Test kms_pipe_crc_basic:
        Subgroup nonblocking-crc-pipe-a:
                pass       -> DMESG-WARN (snb-dellxps)
        Subgroup nonblocking-crc-pipe-b:
                dmesg-warn -> PASS       (snb-x220t)
                pass       -> SKIP       (byt-nuc)
        Subgroup nonblocking-crc-pipe-b-frame-sequence:
                dmesg-warn -> PASS       (hsw-brixbox)
        Subgroup read-crc-pipe-c-frame-sequence:
                pass       -> DMESG-WARN (hsw-brixbox)
Test pm_rpm:
        Subgroup basic-pci-d3-state:
                pass       -> DMESG-WARN (snb-dellxps)
                pass       -> DMESG-WARN (byt-nuc)
        Subgroup basic-rte:
                dmesg-warn -> PASS       (snb-dellxps)
bdw-ultra        total:193  pass:172  dwarn:0   dfail:0   fail:0   skip:21 
bsw-nuc-2        total:193  pass:154  dwarn:1   dfail:0   fail:1   skip:37 
byt-nuc          total:193  pass:156  dwarn:1   dfail:0   fail:0   skip:36 
hsw-brixbox      total:193  pass:170  dwarn:1   dfail:0   fail:0   skip:22 
hsw-gt2          total:193  pass:176  dwarn:0   dfail:0   fail:0   skip:17 
ilk-hp8440p      total:193  pass:129  dwarn:1   dfail:0   fail:0   skip:63 
ivb-t430s        total:193  pass:168  dwarn:0   dfail:0   fail:0   skip:25 
skl-i5k-2        total:193  pass:170  dwarn:0   dfail:0   fail:0   skip:23 
skl-i7k-2        total:193  pass:170  dwarn:0   dfail:0   fail:0   skip:23 
snb-dellxps      total:193  pass:157  dwarn:2   dfail:0   fail:0   skip:34 
snb-x220t        total:193  pass:158  dwarn:1   dfail:0   fail:1   skip:33 

Results at /archive/results/CI_IGT_test/Patchwork_1559/

ab403b26610034afe0e0c97d960782bad98b97d0 drm-intel-nightly: 2016y-03m-09d-09h-25m-31s UTC integration manifest 1328696734a21106ac8da7f5296923ae45a04568 drm/i915: Restrict usage of live status check

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

#6 lore raw

✗ Fi.CI.BAT: failure for drm/i915: Restrict usage of live status check

In reply to Shashank Sharma
== Series Details ==

== Series Details ==

Series: drm/i915: Restrict usage of live status check
URL : https://patchwork.freedesktop.org/series/4297/
State : failure

== Summary ==

Series 4297v1 drm/i915: Restrict usage of live status check
http://patchwork.freedesktop.org/api/1.0/series/4297/revisions/1/mbox/

Test drv_module_reload_basic:

                dmesg-warn -> PASS       (ilk-hp8440p)
Test kms_flip:
        Subgroup basic-flip-vs-dpms:
                pass       -> DMESG-WARN (ilk-hp8440p) UNSTABLE
        Subgroup basic-flip-vs-modeset:
                dmesg-warn -> PASS       (bdw-ultra)
        Subgroup basic-flip-vs-wf_vblank:
                pass       -> FAIL       (bsw-nuc-2)
        Subgroup basic-plain-flip:
                dmesg-warn -> PASS       (hsw-gt2)
Test kms_pipe_crc_basic:
        Subgroup nonblocking-crc-pipe-a:
                pass       -> DMESG-WARN (snb-dellxps)
        Subgroup nonblocking-crc-pipe-b:
                dmesg-warn -> PASS       (snb-x220t)
                pass       -> SKIP       (byt-nuc)
        Subgroup nonblocking-crc-pipe-b-frame-sequence:
                dmesg-warn -> PASS       (hsw-brixbox)
        Subgroup read-crc-pipe-c-frame-sequence:
                pass       -> DMESG-WARN (hsw-brixbox)
Test pm_rpm:
        Subgroup basic-pci-d3-state:
                pass       -> DMESG-WARN (snb-dellxps)
                pass       -> DMESG-WARN (byt-nuc)
        Subgroup basic-rte:
                dmesg-warn -> PASS       (snb-dellxps)
bdw-ultra        total:193  pass:172  dwarn:0   dfail:0   fail:0   skip:21 
bsw-nuc-2        total:193  pass:154  dwarn:1   dfail:0   fail:1   skip:37 
byt-nuc          total:193  pass:156  dwarn:1   dfail:0   fail:0   skip:36 
hsw-brixbox      total:193  pass:170  dwarn:1   dfail:0   fail:0   skip:22 
hsw-gt2          total:193  pass:176  dwarn:0   dfail:0   fail:0   skip:17 
ilk-hp8440p      total:193  pass:129  dwarn:1   dfail:0   fail:0   skip:63 
ivb-t430s        total:193  pass:168  dwarn:0   dfail:0   fail:0   skip:25 
skl-i5k-2        total:193  pass:170  dwarn:0   dfail:0   fail:0   skip:23 
skl-i7k-2        total:193  pass:170  dwarn:0   dfail:0   fail:0   skip:23 
snb-dellxps      total:193  pass:157  dwarn:2   dfail:0   fail:0   skip:34 
snb-x220t        total:193  pass:158  dwarn:1   dfail:0   fail:1   skip:33 

Results at /archive/results/CI_IGT_test/Patchwork_1559/

ab403b26610034afe0e0c97d960782bad98b97d0 drm-intel-nightly: 2016y-03m-09d-09h-25m-31s UTC integration manifest 1328696734a21106ac8da7f5296923ae45a04568 drm/i915: Restrict usage of live status check

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