master hovercats/oakiss / pkg / libdrm / fourcc.lua
 1io.write[[
 2/* AUTOMATICALLY GENERATED by fourcc.lua. You should modify
 3   that script instead of adding here entries manually! */
 4static const struct drmFormatModifierInfo drm_format_modifier_table[] = {
 5    { DRM_MODIFIER_INVALID(NONE, INVALID) },
 6    { DRM_MODIFIER_LINEAR(NONE, LINEAR) },
 7]]
 8
 9local vendors = {
10	ARM=true,
11	SAMSUNG=true,
12	QCOM=true,
13	VIVANTE=true,
14	NVIDIA=true,
15	BROADCOM=true,
16	ALLWINNER=true,
17}
18for line in io.lines() do
19	local mod = line:match('^#define I915_FORMAT_MOD_([%w_]+)')
20	if mod then
21		io.write(string.format('    { DRM_MODIFIER_INTEL(%s, %s) },\n', mod, mod))
22	end
23	local vendor, mod = line:match('^#define DRM_FORMAT_MOD_(%w+)_([%w_]+)%s')
24	if vendors[vendor] then
25		if vendor ~= 'ARM' or not mod:match('^TYPE_') then
26			io.write(string.format('    { DRM_MODIFIER(%s, %s, %s) },\n', vendor, mod, mod))
27		end
28	end
29	local vendor = line:match('^#define DRM_FORMAT_MOD_VENDOR_([%w_]+)')
30	if vendor then
31		table.insert(vendors, vendor)
32	end
33end
34
35io.write[[
36};
37static const struct drmFormatModifierVendorInfo drm_format_modifier_vendor_table[] = {
38]]
39for _, vendor in ipairs(vendors) do
40	io.write(string.format('    { DRM_FORMAT_MOD_VENDOR_%s, "%s" },\n', vendor, vendor))
41end
42io.write[[
43};
44]]