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@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9777>
This commit is contained in:
Jason Ekstrand 2021-03-23 14:00:25 -05:00 committed by Marge Bot
parent d44ea09e61
commit 46cc332025
2 changed files with 5 additions and 18 deletions

View File

@ -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

View File

@ -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(