Skip to contentSkip to conversation

tests/kms_vrr: Update condition checks for flipline test

PATCH Superseded Bhanuprakash Modem 3 participants 6 messages Jan 19, 2021 – Jan 22, 2021

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/kms_vrr: Update condition checks for flipline test

This patch includes below updates
* For Flipline test: if refresh_rate <= Vrr_min then
- Expected returned refresh rate would be vrr_max
- At least 35% of the flips should be in threshold
* Update "igt_display_commit_atomic" with "igt_display_commit2"
* Add few debug prints

V2:
* Rebase

Cc Manasi Navare <[email protected]>
Cc Nicholas Kazlauskas <[email protected]>
---
 tests/kms_vrr.c | 51 ++++++++++++++++++++-----------------------------
 1 file changed, 21 insertions(+), 30 deletions(-)
tests/kms_vrr.c +21 -30
index beb06854f..e6edd131f 100644
@@ -170,7 +170,7 @@ static void set_vrr_on_pipe(data_t *data, enum pipe pipe, bool enabled)
 {
 	igt_pipe_set_prop_value(&data->display, pipe, IGT_CRTC_VRR_ENABLED,
 				enabled);
-	igt_display_commit_atomic(&data->display, 0, NULL);
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 }
 
 /* Prepare the display for testing on the given pipe. */
@@ -208,8 +208,7 @@ static void prepare_test(data_t *data, igt_output_t *output, enum pipe pipe)
 	 */
 	igt_pipe_set_prop_value(&data->display, pipe, IGT_CRTC_VRR_ENABLED, 0);
 
-	igt_display_commit_atomic(&data->display,
-				  DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 }
 
 /* Waits for the vblank interval. Returns the vblank timestamp in ns. */
@@ -291,14 +290,10 @@ flip_and_measure(data_t *data, igt_output_t *output, enum pipe pipe,
 		 * difference between 144Hz and 143Hz which should give this
 		 * enough accuracy for most use cases.
 		 */
-		if (rate_ns <= vtest_ns.min && rate_ns >= vtest_ns.max)
+		if ((rate_ns < vtest_ns.min) && (rate_ns >= vtest_ns.max))
 			diff_ns = rate_ns;
-		else if (rate_ns > vtest_ns.min)
-			diff_ns = vtest_ns.min;
-		else if (rate_ns < vtest_ns.max)
-			diff_ns = vtest_ns.max;
 		else
-			diff_ns = rate_ns;
+			diff_ns = vtest_ns.max;
 		diff_ns -= event_ns - last_event_ns;
 
 		if (llabs(diff_ns) < 50000ll)
@@ -323,8 +318,8 @@ flip_and_measure(data_t *data, igt_output_t *output, enum pipe pipe,
 		while (get_time_ns() < target_ns);
 	}
 
-	igt_info("Completed %u flips, %u were in threshold for %"PRIu64"ns.\n",
-		 total_flip, total_pass, rate_ns);
+	igt_info("Completed %u flips, %u were in threshold for (%llu Hz) %"PRIu64"ns.\n",
+		 total_flip, total_pass, (NSECS_PER_SEC/rate_ns), rate_ns);
 
 	return total_flip ? ((total_pass * 100) / total_flip) : 0;
 }
@@ -338,8 +333,8 @@ test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)
 	range_t range = get_vrr_range(data, output);
 	uint64_t rate = vtest_ns.mid;
 
-	igt_info("VRR Test execution on %s, PIPE_%s\n",
-		 output->name, kmstest_pipe_name(pipe));
+	igt_info("VRR Test execution on %s, PIPE_%s with VRR range: (%u-%u) Hz\n",
+		 output->name, kmstest_pipe_name(pipe), range.min, range.max);
 
 	prepare_test(data, output, pipe);
 
@@ -370,46 +365,42 @@ test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)
 	 * decision boundary.
 	 *
 	 * Example: if range is 40 - 60Hz and
-	 * if refresh_rate > 60Hz:
+	 * if refresh_rate > 60Hz or <= 40Hz:
 	 *      Flip should happen at the flipline boundary & returned refresh rate
 	 *      would be 60Hz.
 	 * if refresh_rate is 50Hz:
 	 *      Flip will happen right away so returned refresh rate is 50Hz.
-	 * if refresh_rate < 40Hz:
-	 *      Flip should happen at the vmax so the returned refresh rate
-	 *      would be 40Hz.
 	 */
 	if (flags & TEST_FLIPLINE) {
-		rate = rate_from_refresh(range.min - 5);
+		rate = rate_from_refresh(range.max + 5);
 		result = flip_and_measure(data, output, pipe, rate, TEST_DURATION_NS);
 		igt_assert_f(result > 75,
-			     "Refresh rate %"PRIu64"ns: Target VRR on threshold not reached, result was %u%%\n",
-			     rate, result);
+			     "Refresh rate (%u Hz) %"PRIu64"ns: Target VRR on threshold not reached, result was %u%%\n",
+			     (range.max + 5), rate, result);
 
-		rate = rate_from_refresh(range.max + 5);
+		rate = rate_from_refresh(range.min - 5);
 		result = flip_and_measure(data, output, pipe, rate, TEST_DURATION_NS);
-		igt_assert_f(result > 75,
-			     "Refresh rate %"PRIu64"ns: Target VRR on threshold not reached, result was %u%%\n",
-			     rate, result);
+		igt_assert_f(result > 35,
+			     "Refresh rate (%u Hz) %"PRIu64"ns: Target VRR on threshold not reached, result was %u%%\n",
+			     (range.min - 5), rate, result);
 	}
 
 	rate = vtest_ns.mid;
 	result = flip_and_measure(data, output, pipe, rate, TEST_DURATION_NS);
 	igt_assert_f(result > 75,
-		     "Refresh rate %"PRIu64"ns: Target VRR on threshold not reached, result was %u%%\n",
-		     rate, result);
+		     "Refresh rate (%u Hz) %"PRIu64"ns: Target VRR on threshold not reached, result was %u%%\n",
+		     ((range.max + range.min) / 2), rate, result);
 
 	set_vrr_on_pipe(data, pipe, 0);
 	result = flip_and_measure(data, output, pipe, rate, TEST_DURATION_NS);
 	igt_assert_f(result < 10,
-		     "Refresh rate %"PRIu64"ns: Target VRR off threshold exceeded, result was %u%%\n",
-		     rate, result);
+		     "Refresh rate (%u Hz) %"PRIu64"ns: Target VRR off threshold exceeded, result was %u%%\n",
+		     ((range.max + range.min) / 2), rate, result);
 
 	/* Clean-up */
 	igt_plane_set_fb(data->primary, NULL);
 	igt_output_set_pipe(output, PIPE_NONE);
