1
0
Fork 0
Commit Graph

7 Commits (8922a908908ff947f1f211e07e2e97f1169ad3cb)

Author SHA1 Message Date
Bhupesh Sharma d692522577 usb: gadget/uvc: Port UVC webcam gadget to use videobuf2 framework
This patch reworks the videobuffer management logic present in the UVC
webcam gadget and ports it to use the "more apt" videobuf2 framework for
video buffer management.

To support routing video data captured from a real V4L2 video capture
device with a "zero copy" operation on videobuffers (as they pass from
the V4L2 domain to UVC domain via a user-space application), we need to
support USER_PTR IO method at the UVC gadget side.

So the V4L2 capture device driver can still continue to use MMAP IO
method and now the user-space application can just pass a pointer to the
video buffers being dequeued from the V4L2 device side while queueing
them at the UVC gadget end. This ensures that we have a "zero-copy"
design as the videobuffers pass from the V4L2 capture device to the UVC
gadget.

Note that there will still be a need to apply UVC specific payload
headers on top of each UVC payload data, which will still require a copy
operation to be performed in the 'encode' routines of the UVC gadget.

This patch also addresses one issue found out while porting the UVC
gadget to videobuf2 framework:
	- In case the usb requests queued by the gadget get completed
	  with a status of -ESHUTDOWN (disconnected from host),
	  the queue of videobuf2 should be cancelled to ensure that the
	  application space daemon is not left in a state waiting for
	  a vb2 to be successfully absorbed at the USB side.

Signed-off-by: Bhupesh Sharma <bhupesh.sharma@st.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2013-04-02 11:42:48 +03:00
Cyril Roelandt 6854bcdc6f usb: gadget: uvc: Use GFP_ATOMIC under spin lock
Found using the following semantic patch:
<spml>
@@
@@
spin_lock_irqsave(...);
... when != spin_unlock_irqrestore(...);
* GFP_KERNEL
</spml>

Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Bhupesh Sharma <bhupesh.sharma@st.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:18:22 +02:00
Bhupesh Sharma 326b0e613b usb: gadget: uvc: Make video streaming buffer size comply with USB3.0 SS
As per the USB3.0 specs, the bandwidth requirements of a UVC's video
streaming endpoint will change to support super-speed. These changes
will be dependent on whether the UVC video streaming endpoint is Bulk or
Isochronous:

- If video streaming endpoint is Isochronous:
  As per Section 4.4.8.2 (Isochronous Transfer Bandwidth Requirements)
  of the USB3.0 specs:

    A SuperSpeed isochronous endpoint can move up to three burst
    transactions of up to 16 maximum sized packets (3 * 16 * 1024 bytes)
    per service interval.

- If video streaming endpoint is Bulk:
  As per 4.4.6.1 (Bulk Transfer Data Packet Size) of the USB3.0 specs:

    An endpoint for bulk transfers shall set the maximum data packet
    payload size in its endpoint descriptor to 1024 bytes. It also
    specifies the burst size that the endpoint can accept from or
    transmit on the SuperSpeed bus. The allowable burst size for a bulk
    endpoint shall be in the range of 1 to 16.

So, in the Isochronous case, we can define the USB request's buffer to
be equal to = (Maximum packet size) * (bMaxBurst + 1) * (Mult + 1), so
that the UDC driver can try to send out this buffer in one Isochronous
service interval.

The same computation will hold good for the Bulk case as the Mult
value is 0 here and we can have a USB request buffer of maximum
16 * 1024 bytes size, which can be sent out by the UDC driver as
per the Bulk bandwidth allocation on the USB3 bus.

This patch adds the above-mentioned support and is also USB2.0 backward
compliant.

Signed-off-by: Bhupesh Sharma <bhupesh.sharma@st.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Bhupesh Sharma <bhupesh.sharma@st.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:18:22 +02:00
Felipe Balbi 482ef1d2fe usb: gadget: uvc: remove references to DMA_ADDR_INVALID
gadget drivers shouldn't touch req->dma at all,
since UDC drivers are the ones required to handle
mapping and unmapping of the request buffer.

Remove references to DMA_ADDR_INVALID so we don't
creat false expectations to gadget driver writers.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:18:12 +02:00
Klaus Schwarzkopf 28c9fc68eb usb gadget: clean up FSF boilerplate text
remove the following two paragraphs as they are not needed:

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
License for more details.

You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,59
Temple Place - Suite 330, Boston, MA  02111-1307, USA.

Signed-off-by: Klaus Schwarzkopf <schwarzkopf@sensortherm.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-09 16:00:09 -07:00
Laurent Pinchart 5d9955f8a9 V4L/DVB: uvc: Fix multiple symbols definitions with UVC gadget and host drivers
The UVC gadget driver borrowed code from the UVC host driver without
changing the symbol names. This results in a namespace clash with
multiple definitions of several symbols when compiling both drivers in
the kernel.

Make all generic UVC functions and variables static in the UVC gadget
driver, as the symbols are not referenced outside of the gadget driver.
Rename the uvc_trace_param global variable to uvc_gadget_trace_param.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-07-11 17:45:10 -03:00
Laurent Pinchart cdda479f15 USB gadget: video class function driver
This USB video class function driver implements a video capture device from the
host's point of view. It creates a V4L2 output device on the gadget's side to
transfer data from a userspace application over USB.

The UVC-specific descriptors are passed by the gadget driver to the UVC
function driver, making them completely configurable without any modification
to the function's driver code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-05-20 13:21:41 -07:00