[igt-dev] [PATCH i-g-t] tests/kms_setmode: Handle eDP with fixed mode better.

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Thu Apr 25 08:54:28 UTC 2019


When running the stealing tests, we set the same mode on the eDP and
the other connector. If the eDP is 4k, we may try to set a mode that
is not supported on the other connector, which might be 1080p.

Fix this by selecting the smallest default mode, based on clock.
Hopefully this is more likely to be supported on all connectors,
instead always using the first connector's mode.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110391
---
 tests/kms_setmode.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
index c40c723d4c74..447da2beb5f6 100644
--- a/tests/kms_setmode.c
+++ b/tests/kms_setmode.c
@@ -210,11 +210,14 @@ static void get_mode_for_crtc(struct crtc_config *crtc,
 	}
 
 	/*
-	 * If none is found then just pick the default mode of the first
-	 * connector and hope the other connectors can support it by scaling
-	 * etc.
+	 * If none is found then just pick the default mode from all connectors
+	 * with the smallest clock, hope the other connectors can support it by
+	 * scaling etc.
 	 */
 	mode = crtc->cconfs[0].default_mode;
+	for (i = 1; i < crtc->connector_count; i++)
+		if (crtc->cconfs[i].default_mode.clock < mode.clock)
+			mode = crtc->cconfs[i].default_mode;
 found:
 	*mode_ret = mode;
 }
-- 
2.20.1



More information about the igt-dev mailing list