[i-g-t 1/2] tests/kms_vrr: New subtest to swith RR without modeset
Bhanuprakash Modem
bhanuprakash.modem at intel.com
Tue Nov 21 05:01:48 UTC 2023
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
tests/kms_vrr.c | 92 ++++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 80 insertions(+), 12 deletions(-)
diff --git a/tests/kms_vrr.c b/tests/kms_vrr.c
index f26adbccf..bc955f3cc 100644
--- a/tests/kms_vrr.c
+++ b/tests/kms_vrr.c
@@ -60,6 +60,13 @@
* Mega feature: VRR
* Test category: functionality test
*
+ * SUBTEST: seamless-rr-switch
+ * Description: Test to switch RR seamlessly without modeset.
+ * Driver requirement: i915, xe
+ * Functionality: adaptive_sync, drrs, lrr
+ * Mega feature: VRR
+ * Test category: functionality test
+ *
* SUBTEST: negative-basic
* Description: Make sure that VRR should not be enabled on the Non-VRR panel.
* Driver requirement: i915, xe
@@ -76,19 +83,13 @@
*/
#define TEST_DURATION_NS (5000000000ull)
-#define DRM_MODE_FMT "\"%s\": %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x"
-#define DRM_MODE_ARG(m) \
- (m)->name, (m)->vrefresh, (m)->clock, \
- (m)->hdisplay, (m)->hsync_start, (m)->hsync_end, (m)->htotal, \
- (m)->vdisplay, (m)->vsync_start, (m)->vsync_end, (m)->vtotal, \
- (m)->type, (m)->flags
-
enum {
TEST_BASIC = 1 << 0,
TEST_DPMS = 1 << 1,
TEST_SUSPEND = 1 << 2,
TEST_FLIPLINE = 1 << 3,
- TEST_NEGATIVE = 1 << 4,
+ TEST_SEAMLESS_RR = 1 << 4,
+ TEST_NEGATIVE = 1 << 5,
};
typedef struct range {
@@ -173,14 +174,31 @@ output_mode_with_maxrate(igt_output_t *output, unsigned int vrr_max)
drmModeConnectorPtr connector = output->config.connector;
drmModeModeInfo mode = *igt_output_get_mode(output);
- igt_debug("Default Mode " DRM_MODE_FMT "\n", DRM_MODE_ARG(&mode));
-
for (i = 0; i < connector->count_modes; i++)
if (connector->modes[i].vrefresh > mode.vrefresh &&
connector->modes[i].vrefresh <= vrr_max)
mode = connector->modes[i];
- igt_debug("Override Mode " DRM_MODE_FMT "\n", DRM_MODE_ARG(&mode));
+ igt_info("Override with HIGH_RR Mode: ");
+ kmstest_dump_mode(&mode);
+
+ return mode;
+}
+
+static drmModeModeInfo
+output_mode_with_minrate(igt_output_t *output, unsigned int vrr_min)
+{
+ int i;
+ drmModeConnectorPtr connector = output->config.connector;
+ drmModeModeInfo mode = *igt_output_get_mode(output);
+
+ for (i = 0; i < connector->count_modes; i++)
+ if (connector->modes[i].vrefresh < mode.vrefresh &&
+ connector->modes[i].vrefresh >= vrr_min)
+ mode = connector->modes[i];
+
+ igt_info("Override with LOW_RR Mode: ");
+ kmstest_dump_mode(&mode);
return mode;
}
@@ -351,7 +369,7 @@ flip_and_measure(data_t *data, igt_output_t *output, enum pipe pipe,
*/
event_ns = get_kernel_event_ns(data, DRM_EVENT_FLIP_COMPLETE);
- igt_debug("event_ns - last_event_ns: %"PRIu64"\n",
+ igt_info("event_ns - last_event_ns: %"PRIu64"\n",
(event_ns - last_event_ns));
/*
@@ -496,6 +514,50 @@ test_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)
igt_remove_fb(data->drm_fd, &data->fb0);
}
+static void
+test_seamless_rr_basic(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)
+{
+ uint32_t result;
+ vtest_ns_t vtest_ns;
+ range_t range;
+ uint64_t rate;
+ drmModeModeInfo mode;
+
+ prepare_test(data, output, pipe);
+ range = data->range;
+ vtest_ns = get_test_rate_ns(range);
+
+ igt_info("Seamless RR Switch Test execution on %s, PIPE_%s with VRR range: (%u-%u) Hz\n",
+ igt_output_name(output), kmstest_pipe_name(pipe), range.min, range.max);
+
+ rate = vtest_ns.max;
+ result = flip_and_measure(data, output, pipe, rate, TEST_DURATION_NS);
+ igt_info("Refresh rate (%u Hz) %"PRIu64"ns: %u%%\n", range.max, rate, result);
+
+ /* Switch to low rr mode without modeset. */
+ mode = output_mode_with_minrate(output, range.min);
+ igt_output_override_mode(output, &mode);
+ igt_assert(igt_display_try_commit_atomic(&data->display, 0, NULL) == 0);
+
+ rate = vtest_ns.min;
+ result = flip_and_measure(data, output, pipe, rate, TEST_DURATION_NS);
+ igt_info("Refresh rate (%u Hz) %"PRIu64"ns: %u%%\n", range.min, rate, result);
+
+ /* Switch back to high rr mode without modeset. */
+ mode = output_mode_with_maxrate(output, range.max);
+ igt_output_override_mode(output, &mode);
+ igt_assert(igt_display_try_commit_atomic(&data->display, 0, NULL) == 0);
+
+ /* Clean-up */
+ 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)
@@ -569,6 +631,12 @@ igt_main
igt_subtest_with_dynamic("negative-basic")
run_vrr_test(&data, test_basic, TEST_NEGATIVE);
+ igt_describe("Test to switch RR seamlessly without modeset.");
+ igt_subtest_with_dynamic("seamless-rr-switch") {
+ igt_require_intel(data.drm_fd);
+ run_vrr_test(&data, test_seamless_rr_basic, TEST_SEAMLESS_RR);
+ }
+
igt_fixture {
igt_display_fini(&data.display);
drm_close_driver(data.drm_fd);
--
2.40.0
More information about the Intel-gfx-trybot
mailing list