[PATCH i-g-t v8 4/6] tests/kms_flip: limit number of outputs wrt suspend

Michał Grzelak
2026-03-09T09:25:48Z

When running suspend subtests on single output, we can still hit the
timeout by testing too much outputs. Default to testing 3 outputs. Add
command-line parameter to run on all outputs.

Signed-off-by: Michał Grzelak <michal.grzelak@intel.com>
---
tests/kms_flip.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 917c5ed6f..ae38096aa 100755
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -264,12 +264,14 @@
#define RUN_PAIR 2

#define PAIR_LIMIT 3
+#define CONN_LIMIT 3

#ifndef DRM_CAP_TIMESTAMP_MONOTONIC
#define DRM_CAP_TIMESTAMP_MONOTONIC 6
#endif

static bool all_crtcs = false;
+static bool all_conns = false;
static bool all_pairs = false;

drmModeRes *resources;
@@ -1822,6 +1824,7 @@ static void run_test(int duration, int flags)
{
struct test_output o;
int i, n, modes = 0;
+ int conn_count = 0;

/* No tiling support in XE. */
if (is_xe_device(drm_fd) && flags & TEST_FENCE_STRESS)
@@ -1887,6 +1890,10 @@ static void run_test(int duration, int flags)
if ((flags & TEST_SUSPEND) && !all_crtcs && n != 0)
continue;

+ /* Limit number of displays run */
+ if ((flags & TEST_SUSPEND) && !all_conns && conn_count >= CONN_LIMIT)
+ continue;
+
memset(&o, 0, sizeof(o));
o.count = 1;
o._connector[0] = resources->connectors[i];
@@ -1895,8 +1902,15 @@ static void run_test(int duration, int flags)
o.depth = 24;

crtc_idx = n;
- run_test_on_crtc_set(&o, &crtc_idx, RUN_TEST,
- resources->count_crtcs, duration);
+
+ connector_find_preferred_mode(o._connector[0], n, &o);
+ if (o.mode_valid) {
+ run_test_on_crtc_set(&o, &crtc_idx, RUN_TEST,
+ resources->count_crtcs, duration);
+ conn_count++;
+ } else {
+ free_test_output(&o);
+ }
}
}

@@ -2071,10 +2085,11 @@ static int opt_handler(int opt, int opt_index, void *data)
}

const char *help_str =
+ " -c \tRun on all connectors. (By default suspend subtests will run on 3 connectors)\n"
" -e \tRun on all CRTCs. (By default subtests will run on two CRTCs)\n"
" -p \tRun on all output pairs. (By default 2x-* suspend subtests will run on 3 pairs)\n";

-int igt_main_args("ep", NULL, help_str, opt_handler, NULL)
+int igt_main_args("cep", NULL, help_str, opt_handler, NULL)
{
struct {
int duration;
--
2.45.2