From owner-freebsd-current@FreeBSD.ORG Tue Dec 16 09:27:22 2003 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 2EAB716A4CE for ; Tue, 16 Dec 2003 09:27:22 -0800 (PST) Received: from opiate.soulwax.net (CPE0010a702d464-CM000039ae486b.cpe.net.cable.rogers.com [63.139.24.219]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0282643D3C for ; Tue, 16 Dec 2003 09:27:17 -0800 (PST) (envelope-from chopra@opiate.soulwax.net) Received: by opiate.soulwax.net (Postfix, from userid 1001) id AD2B24059; Tue, 16 Dec 2003 12:27:24 -0500 (EST) Date: Tue, 16 Dec 2003 12:27:24 -0500 From: Munish Chopra To: current@FreeBSD.org Message-ID: <20031216172724.GC9122@opiate.soulwax.net> Mail-Followup-To: current@FreeBSD.org References: <200312151501.hBFF1Abp088978@fledge.watson.org> <3FDDD7AE.7040801@bis.midco.net> <20031215180827.GA653@opiate.soulwax.net> <20031215190917.GB63202@cnd.mcgill.ca> <3FDF3F49.9010800@bis.midco.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="SLDf9lqlvOQaIe6s" Content-Disposition: inline In-Reply-To: <3FDF3F49.9010800@bis.midco.net> Subject: Re: 5.2-RELEASE TODO 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, 16 Dec 2003 17:27:22 -0000 --SLDf9lqlvOQaIe6s Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On 2003-12-16 11:22 +0000, Peter Schultz wrote: > Mathew Kanner wrote: > >On Dec 15, Munish Chopra wrote: > >> > >>They haven't been corrected in my case, or the cases of quite a few > >>other folks experiencing them (see some of the other ongoing threads). > >> > > I stand corrected. I thought I was being abusive enough, but if I make > my SCSI hard disk (I don't think this is limited to ATA disk activity) > really busy there is still slight glitching. It appears as though > sync'ing the disk is what causes the trouble. > > >>I'm not personally seeing any LOR's, but audio playback slows down under > >>load, and every few seconds I hear popping noises during audio playback, > >>whether under load or not. > >> > >>I've got a simple SB16: > >>pcm0: port 0xd800-0xd83f irq 5 at device 15.0 on > >>pci0 > >>pcm0: > > > > > > Hello Munish, > > I would realy like to help you and others. Please describe in > >detail the circumstances that create the problem. Are you > >experiencing buffer overruns or underruns? How many devices are > >sharing the IRQ? What are they? What happens when you cat a raw file > >to the device? Does this happen with VCHANs? Have you tried the patch > >I posted to -current under the heading "sound patch for pop & > >crackles"? > > I would like to try your patch, but hunk #3 fails on -CURRENT: [...] I've attached the updated patch I sent Mathew yesterday. -- Munish Chopra --SLDf9lqlvOQaIe6s Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="channel.c.patch" --- channel.c.old Mon Dec 15 15:43:09 2003 +++ channel.c Mon Dec 15 18:26:56 2003 @@ -41,6 +41,10 @@ #define DEB(x) x */ +static int chn_fragsps = 0; +SYSCTL_INT(_hw_snd, OID_AUTO, fragsps, CTLFLAG_RW, + &chn_fragsps, 1, "max fragments per second, 0 to disable"); + static int chn_targetirqrate = 32; TUNABLE_INT("hw.snd.targetirqrate", &chn_targetirqrate); @@ -59,7 +63,7 @@ return err; } SYSCTL_PROC(_hw_snd, OID_AUTO, targetirqrate, CTLTYPE_INT | CTLFLAG_RW, - 0, sizeof(int), sysctl_hw_snd_targetirqrate, "I", ""); + 0, sizeof(int), sysctl_hw_snd_targetirqrate, "I", "default fragment tar"); static int report_soft_formats = 1; SYSCTL_INT(_hw_snd, OID_AUTO, report_soft_formats, CTLFLAG_RW, &report_soft_formats, 1, "report software-emulated formats"); @@ -115,11 +119,18 @@ static void chn_wakeup(struct pcm_channel *c) { - struct snd_dbuf *bs = c->bufsoft; - - CHN_LOCKASSERT(c); - if (SEL_WAITING(sndbuf_getsel(bs)) && chn_polltrigger(c)) - selwakeuppri(sndbuf_getsel(bs), PRIBIO); + 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); + } + } wakeup(bs); } @@ -971,7 +982,7 @@ { struct snd_dbuf *b = c->bufhard; struct snd_dbuf *bs = c->bufsoft; - int bufsz, irqhz, tmp, ret; + int irqhz, tmp, ret; CHN_LOCKASSERT(c); if (!CANCHANGE(c) || (c->flags & CHN_F_MAPPED)) @@ -1000,14 +1011,23 @@ DEB(printf("%s: updating (%d, %d)\n", __func__, blkcnt, blksz)); } } else { + if ( chn_fragsps != 0 && + sndbuf_getbps(bs) * sndbuf_getspd(bs) / blksz > chn_fragsps) + { + blksz = sndbuf_getbps(bs) * sndbuf_getspd(bs) / chn_fragsps; + tmp = 32; + while (tmp < blksz) + tmp <<= 1; + blksz = tmp; + if (blksz * blkcnt > CHN_2NDBUFMAXSIZE) + blkcnt = CHN_2NDBUFMAXSIZE / blksz; + } ret = EINVAL; if ((blksz < 16) || (blkcnt < 2) || (blkcnt * blksz > CHN_2NDBUFMAXSIZE)) goto out; ret = 0; c->flags |= CHN_F_HAS_SIZE; } - - bufsz = blkcnt * blksz; ret = sndbuf_remalloc(bs, blkcnt, blksz); if (ret) --SLDf9lqlvOQaIe6s--