[Intel-gfx] [PATCH 7/8] lib: Add igt_wait_for_vblank() helper
Damien Lespiau
damien.lespiau at intel.com
Tue Oct 15 20:44:33 CEST 2013
Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
---
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 <string.h>
-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
More information about the Intel-gfx
mailing list