From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Jacinto Alvarez <fidorul@gmail.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: TWL4030 low-latency
Date: Mon, 09 Jan 2012 14:32:28 +0200 [thread overview]
Message-ID: <4F0ADE5C.5040807@ti.com> (raw)
In-Reply-To: <loom.20120104T191613-550@post.gmane.org>
Hi Jacinto,
On 01/04/2012 08:35 PM, Jacinto Alvarez wrote:
> Hi Peter, is there like a set of steps/hints/source that you could share for
> developers to experiment around these 'hacks' to the McBSP/sDMA? Is it a matter
> of recompiling a particular kernel module or lib?.
Unfortunately I was not able to spend time on this :(
> I have verified Edgar's statements; I am not using Jack, just straight ALSA pcm
> commands and I cannot get the stream to run at anything less than a 23 ms: 128
> frames x 8 periods. I can use longer size w/less periods but ALSA will always
> throw an error if I try a combined lower latency.
Not sure what you mean under latency. For me the latency is the time
needed to play out the sample at the DMA pointer in main memory.
In case of McBSP2 (which has 1280 word long buffer) it is maximum of:
(1280/<number of channels>)/sampling frequency
In case of stereo sample it is 14.51ms with 44.1KHz, and 13.3ms with 48KHz.
There's not that much we can do to reduce this.
The alsa buffer size need to be at least 1280/<number of channels> to
avoid error at stream start.
In McBSP element mode the McBSP FIFO will be kept full all the time
(threshold is 0). This means that the McBSP will request one word from
the DMA if there's a single free slot in the FIFO.
If you switch to threshold mode things will be different under the hood
(providing better power saving):
the McBSP threshold value will be calculated according to the period
size. In this mode the DMA will request for a chunk of data based on the
threshold value, so the FIFO will be filled with DMA bursts. You still
have the FIFO caused latency, but the system can rest between bursts.
I think if you use McBSP threshold mode with 3x 5ms periods you should
be fine (the ALSA buffer is going to be 15ms).
The only thing you need to make sure is that before you start the
playback you need to fill up the 15ms ALSA buffer. At the start of the
playback you most likely see that 2 period will elapse, and pretty soon
the third will also. From this point the time between periods will
settle, and will keep the 5ms distance.
I hope this helps.
--
Péter
next prev parent reply other threads:[~2012-01-09 12:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-14 18:24 TWL4030 low-latency Edgar Berdahl
2011-10-14 19:45 ` Ujfalusi, Peter
2011-10-15 20:28 ` Gabriel M. Beddingfield
2011-10-17 1:39 ` Edgar Berdahl
2011-10-17 5:12 ` Ujfalusi, Peter
2011-10-17 11:23 ` Clemens Ladisch
2012-01-04 18:35 ` Jacinto Alvarez
2012-01-09 12:32 ` Peter Ujfalusi [this message]
[not found] ` <CA+fpFZ9-QQ=5uihMfjCQaJBMYeq3QBHMgmYAW3DBQHQTAwK1gw@mail.gmail.com>
2012-02-14 7:46 ` Peter Ujfalusi
2011-10-25 0:21 ` Edgar Berdahl
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=4F0ADE5C.5040807@ti.com \
--to=peter.ujfalusi@ti.com \
--cc=alsa-devel@alsa-project.org \
--cc=fidorul@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 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).