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) struct anv_bo **bo_out)
{ {
if (!(alloc_flags & ANV_BO_ALLOC_LOCAL_MEM)) 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) if (!device->physical->has_implicit_ccs)
assert(!(alloc_flags & ANV_BO_ALLOC_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_device *device = (struct anv_device *)data;
struct anv_instance *instance = device->physical->instance; struct anv_instance *instance = device->physical->instance;
if (list_is_empty(&instance->vk.debug_report.callbacks))
return;
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
(void) vsnprintf(str, MAX_DEBUG_MESSAGE_LENGTH, fmt, args); (void) vsnprintf(str, MAX_DEBUG_MESSAGE_LENGTH, fmt, args);
va_end(args); va_end(args);
vk_debug_report(&instance->vk, vk_logd(VK_LOG_NO_OBJS(&instance->vk), "%s", str);
VK_DEBUG_REPORT_DEBUG_BIT_EXT,
NULL, 0, 0, "anv", str);
} }
static void 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 /* If, for whatever reason, we can't actually get the GTT size from the
* kernel (too old?) fall back to the aperture size. * 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"); "Failed to get I915_CONTEXT_PARAM_GTT_SIZE: %m");
if (intel_get_aperture_size(fd, &device->gtt_size) == -1) { 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) { 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; return VK_SUCCESS;
} }
if (image->vk.mip_levels > 1) { 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; return VK_SUCCESS;
} }
if (device->info.ver == 8 && image->vk.samples > 1) { 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; 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 * CCS for this case, we currently don't have things hooked up to get
* it working. * 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. " "This image format doesn't support rendering. "
"Not allocating an CCS buffer."); "Not allocating an CCS buffer.");
return VK_SUCCESS; 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 * slice unfortunately. Disable CCS until anv gains more clear color
* tracking abilities. * 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 " "HW may put fast-clear blocks on more slices than SW "
"currently tracks. Not allocating a CCS buffer."); "currently tracks. Not allocating a CCS buffer.");
return VK_SUCCESS; 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; image->planes[plane].aux_usage = ISL_AUX_USAGE_CCS_E;
} else if (device->info.ver >= 12) { } 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 " "The CCS_D aux mode is not yet handled on "
"Gfx12+. Not allocating a CCS buffer."); "Gfx12+. Not allocating a CCS buffer.");
image->planes[plane].aux_surface.isl.size_B = 0; 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) const char *message)
{ {
struct anv_spirv_debug_data *debug_data = private_data; struct anv_spirv_debug_data *debug_data = private_data;
struct anv_instance *instance = debug_data->device->physical->instance;
static const VkDebugReportFlagsEXT vk_flags[] = { switch (level) {
[NIR_SPIRV_DEBUG_LEVEL_INFO] = VK_DEBUG_REPORT_INFORMATION_BIT_EXT, case NIR_SPIRV_DEBUG_LEVEL_INFO:
[NIR_SPIRV_DEBUG_LEVEL_WARNING] = VK_DEBUG_REPORT_WARNING_BIT_EXT, vk_logi(VK_LOG_OBJS(&debug_data->module->base),
[NIR_SPIRV_DEBUG_LEVEL_ERROR] = VK_DEBUG_REPORT_ERROR_BIT_EXT, "SPIR-V offset %lu: %s",
}; (unsigned long) spirv_offset, message);
char buffer[256]; break;
case NIR_SPIRV_DEBUG_LEVEL_WARNING:
snprintf(buffer, sizeof(buffer), "SPIR-V offset %lu: %s", (unsigned long) spirv_offset, message); vk_logw(VK_LOG_OBJS(&debug_data->module->base),
"SPIR-V offset %lu: %s",
vk_debug_report(&instance->vk, vk_flags[level], (unsigned long) spirv_offset, message);
&debug_data->module->base, break;
0, 0, "anv", buffer); 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, /* Eventually, this will become part of anv_CreateShader. Unfortunately,
@@ -1541,10 +1547,7 @@ anv_pipeline_compile_graphics(struct anv_graphics_pipeline *pipeline,
*/ */
assert(found < __builtin_popcount(pipeline->active_stages)); assert(found < __builtin_popcount(pipeline->active_stages));
vk_debug_report(&pipeline->base.device->physical->instance->vk, vk_perf(VK_LOG_OBJS(&cache->base),
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 " "Found a partial pipeline in the cache. This is "
"most likely caused by an incomplete pipeline cache " "most likely caused by an incomplete pipeline cache "
"import or export"); "import or export");

View File

@@ -73,6 +73,7 @@
#include "vk_util.h" #include "vk_util.h"
#include "vk_command_buffer.h" #include "vk_command_buffer.h"
#include "vk_queue.h" #include "vk_queue.h"
#include "vk_log.h"
/* Pre-declarations needed for WSI entrypoints */ /* Pre-declarations needed for WSI entrypoints */
struct wl_surface; struct wl_surface;
@@ -441,11 +442,13 @@ void anv_loge_v(const char *format, va_list va);
/** /**
* Print a perf warning message. Set INTEL_DEBUG=perf to see these. * 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 { \ do { \
static bool reported = false; \ static bool reported = false; \
if (!reported && (INTEL_DEBUG & DEBUG_PERF)) { \ if (!reported && (INTEL_DEBUG & DEBUG_PERF)) { \
__anv_perf_warn(instance, obj, __FILE__, __LINE__,\ __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__); \ format, ## __VA_ARGS__); \
reported = true; \ reported = true; \
} \ } \

View File

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

View File

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