From 086cfa5652ec202f87c14d11e0f6c959d75987d8 Mon Sep 17 00:00:00 2001 From: Tapani Pälli Date: Wed, 23 Aug 2017 11:25:57 +0300 Subject: anv: implementation of VK_EXT_debug_report extension MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch adds required functionality for extension to manage a list of application provided callbacks and handle debug reporting from driver and application side. v2: remove useless helper anv_debug_report_call add locking around callbacks list use vk_alloc2, vk_free2 refactor CreateDebugReportCallbackEXT fix bugs found with crucible testing v3: provide ANV_FROM_HANDLE and use it misc fixes for issues Jason found use vk_find_struct_const for finding ctor_cb Signed-off-by: Tapani Pälli Reviewed-by: Jason Ekstrand --- src/intel/vulkan/anv_private.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/intel/vulkan/anv_private.h') diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 674bc28cc02..1b71093f949 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -61,6 +61,8 @@ typedef uint32_t xcb_window_t; struct anv_buffer; struct anv_buffer_view; struct anv_image_view; +struct anv_instance; +struct anv_debug_report_callback; struct gen_l3_config; @@ -237,6 +239,15 @@ void __anv_perf_warn(const char *file, int line, const char *format, ...) void anv_loge(const char *format, ...) anv_printflike(1, 2); void anv_loge_v(const char *format, va_list va); +void anv_debug_report(struct anv_instance *instance, + VkDebugReportFlagsEXT flags, + VkDebugReportObjectTypeEXT object_type, + uint64_t handle, + size_t location, + int32_t messageCode, + const char* pLayerPrefix, + const char *pMessage); + /** * Print a FINISHME message, including its source location. */ @@ -666,6 +677,14 @@ struct anv_physical_device { int local_fd; }; +struct anv_debug_report_callback { + /* Link in the 'callbacks' list in anv_instance struct. */ + struct list_head link; + VkDebugReportFlagsEXT flags; + PFN_vkDebugReportCallbackEXT callback; + void * data; +}; + struct anv_instance { VK_LOADER_DATA _loader_data; @@ -674,6 +693,11 @@ struct anv_instance { uint32_t apiVersion; int physicalDeviceCount; struct anv_physical_device physicalDevice; + + /* VK_EXT_debug_report debug callbacks */ + pthread_mutex_t callbacks_mutex; + struct list_head callbacks; + struct anv_debug_report_callback destroy_debug_cb; }; VkResult anv_init_wsi(struct anv_physical_device *physical_device); @@ -2493,6 +2517,7 @@ ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_render_pass, VkRenderPass) ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_sampler, VkSampler) ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_semaphore, VkSemaphore) ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_shader_module, VkShaderModule) +ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_debug_report_callback, VkDebugReportCallbackEXT) /* Gen-specific function declarations */ #ifdef genX -- cgit v1.2.3