libion: Adapt to new ION interface

4.12+ kernels have substantially different ION interface. Adapt
libion to the new one.

In doing so, for sake of clarity, rename ION_IOC_ALLOC to
ION_IOC_NEW_ALLOC the to denote new mechanism.

An ion_is_legacy() is provided to check whether the kernel supports old
ION interface or new. Userspace has the responsibility to use it
accordingly.

Devices using kernels without the 4.12 ION updates, can continue to use libion
as before, and will have no impact.

Only devices using libion with 4.12+ kernels (or kernels with backported ION
updates) will need to update their users of libion, including gralloc.

Test: validated with hikey gralloc, with both old and new kernels

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
  [sumits: keep old abi compatibility]

Change-Id: I7899af9e812d0cf5e73b443a3f0248118b42a382
2 files changed