From patchwork Thu May 22 16:47:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Roper X-Patchwork-Id: 4224531 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 D5D63BF90B for ; Thu, 22 May 2014 16:46:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 092A42034B for ; Thu, 22 May 2014 16:46:51 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A54F62011D for ; Thu, 22 May 2014 16:46:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2395F6E445; Thu, 22 May 2014 09:46:49 -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 D25806E445 for ; Thu, 22 May 2014 09:46:47 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 22 May 2014 09:46:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.98,888,1392192000"; d="scan'208";a="516129250" Received: from mdroper-hswdev.fm.intel.com (HELO mdroper-hswdev) ([10.1.134.215]) by orsmga001.jf.intel.com with ESMTP; 22 May 2014 09:46:35 -0700 Received: from mattrope by mdroper-hswdev with local (Exim 4.82) (envelope-from ) id 1WnW9d-0005Ed-I0; Thu, 22 May 2014 09:47:41 -0700 From: Matt Roper To: intel-gfx@lists.freedesktop.org Date: Thu, 22 May 2014 09:47:39 -0700 Message-Id: <1400777259-20091-1-git-send-email-matthew.d.roper@intel.com> X-Mailer: git-send-email 1.8.5.1 Subject: [Intel-gfx] [PATCH i-g-t] kms_cursor_crc: Move igt_pipe_crc_{new, free} to init 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 If a subtest fails, cleanup_crtc() never gets called. Currently that also causes igt_pipe_crc_free() to never be called, leading all subsequent subtests to also fail with -EBUSY at igt_pipe_crc_new(). Move the calls to igt_pipe_crc_{new,free} into igt_main so that we don't need to worry about closing and reopening the CRC filedescriptor for each subtest. Signed-off-by: Matt Roper --- tests/kms_cursor_crc.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c index 06625ee..1b90baa 100644 --- a/tests/kms_cursor_crc.c +++ b/tests/kms_cursor_crc.c @@ -39,11 +39,14 @@ #define DRM_CAP_CURSOR_HEIGHT 0x9 #endif +#define MAX_PIPES 3 + typedef struct { int drm_fd; igt_display_t display; struct igt_fb primary_fb; struct igt_fb fb; + igt_pipe_crc_t *pipe_crcs[MAX_PIPES]; } data_t; typedef struct { @@ -251,12 +254,6 @@ static bool prepare_crtc(test_data_t *test_data, igt_output_t *output, igt_display_commit(display); - /* create the pipe_crc object for this pipe */ - if (test_data->pipe_crc) - igt_pipe_crc_free(test_data->pipe_crc); - - test_data->pipe_crc = igt_pipe_crc_new(test_data->pipe, - INTEL_PIPE_CRC_SOURCE_AUTO); if (!test_data->pipe_crc) { igt_info("auto crc not supported on this connector with pipe %i\n", test_data->pipe); @@ -289,7 +286,6 @@ static void cleanup_crtc(test_data_t *test_data, igt_output_t *output) igt_display_t *display = &data->display; igt_plane_t *primary; - igt_pipe_crc_free(test_data->pipe_crc); test_data->pipe_crc = NULL; igt_remove_fb(data->drm_fd, &data->primary_fb); @@ -315,6 +311,7 @@ static void run_test(data_t *data, void (*testfunc)(test_data_t *), int cursor_w test_data.output = output; for (p = 0; p < igt_display_get_n_pipes(display); p++) { test_data.pipe = p; + test_data.pipe_crc = data->pipe_crcs[p]; if (!prepare_crtc(&test_data, output, cursor_w, cursor_h)) continue; @@ -385,6 +382,7 @@ igt_main uint64_t cursor_width = 64, cursor_height = 64; data_t data = {}; int ret; + int p; igt_skip_on_simulation(); @@ -405,11 +403,20 @@ igt_main igt_require_pipe_crc(); igt_display_init(&data.display, data.drm_fd); + + for (p = 0; p < igt_display_get_n_pipes(&data.display); p++) + data.pipe_crcs[p] = igt_pipe_crc_new(p, + INTEL_PIPE_CRC_SOURCE_AUTO); } run_test_generic(&data, cursor_width); igt_fixture { + for (p = 0; p < igt_display_get_n_pipes(&data.display); p++) { + if (data.pipe_crcs[p]) + igt_pipe_crc_free(data.pipe_crcs[p]); + } + igt_display_fini(&data.display); } }