From 12d05113a10be2078e72039a301b3d3902d29248 Mon Sep 17 00:00:00 2001 From: Brandon Philips Date: Wed, 2 Apr 2008 11:10:59 -0700 Subject: videobuf-vmalloc.c: Fix hack of postponing mmap on remap failure In videobuf-vmalloc.c remap_vmalloc_range is failing when applications are trying to mmap buffers immediately after reqbuf. It fails because the vmalloc area isn't setup until the first QBUF when drivers call iolock. This patch introduces mmap_setup to the qtype_ops and it is called in __videobuf_mmap_setup if the buffer type is mmap. In the case of vmalloc buffers this calls iolock, and sets the state to idle. I don't think this is needed for dma-sg buffers and it defaults to a no-op for everything but vmalloc. Signed-off-by: Brandon Philips --- linux/drivers/media/video/videobuf-core.c | 29 +++++++----------- linux/drivers/media/video/videobuf-vmalloc.c | 43 +++++++++++++-------------- linux/include/media/videobuf-core.h | 3 + 3 files changed, 35 insertions(+), 40 deletions(-) --- linux/include/media/videobuf-core.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'linux/include/media') diff --git a/linux/include/media/videobuf-core.h b/linux/include/media/videobuf-core.h index b94057eac..7c80e8adf 100644 --- a/linux/include/media/videobuf-core.h +++ b/linux/include/media/videobuf-core.h @@ -144,6 +144,8 @@ struct videobuf_qtype_ops { int vbihack, int nonblocking); int (*mmap_free) (struct videobuf_queue *q); + int (*mmap_setup) (struct videobuf_queue *q, + struct videobuf_buffer *vb); int (*mmap_mapper) (struct videobuf_queue *q, struct vm_area_struct *vma); }; @@ -168,7 +170,6 @@ struct videobuf_queue { unsigned int streaming:1; unsigned int reading:1; - unsigned int is_mmapped:1; /* capture via mmap() + ioctl(QBUF/DQBUF) */ struct list_head stream; -- cgit v1.2.3