Skip to contentSkip to conversation

use videobuf2 framework for drivers/staging/dt3155v4l driver

PATCH Applied Marin Mitov 2 participants 5 messages May 28, 2011 – Jun 29, 2011 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 use videobuf2 framework for drivers/staging/dt3155v4l driver

Hi Greg,

This patch transforms drivers/staging/dt3155v4l driver to use videobuf2 framework. Tested and works with "xawtv -f".

Either streaming API or read method should be selected during kernel configuration.

If both are selected into the driver (not possible without another patching), either due to my misunderstanding or problems in xawtv (or both), I get kernel panic after some start/stop of xawtv (not strictly reproducible).

Please apply.

Regards,

Marin Mitov

========================================================================

drivers/staging/dt3155v4l/Kconfig +9 -1
diff -up b/drivers/staging/dt3155v4l/Kconfig a/drivers/staging/dt3155v4l/Kconfig
@@ -1,7 +1,7 @@
 config VIDEO_DT3155
 	tristate "DT3155 frame grabber, Video4Linux interface"
 	depends on PCI && VIDEO_DEV && VIDEO_V4L2
-	select VIDEOBUF_DMA_CONTIG
+	select VIDEOBUF2_DMA_CONTIG
 	default n
 	---help---
 	  Enables dt3155 device driver for the DataTranslation DT3155 frame grabber.
@@ -18,3 +18,11 @@ config DT3155_CCIR
 	---help---
 	  Select it for CCIR/50Hz (European region),
 	  or leave it unselected for RS-170/60Hz (North America).
+
+config DT3155_STREAMING
+	bool "Selects streaming capture method"
+	depends on VIDEO_DT3155
+	default y
+	---help---
+	  Select it if you want to use streaming of memory mapped buffers
+	  or leave it unselected if you want to use read method (one copy more).
drivers/staging/dt3155v4l/dt3155v4l.c +166 -314

761 lines not on this page · raw message

drivers/staging/dt3155v4l/dt3155v4l.h +6 -16
diff -up b/drivers/staging/dt3155v4l/dt3155v4l.h a/drivers/staging/dt3155v4l/dt3155v4l.h
@@ -179,18 +179,13 @@ struct dt3155_stats {
  * struct dt3155_priv - private data structure
  *
  * @vdev:		pointer to video_device structure
- * @acq_fp		pointer to filp that starts acquisition
- * @streaming		streaming is negotiated
  * @pdev:		pointer to pci_dev structure
- * @vidq		pointer to videobuf_queue structure
+ * @q			pointer to vb2_queue structure
  * @curr_buf:		pointer to curren buffer
- * @thread		pointer to worker thraed
+ * @mux:		mutex to protect the instance
  * @irq_handler:	irq handler for the driver
- * @qt_ops		local copy of dma-contig qtype_ops
  * @dmaq		queue for dma buffers
- * @do_dma		wait queue of the kernel thread
- * @mux:		mutex to protect the instance
- * @lock		spinlock for videobuf queues
+ * @lock		spinlock for dma queue
  * @field_count		fields counter
  * @stats:		statistics structure
  * @users		open count
@@ -200,17 +195,12 @@ struct dt3155_stats {
  */
 struct dt3155_priv {
 	struct video_device *vdev;
-	struct file *acq_fp;
-	int streaming;
 	struct pci_dev *pdev;
-	struct videobuf_queue *vidq;
-	struct videobuf_buffer *curr_buf;
-	struct task_struct *thread;
+	struct vb2_queue *q;
+	struct vb2_buffer *curr_buf;
+	struct mutex mux;
 	irq_handler_t irq_handler;
-	struct videobuf_qtype_ops qt_ops;
 	struct list_head dmaq;
-	wait_queue_head_t do_dma;
-	struct mutex mux;
 	spinlock_t lock;
 	unsigned int field_count;
 	struct dt3155_stats stats;
Applied
#1 lore raw

Re: [PATCH] staging: use videobuf2 framework for drivers/staging/dt3155v4l driver

Quoted 4 lines · Marin Mitov

This patch transforms drivers/staging/dt3155v4l driver to use videobuf2 framework. Tested and works with "xawtv -f".

Either streaming API or read method should be selected during kernel configuration.

I've applied this, but why would you ever not want to use the streaming api?

thanks,

greg k-h

#2 lore raw

Re: [PATCH] staging: use videobuf2 framework for drivers/staging/dt3155v4l driver

Quoted 8 lines · Greg KH
Quoted 4 lines · Marin Mitov

This patch transforms drivers/staging/dt3155v4l driver to use videobuf2 framework. Tested and works with "xawtv -f".

Either streaming API or read method should be selected during kernel configuration.

I've applied this, but why would you ever not want to use the streaming api?

There are no reasons for that, sure, but for now xawtv do not work if both are specified in the driver. I have to debug it.

Regards.

Marin Mitov

Quoted 5 lines

thanks,

greg k-h

#3 lore raw

Re: [PATCH] staging: use videobuf2 framework for drivers/staging/dt3155v4l driver

Quoted 5 lines · Marin Mitov
Quoted 4 lines · Greg KH
Quoted 3 lines · Marin Mitov

This patch transforms drivers/staging/dt3155v4l driver to use videobuf2 framework. Tested and works with "xawtv -f".

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Either streaming API or read method should be selected during kernel configuration.

I've applied this, but why would you ever not want to use the streaming api?

There are no reasons for that, sure, but for now xawtv do not work if both are specified in the driver. I have to debug it.

Ok, but why not just remove the read method then? Or do some userspace programs still require it?

greg k-h

#4 lore raw

Re: [PATCH] staging: use videobuf2 framework for drivers/staging/dt3155v4l driver

Quoted 8 lines · Greg KH
Quoted 7 lines · Marin Mitov
Quoted 6 lines · Greg KH
Quoted 4 lines · Marin Mitov

This patch transforms drivers/staging/dt3155v4l driver to use videobuf2 framework. Tested and works with "xawtv -f".

Either streaming API or read method should be selected during kernel configuration.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I've applied this, but why would you ever not want to use the streaming api?

There are no reasons for that, sure, but for now xawtv do not work if both are specified in the driver. I have to debug it.

Ok, but why not just remove the read method then? Or do some userspace programs still require it?

In current version if you select streaming API you effectively remove read method. If you select read method you effectively remove streaming API. At lest this is what userland programs are seeing as driver capabilities.

For now I see some changes in videobuf2-core are in discussion. When they become part of the kernel I will test the driver again.

Thanks.

Marin Mitov

Quoted 3 lines

greg k-h