From: Takashi Iwai <tiwai@suse.de>
To: Vinod Koul <vinod.koul@linux.intel.com>
Cc: vkoul@infradead.org, alsa-devel@alsa-project.org,
broonie@opensource.wolfsonmicro.com, lrg@ti.com
Subject: Re: [PATCH v3 0/3] introduce device_buffer
Date: Tue, 04 Sep 2012 16:24:05 +0200 [thread overview]
Message-ID: <s5htxvd27ei.wl%tiwai@suse.de> (raw)
In-Reply-To: <1346424798.1895.92.camel@vkoul-udesk3>
At Fri, 31 Aug 2012 20:23:18 +0530,
Vinod Koul wrote:
>
> On Fri, 2012-08-31 at 12:41 +0200, Jaroslav Kysela wrote:
> > Date 31.8.2012 03:14, Vinod Koul wrote:
> > > Old wine in a new bottle with added flavour now.
> > > Based on our discussions in LPC, now we will report the combined delay value as
> > > sum of the buffering done in driver and hardware. This is used to report delay
> >
> >
> > > Additionally we tell pcm what is buffer in device/driver, this is used to check
> > > for error calulcations
> >
> > I'm afraid, but this won't work for the mmaped appl_ptr / hw_ptr,
> > because the checks are done outside the kernel - in alsa-lib. I believe
> > that this API should be enhanced, too. But the question is, how to pass
> > two values (hwptr, device_buffer) atomically to the user space without
> > locks for x86.
> Yes for mmap case, tis needs to be done in lib and that can't be done
> without ABI/API changes??
> Is there a reserved field we can perhaps use for this
We've discussed about this issue at Plumbers in the last week, and
found out that yet different solutions would be needed:
- The problem is found in two places, the XRUN check and the DRAINING
check. We need to handle both cases.
- In XRUN check, when hw_ptr == appl_ptr, it's really an XRUN _unless_
the PCM state is DRAINING. This is no matter whether the device has
a device DMA buffer. The reason is that the hardware is supposed to
fetch the new data at this point. Thus, it would fetch the wrong
data if we check hw_ptr + device_buffer as proposed.
- If it's in DRAINING state, the trigger STOP should be issued not at
the point hw_ptr == appl_ptr but at the adjusted position like this
proposal.
Then yet another question came up: what is the exact definition of
runtime->delay. If this is supposed to be the time of the on-flight
samples in the hardware device buffer (but not FIFO that can't be
controlled by trigger on/off), we'd just need to apply runtime->delay
for DRAINING position check. No need for the new additional field.
OTOH, if runtime->delay is the total delay including the hardware
device buffer _and_ the hardware FIFO, a new field would be needed for
the check above. Note that FIFO in this context is a kind of FIFO
things that can't be stopped by the DMA controller. This is supposed
to be small in usual cases, but not guaranteed to be so. For example,
in ASoC abstraction, FIFO can be meant to be the delay in the codec
side. This might be miliseconds long.
Takashi
prev parent reply other threads:[~2012-09-04 14:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-31 1:14 [PATCH v3 0/3] introduce device_buffer Vinod Koul
2012-08-31 1:14 ` [PATCH 1/3] ALSA: pcm - " Vinod Koul
2012-08-31 2:06 ` Raymond Yau
2012-08-31 15:05 ` Vinod Koul
2012-08-31 10:48 ` Jaroslav Kysela
2012-08-31 15:02 ` Vinod Koul
2012-08-31 1:14 ` [PATCH 2/3] ASoC: add device_buffer in asoc Vinod Koul
2012-08-31 1:14 ` [PATCH 3/3] ASoC: mid-x86 - implement buffer query in sst_platform driver Vinod Koul
2012-08-31 10:41 ` [PATCH v3 0/3] introduce device_buffer Jaroslav Kysela
2012-08-31 14:53 ` Vinod Koul
2012-09-04 14:24 ` Takashi Iwai [this message]
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=s5htxvd27ei.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=lrg@ti.com \
--cc=vinod.koul@linux.intel.com \
--cc=vkoul@infradead.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).