summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_batch_chain.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-02-27 16:34:13 -0800
committerJason Ekstrand <[email protected]>2017-08-15 19:08:26 -0700
commit017cdb10cf5001d018b65eeec4b06ebeacbb5593 (patch)
tree13eb65fc54732c45ad17bd5260fb39fc6bebf024 /src/intel/vulkan/anv_batch_chain.c
parent031f57eba3719c8dd6462ebd2af696d2632d71b8 (diff)
anv: Submit a dummy batch when only semaphores are provided.
Vulkan allows you to do a submit whose only job is to wait on and trigger semaphores. The easiest way for us to support that right now is to insert a dummy execbuf. 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.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c
index 52ecfe89027..b55fc03b24b 100644
--- a/src/intel/vulkan/anv_batch_chain.c
+++ b/src/intel/vulkan/anv_batch_chain.c
@@ -1388,6 +1388,23 @@ setup_execbuf_for_cmd_buffer(struct anv_execbuf *execbuf,
return VK_SUCCESS;
}
+static void
+setup_empty_execbuf(struct anv_execbuf *execbuf, struct anv_device *device)
+{
+ anv_execbuf_add_bo(execbuf, &device->trivial_batch_bo, NULL, 0,
+ &device->alloc);
+
+ execbuf->execbuf = (struct drm_i915_gem_execbuffer2) {
+ .buffers_ptr = (uintptr_t) execbuf->objects,
+ .buffer_count = execbuf->bo_count,
+ .batch_start_offset = 0,
+ .batch_len = 8, /* GEN7_MI_BATCH_BUFFER_END and NOOP */
+ .flags = I915_EXEC_HANDLE_LUT | I915_EXEC_RENDER,
+ .rsvd1 = device->context_id,
+ .rsvd2 = 0,
+ };
+}
+
VkResult
anv_cmd_buffer_execbuf(struct anv_device *device,
struct anv_cmd_buffer *cmd_buffer,
@@ -1448,9 +1465,14 @@ anv_cmd_buffer_execbuf(struct anv_device *device,
}
}
- result = setup_execbuf_for_cmd_buffer(&execbuf, cmd_buffer);
- if (result != VK_SUCCESS)
- return result;
+ if (cmd_buffer) {
+ result = setup_execbuf_for_cmd_buffer(&execbuf, cmd_buffer);
+ if (result != VK_SUCCESS)
+ return result;
+ } else {
+ setup_empty_execbuf(&execbuf, device);
+ }
+
result = anv_device_execbuf(device, &execbuf.execbuf, execbuf.bos);