summaryrefslogtreecommitdiff
path: root/lib/igt_audio.c
AgeCommit message (Collapse)Author
2019-04-29lib/igt_audio: fix filemode not specified in open(O_CREAT)Simon Ser
open(3) takes va_args after the flags and O_CREAT will read the first one. If we don't provide one, this is undefined behaviour. (Someone reported it broke the build for them) Signed-off-by: Simon Ser <simon.ser@intel.com> Fixes: 311baff151f9 ("tests/kms_chamelium: add dp-audio test") Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-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-25lib/igt_{alsa, audio}: improve loggingSimon Ser
- Print matched audio devices - Print min/max values when alsa_test_configuration fails - Print debug log line when skipping a frequency 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>
2019-01-21lib/igt_audio: Initialize freq in audio_signal_detect()Petri Latvala
It's not clear to the static analyzer that freq is assigned when handling the previous frame and then used in the next. In fact, it wasn't clear to me either before staring at the code for some minutes. Initializing it to something makes both of us happier. Signed-off-by: Petri Latvala <petri.latvala@intel.com> Cc: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
2018-05-14lib/audio: Replace sqrt(a*a + b*b) with hypot(a, b)Chris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@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-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>