public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] v4l: videobuf update
@ 2003-04-02 16:36 Gerd Knorr
  2003-04-02 18:06 ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Gerd Knorr @ 2003-04-02 16:36 UTC (permalink / raw)
  To: Linus Torvalds, Kernel List

  Hi,

This is a minor update for the video-buf module.  It does
export the videobuf_next_field symbol and adds a few debug
printks.

  Gerd

diff -u linux-2.5.66/drivers/media/video/video-buf.c linux/drivers/media/video/video-buf.c
--- linux-2.5.66/drivers/media/video/video-buf.c	2003-04-02 11:42:51.957723625 +0200
+++ linux/drivers/media/video/video-buf.c	2003-04-02 11:49:35.894628822 +0200
@@ -16,6 +16,7 @@
  * (at your option) any later version.
  */
 
+#include <linux/version.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/vmalloc.h>
@@ -362,21 +363,33 @@
 {
 	int i;
 	
-	if (q->reading)
+	if (q->streaming) {
+		dprintk(1,"busy: streaming active\n");
 		return 1;
-	if (q->streaming)
+	}
+	if (q->reading) {
+		dprintk(1,"busy: pending read #1\n");
 		return 1;
-	if (q->read_buf)
+	}
+	if (q->read_buf) {
+		dprintk(1,"busy: pending read #2\n");
 		return 1;
+	}
 	for (i = 0; i < VIDEO_MAX_FRAME; i++) {
 		if (NULL == q->bufs[i])
 			continue;
-		if (q->bufs[i]->map)
+		if (q->bufs[i]->map) {
+			dprintk(1,"busy: buffer #%d mapped\n",i);
 			return 1;
-		if (q->bufs[i]->state == STATE_QUEUED)
+		}
+		if (q->bufs[i]->state == STATE_QUEUED) {
+			dprintk(1,"busy: buffer #%d queued\n",i);
 			return 1;
-		if (q->bufs[i]->state == STATE_ACTIVE)
+		}
+		if (q->bufs[i]->state == STATE_ACTIVE) {
+			dprintk(1,"busy: buffer #%d active\n",i);
 			return 1;
+		}
 	}
 	return 0;
 }
@@ -569,7 +582,7 @@
 	if (list_empty(&q->stream))
 		goto done;
 	buf = list_entry(q->stream.next, struct videobuf_buffer, stream);
