Alsa and DMA

I see that the ALSA support in SDL doesn’t use DMA, but read/write…

I’m wondering has anyone thought about implementing DMA transfers for
Alsa? or know if it would give much advantage…

Dave.–
David Airlie, Software Engineer
http://www.skynet.ie/~airlied / airlied at skynet.ie
pam_smb / Linux DECstation / Linux VAX / ILUG person

Dave Airlie wrote:

I see that the ALSA support in SDL doesn’t use DMA, but read/write…

I’m wondering has anyone thought about implementing DMA transfers for
Alsa? or know if it would give much advantage…

No idea if it would give a real speed advantage (probably not much). But
I do have plans to fix the alsa backend. I run the alsa kernel modules
at home (with oss emulation), and since the oss backend got broken from
the recent modifications (and alsa never quite worked) I’m stuck now.
Actually, I even think the SDL interface could map quite nicely to the
alsa dma stuff.

How old it the alsa dma api ? We have to keep backwards compatibility
with alsa < 1.0 too…

Stephane

I see that the ALSA support in SDL doesn’t use DMA, but read/write…

I’m wondering has anyone thought about implementing DMA transfers for
Alsa? or know if it would give much advantage…

No idea if it would give a real speed advantage (probably not much). But
I do have plans to fix the alsa backend. I run the alsa kernel modules
at home (with oss emulation), and since the oss backend got broken from
the recent modifications (and alsa never quite worked) I’m stuck now.
Actually, I even think the SDL interface could map quite nicely to the
alsa dma stuff.

What problems are therre with the current alsa backend? I was going to
use it for my embedded app but I’m still waiting on a working
development system with sound… I might get some time to look at this
soon… i.e. any CPU usage saving is a win for my current system (its
getting a bit CPU starved…)

How old it the alsa dma api ? We have to keep backwards compatibility
with alsa < 1.0 too…

I think the dma api has been stable for a while… but I’m not quite sure…

Dave.

Dave Airlie wrote:

I see that the ALSA support in SDL doesn’t use DMA, but read/write…

I’m wondering has anyone thought about implementing DMA transfers for
Alsa? or know if it would give much advantage…

No idea if it would give a real speed advantage (probably not much). But
I do have plans to fix the alsa backend. I run the alsa kernel modules
at home (with oss emulation), and since the oss backend got broken from
the recent modifications (and alsa never quite worked) I’m stuck now.
Actually, I even think the SDL interface could map quite nicely to the
alsa dma stuff.

What problems are therre with the current alsa backend?

The problem seems specific to ac97 cards (I have one, and other ac97
owners reported sound issues too), but I’m not sure.

I was going to
use it for my embedded app but I’m still waiting on a working
development system with sound… I might get some time to look at this
soon… i.e. any CPU usage saving is a win for my current system (its
getting a bit CPU starved…)

I’d say at most 3-4% cpu on a 500Mhz machine. I have not done such
measurements for a long time, however so I can’t say for a more recent cpu.

How old it the alsa dma api ? We have to keep backwards compatibility
with alsa < 1.0 too…

I think the dma api has been stable for a while… but I’m not quite sure…

It’d be interesting to give it a try. I suspect it could fix the ac97
problems as a side effect.

Well, ping me on irc or by mail if you do anything.

Stephane

What problems are therre with the current alsa backend?

The problem seems specific to ac97 cards (I have one, and other ac97
owners reported sound issues too), but I’m not sure.

have you a link to a report or two, I’m seeing the odd wierd thing but
I’ve so far blamed it all on my hardware (the hardware guy can’t prove
it :-), I’ve had an issue with using different channels in SDL_mixer
with my system…

I’d say at most 3-4% cpu on a 500Mhz machine. I have not done such
measurements for a long time, however so I can’t say for a more recent cpu.

it might be worth it, I’ve only got a 500Mhz processor …

Well, ping me on irc or by mail if you do anything.

will do…

Dave.

Dave Airlie wrote:

What problems are therre with the current alsa backend?

The problem seems specific to ac97 cards (I have one, and other ac97
owners reported sound issues too), but I’m not sure.

have you a link to a report or two, I’m seeing the odd wierd thing but
I’ve so far blamed it all on my hardware (the hardware guy can’t prove
it :-), I’ve had an issue with using different channels in SDL_mixer
with my system…

There’s no report of the problem on alsa, since the oss backend has
priority over the alsa one (and alsa provides oss emulation, so it’s
almost always used).
That said, you can google for the infamous “SDL_DSP_NOSELECT” env variable.

If you have an ac97, the only way to get it to work is to use an SDL
that is more that 4 months old (not any recent CVS where this env
variable has disappeared) with the oss backend (the dsp one, not the dma
one) and set the SDL_DSP_NOSELECT variable.

I can’t speak for SDL_mixer since I don’t use/know it.

Stephane

There’s no report of the problem on alsa, since the oss backend has
priority over the alsa one (and alsa provides oss emulation, so it’s
almost always used).
That said, you can google for the infamous “SDL_DSP_NOSELECT” env variable.

If you have an ac97, the only way to get it to work is to use an SDL
that is more that 4 months old (not any recent CVS where this env
variable has disappeared) with the oss backend (the dsp one, not the dma
one) and set the SDL_DSP_NOSELECT variable.

Did you ever hear back from Hannu?

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Sam Lantinga wrote:

There’s no report of the problem on alsa, since the oss backend has
priority over the alsa one (and alsa provides oss emulation, so it’s
almost always used).
That said, you can google for the infamous “SDL_DSP_NOSELECT” env variable.

If you have an ac97, the only way to get it to work is to use an SDL
that is more that 4 months old (not any recent CVS where this env
variable has disappeared) with the oss backend (the dsp one, not the dma
one) and set the SDL_DSP_NOSELECT variable.

Did you ever hear back from Hannu?

No, but I’m not sure what we should do.

The fact that alsa doesn’t work here is already a problem (even alsa
outside of SDL, and my drivers are not outdated, since I use 2.6.10)

What I’d like to have is something that works out of the box for every
card, including ac97 :slight_smile: either by writing code that works everywhere or
by detecting problems and doing a workaround.

Stephane