Re: [PATCH] v4l: Add metadata buffer type and format

2016-09-05 Thread Laurent Pinchart
Hi Hans,

On Monday 05 Sep 2016 09:40:19 Hans Verkuil wrote:
> On 09/02/2016 02:07 PM, Laurent Pinchart wrote:
> > The metadata buffer type is used to transfer metadata between userspace
> > and kernelspace through a V4L2 buffers queue. It comes with a new
> > metadata capture capability and format description.
> > 
> > Signed-off-by: Laurent Pinchart
> > 
> > Tested-by: Guennadi Liakhovetski 
> 
> Looks good. But include/trace/events/v4l2.h needs to be updated with the new
> buf_type as well.
> 
> I would also like to see patches for v4l2-ctl and v4l2-compliance.

I'll work on that.

> Having some support for it in vivid would be nice as well, but is a lower
> prio.

Feel free to submit patches ;-)

-- 
Regards,

Laurent Pinchart



Re: [PATCH] v4l: Add metadata buffer type and format

2016-09-05 Thread Hans Verkuil
On 09/02/2016 02:07 PM, Laurent Pinchart wrote:
> The metadata buffer type is used to transfer metadata between userspace
> and kernelspace through a V4L2 buffers queue. It comes with a new
> metadata capture capability and format description.
> 
> Signed-off-by: Laurent Pinchart 
> Tested-by: Guennadi Liakhovetski 

Looks good. But include/trace/events/v4l2.h needs to be updated with the new
buf_type as well.

I would also like to see patches for v4l2-ctl and v4l2-compliance. Having some
support for it in vivid would be nice as well, but is a lower prio.

Regards,

Hans

> ---
> Changes since v2:
> 
> - Dropped the reserved field from struct v4l2_meta_format
> - Removed redundant documentation sentence
> - Fixed typos
> 
> Changes since v1:
> 
> - Rebased on top of the DocBook to reST conversion
> 
>  Documentation/media/uapi/v4l/buffer.rst  |  8 +++
>  Documentation/media/uapi/v4l/dev-meta.rst| 63 
> 
>  Documentation/media/uapi/v4l/devices.rst |  1 +
>  Documentation/media/uapi/v4l/vidioc-querycap.rst | 14 --
>  Documentation/media/videodev2.h.rst.exceptions   |  2 +
>  drivers/media/v4l2-core/v4l2-compat-ioctl32.c| 19 +++
>  drivers/media/v4l2-core/v4l2-dev.c   | 16 +++---
>  drivers/media/v4l2-core/v4l2-ioctl.c | 34 +
>  drivers/media/v4l2-core/videobuf2-v4l2.c |  3 ++
>  include/media/v4l2-ioctl.h   | 17 +++
>  include/uapi/linux/videodev2.h   | 13 +
>  11 files changed, 181 insertions(+), 9 deletions(-)
>  create mode 100644 Documentation/media/uapi/v4l/dev-meta.rst
> 
> diff --git a/Documentation/media/uapi/v4l/buffer.rst 
> b/Documentation/media/uapi/v4l/buffer.rst
> index 5deb4a46f992..b5177cc63b86 100644
> --- a/Documentation/media/uapi/v4l/buffer.rst
> +++ b/Documentation/media/uapi/v4l/buffer.rst
> @@ -499,6 +499,14 @@ enum v4l2_buf_type
> -  Buffer for Software Defined Radio (SDR) output stream, see
> :ref:`sdr`.
>  
> +-  .. row 13
> +
> +   -  ``V4L2_BUF_TYPE_META_CAPTURE``
> +
> +   -  13
> +
> +   -  Buffer for metadata capture, see :ref:`metadata`.
> +
>  
>  
>  .. _buffer-flags:
> diff --git a/Documentation/media/uapi/v4l/dev-meta.rst 
> b/Documentation/media/uapi/v4l/dev-meta.rst
> new file mode 100644
> index ..d3a33fea9cc9
> --- /dev/null
> +++ b/Documentation/media/uapi/v4l/dev-meta.rst
> @@ -0,0 +1,63 @@
> +.. -*- coding: utf-8; mode: rst -*-
> +
> +.. _metadata:
> +
> +**
> +Metadata Interface
> +**
> +
> +Metadata refers to any non-image data that supplements video frames with
> +additional information. This may include statistics computed over the image
> +or frame capture parameters supplied by the image source. This interface is
> +intended for transfer of metadata to userspace and control of that operation.
> +
> +The metadata interface is implemented on video capture device nodes. The 
> device
> +can be dedicated to metadata or can implement both video and metadata capture
> +as specified in its reported capabilities.
> +
> +.. note::
> +
> +This is an :ref:`experimental` interface and may
> +change in the future.
> +
> +Querying Capabilities
> +=
> +
> +Device nodes supporting the metadata interface set the 
> ``V4L2_CAP_META_CAPTURE``
> +flag in the ``device_caps`` field of the
> +:ref:`v4l2_capability ` structure returned by the
> +:ref:`VIDIOC_QUERYCAP` ioctl. That flag means the device can capture
> +metadata to memory.
> +
> +At least one of the read/write or streaming I/O methods must be supported.
> +
> +
> +Data Format Negotiation
> +===
> +
> +The metadata device uses the :ref:`format` ioctls to select the capture 
> format.
> +The metadata buffer content format is bound to that selected format. In 
> addition
> +to the basic :ref:`format` ioctls, the :ref:`VIDIOC_ENUM_FMT` ioctl must be
> +supported as well.
> +
> +To use the :ref:`format` ioctls applications set the ``type`` field of the
> +:ref:`v4l2_format ` structure to ``V4L2_BUF_TYPE_META_CAPTURE``
> +and use the :ref:`v4l2_meta_format ` ``meta`` member of the
> +``fmt`` union as needed per the desired operation. Both drivers and 
> applications
> +must set the remainder of the :ref:`v4l2_format ` structure to 
> 0.
> +
> +.. _v4l2-meta-format:
> +.. flat-table:: struct v4l2_meta_format
> +:header-rows:  0
> +:stub-columns: 0
> +:widths:   1 1 2
> +
> +* - __u32
> +  - ``dataformat``
> +  - The data format, set by the application. This is a little endian
> +:ref:`four character code `. V4L2 defines metadata 
> formats
> +in :ref:`meta-formats`.
> +* - __u32
> +  - ``buffersize``
> +  - Maximum buffer size in bytes required for data. The value is set by 
> the
> +driver.
> diff --git a/Documentation/media/uapi/v4l/devices.rst 
> b/Documentation/media/uapi/v4l/devices.rs

Re: [PATCH] v4l: Add metadata buffer type and format

2016-09-02 Thread Sakari Ailus
Hi Laurent,

On Fri, Sep 02, 2016 at 03:07:03PM +0300, Laurent Pinchart wrote:
> The metadata buffer type is used to transfer metadata between userspace
> and kernelspace through a V4L2 buffers queue. It comes with a new
> metadata capture capability and format description.
> 
> Signed-off-by: Laurent Pinchart 
> Tested-by: Guennadi Liakhovetski 

Acked-by: Sakari Ailus 

-- 
Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk