All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH igt] lib/kms: Force a full reprobe if we find a bad link
@ 2017-05-26 11:48 Chris Wilson
  2017-05-26 11:54 ` Chris Wilson
  2017-05-31 10:40 ` Martin Peres
  0 siblings, 2 replies; 11+ messages in thread
From: Chris Wilson @ 2017-05-26 11:48 UTC (permalink / raw)
  To: intel-gfx

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@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

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

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

end of thread, other threads:[~2017-06-07 12:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-26 11:48 [PATCH igt] lib/kms: Force a full reprobe if we find a bad link Chris Wilson
2017-05-26 11:54 ` Chris Wilson
2017-05-31 10:40 ` Martin Peres
2017-05-31 12:42   ` Chris Wilson
2017-05-31 13:44     ` Martin Peres
2017-05-31 13:55       ` Chris Wilson
2017-05-31 14:45         ` Martin Peres
2017-06-07 11:13           ` Martin Peres
2017-06-07 11:33             ` Chris Wilson
2017-06-07 11:58               ` Martin Peres
2017-06-07 12:26                 ` Lofstedt, Marta

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.