lkml.org 
[lkml]   [2000]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] kiobuf/rawio fixes for 2.4.0-test10-pre6
Christoph Hellwig wrote:
>
> On Mon, Oct 30, 2000 at 01:56:07PM -0500, Jeff Garzik wrote:
> > My question from above is: how can the via audio mmap in test10-preXX
> > be improved by using kiobufs? I am not a kiobuf expert, but AFAICS a
> > non-kiobuf implementation is better for audio drivers. (and the via
> > audio mmap implementation is what some other audio drivers are about to
> > start using...)
>
> I think the biggest advantage is that you actually get the list of pages
> when you perform the mmap instead of doing virt_to_page on every ->nopage.
> That should speed up the operations on the mmap'ed are a bit.

nopage() is only called when the page is not mapped for the current
process. So it doesn't get called very often. Easy enough to call
virt_to_page at alloc instead of nopage time, though. Patch attached :)


> The other strong argument for the kiobuf solution is code-sharing. Instead
> of having every (sound) driver playing with the vm, there is one central
> place when you use kvmaps.

Actually, I wonder if its even possible for mmap_kiobuf to support audio
-- full duplex requires that both record and playback buffer(s),
theoretically two separate sets of kiobufs, to be presented as one space
(with playback always presented before record). Even if you can do that
with mmap_kiobuf, some audio hardware doesn't support scatter-gather, so
each set of kiobufs must be physically contiguous for each channel.

<thinks> audio drivers' write(2) should be kiobuf'd, but only for
hardware which supports scatter-gather.

I can't think of any other cases where kiobuf would apply to audio.

Jeff


--
Jeff Garzik | "Mind if I drive?" -Sam
Building 1024 | "Not if you don't mind me clawing at the
MandrakeSoft | dash and shrieking like a cheerleader."
| -MaxIndex: drivers/sound/via82cxxx_audio.c
===================================================================
RCS file: /cvsroot/gkernel/linux_2_4/drivers/sound/via82cxxx_audio.c,v
retrieving revision 1.1.1.6.4.1
diff -u -r1.1.1.6.4.1 via82cxxx_audio.c
--- drivers/sound/via82cxxx_audio.c 2000/10/27 08:21:41 1.1.1.6.4.1
+++ drivers/sound/via82cxxx_audio.c 2000/10/30 19:57:21
@@ -226,6 +226,7 @@
struct via_sgd_data {
dma_addr_t handle;
void *cpuaddr;
+ struct page *page;
};


@@ -626,6 +627,7 @@

if (!chan->sgbuf[i].cpuaddr)
goto err_out_nomem;
+ chan->sgbuf[i].page = virt_to_page (chan->sgbuf[i].cpuaddr);

if (i < (VIA_DMA_BUFFERS - 1))
chan->sgtable[i].count = cpu_to_le32 (VIA_DMA_BUF_SIZE | VIA_FLAG);
@@ -722,6 +724,7 @@
chan->sgbuf[i].handle);
chan->sgbuf[i].cpuaddr = NULL;
chan->sgbuf[i].handle = 0;
+ chan->sgbuf[i].page = NULL;
}

if (chan->sgtable) {
@@ -1717,9 +1720,11 @@
} else if (!wr)
chan = &card->ch_in;

+ assert (chan->sgbuf[pgoff].cpuaddr != NULL);
+ assert (chan->sgbuf[pgoff].page != NULL);
assert ((((unsigned long)chan->sgbuf[pgoff].cpuaddr) % PAGE_SIZE) == 0);

- dmapage = virt_to_page (chan->sgbuf[pgoff].cpuaddr);
+ dmapage = chan->sgbuf[pgoff].page;
DPRINTK ("EXIT, returning page %p for cpuaddr %lXh\n",
dmapage, (unsigned long) chan->sgbuf[pgoff].cpuaddr);
get_page (dmapage);
\
 
 \ /
  Last update: 2005-03-22 12:45    [from the cache]
©2003-2011 Jasper Spaans