From bcdf481d13cb8c306a64bd31352ccc654f78ad69 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 27 Jan 2021 11:37:00 -0600 Subject: [PATCH] anv: Switch to the common VK_EXT_debug_report Reviewed-by: Lionel Landwerlin Reviewed-by: Bas Nieuwenhuizen Part-of: --- src/intel/vulkan/anv_device.c | 51 ++------------------------------ src/intel/vulkan/anv_pipeline.c | 4 +-- src/intel/vulkan/anv_private.h | 2 -- src/intel/vulkan/anv_util.c | 4 +-- src/intel/vulkan/genX_pipeline.c | 2 +- 5 files changed, 7 insertions(+), 56 deletions(-) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index a931727a656..9670a7d77e7 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -83,7 +83,7 @@ compiler_debug_log(void *data, const char *fmt, ...) struct anv_device *device = (struct anv_device *)data; struct anv_instance *instance = device->physical->instance; - if (list_is_empty(&instance->debug_report_callbacks.callbacks)) + if (list_is_empty(&instance->vk.debug_report.callbacks)) return; va_list args; @@ -91,7 +91,7 @@ compiler_debug_log(void *data, const char *fmt, ...) (void) vsnprintf(str, MAX_DEBUG_MESSAGE_LENGTH, fmt, args); va_end(args); - vk_debug_report(&instance->debug_report_callbacks, + vk_debug_report(&instance->vk.debug_report, VK_DEBUG_REPORT_DEBUG_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, 0, 0, "anv", str); @@ -738,13 +738,6 @@ VkResult anv_CreateInstance( instance->physical_devices_enumerated = false; list_inithead(&instance->physical_devices); - result = vk_debug_report_instance_init(&instance->debug_report_callbacks); - if (result != VK_SUCCESS) { - vk_instance_finish(&instance->vk); - vk_free(pAllocator, instance); - return vk_error(result); - } - instance->pipeline_cache_enabled = env_var_as_boolean("ANV_ENABLE_PIPELINE_CACHE", true); @@ -774,8 +767,6 @@ void anv_DestroyInstance( VG(VALGRIND_DESTROY_MEMPOOL(instance)); - vk_debug_report_instance_destroy(&instance->debug_report_callbacks); - glsl_type_singleton_decref(); driDestroyOptionCache(&instance->dri_options); @@ -2373,44 +2364,6 @@ PFN_vkVoidFunction vk_icdGetPhysicalDeviceProcAddr( return vk_instance_get_physical_device_proc_addr(&instance->vk, pName); } - -VkResult -anv_CreateDebugReportCallbackEXT(VkInstance _instance, - const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkDebugReportCallbackEXT* pCallback) -{ - ANV_FROM_HANDLE(anv_instance, instance, _instance); - return vk_create_debug_report_callback(&instance->debug_report_callbacks, - pCreateInfo, pAllocator, &instance->vk.alloc, - pCallback); -} - -void -anv_DestroyDebugReportCallbackEXT(VkInstance _instance, - VkDebugReportCallbackEXT _callback, - const VkAllocationCallbacks* pAllocator) -{ - ANV_FROM_HANDLE(anv_instance, instance, _instance); - vk_destroy_debug_report_callback(&instance->debug_report_callbacks, - _callback, pAllocator, &instance->vk.alloc); -} - -void -anv_DebugReportMessageEXT(VkInstance _instance, - VkDebugReportFlagsEXT flags, - VkDebugReportObjectTypeEXT objectType, - uint64_t object, - size_t location, - int32_t messageCode, - const char* pLayerPrefix, - const char* pMessage) -{ - ANV_FROM_HANDLE(anv_instance, instance, _instance); - vk_debug_report(&instance->debug_report_callbacks, flags, objectType, - object, location, messageCode, pLayerPrefix, pMessage); -} - static struct anv_state anv_state_pool_emit_data(struct anv_state_pool *pool, size_t size, size_t align, const void *p) { diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 56b6d451b8c..fded12706ed 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -113,7 +113,7 @@ static void anv_spirv_nir_debug(void *private_data, snprintf(buffer, sizeof(buffer), "SPIR-V offset %lu: %s", (unsigned long) spirv_offset, message); - vk_debug_report(&instance->debug_report_callbacks, + vk_debug_report(&instance->vk.debug_report, vk_flags[level], VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT, (uint64_t) (uintptr_t) debug_data->module, @@ -1404,7 +1404,7 @@ anv_pipeline_compile_graphics(struct anv_graphics_pipeline *pipeline, */ assert(found < __builtin_popcount(pipeline->active_stages)); - vk_debug_report(&pipeline->base.device->physical->instance->debug_report_callbacks, + vk_debug_report(&pipeline->base.device->physical->instance->vk.debug_report, VK_DEBUG_REPORT_WARNING_BIT_EXT | VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT, diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index a9b16561c97..d4bafec1090 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1181,8 +1181,6 @@ struct anv_instance { bool pipeline_cache_enabled; - struct vk_debug_report_instance debug_report_callbacks; - struct driOptionCache dri_options; struct driOptionCache available_dri_options; }; diff --git a/src/intel/vulkan/anv_util.c b/src/intel/vulkan/anv_util.c index e1d76e73948..9d3e97205a9 100644 --- a/src/intel/vulkan/anv_util.c +++ b/src/intel/vulkan/anv_util.c @@ -64,7 +64,7 @@ __anv_perf_warn(struct anv_device *device, const void *object, snprintf(report, sizeof(report), "%s: %s", file, buffer); - vk_debug_report(&device->physical->instance->debug_report_callbacks, + vk_debug_report(&device->physical->instance->vk.debug_report, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT, type, (uint64_t) (uintptr_t) object, @@ -96,7 +96,7 @@ __vk_errorv(struct anv_instance *instance, const void *object, } if (instance) { - vk_debug_report(&instance->debug_report_callbacks, + vk_debug_report(&instance->vk.debug_report, VK_DEBUG_REPORT_ERROR_BIT_EXT, type, (uint64_t) (uintptr_t) object, diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index 85b69e3628c..6fe1b71d6e6 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -1231,7 +1231,7 @@ 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->debug_report_callbacks, + vk_debug_report(&device->physical->instance->vk.debug_report, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, (uint64_t)(uintptr_t)device,