intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Paul Kocialkowski <paul.kocialkowski@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Lyude <lyude@redhat.com>
Subject: [PATCH i-g-t 1/7] tests/chamelium: Update connector state without reprobe when possible
Date: Mon, 26 Jun 2017 16:59:00 +0300	[thread overview]
Message-ID: <20170626135906.32708-1-paul.kocialkowski@linux.intel.com> (raw)

This renames the reprobe_connector function to update_connector and
ensures that full reprobe of the connector is only done when really
necessary (e.g. when changing the EDID).

A full reprobe takes time and is not required for updating the connector
state. Thus, this allows executing tests faster.

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

diff --git a/tests/chamelium.c b/tests/chamelium.c
index b7eaa2fa..e1f21fb8 100644
--- a/tests/chamelium.c
+++ b/tests/chamelium.c
@@ -100,13 +100,14 @@ require_connector_present(data_t *data, unsigned int type)
 }
 
 static drmModeConnection
-reprobe_connector(data_t *data, struct chamelium_port *port)
+update_connector(data_t *data, struct chamelium_port *port, bool reprobe)
 {
 	drmModeConnector *connector;
 	drmModeConnection status;
 
-	igt_debug("Reprobing %s...\n", chamelium_port_get_name(port));
-	connector = chamelium_port_get_connector(data->chamelium, port, true);
+	igt_debug("Updating %s...\n", chamelium_port_get_name(port));
+	connector = chamelium_port_get_connector(data->chamelium, port,
+						 reprobe);
 	igt_assert(connector);
 	status = connector->connection;
 
@@ -116,7 +117,7 @@ reprobe_connector(data_t *data, struct chamelium_port *port)
 
 static void
 wait_for_connector(data_t *data, struct chamelium_port *port,
-		   drmModeConnection status)
+		   drmModeConnection status, bool reprobe)
 {
 	bool finished = false;
 
@@ -129,7 +130,7 @@ wait_for_connector(data_t *data, struct chamelium_port *port,
 	 * that hpd events work in the event that hpd doesn't work on the system
 	 */
 	igt_until_timeout(HOTPLUG_TIMEOUT) {
-		if (reprobe_connector(data, port) == status) {
+		if (update_connector(data, port, reprobe) == status) {
 			finished = true;
 			return;
 		}
@@ -148,11 +149,12 @@ reset_state(data_t *data, struct chamelium_port *port)
 	chamelium_reset(data->chamelium);
 
 	if (port) {
-		wait_for_connector(data, port, DRM_MODE_DISCONNECTED);
+		wait_for_connector(data, port, DRM_MODE_DISCONNECTED, false);
 	} else {
 		for (p = 0; p < data->port_count; p++) {
 			port = data->ports[p];
-			wait_for_connector(data, port, DRM_MODE_DISCONNECTED);
+			wait_for_connector(data, port, DRM_MODE_DISCONNECTED,
+					   false);
 		}
 	}
 }
@@ -172,7 +174,7 @@ test_basic_hotplug(data_t *data, struct chamelium_port *port)
 		/* Check if we get a sysfs hotplug event */
 		chamelium_plug(data->chamelium, port);
 		igt_assert(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT));
-		igt_assert_eq(reprobe_connector(data, port),
+		igt_assert_eq(update_connector(data, port, false),
 			      DRM_MODE_CONNECTED);
 
 		igt_flush_hotplugs(mon);
@@ -180,7 +182,7 @@ test_basic_hotplug(data_t *data, struct chamelium_port *port)
 		/* Now check if we get a hotplug from disconnection */
 		chamelium_unplug(data->chamelium, port);
 		igt_assert(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT));
-		igt_assert_eq(reprobe_connector(data, port),
+		igt_assert_eq(update_connector(data, port, false),
 			      DRM_MODE_DISCONNECTED);
 	}
 
@@ -201,7 +203,7 @@ test_edid_read(data_t *data, struct chamelium_port *port,
 
 	chamelium_port_set_edid(data->chamelium, port, edid_id);
 	chamelium_plug(data->chamelium, port);
-	wait_for_connector(data, port, DRM_MODE_CONNECTED);
+	wait_for_connector(data, port, DRM_MODE_CONNECTED, true);
 
 	igt_assert(kmstest_get_property(data->drm_fd, connector->connector_id,
 					DRM_MODE_OBJECT_CONNECTOR, "EDID", NULL,
@@ -244,13 +246,13 @@ try_suspend_resume_hpd(data_t *data, struct chamelium_port *port,
 
 	igt_assert(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT));
 	if (port) {
-		igt_assert_eq(reprobe_connector(data, port), connected ?
+		igt_assert_eq(update_connector(data, port, false), connected ?
 			      DRM_MODE_DISCONNECTED : DRM_MODE_CONNECTED);
 	} else {
 		for (p = 0; p < data->port_count; p++) {
 			port = data->ports[p];
-			igt_assert_eq(reprobe_connector(data, port), connected ?
-				      DRM_MODE_DISCONNECTED :
+			igt_assert_eq(update_connector(data, port, false),
+				      connected ? DRM_MODE_DISCONNECTED :
 				      DRM_MODE_CONNECTED);
 		}
 
@@ -314,7 +316,7 @@ test_suspend_resume_edid_change(data_t *data, struct chamelium_port *port,
 	/* First plug in the port */
 	chamelium_port_set_edid(data->chamelium, port, edid_id);
 	chamelium_plug(data->chamelium, port);
-	wait_for_connector(data, port, DRM_MODE_CONNECTED);
+	wait_for_connector(data, port, DRM_MODE_CONNECTED, true);
 
 	igt_flush_hotplugs(mon);
 
@@ -349,7 +351,7 @@ prepare_output(data_t *data,
 	chamelium_port_set_edid(data->chamelium, port, data->edid_id);
 
 	chamelium_plug(data->chamelium, port);
-	wait_for_connector(data, port, DRM_MODE_CONNECTED);
+	wait_for_connector(data, port, DRM_MODE_CONNECTED, true);
 
 	igt_display_init(display, data->drm_fd);
 	output = igt_output_from_connector(display, connector);
@@ -587,7 +589,7 @@ test_hpd_without_ddc(data_t *data, struct chamelium_port *port)
 	chamelium_plug(data->chamelium, port);
 
 	igt_assert(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT));
-	igt_assert_eq(reprobe_connector(data, port), DRM_MODE_CONNECTED);
+	igt_assert_eq(update_connector(data, port, false), DRM_MODE_CONNECTED);
 
 	igt_cleanup_hotplug(mon);
 }
-- 
2.13.1

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

             reply	other threads:[~2017-06-26 14:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-26 13:59 Paul Kocialkowski [this message]
2017-06-26 13:59 ` [PATCH i-g-t 2/7] tests/chamelium: Check all connectors state for basic hotplug Paul Kocialkowski
2017-06-26 21:35   ` Lyude Paul
2017-06-26 13:59 ` [PATCH i-g-t 3/7] tests/chamelium: Use 50 ms delay to wait for connector change Paul Kocialkowski
2017-06-26 21:36   ` Lyude Paul
2017-06-26 13:59 ` [PATCH i-g-t 4/7] lib/igt_chamelium: Add support for configurable DUT suspend/resume delay Paul Kocialkowski
2017-06-26 14:25   ` Martin Peres
2017-06-26 14:33     ` Paul Kocialkowski
2017-06-26 15:15       ` Martin Peres
2017-06-26 21:14         ` Lyude Paul
2017-06-27  7:33         ` Paul Kocialkowski
2017-06-27  7:45           ` Paul Kocialkowski
2017-06-27 10:16             ` Paul Kocialkowski
2017-06-26 13:59 ` [PATCH i-g-t 5/7] tests/chamelium: Use " Paul Kocialkowski
2017-06-26 13:59 ` [PATCH i-g-t 6/7] tests/chamelium: Reduce the simple hotplug test toggle count for VGA Paul Kocialkowski
2017-06-26 13:59 ` [PATCH i-g-t 7/7] tests/chamelium: Disconnect connectors without extra reset Paul Kocialkowski
2017-06-26 22:17   ` Lyude Paul
2017-06-27  7:22     ` Paul Kocialkowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170626135906.32708-1-paul.kocialkowski@linux.intel.com \
    --to=paul.kocialkowski@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=lyude@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).