It is necessary to reuse existing BOs when dmabufs are imported. There are 2 cases that need to be handled. dmabufs can be created/exported and imported by the same process and can be imported multiple times. Copying other drivers, add a hash table to track exported BOs so the BOs get reused.
v2: Whitespace fixup (by anholt)
9ace2c1 vc4: add hash table look-up for exported dmabufs
src/gallium/drivers/vc4/vc4_bufmgr.c | 20 +++++++++++++++++++-
src/gallium/drivers/vc4/vc4_bufmgr.h | 21 +++++++++++++++++++--
src/gallium/drivers/vc4/vc4_screen.c | 15 +++++++++++++++
src/gallium/drivers/vc4/vc4_screen.h | 3 +++
4 files changed, 56 insertions(+), 3 deletions(-)
Upstream: cgit.freedesktop.org