All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t v3] tests/chamelium: Add common suspend and hibernate tests for DP and HDMI
@ 2017-06-19  9:39 Paul Kocialkowski
  2017-06-19 18:31 ` Lyude Paul
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Kocialkowski @ 2017-06-19  9:39 UTC (permalink / raw)
  To: intel-gfx; +Cc: Lyude

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.

The generic hpd suspend/resume test code is split in a dedicated
function, that allow testing one or all possible ports.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com>
---
 tests/chamelium.c | 118 +++++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 100 insertions(+), 18 deletions(-)

diff --git a/tests/chamelium.c b/tests/chamelium.c
index 76b14e95..3cf9f3b5 100644
--- a/tests/chamelium.c
+++ b/tests/chamelium.c
@@ -143,8 +143,18 @@ wait_for_connector(data_t *data, struct chamelium_port *port,
 static void
 reset_state(data_t *data, struct chamelium_port *port)
 {
+	int p;
+
 	chamelium_reset(data->chamelium);
-	wait_for_connector(data, port, DRM_MODE_DISCONNECTED);
+
+	if (port) {
+		wait_for_connector(data, port, DRM_MODE_DISCONNECTED);
+	} else {
+		for (p = 0; p < data->port_count; p++) {
+			port = data->ports[p];
+			wait_for_connector(data, port, DRM_MODE_DISCONNECTED);
+		}
+	}
 }
 
 static void
@@ -206,36 +216,96 @@ test_edid_read(data_t *data, struct chamelium_port *port,
 }
 
 static void
-test_suspend_resume_hpd(data_t *data, struct chamelium_port *port,
-			enum igt_suspend_state state,
-			enum igt_suspend_test test)
+try_suspend_resume_hpd(data_t *data, struct chamelium_port *port,
+		       enum igt_suspend_state state, enum igt_suspend_test test,
+		       struct udev_monitor *mon, bool connected)
 {
-	struct udev_monitor *mon = igt_watch_hotplug();
-
-	reset_state(data, port);
+	int p;
 
 	igt_set_autoresume_delay(SUSPEND_RESUME_DELAY);
 	igt_flush_hotplugs(mon);
 
-	/* Make sure we notice new connectors after resuming */
-	chamelium_async_hpd_pulse_start(data->chamelium, port, false,
-					SUSPEND_RESUME_DELAY / 2);
+	if (port) {
+		chamelium_async_hpd_pulse_start(data->chamelium, port,
+						connected,
+						SUSPEND_RESUME_DELAY / 2);
+	} else {
+		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,
+							connected,
+							SUSPEND_RESUME_DELAY / 2);
+		}
+
+		port = NULL;
+	}
+
 	igt_system_suspend_autoresume(state, test);
 	chamelium_async_hpd_pulse_finish(data->chamelium);
 
 	igt_assert(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT));
-	igt_assert_eq(reprobe_connector(data, port), DRM_MODE_CONNECTED);
+	if (port) {
+		igt_assert_eq(reprobe_connector(data, port), connected ?
+			      DRM_MODE_DISCONNECTED : DRM_MODE_CONNECTED);
+	} else {
+		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), connected ?
+				      DRM_MODE_DISCONNECTED :
+				      DRM_MODE_CONNECTED);
+		}
 
-	igt_flush_hotplugs(mon);
+		port = NULL;
+	}
+}
+
+static void
+test_suspend_resume_hpd(data_t *data, struct chamelium_port *port,
+			enum igt_suspend_state state,
+			enum igt_suspend_test test)
+{
+	struct udev_monitor *mon = igt_watch_hotplug();
+
+	reset_state(data, port);
+
+	/* Make sure we notice new connectors after resuming */
+	try_suspend_resume_hpd(data, port, state, test, mon, false);
 
 	/* Now make sure we notice disconnected connectors after resuming */
-	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);
+	try_suspend_resume_hpd(data, port, state, test, mon, true);
 
-	igt_assert(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT));
-	igt_assert_eq(reprobe_connector(data, port), DRM_MODE_DISCONNECTED);
+	igt_cleanup_hotplug(mon);
+}
+
+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;
+
+		igt_debug("Testing port %s\n", chamelium_port_get_name(port));
+	}
+
+	reset_state(data, NULL);
+
+	/* Make sure we notice new connectors after resuming */
+	try_suspend_resume_hpd(data, NULL, state, test, mon, false);
+
+	/* Now make sure we notice disconnected connectors after resuming */
+	try_suspend_resume_hpd(data, NULL, state, test, mon, true);
 
 	igt_cleanup_hotplug(mon);
 }
@@ -750,6 +820,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);
 	}
-- 
2.13.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH i-g-t v3] tests/chamelium: Add common suspend and hibernate tests for DP and HDMI
  2017-06-19  9:39 [PATCH i-g-t v3] tests/chamelium: Add common suspend and hibernate tests for DP and HDMI Paul Kocialkowski
@ 2017-06-19 18:31 ` Lyude Paul
  0 siblings, 0 replies; 2+ messages in thread
From: Lyude Paul @ 2017-06-19 18:31 UTC (permalink / raw)
  To: Paul Kocialkowski, intel-gfx

