summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>2017-11-13 23:26:32 +0100
committerAndres Gomez <agomez@igalia.com>2017-11-21 18:16:46 +0200
commit256733683b70731235eeac94e95d66e9d8a3c56e (patch)
tree1aeb21ee78931ed503f63e216b76329f2c3f9669
parent75efb540e2a2e7631f1724550fffe37a9fcf48dc (diff)
downloadmesa-256733683b70731235eeac94e95d66e9d8a3c56e.tar.gz
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 <samuel.pitoiset@gmail.com> (cherry picked from commit 7c255788637b8fdfc31aca5f7891f39a110c5cb2)
-rw-r--r--src/amd/vulkan/radv_device.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 70d59e4303c..af103781697 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -1988,10 +1988,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;
@@ -2012,6 +2008,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,
@@ -2163,6 +2174,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);
}