Re: [PATCH 01/24] v4l: Add metadata buffer type and format
Hi Laurent, Just one question to this patch: On Mon, 20 Jun 2016, 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> --- > Documentation/DocBook/media/v4l/dev-meta.xml | 93 > +++ > Documentation/DocBook/media/v4l/v4l2.xml | 1 + > 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| 8 +++ > include/uapi/linux/videodev2.h| 14 > 8 files changed, 182 insertions(+), 6 deletions(-) > create mode 100644 Documentation/DocBook/media/v4l/dev-meta.xml > > diff --git a/Documentation/DocBook/media/v4l/dev-meta.xml > b/Documentation/DocBook/media/v4l/dev-meta.xml > new file mode 100644 > index ..9b5b1fba2007 > --- /dev/null > +++ b/Documentation/DocBook/media/v4l/dev-meta.xml > @@ -0,0 +1,93 @@ > + Metadata Interface > + > + > +Experimental > +This is an experimental > +interface and may change in the future. > + > + > + > +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 devices. The device > can > +be dedicated to metadata or can implement both video and metadata capture as > +specified in its reported capabilities. > + > + > + > +Querying Capabilities > + > + > +Devices supporting the metadata interface set the > +V4L2_CAP_META_CAPTURE flag in the > +capabilities field of > +returned by the 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 format ioctls to > +select the capture format. The metadata buffer content format is bound to > that > +selectable format. In addition to the basic > +format ioctls, the ioctl > +must be supported as well. Why does ENUM_FMT have to be supported? As far as I understand, you haven't implemented it for VSP1, I followed that example and haven't implemented it for UVC either. Thanks Guennadi -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/24] v4l: Add metadata buffer type and format
Hi Hans, On Fri, 24 Jun 2016, Hans Verkuil wrote: > On 06/24/2016 05:57 PM, Hans Verkuil wrote: > > On 06/20/2016 09:10 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> > > > I am willing to Ack this, provided Sakari and Guennadi Ack this as well. > > They know > > more about metadata handling in various types of hardware than I do, so I > > feel > > their Acks are important here. > > Actually, I would like to see more about how applications can associate > frames with > metadata (if such a correspondence exists). I think Laurent mentioned this in one of his patches, that the sequence number should be used to establish a correspondence, and this is also what my UVC patch does. Thanks Guennadi > There was an irc discussion about that here: > > https://linuxtv.org/irc/irclogger_log/v4l?date=2016-06-24,Fri > > Guennadi's uvc patches may be useful as a testbed for figuring this out. > > Regards, > > Hans > -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/24] v4l: Add metadata buffer type and format
On Fri, 24 Jun 2016, Hans Verkuil wrote: > On 06/20/2016 09:10 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 PinchartTested-by: Guennadi Liakhovetski If an acked-by is desired too, I'll give the patch a second look next Monday just to see if I can find a missing empty line to nit-pick on ;-) Thanks Guennadi > I am willing to Ack this, provided Sakari and Guennadi Ack this as well. They > know > more about metadata handling in various types of hardware than I do, so I feel > their Acks are important here. > > Regards, > > Hans > > > --- > > Documentation/DocBook/media/v4l/dev-meta.xml | 93 > > +++ > > Documentation/DocBook/media/v4l/v4l2.xml | 1 + > > 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| 8 +++ > > include/uapi/linux/videodev2.h| 14 > > 8 files changed, 182 insertions(+), 6 deletions(-) > > create mode 100644 Documentation/DocBook/media/v4l/dev-meta.xml > > > > diff --git a/Documentation/DocBook/media/v4l/dev-meta.xml > > b/Documentation/DocBook/media/v4l/dev-meta.xml > > new file mode 100644 > > index ..9b5b1fba2007 > > --- /dev/null > > +++ b/Documentation/DocBook/media/v4l/dev-meta.xml > > @@ -0,0 +1,93 @@ > > + Metadata Interface > > + > > + > > +Experimental > > +This is an experimental > > +interface and may change in the future. > > + > > + > > + > > +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 devices. The device > > can > > +be dedicated to metadata or can implement both video and metadata capture > > as > > +specified in its reported capabilities. > > + > > + > > + > > +Querying Capabilities > > + > > + > > +Devices supporting the metadata interface set the > > +V4L2_CAP_META_CAPTURE flag in the > > +capabilities field of > > +returned by the 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 format ioctls to > > +select the capture format. The metadata buffer content format is bound to > > that > > +selectable format. In addition to the basic > > +format ioctls, the ioctl > > +must be supported as well. > > + > > + > > + > > +To use the format ioctls applications set the > > +type field of a to > > +V4L2_BUF_TYPE_META_CAPTURE and use the > > > > +meta member of the > > fmt > > +union as needed per the desired operation. > > +Currently there are two fields, dataformat and > > +buffersize, of struct that > > are > > +used. Content of the dataformat is the V4L2 > > FourCC > > +code of the data format. The buffersize field > > is the > > +maximum buffer size in bytes required for data transfer, set by the driver > > in > > +order to inform applications. > > + > > + > > + > > + struct v4l2_meta_format > > + > > + > > + > > + > > +__u32 > > +dataformat > > + > > +The data format, set by the application. This is a little endian > > +four character code. > > +V4L2 defines metadata formats in . > > + > > + > > + > > +__u32 > > +buffersize > > + > > +Maximum size in bytes required for data. Value is set by the driver. > > + > > + > > + > > +__u8 > > +reserved[24] > > +This array is reserved for future extensions. > > +Drivers and applications must set it to zero. > > + > > + > > + > > + > > + > > + > > diff --git a/Documentation/DocBook/media/v4l/v4l2.xml > > b/Documentation/DocBook/media/v4l/v4l2.xml > > index 42e626d6c936..5c83b5d342dd 100644 > > --- a/Documentation/DocBook/media/v4l/v4l2.xml > > +++ b/Documentation/DocBook/media/v4l/v4l2.xml > > @@ -605,6 +605,7 @@ and discussions on the V4L mailing list. > > > > > > > > + > > > > > >
Re: [PATCH 01/24] v4l: Add metadata buffer type and format
On 06/24/2016 05:57 PM, Hans Verkuil wrote: > On 06/20/2016 09:10 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> > I am willing to Ack this, provided Sakari and Guennadi Ack this as well. They > know > more about metadata handling in various types of hardware than I do, so I feel > their Acks are important here. Actually, I would like to see more about how applications can associate frames with metadata (if such a correspondence exists). There was an irc discussion about that here: https://linuxtv.org/irc/irclogger_log/v4l?date=2016-06-24,Fri Guennadi's uvc patches may be useful as a testbed for figuring this out. Regards, Hans -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/24] v4l: Add metadata buffer type and format
On 06/20/2016 09:10 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 PinchartI am willing to Ack this, provided Sakari and Guennadi Ack this as well. They know more about metadata handling in various types of hardware than I do, so I feel their Acks are important here. Regards, Hans > --- > Documentation/DocBook/media/v4l/dev-meta.xml | 93 > +++ > Documentation/DocBook/media/v4l/v4l2.xml | 1 + > 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| 8 +++ > include/uapi/linux/videodev2.h| 14 > 8 files changed, 182 insertions(+), 6 deletions(-) > create mode 100644 Documentation/DocBook/media/v4l/dev-meta.xml > > diff --git a/Documentation/DocBook/media/v4l/dev-meta.xml > b/Documentation/DocBook/media/v4l/dev-meta.xml > new file mode 100644 > index ..9b5b1fba2007 > --- /dev/null > +++ b/Documentation/DocBook/media/v4l/dev-meta.xml > @@ -0,0 +1,93 @@ > + Metadata Interface > + > + > +Experimental > +This is an experimental > +interface and may change in the future. > + > + > + > +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 devices. The device > can > +be dedicated to metadata or can implement both video and metadata capture as > +specified in its reported capabilities. > + > + > + > +Querying Capabilities > + > + > +Devices supporting the metadata interface set the > +V4L2_CAP_META_CAPTURE flag in the > +capabilities field of > +returned by the 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 format ioctls to > +select the capture format. The metadata buffer content format is bound to > that > +selectable format. In addition to the basic > +format ioctls, the ioctl > +must be supported as well. > + > + > + > +To use the format ioctls applications set the > +type field of a to > +V4L2_BUF_TYPE_META_CAPTURE and use the > > +meta member of the fmt > +union as needed per the desired operation. > +Currently there are two fields, dataformat and > +buffersize, of struct that are > +used. Content of the dataformat is the V4L2 FourCC > +code of the data format. The buffersize field is > the > +maximum buffer size in bytes required for data transfer, set by the driver in > +order to inform applications. > + > + > + > + struct v4l2_meta_format > + > + > + > + > +__u32 > +dataformat > + > +The data format, set by the application. This is a little endian > +four character code. > +V4L2 defines metadata formats in . > + > + > + > +__u32 > +buffersize > + > +Maximum size in bytes required for data. Value is set by the driver. > + > + > + > +__u8 > +reserved[24] > +This array is reserved for future extensions. > +Drivers and applications must set it to zero. > + > + > + > + > + > + > diff --git a/Documentation/DocBook/media/v4l/v4l2.xml > b/Documentation/DocBook/media/v4l/v4l2.xml > index 42e626d6c936..5c83b5d342dd 100644 > --- a/Documentation/DocBook/media/v4l/v4l2.xml > +++ b/Documentation/DocBook/media/v4l/v4l2.xml > @@ -605,6 +605,7 @@ and discussions on the V4L mailing list. > > > > + > > > > diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c > b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c > index bacecbd68a6d..da2d836e8887 100644 > --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c > +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c > @@ -161,6 +161,20 @@ static inline int put_v4l2_sdr_format(struct > v4l2_sdr_format *kp, struct v4l2_sd > return 0; > } > > +static inline int get_v4l2_meta_format(struct v4l2_meta_format *kp, struct > v4l2_meta_format __user *up) > +{ > + if (copy_from_user(kp, up, sizeof(struct v4l2_meta_format))) > +
[PATCH 01/24] v4l: Add metadata buffer type and format
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--- Documentation/DocBook/media/v4l/dev-meta.xml | 93 +++ Documentation/DocBook/media/v4l/v4l2.xml | 1 + 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| 8 +++ include/uapi/linux/videodev2.h| 14 8 files changed, 182 insertions(+), 6 deletions(-) create mode 100644 Documentation/DocBook/media/v4l/dev-meta.xml diff --git a/Documentation/DocBook/media/v4l/dev-meta.xml b/Documentation/DocBook/media/v4l/dev-meta.xml new file mode 100644 index ..9b5b1fba2007 --- /dev/null +++ b/Documentation/DocBook/media/v4l/dev-meta.xml @@ -0,0 +1,93 @@ + Metadata Interface + + +Experimental +This is an experimental +interface and may change in the future. + + + +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 devices. The device can +be dedicated to metadata or can implement both video and metadata capture as +specified in its reported capabilities. + + + +Querying Capabilities + + +Devices supporting the metadata interface set the +V4L2_CAP_META_CAPTURE flag in the +capabilities field of +returned by the 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 format ioctls to +select the capture format. The metadata buffer content format is bound to that +selectable format. In addition to the basic +format ioctls, the ioctl +must be supported as well. + + + +To use the format ioctls applications set the +type field of a to +V4L2_BUF_TYPE_META_CAPTURE and use the +meta member of the fmt +union as needed per the desired operation. +Currently there are two fields, dataformat and +buffersize, of struct that are +used. Content of the dataformat is the V4L2 FourCC +code of the data format. The buffersize field is the +maximum buffer size in bytes required for data transfer, set by the driver in +order to inform applications. + + + + struct v4l2_meta_format + + + + +__u32 +dataformat + +The data format, set by the application. This is a little endian +four character code. +V4L2 defines metadata formats in . + + + +__u32 +buffersize + +Maximum size in bytes required for data. Value is set by the driver. + + + +__u8 +reserved[24] +This array is reserved for future extensions. +Drivers and applications must set it to zero. + + + + + + diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml index 42e626d6c936..5c83b5d342dd 100644 --- a/Documentation/DocBook/media/v4l/v4l2.xml +++ b/Documentation/DocBook/media/v4l/v4l2.xml @@ -605,6 +605,7 @@ and discussions on the V4L mailing list. + diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c index bacecbd68a6d..da2d836e8887 100644 --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c @@ -161,6 +161,20 @@ static inline int put_v4l2_sdr_format(struct v4l2_sdr_format *kp, struct v4l2_sd return 0; } +static inline int get_v4l2_meta_format(struct v4l2_meta_format *kp, struct v4l2_meta_format __user *up) +{ + if (copy_from_user(kp, up, sizeof(struct v4l2_meta_format))) + return -EFAULT; + return 0; +} + +static inline int put_v4l2_meta_format(struct v4l2_meta_format *kp, struct v4l2_meta_format __user *up) +{ + if (copy_to_user(up, kp, sizeof(struct v4l2_meta_format))) + return -EFAULT; + return 0; +} + struct v4l2_format32 { __u32 type; /* enum v4l2_buf_type */ union { @@ -170,6 +184,7 @@ struct v4l2_format32 { struct v4l2_vbi_format vbi; struct v4l2_sliced_vbi_format sliced; struct v4l2_sdr_format sdr; +