From: Kunal Joshi <kunal1.joshi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Kunal Joshi <kunal1.joshi@intel.com>
Subject: [PATCH i-g-t 1/7] tests/intel/kms_dp_linktrain_fallback: refactor find_mst_outputs
Date: Tue, 11 Feb 2025 23:35:36 +0530 [thread overview]
Message-ID: <20250211180542.1430676-2-kunal1.joshi@intel.com> (raw)
In-Reply-To: <20250211180542.1430676-1-kunal1.joshi@intel.com>
refactor find_mst_outputs to improve error handling
v2: change return type to int (Ankit)
Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
---
tests/intel/kms_dp_linktrain_fallback.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/tests/intel/kms_dp_linktrain_fallback.c b/tests/intel/kms_dp_linktrain_fallback.c
index 415005774..edf9409b6 100644
--- a/tests/intel/kms_dp_linktrain_fallback.c
+++ b/tests/intel/kms_dp_linktrain_fallback.c
@@ -47,26 +47,33 @@ typedef int (*condition_check_fn)(int drm_fd, igt_output_t *output);
IGT_TEST_DESCRIPTION("Test link training fallback");
-static void find_mst_outputs(int drm_fd, data_t *data,
- igt_output_t *output,
- igt_output_t *mst_outputs[],
- int *num_mst_outputs)
+static int find_mst_outputs(int drm_fd, igt_display_t *display,
+ igt_output_t *output,
+ igt_output_t *mst_outputs[],
+ int *num_mst_outputs)
{
int output_root_id, root_id;
igt_output_t *connector_output;
+ if (!igt_check_output_is_dp_mst(output))
+ return -EINVAL;
+
output_root_id = igt_get_dp_mst_connector_id(output);
+ if (output_root_id == -EINVAL)
+ return -EINVAL;
/*
* If output is MST check all other connected output which shares
* same path and fill mst_outputs and num_mst_outputs
*/
- for_each_connected_output(&data->display, connector_output) {
+ for_each_connected_output(display, connector_output) {
if (!igt_check_output_is_dp_mst(connector_output))
continue;
+
root_id = igt_get_dp_mst_connector_id(connector_output);
if (((*num_mst_outputs) < IGT_MAX_PIPES) && root_id == output_root_id)
mst_outputs[(*num_mst_outputs)++] = connector_output;
}
+ return 0;
}
static bool setup_mst_outputs(data_t *data, igt_output_t *mst_output[],
@@ -83,8 +90,10 @@ static bool setup_mst_outputs(data_t *data, igt_output_t *mst_output[],
traversed_mst_outputs[i] == data->output->config.connector->connector_id)
return false;
- find_mst_outputs(data->drm_fd, data, data->output,
- mst_output, output_count);
+ igt_assert_f(find_mst_outputs(data->drm_fd, &data->display,
+ data->output, mst_output,
+ output_count) == 0,
+ "Unable to find mst outputs or given optput is not mst\n");
for (i = 0; i < *output_count; i++) {
output = mst_output[i];
--
2.25.1
next prev parent reply other threads:[~2025-02-11 17:50 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-11 18:05 [PATCH i-g-t 0/7] add dsc-fallback test Kunal Joshi
2025-02-11 18:05 ` Kunal Joshi [this message]
2025-02-13 5:00 ` [PATCH i-g-t 1/7] tests/intel/kms_dp_linktrain_fallback: refactor find_mst_outputs Nautiyal, Ankit K
2025-02-14 7:08 ` Sharma, Swati2
2025-02-11 18:05 ` [PATCH i-g-t 2/7] tests/intel/kms_mst_helper: add helper for MST-related functions Kunal Joshi
2025-02-13 5:44 ` Nautiyal, Ankit K
2025-02-14 7:13 ` Sharma, Swati2
2025-02-11 18:05 ` [PATCH i-g-t 3/7] tests/intel/kms_dp_linktrain_fallback: refactor dp-fallback subtest Kunal Joshi
2025-02-11 18:05 ` [PATCH i-g-t 4/7] tests/intel/kms_dp_linktrain_fallback: fix typo Kunal Joshi
2025-02-13 5:48 ` Nautiyal, Ankit K
2025-02-11 18:05 ` [PATCH i-g-t 5/7] tests/intel/kms_dp_linktrain_fallback: add dsc-fallback test Kunal Joshi
2025-02-14 7:22 ` Sharma, Swati2
2025-02-14 7:28 ` Sharma, Swati2
2025-02-11 18:05 ` [PATCH i-g-t 6/7] tests/intel/kms_dp_linktrain_fallback: disable ignore long hpd Kunal Joshi
2025-02-11 18:05 ` [PATCH i-g-t 7/7] HAX: Do not merge Kunal Joshi
2025-02-11 20:09 ` ✗ Xe.CI.BAT: failure for add dsc-fallback test (rev4) Patchwork
2025-02-11 20:37 ` ✗ i915.CI.BAT: " Patchwork
2025-02-12 3:53 ` ✗ Xe.CI.Full: " Patchwork
2025-02-13 5:53 ` [PATCH i-g-t 0/7] add dsc-fallback test Nautiyal, Ankit K
2025-02-16 11:05 ` Joshi, Kunal1
2025-02-14 6:48 ` ✓ i915.CI.BAT: success for add dsc-fallback test (rev4) Patchwork
2025-02-14 9:39 ` ✗ i915.CI.Full: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250211180542.1430676-2-kunal1.joshi@intel.com \
--to=kunal1.joshi@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox