venus: remember render pass PRESENT_SRC barriers

We need them for wsi queue ownership transfer.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10709>
This commit is contained in:
Chia-I Wu 2021-05-07 11:23:38 -07:00 committed by Marge Bot
parent 9fe833dfd9
commit cef50d08e9
2 changed files with 33 additions and 0 deletions

View File

@ -88,6 +88,31 @@ vn_render_pass_replace_present_src2(struct vn_render_pass *pass,
create_info->attachmentCount, out_atts);
}
static void
vn_render_pass_setup_present_src_barriers(struct vn_render_pass *pass)
{
/* TODO parse VkSubpassDependency for more accurate barriers */
for (uint32_t i = 0; i < pass->present_src_count; i++) {
struct vn_present_src_attachment *att =
&pass->present_src_attachments[i];
if (att->acquire) {
att->src_stage_mask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
att->src_access_mask = 0;
att->dst_stage_mask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
att->dst_access_mask =
VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT;
} else {
att->src_stage_mask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
att->src_access_mask = VK_ACCESS_MEMORY_WRITE_BIT;
att->dst_stage_mask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
att->dst_access_mask = 0;
}
}
}
static struct vn_render_pass *
vn_render_pass_create(struct vn_device *dev,
uint32_t acquire_count,
@ -144,6 +169,7 @@ vn_CreateRenderPass(VkDevice device,
}
vn_render_pass_replace_present_src(pass, pCreateInfo, temp_atts);
vn_render_pass_setup_present_src_barriers(pass);
local_pass_info = *pCreateInfo;
local_pass_info.pAttachments = temp_atts;
@ -193,6 +219,7 @@ vn_CreateRenderPass2(VkDevice device,
}
vn_render_pass_replace_present_src2(pass, pCreateInfo, temp_atts);
vn_render_pass_setup_present_src_barriers(pass);
local_pass_info = *pCreateInfo;
local_pass_info.pAttachments = temp_atts;

View File

@ -16,6 +16,12 @@
struct vn_present_src_attachment {
bool acquire;
uint32_t index;
VkPipelineStageFlags src_stage_mask;
VkAccessFlags src_access_mask;
VkPipelineStageFlags dst_stage_mask;
VkAccessFlags dst_access_mask;
};
struct vn_render_pass {