Skip to contentSkip to conversation

tests/chamelium: Add common suspend and hibernate tests for DP and HDMI

PATCH Superseded Paul Kocialkowski 2 participants 3 messages Jun 16, 2017 – Jun 19, 2017

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tests/chamelium: Add common suspend and hibernate tests for DP and HDMI

This adds two new tests: common-hpd-after-suspend and common-hpd-after-hibernate that are aimed at testing HPD change during suspend/hibernate for both DP and HDMI, at the same time.

The interest in bringing this test up is to reduce the time spent in testing, with the downside of less precision regarding the test's outcome. The per-connector tests are still available to get a more precise idea of which connector causes a failure, when that happens.

VGA is explicitly excluded from this test as there is currently no way of doing delayed hpd pulses for it.

---
 tests/chamelium.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)
tests/chamelium.c +86 -0
index 76b14e95..d569c8ee 100644
@@ -241,6 +241,80 @@ test_suspend_resume_hpd(data_t *data, struct chamelium_port *port,
 }
 
 static void
+test_suspend_resume_hpd_common(data_t *data, enum igt_suspend_state state,
+			       enum igt_suspend_test test)
+{
+	struct udev_monitor *mon = igt_watch_hotplug();
+	struct chamelium_port *port;
+	int p;
+
+	for (p = 0; p < data->port_count; p++) {
+		port = data->ports[p];
+		if (chamelium_port_get_type(port) == DRM_MODE_CONNECTOR_VGA)
+			continue;
+
+		reset_state(data, port);
+
+		igt_debug("Testing port %s\n", chamelium_port_get_name(port));
+	}
+
+	igt_set_autoresume_delay(SUSPEND_RESUME_DELAY);
+	igt_flush_hotplugs(mon);
+
+	/* Make sure we notice new connectors after resuming */
+	for (p = 0; p < data->port_count; p++) {
+		port = data->ports[p];
+		if (chamelium_port_get_type(port) == DRM_MODE_CONNECTOR_VGA)
+			continue;
+
+		chamelium_async_hpd_pulse_start(data->chamelium, port, false,
+						SUSPEND_RESUME_DELAY / 2);
+	}
+
+	igt_system_suspend_autoresume(state, test);
+	chamelium_async_hpd_pulse_finish(data->chamelium);
+
+	igt_assert(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT));
+
+	for (p = 0; p < data->port_count; p++) {
+		port = data->ports[p];
+		if (chamelium_port_get_type(port) == DRM_MODE_CONNECTOR_VGA)
+			continue;
+
+		igt_assert_eq(reprobe_connector(data, port),
+			      DRM_MODE_CONNECTED);
+	}
+
+	igt_flush_hotplugs(mon);
+
+	/* Now make sure we notice disconnected connectors after resuming */
+	for (p = 0; p < data->port_count; p++) {
+		port = data->ports[p];
+		if (chamelium_port_get_type(port) == DRM_MODE_CONNECTOR_VGA)
+			continue;
+
+		chamelium_async_hpd_pulse_start(data->chamelium, port, true,
+						SUSPEND_RESUME_DELAY / 2);
+	}
+
+	igt_system_suspend_autoresume(state, test);
+	chamelium_async_hpd_pulse_finish(data->chamelium);
+
+	igt_assert(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT));
+
+	for (p = 0; p < data->port_count; p++) {
+		port = data->ports[p];
+		if (chamelium_port_get_type(port) == DRM_MODE_CONNECTOR_VGA)
+			continue;
+
+		igt_assert_eq(reprobe_connector(data, port),
+			      DRM_MODE_DISCONNECTED);
+	}
+
+	igt_cleanup_hotplug(mon);
+}
+
+static void
 test_suspend_resume_edid_change(data_t *data, struct chamelium_port *port,
 				enum igt_suspend_state state,
 				enum igt_suspend_test test,
@@ -750,6 +824,18 @@ igt_main
 			test_hpd_without_ddc(&data, port);
 	}
 
+	igt_subtest_group {
+		igt_subtest("common-hpd-after-suspend")
+			test_suspend_resume_hpd_common(&data,
+						       SUSPEND_STATE_MEM,
+						       SUSPEND_TEST_NONE);
+
+		igt_subtest("common-hpd-after-hibernate")
+			test_suspend_resume_hpd_common(&data,
+						       SUSPEND_STATE_DISK,
+						       SUSPEND_TEST_DEVICES);
+	}
+
 	igt_fixture {
 		close(data.drm_fd);
 	}
Signature · 6 lines
2.13.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 1/1
#1 lore raw
Quoted 89 lines · Paul Kocialkowski

This adds two new tests: common-hpd-after-suspend and common-hpd-after-hibernate that are aimed at testing HPD change during suspend/hibernate for both DP and HDMI, at the same time.

The interest in bringing this test up is to reduce the time spent in testing, with the downside of less precision regarding the test's outcome. The per-connector tests are still available to get a more precise idea of which connector causes a failure, when that happens.

VGA is explicitly excluded from this test as there is currently no way of doing delayed hpd pulses for it.

Quoted 1 line

