From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Cc: linux-media@vger.kernel.org,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
tomi.valkeinen@ideasonboard.com, bingbu.cao@intel.com,
hongju.wang@intel.com, hverkuil@xs4all.nl,
Andrey Konovalov <andrey.konovalov@linaro.org>,
Dmitry Perchanov <dmitry.perchanov@intel.com>
Subject: Re: [PATCH v3 08/10] media: v4l: Support line-based metadata capture
Date: Mon, 14 Aug 2023 11:02:40 +0000 [thread overview]
Message-ID: <ZNoJ0Fv/3Ir+sdyf@kekkonen.localdomain> (raw)
In-Reply-To: <ejo4a5dhvdukmle6lqddhsmvge6krezx5mhfq2ghoy23cnjygb@byo2u34seqz3>
Hi Jacopo,
On Thu, Aug 10, 2023 at 05:24:14PM +0200, Jacopo Mondi wrote:
> Hi Sakari
>
> On Tue, Aug 08, 2023 at 10:55:36AM +0300, Sakari Ailus wrote:
> > many camera sensors, among other devices, transmit embedded data and image
> > data for each CSI-2 frame. This embedded data typically contains register
> > configuration of the sensor that has been used to capture the image data
> > of the same frame.
> >
> > The embedded data is received by the CSI-2 receiver and has the same
> > properties as the image data, including that it is line based: it has
> > width, height and bytesperline (stride).
> >
> > Add these fields to struct v4l2_meta_format and document them.
> >
> > Also add V4L2_FMT_FLAG_META_LINE_BASED to tell a given format is
> > line-based i.e. these fields of struct v4l2_meta_format are valid for it.
> >
> > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> > ---
> > .../userspace-api/media/v4l/dev-meta.rst | 15 +++++++++++++++
> > .../userspace-api/media/v4l/vidioc-enum-fmt.rst | 7 +++++++
> > .../media/videodev2.h.rst.exceptions | 1 +
> > drivers/media/v4l2-core/v4l2-ioctl.c | 5 +++--
> > include/uapi/linux/videodev2.h | 10 ++++++++++
> > 5 files changed, 36 insertions(+), 2 deletions(-)
> >
> > diff --git a/Documentation/userspace-api/media/v4l/dev-meta.rst b/Documentation/userspace-api/media/v4l/dev-meta.rst
> > index 0e7e1ee1471a..4b24bae6e171 100644
> > --- a/Documentation/userspace-api/media/v4l/dev-meta.rst
> > +++ b/Documentation/userspace-api/media/v4l/dev-meta.rst
> > @@ -65,3 +65,18 @@ to 0.
> > - ``buffersize``
> > - Maximum buffer size in bytes required for data. The value is set by the
> > driver.
> > + * - __u32
> > + - ``width``
> > + - Width of a line of metadata in samples. Valid when :c:type`v4l2_fmtdesc`
> > + flag ``V4L2_FMT_FLAG_META_LINE_BASED`` is set, otherwise zero. See
> > + :c:func:`VIDIOC_ENUM_FMT`.
> > + * - __u32
> > + - ``height``
> > + - Number of rows of metadata. Valid when :c:type`v4l2_fmtdesc` flag
> > + ``V4L2_FMT_FLAG_META_LINE_BASED`` is set, otherwise zero. See
> > + :c:func:`VIDIOC_ENUM_FMT`.
> > + * - __u32
> > + - ``bytesperline``
> > + - Offset in bytes between the beginning of two consecutive lines. Valid
> > + when :c:type`v4l2_fmtdesc` flag ``V4L2_FMT_FLAG_META_LINE_BASED`` is
> > + set, otherwise zero. See :c:func:`VIDIOC_ENUM_FMT`.
> > diff --git a/Documentation/userspace-api/media/v4l/vidioc-enum-fmt.rst b/Documentation/userspace-api/media/v4l/vidioc-enum-fmt.rst
> > index 000c154b0f98..6d7664345a4e 100644
> > --- a/Documentation/userspace-api/media/v4l/vidioc-enum-fmt.rst
> > +++ b/Documentation/userspace-api/media/v4l/vidioc-enum-fmt.rst
> > @@ -227,6 +227,13 @@ the ``mbus_code`` field is handled differently:
> > The application can ask to configure the quantization of the capture
> > device when calling the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl with
> > :ref:`V4L2_PIX_FMT_FLAG_SET_CSC <v4l2-pix-fmt-flag-set-csc>` set.
> > + * - ``V4L2_FMT_FLAG_META_LINE_BASED``
> > + - 0x0200
> > + - The metadata format is line-based. In this case the ``width``,
> > + ``height`` and ``bytesperline`` fields of :c:type:`v4l2_meta_format` are
> > + valid. The buffer consists of ``height`` lines, each having ``width``
> > + bytes of data and offset between the beginning of each two consecutive
>
> Isn't ``width`` in samples ?
Indeed, it's better to refer to samples for clarity. I'll fix for v4.
I'll also add bytesperline is in bytes (and not in samples).
>
> > + lines is ``bytesperline``.
> >
> > Return Value
> > ============
> > diff --git a/Documentation/userspace-api/media/videodev2.h.rst.exceptions b/Documentation/userspace-api/media/videodev2.h.rst.exceptions
> > index 3e58aac4ef0b..bdc628e8c1d6 100644
> > --- a/Documentation/userspace-api/media/videodev2.h.rst.exceptions
> > +++ b/Documentation/userspace-api/media/videodev2.h.rst.exceptions
> > @@ -215,6 +215,7 @@ replace define V4L2_FMT_FLAG_CSC_XFER_FUNC fmtdesc-flags
> > replace define V4L2_FMT_FLAG_CSC_YCBCR_ENC fmtdesc-flags
> > replace define V4L2_FMT_FLAG_CSC_HSV_ENC fmtdesc-flags
> > replace define V4L2_FMT_FLAG_CSC_QUANTIZATION fmtdesc-flags
> > +replace define V4L2_FMT_FLAG_META_LINE_BASED fmtdesc-flags
> >
> > # V4L2 timecode types
> > replace define V4L2_TC_TYPE_24FPS timecode-type
> > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> > index fbbddc333a30..971d784e7429 100644
> > --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> > @@ -343,8 +343,9 @@ static void v4l_print_format(const void *arg, bool write_only)
> > case V4L2_BUF_TYPE_META_OUTPUT:
> > meta = &p->fmt.meta;
> > pixelformat = meta->dataformat;
> > - pr_cont(", dataformat=%p4cc, buffersize=%u\n",
> > - &pixelformat, meta->buffersize);
> > + pr_cont(", dataformat=%p4cc, buffersize=%u, width=%u, height=%u, bytesperline=%u\n",
> > + &pixelformat, meta->buffersize, meta->width,
> > + meta->height, meta->bytesperline);
> > break;
> > }
> > }
> > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
> > index b4284a564025..d26c0650c6a7 100644
> > --- a/include/uapi/linux/videodev2.h
> > +++ b/include/uapi/linux/videodev2.h
> > @@ -877,6 +877,7 @@ struct v4l2_fmtdesc {
> > #define V4L2_FMT_FLAG_CSC_YCBCR_ENC 0x0080
> > #define V4L2_FMT_FLAG_CSC_HSV_ENC V4L2_FMT_FLAG_CSC_YCBCR_ENC
> > #define V4L2_FMT_FLAG_CSC_QUANTIZATION 0x0100
> > +#define V4L2_FMT_FLAG_META_LINE_BASED 0x0200
> >
> > /* Frame Size and frame rate enumeration */
> > /*
> > @@ -2420,10 +2421,19 @@ struct v4l2_sdr_format {
> > * struct v4l2_meta_format - metadata format definition
> > * @dataformat: little endian four character code (fourcc)
> > * @buffersize: maximum size in bytes required for data
> > + * @width: number of bytes of data per line (valid for line based
>
> I'm a bit confused here as well, isn't width in samples ?
I'll change this one as well.
>
> > + * formats only, see format documentation)
> > + * @height: number of lines of data per buffer (valid for line based
> > + * formats only)
> > + * @bytesperline: offset between the beginnings of two adjacent lines in
> > + * bytes (valid for line based formats only)
> > */
> > struct v4l2_meta_format {
> > __u32 dataformat;
> > __u32 buffersize;
> > + __u32 width;
> > + __u32 height;
> > + __u32 bytesperline;
> > } __attribute__ ((packed));
> >
> > /**
--
Kind regards,
Sakari Ailus
next prev parent reply other threads:[~2023-08-14 11:03 UTC|newest]
Thread overview: 84+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-08 7:55 [PATCH v3 00/10] Generic line based metadata support, internal pads Sakari Ailus
2023-08-08 7:55 ` [PATCH v3 01/10] media: Documentation: Align numbered list Sakari Ailus
2023-09-05 13:06 ` Laurent Pinchart
2023-09-06 12:43 ` Sakari Ailus
2023-09-06 12:50 ` Laurent Pinchart
2023-09-07 10:58 ` Sakari Ailus
2023-08-08 7:55 ` [PATCH v3 02/10] media: mc: Check pad flag validity Sakari Ailus
2023-08-10 13:54 ` Jacopo Mondi
2023-08-14 8:49 ` Sakari Ailus
2023-09-05 13:13 ` Laurent Pinchart
2023-08-08 7:55 ` [PATCH v3 03/10] media: mc: Add INTERNAL pad flag Sakari Ailus
2023-08-08 8:15 ` Hans Verkuil
2023-08-11 11:48 ` Sakari Ailus
2023-08-10 14:12 ` Jacopo Mondi
2023-08-11 9:09 ` Sakari Ailus
2023-09-05 13:50 ` Laurent Pinchart
2023-08-08 7:55 ` [PATCH v3 04/10] media: uapi: Add generic serial metadata mbus formats Sakari Ailus
2023-08-23 13:16 ` Tomi Valkeinen
2023-08-24 7:24 ` Sakari Ailus
2023-08-24 8:26 ` Tomi Valkeinen
2023-09-05 16:38 ` Laurent Pinchart
2023-09-06 8:28 ` Tomi Valkeinen
2023-09-06 11:31 ` Laurent Pinchart
2023-09-06 11:39 ` Tomi Valkeinen
2023-09-06 12:34 ` Sakari Ailus
2023-09-06 12:50 ` Laurent Pinchart
2023-09-07 11:04 ` Sakari Ailus
2023-08-08 7:55 ` [PATCH v3 05/10] media: uapi: Document which mbus format fields are valid for metadata Sakari Ailus
2023-08-10 15:19 ` Jacopo Mondi
2023-08-14 10:23 ` Sakari Ailus
2023-09-05 16:44 ` Laurent Pinchart
2023-08-08 7:55 ` [PATCH v3 06/10] media: uapi: Add a macro to tell whether an mbus code is metadata Sakari Ailus
2023-08-08 8:14 ` Hans Verkuil
2023-08-08 8:16 ` Sakari Ailus
2023-09-05 9:47 ` Tomi Valkeinen
2023-09-05 10:37 ` Sakari Ailus
2023-09-05 17:06 ` Laurent Pinchart
2023-09-06 11:33 ` Sakari Ailus
2023-09-06 12:23 ` Laurent Pinchart
2023-09-06 13:06 ` Sakari Ailus
2023-09-07 8:20 ` Sakari Ailus
2023-08-08 7:55 ` [PATCH v3 07/10] media: uapi: Add generic 8-bit metadata format definitions Sakari Ailus
2023-08-08 8:22 ` Hans Verkuil
2023-08-11 6:31 ` Jacopo Mondi
2023-08-11 9:11 ` Sakari Ailus
2023-08-11 9:43 ` Jacopo Mondi
2023-08-11 10:55 ` Sakari Ailus
2023-09-05 16:47 ` Laurent Pinchart
2023-09-06 11:36 ` Sakari Ailus
2023-09-06 12:36 ` Laurent Pinchart
2023-09-06 13:25 ` Sakari Ailus
2023-09-06 13:30 ` Laurent Pinchart
2023-09-06 13:39 ` Sakari Ailus
2023-09-06 13:47 ` Laurent Pinchart
2023-09-07 8:06 ` Sakari Ailus
2023-09-07 8:16 ` Sakari Ailus
2023-08-11 11:12 ` Sakari Ailus
2023-09-05 16:55 ` Laurent Pinchart
2023-09-06 11:56 ` Sakari Ailus
2023-09-06 13:07 ` Laurent Pinchart
2023-09-22 8:50 ` Sakari Ailus
2023-09-22 10:25 ` Laurent Pinchart
2023-09-07 8:36 ` Sakari Ailus
2023-09-07 8:47 ` Laurent Pinchart
2023-09-07 9:49 ` Sakari Ailus
2023-08-08 7:55 ` [PATCH v3 08/10] media: v4l: Support line-based metadata capture Sakari Ailus
2023-08-10 15:24 ` Jacopo Mondi
2023-08-14 11:02 ` Sakari Ailus [this message]
2023-09-05 17:15 ` Laurent Pinchart
2023-09-06 7:21 ` Jacopo Mondi
2023-09-06 12:24 ` Sakari Ailus
2023-09-06 13:20 ` Laurent Pinchart
2023-09-22 8:47 ` Sakari Ailus
2023-09-07 8:48 ` Sakari Ailus
2023-08-08 7:55 ` [PATCH v3 09/10] media: Add media bus codes for MIPI CCS embedded data Sakari Ailus
2023-09-05 17:25 ` Laurent Pinchart
2023-09-06 13:03 ` Sakari Ailus
2023-09-06 13:15 ` Laurent Pinchart
2023-09-07 11:10 ` Sakari Ailus
2023-08-08 7:55 ` [PATCH v3 10/10] media: uapi: v4l: Document source routes Sakari Ailus
2023-08-08 8:55 ` Hans Verkuil
2023-08-11 10:44 ` Sakari Ailus
2023-09-05 23:17 ` Laurent Pinchart
2023-09-06 12:11 ` Sakari Ailus
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=ZNoJ0Fv/3Ir+sdyf@kekkonen.localdomain \
--to=sakari.ailus@linux.intel.com \
--cc=andrey.konovalov@linaro.org \
--cc=bingbu.cao@intel.com \
--cc=dmitry.perchanov@intel.com \
--cc=hongju.wang@intel.com \
--cc=hverkuil@xs4all.nl \
--cc=jacopo.mondi@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=tomi.valkeinen@ideasonboard.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox