diff options
author | Ryszard Knop <ryszard.knop@intel.com> | 2022-05-20 12:39:45 +0200 |
---|---|---|
committer | Petri Latvala <petri.latvala@intel.com> | 2022-05-25 12:52:51 +0300 |
commit | 1b5f7f139660ac27f3c8b4c4a2d23fdd9430ccab (patch) | |
tree | caf077c270e78ae3c880138dd164818d8605ad5f /lib | |
parent | 980f69dfe33f11f0fa65a1c8f4602ecb2f93355c (diff) |
tests/kms_chamelium: Check if port adapters are in use
If a DUT has Chamelium ports connected via an adapter (for example, DP
on the Chamelium side -> DP-HDMI adapter -> HDMI on the DUT), this will
usually cause many tests to fail. If mismatching port types are found
on both sides, the tests will now be aborted with a warning.
This behavior can be overridden with a new AdapterAllowed config value,
which must be set in [Chamelium:PORT] blocks in .igtrc.
Signed-off-by: Ryszard Knop <ryszard.knop@intel.com>
Reviewed-by: Petri Latvala <petri.latvala@intel.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/igt_chamelium.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c index b4d838bb..55cbfa12 100644 --- a/lib/igt_chamelium.c +++ b/lib/igt_chamelium.c @@ -26,6 +26,7 @@ #include "config.h" +#include <stdbool.h> #include <string.h> #include <errno.h> #include <math.h> @@ -103,6 +104,7 @@ struct chamelium_port { int id; int connector_id; char *name; + bool adapter_allowed; }; struct chamelium_frame_dump { @@ -2324,6 +2326,9 @@ static bool chamelium_read_port_mappings(struct chamelium *chamelium, goto out; } + port->adapter_allowed = g_key_file_get_boolean(igt_key_file, group, + "AdapterAllowed", &error); + for (j = 0; j < res->count_connectors && !port->connector_id; j++) { @@ -2557,6 +2562,7 @@ static bool chamelium_autodiscover(struct chamelium *chamelium, int drm_fd) port->id = port_id; port->type = chamelium_get_port_type(chamelium, port); port->connector_id = conn_id; + port->adapter_allowed = false; connector = drmModeGetConnectorCurrent(drm_fd, conn_id); snprintf(conn_name, sizeof(conn_name), "%s-%u", @@ -2703,6 +2709,7 @@ error: struct chamelium *chamelium_init(int drm_fd) { struct chamelium *chamelium = chamelium_init_rpc_only(); + bool mismatching_ports_found = false; if (chamelium == NULL) return NULL; @@ -2734,9 +2741,37 @@ struct chamelium *chamelium_init(int drm_fd) } } + for (int i = 0; i < chamelium->port_count; i++) { + bool type_mismatch = false; + struct chamelium_port * port = &chamelium->ports[i]; + drmModeConnectorPtr connector = + drmModeGetConnectorCurrent(drm_fd, port->connector_id); + + igt_assert(connector != NULL); + + type_mismatch = port->type != connector->connector_type; + + if (type_mismatch) + igt_info("Chamelium port %d is %s, but the DRM connector is %s\n", + port->id, kmstest_connector_type_str(port->type), + kmstest_connector_type_str(connector->connector_type)); + + if (type_mismatch && !port->adapter_allowed) + mismatching_ports_found = true; + + drmModeFreeConnector(connector); + } + cleanup_instance = chamelium; igt_install_exit_handler(chamelium_exit_handler); + igt_abort_on_f(mismatching_ports_found, + "Chamelium port(s) with mismatching connector type on the " + "DRM side found - this will most likely cause test failures. " + "If you want to proceed with this this configuration, set the " + "port mapping manually in .igtrc with AdapterAllowed=1. See " + "docs/chamelium.txt for more information.\n"); + return chamelium; error: close(chamelium->drm_fd); |