public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [i-g-t] tests/kms_vrr: Add Negative tests to validate VRR
Date: Tue, 15 Nov 2022 22:28:25 +0530	[thread overview]
Message-ID: <20221115165916.196084-3-bhanuprakash.modem@intel.com> (raw)
In-Reply-To: <20221115165916.196084-1-bhanuprakash.modem@intel.com>

This patch will try to enable VRR on Non-VRR panel. VRR should
not be enabled on the Non-VRR panel. It is unlikely to reject the
commit/modeset. And the expected behavior is the same as disabling
VRR on a VRR capable panel.

V2, V3:
- Fix the condition check to run basic tests
V4:
- Fix the crash in CI (devided by zero)

Cc: Manasi Navare <manasi.d.navare@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Reviewed-by: Manasi Navare <manasi.d.navare@intel.com>
---
 tests/kms_vrr.c | 70 ++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 52 insertions(+), 18 deletions(-)

diff --git a/tests/kms_vrr.c b/tests/kms_vrr.c
index 8976d4a6..68c4f264 100644
--- a/tests/kms_vrr.c
+++ b/tests/kms_vrr.c
@@ -41,10 +41,11 @@
 	(m)->type, (m)->flags
 
 enum {
-	TEST_NONE = 0,
-	TEST_DPMS = 1 << 0,
-	TEST_SUSPEND = 1 << 1,
-	TEST_FLIPLINE = 1 << 2,
+	TEST_BASIC = 1 << 0,
+	TEST_DPMS = 1 << 1,
+	TEST_SUSPEND = 1 << 2,
+	TEST_FLIPLINE = 1 << 3,
+	TEST_NEGATIVE = 1 << 4,
 };
 
 typedef struct range {
@@ -116,7 +117,7 @@ static uint64_t get_time_ns(void)
 /* Returns the rate duration in nanoseconds for the given refresh rate. */
 static uint64_t rate_from_refresh(uint64_t refresh)
 {
-	return NSECS_PER_SEC / refresh;
+	return refresh ? (NSECS_PER_SEC / refresh) : 0;
 }
 
 /* Instead of running on default mode, loop through the connector modes
@@ -179,11 +180,16 @@ static vtest_ns_t get_test_rate_ns(range_t range)
 	return vtest_ns;
 }
 
-/* Returns true if an output supports VRR. */
+/* Returns true if driver supports VRR. */
 static bool has_vrr(igt_output_t *output)
 {
-	return igt_output_has_prop(output, IGT_CONNECTOR_VRR_CAPABLE) &&
-	       igt_output_get_prop(output, IGT_CONNECTOR_VRR_CAPABLE);
+	return igt_output_has_prop(output, IGT_CONNECTOR_VRR_CAPABLE);
+}
+
+/* Returns true if an output supports VRR. */
+static bool vrr_capable(igt_output_t *output)
+{
+	return igt_output_get_prop(output, IGT_CONNECTOR_VRR_CAPABLE);
 }
 
 /* Toggles variable refresh rate on the pipe. */
@@ -398,7 +404,8 @@ test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)
 	 *      Flip will happen right away so returned refresh rate is 50Hz.
 	 * if refresh_rate < 40Hz:
 	 *      h/w will terminate the vblank at Vmax which is obvious.
