From dd82bdfa86f2086858e2a4bb554aad08a212604e Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 26 Feb 2018 10:36:01 +0000 Subject: igt/kms_force_connector_basic: Clear any previous connector override 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 Cc: Marta Lofstedt Reviewed-by: Marta Lofstedt Reviewed-by: Maarten Lankhorst --- tests/kms_force_connector_basic.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'tests/kms_force_connector_basic.c') diff --git a/tests/kms_force_connector_basic.c b/tests/kms_force_connector_basic.c index d2c804c8..d11a775a 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 VGA 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") { -- cgit v1.2.3