summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_queue.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-02-15 15:35:38 -0800
committerJason Ekstrand <[email protected]>2017-05-03 15:09:46 -0700
commit65aa89e75fb8056db05d4d0634e7e9a792560a41 (patch)
treebad17cfbdd057407d195a0520cd68d1c8ca4f1f0 /src/intel/vulkan/anv_queue.c
parentf466683cb07796fa89f96ef87a6f076218ae6db8 (diff)
anv: Add a real semaphore struct
It's just a dummy for now, but we'll flesh it out as needed for external semaphores. Reviewed-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_queue.c')
-rw-r--r--src/intel/vulkan/anv_queue.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/intel/vulkan/anv_queue.c b/src/intel/vulkan/anv_queue.c
index 5a22ff7fe60..f6ff41f84b2 100644
--- a/src/intel/vulkan/anv_queue.c
+++ b/src/intel/vulkan/anv_queue.c
@@ -493,23 +493,43 @@ done:
// Queue semaphore functions
VkResult anv_CreateSemaphore(
- VkDevice device,
+ VkDevice _device,
const VkSemaphoreCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkSemaphore* pSemaphore)
{
- /* The DRM execbuffer ioctl always execute in-oder, even between different
- * rings. As such, there's nothing to do for the user space semaphore.
+ ANV_FROM_HANDLE(anv_device, device, _device);
+ struct anv_semaphore *semaphore;
+
+ assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO);
+
+ semaphore = vk_alloc2(&device->alloc, pAllocator, sizeof(*semaphore), 8,
+ VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+ if (semaphore == NULL)
+ return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
+
+ /* The DRM execbuffer ioctl always execute in-oder, even between
+ * different rings. As such, a dummy no-op semaphore is a perfectly
+ * valid implementation.
*/
+ semaphore->permanent.type = ANV_SEMAPHORE_TYPE_DUMMY;
+ semaphore->temporary.type = ANV_SEMAPHORE_TYPE_NONE;
- *pSemaphore = (VkSemaphore)1;
+ *pSemaphore = anv_semaphore_to_handle(semaphore);
return VK_SUCCESS;
}
void anv_DestroySemaphore(
- VkDevice device,
- VkSemaphore semaphore,
+ VkDevice _device,
+ VkSemaphore _semaphore,
const VkAllocationCallbacks* pAllocator)
{
+ ANV_FROM_HANDLE(anv_device, device, _device);
+ ANV_FROM_HANDLE(anv_semaphore, semaphore, _semaphore);
+
+ if (semaphore == NULL)
+ return;
+
+ vk_free2(&device->alloc, pAllocator, semaphore);
}