On Mon, 2017-06-19 at 12:39 +0300, Paul Kocialkowski wrote:
> 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.
> 
> The generic hpd suspend/resume test code is split in a dedicated
> function, that allow testing one or all possible ports.
> 
> Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>

Will push to git in just a little bit, thanks!

> ---
>  tests/chamelium.c | 118
> +++++++++++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 100 insertions(+), 18 deletions(-)
> 
> diff --git a/tests/chamelium.c b/tests/chamelium.c
> index 76b14e95..3cf9f3b5 100644
> --- a/tests/chamelium.c
> +++ b/tests/chamelium.c
> @@ -143,8 +143,18 @@ wait_for_connector(data_t *data, struct
> chamelium_port *port,
>  static void
>  reset_state(data_t *data, struct chamelium_port *port)
>  {
> +	int p;
> +
>  	chamelium_reset(data->chamelium);
> -	wait_for_connector(data, port, DRM_MODE_DISCONNECTED);
> +
> +	if (port) {
> +		wait_for_connector(data, port,
> DRM_MODE_DISCONNECTED);
> +	} else {
> +		for (p = 0; p < data->port_count; p++) {
> +			port = data->ports[p];
> +			wait_for_connector(data, port,
> DRM_MODE_DISCONNECTED);
> +		}
> +	}
>  }
>  
>  static void
> @@ -206,36 +216,96 @@ test_edid_read(data_t *data, struct
> chamelium_port *port,
>  }
>  
>  static void
> -test_suspend_resume_hpd(data_t *data, struct chamelium_port *port,
> -			enum igt_suspend_state state,
> -			enum igt_suspend_test test)
> +try_suspend_resume_hpd(data_t *data, struct chamelium_port *port,
> +		       enum igt_suspend_state state, enum
> igt_suspend_test test,
> +		       struct udev_monitor *mon, bool connected)
>  {
> -	struct udev_monitor *mon = igt_watch_hotplug();
> -
> -	reset_state(data, port);
> +	int p;
>  
>  	igt_set_autoresume_delay(SUSPEND_RESUME_DELAY);
>  	igt_flush_hotplugs(mon);
>  
> -	/* Make sure we notice new connectors after resuming */
> -	chamelium_async_hpd_pulse_start(data->chamelium, port,
> false,
> -					SUSPEND_RESUME_DELAY / 2);
> +	if (port) {
> +		chamelium_async_hpd_pulse_start(data->chamelium,
> port,
> +						connected,
> +						SUSPEND_RESUME_DELAY
> / 2);
> +	} else {
> +		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,
> +							connected,
> +							SUSPEND_RESU
> ME_DELAY / 2);
> +		}
> +
> +		port = NULL;
> +	}
> +
>  	igt_system_suspend_autoresume(state, test);
>  	chamelium_async_hpd_pulse_finish(data->chamelium);
>  
>  	igt_assert(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT));
> -	igt_assert_eq(reprobe_connector(data, port),
> DRM_MODE_CONNECTED);
> +	if (port) {
> +		igt_assert_eq(reprobe_connector(data, port),
> connected ?
> +			      DRM_MODE_DISCONNECTED :
> DRM_MODE_CONNECTED);
> +	} else {
> +		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),
> connected ?
> +				      DRM_MODE_DISCONNECTED :
> +				      DRM_MODE_CONNECTED);
> +		}
>  
> -	igt_flush_hotplugs(mon);
> +		port = NULL;
> +	}
> +}
> +
> +static void
> +test_suspend_resume_hpd(data_t *data, struct chamelium_port *port,
> +			enum igt_suspend_state state,
> +			enum igt_suspend_test test)
> +{
> +	struct udev_monitor *mon = igt_watch_hotplug();
> +
> +	reset_state(data, port);
> +
> +	/* Make sure we notice new connectors after resuming */
> +	try_suspend_resume_hpd(data, port, state, test, mon, false);
>  
>  	/* Now make sure we notice disconnected connectors after
> resuming */
> -	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);
> +	try_suspend_resume_hpd(data, port, state, test, mon, true);
>  
> -	igt_assert(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT));
> -	igt_assert_eq(reprobe_connector(data, port),
> DRM_MODE_DISCONNECTED);
> +	igt_cleanup_hotplug(mon);
> +}
> +
> +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;
> +
> +		igt_debug("Testing port %s\n",
> chamelium_port_get_name(port));
> +	}
> +
> +	reset_state(data, NULL);
> +
> +	/* Make sure we notice new connectors after resuming */
> +	try_suspend_resume_hpd(data, NULL, state, test, mon, false);
> +
> +	/* Now make sure we notice disconnected connectors after
> resuming */
> +	try_suspend_resume_hpd(data, NULL, state, test, mon, true);
>  
>  	igt_cleanup_hotplug(mon);
>  }
> @@ -750,6 +820,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);
>  	}
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-19 18:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-19  9:39 [PATCH i-g-t v3] tests/chamelium: Add common suspend and hibernate tests for DP and HDMI Paul Kocialkowski
2017-06-19 18:31 ` Lyude Paul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.