From patchwork Mon Aug 20 23:54:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Siqueira X-Patchwork-Id: 10570861 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 D735B921 for ; Mon, 20 Aug 2018 23:54:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA0DD28DBE for ; Mon, 20 Aug 2018 23:54:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ABDE529B66; Mon, 20 Aug 2018 23:54:52 +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 AEBA328DBE for ; Mon, 20 Aug 2018 23:54:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CCD1D6E0FC; Mon, 20 Aug 2018 23:54:50 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qk0-x244.google.com (mail-qk0-x244.google.com [IPv6:2607:f8b0:400d:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 99F886E0FC; Mon, 20 Aug 2018 23:54:49 +0000 (UTC) Received: by mail-qk0-x244.google.com with SMTP id z125-v6so72614qkb.12; Mon, 20 Aug 2018 16:54:49 -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:user-agent; bh=yAkownn5vKMTj2uao1spvXTpYmLH6JzD8AtTZYKmiBk=; b=Hli77v1c9YN5YwvUkCUbrc9+yNbQxkeAXD75IJUpv/ZRC+rEOgVFjA4PwEi1lN4+iw JdakLYo4nfdESvLor8PZoFC/kxgkRn0pN1KhhiUWoL1FCLH+/nP7Plf8rIYkNI5EZRmp 93zWRwRhLC/XRb9/ToiO9u8lFGx+5Cg9Y9pUrdcvrbGFQMxfxXQhgnyrL7WsdvoUEBxw m/qUfDSZHJtV2r+c3+Zz0QSrwoWzhCxRD1Bo/khRmQ05dsNdv54OnnJ8P8t6hHA0wqzM lTb4Fmnf17f+HB8I2Y+TXwdRn3Pc/SjLpIx428RRZQVkxfVtp1nEhEu+TT4JGG90C8lh WI7Q== X-Gm-Message-State: AOUpUlFwwnzJy2rOWY2HDautAeFYU6b1LsxV87OMzseSjZmCljM+vEwg txlFb5xCNVi0GFMm/7s0PoE= X-Google-Smtp-Source: AA+uWPxj26zLacfpOG/u1UFM6JODsFVlzqdrduzZrlECb7uqlvT6B/BQPjwpI4sr87xCpQvGeo3gRg== X-Received: by 2002:a37:5a06:: with SMTP id o6-v6mr44269610qkb.44.1534809288660; Mon, 20 Aug 2018 16:54:48 -0700 (PDT) Received: from smtp.gmail.com ([143.107.45.1]) by smtp.gmail.com with ESMTPSA id k5-v6sm5834266qkf.53.2018.08.20.16.54.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Aug 2018 16:54:48 -0700 (PDT) Date: Mon, 20 Aug 2018 20:54:45 -0300 From: Rodrigo Siqueira To: Petri Latvala , Arkadiusz Hiler Message-ID: <20180820235445.czxuegylrnnxqrzn@smtp.gmail.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20180716 Subject: [Intel-gfx] [PATCH 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, Haneen Mohammed 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. Signed-off-by: Rodrigo Siqueira --- lib/igt_aux.c | 14 ++++++++++++++ lib/igt_aux.h | 2 ++ tests/kms_flip.c | 26 ++++++++++++++++++++++++-- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/lib/igt_aux.c b/lib/igt_aux.c index 1250d5c5..da5be4bb 100644 --- a/lib/igt_aux.c +++ b/lib/igt_aux.c @@ -564,6 +564,20 @@ bool igt_aub_dump_enabled(void) return dump_aub; } +bool igt_there_is_vblank(int drm_fd) +{ + drmVBlank dummy_vbl; + int ret; + + dummy_vbl.request.type = DRM_VBLANK_ABSOLUTE; + ret = drmWaitVBlank(drm_fd, &dummy_vbl); + + if (ret < 0) + return false; + + return true; +} + /* other helpers */ /** * igt_exchange_int: diff --git a/lib/igt_aux.h b/lib/igt_aux.h index ef89faa9..933055e8 100644 --- a/lib/igt_aux.h +++ b/lib/igt_aux.h @@ -119,6 +119,8 @@ bool igt_check_boolean_env_var(const char *env_var, bool default_value); bool igt_aub_dump_enabled(void); +bool igt_there_is_vblank(int fd); + /* suspend/hibernate and auto-resume system */ /** diff --git a/tests/kms_flip.c b/tests/kms_flip.c index 393d690a..770fa5f7 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 = igt_there_is_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]);