linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Hans Petter Selasky <hselasky@c2i.net>
Cc: Sakari Ailus <sakari.ailus@iki.fi>, linux-media@vger.kernel.org
Subject: Re: Question about V4L2_MEMORY_USERPTR
Date: Thu, 05 Jul 2012 19:24:47 +0200	[thread overview]
Message-ID: <4977006.H7Qry87s3L@avalon> (raw)
In-Reply-To: <201207022107.56259.hselasky@c2i.net>

Hi Hans-Petter,

On Monday 02 July 2012 21:07:56 Hans Petter Selasky wrote:
> Hi Laurent and Sakari,
> 
> For the sake of the matter, here is the driver in question:
> http://www.freshports.org/multimedia/webcamd/
> 
> Under native-Linux (kernel mode):
> 
> I've looked at the linux-media code a bit and it appears that video data is
> copied directly from the USB callback functions to the destination process
> in userspace. This works because the userspace buffer is mapped into kernel
> memory it appears. Correct me if I'm wrong:
> 
> video/videobuf-core.c:
> 
>         err = __videobuf_mmap_setup(q, count, size, V4L2_MEMORY_USERPTR);

It's hard to tell from that line only. V4L2_MEMORY_USERPTR takes a memory 
pointer from userspace and uses it in the kernel. How the memory is used 
depends on the driver, it can be converted to a scatter list of physical 
memory and passed to the hardware, mapped to the kernel, be accessed using 
copy_from_user/copy_to_user, ...

BTW videobuf1 is outdated, drivers will eventually be ported to videobuf2.

> Under FreeBSD where the Linux kernel code is running in user-space as a
> driver daemon, this part cannot be done exactly like this, so I've just
> patched out the V4L2_MEMORY_USERPTR feature until further.
> 
> Am I clear?

-- 
Regards,

Laurent Pinchart


      reply	other threads:[~2012-07-05 17:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-23  7:19 Question about V4L2_MEMORY_USERPTR Hans Petter Selasky
2012-07-01 14:00 ` Sakari Ailus
2012-07-02  9:24   ` Laurent Pinchart
2012-07-02 19:07     ` Hans Petter Selasky
2012-07-05 17:24       ` Laurent Pinchart [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=4977006.H7Qry87s3L@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hselasky@c2i.net \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@iki.fi \
    /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 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).