On Fri Dec 26 06:57:18 2025 +0000, Oliver Collyer wrote:
> Add support for the P010 (10-bit Y/UV 4:2:0) pixel format to the
> uvcvideo driver. This format is exposed by USB capture devices such as
> the Magewell USB Capture HDMI 4K Pro when capturing HDR10 content.
> 
> P010 stores 10-bit Y and interleaved UV samples in 16-bit little-endian
> words, with data in the upper 10 bits and zeros in the lower 6 bits.
> This requires 2 bytes per sample, so bytesperline is wWidth * 2.
> 
> V4L2_PIX_FMT_P010 was added to the V4L2 core in commit 5374d8fb75f3
> ("media: Add P010 video format").
> 
> Based on the community DKMS patch from awawa-dev/P010_for_V4L2.
> 
> Link: https://github.com/awawa-dev/P010_for_V4L2
> Signed-off-by: Oliver Collyer <[email protected]>
> Reviewed-by: Laurent Pinchart <[email protected]>
> Link: https://patch.msgid.link/[email protected]
> Signed-off-by: Laurent Pinchart <[email protected]>
> Signed-off-by: Hans Verkuil <[email protected]>

Patch committed.

Thanks,
Hans Verkuil

 drivers/media/common/uvc.c       | 4 ++++
 drivers/media/usb/uvc/uvc_v4l2.c | 3 +++
 include/linux/usb/uvc.h          | 3 +++
 3 files changed, 10 insertions(+)

---

diff --git a/drivers/media/common/uvc.c b/drivers/media/common/uvc.c
index 1ad4604474ac..0107cedd031e 100644
--- a/drivers/media/common/uvc.c
+++ b/drivers/media/common/uvc.c
@@ -40,6 +40,10 @@ static const struct uvc_format_desc uvc_fmts[] = {
                .guid           = UVC_GUID_FORMAT_M420,
                .fcc            = V4L2_PIX_FMT_M420,
        },
+       {
+               .guid           = UVC_GUID_FORMAT_P010,
+               .fcc            = V4L2_PIX_FMT_P010,
+       },
        {
                .guid           = UVC_GUID_FORMAT_UYVY,
                .fcc            = V4L2_PIX_FMT_UYVY,
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index d5860661c115..cda1697204ea 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -230,6 +230,9 @@ static u32 uvc_v4l2_get_bytesperline(const struct 
uvc_format *format,
        case V4L2_PIX_FMT_M420:
                return frame->wWidth;
 
+       case V4L2_PIX_FMT_P010:
+               return frame->wWidth * 2;
+
        default:
                return format->bpp * frame->wWidth / 8;
        }
diff --git a/include/linux/usb/uvc.h b/include/linux/usb/uvc.h
index ea92ac623a45..05bfebab42b6 100644
--- a/include/linux/usb/uvc.h
+++ b/include/linux/usb/uvc.h
@@ -138,6 +138,9 @@
 #define UVC_GUID_FORMAT_M420 \
        { 'M',  '4',  '2',  '0', 0x00, 0x00, 0x10, 0x00, \
         0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+#define UVC_GUID_FORMAT_P010 \
+       { 'P',  '0',  '1',  '0', 0x00, 0x00, 0x10, 0x00, \
+        0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
 
 #define UVC_GUID_FORMAT_H264 \
        { 'H',  '2',  '6',  '4', 0x00, 0x00, 0x10, 0x00, \
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to