alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Jean-Yves Avenard <jyavenard@gmail.com>
To: Anssi Hannula <anssi.hannula@iki.fi>
Cc: ALSA Development Mailing List <alsa-devel@alsa-project.org>,
	Stephen Warren <swarren@nvidia.com>
Subject: Re: 1ca3d59d5a3e762fb1c002bcd912914bc858b430 broke passthrough [Was: Re: ALSA 1.0.25 broke AC3 passthrough?]
Date: Mon, 13 Feb 2012 17:32:03 +1100	[thread overview]
Message-ID: <CANpj82J+MmYNGbOqmFMCA587sCiUZfjRqDfesfmOG616478SqQ@mail.gmail.com> (raw)
In-Reply-To: <4F37BBDD.1090207@iki.fi>

Hi there

Okay, I had time today to test a bit more on what was going on

On 13 February 2012 00:17, Anssi Hannula <anssi.hannula@iki.fi> wrote:

> I'm not familiar enough with HDA to comment on the cause of the issue,
> but out of interest, does the hang really only happen with passthrough,
> i.e. (AES0 & 0x02) set, or does it happen with a PCM stream with the
> same parameters as well (and the application(s) just happen to set
> problematic ALSA parameters only in passthrough mode)?

Actually, went through over a lot of different type, only to find that
the problem isn't with passthrough as such, but a combination of the
prealloc value set and if 16 bits / 32 bits audio.

16 bits audio, as soon as the ALSA hardware buffer is set to something
different than the default 64 (like 4096, the default when using
Ubuntu)  snd_pcm_write will hang then error.

32 bits audio, plays under most combinations tried, except for 5.1 PCM
where I had to set the prealloc buffer to 1024 and above to get it
work

Here are the various mode I tried, the output of the log is for 4096
prealloc buffer

For a reminder:
format=2 -> SND_PCM_FORMAT_S16_LE
format=10 -> SND_PCM_FORMAT_S32_LE

AC3 Passthrough: working for 64kB, Not working for: 128, 256, 512,
1024, 2048 and 4096
2012-02-13 15:58:50.339376 I  ALSA: SetParameters(format=2,
channels=2, rate=48000, buffer_time=500000, period_time=4)
2012-02-13 15:58:50.339437 I  ALSA: Buffer size range from 64 to 1048576
2012-02-13 15:58:50.339441 I  ALSA: Period size range from 32 to 524288
2012-02-13 15:58:50.339455 I  ALSA: Buffer time = 500000 us
2012-02-13 15:58:50.339465 I  ALSA: Period time = 4 periods
2012-02-13 15:58:50.458098 I  ALSA: Buffer size = 24000 | Period size = 6000
2012-02-13 15:58:50.696838 I  AO: Audio fragment size: 12000

16 bits stereo: working for 64, Not working for: 128, 256, 512, 1024, 2048, 4096
2012-02-13 16:20:39.027793 I  ALSA: SetParameters(format=2,
channels=2, rate=48000, buffer_time=500000, period_time=4)
2012-02-13 16:20:39.027855 I  ALSA: Buffer size range from 64 to 1048576
2012-02-13 16:20:39.027859 I  ALSA: Period size range from 32 to 524288
2012-02-13 16:20:39.027873 I  ALSA: Buffer time = 500000 us
2012-02-13 16:20:39.027883 I  ALSA: Period time = 4 periods
2012-02-13 16:20:39.267237 I  ALSA: Buffer size = 24000 | Period size = 6000
2012-02-13 16:20:39.507467 I  AO: Audio fragment size: 12000

32 bits Stereo: working for: 64, 128,,256, 512, 1024, 2048 and 4096
2012-02-13 16:05:25.010312 I  ALSA: SetParameters(format=10,
channels=2, rate=48000, buffer_time=500000, period_time=4)
2012-02-13 16:05:25.010372 I  ALSA: Buffer size range from 32 to 524288
2012-02-13 16:05:25.010376 I  ALSA: Period size range from 16 to 262144
2012-02-13 16:05:25.010389 I  ALSA: Buffer time = 500000 us
2012-02-13 16:05:25.010400 I  ALSA: Period time = 4 periods
2012-02-13 16:05:25.286857 I  ALSA: Buffer size = 24000 | Period size = 6000
2012-02-13 16:05:25.526849 I  AO: Audio fragment size: 24000

5.1 16 bits PCM:
Using 64kB prealloc buffer, snd_pcm_hw_params_set_buffer_time_near
gives the error "Invalid Parameter" for 500000
Not working for 128, 256, 512, 1024, 2048 and 4096

2012-02-13 16:09:11.621562 I  ALSA: SetParameters(format=2,
channels=6, rate=48000, buffer_time=500000, period_time=4)
2012-02-13 16:09:11.621628 I  ALSA: Buffer size range from 22 to 349525
2012-02-13 16:09:11.621632 I  ALSA: Period size range from 11 to 174762
2012-02-13 16:09:11.621645 I  ALSA: Buffer time = 500000 us
2012-02-13 16:09:11.621663 I  ALSA: Period time = 4 periods
2012-02-13 16:09:11.796861 I  ALSA: Buffer size = 24000 | Period size = 6000
2012-02-13 16:09:12.036842 I  AO: Audio fragment size: 36000

5.1 32 bits PCM:
Not working for: 64, 256, 512. Working for 1024, 2048, 4096
128 gives Invalid argument for snd_pcm_hw_params_set_buffer_time_near

2012-02-13 16:25:12.890306 I  ALSA: SetParameters(format=10,
channels=6, rate=48000, buffer_time=500000, period_time=4)
2012-02-13 16:25:12.890366 I  ALSA: Buffer size range from 12 to 174762
2012-02-13 16:25:12.890370 I  ALSA: Period size range from 6 to 87381
2012-02-13 16:25:12.890383 I  ALSA: Buffer time = 500000 us
2012-02-13 16:25:12.890393 I  ALSA: Period time = 4 periods
2012-02-13 16:25:13.066855 I  ALSA: Buffer size = 24000 | Period size = 6000
2012-02-13 16:25:13.316823 I  AO: Audio fragment size: 72000

>From looking at hda_intel.c, it seems that the problem is that the
nvidia set AZX_DCAPS_BUFSIZE in driver_caps when it probably doesn't
support it..
Hopefully Stephen will be able to answer that one.

I'm surprised not more people has reported the problem, surely there
are a lot of people affected by this... Though 1.0.25 is very recent
and not used yet by many linux distribution. Soon this will change :(

Jean-Yves

  parent reply	other threads:[~2012-02-13  6:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-12 10:25 1ca3d59d5a3e762fb1c002bcd912914bc858b430 broke passthrough [Was: Re: ALSA 1.0.25 broke AC3 passthrough?] Jean-Yves Avenard
2012-02-12 13:17 ` Anssi Hannula
2012-02-12 13:44   ` Jean-Yves Avenard
2012-02-13  6:32   ` Jean-Yves Avenard [this message]
2012-02-13 13:34     ` Takashi Iwai
2012-02-15  2:09       ` Jean-Yves Avenard
2012-02-15  3:58         ` Pierre-Louis Bossart
2012-02-15 10:34           ` Jean-Yves Avenard

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=CANpj82J+MmYNGbOqmFMCA587sCiUZfjRqDfesfmOG616478SqQ@mail.gmail.com \
    --to=jyavenard@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=anssi.hannula@iki.fi \
    --cc=swarren@nvidia.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;
as well as URLs for NNTP newsgroup(s).