anv: fix AHB leak upon exportable allocation
authorYiwei Zhang <zzyiwei@chromium.org>
Sat, 22 May 2021 03:21:05 +0000 (03:21 +0000)
committerMarge Bot <eric+marge@anholt.net>
Tue, 25 May 2021 06:31:25 +0000 (06:31 +0000)
commit2797c75426cf76bd2717fe0695d3f8e66cd41441
treed70052dd8f60c1c0df42556c46f439dfc97a8169
parentf18c55708a6d32bae6e3c70213e14477273d3901
anv: fix AHB leak upon exportable allocation

A successful AHardwareBuffer_allocate itself will increase a refcount on
the newly allocated AHB. For the import case, the implementation must
acquire a reference on the AHB. So if we layer the exportable allocation
on top of AHB allocation and AHB import, we must release an AHB
reference to avoid leak.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10940>
src/intel/vulkan/anv_android.c
src/intel/vulkan/anv_device.c