diff mbox

[i-g-t,v6,4/7] lib/igt_kms: Added kmstest_get_vbl_flag to igt_kms.

Message ID 1463616429-13079-5-git-send-email-robert.foss@collabora.com (mailing list archive)
State New, archived
Headers show

Commit Message

Robert Foss May 19, 2016, 12:07 a.m. UTC
From: Robert Foss <robert.foss@collabora.com>

Added function kmstest_get_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 <robert.foss@collabora.com>
---
 lib/igt_kms.c | 19 +++++++++++++++++++
 lib/igt_kms.h |  1 +
 2 files changed, 20 insertions(+)
diff mbox

Patch

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 1113f57..0e781ef 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -2562,3 +2562,22 @@  void igt_reset_connectors(void)
 		close(fd);
 	}
 }
+
+/**
+ * kmstest_get_vbl_flag:
+ *
+ * Convert a pipe id into the flag representation
+ * expected in DRM while processing DRM_IOCTL_WAIT_VBLANK.
+ */
+uint32_t kmstest_get_vbl_flag(uint32_t pipe_id)
+{
+	if (pipe_id == 0)
+		return 0;
+	else if (pipe_id == 1)
+		return _DRM_VBLANK_SECONDARY;
+	else {
+		uint32_t pipe_flag = pipe_id << 1;
+		igt_assert(!(pipe_flag & ~DRM_VBLANK_HIGH_CRTC_MASK));
+		return pipe_flag;
+	}
+}
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index b8f6dd8..7359d26 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -380,6 +380,7 @@  void igt_wait_for_vblank(int drm_fd, enum pipe pipe);
 
 void igt_enable_connectors(void);
 void igt_reset_connectors(void);
+uint32_t kmstest_get_vbl_flag(uint32_t pipe_id);
 
 #define EDID_LENGTH 128
 const unsigned char* igt_kms_get_base_edid(void);