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

media: uvcvideo: Introduce V4L2_META_FMT_UVC_MSXU_1_5

The UVC driver provides two metadata types V4L2_META_FMT_UVC, and
V4L2_META_FMT_D4XX. The only difference between the two of them is that
V4L2_META_FMT_UVC only copies PTS, SCR, size and flags, and
V4L2_META_FMT_D4XX copies the whole metadata section.

Now we only enable V4L2_META_FMT_D4XX for the Intel D4xx family of
devices, but it is useful to have the whole metadata payload for any
device where vendors include other metadata, such as the one described by
Microsoft:
https://learn.microsoft.com/en-us/windows-hardware/drivers/stream/mf-capture-metadata

This patch introduces a new format V4L2_META_FMT_UVC_MSXU_1_5, that is
identical to V4L2_META_FMT_D4XX.

Let the user enable this format with a quirk for now. This way they can
test if their devices provide useful metadata without rebuilding the
kernel. They can later contribute patches to auto-quirk their devices.
We will also work in methods to auto-detect devices compatible with this
new metadata format.

Suggested-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250707-uvc-meta-v8-4-ed17f8b1218b@chromium.org
Signed-off-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>

authored by

Ricardo Ribalda and committed by
Hans Verkuil
2ab4019a 0bb51c88

+32
+1
Documentation/userspace-api/media/v4l/meta-formats.rst
··· 20 20 metafmt-pisp-fe 21 21 metafmt-rkisp1 22 22 metafmt-uvc 23 + metafmt-uvc-msxu-1-5 23 24 metafmt-vivid 24 25 metafmt-vsp1-hgo 25 26 metafmt-vsp1-hgt
+23
Documentation/userspace-api/media/v4l/metafmt-uvc-msxu-1-5.rst
··· 1 + .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 2 + 3 + .. _v4l2-meta-fmt-uvc-msxu-1-5: 4 + 5 + *********************************** 6 + V4L2_META_FMT_UVC_MSXU_1_5 ('UVCM') 7 + *********************************** 8 + 9 + Microsoft(R)'s UVC Payload Metadata. 10 + 11 + 12 + Description 13 + =========== 14 + 15 + V4L2_META_FMT_UVC_MSXU_1_5 buffers follow the metadata buffer layout of 16 + V4L2_META_FMT_UVC with the only difference that it includes all the UVC 17 + metadata in the `buffer[]` field, not just the first 2-12 bytes. 18 + 19 + The metadata format follows the specification from Microsoft(R) [1]. 20 + 21 + .. _1: 22 + 23 + [1] https://docs.microsoft.com/en-us/windows-hardware/drivers/stream/uvc-extensions-1-5
+1
MAINTAINERS
··· 25837 25837 W: http://www.ideasonboard.org/uvc/ 25838 25838 T: git git://linuxtv.org/media.git 25839 25839 F: Documentation/userspace-api/media/drivers/uvcvideo.rst 25840 + F: Documentation/userspace-api/media/v4l/metafmt-uvc-msxu-1-5.rst 25840 25841 F: Documentation/userspace-api/media/v4l/metafmt-uvc.rst 25841 25842 F: drivers/media/common/uvc.c 25842 25843 F: drivers/media/usb/uvc/
+4
drivers/media/usb/uvc/uvc_metadata.c
··· 189 189 !WARN_ON(dev->info->meta_format == V4L2_META_FMT_UVC)) 190 190 dev->meta_formats[i++] = dev->info->meta_format; 191 191 192 + if (dev->quirks & UVC_QUIRK_MSXU_META && 193 + !WARN_ON(dev->info->meta_format == V4L2_META_FMT_UVC_MSXU_1_5)) 194 + dev->meta_formats[i++] = V4L2_META_FMT_UVC_MSXU_1_5; 195 + 192 196 /* IMPORTANT: for new meta-formats update UVC_MAX_META_DATA_FORMATS. */ 193 197 dev->meta_formats[i++] = 0; 194 198 }
+1
drivers/media/usb/uvc/uvcvideo.h
··· 77 77 #define UVC_QUIRK_DISABLE_AUTOSUSPEND 0x00008000 78 78 #define UVC_QUIRK_INVALID_DEVICE_SOF 0x00010000 79 79 #define UVC_QUIRK_MJPEG_NO_EOF 0x00020000 80 + #define UVC_QUIRK_MSXU_META 0x00040000 80 81 81 82 /* Format flags */ 82 83 #define UVC_FMT_FLAG_COMPRESSED 0x00000001
+1
drivers/media/v4l2-core/v4l2-ioctl.c
··· 1463 1463 case V4L2_META_FMT_VSP1_HGO: descr = "R-Car VSP1 1-D Histogram"; break; 1464 1464 case V4L2_META_FMT_VSP1_HGT: descr = "R-Car VSP1 2-D Histogram"; break; 1465 1465 case V4L2_META_FMT_UVC: descr = "UVC Payload Header Metadata"; break; 1466 + case V4L2_META_FMT_UVC_MSXU_1_5: descr = "UVC MSXU Metadata"; break; 1466 1467 case V4L2_META_FMT_D4XX: descr = "Intel D4xx UVC Metadata"; break; 1467 1468 case V4L2_META_FMT_VIVID: descr = "Vivid Metadata"; break; 1468 1469 case V4L2_META_FMT_RK_ISP1_PARAMS: descr = "Rockchip ISP1 3A Parameters"; break;
+1
include/uapi/linux/videodev2.h
··· 867 867 #define V4L2_META_FMT_VSP1_HGT v4l2_fourcc('V', 'S', 'P', 'T') /* R-Car VSP1 2-D Histogram */ 868 868 #define V4L2_META_FMT_UVC v4l2_fourcc('U', 'V', 'C', 'H') /* UVC Payload Header metadata */ 869 869 #define V4L2_META_FMT_D4XX v4l2_fourcc('D', '4', 'X', 'X') /* D4XX Payload Header metadata */ 870 + #define V4L2_META_FMT_UVC_MSXU_1_5 v4l2_fourcc('U', 'V', 'C', 'M') /* UVC MSXU metadata */ 870 871 #define V4L2_META_FMT_VIVID v4l2_fourcc('V', 'I', 'V', 'D') /* Vivid Metadata */ 871 872 872 873 /* Vendor specific - used for RK_ISP1 camera sub-system */