RE: Using UVC webcam gadget with a real v4l2 device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Laurent,

> -----Original Message-----
> From: Laurent Pinchart [mailto:laurent.pinchart@xxxxxxxxxxxxxxxx]
> Sent: Monday, April 30, 2012 3:51 PM
> To: Bhupesh SHARMA
> Cc: linux-usb@xxxxxxxxxxxxxxx; linux-media@xxxxxxxxxxxxxxx;
> balbi@xxxxxx; g.liakhovetski@xxxxxx
> Subject: Re: Using UVC webcam gadget with a real v4l2 device
> 
> Hi Bhupesh,
> 
> On Thursday 26 April 2012 13:23:59 Bhupesh SHARMA wrote:
> > Hi Laurent,
> >
> > Sorry to jump-in before your reply on my previous mail,
> > but as I was studying the USERPTR stuff in more detail, I have a few
> more
> > queries which I believe you can include in your reply as well..
> 
> [snip]
> 
> > I am now a bit confused on how the entire system will work now:
> > 	- Does USERPTR method needs to be supported both in UVC gadget
> and
> > soc-camera side, or one can still support the MMAP method and the
> other can
> > now be changed to support USERPTR method and we can achieve a ZERO
> buffer
> > copy operation using this method?
> 
> You need USERPTR support on one side only. In practice many (all?) soc-
> camera
> drivers require physically contiguous memory, so you will need to use
> MMAP on
> the soc-camera side and USERPTR on the UVC gadget side. DMABUF, when
> merged in
> the kernel, will be a better solution (but will require all drivers to
> use
> vb2).

Perfect. So, I plan now to add vb2 support for uvc-gadget and leave soc-camera
side to use the mmap stuff.

Now, waiting for your pointers for managing the race-conditions in the UVC gadget
and also avoiding the memcpy that is happening in the QBUF call on the UVC gadget,
before I start the actual work.

Thanks for your help.

Regards,
Bhupesh

> > 	- More specifically, I would like to keep the soc-camera still
> using MMAP
> > (and hence still using video-buf) and make changes at the UVC gadget
> side
> > to support USERPTR and videobuf2. Will this work?
> 
> Please see above :-)
> 
> > 	- At the application side how should we design the flow in case
> both
> > support USERPTR, i.e. the buffer needs to be protected from
> simultaneous
> > access from the UVC gadget driver and soc-camera driver (to ensure
> that a
> > single buffer can be shared across them). Also in case we keep soc-
> camera
> > still using MMAP and UVC gadget side supporting USERPTR, how can we
> share a
> > common buffer across the UVC gadget and soc-camera driver.
> 
> That's easy. Request the same number of buffers on both sides with
> REQBUFS,
> mmap() them to userspace on the soc-camera side, and then use the user
> pointer
> to queue them with QBUF on the UVC side. You just need to ensure that a
> buffer
> is never enqueued to two drivers at the same time. Wait for buffers to
> be
> ready on both sides with select(), and when a buffer is ready dequeue
> it and
> requeue it on the other side.
> 
> > 	- In case of USERPTR method the camera capture hardware should be
> able to
> > DMA the received data to the user space buffers. Are there any
> specific
> > requirements on the DMA capability of these use-space buffers
> > (scatter-gather or contiguous?).
> 
> DMA to userspace is quite hackish. You should use the MMAP method on
> the soc-
> camera side.
> 
> --
> Regards,
> 
> Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux