From patchwork Fri Dec 30 12:00:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kahola X-Patchwork-Id: 9492055 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AC7DC60417 for ; Fri, 30 Dec 2016 12:04:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B9811FF8F for ; Fri, 30 Dec 2016 12:04:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8DDF322638; Fri, 30 Dec 2016 12:04:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0090E1FF8F for ; Fri, 30 Dec 2016 12:04:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1AE1E6E1F9; Fri, 30 Dec 2016 12:04:21 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4383F6E252 for ; Fri, 30 Dec 2016 12:04:20 +0000 (UTC) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 30 Dec 2016 04:04:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,432,1477983600"; d="scan'208";a="24384608" Received: from sorvi.fi.intel.com ([10.237.72.109]) by orsmga002.jf.intel.com with ESMTP; 30 Dec 2016 04:04:19 -0800 From: Mika Kahola To: intel-gfx@lists.freedesktop.org Date: Fri, 30 Dec 2016 14:00:37 +0200 Message-Id: <1483099241-15898-2-git-send-email-mika.kahola@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483099241-15898-1-git-send-email-mika.kahola@intel.com> References: <1483099241-15898-1-git-send-email-mika.kahola@intel.com> Subject: [Intel-gfx] [PATCH i-g-t 1/5] tests/kms_plane_multiple: Add TEST_ONLY flag X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 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-Virus-Scanned: ClamAV using ClamSMTP Add TEST_ONLY flag to test atomic modesetting commits without actual real-life commit. Signed-off-by: Mika Kahola --- tests/kms_plane_multiple.c | 79 ++++++++++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 30 deletions(-) diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c index 5e12be4..1a77a38 100644 --- a/tests/kms_plane_multiple.c +++ b/tests/kms_plane_multiple.c @@ -61,10 +61,12 @@ struct { int iterations; bool user_seed; int seed; + bool test_only; } opt = { .iterations = 64, .user_seed = false, .seed = 1, + .test_only = false, }; static inline uint32_t pipe_select(int pipe) @@ -228,7 +230,7 @@ prepare_planes(data_t *data, enum pipe pipe, color_t *color, static void test_atomic_plane_position_with_output(data_t *data, enum pipe pipe, igt_output_t *output, int max_planes, - uint64_t tiling) + uint64_t tiling, bool test_only) { char buf[256]; struct drm_event *e = (void *)buf; @@ -240,6 +242,12 @@ test_atomic_plane_position_with_output(data_t *data, enum pipe pipe, int iterations = opt.iterations < 1 ? 1 : opt.iterations; bool loop_forever; char info[256]; + int flags = DRM_MODE_ATOMIC_ALLOW_MODESET; + + if (test_only) + flags |= DRM_MODE_ATOMIC_TEST_ONLY; + else + flags |= DRM_MODE_PAGE_FLIP_EVENT; if (opt.iterations == LOOP_FOREVER) { loop_forever = true; @@ -256,8 +264,9 @@ test_atomic_plane_position_with_output(data_t *data, enum pipe pipe, test_init(data, pipe); - test_grab_crc(data, output, pipe, true, &blue, tiling, - &test.reference_crc); + if (!test_only) + test_grab_crc(data, output, pipe, true, &blue, tiling, + &test.reference_crc); i = 0; while (i < iterations || loop_forever) { @@ -265,24 +274,27 @@ test_atomic_plane_position_with_output(data_t *data, enum pipe pipe, vblank_start = get_vblank(data->display.drm_fd, pipe, DRM_VBLANK_NEXTONMISS); - igt_display_commit_atomic(&data->display, - DRM_MODE_PAGE_FLIP_EVENT, - &data->display); + ret = igt_display_try_commit_atomic(&data->display, + flags, + &data->display); + igt_assert(ret != -EINVAL); - igt_set_timeout(1, "Stuck on page flip"); + if (!test_only) { + igt_set_timeout(1, "Stuck on page flip"); - ret = read(data->display.drm_fd, buf, sizeof(buf)); - igt_assert(ret >= 0); + ret = read(data->display.drm_fd, buf, sizeof(buf)); + igt_assert(ret >= 0); - igt_assert_eq(get_vblank(data->display.drm_fd, pipe, 0), vblank_start + 1); - igt_assert_eq(e->type, DRM_EVENT_FLIP_COMPLETE); - igt_reset_timeout(); + igt_assert_eq(get_vblank(data->display.drm_fd, pipe, 0), vblank_start + 1); + igt_assert_eq(e->type, DRM_EVENT_FLIP_COMPLETE); + igt_reset_timeout(); - n = igt_pipe_crc_get_crcs(data->pipe_crc, MAX_CRCS, &crc); + n = igt_pipe_crc_get_crcs(data->pipe_crc, MAX_CRCS, &crc); - igt_assert_eq(n, MAX_CRCS); + igt_assert_eq(n, MAX_CRCS); - igt_assert_crc_equal(&test.reference_crc, crc); + igt_assert_crc_equal(&test.reference_crc, crc); + } i++; } @@ -345,7 +357,7 @@ test_legacy_plane_position_with_output(data_t *data, enum pipe pipe, static void test_plane_position(data_t *data, enum pipe pipe, bool atomic, int max_planes, - uint64_t tiling) + uint64_t tiling, bool test_only) { igt_output_t *output; int connected_outs; @@ -372,7 +384,8 @@ test_plane_position(data_t *data, enum pipe pipe, bool atomic, int max_planes, test_atomic_plane_position_with_output(data, pipe, output, max_planes, - tiling); + tiling, + test_only); else test_legacy_plane_position_with_output(data, pipe, output, @@ -387,54 +400,55 @@ test_plane_position(data_t *data, enum pipe pipe, bool atomic, int max_planes, } static void -run_tests_for_pipe_plane(data_t *data, enum pipe pipe, int max_planes) +run_tests_for_pipe_plane(data_t *data, enum pipe pipe, int max_planes, + bool test_only) { igt_subtest_f("legacy-pipe-%s-tiling-none-planes-%d", kmstest_pipe_name(pipe), max_planes) test_plane_position(data, pipe, false, max_planes, - LOCAL_DRM_FORMAT_MOD_NONE); + LOCAL_DRM_FORMAT_MOD_NONE, test_only); igt_subtest_f("atomic-pipe-%s-tiling-none-planes-%d", kmstest_pipe_name(pipe), max_planes) test_plane_position(data, pipe, true, max_planes, - LOCAL_I915_FORMAT_MOD_X_TILED); + LOCAL_I915_FORMAT_MOD_X_TILED, test_only); igt_subtest_f("legacy-pipe-%s-tiling-x-planes-%d", kmstest_pipe_name(pipe), max_planes) test_plane_position(data, pipe, false, max_planes, - LOCAL_I915_FORMAT_MOD_X_TILED); + LOCAL_I915_FORMAT_MOD_X_TILED, test_only); igt_subtest_f("atomic-pipe-%s-tiling-x-planes-%d", kmstest_pipe_name(pipe), max_planes) test_plane_position(data, pipe, true, max_planes, - LOCAL_I915_FORMAT_MOD_X_TILED); + LOCAL_I915_FORMAT_MOD_X_TILED, test_only); igt_subtest_f("legacy-pipe-%s-tiling-y-planes-%d", kmstest_pipe_name(pipe), max_planes) test_plane_position(data, pipe, false, max_planes, - LOCAL_I915_FORMAT_MOD_Y_TILED); + LOCAL_I915_FORMAT_MOD_Y_TILED, test_only); igt_subtest_f("atomic-pipe-%s-tiling-y-planes-%d", kmstest_pipe_name(pipe), max_planes) test_plane_position(data, pipe, true, max_planes, - LOCAL_I915_FORMAT_MOD_Y_TILED); + LOCAL_I915_FORMAT_MOD_Y_TILED, test_only); igt_subtest_f("legacy-pipe-%s-tiling-yf-planes-%d", kmstest_pipe_name(pipe), max_planes) test_plane_position(data, pipe, false, max_planes, - LOCAL_I915_FORMAT_MOD_Yf_TILED); + LOCAL_I915_FORMAT_MOD_Yf_TILED, test_only); igt_subtest_f("atomic-pipe-%s-tiling-yf-planes-%d", kmstest_pipe_name(pipe), max_planes) test_plane_position(data, pipe, true, max_planes, - LOCAL_I915_FORMAT_MOD_Yf_TILED); + LOCAL_I915_FORMAT_MOD_Yf_TILED, test_only); } static void -run_tests_for_pipe(data_t *data, enum pipe pipe) +run_tests_for_pipe(data_t *data, enum pipe pipe, bool test_only) { for (int planes = IGT_PLANE_PRIMARY; planes < IGT_MAX_PLANES; planes++) - run_tests_for_pipe_plane(data, pipe, planes); + run_tests_for_pipe_plane(data, pipe, planes, test_only); } static data_t data; @@ -455,6 +469,9 @@ static int opt_handler(int option, int option_index, void *input) opt.user_seed = true; opt.seed = strtol(optarg, NULL, 0); break; + case 't': + opt.test_only = true; + break; default: igt_assert(false); } @@ -464,13 +481,15 @@ static int opt_handler(int option, int option_index, void *input) const char *help_str = " --iterations Number of iterations for test coverage. -1 loop forever, default 64 iterations\n" - " --seed Seed for random number generator\n"; + " --seed Seed for random number generator\n" + " --test-only test only atomic commit\n"; int main(int argc, char *argv[]) { struct option long_options[] = { { "iterations", required_argument, NULL, 'i'}, { "seed", required_argument, NULL, 's'}, + { "test-only", no_argument, NULL, 't'}, { 0, 0, 0, 0 } }; @@ -489,7 +508,7 @@ int main(int argc, char *argv[]) } for (int pipe = 0; pipe < I915_MAX_PIPES; pipe++) - run_tests_for_pipe(&data, pipe); + run_tests_for_pipe(&data, pipe, opt.test_only); igt_fixture { igt_display_fini(&data.display);