From patchwork Mon Oct 5 21:21:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zanoni, Paulo R" X-Patchwork-Id: 7331861 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 54B2C9F32B for ; Mon, 5 Oct 2015 21:21:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7EF362060B for ; Mon, 5 Oct 2015 21:21:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 827F820615 for ; Mon, 5 Oct 2015 21:21:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 20EAF6E8D7; Mon, 5 Oct 2015 14:21:47 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTP id 195E06E8D7 for ; Mon, 5 Oct 2015 14:21:46 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 05 Oct 2015 14:21:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,640,1437462000"; d="scan'208";a="804263082" Received: from khauck-mobl.amr.corp.intel.com (HELO panetone.amr.corp.intel.com) ([10.254.102.83]) by fmsmga001.fm.intel.com with ESMTP; 05 Oct 2015 14:21:28 -0700 From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Mon, 5 Oct 2015 18:21:11 -0300 Message-Id: <1444080071-29070-6-git-send-email-paulo.r.zanoni@intel.com> X-Mailer: git-send-email 2.5.3 In-Reply-To: <1444080071-29070-1-git-send-email-paulo.r.zanoni@intel.com> References: <1444080071-29070-1-git-send-email-paulo.r.zanoni@intel.com> Subject: [Intel-gfx] [PATCH igt 6/6] kms_frontbuffer_tracking: add fliptrack subtest 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The current upstream Kernel code stops and then restarts FBC at every page flip. I am working on patches to keep FBC enabled all the time, so this brings the possibility of having the hardware tracking mechanism looking at the old buffer instead of the new one. This test should catch this problem. Signed-off-by: Paulo Zanoni --- tests/kms_frontbuffer_tracking.c | 63 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c index 94b9e01..d97e148 100644 --- a/tests/kms_frontbuffer_tracking.c +++ b/tests/kms_frontbuffer_tracking.c @@ -2265,6 +2265,54 @@ static void flip_subtest(const struct test_mode *t, enum flip_type type) } /* + * fliptrack - check if the hardware tracking works after page flips + * + * METHOD + * Flip to a new buffer, then draw on it using MMAP_GTT and check the CRC to + * make sure the hardware tracking detected the write. + * + * EXPECTED RESULTS + * Everything works as expected, screen contents are properly updated. + * + * FAILURES + * First you need to check if the draw and flip subtests pass. Only after both + * are passing this test can be useful. If we're failing only on this subtest, + * then maybe we are not properly updating the hardware tracking registers + * during the flip operations. + */ +static void fliptrack_subtest(const struct test_mode *t, enum flip_type type) +{ + int r; + struct igt_fb fb2, *orig_fb; + struct modeset_params *params = pick_params(t); + struct draw_pattern_info *pattern = &pattern1; + + prepare_subtest(t, pattern); + + create_fb(t->format, params->fb.fb->width, params->fb.fb->height, + LOCAL_I915_FORMAT_MOD_X_TILED, t->plane, &fb2); + fill_fb(&fb2, COLOR_PRIM_BG); + orig_fb = params->fb.fb; + + for (r = 0; r < pattern->n_rects; r++) { + params->fb.fb = (r % 2 == 0) ? &fb2 : orig_fb; + + if (r != 0) + draw_rect(pattern, ¶ms->fb, t->method, r - 1); + + page_flip_for_params(params, type); + do_assertions(0); + + draw_rect(pattern, ¶ms->fb, t->method, r); + update_wanted_crc(t, &pattern->crcs[t->format][r]); + + do_assertions(ASSERT_PSR_DISABLED); + } + + igt_remove_fb(drm.fd, &fb2); +} + +/* * move - just move the sprite or cursor around * * METHOD @@ -3098,6 +3146,21 @@ int main(int argc, char *argv[]) fbs_str(t.fbs), igt_draw_get_method_name(t.method)) flip_subtest(&t, FLIP_MODESET); + + TEST_MODE_ITER_END + + TEST_MODE_ITER_BEGIN(t) + if (t.plane != PLANE_PRI || + t.screen != SCREEN_PRIM || + t.method != IGT_DRAW_MMAP_GTT || + (t.feature & FEATURE_FBC) == 0) + continue; + + igt_subtest_f("%s-%s-%s-fliptrack", + feature_str(t.feature), + pipes_str(t.pipes), + fbs_str(t.fbs)) + fliptrack_subtest(&t, FLIP_PAGEFLIP); TEST_MODE_ITER_END TEST_MODE_ITER_BEGIN(t)