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:

committed by
Marge Bot

parent
d44ea09e61
commit
46cc332025
@@ -3394,8 +3394,6 @@ struct anv_semaphore_impl {
|
|||||||
struct anv_semaphore {
|
struct anv_semaphore {
|
||||||
struct vk_object_base base;
|
struct vk_object_base base;
|
||||||
|
|
||||||
uint32_t refcount;
|
|
||||||
|
|
||||||
/* Permanent semaphore state. Every semaphore has some form of permanent
|
/* Permanent semaphore state. Every semaphore has some form of permanent
|
||||||
* state (type != ANV_SEMAPHORE_TYPE_NONE). This may be a BO to fence on
|
* 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
|
* (for cross-process semaphores0 or it could just be a dummy for use
|
||||||
|
@@ -80,7 +80,6 @@ static int64_t anv_get_relative_timeout(uint64_t abs_timeout)
|
|||||||
return rel_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,
|
static void anv_semaphore_impl_cleanup(struct anv_device *device,
|
||||||
struct anv_semaphore_impl *impl);
|
struct anv_semaphore_impl *impl);
|
||||||
|
|
||||||
@@ -2129,8 +2128,6 @@ VkResult anv_CreateSemaphore(
|
|||||||
if (semaphore == NULL)
|
if (semaphore == NULL)
|
||||||
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
p_atomic_set(&semaphore->refcount, 1);
|
|
||||||
|
|
||||||
const VkExportSemaphoreCreateInfo *export =
|
const VkExportSemaphoreCreateInfo *export =
|
||||||
vk_find_struct_const(pCreateInfo->pNext, EXPORT_SEMAPHORE_CREATE_INFO);
|
vk_find_struct_const(pCreateInfo->pNext, EXPORT_SEMAPHORE_CREATE_INFO);
|
||||||
VkExternalSemaphoreHandleTypeFlags handleTypes =
|
VkExternalSemaphoreHandleTypeFlags handleTypes =
|
||||||
@@ -2218,18 +2215,6 @@ anv_semaphore_reset_temporary(struct anv_device *device,
|
|||||||
anv_semaphore_impl_cleanup(device, &semaphore->temporary);
|
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(
|
void anv_DestroySemaphore(
|
||||||
VkDevice _device,
|
VkDevice _device,
|
||||||
VkSemaphore _semaphore,
|
VkSemaphore _semaphore,
|
||||||
@@ -2241,7 +2226,11 @@ void anv_DestroySemaphore(
|
|||||||
if (semaphore == NULL)
|
if (semaphore == NULL)
|
||||||
return;
|
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(
|
void anv_GetPhysicalDeviceExternalSemaphoreProperties(
|
||||||
|
Reference in New Issue
Block a user