It's just a dummy for now, but we'll flesh it out as needed for external semaphores. --- src/intel/vulkan/anv_private.h | 15 +++++++++++++++ src/intel/vulkan/anv_queue.c | 30 ++++++++++++++++++++++++------ 2 files changed, 39 insertions(+), 6 deletions(-)
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 816ee8a..a2e077a 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1365,6 +1365,20 @@ struct anv_event { struct anv_state state; }; +enum anv_semaphore_type { + ANV_SEMAPHORE_TYPE_NONE = 0, + ANV_SEMAPHORE_TYPE_DUMMY +}; + +struct anv_semaphore_impl { + enum anv_semaphore_type type; +}; + +struct anv_semaphore { + struct anv_semaphore_impl permanent; + struct anv_semaphore_impl temporary; +}; + struct anv_shader_module { unsigned char sha1[20]; uint32_t size; @@ -1949,6 +1963,7 @@ ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_pipeline_layout, VkPipelineLayout) ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_query_pool, VkQueryPool) ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_render_pass, VkRenderPass) ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_sampler, VkSampler) +ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_semaphore, VkSemaphore) ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_shader_module, VkShaderModule) /* Gen-specific function declarations */ diff --git a/src/intel/vulkan/anv_queue.c b/src/intel/vulkan/anv_queue.c index a628f59..a2a32d6 100644 --- a/src/intel/vulkan/anv_queue.c +++ b/src/intel/vulkan/anv_queue.c @@ -448,23 +448,41 @@ VkResult anv_WaitForFences( // 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); + + vk_free2(&device->alloc, pAllocator, semaphore); } + -- 2.5.0.400.gff86faf _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev