From patchwork Mon Jul 28 15:24:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Wood X-Patchwork-Id: 4635221 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 212CC9F32F for ; Mon, 28 Jul 2014 15:25:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5913B201B4 for ; Mon, 28 Jul 2014 15:24:59 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 92B562017D for ; Mon, 28 Jul 2014 15:24:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B5D66E3B0; Mon, 28 Jul 2014 08:24:56 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by gabe.freedesktop.org (Postfix) with ESMTP id C94856E3B0 for ; Mon, 28 Jul 2014 08:24:54 -0700 (PDT) Received: by mail-wi0-f177.google.com with SMTP id ho1so4571894wib.10 for ; Mon, 28 Jul 2014 08:24:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=Vo5yW+KvqXNiN6ArEg/pQpaEgy+nzJaL27zFQ4iZ+UQ=; b=O8nnqhn/umnmCr+ggOEfYV49kK8Nu4cgYmLGhEEngXJNy6G60TR3T3kCHsGgVcFLNK TP2U/LYWzPvgKVae+Sdm45OKLcq1UksIWPwBsz8a+2AXXwCgB4zp/yiu5BybPCJLsERS J8fHhy4rQwc5yq56KOtY19VkNNawk4a9c5VbwgOtUFQsMeiNjJzFEjtsbWYfjz9HoWG6 zDOEdpjh97U8pocN/cIOKmNkh4iIfS65FzyRQStV+ejeMWOnSzAOxRImWB9HHqt4ydIg qJDc8Q8+8vbDS96hO+bm3ChZ+Pm+kDMCc6EhHvjthe1MCXKz/xae3BCJq1xuImXkEqAB vt7A== X-Gm-Message-State: ALoCoQnILe2FZQF+CqZCdcGzeitQQa/QeopJVK8bJF8DQgzvTIRLpoaoV8LCEVPKrh80aGjY8vIy X-Received: by 10.194.62.110 with SMTP id x14mr50356661wjr.15.1406561090896; Mon, 28 Jul 2014 08:24:50 -0700 (PDT) Received: from pistachio.icx.intel.com ([83.217.123.106]) by mx.google.com with ESMTPSA id je3sm32450524wic.11.2014.07.28.08.24.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Jul 2014 08:24:50 -0700 (PDT) From: Thomas Wood To: intel-gfx@lists.freedesktop.org Date: Mon, 28 Jul 2014 16:24:49 +0100 Message-Id: <1406561089-22739-1-git-send-email-thomas.wood@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [Intel-gfx] [PATCH i-g-t] lib: don't abort if forcing the connector state fails X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 Ensure tests using igt_enable_connectors can still run even if the relevant debugfs files are not available. Signed-off-by: Thomas Wood --- lib/igt_kms.c | 19 ++++++++++++++----- lib/igt_kms.h | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 20370a9..740b5dd 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -429,9 +429,11 @@ static char* get_debugfs_connector_path(int drm_fd, drmModeConnector *connector, * @state: state to force on @connector * * Force the specified state on the specified connector. + * + * Returns: true on success */ -void kmstest_force_connector(int drm_fd, drmModeConnector *connector, enum - kmstest_force_connector_state state) +bool kmstest_force_connector(int drm_fd, drmModeConnector *connector, + enum kmstest_force_connector_state state) { char *path; const char *value; @@ -458,12 +460,15 @@ void kmstest_force_connector(int drm_fd, drmModeConnector *connector, enum debugfs_fd = open(path, O_WRONLY | O_TRUNC); free(path); - igt_assert(debugfs_fd != -1); + if (debugfs_fd == -1) { + return false; + } ret = write(debugfs_fd, value, strlen(value)); close(debugfs_fd); igt_assert(ret != -1); + return (ret == -1) ? false : true; } /** @@ -1509,8 +1514,12 @@ void igt_enable_connectors(void) continue; /* just enable VGA for now */ - if (c->connector_type == DRM_MODE_CONNECTOR_VGA) - kmstest_force_connector(drm_fd, c, FORCE_CONNECTOR_ON); + if (c->connector_type == DRM_MODE_CONNECTOR_VGA) { + if (!kmstest_force_connector(drm_fd, c, FORCE_CONNECTOR_ON)) + igt_info("Unable to force state on %s-%d\n", + kmstest_connector_type_str(c->connector_type), + c->connector_type_id); + } drmModeFreeConnector(c); } diff --git a/lib/igt_kms.h b/lib/igt_kms.h index fb0e66a..08b46ab 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -130,7 +130,7 @@ int kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector, int kmstest_get_connector_config(int drm_fd, uint32_t connector_id, unsigned long crtc_idx_mask, struct kmstest_connector_config *config); -void kmstest_force_connector(int fd, drmModeConnector *connector, +bool kmstest_force_connector(int fd, drmModeConnector *connector, enum kmstest_force_connector_state state); void kmstest_force_edid(int drm_fd, drmModeConnector *connector, const unsigned char *edid, size_t length);