From patchwork Fri Dec 30 12:00:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kahola X-Patchwork-Id: 9492057 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 7A29460417 for ; Fri, 30 Dec 2016 12:04:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68C461FF8F for ; Fri, 30 Dec 2016 12:04:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 59E9022638; Fri, 30 Dec 2016 12:04:40 +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 892621FF8F for ; Fri, 30 Dec 2016 12:04:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9B04F6E252; Fri, 30 Dec 2016 12:04:36 +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 D4F6B6E252 for ; Fri, 30 Dec 2016 12:04:23 +0000 (UTC) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 30 Dec 2016 04:04:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,432,1477983600"; d="scan'208";a="24384619" Received: from sorvi.fi.intel.com ([10.237.72.109]) by orsmga002.jf.intel.com with ESMTP; 30 Dec 2016 04:04:22 -0800 From: Mika Kahola To: intel-gfx@lists.freedesktop.org Date: Fri, 30 Dec 2016 14:00:40 +0200 Message-Id: <1483099241-15898-5-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 4/5] tests/kms_rotation_crc: 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 transition display commits without actual real-life commit. Signed-off-by: Mika Kahola --- tests/kms_rotation_crc.c | 282 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 222 insertions(+), 60 deletions(-) diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c index 796b448..434f845 100644 --- a/tests/kms_rotation_crc.c +++ b/tests/kms_rotation_crc.c @@ -84,11 +84,25 @@ paint_squares(data_t *data, drmModeModeInfo *mode, igt_rotation_t rotation, cairo_destroy(cr); } -static void commit_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane) +static int display_commit_test_only(igt_display_t *display) +{ + int ret; + + ret = igt_display_try_commit_atomic(display, + DRM_MODE_ATOMIC_TEST_ONLY | + DRM_MODE_ATOMIC_ALLOW_MODESET, + NULL); + + return ret; +} + +static void commit_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane, + bool test_only) { igt_display_t *display = &data->display; enum igt_commit_style commit = COMMIT_LEGACY; igt_plane_t *primary; + int ret; /* * With igt_display_commit2 and COMMIT_UNIVERSAL, we call just the @@ -99,7 +113,13 @@ static void commit_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane) primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY); igt_plane_set_fb(primary, &data->fb_modeset); - igt_display_commit(display); + + if (test_only) { + ret = display_commit_test_only(display); + igt_assert_eq(ret, 0); + } else { + igt_display_commit(display); + } igt_plane_set_fb(plane, &data->fb); @@ -111,12 +131,19 @@ static void commit_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane) if (data->display.is_atomic) commit = COMMIT_ATOMIC; + else + igt_skip_on(test_only); - igt_display_commit2(display, commit); + if (test_only) { + ret = display_commit_test_only(display); + igt_assert_eq(ret, 0); + } else { + igt_display_commit2(display, commit); + } } static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe, - igt_plane_t *plane) + igt_plane_t *plane, bool test_only) { drmModeModeInfo *mode; int fb_id, fb_modeset_id; @@ -181,8 +208,10 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe, /* Step 1: create a reference CRC for a software-rotated fb */ paint_squares(data, mode, data->rotation, &data->fb, 1.0); - commit_crtc(data, output, plane); - igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc); + commit_crtc(data, output, plane, test_only); + + if (!test_only) + igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc); /* * Step 2: prepare the plane with an non-rotated fb let the hw @@ -192,10 +221,12 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe, igt_plane_set_fb(plane, &data->fb); } -static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane) +static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane, + bool test_only) { igt_display_t *display = &data->display; - + int ret; + igt_pipe_crc_free(data->pipe_crc); data->pipe_crc = NULL; @@ -215,7 +246,12 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane) igt_plane_set_fb(plane, NULL); igt_output_set_pipe(output, PIPE_ANY); - igt_display_commit(display); + if (test_only) { + ret = display_commit_test_only(display); + igt_assert_eq(ret, 0); + } else { + igt_display_commit(display); + } } static void wait_for_pageflip(int fd) @@ -235,7 +271,7 @@ static void wait_for_pageflip(int fd) igt_assert(drmHandleEvent(fd, &evctx) == 0); } -static void test_plane_rotation(data_t *data, enum igt_plane plane_type) +static void test_plane_rotation(data_t *data, enum igt_plane plane_type, bool test_only) { igt_display_t *display = &data->display; igt_output_t *output; @@ -254,6 +290,8 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type) if (data->display.is_atomic) commit = COMMIT_ATOMIC; + else + igt_skip_on(test_only); for_each_connected_output(display, output) { for_each_pipe(display, pipe) { @@ -264,17 +302,32 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type) plane = igt_output_get_plane(output, plane_type); igt_require(igt_plane_supports_rotation(plane)); - prepare_crtc(data, output, pipe, plane); + prepare_crtc(data, output, pipe, plane, test_only); - igt_display_commit2(display, commit); + if (test_only) { + ret = display_commit_test_only(display); + igt_assert_eq(ret, 0); + } else { + igt_display_commit2(display, commit); + } /* collect unrotated CRC */ - igt_pipe_crc_collect_crc(data->pipe_crc, &crc_unrotated); + if (!test_only) + igt_pipe_crc_collect_crc(data->pipe_crc, &crc_unrotated); igt_plane_set_rotation(plane, data->rotation); - ret = igt_display_try_commit2(display, commit); + + if (test_only) { + ret = display_commit_test_only(display); + igt_assert_eq(ret, 0); + } else { + ret = igt_display_try_commit2(display, commit); + } + if (data->override_fmt || data->override_tiling) { igt_assert_eq(ret, -EINVAL); + } else if (test_only) { + igt_assert_eq(ret, 0); } else { igt_assert_eq(ret, 0); igt_pipe_crc_collect_crc(data->pipe_crc, @@ -283,22 +336,24 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type) &crc_output); } - flip_count = data->flip_stress; - while (flip_count--) { - ret = drmModePageFlip(data->gfx_fd, - output->config.crtc->crtc_id, - data->fb_flip.fb_id, - DRM_MODE_PAGE_FLIP_EVENT, - NULL); - igt_assert(ret == 0); - wait_for_pageflip(data->gfx_fd); - ret = drmModePageFlip(data->gfx_fd, - output->config.crtc->crtc_id, - data->fb.fb_id, - DRM_MODE_PAGE_FLIP_EVENT, - NULL); - igt_assert(ret == 0); - wait_for_pageflip(data->gfx_fd); + if (!test_only) { + flip_count = data->flip_stress; + while (flip_count--) { + ret = drmModePageFlip(data->gfx_fd, + output->config.crtc->crtc_id, + data->fb_flip.fb_id, + DRM_MODE_PAGE_FLIP_EVENT, + NULL); + igt_assert(ret == 0); + wait_for_pageflip(data->gfx_fd); + ret = drmModePageFlip(data->gfx_fd, + output->config.crtc->crtc_id, + data->fb.fb_id, + DRM_MODE_PAGE_FLIP_EVENT, + NULL); + igt_assert(ret == 0); + wait_for_pageflip(data->gfx_fd); + } } /* @@ -307,20 +362,24 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type) */ kmstest_restore_vt_mode(); kmstest_set_vt_graphics_mode(); + + commit_crtc(data, output, plane, test_only); - commit_crtc(data, output, plane); - - igt_pipe_crc_collect_crc(data->pipe_crc, &crc_output); - igt_assert_crc_equal(&crc_unrotated, &crc_output); + if (!test_only) { + igt_pipe_crc_collect_crc(data->pipe_crc, &crc_output); + igt_assert_crc_equal(&crc_unrotated, &crc_output); + } valid_tests++; - cleanup_crtc(data, output, plane); + cleanup_crtc(data, output, plane, test_only); } } igt_require_f(valid_tests, "no valid crtc/connector combinations found\n"); } -static void test_plane_rotation_ytiled_obj(data_t *data, enum igt_plane plane_type) +static void test_plane_rotation_ytiled_obj(data_t *data, + enum igt_plane plane_type, + bool test_only) { igt_display_t *display = &data->display; uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED; @@ -348,6 +407,8 @@ static void test_plane_rotation_ytiled_obj(data_t *data, enum igt_plane plane_ty if (data->display.is_atomic) commit = COMMIT_ATOMIC; + else + igt_skip_on(test_only); mode = igt_output_get_mode(output); w = mode->hdisplay; @@ -379,14 +440,20 @@ static void test_plane_rotation_ytiled_obj(data_t *data, enum igt_plane plane_ty DRM_MODE_OBJECT_PLANE, plane->rotation_property, plane->rotation); - ret = igt_display_try_commit2(display, commit); + + if (test_only) + ret = display_commit_test_only(display); + else + ret = igt_display_try_commit2(display, commit); kmstest_restore_vt_mode(); igt_remove_fb(fd, &data->fb); igt_assert(ret == 0); } -static void test_plane_rotation_exhaust_fences(data_t *data, enum igt_plane plane_type) +static void test_plane_rotation_exhaust_fences(data_t *data, + enum igt_plane plane_type, + bool test_only) { igt_display_t *display = &data->display; uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED; @@ -416,6 +483,8 @@ static void test_plane_rotation_exhaust_fences(data_t *data, enum igt_plane plan if (data->display.is_atomic) commit = COMMIT_ATOMIC; + else + igt_skip_on(test_only); mode = igt_output_get_mode(output); w = mode->hdisplay; @@ -435,7 +504,13 @@ static void test_plane_rotation_exhaust_fences(data_t *data, enum igt_plane plan igt_require(total_fbs_size < total_aperture_size * 0.9); igt_plane_set_fb(plane, NULL); - igt_display_commit(display); + + if (test_only) { + ret = display_commit_test_only(display); + igt_assert_eq(ret, 0); + } else { + igt_display_commit(display); + } for (i = 0; i < MAX_FENCES + 1; i++) { gem_handle = gem_create(fd, size); @@ -460,10 +535,18 @@ static void test_plane_rotation_exhaust_fences(data_t *data, enum igt_plane plan igt_plane_set_fb(plane, &data2[i].fb); igt_plane_set_rotation(plane, IGT_ROTATION_0); - ret = igt_display_try_commit2(display, commit); - if (ret) { - igt_warn("failed to commit unrotated fb\n"); - goto err_commit; + if (test_only) { + ret = display_commit_test_only(display); + if (ret) { + igt_warn("test only: failed to commit unrotated fb\n"); + goto err_commit; + } + } else { + ret = igt_display_try_commit2(display, commit); + if (ret) { + igt_warn("failed to commit unrotated fb\n"); + goto err_commit; + } } igt_plane_set_rotation(plane, IGT_ROTATION_90); @@ -472,10 +555,19 @@ static void test_plane_rotation_exhaust_fences(data_t *data, enum igt_plane plan DRM_MODE_OBJECT_PLANE, plane->rotation_property, plane->rotation); - ret = igt_display_try_commit2(display, commit); - if (ret) { - igt_warn("failed to commit hardware rotated fb\n"); - goto err_commit; + + if (test_only) { + ret = display_commit_test_only(display); + if (ret) { + igt_warn("test only: failed to commit hardware rotated fb\n"); + goto err_commit; + } + } else { + ret = igt_display_try_commit2(display, commit); + if (ret) { + igt_warn("failed to commit hardware rotated fb\n"); + goto err_commit; + } } } @@ -511,41 +603,73 @@ igt_main } igt_subtest_f("primary-rotation-180") { data.rotation = IGT_ROTATION_180; - test_plane_rotation(&data, IGT_PLANE_PRIMARY); + test_plane_rotation(&data, IGT_PLANE_PRIMARY, false); + } + igt_subtest_f("primary-rotation-180-test-only") { + data.rotation = IGT_ROTATION_180; + test_plane_rotation(&data, IGT_PLANE_PRIMARY, true); } igt_subtest_f("sprite-rotation-180") { data.rotation = IGT_ROTATION_180; - test_plane_rotation(&data, IGT_PLANE_2); + test_plane_rotation(&data, IGT_PLANE_2, false); + } + igt_subtest_f("sprite-rotation-180-test-only") { + data.rotation = IGT_ROTATION_180; + test_plane_rotation(&data, IGT_PLANE_2, true); } igt_subtest_f("cursor-rotation-180") { data.rotation = IGT_ROTATION_180; - test_plane_rotation(&data, IGT_PLANE_CURSOR); + test_plane_rotation(&data, IGT_PLANE_CURSOR, false); + } + igt_subtest_f("cursor-rotation-180-test-only") { + data.rotation = IGT_ROTATION_180; + test_plane_rotation(&data, IGT_PLANE_CURSOR, true); } igt_subtest_f("primary-rotation-90") { igt_require(gen >= 9); data.rotation = IGT_ROTATION_90; - test_plane_rotation(&data, IGT_PLANE_PRIMARY); + test_plane_rotation(&data, IGT_PLANE_PRIMARY, false); + } + igt_subtest_f("primary-rotation-90-test-only") { + igt_require(gen >= 9); + data.rotation = IGT_ROTATION_90; + test_plane_rotation(&data, IGT_PLANE_PRIMARY, true); } igt_subtest_f("primary-rotation-270") { igt_require(gen >= 9); data.rotation = IGT_ROTATION_270; - test_plane_rotation(&data, IGT_PLANE_PRIMARY); + test_plane_rotation(&data, IGT_PLANE_PRIMARY, false); + } + igt_subtest_f("primary-rotation-270-test-only") { + igt_require(gen >= 9); + data.rotation = IGT_ROTATION_270; + test_plane_rotation(&data, IGT_PLANE_PRIMARY, true); } igt_subtest_f("sprite-rotation-90") { igt_require(gen >= 9); data.rotation = IGT_ROTATION_90; - test_plane_rotation(&data, IGT_PLANE_2); + test_plane_rotation(&data, IGT_PLANE_2, false); + } + igt_subtest_f("sprite-rotation-90-test-only") { + igt_require(gen >= 9); + data.rotation = IGT_ROTATION_90; + test_plane_rotation(&data, IGT_PLANE_2, true); } igt_subtest_f("sprite-rotation-270") { igt_require(gen >= 9); data.rotation = IGT_ROTATION_270; - test_plane_rotation(&data, IGT_PLANE_2); + test_plane_rotation(&data, IGT_PLANE_2, false); + } + igt_subtest_f("sprite-rotation-270-test-only") { + igt_require(gen >= 9); + data.rotation = IGT_ROTATION_270; + test_plane_rotation(&data, IGT_PLANE_2, true); } igt_subtest_f("sprite-rotation-90-pos-100-0") { @@ -553,7 +677,14 @@ igt_main data.rotation = IGT_ROTATION_90; data.pos_x = 100, data.pos_y = 0; - test_plane_rotation(&data, IGT_PLANE_2); + test_plane_rotation(&data, IGT_PLANE_2, false); + } + igt_subtest_f("sprite-rotation-90-pos-100-0-test-only") { + igt_require(gen >= 9); + data.rotation = IGT_ROTATION_90; + data.pos_x = 100, + data.pos_y = 0; + test_plane_rotation(&data, IGT_PLANE_2, true); } igt_subtest_f("bad-pixel-format") { @@ -562,7 +693,15 @@ igt_main data.pos_y = 0; data.rotation = IGT_ROTATION_90; data.override_fmt = DRM_FORMAT_RGB565; - test_plane_rotation(&data, IGT_PLANE_PRIMARY); + test_plane_rotation(&data, IGT_PLANE_PRIMARY, false); + } + igt_subtest_f("bad-pixel-format-test-only") { + igt_require(gen >= 9); + data.pos_x = 0, + data.pos_y = 0; + data.rotation = IGT_ROTATION_90; + data.override_fmt = DRM_FORMAT_RGB565; + test_plane_rotation(&data, IGT_PLANE_PRIMARY, true); } igt_subtest_f("bad-tiling") { @@ -570,7 +709,14 @@ igt_main data.override_fmt = 0; data.rotation = IGT_ROTATION_90; data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE; - test_plane_rotation(&data, IGT_PLANE_PRIMARY); + test_plane_rotation(&data, IGT_PLANE_PRIMARY, false); + } + igt_subtest_f("bad-tiling-test-only") { + igt_require(gen >= 9); + data.override_fmt = 0; + data.rotation = IGT_ROTATION_90; + data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE; + test_plane_rotation(&data, IGT_PLANE_PRIMARY, true); } igt_subtest_f("primary-rotation-90-flip-stress") { @@ -578,18 +724,34 @@ igt_main data.override_tiling = 0; data.flip_stress = 60; data.rotation = IGT_ROTATION_90; - test_plane_rotation(&data, IGT_PLANE_PRIMARY); + test_plane_rotation(&data, IGT_PLANE_PRIMARY, false); + } + igt_subtest_f("primary-rotation-90-flip-stress-test-only") { + igt_require(gen >= 9); + data.override_tiling = 0; + data.flip_stress = 60; + data.rotation = IGT_ROTATION_90; + test_plane_rotation(&data, IGT_PLANE_PRIMARY, true); } igt_subtest_f("primary-rotation-90-Y-tiled") { igt_require(gen >= 9); data.rotation = IGT_ROTATION_90; - test_plane_rotation_ytiled_obj(&data, IGT_PLANE_PRIMARY); + test_plane_rotation_ytiled_obj(&data, IGT_PLANE_PRIMARY, false); + } + igt_subtest_f("primary-rotation-90-Y-tiled-test-only") { + igt_require(gen >= 9); + data.rotation = IGT_ROTATION_90; + test_plane_rotation_ytiled_obj(&data, IGT_PLANE_PRIMARY, true); } igt_subtest_f("exhaust-fences") { igt_require(gen >= 9); - test_plane_rotation_exhaust_fences(&data, IGT_PLANE_PRIMARY); + test_plane_rotation_exhaust_fences(&data, IGT_PLANE_PRIMARY, false); + } + igt_subtest_f("exhaust-fences-test-only") { + igt_require(gen >= 9); + test_plane_rotation_exhaust_fences(&data, IGT_PLANE_PRIMARY, true); } igt_fixture {