All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH igt] lib/kms: Force a full reprobe if we find a bad link
Date: Fri, 26 May 2017 12:48:46 +0100	[thread overview]
Message-ID: <20170526114846.8869-1-chris@chris-wilson.co.uk> (raw)

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

             reply	other threads:[~2017-05-26 11:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-26 11:48 Chris Wilson [this message]
2017-05-26 11:54 ` [PATCH igt] lib/kms: Force a full reprobe if we find a bad link 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170526114846.8869-1-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.