All of lore.kernel.org
 help / color / mirror / Atom feed
From: terminator356@users.sourceforge.net
To: alsa-devel@alsa-project.org
Subject: multi pcm and mmap problem
Date: Wed, 21 Nov 2007 01:58:41 -0500	[thread overview]
Message-ID: <200711210158.42108.terminator356@users.sourceforge.net> (raw)

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.

             reply	other threads:[~2007-11-21  6:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-21  6:58 terminator356 [this message]
2007-11-21 11:01 ` multi pcm and mmap problem 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200711210158.42108.terminator356@users.sourceforge.net \
    --to=terminator356@users.sourceforge.net \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.