Mesa (main): anv: Stop reference counting semaphores
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jul 16 21:22:28 UTC 2021
Module: Mesa
Branch: main
Commit: 46cc332025b62484baf8f510f285d4749118dde6
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=46cc332025b62484baf8f510f285d4749118dde6
Author: Jason Ekstrand <jason at jlekstrand.net>
Date: Tue Mar 23 14:00:25 2021 -0500
anv: Stop reference counting semaphores
The only reason we had to refcount semaphores was for the ancient
sync_file semaphores which we used for pre-syncobj kernels. Now that we
assume syncobj and that code is gone, we don't need reference counting
anymore either.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9777>
---
src/intel/vulkan/anv_private.h | 2 --
src/intel/vulkan/anv_queue.c | 21 +++++----------------
2 files changed, 5 insertions(+), 18 deletions(-)
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index f923582b8eb..fa3582b979f 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -3394,8 +3394,6 @@ struct anv_semaphore_impl {
struct anv_semaphore {
struct vk_object_base base;
- uint32_t refcount;
-
/* Permanent semaphore state. Every semaphore has some form of permanent
* state (type != ANV_SEMAPHORE_TYPE_NONE). This may be a BO to fence on
* (for cross-process semaphores0 or it could just be a dummy for use
diff --git a/src/intel/vulkan/anv_queue.c b/src/intel/vulkan/anv_queue.c
index deb70802c7b..28621d62564 100644
--- a/src/intel/vulkan/anv_queue.c
+++ b/src/intel/vulkan/anv_queue.c
@@ -80,7 +80,6 @@ static int64_t anv_get_relative_timeout(uint64_t abs_timeout)
return rel_timeout;
}
-static void anv_semaphore_unref(struct anv_device *device, struct anv_semaphore *semaphore);
static void anv_semaphore_impl_cleanup(struct anv_device *device,
struct anv_semaphore_impl *impl);
@@ -2129,8 +2128,6 @@ VkResult anv_CreateSemaphore(
if (semaphore == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
- p_atomic_set(&semaphore->refcount, 1);
-
const VkExportSemaphoreCreateInfo *export =
vk_find_struct_const(pCreateInfo->pNext, EXPORT_SEMAPHORE_CREATE_INFO);
VkExternalSemaphoreHandleTypeFlags handleTypes =
@@ -2218,18 +2215,6 @@ anv_semaphore_reset_temporary(struct anv_device *device,
anv_semaphore_impl_cleanup(device, &semaphore->temporary);
}
-static void
-anv_semaphore_unref(struct anv_device *device, struct anv_semaphore *semaphore)
-{
- if (!p_atomic_dec_zero(&semaphore->refcount))
- return;
-
- anv_semaphore_impl_cleanup(device, &semaphore->temporary);
- anv_semaphore_impl_cleanup(device, &semaphore->permanent);
-
- vk_object_free(&device->vk, NULL, semaphore);
-}
-
void anv_DestroySemaphore(
VkDevice _device,
VkSemaphore _semaphore,
@@ -2241,7 +2226,11 @@ void anv_DestroySemaphore(
if (semaphore == NULL)
return;
- anv_semaphore_unref(device, semaphore);
+ anv_semaphore_impl_cleanup(device, &semaphore->temporary);
+ anv_semaphore_impl_cleanup(device, &semaphore->permanent);
+
+ vk_object_base_finish(&semaphore->base);
+ vk_free(&device->vk.alloc, semaphore);
}
void anv_GetPhysicalDeviceExternalSemaphoreProperties(
More information about the mesa-commit
mailing list