From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: ioctl32 on ppc64 Date: Tue, 14 Sep 2004 16:30:45 +0200 Sender: alsa-devel-admin@lists.sourceforge.net Message-ID: References: <87fz5notfg.fsf@blackdown.de> Mime-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: multipart/mixed; boundary="Multipart_Tue_Sep_14_16:30: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: Juergen Kreileder Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org --Multipart_Tue_Sep_14_16:30:45_2004-1 Content-Type: text/plain; charset=US-ASCII At Tue, 14 Sep 2004 16:00:43 +0200, I wrote: > > [1 ] > At Tue, 14 Sep 2004 12:39:48 +0200, > I wrote: > > > > > I also can play 48000 Hz wav files with 32-bit aplay now, but playing > > > 41000 Hz stuff only works directly to hw:0,0 (sounds broken). > > > Doing rate conversion with a plugin defined in .asoundrc works for the > > > pure 32-bit and 64-bit cases but not for the mixed 32-bit/64-bit case, > > > it fails with "ALSA lib pcm_hw.c:549:(snd_pcm_hw_start) > > > SNDRV_PCM_IOCTL_START failed: Broken pipe": > > > > This is likely a problem of size incompatibility of mmapped records. > > Sigh, this is a bit touch to fix... > > Could you try the attached patch? > With the patch, mmapping of PCM status/control records is disabled > on 32bit mode. Sorry, it included a typo. The fixed patch is below. Takashi --Multipart_Tue_Sep_14_16:30:45_2004-1 Content-Type: text/plain; charset=US-ASCII Index: alsa-kernel/core/pcm_native.c =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/core/pcm_native.c,v retrieving revision 1.82 diff -u -r1.82 pcm_native.c --- alsa-kernel/core/pcm_native.c 6 Sep 2004 12:55:44 -0000 1.82 +++ alsa-kernel/core/pcm_native.c 14 Sep 2004 13:57:38 -0000 @@ -1973,6 +1973,7 @@ str = substream->pstr; substream->file = pcm_file; + substream->no_mmap_ctrl = 0; pcm_file->substream = substream; @@ -3158,8 +3159,12 @@ offset = area->vm_pgoff << PAGE_SHIFT; switch (offset) { case SNDRV_PCM_MMAP_OFFSET_STATUS: + if (substream->no_mmap_ctrl) + return -ENXIO; return snd_pcm_mmap_status(substream, file, area); case SNDRV_PCM_MMAP_OFFSET_CONTROL: + if (substream->no_mmap_ctrl) + return -ENXIO; return snd_pcm_mmap_control(substream, file, area); default: return snd_pcm_mmap_data(substream, file, area); Index: alsa-kernel/core/ioctl32/ioctl32.c =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/core/ioctl32/ioctl32.c,v retrieving revision 1.25 diff -u -r1.25 ioctl32.c --- alsa-kernel/core/ioctl32/ioctl32.c 3 Aug 2004 15:03:54 -0000 1.25 +++ alsa-kernel/core/ioctl32/ioctl32.c 14 Sep 2004 10:35:40 -0000 @@ -246,7 +246,7 @@ struct sndrv_aes_iec958 iec958; } value; unsigned char reserved[128]; -} __attribute__((packed)); +}; /* hmm, it's so hard to retrieve the value type from the control id.. */ Index: alsa-kernel/core/ioctl32/pcm32.c =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/core/ioctl32/pcm32.c,v retrieving revision 1.22 diff -u -r1.22 pcm32.c --- alsa-kernel/core/ioctl32/pcm32.c 3 Aug 2004 15:03:54 -0000 1.22 +++ alsa-kernel/core/ioctl32/pcm32.c 14 Sep 2004 14:27:51 -0000 @@ -439,6 +439,30 @@ /* + * When PCM is used on 32bit mode, we need to disable + * mmap of PCM status/control records because of the size + * incompatibility. + * + * Since INFO ioctl is always called at first, we mark the + * mmap-disabling in this ioctl wrapper. + */ +static int snd_pcm_info_ioctl32(unsigned int fd, unsigned int cmd, unsigned long arg, struct file *filp) +{ + snd_pcm_file_t *pcm_file; + snd_pcm_substream_t *substream; + if (! filp->f_op || ! filp->f_op->ioctl) + return -ENOTTY; + pcm_file = filp->private_data; + if (! pcm_file) + return -ENOTTY; + substream = pcm_file->substream; + if (! substream) + return -ENOTTY; + substream->no_mmap_ctrl = 1; + return filp->f_op->ioctl(filp->f_dentry->d_inode, filp, cmd, arg); +} + +/* */ #define AP(x) snd_ioctl32_##x @@ -462,7 +486,8 @@ struct ioctl32_mapper pcm_mappers[] = { MAP_COMPAT(SNDRV_PCM_IOCTL_PVERSION), - MAP_COMPAT(SNDRV_PCM_IOCTL_INFO), + /* MAP_COMPAT(SNDRV_PCM_IOCTL_INFO), */ + { SNDRV_PCM_IOCTL_INFO, snd_pcm_info_ioctl32 }, MAP_COMPAT(SNDRV_PCM_IOCTL_TSTAMP), { SNDRV_PCM_IOCTL_HW_REFINE32, AP(pcm_hw_refine) }, { SNDRV_PCM_IOCTL_HW_PARAMS32, AP(pcm_hw_params) }, Index: alsa-kernel/include/pcm.h =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/include/pcm.h,v retrieving revision 1.48 diff -u -r1.48 pcm.h --- alsa-kernel/include/pcm.h 6 Sep 2004 12:55:44 -0000 1.48 +++ alsa-kernel/include/pcm.h 14 Sep 2004 11:12:49 -0000 @@ -405,6 +405,8 @@ snd_info_entry_t *proc_sw_params_entry; snd_info_entry_t *proc_status_entry; snd_info_entry_t *proc_prealloc_entry; + /* misc flags */ + unsigned int no_mmap_ctrl: 1; }; #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) --Multipart_Tue_Sep_14_16:30:45_2004-1-- ------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php