[igt-dev] [PATCH i-g-t v2 4/4] test/chamelium: Add HDMI slow unplug workaround
José Roberto de Souza
jose.souza at intel.com
Fri Jun 28 21:40:09 UTC 2019
HDMI specification states that the HPD should be shorter then the
other pins, so slowing unpluging will cause a HPD interruption that
can be processed before the other pins lose contact, so kernel will
be able to read the data lines and will keep the connector as
connected.
A workaround was added in kernel to retry the hotplug detection in
case we detect a hotplug and there is not change in the connector
state, so lets add a test to simulate that issue using chamelium.
Cc: Imre Deak <imre.deak at intel.com>
Signed-off-by: José Roberto de Souza <jose.souza at intel.com>
---
tests/kms_chamelium.c | 56 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
index 213686bf..0e680be2 100644
--- a/tests/kms_chamelium.c
+++ b/tests/kms_chamelium.c
@@ -308,6 +308,59 @@ test_fast_hotplug_handling(data_t *data, struct chamelium_port *port,
igt_require(status == DRM_MODE_DISCONNECTED);
}
+static void
+test_slow_hdmi_unplug_wa(data_t *data, struct chamelium_port *port)
+{
+ struct udev_monitor *mon = igt_watch_hotplug();
+ drmModeConnection status;
+
+ /*
+ * From gen11+ we check the HPD pin state in HDMI probe detection, if
+ * disconnected it gives up as set connector as disconnected without
+ * trying to read the data lines, so this WA is not needed for gen11+.
+ */
+ igt_require(intel_gen(intel_get_drm_devid(data->drm_fd)) < 11);
+
+ /* Reset will unplug all connectors */
+ reset_state(data, NULL);
+
+ /* Check if it device can act on hotplugs fast enough for this test */
+ test_fast_hotplug_handling(data, port, mon);
+
+ /* It is fast enough, lets plug the port again */
+ igt_flush_hotplugs(mon);
+ chamelium_plug(data->chamelium, port);
+ igt_assert(igt_hotplug_detected(mon, FAST_HOTPLUG_TIMEOUT));
+ status = connector_status_get(data, port);
+ igt_assert(status == DRM_MODE_CONNECTED);
+
+ /*
+ * Now lets just unplug the HPD, leaving DDC and EDID available so
+ * kernel will keep the connector as connected
+ */
+ igt_flush_hotplugs(mon);
+ chamelium_unplug_hpd(data->chamelium, port);
+ /* Going from connected to connected is fast */
+ igt_hotplug_detected(mon, FAST_HOTPLUG_TIMEOUT / 2);
+ status = connector_status_get(data, port);
+ igt_assert(status == DRM_MODE_CONNECTED);
+
+ /*
+ * Now disconnected DDC, the kernel workaround should reprobe and
+ * change connector status do disconnected.
+ */
+ chamelium_port_set_ddc_state(data->chamelium, port, false);
+
+ /*
+ * A bigger timeout is needed here because kernel will take at least
+ * 256msec~640msec to go from connected to disconnected(see comment in
+ * test_late_aux_wa to more information) + 1 sec to run the workaround
+ */
+ igt_assert(igt_hotplug_detected(mon, FAST_HOTPLUG_TIMEOUT * 2));
+ status = connector_status_get(data, port);
+ igt_assert(status == DRM_MODE_DISCONNECTED);
+}
+
/*
* Test kernel workaround for sinks that takes some time to have the DDC/aux
* channel responsive after the hotplug
@@ -2433,6 +2486,9 @@ igt_main
connector_subtest("hdmi-audio-edid", HDMIA)
test_display_audio_edid(&data, port,
TEST_EDID_HDMI_AUDIO);
+
+ connector_subtest("hdmi-slow-unplug-wa", HDMIA)
+ test_slow_hdmi_unplug_wa(&data, port);
}
igt_subtest_group {
--
2.22.0
More information about the igt-dev
mailing list