From patchwork Thu Aug 23 17:18:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Siqueira X-Patchwork-Id: 10574433 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 AEEF813B8 for ; Thu, 23 Aug 2018 17:18:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D1FD2C3C6 for ; Thu, 23 Aug 2018 17:18:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 817BE2C3CD; Thu, 23 Aug 2018 17:18:55 +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 09C592C3C6 for ; Thu, 23 Aug 2018 17:18:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E874C6E567; Thu, 23 Aug 2018 17:18:53 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qt0-x241.google.com (mail-qt0-x241.google.com [IPv6:2607:f8b0:400d:c0d::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 65A5F6E567; Thu, 23 Aug 2018 17:18:53 +0000 (UTC) Received: by mail-qt0-x241.google.com with SMTP id g44-v6so6434379qtb.12; Thu, 23 Aug 2018 10:18:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:user-agent; bh=g25b3M3Mkw32FWQCWmtBw5aEAlfOWaEQyDh1NvaXD0Q=; b=pqA5qUWX+d06FwTZypR+C7Jo/MLEzMZyu7MnRCTcoiri1Ni61o1l76SnQBTPy5tsg1 gOWEQUv3hYK9Cx+EGJ44JFNqMgM94wnTKUltJgbQDkpWlSLehIPfiN6mUOczPzq4g0DM xhdPajsAYjWr1lSCZEtCWEGqjH59lMyNooU7n4stB9NKc23YrhC4/19Ekw2eVK8FcyB7 e0X5ypW1B9/ehPncR0j9QOGKXL9IG/lL1li1/I1h4zjRron3HTZoT3ba9BDloq+oSLen lCM76oYC0Y4CERsyGx7+fCQXAcsdLMNiW8XxPTMCZ5ParfkWDxmk99BTI50bFdf2tvcy IKnA== X-Gm-Message-State: APzg51DNjCnUtfEu4Yn6dpPl4ZD8LFuelQZUYdPJ/1NT4C2gEGzezee7 gi+unZvEkX5QgeMf0U5g4ms= X-Google-Smtp-Source: ANB0VdbPUNqADC61I9dblPezwiMeWKe4njs7u4Sd2ANDV51CoCJYf0CXQ+tl1+5gotim5yCgVJRckw== X-Received: by 2002:a0c:acf3:: with SMTP id n48-v6mr3848286qvc.227.1535044732514; Thu, 23 Aug 2018 10:18:52 -0700 (PDT) Received: from smtp.gmail.com ([143.107.45.1]) by smtp.gmail.com with ESMTPSA id l10-v6sm2571540qkk.49.2018.08.23.10.18.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Aug 2018 10:18:51 -0700 (PDT) Date: Thu, 23 Aug 2018 14:18:48 -0300 From: Rodrigo Siqueira To: Petri Latvala , Arkadiusz Hiler Message-ID: <20180823171848.tchxz5iuhrjlbkh4@smtp.gmail.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20180716 Subject: [Intel-gfx] [PATCH V2 i-g-t] Skip VBlank tests in modules without VBlank 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 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP The kms_flip test does not support drivers without VBlank which exclude some virtual drivers. This patch adds a function that checks if a module has a VBlank or not; if a module has VBlank than kms_flip will execute all the VBlank tests, otherwise, VBlank tests will be skipped. Changes since V1: Chris Wilson: - Change function name from igt_there_is_vblank to kms_has_vblank - Move vblank function check from igt_aux to igt_kms - Utilizes memset in dummy_vbl variable - Directly return the result of drmWaitVblank() Signed-off-by: Rodrigo Siqueira --- lib/igt_kms.c | 10 ++++++++++ lib/igt_kms.h | 2 ++ tests/kms_flip.c | 26 ++++++++++++++++++++++++-- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index c9e00c3b..21636093 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -1684,6 +1684,16 @@ void igt_assert_plane_visible(int fd, enum pipe pipe, bool visibility) igt_assert_eq(visible, visibility); } +bool kms_has_vblank(int fd) +{ + drmVBlank dummy_vbl; + + memset(&dummy_vbl, 0, sizeof(drmVBlank)); + dummy_vbl.request.type = DRM_VBLANK_ABSOLUTE; + + return drmWaitVBlank(fd, &dummy_vbl) == 0; +} + /* * A small modeset API */ diff --git a/lib/igt_kms.h b/lib/igt_kms.h index 4222a341..9543debd 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -226,6 +226,8 @@ void kmstest_wait_for_pageflip(int fd); unsigned int kmstest_get_vblank(int fd, int pipe, unsigned int flags); void igt_assert_plane_visible(int fd, enum pipe pipe, bool visibility); +bool kms_has_vblank(int fd); + /* * A small modeset API */ diff --git a/tests/kms_flip.c b/tests/kms_flip.c index 393d690a..13b408a6 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -73,6 +73,7 @@ #define TEST_TS_CONT (1 << 27) #define TEST_BO_TOOBIG (1 << 28) +#define TEST_NO_VBLANK (1 << 29) #define TEST_BASIC (1 << 30) #define EVENT_FLIP (1 << 0) @@ -125,6 +126,18 @@ struct event_state { int seq_step; }; +static bool vblank_dependence(int flags) +{ + int vblank_flags = TEST_VBLANK | TEST_VBLANK_BLOCK | + TEST_VBLANK_ABSOLUTE | TEST_VBLANK_EXPIRED_SEQ | + TEST_TS_CONT | TEST_CHECK_TS | TEST_VBLANK_RACE; + + if (flags & vblank_flags) + return true; + + return false; +} + static float timeval_float(const struct timeval *tv) { return tv->tv_sec + tv->tv_usec / 1000000.0f; @@ -493,11 +506,11 @@ static void check_state(const struct test_output *o, const struct event_state *e /* check only valid if no modeset happens in between, that increments by * (1 << 23) on each step. This bounding matches the one in * DRM_IOCTL_WAIT_VBLANK. */ - if (!(o->flags & (TEST_DPMS | TEST_MODESET))) + if (!(o->flags & (TEST_DPMS | TEST_MODESET | TEST_NO_VBLANK))) { igt_assert_f(es->current_seq - (es->last_seq + o->seq_step) <= 1UL << 23, "unexpected %s seq %u, should be >= %u\n", es->name, es->current_seq, es->last_seq + o->seq_step); - + } /* Check that the vblank frame didn't wrap unexpectedly. */ if (o->flags & TEST_TS_CONT) { /* Ignore seq_step here since vblank waits time out immediately @@ -1204,6 +1217,7 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs, unsigned bo_size = 0; uint64_t tiling; int i; + bool vblank = true; switch (crtc_count) { case 1: @@ -1297,6 +1311,14 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs, } igt_assert(fb_is_bound(o, o->fb_ids[0])); + vblank = kms_has_vblank(drm_fd); + if (!vblank) { + if (vblank_dependence(o->flags)) + igt_require_f(vblank, "There is no Vblank\n"); + else + o->flags |= TEST_NO_VBLANK; + } + /* quiescent the hw a bit so ensure we don't miss a single frame */ if (o->flags & TEST_CHECK_TS) calibrate_ts(o, crtc_idxs[0]);