[igt-dev] [PATCH i-g-t] tests/kms_chamelium: check ports have audio support

Simon Ser simon.ser at intel.com
Mon May 13 13:37:23 UTC 2019


Before starting an audio test, make sure the Chamelium supports audio capture
on the port we want to use.

Old Chamelium devices don't support audio capture on DisplayPort ports. This
patch will make the tests skip DisplayPort ports.

Signed-off-by: Simon Ser <simon.ser at intel.com>
---
 lib/igt_chamelium.c   | 13 +++++++++++++
 lib/igt_chamelium.h   |  2 ++
 tests/kms_chamelium.c |  4 ++++
 3 files changed, 19 insertions(+)

diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index ffc68f3557ee..94825002cab3 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -930,6 +930,19 @@ int chamelium_get_captured_frame_count(struct chamelium *chamelium)
 	return ret;
 }

+bool chamelium_has_audio_support(struct chamelium *chamelium,
+				 struct chamelium_port *port)
+{
+	xmlrpc_value *res;
+	xmlrpc_bool has_support;
+
+	res = chamelium_rpc(chamelium, port, "HasAudioSupport", "(i)", port->id);
+	xmlrpc_read_bool(&chamelium->env, res, &has_support);
+	xmlrpc_DECREF(res);
+
+	return has_support;
+}
+
 /**
  * chamelium_get_audio_channel_mapping:
  * @chamelium: the Chamelium instance
diff --git a/lib/igt_chamelium.h b/lib/igt_chamelium.h
index f47b84cbfc01..a067c888c0ff 100644
--- a/lib/igt_chamelium.h
+++ b/lib/igt_chamelium.h
@@ -106,6 +106,8 @@ void chamelium_start_capture(struct chamelium *chamelium,
 void chamelium_stop_capture(struct chamelium *chamelium, int frame_count);
 void chamelium_capture(struct chamelium *chamelium, struct chamelium_port *port,
 		       int x, int y, int w, int h, int frame_count);
+bool chamelium_has_audio_support(struct chamelium *chamelium,
+				 struct chamelium_port *port);
 void chamelium_get_audio_channel_mapping(struct chamelium *chamelium,
 					 struct chamelium_port *port,
 					 int mapping[static 8]);
diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
index 502f1efa0727..7c3006982abd 100644
--- a/tests/kms_chamelium.c
+++ b/tests/kms_chamelium.c
@@ -1033,6 +1033,10 @@ test_display_audio(data_t *data, struct chamelium_port *port,

 	igt_require(alsa_has_exclusive_access());

+	/* Old Chamelium devices need an update for DisplayPort audio
+	 * support. */
+	igt_require(chamelium_has_audio_support(data->chamelium, port));
+
 	alsa = alsa_init();
 	igt_assert(alsa);

--
2.21.0



More information about the igt-dev mailing list