From patchwork Thu Jun 13 02:19:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Siqueira X-Patchwork-Id: 10991045 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BD17813AF for ; Thu, 13 Jun 2019 02:19:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A000F28A0B for ; Thu, 13 Jun 2019 02:19:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E2CD28A08; Thu, 13 Jun 2019 02:19:13 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,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 2D02A28A0B for ; Thu, 13 Jun 2019 02:19:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4DC5089296; Thu, 13 Jun 2019 02:19:10 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id B8443891AC; Thu, 13 Jun 2019 02:19:08 +0000 (UTC) Received: by mail-ed1-x544.google.com with SMTP id z25so28778287edq.9; Wed, 12 Jun 2019 19:19:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=cllX64Dw/hhsJxsGolxrZB/NK6wL+pKC8OwL/popBDg=; b=amYGgptFW3ZkFx+ONyFSMz6BI9u7/rpoyQT8fWQlufkMvAyPPRhidcl9aq9L26QpBN peiuzPNhS/dugOu1zsRZfFwHjIKHV3Yg03GJhJf8DENSdaaJd7R/nklQMg7/4uxQLzzE pb8j8rFQgpAGou7cdInfFVEofV4JlwpKY7H6ZA/8bZaV45b6LRLI6UM9IQkiCJ40ftrw 8BOJPSRlHXb27sYAxDbXvZM+ra9QLSEfcTuc7jPehUkznUIp0viGbjTJjhq3y36d9mKA DZcFBpkIUpF/hscGVdm3jXRj8imTtOmpSG1VAre/5Y1K9hXi1XXNUA/fu13Ex0UGzZOE 0Tgw== X-Gm-Message-State: APjAAAVZcA82qnHH4jAZnK5ReON5me8XPtAHLaac7aiX9NpU6Su6WF9r 843DrQj3sCAZXEIT3WBlXWJuU9y7bvY= X-Google-Smtp-Source: APXvYqwkh7fTXUX7EguW0zgc5hIJDyb7jQiS2JvgIheDce9Dsfdue7tp1j816Rdy8L4Jp/Sm1Gy1sA== X-Received: by 2002:a50:b3d0:: with SMTP id t16mr22876994edd.158.1560392347369; Wed, 12 Jun 2019 19:19:07 -0700 (PDT) Received: from smtp.gmail.com ([187.121.151.146]) by smtp.gmail.com with ESMTPSA id s11sm270611ejo.51.2019.06.12.19.19.03 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 12 Jun 2019 19:19:06 -0700 (PDT) From: Brian Starkey X-Google-Original-From: Brian Starkey Date: Wed, 12 Jun 2019 23:19:01 -0300 To: Brian Starkey , Liviu Dudau , Petri Latvala , Arkadiusz Hiler , Daniel Vetter Message-ID: <454e4369191d599d038196429af4a242f4f0e5fb.1560374714.git.rodrigosiqueiramelo@gmail.com> References: MIME-Version: 1.0 In-Reply-To: User-Agent: NeoMutt/20180716 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=cllX64Dw/hhsJxsGolxrZB/NK6wL+pKC8OwL/popBDg=; b=CFS9TcjTapFrv7T3VuvLMYioyrrr+OHnu9iOt2u9fIWSbkLHDYStFqjzm6JNl98DRP hFK7r8aSPxp4W88BCMkFYa3i0XoUycvhgiiDcbazRi+2XOiRXU768Zk8d9b8IXG2/WXC qO/IHmtVTvoNQwKb5uW1V/qdHCaVu/omk+h+aXnMZEaJBJJZxkuvwL0meuoZYWNn3eot PA+pLrLfoazvb3lbJNXO6oJ6M6BadSb+agnJbyZs1MazkvAzEGug5vaxFk0ONBeOmNO4 IXPHbq42VPVIhcbM9b1b0TID9FwcRGcUR5WvjXMZvQy8eHpWbXP4gdL8BljKBTYu6/K+ mkew== Subject: [Intel-gfx] [PATCH V6 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: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, nd Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP 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 [rebased and addressed comments by Maarten] Signed-off-by: Liviu Dudau --- tests/kms_writeback.c | 64 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 59 insertions(+), 5 deletions(-) diff --git a/tests/kms_writeback.c b/tests/kms_writeback.c index 0f20dadd..ae536bbf 100644 --- a/tests/kms_writeback.c +++ b/tests/kms_writeback.c @@ -51,7 +51,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; @@ -91,6 +92,30 @@ 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); + igt_output_override_mode(output, &override_mode); + 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); + igt_debug("try_commit_atomic clone returned %d\n", newret); + if (!newret) { + *clone = second_output; + igt_debug("Selected clone %s\n", (*clone)->name); + break; + } + } + } + } igt_plane_set_fb(plane, NULL); igt_remove_fb(display->drm_fd, &input_fb); igt_remove_fb(display->drm_fd, &output_fb); @@ -98,7 +123,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; @@ -114,10 +140,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; } } @@ -335,10 +367,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)); @@ -353,7 +386,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) @@ -431,6 +464,27 @@ 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); + igt_output_override_mode(clone, &mode); + + 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);