[igt-dev] [PATCH i-g-t] lib/igt_kms: Improve connector probing in igt_display_init()

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Mon Mar 26 10:40:24 UTC 2018


Only do a full probe when the initial connector status is unknown, and
otherwise skip it. This should speed up kms tests ever so slightly.

Also set pipe to PIPE_NONE for igt_output_refresh(), to make the
connector info slightly more accurate.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
 lib/igt_kms.c | 17 +++++++++++++----
 lib/igt_kms.h |  2 +-
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index d8f69d3db9ca..44f6ae977092 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -974,7 +974,7 @@ _kmstest_connector_config_find_encoder(int drm_fd, drmModeConnector *connector,
 static bool _kmstest_connector_config(int drm_fd, uint32_t connector_id,
 				      unsigned long crtc_idx_mask,
 				      struct kmstest_connector_config *config,
-				      bool probe)
+				      int probe)
 {
 	drmModeRes *resources;
 	drmModeConnector *connector;
@@ -988,11 +988,19 @@ static bool _kmstest_connector_config(int drm_fd, uint32_t connector_id,
 	}
 
 	/* First, find the connector & mode */
-	if (probe)
+	if (probe > 0)
 		connector = drmModeGetConnector(drm_fd, connector_id);
-	else
+	else {
 		connector = drmModeGetConnectorCurrent(drm_fd, connector_id);
 
+		if (probe < 0 && connector &&
+		    connector->connection == DRM_MODE_UNKNOWNCONNECTION) {
+			drmModeFreeConnector(connector);
+
+			connector = drmModeGetConnector(drm_fd, connector_id);
+		}
+	}
+
 	if (!connector)
 		goto err2;
 
@@ -2028,7 +2036,8 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 		 * We don't assign each output a pipe unless
 		 * a pipe is set with igt_output_set_pipe().
 		 */
-		output->force_reprobe = true;
+		output->force_reprobe = -1;
+		output->pipe = PIPE_NONE;
 		output->id = resources->connectors[i];
 		output->display = display;
 
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 6f16dc8cf85e..9e734ab1a5b8 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -340,7 +340,7 @@ typedef struct {
 	uint32_t id;					/* KMS id */
 	struct kmstest_connector_config config;
 	char *name;
-	bool force_reprobe;
+	int force_reprobe;
 	enum pipe pending_pipe;
 	bool use_override_mode;
 	drmModeModeInfo override_mode;
-- 
2.16.3



More information about the igt-dev mailing list