From patchwork Mon Jun 26 13:59:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Kocialkowki X-Patchwork-Id: 9809747 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 21D06603D7 for ; Mon, 26 Jun 2017 14:00:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28208285D5 for ; Mon, 26 Jun 2017 14:00:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 25EB9285D1; Mon, 26 Jun 2017 14:00:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 23280285D5 for ; Mon, 26 Jun 2017 14:00:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 681FC6E253; Mon, 26 Jun 2017 14:00:26 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9BB7A6E24F for ; Mon, 26 Jun 2017 14:00:23 +0000 (UTC) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jun 2017 07:00:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,395,1493708400"; d="scan'208";a="117538089" Received: from linux.intel.com ([10.54.29.200]) by orsmga005.jf.intel.com with ESMTP; 26 Jun 2017 07:00:23 -0700 Received: from workstation.fi.intel.com (workstation.fi.intel.com [10.237.68.144]) by linux.intel.com (Postfix) with ESMTP id B7EBB580351; Mon, 26 Jun 2017 07:00:21 -0700 (PDT) From: Paul Kocialkowski To: intel-gfx@lists.freedesktop.org Date: Mon, 26 Jun 2017 16:59:03 +0300 Message-Id: <20170626135906.32708-4-paul.kocialkowski@linux.intel.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170626135906.32708-1-paul.kocialkowski@linux.intel.com> References: <20170626135906.32708-1-paul.kocialkowski@linux.intel.com> Cc: Lyude Subject: [Intel-gfx] [PATCH i-g-t 4/7] lib/igt_chamelium: Add support for configurable DUT suspend/resume delay X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);