From 7ead45c28c8870685bbfd219b967f035df85242b Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Mon, 4 Jul 2016 16:52:46 +0300 Subject: 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 Signed-off-by: Marius Vlad --- lib/igt_kms.c | 19 +++++++++++++++++++ lib/igt_kms.h | 2 ++ 2 files changed, 21 insertions(+) (limited to 'lib') diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 112bdf7d..be806467 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -2570,3 +2570,22 @@ void igt_reset_connectors(void) forced_connectors[i], "detect"); } + +/** + * 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 8a6c0476..829615d7 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -402,6 +402,8 @@ static inline bool igt_pipe_connector_valid(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); const unsigned char* igt_kms_get_alt_edid(void); -- cgit v1.2.3