From patchwork Tue Jan 17 08:22:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kahola X-Patchwork-Id: 9520093 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 864A66020B for ; Tue, 17 Jan 2017 08:24:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F7662022B for ; Tue, 17 Jan 2017 08:24:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6445428236; Tue, 17 Jan 2017 08:24:26 +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 135A52022B for ; Tue, 17 Jan 2017 08:24:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A4F686E622; Tue, 17 Jan 2017 08:24:19 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 55EA56E619 for ; Tue, 17 Jan 2017 08:24:18 +0000 (UTC) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 17 Jan 2017 00:24:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,243,1477983600"; d="scan'208";a="809794273" Received: from sorvi.fi.intel.com ([10.237.72.109]) by FMSMGA003.fm.intel.com with ESMTP; 17 Jan 2017 00:24:17 -0800 From: Mika Kahola To: intel-gfx@lists.freedesktop.org Date: Tue, 17 Jan 2017 10:22:55 +0200 Message-Id: <1484641375-15983-3-git-send-email-mika.kahola@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484641375-15983-1-git-send-email-mika.kahola@intel.com> References: <1484641375-15983-1-git-send-email-mika.kahola@intel.com> Subject: [Intel-gfx] [PATCH i-g-t v2 2/2] tests/kms_plane_multiple: Cleanup in favor of library functions 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 Cleaunup by replacing get_vblank() function with library function kmstest_get_vblank(). Cc: Maarten Lankhorst Reviewed-by: Maarten Lankhorst Signed-off-by: Mika Kahola --- tests/kms_plane_multiple.c | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c index dcea910..2b43f0c 100644 --- a/tests/kms_plane_multiple.c +++ b/tests/kms_plane_multiple.c @@ -67,28 +67,6 @@ struct { .seed = 1, }; -static inline uint32_t pipe_select(int pipe) -{ - if (pipe > 1) - return pipe << DRM_VBLANK_HIGH_CRTC_SHIFT; - else if (pipe > 0) - return DRM_VBLANK_SECONDARY; - else - return 0; -} - -static unsigned int get_vblank(int fd, int pipe, unsigned int flags) -{ - union drm_wait_vblank vbl; - - memset(&vbl, 0, sizeof(vbl)); - vbl.request.type = DRM_VBLANK_RELATIVE | pipe_select(pipe) | flags; - if (drmIoctl(fd, DRM_IOCTL_WAIT_VBLANK, &vbl)) - return 0; - - return vbl.reply.sequence; -} - /* * Common code across all tests, acting on data_t */ @@ -263,7 +241,8 @@ test_atomic_plane_position_with_output(data_t *data, enum pipe pipe, while (i < iterations || loop_forever) { prepare_planes(data, pipe, &blue, tiling, max_planes, output); - vblank_start = get_vblank(data->display.drm_fd, pipe, DRM_VBLANK_NEXTONMISS); + vblank_start = kmstest_get_vblank(data->display.drm_fd, pipe, + DRM_VBLANK_NEXTONMISS); igt_display_commit_atomic(&data->display, DRM_MODE_PAGE_FLIP_EVENT, @@ -274,7 +253,7 @@ test_atomic_plane_position_with_output(data_t *data, enum pipe pipe, ret = read(data->display.drm_fd, buf, sizeof(buf)); igt_assert(ret >= 0); - vblank_stop = get_vblank(data->display.drm_fd, pipe, 0); + vblank_stop = kmstest_get_vblank(data->display.drm_fd, pipe, 0); igt_assert_eq(e->type, DRM_EVENT_FLIP_COMPLETE); igt_reset_timeout();