diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2018-10-02 11:58:12 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2018-10-02 11:58:12 +0200 |
commit | cb0ab87935c13c6d3e642b7ce0dc8d9a1f739b8e (patch) | |
tree | 65e5bf2e6d42256688af722efd0a134dd866e81e /update-fmtmod.pl | |
parent | 57a2a5731c6a7893597b7fa16c86a5c848b6cb72 (diff) | |
download | drminfo-cb0ab87935c13c6d3e642b7ce0dc8d9a1f739b8e.tar.gz |
tweak format modifier listing
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'update-fmtmod.pl')
-rwxr-xr-x | update-fmtmod.pl | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/update-fmtmod.pl b/update-fmtmod.pl new file mode 100755 index 0000000..e27cfad --- /dev/null +++ b/update-fmtmod.pl @@ -0,0 +1,25 @@ +#!/usr/bin/perl +use strict; +use warnings; + +my $header; +my @syms; + +open FILE, "<", "/usr/include/libdrm/drm_fourcc.h" or die "open drm_fourcc.h: $!"; +{ local $/; undef $/; $header = <FILE>; } +close FILE; + +$header =~ s/\\\n//g; +foreach my $line (split /\n/, $header) { + next unless $line =~ m/#define\s+([a-zA-Z0-9_]+)\s+fourcc_mod_code/; + push @syms, $1; +} + +open FILE, ">", "drmfmtmods.h" or die "open drmfmtmods.h: $!"; +print FILE "/* generated by update-fmtmod.pl */\n"; +for my $sym (@syms) { + my $name = $sym; + $name =~ s/^DRM_FORMAT_MOD_//; + printf FILE "{ .mod = %s, .name = \"%s\" },\n", $sym, $name; +} +close FILE; |