summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@virtuousgeek.org>2016-01-14 14:03:53 -0800
committerJesse Barnes <jbarnes@virtuousgeek.org>2016-01-26 09:32:43 -0800
commite28acefc5c22b41e3f141ca959c8f96cd16feb47 (patch)
treeb59a00df139b759101239464f20b6ed1271bc976 /lib
parente2c9a023f2f76db04b94dae64e14ad37e0210b46 (diff)
lib/igt_kms, tests/testdisplay: allow probing of new connector modes
Fixup some fallout from the connector probing changes so testdisplay -m will pick up newly hotplugged displays correctly. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org.
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_kms.c53
-rw-r--r--lib/igt_kms.h3
2 files changed, 51 insertions, 5 deletions
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 497118af..90c8da7a 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -533,18 +533,20 @@ bool kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector,
}
/**
- * kmstest_get_connector_config:
+ * _kmstest_connector_config:
* @drm_fd: DRM fd
* @connector_id: DRM connector id
* @crtc_idx_mask: mask of allowed DRM CRTC indices
* @config: structure filled with the possible configuration
+ * @probe: whether to fully re-probe mode list or not
*
* This tries to find a suitable configuration for the given connector and CRTC
* constraint and fills it into @config.
*/
-bool kmstest_get_connector_config(int drm_fd, uint32_t connector_id,
- unsigned long crtc_idx_mask,
- struct kmstest_connector_config *config)
+static bool _kmstest_connector_config(int drm_fd, uint32_t connector_id,
+ unsigned long crtc_idx_mask,
+ struct kmstest_connector_config *config,
+ bool probe)
{
drmModeRes *resources;
drmModeConnector *connector;
@@ -558,7 +560,11 @@ bool kmstest_get_connector_config(int drm_fd, uint32_t connector_id,
}
/* First, find the connector & mode */
- connector = drmModeGetConnectorCurrent(drm_fd, connector_id);
+ if (probe)
+ connector = drmModeGetConnector(drm_fd, connector_id);
+ else
+ connector = drmModeGetConnectorCurrent(drm_fd, connector_id);
+
if (!connector)
goto err2;
@@ -634,6 +640,43 @@ err1:
}
/**
+ * kmstest_get_connector_config:
+ * @drm_fd: DRM fd
+ * @connector_id: DRM connector id
+ * @crtc_idx_mask: mask of allowed DRM CRTC indices
+ * @config: structure filled with the possible configuration
+ *
+ * This tries to find a suitable configuration for the given connector and CRTC
+ * constraint and fills it into @config.
+ */
+bool kmstest_get_connector_config(int drm_fd, uint32_t connector_id,
+ unsigned long crtc_idx_mask,
+ struct kmstest_connector_config *config)
+{
+ return _kmstest_connector_config(drm_fd, connector_id, crtc_idx_mask,
+ config, 0);
+}
+
+/**
+ * kmstest_probe_connector_config:
+ * @drm_fd: DRM fd
+ * @connector_id: DRM connector id
+ * @crtc_idx_mask: mask of allowed DRM CRTC indices
+ * @config: structure filled with the possible configuration
+ *
+ * This tries to find a suitable configuration for the given connector and CRTC
+ * constraint and fills it into @config, fully probing the connector in the
+ * process.
+ */
+bool kmstest_probe_connector_config(int drm_fd, uint32_t connector_id,
+ unsigned long crtc_idx_mask,
+ struct kmstest_connector_config *config)
+{
+ return _kmstest_connector_config(drm_fd, connector_id, crtc_idx_mask,
+ config, 1);
+}
+
+/**
* kmstest_free_connector_config:
* @config: connector configuration structure
*
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 94f315fe..3f7add58 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -140,6 +140,9 @@ bool kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector,
bool kmstest_get_connector_config(int drm_fd, uint32_t connector_id,
unsigned long crtc_idx_mask,
struct kmstest_connector_config *config);
+bool kmstest_probe_connector_config(int drm_fd, uint32_t connector_id,
+ unsigned long crtc_idx_mask,
+ struct kmstest_connector_config *config);
void kmstest_free_connector_config(struct kmstest_connector_config *config);
void kmstest_set_connector_dpms(int fd, drmModeConnector *connector, int mode);