-	 *      So, for now we can safely ignore the lower refresh rates
+	 *      So, vblank termination should happen at Vmax, and flip done at
+	 *      next Vmin.
 	 */
 	if (flags & TEST_FLIPLINE) {
 		rate = rate_from_refresh(range.max + 5);
@@ -408,17 +415,33 @@ test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)
 			     (range.max + 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 (%u Hz) %"PRIu64"ns: Target VRR on threshold not reached, result was %u%%\n",
-		     ((range.max + range.min) / 2), rate, result);
+	if (flags & ~TEST_NEGATIVE) {
+		rate = vtest_ns.mid;
+		result = flip_and_measure(data, output, pipe, rate, TEST_DURATION_NS);
+		igt_assert_f(result > 75,
+			     "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, false);
+	if (flags & TEST_FLIPLINE) {
+		rate = rate_from_refresh(range.min - 5);
+		result = flip_and_measure(data, output, pipe, rate, TEST_DURATION_NS);
+		igt_assert_f(result < 50,
+			     "Refresh rate (%u Hz) %"PRIu64"ns: Target VRR on threshold exceeded, result was %u%%\n",
+			     (range.min - 5), rate, result);
+	}
+
+	/*
+	 * If we request VRR on a non-VRR panel, it is unlikely to reject the
+	 * modeset. And the expected behavior is the same as disabling VRR on
+	 * a VRR capable panel.
+	 */
+	set_vrr_on_pipe(data, pipe, (flags & TEST_NEGATIVE)? true : false);
+	rate = vtest_ns.mid;
 	result = flip_and_measure(data, output, pipe, rate, TEST_DURATION_NS);
 	igt_assert_f(result < 10,
-		     "Refresh rate (%u Hz) %"PRIu64"ns: Target VRR off threshold exceeded, result was %u%%\n",
-		     ((range.max + range.min) / 2), rate, result);
+		     "Refresh rate (%u Hz) %"PRIu64"ns: Target VRR %s threshold exceeded, result was %u%%\n",
+		     ((range.max + range.min) / 2), rate, (flags & TEST_NEGATIVE)? "on" : "off", result);
 
 	/* Clean-up */
 	igt_plane_set_fb(data->primary, NULL);
@@ -442,6 +465,13 @@ run_vrr_test(data_t *data, test_t test, uint32_t flags)
 		if (!has_vrr(output))
 			continue;
 
+		/* For Negative tests, panel should be non-vrr. */
+		if ((flags & TEST_NEGATIVE) && vrr_capable(output))
+			continue;
+
+		if ((flags & ~TEST_NEGATIVE) && !vrr_capable(output))
+			continue;
+
 		for_each_pipe(&data->display, pipe) {
 			if (igt_pipe_connector_valid(pipe, output)) {
 				igt_dynamic_f("pipe-%s-%s",
@@ -470,7 +500,7 @@ igt_main
 	igt_describe("Tests that VRR is enabled and that the difference between flip "
 		     "timestamps converges to the requested rate");
 	igt_subtest_with_dynamic("flip-basic")
-		run_vrr_test(&data, test_basic, 0);
+		run_vrr_test(&data, test_basic, TEST_BASIC);
 
 	igt_describe("Tests with DPMS that VRR is enabled and that the difference between flip "
 		     "timestamps converges to the requested rate.");
@@ -486,6 +516,10 @@ igt_main
 	igt_subtest_with_dynamic("flipline")
 		run_vrr_test(&data, test_basic, TEST_FLIPLINE);
 
+	igt_describe("Make sure that VRR should not be enabled on the Non-VRR panel.");
+	igt_subtest_with_dynamic("negative-basic")
+		run_vrr_test(&data, test_basic, TEST_NEGATIVE);
+
 	igt_fixture {
 		igt_display_fini(&data.display);
 	}
-- 
2.38.0

  parent reply	other threads:[~2022-11-15 17:00 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15 16:58 [igt-dev] [i-g-t v5 00/52] Add IGT support for Bigjoiner Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 01/52] lib/igt_kms: Add a helper for valid pipe/output constraint Bhanuprakash Modem
2022-11-15 16:58 ` Bhanuprakash Modem [this message]
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 02/52] lib/igt_kms: Bigjoiner check in max_bpc constraint Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 03/52] tests/kms_async_flips: Add support for Bigjoiner Bhanuprakash Modem
2022-12-23  6:20   ` Karthik B S
2022-12-23  6:24   ` Karthik B S
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 04/52] tests/kms_atomic: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 05/52] tests/kms_atomic_interruptible: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 06/52] tests/kms_atomic_transition: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 07/52] tests/kms_color_helper: Helper to check Bigjoiner constraint Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 08/52] tests/kms_color: Add support for Bigjoiner Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 09/52] tests/chamelium/kms_color_chamelium: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 10/52] tests/kms_concurrent: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 11/52] tests/kms_content_protection: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 12/52] tests/kms_cursor_crc: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 13/52] tests/kms_cursor_edge_walk: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 14/52] tests/kms_cursor_legacy: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 15/52] tests/kms_display_modes: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 16/52] tests/kms_dp_tiled_display: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 17/52] tests/kms_flip_event_leak: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 18/52] tests/kms_invalid_mode: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 19/52] tests/kms_lease: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 20/52] tests/kms_multipipe_modeset: Find the suitable mode instead of using default Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 21/52] tests/kms_pipe_crc_basic: Add support for Bigjoiner Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 22/52] tests/kms_plane: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 23/52] tests/kms_plane_alpha_blend: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 24/52] tests/kms_plane_cursor: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 25/52] tests/kms_plane_lowres: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 26/52] tests/kms_plane_multiple: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 27/52] tests/kms_plane_scaling: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 28/52] tests/kms_prime: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 29/52] tests/kms_properties: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 30/52] tests/kms_rmfb: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 31/52] tests/kms_rotation_crc: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 32/52] tests/kms_scaling_modes: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 33/52] tests/kms_sequence: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 34/52] tests/kms_universal_plane: " Bhanuprakash Modem
2022-11-15 16:58 ` [igt-dev] [i-g-t v5 35/52] tests/kms_vblank: " Bhanuprakash Modem
2022-11-15 16:59 ` [igt-dev] [i-g-t v5 36/52] tests/kms_vrr: " Bhanuprakash Modem
2022-11-15 16:59 ` [igt-dev] [i-g-t v5 37/52] tests/i915/kms_big_fb: " Bhanuprakash Modem
2022-11-15 16:59 ` [igt-dev] [i-g-t v5 38/52] tests/i915/kms_big_joiner: Negative tests " Bhanuprakash Modem
2022-11-15 16:59 ` [igt-dev] [i-g-t v5 39/52] tests/i915/kms_busy: Add support " Bhanuprakash Modem
2022-11-15 16:59 ` [igt-dev] [i-g-t v5 40/52] tests/i915/kms_ccs: " Bhanuprakash Modem
2022-11-15 16:59 ` [igt-dev] [i-g-t v5 41/52] tests/i915/kms_cdclk: " Bhanuprakash Modem
2022-11-15 16:59 ` [igt-dev] [i-g-t v5 42/52] tests/i915/kms_draw_crc: " Bhanuprakash Modem
2022-11-15 16:59 ` [igt-dev] [i-g-t v5 43/52] tests/i915/kms_fence_pin_leak: " Bhanuprakash Modem
2022-11-15 16:59 ` [igt-dev] [i-g-t v5 44/52] tests/i915/kms_flip_scaled_crc: " Bhanuprakash Modem
2022-11-15 16:59 ` [igt-dev] [i-g-t v5 45/52] tests/i915/kms_flip_tiling: " Bhanuprakash Modem
2022-11-15 16:59 ` [igt-dev] [i-g-t v5 46/52] tests/i915/kms_frontbuffer_tracking: " Bhanuprakash Modem
2022-11-15 16:59 ` [igt-dev] [i-g-t v5 47/52] tests/i915/kms_mmap_write_crc: " Bhanuprakash Modem
2022-11-15 16:59 ` [igt-dev] [i-g-t v5 48/52] tests/i915/kms_psr2_sf: " Bhanuprakash Modem
2022-11-15 16:59 ` [igt-dev] [i-g-t v5 49/52] tests/i915/kms_psr2_su: " Bhanuprakash Modem
2022-11-15 16:59 ` [igt-dev] [i-g-t v5 50/52] tests/i915/kms_psr: " Bhanuprakash Modem
2022-11-15 16:59 ` [igt-dev] [i-g-t v5 51/52] tests/i915/kms_psr_stress_test: " Bhanuprakash Modem
2022-11-15 16:59 ` [igt-dev] [i-g-t v5 52/52] tests/i915/kms_pwrite_crc: " Bhanuprakash Modem
2022-11-15 17:06 ` [igt-dev] [i-g-t v5 00/52] Add IGT " Bhanuprakash Modem
2022-11-15 20:16 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_vrr: Add Negative tests to validate VRR (rev2) Patchwork
2022-11-16  2:59 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2022-11-14 11:52 [igt-dev] [i-g-t] tests/kms_vrr: Add Negative tests to validate VRR Bhanuprakash Modem
2022-11-15 17:17 ` Bhanuprakash Modem

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=20221115165916.196084-3-bhanuprakash.modem@intel.com \
    --to=bhanuprakash.modem@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