Re: [v4l-dvb-maintainer] [RFC] V4L1 API removal proposal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Em Seg, 2006-04-10 às 10:29 +0200, Michael Hunold escreveu:
Hi, Michael,
> Hi Mauro,
> 
> On 10.04.2006 00:36 Mauro Carvalho Chehab said the following:
> > We should fix all obsolete V4L1 drivers to V4L2 API. This affects
> > several V4L drivers, and a few DVB drivers, based on SAA7146.
> 
> It would be nice to have a list of which drivers are affected and to
> what degree (ie. if only minor things need to be changed or if the whole
> driver is affected).
> 
> Could you try to create such a list?
In the case of saa7146, I have already a patch to the core, since the
only stuff used there is VIDEO_MODE_PAL and VIDEO_MODE_NTSC. But mxb.c
still use the old DECODER_* ioctl. Those should be replaced by
VIDIOC_INT_* as defined on v4l2-common.h. You may look saa7127.c, for
example, for an example on how to use it. Shouldn't be difficult. If you
have doubts, please ask at the list.

For et61x251_sensor.h,  sn9c102_sensor.h and zc0301_sensor.h, there are
some dependencies on videodev.h. I didn't go further to investigate, but
it seems also easy to solve.

Zoran 36067 and bttv driver implements both V4L1 and V4L2 at the core.
V4L1 should be removed and called  v4l_compat_translate_ioctl instead.

For BTTV, we had a patch in the past removing all old VIDIOCfoo stuff
and fixing corresponding stuff on other bttv files. This patch should be
reworked due to several changes at bttv and due to audio routing
patches.

For Zoran 36067, This would mean to fix all decoder modules that still
use DECODER_* and VIDEO_MODE_*.

For the other drivers, more work will be required, since they don't have
any V4L2 API support.

For those, I'm creating a new videodev2 struct, that will handle V4L2
ioctl parsing, calling several callbacks. This may be useful for the
conversion process. It is still unfinished.

A preview can be seen at http://linuxtv.org/hg/~mchehab/videodev2. I
intend to include also an easy way to use videobuf at the newer way, so
that the hardest part of the migration (memory allocation/handling) will
be handled by core, requiring almost no code at the drivers.

I expect to finish by the end of the week.

> 
> > If VIDEO_V4L1 is unselected, all drivers that use videodev.h or
> > video_decoder.h instead of videodev2.h are hidden, so, only good V4L2
> > drivers will be available.
> 
> For example, my MXB driver uses video_decoder.h to drive the saa7111
> video decoder. What changes are necessary here?
The best way is to use instead saa7115. It already supports
saa7113/7114/7115 chips and seem to be easy to make it work with saa7111
also. As an side effect, it can handle multiple video standards that
were broken like PAL/M, PAL/N, PAL/60 and NTSC/Jp.
> 
> IMO video_decoder can be dropped completely, because I know that the MXB
> has a saa7111 and I know which features are used.
> 
> Will there be a new dedicated saa7111 driver that understands v4l2
> ioctls then?
> 
> Or should I got and implement the few necessary i2c command sequences
> directly? (probably not)
Please don't implement directly. for saa7115 to work with saa7111, you
need to create a V4L2_IDENT_SAA7111 at v4l2-common, include the code at
saa7111 to detect it, based on chip_id, at saa7115_attach function, and
take a look on each test for V4L2_IDENT_foo. Also, you may need to
include saa7111 struct there, if saa7113 cannot fit well. Shoudn't take
much time.

Cheers, 
Mauro.
diff -r aa1faaddab8b linux/drivers/media/common/saa7146_fops.c
--- a/linux/drivers/media/common/saa7146_fops.c	Sat Apr  8 16:06:16 2006 -0300
+++ b/linux/drivers/media/common/saa7146_fops.c	Sun Apr  9 09:53:54 2006 -0300
@@ -456,7 +456,7 @@ static void vv_callback(struct saa7146_d
 
 static struct video_device device_template =
 {
-	.hardware	= VID_HARDWARE_SAA7146,
+	.hardware	= 0,
 	.fops		= &video_fops,
 	.minor		= -1,
 };
diff -r aa1faaddab8b linux/drivers/media/common/saa7146_video.c
--- a/linux/drivers/media/common/saa7146_video.c	Sat Apr  8 16:06:16 2006 -0300
+++ b/linux/drivers/media/common/saa7146_video.c	Sun Apr  9 09:53:54 2006 -0300
@@ -1,5 +1,9 @@
 #include "compat.h"
 #include <media/saa7146_vv.h>
+#if CONFIG_VIDEO_V4L2
+/* Include V4L1 specific functions. Should be removed soon */
+#include <linux/videodev.h>
+#endif
 
 static int max_memory = 32;
 
@@ -1189,6 +1193,7 @@ int saa7146_video_do_ioctl(struct inode 
 		}
 		return err;
 	}
