From patchwork Tue Apr 26 15:54:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foss X-Patchwork-Id: 8940271 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 8FC499F1D3 for ; Tue, 26 Apr 2016 15:54:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C70F5201FE for ; Tue, 26 Apr 2016 15:54:39 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 01050201EC for ; Tue, 26 Apr 2016 15:54:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5476E6E869; Tue, 26 Apr 2016 15:54:35 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6A3706E86B for ; Tue, 26 Apr 2016 15:54:32 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: robertfoss) with ESMTPSA id 917E02613D9 From: robert.foss@collabora.com To: marius.c.vlad@intel.com, daniel.vetter@ffwll.ch, tomeu.vizoso@collabora.com, daniel.stone@collabora.com Date: Tue, 26 Apr 2016 11:54:22 -0400 Message-Id: <1461686062-24630-6-git-send-email-robert.foss@collabora.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1461686062-24630-1-git-send-email-robert.foss@collabora.com> References: <1461686062-24630-1-git-send-email-robert.foss@collabora.com> Cc: intel-gfx@lists.freedesktop.org Subject: [Intel-gfx] [PATCH i-g-t v4 5/5] lib/igt_kms: Added pipe_id_to_vbl_flag() to igt_kms. 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=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 From: Robert Foss Added function pipe_id_to_vbl_flag() to igt_kms. This function formats a pipe_id into the format expected by DRM while processing DRM_IOCTL_WAIT_VBLANK. Signed-off-by: Robert Foss --- lib/igt_kms.c | 16 ++++++++++++++++ lib/igt_kms.h | 1 + 2 files changed, 17 insertions(+) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 99b6279..48b95e6 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -2557,3 +2557,19 @@ void igt_reset_connectors(void) close(fd); } } + +/** + * pipe_id_to_vbl_flag: + * + * Convert a pipe if into the flag representation + * expected in DRM while processing DRM_IOCTL_WAIT_VBLANK. + */ +uint32_t pipe_id_to_vbl_flag(uint32_t pipe_id) +{ + if (pipe_id == 0) + return 0; + else if (pipe_id == 1) + return 1 | _DRM_VBLANK_SECONDARY; + else + return pipe_id << 1; +} diff --git a/lib/igt_kms.h b/lib/igt_kms.h index d9a4e11..f74edaf 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -400,6 +400,7 @@ void igt_wait_for_vblank(int drm_fd, enum pipe pipe); void igt_enable_connectors(void); void igt_reset_connectors(void); +uint32_t pipe_id_to_vbl_flag(uint32_t pipe_id); #define EDID_LENGTH 128 const unsigned char* igt_kms_get_base_edid(void);