From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Roper Subject: [PATCH i-g-t 2/5] kms: Add igt_drm_plane_try_commit() Date: Thu, 29 May 2014 08:09:14 -0700 Message-ID: <1401376157-24940-2-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> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: 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) In-Reply-To: <1401376157-24940-1-git-send-email-matthew.d.roper@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org 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); -- 1.8.5.1