From 390947128846a5f6b6db4dcef93ffaf464355a67 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 19 Apr 2023 09:10:32 -0400 Subject: [PATCH] zink: use a perf_debug() macro for debug message logging of copy box warning Reviewed-by: Emma Anholt Part-of: --- src/gallium/drivers/zink/zink_context.h | 5 +++++ src/gallium/drivers/zink/zink_resource.c | 4 ++-- src/gallium/drivers/zink/zink_resource.h | 2 +- src/gallium/drivers/zink/zink_synchronization.cpp | 4 ++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h index c75879e0f5d..a47a94c3138 100644 --- a/src/gallium/drivers/zink/zink_context.h +++ b/src/gallium/drivers/zink/zink_context.h @@ -50,6 +50,11 @@ struct zink_rasterizer_state; struct zink_resource; struct zink_vertex_elements_state; +#define perf_debug(ctx, ...) do { \ + mesa_logw(__VA_ARGS__); \ + util_debug_message(&ctx->dbg, PERF_INFO, __VA_ARGS__); \ +} while(0) + static inline struct zink_resource * zink_descriptor_surface_resource(struct zink_descriptor_surface *ds) { diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index f40e61fa7c8..b8644cfce1b 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -2251,7 +2251,7 @@ zink_resource_copy_box_intersects(struct zink_resource *res, unsigned level, con /* track a new region for TRANSFER_DST barrier emission */ void -zink_resource_copy_box_add(struct zink_resource *res, unsigned level, const struct pipe_box *box) +zink_resource_copy_box_add(struct zink_context *ctx, struct zink_resource *res, unsigned level, const struct pipe_box *box) { if (res->obj->copies_valid) { struct pipe_box *b = res->obj->copies[level].data; @@ -2408,7 +2408,7 @@ zink_resource_copy_box_add(struct zink_resource *res, unsigned level, const stru } util_dynarray_append(&res->obj->copies[level], struct pipe_box, *box); if (!res->copies_warned && util_dynarray_num_elements(&res->obj->copies[level], struct pipe_box) > 100) { - mesa_logw("zink: PERF WARNING! > 100 copy boxes detected for %p\n", res); + perf_debug(ctx, "zink: PERF WARNING! > 100 copy boxes detected for %p\n", res); res->copies_warned = true; } res->obj->copies_valid = true; diff --git a/src/gallium/drivers/zink/zink_resource.h b/src/gallium/drivers/zink/zink_resource.h index 868e355f30e..ce42d866c49 100644 --- a/src/gallium/drivers/zink/zink_resource.h +++ b/src/gallium/drivers/zink/zink_resource.h @@ -96,7 +96,7 @@ zink_is_swapchain(const struct zink_resource *res) bool zink_resource_copy_box_intersects(struct zink_resource *res, unsigned level, const struct pipe_box *box); void -zink_resource_copy_box_add(struct zink_resource *res, unsigned level, const struct pipe_box *box); +zink_resource_copy_box_add(struct zink_context *ctx, struct zink_resource *res, unsigned level, const struct pipe_box *box); void zink_resource_copies_reset(struct zink_resource *res); diff --git a/src/gallium/drivers/zink/zink_synchronization.cpp b/src/gallium/drivers/zink/zink_synchronization.cpp index 392b6e0ca2c..e7359b6bbed 100644 --- a/src/gallium/drivers/zink/zink_synchronization.cpp +++ b/src/gallium/drivers/zink/zink_synchronization.cpp @@ -427,7 +427,7 @@ zink_resource_image_transfer_dst_barrier(struct zink_context *ctx, struct zink_r res->obj->last_write = VK_ACCESS_TRANSFER_WRITE_BIT; res->obj->access_stage = VK_PIPELINE_STAGE_TRANSFER_BIT; } - zink_resource_copy_box_add(res, level, box); + zink_resource_copy_box_add(ctx, res, level, box); } bool @@ -457,7 +457,7 @@ zink_resource_buffer_transfer_dst_barrier(struct zink_context *ctx, struct zink_ res->obj->ordered_access_is_copied = true; } } - zink_resource_copy_box_add(res, 0, &box); + zink_resource_copy_box_add(ctx, res, 0, &box); /* this return value implies that the caller could do an unordered op on this resource */ return unordered; }