anv: Switch to new debug message helpers

Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10318>
This commit is contained in:
Yevhenii Kolesnikov 2021-05-13 21:39:09 +03:00 committed by Marge Bot
parent d55d1fcda2
commit dc354b8fda
7 changed files with 48 additions and 46 deletions

View File

@ -1622,7 +1622,8 @@ anv_device_alloc_bo(struct anv_device *device,
struct anv_bo **bo_out)
{
if (!(alloc_flags & ANV_BO_ALLOC_LOCAL_MEM))
anv_perf_warn(device, NULL, "system memory used");
anv_perf_warn(VK_LOG_NO_OBJS(&device->physical->instance->vk.base),
"system memory used");
if (!device->physical->has_implicit_ccs)
assert(!(alloc_flags & ANV_BO_ALLOC_IMPLICIT_CCS));

View File

@ -92,17 +92,12 @@ compiler_debug_log(void *data, UNUSED unsigned *id, const char *fmt, ...)
struct anv_device *device = (struct anv_device *)data;
struct anv_instance *instance = device->physical->instance;
if (list_is_empty(&instance->vk.debug_report.callbacks))
return;
va_list args;
va_start(args, fmt);
(void) vsnprintf(str, MAX_DEBUG_MESSAGE_LENGTH, fmt, args);
va_end(args);
vk_debug_report(&instance->vk,
VK_DEBUG_REPORT_DEBUG_BIT_EXT,
NULL, 0, 0, "anv", str);
vk_logd(VK_LOG_NO_OBJS(&instance->vk), "%s", str);
}
static void
@ -438,7 +433,7 @@ anv_physical_device_init_heaps(struct anv_physical_device *device, int fd)
/* If, for whatever reason, we can't actually get the GTT size from the
* kernel (too old?) fall back to the aperture size.
*/
anv_perf_warn(NULL, NULL,
anv_perf_warn(VK_LOG_NO_OBJS(&device->instance->vk),
"Failed to get I915_CONTEXT_PARAM_GTT_SIZE: %m");
if (intel_get_aperture_size(fd, &device->gtt_size) == -1) {

View File

@ -537,17 +537,18 @@ add_aux_surface_if_supported(struct anv_device *device,
}
if (device->info.ver == 7) {
anv_perf_warn(device, &image->vk.base, "Implement gfx7 HiZ");
anv_perf_warn(VK_LOG_OBJS(&image->vk.base), "Implement gfx7 HiZ");
return VK_SUCCESS;
}
if (image->vk.mip_levels > 1) {
anv_perf_warn(device, &image->vk.base, "Enable multi-LOD HiZ");
anv_perf_warn(VK_LOG_OBJS(&image->vk.base), "Enable multi-LOD HiZ");
return VK_SUCCESS;
}
if (device->info.ver == 8 && image->vk.samples > 1) {
anv_perf_warn(device, &image->vk.base, "Enable gfx8 multisampled HiZ");
anv_perf_warn(VK_LOG_OBJS(&image->vk.base),
"Enable gfx8 multisampled HiZ");
return VK_SUCCESS;
}
@ -629,7 +630,7 @@ add_aux_surface_if_supported(struct anv_device *device,
* CCS for this case, we currently don't have things hooked up to get
* it working.
*/
anv_perf_warn(device, &image->vk.base,
anv_perf_warn(VK_LOG_OBJS(&image->vk.base),
"This image format doesn't support rendering. "
"Not allocating an CCS buffer.");
return VK_SUCCESS;
@ -642,7 +643,7 @@ add_aux_surface_if_supported(struct anv_device *device,
* slice unfortunately. Disable CCS until anv gains more clear color
* tracking abilities.
*/
anv_perf_warn(device, &image->vk.base,
anv_perf_warn(VK_LOG_OBJS(&image->vk.base),
"HW may put fast-clear blocks on more slices than SW "
"currently tracks. Not allocating a CCS buffer.");
return VK_SUCCESS;
@ -676,7 +677,7 @@ add_aux_surface_if_supported(struct anv_device *device,
*/
image->planes[plane].aux_usage = ISL_AUX_USAGE_CCS_E;
} else if (device->info.ver >= 12) {
anv_perf_warn(device, &image->vk.base,
anv_perf_warn(VK_LOG_OBJS(&image->vk.base),
"The CCS_D aux mode is not yet handled on "
"Gfx12+. Not allocating a CCS buffer.");
image->planes[plane].aux_surface.isl.size_B = 0;

View File

@ -57,20 +57,26 @@ static void anv_spirv_nir_debug(void *private_data,
const char *message)
{
struct anv_spirv_debug_data *debug_data = private_data;
struct anv_instance *instance = debug_data->device->physical->instance;
static const VkDebugReportFlagsEXT vk_flags[] = {
[NIR_SPIRV_DEBUG_LEVEL_INFO] = VK_DEBUG_REPORT_INFORMATION_BIT_EXT,
[NIR_SPIRV_DEBUG_LEVEL_WARNING] = VK_DEBUG_REPORT_WARNING_BIT_EXT,
[NIR_SPIRV_DEBUG_LEVEL_ERROR] = VK_DEBUG_REPORT_ERROR_BIT_EXT,
};
char buffer[256];
snprintf(buffer, sizeof(buffer), "SPIR-V offset %lu: %s", (unsigned long) spirv_offset, message);
vk_debug_report(&instance->vk, vk_flags[level],
&debug_data->module->base,
0, 0, "anv", buffer);
switch (level) {
case NIR_SPIRV_DEBUG_LEVEL_INFO:
vk_logi(VK_LOG_OBJS(&debug_data->module->base),
"SPIR-V offset %lu: %s",
(unsigned long) spirv_offset, message);
break;
case NIR_SPIRV_DEBUG_LEVEL_WARNING:
vk_logw(VK_LOG_OBJS(&debug_data->module->base),
"SPIR-V offset %lu: %s",
(unsigned long) spirv_offset, message);
break;
case NIR_SPIRV_DEBUG_LEVEL_ERROR:
vk_loge(VK_LOG_OBJS(&debug_data->module->base),
"SPIR-V offset %lu: %s",
(unsigned long) spirv_offset, message);
break;
default:
break;
}
}
/* Eventually, this will become part of anv_CreateShader. Unfortunately,
@ -1541,13 +1547,10 @@ anv_pipeline_compile_graphics(struct anv_graphics_pipeline *pipeline,
*/
assert(found < __builtin_popcount(pipeline->active_stages));
vk_debug_report(&pipeline->base.device->physical->instance->vk,
VK_DEBUG_REPORT_WARNING_BIT_EXT |
VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT,
&cache->base, 0, 0, "anv",
"Found a partial pipeline in the cache. This is "
"most likely caused by an incomplete pipeline cache "
"import or export");
vk_perf(VK_LOG_OBJS(&cache->base),
"Found a partial pipeline in the cache. This is "
"most likely caused by an incomplete pipeline cache "
"import or export");
/* We're going to have to recompile anyway, so just throw away our
* references to the shaders in the cache. We'll get them out of the

View File

@ -73,6 +73,7 @@
#include "vk_util.h"
#include "vk_command_buffer.h"
#include "vk_queue.h"
#include "vk_log.h"
/* Pre-declarations needed for WSI entrypoints */
struct wl_surface;
@ -441,12 +442,14 @@ void anv_loge_v(const char *format, va_list va);
/**
* Print a perf warning message. Set INTEL_DEBUG=perf to see these.
*/
#define anv_perf_warn(instance, obj, format, ...) \
#define anv_perf_warn(objects_macro, format, ...) \
do { \
static bool reported = false; \
if (!reported && (INTEL_DEBUG & DEBUG_PERF)) { \
__anv_perf_warn(instance, obj, __FILE__, __LINE__,\
format, ##__VA_ARGS__); \
__vk_log(VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT, \
VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT, \
objects_macro, __FILE__, __LINE__, \
format, ## __VA_ARGS__); \
reported = true; \
} \
} while (0)

View File

@ -401,7 +401,7 @@ anv_can_fast_clear_color_view(struct anv_device * device,
if (isl_color_value_requires_conversion(clear_color,
&iview->image->planes[0].primary_surface.isl,
&iview->planes[0].isl)) {
anv_perf_warn(device, &iview->vk.base,
anv_perf_warn(VK_LOG_OBJS(&iview->vk.base),
"Cannot fast-clear to colors which would require "
"format conversion on resolve");
return false;
@ -416,7 +416,7 @@ anv_can_fast_clear_color_view(struct anv_device * device,
*/
if (iview->planes[0].isl.base_level > 0 ||
iview->planes[0].isl.base_array_layer > 0) {
anv_perf_warn(device, &iview->image->vk.base,
anv_perf_warn(VK_LOG_OBJS(&iview->image->vk.base),
"Rendering with multi-lod or multi-layer framebuffer "
"with LOAD_OP_LOAD and baseMipLevel > 0 or "
"baseArrayLayer > 0. Not fast clearing.");
@ -424,7 +424,7 @@ anv_can_fast_clear_color_view(struct anv_device * device,
}
if (num_layers > 1) {
anv_perf_warn(device, &iview->image->vk.base,
anv_perf_warn(VK_LOG_OBJS(&iview->image->vk.base),
"Rendering to a multi-layer framebuffer with "
"LOAD_OP_CLEAR. Only fast-clearing the first slice");
}
@ -1385,7 +1385,7 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer,
}
} else {
if (image->vk.samples == 4 || image->vk.samples == 16) {
anv_perf_warn(cmd_buffer->device, &image->vk.base,
anv_perf_warn(VK_LOG_OBJS(&image->vk.base),
"Doing a potentially unnecessary fast-clear to "
"define an MCS buffer.");
}

View File

@ -32,6 +32,7 @@
#include "nir/nir_xfb_info.h"
#include "vk_util.h"
#include "vk_format.h"
#include "vk_log.h"
static uint32_t
vertex_element_comp_control(enum isl_format format, unsigned comp)
@ -1330,11 +1331,9 @@ emit_cb_state(struct anv_graphics_pipeline *pipeline,
is_dual_src_blend_factor(a->dstColorBlendFactor) ||
is_dual_src_blend_factor(a->srcAlphaBlendFactor) ||
is_dual_src_blend_factor(a->dstAlphaBlendFactor))) {
vk_debug_report(&device->physical->instance->vk,
VK_DEBUG_REPORT_WARNING_BIT_EXT,
&device->vk.base, 0, 0, "anv",
"Enabled dual-src blend factors without writing both targets "
"in the shader. Disabling blending to avoid GPU hangs.");
vk_logw(VK_LOG_OBJS(&device->vk.base),
"Enabled dual-src blend factors without writing both targets "
"in the shader. Disabling blending to avoid GPU hangs.");
entry.ColorBufferBlendEnable = false;
}