-	igt_display_commit_atomic(&data->display,
-				  DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 
 	igt_remove_fb(data->drm_fd, &data->fb1);
 	igt_remove_fb(data->drm_fd, &data->fb0);

--
2.20.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#1 lore raw

[igt-dev] ✗ Fi.CI.BAT: failure for tests/kms_vrr: Update condition checks for flipline test (rev2)

== Series Details ==

== Series Details ==

Series: tests/kms_vrr: Update condition checks for flipline test (rev2)
URL : https://patchwork.freedesktop.org/series/84932/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_9636 -> IGTPW_5400
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with IGTPW_5400 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in IGTPW_5400, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5400/index.html

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_5400:

### IGT changes ###

#### Possible regressions ####

* igt@gem_render_linear_blits@basic:
- fi-byt-j1900: [PASS][1] -> [FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9636/fi-byt-j1900/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5400/fi-byt-j1900/igt@[email protected]

Known issues
------------

Here are the changes found in IGTPW_5400 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@amdgpu/amd_basic@cs-compute:
- fi-tgl-y: NOTRUN -> [SKIP][3] ([fdo#109315] / [i915#2575]) +5 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5400/fi-tgl-y/igt@amdgpu/[email protected]

* igt@prime_vgem@basic-fence-flip:
- fi-tgl-y: [PASS][4] -> [DMESG-WARN][5] ([i915#402]) +1 similar issue
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9636/fi-tgl-y/igt@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5400/fi-tgl-y/igt@[email protected]

#### Possible fixes ####

* igt@kms_chamelium@hdmi-crc-fast:
- fi-kbl-7500u: [DMESG-WARN][6] ([i915#2868]) -> [PASS][7]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9636/fi-kbl-7500u/igt@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5400/fi-kbl-7500u/igt@[email protected]

* igt@prime_self_import@basic-with_two_bos:
- fi-tgl-y: [DMESG-WARN][8] ([i915#402]) -> [PASS][9] +1 similar issue
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9636/fi-tgl-y/igt@prime_self_import@basic-with_two_bos.html
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5400/fi-tgl-y/igt@prime_self_import@basic-with_two_bos.html

[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
[i915#2868]: https://gitlab.freedesktop.org/drm/intel/issues/2868
[i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402

Participating hosts (44 -> 37)
------------------------------

Missing (7): fi-ilk-m540 fi-hsw-4200u fi-bsw-cyan fi-ctg-p8600 fi-dg1-1 fi-cml-drallion fi-bdw-samus

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_5960 -> IGTPW_5400

CI-20190529: 20190529
CI_DRM_9636: f560ac388c527f2f166897c9091f7b9ad652050f @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_5400: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5400/index.html
IGT_5960: ace82fcd5f3623f8dde7c220a825873dc53dfae4 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5400/index.html

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#2 lore raw
In reply to Bhanuprakash Modem
Quoted 6 lines · Bhanuprakash Modem

This patch includes below updates
* For Flipline test: if refresh_rate <= Vrr_min then
- Expected returned refresh rate would be vrr_max
- At least 35% of the flips should be in threshold
* Update "igt_display_commit_atomic" with "igt_display_commit2"
* Add few debug prints

Some ideas I had for a vrr test:
- test flipping at a few different rates
- make sure the interval between flip timestamps
matches the expected rate
- otherwise confirm the timestamps are sensible. Not quite sure what the best way would be. One idea was to just make sure the timestamp points to more or less the correct point in time. Another idea was to drive the whole loop baed on the timestamps + target refresh rate (ie. wait for event, schedule next flip for event timestamps + whatever time we have left to reach the exected refresh rate). This latter idea I think would catch bugs where the interval between timestamps is correct but the absolute times are not correct (eg. if the timestamps are miscorrected to point fr into the future based on the max vblank length, or too close into the future based on min vblank length).
- the busy loop thing I don't think should be needed. Sure, there is some wakeup latency due to C-states and whatnot, but it should be possible to compensate to make sure we reach the target refresh rate w/o spinning.

Quoted 140 lines

V2:
* Rebase

Cc Manasi Navare <[email protected]>
Cc Nicholas Kazlauskas <[email protected]>
---
 tests/kms_vrr.c | 51 ++++++++++++++++++++-----------------------------
 1 file changed, 21 insertions(+), 30 deletions(-)
tests/kms_vrr.c +21 -31
index beb06854f..e6edd131f 100644
@@ -170,7 +170,7 @@ static void set_vrr_on_pipe(data_t *data, enum pipe pipe, bool enabled)
 {
 	igt_pipe_set_prop_value(&data->display, pipe, IGT_CRTC_VRR_ENABLED,
 				enabled);
-	igt_display_commit_atomic(&data->display, 0, NULL);
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 }
 
 /* Prepare the display for testing on the given pipe. */
@@ -208,8 +208,7 @@ static void prepare_test(data_t *data, igt_output_t *output, enum pipe pipe)
 	 */
 	igt_pipe_set_prop_value(&data->display, pipe, IGT_CRTC_VRR_ENABLED, 0);
 
-	igt_display_commit_atomic(&data->display,
-				  DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 }
 
 /* Waits for the vblank interval. Returns the vblank timestamp in ns. */
@@ -291,14 +290,10 @@ flip_and_measure(data_t *data, igt_output_t *output, enum pipe pipe,
 		 * difference between 144Hz and 143Hz which should give this
 		 * enough accuracy for most use cases.
 		 */
-		if (rate_ns <= vtest_ns.min && rate_ns >= vtest_ns.max)
+		if ((rate_ns < vtest_ns.min) && (rate_ns >= vtest_ns.max))
 			diff_ns = rate_ns;
-		else if (rate_ns > vtest_ns.min)
-			diff_ns = vtest_ns.min;
-		else if (rate_ns < vtest_ns.max)
-			diff_ns = vtest_ns.max;
 		else
-			diff_ns = rate_ns;
+			diff_ns = vtest_ns.max;
 		diff_ns -= event_ns - last_event_ns;
 
 		if (llabs(diff_ns) < 50000ll)
@@ -323,8 +318,8 @@ flip_and_measure(data_t *data, igt_output_t *output, enum pipe pipe,
 		while (get_time_ns() < target_ns);
 	}
 
-	igt_info("Completed %u flips, %u were in threshold for %"PRIu64"ns.\n",
-		 total_flip, total_pass, rate_ns);
+	igt_info("Completed %u flips, %u were in threshold for (%llu Hz) %"PRIu64"ns.\n",
+		 total_flip, total_pass, (NSECS_PER_SEC/rate_ns), rate_ns);
 
 	return total_flip ? ((total_pass * 100) / total_flip) : 0;
 }
@@ -338,8 +333,8 @@ test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)
 	range_t range = get_vrr_range(data, output);
 	uint64_t rate = vtest_ns.mid;
 
-	igt_info("VRR Test execution on %s, PIPE_%s\n",
-		 output->name, kmstest_pipe_name(pipe));
+	igt_info("VRR Test execution on %s, PIPE_%s with VRR range: (%u-%u) Hz\n",
+		 output->name, kmstest_pipe_name(pipe), range.min, range.max);
 
 	prepare_test(data, output, pipe);
 
@@ -370,46 +365,42 @@ test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)
 	 * decision boundary.
 	 *
 	 * Example: if range is 40 - 60Hz and
-	 * if refresh_rate > 60Hz:
+	 * if refresh_rate > 60Hz or <= 40Hz:
 	 *      Flip should happen at the flipline boundary & returned refresh rate
 	 *      would be 60Hz.
 	 * if refresh_rate is 50Hz:
 	 *      Flip will happen right away so returned refresh rate is 50Hz.
-	 * if refresh_rate < 40Hz:
-	 *      Flip should happen at the vmax so the returned refresh rate
-	 *      would be 40Hz.
 	 */
 	if (flags & TEST_FLIPLINE) {
-		rate = rate_from_refresh(range.min - 5);
+		rate = rate_from_refresh(range.max + 5);
 		result = flip_and_measure(data, output, pipe, rate, TEST_DURATION_NS);
 		igt_assert_f(result > 75,
-			     "Refresh rate %"PRIu64"ns: Target VRR on threshold not reached, result was %u%%\n",
-			     rate, result);
+			     "Refresh rate (%u Hz) %"PRIu64"ns: Target VRR on threshold not reached, result was %u%%\n",
+			     (range.max + 5), rate, result);
 
-		rate = rate_from_refresh(range.max + 5);
+		rate = rate_from_refresh(range.min - 5);
 		result = flip_and_measure(data, output, pipe, rate, TEST_DURATION_NS);
-		igt_assert_f(result > 75,
-			     "Refresh rate %"PRIu64"ns: Target VRR on threshold not reached, result was %u%%\n",
-			     rate, result);
+		igt_assert_f(result > 35,
+			     "Refresh rate (%u Hz) %"PRIu64"ns: Target VRR on threshold not reached, result was %u%%\n",
+			     (range.min - 5), rate, result);
 	}
 
 	rate = vtest_ns.mid;
 	result = flip_and_measure(data, output, pipe, rate, TEST_DURATION_NS);
 	igt_assert_f(result > 75,
-		     "Refresh rate %"PRIu64"ns: Target VRR on threshold not reached, result was %u%%\n",
-		     rate, result);
+		     "Refresh rate (%u Hz) %"PRIu64"ns: Target VRR on threshold not reached, result was %u%%\n",
+		     ((range.max + range.min) / 2), rate, result);
 
 	set_vrr_on_pipe(data, pipe, 0);
 	result = flip_and_measure(data, output, pipe, rate, TEST_DURATION_NS);
 	igt_assert_f(result < 10,
-		     "Refresh rate %"PRIu64"ns: Target VRR off threshold exceeded, result was %u%%\n",
-		     rate, result);
+		     "Refresh rate (%u Hz) %"PRIu64"ns: Target VRR off threshold exceeded, result was %u%%\n",
+		     ((range.max + range.min) / 2), rate, result);
 
 	/* Clean-up */
 	igt_plane_set_fb(data->primary, NULL);
 	igt_output_set_pipe(output, PIPE_NONE);
-	igt_display_commit_atomic(&data->display,
-				  DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 
 	igt_remove_fb(data->drm_fd, &data->fb1);
 	igt_remove_fb(data->drm_fd, &data->fb0);
--

2.20.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#3 lore raw
Quoted 16 lines

-----Original Message-----
From: Ville Syrjälä <[email protected]>
Sent: Wednesday, January 20, 2021 12:46 AM
To: Modem, Bhanuprakash <[email protected]>
Cc: [email protected]
Subject: Re: [igt-dev] [PATCH i-g-t] tests/kms_vrr: Update condition checks for flipline test

Quoted 6 lines · Bhanuprakash Modem

This patch includes below updates
* For Flipline test: if refresh_rate <= Vrr_min then
- Expected returned refresh rate would be vrr_max
- At least 35% of the flips should be in threshold
* Update "igt_display_commit_atomic" with "igt_display_commit2"
* Add few debug prints

Quoted 4 lines

Some ideas I had for a vrr test:
- test flipping at a few different rates
- make sure the interval between flip timestamps
matches the expected rate

Actually, we are doing the same in our flipline[*] test.

Example: if we have a monitor with vrr range of 40 - 60Hz We'll try to flip with 35, 50 and 65 Hz, and the difference between the two flip timestamps should be within the required threshold from the expected rate. A ~50us threshold is an arbitrary.

[*] https://patchwork.freedesktop.org/patch/392037

Quoted 6 lines

- otherwise confirm the timestamps are sensible. Not quite sure what the best way would be. One idea was to just make sure the timestamp points to more or less the correct point in time. Another idea was to drive the whole loop baed on the timestamps + target refresh rate (ie. wait for event, schedule next flip for event timestamps + whatever time we have left to reach the exected refresh rate). This latter idea I think

Quoted 8 lines

would catch bugs where the interval between timestamps is correct but the absolute times are not correct (eg. if the timestamps are miscorrected to point fr into the future based on the max vblank length, or too close into the future based on min vblank length).
- the busy loop thing I don't think should be needed. Sure, there is some wakeup latency due to C-states and whatnot, but it should be possible to compensate to make sure we reach the target refresh rate w/o spinning.

This part is not clear to me.

Ex. To generate the flips with refresh rate 50Hz (ie. 20000000ns), below is the expected sequence:

* Request a flip & wait for flip completion event
* Capture the event timestamp to compare
* Wait 20000000ns for next flip
* Repeat

Am I missing something here?

Quoted 162 lines

tests/kms_vrr.c static void set_vrr_on_pipe(data_t *data, enum pipe

Quoted 17 lines

V2:
* Rebase

Cc Manasi Navare <[email protected]>
Cc Nicholas Kazlauskas <[email protected]>
---
 tests/kms_vrr.c | 51 ++++++++++++++++++++-----------------------------
 1 file changed, 21 insertions(+), 30 deletions(-)
tests/kms_vrr.c +0 -0
index beb06854f..e6edd131f 100644
@@ -170,7 +170,7 @@ static void set_vrr_on_pipe(data_t *data, enum pipe

pipe, bool enabled)

tests/kms_vrr.c static void prepare_test(data_t *data, igt_output_t

Quoted 9 lines
tests/kms_vrr.c +1 -1
 {
 	igt_pipe_set_prop_value(&data->display, pipe, IGT_CRTC_VRR_ENABLED,
 				enabled);
-	igt_display_commit_atomic(&data->display, 0, NULL);
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 }
 
 /* Prepare the display for testing on the given pipe. */
@@ -208,8 +208,7 @@ static void prepare_test(data_t *data, igt_output_t

*output, enum pipe pipe)

tests/kms_vrr.c static void prepare_test(data_t *data, igt_output_t · line 209

Quoted 2 lines
tests/kms_vrr.c +0 -0
 	 */
 	igt_pipe_set_prop_value(&data->display, pipe, IGT_CRTC_VRR_ENABLED,

0);

tests/kms_vrr.c static void prepare_test(data_t *data, igt_output_t *output, enum pipe pipe)

Quoted 7 lines
tests/kms_vrr.c +1 -2
-	igt_display_commit_atomic(&data->display,
-				  DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 }
 
 /* Waits for the vblank interval. Returns the vblank timestamp in ns.

*/

tests/kms_vrr.c flip_and_measure(data_t *data, igt_output_t

Quoted 1 line
tests/kms_vrr.c +0 -0
@@ -291,14 +290,10 @@ flip_and_measure(data_t *data, igt_output_t

*output, enum pipe pipe,

tests/kms_vrr.c flip_and_measure(data_t *data, igt_output_t *output,

Quoted 17 lines
tests/kms_vrr.c +2 -6
 		 * difference between 144Hz and 143Hz which should give this
 		 * enough accuracy for most use cases.
 		 */
-		if (rate_ns <= vtest_ns.min && rate_ns >= vtest_ns.max)
+		if ((rate_ns < vtest_ns.min) && (rate_ns >= vtest_ns.max))
 			diff_ns = rate_ns;
-		else if (rate_ns > vtest_ns.min)
-			diff_ns = vtest_ns.min;
-		else if (rate_ns < vtest_ns.max)
-			diff_ns = vtest_ns.max;
 		else
-			diff_ns = rate_ns;
+			diff_ns = vtest_ns.max;
 		diff_ns -= event_ns - last_event_ns;
 
 		if (llabs(diff_ns) < 50000ll)
@@ -323,8 +318,8 @@ flip_and_measure(data_t *data, igt_output_t *output,

enum pipe pipe,

tests/kms_vrr.c flip_and_measure(data_t *data, igt_output_t *output, enum pipe pipe,

Quoted 4 lines
tests/kms_vrr.c +0 -1
 		while (get_time_ns() < target_ns);
 	}
 
-	igt_info("Completed %u flips, %u were in threshold for

%"PRIu64"ns.\n",

tests/kms_vrr.c flip_and_measure(data_t *data, igt_output_t *output, · line 321

Quoted 2 lines
tests/kms_vrr.c +1 -1
-		 total_flip, total_pass, rate_ns);
+	igt_info("Completed %u flips, %u were in threshold for (%llu Hz)

%"PRIu64"ns.\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe,

Quoted 5 lines
tests/kms_vrr.c +1 -0
+		 total_flip, total_pass, (NSECS_PER_SEC/rate_ns), rate_ns);
 
 	return total_flip ? ((total_pass * 100) / total_flip) : 0;
 }
@@ -338,8 +333,8 @@ test_basic(data_t *data, enum pipe pipe,

igt_output_t *output, uint32_t flags)

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 6 lines
tests/kms_vrr.c +1 -2
 	range_t range = get_vrr_range(data, output);
 	uint64_t rate = vtest_ns.mid;
 
-	igt_info("VRR Test execution on %s, PIPE_%s\n",
-		 output->name, kmstest_pipe_name(pipe));
+	igt_info("VRR Test execution on %s, PIPE_%s with VRR range: (%u-%u)

Hz\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe,

Quoted 5 lines
tests/kms_vrr.c +1 -0
+		 output->name, kmstest_pipe_name(pipe), range.min, range.max);
 
 	prepare_test(data, output, pipe);
 
@@ -370,46 +365,42 @@ test_basic(data_t *data, enum pipe pipe,

igt_output_t *output, uint32_t flags)

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 6 lines
tests/kms_vrr.c +1 -1
 	 * decision boundary.
 	 *
 	 * Example: if range is 40 - 60Hz and
-	 * if refresh_rate > 60Hz:
+	 * if refresh_rate > 60Hz or <= 40Hz:
 	 *      Flip should happen at the flipline boundary & returned

refresh rate

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 3 lines
tests/kms_vrr.c +0 -0
 	 *      would be 60Hz.
 	 * if refresh_rate is 50Hz:
 	 *      Flip will happen right away so returned refresh rate is

50Hz.

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 8 lines
tests/kms_vrr.c +1 -4
-	 * if refresh_rate < 40Hz:
-	 *      Flip should happen at the vmax so the returned refresh rate
-	 *      would be 40Hz.
 	 */
 	if (flags & TEST_FLIPLINE) {
-		rate = rate_from_refresh(range.min - 5);
+		rate = rate_from_refresh(range.max + 5);
 		result = flip_and_measure(data, output, pipe, rate,

TEST_DURATION_NS);

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, · line 386

Quoted 2 lines
tests/kms_vrr.c +0 -1
 		igt_assert_f(result > 75,
-			     "Refresh rate %"PRIu64"ns: Target VRR on threshold

not reached, result was %u%%\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, · line 378

Quoted 2 lines
tests/kms_vrr.c +1 -1
-			     rate, result);
+			     "Refresh rate (%u Hz) %"PRIu64"ns: Target VRR on

threshold not reached, result was %u%%\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 5 lines
tests/kms_vrr.c +2 -1
+			     (range.max + 5), rate, result);
 
-		rate = rate_from_refresh(range.max + 5);
+		rate = rate_from_refresh(range.min - 5);
 		result = flip_and_measure(data, output, pipe, rate,

TEST_DURATION_NS);

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, · line 392

Quoted 2 lines
tests/kms_vrr.c +0 -2
-		igt_assert_f(result > 75,
-			     "Refresh rate %"PRIu64"ns: Target VRR on threshold

not reached, result was %u%%\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 3 lines
tests/kms_vrr.c +2 -1
-			     rate, result);
+		igt_assert_f(result > 35,
+			     "Refresh rate (%u Hz) %"PRIu64"ns: Target VRR on

threshold not reached, result was %u%%\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 5 lines
tests/kms_vrr.c +1 -0
+			     (range.min - 5), rate, result);
 	}
 
 	rate = vtest_ns.mid;
 	result = flip_and_measure(data, output, pipe, rate,

TEST_DURATION_NS);

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, · line 399

Quoted 2 lines
tests/kms_vrr.c +0 -1
 	igt_assert_f(result > 75,
-		     "Refresh rate %"PRIu64"ns: Target VRR on threshold not

reached, result was %u%%\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, · line 391

Quoted 2 lines
tests/kms_vrr.c +1 -1
-		     rate, result);
+		     "Refresh rate (%u Hz) %"PRIu64"ns: Target VRR on threshold

not reached, result was %u%%\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 4 lines
tests/kms_vrr.c +1 -0
+		     ((range.max + range.min) / 2), rate, result);
 
 	set_vrr_on_pipe(data, pipe, 0);
 	result = flip_and_measure(data, output, pipe, rate,

TEST_DURATION_NS);

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, · line 405

Quoted 2 lines
tests/kms_vrr.c +0 -1
 	igt_assert_f(result < 10,
-		     "Refresh rate %"PRIu64"ns: Target VRR off threshold

exceeded, result was %u%%\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, · line 397

Quoted 2 lines
tests/kms_vrr.c +1 -1
-		     rate, result);
+		     "Refresh rate (%u Hz) %"PRIu64"ns: Target VRR off

threshold exceeded, result was %u%%\n",

Quoted 14 lines
tests/kms_vrr.c +2 -3
+		     ((range.max + range.min) / 2), rate, result);
 
 	/* Clean-up */
 	igt_plane_set_fb(data->primary, NULL);
 	igt_output_set_pipe(output, PIPE_NONE);
-	igt_display_commit_atomic(&data->display,
-				  DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 
 	igt_remove_fb(data->drm_fd, &data->fb1);
 	igt_remove_fb(data->drm_fd, &data->fb0);
--

2.20.1

Quoted 8 lines
Quoted 4 lines

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

--
Ville Syrjälä
Intel

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#4 lore raw
Quoted 43 lines · Bhanuprakash
Quoted 16 lines

-----Original Message-----
From: Ville Syrjälä <[email protected]>
Sent: Wednesday, January 20, 2021 12:46 AM
To: Modem, Bhanuprakash <[email protected]>
Cc: [email protected]
Subject: Re: [igt-dev] [PATCH i-g-t] tests/kms_vrr: Update condition checks for flipline test

Quoted 6 lines · Bhanuprakash Modem

This patch includes below updates
* For Flipline test: if refresh_rate <= Vrr_min then
- Expected returned refresh rate would be vrr_max
- At least 35% of the flips should be in threshold
* Update "igt_display_commit_atomic" with "igt_display_commit2"
* Add few debug prints

Quoted 4 lines

Some ideas I had for a vrr test:
- test flipping at a few different rates
- make sure the interval between flip timestamps
matches the expected rate

Actually, we are doing the same in our flipline[*] test.

Example: if we have a monitor with vrr range of 40 - 60Hz We'll try to flip with 35, 50 and 65 Hz, and the difference between the two flip timestamps should be within the required threshold from the expected rate. A ~50us threshold is an arbitrary.

[*] https://patchwork.freedesktop.org/patch/392037

Quoted 6 lines

- otherwise confirm the timestamps are sensible. Not quite sure what the best way would be. One idea was to just make sure the timestamp points to more or less the correct point in time. Another idea was to drive the whole loop baed on the timestamps + target refresh rate (ie. wait for event, schedule next flip for event timestamps + whatever time we have left to reach the exected refresh rate). This latter idea I think

Quoted 8 lines

would catch bugs where the interval between timestamps is correct but the absolute times are not correct (eg. if the timestamps are miscorrected to point fr into the future based on the max vblank length, or too close into the future based on min vblank length).
- the busy loop thing I don't think should be needed. Sure, there is some wakeup latency due to C-states and whatnot, but it should be possible to compensate to make sure we reach the target refresh rate w/o spinning.

Quoted 8 lines

This part is not clear to me.

Ex. To generate the flips with refresh rate 50Hz (ie. 20000000ns), below is the expected sequence:

* Request a flip & wait for flip completion event
* Capture the event timestamp to compare
* Wait 20000000ns for next flip

That would anyway need a bit of correction to account for event delivery latency + whatever overhead we have in submitting the flip.

But in addition I was suggesting that we calculate how long to wait based on the flip event timestamp + whatever extra is needed on top to reach the target frame rate. Thus if the timestamp is garbage the test should fail since we'll end up flipping at the wrong rate.

Quoted 174 lines

* Repeat

Am I missing something here?

Quoted 170 lines

tests/kms_vrr.c static void set_vrr_on_pipe(data_t *data, enum pipe

Quoted 17 lines

V2:
* Rebase

Cc Manasi Navare <[email protected]>
Cc Nicholas Kazlauskas <[email protected]>
---
 tests/kms_vrr.c | 51 ++++++++++++++++++++-----------------------------
 1 file changed, 21 insertions(+), 30 deletions(-)
tests/kms_vrr.c +0 -0
index beb06854f..e6edd131f 100644
@@ -170,7 +170,7 @@ static void set_vrr_on_pipe(data_t *data, enum pipe

pipe, bool enabled)

tests/kms_vrr.c static void prepare_test(data_t *data, igt_output_t

Quoted 9 lines
tests/kms_vrr.c +1 -1
 {
 	igt_pipe_set_prop_value(&data->display, pipe, IGT_CRTC_VRR_ENABLED,
 				enabled);
-	igt_display_commit_atomic(&data->display, 0, NULL);
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 }
 
 /* Prepare the display for testing on the given pipe. */
@@ -208,8 +208,7 @@ static void prepare_test(data_t *data, igt_output_t

*output, enum pipe pipe)

tests/kms_vrr.c static void prepare_test(data_t *data, igt_output_t · line 209

Quoted 2 lines
tests/kms_vrr.c +0 -0
 	 */
 	igt_pipe_set_prop_value(&data->display, pipe, IGT_CRTC_VRR_ENABLED,

0);

tests/kms_vrr.c static void prepare_test(data_t *data, igt_output_t *output, enum pipe pipe)

Quoted 7 lines
tests/kms_vrr.c +1 -2
-	igt_display_commit_atomic(&data->display,
-				  DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 }
 
 /* Waits for the vblank interval. Returns the vblank timestamp in ns.

*/

tests/kms_vrr.c flip_and_measure(data_t *data, igt_output_t

Quoted 1 line
tests/kms_vrr.c +0 -0
@@ -291,14 +290,10 @@ flip_and_measure(data_t *data, igt_output_t

*output, enum pipe pipe,

tests/kms_vrr.c flip_and_measure(data_t *data, igt_output_t *output,

Quoted 17 lines
tests/kms_vrr.c +2 -6
 		 * difference between 144Hz and 143Hz which should give this
 		 * enough accuracy for most use cases.
 		 */
-		if (rate_ns <= vtest_ns.min && rate_ns >= vtest_ns.max)
+		if ((rate_ns < vtest_ns.min) && (rate_ns >= vtest_ns.max))
 			diff_ns = rate_ns;
-		else if (rate_ns > vtest_ns.min)
-			diff_ns = vtest_ns.min;
-		else if (rate_ns < vtest_ns.max)
-			diff_ns = vtest_ns.max;
 		else
-			diff_ns = rate_ns;
+			diff_ns = vtest_ns.max;
 		diff_ns -= event_ns - last_event_ns;
 
 		if (llabs(diff_ns) < 50000ll)
@@ -323,8 +318,8 @@ flip_and_measure(data_t *data, igt_output_t *output,

enum pipe pipe,

tests/kms_vrr.c flip_and_measure(data_t *data, igt_output_t *output, enum pipe pipe,

Quoted 4 lines
tests/kms_vrr.c +0 -1
 		while (get_time_ns() < target_ns);
 	}
 
-	igt_info("Completed %u flips, %u were in threshold for

%"PRIu64"ns.\n",

tests/kms_vrr.c flip_and_measure(data_t *data, igt_output_t *output, · line 321

Quoted 2 lines
tests/kms_vrr.c +1 -1
-		 total_flip, total_pass, rate_ns);
+	igt_info("Completed %u flips, %u were in threshold for (%llu Hz)

%"PRIu64"ns.\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe,

Quoted 5 lines
tests/kms_vrr.c +1 -0
+		 total_flip, total_pass, (NSECS_PER_SEC/rate_ns), rate_ns);
 
 	return total_flip ? ((total_pass * 100) / total_flip) : 0;
 }
@@ -338,8 +333,8 @@ test_basic(data_t *data, enum pipe pipe,

igt_output_t *output, uint32_t flags)

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 6 lines
tests/kms_vrr.c +1 -2
 	range_t range = get_vrr_range(data, output);
 	uint64_t rate = vtest_ns.mid;
 
-	igt_info("VRR Test execution on %s, PIPE_%s\n",
-		 output->name, kmstest_pipe_name(pipe));
+	igt_info("VRR Test execution on %s, PIPE_%s with VRR range: (%u-%u)

Hz\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe,

Quoted 5 lines
tests/kms_vrr.c +1 -0
+		 output->name, kmstest_pipe_name(pipe), range.min, range.max);
 
 	prepare_test(data, output, pipe);
 
@@ -370,46 +365,42 @@ test_basic(data_t *data, enum pipe pipe,

igt_output_t *output, uint32_t flags)

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 6 lines
tests/kms_vrr.c +1 -1
 	 * decision boundary.
 	 *
 	 * Example: if range is 40 - 60Hz and
-	 * if refresh_rate > 60Hz:
+	 * if refresh_rate > 60Hz or <= 40Hz:
 	 *      Flip should happen at the flipline boundary & returned

refresh rate

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 3 lines
tests/kms_vrr.c +0 -0
 	 *      would be 60Hz.
 	 * if refresh_rate is 50Hz:
 	 *      Flip will happen right away so returned refresh rate is

50Hz.

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 8 lines
tests/kms_vrr.c +1 -4
-	 * if refresh_rate < 40Hz:
-	 *      Flip should happen at the vmax so the returned refresh rate
-	 *      would be 40Hz.
 	 */
 	if (flags & TEST_FLIPLINE) {
-		rate = rate_from_refresh(range.min - 5);
+		rate = rate_from_refresh(range.max + 5);
 		result = flip_and_measure(data, output, pipe, rate,

TEST_DURATION_NS);

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, · line 386

Quoted 2 lines
tests/kms_vrr.c +0 -1
 		igt_assert_f(result > 75,
-			     "Refresh rate %"PRIu64"ns: Target VRR on threshold

not reached, result was %u%%\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, · line 378

Quoted 2 lines
tests/kms_vrr.c +1 -1
-			     rate, result);
+			     "Refresh rate (%u Hz) %"PRIu64"ns: Target VRR on

threshold not reached, result was %u%%\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 5 lines
tests/kms_vrr.c +2 -1
+			     (range.max + 5), rate, result);
 
-		rate = rate_from_refresh(range.max + 5);
+		rate = rate_from_refresh(range.min - 5);
 		result = flip_and_measure(data, output, pipe, rate,

TEST_DURATION_NS);

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, · line 392

Quoted 2 lines
tests/kms_vrr.c +0 -2
-		igt_assert_f(result > 75,
-			     "Refresh rate %"PRIu64"ns: Target VRR on threshold

not reached, result was %u%%\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 3 lines
tests/kms_vrr.c +2 -1
-			     rate, result);
+		igt_assert_f(result > 35,
+			     "Refresh rate (%u Hz) %"PRIu64"ns: Target VRR on

threshold not reached, result was %u%%\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 5 lines
tests/kms_vrr.c +1 -0
+			     (range.min - 5), rate, result);
 	}
 
 	rate = vtest_ns.mid;
 	result = flip_and_measure(data, output, pipe, rate,

TEST_DURATION_NS);

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, · line 399

Quoted 2 lines
tests/kms_vrr.c +0 -1
 	igt_assert_f(result > 75,
-		     "Refresh rate %"PRIu64"ns: Target VRR on threshold not

reached, result was %u%%\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, · line 391

Quoted 2 lines
tests/kms_vrr.c +1 -1
-		     rate, result);
+		     "Refresh rate (%u Hz) %"PRIu64"ns: Target VRR on threshold

not reached, result was %u%%\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 4 lines
tests/kms_vrr.c +1 -0
+		     ((range.max + range.min) / 2), rate, result);
 
 	set_vrr_on_pipe(data, pipe, 0);
 	result = flip_and_measure(data, output, pipe, rate,

TEST_DURATION_NS);

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, · line 405

Quoted 2 lines
tests/kms_vrr.c +0 -1
 	igt_assert_f(result < 10,
-		     "Refresh rate %"PRIu64"ns: Target VRR off threshold

exceeded, result was %u%%\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, · line 397

Quoted 2 lines
tests/kms_vrr.c +1 -1
-		     rate, result);
+		     "Refresh rate (%u Hz) %"PRIu64"ns: Target VRR off

threshold exceeded, result was %u%%\n",

Quoted 14 lines
tests/kms_vrr.c +2 -3
+		     ((range.max + range.min) / 2), rate, result);
 
 	/* Clean-up */
 	igt_plane_set_fb(data->primary, NULL);
 	igt_output_set_pipe(output, PIPE_NONE);
-	igt_display_commit_atomic(&data->display,
-				  DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 
 	igt_remove_fb(data->drm_fd, &data->fb1);
 	igt_remove_fb(data->drm_fd, &data->fb0);
--

2.20.1

Quoted 4 lines

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

--
Ville Syrjälä
Intel

Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#5 lore raw
Quoted 72 lines

-----Original Message-----
From: Ville Syrjälä <[email protected]>
Sent: Wednesday, January 20, 2021 4:24 PM
To: Modem, Bhanuprakash <[email protected]>
Cc: [email protected]; Navare, Manasi D <[email protected]>
Subject: Re: [igt-dev] [PATCH i-g-t] tests/kms_vrr: Update condition checks for flipline test

Quoted 20 lines · Bhanuprakash
Quoted 16 lines

-----Original Message-----
From: Ville Syrjälä <[email protected]>
Sent: Wednesday, January 20, 2021 12:46 AM
To: Modem, Bhanuprakash <[email protected]>
Cc: [email protected]
Subject: Re: [igt-dev] [PATCH i-g-t] tests/kms_vrr: Update condition checks for flipline test

Quoted 6 lines · Bhanuprakash Modem

This patch includes below updates
* For Flipline test: if refresh_rate <= Vrr_min then
- Expected returned refresh rate would be vrr_max
- At least 35% of the flips should be in threshold
* Update "igt_display_commit_atomic" with "igt_display_commit2"
* Add few debug prints

Quoted 4 lines

Some ideas I had for a vrr test:
- test flipping at a few different rates
- make sure the interval between flip timestamps
matches the expected rate

Quoted 10 lines

Actually, we are doing the same in our flipline[*] test.

Example: if we have a monitor with vrr range of 40 - 60Hz We'll try to flip with 35, 50 and 65 Hz, and the difference between the two flip timestamps should be within the required threshold from the expected rate. A ~50us threshold is an arbitrary.

[*] https://patchwork.freedesktop.org/patch/392037

Quoted 1 line

- otherwise confirm the timestamps are sensible. Not quite sure what

the

Quoted 1 line
Quoted 1 line

best way would be. One idea was to just make sure the timestamp

points

Quoted 2 lines
Quoted 2 lines

to more or less the correct point in time. Another idea was to drive the whole loop baed on the timestamps + target refresh rate (ie.

wait

Quoted 1 line
Quoted 1 line

for event, schedule next flip for event timestamps + whatever time

we

Quoted 1 line
Quoted 1 line

have left to reach the exected refresh rate). This latter idea I

think

Quoted 1 line
Quoted 1 line

would catch bugs where the interval between timestamps is correct

but

Quoted 7 lines
Quoted 7 lines

the absolute times are not correct (eg. if the timestamps are miscorrected to point fr into the future based on the max vblank length, or too close into the future based on min vblank length).
- the busy loop thing I don't think should be needed. Sure, there is some wakeup latency due to C-states and whatnot, but it should be possible to compensate to make sure we reach the target refresh rate w/o spinning.

Quoted 8 lines

This part is not clear to me.

Ex. To generate the flips with refresh rate 50Hz (ie. 20000000ns), below is the expected sequence:

* Request a flip & wait for flip completion event
* Capture the event timestamp to compare
* Wait 20000000ns for next flip

That would anyway need a bit of correction to account for event delivery latency + whatever overhead we have in submitting the flip.

Quoted 5 lines

But in addition I was suggesting that we calculate how long to wait based on the flip event timestamp + whatever extra is needed on top to reach the target frame rate. Thus if the timestamp is garbage the test should fail since we'll end up flipping at the wrong rate.

Does this make sense?

- diff_ns = now_ns - start_ns;

+       diff_ns = last_event_ns - start_ns;
        wait_ns = ((diff_ns + rate_ns - 1) / rate_ns) * rate_ns;

+ wait_ns += rate_ns - (last_event_ns - event_ns);

Quoted 196 lines
Quoted 15 lines

* Repeat

Am I missing something here?

Quoted 10 lines
Quoted 10 lines

V2:
* Rebase

Cc Manasi Navare <[email protected]>
Cc Nicholas Kazlauskas <[email protected]>
---
 tests/kms_vrr.c | 51 ++++++++++++++++++++--------------------------

---

Quoted 7 lines
Quoted 7 lines

tests/kms_vrr.c static void set_vrr_on_pipe(data_t *data, enum

Quoted 7 lines
 1 file changed, 21 insertions(+), 30 deletions(-)
tests/kms_vrr.c +0 -0
index beb06854f..e6edd131f 100644
@@ -170,7 +170,7 @@ static void set_vrr_on_pipe(data_t *data, enum

pipe

Quoted 3 lines
Quoted 3 lines

pipe, bool enabled)

Quoted 2 lines
tests/kms_vrr.c +0 -0
 {
 	igt_pipe_set_prop_value(&data->display, pipe,

IGT_CRTC_VRR_ENABLED,

Quoted 7 lines
Quoted 7 lines

tests/kms_vrr.c static void prepare_test(data_t *data,

Quoted 7 lines
tests/kms_vrr.c +1 -1
 				enabled);
-	igt_display_commit_atomic(&data->display, 0, NULL);
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 }
 
 /* Prepare the display for testing on the given pipe. */
@@ -208,8 +208,7 @@ static void prepare_test(data_t *data,

igt_output_t

Quoted 3 lines
Quoted 3 lines

*output, enum pipe pipe)

Quoted 2 lines
tests/kms_vrr.c +0 -0
 	 */
 	igt_pipe_set_prop_value(&data->display, pipe,

IGT_CRTC_VRR_ENABLED,

Quoted 8 lines
Quoted 8 lines

0);

tests/kms_vrr.c static void prepare_test(data_t *data, igt_output_t *output, enum pipe pipe)

Quoted 7 lines
tests/kms_vrr.c +1 -2
-	igt_display_commit_atomic(&data->display,
-				  DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 }
 
 /* Waits for the vblank interval. Returns the vblank timestamp in

ns.

Quoted 4 lines
Quoted 4 lines

*/

tests/kms_vrr.c flip_and_measure(data_t *data, igt_output_t

Quoted 1 line
tests/kms_vrr.c +0 -0
@@ -291,14 +290,10 @@ flip_and_measure(data_t *data, igt_output_t

*output, enum pipe pipe,

Quoted 1 line
tests/kms_vrr.c +0 -0
 		 * difference between 144Hz and 143Hz which should give

this

Quoted 4 lines
Quoted 4 lines

tests/kms_vrr.c flip_and_measure(data_t *data, igt_output_t *output, enum pipe pipe,

Quoted 4 lines
tests/kms_vrr.c +1 -1
 		 * enough accuracy for most use cases.
 		 */
-		if (rate_ns <= vtest_ns.min && rate_ns >= vtest_ns.max)
+		if ((rate_ns < vtest_ns.min) && (rate_ns >=

vtest_ns.max))

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
tests/kms_vrr.c +1 -5
 			diff_ns = rate_ns;
-		else if (rate_ns > vtest_ns.min)
-			diff_ns = vtest_ns.min;
-		else if (rate_ns < vtest_ns.max)
-			diff_ns = vtest_ns.max;
 		else
-			diff_ns = rate_ns;
+			diff_ns = vtest_ns.max;
 		diff_ns -= event_ns - last_event_ns;
 
Quoted 2 lines
Quoted 2 lines

tests/kms_vrr.c flip_and_measure(data_t *data, igt_output_t

Quoted 2 lines
tests/kms_vrr.c +0 -0
 		if (llabs(diff_ns) < 50000ll)
@@ -323,8 +318,8 @@ flip_and_measure(data_t *data, igt_output_t

*output,

Quoted 8 lines
Quoted 8 lines

enum pipe pipe,

tests/kms_vrr.c flip_and_measure(data_t *data, igt_output_t *output, enum pipe pipe,

Quoted 4 lines
tests/kms_vrr.c +0 -1
 		while (get_time_ns() < target_ns);
 	}
 
-	igt_info("Completed %u flips, %u were in threshold for

%"PRIu64"ns.\n",

tests/kms_vrr.c flip_and_measure(data_t *data, igt_output_t · line 321

Quoted 2 lines
tests/kms_vrr.c +1 -1
-		 total_flip, total_pass, rate_ns);
+	igt_info("Completed %u flips, %u were in threshold for (%llu

Hz)

Quoted 2 lines
Quoted 2 lines

%"PRIu64"ns.\n",

tests/kms_vrr.c flip_and_measure(data_t *data, igt_output_t · line 322

Quoted 1 line
tests/kms_vrr.c +1 -0
+		 total_flip, total_pass, (NSECS_PER_SEC/rate_ns),

rate_ns);

Quoted 11 lines
Quoted 11 lines

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe,

Quoted 4 lines
tests/kms_vrr.c +0 -0
 	return total_flip ? ((total_pass * 100) / total_flip) : 0;
 }
@@ -338,8 +333,8 @@ test_basic(data_t *data, enum pipe pipe,

igt_output_t *output, uint32_t flags)

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 6 lines
tests/kms_vrr.c +1 -2
 	range_t range = get_vrr_range(data, output);
 	uint64_t rate = vtest_ns.mid;
 
-	igt_info("VRR Test execution on %s, PIPE_%s\n",
-		 output->name, kmstest_pipe_name(pipe));
+	igt_info("VRR Test execution on %s, PIPE_%s with VRR range:

(%u-%u)

Quoted 2 lines
Quoted 2 lines

Hz\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, · line 337

Quoted 1 line
tests/kms_vrr.c +1 -0
+		 output->name, kmstest_pipe_name(pipe), range.min,

range.max);

Quoted 12 lines
Quoted 12 lines

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe,

Quoted 4 lines
tests/kms_vrr.c +0 -0
 	prepare_test(data, output, pipe);
 
@@ -370,46 +365,42 @@ test_basic(data_t *data, enum pipe pipe,

igt_output_t *output, uint32_t flags)

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 6 lines
tests/kms_vrr.c +1 -1
 	 * decision boundary.
 	 *
 	 * Example: if range is 40 - 60Hz and
-	 * if refresh_rate > 60Hz:
+	 * if refresh_rate > 60Hz or <= 40Hz:
 	 *      Flip should happen at the flipline boundary & returned

refresh rate

Quoted 6 lines
Quoted 6 lines

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 3 lines
tests/kms_vrr.c +0 -0
 	 *      would be 60Hz.
 	 * if refresh_rate is 50Hz:
 	 *      Flip will happen right away so returned refresh rate is

50Hz.

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, · line 379

Quoted 2 lines
tests/kms_vrr.c +0 -2
-	 * if refresh_rate < 40Hz:
-	 *      Flip should happen at the vmax so the returned refresh

rate

Quoted 9 lines
Quoted 9 lines

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 6 lines
tests/kms_vrr.c +1 -2
-	 *      would be 40Hz.
 	 */
 	if (flags & TEST_FLIPLINE) {
-		rate = rate_from_refresh(range.min - 5);
+		rate = rate_from_refresh(range.max + 5);
 		result = flip_and_measure(data, output, pipe, rate,

TEST_DURATION_NS);

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, · line 386

Quoted 2 lines
tests/kms_vrr.c +0 -1
 		igt_assert_f(result > 75,
-			     "Refresh rate %"PRIu64"ns: Target VRR on

threshold

Quoted 3 lines
Quoted 3 lines

not reached, result was %u%%\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, · line 378

Quoted 2 lines
tests/kms_vrr.c +1 -1
-			     rate, result);
+			     "Refresh rate (%u Hz) %"PRIu64"ns: Target VRR

on

Quoted 9 lines
Quoted 9 lines

threshold not reached, result was %u%%\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 5 lines
tests/kms_vrr.c +2 -1
+			     (range.max + 5), rate, result);
 
-		rate = rate_from_refresh(range.max + 5);
+		rate = rate_from_refresh(range.min - 5);
 		result = flip_and_measure(data, output, pipe, rate,

TEST_DURATION_NS);

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, · line 392

Quoted 2 lines
tests/kms_vrr.c +0 -2
-		igt_assert_f(result > 75,
-			     "Refresh rate %"PRIu64"ns: Target VRR on

threshold

Quoted 4 lines
Quoted 4 lines

not reached, result was %u%%\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 3 lines
tests/kms_vrr.c +2 -1
-			     rate, result);
+		igt_assert_f(result > 35,
+			     "Refresh rate (%u Hz) %"PRIu64"ns: Target VRR

on

Quoted 9 lines
Quoted 9 lines

threshold not reached, result was %u%%\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 5 lines
tests/kms_vrr.c +1 -0
+			     (range.min - 5), rate, result);
 	}
 
 	rate = vtest_ns.mid;
 	result = flip_and_measure(data, output, pipe, rate,

TEST_DURATION_NS);

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, · line 399

Quoted 2 lines
tests/kms_vrr.c +0 -1
 	igt_assert_f(result > 75,
-		     "Refresh rate %"PRIu64"ns: Target VRR on threshold

not

Quoted 3 lines
Quoted 3 lines

reached, result was %u%%\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, · line 391

Quoted 2 lines
tests/kms_vrr.c +1 -1
-		     rate, result);
+		     "Refresh rate (%u Hz) %"PRIu64"ns: Target VRR on

threshold

Quoted 26 lines
Quoted 26 lines

not reached, result was %u%%\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)

Quoted 4 lines
tests/kms_vrr.c +1 -0
+		     ((range.max + range.min) / 2), rate, result);
 
 	set_vrr_on_pipe(data, pipe, 0);
 	result = flip_and_measure(data, output, pipe, rate,

TEST_DURATION_NS);

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, · line 405

Quoted 2 lines
tests/kms_vrr.c +0 -1
 	igt_assert_f(result < 10,
-		     "Refresh rate %"PRIu64"ns: Target VRR off threshold

exceeded, result was %u%%\n",

tests/kms_vrr.c test_basic(data_t *data, enum pipe pipe, · line 397

Quoted 2 lines
tests/kms_vrr.c +1 -1
-		     rate, result);
+		     "Refresh rate (%u Hz) %"PRIu64"ns: Target VRR off

threshold exceeded, result was %u%%\n",

Quoted 14 lines
tests/kms_vrr.c +2 -3
+		     ((range.max + range.min) / 2), rate, result);
 
 	/* Clean-up */
 	igt_plane_set_fb(data->primary, NULL);
 	igt_output_set_pipe(output, PIPE_NONE);
-	igt_display_commit_atomic(&data->display,
-				  DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 
 	igt_remove_fb(data->drm_fd, &data->fb1);
 	igt_remove_fb(data->drm_fd, &data->fb0);
--

2.20.1

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

--
Ville Syrjälä
Intel

Quoted 3 lines

--
Ville Syrjälä
Intel

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev