From: Edouard Gomez <ed.gomez@free.fr>
To: alsa-devel@lists.sourceforge.net
Subject: Cannot mmap /dev/dsp error in alsa 0.9.7 and 0.9.8
Date: Sat, 15 Nov 2003 02:31:37 +0100 [thread overview]
Message-ID: <20031115013137.GF832@leeloo> (raw)
[-- Attachment #1: Type: text/plain, Size: 1654 bytes --]
Hello,
I'm having troubles with recent alsa releases (newer than 0.9.6). I
first suffered the bugs explained later on 2.6 test kernels, so i
thought it was smply a 2.6 bug. Tonight the 0.9.8 alsa packages made
their paths into debian SID so i compiled the kernel part for my usual
2.4.22 kernel and i experience the same problems.
Symptoms:
- OSS device mapping fails with a EACCES errno. See attachment for
triggering the bug.
- mplayer AV sync is too fast by ~20% (men sound like ladies ;-) when
using the alsa9 output, but syncs well when using the compat oss layer
Configuration:
- 2.4.22-ck2 or 2.4.22 or 2.6.0-test8 or 2.6.0-test9 or
2.6.0-test9+latest alsa cvs
- alsa 0.9.7 or 0.9.8 or current CVS for the kernel modules and 0.9.8
for all client shared libs (but shared libs aren't a problem as the
OSS bug is only related to the module part)
- VIA 8235 (module snd-via82xx)
Known working combinations:
- 2.4.22 + alsa 0.9.6 kmodules + 0.9.8 libs
- 2.4.22-ck2 + alsa 0.9.6 kmodules + 0.9.8 libs
Changing the modules to a 0.9.8 makes the bug appearing.
When playing with 2.6, i tried 0.9.7 and 0.9.8 on top of the test9
version, all show the bug, sorry, i forgot trying 0.9.6 and i erased
the 2.6 tree.
Hope this bug report is enough. See attachment for the OSS bug. The
mmap function call will always return -1 with 0.9.7 or 0.9.8.
PS: the code in the attached file is exactly the same as found in all
quake engines. That's an Id game (quake3) that triggered the bug first so
i've copied the quake1 sound init sequence in order to approximate
the quake3 engine sound initialization... this worked.
--
Edouard Gomez
[-- Attachment #2: mmap-bug-oss.c --]
[-- Type: text/x-csrc, Size: 1320 bytes --]
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/shm.h>
#include <sys/wait.h>
#include <linux/soundcard.h>
#include <stdio.h>
int main()
{
int dsp;
char *dma_buffer;
struct audio_buf_info info;
int caps;
/* Open the dsp device */
if ((dsp = open("/dev/dsp", O_RDWR)) == -1) {
perror("error opening /dev/dsp");
return(-1);
}
/* Reset the dsp */
if (ioctl(dsp, SNDCTL_DSP_RESET, 0) == -1) {
perror("Could not reset DSP");
close(dsp);
return(-2);
}
if (ioctl(dsp, SNDCTL_DSP_GETCAPS, &caps) == -1) {
perror("error getting DSP capabilities");
close(dsp);
return(-3);
}
if (!(caps & DSP_CAP_TRIGGER) || !(caps & DSP_CAP_MMAP)) {
fprintf(stderr, "error mmap capability unavailable\n");
close(dsp);
return(-4);
}
if (ioctl(dsp, SNDCTL_DSP_GETOSPACE, &info) == -1) {
perror("error GETOSPACE unavailable");
close(dsp);
return(-5);
}
/* memory map the dma buffer */
dma_buffer = mmap(NULL, info.fragstotal*info.fragsize, PROT_WRITE, MAP_FILE|MAP_SHARED, dsp, 0);
if (!dma_buffer || dma_buffer == (char *)-1) {
perror("Could not mmap /dev/dsp");
close(dsp);
return(-6);
}
/* never reached */
munmap(dma_buffer, info.fragstotal*info.fragsize);
close(dsp);
return(0);
}
next reply other threads:[~2003-11-15 1:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-15 1:31 Edouard Gomez [this message]
2003-11-16 11:39 ` Cannot mmap /dev/dsp error in alsa 0.9.7 and 0.9.8 Edouard Gomez
2003-11-18 10:45 ` 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=20031115013137.GF832@leeloo \
--to=ed.gomez@free.fr \
--cc=alsa-devel@lists.sourceforge.net \
/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.