Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Hung <alex.hung@amd.com>
To: Tom Chung <chiahsuan.chung@amd.com>, igt-dev@lists.freedesktop.org
Cc: christian.koenig@amd.com
Subject: Re: [igt-dev] [i-g-t, v4 4/8] tests/amdgpu/amd_freesync_video_mode: Add some code from kms_vrr to resolve tearing issue
Date: Mon, 10 Jul 2023 11:17:24 -0600	[thread overview]
Message-ID: <5aca6f5f-a861-3d17-18b6-c680b03514eb@amd.com> (raw)
In-Reply-To: <20230710075749.2377896-5-chiahsuan.chung@amd.com>

Reviewed-by: Alex Hung <alex.hung@amd.com>

On 2023-07-10 01:57, Tom Chung wrote:
> [Why]
> There is a tearing video issue during the stage-2 animation test.
> 
> [How]
> 1. Refer to the kms_vrr IGT code, it needs some delay before the the next flip and
>     add some warmup time before do the flip and measure to make the test more accurate.
> 2. Change the target refresh rate percentage to 75% to align with the kms_vrr test.
> 
> Signed-off-by: Tom Chung <chiahsuan.chung@amd.com>
> ---
>   tests/amdgpu/amd_freesync_video_mode.c | 22 ++++++++++++++++++----
>   1 file changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/amdgpu/amd_freesync_video_mode.c b/tests/amdgpu/amd_freesync_video_mode.c
> index 29ba1f65c..0927f4307 100644
> --- a/tests/amdgpu/amd_freesync_video_mode.c
> +++ b/tests/amdgpu/amd_freesync_video_mode.c
> @@ -26,7 +26,7 @@
>   #include <signal.h>
>   
>   #define NSECS_PER_SEC		(1000000000ull)
> -#define TEST_DURATION_NS	(10 * NSECS_PER_SEC)
> +#define TEST_DURATION_NS	(8 * NSECS_PER_SEC)
>   
>   #define BYTES_PER_PIXEL         4
>   #define MK_COLOR(r, g, b)	((0 << 24) | (r << 16) | (g << 8) | b)
> @@ -638,7 +638,7 @@ flip_and_measure(
>   	igt_info("interval_ns=%lu\n", interval_ns);
>   
>   	for (;;) {
> -		uint64_t event_ns;
> +		uint64_t event_ns, wait_ns;
>   		int64_t diff_ns;
>   
>   		data->front = !data->front;
> @@ -673,6 +673,19 @@ flip_and_measure(
>   
>   		if (event_ns - start_ns > duration_ns)
>   			break;
> +
> +		/*
> +		 * Burn CPU until next timestamp, sleeping isn't accurate enough.
> +		 * The target timestamp is based on the delta b/w event timestamps
> +		 * and whatever the time left to reach the expected refresh rate.
> +		 */
> +		diff_ns = event_ns - target_ns;
> +		wait_ns = ((diff_ns + interval_ns - 1) / interval_ns) * interval_ns;
> +		wait_ns -= diff_ns;
> +		target_ns = event_ns + wait_ns;
> +
> +		while (get_time_ns() < target_ns - 10)
> +			;
>   	}
>   
>   	igt_info("Completed %u flips, %u were in threshold for (%llu Hz) %"PRIu64"ns.\n",
> @@ -808,9 +821,10 @@ mode_transition(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t sce
>   	igt_info("stage-2: simple animation as video playback\n");
>   	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 */
> +	result = flip_and_measure(data, output, pipe, interval, 2 * NSECS_PER_SEC, ANIM_TYPE_CIRCLE_WAVE);
>   	result = flip_and_measure(data, output, pipe, interval, TEST_DURATION_NS, ANIM_TYPE_CIRCLE_WAVE);
> -	igt_assert_f(result > 90, "Target refresh rate not meet(result=%d%%\n", result);
> -
> +	igt_assert_f(result > 75, "Target refresh rate not meet 75%% (result=%d%%\n", result);
>   	finish_test(data, pipe, output);
>   }
>   

  reply	other threads:[~2023-07-10 17:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10  7:57 [igt-dev] [i-g-t,v4 0/8] Fix some bugs in amd_freesync_video_mode Tom Chung
2023-07-10  7:57 ` [igt-dev] [i-g-t, v4 1/8] tests/amdgpu/amd_freesync_video_mode: Adjust indents and spacing Tom Chung
2023-07-10 17:13   ` Alex Hung
2023-07-10  7:57 ` [igt-dev] [i-g-t, v4 2/8] tests/amdgpu/amd_freesync_video_mode: Fix memory leak and corruption Tom Chung
2023-07-10 17:16   ` Alex Hung
2023-07-10  7:57 ` [igt-dev] [i-g-t, v4 3/8] tests/amdgpu/amd_freesync_video_mode: Fix wrong resolution setting during the test Tom Chung
2023-07-10 17:16   ` Alex Hung
2023-07-10  7:57 ` [igt-dev] [i-g-t, v4 4/8] tests/amdgpu/amd_freesync_video_mode: Add some code from kms_vrr to resolve tearing issue Tom Chung
2023-07-10 17:17   ` Alex Hung [this message]
2023-07-10  7:57 ` [igt-dev] [i-g-t, v4 5/8] tests/amdgpu/amd_freesync_video_mode: Add/remove some test progress messages Tom Chung
2023-07-10 17:18   ` Alex Hung
2023-07-10  7:57 ` [igt-dev] [i-g-t, v4 6/8] tests/amdgpu/amd_freesync_video_mode: Move the vrr setting and display reset Tom Chung
2023-07-10 17:19   ` Alex Hung
2023-07-10  7:57 ` [igt-dev] [i-g-t, v4 7/8] tests/amdgpu/amd_freesync_video_mode: Fix wrong resolution setting for some panel Tom Chung
2023-07-10 17:19   ` Alex Hung
2023-07-10  7:57 ` [igt-dev] [i-g-t, v4 8/8] tests/amdgpu/amd_freesync_video_mode: Add amd_freesync_video_mode to meson.build Tom Chung
2023-07-10 17:19   ` Alex Hung
2023-07-10  8:50 ` [igt-dev] ✓ Fi.CI.BAT: success for Fix some bugs in amd_freesync_video_mode (rev3) Patchwork
2023-07-10  9:26 ` [igt-dev] ○ CI.xeBAT: info " Patchwork
2023-07-10 10:13 ` [igt-dev] ✓ Fi.CI.IGT: success " 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=5aca6f5f-a861-3d17-18b6-c680b03514eb@amd.com \
    --to=alex.hung@amd.com \
    --cc=chiahsuan.chung@amd.com \
    --cc=christian.koenig@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