radv: Free temporary syncobj after waiting on it.

Otherwise we leak it.

Fixes: eaa56eab6d "radv: initial support for shared semaphores (v2)"
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
(cherry picked from commit 7c25578863)
This commit is contained in:
Bas Nieuwenhuizen 2017-11-13 23:26:32 +01:00 committed by Emil Velikov
parent 577af89bd1
commit 8269b7ec4b

View file

@ -1828,10 +1828,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;
@ -1852,6 +1848,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,
@ -1990,6 +2001,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);
}