Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

media: v4l: Support line-based metadata capture

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>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

authored by

Sakari Ailus and committed by
Hans Verkuil
89345c2a 1d921523

+42 -2
+21
Documentation/userspace-api/media/v4l/dev-meta.rst
··· 47 47 and applications must set the remainder of the :c:type:`v4l2_format` structure 48 48 to 0. 49 49 50 + Devices that capture metadata by line have the struct v4l2_fmtdesc 51 + ``V4L2_FMT_FLAG_META_LINE_BASED`` flag set for :c:func:`VIDIOC_ENUM_FMT`. Such 52 + devices can typically also :ref:`capture image data <capture>`. This primarily 53 + involves devices that receive the data from a different devices such as a camera 54 + sensor. 55 + 50 56 .. c:type:: v4l2_meta_format 51 57 52 58 .. tabularcolumns:: |p{1.4cm}|p{2.4cm}|p{13.5cm}| ··· 71 65 - ``buffersize`` 72 66 - Maximum buffer size in bytes required for data. The value is set by the 73 67 driver. 68 + * - __u32 69 + - ``width`` 70 + - Width of a line of metadata in Data Units. Valid when 71 + :c:type`v4l2_fmtdesc` flag ``V4L2_FMT_FLAG_META_LINE_BASED`` is set, 72 + otherwise zero. See :c:func:`VIDIOC_ENUM_FMT`. 73 + * - __u32 74 + - ``height`` 75 + - Number of rows of metadata. Valid when :c:type`v4l2_fmtdesc` flag 76 + ``V4L2_FMT_FLAG_META_LINE_BASED`` is set, otherwise zero. See 77 + :c:func:`VIDIOC_ENUM_FMT`. 78 + * - __u32 79 + - ``bytesperline`` 80 + - Offset in bytes between the beginning of two consecutive lines. Valid 81 + when :c:type`v4l2_fmtdesc` flag ``V4L2_FMT_FLAG_META_LINE_BASED`` is 82 + set, otherwise zero. See :c:func:`VIDIOC_ENUM_FMT`.
+7
Documentation/userspace-api/media/v4l/vidioc-enum-fmt.rst
··· 227 227 The application can ask to configure the quantization of the capture 228 228 device when calling the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl with 229 229 :ref:`V4L2_PIX_FMT_FLAG_SET_CSC <v4l2-pix-fmt-flag-set-csc>` set. 230 + * - ``V4L2_FMT_FLAG_META_LINE_BASED`` 231 + - 0x0200 232 + - The metadata format is line-based. In this case the ``width``, 233 + ``height`` and ``bytesperline`` fields of :c:type:`v4l2_meta_format` are 234 + valid. The buffer consists of ``height`` lines, each having ``width`` 235 + Data Units of data and the offset (in bytes) between the beginning of 236 + each two consecutive lines is ``bytesperline``. 230 237 231 238 Return Value 232 239 ============
+1
Documentation/userspace-api/media/videodev2.h.rst.exceptions
··· 215 215 replace define V4L2_FMT_FLAG_CSC_YCBCR_ENC fmtdesc-flags 216 216 replace define V4L2_FMT_FLAG_CSC_HSV_ENC fmtdesc-flags 217 217 replace define V4L2_FMT_FLAG_CSC_QUANTIZATION fmtdesc-flags 218 + replace define V4L2_FMT_FLAG_META_LINE_BASED fmtdesc-flags 218 219 219 220 # V4L2 timecode types 220 221 replace define V4L2_TC_TYPE_24FPS timecode-type
+3 -2
drivers/media/v4l2-core/v4l2-ioctl.c
··· 343 343 case V4L2_BUF_TYPE_META_OUTPUT: 344 344 meta = &p->fmt.meta; 345 345 pixelformat = meta->dataformat; 346 - pr_cont(", dataformat=%p4cc, buffersize=%u\n", 347 - &pixelformat, meta->buffersize); 346 + pr_cont(", dataformat=%p4cc, buffersize=%u, width=%u, height=%u, bytesperline=%u\n", 347 + &pixelformat, meta->buffersize, meta->width, 348 + meta->height, meta->bytesperline); 348 349 break; 349 350 } 350 351 }
+10
include/uapi/linux/videodev2.h
··· 877 877 #define V4L2_FMT_FLAG_CSC_YCBCR_ENC 0x0080 878 878 #define V4L2_FMT_FLAG_CSC_HSV_ENC V4L2_FMT_FLAG_CSC_YCBCR_ENC 879 879 #define V4L2_FMT_FLAG_CSC_QUANTIZATION 0x0100 880 + #define V4L2_FMT_FLAG_META_LINE_BASED 0x0200 880 881 881 882 /* Frame Size and frame rate enumeration */ 882 883 /* ··· 2425 2424 * struct v4l2_meta_format - metadata format definition 2426 2425 * @dataformat: little endian four character code (fourcc) 2427 2426 * @buffersize: maximum size in bytes required for data 2427 + * @width: number of data units of data per line (valid for line 2428 + * based formats only, see format documentation) 2429 + * @height: number of lines of data per buffer (valid for line based 2430 + * formats only) 2431 + * @bytesperline: offset between the beginnings of two adjacent lines in 2432 + * bytes (valid for line based formats only) 2428 2433 */ 2429 2434 struct v4l2_meta_format { 2430 2435 __u32 dataformat; 2431 2436 __u32 buffersize; 2437 + __u32 width; 2438 + __u32 height; 2439 + __u32 bytesperline; 2432 2440 } __attribute__ ((packed)); 2433 2441 2434 2442 /**