From: Takashi Iwai Subject: Re: hw_params function and OSS emulation Date: Thu, 23 Aug 2007 21:01:54 +0200 Message-ID: References: <46CB2BB4.9060808@freescale.com> <46CC480F.7090604@freescale.com> <46CC4FF3.6090607@freescale.com> <46CC5ADC.4020605@freescale.com> <46CDC5AB.6080602@freescale.com> <46CDD55C.5040301@freescale.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (ns.suse.de [195.135.220.2]) by alsa0.perex.cz (Postfix) with ESMTP id 8AC7524348 for ; Thu, 23 Aug 2007 21:01:54 +0200 (CEST) In-Reply-To: <46CDD55C.5040301@freescale.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: Timur Tabi Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Thu, 23 Aug 2007 13:43:40 -0500, Timur Tabi wrote: > > Takashi Iwai wrote: > > > Err, usually, application = user-space application. Do you mean > > really this? > > Yes. The application allocates a buffer, locks it down, and passes it to the > kernel. Since the buffer was allocated in user space, it is virtual > contiguous but not physically contiguous, hence the need for a list of > physical addresses. To the hardware, the buffer appears as a collection of > scattered buffers. Hence, scatter/gather. Hm, then it must be a really special application. I've never seen linux audio apps doing such things... The problem in your scenario is that the buffers allocated from user-space are not always DMA-able for devices, thus not always usable for the hardware. > Like I said, I haven't look at the ALSA API for S/G, so I may be talking about > an implementation of S/G that does not apply to ALSA. The ALSA SG-buffer helper is simply to allocate individual pages and gather as a virtually linear buffer. From the user-space, it's nothing but a normal linear buffer. The helper is specific to devices that can handle SG-buffers with kernel PAGE grains, and for architectures with vmap support. Anyway, the hw_params implementation is basically free for drivers. The driver can use its own SG-buffer handler if the given SG-buffer helper doesn't match with the requirement. Takashi