util,vulkan,asahi,hk: hash format strings

flag day change to use the new infra. as-is this is a bit pointless, but it
unblocks the new bindgen work.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33067>
This commit is contained in:
Alyssa Rosenzweig 2025-01-15 15:41:23 -05:00 committed by Marge Bot
parent 43e79b26de
commit c1e685bfe9
6 changed files with 14 additions and 16 deletions

View file

@ -98,6 +98,7 @@ compile(void *memctx, const uint32_t *spirv, size_t spirv_size)
NIR_PASS(_, nir, nir_lower_printf,
&(const struct nir_lower_printf_options){
.hash_format_strings = true,
});
/* We have to lower away local constant initializers right before we

View file

@ -30,6 +30,7 @@
#include "util/os_mman.h"
#include "util/os_time.h"
#include "util/simple_mtx.h"
#include "util/u_printf.h"
#include "git_sha1.h"
#include "nir_serialize.h"
#include "unstable_asahi_drm.h"
@ -694,7 +695,9 @@ agx_open_device(void *memctx, struct agx_device *dev)
}
u_printf_init(&dev->printf, bo, agx_bo_map(bo));
u_printf_singleton_init_or_ref();
u_printf_singleton_add(dev->libagx->printf_info,
dev->libagx->printf_info_count);
return true;
}
@ -711,6 +714,7 @@ agx_close_device(struct agx_device *dev)
util_vma_heap_finish(&dev->main_heap);
util_vma_heap_finish(&dev->usc_heap);
glsl_type_singleton_decref();
u_printf_singleton_decref();
close(dev->fd);
}

View file

@ -282,9 +282,7 @@ static VkResult
hk_check_status(struct vk_device *device)
{
struct hk_device *dev = container_of(device, struct hk_device, vk);
return vk_check_printf_status(&dev->vk, &dev->dev.printf,
dev->dev.libagx->printf_info,
dev->dev.libagx->printf_info_count);
return vk_check_printf_status(&dev->vk, &dev->dev.printf);
}
static VkResult

View file

@ -102,8 +102,7 @@ u_printf_destroy(struct u_printf_ctx *ctx)
}
static inline void
u_printf_with_ctx(FILE *out, struct u_printf_ctx *ctx,
const u_printf_info *info, unsigned info_size)
u_printf_with_ctx(FILE *out, struct u_printf_ctx *ctx)
{
/* If the printf buffer is empty, early-exit without taking the lock. The
* speeds up the happy path and makes this function reasonable to call even
@ -113,7 +112,7 @@ u_printf_with_ctx(FILE *out, struct u_printf_ctx *ctx,
return;
simple_mtx_lock(&ctx->lock);
u_printf(out, (char *)(ctx->map + 2), ctx->map[0] - 8, info, info_size);
u_printf(out, (char *)(ctx->map + 2), ctx->map[0] - 8, NULL, 0);
/* Reset */
ctx->map[0] = 8;
@ -125,10 +124,9 @@ u_printf_with_ctx(FILE *out, struct u_printf_ctx *ctx,
* intended to be called periodically to handle aborts in a timely manner.
*/
static inline bool
u_printf_check_abort(FILE *out, struct u_printf_ctx *ctx,
const u_printf_info *info, unsigned info_size)
u_printf_check_abort(FILE *out, struct u_printf_ctx *ctx)
{
u_printf_with_ctx(out, ctx, info, info_size);
u_printf_with_ctx(out, ctx);
/* Check the aborted flag */
return (ctx->map[1] != 0);

View file

@ -462,10 +462,9 @@ vk_common_QueueInsertDebugUtilsLabelEXT(
}
VkResult
vk_check_printf_status(struct vk_device *dev, struct u_printf_ctx *ctx,
struct u_printf_info *info, uint32_t count)
vk_check_printf_status(struct vk_device *dev, struct u_printf_ctx *ctx)
{
if (u_printf_check_abort(stdout, ctx, info, count)) {
if (u_printf_check_abort(stdout, ctx)) {
vk_device_set_lost(dev, "GPU abort.");
return VK_ERROR_DEVICE_LOST;
} else {

View file

@ -69,11 +69,9 @@ vk_address_binding_report(struct vk_instance *instance,
VkDeviceAddressBindingTypeEXT type);
struct u_printf_ctx;
struct u_printf_info;
VkResult
vk_check_printf_status(struct vk_device *dev, struct u_printf_ctx *ctx,
struct u_printf_info *info, uint32_t count);
vk_check_printf_status(struct vk_device *dev, struct u_printf_ctx *ctx);
#ifdef __cplusplus
}