[PATCH i-g-t 2/2] tests/chamelium: Remove reliance on output->config.pipe

Maarten Lankhorst
2017-10-12T11:41:38Z

IGT has an api that can find a matching pipe for a given connector,
so use that.

igt_output_override_mode already forces a modeset on an affected pipe
since an earlier commit, so the second call to igt_output_set_pipe
can be removed.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
tests/chamelium.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/tests/chamelium.c b/tests/chamelium.c
index ae164920e86e..c236d25fa798 100644
--- a/tests/chamelium.c
+++ b/tests/chamelium.c
@@ -416,6 +416,8 @@ prepare_output(data_t *data,
drmModeRes *res;
drmModeConnector *connector =
chamelium_port_get_connector(data->chamelium, port, false);
+ enum pipe pipe;
+ bool found = false;

igt_assert(res = drmModeGetResources(data->drm_fd));
kmstest_unset_all_crtcs(data->drm_fd, res);
@@ -433,7 +435,18 @@ prepare_output(data_t *data,

igt_assert(kmstest_probe_connector_config(
data->drm_fd, connector->connector_id, ~0, &output->config));
- igt_output_set_pipe(output, output->config.pipe);
+
+ for_each_pipe(display, pipe) {
+ if (!igt_pipe_connector_valid(pipe, output))
+ continue;
+
+ found = true;
+ break;
+ }
+
+ igt_assert_f(found, "No pipe found for output %s\n", igt_output_name(output));
+
+ igt_output_set_pipe(output, pipe);

drmModeFreeConnector(connector);
drmModeFreeResources(res);
@@ -459,8 +472,6 @@ enable_output(data_t *data,
igt_plane_set_fb(primary, fb);
igt_output_override_mode(output, mode);

- igt_output_set_pipe(output, output->config.pipe);
-
/* Clear any color correction values that might be enabled */
igt_pipe_obj_replace_prop_blob(primary->pipe, IGT_CRTC_DEGAMMA_LUT, NULL, 0);
igt_pipe_obj_replace_prop_blob(primary->pipe, IGT_CRTC_GAMMA_LUT, NULL, 0);