Skip to contentSkip to conversation

uvc/vsp1/ipu3: use VFL_TYPE_METADATA for metadata device.

PATCH New Vandana BN 2 participants 2 messages Sep 11, 2019 – Sep 14, 2019

Subsystems (4)
lore
Share & tools
lore

Vandana BN

author
#0 lore raw

PATCH 1/1 uvc/vsp1/ipu3: use VFL_TYPE_METADATA for metadata device.

Use vfl_type VFL_TYPE_METADATA instead of VFL_TYPE_GRABBER for metadata device.

Signed-off-by Vandana BN <bnvandana at gmail.com>
---
 drivers/media/platform/vsp1/vsp1_histo.c | 4 ++--
 drivers/media/usb/uvc/uvc_driver.c       | 4 +++-
 drivers/staging/media/ipu3/ipu3-v4l2.c   | 8 +++++++-
 3 files changed, 12 insertions(+), 4 deletions(-)
drivers/media/platform/vsp1/vsp1_histo.c +2 -2
index 30d751f2cccf..1e1429817758 100644
@@ -551,7 +551,7 @@ int vsp1_histogram_init(struct vsp1_device *vsp1, struct vsp1_histogram *histo,
 	histo->video.fops = &histo_v4l2_fops;
 	snprintf(histo->video.name, sizeof(histo->video.name),
 		 "%s histo", histo->entity.subdev.name);
-	histo->video.vfl_type = VFL_TYPE_GRABBER;
+	histo->video.vfl_type = VFL_TYPE_METADATA;
 	histo->video.release = video_device_release_empty;
 	histo->video.ioctl_ops = &histo_v4l2_ioctl_ops;
 	histo->video.device_caps = V4L2_CAP_META_CAPTURE | V4L2_CAP_STREAMING;
@@ -576,7 +576,7 @@ int vsp1_histogram_init(struct vsp1_device *vsp1, struct vsp1_histogram *histo,
 
 	/* ... and register the video device. */
 	histo->video.queue = &histo->queue;
-	ret = video_register_device(&histo->video, VFL_TYPE_GRABBER, -1);
+	ret = video_register_device(&histo->video, VFL_TYPE_METADATA, -1);
 	if (ret < 0) {
 		dev_err(vsp1->dev, "failed to register video device\n");
 		goto error;
drivers/media/usb/uvc/uvc_driver.c +3 -1
index 66ee168ddc7e..cf2e23238268 100644
@@ -1942,6 +1942,7 @@ int uvc_register_video_device(struct uvc_device *dev,
 			      const struct v4l2_ioctl_ops *ioctl_ops)
 {
 	int ret;
+	int vfl_type = VFL_TYPE_GRABBER;
 
 	/* Initialize the video buffers queue. */
 	ret = uvc_queue_init(queue, type, !uvc_no_drop_param);
@@ -1975,6 +1976,7 @@ int uvc_register_video_device(struct uvc_device *dev,
 		break;
 	case V4L2_BUF_TYPE_META_CAPTURE:
 		vdev->device_caps = V4L2_CAP_META_CAPTURE | V4L2_CAP_STREAMING;
+		vfl_type = VFL_TYPE_METADATA;
 		break;
 	}
 
@@ -1986,7 +1988,7 @@ int uvc_register_video_device(struct uvc_device *dev,
 	 */
 	video_set_drvdata(vdev, stream);
 
-	ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1);
+	ret = video_register_device(vdev, vfl_type, -1);
 	if (ret < 0) {
 		uvc_printk(KERN_ERR, "Failed to register %s device (%d).\n",
 			   v4l2_type_names[type], ret);
drivers/staging/media/ipu3/ipu3-v4l2.c +7 -1
index 3c7ad1eed434..56fab0de4342 100644
@@ -1245,7 +1245,13 @@ static int imgu_v4l2_node_setup(struct imgu_device *imgu, unsigned int pipe,
 	vdev->queue = &node->vbq;
 	vdev->vfl_dir = node->output ? VFL_DIR_TX : VFL_DIR_RX;
 	video_set_drvdata(vdev, imgu);
-	r = video_register_device(vdev, VFL_TYPE_GRABBER, -1);
+
+	if (vbq->type == V4L2_BUF_TYPE_META_CAPTURE ||
+	    vbq->type == V4L2_BUF_TYPE_META_OUTPUT)
+		r = video_register_device(vdev, VFL_TYPE_METADATA, -1);
+	else
+		r = video_register_device(vdev, VFL_TYPE_GRABBER, -1);
+
 	if (r) {
 		dev_err(dev, "failed to register video device (%d)", r);
 		media_entity_cleanup(&vdev->entity);
Signature · 1 line
2.17.1
#1 lore raw
Thank you for the patch! Yet something to improve:

Hi Vandana,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[cannot apply to v5.3-rc8 next-20190904]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Vandana-BN/uvc-vsp1-ipu3-use-VFL_TYPE_METADATA-for-metadata-device/20190914-074954
base:   git://linuxtv.org/media_tree.git master
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 7.4.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=ia64

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>

All errors (new ones prefixed by >>):

drivers/media/usb/uvc/uvc_driver.c: In function 'uvc_register_video_device':

>> drivers/media/usb/uvc/uvc_driver.c:1979:14: error: 'VFL_TYPE_METADATA' undeclared (first use in this function); did you mean 'VFL_TYPE_MAX'?
      vfl_type = VFL_TYPE_METADATA;
                 ^~~~~~~~~~~~~~~~~
                 VFL_TYPE_MAX
   drivers/media/usb/uvc/uvc_driver.c:1979:14: note: each undeclared identifier is reported only once for each function it appears in
--
   drivers/media/platform/vsp1/vsp1_histo.c: In function 'vsp1_histogram_init':
>> drivers/media/platform/vsp1/vsp1_histo.c:554:26: error: 'VFL_TYPE_METADATA' undeclared (first use in this function); did you mean 'VFL_TYPE_MAX'?
     histo->video.vfl_type = VFL_TYPE_METADATA;
                             ^~~~~~~~~~~~~~~~~
                             VFL_TYPE_MAX

drivers/media/platform/vsp1/vsp1_histo.c:554:26: note: each undeclared identifier is reported only once for each function it appears in

vim +1979 drivers/media/usb/uvc/uvc_driver.c

1935
1936 int uvc_register_video_device(struct uvc_device *dev,

  1937				      struct uvc_streaming *stream,
  1938				      struct video_device *vdev,
  1939				      struct uvc_video_queue *queue,
  1940				      enum v4l2_buf_type type,
  1941				      const struct v4l2_file_operations *fops,
  1942				      const struct v4l2_ioctl_ops *ioctl_ops)
  1943	{
  1944		int ret;
  1945		int vfl_type = VFL_TYPE_GRABBER;
  1946	
  1947		/* Initialize the video buffers queue. */
  1948		ret = uvc_queue_init(queue, type, !uvc_no_drop_param);
  1949		if (ret)
  1950			return ret;
  1951	
  1952		/* Register the device with V4L. */
  1953	
  1954		/*
  1955		 * We already hold a reference to dev->udev. The video device will be
  1956		 * unregistered before the reference is released, so we don't need to
  1957		 * get another one.
  1958		 */
  1959		vdev->v4l2_dev = &dev->vdev;
  1960		vdev->fops = fops;
  1961		vdev->ioctl_ops = ioctl_ops;
  1962		vdev->release = uvc_release;
  1963		vdev->prio = &stream->chain->prio;
  1964		if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
  1965			vdev->vfl_dir = VFL_DIR_TX;
  1966		else
  1967			vdev->vfl_dir = VFL_DIR_RX;
  1968	
  1969		switch (type) {
  1970		case V4L2_BUF_TYPE_VIDEO_CAPTURE:
  1971		default:
  1972			vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
  1973			break;
  1974		case V4L2_BUF_TYPE_VIDEO_OUTPUT:
  1975			vdev->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
  1976			break;
  1977		case V4L2_BUF_TYPE_META_CAPTURE:
  1978			vdev->device_caps = V4L2_CAP_META_CAPTURE | V4L2_CAP_STREAMING;
> 1979			vfl_type = VFL_TYPE_METADATA;

1980 break;
1981 }
1982
1983 strscpy(vdev->name, dev->name, sizeof(vdev->name));
1984
1985 /*
1986 * Set the driver data before calling video_register_device, otherwise
1987 * the file open() handler might race us.
1988 */
1989 video_set_drvdata(vdev, stream);
1990
1991 ret = video_register_device(vdev, vfl_type, -1);
1992 if (ret < 0) {
1993 uvc_printk(KERN_ERR, "Failed to register %s device (%d).\n",
1994 v4l2_type_names[type], ret);
1995 return ret;
1996 }
1997
1998 kref_get(&dev->ref);
1999 return 0;
2000 }
2001

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 54564 bytes
Desc: not available
URL: <http://lists.linuxfoundation.org/pipermail/linux-kernel-mentees/attachments/20190914/426ec56e/attachment-0001.bin>