From patchwork Mon Nov 2 17:25:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Wood X-Patchwork-Id: 7537681 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7ED2C9F71A for ; Mon, 2 Nov 2015 17:36:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BDFE02041D for ; Mon, 2 Nov 2015 17:36:04 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id CEEA4203AB for ; Mon, 2 Nov 2015 17:36:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 599166E143; Mon, 2 Nov 2015 09:36:02 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTP id 34AD46E31B for ; Mon, 2 Nov 2015 09:35:55 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 02 Nov 2015 09:35:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,234,1444719600"; d="scan'208";a="592647815" Received: from otc-vmt1.isw.intel.com ([10.237.224.80]) by FMSMGA003.fm.intel.com with ESMTP; 02 Nov 2015 09:35:54 -0800 From: Thomas Wood To: intel-gfx@lists.freedesktop.org Date: Mon, 2 Nov 2015 17:25:32 +0000 Message-Id: <1446485133-13529-4-git-send-email-thomas.wood@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446485133-13529-1-git-send-email-thomas.wood@intel.com> References: <1446485133-13529-1-git-send-email-thomas.wood@intel.com> Organization: Intel Corporation (UK) Ltd. - Co. Reg. #1134945 - Pipers Way, Swindon SN3 1RJ Subject: [Intel-gfx] [PATCH i-g-t 4/5] tests/kms_force_connector: add an option to reset connector force states 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Thomas Wood --- tests/kms_force_connector.c | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/tests/kms_force_connector.c b/tests/kms_force_connector.c index 1e5ec6f..2cb149a 100644 --- a/tests/kms_force_connector.c +++ b/tests/kms_force_connector.c @@ -30,13 +30,55 @@ IGT_TEST_DESCRIPTION("Check the debugfs force connector/edid features work" #define CHECK_MODE(m, h, w, r) igt_assert(m.hdisplay == h && m.vdisplay == w \ && m.vrefresh == r) -igt_main +static void __attribute__((noreturn)) reset_connectors() +{ + int drm_fd = 0; + drmModeRes *res; + drmModeConnector *connector = NULL; + + drm_fd = drm_open_driver_master(DRIVER_INTEL); + res = drmModeGetResources(drm_fd); + + for (int i = 0; i < res->count_connectors; i++) { + + connector = drmModeGetConnector(drm_fd, res->connectors[i]); + + kmstest_force_connector(drm_fd, connector, + FORCE_CONNECTOR_UNSPECIFIED); + + drmModeFreeConnector(connector); + } + + exit(0); +} + +static int opt_handler(int opt, int opt_index, void *data) +{ + switch (opt) { + case 'r': + reset_connectors(); + break; + } + + return 0; +} + +int main(int argc, char **argv) { /* force the VGA output and test that it worked */ int drm_fd = 0; drmModeRes *res; drmModeConnector *vga_connector = NULL, *temp; int start_n_modes; + struct option long_opts[] = { + {"reset", 0, 0, 'r'}, + {0, 0, 0, 0} + }; + const char *help_str = + " --reset\t\tReset all connector force states.\n"; + + igt_subtest_init_parse_opts(&argc, argv, "", long_opts, help_str, + opt_handler, NULL); igt_fixture { drm_fd = drm_open_driver_master(DRIVER_INTEL);