summaryrefslogtreecommitdiff
path: root/xf86drm.h
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2021-02-01 13:23:20 +0200
committerDaniel Stone <daniels@collabora.com>2021-06-22 11:16:04 +0000
commit67e911977fbe1f444045f59028c149a04ba29566 (patch)
tree2860b6a815e93c49977fa35ea9186501d2e6b9df /xf86drm.h
parentf287d1990b859602b0cbe50f0b903343c3b67d1a (diff)
downloaddrm-67e911977fbe1f444045f59028c149a04ba29566.tar.gz
xf86drm: Add a human readable representation for format modifiers
Introduces two new methods to retrieve a human readable representation of a format modifier: drmGetFormatModifierName() - returns a format modifier as a string, from a token modifier drmGetFormatModifierVendor() - returns the vendor as a string, from a token modifier and the fourcc_mod_get_vendor macro that returns the vendor. New format modifiers added in drm_fourcc.h uapi kernel header should be sync'ed up with libdrm and should include a human readable representation for that format modifier, in order to display it correctly as a string. That happens with the help of a python script that reads up drm_fourcc header file and outputs a static table comprised of token modifiers alongside a vendor table (Suggested-by Simon Ser <contact@emersion.fr>). The reason for doing it in libdrm is to have a unified place instead of each user of libdrm having a way to keep track of the format modifiers. With this patch, modetest has also been modified to make use of it. Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Diffstat (limited to 'xf86drm.h')
-rw-r--r--xf86drm.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/xf86drm.h b/xf86drm.h
index 9fc06ab8..930d2f40 100644
--- a/xf86drm.h
+++ b/xf86drm.h
@@ -944,6 +944,17 @@ extern int drmSyncobjTransfer(int fd,
uint32_t src_handle, uint64_t src_point,
uint32_t flags);
+extern char *
+drmGetFormatModifierVendor(uint64_t modifier);
+
+extern char *
+drmGetFormatModifierName(uint64_t modifier);
+
+#ifndef fourcc_mod_get_vendor
+#define fourcc_mod_get_vendor(modifier) \
+ (((modifier) >> 56) & 0xff)
+#endif
+
#if defined(__cplusplus)
}
#endif