All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Tomasz Stanislawski <t.stanislaws@samsung.com>,
	linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
	airlied@redhat.com, m.szyprowski@samsung.com,
	kyungmin.park@samsung.com, sumit.semwal@ti.com,
	daeinki@gmail.com, daniel.vetter@ffwll.ch, robdclark@gmail.com,
	pawel@osciak.com, linaro-mm-sig@lists.linaro.org,
	remi@remlab.net, subashrp@gmail.com, mchehab@redhat.com,
	zhangfei.gao@gmail.com, s.nawrocki@samsung.com,
	k.debski@samsung.com
Subject: Re: [PATCHv9 18/25] v4l: add buffer exporting via dmabuf
Date: Sun, 7 Oct 2012 16:17:03 +0200	[thread overview]
Message-ID: <201210071617.03213.hverkuil@xs4all.nl> (raw)
In-Reply-To: <1481309.1Xrun8GG9o@avalon>

On Sun October 7 2012 15:38:30 Laurent Pinchart wrote:
> Hi Hans,
> 
> On Friday 05 October 2012 10:55:40 Hans Verkuil wrote:
> > On Tue October 2 2012 16:27:29 Tomasz Stanislawski wrote:
> > > This patch adds extension to V4L2 api. It allow to export a mmap buffer as
> > > file descriptor. New ioctl VIDIOC_EXPBUF is added. It takes a buffer
> > > offset used by mmap and return a file descriptor on success.
> > > 
> > > Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
> > > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> 
> [snip]
> 
> > > diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
> > > index e04a73e..f429b6a 100644
> > > --- a/include/linux/videodev2.h
> > > +++ b/include/linux/videodev2.h
> > > @@ -688,6 +688,33 @@ struct v4l2_buffer {
> > > 
> > >  #define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE	0x0800
> > >  #define V4L2_BUF_FLAG_NO_CACHE_CLEAN		0x1000
> > > 
> > > +/**
> > > + * struct v4l2_exportbuffer - export of video buffer as DMABUF file
> > > descriptor + *
> > > + * @fd:		file descriptor associated with DMABUF (set by driver)
> > > + * @flags:	flags for newly created file, currently only O_CLOEXEC is
> > > + *		supported, refer to manual of open syscall for more details
> > > + * @index:	id number of the buffer
> > > + * @type:	enum v4l2_buf_type; buffer type (type == *_MPLANE for
> > > + *		multiplanar buffers);
> > > + * @plane:	index of the plane to be exported, 0 for single plane queues
> > > + *
> > > + * Contains data used for exporting a video buffer as DMABUF file
> > > descriptor. + * The buffer is identified by a 'cookie' returned by
> > > VIDIOC_QUERYBUF + * (identical to the cookie used to mmap() the buffer to
> > > userspace). All + * reserved fields must be set to zero. The field
> > > reserved0 is expected to + * become a structure 'type' allowing an
> > > alternative layout of the structure + * content. Therefore this field
> > > should not be used for any other extensions. + */
> > > +struct v4l2_exportbuffer {
> > > +	__s32		fd;
> > > +	__u32		flags;
> > > +	__u32		type; /* enum v4l2_buf_type */
> > > +	__u32		index;
> > > +	__u32		plane;
> > 
> > As suggested in my comments in the previous patch, I think it is a more
> > natural order to have the type/index/plane fields first in this struct.
> > 
> > Actually, I think that flags should also come before fd:
> > 
> > struct v4l2_exportbuffer {
> > 	__u32		type; /* enum v4l2_buf_type */
> > 	__u32		index;
> > 	__u32		plane;
> > 	__u32		flags;
> > 	__s32		fd;
> > 	__u32		reserved[11];
> > };
> 
> It would indeed feel more natural, but putting them right before the reserved 
> fields allows creating an anonymous union around type, index and plane and 
> extending it with reserved fields if needed. That's (at least to my 
> understanding) the rationale behind the current structure layout.

The anonymous union argument makes no sense to me, to be honest. It's standard
practice within V4L2 to have the IN fields first, then the OUT fields, followed
by reserved fields for future expansion. Should we ever need a, say, sub-plane
index (whatever that might be), then we can use one of the reserved fields.

Regards,

	Hans

> 
> > > +	__u32		reserved[11];
> > > +};
> > > +
> > > 
> > >  /*
> > >  
> > >   *	O V E R L A Y   P R E V I E W
> > >   */
> 
> 

  reply	other threads:[~2012-10-07 14:17 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-02 14:27 [PATCHv9 00/25] Integration of videobuf2 with DMABUF Tomasz Stanislawski
2012-10-02 14:27 ` [PATCHv9 01/25] v4l: Add DMABUF as a memory type Tomasz Stanislawski
2012-10-02 14:27 ` [PATCHv9 02/25] Documentation: media: description of DMABUF importing in V4L2 Tomasz Stanislawski
2012-10-05  8:05   ` Hans Verkuil
2012-10-02 14:27 ` [PATCHv9 03/25] v4l: vb2: add support for shared buffer (dma_buf) Tomasz Stanislawski
2012-10-05  8:17   ` Hans Verkuil
2012-10-02 14:27 ` [PATCHv9 04/25] v4l: vb: remove warnings about MEMORY_DMABUF Tomasz Stanislawski
2012-10-02 14:27 ` [PATCHv9 05/25] v4l: vb2-dma-contig: shorten vb2_dma_contig prefix to vb2_dc Tomasz Stanislawski
2012-10-02 14:27 ` [PATCHv9 06/25] v4l: vb2-dma-contig: remove reference of alloc_ctx from a buffer Tomasz Stanislawski
2012-10-02 14:27 ` [PATCHv9 07/25] v4l: vb2-dma-contig: reorder functions Tomasz Stanislawski
2012-10-02 14:27 ` [PATCHv9 08/25] v4l: vb2-dma-contig: add support for scatterlist in userptr mode Tomasz Stanislawski
2012-10-02 14:27 ` [PATCHv9 09/25] v4l: vb2: add prepare/finish callbacks to allocators Tomasz Stanislawski
2012-10-05  8:22   ` Hans Verkuil
2012-10-02 14:27 ` [PATCHv9 10/25] v4l: vb2-dma-contig: add prepare/finish to dma-contig allocator Tomasz Stanislawski
2012-10-02 14:27 ` [PATCHv9 11/25] v4l: vb2-dma-contig: add support for dma_buf importing Tomasz Stanislawski
2012-10-02 14:27 ` [PATCHv9 12/25] v4l: vb2-vmalloc: add support for dmabuf importing Tomasz Stanislawski
2012-10-02 14:27 ` [PATCHv9 13/25] v4l: vivi: " Tomasz Stanislawski
2012-10-02 14:27 ` [PATCHv9 14/25] v4l: s5p-tv: mixer: " Tomasz Stanislawski
2012-10-02 14:27 ` [PATCHv9 15/25] v4l: s5p-fimc: " Tomasz Stanislawski
2012-10-02 14:27 ` [PATCHv9 16/25] v4l: vb2-dma-contig: let mmap method to use dma_mmap_coherent call Tomasz Stanislawski
2012-10-02 14:27 ` [PATCHv9 17/25] Documentation: media: description of DMABUF exporting in V4L2 Tomasz Stanislawski
2012-10-05  8:44   ` Hans Verkuil
2012-10-02 14:27 ` [PATCHv9 18/25] v4l: add buffer exporting via dmabuf Tomasz Stanislawski
2012-10-05  8:55   ` Hans Verkuil
2012-10-07 13:38     ` Laurent Pinchart
2012-10-07 14:17       ` Hans Verkuil [this message]
2012-10-08  9:40         ` Tomasz Stanislawski
2012-10-08  9:54           ` Hans Verkuil
2012-10-08 10:41             ` Tomasz Stanislawski
2012-10-08 11:15               ` Hans Verkuil
2012-10-02 14:27 ` [PATCHv9 19/25] v4l: vb2: " Tomasz Stanislawski
2012-10-06 12:22   ` Hans Verkuil
2012-10-10 14:05     ` Tomasz Stanislawski
2012-10-02 14:27 ` [PATCHv9 20/25] v4l: vb2-dma-contig: add support for DMABUF exporting Tomasz Stanislawski
2012-10-07 13:38   ` Laurent Pinchart
2012-10-02 14:27 ` [PATCHv9 21/25] v4l: vb2-dma-contig: add reference counting for a device from allocator context Tomasz Stanislawski
2012-10-07 13:38   ` Laurent Pinchart
2012-10-02 14:27 ` [PATCHv9 22/25] v4l: vb2-dma-contig: fail if user ptr buffer is not correctly aligned Tomasz Stanislawski
2012-10-07 13:38   ` Laurent Pinchart
2012-10-02 14:27 ` [PATCHv9 23/25] v4l: s5p-fimc: support for dmabuf exporting Tomasz Stanislawski
2012-10-02 14:27 ` [PATCHv9 24/25] v4l: s5p-tv: mixer: " Tomasz Stanislawski
2012-10-02 14:27 ` [PATCHv9 25/25] v4l: s5p-mfc: " Tomasz Stanislawski
2012-10-05  9:24 ` [PATCHv9 00/25] Integration of videobuf2 with DMABUF Hans Verkuil
2012-10-07 10:03 ` Hans Verkuil
2012-10-10 10:54 ` Mauro Carvalho Chehab
2012-10-10 11:11   ` [Linaro-mm-sig] " Kyungmin Park
2012-10-10 11:11     ` Kyungmin Park
2012-10-10 13:34   ` Laurent Pinchart

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=201210071617.03213.hverkuil@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=airlied@redhat.com \
    --cc=daeinki@gmail.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=k.debski@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-media@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mchehab@redhat.com \
    --cc=pawel@osciak.com \
    --cc=remi@remlab.net \
    --cc=robdclark@gmail.com \
    --cc=s.nawrocki@samsung.com \
    --cc=subashrp@gmail.com \
    --cc=sumit.semwal@ti.com \
    --cc=t.stanislaws@samsung.com \
    --cc=zhangfei.gao@gmail.com \
    /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.