summaryrefslogtreecommitdiffstats
path: root/include/uapi/drm/drm_fourcc.h
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2021-06-10 13:12:34 +0200
committerThierry Reding <treding@nvidia.com>2021-08-16 12:17:56 +0200
commit32a4eb04d59ae8d5bb5baa5a8528e31094ae8e84 (patch)
tree631593aae617b5c66626c1b56465cdfe6935af53 /include/uapi/drm/drm_fourcc.h
parentdrm: unexport drm_ioctl_permit (diff)
downloadlinux-32a4eb04d59ae8d5bb5baa5a8528e31094ae8e84.tar.xz
linux-32a4eb04d59ae8d5bb5baa5a8528e31094ae8e84.zip
drm/fourcc: Add macros to determine the modifier vendor
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. Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Daniel Stone <daniels@collabora.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210610111236.3814211-1-thierry.reding@gmail.com
Diffstat (limited to 'include/uapi/drm/drm_fourcc.h')
-rw-r--r--include/uapi/drm/drm_fourcc.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index 9f4bb4a6f358..45a914850be0 100644
--- a/include/uapi/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -373,6 +373,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))