summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2018-02-26 10:36:01 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2018-02-26 14:39:32 +0000
commitdd82bdfa86f2086858e2a4bb554aad08a212604e (patch)
tree39bf488b4e800ebf15060c458347dbe85bf78152
parent9d5d1d5b87b92abeaaf6018cfedac930f79e1773 (diff)
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 <chris@chris-wilson.co.uk> Cc: Marta Lofstedt <marta.lofstedt@intel.com> Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
-rw-r--r--tests/kms_force_connector_basic.c24
1 files changed, 17 insertions, 7 deletions
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") {