<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Fri, Dec 7, 2018 at 6:06 PM Rafael Antognolli <<a href="mailto:rafael.antognolli@intel.com">rafael.antognolli@intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">We now have multiple BOs in the block pool, but sometimes we still<br>
reference only the first one in some instructions, and use relative<br>
offsets in others. So we must be sure to add all the BOs from the block<br>
pool to the validation list when submitting commands.<br>
---<br>
src/intel/vulkan/anv_batch_chain.c | 47 ++++++++++++++++++++++++++----<br>
1 file changed, 42 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c<br>
index bec4d647b7e..65df28ccb91 100644<br>
--- a/src/intel/vulkan/anv_batch_chain.c<br>
+++ b/src/intel/vulkan/anv_batch_chain.c<br>
@@ -1356,6 +1356,36 @@ relocate_cmd_buffer(struct anv_cmd_buffer *cmd_buffer,<br>
return true;<br>
}<br>
<br>
+static void<br>
+anv_reloc_list_add_dep(struct anv_cmd_buffer *cmd_buffer,<br>
+ struct anv_bo_list *bo_list)<br>
+{<br>
+ struct anv_bo_list *iter;<br>
+ struct anv_bo *bo;<br>
+ struct anv_reloc_list *relocs = cmd_buffer->batch.relocs;<br>
+<br>
+ anv_block_pool_foreach_bo(bo_list, iter, bo) {<br>
+ _mesa_set_add(relocs->deps, bo);<br>
+ }<br>
+}<br>
+<br>
+static void<br>
+anv_batch_bos_add(struct anv_cmd_buffer *cmd_buffer)<br>
+{<br>
+ struct anv_bo_list *bo_list;<br>
+<br>
+ bo_list = cmd_buffer->device->dynamic_state_pool.block_pool.bos;<br>
+ anv_reloc_list_add_dep(cmd_buffer, bo_list);<br>
+<br>
+ bo_list = cmd_buffer->device->instruction_state_pool.block_pool.bos;<br>
+ anv_reloc_list_add_dep(cmd_buffer, bo_list);<br>
+<br>
+ if (cmd_buffer->device->instance->physicalDevice.use_softpin) {<br>
+ bo_list = cmd_buffer->device->binding_table_pool.block_pool.bos;<br>
+ anv_reloc_list_add_dep(cmd_buffer, bo_list);<br></blockquote><div><br></div><div>I don't think want to add things to the command buffer's dependency set this late (at submit time). Instead, I think we want to just do anv_execbuf_add_bo for each of them directly at the top of setup_execbuf_for_cmd_buffer.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ }<br>
+}<br>
+<br>
static VkResult<br>
setup_execbuf_for_cmd_buffer(struct anv_execbuf *execbuf,<br>
struct anv_cmd_buffer *cmd_buffer)<br>
@@ -1364,13 +1394,20 @@ setup_execbuf_for_cmd_buffer(struct anv_execbuf *execbuf,<br>
struct anv_state_pool *ss_pool =<br>
&cmd_buffer->device->surface_state_pool;<br>
<br>
+ anv_batch_bos_add(cmd_buffer);<br>
+<br>
adjust_relocations_from_state_pool(ss_pool, &cmd_buffer->surface_relocs,<br>
cmd_buffer->last_ss_pool_center);<br>
- VkResult result = anv_execbuf_add_bo(execbuf, ss_pool-><a href="http://block_pool.bo" rel="noreferrer" target="_blank">block_pool.bo</a>,<br>
- &cmd_buffer->surface_relocs, 0,<br>
- &cmd_buffer->device->alloc);<br>
- if (result != VK_SUCCESS)<br>
- return result;<br>
+ VkResult result;<br>
+ struct anv_bo *bo;<br>
+ struct anv_bo_list *iter;<br>
+ anv_block_pool_foreach_bo(ss_pool->block_pool.bos, iter, bo) {<br>
+ result = anv_execbuf_add_bo(execbuf, bo,<br>
+ &cmd_buffer->surface_relocs, 0,<br>
+ &cmd_buffer->device->alloc);<br></blockquote><div><br></div><div>I don't think we want to pass the relocation list on every BO. Instead, we should have a softpin case where we walk the list and don't provide any relocations and a non-softpin case where we assert that there is only one BO and do provide the relocations.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ if (result != VK_SUCCESS)<br>
+ return result;<br>
+ }<br>
<br>
/* First, we walk over all of the bos we've seen and add them and their<br>
* relocations to the validate list.<br>
-- <br>
2.17.1<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div></div>