Skip to contentSkip to conversation

drm/i915/hotplug: Move iteration over connectors to other function

PATCH New José Roberto de Souza 2 participants 5 messages Feb 9, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/i915/hotplug: Move iteration over connectors to other function

The next patch will need to a second iteration over connectors so moving it to a function, no behavior changes intended here.

While at it moving intel_connector and intel_encoder to inside of the block that actually uses it.

---
 drivers/gpu/drm/i915/intel_hotplug.c | 52 ++++++++++++++++++----------
 1 file changed, 33 insertions(+), 19 deletions(-)
drivers/gpu/drm/i915/intel_hotplug.c +33 -19
index b8937c788f03..72e0203bcbb2 100644
@@ -342,6 +342,37 @@ static void i915_digport_work_func(struct work_struct *work)
 	}
 }
 
+static bool
+i915_hotplug_iterate(struct drm_device *dev, u32 hpd_event_bits)
+{
+	struct drm_connector_list_iter conn_iter;
+	struct drm_connector *connector;
+	bool changed = 0;
+
+	drm_connector_list_iter_begin(dev, &conn_iter);
+	drm_for_each_connector_iter(connector, &conn_iter) {
+		struct intel_connector *intel_connector;
+		struct intel_encoder *intel_encoder;
+
+		intel_connector = to_intel_connector(connector);
+		intel_encoder = intel_connector->encoder;
+
+		if (!intel_encoder)
+			continue;
+
+		if (hpd_event_bits & (1 << intel_encoder->hpd_pin)) {
+			DRM_DEBUG_KMS("Connector %s (pin %i) received hotplug event.\n",
+				      connector->name, intel_encoder->hpd_pin);
+
+			changed |= intel_encoder->hotplug(intel_encoder,
+							  intel_connector);
+		}
+	}
+	drm_connector_list_iter_end(&conn_iter);
+
+	return changed;
+}
+
 /*
  * Handle hotplug events outside the interrupt handler proper.
  */
@@ -350,11 +381,7 @@ static void i915_hotplug_work_func(struct work_struct *work)
 	struct drm_i915_private *dev_priv =
 		container_of(work, struct drm_i915_private, hotplug.hotplug_work);
 	struct drm_device *dev = &dev_priv->drm;
-	struct intel_connector *intel_connector;
-	struct intel_encoder *intel_encoder;
-	struct drm_connector *connector;
-	struct drm_connector_list_iter conn_iter;
-	bool changed = false;
+	bool changed;
 	u32 hpd_event_bits;
 
 	mutex_lock(&dev->mode_config.mutex);
@@ -370,21 +397,8 @@ static void i915_hotplug_work_func(struct work_struct *work)
 
 	spin_unlock_irq(&dev_priv->irq_lock);
 
-	drm_connector_list_iter_begin(dev, &conn_iter);
-	drm_for_each_connector_iter(connector, &conn_iter) {
-		intel_connector = to_intel_connector(connector);
-		if (!intel_connector->encoder)
-			continue;
-		intel_encoder = intel_connector->encoder;
-		if (hpd_event_bits & (1 << intel_encoder->hpd_pin)) {
-			DRM_DEBUG_KMS("Connector %s (pin %i) received hotplug event.\n",
-				      connector->name, intel_encoder->hpd_pin);
+	changed = i915_hotplug_iterate(dev, hpd_event_bits);
 
-			changed |= intel_encoder->hotplug(intel_encoder,
-							  intel_connector);
-		}
-	}
-	drm_connector_list_iter_end(&conn_iter);
 	mutex_unlock(&dev->mode_config.mutex);
 
 	if (changed)
Signature · 6 lines
2.20.1

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

PATCH 2/2 drm/i915/icl: Probe again type-c connectors that failed

Unpowered type-c dongles can take some time to boot and be responsible, causing the probe to fail and sink never be detected without further actions from userspace.

It was not a issue for older platforms because there was a hardware bridge between DDI/DP ports and type-c controller adding a implicit delay that hid this issue but ICL have type-c controllers integrated to the SOC bring this issue to users.

So here after the first probe interation over every connector with a hotplug event set, it sleeps for half a second to give some time to dongles to be ready and then try to probe again every type-c connector that failed in the initial probe.

---
 drivers/gpu/drm/i915/intel_dp.c      |  3 +++
 drivers/gpu/drm/i915/intel_drv.h     |  2 +-
 drivers/gpu/drm/i915/intel_hotplug.c | 39 +++++++++++++++++++++++-----
 3 files changed, 37 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +3 -0
index cf709835fb9a..b91b9700755f 100644
@@ -6968,6 +6968,9 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 		I915_WRITE(PEG_BAND_GAP_DATA, (temp & ~0xf) | 0xd);
 	}
 
+	if (intel_port_is_tc(dev_priv, port) && !intel_dig_port->tc_legacy_port)
+		intel_dig_port->tc_delay_wa_needed = true;
+
 	return true;
 
 fail:
drivers/gpu/drm/i915/intel_drv.h +1 -1
index fd50c962eaa3..3ae95679c2a9 100644
@@ -1257,7 +1257,7 @@ struct intel_digital_port {
 	/* Used for DP and ICL+ TypeC/DP and TypeC/HDMI ports. */
 	enum aux_ch aux_ch;
 	enum intel_display_power_domain ddi_io_power_domain;
-	bool tc_legacy_port:1;
+	bool tc_legacy_port:1, tc_delay_wa_needed:1;
 	enum tc_port_type tc_type;
 
 	void (*write_infoframe)(struct intel_encoder *encoder,
drivers/gpu/drm/i915/intel_hotplug.c +33 -6
index 72e0203bcbb2..eeac29f2dc70 100644
@@ -343,7 +343,7 @@ static void i915_digport_work_func(struct work_struct *work)
 }
 
 static bool
-i915_hotplug_iterate(struct drm_device *dev, u32 hpd_event_bits)
+i915_hotplug_iterate(struct drm_device *dev, u32 hpd_event_bits, u32 *hpd_tc_delay_wa)
 {
 	struct drm_connector_list_iter conn_iter;
 	struct drm_connector *connector;
@@ -356,16 +356,27 @@ i915_hotplug_iterate(struct drm_device *dev, u32 hpd_event_bits)
 
 		intel_connector = to_intel_connector(connector);
 		intel_encoder = intel_connector->encoder;
-
 		if (!intel_encoder)
 			continue;
 
 		if (hpd_event_bits & (1 << intel_encoder->hpd_pin)) {
+			bool ret;
+
 			DRM_DEBUG_KMS("Connector %s (pin %i) received hotplug event.\n",
 				      connector->name, intel_encoder->hpd_pin);
 
-			changed |= intel_encoder->hotplug(intel_encoder,
-							  intel_connector);
+			ret = intel_encoder->hotplug(intel_encoder,
+						     intel_connector);
+			changed |= ret;
+
+			if (hpd_tc_delay_wa && !ret &&
+			    connector->status != connector_status_connected) {
+				struct intel_digital_port *dig_port = enc_to_dig_port(&intel_encoder->base);
+
+				if (dig_port && dig_port->tc_delay_wa_needed &&
+				    !dig_port->dp.is_mst)
+					*hpd_tc_delay_wa |= (1 << intel_encoder->hpd_pin);
+			}
 		}
 	}
 	drm_connector_list_iter_end(&conn_iter);
@@ -382,7 +393,7 @@ static void i915_hotplug_work_func(struct work_struct *work)
 		container_of(work, struct drm_i915_private, hotplug.hotplug_work);
 	struct drm_device *dev = &dev_priv->drm;
 	bool changed;
-	u32 hpd_event_bits;
+	u32 hpd_event_bits, hpd_tc_delay_wa = 0;
 
 	mutex_lock(&dev->mode_config.mutex);
 	DRM_DEBUG_KMS("running encoder hotplug functions\n");
@@ -397,12 +408,28 @@ static void i915_hotplug_work_func(struct work_struct *work)
 
 	spin_unlock_irq(&dev_priv->irq_lock);
 
-	changed = i915_hotplug_iterate(dev, hpd_event_bits);
+	changed = i915_hotplug_iterate(dev, hpd_event_bits, &hpd_tc_delay_wa);
 
 	mutex_unlock(&dev->mode_config.mutex);
 
 	if (changed)
 		drm_kms_helper_hotplug_event(dev);
+
+	/*
+	 * Unpowered type-c dongles can take some time to boot and be
+	 * responsible, so here giving some type to those dongles to power up
+	 * and then probing again.
+	 */
+	if (hpd_tc_delay_wa) {
+		msleep(500);
+
+		mutex_lock(&dev->mode_config.mutex);
+		changed = i915_hotplug_iterate(dev, hpd_tc_delay_wa, NULL);
+		mutex_unlock(&dev->mode_config.mutex);
+
+		if (changed)
+			drm_kms_helper_hotplug_event(dev);
+	}
 }
 
 
Signature · 6 lines
2.20.1

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

✗ Fi.CI.CHECKPATCH: warning for series starting with [1/2] drm/i915/hotplug: Move iteration over connectors to other function

