From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 47CCA6E312 for ; Sat, 11 Jul 2020 20:06:16 +0000 (UTC) From: Mohammed Khajapasha Date: Sun, 12 Jul 2020 01:35:53 +0530 Message-Id: <20200711200602.3217-3-mohammed.khajapasha@intel.com> In-Reply-To: <20200711200602.3217-1-mohammed.khajapasha@intel.com> References: <20200711200602.3217-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, arkadiusz.hiler@intel.com 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 5a80d17f..5b68ffda 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