From patchwork Mon Jan 15 14:28:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maarten Lankhorst X-Patchwork-Id: 10164559 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 CD4F5601C0 for ; Mon, 15 Jan 2018 14:28:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB5AB2842D for ; Mon, 15 Jan 2018 14:28:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AFAA728446; Mon, 15 Jan 2018 14:28:45 +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 1502428475 for ; Mon, 15 Jan 2018 14:28:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CCC426E0FD; Mon, 15 Jan 2018 14:28:40 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mblankhorst.nl (mblankhorst.nl [141.105.120.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 022EE6E0F4 for ; Mon, 15 Jan 2018 14:28:38 +0000 (UTC) From: Maarten Lankhorst To: intel-gfx@lists.freedesktop.org Date: Mon, 15 Jan 2018 15:28:27 +0100 Message-Id: <20180115142834.65798-2-maarten.lankhorst@linux.intel.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180115142834.65798-1-maarten.lankhorst@linux.intel.com> References: <20180115142834.65798-1-maarten.lankhorst@linux.intel.com> Subject: [Intel-gfx] [PATCH i-g-t v3 1/8] tests/kms_plane_scaling: Move the actual test to its own function. 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 We will add more subtests in the future, it's more clear if we split out the actual test to its own function first. Signed-off-by: Maarten Lankhorst Reviewed-by: Mika Kahola --- tests/kms_plane_scaling.c | 226 ++++++++++++++++++++++++---------------------- 1 file changed, 117 insertions(+), 109 deletions(-) diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c index 403df47e2d3b..37e05158b968 100644 --- a/tests/kms_plane_scaling.c +++ b/tests/kms_plane_scaling.c @@ -163,144 +163,151 @@ static void iterate_plane_scaling(data_t *d, drmModeModeInfo *mode) } } -static void test_plane_scaling(data_t *d) +static void +test_plane_scaling_on_pipe(data_t *d, enum pipe pipe, igt_output_t *output) { igt_display_t *display = &d->display; - igt_output_t *output; - enum pipe pipe; - int valid_tests = 0; + drmModeModeInfo *mode; int primary_plane_scaling = 0; /* For now */ - igt_require(d->num_scalers); + igt_output_set_pipe(output, pipe); + mode = igt_output_get_mode(output); + + /* allocate fb2 with image size */ + d->fb_id2 = igt_create_image_fb(d->drm_fd, 0, 0, + DRM_FORMAT_XRGB8888, + LOCAL_I915_FORMAT_MOD_X_TILED, /* tiled */ + FILE_NAME, &d->fb2); + igt_assert(d->fb_id2); + + d->fb_id3 = igt_create_pattern_fb(d->drm_fd, + mode->hdisplay, mode->vdisplay, + DRM_FORMAT_XRGB8888, + LOCAL_I915_FORMAT_MOD_X_TILED, /* tiled */ + &d->fb3); + igt_assert(d->fb_id3); + + /* Set up display with plane 1 */ + d->plane1 = igt_output_get_plane(output, 0); + prepare_crtc(d, output, pipe, d->plane1, mode, COMMIT_UNIVERSAL); + + if (primary_plane_scaling) { + /* Primary plane upscaling */ + igt_fb_set_position(&d->fb1, d->plane1, 100, 100); + igt_fb_set_size(&d->fb1, d->plane1, 500, 500); + igt_plane_set_position(d->plane1, 0, 0); + igt_plane_set_size(d->plane1, mode->hdisplay, mode->vdisplay); + igt_display_commit2(display, COMMIT_UNIVERSAL); - for_each_pipe_with_valid_output(display, pipe, output) { - drmModeModeInfo *mode; - - igt_output_set_pipe(output, pipe); - - mode = igt_output_get_mode(output); - - /* allocate fb2 with image size */ - d->fb_id2 = igt_create_image_fb(d->drm_fd, 0, 0, - DRM_FORMAT_XRGB8888, - LOCAL_I915_FORMAT_MOD_X_TILED, /* tiled */ - FILE_NAME, &d->fb2); - igt_assert(d->fb_id2); - - d->fb_id3 = igt_create_pattern_fb(d->drm_fd, - mode->hdisplay, mode->vdisplay, - DRM_FORMAT_XRGB8888, - LOCAL_I915_FORMAT_MOD_X_TILED, /* tiled */ - &d->fb3); - igt_assert(d->fb_id3); - - /* Set up display with plane 1 */ - d->plane1 = igt_output_get_plane(output, 0); - prepare_crtc(d, output, pipe, d->plane1, mode, COMMIT_UNIVERSAL); - - if (primary_plane_scaling) { - /* Primary plane upscaling */ - igt_fb_set_position(&d->fb1, d->plane1, 100, 100); - igt_fb_set_size(&d->fb1, d->plane1, 500, 500); - igt_plane_set_position(d->plane1, 0, 0); - igt_plane_set_size(d->plane1, mode->hdisplay, mode->vdisplay); - igt_display_commit2(display, COMMIT_UNIVERSAL); + /* Primary plane 1:1 no scaling */ + igt_fb_set_position(&d->fb1, d->plane1, 0, 0); + igt_fb_set_size(&d->fb1, d->plane1, d->fb1.width, d->fb1.height); + igt_plane_set_position(d->plane1, 0, 0); + igt_plane_set_size(d->plane1, mode->hdisplay, mode->vdisplay); + igt_display_commit2(display, COMMIT_UNIVERSAL); + } - /* Primary plane 1:1 no scaling */ - igt_fb_set_position(&d->fb1, d->plane1, 0, 0); - igt_fb_set_size(&d->fb1, d->plane1, d->fb1.width, d->fb1.height); - igt_plane_set_position(d->plane1, 0, 0); - igt_plane_set_size(d->plane1, mode->hdisplay, mode->vdisplay); - igt_display_commit2(display, COMMIT_UNIVERSAL); - } + /* Set up fb2->plane2 mapping. */ + d->plane2 = igt_output_get_plane(output, 1); + igt_plane_set_fb(d->plane2, &d->fb2); - /* Set up fb2->plane2 mapping. */ - d->plane2 = igt_output_get_plane(output, 1); - igt_plane_set_fb(d->plane2, &d->fb2); + /* 2nd plane windowed */ + igt_fb_set_position(&d->fb2, d->plane2, 100, 100); + igt_fb_set_size(&d->fb2, d->plane2, d->fb2.width-200, d->fb2.height-200); + igt_plane_set_position(d->plane2, 100, 100); + igt_plane_set_size(d->plane2, mode->hdisplay-200, mode->vdisplay-200); + igt_display_commit2(display, COMMIT_UNIVERSAL); - /* 2nd plane windowed */ - igt_fb_set_position(&d->fb2, d->plane2, 100, 100); - igt_fb_set_size(&d->fb2, d->plane2, d->fb2.width-200, d->fb2.height-200); - igt_plane_set_position(d->plane2, 100, 100); - igt_plane_set_size(d->plane2, mode->hdisplay-200, mode->vdisplay-200); - igt_display_commit2(display, COMMIT_UNIVERSAL); + iterate_plane_scaling(d, mode); - iterate_plane_scaling(d, mode); + /* 2nd plane up scaling */ + igt_fb_set_position(&d->fb2, d->plane2, 100, 100); + igt_fb_set_size(&d->fb2, d->plane2, 500, 500); + igt_plane_set_position(d->plane2, 10, 10); + igt_plane_set_size(d->plane2, mode->hdisplay-20, mode->vdisplay-20); + igt_display_commit2(display, COMMIT_UNIVERSAL); - /* 2nd plane up scaling */ - igt_fb_set_position(&d->fb2, d->plane2, 100, 100); - igt_fb_set_size(&d->fb2, d->plane2, 500, 500); - igt_plane_set_position(d->plane2, 10, 10); - igt_plane_set_size(d->plane2, mode->hdisplay-20, mode->vdisplay-20); - igt_display_commit2(display, COMMIT_UNIVERSAL); + /* 2nd plane downscaling */ + igt_fb_set_position(&d->fb2, d->plane2, 0, 0); + igt_fb_set_size(&d->fb2, d->plane2, d->fb2.width, d->fb2.height); + igt_plane_set_position(d->plane2, 10, 10); + igt_plane_set_size(d->plane2, 500, 500 * d->fb2.height/d->fb2.width); + igt_display_commit2(display, COMMIT_UNIVERSAL); - /* 2nd plane downscaling */ - igt_fb_set_position(&d->fb2, d->plane2, 0, 0); - igt_fb_set_size(&d->fb2, d->plane2, d->fb2.width, d->fb2.height); - igt_plane_set_position(d->plane2, 10, 10); - igt_plane_set_size(d->plane2, 500, 500 * d->fb2.height/d->fb2.width); + if (primary_plane_scaling) { + /* Primary plane up scaling */ + igt_fb_set_position(&d->fb1, d->plane1, 100, 100); + igt_fb_set_size(&d->fb1, d->plane1, 500, 500); + igt_plane_set_position(d->plane1, 0, 0); + igt_plane_set_size(d->plane1, mode->hdisplay, mode->vdisplay); igt_display_commit2(display, COMMIT_UNIVERSAL); + } - if (primary_plane_scaling) { - /* Primary plane up scaling */ - igt_fb_set_position(&d->fb1, d->plane1, 100, 100); - igt_fb_set_size(&d->fb1, d->plane1, 500, 500); - igt_plane_set_position(d->plane1, 0, 0); - igt_plane_set_size(d->plane1, mode->hdisplay, mode->vdisplay); - igt_display_commit2(display, COMMIT_UNIVERSAL); - } + /* Set up fb3->plane3 mapping. */ + d->plane3 = igt_output_get_plane(output, 2); + igt_plane_set_fb(d->plane3, &d->fb3); + + /* 3rd plane windowed - no scaling */ + igt_fb_set_position(&d->fb3, d->plane3, 100, 100); + igt_fb_set_size(&d->fb3, d->plane3, d->fb3.width-300, d->fb3.height-300); + igt_plane_set_position(d->plane3, 100, 100); + igt_plane_set_size(d->plane3, mode->hdisplay-300, mode->vdisplay-300); + igt_display_commit2(display, COMMIT_UNIVERSAL); - /* Set up fb3->plane3 mapping. */ - d->plane3 = igt_output_get_plane(output, 2); - igt_plane_set_fb(d->plane3, &d->fb3); + /* Switch scaler from plane 2 to plane 3 */ + igt_fb_set_position(&d->fb2, d->plane2, 100, 100); + igt_fb_set_size(&d->fb2, d->plane2, d->fb2.width-200, d->fb2.height-200); + igt_plane_set_position(d->plane2, 100, 100); + igt_plane_set_size(d->plane2, d->fb2.width-200, d->fb2.height-200); - /* 3rd plane windowed - no scaling */ - igt_fb_set_position(&d->fb3, d->plane3, 100, 100); - igt_fb_set_size(&d->fb3, d->plane3, d->fb3.width-300, d->fb3.height-300); - igt_plane_set_position(d->plane3, 100, 100); - igt_plane_set_size(d->plane3, mode->hdisplay-300, mode->vdisplay-300); - igt_display_commit2(display, COMMIT_UNIVERSAL); + igt_fb_set_position(&d->fb3, d->plane3, 100, 100); + igt_fb_set_size(&d->fb3, d->plane3, d->fb3.width-400, d->fb3.height-400); + igt_plane_set_position(d->plane3, 10, 10); + igt_plane_set_size(d->plane3, mode->hdisplay-300, mode->vdisplay-300); + igt_display_commit2(display, COMMIT_UNIVERSAL); + + if (primary_plane_scaling) { + /* Switch scaler from plane 1 to plane 2 */ + igt_fb_set_position(&d->fb1, d->plane1, 0, 0); + igt_fb_set_size(&d->fb1, d->plane1, d->fb1.width, d->fb1.height); + igt_plane_set_position(d->plane1, 0, 0); + igt_plane_set_size(d->plane1, mode->hdisplay, mode->vdisplay); - /* Switch scaler from plane 2 to plane 3 */ igt_fb_set_position(&d->fb2, d->plane2, 100, 100); - igt_fb_set_size(&d->fb2, d->plane2, d->fb2.width-200, d->fb2.height-200); + igt_fb_set_size(&d->fb2, d->plane2, d->fb2.width-500,d->fb2.height-500); igt_plane_set_position(d->plane2, 100, 100); - igt_plane_set_size(d->plane2, d->fb2.width-200, d->fb2.height-200); - - igt_fb_set_position(&d->fb3, d->plane3, 100, 100); - igt_fb_set_size(&d->fb3, d->plane3, d->fb3.width-400, d->fb3.height-400); - igt_plane_set_position(d->plane3, 10, 10); - igt_plane_set_size(d->plane3, mode->hdisplay-300, mode->vdisplay-300); + igt_plane_set_size(d->plane2, mode->hdisplay-200, mode->vdisplay-200); igt_display_commit2(display, COMMIT_UNIVERSAL); + } - if (primary_plane_scaling) { - /* Switch scaler from plane 1 to plane 2 */ - igt_fb_set_position(&d->fb1, d->plane1, 0, 0); - igt_fb_set_size(&d->fb1, d->plane1, d->fb1.width, d->fb1.height); - igt_plane_set_position(d->plane1, 0, 0); - igt_plane_set_size(d->plane1, mode->hdisplay, mode->vdisplay); - - igt_fb_set_position(&d->fb2, d->plane2, 100, 100); - igt_fb_set_size(&d->fb2, d->plane2, d->fb2.width-500,d->fb2.height-500); - igt_plane_set_position(d->plane2, 100, 100); - igt_plane_set_size(d->plane2, mode->hdisplay-200, mode->vdisplay-200); - igt_display_commit2(display, COMMIT_UNIVERSAL); - } + /* back to single plane mode */ + igt_plane_set_fb(d->plane2, NULL); + igt_plane_set_fb(d->plane3, NULL); + igt_display_commit2(display, COMMIT_UNIVERSAL); - /* back to single plane mode */ - igt_plane_set_fb(d->plane2, NULL); - igt_plane_set_fb(d->plane3, NULL); - igt_display_commit2(display, COMMIT_UNIVERSAL); + cleanup_crtc(d, output, d->plane1); +} +static void test_plane_scaling(data_t *d, enum pipe pipe) +{ + igt_output_t *output; + int valid_tests = 0; + + igt_require(d->num_scalers); + + for_each_valid_output_on_pipe(&d->display, pipe, output) { + test_plane_scaling_on_pipe(d, pipe, output); + igt_output_set_pipe(output, PIPE_ANY); valid_tests++; - cleanup_crtc(d, output, d->plane1); } + igt_require_f(valid_tests, "no valid crtc/connector combinations found\n"); } igt_simple_main { data_t data = {}; + enum pipe pipe; igt_skip_on_simulation(); @@ -312,7 +319,8 @@ igt_simple_main data.num_scalers = intel_gen(data.devid) >= 9 ? 2 : 0; - test_plane_scaling(&data); + for_each_pipe_static(pipe) + test_plane_scaling(&data, pipe); igt_display_fini(&data.display); }