[igt-dev] [PATCH v3 06/11] chamelium: Use preferred mode when testing a single mode
Maxime Ripard
maxime.ripard at bootlin.com
Thu May 24 14:24:45 UTC 2018
The current code is testing the first mode in the connector list when it's
testing a single mode. While this is arbitrarily chosen, it makes more
sense to use the preferred mode reported by the display.
Signed-off-by: Maxime Ripard <maxime.ripard at bootlin.com>
---
tests/kms_chamelium.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
index 490bacc6f5fe..5d7fb83fb74f 100644
--- a/tests/kms_chamelium.c
+++ b/tests/kms_chamelium.c
@@ -534,6 +534,20 @@ static void do_test_display_crc(data_t *data, struct chamelium_port *port,
igt_remove_fb(data->drm_fd, &fb);
}
+static drmModeModeInfo *find_preferred_mode(drmModeConnector *connector)
+{
+ int i;
+
+ for (i = 0; i < connector->count_modes; i++) {
+ drmModeModeInfo *mode = &connector->modes[i];
+
+ if (mode->type & DRM_MODE_TYPE_PREFERRED)
+ return mode;
+ }
+
+ return NULL;
+}
+
static void test_display_crc_one_mode(data_t *data, struct chamelium_port *port,
int count)
{
@@ -549,7 +563,10 @@ static void test_display_crc_one_mode(data_t *data, struct chamelium_port *port,
primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
igt_assert(primary);
- do_test_display_crc(data, port, output, &connector->modes[0], count);
+ mode = find_preferred_mode(connector);
+ igt_assert(mode);
+
+ do_test_display_crc(data, port, output, mode, count);
drmModeFreeConnector(connector);
}
--
git-series 0.9.1
More information about the igt-dev
mailing list