From owner-freebsd-bugs Mon Nov 18 11:30: 6 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2831537B401 for ; Mon, 18 Nov 2002 11:30:03 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 498C243E88 for ; Mon, 18 Nov 2002 11:30:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id gAIJU1x3093144 for ; Mon, 18 Nov 2002 11:30:01 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id gAIJU1BS093143; Mon, 18 Nov 2002 11:30:01 -0800 (PST) Date: Mon, 18 Nov 2002 11:30:01 -0800 (PST) Message-Id: <200211181930.gAIJU1BS093143@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: "Ulrich 'Q' Spoerlein" Subject: Re: kern/41747: quake won't play sound with newpcm driver Reply-To: "Ulrich 'Q' Spoerlein" Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/41747; it has been noted by GNATS. From: "Ulrich 'Q' Spoerlein" To: freebsd-gnats-submit@FreeBSD.org, q@uni.de, Orion Hodson 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 #include #include #include #include #include #include #include #include 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