Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Chung <chiahsuan.chung@amd.com>
To: <igt-dev@lists.freedesktop.org>
Cc: Tom Chung <chiahsuan.chung@amd.com>
Subject: [igt-dev] [PATCH i-g-t 5/8] tests/amdgpu/amd_freesync_video_mode: Add/remove some test progress messages
Date: Wed, 21 Jun 2023 14:57:30 +0800	[thread overview]
Message-ID: <20230621065733.840316-5-chiahsuan.chung@amd.com> (raw)
In-Reply-To: <20230621065733.840316-1-chiahsuan.chung@amd.com>

1. Add/remove some test progress messages.
2. Change the variable name "range" to "vrr_range" to make the code clear.
3. Switch to igt_subtest_with_dynamic.
   It can get more progress messages during the test.

Signed-off-by: Tom Chung <chiahsuan.chung@amd.com>
---
 tests/amdgpu/amd_freesync_video_mode.c | 47 +++++++++++++++-----------
 1 file changed, 28 insertions(+), 19 deletions(-)

diff --git a/tests/amdgpu/amd_freesync_video_mode.c b/tests/amdgpu/amd_freesync_video_mode.c
index 073f91084..fd27c39e5 100644
--- a/tests/amdgpu/amd_freesync_video_mode.c
+++ b/tests/amdgpu/amd_freesync_video_mode.c
@@ -60,7 +60,7 @@ typedef struct data {
 	uint32_t *fb_mem[2];
 	int front;
 	bool fb_initialized;
-	range_t range;
+	range_t vrr_range;
 
 	drmModeConnector *connector;
 	drmModeModeInfo *modes;
@@ -431,14 +431,15 @@ static drmModeModeInfo* select_mode(
 		break;
 
 	default:
-		igt_assert("Cannot find mode with specified rate and type.");
+		igt_skip("Cannot find the specified mode type.\n");
 		break;
 	}
 
 	if (mode) {
 		igt_info("selected mode:\n");
 		kmstest_dump_mode(mode);
-	}
+	} else
+		igt_skip("Cannot find the mode with specified rate and type.\n");
 
 	return mode;
 }
@@ -462,10 +463,10 @@ static int prepare_custom_mode(
 		return -1;
 	}
 
-	if (refresh_rate < data->range.min ||
-			refresh_rate > data->range.max) {
+	if (refresh_rate < data->vrr_range.min ||
+			refresh_rate > data->vrr_range.max) {
 		igt_warn("The given refresh rate(%u) should be between the rage of: min=%d, max=%d\n",
-				refresh_rate, data->range.min, data->range.max);
+				refresh_rate, data->vrr_range.min, data->vrr_range.max);
 		return -1;
 	}
 
@@ -525,6 +526,7 @@ get_vrr_range(data_t *data, igt_output_t *output)
 
 	igt_assert(start_loc = strstr(buf, "Max: "));
 	igt_assert_eq(sscanf(start_loc, "Max: %u", &range.max), 1);
+	igt_info("VRR Range: %u-%u Hz\n",range.min, range.max );
 
 	return range;
 }
@@ -637,7 +639,7 @@ flip_and_measure(
 	do_flip(data);
 	start_ns = last_event_ns = target_ns = get_kernel_event_ns(data,
 							DRM_EVENT_FLIP_COMPLETE);
-	igt_info("interval_ns=%lu\n", interval_ns);
+	igt_debug("interval_ns=%lu\n", interval_ns);
 
 	for (;;) {
 		uint64_t event_ns, wait_ns;
@@ -689,8 +691,9 @@ flip_and_measure(
 		while (get_time_ns() < target_ns - 10);
 	}
 
-	igt_info("Completed %u flips, %u were in threshold for (%llu Hz) %"PRIu64"ns.\n",
-		 total_flip, total_pass, (NSECS_PER_SEC / interval_ns), interval_ns);
+	igt_info("Completed %u flips, %u were in threshold (Rate: %u%%) for (%llu Hz) %"PRIu64"ns.\n",
+		total_flip, total_pass, total_flip ? ((total_pass * 100) / total_flip) : 0,
+		(NSECS_PER_SEC / interval_ns), interval_ns);
 
 	return total_flip ? ((total_pass * 100) / total_flip) : 0;
 }
@@ -735,7 +738,6 @@ static void init_data(data_t *data, igt_output_t *output) {
 			}
 		}
 	}
-		igt_info("preferred=%d, base=%d\n", data->preferred_mode_index, data->base_mode_index);
 
 	for (i = 0; i < connector->count_modes; i++) {
 		drmModeModeInfo *mode = &connector->modes[i];
@@ -743,7 +745,7 @@ static void init_data(data_t *data, igt_output_t *output) {
 			igt_debug("mode[%d] is freesync video mode.\n", i);
 	}
 
-	data->range = get_vrr_range(data, output);
+	data->vrr_range = get_vrr_range(data, output);
 }
 
 static void finish_test(data_t *data, enum pipe pipe, igt_output_t *output)
