lib/igt_alsa: remove input support
PATCH 1/1 lib/igt_alsa: remove input support
This is not used anymore because the old audio tests have been removed.
--- lib/igt_alsa.c | 192 ------------------------------------------------- lib/igt_alsa.h | 9 --- 2 files changed, 201 deletions(-)
lib/igt_alsa.c +0 -192
@@ -53,14 +53,6 @@ struct alsa {int (*output_callback)(void *data,short *buffer,int samples);void *output_callback_data;int output_samples_trigger; - -snd_pcm_t *input_handle; -int input_sampling_rate; -int input_channels; - -int (*input_callback)(void *data,short *buffer,int samples); -void *input_callback_data; -int input_samples_trigger; };/**
@@ -249,40 +241,6 @@ int alsa_open_output(struct alsa *alsa, const char *device_name)return 0 ; } -/** -* alsa_open_input: -* @alsa: The target alsa structure -* @device_name: The name of the input device to open -* -* Open the ALSA input device whose name matches the provided name prefix. -* -* Returns: An integer equal to zero for success and negative for failure -*/ -int alsa_open_input (struct alsa *alsa,const char *device_name) -{ -snd_pcm_t *handle; -char *identifier; -int ret; - - identifier =alsa_resolve_indentifier (device_name,0 ); - - ret =snd_pcm_open (&handle, device_name,SND_PCM_STREAM_CAPTURE , -SND_PCM_NONBLOCK ); -if (ret <0 ) - goto complete; - -igt_debug ("Opened input %s\n" , identifier); - - alsa->input_handle = handle; - - ret =0 ; - -complete: -free (identifier); - -return ret; -} -/** * alsa_close_output: * @alsa: The target alsa structure
@@ -308,24 +266,6 @@ void alsa_close_output(struct alsa *alsa) alsa->output_callback =NULL ; } -/** -* alsa_close_output: -* @alsa: The target alsa structure -* -* Close the open ALSA input. -*/ -void alsa_close_input (struct alsa *alsa) -{ -snd_pcm_t *handle = alsa->input_handle; -if (!handle) -return ; - -snd_pcm_close (handle); - alsa->input_handle =NULL ; - - alsa->input_callback =NULL ; -} -static bool alsa_test_configuration (snd_pcm_t *handle,int channels,int sampling_rate) {
@@ -393,24 +333,6 @@ bool alsa_test_output_configuration(struct alsa *alsa, int channels,return true; } -/** -* alsa_test_input_configuration: -* @alsa: The target alsa structure -* @channels: The number of channels to test -* @sampling_rate: The sampling rate to test -* -* Test the input configuration specified by @channels and @sampling_rate -* for the input device. -* -* Returns: A boolean indicating whether the test succeeded -*/ -bool alsa_test_input_configuration (struct alsa *alsa,int channels, -int sampling_rate) -{ -return alsa_test_configuration (alsa->input_handle, channels, - sampling_rate); -} -/** * alsa_configure_output: * @alsa: The target alsa structure
@@ -443,33 +365,6 @@ void alsa_configure_output(struct alsa *alsa, int channels, alsa->output_sampling_rate = sampling_rate; } -/** -* alsa_configure_input: -* @alsa: The target alsa structure -* @channels: The number of channels to test -* @sampling_rate: The sampling rate to test -* -* Configure the input device with the configuration specified by @channels -* and @sampling_rate. -*/ -void alsa_configure_input (struct alsa *alsa,int channels, -int sampling_rate) -{ -snd_pcm_t *handle; -int ret; - - handle = alsa->input_handle; - - ret =snd_pcm_set_params (handle,SND_PCM_FORMAT_S16_LE , -SND_PCM_ACCESS_RW_INTERLEAVED , channels, - sampling_rate,0 ,0 ); -igt_assert (ret >=0 ); - - alsa->input_channels = channels; - alsa->input_sampling_rate = sampling_rate; - -} -/** * alsa_register_output_callback: * @alsa: The target alsa structure
@@ -492,28 +387,6 @@ void alsa_register_output_callback(struct alsa *alsa, alsa->output_samples_trigger = samples_trigger; } -/** -* alsa_register_input_callback: -* @alsa: The target alsa structure -* @callback: The callback function to call when input data is available -* @callback_data: The data pointer to pass to the callback function -* @samples_trigger: The required number of samples to trigger the callback -* -* Register a callback function to be called when input data is available during -* a run. The callback is called when @samples_trigger samples are available. -* -* The callback should return an integer equal to zero for success, negative for -* failure and positive to indicate that the run should stop. -*/ -void alsa_register_input_callback (struct alsa *alsa, -int (*callback)(void *data,short *buffer,int samples), -void *callback_data,int samples_trigger) -{ - alsa->input_callback = callback; - alsa->input_callback_data = callback_data; - alsa->input_samples_trigger = samples_trigger; -} -/** * alsa_run: * @alsa: The target alsa structure
@@ -530,18 +403,12 @@ int alsa_run(struct alsa *alsa, int duration_ms) {snd_pcm_t *handle;short *output_buffer =NULL ; -short *input_buffer =NULL ;int output_limit;int output_total =0 ;int output_counts[alsa->output_handles_count];bool output_ready = false;int output_channels;int output_trigger; -int input_limit; -int input_total =0 ; -int input_count =0 ; -int input_channels; -int input_trigger;bool reached;int index;int count;
@@ -555,14 +422,6 @@ int alsa_run(struct alsa *alsa, int duration_ms) output_buffer =malloc (sizeof (short ) * output_channels * output_trigger); -if (alsa->input_callback) { - input_limit = alsa->input_sampling_rate * duration_ms /1000 ; - input_trigger = alsa->input_samples_trigger; - input_channels = alsa->input_channels; - input_buffer =malloc (sizeof (short ) * input_channels * - input_trigger); - } - do { reached = true;
@@ -627,63 +486,12 @@ int alsa_run(struct alsa *alsa, int duration_ms) output_total += output_trigger; } - -if (alsa->input_callback && - (input_limit <0 || input_total < input_limit)) { - reached = false; - -if (input_count == input_trigger) { - input_count =0 ; - - ret = alsa->input_callback (alsa->input_callback_data, - input_buffer, - input_trigger); -if (ret !=0 ) - goto complete; - } - - handle = alsa->input_handle; - - ret =snd_pcm_avail (handle); -if (input_count < input_trigger && - (ret >0 || input_total ==0 )) { - index = input_count * input_channels; - count = input_trigger - input_count; - avail =snd_pcm_avail (handle); - - count = avail >0 && avail < count ? avail : - count; - - ret =snd_pcm_readi (handle, - &input_buffer[index], - count); -if (ret == -EAGAIN ) { - ret =0 ; - }else if (ret <0 ) { - ret =snd_pcm_recover (handle, ret,0 ); -if (ret <0 ) { -igt_debug ("snd_pcm_recover after snd_pcm_readi failed" ); - goto complete; - } - } - - input_count += ret; - input_total += ret; - }else if (input_count < input_trigger && ret <0 ) { - ret =snd_pcm_recover (handle, ret,0 ); -if (ret <0 ) { -igt_debug ("snd_pcm_recover failed" ); - goto complete; - } - } - } }while (!reached); ret =0 ; complete:free (output_buffer); -free (input_buffer);return ret; }
lib/igt_alsa.h +0 -9
@@ -36,23 +36,14 @@ struct alsa;bool alsa_has_exclusive_access (void );struct alsa *alsa_init (void );int alsa_open_output (struct alsa *alsa,const char *device_name); -int alsa_open_input (struct alsa *alsa,const char *device_name);void alsa_close_output (struct alsa *alsa); -void alsa_close_input (struct alsa *alsa);bool alsa_test_output_configuration (struct alsa *alsa,int channels,int sampling_rate); -bool alsa_test_input_configuration (struct alsa *alsa,int channels, -int sampling_rate);void alsa_configure_output (struct alsa *alsa,int channels,int sampling_rate); -void alsa_configure_input (struct alsa *alsa,int channels, -int sampling_rate);void alsa_register_output_callback (struct alsa *alsa,int (*callback)(void *data,short *buffer,int samples),void *callback_data,int samples_trigger); -void alsa_register_input_callback (struct alsa *alsa, -int (*callback)(void *data,short *buffer,int samples), -void *callback_data,int samples_trigger);int alsa_run (struct alsa *alsa,int duration_ms);#endif
--
2.21.0
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✓ Fi.CI.BAT: success for lib/igt_alsa: remove input support
== Series Details ==
== Series Details ==
Series: lib/igt_alsa: remove input support
URL : https://patchwork.freedesktop.org/series/60615/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_6078 -> IGTPW_2976
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/60615/revisions/1/mbox/
Known issues
------------
Here are the changes found in IGTPW_2976 that come from known issues:
### IGT changes ###
#### Possible fixes ####
* igt@i915_selftest@live_hangcheck:
- fi-skl-iommu: [INCOMPLETE][1] ([fdo#108602] / [fdo#108744]) -> [PASS][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6078/fi-skl-iommu/igt@i915_selftest@live_hangcheck.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2976/fi-skl-iommu/igt@i915_selftest@live_hangcheck.html
[fdo#108602]: https://bugs.freedesktop.org/show_bug.cgi?id=108602
[fdo#108744]: https://bugs.freedesktop.org/show_bug.cgi?id=108744
Participating hosts (54 -> 44)
------------------------------
Missing (10): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-kbl-7500u fi-ctg-p8600 fi-gdg-551 fi-byt-clapper fi-bdw-samus
Build changes
-------------
* IGT: IGT_4984 -> IGTPW_2976
CI_DRM_6078: c8c778558fd52abd3303d8ea324df788062adc97 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2976: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2976/
IGT_4984: 66c887d2f7a92a4a97acd9611d5342afc5d4f815 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2976/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 3 lines · Simon Ser
This is not used anymore because the old audio tests have been removed.
Signed-off-by Simon Ser <[email protected]>
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev