minigbm: Stop relying on drmPrimeFDToHandle() in common code

ARM-based SOCs usually have a separate display controller unit (IP core)
which has its own kernel driver and capabilities.

In most cases display controllers can handle only contiguous buffers
which require to reserve CMA region for them.

GPU itself usually has embedded MMU and can handle non-contiguous buffers.

In this hardware configuration it makes sense to allocate contiguous
memory for the buffers which will be used by display controller, and
non-contiguous memory for buffers which will be used by GPU only,
thus reducing minimum required CMA reserved region size.

Once a buffer is allocated in a non-contiguous region, any attempt of
importing it to the KMS driver using drmPrimeFDToHandle() will fail
with -EINVAL.

BO Handle was used as a unique per-buffer key, where 'id' field can be
used as well. As a positive side effect of this change number of system
calls is also reduced.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Change-Id: I030849ede744b3d6aea04639c9a13d2fe1ccd71c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2637641
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
1 file changed