From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: ALSA Memory Allocation Bug Date: Thu, 13 May 2004 20:06:45 +0200 Sender: alsa-devel-admin@lists.sourceforge.net Message-ID: References: Mime-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: multipart/mixed; boundary="Multipart_Thu_May_13_20:06:45_2004-1" Return-path: In-Reply-To: Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Loc Ho Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org --Multipart_Thu_May_13_20:06:45_2004-1 Content-Type: text/plain; charset=US-ASCII At Thu, 13 May 2004 10:53:48 -0700, Loc Ho wrote: > > Hi, > > Also, after looking at the snd memory allocation routines, the > unique tag are type, id, and flag. The type is "continous". The id is > formated by the device ID, stream number, and substream number. The > flag is the kernel memory flag. I already discussed the ID in my > previous email (see below). Therefore, it will NOT be unique across > multiple card!!! hmm, you're right. obviously it's a bug of snd-usb-audio. the attached patch should fix the problem. Takashi --Multipart_Thu_May_13_20:06:45_2004-1 Content-Type: text/plain; charset=US-ASCII Index: alsa-kernel/usb/usbaudio.c =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/usb/usbaudio.c,v retrieving revision 1.100 diff -u -r1.100 usbaudio.c --- alsa-kernel/usb/usbaudio.c 7 May 2004 10:08:49 -0000 1.100 +++ alsa-kernel/usb/usbaudio.c 13 May 2004 18:05:45 -0000 @@ -2036,6 +2036,7 @@ static void init_substream(snd_usb_stream_t *as, int stream, struct audioformat *fp) { snd_usb_substream_t *subs = &as->substream[stream]; + snd_pcm_substream_t *pcms; INIT_LIST_HEAD(&subs->fmt_list); spin_lock_init(&subs->lock); @@ -2047,7 +2048,12 @@ subs->ops = audio_urb_ops[stream]; else subs->ops = audio_urb_ops_high_speed[stream]; - snd_pcm_lib_preallocate_pages(as->pcm->streams[stream].substream, + /* set up the unique device id with the card index number */ + pcms = as->pcm->streams[stream].substream; + pcms->dma_device.id = (as->pcm->device << 16) | + (pcms->stream << 8) | (pcms->number + 1) | + (as->chip->card->number + 1) << 24; + snd_pcm_lib_preallocate_pages(pcms, SNDRV_DMA_TYPE_CONTINUOUS, snd_dma_continuous_data(GFP_KERNEL), 64 * 1024, 128 * 1024); --Multipart_Thu_May_13_20:06:45_2004-1-- ------------------------------------------------------- This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for SourceForge Broadband and get the fastest 6.0/768 connection for only $19.95/mo for the first 3 months! http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click