summaryrefslogtreecommitdiff
path: root/pkg/libdrm/fourcc.lua
blob: 0a0deaaa2ff222a1ad3412d50941861bd83fd353 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
io.write[[
/* AUTOMATICALLY GENERATED by fourcc.lua. You should modify
   that script instead of adding here entries manually! */
static const struct drmFormatModifierInfo drm_format_modifier_table[] = {
    { DRM_MODIFIER_INVALID(NONE, INVALID) },
    { DRM_MODIFIER_LINEAR(NONE, LINEAR) },
]]

local vendors = {
	ARM=true,
	SAMSUNG=true,
	QCOM=true,
	VIVANTE=true,
	NVIDIA=true,
	BROADCOM=true,
	ALLWINNER=true,
}
for line in io.lines() do
	local mod = line:match('^#define I915_FORMAT_MOD_([%w_]+)')
	if mod then
		io.write(string.format('    { DRM_MODIFIER_INTEL(%s, %s) },\n', mod, mod))
	end
	local vendor, mod = line:match('^#define DRM_FORMAT_MOD_(%w+)_([%w_]+)%s')
	if vendors[vendor] then
		if vendor ~= 'ARM' or not mod:match('^TYPE_') then
			io.write(string.format('    { DRM_MODIFIER(%s, %s, %s) },\n', vendor, mod, mod))
		end
	end
	local vendor = line:match('^#define DRM_FORMAT_MOD_VENDOR_([%w_]+)')
	if vendor then
		table.insert(vendors, vendor)
	end
end

io.write[[
};
static const struct drmFormatModifierVendorInfo drm_format_modifier_vendor_table[] = {
]]
for _, vendor in ipairs(vendors) do
	io.write(string.format('    { DRM_FORMAT_MOD_VENDOR_%s, "%s" },\n', vendor, vendor))
end
io.write[[
};
]]