Skip to content

Commit 2ab4019

Browse files
ribaldahverkuil
authored andcommitted
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 <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Ricardo Ribalda <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent 0bb51c8 commit 2ab4019

File tree

7 files changed

+32
-0
lines changed

7 files changed

+32
-0
lines changed

Documentation/userspace-api/media/v4l/meta-formats.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ These formats are used for the :ref:`metadata` interface only.
2020
metafmt-pisp-fe
2121
metafmt-rkisp1
2222
metafmt-uvc
23+
metafmt-uvc-msxu-1-5
2324
metafmt-vivid
2425
metafmt-vsp1-hgo
2526
metafmt-vsp1-hgt
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25837,6 +25837,7 @@ S: Maintained
2583725837
W: http://www.ideasonboard.org/uvc/
2583825838
T: git git://linuxtv.org/media.git
2583925839
F: Documentation/userspace-api/media/drivers/uvcvideo.rst
25840+
F: Documentation/userspace-api/media/v4l/metafmt-uvc-msxu-1-5.rst
2584025841
F: Documentation/userspace-api/media/v4l/metafmt-uvc.rst
2584125842
F: drivers/media/common/uvc.c
2584225843
F: drivers/media/usb/uvc/

drivers/media/usb/uvc/uvc_metadata.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ void uvc_meta_init(struct uvc_device *dev)
189189
!WARN_ON(dev->info->meta_format == V4L2_META_FMT_UVC))
190190
dev->meta_formats[i++] = dev->info->meta_format;
191191

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+
192196
/* IMPORTANT: for new meta-formats update UVC_MAX_META_DATA_FORMATS. */
193197
dev->meta_formats[i++] = 0;
194198
}

drivers/media/usb/uvc/uvcvideo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
#define UVC_QUIRK_DISABLE_AUTOSUSPEND 0x00008000
7878
#define UVC_QUIRK_INVALID_DEVICE_SOF 0x00010000
7979
#define UVC_QUIRK_MJPEG_NO_EOF 0x00020000
80+
#define UVC_QUIRK_MSXU_META 0x00040000
8081

8182
/* Format flags */
8283
#define UVC_FMT_FLAG_COMPRESSED 0x00000001

drivers/media/v4l2-core/v4l2-ioctl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,6 +1463,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
14631463
case V4L2_META_FMT_VSP1_HGO: descr = "R-Car VSP1 1-D Histogram"; break;
14641464
case V4L2_META_FMT_VSP1_HGT: descr = "R-Car VSP1 2-D Histogram"; break;
14651465
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;
14661467
case V4L2_META_FMT_D4XX: descr = "Intel D4xx UVC Metadata"; break;
14671468
case V4L2_META_FMT_VIVID: descr = "Vivid Metadata"; break;
14681469
case V4L2_META_FMT_RK_ISP1_PARAMS: descr = "Rockchip ISP1 3A Parameters"; break;

include/uapi/linux/videodev2.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,7 @@ struct v4l2_pix_format {
867867
#define V4L2_META_FMT_VSP1_HGT v4l2_fourcc('V', 'S', 'P', 'T') /* R-Car VSP1 2-D Histogram */
868868
#define V4L2_META_FMT_UVC v4l2_fourcc('U', 'V', 'C', 'H') /* UVC Payload Header metadata */
869869
#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 */
870871
#define V4L2_META_FMT_VIVID v4l2_fourcc('V', 'I', 'V', 'D') /* Vivid Metadata */
871872

872873
/* Vendor specific - used for RK_ISP1 camera sub-system */

0 commit comments

Comments
 (0)