-	retval = videobuf_waiton(buf,1,1);
+	retval = videobuf_waiton(buf, file->f_flags & O_NONBLOCK, 1);
 	if (retval < 0)
 		goto done;
 	switch (buf->state) {
@@ -925,6 +938,9 @@
 videobuf_vm_open(struct vm_area_struct *vma)
 {
 	struct videobuf_mapping *map = vma->vm_private_data;
+
+	dprintk(2,"vm_open %p [count=%d,vma=%08lx-%08lx]\n",map,
+		map->count,vma->vm_start,vma->vm_end);
 	map->count++;
 }
 
@@ -934,6 +950,9 @@
 	struct videobuf_mapping *map = vma->vm_private_data;
 	int i;
 
+	dprintk(2,"vm_close %p [count=%d,vma=%08lx-%08lx]\n",map,
+		map->count,vma->vm_start,vma->vm_end);
+
 	/* down(&fh->lock); FIXME */
 	map->count--;
 	if (0 == map->count) {
@@ -1081,11 +1100,11 @@
 		q->bufs[i]->map   = map;
 		q->bufs[i]->baddr = vma->vm_start + size;
 	}
-	map->count   = 1;
-	map->start   = vma->vm_start;
-	map->end     = vma->vm_end;
-	map->q       = q;
-	vma->vm_ops  = &videobuf_vm_ops;
+	map->count    = 1;
+	map->start    = vma->vm_start;
+	map->end      = vma->vm_end;
+	map->q        = q;
+	vma->vm_ops   = &videobuf_vm_ops;
 	vma->vm_flags |= VM_DONTEXPAND;
 	vma->vm_flags &= ~VM_IO; /* using shared anonymous pages */
 	vma->vm_private_data = map;
@@ -1119,6 +1138,7 @@
 EXPORT_SYMBOL_GPL(videobuf_queue_cancel);
 EXPORT_SYMBOL_GPL(videobuf_queue_is_busy);
 
+EXPORT_SYMBOL_GPL(videobuf_next_field);
 EXPORT_SYMBOL_GPL(videobuf_status);
 EXPORT_SYMBOL_GPL(videobuf_reqbufs);
 EXPORT_SYMBOL_GPL(videobuf_querybuf);
diff -u linux-2.5.66/include/media/video-buf.h linux/include/media/video-buf.h
--- linux-2.5.66/include/media/video-buf.h	2003-04-02 11:42:55.103208272 +0200
+++ linux/include/media/video-buf.h	2003-04-02 11:49:35.895628670 +0200
@@ -196,6 +196,7 @@
 int  videobuf_queue_is_busy(struct videobuf_queue *q);
 void videobuf_queue_cancel(struct file *file, struct videobuf_queue *q);
 
+enum v4l2_field videobuf_next_field(struct videobuf_queue *q);
 void videobuf_status(struct v4l2_buffer *b, struct videobuf_buffer *vb,
 		     enum v4l2_buf_type type);
 int videobuf_reqbufs(struct file *file, struct videobuf_queue *q,

-- 
Michael Moore for president!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] v4l: videobuf update
  2003-04-02 16:36 [patch] v4l: videobuf update Gerd Knorr
@ 2003-04-02 18:06 ` Christoph Hellwig
  2003-04-02 18:35   ` Gerd Knorr
  0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2003-04-02 18:06 UTC (permalink / raw)
  To: Gerd Knorr; +Cc: Linus Torvalds, Kernel List

On Wed, Apr 02, 2003 at 06:36:47PM +0200, Gerd Knorr wrote:
>   Hi,
> 
> This is a minor update for the video-buf module.  It does
> export the videobuf_next_field symbol and adds a few debug
> printks.
> 
>   Gerd
> 
> diff -u linux-2.5.66/drivers/media/video/video-buf.c linux/drivers/media/video/video-buf.c
> --- linux-2.5.66/drivers/media/video/video-buf.c	2003-04-02 11:42:51.957723625 +0200
> +++ linux/drivers/media/video/video-buf.c	2003-04-02 11:49:35.894628822 +0200
> @@ -16,6 +16,7 @@
>   * (at your option) any later version.
>   */
>  
> +#include <linux/version.h>

Why do you need this?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] v4l: videobuf update
  2003-04-02 18:06 ` Christoph Hellwig
@ 2003-04-02 18:35   ` Gerd Knorr
  2003-04-02 18:36     ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Gerd Knorr @ 2003-04-02 18:35 UTC (permalink / raw)
  To: Christoph Hellwig, Linus Torvalds, Kernel List

> > --- linux-2.5.66/drivers/media/video/video-buf.c	2003-04-02 11:42:51.957723625 +0200
> >  
> > +#include <linux/version.h>
> 
> Why do you need this?

Because the 2.5.x code doesn't compile on 2.4.x, thus there are version
#ifdefs in my device driver tarballs.  You just don't see that because
some perl magic filteres out the 2.4 code when submitting patches for
2.5.x (and visa versa ...).  If you fetch the tarballs from bytesex.org
you'll see the #ifdefs in the driver code.

  Gerd

-- 
Michael Moore for president!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] v4l: videobuf update
  2003-04-02 18:35   ` Gerd Knorr
@ 2003-04-02 18:36     ` Christoph Hellwig
  2003-04-02 19:19       ` Gerd Knorr
  0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2003-04-02 18:36 UTC (permalink / raw)
  To: Gerd Knorr; +Cc: Linus Torvalds, Kernel List

On Wed, Apr 02, 2003 at 08:35:44PM +0200, Gerd Knorr wrote:
> > > --- linux-2.5.66/drivers/media/video/video-buf.c	2003-04-02 11:42:51.957723625 +0200
> > >  
> > > +#include <linux/version.h>
> > 
> > Why do you need this?
> 
> Because the 2.5.x code doesn't compile on 2.4.x, thus there are version
> #ifdefs in my device driver tarballs.  You just don't see that because
> some perl magic filteres out the 2.4 code when submitting patches for
> 2.5.x (and visa versa ...).  If you fetch the tarballs from bytesex.org
> you'll see the #ifdefs in the driver code.

So what about stripping #include <linux/version.h> in your script aswell? :)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] v4l: videobuf update
  2003-04-02 18:36     ` Christoph Hellwig