---
 tests/chamelium.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++

 1 file changed, 86 insertions(+)
tests/chamelium.c +0 -0
index 76b14e95..d569c8ee 100644
@@ -241,6 +241,80 @@ test_suspend_resume_hpd(data_t *data, struct chamelium_port *port,
  }


 static void

tests/chamelium.c +64 -0
+test_suspend_resume_hpd_common(data_t *data, enum igt_suspend_state state,
+			       enum igt_suspend_test test)
+{
+	struct udev_monitor *mon = igt_watch_hotplug();
+	struct chamelium_port *port;
+	int p;
+
+	for (p = 0; p < data->port_count; p++) {
+		port = data->ports[p];
+		if (chamelium_port_get_type(port) == DRM_MODE_CONNECTOR_VGA)
+			continue;
+
+		reset_state(data, port);
+
+		igt_debug("Testing port %s\n", chamelium_port_get_name(port));
+	}
+
+	igt_set_autoresume_delay(SUSPEND_RESUME_DELAY);
+	igt_flush_hotplugs(mon);
+
+	/* Make sure we notice new connectors after resuming */
+	for (p = 0; p < data->port_count; p++) {
+		port = data->ports[p];
+		if (chamelium_port_get_type(port) == DRM_MODE_CONNECTOR_VGA)
+			continue;
+
+		chamelium_async_hpd_pulse_start(data->chamelium, port, false,
+						SUSPEND_RESUME_DELAY / 2);
+	}
+
+	igt_system_suspend_autoresume(state, test);
+	chamelium_async_hpd_pulse_finish(data->chamelium);
+
+	igt_assert(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT));
+
+	for (p = 0; p < data->port_count; p++) {
+		port = data->ports[p];
+		if (chamelium_port_get_type(port) == DRM_MODE_CONNECTOR_VGA)
+			continue;
+
+		igt_assert_eq(reprobe_connector(data, port),
+			      DRM_MODE_CONNECTED);
+	}
+
+	igt_flush_hotplugs(mon);
+
+	/* Now make sure we notice disconnected connectors after resuming */
+	for (p = 0; p < data->port_count; p++) {
+		port = data->ports[p];
+		if (chamelium_port_get_type(port) == DRM_MODE_CONNECTOR_VGA)
+			continue;
+
+		chamelium_async_hpd_pulse_start(data->chamelium, port, true,
+						SUSPEND_RESUME_DELAY / 2);
+	}
+
+	igt_system_suspend_autoresume(state, test);
+	chamelium_async_hpd_pulse_finish(data->chamelium);
+
+	igt_assert(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT));
+
+	for (p = 0; p < data->port_count; p++) {
+		port = data->ports[p];
+		if (chamelium_port_get_type(port) == DRM_MODE_CONNECTOR_VGA)

tests/chamelium.c test_suspend_resume_hpd(data_t *data, struct chamelium_port *port, · line 317

Quoted 10 lines
tests/chamelium.c +10 -0
+			continue;
+
+		igt_assert_eq(reprobe_connector(data, port),
+			      DRM_MODE_DISCONNECTED);
+	}
+
+	igt_cleanup_hotplug(mon);
+}
+
+static void

For smaller bits of code this isn't a big deal since we're talking about tests here, but this is a lot of code to have for a single function like this. Mind splitting this into something like (feel free to take some liberty with the function naming)

test_suspend_resume_hpd(data_t *data, enum igt_suspend_state state, enum igt_suspend_test test)
→ try_suspend_resume_hpd(data_t *data, enum igt_suspend_state state, enum igt_suspend_test test, bool connected)

Other then that, looks good. With the changes mentioned:

Quoted 22 lines

 test_suspend_resume_edid_change(data_t *data, struct chamelium_port *port, enum igt_suspend_state state, enum igt_suspend_test test,

tests/chamelium.c +0 -0
@@ -750,6 +824,18 @@ igt_main
  			test_hpd_without_ddc(&data, port);
  	}

tests/chamelium.c +12 -0
+	igt_subtest_group {
+		igt_subtest("common-hpd-after-suspend")
+			test_suspend_resume_hpd_common(&data,
+						       SUSPEND_STATE_MEM,
+						       SUSPEND_TEST_NONE);
+
+		igt_subtest("common-hpd-after-hibernate")
+			test_suspend_resume_hpd_common(&data,
+						       SUSPEND_STATE_DISK,
+						       SUSPEND_TEST_DEVICES);
+	}
+

  igt_fixture {
  close(data.drm_fd);
  }

Signature · 6 lines
Cheers,
	Lyude
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Hi,

Quoted 109 lines · Lyude Paul
Quoted 108 lines · Paul Kocialkowski

This adds two new tests: common-hpd-after-suspend and common-hpd-after-hibernate that are aimed at testing HPD change during suspend/hibernate for both DP and HDMI, at the same time.

The interest in bringing this test up is to reduce the time spent in testing, with the downside of less precision regarding the test's outcome. The per-connector tests are still available to get a more precise idea of which connector causes a failure, when that happens.

VGA is explicitly excluded from this test as there is currently no way of doing delayed hpd pulses for it.

Quoted 1 line
---
 tests/chamelium.c | 86
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)
tests/chamelium.c +24 -0
index 76b14e95..d569c8ee 100644
@@ -241,6 +241,80 @@ test_suspend_resume_hpd(data_t *data, struct
 chamelium_port *port,
 }
 
 static void
+test_suspend_resume_hpd_common(data_t *data, enum igt_suspend_state state,
+			       enum igt_suspend_test test)
+{
+	struct udev_monitor *mon = igt_watch_hotplug();
+	struct chamelium_port *port;
+	int p;
+
+	for (p = 0; p < data->port_count; p++) {
+		port = data->ports[p];
+		if (chamelium_port_get_type(port) ==
 DRM_MODE_CONNECTOR_VGA)
+			continue;
+
+		reset_state(data, port);
+
+		igt_debug("Testing port %s\n",
 chamelium_port_get_name(port));
+	}
+
+	igt_set_autoresume_delay(SUSPEND_RESUME_DELAY);
+	igt_flush_hotplugs(mon);
+
+	/* Make sure we notice new connectors after resuming */
+	for (p = 0; p < data->port_count; p++) {
+		port = data->ports[p];
+		if (chamelium_port_get_type(port) ==

DRM_MODE_CONNECTOR_VGA)

tests/chamelium.c +3 -0
+			continue;
+
+		chamelium_async_hpd_pulse_start(data->chamelium, port,

false,

tests/chamelium.c +11 -0
+						SUSPEND_RESUME_DELAY / 2);
+	}
+
+	igt_system_suspend_autoresume(state, test);
+	chamelium_async_hpd_pulse_finish(data->chamelium);
+
+	igt_assert(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT));
+
+	for (p = 0; p < data->port_count; p++) {
+		port = data->ports[p];
+		if (chamelium_port_get_type(port) ==

DRM_MODE_CONNECTOR_VGA)

tests/chamelium.c +9 -0
+			continue;
+
+		igt_assert_eq(reprobe_connector(data, port),
+			      DRM_MODE_CONNECTED);
+	}
+
+	igt_flush_hotplugs(mon);
+
+	/* Now make sure we notice disconnected connectors after resuming

*/

tests/chamelium.c +3 -0
+	for (p = 0; p < data->port_count; p++) {
+		port = data->ports[p];
+		if (chamelium_port_get_type(port) ==

DRM_MODE_CONNECTOR_VGA)

tests/chamelium.c +3 -0
+			continue;
+
+		chamelium_async_hpd_pulse_start(data->chamelium, port,

true,

tests/chamelium.c +11 -0
+						SUSPEND_RESUME_DELAY / 2);
+	}
+
+	igt_system_suspend_autoresume(state, test);
+	chamelium_async_hpd_pulse_finish(data->chamelium);
+
+	igt_assert(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT));
+
+	for (p = 0; p < data->port_count; p++) {
+		port = data->ports[p];
+		if (chamelium_port_get_type(port) ==

DRM_MODE_CONNECTOR_VGA)

tests/chamelium.c +7 -0
+			continue;
+
+		igt_assert_eq(reprobe_connector(data, port),
+			      DRM_MODE_DISCONNECTED);
+	}
+
+	igt_cleanup_hotplug(mon);
Quoted 8 lines

tests/chamelium.c test_suspend_resume_hpd(data_t *data, struct chamelium_port *port, · line 317

Quoted 3 lines
tests/chamelium.c +3 -0
+}
+
+static void

For smaller bits of code this isn't a big deal since we're talking about tests here, but this is a lot of code to have for a single function like this. Mind splitting this into something like (feel free to take some liberty with the function naming)

That is quite right, this is indeed starting to look too big. Thanks for pointing it out. I'll send v2 with a dedicated function as suggested.

Quoted 32 lines

test_suspend_resume_hpd(data_t *data, enum igt_suspend_state state, enum igt_suspend_test test)
→ try_suspend_resume_hpd(data_t *data, enum igt_suspend_state state, enum
igt_suspend_test test, bool connected)

Other then that, looks good. With the changes mentioned:

Quoted 23 lines

test_suspend_resume_edid_change(data_t *data, struct chamelium_port *port,

tests/chamelium.c +12 -0
 				enum igt_suspend_state state,
 				enum igt_suspend_test test,
@@ -750,6 +824,18 @@ igt_main
 			test_hpd_without_ddc(&data, port);
 	}
 
+	igt_subtest_group {
+		igt_subtest("common-hpd-after-suspend")
+			test_suspend_resume_hpd_common(&data,
+						       SUSPEND_STATE_MEM,
+						       SUSPEND_TEST_NONE);
+
+		igt_subtest("common-hpd-after-hibernate")
+			test_suspend_resume_hpd_common(&data,
+						       SUSPEND_STATE_DISK,
+						       SUSPEND_TEST_DEVICES
 );
+	}
+
 	igt_fixture {
 		close(data.drm_fd);

}

Signature · 6 lines
Paul Kocialkowski <[email protected]>
Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx