diff options
author | Simon Ser <simon.ser@intel.com> | 2019-07-15 18:44:49 +0300 |
---|---|---|
committer | Simon Ser <simon.ser@intel.com> | 2019-08-14 13:20:32 +0300 |
commit | 81df2f22385bc275975cf199d962eed9bc10f916 (patch) | |
tree | 73f9a79e8b00d388458cb57a2ba7da9f92478285 /tests | |
parent | 789fc28fd46d1cc6d3b4abf9b74b77a5b3f34a71 (diff) | |
download | platform_external_igt-gpu-tools-81df2f22385bc275975cf199d962eed9bc10f916.tar.gz platform_external_igt-gpu-tools-81df2f22385bc275975cf199d962eed9bc10f916.tar.bz2 platform_external_igt-gpu-tools-81df2f22385bc275975cf199d962eed9bc10f916.zip |
tests/kms_chamelium: add InfoFrame checks to audio tests
If the DUT sends an InfoFrame, check that its values are correct. Per the HDMI
and DP specs, most of the fields can be set to "refer to stream header" because
some information is duplicated. The DP spec also says that InfoFrames are
optional if mono or stereo audio is used (because there's no channel speaker
allocation).
Signed-off-by: Simon Ser <simon.ser@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/kms_chamelium.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c index b7d30a2d..f25d13c6 100644 --- a/tests/kms_chamelium.c +++ b/tests/kms_chamelium.c @@ -29,6 +29,7 @@ #include "igt_vc4.h" #include "igt_edid.h" #include "igt_eld.h" +#include "igt_infoframe.h" #include <fcntl.h> #include <pthread.h> @@ -1121,6 +1122,59 @@ static void audio_state_stop(struct audio_state *state, bool success) success ? "ALL GREEN" : "FAILED"); } +static void check_audio_infoframe(struct audio_state *state) +{ + struct chamelium_infoframe *infoframe; + struct infoframe_audio infoframe_audio; + struct infoframe_audio expected = {0}; + bool ok; + + if (!chamelium_supports_get_last_infoframe(state->chamelium)) { + igt_debug("Skipping audio InfoFrame check: " + "Chamelium board doesn't support GetLastInfoFrame\n"); + return; + } + + expected.coding_type = INFOFRAME_AUDIO_CT_PCM; + expected.channel_count = state->playback.channels; + expected.sampling_freq = state->playback.rate; + expected.sample_size = snd_pcm_format_width(state->playback.format); + + infoframe = chamelium_get_last_infoframe(state->chamelium, state->port, + CHAMELIUM_INFOFRAME_AUDIO); + if (infoframe == NULL && state->playback.channels <= 2) { + /* Audio InfoFrames are optional for mono and stereo audio */ + igt_debug("Skipping audio InfoFrame check: " + "no InfoFrame received\n"); + return; + } + igt_assert_f(infoframe != NULL, "no audio InfoFrame received\n"); + + ok = infoframe_audio_parse(&infoframe_audio, infoframe->version, + infoframe->payload, infoframe->payload_size); + chamelium_infoframe_destroy(infoframe); + igt_assert_f(ok, "failed to parse audio InfoFrame\n"); + + igt_debug("Checking audio InfoFrame:\n"); + igt_debug("coding_type: got %d, expected %d\n", + infoframe_audio.coding_type, expected.coding_type); + igt_debug("channel_count: got %d, expected %d\n", + infoframe_audio.channel_count, expected.channel_count); + igt_debug("sampling_freq: got %d, expected %d\n", + infoframe_audio.sampling_freq, expected.sampling_freq); + igt_debug("sample_size: got %d, expected %d\n", + infoframe_audio.sample_size, expected.sample_size); + + if (infoframe_audio.coding_type != INFOFRAME_AUDIO_CT_UNSPECIFIED) + igt_assert(infoframe_audio.coding_type == expected.coding_type); + if (infoframe_audio.channel_count >= 0) + igt_assert(infoframe_audio.channel_count == expected.channel_count); + if (infoframe_audio.sampling_freq >= 0) + igt_assert(infoframe_audio.sampling_freq == expected.sampling_freq); + if (infoframe_audio.sample_size >= 0) + igt_assert(infoframe_audio.sample_size == expected.sample_size); +} + static int audio_output_frequencies_callback(void *data, void *buffer, int samples) { @@ -1246,6 +1300,8 @@ static bool test_audio_frequencies(struct audio_state *state) free(channel); audio_signal_fini(state->signal); + check_audio_infoframe(state); + return success; } |