<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 28, 2017 at 10:44 PM, Tapani Pälli <span dir="ltr"><<a href="mailto:tapani.palli@intel.com" target="_blank">tapani.palli@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Tapani Pälli <<a href="mailto:tapani.palli@intel.com">tapani.palli@intel.com</a>><br>
---<br>
src/intel/vulkan/anv_<wbr>allocator.c | 8 +++++---<br>
src/intel/vulkan/anv_device.c | 38 ++++++++++++++++++++++++------<wbr>--------<br>
src/intel/vulkan/anv_formats.c | 3 ++-<br>
src/intel/vulkan/anv_private.h | 12 +++++++++---<br>
src/intel/vulkan/anv_queue.c | 13 ++++++++-----<br>
src/intel/vulkan/anv_util.c | 4 +++-<br>
src/intel/vulkan/anv_wsi.c | 6 ++++--<br>
src/intel/vulkan/genX_query.c | 3 ++-<br>
8 files changed, 57 insertions(+), 30 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_<wbr>allocator.c b/src/intel/vulkan/anv_<wbr>allocator.c<br>
index efaaebcf39..3fcf9e64af 100644<br>
--- a/src/intel/vulkan/anv_<wbr>allocator.c<br>
+++ b/src/intel/vulkan/anv_<wbr>allocator.c<br>
@@ -361,12 +361,14 @@ anv_block_pool_expand_range(<wbr>struct anv_block_pool *pool,<br>
MAP_SHARED | MAP_POPULATE, pool->fd,<br>
BLOCK_POOL_MEMFD_CENTER - center_bo_offset);<br>
if (map == MAP_FAILED)<br>
- return vk_errorf(VK_ERROR_MEMORY_MAP_<wbr>FAILED, "mmap failed: %m");<br>
+ return vk_errorf(pool->device-><wbr>instance, pool->device,<br>
+ VK_ERROR_MEMORY_MAP_FAILED, "mmap failed: %m");<br>
<br>
gem_handle = anv_gem_userptr(pool->device, map, size);<br>
if (gem_handle == 0) {<br>
munmap(map, size);<br>
- return vk_errorf(VK_ERROR_TOO_MANY_<wbr>OBJECTS, "userptr failed: %m");<br>
+ return vk_errorf(pool->device-><wbr>instance, pool->device,<br>
+ VK_ERROR_TOO_MANY_OBJECTS, "userptr failed: %m");<br>
}<br>
<br>
cleanup->map = map;<br>
@@ -1190,7 +1192,7 @@ anv_bo_cache_init(struct anv_bo_cache *cache)<br>
<br>
if (pthread_mutex_init(&cache-><wbr>mutex, NULL)) {<br>
_mesa_hash_table_destroy(<wbr>cache->bo_map, NULL);<br>
- return vk_errorf(VK_ERROR_OUT_OF_<wbr>HOST_MEMORY,<br>
+ return vk_errorf(NULL, NULL, VK_ERROR_OUT_OF_HOST_MEMORY,<br>
"pthread_mutex_init failed: %m");<br>
}<br>
<br>
diff --git a/src/intel/vulkan/anv_device.<wbr>c b/src/intel/vulkan/anv_device.<wbr>c<br>
index 037b8258df..3d1382e695 100644<br>
--- a/src/intel/vulkan/anv_device.<wbr>c<br>
+++ b/src/intel/vulkan/anv_device.<wbr>c<br>
@@ -68,7 +68,7 @@ anv_compute_heap_size(int fd, uint64_t *heap_size)<br>
"Failed to get I915_CONTEXT_PARAM_GTT_SIZE: %m");<br>
<br>
if (anv_gem_get_aperture(fd, >t_size) == -1) {<br>
- return vk_errorf(VK_ERROR_<wbr>INITIALIZATION_FAILED,<br>
+ return vk_errorf(NULL, NULL, VK_ERROR_INITIALIZATION_<wbr>FAILED,<br>
"failed to get aperture size: %m");<br>
}<br>
}<br>
@@ -210,13 +210,15 @@ anv_physical_device_init_<wbr>uuids(struct anv_physical_device *device)<br>
{<br>
const struct build_id_note *note = build_id_find_nhdr("libvulkan_<wbr>intel.so");<br>
if (!note) {<br>
- return vk_errorf(VK_ERROR_<wbr>INITIALIZATION_FAILED,<br>
+ return vk_errorf(device->instance, device,<br>
+ VK_ERROR_INITIALIZATION_<wbr>FAILED,<br>
"Failed to find build-id");<br>
}<br>
<br>
unsigned build_id_len = build_id_length(note);<br>
if (build_id_len < 20) {<br>
- return vk_errorf(VK_ERROR_<wbr>INITIALIZATION_FAILED,<br>
+ return vk_errorf(device->instance, device,<br>
+ VK_ERROR_INITIALIZATION_<wbr>FAILED,<br>
"build-id too short. It needs to be a SHA");<br>
}<br>
<br>
@@ -298,7 +300,8 @@ anv_physical_device_init(<wbr>struct anv_physical_device *device,<br>
/* Broadwell, Cherryview, Skylake, Broxton, Kabylake is as fully<br>
* supported as anything */<br>
} else {<br>
- result = vk_errorf(VK_ERROR_<wbr>INCOMPATIBLE_DRIVER,<br>
+ result = vk_errorf(device->instance, device,<br>
+ VK_ERROR_INCOMPATIBLE_DRIVER,<br>
"Vulkan not yet supported on %s", device->name);<br>
goto fail;<br>
}<br>
@@ -308,27 +311,31 @@ anv_physical_device_init(<wbr>struct anv_physical_device *device,<br>
device->cmd_parser_version =<br>
anv_gem_get_param(fd, I915_PARAM_CMD_PARSER_VERSION)<wbr>;<br>
if (device->cmd_parser_version == -1) {<br>
- result = vk_errorf(VK_ERROR_<wbr>INITIALIZATION_FAILED,<br>
+ result = vk_errorf(device->instance, device,<br>
+ VK_ERROR_INITIALIZATION_<wbr>FAILED,<br>
"failed to get command parser version");<br>
goto fail;<br>
}<br>
}<br>
<br>
if (!anv_gem_get_param(fd, I915_PARAM_HAS_WAIT_TIMEOUT)) {<br>
- result = vk_errorf(VK_ERROR_<wbr>INITIALIZATION_FAILED,<br>
+ result = vk_errorf(device->instance, device,<br>
+ VK_ERROR_INITIALIZATION_<wbr>FAILED,<br>
"kernel missing gem wait");<br>
goto fail;<br>
}<br>
<br>
if (!anv_gem_get_param(fd, I915_PARAM_HAS_EXECBUF2)) {<br>
- result = vk_errorf(VK_ERROR_<wbr>INITIALIZATION_FAILED,<br>
+ result = vk_errorf(device->instance, device,<br>
+ VK_ERROR_INITIALIZATION_<wbr>FAILED,<br>
"kernel missing execbuf2");<br>
goto fail;<br>
}<br>
<br>
if (!device->info.has_llc &&<br>
anv_gem_get_param(fd, I915_PARAM_MMAP_VERSION) < 1) {<br>
- result = vk_errorf(VK_ERROR_<wbr>INITIALIZATION_FAILED,<br>
+ result = vk_errorf(device->instance, device,<br>
+ VK_ERROR_INITIALIZATION_<wbr>FAILED,<br>
"kernel missing wc mmap");<br>
goto fail;<br>
}<br>
@@ -487,7 +494,7 @@ VkResult anv_CreateInstance(<br>
"incompatible driver version",<br>
ctor_cb->pUserData);<br>
<br>
- return vk_errorf(VK_ERROR_<wbr>INCOMPATIBLE_DRIVER,<br>
+ return vk_errorf(NULL, NULL, VK_ERROR_INCOMPATIBLE_DRIVER,<br>
"Client requested version %d.%d.%d",<br>
VK_VERSION_MAJOR(client_<wbr>version),<br>
VK_VERSION_MINOR(client_<wbr>version),<br>
@@ -1374,16 +1381,17 @@ anv_device_query_status(struct anv_device *device)<br>
if (ret == -1) {<br>
/* We don't know the real error. */<br>
device->lost = true;<br>
- return vk_errorf(VK_ERROR_DEVICE_<wbr>LOST, "get_reset_stats failed: %m");<br>
+ return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,<br>
+ "get_reset_stats failed: %m");<br>
}<br>
<br>
if (active) {<br>
device->lost = true;<br>
- return vk_errorf(VK_ERROR_DEVICE_<wbr>LOST,<br>
+ return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,<br>
"GPU hung on one of our command buffers");<br>
} else if (pending) {<br>
device->lost = true;<br>
- return vk_errorf(VK_ERROR_DEVICE_<wbr>LOST,<br>
+ return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,<br>
"GPU hung with commands in-flight");<br>
}<br>
<br>
@@ -1403,7 +1411,8 @@ anv_device_bo_busy(struct anv_device *device, struct anv_bo *bo)<br>
} else if (ret == -1) {<br>
/* We don't know the real error. */<br>
device->lost = true;<br>
- return vk_errorf(VK_ERROR_DEVICE_<wbr>LOST, "gem wait failed: %m");<br>
+ return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,<br>
+ "gem wait failed: %m");<br>
}<br>
<br>
/* Query for device status after the busy call. If the BO we're checking<br>
@@ -1425,7 +1434,8 @@ anv_device_wait(struct anv_device *device, struct anv_bo *bo,<br>
} else if (ret == -1) {<br>
/* We don't know the real error. */<br>
device->lost = true;<br>
- return vk_errorf(VK_ERROR_DEVICE_<wbr>LOST, "gem wait failed: %m");<br>
+ return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,<br>
+ "gem wait failed: %m");<br>
}<br>
<br>
/* Query for device status after the wait. If the BO we're waiting on got<br>
diff --git a/src/intel/vulkan/anv_<wbr>formats.c b/src/intel/vulkan/anv_<wbr>formats.c<br>
index 9808508523..b6614dbede 100644<br>
--- a/src/intel/vulkan/anv_<wbr>formats.c<br>
+++ b/src/intel/vulkan/anv_<wbr>formats.c<br>
@@ -721,7 +721,8 @@ VkResult anv_<wbr>GetPhysicalDeviceImageFormatPr<wbr>operties2KHR(<br>
* vkGetPhysicalDeviceImageFormat<wbr>Properties2KHR returns<br>
* VK_ERROR_FORMAT_NOT_SUPPORTED.<br>
*/<br>
- result = vk_errorf(VK_ERROR_FORMAT_NOT_<wbr>SUPPORTED,<br>
+ result = vk_errorf(physical_device-><wbr>instance, physical_device,<br>
+ VK_ERROR_FORMAT_NOT_SUPPORTED,<br>
"unsupported VkExternalMemoryTypeFlagBitsKH<wbr>R 0x%x",<br>
external_info->handleType);<br>
goto fail;<br>
diff --git a/src/intel/vulkan/anv_<wbr>private.h b/src/intel/vulkan/anv_<wbr>private.h<br>
index 4d59d5b24c..7d43ad1264 100644<br>
--- a/src/intel/vulkan/anv_<wbr>private.h<br>
+++ b/src/intel/vulkan/anv_<wbr>private.h<br>
@@ -303,11 +303,17 @@ vk_to_isl_color(<wbr>VkClearColorValue color)<br>
* propagating errors. Might be useful to plug in a stack trace here.<br>
*/<br>
<br>
-VkResult __vk_errorf(VkResult error, const char *file, int line, const char *format, ...);<br>
+VkResult __vk_errorf(struct anv_instance *instance, const void *object,<br>
+ VkDebugReportObjectTypeEXT type, VkResult error,<br>
+ const char *file, int line, const char *format, ...);<br>
<br>
#ifdef DEBUG<br>
-#define vk_error(error) __vk_errorf(error, __FILE__, __LINE__, NULL);<br>
-#define vk_errorf(error, format, ...) __vk_errorf(error, __FILE__, __LINE__, format, ## __VA_ARGS__);<br>
+#define vk_error(error) __vk_errorf(NULL, NULL,\<br>
+ VK_DEBUG_REPORT_OBJECT_TYPE_<wbr>UNKNOWN_EXT,\<br>
+ error, __FILE__, __LINE__, NULL);<br>
+#define vk_errorf(instance, obj, error, format, ...)\<br>
+ __vk_errorf(NULL, NULL, VK_DEBUG_REPORT_OBJECT_TYPE_<wbr>UNKNOWN_EXT, error,\<br>
+ __FILE__, __LINE__, format, ## __VA_ARGS__);<br>
#define anv_debug(format, ...) fprintf(stderr, "debug: " format, ##__VA_ARGS__)<br>
#else<br>
#define vk_error(error) error<br>
diff --git a/src/intel/vulkan/anv_queue.c b/src/intel/vulkan/anv_queue.c<br>
index 429bac9739..1849e5277a 100644<br>
--- a/src/intel/vulkan/anv_queue.c<br>
+++ b/src/intel/vulkan/anv_queue.c<br>
@@ -43,7 +43,8 @@ anv_device_execbuf(struct anv_device *device,<br>
if (ret != 0) {<br>
/* We don't know the real error. */<br>
device->lost = true;<br>
- return vk_errorf(VK_ERROR_DEVICE_<wbr>LOST, "execbuf2 failed: %m");<br>
+ return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,<br>
+ "execbuf2 failed: %m");<br>
}<br>
<br>
struct drm_i915_gem_exec_object2 *objects =<br>
@@ -238,7 +239,8 @@ out:<br>
* VK_ERROR_DEVICE_LOST to ensure that clients do not attempt to<br>
* submit the same job again to this device.<br>
*/<br>
- result = vk_errorf(VK_ERROR_DEVICE_<wbr>LOST, "vkQueueSubmit() failed");<br>
+ result = vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,<br>
+ "vkQueueSubmit() failed");<br>
device->lost = true;<br>
}<br>
<br>
@@ -428,7 +430,7 @@ VkResult anv_GetFenceStatus(<br>
} else {<br>
/* We don't know the real error. */<br>
device->lost = true;<br>
- return vk_errorf(VK_ERROR_DEVICE_<wbr>LOST,<br>
+ return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,<br>
"drm_syncobj_wait failed: %m");<br>
}<br>
} else {<br>
@@ -508,7 +510,7 @@ anv_wait_for_syncobj_fences(<wbr>struct anv_device *device,<br>
} else {<br>
/* We don't know the real error. */<br>
device->lost = true;<br>
- return vk_errorf(VK_ERROR_DEVICE_<wbr>LOST,<br>
+ return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,<br>
"drm_syncobj_wait failed: %m");<br>
}<br>
} else {<br>
@@ -750,7 +752,8 @@ VkResult anv_ImportFenceFdKHR(<br>
<br>
if (anv_gem_syncobj_import_sync_<wbr>file(device, new_impl.syncobj, fd)) {<br>
anv_gem_syncobj_destroy(<wbr>device, new_impl.syncobj);<br>
- return vk_errorf(VK_ERROR_INVALID_<wbr>EXTERNAL_HANDLE_KHR,<br>
+ return vk_errorf(device->instance, NULL,<br>
+ VK_ERROR_INVALID_EXTERNAL_<wbr>HANDLE_KHR,<br>
"syncobj sync file import failed: %m");<br>
}<br>
break;<br>
diff --git a/src/intel/vulkan/anv_util.c b/src/intel/vulkan/anv_util.c<br>
index a374db5cc6..5318528150 100644<br>
--- a/src/intel/vulkan/anv_util.c<br>
+++ b/src/intel/vulkan/anv_util.c<br>
@@ -93,7 +93,9 @@ __anv_perf_warn(struct anv_instance *instance, const void *object,<br>
}<br>
<br>
VkResult<br>
-__vk_errorf(VkResult error, const char *file, int line, const char *format, ...)<br>
+__vk_errorf(struct anv_instance *instance, const void *object,<br>
+ VkDebugReportObjectTypeEXT type, VkResult error,<br>
+ const char *file, int line, const char *format, ...)<br>
{<br></blockquote><div><br></div><div>Were you planning to actually hook this into debug_report? I don't see that code.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
va_list ap;<br>
char buffer[256];<br>
diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c<br>
index 00edb220b2..c3e5dc1870 100644<br>
--- a/src/intel/vulkan/anv_wsi.c<br>
+++ b/src/intel/vulkan/anv_wsi.c<br>
@@ -248,7 +248,8 @@ anv_wsi_image_create(VkDevice device_h,<br>
surface->isl.row_pitch, I915_TILING_X);<br>
if (ret) {<br>
/* FINISHME: Choose a better error. */<br>
- result = vk_errorf(VK_ERROR_OUT_OF_<wbr>DEVICE_MEMORY,<br>
+ result = vk_errorf(device->instance, device,<br>
+ VK_ERROR_OUT_OF_DEVICE_MEMORY,<br>
"set_tiling failed: %m");<br>
goto fail_alloc_memory;<br>
}<br>
@@ -256,7 +257,8 @@ anv_wsi_image_create(VkDevice device_h,<br>
int fd = anv_gem_handle_to_fd(device, memory->bo->gem_handle);<br>
if (fd == -1) {<br>
/* FINISHME: Choose a better error. */<br>
- result = vk_errorf(VK_ERROR_OUT_OF_<wbr>DEVICE_MEMORY,<br>
+ result = vk_errorf(device->instance, device,<br>
+ VK_ERROR_OUT_OF_DEVICE_MEMORY,<br>
"handle_to_fd failed: %m");<br>
goto fail_alloc_memory;<br>
}<br>
diff --git a/src/intel/vulkan/genX_query.<wbr>c b/src/intel/vulkan/genX_query.<wbr>c<br>
index 5102412e8f..9c5fc86d7f 100644<br>
--- a/src/intel/vulkan/genX_query.<wbr>c<br>
+++ b/src/intel/vulkan/genX_query.<wbr>c<br>
@@ -167,7 +167,8 @@ wait_for_available(struct anv_device *device,<br>
} else if (ret == -1) {<br>
/* We don't know the real error. */<br>
device->lost = true;<br>
- return vk_errorf(VK_ERROR_DEVICE_<wbr>LOST, "gem wait failed: %m");<br>
+ return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,<br>
+ "gem wait failed: %m");<br>
} else {<br>
assert(ret == 0);<br>
/* The BO is no longer busy. */<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.13.5<br>
<br>
</font></span></blockquote></div><br></div></div>