vk/batch_chain: Compute secondary exec mode after finishing the bo
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 31 Jul 2015 15:52:28 +0000 (08:52 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 31 Jul 2015 15:52:30 +0000 (08:52 -0700)
Figuring out whether or not to do a copy requires knowing the length of the
final batch_bo.  This gets set by anv_batch_bo_finish so we have to do it
afterwards.  Not sure how this was even working before.

src/vulkan/anv_batch_chain.c

index 2f09248aceec4064b7dd3b5bd31c048e09a2ed96..04528bb06b6c5315bb433accab684d8d5a1a722d 100644 (file)
@@ -636,7 +636,13 @@ anv_cmd_buffer_end_batch_buffer(struct anv_cmd_buffer *cmd_buffer)
          anv_batch_emit(&cmd_buffer->batch, GEN8_MI_NOOP);
 
       cmd_buffer->exec_mode = ANV_CMD_BUFFER_EXEC_MODE_PRIMARY;
-   } else {
+   }
+
+   anv_batch_bo_finish(batch_bo, &cmd_buffer->batch);
+
+   surface_bbo->length = cmd_buffer->surface_next;
+
+   if (cmd_buffer->level == VK_CMD_BUFFER_LEVEL_SECONDARY) {
       /* If this is a secondary command buffer, we need to determine the
        * mode in which it will be executed with vkExecuteCommands.  We
        * determine this statically here so that this stays in sync with the
@@ -666,10 +672,6 @@ anv_cmd_buffer_end_batch_buffer(struct anv_cmd_buffer *cmd_buffer)
          cmd_buffer->exec_mode = ANV_CMD_BUFFER_EXEC_MODE_COPY_AND_CHAIN;
       }
    }
-
-   anv_batch_bo_finish(batch_bo, &cmd_buffer->batch);
-
-   surface_bbo->length = cmd_buffer->surface_next;
 }
 
 static inline VkResult