summaryrefslogtreecommitdiff
path: root/lib/igt_audio.h
AgeCommit message (Collapse)Author
2019-05-27lib/igt_audio: introduce audio_convert_toSimon Ser
This function converts normalized doubles into an ALSA PCM format. Instead of having per-format audio_signal_fill_* functions, we can only have audio_signal_fill that outputs normalized doubles. Then in ALSA's playback callback, we can simply use the new audio_convert_to function to fill the buffer. This makes the test code simpler and prevents code duplication when another ALSA playback callback is implemented. This adds a dependency of igt_audio over ALSA for the PCM format enum, but I don't think this is a concern, since I don't see the point of using igt_audio without igt_alsa. If this is an issue, it would always be possible to replace ALSA's enum with our own in the future. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-05-20lib/igt_audio: add support for S24_LE and S32_LE signal generationSimon Ser
This adds two new helpers to generate S24_LE and S32_LE signals. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-05-16lib/igt_audio: use double instead of int16_tSimon Ser
In order to be able to generate S32_LE signals, we need a higher precision than S16_LE. Change the signal generation code to use double instead of int16_t and introduce a new helper to fill a buffer with S16_LE samples. We already use arrays of doubles elsewhere (see audio_signal_detect). Similar format-specific helpers will be added for S32_LE in the future. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2019-05-15lib/igt_audio: make audio_signal_detect take const dataSimon Ser
audio_signal_detect uses gsl_fft_real_radix2_transform which mutates the data array. This can be surprising when calling audio_signal_detect and then read again the data (e.g. for another check). Instead of mutating the array, make audio_signal_detect less error-prone by taking a const parameter. Do an internal copy before calling the gsl function. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2019-04-25tests/kms_chamelium: test we receive a signal from both audio channelsSimon Ser
This commit updates the audio test to make sure we receive a signal from both audio channels. However this commit doesn't check that left and right channels are not swapped. Such a check requires some more work (because the Chamelium device does swap left and right channels) and will be implemented in a future commit. This commit adds a new channel argument to audio_signal_add_frequency, to add a frequency to a single channel only. Some light refactoring has been performed: a proper audio_signal_fini function has been introduced and size_t in now used when it should be. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-04-25tests/kms_chamelium: add dp-audio testSimon Ser
This new test ensures DisplayPort audio works by using the Chamelium. It enables the DisplayPort output and sends an audio signal containing a set of frequencies we choose to all HDMI/DisplayPort audio devices. It starts recording audio on the Chamelium device and uses the stream server to retrieve captured audio pages. It then checks that the capture audio signal contains the frequencies we sent, and only those, by computing a FFT. A new library has been added to libigt to communicate with the stream server. It implements a simple custom TCP protocol. In case the test fails, a WAV file with the captured data is saved on disk. Right now the test has a few limitations: - Only the first channel is checked - IGT only generates audio with a single sampling rate (48 KHz) - Audio data is not captured in real-time These limitations will be lifted in future patches. PulseAudio must not run during the tests since ALSA is used directly. To ensure this, edit /etc/pulse/client.conf and add `autospawn=no`. Then run `pulseaudio --kill`. This commit deletes the existing audio tests. They weren't run and required an exotic configuration (HDMI audio splitter, dummy HDMI sink and a line-in port on the DUT). This patch also changes lib/igt_audio to use uint16_t instead of short. The rationale is: - The standard says a short is at least 16 bit wide, but a short can be larger (in practice it won't happen, but better use types correctly) - It makes it clearer that the audio format is S16_LE, since "16" is in the type name. This patch depends on the following Chameleon bugs: - https://crbug.com/948060 - https://crbug.com/950857 Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2017-09-08lib: clean up header includesDaniel Vetter
Just a bit of OCD, I like it when connections within library modules are a bit more obvious. igt.h is ok for tests, but let's use individual include lines for libraries consistently. Also order standard includes before igt ones. v2: Rebase. Acked-by: Jani Nikula <jani.nikula@intel.com> Acked-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Acked-by: Petri Latvala <petri.latvala@intel.com> Acked-by: Daniel Stone <daniels@collabora.com> Acked-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2017-09-08build: Nuke #ifdef HAVE_CONFIG_H cargo-cultDaniel Vetter
We have it. Daniel Stone said the #ifdef HAVE_CONFIG_H comes from the X11 transition to the modular build, where in the imake -> modular build transition config.h wasn't universally available. Now we just make this a requirement (so yeah Android better generate one too). v2: Improve commit message a bit. Reviewed-by: Eric Anholt <eric@anholt.net> Acked-by: Jani Nikula <jani.nikula@intel.com> Acked-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Acked-by: Petri Latvala <petri.latvala@intel.com> Acked-by: Daniel Stone <daniels@collabora.com> Acked-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2017-08-21lib: Add audio library with dedicated helpersPaul Kocialkowski
This introduces an audio library, with dedicated helpers for both generating signals and detecting peak frequencies in a signal. This library paves the way for testing audio going through display connectors, such as HDMI. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com> Reviewed-by: Lyude Paul <lyude@redhat.com>