tu: Don't emit initial render target state in tile_load_ib
authorConnor Abbott <cwabbott0@gmail.com>
Wed, 5 Feb 2020 16:18:47 +0000 (17:18 +0100)
committerJonathan Marek <jonathan@marek.ca>
Thu, 13 Feb 2020 02:23:50 +0000 (21:23 -0500)
Emitting it directly in CmdBeginRenderPass should be around the same,
except that now we can easily share it with the sysmem path.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3713>

src/freedreno/vulkan/tu_cmd_buffer.c

index 6c251757c94a78e7d6108985ac0126057143e781..7a70c9f5abbdc622c81b25f228c4d510d2a91bbe 100644 (file)
@@ -1419,8 +1419,9 @@ tu_cmd_prepare_tile_load_ib(struct tu_cmd_buffer *cmd,
                             const VkRenderPassBeginInfo *info)
 {
    const uint32_t tile_load_space =
-      8 + (23+19) * cmd->state.pass->attachment_count +
-      21 + (13 * cmd->state.subpass->color_count + 8) + 11;
+      2 * 3 /* blit_scissor */ +
+      (20 /* load */ + 19 /* clear */) * cmd->state.pass->attachment_count +
+      2 /* cache invalidate */;
 
    struct tu_cs sub_cs;
 
@@ -1448,10 +1449,6 @@ tu_cmd_prepare_tile_load_ib(struct tu_cmd_buffer *cmd,
    if (cmd->state.subpass->input_count)
       tu6_emit_event_write(cmd, &sub_cs, CACHE_INVALIDATE, false);
 
-   tu6_emit_zs(cmd, cmd->state.subpass, &sub_cs);
-   tu6_emit_mrt(cmd, cmd->state.subpass, &sub_cs);
-   tu6_emit_msaa(cmd, cmd->state.subpass, &sub_cs);
-
    cmd->state.tile_load_ib = tu_cs_end_sub_stream(&cmd->sub_cs, &sub_cs);
 }
 
@@ -2322,6 +2319,16 @@ tu_CmdBeginRenderPass(VkCommandBuffer commandBuffer,
    tu_cmd_prepare_tile_load_ib(cmd, pRenderPassBegin);
    tu_cmd_prepare_tile_store_ib(cmd);
 
+   VkResult result = tu_cs_reserve_space(cmd->device, &cmd->draw_cs, 1024);
+   if (result != VK_SUCCESS) {
+      cmd->record_result = result;
+      return;
+   }
+
+   tu6_emit_zs(cmd, cmd->state.subpass, &cmd->draw_cs);
+   tu6_emit_mrt(cmd, cmd->state.subpass, &cmd->draw_cs);
+   tu6_emit_msaa(cmd, cmd->state.subpass, &cmd->draw_cs);
+
    /* note: use_hw_binning only checks tiling config */
    if (use_hw_binning(cmd))
       cmd->use_vsc_data = true;