From owner-freebsd-multimedia@FreeBSD.ORG Fri May 6 20:19:41 2011 Return-Path: Delivered-To: multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66FDD106566C; Fri, 6 May 2011 20:19:41 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 3D49C8FC14; Fri, 6 May 2011 20:19:41 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id E683A46B42; Fri, 6 May 2011 16:19:40 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 8262F8A027; Fri, 6 May 2011 16:19:40 -0400 (EDT) From: John Baldwin To: freebsd-current@freebsd.org Date: Fri, 6 May 2011 16:16:40 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110325; KDE/4.5.5; amd64; ; ) References: <4DC3B764.4030801@FreeBSD.org> <4DC3F9B8.3030505@FreeBSD.org> <20110506140428.GF48734@deviant.kiev.zoral.com.ua> In-Reply-To: <20110506140428.GF48734@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201105061616.41145.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Fri, 06 May 2011 16:19:40 -0400 (EDT) Cc: multimedia@freebsd.org, current@freebsd.org, Andriy Gapon Subject: Re: dsp mmap change X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 May 2011 20:19:41 -0000 On Friday, May 06, 2011 10:04:28 am Kostik Belousov wrote: > On Fri, May 06, 2011 at 04:38:00PM +0300, Andriy Gapon wrote: > > on 06/05/2011 16:32 Kostik Belousov said the following: > > > On Fri, May 06, 2011 at 11:55:00AM +0300, Andriy Gapon wrote: > > >> > > >> I would like to ask for a review and/or testing of the following patch: > > >> http://people.freebsd.org/~avg/dev_dsp_mmap.diff > > >> > > >> It's supposed to fix an issue described here: > > >> http://lists.freebsd.org/pipermail/freebsd-multimedia/2011- February/011691.html > > >> > > >> In short, the following pseudo-code should do the right thing: > > >> fd = open(/dev/dsp, O_RDWR); > > >> mmap(PROT_READ, fd); > > >> mmap(PROT_WRITE, fd); > > >> > > >> Thank you! > > > > > > I think that you have to call PCM_GIANT_LEAVE() when returning > > > EINVAL on the vm_pager_alloc() failure. > > > > Yes, thank you. > > > > > Your patch hardcodes an assumption that sndbufs are always > > > contiguous. I was unable to convince myself that this is true. > > > > I think that this should be true for the case when DMA is used? > In the current driver, yes, but there is nothing that theoretically > prevents scatter-gather from be used. You could "fix" this by creating an sglist (via sglist_build()) and an OBJT_SG VM object that the d_mmap_single callback returned. I wish there was a cleaner way to just create a VM object and populate it with pages though, and then use vm_map_insert() to map it into the kernel rather than the more roundabout method of OBJT_SG. -- John Baldwin