From owner-freebsd-current@FreeBSD.ORG Sat Jan 24 12:09:19 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 2986A16A4CE for ; Sat, 24 Jan 2004 12:09:19 -0800 (PST) Received: from hak.cnd.mcgill.ca (hak.cnd.mcgill.ca [132.216.11.133]) by mx1.FreeBSD.org (Postfix) with ESMTP id 019DE43D98 for ; Sat, 24 Jan 2004 12:07:31 -0800 (PST) (envelope-from mat@hak.cnd.mcgill.ca) Received: from hak.cnd.mcgill.ca (localhost [127.0.0.1]) by hak.cnd.mcgill.ca (8.12.9/8.12.8) with ESMTP id i0OK3hpq094383; Sat, 24 Jan 2004 15:03:43 -0500 (EST) (envelope-from mat@hak.cnd.mcgill.ca) Received: (from mat@localhost) by hak.cnd.mcgill.ca (8.12.9/8.12.8/Submit) id i0OK3hdq094382; Sat, 24 Jan 2004 15:03:43 -0500 (EST) Date: Sat, 24 Jan 2004 15:03:43 -0500 From: Mathew Kanner To: Stefan Ehmann Message-ID: <20040124200343.GP64193@cnd.mcgill.ca> References: <1074937301.2959.7.camel@shoeserv.freebsd> <20040124191514.GO64193@cnd.mcgill.ca> <1074973701.719.4.camel@shoeserv.freebsd> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="/e2eDi0V/xtL+Mc8" Content-Disposition: inline In-Reply-To: <1074973701.719.4.camel@shoeserv.freebsd> User-Agent: Mutt/1.4.1i Organization: I speak for myself, operating in Montreal, CANADA X-Spam-Status: No, hits=0.0 required=5.0 tests=none autolearn=no version=2.62 X-Spam-Checker-Version: SpamAssassin 2.62 (2004-01-11) on hak.cnd.mcgill.ca cc: current@freebsd.org cc: Mathew Kanner Subject: Re: write(2) lc_r problem 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: Sat, 24 Jan 2004 20:09:19 -0000 --/e2eDi0V/xtL+Mc8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Jan 24, Stefan Ehmann wrote: > On Sat, 2004-01-24 at 20:15, Mathew Kanner wrote: > > On Jan 24, Stefan Ehmann wrote: > > > I'm trying to write a small sound application and run across a problem > > > on CURRENT. > > > > > > It's very basic at the moment. It simply reads pcm data from a file and > > > uses write(2) on /dev/dsp. > > > > > > But as soon as I link the program with -lc_r there's always about 1 > > > second delay before a write call - which makes it pretty unusable for > > > playing sound. > > > > > > It should be easy reproducable if you link audio/waveplay with -lc_r. > > > > > > This doesn't happen in either FreeBSD 4.9, Knoppix or CURRENT if linked > > > with -lkse or -lthr. > > > > > > Am I'm missing something basic when using write together with lc_r or > > > ist this a bug in CURRENT? > > > > There is definetly a bug with the sound code when using vchans > > and select. Make sure that (using sysctl) > > > > hw.snd.maxautovchans=0 > > hw.snd.pcmX.vchans=0 > > You're right, that fixed it. That's also the reason why it worked on > stable (vchans was disabled there). Please try this untested patch with vchans enabled. --Mat -- We peer so suspiciously at each other that we cannot see that we Canadians are standing on the mountaintop of human wealth, freedom and privilege. - Pierre Elliott Trudeau --/e2eDi0V/xtL+Mc8 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="chn_wakeup.patch" Index: channel.c =================================================================== RCS file: /home/ncvs/src/sys/dev/sound/pcm/channel.c,v retrieving revision 1.93 diff -u -r1.93 channel.c --- channel.c 5 Dec 2003 02:08:13 -0000 1.93 +++ channel.c 24 Jan 2004 20:05:21 -0000 @@ -115,11 +115,19 @@ static void chn_wakeup(struct pcm_channel *c) { - struct snd_dbuf *bs = c->bufsoft; + struct snd_dbuf *bs = c->bufsoft; + struct pcmchan_children *pce; + + // CHN_LOCKASSERT(c); + if (SLIST_EMPTY(&c->children)) { + if (SEL_WAITING(sndbuf_getsel(bs)) && chn_polltrigger(c)) + selwakeup(sndbuf_getsel(bs)); + } else { + SLIST_FOREACH(pce, &c->children, link) { + chn_wakeup(pce->channel); + } + } - CHN_LOCKASSERT(c); - if (SEL_WAITING(sndbuf_getsel(bs)) && chn_polltrigger(c)) - selwakeuppri(sndbuf_getsel(bs), PRIBIO); wakeup(bs); } --/e2eDi0V/xtL+Mc8--