public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH igt] igt/kms_force_connector_basic: Clear any previous connector override
@ 2018-02-26 10:43 Chris Wilson
  2018-02-26 11:35 ` Lofstedt, Marta
  2018-02-26 11:43 ` [igt-dev] " Maarten Lankhorst
  0 siblings, 2 replies; 3+ messages in thread
From: Chris Wilson @ 2018-02-26 10:43 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

When searching for a VGA connector to use to test overriding the
connector status, we require the system to have a disconnected VGA
connector, but if a previous test left an override inplace, that may not
exist. Before we check whether the connector is attached to real HW,
first reset the connector status override so that we always get the
actual HW result.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Marta Lofstedt <marta.lofstedt@intel.com>
---
 tests/kms_force_connector_basic.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/tests/kms_force_connector_basic.c b/tests/kms_force_connector_basic.c
index d2c804c8..c51b5cdf 100644
--- a/tests/kms_force_connector_basic.c
+++ b/tests/kms_force_connector_basic.c
@@ -86,29 +86,39 @@ int main(int argc, char **argv)
 				    opt_handler, NULL);
 
 	igt_fixture {
+		unsigned vga_connector_id = 0;
+
 		drm_fd = drm_open_driver_master(DRIVER_INTEL);
 		res = drmModeGetResources(drm_fd);
 		igt_assert(res);
 
 		/* find the vga connector */
 		for (int i = 0; i < res->count_connectors; i++) {
-
 			vga_connector = drmModeGetConnectorCurrent(drm_fd,
 								   res->connectors[i]);
 
 			if (vga_connector->connector_type == DRM_MODE_CONNECTOR_VGA) {
-				start_n_modes = vga_connector->count_modes;
-				start_connection = vga_connector->connection;
-				break;
+				/* Ensure that no override was left in place */
+				kmstest_force_connector(drm_fd,
+							vga_connector,
+							FORCE_CONNECTOR_UNSPECIFIED);
+
+				/* only use the first connector */
+				if (!vga_connector_id)
+					vga_connector_id = res->connectors[i];
 			}
 
 			drmModeFreeConnector(vga_connector);
-
-			vga_connector = NULL;
 		}
 
-		igt_require(vga_connector);
+		igt_require(vga_connector_id);
+
+		/* Reacquire status after clearing any previous overrides */
+		vga_connector = drmModeGetConnector(drm_fd, vga_connector_id);
 		igt_skip_on(vga_connector->connection == DRM_MODE_CONNECTED);
+
+		start_n_modes = vga_connector->count_modes;
+		start_connection = vga_connector->connection;
 	}
 
 	igt_subtest("force-load-detect") {
-- 
2.16.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-26 11:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-26 10:43 [PATCH igt] igt/kms_force_connector_basic: Clear any previous connector override Chris Wilson
2018-02-26 11:35 ` Lofstedt, Marta
2018-02-26 11:43 ` [igt-dev] " Maarten Lankhorst

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox