* Scatter Gather
@ 2004-02-27 18:17 Manuel Jander
2004-03-01 12:52 ` Clemens Ladisch
0 siblings, 1 reply; 8+ messages in thread
From: Manuel Jander @ 2004-02-27 18:17 UTC (permalink / raw)
To: Alsa Devel list
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Scatter Gather
2004-02-27 18:17 Scatter Gather Manuel Jander
@ 2004-03-01 12:52 ` Clemens Ladisch
2004-03-02 4:09 ` Manuel Jander
0 siblings, 1 reply; 8+ messages in thread
From: Clemens Ladisch @ 2004-03-01 12:52 UTC (permalink / raw)
To: Manuel Jander; +Cc: Alsa Devel list
Manuel Jander wrote:
> AFAIK, it seems that when using a scatter gather buffer, not every
> period is located inside of a page. ...
> 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.
> ...
> 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!
Yes. Every driver using SG must do this. Look into bt87x.c or
via82xx.c for examples.
> 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.
Devices like usb and ymfpci have a fixed period size, but their
drivers emulate arbitrary period sizes.
Regards,
Clemens
-------------------------------------------------------
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Scatter Gather
2004-03-01 12:52 ` Clemens Ladisch
@ 2004-03-02 4:09 ` Manuel Jander
2004-03-02 8:00 ` Jaroslav Kysela
2004-03-02 10:16 ` Giuliano Pochini
0 siblings, 2 replies; 8+ messages in thread
From: Manuel Jander @ 2004-03-02 4:09 UTC (permalink / raw)
To: Alsa Devel list
Hi,
On Mon, 2004-03-01 at 08:52, Clemens Ladisch wrote:
> Manuel Jander wrote:
> > AFAIK, it seems that when using a scatter gather buffer, not every
> > period is located inside of a page. ...
> > 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.
> > ...
> > 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!
>
> Yes. Every driver using SG must do this. Look into bt87x.c or
> via82xx.c for examples.
Well, i guess in that case the period size loses any relevance in terms
of efficiency. Is there any gain if DMA chunks and period sizes are
related in any way ?
> > 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.
>
> Devices like usb and ymfpci have a fixed period size, but their
> drivers emulate arbitrary period sizes.
That means that those hwparam restrictions "should not be used" ?? After
realizing that 99% of ALSA apps don't work when using them, renders them
quiet useless.
By the way, is it really really necesary that "snd_pcm_period_elapsed()"
is called exactly when one period has been playback ? Must that callback
be called for every period ?
After looking at the bt87x driver it seems that it doesn't matter after
all (is that right ?). I was thinking in calling
snd_pcm_period_elapsed() just after each page crossing, instead of
period crossing, for simplicity.
Any comments ?
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Scatter Gather
2004-03-02 4:09 ` Manuel Jander
@ 2004-03-02 8:00 ` Jaroslav Kysela
2004-03-02 10:16 ` Giuliano Pochini
1 sibling, 0 replies; 8+ messages in thread
From: Jaroslav Kysela @ 2004-03-02 8:00 UTC (permalink / raw)
To: Manuel Jander; +Cc: Alsa Devel list
On Tue, 2 Mar 2004, Manuel Jander wrote:
> By the way, is it really really necesary that "snd_pcm_period_elapsed()"
> is called exactly when one period has been playback ? Must that callback
> be called for every period ?
> After looking at the bt87x driver it seems that it doesn't matter after
> all (is that right ?). I was thinking in calling
> snd_pcm_period_elapsed() just after each page crossing, instead of
> period crossing, for simplicity.
It will create extra latency, because application will be woken up later
than expected. The driver should try to call this ack immediately when the
period transfer is finished.
Jaroslav
-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs
-------------------------------------------------------
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Scatter Gather
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
1 sibling, 1 reply; 8+ messages in thread
From: Giuliano Pochini @ 2004-03-02 10:16 UTC (permalink / raw)
To: Manuel Jander; +Cc: Alsa Devel list
On 02-Mar-2004 Manuel Jander wrote:
>> Yes. Every driver using SG must do this. Look into bt87x.c or
>> via82xx.c for examples.
>
> Well, i guess in that case the period size loses any relevance in
> terms of efficiency.
Efficiency about what ? If the hardware can be programmed to use
any period size, then the application is free to choose the size
it prefers. It's not a bad thing. NB: the interrupt should be
generated at the end of the period, not at the end of each block,
eg. when it crosses the page boundary.
> Is there any gain if DMA chunks and period sizes are
> related in any way ?
No, unless the hardware benefits from it.
--
Giuliano.
-------------------------------------------------------
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Scatter Gather
2004-03-02 10:16 ` Giuliano Pochini
@ 2004-03-02 10:23 ` Takashi Iwai
0 siblings, 0 replies; 8+ messages in thread
From: Takashi Iwai @ 2004-03-02 10:23 UTC (permalink / raw)
To: Giuliano Pochini; +Cc: Manuel Jander, Alsa Devel list
At Tue, 02 Mar 2004 11:16:33 +0100 (CET),
Giuliano Pochini wrote:
>
>
> On 02-Mar-2004 Manuel Jander wrote:
>
> >> Yes. Every driver using SG must do this. Look into bt87x.c or
> >> via82xx.c for examples.
> >
> > Well, i guess in that case the period size loses any relevance in
> > terms of efficiency.
>
> Efficiency about what ? If the hardware can be programmed to use
> any period size, then the application is free to choose the size
> it prefers. It's not a bad thing. NB: the interrupt should be
> generated at the end of the period, not at the end of each block,
> eg. when it crosses the page boundary.
well, it's ok to generate irqs at each page boundary, too, as long as
the driver processes it properly, i.e. calling
snd_pcm_period_elapsed() only at the irq of the end of period.
of course, less irqs are better from the performance viewpoint.
Takashi
-------------------------------------------------------
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* scatter gather
@ 2010-08-18 12:21 Round Robinjp
2010-08-18 19:24 ` Linus Walleij
0 siblings, 1 reply; 8+ messages in thread
From: Round Robinjp @ 2010-08-18 12:21 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
Is scatter gather supported on ARM linux?
I am trying to find out how to use it, but can find
only old info. Can I find uptodate info anywhere
which can be used with newer kernels?
Thanks
RR
--------------------------------------
GyaO! - Anime, Dramas, Movies, and Music videos [FREE]
http://pr.mail.yahoo.co.jp/gyao/
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-08-18 19:24 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-27 18:17 Scatter Gather Manuel Jander
2004-03-01 12:52 ` 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
-- strict thread matches above, loose matches on Subject: below --
2010-08-18 12:21 scatter gather Round Robinjp
2010-08-18 19:24 ` Linus Walleij
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.