[v2 i-g-t] tests/kms_vrr: Add Negative tests to validate VRR
Bhanuprakash Modem
bhanuprakash.modem at intel.com
Mon Feb 21 03:25:34 UTC 2022
VRR on Non-VRR panel: VRR should not be enabled on the Non-VRR
panel. Kernel should reject the commit.
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
tests/intel-ci/fast-feedback.testlist | 1 +
tests/kms_vrr.c | 80 ++++++++++++++++++++++-----
2 files changed, 67 insertions(+), 14 deletions(-)
diff --git a/tests/intel-ci/fast-feedback.testlist b/tests/intel-ci/fast-feedback.testlist
index 5c867bbf7e..b697722b8d 100644
--- a/tests/intel-ci/fast-feedback.testlist
+++ b/tests/intel-ci/fast-feedback.testlist
@@ -137,6 +137,7 @@ igt at kms_psr@primary_page_flip
igt at kms_psr@cursor_plane_move
igt at kms_psr@sprite_plane_onoff
igt at kms_psr@primary_mmap_gtt
+igt at kms_vrr@negative-basic
igt at kms_setmode@basic-clone-single-crtc
igt at i915_pm_backlight@basic-brightness
igt at i915_pm_rpm@basic-pci-d3-state
diff --git a/tests/kms_vrr.c b/tests/kms_vrr.c
index 55de7cb989..6789841686 100644
--- a/tests/kms_vrr.c
+++ b/tests/kms_vrr.c
@@ -45,6 +45,7 @@ enum {
TEST_DPMS = 1 << 0,
TEST_SUSPEND = 1 << 1,
TEST_FLIPLINE = 1 << 2,
+ TEST_NEGATIVE = 1 << 3,
};
typedef struct range {
@@ -195,7 +196,8 @@ static void set_vrr_on_pipe(data_t *data, enum pipe pipe, bool enabled)
}
/* Prepare the display for testing on the given pipe. */
-static void prepare_test(data_t *data, igt_output_t *output, enum pipe pipe)
+static void prepare_test(data_t *data, igt_output_t *output,
+ enum pipe pipe, uint32_t flags)
{
drmModeModeInfo mode;
cairo_t *cr;
@@ -207,13 +209,22 @@ static void prepare_test(data_t *data, igt_output_t *output, enum pipe pipe)
/* Capture VRR range */
data->range = get_vrr_range(data, output);
- /* Override mode with max vrefresh.
- * - vrr_min range should be less than the override mode vrefresh.
- * - Limit the vrr_max range with the override mode vrefresh.
- */
- mode = output_mode_with_maxrate(output, data->range.max);
- igt_require(mode.vrefresh > data->range.min);
- data->range.max = mode.vrefresh;
+ if (flags & TEST_NEGATIVE) {
+ /* As we are running Negative test on non-vrr panel, both vrr
+ * min & max should be zero.
+ */
+ igt_assert_eq(data->range.min, 0);
+ igt_assert_eq(data->range.max, 0);
+ mode = *igt_output_get_mode(output);
+ } else {
+ /* Override mode with max vrefresh.
+ * - vrr_min range should be less than the override mode vrefresh.
+ * - Limit the vrr_max range with the override mode vrefresh.
+ */
+ mode = output_mode_with_maxrate(output, data->range.max);
+ igt_require(mode.vrefresh > data->range.min);
+ data->range.max = mode.vrefresh;
+ }
igt_output_override_mode(output, &mode);
/* Prepare resources */
@@ -356,7 +367,7 @@ test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)
range_t range;
uint64_t rate;
- prepare_test(data, output, pipe);
+ prepare_test(data, output, pipe, flags);
range = data->range;
vtest_ns = get_test_rate_ns(range);
rate = vtest_ns.mid;
@@ -364,7 +375,7 @@ test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)
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);
- set_vrr_on_pipe(data, pipe, 1);
+ set_vrr_on_pipe(data, pipe, true);
/*
* Do a short run with VRR, but don't check the result.
@@ -414,7 +425,7 @@ test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)
"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);
+ set_vrr_on_pipe(data, pipe, false);
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",
@@ -430,6 +441,36 @@ test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)
igt_remove_fb(data->drm_fd, &data->fb0);
}
+/* VRR on Non-VRR panel: VRR should not be enabled on the Non-VRR panel.
+ * Kernel should reject the commit.
+ */
+static void
+test_negative_basic(data_t *data, enum pipe pipe,
+ igt_output_t *output, uint32_t flags)
+{
+ igt_info("VRR Negative Test execution on %s, PIPE_%s.\n",
+ output->name, kmstest_pipe_name(pipe));
+
+ prepare_test(data, output, pipe, flags);
+ set_vrr_on_pipe(data, pipe, true);
+
+ igt_assert_f(!igt_display_try_commit_atomic(&data->display,
+ DRM_MODE_ATOMIC_TEST_ONLY |
+ DRM_MODE_ATOMIC_ALLOW_MODESET,
+ NULL),
+ "VRR shouln't be enabled on Non-VRR panel.\n");
+
+ /* Clean-up */
+ set_vrr_on_pipe(data, pipe, false);
+ igt_plane_set_fb(data->primary, NULL);
+ igt_output_set_pipe(output, PIPE_NONE);
+ igt_output_override_mode(output, NULL);
+ igt_display_commit2(&data->display, COMMIT_ATOMIC);
+
+ igt_remove_fb(data->drm_fd, &data->fb1);
+ igt_remove_fb(data->drm_fd, &data->fb0);
+}
+
/* Runs tests on outputs that are VRR capable. */
static void
run_vrr_test(data_t *data, test_t test, uint32_t flags)
@@ -440,8 +481,14 @@ run_vrr_test(data_t *data, test_t test, uint32_t flags)
for_each_connected_output(&data->display, output) {
enum pipe pipe;
- if (!has_vrr(output))
- continue;
+ /* For Negative tests, panel should be non-vrr. */
+ if (flags & TEST_NEGATIVE) {
+ if (has_vrr(output))
+ continue;
+ } else {
+ if (!has_vrr(output))
+ continue;
+ }
for_each_pipe(&data->display, pipe)
if (igt_pipe_connector_valid(pipe, output)) {
@@ -452,7 +499,8 @@ run_vrr_test(data_t *data, test_t test, uint32_t flags)
}
if (!found)
- igt_skip("No vrr capable outputs found.\n");
+ igt_skip("No %sVRR outputs found.\n",
+ (flags & TEST_NEGATIVE) ? "Non-" : "");
}
igt_main
@@ -488,6 +536,10 @@ igt_main
igt_subtest("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("negative-basic")
+ run_vrr_test(&data, test_negative_basic, TEST_NEGATIVE);
+
igt_fixture {
igt_display_fini(&data.display);
}
--
2.35.0
More information about the Intel-gfx-trybot
mailing list