Date: Mon, 18 Nov 2002 11:30:01 -0800 (PST) From: "Ulrich 'Q' Spoerlein" <q@uni.de> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/41747: quake won't play sound with newpcm driver Message-ID: <200211181930.gAIJU1BS093143@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/41747; it has been noted by GNATS. From: "Ulrich 'Q' Spoerlein" <q@uni.de> To: freebsd-gnats-submit@FreeBSD.org, q@uni.de, Orion Hodson <orion@FreeBSD.org> Cc: Subject: Re: kern/41747: quake won't play sound with newpcm driver Date: Mon, 18 Nov 2002 20:21:26 +0100 So, after several MFCs of the -current pcm-driver, this problem still exists, and is not limited to Quake. Maxim Sobolev posted a thread on -multimedia with a small test program triggering the issue on -STABLE (but not on -CURRENT). It looks like the pcm driver or the mmap() call need/want read-write access to the device (though write-only access should be fine) this code breaks on -STABLE: #include <sys/types.h> #include <sys/mman.h> #include <sys/soundcard.h> #include <err.h> #include <fcntl.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <strings.h> int bytesok = 0; void catch(int signum) { printf("Signal %d catched, only %d bytes cleared\n", signum, bytesok); exit (1); } int main() { int fd; audio_buf_info info; int frags; void *p; fd = open("/dev/dsp", O_WRONLY | O_DIRECT); /* Changing this to read/write access.... fd = open("/dev/dsp", O_RDWR); */ if (fd == -1) err(1, "can't open audio device"); frags = 0x0020000B; /* 64K buffer (32 * 2^11) */ if (ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &frags) == -1) err(1, "can't set fragments"); if (ioctl(fd, SNDCTL_DSP_GETOSPACE, &info) == -1) err(1, "can't get info about i/o space"); p = mmap(NULL, info.fragstotal * info.fragsize, PROT_WRITE, MAP_SHARED, fd, 0); /* ...and this to read/write works p = mmap(NULL, info.fragstotal * info.fragsize, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); */ if (p == MAP_FAILED) err(1, "can't mmap() output buffer"); signal(SIGBUS, catch); for (bytesok = 0; bytesok < info.fragstotal * info.fragsize; bytesok++) *((char *)p + bytesok) = 0; exit (0); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200211181930.gAIJU1BS093143>