summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMohammed Khajapasha <mohammed.khajapasha@intel.com>2020-07-20 20:50:36 +0530
committerArkadiusz Hiler <arkadiusz.hiler@intel.com>2020-07-21 12:58:11 +0300
commitd9a0b9166c6d4a59e124624f77abca408fb87ca8 (patch)
tree331b4c122fce9f2131ad062942d61509117771ed /lib
parentb743593074ba80db7ac2178760d9e56354104041 (diff)
lib/igt_kms: Add igt_require_pipe() function
Add igt_require_pipe() fn to check whether a pipe is enabled or not Signed-off-by: Mohammed Khajapasha <mohammed.khajapasha@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_kms.c17
-rw-r--r--lib/igt_kms.h13
2 files changed, 30 insertions, 0 deletions
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 5a80d17fd..5b68ffda0 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1873,6 +1873,23 @@ void igt_display_reset(igt_display_t *display)
static void igt_fill_plane_format_mod(igt_display_t *display, igt_plane_t *plane);
static void igt_fill_display_format_mod(igt_display_t *display);
+/*
+ * igt_require_pipe:
+ * @display: pointer to igt_display_t
+ * @pipe: pipe which need to check
+ *
+ * Skip a (sub-)test if the pipe not enabled.
+ *
+ * Should be used everywhere where a test checks pipe and skip
+ * test when pipe is not enabled.
+ */
+void igt_require_pipe(igt_display_t *display, enum pipe pipe)
+{
+ igt_skip_on_f(!display->pipes[pipe].enabled,
+ "Pipe %s does not exist or not enabled\n",
+ kmstest_pipe_name(pipe));
+}
+
/* Get crtc mask for a pipe using crtc id */
static int
__get_crtc_mask_for_pipe(drmModeRes *resources, igt_pipe_t *pipe)
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index f9bbddc5f..7109c9a58 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -858,4 +858,17 @@ int igt_connector_sysfs_open(int drm_fd,
drmModeConnector *connector);
uint32_t igt_reduce_format(uint32_t format);
+/*
+ * igt_require_pipe:
+ * @display: pointer to igt_display_t
+ * @pipe: pipe which need to check
+ *
+ * Skip a (sub-)test if the pipe not enabled.
+ *
+ * Should be used everywhere where a test checks pipe and skip
+ * test when pipe is not enabled.
+ */
+void igt_require_pipe(igt_display_t *display,
+ enum pipe pipe);
+
#endif /* __IGT_KMS_H__ */