venus: remember cmd buffer fb attachments

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-05 16:17:34 -07:00
committed by Marge Bot
parent ccf85f6604
commit fb6fc24771
2 changed files with 44 additions and 0 deletions
+43
View File
@@ -14,6 +14,7 @@
#include "venus-protocol/vn_protocol_driver_command_pool.h"
#include "vn_device.h"
#include "vn_image.h"
#include "vn_render_pass.h"
static void
@@ -24,13 +25,55 @@ vn_cmd_begin_render_pass(struct vn_command_buffer *cmd,
{
cmd->builder.render_pass = pass;
cmd->builder.framebuffer = fb;
if (!pass->present_src_count ||
cmd->level == VK_COMMAND_BUFFER_LEVEL_SECONDARY)
return;
/* find fb attachments */
const VkImageView *views;
uint32_t view_count;
if (fb->image_view_count) {
views = fb->image_views;
view_count = fb->image_view_count;
} else {
const VkRenderPassAttachmentBeginInfo *imageless_info =
vk_find_struct_const(begin_info->pNext,
RENDER_PASS_ATTACHMENT_BEGIN_INFO);
assert(imageless_info);
views = imageless_info->pAttachments;
view_count = imageless_info->attachmentCount;
}
const struct vn_image **images =
vk_alloc(&cmd->allocator, sizeof(*images) * pass->present_src_count,
VN_DEFAULT_ALIGN, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!images) {
cmd->state = VN_COMMAND_BUFFER_STATE_INVALID;
return;
}
for (uint32_t i = 0; i < pass->present_src_count; i++) {
const uint32_t index = pass->present_src_attachments[i].index;
assert(index < view_count);
images[i] = vn_image_view_from_handle(views[index])->image;
}
cmd->builder.present_src_images = images;
}
static void
vn_cmd_end_render_pass(struct vn_command_buffer *cmd)
{
const struct vn_render_pass *pass = cmd->builder.render_pass;
cmd->builder.render_pass = NULL;
cmd->builder.framebuffer = NULL;
if (!pass->present_src_count || !cmd->builder.present_src_images)
return;
vk_free(&cmd->allocator, cmd->builder.present_src_images);
}
/* command pool commands */
+1
View File
@@ -42,6 +42,7 @@ struct vn_command_buffer_builder {
const struct vn_render_pass *render_pass;
const struct vn_framebuffer *framebuffer;
const struct vn_image **present_src_images;
};
struct vn_command_buffer {