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

media: videodev2: Add flag to unconditionally enumerate pixel formats

When the index is ORed with V4L2_FMTDESC_FLAG_ENUM_ALL the
driver clears the flag and enumerate all the possible formats,
ignoring any limitations from the current configuration.
Drivers which do not support this flag yet always return an EINVAL.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil: improved doc when the new flag is not supported by the driver]

authored by

Benjamin Gaignard and committed by
Hans Verkuil
06f55319 0567d0f1

+21 -1
+17 -1
Documentation/userspace-api/media/v4l/vidioc-enum-fmt.rst
··· 85 85 * - __u32 86 86 - ``index`` 87 87 - Number of the format in the enumeration, set by the application. 88 - This is in no way related to the ``pixelformat`` field. 88 + This is in no way related to the ``pixelformat`` field. 89 + When the index is ORed with ``V4L2_FMTDESC_FLAG_ENUM_ALL`` the 90 + driver clears the flag and enumerates all the possible formats, 91 + ignoring any limitations from the current configuration. Drivers 92 + which do not support this flag always return an ``EINVAL`` 93 + error code without clearing this flag. 94 + Formats enumerated when using ``V4L2_FMTDESC_FLAG_ENUM_ALL`` flag 95 + shouldn't be used when calling :c:func:`VIDIOC_ENUM_FRAMESIZES` 96 + or :c:func:`VIDIOC_ENUM_FRAMEINTERVALS`. 97 + ``V4L2_FMTDESC_FLAG_ENUM_ALL`` should only be used by drivers that 98 + can return different format list depending on this flag. 89 99 * - __u32 90 100 - ``type`` 91 101 - Type of the data stream, set by the application. Only these types ··· 244 234 valid. The buffer consists of ``height`` lines, each having ``width`` 245 235 Data Units of data and the offset (in bytes) between the beginning of 246 236 each two consecutive lines is ``bytesperline``. 237 + * - ``V4L2_FMTDESC_FLAG_ENUM_ALL`` 238 + - 0x80000000 239 + - When the applications ORs ``index`` with ``V4L2_FMTDESC_FLAG_ENUM_ALL`` flag 240 + the driver enumerates all the possible pixel formats without taking care 241 + of any already set configuration. Drivers which do not support this flag, 242 + always return ``EINVAL`` without clearing this flag. 247 243 248 244 Return Value 249 245 ============
+1
Documentation/userspace-api/media/videodev2.h.rst.exceptions
··· 217 217 replace define V4L2_FMT_FLAG_CSC_HSV_ENC fmtdesc-flags 218 218 replace define V4L2_FMT_FLAG_CSC_QUANTIZATION fmtdesc-flags 219 219 replace define V4L2_FMT_FLAG_META_LINE_BASED fmtdesc-flags 220 + replace define V4L2_FMTDESC_FLAG_ENUM_ALL fmtdesc-flags 220 221 221 222 # V4L2 timecode types 222 223 replace define V4L2_TC_TYPE_24FPS timecode-type
+3
include/uapi/linux/videodev2.h
··· 907 907 #define V4L2_FMT_FLAG_CSC_QUANTIZATION 0x0100 908 908 #define V4L2_FMT_FLAG_META_LINE_BASED 0x0200 909 909 910 + /* Format description flag, to be ORed with the index */ 911 + #define V4L2_FMTDESC_FLAG_ENUM_ALL 0x80000000 912 + 910 913 /* Frame Size and frame rate enumeration */ 911 914 /* 912 915 * F R A M E S I Z E E N U M E R A T I O N