static void
tu6_render_end(struct tu_cmd_buffer *cmd, struct tu_cs *cs)
{
- VkResult result = tu_cs_reserve_space(cmd->device, cs, 16);
+ const uint32_t space = 16 + tu_cs_get_call_size(&cmd->draw_epilogue_cs);
+ VkResult result = tu_cs_reserve_space(cmd->device, cs, space);
if (result != VK_SUCCESS) {
cmd->record_result = result;
return;
}
+ tu_cs_emit_call(cs, &cmd->draw_epilogue_cs);
+
tu_cs_emit_regs(cs,
A6XX_GRAS_LRZ_CNTL(0));
tu_bo_list_init(&cmd_buffer->bo_list);
tu_cs_init(&cmd_buffer->cs, TU_CS_MODE_GROW, 4096);
tu_cs_init(&cmd_buffer->draw_cs, TU_CS_MODE_GROW, 4096);
+ tu_cs_init(&cmd_buffer->draw_epilogue_cs, TU_CS_MODE_GROW, 4096);
tu_cs_init(&cmd_buffer->sub_cs, TU_CS_MODE_SUB_STREAM, 2048);
*pCommandBuffer = tu_cmd_buffer_to_handle(cmd_buffer);
tu_cs_finish(cmd_buffer->device, &cmd_buffer->cs);
tu_cs_finish(cmd_buffer->device, &cmd_buffer->draw_cs);
+ tu_cs_finish(cmd_buffer->device, &cmd_buffer->draw_epilogue_cs);
tu_cs_finish(cmd_buffer->device, &cmd_buffer->sub_cs);
tu_bo_list_destroy(&cmd_buffer->bo_list);
tu_bo_list_reset(&cmd_buffer->bo_list);
tu_cs_reset(cmd_buffer->device, &cmd_buffer->cs);
tu_cs_reset(cmd_buffer->device, &cmd_buffer->draw_cs);
+ tu_cs_reset(cmd_buffer->device, &cmd_buffer->draw_epilogue_cs);
tu_cs_reset(cmd_buffer->device, &cmd_buffer->sub_cs);
for (unsigned i = 0; i < VK_PIPELINE_BIND_POINT_RANGE_SIZE; i++) {
tu_cs_begin(&cmd_buffer->cs);
tu_cs_begin(&cmd_buffer->draw_cs);
+ tu_cs_begin(&cmd_buffer->draw_epilogue_cs);
cmd_buffer->marker_seqno = 0;
cmd_buffer->scratch_seqno = 0;
MSM_SUBMIT_BO_READ | MSM_SUBMIT_BO_DUMP);
}
+ for (uint32_t i = 0; i < cmd_buffer->draw_epilogue_cs.bo_count; i++) {
+ tu_bo_list_add(&cmd_buffer->bo_list, cmd_buffer->draw_epilogue_cs.bos[i],
+ MSM_SUBMIT_BO_READ | MSM_SUBMIT_BO_DUMP);
+ }
+
for (uint32_t i = 0; i < cmd_buffer->sub_cs.bo_count; i++) {
tu_bo_list_add(&cmd_buffer->bo_list, cmd_buffer->sub_cs.bos[i],
MSM_SUBMIT_BO_READ | MSM_SUBMIT_BO_DUMP);
tu_cs_end(&cmd_buffer->cs);
tu_cs_end(&cmd_buffer->draw_cs);
+ tu_cs_end(&cmd_buffer->draw_epilogue_cs);
cmd_buffer->status = TU_CMD_BUFFER_STATUS_EXECUTABLE;
cmd->record_result = result;
break;
}
+
+ result = tu_cs_add_entries(&cmd->draw_epilogue_cs,
+ &secondary->draw_epilogue_cs);
+ if (result != VK_SUCCESS) {
+ cmd->record_result = result;
+ break;
+ }
}
cmd->state.dirty = ~0u; /* TODO: set dirty only what needs to be */
}
TU_FROM_HANDLE(tu_cmd_buffer, cmd_buffer, commandBuffer);
tu_cs_end(&cmd_buffer->draw_cs);
+ tu_cs_end(&cmd_buffer->draw_epilogue_cs);
tu_cmd_render_tiles(cmd_buffer);
- /* discard draw_cs entries now that the tiles are rendered */
+ /* discard draw_cs and draw_epilogue_cs entries now that the tiles are
+ rendered */
tu_cs_discard_entries(&cmd_buffer->draw_cs);
tu_cs_begin(&cmd_buffer->draw_cs);
+ tu_cs_discard_entries(&cmd_buffer->draw_epilogue_cs);
+ tu_cs_begin(&cmd_buffer->draw_epilogue_cs);
cmd_buffer->state.pass = NULL;
cmd_buffer->state.subpass = NULL;
* pass, we cannot mark as available yet since the commands in
* draw_cs are not run until vkCmdEndRenderPass.
*/
- struct tu_cs *cs = cmdbuf->state.pass ? &cmdbuf->draw_cs : &cmdbuf->cs;
+ const struct tu_render_pass *pass = cmdbuf->state.pass;
+ struct tu_cs *cs = pass ? &cmdbuf->draw_cs : &cmdbuf->cs;
+ uint64_t available_iova = occlusion_query_iova(pool, query, available);
uint64_t begin_iova = occlusion_query_iova(pool, query, begin);
uint64_t end_iova = occlusion_query_iova(pool, query, end);
uint64_t result_iova = occlusion_query_iova(pool, query, result);
tu_cs_emit_pkt7(cs, CP_WAIT_MEM_WRITES, 0);
- if (!cmdbuf->state.pass) {
- tu_cs_reserve_space(cmdbuf->device, cs, 5);
- tu_cs_emit_pkt7(cs, CP_MEM_WRITE, 4);
- tu_cs_emit_qw(cs, occlusion_query_iova(pool, query, available));
- tu_cs_emit_qw(cs, 0x1);
- }
+ if (pass)
+ /* Technically, queries should be tracked per-subpass, but here we track
+ * at the render pass level to simply the code a bit. This is safe
+ * because the only commands that use the available bit are
+ * vkCmdCopyQueryPoolResults and vkCmdResetQueryPool, both of which
+ * cannot be invoked from inside a render pass scope.
+ */
+ cs = &cmdbuf->draw_epilogue_cs;
+
+ tu_cs_reserve_space(cmdbuf->device, cs, 5);
+ tu_cs_emit_pkt7(cs, CP_MEM_WRITE, 4);
+ tu_cs_emit_qw(cs, available_iova);
+ tu_cs_emit_qw(cs, 0x1);
}
void