In reply to José Roberto de Souza
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915/hotplug: Move iteration over connectors to other function
URL : https://patchwork.freedesktop.org/series/56445/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
657dfb10e498 drm/i915/hotplug: Move iteration over connectors to other function
c6cc6b7ff347 drm/i915/icl: Probe again type-c connectors that failed
-:88: WARNING:LONG_LINE: line over 100 characters
#88: FILE: drivers/gpu/drm/i915/intel_hotplug.c:374:
+				struct intel_digital_port *dig_port = enc_to_dig_port(&intel_encoder->base);

total: 0 errors, 1 warnings, 0 checks, 92 lines checked

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

#3 lore raw

✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915/hotplug: Move iteration over connectors to other function

In reply to José Roberto de Souza
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915/hotplug: Move iteration over connectors to other function
URL : https://patchwork.freedesktop.org/series/56445/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5571 -> Patchwork_12186
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/56445/revisions/1/mbox/

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

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

### IGT changes ###

#### Issues hit ####

* igt@kms_busy@basic-flip-a:
- fi-gdg-551: PASS -> FAIL [fdo#103182]

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
- fi-skl-6700k2: PASS -> INCOMPLETE [fdo#104108]

#### Possible fixes ####

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

* igt@kms_pipe_crc_basic@read-crc-pipe-b:
- fi-byt-clapper: FAIL [fdo#107362] -> PASS +1

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

[fdo#103182]: https://bugs.freedesktop.org/show_bug.cgi?id=103182
[fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
[fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
[fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
[fdo#109226]: https://bugs.freedesktop.org/show_bug.cgi?id=109226
[fdo#109485]: https://bugs.freedesktop.org/show_bug.cgi?id=109485

Participating hosts (50 -> 42)
------------------------------

Missing (8): fi-kbl-soraka fi-ilk-m540 fi-bxt-dsi fi-byt-j1900 fi-hsw-peppy fi-byt-squawks fi-bsw-cyan fi-bdw-samus

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

* Linux: CI_DRM_5571 -> Patchwork_12186

CI_DRM_5571: dd61c93126a4c9eea6a6b2cc9d731dd77d92e0a2 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4815: 947301563259726b65ce47d3a3fe37931ed42efe @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_12186: c6cc6b7ff347c66ee085d8a8f196fbf2244f4333 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

c6cc6b7ff347 drm/i915/icl: Probe again type-c connectors that failed 657dfb10e498 drm/i915/hotplug: Move iteration over connectors to other function

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12186/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

✗ Fi.CI.IGT: failure for series starting with [1/2] drm/i915/hotplug: Move iteration over connectors to other function

In reply to José Roberto de Souza
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915/hotplug: Move iteration over connectors to other function
URL : https://patchwork.freedesktop.org/series/56445/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_5571_full -> Patchwork_12186_full
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_12186_full absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_12186_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

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

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

### IGT changes ###

#### Possible regressions ####

* igt@gem_eio@reset-stress:
- shard-snb: PASS -> FAIL

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_mmap_gtt@hang:
- shard-snb: PASS -> INCOMPLETE [fdo#105411]

* igt@kms_busy@extended-modeset-hang-newfb-render-b:
- shard-kbl: NOTRUN -> DMESG-WARN [fdo#107956]

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

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

* igt@kms_cursor_legacy@cursor-vs-flip-atomic:
- shard-hsw: PASS -> INCOMPLETE [fdo#103540]

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

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

* igt@kms_plane_alpha_blend@pipe-b-alpha-opaque-fb:
- shard-apl: PASS -> FAIL [fdo#108145]

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

* igt@kms_universal_plane@universal-plane-pipe-c-functional:
- shard-glk: PASS -> FAIL [fdo#103166] +1

#### Possible fixes ####

* igt@kms_cursor_crc@cursor-64x21-random:
- shard-apl: FAIL [fdo#103232] -> PASS +6

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

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

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

* igt@kms_plane@plane-position-covered-pipe-c-planes:
- shard-apl: FAIL [fdo#103166] -> PASS +2

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

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

* igt@kms_vblank@pipe-c-ts-continuation-suspend:
- shard-hsw: FAIL [fdo#104894] -> PASS

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

[fdo#103060]: https://bugs.freedesktop.org/show_bug.cgi?id=103060
[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
[fdo#104894]: https://bugs.freedesktop.org/show_bug.cgi?id=104894
[fdo#105411]: https://bugs.freedesktop.org/show_bug.cgi?id=105411
[fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912

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

Missing (2): shard-skl shard-iclb

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

* Linux: CI_DRM_5571 -> Patchwork_12186

CI_DRM_5571: dd61c93126a4c9eea6a6b2cc9d731dd77d92e0a2 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4815: 947301563259726b65ce47d3a3fe37931ed42efe @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_12186: c6cc6b7ff347c66ee085d8a8f196fbf2244f4333 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12186/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx