libfimg: host: Code consolidation

Host interface code consolidation to prepare for reusing geometry
conversion code in OpenFIMG 2.0 Gallium3D driver:
 1) Move code common for direct and indexed draws to helper functions.
 2) Use pseudo-templates for handling of different index types without
    code duplication.
 3) Unify primitive vertex copy into single, parametrized function.
 4) Allow unaligned accesses to vertex data to simplify vertex packing.
 5) Several minor code clean-ups.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>