Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Manuel Jander <manuel.jander@mat.utfsm.cl>
To: Alsa Devel list <alsa-devel@lists.sourceforge.net>
Subject: Scatter Gather
Date: Fri, 27 Feb 2004 14:17:43 -0400	[thread overview]
Message-ID: <1077905854.6881.28.camel@localhost> (raw)

Hi,

AFAIK, it seems that when using a scatter gather buffer, not every
period is located inside of a page. If for example i use a period size
of 3000 bytes and a Scatter Gather buffer, i would have this:

pages : page0, page1, page2 ...
periods: p0, p1, p2, p3, p4 ...

|...page0...||...page1...||...page3...|
|...p0...||...p1...||...p2...||...p3...|

The problem is that a DMA transfer can not go accross 2 different pages.
On Aureal hardware, even on contiguous buffers this causes all sort of
odd problems. Each DMA chunk must be on the same page.

So i would have to do this:

d0, d1, d2, d3 : DMA chunks programmed in hardware. There are 4 for each
DMA channel.

|...page0...||...page1...||...page3...|
|...p0...||..|.p1...||...p2...||...p3...|
|...d0...||d1||.d2..||d3||.d0.||..d1..|

That means that i would have to split each period that crosses a page
boundary into 2 DMA chunks, with all the complications involved because
of irregular sizes, offsets... ARghhh!

I could just leave the period size as a power of 2, on that way, a
period would never cross any page boundary, but most ALSA programs are
too picky to accept that kind of restrictions in most cases.


----------------------------------------------
Regarding the "Writing a ALSA driver" Docbook:

Regarding the Non contiguous buffers, that the sgbuf struct can be
derived as:

snd_pcm_sgbuf_t *sgbuf = (snd_pcm_sgbuf_t*)substream->dma_private;

But there is a problem: The substream->dma_private is only valid after 
snd_pcm_lib_malloc_pages() has been called. Maybe it would be nice to
hint about this small detail in the document.


Best Regards

Manuel




-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click

             reply	other threads:[~2004-02-27 18:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-27 18:17 Manuel Jander [this message]
2004-03-01 12:52 ` Scatter Gather Clemens Ladisch
2004-03-02  4:09   ` Manuel Jander
2004-03-02  8:00     ` Jaroslav Kysela
2004-03-02 10:16     ` Giuliano Pochini
2004-03-02 10:23       ` 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=1077905854.6881.28.camel@localhost \
    --to=manuel.jander@mat.utfsm.cl \
    --cc=alsa-devel@lists.sourceforge.net \
    /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