Sergei Steshenko wrote:
> Tomas Carnecky <[EMAIL PROTECTED]> wrote:
> > Clemens Ladisch wrote:
> > > Your application must be able to handle any period size.
> > > 
> > > Why does the period size matter at all?
> > 
> > My app can handle that now, but the way how I had to do it defeats the 
> > 'zero-copy' paradigm.
> > 
> > The situation is this: the application requests a 16kb buffer, at 2 
> > channels / U16LE this makes a 4096 frames. It's a streaming buffer and 
> > the app writes in the data in chunks of 4096 bytes. I can't map the alsa 
> > mmap'ed buffer to the application (because of the different size) so I 
> > have to create my own temporary buffer and then copy the data to the 
> > mmap'ed buffer.
> 
> I might be wrong, but it seems that 4096 bytes limit comes from these
> facts:
> 
> 1) on Linux page size is 4096 bytes;

(depends on the architecture)

> 2) if one allocate more than 4096 bytes, the system cannot guarantee the
> pages are contiguous;

One can try, but the system doesn't guarantee that it succeeds.

> 3) ALSA uses DMA whenever the card supports it;

Almost all cards actually _require_ DMA.

> 4) DMA needs contiguous buffer, so we are back to one page 4096 bytes
> buffer.

ALSA's buffer is continuous (when needed).  If ALSA isn't able to
allocate it, setting the hardware parameters fails.


HTH
Clemens

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alsa-user mailing list
Alsa-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user

Reply via email to