From patchwork Wed Apr 30 17:11:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Roper X-Patchwork-Id: 4095291 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 22F509F169 for ; Wed, 30 Apr 2014 17:15:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 57CE2202F8 for ; Wed, 30 Apr 2014 17:15:57 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 7D614202F2 for ; Wed, 30 Apr 2014 17:15:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2102D6EC67; Wed, 30 Apr 2014 10:15:56 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id B571B6EC67 for ; Wed, 30 Apr 2014 10:15:54 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 30 Apr 2014 10:11:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,959,1389772800"; d="scan'208";a="503832281" Received: from mdroper-hswdev.fm.intel.com (HELO mdroper-hswdev) ([10.1.134.215]) by orsmga001.jf.intel.com with ESMTP; 30 Apr 2014 10:11:04 -0700 Received: from mattrope by mdroper-hswdev with local (Exim 4.82) (envelope-from ) id 1WfY2Q-0004Rd-QA; Wed, 30 Apr 2014 10:11:18 -0700 From: Matt Roper To: intel-gfx@lists.freedesktop.org Date: Wed, 30 Apr 2014 10:11:09 -0700 Message-Id: <1398877871-17046-2-git-send-email-matthew.d.roper@intel.com> X-Mailer: git-send-email 1.8.5.1 In-Reply-To: <1398877871-17046-1-git-send-email-matthew.d.roper@intel.com> References: <1398877871-17046-1-git-send-email-matthew.d.roper@intel.com> Subject: [Intel-gfx] [PATCH i-g-t 2/4] kms: Add igt_drm_plane_try_commit() 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.8 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 For some of our tests, we want to make sure that bogus plane programming attempts fail with the expected error code. Add igt_drm_plane_try_commit() that will just return the error code on failure rather than failing the current subtest. This lets us test the return value against the expected error code. Signed-off-by: Matt Roper --- lib/igt_kms.c | 21 ++++++++++++++++++--- lib/igt_kms.h | 1 + 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 97e329b..ce6ea87 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -810,7 +810,11 @@ static int igt_cursor_commit(igt_plane_t *plane, igt_output_t *output) return 0; } -static int igt_drm_plane_commit(igt_plane_t *plane, igt_output_t *output) +/* + * Attempt to commit a plane; if the DRM call to program the plane fails, + * just return an error code (but don't fail the current subtest). + */ +int igt_drm_plane_try_commit(igt_plane_t *plane, igt_output_t *output) { igt_display_t *display = output->display; igt_pipe_t *pipe; @@ -842,7 +846,8 @@ static int igt_drm_plane_commit(igt_plane_t *plane, igt_output_t *output) IGT_FIXED(0,0), /* src_w */ IGT_FIXED(0,0) /* src_h */); - igt_assert(ret == 0); + if (ret) + return ret; plane->fb_changed = false; } else if (plane->fb_changed || plane->position_changed) { @@ -866,7 +871,8 @@ static int igt_drm_plane_commit(igt_plane_t *plane, igt_output_t *output) IGT_FIXED(plane->fb->width,0), /* src_w */ IGT_FIXED(plane->fb->height,0) /* src_h */); - igt_assert(ret == 0); + if (ret) + return ret; plane->fb_changed = false; plane->position_changed = false; @@ -876,6 +882,15 @@ static int igt_drm_plane_commit(igt_plane_t *plane, igt_output_t *output) return 0; } +static int igt_drm_plane_commit(igt_plane_t *plane, igt_output_t *output) +{ + int ret = igt_drm_plane_try_commit(plane, output); + + igt_assert(ret == 0); + + return 0; +} + static int igt_plane_commit(igt_plane_t *plane, igt_output_t *output) { struct igt_display *display = plane->pipe->display; diff --git a/lib/igt_kms.h b/lib/igt_kms.h index 4955fc8..2f72a1c 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -157,6 +157,7 @@ void igt_display_use_universal_commits(igt_display_t *display, bool use_universal); int igt_display_commit(igt_display_t *display); int igt_display_get_n_pipes(igt_display_t *display); +int igt_drm_plane_try_commit(igt_plane_t *plane, igt_output_t *output); const char *igt_output_name(igt_output_t *output); drmModeModeInfo *igt_output_get_mode(igt_output_t *output);