Skip to contentSkip to conversation

ispvideo: Add support for G/S/ENUM_STD ioctl

PATCH In review Deepthy Ravi 7 participants 17 messages Sep 8, 2011 – Sep 28, 2011 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 4/8 ispvideo: Add support for G/S/ENUM_STD ioctl

From: Vaibhav Hiremath <[email protected]>

In order to support TVP5146 (for that matter any video decoder), it is important to support G/S/ENUM_STD ioctl on /dev/videoX device node.

---
 drivers/media/video/omap3isp/ispvideo.c |   98 ++++++++++++++++++++++++++++++-
 drivers/media/video/omap3isp/ispvideo.h |    1 +
 2 files changed, 98 insertions(+), 1 deletions(-)
drivers/media/video/omap3isp/ispvideo.c +97 -1
index d5b8236..ff0ffed 100644
@@ -37,6 +37,7 @@
 #include <plat/iovmm.h>
 #include <plat/omap-pm.h>
 
+#include <media/tvp514x.h>
 #include "ispvideo.h"
 #include "isp.h"
 
@@ -1136,7 +1137,97 @@ isp_video_g_input(struct file *file, void *fh, unsigned int *input)
 static int
 isp_video_s_input(struct file *file, void *fh, unsigned int input)
 {
-	return input == 0 ? 0 : -EINVAL;
+	struct isp_video *video = video_drvdata(file);
+	struct media_entity *entity = &video->video.entity;
+	struct media_entity_graph graph;
+	struct v4l2_subdev *subdev;
+	struct v4l2_routing route;
+	int ret = 0;
+
+	media_entity_graph_walk_start(&graph, entity);
+	while ((entity = media_entity_graph_walk_next(&graph))) {
+		if (media_entity_type(entity) ==
+				MEDIA_ENT_T_V4L2_SUBDEV) {
+			subdev = media_entity_to_v4l2_subdev(entity);
+			if (subdev != NULL) {
+				if (input == 0)
+					route.input = INPUT_CVBS_VI4A;
+				else
+					route.input = INPUT_SVIDEO_VI2C_VI1C;
+				route.output = 0;
+				ret = v4l2_subdev_call(subdev, video, s_routing,
+						route.input, route.output, 0);
+				if (ret < 0 && ret != -ENOIOCTLCMD)
+					return ret;
+			}
+		}
+	}
+
+	return 0;
+}
+
+static int isp_video_querystd(struct file *file, void *fh, v4l2_std_id *a)
+{
+	struct isp_video_fh *vfh = to_isp_video_fh(fh);
+	struct isp_video *video = video_drvdata(file);
+	struct media_entity *entity = &video->video.entity;
+	struct media_entity_graph graph;
+	struct v4l2_subdev *subdev;
+	int ret = 0;
+
+	media_entity_graph_walk_start(&graph, entity);
+	while ((entity = media_entity_graph_walk_next(&graph))) {
+		if (media_entity_type(entity) ==
+				MEDIA_ENT_T_V4L2_SUBDEV) {
+			subdev = media_entity_to_v4l2_subdev(entity);
+			if (subdev != NULL) {
+				ret = v4l2_subdev_call(subdev, video, querystd,
+						a);
+				if (ret < 0 && ret != -ENOIOCTLCMD)
+					return ret;
+			}
+		}
+	}
+
+	vfh->standard.id = *a;
+	return 0;
+}
+
+static int isp_video_g_std(struct file *file, void *fh, v4l2_std_id *norm)
+{
+	struct isp_video_fh *vfh = to_isp_video_fh(fh);
+	struct isp_video *video = video_drvdata(file);
+
+	mutex_lock(&video->mutex);
+	*norm = vfh->standard.id;
+	mutex_unlock(&video->mutex);
+
+	return 0;
+}
+
+static int isp_video_s_std(struct file *file, void *fh, v4l2_std_id *norm)
+{
+	struct isp_video *video = video_drvdata(file);
+	struct media_entity *entity = &video->video.entity;
+	struct media_entity_graph graph;
+	struct v4l2_subdev *subdev;
+	int ret = 0;
+
+	media_entity_graph_walk_start(&graph, entity);
+	while ((entity = media_entity_graph_walk_next(&graph))) {
+		if (media_entity_type(entity) ==
+				MEDIA_ENT_T_V4L2_SUBDEV) {
+			subdev = media_entity_to_v4l2_subdev(entity);
+			if (subdev != NULL) {
+				ret = v4l2_subdev_call(subdev, core, s_std,
+						*norm);
+				if (ret < 0 && ret != -ENOIOCTLCMD)
+					return ret;
+			}
+		}
+	}
+
+	return 0;
 }
 
 static const struct v4l2_ioctl_ops isp_video_ioctl_ops = {
@@ -1161,6 +1252,9 @@ static const struct v4l2_ioctl_ops isp_video_ioctl_ops = {
 	.vidioc_enum_input		= isp_video_enum_input,
 	.vidioc_g_input			= isp_video_g_input,
 	.vidioc_s_input			= isp_video_s_input,
+	.vidioc_querystd		= isp_video_querystd,
+	.vidioc_g_std			= isp_video_g_std,
+	.vidioc_s_std			= isp_video_s_std,
 };
 
 /* -----------------------------------------------------------------------------
@@ -1325,6 +1419,8 @@ int omap3isp_video_register(struct isp_video *video, struct v4l2_device *vdev)
 		printk(KERN_ERR "%s: could not register video device (%d)\n",
 			__func__, ret);
 
+	video->video.tvnorms		= V4L2_STD_NTSC | V4L2_STD_PAL;
+	video->video.current_norm	= V4L2_STD_NTSC;
 	return ret;
 }
 
drivers/media/video/omap3isp/ispvideo.h +1 -0
index 53160aa..bb8feb6 100644
@@ -182,6 +182,7 @@ struct isp_video_fh {
 	struct isp_video *video;
 	struct isp_video_queue queue;
 	struct v4l2_format format;
+	struct v4l2_standard standard;
 	struct v4l2_fract timeperframe;
 };
 
Signature · 1 line
1.7.0.4
#1 lore raw

Hi,

Thanks for the patch.

Quoted 5 lines · On Thursday 08 September 2011 15:35:22 Deepthy Ravi wrote:

From: Vaibhav Hiremath <[email protected]>

In order to support TVP5146 (for that matter any video decoder), it is important to support G/S/ENUM_STD ioctl on /dev/videoX device node.

Why so ? Shouldn't it be queried on the subdev output pad directly ?

Quoted 151 lines
---
 drivers/media/video/omap3isp/ispvideo.c |   98
++++++++++++++++++++++++++++++- drivers/media/video/omap3isp/ispvideo.h | 
  1 +
 2 files changed, 98 insertions(+), 1 deletions(-)
(quoted diff) +0 -0

b/drivers/media/video/omap3isp/ispvideo.c index d5b8236..ff0ffed 100644

drivers/media/video/omap3isp/ispvideo.c +1 -0
@@ -37,6 +37,7 @@
 #include <plat/iovmm.h>
 #include <plat/omap-pm.h>
 
+#include <media/tvp514x.h>
 #include "ispvideo.h"
 #include "isp.h"
 
@@ -1136,7 +1137,97 @@ isp_video_g_input(struct file *file, void *fh,

unsigned int *input) static int
isp_video_s_input(struct file *file, void *fh, unsigned int input) {

drivers/media/video/omap3isp/ispvideo.c +94 -3
-	return input == 0 ? 0 : -EINVAL;
+	struct isp_video *video = video_drvdata(file);
+	struct media_entity *entity = &video->video.entity;
+	struct media_entity_graph graph;
+	struct v4l2_subdev *subdev;
+	struct v4l2_routing route;
+	int ret = 0;
+
+	media_entity_graph_walk_start(&graph, entity);
+	while ((entity = media_entity_graph_walk_next(&graph))) {
+		if (media_entity_type(entity) ==
+				MEDIA_ENT_T_V4L2_SUBDEV) {
+			subdev = media_entity_to_v4l2_subdev(entity);
+			if (subdev != NULL) {
+				if (input == 0)
+					route.input = INPUT_CVBS_VI4A;
+				else
+					route.input = INPUT_SVIDEO_VI2C_VI1C;
+				route.output = 0;
+				ret = v4l2_subdev_call(subdev, video, s_routing,
+						route.input, route.output, 0);
+				if (ret < 0 && ret != -ENOIOCTLCMD)
+					return ret;
+			}
+		}
+	}
+
+	return 0;
+}
+
+static int isp_video_querystd(struct file *file, void *fh, v4l2_std_id *a)
+{
+	struct isp_video_fh *vfh = to_isp_video_fh(fh);
+	struct isp_video *video = video_drvdata(file);
+	struct media_entity *entity = &video->video.entity;
+	struct media_entity_graph graph;
+	struct v4l2_subdev *subdev;
+	int ret = 0;
+
+	media_entity_graph_walk_start(&graph, entity);
+	while ((entity = media_entity_graph_walk_next(&graph))) {
+		if (media_entity_type(entity) ==
+				MEDIA_ENT_T_V4L2_SUBDEV) {
+			subdev = media_entity_to_v4l2_subdev(entity);
+			if (subdev != NULL) {
+				ret = v4l2_subdev_call(subdev, video, querystd,
+						a);
+				if (ret < 0 && ret != -ENOIOCTLCMD)
+					return ret;
+			}
+		}
+	}
+
+	vfh->standard.id = *a;
+	return 0;
+}
+
+static int isp_video_g_std(struct file *file, void *fh, v4l2_std_id *norm)
+{
+	struct isp_video_fh *vfh = to_isp_video_fh(fh);
+	struct isp_video *video = video_drvdata(file);
+
+	mutex_lock(&video->mutex);
+	*norm = vfh->standard.id;
+	mutex_unlock(&video->mutex);
+
+	return 0;
+}
+
+static int isp_video_s_std(struct file *file, void *fh, v4l2_std_id *norm)
+{
+	struct isp_video *video = video_drvdata(file);
+	struct media_entity *entity = &video->video.entity;
+	struct media_entity_graph graph;
+	struct v4l2_subdev *subdev;
+	int ret = 0;
+
+	media_entity_graph_walk_start(&graph, entity);
+	while ((entity = media_entity_graph_walk_next(&graph))) {
+		if (media_entity_type(entity) ==
+				MEDIA_ENT_T_V4L2_SUBDEV) {
+			subdev = media_entity_to_v4l2_subdev(entity);
+			if (subdev != NULL) {
+				ret = v4l2_subdev_call(subdev, core, s_std,
+						*norm);
+				if (ret < 0 && ret != -ENOIOCTLCMD)
+					return ret;
+			}
+		}
+	}
+
+	return 0;
 }
 
 static const struct v4l2_ioctl_ops isp_video_ioctl_ops = {
@@ -1161,6 +1252,9 @@ static const struct v4l2_ioctl_ops
 isp_video_ioctl_ops = { .vidioc_enum_input		= isp_video_enum_input,
 	.vidioc_g_input			= isp_video_g_input,
 	.vidioc_s_input			= isp_video_s_input,
+	.vidioc_querystd		= isp_video_querystd,
+	.vidioc_g_std			= isp_video_g_std,
+	.vidioc_s_std			= isp_video_s_std,
 };
 
 /*
--------------------------------------------------------------------------
--- @@ -1325,6 +1419,8 @@ int omap3isp_video_register(struct isp_video

*video, struct v4l2_device *vdev) printk(KERN_ERR "%s: could not register video device (%d)\n",

drivers/media/video/omap3isp/ispvideo.c +2 -0
 			__func__, ret);
 
+	video->video.tvnorms		= V4L2_STD_NTSC | V4L2_STD_PAL;
+	video->video.current_norm	= V4L2_STD_NTSC;
 	return ret;
 }
(quoted diff) +0 -0

b/drivers/media/video/omap3isp/ispvideo.h index 53160aa..bb8feb6 100644

drivers/media/video/omap3isp/ispvideo.h +1 -0
@@ -182,6 +182,7 @@ struct isp_video_fh {
 	struct isp_video *video;
 	struct isp_video_queue queue;
 	struct v4l2_format format;
+	struct v4l2_standard standard;
 	struct v4l2_fract timeperframe;
 };
Signature · 3 lines
Regards,

Laurent Pinchart
#2 lore raw

Hi,
Sorry for the delayed response.

Quoted 11 lines

________________________________________
From: Laurent Pinchart [laurent.pinchart at ideasonboard.com]
Sent: Thursday, September 08, 2011 10:51 PM
To: Ravi, Deepthy
Cc: linux-media at vger.kernel.org; tony at atomide.com; linux at arm.linux.org.uk; linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux-kernel at vger.kernel.org; mchehab at infradead.org; g.liakhovetski at gmx.de; Hiremath, Vaibhav
Subject: Re: [PATCH 4/8] ispvideo: Add support for G/S/ENUM_STD ioctl

Hi,

Thanks for the patch.

Quoted 9 lines
Quoted 5 lines · On Thursday 08 September 2011 15:35:22 Deepthy Ravi wrote:

From: Vaibhav Hiremath <[email protected]>

In order to support TVP5146 (for that matter any video decoder), it is important to support G/S/ENUM_STD ioctl on /dev/videoX device node.

Why so ? Shouldn't it be queried on the subdev output pad directly ?

[Deepthy Ravi] Because standard v4l2 application for analog devices will call these std ioctls on the streaming device node. So it's done on /dev/video to make the existing apllication work.

Quoted 157 lines
Quoted 145 lines
---
 drivers/media/video/omap3isp/ispvideo.c |   98
++++++++++++++++++++++++++++++- drivers/media/video/omap3isp/ispvideo.h |
  1 +
 2 files changed, 98 insertions(+), 1 deletions(-)
(quoted diff) +0 -0

b/drivers/media/video/omap3isp/ispvideo.c index d5b8236..ff0ffed 100644

drivers/media/video/omap3isp/ispvideo.c +1 -0
@@ -37,6 +37,7 @@
 #include <plat/iovmm.h>
 #include <plat/omap-pm.h>
 
+#include <media/tvp514x.h>
 #include "ispvideo.h"
 #include "isp.h"
 
@@ -1136,7 +1137,97 @@ isp_video_g_input(struct file *file, void *fh,

unsigned int *input) static int
isp_video_s_input(struct file *file, void *fh, unsigned int input) {

drivers/media/video/omap3isp/ispvideo.c +94 -3
-     return input == 0 ? 0 : -EINVAL;
+     struct isp_video *video = video_drvdata(file);
+     struct media_entity *entity = &video->video.entity;
+     struct media_entity_graph graph;
+     struct v4l2_subdev *subdev;
+     struct v4l2_routing route;
+     int ret = 0;
+
+     media_entity_graph_walk_start(&graph, entity);
+     while ((entity = media_entity_graph_walk_next(&graph))) {
+             if (media_entity_type(entity) ==
+                             MEDIA_ENT_T_V4L2_SUBDEV) {
+                     subdev = media_entity_to_v4l2_subdev(entity);
+                     if (subdev != NULL) {
+                             if (input == 0)
+                                     route.input = INPUT_CVBS_VI4A;
+                             else
+                                     route.input = INPUT_SVIDEO_VI2C_VI1C;
+                             route.output = 0;
+                             ret = v4l2_subdev_call(subdev, video, s_routing,
+                                             route.input, route.output, 0);
+                             if (ret < 0 && ret != -ENOIOCTLCMD)
+                                     return ret;
+                     }
+             }
+     }
+
+     return 0;
+}
+
+static int isp_video_querystd(struct file *file, void *fh, v4l2_std_id *a)
+{
+     struct isp_video_fh *vfh = to_isp_video_fh(fh);
+     struct isp_video *video = video_drvdata(file);
+     struct media_entity *entity = &video->video.entity;
+     struct media_entity_graph graph;
+     struct v4l2_subdev *subdev;
+     int ret = 0;
+
+     media_entity_graph_walk_start(&graph, entity);
+     while ((entity = media_entity_graph_walk_next(&graph))) {
+             if (media_entity_type(entity) ==
+                             MEDIA_ENT_T_V4L2_SUBDEV) {
+                     subdev = media_entity_to_v4l2_subdev(entity);
+                     if (subdev != NULL) {
+                             ret = v4l2_subdev_call(subdev, video, querystd,
+                                             a);
+                             if (ret < 0 && ret != -ENOIOCTLCMD)
+                                     return ret;
+                     }
+             }
+     }
+
+     vfh->standard.id = *a;
+     return 0;
+}
+
+static int isp_video_g_std(struct file *file, void *fh, v4l2_std_id *norm)
+{
+     struct isp_video_fh *vfh = to_isp_video_fh(fh);
+     struct isp_video *video = video_drvdata(file);
+
+     mutex_lock(&video->mutex);
+     *norm = vfh->standard.id;
+     mutex_unlock(&video->mutex);
+
+     return 0;
+}
+
+static int isp_video_s_std(struct file *file, void *fh, v4l2_std_id *norm)
+{
+     struct isp_video *video = video_drvdata(file);
+     struct media_entity *entity = &video->video.entity;
+     struct media_entity_graph graph;
+     struct v4l2_subdev *subdev;
+     int ret = 0;
+
+     media_entity_graph_walk_start(&graph, entity);
+     while ((entity = media_entity_graph_walk_next(&graph))) {
+             if (media_entity_type(entity) ==
+                             MEDIA_ENT_T_V4L2_SUBDEV) {
+                     subdev = media_entity_to_v4l2_subdev(entity);
+                     if (subdev != NULL) {
+                             ret = v4l2_subdev_call(subdev, core, s_std,
+                                             *norm);
+                             if (ret < 0 && ret != -ENOIOCTLCMD)
+                                     return ret;
+                     }
+             }
+     }
+
+     return 0;
 }
 
 static const struct v4l2_ioctl_ops isp_video_ioctl_ops = {
@@ -1161,6 +1252,9 @@ static const struct v4l2_ioctl_ops
 isp_video_ioctl_ops = { .vidioc_enum_input            = isp_video_enum_input,
      .vidioc_g_input                 = isp_video_g_input,
      .vidioc_s_input                 = isp_video_s_input,
+     .vidioc_querystd                = isp_video_querystd,
+     .vidioc_g_std                   = isp_video_g_std,
+     .vidioc_s_std                   = isp_video_s_std,
 };
 
 /*
--------------------------------------------------------------------------
--- @@ -1325,6 +1419,8 @@ int omap3isp_video_register(struct isp_video

*video, struct v4l2_device *vdev) printk(KERN_ERR "%s: could not register video device (%d)\n",

                      __func__, ret);
drivers/media/video/omap3isp/ispvideo.c +2 -0
+     video->video.tvnorms            = V4L2_STD_NTSC | V4L2_STD_PAL;
+     video->video.current_norm       = V4L2_STD_NTSC;
      return ret;
 }
(quoted diff) +0 -0

b/drivers/media/video/omap3isp/ispvideo.h index 53160aa..bb8feb6 100644

drivers/media/video/omap3isp/ispvideo.h struct isp_video_fh { · line 187

Quoted 6 lines
drivers/media/video/omap3isp/ispvideo.h +1 -0
@@ -182,6 +182,7 @@ struct isp_video_fh {
      struct isp_video *video;
      struct isp_video_queue queue;
      struct v4l2_format format;
+     struct v4l2_standard standard;
      struct v4l2_fract timeperframe;
 };

--
Regards,

Laurent Pinchart

#3 lore raw

Hi Deepthy,

Quoted 8 lines · Deepthy
Quoted 7 lines · Laurent Pinchart
Quoted 5 lines · On Thursday 08 September 2011 15:35:22 Deepthy Ravi wrote:

From: Vaibhav Hiremath <[email protected]>

In order to support TVP5146 (for that matter any video decoder), it is important to support G/S/ENUM_STD ioctl on /dev/videoX device node.

Quoted 5 lines
Quoted 1 line

Why so ? Shouldn't it be queried on the subdev output pad directly ?

Because standard v4l2 application for analog devices will call these std ioctls on the streaming device node. So it's done on /dev/video to make the existing apllication work.

Existing applications can't work with the OMAP3 ISP (and similar complex embedded devices) without userspace support anyway, either in the form of a GStreamer element or a libv4l plugin. I still believe that analog video standard operations should be added to the subdev pad operations and exposed through subdev device nodes, exactly as done with formats.

Signature · 3 lines
Regards,

Laurent Pinchart
#4 lore raw
Quoted 29 lines

-----Original Message-----
From: Laurent Pinchart [mailto:laurent.pinchart at ideasonboard.com]
Sent: Friday, September 16, 2011 6:36 PM
To: Ravi, Deepthy
Cc: linux-media at vger.kernel.org; tony at atomide.com; linux at arm.linux.org.uk; linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux- kernel at vger.kernel.org; mchehab at infradead.org; g.liakhovetski at gmx.de; Hiremath, Vaibhav
Subject: Re: [PATCH 4/8] ispvideo: Add support for G/S/ENUM_STD ioctl

Hi Deepthy,

Quoted 4 lines · Deepthy
Quoted 3 lines · Laurent Pinchart
Quoted 2 lines · On Thursday 08 September 2011 15:35:22 Deepthy Ravi wrote:

From: Vaibhav Hiremath <[email protected]>

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

In order to support TVP5146 (for that matter any video decoder), it is important to support G/S/ENUM_STD ioctl on /dev/videoX device node.

Why so ? Shouldn't it be queried on the subdev output pad directly ?

Because standard v4l2 application for analog devices will call these std ioctls on the streaming device node. So it's done on /dev/video to make

the

Quoted 1 line

existing apllication work.

Quoted 8 lines

Existing applications can't work with the OMAP3 ISP (and similar complex embedded devices) without userspace support anyway, either in the form of a
GStreamer element or a libv4l plugin. I still believe that analog video standard operations should be added to the subdev pad operations and exposed
through subdev device nodes, exactly as done with formats.

[Hiremath, Vaibhav] Laurent,

I completely agree with your point that, existing application will not work without setting links properly. But I believe the assumption here is, media-controller should set the links (along with pad formants) and all existing application should work as is. Isn't it?

The way it is being done currently is, set the format at the pad level which is same as analog standard resolution and use existing application for streaming...

I am ok, if we add s/g/enum_std api support at sub-dev level but this should also be supported on streaming device node.

Thanks,
Vaibhav

Quoted 4 lines

--
Regards,

Laurent Pinchart

#5 lore raw

Hi Vaibhav,

Quoted 22 lines · Vaibhav
Quoted 15 lines · Laurent Pinchart
Quoted 8 lines · Deepthy
Quoted 7 lines · Laurent Pinchart
Quoted 5 lines · On Thursday 08 September 2011 15:35:22 Deepthy Ravi wrote:

From: Vaibhav Hiremath <[email protected]>

In order to support TVP5146 (for that matter any video decoder), it is important to support G/S/ENUM_STD ioctl on /dev/videoX device node.

Quoted 5 lines
Quoted 1 line

Why so ? Shouldn't it be queried on the subdev output pad directly ?

Because standard v4l2 application for analog devices will call these std ioctls on the streaming device node. So it's done on /dev/video to make the existing apllication work.

Quoted 5 lines

Existing applications can't work with the OMAP3 ISP (and similar complex embedded devices) without userspace support anyway, either in the form of a GStreamer element or a libv4l plugin. I still believe that analog video standard operations should be added to the subdev pad operations and exposed through subdev device nodes, exactly as done with formats.

Quoted 4 lines

I completely agree with your point that, existing application will not work without setting links properly. But I believe the assumption here is, media-controller should set the links (along with pad formants) and all existing application should work as is. Isn't it?

The media controller is an API used (among other things) to set the links. You still need to call it from userspace. That won't happen magically. The userspace component that sets up the links and configures the formats, be it a GStreamer element, a libv4l plugin, or something else, can as well setup the standard on the TVP5146 subdev.

Quoted 3 lines

The way it is being done currently is, set the format at the pad level which is same as analog standard resolution and use existing application for streaming...

At then end of the OMAP3 ISP pipeline video data has long lost its analog roots. I don't think standards make sense there.

Quoted 2 lines

I am ok, if we add s/g/enum_std api support at sub-dev level but this should also be supported on streaming device node.

Signature · 3 lines
Regards,

Laurent Pinchart
#6 lore raw
Quoted 46 lines

-----Original Message-----
From: Laurent Pinchart [mailto:laurent.pinchart at ideasonboard.com]
Sent: Tuesday, September 27, 2011 11:36 PM
To: Hiremath, Vaibhav
Cc: Ravi, Deepthy; linux-media at vger.kernel.org; tony at atomide.com; linux at arm.linux.org.uk; linux-omap at vger.kernel.org; linux-arm- kernel at lists.infradead.org; linux-kernel at vger.kernel.org; mchehab at infradead.org; g.liakhovetski at gmx.de
Subject: Re: [PATCH 4/8] ispvideo: Add support for G/S/ENUM_STD ioctl

Hi Vaibhav,

Quoted 11 lines · Vaibhav
Quoted 10 lines · Laurent Pinchart
Quoted 9 lines · Deepthy
Quoted 8 lines · Laurent Pinchart
Quoted 5 lines · On Thursday 08 September 2011 15:35:22 Deepthy Ravi wrote:

From: Vaibhav Hiremath <[email protected]>

In order to support TVP5146 (for that matter any video decoder), it is important to support G/S/ENUM_STD ioctl on /dev/videoX device node.

Why so ? Shouldn't it be queried on the subdev output pad

directly ?

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Because standard v4l2 application for analog devices will call these std ioctls on the streaming device node. So it's done on /dev/video

to

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

make the existing apllication work.

Existing applications can't work with the OMAP3 ISP (and similar

complex

Quoted 1 line
Quoted 1 line

embedded devices) without userspace support anyway, either in the form

of

Quoted 1 line
Quoted 1 line

a GStreamer element or a libv4l plugin. I still believe that analog

video

Quoted 4 lines
Quoted 2 lines

standard operations should be added to the subdev pad operations and exposed through subdev device nodes, exactly as done with formats.

I completely agree with your point that, existing application will not

work

Quoted 3 lines

without setting links properly. But I believe the assumption here is, media-controller should set the links (along with pad formants) and all existing application should work as is. Isn't it?

Quoted 9 lines

The media controller is an API used (among other things) to set the links. You
still need to call it from userspace. That won't happen magically. The userspace component that sets up the links and configures the formats, be it a
GStreamer element, a libv4l plugin, or something else, can as well setup the
standard on the TVP5146 subdev.

Please look at from analog device point of view which is interfaced to ISP.

OMAP3 ISP => TVP5146 (video decoder)

As a user I would want to expect the standard to be supported on streaming device node, since all standard streaming applications (for analog devices/interfaces) does this.

Setting up the links and format is still something got added with MC framework, and I would consider it as a separate plug-in along with existing applications.

Why do I need to write/use two different streaming application one for MC compatible device and another for non-MC?

Quoted 7 lines
Quoted 3 lines

The way it is being done currently is, set the format at the pad level which is same as analog standard resolution and use existing application for streaming...

At then end of the OMAP3 ISP pipeline video data has long lost its analog roots. I don't think standards make sense there.

I don't agree with you here, I think we made it clear when we started with MC development activity, we will not break existing standard applications. Media-controller will play a roll to setup the links, connecting the pads and stuff.

Thanks,
Vaibhav

Quoted 7 lines
Quoted 2 lines

I am ok, if we add s/g/enum_std api support at sub-dev level but this should also be supported on streaming device node.

--
Regards,

Laurent Pinchart

#7 lore raw

Hi Hiremath,

Quoted 69 lines · Vaibhav
Quoted 53 lines

-----Original Message----- From: Laurent Pinchart [mailto:laurent.pinchart at ideasonboard.com] Sent: Tuesday, September 27, 2011 11:36 PM To: Hiremath, Vaibhav Cc: Ravi, Deepthy; linux-media at vger.kernel.org; tony at atomide.com;
linux at arm.linux.org.uk; linux-omap at vger.kernel.org; linux-arm- kernel at lists.infradead.org; linux-kernel at vger.kernel.org; mchehab at infradead.org; g.liakhovetski at gmx.de Subject: Re: [PATCH 4/8] ispvideo: Add support for G/S/ENUM_STD ioctl

Hi Vaibhav,

Quoted 4 lines · Vaibhav
Quoted 3 lines · Laurent Pinchart
Quoted 2 lines · Deepthy

On Thursday, September 08, 2011 10:51 PM Laurent Pinchart wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · On Thursday 08 September 2011 15:35:22 Deepthy Ravi wrote:
Quoted 5 lines

From: Vaibhav Hiremath <[email protected]>

In order to support TVP5146 (for that matter any video decoder), it is important to support G/S/ENUM_STD ioctl on /dev/videoX device node.

Why so ? Shouldn't it be queried on the subdev output pad

directly ?

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Because standard v4l2 application for analog devices will call these std ioctls on the streaming device node. So it's done on /dev/video

to

Quoted 4 lines
Quoted 4 lines
Quoted 1 line

make the existing apllication work.

Existing applications can't work with the OMAP3 ISP (and similar

complex

Quoted 2 lines
Quoted 2 lines

embedded devices) without userspace support anyway, either in the form

of

Quoted 2 lines
Quoted 2 lines

a GStreamer element or a libv4l plugin. I still believe that analog

video

Quoted 6 lines
Quoted 3 lines

standard operations should be added to the subdev pad operations and exposed through subdev device nodes, exactly as done with formats.

I completely agree with your point that, existing application will not

work

Quoted 4 lines

without setting links properly. But I believe the assumption here is, media-controller should set the links (along with pad formants) and all existing application should work as is. Isn't it?

Quoted 7 lines

The media controller is an API used (among other things) to set the links. You still need to call it from userspace. That won't happen magically. The userspace component that sets up the links and configures the formats, be it a GStreamer element, a libv4l plugin, or something else, can as well setup the standard on the TVP5146 subdev.

Please look at from analog device point of view which is interfaced to ISP.

OMAP3 ISP => TVP5146 (video decoder)

As a user I would want to expect the standard to be supported on streaming device node, since all standard streaming applications (for analog devices/interfaces) does this.

Quoted 6 lines

Setting up the links and format is still something got added with MC framework, and I would consider it as a separate plug-in along with existing applications.

Why do I need to write/use two different streaming application one for MC compatible device and another for non-MC?

You musn't need to.

This is something that will have to be handled by the libv4l plugin, as the rest of controlling the device. Controls related ioctls will be passed from the source to downstream once they apply, and I don't see why the same shouldn't be done to the {G,S,ENUM}_STD.

Regards,

Signature · 2 lines
Sakari Ailus
sakari.ailus at iki.fi
#8 lore raw
In reply to Hiremath, Vaibhav

Em 19-09-2011 12:31, Hiremath, Vaibhav escreveu:

Quoted 37 lines
Quoted 29 lines

-----Original Message-----
From: Laurent Pinchart [mailto:laurent.pinchart at ideasonboard.com]
Sent: Friday, September 16, 2011 6:36 PM
To: Ravi, Deepthy
Cc: linux-media at vger.kernel.org; tony at atomide.com; linux at arm.linux.org.uk; linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux- kernel at vger.kernel.org; mchehab at infradead.org; g.liakhovetski at gmx.de; Hiremath, Vaibhav
Subject: Re: [PATCH 4/8] ispvideo: Add support for G/S/ENUM_STD ioctl

Hi Deepthy,

Quoted 4 lines · Deepthy
Quoted 3 lines · Laurent Pinchart
Quoted 2 lines · On Thursday 08 September 2011 15:35:22 Deepthy Ravi wrote:

From: Vaibhav Hiremath <[email protected]>

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

In order to support TVP5146 (for that matter any video decoder), it is important to support G/S/ENUM_STD ioctl on /dev/videoX device node.

Why so ? Shouldn't it be queried on the subdev output pad directly ?

Because standard v4l2 application for analog devices will call these std ioctls on the streaming device node. So it's done on /dev/video to make

the

Quoted 1 line

existing apllication work.

Quoted 8 lines

Existing applications can't work with the OMAP3 ISP (and similar complex embedded devices) without userspace support anyway, either in the form of a
GStreamer element or a libv4l plugin. I still believe that analog video standard operations should be added to the subdev pad operations and exposed
through subdev device nodes, exactly as done with formats.

Quoted 5 lines

[Hiremath, Vaibhav] Laurent,

I completely agree with your point that, existing application will not work without setting links properly. But I believe the assumption here is, media-controller should set the links (along with pad formants) and all existing application should work as is. Isn't it?

Yes.

Quoted 1 line

The way it is being done currently is, set the format at the pad level which is same as analog standard resolution and use existing application for streaming...

Yes.

Quoted 1 line

I am ok, if we add s/g/enum_std api support at sub-dev level but this should also be supported on streaming device node.

Agreed. Standards selection should be done at device node, just like any other device.

Regards,
Mauro

#9 lore raw

Hi Mauro,

Quoted 2 lines · On Wednesday 28 September 2011 00:31:32 Mauro Carvalho Chehab wrote:

Em 19-09-2011 12:31, Hiremath, Vaibhav escreveu:

Quoted 1 line

On Friday, September 16, 2011 6:36 PM Laurent Pinchart wrote: > >> On

Quoted 31 lines · Deepthy
Quoted 20 lines
Quoted 14 lines
Quoted 8 lines · Laurent Pinchart
Quoted 7 lines · On Thursday 08 September 2011 15:35:22 Deepthy Ravi wrote:
Quoted 5 lines

From: Vaibhav Hiremath <[email protected]>

In order to support TVP5146 (for that matter any video decoder), it is important to support G/S/ENUM_STD ioctl on /dev/videoX device node.

Quoted 5 lines
Quoted 1 line

Why so ? Shouldn't it be queried on the subdev output pad directly ?

Because standard v4l2 application for analog devices will call these std ioctls on the streaming device node. So it's done on /dev/video to make the existing apllication work.

Quoted 5 lines

Existing applications can't work with the OMAP3 ISP (and similar complex embedded devices) without userspace support anyway, either in the form of a GStreamer element or a libv4l plugin. I still believe that analog video standard operations should be added to the subdev pad operations and exposed through subdev device nodes, exactly as done with formats.

Quoted 4 lines

I completely agree with your point that, existing application will not work without setting links properly. But I believe the assumption here is, media-controller should set the links (along with pad formants) and all existing application should work as is. Isn't it?

Yes.

Quoted 3 lines

The way it is being done currently is, set the format at the pad level which is same as analog standard resolution and use existing application for streaming...

Quoted 7 lines

Yes.

Quoted 2 lines

I am ok, if we add s/g/enum_std api support at sub-dev level but this should also be supported on streaming device node.

Agreed. Standards selection should be done at device node, just like any other device.

No. Please see my reply to Vaibhav's e-mail. Standard selection should be done on the subdev pads, for the exact same reason why formats and selection rectangles are configured on subdev pads.

Signature · 3 lines
Regards,

Laurent Pinchart
#10 lore raw

Em 27-09-2011 19:41, Laurent Pinchart escreveu:

Quoted 42 lines

Hi Mauro,

Quoted 2 lines · On Wednesday 28 September 2011 00:31:32 Mauro Carvalho Chehab wrote:

Em 19-09-2011 12:31, Hiremath, Vaibhav escreveu:

Quoted 1 line

On Friday, September 16, 2011 6:36 PM Laurent Pinchart wrote: > >> On

Quoted 36 lines · Deepthy
Quoted 20 lines
Quoted 14 lines
Quoted 8 lines · Laurent Pinchart
Quoted 7 lines · On Thursday 08 September 2011 15:35:22 Deepthy Ravi wrote:
Quoted 5 lines

From: Vaibhav Hiremath <[email protected]>

In order to support TVP5146 (for that matter any video decoder), it is important to support G/S/ENUM_STD ioctl on /dev/videoX device node.

Quoted 5 lines
Quoted 1 line

Why so ? Shouldn't it be queried on the subdev output pad directly ?

Because standard v4l2 application for analog devices will call these std ioctls on the streaming device node. So it's done on /dev/video to make the existing apllication work.

Quoted 5 lines

Existing applications can't work with the OMAP3 ISP (and similar complex embedded devices) without userspace support anyway, either in the form of a GStreamer element or a libv4l plugin. I still believe that analog video standard operations should be added to the subdev pad operations and exposed through subdev device nodes, exactly as done with formats.

Quoted 4 lines

I completely agree with your point that, existing application will not work without setting links properly. But I believe the assumption here is, media-controller should set the links (along with pad formants) and all existing application should work as is. Isn't it?

Yes.

Quoted 3 lines

The way it is being done currently is, set the format at the pad level which is same as analog standard resolution and use existing application for streaming...

Yes.

Quoted 2 lines

I am ok, if we add s/g/enum_std api support at sub-dev level but this should also be supported on streaming device node.

Quoted 6 lines
Quoted 2 lines

Agreed. Standards selection should be done at device node, just like any other device.

No. Please see my reply to Vaibhav's e-mail. Standard selection should be done on the subdev pads, for the exact same reason why formats and selection rectangles are configured on subdev pads.

NACK. Let's not reinvent the wheel. the MC should not replace the V4L2 API.

Mauro.

#11 lore raw
Quoted 43 lines · Mauro Carvalho Chehab

Em 27-09-2011 19:41, Laurent Pinchart escreveu:

Quoted 42 lines

Hi Mauro,

Quoted 2 lines · On Wednesday 28 September 2011 00:31:32 Mauro Carvalho Chehab wrote:

Em 19-09-2011 12:31, Hiremath, Vaibhav escreveu:

Quoted 1 line

On Friday, September 16, 2011 6:36 PM Laurent Pinchart wrote: > >> On

Quoted 36 lines · Deepthy
Quoted 20 lines
Quoted 14 lines
Quoted 8 lines · Laurent Pinchart
Quoted 7 lines · On Thursday 08 September 2011 15:35:22 Deepthy Ravi wrote:
Quoted 5 lines

From: Vaibhav Hiremath <[email protected]>

In order to support TVP5146 (for that matter any video decoder), it is important to support G/S/ENUM_STD ioctl on /dev/videoX device node.

Quoted 5 lines
Quoted 1 line

Why so ? Shouldn't it be queried on the subdev output pad directly ?

Because standard v4l2 application for analog devices will call these std ioctls on the streaming device node. So it's done on /dev/video to make the existing apllication work.

Quoted 5 lines

Existing applications can't work with the OMAP3 ISP (and similar complex embedded devices) without userspace support anyway, either in the form of a GStreamer element or a libv4l plugin. I still believe that analog video standard operations should be added to the subdev pad operations and exposed through subdev device nodes, exactly as done with formats.

Quoted 4 lines

I completely agree with your point that, existing application will not work without setting links properly. But I believe the assumption here is, media-controller should set the links (along with pad formants) and all existing application should work as is. Isn't it?

Yes.

Quoted 3 lines

The way it is being done currently is, set the format at the pad level which is same as analog standard resolution and use existing application for streaming...

Yes.

Quoted 2 lines

I am ok, if we add s/g/enum_std api support at sub-dev level but this should also be supported on streaming device node.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Agreed. Standards selection should be done at device node, just like any other device.

No. Please see my reply to Vaibhav's e-mail. Standard selection should be done on the subdev pads, for the exact same reason why formats and selection rectangles are configured on subdev pads.

NACK. Let's not reinvent the wheel. the MC should not replace the V4L2 API.

That has never been the intention.

My proposal is that the {G,S,ENUM}_STD is implemented in the V4L2 subdev user space interface and then the libv4l plugin redirects the call to the right subdev, in a similar fashion which is planned for V4L2 controls.

Kind regards,

Signature · 2 lines
Sakari Ailus
[email protected]
#12 lore raw
In reply to Mauro Carvalho Chehab

Hi Mauro,

Quoted 42 lines · On Wednesday 28 September 2011 11:59:30 Mauro Carvalho Chehab wrote:

Em 27-09-2011 19:41, Laurent Pinchart escreveu:

Quoted 41 lines · On Wednesday 28 September 2011 00:31:32 Mauro Carvalho Chehab wrote:
Quoted 40 lines

Em 19-09-2011 12:31, Hiremath, Vaibhav escreveu:

Quoted 23 lines · Laurent Pinchart
Quoted 15 lines · Deepthy
Quoted 8 lines · Laurent Pinchart
Quoted 7 lines · On Thursday 08 September 2011 15:35:22 Deepthy Ravi wrote:
Quoted 5 lines

From: Vaibhav Hiremath <[email protected]>

In order to support TVP5146 (for that matter any video decoder), it is important to support G/S/ENUM_STD ioctl on /dev/videoX device node.

Quoted 5 lines
Quoted 1 line

Why so ? Shouldn't it be queried on the subdev output pad directly ?

Because standard v4l2 application for analog devices will call these std ioctls on the streaming device node. So it's done on /dev/video to make the existing apllication work.

Quoted 6 lines

Existing applications can't work with the OMAP3 ISP (and similar complex embedded devices) without userspace support anyway, either in the form of a GStreamer element or a libv4l plugin. I still believe that analog video standard operations should be added to the subdev pad operations and exposed through subdev device nodes, exactly as done with formats.

Quoted 4 lines

I completely agree with your point that, existing application will not work without setting links properly. But I believe the assumption here is, media-controller should set the links (along with pad formants) and all existing application should work as is. Isn't it?

Yes.

Quoted 3 lines

The way it is being done currently is, set the format at the pad level which is same as analog standard resolution and use existing application for streaming...

Yes.

Quoted 2 lines

I am ok, if we add s/g/enum_std api support at sub-dev level but this should also be supported on streaming device node.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Agreed. Standards selection should be done at device node, just like any other device.

No. Please see my reply to Vaibhav's e-mail. Standard selection should be done on the subdev pads, for the exact same reason why formats and selection rectangles are configured on subdev pads.

NACK. Let's not reinvent the wheel. the MC should not replace the V4L2 API.

I will NACK any patch that implements G/S/ENUM_STD in the OMAP3 ISP driver itself, so we got a deadlock here :-)

Maybe it would be easier to discuss this face to face in Prague ?

Signature · 3 lines
Regards,

Laurent Pinchart
#13 lore raw
Quoted 71 lines

-----Original Message-----
From: Laurent Pinchart [mailto:[email protected]]
Sent: Wednesday, September 28, 2011 6:59 PM
To: Mauro Carvalho Chehab
Cc: Hiremath, Vaibhav; Ravi, Deepthy; [email protected]; [email protected]; Sakari Ailus
Subject: Re: [PATCH 4/8] ispvideo: Add support for G/S/ENUM_STD ioctl

Hi Mauro,

Quoted 14 lines · On Wednesday 28 September 2011 11:59:30 Mauro Carvalho Chehab wrote:

Em 27-09-2011 19:41, Laurent Pinchart escreveu:

Quoted 13 lines · On Wednesday 28 September 2011 00:31:32 Mauro Carvalho Chehab wrote:
Quoted 12 lines

Em 19-09-2011 12:31, Hiremath, Vaibhav escreveu:

Quoted 11 lines · Laurent Pinchart
Quoted 10 lines · Deepthy
Quoted 9 lines · Laurent Pinchart
Quoted 8 lines · On Thursday 08 September 2011 15:35:22 Deepthy Ravi wrote:
Quoted 5 lines

From: Vaibhav Hiremath <[email protected]>

In order to support TVP5146 (for that matter any video decoder), it is important to support G/S/ENUM_STD ioctl on /dev/videoX device node.

Why so ? Shouldn't it be queried on the subdev output pad

directly ?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Because standard v4l2 application for analog devices will call

these

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

std ioctls on the streaming device node. So it's done on

/dev/video

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

to make the existing apllication work.

Existing applications can't work with the OMAP3 ISP (and similar complex embedded devices) without userspace support anyway, either

in

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

the form of a GStreamer element or a libv4l plugin. I still believe that analog video standard operations should be added to the subdev pad operations and exposed through subdev device nodes, exactly as done with formats.

I completely agree with your point that, existing application will

not

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

work without setting links properly. But I believe the assumption

here

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

is, media-controller should set the links (along with pad formants)

and

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line

all existing application should work as is. Isn't it?

Yes.

Quoted 1 line

The way it is being done currently is, set the format at the pad

level

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

which is same as analog standard resolution and use existing application for streaming...

Yes.

Quoted 1 line

I am ok, if we add s/g/enum_std api support at sub-dev level but

this

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

should also be supported on streaming device node.

Agreed. Standards selection should be done at device node, just like

any

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

other device.

No. Please see my reply to Vaibhav's e-mail. Standard selection should

be

Quoted 3 lines
Quoted 2 lines

done on the subdev pads, for the exact same reason why formats and selection rectangles are configured on subdev pads.

Quoted 8 lines
Quoted 1 line

NACK. Let's not reinvent the wheel. the MC should not replace the V4L2

API.

I will NACK any patch that implements G/S/ENUM_STD in the OMAP3 ISP driver itself, so we got a deadlock here :-)

Maybe it would be easier to discuss this face to face in Prague ?

[Hiremath, Vaibhav] I am surprised and afraid to say that, we are breaking existing V4L2 standard applications.

We are referring to libv4l, which anyway should follow (compliant to) standard V4L2 spec; and for analog device interface we must support G/S/ENUM_STD ioctl interface.

What if I don't want to use libv4l and writing my own application? What if I only want to validate my driver (without libv4l) and the underneath TVP5146 device is being used in both MC and non-MC compatible devices?

For example,

In my case, I have OMAP3 (with MC support) and AM3517 (without MC support),
And I do my whole testing with simple and plain C application which works on both without any change/issues. Streaming application is exactly same, only in case of OMAP3, I have to set the links with media-ctl before streaming.

I think we had enough discussion on this, and I don't see you are getting into alignment with this (I am surprised). I vote for F2F discussion, but I will not be available. Hope you will update me on this.

Thanks,
Vaibhav

Quoted 4 lines

--
Regards,

Laurent Pinchart

#14 lore raw
In reply to Mauro Carvalho Chehab
Quoted 46 lines · Mauro Carvalho Chehab

Em 19-09-2011 12:31, Hiremath, Vaibhav escreveu:

Quoted 37 lines
Quoted 29 lines

-----Original Message-----
From: Laurent Pinchart [mailto:laurent.pinchart at ideasonboard.com]
Sent: Friday, September 16, 2011 6:36 PM
To: Ravi, Deepthy
Cc: linux-media at vger.kernel.org; tony at atomide.com; linux at arm.linux.org.uk; linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux- kernel at vger.kernel.org; mchehab at infradead.org; g.liakhovetski at gmx.de; Hiremath, Vaibhav
Subject: Re: [PATCH 4/8] ispvideo: Add support for G/S/ENUM_STD ioctl

Hi Deepthy,

Quoted 4 lines · Deepthy
Quoted 3 lines · Laurent Pinchart
Quoted 2 lines · On Thursday 08 September 2011 15:35:22 Deepthy Ravi wrote:

From: Vaibhav Hiremath<[email protected]>

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

In order to support TVP5146 (for that matter any video decoder), it is important to support G/S/ENUM_STD ioctl on /dev/videoX device node.

Why so ? Shouldn't it be queried on the subdev output pad directly ?

Because standard v4l2 application for analog devices will call these std ioctls on the streaming device node. So it's done on /dev/video to make

the

Quoted 1 line

existing apllication work.

Quoted 8 lines

Existing applications can't work with the OMAP3 ISP (and similar complex embedded devices) without userspace support anyway, either in the form of a
GStreamer element or a libv4l plugin. I still believe that analog video standard operations should be added to the subdev pad operations and exposed
through subdev device nodes, exactly as done with formats.

Quoted 5 lines

[Hiremath, Vaibhav] Laurent,

I completely agree with your point that, existing application will not work without setting links properly. But I believe the assumption here is, media-controller should set the links (along with pad formants) and all existing application should work as is. Isn't it?

Yes.

Quoted 8 lines
Quoted 1 line

The way it is being done currently is, set the format at the pad level which is same as analog standard resolution and use existing application for streaming...

Yes.

Quoted 1 line

I am ok, if we add s/g/enum_std api support at sub-dev level but this should also be supported on streaming device node.

Agreed. Standards selection should be done at device node, just like any other device.

So how do you handle a part like the TVP5150 that is standard agnostic? That device can sense the standard from the input signal and sets the result appropriately.

Signature · 4 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------
#15 lore raw

Em 27-09-2011 19:49, Gary Thomas escreveu:

Quoted 51 lines · Mauro Carvalho Chehab
Quoted 50 lines

Em 19-09-2011 12:31, Hiremath, Vaibhav escreveu:

Quoted 37 lines
Quoted 29 lines

-----Original Message-----
From: Laurent Pinchart [mailto:laurent.pinchart at ideasonboard.com]
Sent: Friday, September 16, 2011 6:36 PM
To: Ravi, Deepthy
Cc: linux-media at vger.kernel.org; tony at atomide.com; linux at arm.linux.org.uk; linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux- kernel at vger.kernel.org; mchehab at infradead.org; g.liakhovetski at gmx.de; Hiremath, Vaibhav
Subject: Re: [PATCH 4/8] ispvideo: Add support for G/S/ENUM_STD ioctl

Hi Deepthy,

Quoted 4 lines · Deepthy
Quoted 3 lines · Laurent Pinchart
Quoted 2 lines · On Thursday 08 September 2011 15:35:22 Deepthy Ravi wrote:

From: Vaibhav Hiremath<[email protected]>

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

In order to support TVP5146 (for that matter any video decoder), it is important to support G/S/ENUM_STD ioctl on /dev/videoX device node.

Why so ? Shouldn't it be queried on the subdev output pad directly ?

Because standard v4l2 application for analog devices will call these std ioctls on the streaming device node. So it's done on /dev/video to make

the

Quoted 1 line

existing apllication work.

Quoted 8 lines

Existing applications can't work with the OMAP3 ISP (and similar complex embedded devices) without userspace support anyway, either in the form of a
GStreamer element or a libv4l plugin. I still believe that analog video standard operations should be added to the subdev pad operations and exposed
through subdev device nodes, exactly as done with formats.

Quoted 5 lines

[Hiremath, Vaibhav] Laurent,

I completely agree with your point that, existing application will not work without setting links properly. But I believe the assumption here is, media-controller should set the links (along with pad formants) and all existing application should work as is. Isn't it?

Yes.

Quoted 1 line

The way it is being done currently is, set the format at the pad level which is same as analog standard resolution and use existing application for streaming...

Yes.

Quoted 9 lines
Quoted 4 lines
Quoted 1 line

I am ok, if we add s/g/enum_std api support at sub-dev level but this should also be supported on streaming device node.

Agreed. Standards selection should be done at device node, just like any other device.

So how do you handle a part like the TVP5150 that is standard agnostic? That device can sense the standard from the input signal and sets the result appropriately.

See the em28xx driver. It uses tvp5150 at the device node, and works properly.

It should be noticed, however, that the implementation at tvp5150 doesn't implement standards detection properly, due to hardware limitation.

A proper implementation of standards detection is to get the standards mask from userspace and let the driver detect between the standards that the userspace is expecting.

So, userspace could, for example, do things like:

	v4l2_std_id std = V4L2_STD_PAL_M | V4L2_STD_NTSC_M | V4L2_STD_PAL_DK;

	ioctl (fd, VIDIOC_S_STD, &std);
	msleep (100);
	ioctl (fd, VIDIOC_G_STD, &std);
	if (std & V4L2_STD_625_50)
		height = 576;
	else
		height = 480;

The above code won't work with the current tvp5150 driver, due to two reasons:

1) The tvp5150 register 0x28 doesn't allow an arbitrary standards mask like the above. The driver does support standards detection, if V4L2_STD_ALL is passed into it.

2) even if V4L2_STD_ALL is used, the driver currently doesn't implement a vidioc_g_std callback. So, the driver cannot return back to userspace and to the bridge driver what standard were detected. Without this information, userspace might use the wrong number of lines when allocating the buffer, and this won't work.

Of course, patches for fixing this are welcome.

Thanks,
Mauro

#16 lore raw
In reply to Deepthy Ravi

Hi Deepathy,

Thanks for the patches.

Quoted 5 lines · Deepthy Ravi

From: Vaibhav Hiremath <[email protected]>

In order to support TVP5146 (for that matter any video decoder), it is important to support G/S/ENUM_STD ioctl on /dev/videoX device node.

Why on video nodes rather than the subdev node?

I don't think *_STD ioctls should be handled differently from any others, i.e. this is directly related to that subdev, so the control should go through the subdev node.

That said, generic applications aren't necessarily aware of the subdev nodes and I think this is something that should be handled in a libv4l plugin. This appears quite generic to me; walking the graph and accessing the right subdev node can be done in user space.

Quoted 156 lines
---
 drivers/media/video/omap3isp/ispvideo.c |   98 ++++++++++++++++++++++++++++++-
 drivers/media/video/omap3isp/ispvideo.h |    1 +
 2 files changed, 98 insertions(+), 1 deletions(-)
drivers/media/video/omap3isp/ispvideo.c +97 -1
index d5b8236..ff0ffed 100644
@@ -37,6 +37,7 @@
 #include <plat/iovmm.h>
 #include <plat/omap-pm.h>
 
+#include <media/tvp514x.h>
 #include "ispvideo.h"
 #include "isp.h"
 
@@ -1136,7 +1137,97 @@ isp_video_g_input(struct file *file, void *fh, unsigned int *input)
 static int
 isp_video_s_input(struct file *file, void *fh, unsigned int input)
 {
-	return input == 0 ? 0 : -EINVAL;
+	struct isp_video *video = video_drvdata(file);
+	struct media_entity *entity = &video->video.entity;
+	struct media_entity_graph graph;
+	struct v4l2_subdev *subdev;
+	struct v4l2_routing route;
+	int ret = 0;
+
+	media_entity_graph_walk_start(&graph, entity);
+	while ((entity = media_entity_graph_walk_next(&graph))) {
+		if (media_entity_type(entity) ==
+				MEDIA_ENT_T_V4L2_SUBDEV) {
+			subdev = media_entity_to_v4l2_subdev(entity);
+			if (subdev != NULL) {
+				if (input == 0)
+					route.input = INPUT_CVBS_VI4A;
+				else
+					route.input = INPUT_SVIDEO_VI2C_VI1C;
+				route.output = 0;
+				ret = v4l2_subdev_call(subdev, video, s_routing,
+						route.input, route.output, 0);
+				if (ret < 0 && ret != -ENOIOCTLCMD)
+					return ret;
+			}
+		}
+	}
+
+	return 0;
+}
+
+static int isp_video_querystd(struct file *file, void *fh, v4l2_std_id *a)
+{
+	struct isp_video_fh *vfh = to_isp_video_fh(fh);
+	struct isp_video *video = video_drvdata(file);
+	struct media_entity *entity = &video->video.entity;
+	struct media_entity_graph graph;
+	struct v4l2_subdev *subdev;
+	int ret = 0;
+
+	media_entity_graph_walk_start(&graph, entity);
+	while ((entity = media_entity_graph_walk_next(&graph))) {
+		if (media_entity_type(entity) ==
+				MEDIA_ENT_T_V4L2_SUBDEV) {
+			subdev = media_entity_to_v4l2_subdev(entity);
+			if (subdev != NULL) {
+				ret = v4l2_subdev_call(subdev, video, querystd,
+						a);
+				if (ret < 0 && ret != -ENOIOCTLCMD)
+					return ret;
+			}
+		}
+	}
+
+	vfh->standard.id = *a;
+	return 0;
+}
+
+static int isp_video_g_std(struct file *file, void *fh, v4l2_std_id *norm)
+{
+	struct isp_video_fh *vfh = to_isp_video_fh(fh);
+	struct isp_video *video = video_drvdata(file);
+
+	mutex_lock(&video->mutex);
+	*norm = vfh->standard.id;
+	mutex_unlock(&video->mutex);
+
+	return 0;
+}
+
+static int isp_video_s_std(struct file *file, void *fh, v4l2_std_id *norm)
+{
+	struct isp_video *video = video_drvdata(file);
+	struct media_entity *entity = &video->video.entity;
+	struct media_entity_graph graph;
+	struct v4l2_subdev *subdev;
+	int ret = 0;
+
+	media_entity_graph_walk_start(&graph, entity);
+	while ((entity = media_entity_graph_walk_next(&graph))) {
+		if (media_entity_type(entity) ==
+				MEDIA_ENT_T_V4L2_SUBDEV) {
+			subdev = media_entity_to_v4l2_subdev(entity);
+			if (subdev != NULL) {
+				ret = v4l2_subdev_call(subdev, core, s_std,
+						*norm);
+				if (ret < 0 && ret != -ENOIOCTLCMD)
+					return ret;
+			}
+		}
+	}
+
+	return 0;
 }
 
 static const struct v4l2_ioctl_ops isp_video_ioctl_ops = {
@@ -1161,6 +1252,9 @@ static const struct v4l2_ioctl_ops isp_video_ioctl_ops = {
 	.vidioc_enum_input		= isp_video_enum_input,
 	.vidioc_g_input			= isp_video_g_input,
 	.vidioc_s_input			= isp_video_s_input,
+	.vidioc_querystd		= isp_video_querystd,
+	.vidioc_g_std			= isp_video_g_std,
+	.vidioc_s_std			= isp_video_s_std,
 };
 
 /* -----------------------------------------------------------------------------
@@ -1325,6 +1419,8 @@ int omap3isp_video_register(struct isp_video *video, struct v4l2_device *vdev)
 		printk(KERN_ERR "%s: could not register video device (%d)\n",
 			__func__, ret);
 
+	video->video.tvnorms		= V4L2_STD_NTSC | V4L2_STD_PAL;
+	video->video.current_norm	= V4L2_STD_NTSC;
 	return ret;
 }
 
drivers/media/video/omap3isp/ispvideo.h +1 -0
index 53160aa..bb8feb6 100644
@@ -182,6 +182,7 @@ struct isp_video_fh {
 	struct isp_video *video;
 	struct isp_video_queue queue;
 	struct v4l2_format format;
+	struct v4l2_standard standard;
 	struct v4l2_fract timeperframe;
 };
 
Signature · 6 lines
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Sakari Ailus
e-mail: sakari.ailus at iki.fi	jabber/XMPP/Gmail: sailus at retiisi.org.uk