test/utils: support format name aliases
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Thu, 9 Apr 2015 11:17:54 +0000 (14:17 +0300)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Wed, 15 Apr 2015 09:42:33 +0000 (12:42 +0300)
commitf1f6cc23ce340087035e7ec912723e8a6134efc3
treeedf012a122a56295aa4c939cca0a17edf38ce018
parent2c5fac932061351ae2153026003539745aa9b44e
test/utils: support format name aliases

Previously there was a flat list of formats, used to iterate over all
formats when looking up a format from name or listing them. This cannot
support name aliases.

To support name aliases (multiple name strings mapping to the same
format), create a format-name mapping table. Functions format_name(),
format_from_string(), and list_formats() should keep on working exactly
like before, except format_from_string() now recognizes the additional
formats that format_name() already supported.

The only the formats from the old format list are added with ENTRY, so
that list_formats() works as before. The whole list is verified against
the authoritative list in pixman.h, entries missing from the old list
are commented out.

The extra formats supported by the old format_name() are added as
ALIASes. A side-effect of that is that now also format_from_string()
recognizes the following new names: x4c4 / c8, x4g4 / g8, c4, g4, g1,
yuy2, yv12, null, solid, pixbuf, rpixbuf, unknown.

Name aliases will be useful in follow-up patches, where
lowlevel-blt-bench.c is converted to parse short-hand format names from
strings.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ben Avison <bavison@riscosopen.org>
test/utils.c