From patchwork Fri Jul 14 15:18:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 107810 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1034994qge; Fri, 14 Jul 2017 08:19:53 -0700 (PDT) X-Received: by 10.98.163.203 with SMTP id q72mr5735316pfl.97.1500045593630; Fri, 14 Jul 2017 08:19:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500045593; cv=none; d=google.com; s=arc-20160816; b=V/SDGL9UmImstAsBnDHMgDymzLG9Lhyod7wLwKZSJLCyctWxcimySAjsIAYu9Lwxti aC47xOqB3we9GSjKCIFD5DiT3gwFgMsmrIZHUmSzV5r1p1wUEtOF2EAXPR6BscL+6/34 io+aJOZTzHXbEhKR3TUC1bxWpYYrpckjSUslz+tCp2ZMhcYAoKu+XfcMVnpUugwhollS hU8RcesoNFedvlI/E+makxC3Yphdni2IUMYSgiu1SUJTzoAkJH6FoicVIJcV2mKZGS+o zYyIkhVFGg83WSNII3gm1rxeum3CmlblrU0D3xryoMvO45zlprToiaanDRmI1fU+xxXU bs4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:references:in-reply-to:message-id:date :subject:to:from:delivered-to:arc-authentication-results; bh=9MEeHweagjgnQiY2XY+EeqUS8DZImB1SQd69tR8CN54=; b=aljyL7dw7Igw4IYNzBTRVhIcF5Rigb/KTbTbxY3QtXwL/AeP4lHQ+vWiGMTfB3cFKo 668Mr8MH0k7Lu1vJg0cQ6aDOBMQpeBPEEOp557ZUizI64LM8IxXIQjUxH7vOqEqVt6Z9 L+de2nzEIwsxQ4WWTo/+4wzl54sBOd2nURuEbwWYWtS2peSE7n+lzm58UoMX/Sv16Igx mv5R6lAo5CIYqheC2MHm5ZPw0YhWUB0HaV/LtNI1z31bvr79TQeTjM9LWsqniQSeqon2 k3Bj4Z5/5WIbXTcEIpUAQMqAK95uKnI9I1LRbguXiWKkT4CecmAneV8iE2WujnFEiBLw TTyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id 36si7298077pla.124.2017.07.14.08.19.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jul 2017 08:19:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6320C6E898; Fri, 14 Jul 2017 15:19:14 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@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 B826A6E86E; Fri, 14 Jul 2017 15:19:01 +0000 (UTC) Received: from e110455-lin.cambridge.arm.com (e110455-lin.cambridge.arm.com [10.2.131.9]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id v6EFIuFQ000867; Fri, 14 Jul 2017 16:18:57 +0100 From: Liviu Dudau To: Intel GFX discussion Subject: [PATCH i-g-t v2 7/7] kms_writeback: Add tests using a cloned output Date: Fri, 14 Jul 2017 16:18:56 +0100 Message-Id: <20170714151856.32041-8-liviu.dudau@arm.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170714151856.32041-1-liviu.dudau@arm.com> References: <20170714151856.32041-1-liviu.dudau@arm.com> Cc: Boris Brezillon , DRI devel X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 | 63 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 55 insertions(+), 8 deletions(-) diff --git a/tests/kms_writeback.c b/tests/kms_writeback.c index 8201a81c..9a34bca0 100644 --- a/tests/kms_writeback.c +++ b/tests/kms_writeback.c @@ -81,7 +81,8 @@ static uint32_t pick_writeback_format(igt_output_t *output) return format; } -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; @@ -123,6 +124,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); @@ -130,7 +152,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; @@ -146,10 +169,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; } } @@ -190,9 +219,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) { @@ -391,10 +417,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)); @@ -409,7 +436,7 @@ 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) @@ -487,6 +514,26 @@ 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); + + 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);