From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Bhupesh SHARMA <bhupesh.sharma@st.com>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"balbi@ti.com" <balbi@ti.com>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Subject: Re: [PATCH 5/5] usb: gadget/uvc: Add support for 'USB_GADGET_DELAYED_STATUS' response for a set_intf(alt-set 1) command
Date: Sat, 07 Jul 2012 15:06:34 +0200 [thread overview]
Message-ID: <2053957.fXKIb2sWrZ@avalon> (raw)
In-Reply-To: <D5ECB3C7A6F99444980976A8C6D896384FAA6331E6@EAPEX1MAIL1.st.com>
Hi Bhupesh,
On Tuesday 03 July 2012 23:47:14 Bhupesh SHARMA wrote:
> On Wednesday, June 20, 2012 3:19 AM Laurent Pinchart wrote:
> > On Friday 01 June 2012 15:08:58 Bhupesh Sharma wrote:
> > > This patch adds the support in UVC webcam gadget design for providing
> > > USB_GADGET_DELAYED_STATUS in response to a set_interface(alt setting 1)
> > > command issue by the Host.
> > >
> > > The current UVC webcam gadget design generates a STREAMON event
> > > corresponding to a set_interface(alt setting 1) command from the Host.
> > > This STREAMON event will eventually be routed to a real V4L2 device.
> > >
> > > To start video streaming, it may be required to perform some register
> > > writes to a camera sensor device over slow external busses like I2C or
> > > SPI. So, it makes sense to ensure that we delay the STATUS stage of the
> > > set_interface(alt setting 1) command.
> > >
> > > Otherwise, a lot of ISOC IN tokens sent by the Host will be replied to
> > > by zero-length packets by the webcam device. On certain Hosts this may
> > > even> lead to ISOC URBs been cancelled from the Host side.
> > >
> > > So, as soon as we finish doing all the "streaming" related stuff on the
> > > real V4L2 device, we call a STREAMON ioctl on the UVC side and from here
> > > we call the 'usb_composite_setup_continue' function to complete the
> > > status stage of the set_interface(alt setting 1) command.
> >
> > That sounds good, thank you for coming up with a solution to this
> > issue.
> >
> > > Further, we need to ensure that we queue no video buffers on the UVC
> > > webcam gadget, until we de-queue a video buffer from the V4L2 device.
> > > Also, we need to enable UVC video related stuff at the first QBUF ioctl
> > > call itself, as the application will call the STREAMON on UVC side only
> > > when it has dequeued sufficient buffers from the V4L2 side and queued
> > > them to the UVC gadget. So, the UVC video enable stuff cannot be done in
> > > STREAMON ioctl call.
> >
> > Is that really required ? First of all, the userspace application can
> > queue buffers before it calls VIDIOC_STREAMON. Assuming it doesn't, the
> > gadget driver calls uvc_video_enable() at streamon time, which then calls
> > uvc_video_pump(). As no buffer is queued, the function will return without
> > queuing any USB request, so we shouldn't have any problem.
>
> I think that while working with a real video device, it will be possible to
> queue a buffer at UVC end only when atleast one buffer has been dequeued
> from the V4L2 device side (and has some real data).
>
> This is because for a uvc buffer being queued we need to pass the v4l2
> buffer's buffer.start and buffer.length in the qbuf call at UVC side.
I agree with you, queuing a buffer on the UVC gadget side will usually require
starting capture and waiting for a frame on a V4L2 source device. However,
unless I'm mistaken, the UVC gadget code already deals with that situation
correctly. As I explained, when your application calls VIDIOC_STREAMON on the
UVC gadget, the uvc_video_pump() will not find any V4L2 buffer to be
transferred, and will return without queuing any URB. It will then be called
again by VIDIOC_QBUF, and will then start the transfer.
Adding support for USB_GADGET_DELAYED_STATUS is thus a good idea, but the pre-
streaming state is in my opinion not needed. Feel free to prove me wrong
though :-)
> > > For the same we add two more UVC states:
> > > - PRE_STREAMING : not even a single buffer has been queued to UVC
> > > - BUF_QUEUED_STREAMING_OFF : one video buffer has been queued to UVC
> > > but we have not yet enabled STREAMING on UVC side.
> > >
> > > Signed-off-by: Bhupesh Sharma <bhupesh.sharma@st.com>
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2012-07-07 13:06 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-01 9:37 [PATCH 0/5] UVC webcam gadget related changes Bhupesh Sharma
2012-06-01 9:38 ` [PATCH 1/5] usb: gadget/uvc: Fix string descriptor STALL issue when multiple uvc functions are added to a configuration Bhupesh Sharma
2012-06-01 9:38 ` [PATCH 2/5] usb: gadget/uvc: Use macro for interrupt endpoint status size instead of using a MAGIC number Bhupesh Sharma
2012-06-01 9:38 ` [PATCH 3/5] usb: gadget/uvc: Add super-speed support to UVC webcam gadget Bhupesh Sharma
2012-06-08 15:52 ` Laurent Pinchart
2012-06-09 5:39 ` Bhupesh SHARMA
2012-06-11 7:25 ` Laurent Pinchart
2012-06-15 10:24 ` Bhupesh SHARMA
2012-06-01 9:38 ` [PATCH 4/5] usb: gadget/uvc: Port UVC webcam gadget to use videobuf2 framework Bhupesh Sharma
2012-06-04 15:13 ` Felipe Balbi
2012-06-04 15:21 ` Bhupesh SHARMA
2012-06-04 15:28 ` Felipe Balbi
2012-06-04 15:37 ` Bhupesh SHARMA
2012-06-04 15:40 ` Felipe Balbi
2012-06-04 15:43 ` Bhupesh SHARMA
2012-06-04 16:40 ` Laurent Pinchart
2012-06-04 16:41 ` Felipe Balbi
2012-06-18 10:14 ` Bhupesh SHARMA
2012-06-18 22:50 ` Laurent Pinchart
2012-06-18 22:49 ` Laurent Pinchart
2012-07-03 15:42 ` Bhupesh SHARMA
2012-07-07 11:58 ` Laurent Pinchart
2012-07-25 18:18 ` Bhupesh SHARMA
2012-06-01 9:38 ` [PATCH 5/5] usb: gadget/uvc: Add support for 'USB_GADGET_DELAYED_STATUS' response for a set_intf(alt-set 1) command Bhupesh Sharma
2012-06-18 10:14 ` Bhupesh SHARMA
2012-06-19 21:49 ` Laurent Pinchart
2012-07-03 15:47 ` Bhupesh SHARMA
2012-07-07 13:06 ` Laurent Pinchart [this message]
2012-07-25 18:14 ` Bhupesh SHARMA
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=2053957.fXKIb2sWrZ@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=balbi@ti.com \
--cc=bhupesh.sharma@st.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/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.