summaryrefslogtreecommitdiff
path: root/lib/igt_alsa.c
AgeCommit message (Collapse)Author
2019-11-26lib/igt_alsa: Check that ELD comes from IGTSimon Ser
Prior to this commit, audio tests play sound on all HDMI/DisplayPort PCM devices (by filtering devices with the "HDMI" prefix). This had several issues. First, the PCM device → connector mapping via the ELD wasn't checked. Second, it makes debugging more complicated: if ALSA doesn't detect the screen, we just get a Chamelium failure (because it doesn't receive any audio stream). Third, it would play sounds on real screens too (not only Chamelium) and this could theorically damage bad hardware (though this is just speculation). To mitigate this issue, check the monitor name of PCM devices we open and only keep them if it's an IGT EDID (ie. connected to the Chamelium board). Note that while this is a good improvement, it isn't a complete fix: the ELD is only exposed by the HDA Intel driver. This means non-IGT PCM devices won't be filtered out on non-Intel hardware. There is no driver-agnostic way to get the screen name, I'm afraid. Cc: Martin Peres <martin.peres@linux.intel.com> Signed-off-by: Simon Ser <simon.ser@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-05-20lib/igt_alsa: add format argument to alsa_test_output_configurationSimon Ser
This allows us to test whether HW supports a PCM format, and only run the test if it's the case. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-05-20lib/igt_alsa: support all alsa formatsSimon Ser
This commit adds a new format argument to alsa_configure_output. This allows the caller to decide the format used for the audio signal. This removes the assumption that samples are S16_LE items in igt_alsa. The alsa function snd_pcm_format_physical_width is used instead of sizeof(short). This also removes the theorically incorrect assumption that sizeof(short) == sizeof(int16_t). Right now S16_LE is hardcoded in the test. Tests with other formats will be added in future commits. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-05-14lib/igt_alsa: remove input supportSimon Ser
This is not used anymore because the old audio tests have been removed. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2019-04-25lib/igt_alsa: use variables to improve readabilitySimon Ser
Most people don't have "remember what the last two parameters of snd_pcm_set_params are" in their lifegoals list. Use variables so that it's clearer what those are. 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: capture audio data in real-timeSimon Ser
Before this patch, the audio test first sends an audio signal for 2s, and then checks whether the captured signal matches. This patch makes it so we send and check the signal in parallel. Thus we can stop the test as soon as we receive the correct signal. This saves ~2s per audio test. 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_alsa: Remove dead assignmentPetri Latvala
The execution can only reach the end (goto complete) or the new unconditional assignment a few lines below before the value is read again. Either it's really a dead assignment, or there's a bug with the execution flow. Leaning on the former. Signed-off-by: Petri Latvala <petri.latvala@intel.com> Cc: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.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 ALSA library with dedicated helpersPaul Kocialkowski
This introduces an ALSA library, with dedicated helpers for handling playback and capture. It handles ALSA device identification and configuration as well as a run loop with callback mechanisms for feeding output data and handling input data. 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>