From: Andres Rodriguez Date: Mon, 30 Apr 2018 22:05:49 +0000 (-0400) Subject: radv/winsys: fix leaking resources from bo's imported by fd X-Git-Tag: android-x86-8.1-r1~3712 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f56e22e49673e8234a7fe0c241b4c3eae4752f34;p=android-x86%2Fexternal-mesa.git radv/winsys: fix leaking resources from bo's imported by fd A bo's ref_count was not being initialized when imported from an fd. Therefore, we would fail to free the resource during VkFreeMemory(). This patch fixes applications like hifi VR in threaded mode, which perform frequent imports/releases of IPC shared memory. Signed-off-by: Andres Rodriguez Reviewed-by: Bas Nieuwenhuizen CC: 18.0 18.1 --- diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c index e2060651e48..8ed3e53e2d3 100644 --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c @@ -501,6 +501,7 @@ radv_amdgpu_winsys_bo_from_fd(struct radeon_winsys *_ws, bo->size = result.alloc_size; bo->is_shared = true; bo->ws = ws; + bo->ref_count = 1; radv_amdgpu_add_buffer_to_global_list(bo); return (struct radeon_winsys_bo *)bo; error_va_map: