From: Damien Lespiau Subject: [PATCH 7/8] lib: Add igt_wait_for_vblank() helper Date: Tue, 15 Oct 2013 19:44:33 +0100 Message-ID: <1381862674-17763-8-git-send-email-damien.lespiau@intel.com> References: <1381862674-17763-1-git-send-email-damien.lespiau@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id E7BF1E6C48 for ; Tue, 15 Oct 2013 11:44:59 -0700 (PDT) In-Reply-To: <1381862674-17763-1-git-send-email-damien.lespiau@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org Signed-off-by: Damien Lespiau --- lib/Makefile.am | 1 + lib/{igt_display.h => igt_display.c} | 38 ++++++++++++------------------------ lib/igt_display.h | 2 ++ 3 files changed, 15 insertions(+), 26 deletions(-) copy lib/{igt_display.h => igt_display.c} (68%) diff --git a/lib/Makefile.am b/lib/Makefile.am index 06d406f..431fd93 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -13,6 +13,7 @@ libintel_tools_la_SOURCES = \ i915_reg.h \ igt_debugfs.c \ igt_debugfs.h \ + igt_display.c \ igt_display.h \ instdone.c \ instdone.h \ diff --git a/lib/igt_display.h b/lib/igt_display.c similarity index 68% copy from lib/igt_display.h copy to lib/igt_display.c index 22c8a9f..28e21e6 100644 --- a/lib/igt_display.h +++ b/lib/igt_display.c @@ -22,34 +22,20 @@ * */ -#ifndef __IGT_DISPLAY_H__ -#define __IGT_DISPLAY_H__ +#include -enum pipe { - PIPE_A = 0, - PIPE_B, - PIPE_C, - I915_MAX_PIPES -}; -#define pipe_name(p) ((p) + 'A') +#include "drmtest.h" +#include "igt_display.h" -enum plane { - PLANE_A = 0, - PLANE_B, - PLANE_C, -}; -#define plane_name(p) ((p) + 'A') +void igt_wait_for_vblank(int drm_fd, enum pipe pipe) +{ + drmVBlank wait_vbl; -#define sprite_name(p, s) ((p) * dev_priv->num_plane + (s) + 'A') + memset(&wait_vbl, 0, sizeof(wait_vbl)); -enum port { - PORT_A = 0, - PORT_B, - PORT_C, - PORT_D, - PORT_E, - I915_MAX_PORTS -}; -#define port_name(p) ((p) + 'A') + wait_vbl.request.type = pipe << DRM_VBLANK_HIGH_CRTC_SHIFT | + DRM_VBLANK_RELATIVE; + wait_vbl.request.sequence = 1; -#endif /* __IGT_DISPLAY_H__ */ + igt_assert(drmWaitVBlank(drm_fd, &wait_vbl) == 0); +} diff --git a/lib/igt_display.h b/lib/igt_display.h index 22c8a9f..1357ce9 100644 --- a/lib/igt_display.h +++ b/lib/igt_display.h @@ -52,4 +52,6 @@ enum port { }; #define port_name(p) ((p) + 'A') +void igt_wait_for_vblank(int drm_fd, enum pipe pipe); + #endif /* __IGT_DISPLAY_H__ */ -- 1.8.3.1