+#ifdef HAVE_V4L1
 	case VIDIOCGMBUF:
 	{
 		struct video_mbuf *mbuf = arg;
@@ -1217,6 +1222,7 @@ int saa7146_video_do_ioctl(struct inode 
 		mutex_unlock(&q->lock);
 		return 0;
 	}
+#endif
 	default:
 		return v4l_compat_translate_ioctl(inode,file,cmd,arg,
 						  saa7146_video_do_ioctl);
diff -r aa1faaddab8b linux/drivers/media/dvb/ttpci/av7110.c
--- a/linux/drivers/media/dvb/ttpci/av7110.c	Sat Apr  8 16:06:16 2006 -0300
+++ b/linux/drivers/media/dvb/ttpci/av7110.c	Sun Apr  9 09:53:54 2006 -0300
@@ -2547,7 +2547,7 @@ static int __devinit av7110_attach(struc
 	mutex_init(&av7110->osd_mutex);
 
 	/* TV standard */
-	av7110->vidmode = tv_standard == 1 ? VIDEO_MODE_NTSC : VIDEO_MODE_PAL;
+	av7110->vidmode = tv_standard == 1 ? V4L2_STD_NTSC : V4L2_STD_PAL;
 
 	/* ARM "watchdog" */
 	init_waitqueue_head(&av7110->arm_wait);
diff -r aa1faaddab8b linux/drivers/media/dvb/ttpci/av7110_av.c
--- a/linux/drivers/media/dvb/ttpci/av7110_av.c	Sat Apr  8 16:06:16 2006 -0300
+++ b/linux/drivers/media/dvb/ttpci/av7110_av.c	Sun Apr  9 09:53:54 2006 -0300
@@ -342,10 +342,10 @@ int av7110_set_vidmode(struct av7110 *av
 
 
 static int sw2mode[16] = {
-	VIDEO_MODE_PAL, VIDEO_MODE_NTSC, VIDEO_MODE_NTSC, VIDEO_MODE_PAL,
-	VIDEO_MODE_NTSC, VIDEO_MODE_NTSC, VIDEO_MODE_PAL, VIDEO_MODE_NTSC,
-	VIDEO_MODE_PAL, VIDEO_MODE_PAL, VIDEO_MODE_PAL, VIDEO_MODE_PAL,
-	VIDEO_MODE_PAL, VIDEO_MODE_PAL, VIDEO_MODE_PAL, VIDEO_MODE_PAL,
+	V4L2_STD_PAL, V4L2_STD_NTSC, V4L2_STD_NTSC, V4L2_STD_PAL,
+	V4L2_STD_NTSC, V4L2_STD_NTSC, V4L2_STD_PAL, V4L2_STD_NTSC,
+	V4L2_STD_PAL, V4L2_STD_PAL, V4L2_STD_PAL, V4L2_STD_PAL,
+	V4L2_STD_PAL, V4L2_STD_PAL, V4L2_STD_PAL, V4L2_STD_PAL,
 };
 
 static int get_video_format(struct av7110 *av7110, u8 *buf, int count)
diff -r aa1faaddab8b linux/drivers/media/dvb/ttpci/av7110_v4l.c
--- a/linux/drivers/media/dvb/ttpci/av7110_v4l.c	Sat Apr  8 16:06:16 2006 -0300
+++ b/linux/drivers/media/dvb/ttpci/av7110_v4l.c	Sun Apr  9 09:53:54 2006 -0300
@@ -857,11 +857,11 @@ static int std_callback(struct saa7146_d
 	struct av7110 *av7110 = (struct av7110*) dev->ext_priv;
 
 	if (std->id & V4L2_STD_PAL) {
-		av7110->vidmode = VIDEO_MODE_PAL;
+		av7110->vidmode = V4L2_STD_PAL;
 		av7110_set_vidmode(av7110, av7110->vidmode);
 	}
 	else if (std->id & V4L2_STD_NTSC) {
-		av7110->vidmode = VIDEO_MODE_NTSC;
+		av7110->vidmode = V4L2_STD_NTSC;
 		av7110_set_vidmode(av7110, av7110->vidmode);
 	}
 	else
diff -r aa1faaddab8b linux/drivers/media/video/mxb.c
--- a/linux/drivers/media/video/mxb.c	Sat Apr  8 16:06:16 2006 -0300
+++ b/linux/drivers/media/video/mxb.c	Sun Apr  9 09:53:54 2006 -0300
@@ -27,6 +27,7 @@
 #include <media/saa7146_vv.h>
 #include <media/tuner.h>
 #include <linux/video_decoder.h>
+#include <linux/videodev.h>
 #include <media/v4l2-common.h>
 
 #include "mxb.h"
diff -r aa1faaddab8b linux/drivers/media/video/stradis.c
--- a/linux/drivers/media/video/stradis.c	Sat Apr  8 16:06:16 2006 -0300
+++ b/linux/drivers/media/video/stradis.c	Sun Apr  9 09:53:54 2006 -0300
@@ -1917,7 +1917,7 @@ static struct video_device saa_template 
 static struct video_device saa_template = {
 	.name = "SAA7146A",
 	.type = VID_TYPE_CAPTURE | VID_TYPE_OVERLAY,
-	.hardware = VID_HARDWARE_SAA7146,
+	.hardware = 0,
 	.fops = &saa_fops,
 	.minor = -1,
 };
diff -r aa1faaddab8b linux/include/media/saa7146_vv.h
--- a/linux/include/media/saa7146_vv.h	Sat Apr  8 16:06:16 2006 -0300
+++ b/linux/include/media/saa7146_vv.h	Sun Apr  9 09:53:54 2006 -0300
@@ -1,7 +1,7 @@
 #ifndef __SAA7146_VV__
 #define __SAA7146_VV__
 
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
 
 #include <media/saa7146.h>
 #include <media/video-buf.h>
_______________________________________________

linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux