drm_hwcomposer: platformdrmgeneric: Handle closing gem_handles if we have duplicate handles
In some cases some multi-plane bo's may have multiple
gem_handles/offsets/pitches set. And its possible to have
multiple planes that use the same gem_handle with different
offsets/pitches.
Thus, when closing the gem_handles, if we're not careful
we could close the same handle multiple times. So this
patch avoids this by taking some old code from the nv
importer:
https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/blob/
aeccd89eaafec467cb9449cce5c64152a240c138/platformnv.cpp#L176
Many thanks to Stefan Schake for pointing me to that code.
Change-Id: Ifecd0f95de5ada5280a0af807005d0b0186a068c
Signed-off-by: John Stultz <john.stultz@linaro.org>