media: uvcvideo: Introduce V4L2_META_FMT_UVC_MSXU_1_5

JIRA: https://redhat.atlassian.net/browse/RHEL-162130

Conflicts:
    due to a missing commit
    dc51b3cc9d4d (MAINTAINERS: update location of media main tree)

commit 2ab4019aa34dc2aec4a0824fbf1e49300884fbbf
Author: Ricardo Ribalda <ribalda@chromium.org>
Date: Mon, 7 Jul 2025 18:34:04 +0000

  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>

Signed-off-by: Kate Hsuan <hpa@redhat.com>
This commit is contained in:
Kate Hsuan
2026-05-15 14:39:59 +08:00
parent cf07a85147
commit 73a44582d6
7 changed files with 36 additions and 1 deletions
@@ -17,6 +17,7 @@ These formats are used for the :ref:`metadata` interface only.
metafmt-intel-ipu3
metafmt-rkisp1
metafmt-uvc
metafmt-uvc-msxu-1-5
metafmt-vivid
metafmt-vsp1-hgo
metafmt-vsp1-hgt
@@ -0,0 +1,23 @@
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. _v4l2-meta-fmt-uvc-msxu-1-5:
***********************************
V4L2_META_FMT_UVC_MSXU_1_5 ('UVCM')
***********************************
Microsoft(R)'s UVC Payload Metadata.
Description
===========
V4L2_META_FMT_UVC_MSXU_1_5 buffers follow the metadata buffer layout of
V4L2_META_FMT_UVC with the only difference that it includes all the UVC
metadata in the `buffer[]` field, not just the first 2-12 bytes.
The metadata format follows the specification from Microsoft(R) [1].
.. _1:
[1] https://docs.microsoft.com/en-us/windows-hardware/drivers/stream/uvc-extensions-1-5
+5 -1
View File
@@ -20382,7 +20382,11 @@ M: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
L: linux-media@vger.kernel.org
S: Maintained
W: http://www.ideasonboard.org/uvc/
T: git git://linuxtv.org/media_tree.git
T: git git://linuxtv.org/media.git
F: Documentation/userspace-api/media/drivers/uvcvideo.rst
F: Documentation/userspace-api/media/v4l/metafmt-uvc-msxu-1-5.rst
F: Documentation/userspace-api/media/v4l/metafmt-uvc.rst
F: drivers/media/common/uvc.c
F: drivers/media/usb/uvc/
F: include/uapi/linux/uvcvideo.h
+4
View File
@@ -189,6 +189,10 @@ void uvc_meta_init(struct uvc_device *dev)
!WARN_ON(dev->info->meta_format == V4L2_META_FMT_UVC))
dev->meta_formats[i++] = dev->info->meta_format;
if (dev->quirks & UVC_QUIRK_MSXU_META &&
!WARN_ON(dev->info->meta_format == V4L2_META_FMT_UVC_MSXU_1_5))
dev->meta_formats[i++] = V4L2_META_FMT_UVC_MSXU_1_5;
/* IMPORTANT: for new meta-formats update UVC_MAX_META_DATA_FORMATS. */
dev->meta_formats[i++] = 0;
}
+1
View File
@@ -77,6 +77,7 @@
#define UVC_QUIRK_DISABLE_AUTOSUSPEND 0x00008000
#define UVC_QUIRK_INVALID_DEVICE_SOF 0x00010000
#define UVC_QUIRK_MJPEG_NO_EOF 0x00020000
#define UVC_QUIRK_MSXU_META 0x00040000
/* Format flags */
#define UVC_FMT_FLAG_COMPRESSED 0x00000001
+1
View File
@@ -1461,6 +1461,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
case V4L2_META_FMT_VSP1_HGO: descr = "R-Car VSP1 1-D Histogram"; break;
case V4L2_META_FMT_VSP1_HGT: descr = "R-Car VSP1 2-D Histogram"; break;
case V4L2_META_FMT_UVC: descr = "UVC Payload Header Metadata"; break;
case V4L2_META_FMT_UVC_MSXU_1_5: descr = "UVC MSXU Metadata"; break;
case V4L2_META_FMT_D4XX: descr = "Intel D4xx UVC Metadata"; break;
case V4L2_META_FMT_VIVID: descr = "Vivid Metadata"; break;
case V4L2_META_FMT_RK_ISP1_PARAMS: descr = "Rockchip ISP1 3A Parameters"; break;
+1
View File
@@ -857,6 +857,7 @@ struct v4l2_pix_format {
#define V4L2_META_FMT_VSP1_HGT v4l2_fourcc('V', 'S', 'P', 'T') /* R-Car VSP1 2-D Histogram */
#define V4L2_META_FMT_UVC v4l2_fourcc('U', 'V', 'C', 'H') /* UVC Payload Header metadata */
#define V4L2_META_FMT_D4XX v4l2_fourcc('D', '4', 'X', 'X') /* D4XX Payload Header metadata */
#define V4L2_META_FMT_UVC_MSXU_1_5 v4l2_fourcc('U', 'V', 'C', 'M') /* UVC MSXU metadata */
#define V4L2_META_FMT_VIVID v4l2_fourcc('V', 'I', 'V', 'D') /* Vivid Metadata */
/* Vendor specific - used for RK_ISP1 camera sub-system */