From owner-freebsd-current@FreeBSD.ORG Tue Feb 17 09:14:58 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A308916A4CE for ; Tue, 17 Feb 2004 09:14:58 -0800 (PST) Received: from gw.catspoiler.org (217-ip-163.nccn.net [209.79.217.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4812643D1F for ; Tue, 17 Feb 2004 09:14:58 -0800 (PST) (envelope-from truckman@FreeBSD.org) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.12.9p2/8.12.9) with ESMTP id i1HHEO7E050341; Tue, 17 Feb 2004 09:14:28 -0800 (PST) (envelope-from truckman@FreeBSD.org) Message-Id: <200402171714.i1HHEO7E050341@gw.catspoiler.org> Date: Tue, 17 Feb 2004 09:14:23 -0800 (PST) From: Don Lewis To: haro@h4.dion.ne.jp In-Reply-To: <20040218.021017.74756279.haro@h4.dion.ne.jp> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii cc: freebsd-current@FreeBSD.org cc: haro@kgt.co.jp cc: mat@cnd.mcgill.ca Subject: Re: LOR with sound X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Feb 2004 17:14:58 -0000 On 18 Feb, Munehiro Matsuda wrote: > Hello Don Lewis, > > Thank you for looking into the problem, but.... > > ::Can you try the patch below? Be warned that I don't have the > ::appropriate combination of hardware and software to really exercise it. > ::I know that it won't fix the problem of > > I cannot seem to find the patch. ;-) I forgot to attach it. Maybe I'll remember this time ... Index: sys/dev/sound/pcm/dsp.c =================================================================== RCS file: /home/ncvs/src/sys/dev/sound/pcm/dsp.c,v retrieving revision 1.72 diff -u -r1.72 dsp.c --- sys/dev/sound/pcm/dsp.c 28 Jan 2004 08:02:15 -0000 1.72 +++ sys/dev/sound/pcm/dsp.c 17 Feb 2004 16:30:03 -0000 @@ -500,8 +500,14 @@ p->play_size = 0; p->rec_size = 0; if (wrch) { + if (rdch) + CHN_UNLOCK(rdch); chn_setblocksize(wrch, 2, p->play_size); p->play_size = sndbuf_getblksz(wrch->bufsoft); + CHN_UNLOCK(wrch); + wrch = NULL; + if (rdch) + CHN_LOCK(rdch); } if (rdch) { chn_setblocksize(rdch, 2, p->rec_size); @@ -525,8 +531,14 @@ snd_chan_param *p = (snd_chan_param *)arg; if (wrch) { + if (rdch) + CHN_UNLOCK(rdch); chn_setformat(wrch, p->play_format); chn_setspeed(wrch, p->play_rate); + CHN_UNLOCK(wrch); + wrch = NULL; + if (rdch) + CHN_LOCK(rdch); } if (rdch) { chn_setformat(rdch, p->rec_format); @@ -633,8 +645,15 @@ case SNDCTL_DSP_SETBLKSIZE: RANGE(*arg_i, 16, 65536); - if (wrch) + if (wrch) { + if (rdch) + CHN_UNLOCK(rdch); chn_setblocksize(wrch, 2, *arg_i); + CHN_UNLOCK(wrch); + wrch = NULL; + if (rdch) + CHN_LOCK(rdch); + } if (rdch) chn_setblocksize(rdch, 2, *arg_i); break; @@ -662,8 +681,14 @@ /* chn_setspeed may sleep */ tmp = 0; if (wrch) { + if (rdch) + CHN_UNLOCK(rdch); ret = chn_setspeed(wrch, *arg_i); tmp = wrch->speed; + CHN_UNLOCK(wrch); + wrch = NULL; + if (rdch) + CHN_LOCK(rdch); } if (rdch && ret == 0) { ret = chn_setspeed(rdch, *arg_i); @@ -681,8 +706,14 @@ tmp = -1; *arg_i = (*arg_i)? AFMT_STEREO : 0; if (wrch) { + if (rdch) + CHN_UNLOCK(rdch); ret = chn_setformat(wrch, (wrch->format & ~AFMT_STEREO) | *arg_i); tmp = (wrch->format & AFMT_STEREO)? 1 : 0; + CHN_UNLOCK(wrch); + wrch = NULL; + if (rdch) + CHN_LOCK(rdch); } if (rdch && ret == 0) { ret = chn_setformat(rdch, (rdch->format & ~AFMT_STEREO) | *arg_i); @@ -698,8 +729,14 @@ tmp = 0; *arg_i = (*arg_i != 1)? AFMT_STEREO : 0; if (wrch) { + if (rdch) + CHN_UNLOCK(rdch); ret = chn_setformat(wrch, (wrch->format & ~AFMT_STEREO) | *arg_i); tmp = (wrch->format & AFMT_STEREO)? 2 : 1; + CHN_UNLOCK(wrch); + wrch = NULL; + if (rdch) + CHN_LOCK(rdch); } if (rdch && ret == 0) { ret = chn_setformat(rdch, (rdch->format & ~AFMT_STEREO) | *arg_i); @@ -724,8 +761,14 @@ if ((*arg_i != AFMT_QUERY)) { tmp = 0; if (wrch) { + if (rdch) + CHN_UNLOCK(rdch); ret = chn_setformat(wrch, (*arg_i) | (wrch->format & AFMT_STEREO)); tmp = wrch->format & ~AFMT_STEREO; + CHN_UNLOCK(wrch); + wrch = NULL; + if (rdch) + CHN_LOCK(rdch); } if (rdch && ret == 0) { ret = chn_setformat(rdch, (*arg_i) | (rdch->format & AFMT_STEREO)); @@ -757,9 +800,15 @@ DEB(printf("SNDCTL_DSP_SETFRAGMENT %d frags, %d sz\n", maxfrags, fragsz)); if (rdch) { + if (wrch) + CHN_UNLOCK(wrch); ret = chn_setblocksize(rdch, maxfrags, fragsz); maxfrags = sndbuf_getblkcnt(rdch->bufsoft); fragsz = sndbuf_getblksz(rdch->bufsoft); + CHN_UNLOCK(rdch); + rdch = NULL; + if (wrch) + CHN_LOCK(wrch); } if (wrch && ret == 0) { ret = chn_setblocksize(wrch, maxfrags, fragsz);