@ 2003-04-02 19:19       ` Gerd Knorr
  0 siblings, 0 replies; 6+ messages in thread
From: Gerd Knorr @ 2003-04-02 19:19 UTC (permalink / raw)
  To: Christoph Hellwig, Linus Torvalds, Kernel List

On Wed, Apr 02, 2003 at 07:36:36PM +0100, Christoph Hellwig wrote:
> > Because the 2.5.x code doesn't compile on 2.4.x, thus there are version
> > #ifdefs in my device driver tarballs.  You just don't see that because
> > some perl magic filteres out the 2.4 code when submitting patches for
> > 2.5.x (and visa versa ...).  If you fetch the tarballs from bytesex.org
> > you'll see the #ifdefs in the driver code.
> 
> So what about stripping #include <linux/version.h> in your script aswell? :)

In video-buf.c it can likely deleted without side effects, but just
removing it unconditionally everythere likely doesn't work because my
drivers use the KERNEL_VERSION() macro for the device driver version as
well (see drivers/media/video/bttvp.h for example).

  Gerd

-- 
Michael Moore for president!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [patch] v4l: videobuf update
@ 2003-10-07 10:52 Gerd Knorr
  0 siblings, 0 replies; 6+ messages in thread
From: Gerd Knorr @ 2003-10-07 10:52 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton, Kernel List, Michael Hunold

  Hi,

This patch updates the videobuf module used by the bttv, saa7134 and
saa7146 drivers.  Related updates for the three drivers will follow.

Changes:
  * adds support for overlays (i.e. PCI-PCI DMA transfers).
  * adds support for userspace DMA.
  * fixes bug in the read() helper function (catch I/O errors). 

Please apply,

  Gerd

diff -u linux-2.6.0-test6/drivers/media/video/video-buf.c linux/drivers/media/video/video-buf.c
--- linux-2.6.0-test6/drivers/media/video/video-buf.c	2003-10-06 17:45:22.000000000 +0200
+++ linux/drivers/media/video/video-buf.c	2003-10-06 17:48:02.000000000 +0200
@@ -197,6 +197,20 @@
 	return 0;
 }
 
+int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction,
+			      dma_addr_t addr, int nr_pages)
+{
+	dprintk(1,"init overlay [%d pages @ bus 0x%lx]\n",
+		nr_pages,(unsigned long)addr);
+	dma->direction = direction;
+	if (0 == addr)
+		return -EINVAL;
+
+	dma->bus_addr = addr;
+	dma->nr_pages = nr_pages;
+	return 0;
+}
+
 int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma)
 {
 	int err;
@@ -218,12 +232,23 @@
 		dma->sglist = videobuf_vmalloc_to_sg
 			(dma->vmalloc,dma->nr_pages);
 	}
+	if (dma->bus_addr) {
+		dma->sglist = kmalloc(sizeof(struct scatterlist), GFP_KERNEL);
+		if (NULL != dma->sglist) {
+			dma->sglen  = 1;
+			sg_dma_address(&dma->sglist[0]) = dma->bus_addr & ~PAGE_MASK;
+			dma->sglist[0].offset           = dma->bus_addr & PAGE_MASK;
+			sg_dma_len(&dma->sglist[0])     = dma->nr_pages * PAGE_SIZE;
+		}
+	}
 	if (NULL == dma->sglist) {
 		dprintk(1,"scatterlist is NULL\n");
 		return -ENOMEM;
 	}
-	dma->sglen = pci_map_sg(dev,dma->sglist,dma->nr_pages,
-				dma->direction);
+
+	if (!dma->bus_addr)
+		dma->sglen = pci_map_sg(dev,dma->sglist,dma->nr_pages,
+					dma->direction);
 	return 0;
 }
 
@@ -232,7 +257,8 @@
 	if (!dma->sglen)
 		BUG();
 
-	pci_dma_sync_sg(dev,dma->sglist,dma->nr_pages,dma->direction);
+	if (!dma->bus_addr)
+		pci_dma_sync_sg(dev,dma->sglist,dma->nr_pages,dma->direction);
 	return 0;
 }
 
@@ -241,7 +267,8 @@
 	if (!dma->sglen)
 		return 0;
 
-	pci_unmap_sg(dev,dma->sglist,dma->nr_pages,dma->direction);
+	if (!dma->bus_addr)
+		pci_unmap_sg(dev,dma->sglist,dma->nr_pages,dma->direction);
 	kfree(dma->sglist);
 	dma->sglist = NULL;
 	dma->sglen = 0;
@@ -266,6 +293,9 @@
 		vfree(dma->vmalloc);
 		dma->vmalloc = NULL;
 	}
+	if (dma->bus_addr) {
+		dma->bus_addr = 0;
+	}
 	dma->direction = PCI_DMA_NONE;
 	return 0;
 }
@@ -309,27 +339,48 @@
 }
 
 int
-videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb)
+videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb,
+		struct v4l2_framebuffer *fbuf)
 {
 	int err,pages;
+	dma_addr_t bus;
 
-	if (0 == vb->baddr) {
-		/* no userspace addr -- kernel bounce buffer */
+	switch (vb->memory) {
+	case V4L2_MEMORY_MMAP:
+	case V4L2_MEMORY_USERPTR:
+		if (0 == vb->baddr) {
+			/* no userspace addr -- kernel bounce buffer */
+			pages = PAGE_ALIGN(vb->size) >> PAGE_SHIFT;
+			err = videobuf_dma_init_kernel(&vb->dma,PCI_DMA_FROMDEVICE,
+						       pages);
+			if (0 != err)
+				return err;
+		} else {
+			/* dma directly to userspace */
+			err = videobuf_dma_init_user(&vb->dma,PCI_DMA_FROMDEVICE,
+						     vb->baddr,vb->bsize);
+			if (0 != err)
+				return err;
+		}
+		break;
+	case V4L2_MEMORY_OVERLAY:
+		if (NULL == fbuf)
+			return -EINVAL;
+		/* FIXME: need sanity checks for vb->boff */
+		bus   = (dma_addr_t)fbuf->base + vb->boff;
 		pages = PAGE_ALIGN(vb->size) >> PAGE_SHIFT;
-		err = videobuf_dma_init_kernel(&vb->dma,PCI_DMA_FROMDEVICE,
-					       pages);
-		if (0 != err)
-			return err;
-	} else {
-		/* dma directly to userspace */
-		err = videobuf_dma_init_user(&vb->dma,PCI_DMA_FROMDEVICE,
-					     vb->baddr,vb->bsize);
+		err = videobuf_dma_init_overlay(&vb->dma,PCI_DMA_FROMDEVICE,
+						bus, pages);
 		if (0 != err)
 			return err;
+		break;
+	default:
+		BUG();
 	}
 	err = videobuf_dma_pci_map(pci,&vb->dma);
 	if (0 != err)
 		return err;
+		
 	return 0;
 }
 
@@ -447,11 +498,26 @@
 {
 	b->index    = vb->i;
 	b->type     = type;
-	b->m.offset = vb->boff;
-	b->length   = vb->bsize;
+
+	b->memory   = vb->memory;
+	switch (b->memory) {
+	case V4L2_MEMORY_MMAP:
+		b->m.offset  = vb->boff;
+		b->length    = vb->bsize;
+		break;
+	case V4L2_MEMORY_USERPTR:
+		b->m.userptr = vb->baddr;
+		b->length    = vb->bsize;
+		break;
+	case V4L2_MEMORY_OVERLAY:
+		b->m.offset  = vb->boff;
+		break;
+	}
+
 	b->flags    = 0;
 	if (vb->map)
 		b->flags |= V4L2_BUF_FLAG_MAPPED;
+
 	switch (vb->state) {
 	case STATE_PREPARED:
 	case STATE_QUEUED:
@@ -467,6 +533,7 @@
 		/* nothing */
 		break;
 	}
+
 	b->field     = vb->field;
 	b->timestamp = vb->ts;
 	b->bytesused = vb->size;
@@ -484,6 +551,10 @@
 		return -EINVAL;
 	if (req->count < 1)
 		return -EINVAL;
+	if (req->memory != V4L2_MEMORY_MMAP     &&
+	    req->memory != V4L2_MEMORY_USERPTR  &&
+	    req->memory != V4L2_MEMORY_OVERLAY)
+		return -EINVAL;
 
 	down(&q->lock);
 	count = req->count;
@@ -495,10 +566,10 @@
 	dprintk(1,"reqbufs: bufs=%d, size=0x%x [%d pages total]\n",
 		count, size, (count*size)>>PAGE_SHIFT);
 
-	retval = videobuf_mmap_setup(file,q,count,size);
+	retval = videobuf_mmap_setup(file,q,count,size,req->memory);
 	if (retval < 0)
 		goto done;
-	req->type  = q->type;
+
 	req->count = count;
 
  done:
@@ -540,12 +611,29 @@
 	buf = q->bufs[b->index];
 	if (NULL == buf)
 		goto done;
-	if (0 == buf->baddr)
+	if (buf->memory != b->memory)
 		goto done;
 	if (buf->state == STATE_QUEUED ||
 	    buf->state == STATE_ACTIVE)
 		goto done;
 
+	switch (b->memory) {
+	case V4L2_MEMORY_MMAP:
+		if (0 == buf->baddr)
+			goto done;
+		break;
+	case V4L2_MEMORY_USERPTR:
+		if (b->length < buf->bsize)
+			goto done;
+		buf->baddr = b->m.userptr;
+		break;
+	case V4L2_MEMORY_OVERLAY:
+		buf->boff = b->m.offset;
+		break;
+	default:
+		goto done;
+	}
+
 	field = videobuf_next_field(q);
 	retval = q->ops->buf_prepare(file,buf,field);
 	if (0 != retval)
@@ -663,8 +751,9 @@
 	if (NULL == q->read_buf)
 		goto done;
 
-	q->read_buf->baddr = (unsigned long)data;
-        q->read_buf->bsize = count;
+	q->read_buf->memory = V4L2_MEMORY_USERPTR;
+	q->read_buf->baddr  = (unsigned long)data;
+        q->read_buf->bsize  = count;
 	field = videobuf_next_field(q);
 	retval = q->ops->buf_prepare(file,q->read_buf,field);
 	if (0 != retval)
@@ -719,6 +808,7 @@
 		q->read_buf = videobuf_alloc(q->msize);
 		if (NULL == q->read_buf)
 			goto done;
+		q->read_buf->memory = V4L2_MEMORY_USERPTR;
 		field = videobuf_next_field(q);
 		retval = q->ops->buf_prepare(file,q->read_buf,field);
 		if (0 != retval)
@@ -780,7 +870,7 @@
 		count = VIDEO_MAX_FRAME;
 	size = PAGE_ALIGN(size);
 
-	err = videobuf_mmap_setup(file, q, count, size);
+	err = videobuf_mmap_setup(file, q, count, size, V4L2_MEMORY_USERPTR);
 	if (err)
 		return err;
 	for (i = 0; i < count; i++) {
@@ -850,31 +940,36 @@
 			break;
 		}
 
-		if (vbihack) {
-			/* dirty, undocumented hack -- pass the frame counter
-			 * within the last four bytes of each vbi data block.
-			 * We need that one to maintain backward compatibility
-			 * to all vbi decoding software out there ... */
-			fc  = (unsigned int*)q->read_buf->dma.vmalloc;
-			fc += (q->read_buf->size>>2) -1;
-			*fc = q->read_buf->field_count >> 1;
-			dprintk(1,"vbihack: %d\n",*fc);
-		}
-
-		/* copy stuff */
-		bytes = count;
-		if (bytes > q->read_buf->size - q->read_off)
-			bytes = q->read_buf->size - q->read_off;
-		if (copy_to_user(data + retval,
-				 q->read_buf->dma.vmalloc + q->read_off,
-				 bytes)) {
-			if (0 == retval)
-				retval = -EFAULT;
-			break;
+		if (q->read_buf->state == STATE_DONE) {
+			if (vbihack) {
+				/* dirty, undocumented hack -- pass the frame counter
+				 * within the last four bytes of each vbi data block.
+				 * We need that one to maintain backward compatibility
+				 * to all vbi decoding software out there ... */
+				fc  = (unsigned int*)q->read_buf->dma.vmalloc;
+				fc += (q->read_buf->size>>2) -1;
+				*fc = q->read_buf->field_count >> 1;
+				dprintk(1,"vbihack: %d\n",*fc);
+			}
+			
+			/* copy stuff */
+			bytes = count;
+			if (bytes > q->read_buf->size - q->read_off)
+				bytes = q->read_buf->size - q->read_off;
+			if (copy_to_user(data + retval,
+					 q->read_buf->dma.vmalloc + q->read_off,
+					 bytes)) {
+				if (0 == retval)
+					retval = -EFAULT;
+				break;
+			}
+			count       -= bytes;
+			retval      += bytes;
+			q->read_off += bytes;
+		} else {
+			/* some error -- skip buffer */
+			q->read_off = q->read_buf->size;
 		}
-		count       -= bytes;
-		retval      += bytes;
-		q->read_off += bytes;
 
 		/* requeue buffer when done with copying */
 		if (q->read_off == q->read_buf->size) {
@@ -1004,7 +1099,8 @@
 };
 
 int videobuf_mmap_setup(struct file *file, struct videobuf_queue *q,
-			unsigned int bcount, unsigned int bsize)
+			unsigned int bcount, unsigned int bsize,
+			enum v4l2_memory memory)
 {
 	unsigned int i;
 	int err;
@@ -1012,12 +1108,21 @@
 	err = videobuf_mmap_free(file,q);
 	if (0 != err)
 		return err;
-	
+
 	for (i = 0; i < bcount; i++) {
 		q->bufs[i] = videobuf_alloc(q->msize);
-		q->bufs[i]->i     = i;
-		q->bufs[i]->boff  = bsize * i;
-		q->bufs[i]->bsize = bsize;
+		q->bufs[i]->i      = i;
+		q->bufs[i]->memory = memory;
+		q->bufs[i]->bsize  = bsize;
+		switch (memory) {
+		case V4L2_MEMORY_MMAP:
+			q->bufs[i]->boff  = bsize * i;
+			break;
+		case V4L2_MEMORY_USERPTR:
+		case V4L2_MEMORY_OVERLAY:
+			/* nothing */
+			break;
+		};
 	}
 	dprintk(1,"mmap setup: %d buffers, %d bytes each\n",
 		bcount,bsize);
@@ -1063,6 +1168,8 @@
 	for (first = 0; first < VIDEO_MAX_FRAME; first++) {
 		if (NULL == q->bufs[first])
 			continue;
+		if (V4L2_MEMORY_MMAP != q->bufs[first]->memory)
+			continue;
 		if (q->bufs[first]->boff == (vma->vm_pgoff << PAGE_SHIFT))
 			break;
 	}
@@ -1076,6 +1183,8 @@
 	for (size = 0, last = first; last < VIDEO_MAX_FRAME; last++) {
 		if (NULL == q->bufs[last])
 			continue;
+		if (V4L2_MEMORY_MMAP != q->bufs[last]->memory)
+			continue;
 		if (q->bufs[last]->map) {
 			retval = -EBUSY;
 			goto done;
@@ -1124,6 +1233,7 @@
 
 EXPORT_SYMBOL_GPL(videobuf_dma_init_user);
 EXPORT_SYMBOL_GPL(videobuf_dma_init_kernel);
+EXPORT_SYMBOL_GPL(videobuf_dma_init_overlay);
 EXPORT_SYMBOL_GPL(videobuf_dma_pci_map);
 EXPORT_SYMBOL_GPL(videobuf_dma_pci_sync);
 EXPORT_SYMBOL_GPL(videobuf_dma_pci_unmap);
diff -u linux-2.6.0-test6/include/media/video-buf.h linux/include/media/video-buf.h
--- linux-2.6.0-test6/include/media/video-buf.h	2003-10-06 17:45:24.000000000 +0200
+++ linux/include/media/video-buf.h	2003-10-06 17:48:02.000000000 +0200
@@ -43,17 +43,17 @@
  * A small set of helper functions to manage buffers (both userland
  * and kernel) for DMA.
  *
- * videobuf_init_*_dmabuf()
+ * videobuf_dma_init_*()
  *	creates a buffer.  The userland version takes a userspace
  *	pointer + length.  The kernel version just wants the size and
  *	does memory allocation too using vmalloc_32().
  *
- * videobuf_pci_*_dmabuf()
+ * videobuf_dma_pci_*()
  *	see Documentation/DMA-mapping.txt, these functions to
  *	basically the same.  The map function does also build a
  *	scatterlist for the buffer (and unmap frees it ...)
  *
- * videobuf_free_dmabuf()
+ * videobuf_dma_free()
  *	no comment ...
  *
  */
@@ -66,6 +66,9 @@
 	/* for kernel buffers */
 	void                *vmalloc;
 
+	/* for overlay buffers (pci-pci dma) */
+	dma_addr_t          bus_addr;
+
 	/* common */
 	struct scatterlist  *sglist;
 	int                 sglen;
@@ -77,6 +80,8 @@
 			   unsigned long data, unsigned long size);
 int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction,
 			     int nr_pages);
+int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction,
+			      dma_addr_t addr, int nr_pages);
 int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma);
 int videobuf_dma_pci_sync(struct pci_dev *dev,
 			  struct videobuf_dmabuf *dma);
@@ -133,6 +138,7 @@
 	/* info about the buffer */
 	unsigned int            width;
 	unsigned int            height;
+	unsigned int            bytesperline; /* use only if != 0 */
 	unsigned long           size;
 	enum v4l2_field         field;
 	enum videobuf_state     state;
@@ -140,7 +146,8 @@
 	struct list_head        stream;  /* QBUF/DQBUF list */
 
 	/* for mmap'ed buffers */
-	size_t                  boff;    /* buffer offset (mmap) */
+	enum v4l2_memory        memory;
+	size_t                  boff;    /* buffer offset (mmap + overlay) */
 	size_t                  bsize;   /* buffer size */
 	unsigned long           baddr;   /* buffer addr (userland ptr!) */
 	struct videobuf_mapping *map;
@@ -185,7 +192,8 @@
 
 void* videobuf_alloc(unsigned int size);
 int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr);
-int videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb);
+int videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb,
+		    struct v4l2_framebuffer *fbuf);
 
 void videobuf_queue_init(struct videobuf_queue *q,
 			 struct videobuf_queue_ops *ops,
@@ -221,7 +229,8 @@
 				  poll_table *wait);
 
 int videobuf_mmap_setup(struct file *file, struct videobuf_queue *q,
-			unsigned int bcount, unsigned int bsize);
+			unsigned int bcount, unsigned int bsize,
+			enum v4l2_memory memory);
 int videobuf_mmap_free(struct file *file, struct videobuf_queue *q);
 int videobuf_mmap_mapper(struct vm_area_struct *vma,
 			 struct videobuf_queue *q);

-- 
You have a new virus in /var/mail/kraxel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-10-07 10:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-02 16:36 [patch] v4l: videobuf update Gerd Knorr
2003-04-02 18:06 ` Christoph Hellwig
2003-04-02 18:35   ` Gerd Knorr
2003-04-02 18:36     ` Christoph Hellwig
2003-04-02 19:19       ` Gerd Knorr
  -- strict thread matches above, loose matches on Subject: below --
2003-10-07 10:52 Gerd Knorr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox