diff options
author | Jason Ekstrand <[email protected]> | 2017-08-03 14:19:44 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-08-28 18:35:27 -0700 |
commit | 92286dc08a58226a2155f07d845978633f23590b (patch) | |
tree | 9a5b5eca876894ed9a5ec42543578b1fed1b6da1 /src/intel/vulkan/anv_batch_chain.c | |
parent | 738e5e3c1d261d4f262c2ae25ccca8cb67075d72 (diff) |
anv: Pull the guts of anv_fence into anv_fence_impl
This is just a refactor, similar to what we did for semaphores, in
preparation for handling VK_KHR_external_fence.
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_batch_chain.c')
-rw-r--r-- | src/intel/vulkan/anv_batch_chain.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c index ef6ada49ff3..775009c913a 100644 --- a/src/intel/vulkan/anv_batch_chain.c +++ b/src/intel/vulkan/anv_batch_chain.c @@ -1549,10 +1549,20 @@ anv_cmd_buffer_execbuf(struct anv_device *device, } if (fence) { - result = anv_execbuf_add_bo(&execbuf, &fence->bo, NULL, - EXEC_OBJECT_WRITE, &device->alloc); - if (result != VK_SUCCESS) - return result; + assert(fence->temporary.type == ANV_FENCE_TYPE_NONE); + struct anv_fence_impl *impl = &fence->permanent; + + switch (impl->type) { + case ANV_FENCE_TYPE_BO: + result = anv_execbuf_add_bo(&execbuf, &impl->bo.bo, NULL, + EXEC_OBJECT_WRITE, &device->alloc); + if (result != VK_SUCCESS) + return result; + break; + + default: + unreachable("Invalid fence type"); + } } if (cmd_buffer) @@ -1598,7 +1608,7 @@ anv_cmd_buffer_execbuf(struct anv_device *device, anv_semaphore_reset_temporary(device, semaphore); } - if (fence) { + if (fence && fence->permanent.type == ANV_FENCE_TYPE_BO) { /* Once the execbuf has returned, we need to set the fence state to * SUBMITTED. We can't do this before calling execbuf because * anv_GetFenceStatus does take the global device lock before checking @@ -1609,7 +1619,7 @@ anv_cmd_buffer_execbuf(struct anv_device *device, * vkGetFenceStatus() return a valid result (VK_ERROR_DEVICE_LOST or * VK_SUCCESS) in a finite amount of time even if execbuf fails. */ - fence->state = ANV_FENCE_STATE_SUBMITTED; + fence->permanent.bo.state = ANV_FENCE_STATE_SUBMITTED; } if (result == VK_SUCCESS && need_out_fence) { |