All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Tretter <m.tretter@pengutronix.de>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Daniel Scally <dan.scally@ideasonboard.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Michael Grzeschik <m.grzeschik@pengutronix.de>,
	linux-usb@vger.kernel.org, linux-media@vger.kernel.org,
	kernel@pengutronix.de
Subject: Re: [PATCH 0/8] usb: gadget: uvc: fix errors reported by v4l2-compliance
Date: Mon, 27 Mar 2023 14:26:03 +0200	[thread overview]
Message-ID: <20230327122603.GB7238@pengutronix.de> (raw)
In-Reply-To: <20230324093834.GJ18895@pendragon.ideasonboard.com>

Hi Laurent,

On Fri, 24 Mar 2023 11:38:34 +0200, Laurent Pinchart wrote:
> On Thu, Mar 23, 2023 at 12:41:09PM +0100, Michael Tretter wrote:
> > This series fixes various errors and warnings that are reported by
> > v4l2-compliance for the v4l2 output device created by the UVC gadget.
> > 
> > Most notably, it changes the driver to take the initial format from the
> > configfs instead of using a hard coded value that might be rejected later in
> > the SET_FORMAT call. Note that user space is still responsible for negotiating
> > the format with the UVC host.
> 
> I'm afraid I dislike most of this series (apart from the fix to
> REQBUFS). It was a bad idea to add format handling to the driver in the
> first place, and this series adds up code on top of that to please a
> compliance tool but without any added value. This code should never be
> exercised by userspace and will just bloat the kernel. That's not good.

There is a userspace implementation that exercises this code: The GStreamer
v4l2uvcsink element [0] handles the format negotiation with the UVC host, but
internally uses a v4l2sink to pass the video buffers to the V4L2 output device
of the UVC gadget. The v4l2sink element treats the UVC V4L2 device like any
other V4L2 device, uses the specified ioctls, and, thus, expects compliant
behavior from the V4L2 device.

Being able to use a GStreamer pipeline with a v4l2uvcsink and v4l2sink element
to pass video data from any GStreamer source element to a UVC gadget is so
beneficial that it justifies adding the few missing V4L2 callbacks to make the
device's behavior compliant to V4L2. Especially, as the behavior of the code
can easily be exercised and tested with v4l2-compliance.

Therefore, I think the added code actually has value, as it allows to reuse
existing userspace code for V4L2 devices with the V4L2 device of the UVC
gadget.

Michael

[0] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1304

> I'd recommend reverting the series that add format handling if you want
> to improve the UVC gadget driver.
> 
> > To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > To: Daniel Scally <dan.scally@ideasonboard.com>
> > To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Cc: Michael Grzeschik <m.grzeschik@pengutronix.de>
> > Cc: linux-usb@vger.kernel.org
> > Cc: linux-media@vger.kernel.org
> > Cc: kernel@pengutronix.de
> > Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
> > 
> > ---
> > Michael Tretter (8):
> >       usb: gadget: uvc: use fourcc printk helper
> >       usb: gadget: uvc: fix return code of REQBUFS
> >       usb: gadget: uvc: implement s/g_output ioctl
> >       usb: gadget: uvc: move video format initialization to uvc_v4l2
> >       usb: gadget: uvc: initialize video format using configfs
> >       usb: gadget: uvc: try harder to find a valid format
> >       usb: gadget: uvc: add colorspace handling
> >       usb: gadget: uvc: implement s/g_parm
> > 
> >  drivers/usb/gadget/function/f_uvc.c     |   2 +
> >  drivers/usb/gadget/function/uvc.h       |   5 +
> >  drivers/usb/gadget/function/uvc_queue.c |   6 +-
> >  drivers/usb/gadget/function/uvc_v4l2.c  | 235 ++++++++++++++++++++++++++++++--
> >  drivers/usb/gadget/function/uvc_v4l2.h  |   3 +
> >  drivers/usb/gadget/function/uvc_video.c |   5 -
> >  6 files changed, 238 insertions(+), 18 deletions(-)
> > ---
> > base-commit: 8be174835f07b2c106b9961c0775486d06112a3c
> > change-id: 20230323-uvc-gadget-cleanup-47b1495befb9

      reply	other threads:[~2023-03-27 12:26 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23 11:41 [PATCH 0/8] usb: gadget: uvc: fix errors reported by v4l2-compliance Michael Tretter
2023-03-23 11:41 ` [PATCH 1/8] usb: gadget: uvc: use fourcc printk helper Michael Tretter
2023-03-24  7:44   ` Dan Scally
2023-03-24  9:21   ` Laurent Pinchart
2023-03-23 11:41 ` [PATCH 2/8] usb: gadget: uvc: fix return code of REQBUFS Michael Tretter
2023-03-24  7:50   ` Dan Scally
2023-03-24  9:25     ` Laurent Pinchart
2023-03-23 11:41 ` [PATCH 3/8] usb: gadget: uvc: implement s/g_output ioctl Michael Tretter
2023-03-24  9:20   ` Laurent Pinchart
2023-03-24  9:21     ` Dan Scally
2023-03-24  9:39       ` Hans Verkuil
2023-03-24  9:49         ` Laurent Pinchart
2023-03-23 11:41 ` [PATCH 4/8] usb: gadget: uvc: move video format initialization to uvc_v4l2 Michael Tretter
2023-03-24  9:31   ` Laurent Pinchart
2023-03-23 11:41 ` [PATCH 5/8] usb: gadget: uvc: initialize video format using configfs Michael Tretter
2023-03-23 11:41 ` [PATCH 6/8] usb: gadget: uvc: try harder to find a valid format Michael Tretter
2023-03-24  9:35   ` Laurent Pinchart
2023-03-23 11:41 ` [PATCH 7/8] usb: gadget: uvc: add colorspace handling Michael Tretter
2023-03-24  9:33   ` Laurent Pinchart
2023-03-23 11:41 ` [PATCH 8/8] usb: gadget: uvc: implement s/g_parm Michael Tretter
2023-03-23 18:02   ` kernel test robot
2023-03-24  9:32   ` Laurent Pinchart
2023-03-24  9:38 ` [PATCH 0/8] usb: gadget: uvc: fix errors reported by v4l2-compliance Laurent Pinchart
2023-03-27 12:26   ` Michael Tretter [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=20230327122603.GB7238@pengutronix.de \
    --to=m.tretter@pengutronix.de \
    --cc=dan.scally@ideasonboard.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.grzeschik@pengutronix.de \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.