Skip to contentSkip to conversation

dmix plugin

DISCUSSION Jaroslaw Sobierski 4 participants 5 messages Feb 17, 2003 – Feb 18, 2003

lore
Share & tools
lore
#0 lore raw
Quoted 18 lines · Abramo Bagnara

If we'd need to use an intermediate buffer and a mixing thread, the dmix approach lose our interest.

A solution might be to have a shared parallel sw ring buffer where to store the exact value:

       xadd(sw, *src);
	do {
		v = *sw;
		if (v > 0x7fff)
			s = 0x7fff;
		else if (v < -0x8000)
			s = -0x8000;
		else
	     		s = v;
		*hw = v;
	} while (unlikely(v != *sw));
Quoted 1 line

This should solve also the atomicity update.

Very true, and it is consistent with what

Quoted 6 lines · Jaroslav Kysela

My point was that all processes operates simultaneously and independently. So if one process updates area in the "sum" ring buffer, then it MUST transfer changed area (with saturation) to the DMA buffer. So there is no "once saturation" as you think. Anyway, the current implementation uses also saturation for all clients (processes) so the only drawback is the additional access to the "sum" ring buffer memory area.

So it seems like a good compromise to solve all our problems :-).

Still, don't we already *have* a feeding thread for the sound card? I mean it doesn't just grab the memory buffer all by itself whenever it wants? Excuse my ignorance on this topic I'm only just starting with ALSA, and I did not have the time yet to go through the entire source code ;-). I remember when I was writing a driver for an mpeg2 decoder card that I had to create 2 threads, one for feeding video and one for audio. The FIFO level was checked either by polling or via interrupt handlers but I still had control over what and when is transferred. I could let the card pull the data via DMA using bus mastering but I still new what and from where will be sent...
Does the problem lie in the fact that it is actually a plugin and has no control of the transfer? Maybe it would be worth considering a callback for the plugin from the main alsa module to infrom it that a new piece of the DMA buffer must be "prepared" whatever that could mean for a particular plugin. Anyway, just a thought.

--------------
Fycio (J.Sobierski)
[email protected]

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#1 lore raw
Quoted 2 lines · Jaroslaw Sobierski

Still, don't we already *have* a feeding thread for the sound card? I mean it doesn't just grab the memory buffer all by itself whenever it wants?

Nope. The idea for the dmix plugin is that we share the DMA ring buffer with more threads (processes). There is no "master" thread which operates exclusively with the DMA buffer.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#2 lore raw
Quoted 6 lines
Quoted 2 lines

Still, don't we already *have* a feeding thread for the sound card? I mean it doesn't just grab the memory buffer all by itself whenever it wants?

Nope. The idea for the dmix plugin is that we share the DMA ring buffer with more threads (processes). There is no "master" thread which operates exclusively with the DMA buffer.

that would be called "JACK", right ?

--p

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#3 lore raw
Quoted 9 lines · Paul Davis
Quoted 7 lines
Quoted 3 lines

Still, don't we already *have* a feeding thread for the sound card? I mean it doesn't just grab the memory buffer all by itself whenever it wants?

Nope. The idea for the dmix plugin is that we share the DMA ring buffer with more threads (processes). There is no "master" thread which operates exclusively with the DMA buffer.

that would be called "JACK", right ?

Not necessarily, sorry.

I've just explained in many ways that IMO the callback-only model choice will doom Jack to remain in a niche.

And I say this with grief: Jack is the nicest acronym I've ever heard ;-)

Signature · 11 lines
Abramo Bagnara                       mailto:[email protected]

Opera Unica                          Phone: +39.546.656023
Via Emilia Interna, 140
48014 Castel Bolognese (RA) - Italy


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
#4 lore raw
In reply to Jaroslaw Sobierski
Quoted 5 lines · Jaroslaw Sobierski

Does the problem lie in the fact that it is actually a plugin and has no control of the transfer? Maybe it would be worth considering a callback for the plugin from the main alsa module to infrom it that a new piece of the DMA buffer must be "prepared" whatever that could mean for a particular plugin. Anyway, just a thought.

We use the poll and slave timer source which generates ticks when an interrupt from the PCM hardware arrives. It's sufficient for our purpose.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf