public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] lib/igt_alsa: remove input support
@ 2019-05-14  8:06 Simon Ser
  2019-05-14  8:49 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
  2019-05-14 11:42 ` [igt-dev] [PATCH i-g-t] " Arkadiusz Hiler
  0 siblings, 2 replies; 3+ messages in thread
From: Simon Ser @ 2019-05-14  8:06 UTC (permalink / raw)
  To: igt-dev; +Cc: martin.peres

This is not used anymore because the old audio tests have been removed.

Signed-off-by: Simon Ser <simon.ser@intel.com>
---
 lib/igt_alsa.c | 192 -------------------------------------------------
 lib/igt_alsa.h |   9 ---
 2 files changed, 201 deletions(-)

diff --git a/lib/igt_alsa.c b/lib/igt_alsa.c
index a478686a3fd7..28a866e0ee74 100644
--- a/lib/igt_alsa.c
+++ b/lib/igt_alsa.c
@@ -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;
 }
diff --git a/lib/igt_alsa.h b/lib/igt_alsa.h
index 5c804b46ace4..a10985ff777f 100644
--- a/lib/igt_alsa.h
+++ b/lib/igt_alsa.h
@@ -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
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_alsa: remove input support
  2019-05-14  8:06 [igt-dev] [PATCH i-g-t] lib/igt_alsa: remove input support Simon Ser
@ 2019-05-14  8:49 ` Patchwork
  2019-05-14 11:42 ` [igt-dev] [PATCH i-g-t] " Arkadiusz Hiler
  1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2019-05-14  8:49 UTC (permalink / raw)
  To: Ser, Simon; +Cc: igt-dev

== 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
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [igt-dev] [PATCH i-g-t] lib/igt_alsa: remove input support
  2019-05-14  8:06 [igt-dev] [PATCH i-g-t] lib/igt_alsa: remove input support Simon Ser
  2019-05-14  8:49 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
@ 2019-05-14 11:42 ` Arkadiusz Hiler
  1 sibling, 0 replies; 3+ messages in thread
From: Arkadiusz Hiler @ 2019-05-14 11:42 UTC (permalink / raw)
  To: Simon Ser; +Cc: igt-dev, martin.peres

On Tue, May 14, 2019 at 11:06:12AM +0300, Simon Ser wrote:
> 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>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-14 11:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-14  8:06 [igt-dev] [PATCH i-g-t] lib/igt_alsa: remove input support Simon Ser
2019-05-14  8:49 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-05-14 11:42 ` [igt-dev] [PATCH i-g-t] " Arkadiusz Hiler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox