Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Hersen Wu <hersenxs.wu@amd.com>
To: <igt-dev@lists.freedesktop.org>, <rodrigo.siqueira@amd.com>,
	<aurabindo.pillai@amd.com>, <alex.hung@amd.com>,
	<stylon.wang@amd.com>, <hamza.mahfooz@amd.com>
Cc: Hersen Wu <hersenxs.wu@amd.com>
Subject: [igt-dev] [PATCH] [i-g-t] tests/amdgpu/amd_vrr_range: fix test crash when n_pipes > n_outputs
Date: Tue, 13 Jun 2023 08:46:47 -0400	[thread overview]
Message-ID: <20230613124647.37529-1-hersenxs.wu@amd.com> (raw)

Fix test crash by looping outputs using
for_each_connected_output(display, output).

When n_pipes > n_outputs, i >= n_outputs,
display->outputs[i]->config.connector within
for_each_pipe(display, i) are invalid.
Invalid connectors cause test crash.

Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
---
 tests/amdgpu/amd_vrr_range.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/tests/amdgpu/amd_vrr_range.c b/tests/amdgpu/amd_vrr_range.c
index 3f8f23e9a..611f41f95 100644
--- a/tests/amdgpu/amd_vrr_range.c
+++ b/tests/amdgpu/amd_vrr_range.c
@@ -258,18 +258,14 @@ static void test_freesync_parsing_base(data_t *data, uint32_t test_flags)
 	const struct edid *edid;
 	range_t range, expected_range;
 	igt_output_t *output;
-	int i, j, test_conn_cnt = 0;
+	int j, test_conn_cnt = 0;
+	igt_display_t *display = &data->display;
 
 	test_init(data);
 
 	igt_amd_require_hpd(&data->display, data->fd);
 
-	for_each_pipe(&data->display, i) {
-		/* setup the output */
-		output = data->output[i];
-		if (!output || !igt_output_is_connected(output))
-			continue;
-
+	for_each_connected_output(display, output) {
 		/* find a test EDID */
 		j = find_test_edid_index(output->config.connector->connector_type);
 
@@ -335,18 +331,14 @@ static void test_freesync_range_base(data_t *data, uint32_t test_flags)
 {
 	range_t range;
 	igt_output_t *output;
-	int i, test_conn_cnt = 0;
+	int test_conn_cnt = 0;
+	igt_display_t *display = &data->display;
 
 	test_init(data);
 
 	igt_amd_require_hpd(&data->display, data->fd);
 
-	for_each_pipe(&data->display, i) {
-		/* setup the output */
-		output = data->output[i];
-		if (!output || !igt_output_is_connected(output))
-			continue;
-
+	for_each_connected_output(display, output) {
 		igt_debug_on_f(!has_vrr(output), "Requires output supports VRR\n");
 
 		if (!has_vrr(output)) {
-- 
2.25.1

             reply	other threads:[~2023-06-13 12:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-13 12:46 Hersen Wu [this message]
2023-06-13 13:36 ` [igt-dev] ✗ GitLab.Pipeline: warning for tests/amdgpu/amd_vrr_range: fix test crash when n_pipes > n_outputs Patchwork
2023-06-13 14:08 ` [igt-dev] ✗ Fi.CI.BAT: failure " Patchwork
2023-06-13 16:27   ` Kamil Konieczny
2023-06-15 13:25     ` Yedireswarapu, SaiX Nandan
2023-06-13 17:22 ` [igt-dev] [PATCH] [i-g-t] " Alex Hung
2023-06-13 17:53   ` Wu, Hersen
2023-06-13 23:28 ` Alex Hung
2023-06-14 19:21 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/amdgpu/amd_vrr_range: fix test crash when n_pipes > n_outputs (rev2) Patchwork
2023-06-14 21:02 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2023-06-15 13:01 ` Patchwork
2023-06-15 13:18 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork
2023-06-15 15:11 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/amdgpu/amd_vrr_range: fix test crash when n_pipes > n_outputs (rev3) Patchwork
2023-06-15 18:26 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2023-06-15 19:06 ` [igt-dev] ✗ GitLab.Pipeline: warning for tests/amdgpu/amd_vrr_range: fix test crash when n_pipes > n_outputs (rev4) Patchwork
2023-06-15 19:39 ` [igt-dev] ✗ Fi.CI.BAT: failure " Patchwork
2023-06-16  8:52   ` Kamil Konieczny
2023-06-17  7:05     ` Yedireswarapu, SaiX Nandan
2023-06-16 12:41 ` Patchwork
2023-06-16 13:06 ` Patchwork
2023-06-16 13:40 ` [igt-dev] ✓ Fi.CI.IGT: success for tests/amdgpu/amd_vrr_range: fix test crash when n_pipes > n_outputs (rev3) Patchwork
2023-06-16 13:47 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests/amdgpu/amd_vrr_range: fix test crash when n_pipes > n_outputs (rev4) 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=20230613124647.37529-1-hersenxs.wu@amd.com \
    --to=hersenxs.wu@amd.com \
    --cc=alex.hung@amd.com \
    --cc=aurabindo.pillai@amd.com \
    --cc=hamza.mahfooz@amd.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=rodrigo.siqueira@amd.com \
    --cc=stylon.wang@amd.com \
    /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