[Intel-gfx] [PATCH igt] lib/kms: Force a full reprobe if we find a bad link

Chris Wilson chris at chris-wilson.co.uk
Fri May 26 11:48:46 UTC 2017


If we do a shallow probe of the connector and it reports the link failed
previous (link-status != GOOD), force a full probe of the connector to
give the kernel a chance to validate the mode list.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 lib/igt_kms.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index f7758458..5f2adbdb 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -852,6 +852,26 @@ _kmstest_connector_config_find_encoder(int drm_fd, drmModeConnector *connector,
 	return NULL;
 }
 
+static bool connector_check_link_status(int fd, drmModeConnector *connector)
+{
+	for (int i = 0; i < connector->count_props; i++) {
+		struct drm_mode_get_property prop;
+
+		prop.prop_id = connector->props[i];
+		prop.count_values = 0;
+		prop.count_enum_blobs = 0;
+		if (drmIoctl(fd, DRM_IOCTL_MODE_GETPROPERTY, &prop))
+			continue;
+
+		if (strcmp(prop.name, "link-status"))
+			continue;
+
+		return connector->prop_values[i] == 0;
+	}
+
+	return true;
+}
+
 /**
  * _kmstest_connector_config:
  * @drm_fd: DRM fd
@@ -894,6 +914,15 @@ static bool _kmstest_connector_config(int drm_fd, uint32_t connector_id,
 		goto err3;
 	}
 
+	if (!probe && !connector_check_link_status(drm_fd, connector)) {
+		drmModeFreeConnector(connector);
+		connector = drmModeGetConnector(drm_fd, connector_id);
+		if (!connector)
+			goto err2;
+
+		igt_assert(connector->connector_id == connector_id);
+	}
+
 	/*
 	 * Find given CRTC if crtc_id != 0 or else the first CRTC not in use.
 	 * In both cases find the first compatible encoder and skip the CRTC
-- 
2.11.0



More information about the Intel-gfx mailing list