mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
vulkan/cmd_queue: allocate cmds based on the size of the cmd
the base size of a vk_cmd_queue_entry is massive since there are a couple union entries that have a trillion params. by allocating conditionally using the union member size, memory can be reduced, which will affect some user-facing api properties Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23322>
This commit is contained in:
parent
96a404cf82
commit
5759ab668e
1 changed files with 17 additions and 1 deletions
|
|
@ -115,6 +115,18 @@ struct ${to_struct_name(c.name)} {
|
|||
% endif
|
||||
% endfor
|
||||
|
||||
struct vk_cmd_queue_entry;
|
||||
|
||||
/* this ordering must match vk_cmd_queue_entry */
|
||||
struct vk_cmd_queue_entry_base {
|
||||
struct list_head cmd_link;
|
||||
enum vk_cmd_type type;
|
||||
void *driver_data;
|
||||
void (*driver_free_cb)(struct vk_cmd_queue *queue,
|
||||
struct vk_cmd_queue_entry *cmd);
|
||||
};
|
||||
|
||||
/* this ordering must match vk_cmd_queue_entry_base */
|
||||
struct vk_cmd_queue_entry {
|
||||
struct list_head cmd_link;
|
||||
enum vk_cmd_type type;
|
||||
|
|
@ -247,7 +259,11 @@ VkResult vk_enqueue_${to_underscore(c.name)}(struct vk_cmd_queue *queue
|
|||
)
|
||||
{
|
||||
struct vk_cmd_queue_entry *cmd = vk_zalloc(queue->alloc,
|
||||
sizeof(*cmd), 8,
|
||||
sizeof(struct vk_cmd_queue_entry_base)
|
||||
% if len(c.params) > 1:
|
||||
+ sizeof(struct ${to_struct_name(c.name)})
|
||||
% endif
|
||||
, 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
if (!cmd) return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue