All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Ser <simon.ser@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: martin.peres@intel.com
Subject: [igt-dev] [PATCH i-g-t v3 01/10] lib/igt_chamelium: introduce CHAMELIUM_MAX_AUDIO_CHANNELS
Date: Mon, 27 May 2019 17:34:09 +0300	[thread overview]
Message-ID: <20190527143418.7925-2-simon.ser@intel.com> (raw)
In-Reply-To: <20190527143418.7925-1-simon.ser@intel.com>

This allows us not to hardcode 8 everywhere.

Signed-off-by: Simon Ser <simon.ser@intel.com>
---
 lib/igt_chamelium.c | 8 +++++---
 lib/igt_chamelium.h | 8 +++++++-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index cfdf7617a65a..75f03d8469aa 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -1020,7 +1020,7 @@ bool chamelium_has_audio_support(struct chamelium *chamelium,
  */
 void chamelium_get_audio_channel_mapping(struct chamelium *chamelium,
 					 struct chamelium_port *port,
-					 int mapping[static 8])
+					 int mapping[static CHAMELIUM_MAX_AUDIO_CHANNELS])
 {
 	xmlrpc_value *res, *res_channel;
 	int res_len, i;
@@ -1028,7 +1028,7 @@ void chamelium_get_audio_channel_mapping(struct chamelium *chamelium,
 	res = chamelium_rpc(chamelium, port, "GetAudioChannelMapping", "(i)",
 			    port->id);
 	res_len = xmlrpc_array_size(&chamelium->env, res);
-	igt_assert(res_len == 8);
+	igt_assert(res_len == CHAMELIUM_MAX_AUDIO_CHANNELS);
 	for (i = 0; i < res_len; i++) {
 		xmlrpc_array_read_item(&chamelium->env, res, i, &res_channel);
 		xmlrpc_read_int(&chamelium->env, res_channel, &mapping[i]);
@@ -1058,8 +1058,10 @@ static void audio_format_from_xml(struct chamelium *chamelium,
 
 	if (rate)
 		xmlrpc_read_int(&chamelium->env, res_rate, rate);
-	if (channels)
+	if (channels) {
 		xmlrpc_read_int(&chamelium->env, res_channel, channels);
+		igt_assert(*channels <= CHAMELIUM_MAX_AUDIO_CHANNELS);
+	}
 
 	xmlrpc_DECREF(res_channel);
 	xmlrpc_DECREF(res_sample_format);
diff --git a/lib/igt_chamelium.h b/lib/igt_chamelium.h
index 33362b266ce4..28f726c91e83 100644
--- a/lib/igt_chamelium.h
+++ b/lib/igt_chamelium.h
@@ -65,6 +65,12 @@ struct chamelium_audio_file {
  */
 #define CHAMELIUM_DEFAULT_EDID 0
 
+/**
+ * CHAMELIUM_MAX_AUDIO_CHANNELS: the maximum number of audio capture channels
+ * supported by Chamelium.
+ */
+#define CHAMELIUM_MAX_AUDIO_CHANNELS 8
+
 struct chamelium *chamelium_init(int drm_fd);
 void chamelium_deinit(struct chamelium *chamelium);
 void chamelium_reset(struct chamelium *chamelium);
@@ -116,7 +122,7 @@ 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]);
+					 int mapping[static CHAMELIUM_MAX_AUDIO_CHANNELS]);
 void chamelium_get_audio_format(struct chamelium *chamelium,
 				struct chamelium_port *port,
 				int *rate, int *channels);
-- 
2.21.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-05-27 14:34 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-27 14:34 [igt-dev] [PATCH i-g-t v3 00/10] tests/kms_chamelium: add pulse test Simon Ser
2019-05-27 14:34 ` Simon Ser [this message]
2019-05-27 14:41   ` [igt-dev] [PATCH i-g-t v3 01/10] lib/igt_chamelium: introduce CHAMELIUM_MAX_AUDIO_CHANNELS Peres, Martin
2019-05-27 14:34 ` [igt-dev] [PATCH i-g-t v3 02/10] tests/kms_chamelium: refactor audio test Simon Ser
2019-05-27 14:34 ` [igt-dev] [PATCH i-g-t v3 03/10] tests/kms_chamelium: introduce audio_state_receive Simon Ser
2019-05-27 14:34 ` [igt-dev] [PATCH i-g-t v3 04/10] tests/kms_chamelium: rename do_test_display_audio and test_audio_configuration Simon Ser
2019-05-27 14:34 ` [igt-dev] [PATCH i-g-t v3 05/10] tests/kms_chamelium: explain why 8-channel tests aren't performed Simon Ser
2019-05-27 14:34 ` [igt-dev] [PATCH i-g-t v3 06/10] lib/igt_audio: introduce audio_convert_to Simon Ser
2019-05-27 14:34 ` [igt-dev] [PATCH i-g-t v3 07/10] tests/kms_chamelium: add name parameter to audio_state_start Simon Ser
2019-05-27 14:34 ` [igt-dev] [PATCH i-g-t v3 08/10] lib/igt_audio: make audio_extract_channel_s32_le support a NULL dst Simon Ser
2019-05-27 14:34 ` [igt-dev] [PATCH i-g-t v3 09/10] tests/kms_chamelium: add a flatline audio test Simon Ser
2019-06-04  8:38   ` Tvrtko Ursulin
2019-06-04 11:22     ` Ser, Simon
2019-06-04 12:26       ` Peres, Martin
2019-06-04 12:59         ` Tvrtko Ursulin
2019-06-04 14:06           ` Ser, Simon
2019-06-05 10:51             ` Tvrtko Ursulin
2019-06-05 13:04               ` Ser, Simon
2019-06-05 13:30                 ` Tvrtko Ursulin
2019-06-04 14:11         ` Ser, Simon
2019-05-27 14:34 ` [igt-dev] [PATCH i-g-t v3 10/10] tests/kms_chamelium: add audio channel alignment test Simon Ser
2019-05-27 16:03 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_chamelium: add pulse test (rev3) Patchwork
2019-05-28  4:48 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190527143418.7925-2-simon.ser@intel.com \
    --to=simon.ser@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=martin.peres@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.