From patchwork Mon Jan 16 13:09:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kahola X-Patchwork-Id: 9518677 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 EC65A600C5 for ; Mon, 16 Jan 2017 13:08:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D31CB283F4 for ; Mon, 16 Jan 2017 13:08:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C6B8D28428; Mon, 16 Jan 2017 13:08:49 +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 88BB1283F4 for ; Mon, 16 Jan 2017 13:08:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2549D6E31D; Mon, 16 Jan 2017 13:08:49 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7E3AD6E319 for ; Mon, 16 Jan 2017 13:08:47 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 16 Jan 2017 05:08:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,239,1477983600"; d="scan'208";a="923076314" Received: from sorvi.fi.intel.com ([10.237.72.109]) by orsmga003.jf.intel.com with ESMTP; 16 Jan 2017 05:08:34 -0800 From: Mika Kahola To: intel-gfx@lists.freedesktop.org Date: Mon, 16 Jan 2017 15:09:13 +0200 Message-Id: <1484572153-28840-3-git-send-email-mika.kahola@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484572153-28840-1-git-send-email-mika.kahola@intel.com> References: <1484572153-28840-1-git-send-email-mika.kahola@intel.com> Subject: [Intel-gfx] [PATCH i-g-t 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 Signed-off-by: Mika Kahola Reviewed-by: Maarten Lankhorst --- 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 6257a8b..f66f41a 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();