All of lore.kernel.org
 help / color / mirror / Atom feed
* multi pcm and mmap problem
@ 2007-11-21  6:58 terminator356
  2007-11-21 11:01 ` Takashi Iwai
  0 siblings, 1 reply; 12+ messages in thread
From: terminator356 @ 2007-11-21  6:58 UTC (permalink / raw)
  To: alsa-devel

After 2 years I've finally traced and fixed a problem
 which was preventing me from using anything after 
 ALSA 1.0.9b !

In ALSA lib 1.0.9b: 
pcm/pcm_generic.c:
int snd_pcm_generic_channel_info()
{
        snd_pcm_generic_t *generic = pcm->private_data;
                return snd_pcm_channel_info(generic->slave, info);
}

But in ALSA lib 1.0.15: 
pcm/pcm_generic.c:
int snd_pcm_generic_channel_info()
{
        snd_pcm_generic_t *generic = pcm->private_data;
        if (pcm->mmap_shadow) {
                /* No own buffer is required - the plugin won't change
                 * the data on the buffer, or do safely on-the-place
                 * conversion
                 */
                return snd_pcm_channel_info(generic->slave, info);
        } else {
               // Tim: TESTED: This is now called instead of the other one!
                /* Allocate own buffer */
                return snd_pcm_channel_info_shm(pcm, info, -1);
        }
}

My multi PCM consists of a plughw:0,2 and a hw:1,0
In ALSA 1.0.9b, all five PCMs ALSA creates for this arrangement
 create their areas with mmap(). And it works.
But in ALSA 1.0.15 my hw:1,0 and its multi PCM areas are
 created with mmap(), and my plughw:0,2 and its PCMs areas 
 are created with malloc(). 
Can't hear/record any sound from the plughw:0,2 part of the multi.

I have verified that ALSA 1.0.15 is copying the plughw:0,2 HW PCM 
 areas to its LINEAR PCM areas, but NOT finally to its multi PCM areas.
It just copies all zeros. 
That's the reason I hear/record no sound from the plughw:0,2 part
 of the multi PCM.
So I reverted the function's code back to 1.0.9b and presto!
It works now, the same as in ALSA 1.0.9b 

So please tell me, am I missing something?
Should I add something more to my .asoundrc ?
I see that besides {type multi ... }, there is a {type share ...} defined. 
*** Does the 'share' have any use here? Can't find any docs on it.

Also:
Yes, I can see now, why you made this code change.
mmap() has limits, so you switched over to malloc().
Those limits force the user to use small buffers
 and/or reduce the number of channels created.
Otherwise aplay, arecord, and jack etc complain mmap() failed.
In ALSA 1.0.9b, and after my change to ALSA 1.0.15,
 I tried ulimit() -l, and editing /etc/security/limits.conf
I quadrupled the available locked memory, but aplay, arecord etc
 still won't let me increase the buffer size beyond what it
 was BEFORE I edited limits.conf
*** What am I doing wrong?

Thanks
Tim.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2007-12-02 13:33 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-21  6:58 multi pcm and mmap problem terminator356
2007-11-21 11:01 ` Takashi Iwai
     [not found]   ` <200711211627.52438.terminator356@users.sourceforge.net>
2007-11-23 13:41     ` Takashi Iwai
2007-11-23 14:35       ` Takashi Iwai
2007-11-24  1:31         ` Tim
2007-11-24 10:16           ` Takashi Iwai
2007-11-25 22:51             ` Tim
2007-11-26 10:38               ` Takashi Iwai
2007-11-26 22:46                 ` Tim
2007-11-27 14:06                   ` Takashi Iwai
2007-12-01 23:33                     ` Tim
2007-12-02 13:40                       ` John Rigg

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.