drm_hwcomposer: Add refcount for GEM handle

The linux kernel doesn't provide reference counting for the handle
returned by FD_TO_HANDLE ioctl. It means that if the same Gralloc buffer
is imported twice, the first GEM_CLOSE will destroy the handle even if it
is still in use by another import.

Remedy this issue by doing the reference counting directly in the DRM
generic platform support: ImportHandle() will increase the reference,
while ReleaseHandle() will decrease and close it, if necessary.

Signed-off-by: Vincent Donnefort <vincent.donnefort@arm.com>
1 job for gem-refcount in 33 seconds