From 781dd7ff31af62201a64e8977bbc63a48acd482b Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Tue, 14 Apr 2020 11:35:46 +0200 Subject: [PATCH] v3dv: fix subpass merge tests When testing if we could merge the new subpass into the previous one We were taking the subpass index from the state (which isn't updated to the new subpass until a bit later when the job for the new subpass has been settled). This means that we were doing the merge checks with the previous subpass, not the current one. Part-of: --- src/broadcom/vulkan/v3dv_cmd_buffer.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/broadcom/vulkan/v3dv_cmd_buffer.c b/src/broadcom/vulkan/v3dv_cmd_buffer.c index cd77f7e..d37383e 100644 --- a/src/broadcom/vulkan/v3dv_cmd_buffer.c +++ b/src/broadcom/vulkan/v3dv_cmd_buffer.c @@ -247,7 +247,8 @@ attachment_list_is_subset(struct v3dv_subpass_attachment *l1, uint32_t l1_count, } static bool -cmd_buffer_can_merge_subpass(struct v3dv_cmd_buffer *cmd_buffer) +cmd_buffer_can_merge_subpass(struct v3dv_cmd_buffer *cmd_buffer, + uint32_t subpass_idx) { const struct v3dv_cmd_buffer_state *state = &cmd_buffer->state; assert(state->pass); @@ -265,7 +266,7 @@ cmd_buffer_can_merge_subpass(struct v3dv_cmd_buffer *cmd_buffer) return false; /* Each render pass starts a new job */ - if (state->subpass_idx == 0) + if (subpass_idx == 0) return false; /* Two subpasses can be merged in the same job if we can emit a single RCL @@ -273,9 +274,9 @@ cmd_buffer_can_merge_subpass(struct v3dv_cmd_buffer *cmd_buffer) * triggers the "render job finished" interrupt). We can do this so long * as both subpasses render against the same attachments. */ - uint32_t prev_subpass_idx = state->subpass_idx - 1; - struct v3dv_subpass *prev_subpass = &state->pass->subpasses[prev_subpass_idx]; - struct v3dv_subpass *subpass = &state->pass->subpasses[state->subpass_idx]; + assert(state->subpass_idx == subpass_idx - 1); + struct v3dv_subpass *prev_subpass = &state->pass->subpasses[state->subpass_idx]; + struct v3dv_subpass *subpass = &state->pass->subpasses[subpass_idx]; /* Because the list of subpass attachments can include VK_ATTACHMENT_UNUSED, * we need to check that for each subpass all its used attachments are @@ -546,7 +547,7 @@ v3dv_cmd_buffer_start_job(struct v3dv_cmd_buffer *cmd_buffer, */ if (cmd_buffer->state.pass && subpass_idx != -1 && - cmd_buffer_can_merge_subpass(cmd_buffer)) { + cmd_buffer_can_merge_subpass(cmd_buffer, subpass_idx)) { cmd_buffer->state.job->is_subpass_finish = false; return cmd_buffer->state.job; } -- 2.7.4