diff options
author | Bas Nieuwenhuizen <[email protected]> | 2017-11-13 23:26:32 +0100 |
---|---|---|
committer | Bas Nieuwenhuizen <[email protected]> | 2017-11-14 10:03:02 +0100 |
commit | 7c255788637b8fdfc31aca5f7891f39a110c5cb2 (patch) | |
tree | 185acca0e1ab5c3b83afc18de704738da0359a4e /src/amd | |
parent | 917d3b43f2b206ccf036542aa1c39f1dbdd84f62 (diff) |
radv: Free temporary syncobj after waiting on it.
Otherwise we leak it.
Fixes: eaa56eab6da "radv: initial support for shared semaphores (v2)"
Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/vulkan/radv_device.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 4e3ad111382..60f51469c43 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -1833,10 +1833,6 @@ static VkResult radv_alloc_sem_counts(struct radv_winsys_sem_counts *counts, if (sem->temp_syncobj) { counts->syncobj[syncobj_idx++] = sem->temp_syncobj; - if (reset_temp) { - /* after we wait on a temp import - drop it */ - sem->temp_syncobj = 0; - } } else if (sem->syncobj) counts->syncobj[syncobj_idx++] = sem->syncobj; @@ -1857,6 +1853,21 @@ void radv_free_sem_info(struct radv_winsys_sem_info *sem_info) free(sem_info->signal.sem); } + +static void radv_free_temp_syncobjs(struct radv_device *device, + int num_sems, + const VkSemaphore *sems) +{ + for (uint32_t i = 0; i < num_sems; i++) { + RADV_FROM_HANDLE(radv_semaphore, sem, sems[i]); + + if (sem->temp_syncobj) { + device->ws->destroy_syncobj(device->ws, sem->temp_syncobj); + sem->temp_syncobj = 0; + } + } +} + VkResult radv_alloc_sem_info(struct radv_winsys_sem_info *sem_info, int num_wait_sems, const VkSemaphore *wait_sems, @@ -1995,6 +2006,9 @@ VkResult radv_QueueSubmit( } } + radv_free_temp_syncobjs(queue->device, + pSubmits[i].waitSemaphoreCount, + pSubmits[i].pWaitSemaphores); radv_free_sem_info(&sem_info); free(cs_array); } |