From patchwork Thu Feb 2 11:12:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kahola X-Patchwork-Id: 9551607 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 E0D2E60405 for ; Thu, 2 Feb 2017 11:14:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C15092808C for ; Thu, 2 Feb 2017 11:14:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B62242839A; Thu, 2 Feb 2017 11:14:03 +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 BD7392808C for ; Thu, 2 Feb 2017 11:14:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C469F6E9C3; Thu, 2 Feb 2017 11:14:01 +0000 (UTC) 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 ESMTPS id 9EAD36E9C3 for ; Thu, 2 Feb 2017 11:14:00 +0000 (UTC) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 02 Feb 2017 03:11:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.33,324,1477983600"; d="scan'208"; a="1090037972" Received: from sorvi.fi.intel.com ([10.237.72.109]) by orsmga001.jf.intel.com with ESMTP; 02 Feb 2017 03:11:50 -0800 From: Mika Kahola To: intel-gfx@lists.freedesktop.org Date: Thu, 2 Feb 2017 13:12:34 +0200 Message-Id: <1486033954-11964-1-git-send-email-mika.kahola@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [Intel-gfx] [PATCH i-g-t v2] tests/kms_plane_multiple: Test only with maximum number of planes 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 To be more suitable for BAT testing, let's modify the test such a way that it only uses the maximum number of available planes. This reduces the total number of subtests. v2: Fix broken kms_plane_multiple --list-subtests (Petri) Cc: Petri Latvala Cc: Robert Foss Signed-off-by: Mika Kahola Reviewed-by: Robert Foss --- tests/kms_plane_multiple.c | 141 +++++++++++++++++++++------------------------ 1 file changed, 65 insertions(+), 76 deletions(-) diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c index bb84878..4930286 100644 --- a/tests/kms_plane_multiple.c +++ b/tests/kms_plane_multiple.c @@ -171,7 +171,7 @@ create_fb_for_mode_position(data_t *data, igt_output_t *output, drmModeModeInfo mode->hdisplay, mode->vdisplay, color->red, color->green, color->blue); - for (int i = 0; i <= max_planes; i++) { + for (int i = 0; i < max_planes; i++) { if (data->plane[i]->type == DRM_PLANE_TYPE_PRIMARY) continue; igt_paint_color(cr, rect_x[i], rect_y[i], @@ -211,7 +211,7 @@ prepare_planes(data_t *data, enum pipe pipe_id, color_t *color, /* planes with random positions */ x[primary->index] = 0; y[primary->index] = 0; - for (i = 1; i <= max_planes; i++) { + for (i = 0; i < max_planes; i++) { igt_plane_t *plane = igt_output_get_plane(output, i); if (plane->type == DRM_PLANE_TYPE_PRIMARY) @@ -247,7 +247,7 @@ prepare_planes(data_t *data, enum pipe pipe_id, color_t *color, static void test_atomic_plane_position_with_output(data_t *data, enum pipe pipe, igt_output_t *output, int n_planes, - int max_planes, uint64_t tiling) + uint64_t tiling) { char buf[256]; struct drm_event *e = (void *)buf; @@ -270,7 +270,7 @@ test_atomic_plane_position_with_output(data_t *data, enum pipe pipe, } igt_info("Testing connector %s using pipe %s with %d planes %s with seed %d\n", - igt_output_name(output), kmstest_pipe_name(pipe), max_planes, + igt_output_name(output), kmstest_pipe_name(pipe), n_planes, info, opt.seed); test_init(data, pipe, n_planes); @@ -280,7 +280,7 @@ test_atomic_plane_position_with_output(data_t *data, enum pipe pipe, i = 0; while (i < iterations || loop_forever) { - prepare_planes(data, pipe, &blue, tiling, max_planes, output); + prepare_planes(data, pipe, &blue, tiling, n_planes, output); vblank_start = kmstest_get_vblank(data->display.drm_fd, pipe, DRM_VBLANK_NEXTONMISS); @@ -316,7 +316,7 @@ test_atomic_plane_position_with_output(data_t *data, enum pipe pipe, static void test_legacy_plane_position_with_output(data_t *data, enum pipe pipe, igt_output_t *output, int n_planes, - int max_planes, uint64_t tiling) + uint64_t tiling) { test_position_t test = { .data = data }; color_t blue = { 0.0f, 0.0f, 1.0f }; @@ -336,7 +336,7 @@ test_legacy_plane_position_with_output(data_t *data, enum pipe pipe, } igt_info("Testing connector %s using pipe %s with %d planes %s with seed %d\n", - igt_output_name(output), kmstest_pipe_name(pipe), max_planes, + igt_output_name(output), kmstest_pipe_name(pipe), n_planes, info, opt.seed); test_init(data, pipe, n_planes); @@ -346,7 +346,7 @@ test_legacy_plane_position_with_output(data_t *data, enum pipe pipe, i = 0; while (i < iterations || loop_forever) { - prepare_planes(data, pipe, &blue, tiling, max_planes, output); + prepare_planes(data, pipe, &blue, tiling, n_planes, output); igt_display_commit2(&data->display, COMMIT_LEGACY); @@ -365,19 +365,16 @@ 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 n_planes, - int max_planes, uint64_t tiling) +test_plane_position(data_t *data, enum pipe pipe, bool atomic, uint64_t tiling) { igt_output_t *output; int connected_outs; int devid = intel_get_drm_devid(data->drm_fd); + int n_planes = data->display.pipes[pipe].n_planes; if (atomic) igt_require(data->display.is_atomic); - igt_skip_on(pipe >= data->display.n_pipes); - igt_skip_on(max_planes >= data->display.pipes[pipe].n_planes); - if ((tiling == LOCAL_I915_FORMAT_MOD_Y_TILED || tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED)) igt_require(AT_LEAST_GEN(devid, 9)); @@ -392,14 +389,12 @@ test_plane_position(data_t *data, enum pipe pipe, bool atomic, int n_planes, if (atomic) test_atomic_plane_position_with_output(data, pipe, output, - n_planes, - max_planes, + n_planes, tiling); else test_legacy_plane_position_with_output(data, pipe, output, - n_planes, - max_planes, + n_planes, tiling); connected_outs++; @@ -410,71 +405,62 @@ test_plane_position(data_t *data, enum pipe pipe, bool atomic, int n_planes, } static void -run_tests_for_pipe_plane(data_t *data, enum pipe pipe) +run_tests_for_pipe(data_t *data, enum pipe pipe) { - igt_subtest_f("legacy-pipe-%s-tiling-none-planes", - kmstest_pipe_name(pipe)) { - int n_planes = data->display.pipes[pipe].n_planes; - for (int planes = 0; planes < n_planes; planes++) - test_plane_position(data, pipe, false, n_planes, - planes, LOCAL_DRM_FORMAT_MOD_NONE); - } - - igt_subtest_f("atomic-pipe-%s-tiling-none-planes", - kmstest_pipe_name(pipe)) { - int n_planes = data->display.pipes[pipe].n_planes; - for (int planes = 0; planes < n_planes; planes++) - test_plane_position(data, pipe, true, n_planes, - planes, LOCAL_I915_FORMAT_MOD_X_TILED); - } + igt_output_t *output; - igt_subtest_f("legacy-pipe-%s-tiling-x-planes", - kmstest_pipe_name(pipe)) { - int n_planes = data->display.pipes[pipe].n_planes; - for (int planes = 0; planes < n_planes; planes++) - test_plane_position(data, pipe, false, n_planes, - planes, LOCAL_I915_FORMAT_MOD_X_TILED); - } + igt_fixture { + int valid_tests = 0; - igt_subtest_f("atomic-pipe-%s-tiling-x-planes", - kmstest_pipe_name(pipe)) { - int n_planes = data->display.pipes[pipe].n_planes; - for (int planes = 0; planes < n_planes; planes++) - test_plane_position(data, pipe, true, n_planes, - planes, LOCAL_I915_FORMAT_MOD_X_TILED); - } + igt_skip_on(pipe >= data->display.n_pipes); - igt_subtest_f("legacy-pipe-%s-tiling-y-planes", - kmstest_pipe_name(pipe)) { - int n_planes = data->display.pipes[pipe].n_planes; - for (int planes = 0; planes < n_planes; planes++) - test_plane_position(data, pipe, false, n_planes, - planes, LOCAL_I915_FORMAT_MOD_Y_TILED); - } + for_each_valid_output_on_pipe(&data->display, pipe, output) + valid_tests++; - igt_subtest_f("atomic-pipe-%s-tiling-y-planes", - kmstest_pipe_name(pipe)) { - int n_planes = data->display.pipes[pipe].n_planes; - for (int planes = 0; planes < n_planes; planes++) - test_plane_position(data, pipe, true, n_planes, - planes, LOCAL_I915_FORMAT_MOD_Y_TILED); + igt_require_f(valid_tests, "no valid crtc/connector combinations found\n"); + igt_require(data->display.pipes[pipe].n_planes > 0); } - igt_subtest_f("legacy-pipe-%s-tiling-yf-planes", - kmstest_pipe_name(pipe)) { - int n_planes = data->display.pipes[pipe].n_planes; - for (int planes = 0; planes < n_planes; planes++) - test_plane_position(data, pipe, false, n_planes, - planes, LOCAL_I915_FORMAT_MOD_Yf_TILED); - } - igt_subtest_f("atomic-pipe-%s-tiling-yf-planes", - kmstest_pipe_name(pipe)) { - int n_planes = data->display.pipes[pipe].n_planes; - for (int planes = 0; planes < n_planes; planes++) - test_plane_position(data, pipe, true, n_planes, - planes, LOCAL_I915_FORMAT_MOD_Yf_TILED); - } + igt_subtest_f("legacy-pipe-%s-tiling-none", + kmstest_pipe_name(pipe)) + for_each_valid_output_on_pipe(&data->display, pipe, output) + test_plane_position(data, pipe, false, LOCAL_DRM_FORMAT_MOD_NONE); + + igt_subtest_f("atomic-pipe-%s-tiling-none", + kmstest_pipe_name(pipe)) + for_each_valid_output_on_pipe(&data->display, pipe, output) + test_plane_position(data, pipe, true, LOCAL_I915_FORMAT_MOD_X_TILED); + + igt_subtest_f("legacy-pipe-%s-tiling-x", + kmstest_pipe_name(pipe)) + for_each_valid_output_on_pipe(&data->display, pipe, output) + test_plane_position(data, pipe, false, LOCAL_I915_FORMAT_MOD_X_TILED); + + igt_subtest_f("atomic-pipe-%s-tiling-x", + kmstest_pipe_name(pipe)) + for_each_valid_output_on_pipe(&data->display, pipe, output) + test_plane_position(data, pipe, true, LOCAL_I915_FORMAT_MOD_X_TILED); + + igt_subtest_f("legacy-pipe-%s-tiling-y", + kmstest_pipe_name(pipe)) + for_each_valid_output_on_pipe(&data->display, pipe, output) + test_plane_position(data, pipe, false, LOCAL_I915_FORMAT_MOD_Y_TILED); + + igt_subtest_f("atomic-pipe-%s-tiling-y", + kmstest_pipe_name(pipe)) + for_each_valid_output_on_pipe(&data->display, pipe, output) + test_plane_position(data, pipe, true, LOCAL_I915_FORMAT_MOD_Y_TILED); + + igt_subtest_f("legacy-pipe-%s-tiling-yf", + kmstest_pipe_name(pipe)) + for_each_valid_output_on_pipe(&data->display, pipe, output) + test_plane_position(data, pipe, false, LOCAL_I915_FORMAT_MOD_Yf_TILED); + + igt_subtest_f("atomic-pipe-%s-tiling-yf", + kmstest_pipe_name(pipe)) + for_each_valid_output_on_pipe(&data->display, pipe, output) + test_plane_position(data, pipe, true, LOCAL_I915_FORMAT_MOD_Yf_TILED); } static data_t data; @@ -524,10 +510,13 @@ int main(int argc, char *argv[]) kmstest_set_vt_graphics_mode(); igt_require_pipe_crc(); igt_display_init(&data.display, data.drm_fd); + igt_require(data.display.n_pipes > 0); } - for (int pipe = 0; pipe < I915_MAX_PIPES; pipe++) - run_tests_for_pipe_plane(&data, pipe); + for (int pipe = 0; pipe < I915_MAX_PIPES; pipe++) { + igt_subtest_group + run_tests_for_pipe(&data, pipe); + } igt_fixture { igt_display_fini(&data.display);