From: Takashi Iwai Subject: Re: Proposal for more reliable audio DMA. Date: Wed, 24 Jun 2009 23:11:22 +0200 Message-ID: References: <378E7985-7CD3-4009-AA14-127391A819F2@opensource.wolfsonmicro.com> <9e4733910906241207m50340ef5gd63fc4527e50b861@mail.gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mx1.suse.de (cantor.suse.de [195.135.220.2]) by alsa0.perex.cz (Postfix) with ESMTP id D9B09248C9 for ; Wed, 24 Jun 2009 23:11:22 +0200 (CEST) In-Reply-To: <9e4733910906241207m50340ef5gd63fc4527e50b861@mail.gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Jon Smirl Cc: alsa-devel mailing list , Mark Brown , James Courtier-Dutton List-Id: alsa-devel@alsa-project.org At Wed, 24 Jun 2009 15:07:17 -0400, Jon Smirl wrote: > = > On Wed, Jun 24, 2009 at 12:28 PM, Mark > Brown wrote: > > On 24 Jun 2009, at 17:07, Jon Smirl wrote: > > > >> Trying to directly expose the ring buffer to the app seems like a good > >> > >> way to avoid a copy, but it isn't achieving that. pulse is not > >> decoding audio straight into the ring buffer, it decodes first and > >> then copies into the buffer. Pulse is using the timers to estimate the > >> destination for the copy. =A0Move this copy down into the drivers, the > >> drivers know the correct destination for the copy. > > > > Pulse isn't just doing straight playback, a large part of what it's the= re > > for is to do software mixing. When you have multiple sources active pul= se is > > going to be forced to do the copy as part of the mixing process so putt= ing > > that bit of the buffer management in kernel won't help in the way you t= hink > > it does. Part of what's going on here is that the kernel code is trying= to > > give userspace access to the data for as long as possible. > > > = > Does this work as a use case? > = > Pulse is playing music in the background. A game want to do a laser blas= t. > = > Pulse has already sent a buffer into kernel for the background music. > Pulse makes a new buffer that contains the background mixed with the lase= r. > It sends this new buffer into the kernel and says play with minimum laten= cy. When it's mmapped and can be updated on the fly, no need to resend the buffer. You can just rewrite it. > The problem is knowing which sample in the background music to start > mixing the low latency laser blast into. That's why querying the accurate hwptr is important in PA. Takashi