All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Raymond Yau <superquad.vortex2@gmail.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: Problems with safe API and snd-cs46xx
Date: Mon, 07 Sep 2009 17:15:35 +0200	[thread overview]
Message-ID: <s5h8wgqss4o.wl%tiwai@suse.de> (raw)
In-Reply-To: <4f3252890909070807r5aaca0f6vf2f1b0f0a88a8e5e@mail.gmail.com>

At Mon, 7 Sep 2009 23:07:14 +0800,
Raymond Yau wrote:
> 
> do you  mean that the function cannot update the min and max value ?
> 
>     snd_pcm_hw_constraint_list(runtime, 0,
>                    SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
>                    &hw_constraints_period_sizes);

This of course influences on the buffer min/max sizes.  But, this has
nothing to do with the order of parameter determination at
snd_pcm_hw_params() call.

The PCM core determines the parameters in the order of period size,
then the buffer size.  That is, first choose the period size to the
minimum unless explicitly set, then choose the buffer size to the max
unless explicitly set.  Since the max number of periods is 1024 for
cs46xx, it'd choose period_size = 1, then buffer_size = 1024.

So, the question is what the app expects.  If the app requires the
smaller period size, then this set up is OK (of course, it'd be better
to check the min period and fix it somehow).  OTOH, if the app prefers
larger buffer sizes, then it'd be better to set the buffer size as the
max first before calling snd_pcm_hw_params().


Takashi

> 
> 
> 2009/9/7 Takashi Iwai <tiwai@suse.de>
> 
> > At Mon, 07 Sep 2009 14:29:15 +0100,
> > Tony Vroon wrote:
> > >
> > > [1  <text/plain (quoted-printable)>]
> > > On Mon, 2009-09-07 at 14:32 +0200, Takashi Iwai wrote:
> > > > Hm, I don't know of "safe API"...
> > >
> > > It is described here:
> > > http://0pointer.de/blog/projects/guide-to-sound-apis.html
> > >
> > > Should this be incomplete or otherwise incorrect it would be useful to
> > > have a rebuttal.
> >
> > Thanks for the pointer.
> >
> > > > A small test case, preferably a short C program just to reproduce
> > > > the problem would be really needed in such a case.  It's very hard to
> > > > guess what's going on and what is actually wrong in the driver only
> > > > from your problem description, because of no obvious debug logs.
> > >
> > > If it is anything like the Aureal Vortex bug, the minimum period size
> > > doesn't make sense.
> >
> > Yes, cs46xx also sets the minimum bytes 1, and this can be the
> > same problem as aureal driver.
> >
> > (BTW, this isn't exactly a driver "bug" -- if this word is meaning a
> >  programming error.  periods_size = 1 is no invalid setup in theory.
> >  But, it's rarely a sane setup in reality, so it should be fixed
> >  to match with the real machines indeed.)
> >
> > > Unlike the older the ALSA plugin, the new ALSA-NG
> > > plugin in Audacious opens the audio device with defaults and does not
> > > attempt to set period sizes.
> >
> > Maybe a bit "safer" option would be to check the period min size and
> > raise to a sane value as a workaround.
> >
> > Or, if the period size doesn't matter much but rather the buffer size
> > is more important, you can first limit the buffer size as max.  Then
> > call snd_pcm_hw_params().  Without this, the PCM core determines the
> > period size first, then the buffer size.
> >
> >
> > Takashi
> > _______________________________________________
> > Alsa-devel mailing list
> > Alsa-devel@alsa-project.org
> > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> >
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 

  reply	other threads:[~2009-09-07 15:15 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-05 12:24 Problems with safe API and snd-cs46xx Sophie Hamilton
2009-09-07 12:32 ` Takashi Iwai
2009-09-07 13:29   ` Tony Vroon
2009-09-07 14:18     ` Raymond Yau
2009-09-07 14:25     ` Error with custom driver: playback drain error (DMA or IRQ trouble?) Stefan Schoenleitner
2009-09-07 15:01     ` Problems with safe API and snd-cs46xx Takashi Iwai
2009-09-07 15:07       ` Raymond Yau
2009-09-07 15:15         ` Takashi Iwai [this message]
2009-09-07 22:47       ` Lennart Poettering
2009-09-07 23:10         ` Sophie Hamilton
2009-09-08  6:29         ` Takashi Iwai
2009-09-08  7:46           ` Sophie Hamilton
2009-09-08  8:53             ` Takashi Iwai
2009-09-09 11:04               ` Takashi Iwai
2009-09-09 12:29                 ` Sophie Hamilton
2009-09-09 12:35                   ` Takashi Iwai
2009-09-09 14:07                     ` Lennart Poettering
2009-09-09 14:14                       ` Takashi Iwai
2009-09-09 14:27                         ` Lennart Poettering
2009-09-09 14:37                           ` Takashi Iwai
2009-09-10  8:47                             ` Raymond Yau
2009-09-08 13:38           ` Lennart Poettering
2009-09-08 14:42             ` Takashi Iwai
2009-09-09  2:18               ` Raymond Yau
2009-09-07 15:02   ` Sophie Hamilton
2009-09-07 17:04     ` Sophie Hamilton
2009-09-07 17:27       ` Takashi Iwai
2009-09-07 19:06         ` Sophie Hamilton
2009-09-08  6:38           ` Takashi Iwai
2009-09-08  8:19             ` Sophie Hamilton
2009-09-08  9:03               ` Takashi Iwai
2009-09-08 13:18               ` Raymond Yau
2009-09-08 13:21                 ` Takashi Iwai

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=s5h8wgqss4o.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=superquad.vortex2@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.