media: uvcvideo: Add GUID for BGRA/X 8:8:8:8
PATCH 1/1 media: uvcvideo: Add GUID for BGRA/X 8:8:8:8
The Cypress EZUSB FX3 UVC example can be configured to report pixel format "e436eb7e-524f-11ce-9f53-0020af0ba770". This is its GUID for BGRA/X 8:8:8:8.
The UVC 1.5 spec [1] only defines GUIDs for YUY2, NV12, M420 and I420. This seems to be an extension documented in the Microsoft Windows Media Format SDK[2]. This Media Format SDK defines this GUID as corresponding to MEDIASUBTYPE_RGB32.
Note that in my case, the FX3 UVC can output either channel order, BGR or RGB or any other mix for that matter. Since Linux commit 1b8dc32286a1a ("[media] uvcvideo: Add GUID for BGR 8:8:8") defined a GUID for MEDIASUBTYPE_RGB24 channel order as BGR, keep this change consistent and define MEDIASUBTYPE_RGB32 as BGR as well.
[1]: https://www.usb.org/document-library/video-class-v15-document-set
[2]: https://learn.microsoft.com/en-us/windows/win32/wmformat/media-type-identifiers
---
Cc: Laurent Pinchart <[email protected]>
Cc: Mauro Carvalho Chehab <[email protected]>
Cc: William Manley <[email protected]>
--- include/media/v4l2-uvc.h | 8 ++++++++ 1 file changed, 8 insertions(+)
include/media/v4l2-uvc.h +8 -0
@@ -99,6 +99,9 @@#define UVC_GUID_FORMAT_BGR3 \ { 0x7d, 0xeb, 0x36, 0xe4, 0x4f, 0x52, 0xce, 0x11, \ 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70} +#define UVC_GUID_FORMAT_BGR4 \ + { 0x7e, 0xeb, 0x36, 0xe4, 0x4f, 0x52, 0xce, 0x11, \ + 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}#define UVC_GUID_FORMAT_M420 \ { 'M', '4', '2', '0', 0x00, 0x00, 0x10, 0x00, \ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
@@ -266,6 +269,11 @@ static struct uvc_format_desc uvc_fmts[] = { .guid = UVC_GUID_FORMAT_BGR3, .fcc = V4L2_PIX_FMT_BGR24, }, + { + .name = "BGRA/X 8:8:8:8 (BGR4)", + .guid = UVC_GUID_FORMAT_BGR4, + .fcc = V4L2_PIX_FMT_BGR32, + }, { .name = "H.264", .guid = UVC_GUID_FORMAT_H264,
Signature · 1 line
2.39.0
Hi Marek,
Thank you for the patch.
Quoted 9 lines · Marek Vasut
The Cypress EZUSB FX3 UVC example can be configured to report pixel format "e436eb7e-524f-11ce-9f53-0020af0ba770". This is its GUID for BGRA/X 8:8:8:8.
The UVC 1.5 spec [1] only defines GUIDs for YUY2, NV12, M420 and I420. This seems to be an extension documented in the Microsoft Windows Media Format SDK[2]. This Media Format SDK defines this GUID as corresponding to
MEDIASUBTYPE_RGB32.
Quoted 5 lines
Note that in my case, the FX3 UVC can output either channel order, BGR or RGB or any other mix for that matter. Since Linux commit
1b8dc32286a1a("[media] uvcvideo: Add GUID for BGR 8:8:8") defined a GUID forMEDIASUBTYPE_RGB24channel order as BGR, keep this change consistent and defineMEDIASUBTYPE_RGB32as BGR as well.
I'd like to see documentation of the MEDIASUBTYPE_RGB32 format that indicates the components order precisely. While there's a high chance it maps to a BGR (in the V4L2 nomenclature) format, there would still be two different options for the A or X component.
Quoted 38 lines
[1]: https://www.usb.org/document-library/video-class-v15-document-set
[2]: https://learn.microsoft.com/en-us/windows/win32/wmformat/media-type-identifiersSigned-off-by Marek Vasut <[email protected]>---
Cc: Laurent Pinchart <[email protected]>
Cc: Mauro Carvalho Chehab <[email protected]>
Cc: William Manley <[email protected]>--- include/media/v4l2-uvc.h | 8 ++++++++ 1 file changed, 8 insertions(+)include/media/v4l2-uvc.h +8
-0@@ -99,6 +99,9 @@#define UVC_GUID_FORMAT_BGR3 \ { 0x7d, 0xeb, 0x36, 0xe4, 0x4f, 0x52, 0xce, 0x11, \ 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70} +#define UVC_GUID_FORMAT_BGR4 \ + { 0x7e, 0xeb, 0x36, 0xe4, 0x4f, 0x52, 0xce, 0x11, \ + 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}#define UVC_GUID_FORMAT_M420 \ { 'M', '4', '2', '0', 0x00, 0x00, 0x10, 0x00, \ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}@@ -266,6 +269,11 @@ static struct uvc_format_desc uvc_fmts[] = { .guid = UVC_GUID_FORMAT_BGR3, .fcc = V4L2_PIX_FMT_BGR24, }, + { + .name = "BGRA/X 8:8:8:8 (BGR4)", + .guid = UVC_GUID_FORMAT_BGR4, + .fcc = V4L2_PIX_FMT_BGR32, + }, { .name = "H.264", .guid = UVC_GUID_FORMAT_H264,
Signature · 3 lines
Regards, Laurent Pinchart
Quoted 1 line · Laurent Pinchart
Hi Marek,
Hi,
Quoted 18 lines
Thank you for the patch.
Quoted 9 lines · Marek Vasut
The Cypress EZUSB FX3 UVC example can be configured to report pixel format "e436eb7e-524f-11ce-9f53-0020af0ba770". This is its GUID for BGRA/X 8:8:8:8.
The UVC 1.5 spec [1] only defines GUIDs for YUY2, NV12, M420 and I420. This seems to be an extension documented in the Microsoft Windows Media Format SDK[2]. This Media Format SDK defines this GUID as corresponding to
MEDIASUBTYPE_RGB32.Quoted 5 lines
Note that in my case, the FX3 UVC can output either channel order, BGR or RGB or any other mix for that matter. Since Linux commit
1b8dc32286a1a("[media] uvcvideo: Add GUID for BGR 8:8:8") defined a GUID forMEDIASUBTYPE_RGB24channel order as BGR, keep this change consistent and defineMEDIASUBTYPE_RGB32as BGR as well.
Quoted 4 lines
I'd like to see documentation of the
MEDIASUBTYPE_RGB32format that indicates the components order precisely. While there's a high chance it maps to a BGR (in the V4L2 nomenclature) format, there would still be two different options for the A or X component.
Maybe this ?
"
Remarks
...
For RGB 32, every pixel is an RGBQUAD. Each color is one byte, with a value from 0 to 255, inclusive. The memory layout is:
Byte 0 1 2 3 Value Blue Green Red Alpha or Don't Care
"
Maps to
drivers/media/v4l2-core/v4l2-ioctl.c: case V4L2_PIX_FMT_BGR32: descr = "32-bit BGRA/X 8-8-8-8"; break;
Hi Marek,
Quoted 31 lines · Marek Vasut
Quoted 16 lines · Laurent Pinchart
Quoted 9 lines · Marek Vasut
The Cypress EZUSB FX3 UVC example can be configured to report pixel format "e436eb7e-524f-11ce-9f53-0020af0ba770". This is its GUID for BGRA/X 8:8:8:8.
The UVC 1.5 spec [1] only defines GUIDs for YUY2, NV12, M420 and I420. This seems to be an extension documented in the Microsoft Windows Media Format SDK[2]. This Media Format SDK defines this GUID as corresponding to
MEDIASUBTYPE_RGB32.Quoted 5 lines
Note that in my case, the FX3 UVC can output either channel order, BGR or RGB or any other mix for that matter. Since Linux commit
1b8dc32286a1a("[media] uvcvideo: Add GUID for BGR 8:8:8") defined a GUID forMEDIASUBTYPE_RGB24channel order as BGR, keep this change consistent and defineMEDIASUBTYPE_RGB32as BGR as well.Quoted 4 lines
I'd like to see documentation of the
MEDIASUBTYPE_RGB32format that indicates the components order precisely. While there's a high chance it maps to a BGR (in the V4L2 nomenclature) format, there would still be two different options for the A or X component.Maybe this ?
"
Remarks
...
For RGB 32, every pixel is an RGBQUAD. Each color is one byte, with a value from 0 to 255, inclusive. The memory layout is:
Quoted 8 lines
Byte 0 1 2 3 Value Blue Green Red Alpha or Don't Care"
Maps to
drivers/media/v4l2-core/v4l2-ioctl.c: caseV4L2_PIX_FMT_BGR32:
descr = "32-bit BGRA/X 8-8-8-8"; break;
Thank you for digging it up. Looks good to me, except that V4L2_PIX_FMT_BGR32 is deprecated (see
https://linuxtv.org/downloads/v4l-dvb-apis/userspace-api/v4l/pixfmt-rgb.html#deprecated-rgb-formats).
You should use V4L2_PIX_FMT_BGRA32 or V4L2_PIX_FMT_BGRX32 instead.
Signature · 3 lines
Regards, Laurent Pinchart
Quoted 40 lines · Laurent Pinchart
Hi Marek,
Quoted 37 lines · Marek Vasut
Quoted 16 lines · Laurent Pinchart
Quoted 9 lines · Marek Vasut
The Cypress EZUSB FX3 UVC example can be configured to report pixel format "e436eb7e-524f-11ce-9f53-0020af0ba770". This is its GUID for BGRA/X 8:8:8:8.
The UVC 1.5 spec [1] only defines GUIDs for YUY2, NV12, M420 and I420. This seems to be an extension documented in the Microsoft Windows Media Format SDK[2]. This Media Format SDK defines this GUID as corresponding to
MEDIASUBTYPE_RGB32.Quoted 5 lines
Note that in my case, the FX3 UVC can output either channel order, BGR or RGB or any other mix for that matter. Since Linux commit
1b8dc32286a1a("[media] uvcvideo: Add GUID for BGR 8:8:8") defined a GUID forMEDIASUBTYPE_RGB24channel order as BGR, keep this change consistent and defineMEDIASUBTYPE_RGB32as BGR as well.Quoted 4 lines
I'd like to see documentation of the
MEDIASUBTYPE_RGB32format that indicates the components order precisely. While there's a high chance it maps to a BGR (in the V4L2 nomenclature) format, there would still be two different options for the A or X component.Maybe this ?
"
Remarks
...
For RGB 32, every pixel is an RGBQUAD. Each color is one byte, with a value from 0 to 255, inclusive. The memory layout is:Byte 0 1 2 3 Value Blue Green Red Alpha or Don't Care"
Maps to
Quoted 7 lines
Quoted 2 lines
drivers/media/v4l2-core/v4l2-ioctl.c: caseV4L2_PIX_FMT_BGR32:
descr = "32-bit BGRA/X 8-8-8-8"; break;Thank you for digging it up. Looks good to me, except that
V4L2_PIX_FMT_BGR32is deprecated (see
https://linuxtv.org/downloads/v4l-dvb-apis/userspace-api/v4l/pixfmt-rgb.html#deprecated-rgb-formats).
You should useV4L2_PIX_FMT_BGRA32orV4L2_PIX_FMT_BGRX32instead.
V4L2_PIX_FMT_XBGR32 , right ?
Hi Marek,
Quoted 42 lines · Marek Vasut
Quoted 41 lines · Laurent Pinchart
Quoted 39 lines · Marek Vasut
Quoted 16 lines · Laurent Pinchart
Quoted 9 lines · Marek Vasut
The Cypress EZUSB FX3 UVC example can be configured to report pixel format "e436eb7e-524f-11ce-9f53-0020af0ba770". This is its GUID for BGRA/X 8:8:8:8.
The UVC 1.5 spec [1] only defines GUIDs for YUY2, NV12, M420 and I420. This seems to be an extension documented in the Microsoft Windows Media Format SDK[2]. This Media Format SDK defines this GUID as corresponding to
MEDIASUBTYPE_RGB32.Quoted 5 lines
Note that in my case, the FX3 UVC can output either channel order, BGR or RGB or any other mix for that matter. Since Linux commit
1b8dc32286a1a("[media] uvcvideo: Add GUID for BGR 8:8:8") defined a GUID forMEDIASUBTYPE_RGB24channel order as BGR, keep this change consistent and defineMEDIASUBTYPE_RGB32as BGR as well.Quoted 4 lines
I'd like to see documentation of the
MEDIASUBTYPE_RGB32format that indicates the components order precisely. While there's a high chance it maps to a BGR (in the V4L2 nomenclature) format, there would still be two different options for the A or X component.Maybe this ?
"
Remarks
...
For RGB 32, every pixel is an RGBQUAD. Each color is one byte, with a value from 0 to 255, inclusive. The memory layout is:Byte 0 1 2 3 Value Blue Green Red Alpha or Don't Care"
Maps to
drivers/media/v4l2-core/v4l2-ioctl.c: caseV4L2_PIX_FMT_BGR32:
descr = "32-bit BGRA/X 8-8-8-8"; break;
Quoted 6 lines
Quoted 4 lines
Thank you for digging it up. Looks good to me, except that
V4L2_PIX_FMT_BGR32is deprecated (see
https://linuxtv.org/downloads/v4l-dvb-apis/userspace-api/v4l/pixfmt-rgb.html#deprecated-rgb-formats).
You should useV4L2_PIX_FMT_BGRA32orV4L2_PIX_FMT_BGRX32instead.
V4L2_PIX_FMT_XBGR32, right ?
Yes, my bad. 4CCs are awful :-)
We could also use V4L2_PIX_FMT_ABGR32, but I don't think a UVC camera would meaningfully produce an alpha channel.
I can change the pixel format when applying the patch if this is fine with you.
Signature · 3 lines
Regards, Laurent Pinchart
Quoted 1 line · Laurent Pinchart
Hi Marek,
Hi,
Quoted 50 lines · Marek Vasut
Quoted 42 lines · Laurent Pinchart
Quoted 41 lines · Marek Vasut
Quoted 39 lines · Laurent Pinchart
Quoted 16 lines · Marek Vasut
Quoted 9 lines
The Cypress EZUSB FX3 UVC example can be configured to report pixel format "e436eb7e-524f-11ce-9f53-0020af0ba770". This is its GUID for BGRA/X 8:8:8:8.
The UVC 1.5 spec [1] only defines GUIDs for YUY2, NV12, M420 and I420. This seems to be an extension documented in the Microsoft Windows Media Format SDK[2]. This Media Format SDK defines this GUID as corresponding to
MEDIASUBTYPE_RGB32.Quoted 5 lines
Note that in my case, the FX3 UVC can output either channel order, BGR or RGB or any other mix for that matter. Since Linux commit
1b8dc32286a1a("[media] uvcvideo: Add GUID for BGR 8:8:8") defined a GUID forMEDIASUBTYPE_RGB24channel order as BGR, keep this change consistent and defineMEDIASUBTYPE_RGB32as BGR as well.Quoted 4 lines
I'd like to see documentation of the
MEDIASUBTYPE_RGB32format that indicates the components order precisely. While there's a high chance it maps to a BGR (in the V4L2 nomenclature) format, there would still be two different options for the A or X component.Maybe this ?
"
Remarks
...
For RGB 32, every pixel is an RGBQUAD. Each color is one byte, with a value from 0 to 255, inclusive. The memory layout is:Byte 0 1 2 3 Value Blue Green Red Alpha or Don't Care"
Maps to
drivers/media/v4l2-core/v4l2-ioctl.c: caseV4L2_PIX_FMT_BGR32:
descr = "32-bit BGRA/X 8-8-8-8"; break;Quoted 6 lines
Quoted 4 lines
Thank you for digging it up. Looks good to me, except that
V4L2_PIX_FMT_BGR32is deprecated (see
https://linuxtv.org/downloads/v4l-dvb-apis/userspace-api/v4l/pixfmt-rgb.html#deprecated-rgb-formats).
You should useV4L2_PIX_FMT_BGRA32orV4L2_PIX_FMT_BGRX32instead.
V4L2_PIX_FMT_XBGR32, right ?
Quoted 7 lines
Yes, my bad. 4CCs are awful :-)
We could also use
V4L2_PIX_FMT_ABGR32, but I don't think a UVC camera would meaningfully produce an alpha channel.I can change the pixel format when applying the patch if this is fine with you.
I sent a V2 with a couple more links for future reference.