alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Raymond Yau <superquad.vortex2@gmail.com>
To: alsa-devel@alsa-project.org
Subject: Re: hw_ptr_interrupt removal broke interrupt pointer updates
Date: Wed, 27 Jan 2010 11:09:41 +0800	[thread overview]
Message-ID: <4f3252891001261909pd14a997p40e10fe270890772@mail.gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1001261713430.6542@eeebox2.perex-int.cz>

2010/1/27 Jaroslav Kysela <perex@perex.cz>

> On Tue, 26 Jan 2010, Clemens Ladisch wrote:
>
> > Commit "cleanup & merge hw_ptr update functions" says:
> >> The main change is hw_ptr_interrupt variable removal to simplify code
> >> logic. This variable can be computed directly from hw_ptr.
> >
> > The hw_ptr_interrupt variable was needed to differentiate between the
> > position at the last normal pointer update and the position of the last
> > signaled period boundary.
> >
> >       if (in_interrupt) {
> >               /* we know that one period was processed */
> >               /* delta = "expected next hw_ptr" for in_interrupt != 0 */
> >               delta = old_hw_ptr - (old_hw_ptr % runtime->period_size)
> >                       + runtime->period_size;
> >               if (delta > new_hw_ptr) {
> >                       hw_base += runtime->buffer_size;
> >
> > It is possible for the status/delay ioctls to be called when the sound
> > card's pointer register alreay shows a position at the beginning of the
> > new period, but immediately before the interrupt is actually executed.
> > (This happens regularly on a SMP machine with mplayer.)  When that
> > happens, the code thinks that the position must be at least one period
> > ahead of the current position and drops an entire buffer of data.
>
> Clements, thank you for nice explanation how I was wrong. I returned
> hw_ptr_interrupt variable back. I am testing this patch now:
>
>
> http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff;h=04d64a69fcb9fd182d73d6f1a8de55b2f527a1de
>
> A review is always welcome. Thanks.
>
>
>                                                Jaroslav
>
>
do snd_pcm_period_elapsed really handle the case when more than one period
are elasped ?

For au88x0 , each substream have four sets of hardware registers ,  it seem
that the driver can recover lost interrupt with no underrun when using very
small period size


http://www.alsa-project.org/~tiwai/writing-an-alsa-driver/ch05s07.html#pcm-interface-interrupt-handler-boundary

On calling snd_pcm_period_elapsed()

In both cases, even if more than one period are elapsed, you don't have to
call snd_pcm_period_elapsed() many times. Call only once. And the pcm layer
will check the current hardware pointer and update to the latest status.

  reply	other threads:[~2010-01-27  3:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-26 13:39 hw_ptr_interrupt removal broke interrupt pointer updates Clemens Ladisch
2010-01-26 16:16 ` Jaroslav Kysela
2010-01-27  3:09   ` Raymond Yau [this message]
2010-01-27  7:06     ` Jaroslav Kysela
2010-01-27  9:49   ` Clemens Ladisch
2010-01-27 10:11     ` Jaroslav Kysela
2010-01-27 14:12       ` Clemens Ladisch
2010-01-27 17:21         ` Jaroslav Kysela
2010-02-01 15:33           ` Colin Guthrie

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=4f3252891001261909pd14a997p40e10fe270890772@mail.gmail.com \
    --to=superquad.vortex2@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    /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).