From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id 204196E1B3 for ; Sat, 11 Jul 2020 18:05:08 +0000 (UTC) From: Mohammed Khajapasha Date: Sat, 11 Jul 2020 23:34:48 +0530 Message-Id: <20200711180457.1824-3-mohammed.khajapasha@intel.com> In-Reply-To: <20200711180457.1824-1-mohammed.khajapasha@intel.com> References: <20200711180457.1824-1-mohammed.khajapasha@intel.com> MIME-Version: 1.0 Subject: [igt-dev] [PATCH i-g-t 02/11] lib/igt_kms: Add igt_require_pipe() function List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" To: igt-dev@lists.freedesktop.org List-ID: Add igt_require_pipe() fn to check whether a pipe is enabled or not Signed-off-by: Mohammed Khajapasha --- lib/igt_kms.c | 17 +++++++++++++++++ lib/igt_kms.h | 13 +++++++++++++ 2 files changed, 30 insertions(+) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 8b92f1fe..242e75d9 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 f9bbddc5..7109c9a5 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__ */ -- 2.24.1 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev