mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-02 03:38:06 +02:00
venus: move transient storage from cmd to pool
The storage is for command scope usage, so it fits better for the pool. Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24103>
This commit is contained in:
parent
566df7821b
commit
f0b5a6335d
2 changed files with 20 additions and 21 deletions
|
|
@ -70,19 +70,20 @@ vn_dependency_info_has_present_src(uint32_t dep_count,
|
|||
static void *
|
||||
vn_cmd_get_tmp_data(struct vn_command_buffer *cmd, size_t size)
|
||||
{
|
||||
struct vn_command_pool *pool = cmd->pool;
|
||||
/* avoid shrinking in case of non efficient reallocation implementation */
|
||||
if (size > cmd->builder.tmp.size) {
|
||||
if (size > pool->tmp.size) {
|
||||
void *data =
|
||||
vk_realloc(&cmd->pool->allocator, cmd->builder.tmp.data, size,
|
||||
VN_DEFAULT_ALIGN, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
vk_realloc(&pool->allocator, pool->tmp.data, size, VN_DEFAULT_ALIGN,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
if (!data)
|
||||
return NULL;
|
||||
|
||||
cmd->builder.tmp.data = data;
|
||||
cmd->builder.tmp.size = size;
|
||||
pool->tmp.data = data;
|
||||
pool->tmp.size = size;
|
||||
}
|
||||
|
||||
return cmd->builder.tmp.data;
|
||||
return pool->tmp.data;
|
||||
}
|
||||
|
||||
static inline VkImageMemoryBarrier *
|
||||
|
|
@ -729,9 +730,6 @@ vn_DestroyCommandPool(VkDevice device,
|
|||
if (cmd->builder.present_src_images)
|
||||
vk_free(alloc, cmd->builder.present_src_images);
|
||||
|
||||
if (cmd->builder.tmp.data)
|
||||
vk_free(alloc, cmd->builder.tmp.data);
|
||||
|
||||
list_for_each_entry_safe(struct vn_command_buffer_query_batch, batch,
|
||||
&cmd->query_batches, head)
|
||||
vk_free(alloc, batch);
|
||||
|
|
@ -743,6 +741,9 @@ vn_DestroyCommandPool(VkDevice device,
|
|||
&pool->free_query_batches, head)
|
||||
vk_free(alloc, batch);
|
||||
|
||||
if (pool->tmp.data)
|
||||
vk_free(alloc, pool->tmp.data);
|
||||
|
||||
vn_object_base_fini(&pool->base);
|
||||
vk_free(alloc, pool);
|
||||
}
|
||||
|
|
@ -875,9 +876,6 @@ vn_FreeCommandBuffers(VkDevice device,
|
|||
if (!cmd)
|
||||
continue;
|
||||
|
||||
if (cmd->builder.tmp.data)
|
||||
vk_free(alloc, cmd->builder.tmp.data);
|
||||
|
||||
if (cmd->builder.present_src_images)
|
||||
vk_free(alloc, cmd->builder.present_src_images);
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,16 @@ struct vn_command_pool {
|
|||
struct list_head command_buffers;
|
||||
|
||||
struct list_head free_query_batches;
|
||||
|
||||
/* Temporary storage for scrubbing VK_IMAGE_LAYOUT_PRESENT_SRC_KHR. The
|
||||
* storage's lifetime is the command pool's lifetime. We increase the
|
||||
* storage as needed, but never shrink it. Upon used by the cmd buffer, the
|
||||
* storage must fit within command scope to avoid locking or suballocation.
|
||||
*/
|
||||
struct {
|
||||
void *data;
|
||||
size_t size;
|
||||
} tmp;
|
||||
};
|
||||
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_command_pool,
|
||||
base.base,
|
||||
|
|
@ -39,15 +49,6 @@ enum vn_command_buffer_state {
|
|||
};
|
||||
|
||||
struct vn_command_buffer_builder {
|
||||
/* Temporary storage for scrubbing VK_IMAGE_LAYOUT_PRESENT_SRC_KHR. The
|
||||
* storage's lifetime is the command buffer's lifetime. We increase the
|
||||
* storage as needed, but never shrink it.
|
||||
*/
|
||||
struct {
|
||||
void *data;
|
||||
size_t size;
|
||||
} tmp;
|
||||
|
||||
const struct vn_render_pass *render_pass;
|
||||
const struct vn_framebuffer *framebuffer;
|
||||
const struct vn_image **present_src_images;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue