mesa/src/panfrost/vulkan/panvk_cmd_alloc.h
Boris Brezillon 086bcbe186 pan: Use a consistent pan_ prefix across src/panfrost/*
We've been inconsistenly using panfrost_ and pan_ as a prefix for
the common helpers/structs. Let's finally make a clear cut by
prefixing everything that lives in src/panfrost/* with pan_.

No functional changes here, this is just renaming and reformatting
changes.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Ryan Mckeever <ryan.mckeever@collabora.com>
Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34767>
2025-05-21 14:58:20 +02:00

51 lines
1.8 KiB
C

/*
* Copyright © 2024 Collabora Ltd.
* SPDX-License-Identifier: MIT
*/
#ifndef PANVK_CMD_ALLOC_H
#define PANVK_CMD_ALLOC_H
#include "panvk_cmd_buffer.h"
#include "panvk_macros.h"
#include "panvk_mempool.h"
static inline struct pan_ptr
panvk_cmd_alloc_from_pool(struct panvk_cmd_buffer *cmdbuf,
struct panvk_pool *pool,
struct panvk_pool_alloc_info info)
{
if (!info.size)
return (struct pan_ptr){0};
struct pan_ptr ptr =
pan_pool_alloc_aligned(&pool->base, info.size, info.alignment);
if (!ptr.gpu) {
VkResult error =
panvk_catch_indirect_alloc_failure(VK_ERROR_OUT_OF_DEVICE_MEMORY);
vk_command_buffer_set_error(&cmdbuf->vk, error);
}
return ptr;
}
#define panvk_cmd_alloc_dev_mem(__cmdbuf, __poolnm, __sz, __alignment) \
panvk_cmd_alloc_from_pool(__cmdbuf, &(__cmdbuf)->__poolnm##_pool, \
(struct panvk_pool_alloc_info){ \
.size = __sz, \
.alignment = __alignment, \
})
#define panvk_cmd_alloc_desc_aggregate(__cmdbuf, ...) \
panvk_cmd_alloc_from_pool( \
__cmdbuf, &(__cmdbuf)->desc_pool, \
panvk_pool_descs_to_alloc_info(PAN_DESC_AGGREGATE(__VA_ARGS__)))
#define panvk_cmd_alloc_desc(__cmdbuf, __desc) \
panvk_cmd_alloc_desc_aggregate(__cmdbuf, PAN_DESC(__desc))
#define panvk_cmd_alloc_desc_array(__cmdbuf, __count, __desc) \
panvk_cmd_alloc_desc_aggregate(__cmdbuf, PAN_DESC_ARRAY(__count, __desc))
#endif