venus: add env perf options and introduce no_async_set_alloc

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16110>
This commit is contained in:
Yiwei Zhang 2022-04-22 21:37:27 +00:00 committed by Marge Bot
parent 4ab640852b
commit f0bfd8afe2
3 changed files with 17 additions and 2 deletions

View file

@ -27,6 +27,11 @@ static const struct debug_control vn_debug_options[] = {
{ NULL, 0 },
};
static const struct debug_control vn_perf_options[] = {
{ "no_async_set_alloc", VN_PERF_NO_ASYNC_SET_ALLOC },
{ NULL, 0 },
};
struct vn_env vn_env;
static void
@ -34,6 +39,8 @@ vn_env_init_once(void)
{
vn_env.debug =
parse_debug_string(os_get_option("VN_DEBUG"), vn_debug_options);
vn_env.perf =
parse_debug_string(os_get_option("VN_PERF"), vn_perf_options);
}
void

View file

@ -45,6 +45,7 @@
#define VN_DEFAULT_ALIGN 8
#define VN_DEBUG(category) (unlikely(vn_env.debug & VN_DEBUG_##category))
#define VN_PERF(category) (unlikely(vn_env.perf & VN_PERF_##category))
#define vn_error(instance, error) \
(VN_DEBUG(RESULT) ? vn_log_result((instance), (error), __func__) : (error))
@ -141,6 +142,10 @@ enum vn_debug {
VN_DEBUG_NO_ABORT = 1ull << 4,
};
enum vn_perf {
VN_PERF_NO_ASYNC_SET_ALLOC = 1ull << 0,
};
typedef uint64_t vn_object_id;
/* base class of vn_instance */
@ -173,6 +178,7 @@ struct vn_refcount {
struct vn_env {
uint64_t debug;
uint64_t perf;
};
extern struct vn_env vn_env;

View file

@ -259,8 +259,10 @@ vn_CreateDescriptorPool(VkDevice device,
* allocation must not fail due to a fragmented pool per spec. In this
* case, set allocation can be asynchronous with pool resource tracking.
*/
pool->async_set_allocation = !(
pCreateInfo->flags & VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT);
pool->async_set_allocation =
!VN_PERF(NO_ASYNC_SET_ALLOC) &&
!(pCreateInfo->flags &
VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT);
pool->max.set_count = pCreateInfo->maxSets;