From: Takashi Iwai <tiwai@suse.de>
To: Juergen Kreileder <jk@blackdown.de>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: ioctl32 on ppc64
Date: Tue, 14 Sep 2004 16:30:45 +0200 [thread overview]
Message-ID: <s5hu0u0x6qy.wl@alsa2.suse.de> (raw)
In-Reply-To: <s5hfz5lrlv8.wl@alsa2.suse.de>
[-- Attachment #1: Type: text/plain, Size: 856 bytes --]
At Tue, 14 Sep 2004 16:00:43 +0200,
I wrote:
>
> [1 <text/plain; US-ASCII (7bit)>]
> 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
[-- Attachment #2: Type: text/plain, Size: 3638 bytes --]
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)
next prev parent reply other threads:[~2004-09-14 14:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-13 1:21 ioctl32 on ppc64 Juergen Kreileder
2004-09-13 23:38 ` Juergen Kreileder
2004-09-14 10:39 ` Takashi Iwai
2004-09-14 14:00 ` Takashi Iwai
2004-09-14 14:30 ` Takashi Iwai [this message]
2004-09-14 15:11 ` Juergen Kreileder
2004-09-15 9:31 ` Takashi Iwai
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=s5hu0u0x6qy.wl@alsa2.suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@lists.sourceforge.net \
--cc=jk@blackdown.de \
/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.