Skip to content

Commit 32a4eb0

Browse files
committed
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
1 parent 7b81217 commit 32a4eb0

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎include/uapi/drm/drm_fourcc.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,12 @@ extern "C" {
373373

374374
#define DRM_FORMAT_RESERVED ((1ULL << 56) - 1)
375375

376+
#define fourcc_mod_get_vendor(modifier) \
377+
(((modifier) >> 56) & 0xff)
378+
379+
#define fourcc_mod_is_vendor(modifier, vendor) \
380+
(fourcc_mod_get_vendor(modifier) == DRM_FORMAT_MOD_VENDOR_## vendor)
381+
376382
#define fourcc_mod_code(vendor, val) \
377383
((((__u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | ((val) & 0x00ffffffffffffffULL))
378384

0 commit comments

Comments
 (0)