summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGwan-gyeong Mun <elongbug@gmail.com>2016-11-25 23:34:46 +0900
committerEmil Velikov <emil.l.velikov@gmail.com>2016-12-14 19:03:10 +0000
commiteb62264769650f239dec910831bb98134af78ce2 (patch)
treefa4755bc11aaed9c4e477c0bdd0c0c77d615d99b /src
parentef08616dcbc66f6b89bdc7123ca00c565df917ed (diff)
downloadexternal_mesa3d-eb62264769650f239dec910831bb98134af78ce2.zip
external_mesa3d-eb62264769650f239dec910831bb98134af78ce2.tar.gz
external_mesa3d-eb62264769650f239dec910831bb98134af78ce2.tar.bz2
anv: Update the teardown in reverse order of the anv_CreateDevice
This updates releasing of resource in reverse order of the anv_CreateDevice to anv_DestroyDevice. And it fixes resource leak in pthread_mutex, pthread_cond, anv_gem_context. Cc: "13.0" <mesa-stable@lists.freedesktop.org> Signed-off-by: Mun Gwan-gyeong <elongbug@gmail.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> (cherry picked from commit b178652b41410483dcd82aba495eab6bc892ab15)
Diffstat (limited to 'src')
-rw-r--r--src/intel/vulkan/anv_device.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 98fd40e..05de608 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -968,10 +968,10 @@ void anv_DestroyDevice(
{
ANV_FROM_HANDLE(anv_device, device, _device);
- anv_queue_finish(&device->queue);
-
anv_device_finish_blorp(device);
+ anv_queue_finish(&device->queue);
+
#ifdef HAVE_VALGRIND
/* We only need to free these to prevent valgrind errors. The backing
* BO will go away in a couple of lines so we don't actually leak.
@@ -979,22 +979,27 @@ void anv_DestroyDevice(
anv_state_pool_free(&device->dynamic_state_pool, device->border_colors);
#endif
+ anv_scratch_pool_finish(device, &device->scratch_pool);
+
anv_gem_munmap(device->workaround_bo.map, device->workaround_bo.size);
anv_gem_close(device, device->workaround_bo.gem_handle);
- anv_bo_pool_finish(&device->batch_bo_pool);
- anv_state_pool_finish(&device->dynamic_state_pool);
- anv_block_pool_finish(&device->dynamic_state_block_pool);
- anv_state_pool_finish(&device->instruction_state_pool);
- anv_block_pool_finish(&device->instruction_block_pool);
anv_state_pool_finish(&device->surface_state_pool);
anv_block_pool_finish(&device->surface_state_block_pool);
- anv_scratch_pool_finish(device, &device->scratch_pool);
+ anv_state_pool_finish(&device->instruction_state_pool);
+ anv_block_pool_finish(&device->instruction_block_pool);
+ anv_state_pool_finish(&device->dynamic_state_pool);
+ anv_block_pool_finish(&device->dynamic_state_block_pool);
- close(device->fd);
+ anv_bo_pool_finish(&device->batch_bo_pool);
+ pthread_cond_destroy(&device->queue_submit);
pthread_mutex_destroy(&device->mutex);
+ anv_gem_destroy_context(device, device->context_id);
+
+ close(device->fd);
+
vk_free(&device->alloc, device);
}