[PATCH v3 2/4] media: videodev2.h: add pixel format modifiers
Hsia-Jun Li
randy.li at synaptics.com
Tue Nov 1 10:04:46 UTC 2022
From: "Hsia-Jun(Randy) Li" <randy.li at synaptics.com>
Signed-off-by: Hsia-Jun(Randy) Li <randy.li at synaptics.com>
---
include/uapi/linux/videodev2.h | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 29da1f4b4578..d00b2e9c0c54 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -816,6 +816,26 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_FLAG_PREMUL_ALPHA 0x00000001
#define V4L2_PIX_FMT_FLAG_SET_CSC 0x00000002
+/*
+ * F O R M A T M O D I F I E S
+ */
+/* Vendor Ids: */
+#define V4L2_PIX_FMT_RESERVED ((1ULL << 56) - 1)
+
+#define fourcc_mod_get_vendor(modifier) \
+ (((modifier) >> 56) & 0xff)
+
+#define fourcc_mod_is_vendor(modifier, vendor) \
+ (fourcc_mod_get_vendor(modifier) == V4L2_PIX_FMT_MOD_VENDOR_## vendor)
+
+#define fourcc_mod_code(vendor, val) \
+ ((((__u64)V4L2_PIX_FMT_MOD_VENDOR_## vendor) << 56) | ((val) & 0x00ffffffffffffffULL))
+
+/* Format Modifier tokens */
+#define V4L2_PIX_FMT_MOD_INVALID fourcc_mod_code(NONE, V4L2_PIX_FMT_RESERVED)
+#define V4L2_PIX_FMT_MOD_LINEAR fourcc_mod_code(NONE, 0)
+
+
/*
* F O R M A T E N U M E R A T I O N
*/
--
2.17.1
More information about the dri-devel
mailing list