LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Ricardo Ribalda <ribalda@chromium.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Tomasz Figa <tfiga@chromium.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	senozhatsky@chromium.org
Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Subject: Re: [PATCH v3 8/8] uvc: use vb2 ioctl and fop helpers
Date: Fri, 12 Mar 2021 14:59:09 +0100	[thread overview]
Message-ID: <8384a3c0-2196-7054-207c-2a01cc4d7597@xs4all.nl> (raw)
In-Reply-To: <20210312124830.1344255-9-ribalda@chromium.org>

On 12/03/2021 13:48, Ricardo Ribalda wrote:
> From: Hans Verkuil <hverkuil@xs4all.nl>
> 
> When uvc was written the vb2 ioctl and file operation helpers didn't exist.
> 
> This patch switches uvc over to those helpers, which removes a lot of boilerplate
> code and simplifies VIDIOC_G/S_PRIORITY handling and allows us to drop the
> 'privileges' scheme, since that's now handled inside the vb2 helpers.
> 
> This makes it possible for uvc to pass the v4l2-compliance streaming tests.
> 
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> ---
>  drivers/media/usb/uvc/uvc_driver.c   |   7 +-
>  drivers/media/usb/uvc/uvc_metadata.c |   8 +-
>  drivers/media/usb/uvc/uvc_queue.c    | 131 -------------
>  drivers/media/usb/uvc/uvc_v4l2.c     | 272 ++-------------------------
>  drivers/media/usb/uvc/uvcvideo.h     |  28 ---
>  5 files changed, 24 insertions(+), 422 deletions(-)
> 
> diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> index 6c928e708615..b9f3984e9f80 100644
> --- a/drivers/media/usb/uvc/uvc_driver.c
> +++ b/drivers/media/usb/uvc/uvc_driver.c
> @@ -1911,7 +1911,6 @@ static struct uvc_video_chain *uvc_alloc_chain(struct uvc_device *dev)
>  	INIT_LIST_HEAD(&chain->entities);
>  	mutex_init(&chain->ctrl_mutex);
>  	chain->dev = dev;
> -	v4l2_prio_init(&chain->prio);
>  
>  	return chain;
>  }
> @@ -2194,7 +2193,7 @@ int uvc_register_video_device(struct uvc_device *dev,
>  	vdev->fops = fops;
>  	vdev->ioctl_ops = ioctl_ops;
>  	vdev->release = uvc_release;
> -	vdev->prio = &stream->chain->prio;
> +	vdev->queue = &queue->queue;
>  	if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
>  		vdev->vfl_dir = VFL_DIR_TX;
>  	else
> @@ -2560,8 +2559,8 @@ static int __uvc_resume(struct usb_interface *intf, int reset)
>  		if (stream->intf == intf) {
>  			ret = uvc_video_resume(stream, reset);
>  			if (ret < 0)
> -				uvc_queue_streamoff(&stream->queue,
> -						    stream->queue.queue.type);
> +				vb2_streamoff(&stream->queue.queue,
> +					      stream->queue.queue.type);
>  			return ret;
>  		}
>  	}
> diff --git a/drivers/media/usb/uvc/uvc_metadata.c b/drivers/media/usb/uvc/uvc_metadata.c
> index b6279ad7ac84..2f52cdc62929 100644
> --- a/drivers/media/usb/uvc/uvc_metadata.c
> +++ b/drivers/media/usb/uvc/uvc_metadata.c
> @@ -96,7 +96,7 @@ static int uvc_meta_v4l2_set_format(struct file *file, void *fh,
>  	 */
>  	mutex_lock(&stream->mutex);
>  
> -	if (uvc_queue_allocated(&stream->queue))
> +	if (vb2_is_busy(&stream->queue.queue))

This should be &stream->meta.queue.queue. That explains this failure that I get
with v4l2-compliance -d1 when streaming with v4l2-ctl --stream-mmap:

fail: v4l2-test-formats.cpp(452): expected EINVAL, but got 16 when getting format for buftype 13
        test VIDIOC_S_FMT: FAIL

Regards,

	Hans

      reply	other threads:[~2021-03-12 14:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12 12:48 [PATCH v3 0/8] Fix v4l2-compliance errors Ricardo Ribalda
2021-03-12 12:48 ` [PATCH v3 1/8] media: v4l2-ioctl: Fix check_ext_ctrls Ricardo Ribalda
2021-03-12 12:48 ` [PATCH v3 2/8] media: uvcvideo: Set capability in s_param Ricardo Ribalda
2021-03-12 12:48 ` [PATCH v3 3/8] media: uvcvideo: Return -EIO for control errors Ricardo Ribalda
2021-03-12 12:48 ` [PATCH v3 4/8] media: uvcvideo: set error_idx to count on EACCESS Ricardo Ribalda
2021-03-12 22:42   ` Laurent Pinchart
2021-03-12 12:48 ` [PATCH v3 5/8] media: uvcvideo: refactor __uvc_ctrl_add_mapping Ricardo Ribalda
2021-03-12 22:40   ` Laurent Pinchart
2021-03-12 12:48 ` [PATCH v3 6/8] media: uvcvideo: Add support for V4L2_CTRL_TYPE_CTRL_CLASS Ricardo Ribalda
2021-03-12 22:44   ` Laurent Pinchart
2021-03-12 12:48 ` [PATCH v3 7/8] media: uvcvideo: Set a different name for the metadata entity Ricardo Ribalda
2021-03-12 22:27   ` Laurent Pinchart
2021-03-12 23:17     ` Ricardo Ribalda Delgado
2021-03-12 23:28       ` Laurent Pinchart
2021-03-12 23:47         ` Ricardo Ribalda Delgado
2021-03-12 12:48 ` [PATCH v3 8/8] uvc: use vb2 ioctl and fop helpers Ricardo Ribalda
2021-03-12 13:59   ` Hans Verkuil [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8384a3c0-2196-7054-207c-2a01cc4d7597@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ribalda@chromium.org \
    --cc=senozhatsky@chromium.org \
    --cc=tfiga@chromium.org \
    --subject='Re: [PATCH v3 8/8] uvc: use vb2 ioctl and fop helpers' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).