@@ -781,7 +783,6 @@ mode_transition(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t sce
 	init_data(data, output);
 	sprite_anim_init();
 
-	igt_info("stage-1:\n");
 	switch(scene) {
 	case SCENE_BASE_MODE_TO_VARIOUS_FSV_MODE:
 		mode_start = select_mode(data, FSV_BASE_MODE, 0);
@@ -811,12 +812,14 @@ mode_transition(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t sce
 	}
 	igt_assert_f(mode_start && mode_playback,
 			"Failure on selecting mode with given type and refresh rate.\n");
+
+	igt_info("stage-1: fps:%d\n", mode_start->vrefresh);
 	prepare_test(data, output, pipe, mode_start);
 	interval = nsec_per_frame(mode_start->vrefresh) ;
-	set_vrr_on_pipe(data, pipe, 1);
+	set_vrr_on_pipe(data, pipe, true);
 	result = flip_and_measure(data, output, pipe, interval, TEST_DURATION_NS, ANIM_TYPE_SMPTE);
 
-	igt_info("stage-2: simple animation as video playback\n");
+	igt_info("stage-2: simple animation as video playback fps:%d\n", mode_playback->vrefresh);
 	prepare_test(data, output, pipe, mode_playback);
 	interval = nsec_per_frame(mode_playback->vrefresh) ;
 	/* Do a short run with VRR before measure to make sure we measure in a stable state */
@@ -826,6 +829,7 @@ mode_transition(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t sce
 	finish_test(data, pipe, output);
 }
 
+/* Runs tests on outputs that are VRR capable. */
 static void
 run_test(data_t *data, uint32_t scene)
 {
@@ -835,11 +839,16 @@ run_test(data_t *data, uint32_t scene)
 	for_each_connected_output(&data->display, output) {
 		enum pipe pipe;
 
-		if (!has_vrr(output))
+		if (!has_vrr(output)) {
+			igt_info("%s is not a vrr capable output. Skip it.\n",
+				 output->name);
 			continue;
+		}
 
 		for_each_pipe(&data->display, pipe)
 			if (igt_pipe_connector_valid(pipe, output)) {
+				igt_dynamic_f("pipe-%s-%s",
+					      kmstest_pipe_name(pipe), output->name)
 				mode_transition(data, pipe, output, scene);
 				found = true;
 				break;
@@ -869,25 +878,25 @@ igt_main
 	/* Expectation: Modeset happens instantaneously without blanking */
 	igt_describe("Test switch from base freesync mode to " \
 					"various freesync video modes");
-	igt_subtest("freesync-base-to-various")
+	igt_subtest_with_dynamic("freesync-base-to-various")
 	run_test(&data, SCENE_BASE_MODE_TO_VARIOUS_FSV_MODE);
 
 	/* Expectation: Modeset happens instantaneously without blanking */
 	igt_describe("Test switching from lower refresh freesync mode to " \
 					"another freesync mode with higher refresh rate");
-	igt_subtest("freesync-lower-to-higher")
+	igt_subtest_with_dynamic("freesync-lower-to-higher")
 	run_test(&data, SCENE_LOWER_FSV_MODE_TO_HIGHER_FSV_MODE);
 
 	/* Expectation: Full modeset is triggered. */
 	igt_describe("Test switching from non preferred video mode to " \
 					"one of freesync video mode");
-	igt_subtest("freesync-non-preferred-to-freesync")
+	igt_subtest_with_dynamic("freesync-non-preferred-to-freesync")
 	run_test(&data, SCENE_NON_FSV_MODE_TO_FSV_MODE);
 
 	/* Expectation: Modeset happens instantaneously without blanking */
 	igt_describe("Add custom mode through xrandr based on " \
 					"base freesync mode and apply the new mode");
-	igt_subtest("freesync-custom-mode")
+	igt_subtest_with_dynamic("freesync-custom-mode")
 	run_test(&data, SCENE_BASE_MODE_TO_CUSTUM_MODE);
 
 	igt_info("end of test\n");
-- 
2.34.1

  parent reply	other threads:[~2023-06-21  6:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-21  6:57 [igt-dev] [PATCH i-g-t 1/8] tests/amdgpu/amd_freesync_video_mode: Adjust indents and spacing Tom Chung
2023-06-21  6:57 ` [igt-dev] [PATCH i-g-t 2/8] tests/amdgpu/amd_freesync_video_mode: Fix memory leak and corruption Tom Chung
2023-06-21  6:57 ` [igt-dev] [PATCH i-g-t 3/8] tests/amdgpu/amd_freesync_video_mode: Fix wrong resolution setting during the test Tom Chung
2023-06-21  6:57 ` [igt-dev] [PATCH i-g-t 4/8] tests/amdgpu/amd_freesync_video_mode: Add some code from kms_vrr to resolve tearing issue Tom Chung
2023-06-21  6:57 ` Tom Chung [this message]
2023-06-21  6:57 ` [igt-dev] [PATCH i-g-t 6/8] tests/amdgpu/amd_freesync_video_mode: Move the vrr setting and display reset Tom Chung
2023-06-21  6:57 ` [igt-dev] [PATCH i-g-t 7/8] tests/amdgpu/amd_freesync_video_mode: Fix wrong resolution setting for some panel Tom Chung
2023-06-21  6:57 ` [igt-dev] [PATCH i-g-t 8/8] tests/amdgpu/amd_freesync_video_mode: Add amd_freesync_video_mode to meson.build Tom Chung
2023-06-21 14:55 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/8] tests/amdgpu/amd_freesync_video_mode: Adjust indents and spacing Patchwork
2023-06-22  3:34 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2023-06-28 20:57 ` [igt-dev] [PATCH i-g-t 1/8] " Kamil Konieczny
2023-06-28 21:06   ` vitaly prosyak
2023-06-29 10:16   ` Chung, ChiaHsuan (Tom)

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=20230621065733.840316-5-chiahsuan.chung@amd.com \
    --to=chiahsuan.chung@amd.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