From owner-freebsd-multimedia@FreeBSD.ORG Thu Apr 28 11:33:54 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8FC2116A4CE for ; Thu, 28 Apr 2005 11:33:54 +0000 (GMT) Received: from torrent.cc.mcgill.ca (torrent.cc.mcgill.ca [132.206.27.49]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2D8C143D2F for ; Thu, 28 Apr 2005 11:33:54 +0000 (GMT) (envelope-from mat@cnd.mcgill.ca) Received: from mailscan3.cc.mcgill.ca (mailscan3.CC.McGill.CA [132.216.77.250])j3SBXrCs020464; Thu, 28 Apr 2005 07:33:53 -0400 Received: from cube.cnd.mcgill.ca (cube.CND.McGill.CA [132.216.25.196]) j3SBXoYV023111; Thu, 28 Apr 2005 07:33:50 -0400 (EDT) Received: from localhost.localdomain (acid.cnd.mcgill.ca [132.216.11.151]) by cube.cnd.mcgill.ca (8.12.11/8.12.11) with ESMTP id j3SBXnP0020266; Thu, 28 Apr 2005 07:33:50 -0400 Received: from localhost.localdomain (acid [127.0.0.1]) j3SBXnu5015511; Thu, 28 Apr 2005 07:33:49 -0400 Received: (from mat@localhost) by localhost.localdomain (8.12.11/8.12.11/Submit) id j3SBXn8k015510; Thu, 28 Apr 2005 07:33:49 -0400 Date: Thu, 28 Apr 2005 07:33:49 -0400 From: Mathew Kanner To: Luigi Rizzo Message-ID: <20050428113349.GC14507@cnd.mcgill.ca> References: <20050422154654.A72976@xorpc.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050422154654.A72976@xorpc.icir.org> User-Agent: Mutt/1.4.2i Organization: I speak for myself, operating in Montreal, CANADA cc: multimedia@freebsd.org Subject: Re: dev/sound patches to reduce latency X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Apr 2005 11:33:54 -0000 On Apr 22, Luigi Rizzo wrote: > attached are some patches for the sound driver to reduce latency > in the playback channel. > Background - by design, the driver tries to keep the "hard" buffer > (the one used by the hardware to play samples out) always full > even if userland supplied a small amount of data. While there is > an ioctl() to set the size of the buffer in terms of a blocksize > and number of blocks, the existing code failed in some cases to > push down the info to the hardware, and had the tendency to > use max-sized buffers in many cases. At 8khz, the 16k default buffers > could cause very large delays in the playback of audio. > > With this patches, we try to pass the user-specified blocksize down > to the hardware, and furthermore, use a small number of blocks in > the "hard" buffer to minimize latency. > > I'd appreciate if people could test this code and report any good > or bad news. I think it significantly improves what we have now. > It could still benefit from an additional improvement: > - make the choice of the number of buffers adaptive on the irq rate. > which is not a very complex thing to do, but should be done in all > individual drivers, so it takes a bit more testing. Hi Luigi, I've started to look at your patches by brining them up to 6.x. Integreating them is been hard because the 4.x code base does not have the (heroic) changes that truckman commited about a year ago that cleans up/changes the sound buffer. I'm not done yet, but I wanted to stop and ask: Have you tried 5-+? It should be a little better in regards to buffer allocation. --Mat