From patchwork Mon Nov 14 09:59:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9426979 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 D138860471 for ; Mon, 14 Nov 2016 10:00:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C583B286D4 for ; Mon, 14 Nov 2016 10:00:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B97D0286FE; Mon, 14 Nov 2016 10:00:53 +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 3A60E286D4 for ; Mon, 14 Nov 2016 10:00:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6D6586E3CC; Mon, 14 Nov 2016 10:00:09 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pg0-f65.google.com (mail-pg0-f65.google.com [74.125.83.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5BE306E3C1; Mon, 14 Nov 2016 10:00:05 +0000 (UTC) Received: by mail-pg0-f65.google.com with SMTP id e9so8270761pgc.1; Mon, 14 Nov 2016 02:00:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zbAz9jC25HZX1V53gsQ7qUi6i2yO4B9a6Me7LGmA2O8=; b=GrEzx1rlqkA+bSOaQc00wXrprkEQRnShxMVDgyUhNM39x/Cfy740j0ClwFGQUoR1pG fLCm+LzNN2kN2iKAJ7fRuVrt8qL5K0N6+k8c2EdBnVyI0H7jUQ6C8sva8eVaH4aDAxv1 1+LKJ2EGRNNmarrUV1qUWAgapNZ40tfb5A464W9rqJZHEZMZcbJ7nQSN2EiCt9gWHCdM mFWwiNJATxwkbBrSI+I3CowPAukAJjh4cgsTjtOnibBve4Dkt66oNbEpJwksTO0GlDAi hAlv9XMeaTykJLEXPogrY9VApbtI+jjeNC8Uyzb3Uo5nKSs4zx51xftYs2OXLJ95PSEl K9OA== X-Gm-Message-State: ABUngvdYhqE4EETGRgYxpcy1HkoyazzWEFfGNTxElfoxhnVo65/5oI4radQ8wBTxYU00dQ== X-Received: by 10.98.9.149 with SMTP id 21mr35053680pfj.159.1479117604682; Mon, 14 Nov 2016 02:00:04 -0800 (PST) Received: from jade.nodan1.kt.home.ne.jp (202-72-64-164.koalanet.ne.jp. [202.72.64.164]) by smtp.gmail.com with ESMTPSA id p125sm14320235pfg.33.2016.11.14.01.59.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Nov 2016 02:00:00 -0800 (PST) From: Gustavo Padovan To: intel-gfx@lists.freedesktop.org Date: Mon, 14 Nov 2016 18:59:24 +0900 Message-Id: <1479117566-17709-13-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1479117566-17709-1-git-send-email-gustavo@padovan.org> References: <1479117566-17709-1-git-send-email-gustavo@padovan.org> Cc: Gustavo Padovan , dri-devel@lists.freedesktop.org Subject: [Intel-gfx] [PATCH 10/12] tests/kms_atomic_transition: add out_fences tests 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 From: Gustavo Padovan Signed-off-by: Gustavo Padovan --- lib/igt_kms.c | 22 ++++++++++++++++++++++ tests/kms_atomic_transition.c | 30 ++++++++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index f25e1eb..9271ab4 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -49,6 +49,7 @@ #include "intel_chipset.h" #include "igt_debugfs.h" #include "igt_sysfs.h" +#include "sw_sync.h" /** * SECTION:igt_kms @@ -2183,6 +2184,27 @@ static int igt_atomic_commit(igt_display_t *display, uint32_t flags, void *user_ } ret = drmModeAtomicCommit(display->drm_fd, req, flags, user_data); + if (!ret) { + uint64_t *fence_ptr; + + for_each_pipe(display, pipe) { + igt_pipe_t *pipe_obj = &display->pipes[pipe]; + + fence_ptr = (uint64_t *)pipe_obj->out_fence_ptr; + if (!fence_ptr) + continue; + + if (flags & DRM_MODE_ATOMIC_TEST_ONLY) { + igt_assert(*fence_ptr == -1); + } else { + igt_assert(*fence_ptr >= 0); + ret = sw_sync_wait(*fence_ptr, 1000); + igt_assert(ret == 0); + close(*fence_ptr); + } + } + } + drmModeAtomicFree(req); return ret; diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c index 8bef85d..507f526 100644 --- a/tests/kms_atomic_transition.c +++ b/tests/kms_atomic_transition.c @@ -132,6 +132,7 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output struct plane_parms parms[IGT_MAX_PLANES]; bool skip_test = false; unsigned flags = DRM_MODE_PAGE_FLIP_EVENT; + int out_fence, ret; if (nonblocking) flags |= DRM_MODE_ATOMIC_NONBLOCK; @@ -198,9 +199,10 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output * planes to fix this */ while (1) { - int ret; - wm_setup_plane(display, pipe, iter_max - 1, parms); + + if (fencing) + igt_pipe_set_out_fence_ptr(&display->pipes[pipe], &out_fence); ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL); if (ret != -EINVAL || n_planes < 3) @@ -231,6 +233,9 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output wm_setup_plane(display, pipe, i, parms); + if (fencing) + igt_pipe_set_out_fence_ptr(&display->pipes[pipe], &out_fence); + igt_display_commit_atomic(display, flags, (void *)(unsigned long)i); drmHandleEvent(display->drm_fd, &drm_events); @@ -239,6 +244,9 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output wm_setup_plane(display, pipe, 0, parms); + if (fencing) + igt_pipe_set_out_fence_ptr(&display->pipes[pipe], &out_fence); + igt_display_commit_atomic(display, flags, (void *)0UL); drmHandleEvent(display->drm_fd, &drm_events); @@ -252,6 +260,9 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output if (type == TRANSITION_MODESET) igt_output_override_mode(output, &override_mode); + if (fencing) + igt_pipe_set_out_fence_ptr(&display->pipes[pipe], &out_fence); + igt_display_commit_atomic(display, flags, (void *)(unsigned long)j); drmHandleEvent(display->drm_fd, &drm_events); @@ -259,6 +270,9 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output if (type == TRANSITION_MODESET) igt_output_override_mode(output, NULL); + if (fencing) + igt_pipe_set_out_fence_ptr(&display->pipes[pipe], &out_fence); + igt_display_commit_atomic(display, flags, (void *)(unsigned long)i); drmHandleEvent(display->drm_fd, &drm_events); } @@ -594,14 +608,26 @@ igt_main for_each_pipe_with_valid_output(&display, pipe, output) run_transition_test(&display, pipe, output, TRANSITION_PLANES, false, false); + igt_subtest("plane-all-transition-fencing") + for_each_pipe_with_valid_output(&display, pipe, output) + run_transition_test(&display, pipe, output, TRANSITION_PLANES, false, true); + igt_subtest("plane-all-transition-nonblocking") for_each_pipe_with_valid_output(&display, pipe, output) run_transition_test(&display, pipe, output, TRANSITION_PLANES, true, false); + igt_subtest("plane-all-transition-nonblocking-fencing") + for_each_pipe_with_valid_output(&display, pipe, output) + run_transition_test(&display, pipe, output, TRANSITION_PLANES, true, true); + igt_subtest("plane-all-modeset-transition") for_each_pipe_with_valid_output(&display, pipe, output) run_transition_test(&display, pipe, output, TRANSITION_MODESET, false, false); + igt_subtest("plane-all-modeset-transition-fencing") + for_each_pipe_with_valid_output(&display, pipe, output) + run_transition_test(&display, pipe, output, TRANSITION_MODESET, false, true); + igt_subtest("plane-toggle-modeset-transition") for_each_pipe_with_valid_output(&display, pipe, output) run_transition_test(&display, pipe, output, TRANSITION_MODESET_DISABLE, false, false);