From patchwork Thu Mar 1 17:38:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 10252127 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 6FDF660211 for ; Thu, 1 Mar 2018 17:51:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6146C283D1 for ; Thu, 1 Mar 2018 17:51:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5619B283F5; Thu, 1 Mar 2018 17:51:37 +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 D0F46283D1 for ; Thu, 1 Mar 2018 17:51:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D82E76ED41; Thu, 1 Mar 2018 17:51:33 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from cam-smtp0.cambridge.arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by gabe.freedesktop.org (Postfix) with ESMTPS id D046F6ED38; Thu, 1 Mar 2018 17:51:31 +0000 (UTC) Received: from e110455-lin.cambridge.arm.com (e110455-lin.cambridge.arm.com [10.2.131.15]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id w21HcWgV006311; Thu, 1 Mar 2018 17:38:33 GMT From: Liviu Dudau To: i-g-t Date: Thu, 1 Mar 2018 17:38:32 +0000 Message-Id: <20180301173832.9654-7-liviu.dudau@arm.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180301173832.9654-1-liviu.dudau@arm.com> References: <20180301173832.9654-1-liviu.dudau@arm.com> Subject: [Intel-gfx] [PATCH i-g-t 6/6] kms_writeback: Add tests using a cloned output X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Intel GFX ML , Rob Clark MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Brian Starkey Update the connector search to also optionally attempt to find a non-writeback connector to clone to. Add a subtest which is the same as writeback-check-output, but also clones to the second connector. Signed-off-by: Brian Starkey --- tests/kms_writeback.c | 76 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 66 insertions(+), 10 deletions(-) diff --git a/tests/kms_writeback.c b/tests/kms_writeback.c index af896e05..5da7086f 100644 --- a/tests/kms_writeback.c +++ b/tests/kms_writeback.c @@ -56,7 +56,8 @@ static drmModePropertyBlobRes *get_writeback_formats_blob(igt_output_t *output) return blob; } -static bool check_writeback_config(igt_display_t *display, igt_output_t *output) +static bool check_writeback_config(igt_display_t *display, igt_output_t *output, + int pipe, igt_output_t **clone) { igt_fb_t input_fb, output_fb; igt_plane_t *plane; @@ -98,6 +99,27 @@ static bool check_writeback_config(igt_display_t *display, igt_output_t *output) ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL); + if (!ret && clone) { + /* Try and find a clone */ + int i, newret; + *clone = NULL; + + for (i = 0; i < display->n_outputs; i++) { + igt_output_t *second_output = &display->outputs[i]; + if (output != second_output && + igt_pipe_connector_valid(pipe, second_output)) { + + igt_output_clone_pipe(second_output, pipe); + newret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_TEST_ONLY | + DRM_MODE_ATOMIC_ALLOW_MODESET, NULL); + igt_output_set_pipe(second_output, PIPE_NONE); + if (!newret) { + *clone = second_output; + break; + } + } + } + } igt_plane_set_fb(plane, NULL); igt_remove_fb(display->drm_fd, &input_fb); igt_remove_fb(display->drm_fd, &output_fb); @@ -105,7 +127,8 @@ static bool check_writeback_config(igt_display_t *display, igt_output_t *output) return !ret; } -static igt_output_t *kms_writeback_get_output(igt_display_t *display) +static igt_output_t *kms_writeback_get_output(igt_display_t *display, enum pipe *pipe, + igt_output_t **clone) { int i; @@ -121,10 +144,16 @@ static igt_output_t *kms_writeback_get_output(igt_display_t *display) for (j = 0; j < igt_display_get_n_pipes(display); j++) { igt_output_set_pipe(output, j); - if (check_writeback_config(display, output)) { + if (check_writeback_config(display, output, j, clone)) { igt_debug("Using connector %u:%s on pipe %d\n", output->config.connector->connector_id, output->name, j); + if (clone && *clone) + igt_debug("Cloning to connector %u:%s\n", + (*clone)->config.connector->connector_id, + (*clone)->name); + if (pipe) + *pipe = j; return output; } } @@ -165,9 +194,6 @@ static int do_writeback_test(igt_output_t *output, uint32_t flags, igt_pipe_t *pipe_obj = &display->pipes[pipe]; igt_plane_t *plane; - /* - * Add CRTC Properties to the property set - */ igt_atomic_prepare_crtc_commit(pipe_obj, req); for_each_plane_on_pipe(display, pipe, plane) { @@ -311,6 +337,9 @@ static void writeback_seqence(igt_output_t *output, igt_plane_t *plane, /* Commit */ igt_plane_set_fb(plane, in_fb); igt_output_set_writeback_fb(output, out_fbs[i]); + igt_output_set_prop_value(output, IGT_CONNECTOR_WRITEBACK_FB_ID, + out_fbs[i] ? out_fbs[i]->fb_id : 0); + if (out_fbs[i]) igt_output_request_writeback_out_fence(output); igt_display_commit_atomic(output->display, @@ -372,10 +401,11 @@ static void writeback_check_output(igt_output_t *output, igt_plane_t *plane, igt_main { igt_display_t display; - igt_output_t *output; + igt_output_t *output, *clone; igt_plane_t *plane; igt_fb_t input_fb; drmModeModeInfo mode; + enum pipe pipe; int ret; memset(&display, 0, sizeof(display)); @@ -390,12 +420,13 @@ igt_main igt_require(display.is_atomic); - output = kms_writeback_get_output(&display); + output = kms_writeback_get_output(&display, &pipe, &clone); igt_require(output); - if (output->use_override_mode) + if (output->use_override_mode) { memcpy(&mode, &output->override_mode, sizeof(mode)); - else + igt_output_override_mode(output, &mode); + } else memcpy(&mode, &output->config.default_mode, sizeof(mode)); plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY); @@ -468,6 +499,31 @@ igt_main igt_remove_fb(display.drm_fd, &output_fb); } + igt_subtest("writeback-check-output-clone") { + igt_fb_t output_fb; + + igt_require(clone); + + ret = igt_create_fb(display.drm_fd, mode.hdisplay, mode.vdisplay, + DRM_FORMAT_XRGB8888, + igt_fb_mod_to_tiling(0), + &output_fb); + igt_require(ret > 0); + + /* + * ToDo: this should be forcing the other pipe to be a clone + * of the writeback pipe, but it doesn't seem to happen. + * Need to investigate the reason + */ + //igt_output_clone_pipe(clone, pipe); + + writeback_check_output(output, plane, &input_fb, &output_fb); + + igt_output_set_pipe(clone, PIPE_NONE); + + igt_remove_fb(display.drm_fd, &output_fb); + } + igt_fixture { igt_remove_fb(display.drm_fd, &input_fb); igt_display_fini(&display);