From patchwork Thu May 29 15:09:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Roper X-Patchwork-Id: 4265791 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0AF3CBEEA7 for ; Thu, 29 May 2014 15:09:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 40686202BE for ; Thu, 29 May 2014 15:09:08 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 574B020149 for ; Thu, 29 May 2014 15:09:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CE0CE6E9C3; Thu, 29 May 2014 08:09:06 -0700 (PDT) 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 ESMTP id E0C5B6E9C3 for ; Thu, 29 May 2014 08:09:05 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 29 May 2014 08:02:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.98,934,1392192000"; d="scan'208";a="548412697" Received: from mdroper-hswdev.fm.intel.com (HELO mdroper-hswdev) ([10.1.134.215]) by orsmga002.jf.intel.com with ESMTP; 29 May 2014 08:08:03 -0700 Received: from mattrope by mdroper-hswdev with local (Exim 4.82) (envelope-from ) id 1Wq1xP-0006Uy-Ks; Thu, 29 May 2014 08:09:27 -0700 From: Matt Roper To: intel-gfx@lists.freedesktop.org Date: Thu, 29 May 2014 08:09:14 -0700 Message-Id: <1401376157-24940-2-git-send-email-matthew.d.roper@intel.com> X-Mailer: git-send-email 1.8.5.1 In-Reply-To: <1401376157-24940-1-git-send-email-matthew.d.roper@intel.com> References: <1401376014-24845-1-git-send-email-matthew.d.roper@intel.com> <1401376157-24940-1-git-send-email-matthew.d.roper@intel.com> Subject: [Intel-gfx] [PATCH i-g-t 2/5] 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);