[igt-dev] [v6 i-g-t 04/14] tests/debugfs_test: Fix mode selection for 2x tests

Bhanuprakash Modem bhanuprakash.modem at intel.com
Wed May 12 17:05:26 UTC 2021


This patch will find the connector/mode combination that fits
into the bandwidth when more than one monitor is connected.

Example:
  When two monitors connected through MST, the second monitor
  also tries to use the same mode. So two such modes may not
  fit into the link bandwidth. So, iterate through connected
  outputs & modes and find a combination of modes those fit
  into the link BW.

V2:
* Add support for legacy commit (Ankit)
V3:
* Fix commit message (Ankit)

Cc: Imre Deak <imre.deak at intel.com>
Cc: Ankit Nautiyal <ankit.k.nautiyal at intel.com>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal at intel.com>
---
 tests/debugfs_test.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/tests/debugfs_test.c b/tests/debugfs_test.c
index 46ba0a8be..e50f213ae 100644
--- a/tests/debugfs_test.c
+++ b/tests/debugfs_test.c
@@ -98,12 +98,14 @@ static void kms_tests(int fd, int debugfs)
 	igt_display_t display;
 	struct igt_fb fb[IGT_MAX_PIPES];
 	enum pipe pipe;
+	int ret;
 
 	igt_fixture
 		igt_display_require(&display, fd);
 
 	igt_subtest("read_all_entries_display_on") {
 		/* try to light all pipes */
+retry:
 		for_each_pipe(&display, pipe) {
 			igt_output_t *output;
 
@@ -128,6 +130,25 @@ static void kms_tests(int fd, int debugfs)
 			}
 		}
 
+		if (display.is_atomic)
+			ret = igt_display_try_commit_atomic(&display,
+					DRM_MODE_ATOMIC_TEST_ONLY |
+					DRM_MODE_ATOMIC_ALLOW_MODESET,
+					NULL);
+		else
+			ret = igt_display_try_commit2(&display, COMMIT_LEGACY);
+
+		if (ret) {
+			igt_output_t *output;
+			bool found = igt_override_all_active_output_modes_to_fit_bw(&display);
+			igt_require_f(found, "No valid mode combo found.\n");
+
+			for_each_connected_output(&display, output)
+				igt_output_set_pipe(output, PIPE_NONE);
+
+			goto retry;
+		}
+
 		igt_display_commit2(&display, display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
 
 		read_and_discard_sysfs_entries(debugfs, 0);
-- 
2.20.1



More information about the igt-dev mailing list