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 4/7] lib/igt_chamelium: Add support for configurable DUT suspend/resume delay
Date: Mon, 26 Jun 2017 16:59:03 +0300	[thread overview]
Message-ID: <20170626135906.32708-4-paul.kocialkowski@linux.intel.com> (raw)
In-Reply-To: <20170626135906.32708-1-paul.kocialkowski@linux.intel.com>

This adds support for reading a SuspendResumeDelay property (under
[DUT]) in the IGT configuration (igtrc) and exposing it through a
chamelium_get_suspend_resume_delay function.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com>
---
 lib/igt_chamelium.c | 31 ++++++++++++++++++++++++++++++-
 lib/igt_chamelium.h |  1 +
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index 225f98c3..a1aaf405 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -58,7 +58,7 @@
  *	[Chamelium]
  *	URL=http://chameleon:9992 # The URL used for connecting to the Chamelium's RPC server
  *
- *	# The rest of the sections are used for defining connector mappings.
+ *	# The following sections are used for defining connector mappings.
  *	# This is required so any tests using the Chamelium know which connector
  *	# on the test machine should be connected to each Chamelium port.
  *	#
@@ -70,12 +70,19 @@
  *
  *	[Chamelium:HDMI-A-1]
  *	ChameliumPortID=3
+ *
+ *	# The following section is used for configuring the Device Under Test.
+ *	# It is not mandatory and allows overriding default values.
+ *	[DUT]
+ *	SuspendResumeDelay=10
  * ]|
  *
  * By default, this file is expected to exist in ~/.igtrc . The directory for
  * this can be overriden by setting the environment variable %IGT_CONFIG_PATH.
  */
 
+#define SUSPEND_RESUME_DELAY_DEFAULT 20 /* seconds */
+
 struct chamelium_edid {
 	int id;
 	struct igt_list link;
@@ -100,6 +107,7 @@ struct chamelium {
 	xmlrpc_env env;
 	xmlrpc_client *client;
 	char *url;
+	int suspend_resume_delay;
 
 	/* Indicates the last port to have been used for capturing video */
 	struct chamelium_port *capturing_port;
@@ -114,6 +122,20 @@ struct chamelium {
 static struct chamelium *cleanup_instance;
 
 /**
+ * chamelium_get_suspend_resume_delay:
+ * @chamelium: The Chamelium instance to use
+ *
+ * Retrieves the suspend/resume delay as specified in the configuration or
+ * its default value.
+ *
+ * Returns: the suspend/resume delay in seconds
+ */
+int chamelium_get_suspend_resume_delay(struct chamelium *chamelium)
+{
+	return chamelium->suspend_resume_delay;
+}
+
+/**
  * chamelium_get_ports:
  * @chamelium: The Chamelium instance to use
  * @count: Where to store the number of ports
@@ -1157,6 +1179,13 @@ static bool chamelium_read_config(struct chamelium *chamelium, int drm_fd)
 		goto out;
 	}
 
+	rc = g_key_file_get_integer(key_file, "DUT", "SuspendResumeDelay",
+				    &error);
+	if (rc == 0)
+		chamelium->suspend_resume_delay = SUSPEND_RESUME_DELAY_DEFAULT;
+	else
+		chamelium->suspend_resume_delay = rc;
+
 	ret = chamelium_read_port_mappings(chamelium, drm_fd, key_file);
 
 out:
diff --git a/lib/igt_chamelium.h b/lib/igt_chamelium.h
index 81322ad2..380f9b36 100644
--- a/lib/igt_chamelium.h
+++ b/lib/igt_chamelium.h
@@ -41,6 +41,7 @@ struct chamelium *chamelium_init(int drm_fd);
 void chamelium_deinit(struct chamelium *chamelium);
 void chamelium_reset(struct chamelium *chamelium);
 
+int chamelium_get_suspend_resume_delay(struct chamelium *chamelium);
 struct chamelium_port **chamelium_get_ports(struct chamelium *chamelium,
 					    int *count);
 unsigned int chamelium_port_get_type(const struct chamelium_port *port);
-- 
2.13.1

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

  parent 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 [PATCH i-g-t 1/7] tests/chamelium: Update connector state without reprobe when possible Paul Kocialkowski
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 ` Paul Kocialkowski [this message]
2017-06-26 14:25   ` [PATCH i-g-t 4/7] lib/igt_chamelium: Add support for configurable DUT suspend/resume delay 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-4-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).