public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Martin Peres <martin.peres@linux.intel.com>
To: Simon Ser <simon.ser@intel.com>, igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t v7 3/8] lib/igt_{alsa, audio}: improve logging
Date: Thu, 25 Apr 2019 12:53:42 +0300	[thread overview]
Message-ID: <d4e7dfe1-acc6-cb24-ea98-e4f959129864@linux.intel.com> (raw)
In-Reply-To: <20190423130459.31594-4-simon.ser@intel.com>

On 23/04/2019 16:04, Simon Ser wrote:
> - 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>

> ---
>  lib/igt_alsa.c  | 21 +++++++++++++++++++--
>  lib/igt_audio.c |  5 ++++-
>  2 files changed, 23 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/igt_alsa.c b/lib/igt_alsa.c
> index fc6d336b..3b1a9e90 100644
> --- a/lib/igt_alsa.c
> +++ b/lib/igt_alsa.c
> @@ -182,6 +182,8 @@ static char *alsa_resolve_indentifier(const char *device_name, int skip)
>  					continue;
>  				}
>  
> +				igt_debug("Matched device \"%s\"\n", pcm_name);
> +
>  				snprintf(name, sizeof(name), "hw:%d,%d", card,
>  					 dev);
>  
> @@ -329,6 +331,9 @@ static bool alsa_test_configuration(snd_pcm_t *handle, int channels,
>  {
>  	snd_pcm_hw_params_t *params;
>  	int ret;
> +	unsigned int min_channels, max_channels;
> +	unsigned int min_rate, max_rate;
> +	int min_rate_dir, max_rate_dir;
>  
>  	snd_pcm_hw_params_alloca(&params);
>  
> @@ -337,12 +342,24 @@ static bool alsa_test_configuration(snd_pcm_t *handle, int channels,
>  		return false;
>  
>  	ret = snd_pcm_hw_params_test_rate(handle, params, sampling_rate, 0);
> -	if (ret < 0)
> +	if (ret < 0) {
> +		snd_pcm_hw_params_get_rate_min(params, &min_rate, &min_rate_dir);
> +		snd_pcm_hw_params_get_rate_max(params, &max_rate, &max_rate_dir);
> +		igt_debug("Output device supports rates between %u and %u, "
> +			  "requested %d\n",
> +			  min_rate, max_rate, sampling_rate);
>  		return false;
> +	}
>  
>  	ret = snd_pcm_hw_params_test_channels(handle, params, channels);
> -	if (ret < 0)
> +	if (ret < 0) {
> +		snd_pcm_hw_params_get_channels_min(params, &min_channels);
> +		snd_pcm_hw_params_get_channels_max(params, &max_channels);
> +		igt_debug("Output device supports between %u and "
> +			  "%u channels, requested %d\n",
> +			  min_channels, max_channels, channels);
>  		return false;
> +	}
>  
>  	return true;
>  }
> diff --git a/lib/igt_audio.c b/lib/igt_audio.c
> index 7624f565..5822fed7 100644
> --- a/lib/igt_audio.c
> +++ b/lib/igt_audio.c
> @@ -102,8 +102,11 @@ int audio_signal_add_frequency(struct audio_signal *signal, int frequency)
>  		return -1;
>  
>  	/* Stay within the Nyquist–Shannon sampling theorem. */
> -	if (frequency > signal->sampling_rate / 2)
> +	if (frequency > signal->sampling_rate / 2) {
> +		igt_debug("Skipping frequency %d: too high for a %d Hz "
> +			  "sampling rate\n", frequency, signal->sampling_rate);
>  		return -1;
> +	}
>  
>  	/* Clip the frequency to an integer multiple of the sampling rate.
>  	 * This to be able to store a full period of it and use that for
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-04-25  9:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-23 13:04 [igt-dev] [PATCH i-g-t v7 0/8] tests/kms_chamelium: add dp-audio test Simon Ser
2019-04-23 13:04 ` [igt-dev] [PATCH i-g-t v7 1/8] " Simon Ser
2019-04-25 10:16   ` Petri Latvala
2019-04-25 11:37     ` Arkadiusz Hiler
2019-04-23 13:04 ` [igt-dev] [PATCH i-g-t v7 2/8] tests/kms_chamelium: capture audio data in real-time Simon Ser
2019-04-23 13:04 ` [igt-dev] [PATCH i-g-t v7 3/8] lib/igt_{alsa, audio}: improve logging Simon Ser
2019-04-25  9:53   ` Martin Peres [this message]
2019-04-23 13:04 ` [igt-dev] [PATCH i-g-t v7 4/8] lib/igt_alsa: use variables to improve readability Simon Ser
2019-04-25  9:54   ` Martin Peres
2019-04-23 13:04 ` [igt-dev] [PATCH i-g-t v7 5/8] tests/kms_chamelium: test we receive a signal from both audio channels Simon Ser
2019-04-23 13:04 ` [igt-dev] [PATCH i-g-t v7 6/8] tests/kms_chamelium: test audio channels are not mixed up Simon Ser
2019-04-23 13:04 ` [igt-dev] [PATCH i-g-t v7 7/8] tests/kms_chamelium: run audio test with multiple sampling rates Simon Ser
2019-04-23 13:04 ` [igt-dev] [PATCH i-g-t v7 8/8] HAX: add dp-audio test to fast-feedback Simon Ser
2019-04-23 15:29 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_chamelium: add dp-audio test (rev8) Patchwork
2019-04-23 18:33 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-04-25 10:00 ` [igt-dev] [PATCH i-g-t v7 0/8] tests/kms_chamelium: add dp-audio test Martin Peres

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d4e7dfe1-acc6-cb24-ea98-e4f959129864@linux.intel.com \
    --to=martin.peres@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=simon.ser@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox