[PATCH v2 01/10] drm/fourcc: Add macros to determine the modifier vendor
Thierry Reding
thierry.reding at gmail.com
Fri Mar 26 14:51:30 UTC 2021
From: Thierry Reding <treding at nvidia.com>
When working with framebuffer modifiers, it can be useful to extract the
vendor identifier or check a modifier against a given vendor identifier.
Add one macro that extracts the vendor identifier and a helper to check
a modifier against a given vendor identifier.
v2: add macro to extract vendor ID from modifier (Simon)
Signed-off-by: Thierry Reding <treding at nvidia.com>
---
include/uapi/drm/drm_fourcc.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index f76de49c768f..64f01bc2624c 100644
--- a/include/uapi/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -366,6 +366,12 @@ extern "C" {
#define DRM_FORMAT_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) == DRM_FORMAT_MOD_VENDOR_## vendor)
+
#define fourcc_mod_code(vendor, val) \
((((__u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | ((val) & 0x00ffffffffffffffULL))
--
2.30.2
More information about the dri-devel
mailing list