[alsa-devel] safe support for rewind in ALSA

Raymond Yau superquad.vortex2 at gmail.com
Tue May 4 04:31:58 CEST 2010


2010/2/22 Lennart Poettering <mznyfn at 0pointer.de>

> On Sun, 21.02.10 12:06, Kai Vehmanen (kvehmanen at eca.cx) wrote:
>
> >
> > Hi,
> >
> > On Thu, 11 Feb 2010, Jaroslav Kysela wrote:
> >
> > >> However, PA ignores the sound card's interrupts and is woken up by its
> > >> own timer.
> > >
> > > PA can drive the wake-ups using avail_min sw parameter. If this value
> is
> > > high enough, no userspace wake up is called, only interrupt is
> processed
> > > and internal ring buffer pointers in the driver are updated.
> >
> > but that's unfortunately not enough. AFAIK glitch-free aims, among other
> > things, to minimize power usage for battery powered devices, and to do
> > that, you need to minimize hardware interrupts [1]. And for that,
> > avail_min won't help.
> >
> > [1] this is exactly the same thing that is driving Linux tickless
> >      development:
> >      http://www.lesswatts.org/projects/tickless/
> >
> > PS I do agree that avail_min is a very useful, and often overlooked
> >     feature, of ALSA. But in this specific case it won't help...
>
> We try our best to minimize wakeups by setting the minimal number of
> periods in PA. Unfortunately that still means one gets 2 or 1 irqs per
> buffer iteration.
>
> However even if we get those two wakeups, using avail_min allows us to
> minimize the number of processes that are woken up on that
> IRQ. i.e. if the CPU is woken up, it is still better when this only
> means some IRQ in the kernel is processed, then passing it into
> userspace.
>
> Lennart
>
>
Has any one try the patch posted in
http://thread.gmane.org/gmane.comp.audio.pulseaudio.general/6671

>> Rewinding the ring buffer completely causes audible issues with DMAs.
Previous solution didn't work with tsched=0, and used tsched_watermark
for guardband, which isn't linked to hardware and could become really high
if underflows occurred.

Why PA alway rewind the buffer when the stream connects ?

When you rewind the application pointer to hardware pointer  ?


More information about the Alsa-devel mailing list