diff options
author | Marius Vlad <marius.vlad@collabora.com> | 2021-02-01 13:23:20 +0200 |
---|---|---|
committer | Daniel Stone <daniels@collabora.com> | 2021-06-22 11:16:04 +0000 |
commit | 67e911977fbe1f444045f59028c149a04ba29566 (patch) | |
tree | 2860b6a815e93c49977fa35ea9186501d2e6b9df /xf86drm.h | |
parent | f287d1990b859602b0cbe50f0b903343c3b67d1a (diff) | |
download | drm-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.h | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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 |