[Intel-gfx] [PATCH IGT] tests/kms_setmode: avoid 2 connectors on the same encoder

Paulo Zanoni przanoni at gmail.com
Tue Dec 3 18:38:18 CET 2013


From: Paulo Zanoni <paulo.r.zanoni at intel.com>

Don't try to set modes on two connectors that share the same encoder.
That will just fail.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68463
Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
---
 tests/kms_setmode.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
index 3d18fc7..e1c9c5a 100644
--- a/tests/kms_setmode.c
+++ b/tests/kms_setmode.c
@@ -275,6 +275,7 @@ static void setup_crtcs(drmModeRes *resources, struct connector_config *cconf,
 	int crtc_count;
 	bool config_valid;
 	int i;
+	int encoder_usage_count[resources->count_encoders];
 
 	i = 0;
 	crtc_count = 0;
@@ -337,6 +338,20 @@ static void setup_crtcs(drmModeRes *resources, struct connector_config *cconf,
 		crtc++;
 	}
 
+	memset(encoder_usage_count, 0, sizeof(encoder_usage_count));
+	for (i = 0; i < connector_count; i++) {
+		drmModeConnector *connector = cconf[i].connector;
+		drmModeEncoder *encoder;
+
+		igt_assert(connector->count_encoders == 1);
+		encoder = drmModeGetEncoder(drm_fd, connector->encoders[0]);
+		encoder_usage_count[get_encoder_idx(resources, encoder)]++;
+		drmModeFreeEncoder(encoder);
+	}
+	for (i = 0; i < resources->count_encoders; i++)
+		if (encoder_usage_count[i] > 1)
+			config_valid = false;
+
 	*crtc_count_ret = crtc_count;
 	*config_valid_ret = config_valid;
 }
-- 
1.8.3.1




More information about the Intel-gfx mailing list