Skip to contentSkip to conversation

drm/fourcc: Add formats for packed YUV 4:4:4 AVUY and XVUY permutations

PATCH Applied Laurent Pinchart 3 participants 6 messages Jun 16, 2022 – Jul 18, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/fourcc: Add formats for packed YUV 4:4:4 AVUY and XVUY permutations

Add FourCCs for two missing permutations of the packed YUV 4:4:4 color components, namely AVUY and XVUY.

These formats are needed by the NXP i.MX8 ISI. While the ISI is supported by a V4L2 device (corresponding formats have been submitted to V4L2), it is handled in userspace by libcamera, which uses DRM FourCCs for pixel formats.

---
 include/uapi/drm/drm_fourcc.h | 2 ++
 1 file changed, 2 insertions(+)
include/uapi/drm/drm_fourcc.h +2 -0
index f1972154a594..399d950c53e3 100644
@@ -205,7 +205,9 @@ extern "C" {
 #define DRM_FORMAT_VYUY		fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */
 
 #define DRM_FORMAT_AYUV		fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
+#define DRM_FORMAT_AVUY8888	fourcc_code('A', 'V', 'U', 'Y') /* [31:0] A:Cr:Cb:Y 8:8:8:8 little endian */
 #define DRM_FORMAT_XYUV8888	fourcc_code('X', 'Y', 'U', 'V') /* [31:0] X:Y:Cb:Cr 8:8:8:8 little endian */
+#define DRM_FORMAT_XVUY8888	fourcc_code('X', 'V', 'U', 'Y') /* [31:0] X:Cr:Cb:Y 8:8:8:8 little endian */
 #define DRM_FORMAT_VUY888	fourcc_code('V', 'U', '2', '4') /* [23:0] Cr:Cb:Y 8:8:8 little endian */
 #define DRM_FORMAT_VUY101010	fourcc_code('V', 'U', '3', '0') /* Y followed by U then V, 10:10:10. Non-linear modifier only */
 
Signature · 3 lines
Regards,

Laurent Pinchart
Reviewed-by on v1 1/1
#1 lore raw
Quoted 1 line · Laurent Pinchart

Add FourCCs for two missing permutations of the packed YUV 4:4:4 color

For a second I thought this 4:4:4 is the bit packing, but it's the 444 sampling rate thing.

Man formats are confusing.

include/uapi/drm/drm_fourcc.h extern "C" {

Quoted 17 lines

components, namely AVUY and XVUY.

These formats are needed by the NXP i.MX8 ISI. While the ISI is supported by a V4L2 device (corresponding formats have been submitted to V4L2), it is handled in userspace by libcamera, which uses DRM FourCCs for pixel formats.

---
 include/uapi/drm/drm_fourcc.h | 2 ++
 1 file changed, 2 insertions(+)
include/uapi/drm/drm_fourcc.h +0 -0
index f1972154a594..399d950c53e3 100644
@@ -205,7 +205,9 @@ extern "C" {

I build script to make sure we don't accidentally assign duplicated codes would be nice, this is pain to check.

Quoted 14 lines
include/uapi/drm/drm_fourcc.h +2 -0
 #define DRM_FORMAT_VYUY		fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */
 
 #define DRM_FORMAT_AYUV		fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
+#define DRM_FORMAT_AVUY8888	fourcc_code('A', 'V', 'U', 'Y') /* [31:0] A:Cr:Cb:Y 8:8:8:8 little endian */
 #define DRM_FORMAT_XYUV8888	fourcc_code('X', 'Y', 'U', 'V') /* [31:0] X:Y:Cb:Cr 8:8:8:8 little endian */
+#define DRM_FORMAT_XVUY8888	fourcc_code('X', 'V', 'U', 'Y') /* [31:0] X:Cr:Cb:Y 8:8:8:8 little endian */
 #define DRM_FORMAT_VUY888	fourcc_code('V', 'U', '2', '4') /* [23:0] Cr:Cb:Y 8:8:8 little endian */
 #define DRM_FORMAT_VUY101010	fourcc_code('V', 'U', '3', '0') /* Y followed by U then V, 10:10:10. Non-linear modifier only */
 
Signature · 3 lines
Regards,

Laurent Pinchart
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#2 lore raw

Hi Daniel,

Quoted 7 lines · Daniel Vetter
Quoted 1 line · Laurent Pinchart

Add FourCCs for two missing permutations of the packed YUV 4:4:4 color

For a second I thought this 4:4:4 is the bit packing, but it's the 444 sampling rate thing.

Man formats are confusing.

:-)

Quoted 12 lines
Quoted 12 lines

components, namely AVUY and XVUY.

These formats are needed by the NXP i.MX8 ISI. While the ISI is supported by a V4L2 device (corresponding formats have been submitted to V4L2), it is handled in userspace by libcamera, which uses DRM FourCCs for pixel formats.

---
 include/uapi/drm/drm_fourcc.h | 2 ++
 1 file changed, 2 insertions(+)
Quoted 8 lines

include/uapi/drm/drm_fourcc.h extern "C" {

Quoted 5 lines
include/uapi/drm/drm_fourcc.h +0 -0
index f1972154a594..399d950c53e3 100644
@@ -205,7 +205,9 @@ extern "C" {

I build script to make sure we don't accidentally assign duplicated codes would be nice, this is pain to check.

Do you mean something like

cat include/uapi/drm/drm_fourcc.h | \
	grep '#define DRM_FORMAT_.*fourcc_code' | \
	sed 's/.*fourcc_code(\([^)]*\)).*/\1/' | \
	sort | \
	uniq -c | \
	grep -qv '^ \+1 ' && echo "Duplicate 4CC !!"

?

Where could this live ?

Quoted 10 lines
Quoted 8 lines
include/uapi/drm/drm_fourcc.h +2 -0
 #define DRM_FORMAT_VYUY		fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */
 
 #define DRM_FORMAT_AYUV		fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
+#define DRM_FORMAT_AVUY8888	fourcc_code('A', 'V', 'U', 'Y') /* [31:0] A:Cr:Cb:Y 8:8:8:8 little endian */
 #define DRM_FORMAT_XYUV8888	fourcc_code('X', 'Y', 'U', 'V') /* [31:0] X:Y:Cb:Cr 8:8:8:8 little endian */
+#define DRM_FORMAT_XVUY8888	fourcc_code('X', 'V', 'U', 'Y') /* [31:0] X:Cr:Cb:Y 8:8:8:8 little endian */
 #define DRM_FORMAT_VUY888	fourcc_code('V', 'U', '2', '4') /* [23:0] Cr:Cb:Y 8:8:8 little endian */
 #define DRM_FORMAT_VUY101010	fourcc_code('V', 'U', '3', '0') /* Y followed by U then V, 10:10:10. Non-linear modifier only */
Signature · 3 lines
Regards,

Laurent Pinchart
#3 lore raw
Quoted 43 lines · Laurent Pinchart

Hi Daniel,

Quoted 7 lines · Daniel Vetter
Quoted 1 line · Laurent Pinchart

Add FourCCs for two missing permutations of the packed YUV 4:4:4 color

For a second I thought this 4:4:4 is the bit packing, but it's the 444 sampling rate thing.

Man formats are confusing.

:-)

Quoted 12 lines
Quoted 12 lines

components, namely AVUY and XVUY.

These formats are needed by the NXP i.MX8 ISI. While the ISI is supported by a V4L2 device (corresponding formats have been submitted to V4L2), it is handled in userspace by libcamera, which uses DRM FourCCs for pixel formats.

---
 include/uapi/drm/drm_fourcc.h | 2 ++
 1 file changed, 2 insertions(+)
Quoted 8 lines

include/uapi/drm/drm_fourcc.h extern "C" {

Quoted 5 lines
include/uapi/drm/drm_fourcc.h +0 -0
index f1972154a594..399d950c53e3 100644
@@ -205,7 +205,9 @@ extern "C" {

I build script to make sure we don't accidentally assign duplicated codes would be nice, this is pain to check.

Do you mean something like

cat include/uapi/drm/drm_fourcc.h | \
	grep '#define DRM_FORMAT_.*fourcc_code' | \
	sed 's/.*fourcc_code(\([^)]*\)).*/\1/' | \
	sort | \
	uniq -c | \
	grep -qv '^ \+1 ' && echo "Duplicate 4CC !!"
Quoted 3 lines

?

Where could this live ?

Can we stuff it into Kbuild as a check?
-Daniel

Quoted 16 lines
Quoted 11 lines
Quoted 8 lines
include/uapi/drm/drm_fourcc.h +2 -0
 #define DRM_FORMAT_VYUY		fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */
 
 #define DRM_FORMAT_AYUV		fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
+#define DRM_FORMAT_AVUY8888	fourcc_code('A', 'V', 'U', 'Y') /* [31:0] A:Cr:Cb:Y 8:8:8:8 little endian */
 #define DRM_FORMAT_XYUV8888	fourcc_code('X', 'Y', 'U', 'V') /* [31:0] X:Y:Cb:Cr 8:8:8:8 little endian */
+#define DRM_FORMAT_XVUY8888	fourcc_code('X', 'V', 'U', 'Y') /* [31:0] X:Cr:Cb:Y 8:8:8:8 little endian */
 #define DRM_FORMAT_VUY888	fourcc_code('V', 'U', '2', '4') /* [23:0] Cr:Cb:Y 8:8:8 little endian */
 #define DRM_FORMAT_VUY101010	fourcc_code('V', 'U', '3', '0') /* Y followed by U then V, 10:10:10. Non-linear modifier only */
Signature · 3 lines
Regards,

Laurent Pinchart
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#4 lore raw
Quoted 44 lines · Daniel Vetter
Quoted 43 lines · Laurent Pinchart

Hi Daniel,

Quoted 7 lines · Daniel Vetter
Quoted 1 line · Laurent Pinchart

Add FourCCs for two missing permutations of the packed YUV 4:4:4 color

For a second I thought this 4:4:4 is the bit packing, but it's the 444 sampling rate thing.

Man formats are confusing.

:-)

Quoted 12 lines
Quoted 12 lines

components, namely AVUY and XVUY.

These formats are needed by the NXP i.MX8 ISI. While the ISI is supported by a V4L2 device (corresponding formats have been submitted to V4L2), it is handled in userspace by libcamera, which uses DRM FourCCs for pixel formats.

---
 include/uapi/drm/drm_fourcc.h | 2 ++
 1 file changed, 2 insertions(+)
Quoted 8 lines

include/uapi/drm/drm_fourcc.h extern "C" {

Quoted 5 lines
include/uapi/drm/drm_fourcc.h +0 -0
index f1972154a594..399d950c53e3 100644
@@ -205,7 +205,9 @@ extern "C" {

I build script to make sure we don't accidentally assign duplicated codes would be nice, this is pain to check.

Do you mean something like

cat include/uapi/drm/drm_fourcc.h | \
	grep '#define DRM_FORMAT_.*fourcc_code' | \
	sed 's/.*fourcc_code(\([^)]*\)).*/\1/' | \
	sort | \
	uniq -c | \
	grep -qv '^ \+1 ' && echo "Duplicate 4CC !!"
Quoted 5 lines
Quoted 3 lines

?

Where could this live ?

Can we stuff it into Kbuild as a check?

Sounds like a good idea. Anyone know how to do so ?

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
include/uapi/drm/drm_fourcc.h +2 -0
 #define DRM_FORMAT_VYUY		fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */
 
 #define DRM_FORMAT_AYUV		fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
+#define DRM_FORMAT_AVUY8888	fourcc_code('A', 'V', 'U', 'Y') /* [31:0] A:Cr:Cb:Y 8:8:8:8 little endian */
 #define DRM_FORMAT_XYUV8888	fourcc_code('X', 'Y', 'U', 'V') /* [31:0] X:Y:Cb:Cr 8:8:8:8 little endian */
+#define DRM_FORMAT_XVUY8888	fourcc_code('X', 'V', 'U', 'Y') /* [31:0] X:Cr:Cb:Y 8:8:8:8 little endian */
 #define DRM_FORMAT_VUY888	fourcc_code('V', 'U', '2', '4') /* [23:0] Cr:Cb:Y 8:8:8 little endian */
 #define DRM_FORMAT_VUY101010	fourcc_code('V', 'U', '3', '0') /* Y followed by U then V, 10:10:10. Non-linear modifier only */
Signature · 3 lines
Regards,

Laurent Pinchart
#5 lore raw
In reply to Laurent Pinchart
Quoted 9 lines · Laurent Pinchart

Add FourCCs for two missing permutations of the packed YUV 4:4:4 color components, namely AVUY and XVUY.

These formats are needed by the NXP i.MX8 ISI. While the ISI is supported by a V4L2 device (corresponding formats have been submitted to V4L2), it is handled in userspace by libcamera, which uses DRM FourCCs for pixel formats.

[...]

Applied to drm/drm-misc (drm-misc-next).

Thanks!
Maxime