[igt-dev] [PATCH i-g-t 5/7] lib/kms: Reprobe connector state after disabling modest

Arkadiusz Hiler
2020-04-07T13:17:24Z

With TypeC we don't always get hotplug events for a connector until the
mode is disabled.

Cc: Imre Deak <imre.deak@intel.com>
Issue: https://gitlab.freedesktop.org/drm/intel/issues/323
Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
---
lib/igt_kms.c | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 4ffc3ed2..9d384fc9 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -2040,7 +2040,6 @@ void igt_display_require(igt_display_t *display, int drm_fd)

for (i = 0; i < display->n_outputs; i++) {
igt_output_t *output = &display->outputs[i];
- drmModeConnector *connector;

/*
* We don't assign each output a pipe unless
@@ -2051,13 +2050,6 @@ void igt_display_require(igt_display_t *display, int drm_fd)
output->display = display;

igt_output_refresh(output);
-
- connector = output->config.connector;
- if (connector && (!connector->count_modes ||
- connector->connection == DRM_MODE_UNKNOWNCONNECTION)) {
- output->force_reprobe = true;
- igt_output_refresh(output);
- }
}

drmModeFreePlaneResources(plane_resources);
@@ -2072,6 +2064,25 @@ void igt_display_require(igt_display_t *display, int drm_fd)
display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
}

+ /*
+ * Let's reprobe all connectors to make sure we have up to date stete.
+ * Some connectors may require disabling modeset to be detected
+ * correctly.
+ */
+ for (i = 0; i < display->n_outputs; i++) {
+ igt_output_t *output = &display->outputs[i];
+ drmModeConnector *connector;
+
+ igt_output_refresh(output);
+
+ connector = output->config.connector;
+ if (connector && (!connector->count_modes ||
+ connector->connection == DRM_MODE_UNKNOWNCONNECTION)) {
+ output->force_reprobe = true;
+ igt_output_refresh(output);
+ }
+ }
+
out:
LOG_UNINDENT(display);