diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-01-25 03:00:01 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-02-21 10:34:55 -0500 |
commit | b50e7fe99317c05b0bb8ba6338bc6aa7da3b918e (patch) | |
tree | 32124766d993a7d65b49555f6f65a04508ecc318 /drivers/media/video/video-buf.c | |
parent | 52ebc763d8e0c9f2ab48af89a75e90e2318bac86 (diff) |
V4L/DVB (5147): Make vivi driver to use vmalloced pointers
Before this patch, vivi were simulating a scatter gather DMA transfer.
While this is academic, showing how stuff really works on a real PCI
device, this means a non-optimized code.
There are only two memory models that vivi implements:
1) kernel alloced memory. This is also used by read() method.
On this case, a vmalloc32 buffer is allocated at kernel;
2) userspace allocated memory. This is used by most userspace apps.
video-buf will store this pointer.
a simple copy_to_user is enough to transfer data.
The third memory model scenario supported by video-buf is overlay mode.
This model is not implemented on vivi and unlikely to be implemented on
newer drivers, since now, most userspace apps do some post-processing
(like de-interlacing).
After this patch, some cleanups may be done at video-buf.c to avoid
allocating pages, when the driver doesn't need a PCI buffer. This is the
case of vivi and usb drivers.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/video-buf.c')
-rw-r--r-- | drivers/media/video/video-buf.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/media/video/video-buf.c b/drivers/media/video/video-buf.c index 6504a5866849..459786ff459a 100644 --- a/drivers/media/video/video-buf.c +++ b/drivers/media/video/video-buf.c | |||
@@ -148,6 +148,8 @@ int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction, | |||
148 | dprintk(1,"init user [0x%lx+0x%lx => %d pages]\n", | 148 | dprintk(1,"init user [0x%lx+0x%lx => %d pages]\n", |
149 | data,size,dma->nr_pages); | 149 | data,size,dma->nr_pages); |
150 | 150 | ||
151 | dma->varea = (void *) data; | ||
152 | |||
151 | down_read(¤t->mm->mmap_sem); | 153 | down_read(¤t->mm->mmap_sem); |
152 | err = get_user_pages(current,current->mm, | 154 | err = get_user_pages(current,current->mm, |
153 | data & PAGE_MASK, dma->nr_pages, | 155 | data & PAGE_MASK, dma->nr_pages, |
@@ -285,6 +287,7 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma) | |||
285 | 287 | ||
286 | vfree(dma->vmalloc); | 288 | vfree(dma->vmalloc); |
287 | dma->vmalloc = NULL; | 289 | dma->vmalloc = NULL; |
290 | dma->varea = NULL; | ||
288 | 291 | ||
289 | if (dma->bus_addr) { | 292 | if (dma->bus_addr) { |
290 | dma->bus_addr = 0; | 293 | dma->bus_addr = 0; |