anv: Take an anv_device in vk_errorf
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3461>
This commit is contained in:

committed by
Marge Bot

parent
70e8064e13
commit
cb6ea77045
@@ -207,7 +207,7 @@ anv_state_table_expand_range(struct anv_state_table *table, uint32_t size)
|
|||||||
map = mmap(NULL, size, PROT_READ | PROT_WRITE,
|
map = mmap(NULL, size, PROT_READ | PROT_WRITE,
|
||||||
MAP_SHARED | MAP_POPULATE, table->fd, 0);
|
MAP_SHARED | MAP_POPULATE, table->fd, 0);
|
||||||
if (map == MAP_FAILED) {
|
if (map == MAP_FAILED) {
|
||||||
return vk_errorf(table->device->instance, table->device,
|
return vk_errorf(table->device, table->device,
|
||||||
VK_ERROR_OUT_OF_HOST_MEMORY, "mmap failed: %m");
|
VK_ERROR_OUT_OF_HOST_MEMORY, "mmap failed: %m");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -519,7 +519,7 @@ anv_block_pool_expand_range(struct anv_block_pool *pool,
|
|||||||
MAP_SHARED | MAP_POPULATE, pool->fd,
|
MAP_SHARED | MAP_POPULATE, pool->fd,
|
||||||
BLOCK_POOL_MEMFD_CENTER - center_bo_offset);
|
BLOCK_POOL_MEMFD_CENTER - center_bo_offset);
|
||||||
if (map == MAP_FAILED)
|
if (map == MAP_FAILED)
|
||||||
return vk_errorf(pool->device->instance, pool->device,
|
return vk_errorf(pool->device, pool->device,
|
||||||
VK_ERROR_MEMORY_MAP_FAILED, "mmap failed: %m");
|
VK_ERROR_MEMORY_MAP_FAILED, "mmap failed: %m");
|
||||||
|
|
||||||
struct anv_bo *new_bo;
|
struct anv_bo *new_bo;
|
||||||
@@ -1586,8 +1586,7 @@ anv_device_alloc_bo(struct anv_device *device,
|
|||||||
if (new_bo.map)
|
if (new_bo.map)
|
||||||
anv_gem_munmap(new_bo.map, size);
|
anv_gem_munmap(new_bo.map, size);
|
||||||
anv_gem_close(device, new_bo.gem_handle);
|
anv_gem_close(device, new_bo.gem_handle);
|
||||||
return vk_errorf(device->instance, NULL,
|
return vk_errorf(device, NULL, VK_ERROR_OUT_OF_DEVICE_MEMORY,
|
||||||
VK_ERROR_OUT_OF_DEVICE_MEMORY,
|
|
||||||
"failed to allocate virtual address for BO");
|
"failed to allocate virtual address for BO");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1636,24 +1635,21 @@ anv_device_import_bo_from_host_ptr(struct anv_device *device,
|
|||||||
assert(bo->gem_handle == gem_handle);
|
assert(bo->gem_handle == gem_handle);
|
||||||
if (bo_flags != bo->flags) {
|
if (bo_flags != bo->flags) {
|
||||||
pthread_mutex_unlock(&cache->mutex);
|
pthread_mutex_unlock(&cache->mutex);
|
||||||
return vk_errorf(device->instance, NULL,
|
return vk_errorf(device, NULL, VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
||||||
VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
|
||||||
"same host pointer imported two different ways");
|
"same host pointer imported two different ways");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bo->has_client_visible_address !=
|
if (bo->has_client_visible_address !=
|
||||||
((alloc_flags & ANV_BO_ALLOC_CLIENT_VISIBLE_ADDRESS) != 0)) {
|
((alloc_flags & ANV_BO_ALLOC_CLIENT_VISIBLE_ADDRESS) != 0)) {
|
||||||
pthread_mutex_unlock(&cache->mutex);
|
pthread_mutex_unlock(&cache->mutex);
|
||||||
return vk_errorf(device->instance, NULL,
|
return vk_errorf(device, NULL, VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
||||||
VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
|
||||||
"The same BO was imported with and without buffer "
|
"The same BO was imported with and without buffer "
|
||||||
"device address");
|
"device address");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client_address && client_address != gen_48b_address(bo->offset)) {
|
if (client_address && client_address != gen_48b_address(bo->offset)) {
|
||||||
pthread_mutex_unlock(&cache->mutex);
|
pthread_mutex_unlock(&cache->mutex);
|
||||||
return vk_errorf(device->instance, NULL,
|
return vk_errorf(device, NULL, VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
||||||
VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
|
||||||
"The same BO was imported at two different "
|
"The same BO was imported at two different "
|
||||||
"addresses");
|
"addresses");
|
||||||
}
|
}
|
||||||
@@ -1677,8 +1673,7 @@ anv_device_import_bo_from_host_ptr(struct anv_device *device,
|
|||||||
if (!anv_vma_alloc(device, &new_bo, client_address)) {
|
if (!anv_vma_alloc(device, &new_bo, client_address)) {
|
||||||
anv_gem_close(device, new_bo.gem_handle);
|
anv_gem_close(device, new_bo.gem_handle);
|
||||||
pthread_mutex_unlock(&cache->mutex);
|
pthread_mutex_unlock(&cache->mutex);
|
||||||
return vk_errorf(device->instance, NULL,
|
return vk_errorf(device, NULL, VK_ERROR_OUT_OF_DEVICE_MEMORY,
|
||||||
VK_ERROR_OUT_OF_DEVICE_MEMORY,
|
|
||||||
"failed to allocate virtual address for BO");
|
"failed to allocate virtual address for BO");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1737,8 +1732,7 @@ anv_device_import_bo(struct anv_device *device,
|
|||||||
if ((bo->flags & EXEC_OBJECT_PINNED) !=
|
if ((bo->flags & EXEC_OBJECT_PINNED) !=
|
||||||
(bo_flags & EXEC_OBJECT_PINNED)) {
|
(bo_flags & EXEC_OBJECT_PINNED)) {
|
||||||
pthread_mutex_unlock(&cache->mutex);
|
pthread_mutex_unlock(&cache->mutex);
|
||||||
return vk_errorf(device->instance, NULL,
|
return vk_errorf(device, NULL, VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
||||||
VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
|
||||||
"The same BO was imported two different ways");
|
"The same BO was imported two different ways");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1753,24 +1747,21 @@ anv_device_import_bo(struct anv_device *device,
|
|||||||
(bo->flags & EXEC_OBJECT_SUPPORTS_48B_ADDRESS) !=
|
(bo->flags & EXEC_OBJECT_SUPPORTS_48B_ADDRESS) !=
|
||||||
(bo_flags & EXEC_OBJECT_SUPPORTS_48B_ADDRESS)) {
|
(bo_flags & EXEC_OBJECT_SUPPORTS_48B_ADDRESS)) {
|
||||||
pthread_mutex_unlock(&cache->mutex);
|
pthread_mutex_unlock(&cache->mutex);
|
||||||
return vk_errorf(device->instance, NULL,
|
return vk_errorf(device, NULL, VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
||||||
VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
|
||||||
"The same BO was imported on two different heaps");
|
"The same BO was imported on two different heaps");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bo->has_client_visible_address !=
|
if (bo->has_client_visible_address !=
|
||||||
((alloc_flags & ANV_BO_ALLOC_CLIENT_VISIBLE_ADDRESS) != 0)) {
|
((alloc_flags & ANV_BO_ALLOC_CLIENT_VISIBLE_ADDRESS) != 0)) {
|
||||||
pthread_mutex_unlock(&cache->mutex);
|
pthread_mutex_unlock(&cache->mutex);
|
||||||
return vk_errorf(device->instance, NULL,
|
return vk_errorf(device, NULL, VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
||||||
VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
|
||||||
"The same BO was imported with and without buffer "
|
"The same BO was imported with and without buffer "
|
||||||
"device address");
|
"device address");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client_address && client_address != gen_48b_address(bo->offset)) {
|
if (client_address && client_address != gen_48b_address(bo->offset)) {
|
||||||
pthread_mutex_unlock(&cache->mutex);
|
pthread_mutex_unlock(&cache->mutex);
|
||||||
return vk_errorf(device->instance, NULL,
|
return vk_errorf(device, NULL, VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
||||||
VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
|
||||||
"The same BO was imported at two different "
|
"The same BO was imported at two different "
|
||||||
"addresses");
|
"addresses");
|
||||||
}
|
}
|
||||||
@@ -1801,8 +1792,7 @@ anv_device_import_bo(struct anv_device *device,
|
|||||||
if (!anv_vma_alloc(device, &new_bo, client_address)) {
|
if (!anv_vma_alloc(device, &new_bo, client_address)) {
|
||||||
anv_gem_close(device, new_bo.gem_handle);
|
anv_gem_close(device, new_bo.gem_handle);
|
||||||
pthread_mutex_unlock(&cache->mutex);
|
pthread_mutex_unlock(&cache->mutex);
|
||||||
return vk_errorf(device->instance, NULL,
|
return vk_errorf(device, NULL, VK_ERROR_OUT_OF_DEVICE_MEMORY,
|
||||||
VK_ERROR_OUT_OF_DEVICE_MEMORY,
|
|
||||||
"failed to allocate virtual address for BO");
|
"failed to allocate virtual address for BO");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -445,8 +445,7 @@ anv_image_from_gralloc(VkDevice device_h,
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (gralloc_info->handle->numFds != 1) {
|
if (gralloc_info->handle->numFds != 1) {
|
||||||
return vk_errorf(device->instance, device,
|
return vk_errorf(device, device, VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
||||||
VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
|
||||||
"VkNativeBufferANDROID::handle::numFds is %d, "
|
"VkNativeBufferANDROID::handle::numFds is %d, "
|
||||||
"expected 1", gralloc_info->handle->numFds);
|
"expected 1", gralloc_info->handle->numFds);
|
||||||
}
|
}
|
||||||
@@ -472,7 +471,7 @@ anv_image_from_gralloc(VkDevice device_h,
|
|||||||
0 /* client_address */,
|
0 /* client_address */,
|
||||||
&bo);
|
&bo);
|
||||||
if (result != VK_SUCCESS) {
|
if (result != VK_SUCCESS) {
|
||||||
return vk_errorf(device->instance, device, result,
|
return vk_errorf(device, device, result,
|
||||||
"failed to import dma-buf from VkNativeBufferANDROID");
|
"failed to import dma-buf from VkNativeBufferANDROID");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -488,14 +487,12 @@ anv_image_from_gralloc(VkDevice device_h,
|
|||||||
anv_info.isl_tiling_flags = ISL_TILING_Y0_BIT;
|
anv_info.isl_tiling_flags = ISL_TILING_Y0_BIT;
|
||||||
break;
|
break;
|
||||||
case -1:
|
case -1:
|
||||||
result = vk_errorf(device->instance, device,
|
result = vk_errorf(device, device, VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
||||||
VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
|
||||||
"DRM_IOCTL_I915_GEM_GET_TILING failed for "
|
"DRM_IOCTL_I915_GEM_GET_TILING failed for "
|
||||||
"VkNativeBufferANDROID");
|
"VkNativeBufferANDROID");
|
||||||
goto fail_tiling;
|
goto fail_tiling;
|
||||||
default:
|
default:
|
||||||
result = vk_errorf(device->instance, device,
|
result = vk_errorf(device, device, VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
||||||
VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
|
||||||
"DRM_IOCTL_I915_GEM_GET_TILING returned unknown "
|
"DRM_IOCTL_I915_GEM_GET_TILING returned unknown "
|
||||||
"tiling %d for VkNativeBufferANDROID", i915_tiling);
|
"tiling %d for VkNativeBufferANDROID", i915_tiling);
|
||||||
goto fail_tiling;
|
goto fail_tiling;
|
||||||
@@ -516,8 +513,7 @@ anv_image_from_gralloc(VkDevice device_h,
|
|||||||
goto fail_create;
|
goto fail_create;
|
||||||
|
|
||||||
if (bo->size < image->size) {
|
if (bo->size < image->size) {
|
||||||
result = vk_errorf(device->instance, device,
|
result = vk_errorf(device, device, VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
||||||
VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
|
||||||
"dma-buf from VkNativeBufferANDROID is too small for "
|
"dma-buf from VkNativeBufferANDROID is too small for "
|
||||||
"VkImage: %"PRIu64"B < %"PRIu64"B",
|
"VkImage: %"PRIu64"B < %"PRIu64"B",
|
||||||
bo->size, image->size);
|
bo->size, image->size);
|
||||||
@@ -568,7 +564,7 @@ format_supported_with_usage(VkDevice device_h, VkFormat format,
|
|||||||
result = anv_GetPhysicalDeviceImageFormatProperties2(phys_dev_h,
|
result = anv_GetPhysicalDeviceImageFormatProperties2(phys_dev_h,
|
||||||
&image_format_info, &image_format_props);
|
&image_format_info, &image_format_props);
|
||||||
if (result != VK_SUCCESS) {
|
if (result != VK_SUCCESS) {
|
||||||
return vk_errorf(device->instance, device, result,
|
return vk_errorf(device, device, result,
|
||||||
"anv_GetPhysicalDeviceImageFormatProperties2 failed "
|
"anv_GetPhysicalDeviceImageFormatProperties2 failed "
|
||||||
"inside %s", __func__);
|
"inside %s", __func__);
|
||||||
}
|
}
|
||||||
@@ -607,7 +603,7 @@ setup_gralloc0_usage(VkFormat format, VkImageUsageFlags imageUsage,
|
|||||||
* gralloc swapchains.
|
* gralloc swapchains.
|
||||||
*/
|
*/
|
||||||
if (imageUsage != 0) {
|
if (imageUsage != 0) {
|
||||||
return vk_errorf(device->instance, device, VK_ERROR_FORMAT_NOT_SUPPORTED,
|
return vk_errorf(device, device, VK_ERROR_FORMAT_NOT_SUPPORTED,
|
||||||
"unsupported VkImageUsageFlags(0x%x) for gralloc "
|
"unsupported VkImageUsageFlags(0x%x) for gralloc "
|
||||||
"swapchain", imageUsage);
|
"swapchain", imageUsage);
|
||||||
}
|
}
|
||||||
@@ -709,7 +705,7 @@ anv_AcquireImageANDROID(
|
|||||||
* VkFence.
|
* VkFence.
|
||||||
*/
|
*/
|
||||||
if (sync_wait(nativeFenceFd, /*timeout*/ -1) < 0) {
|
if (sync_wait(nativeFenceFd, /*timeout*/ -1) < 0) {
|
||||||
result = vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,
|
result = vk_errorf(device, device, VK_ERROR_DEVICE_LOST,
|
||||||
"%s: failed to wait on nativeFenceFd=%d",
|
"%s: failed to wait on nativeFenceFd=%d",
|
||||||
__func__, nativeFenceFd);
|
__func__, nativeFenceFd);
|
||||||
}
|
}
|
||||||
@@ -755,7 +751,7 @@ anv_AcquireImageANDROID(
|
|||||||
result = anv_QueueSubmit(anv_queue_to_handle(&device->queue), 1,
|
result = anv_QueueSubmit(anv_queue_to_handle(&device->queue), 1,
|
||||||
&submit, fence_h);
|
&submit, fence_h);
|
||||||
if (result != VK_SUCCESS) {
|
if (result != VK_SUCCESS) {
|
||||||
return vk_errorf(device->instance, device, result,
|
return vk_errorf(device, device, result,
|
||||||
"anv_QueueSubmit failed inside %s", __func__);
|
"anv_QueueSubmit failed inside %s", __func__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -136,8 +136,9 @@ anv_physical_device_init_heaps(struct anv_physical_device *device, int fd)
|
|||||||
"Failed to get I915_CONTEXT_PARAM_GTT_SIZE: %m");
|
"Failed to get I915_CONTEXT_PARAM_GTT_SIZE: %m");
|
||||||
|
|
||||||
if (anv_gem_get_aperture(fd, &device->gtt_size) == -1) {
|
if (anv_gem_get_aperture(fd, &device->gtt_size) == -1) {
|
||||||
return vk_errorf(NULL, NULL, VK_ERROR_INITIALIZATION_FAILED,
|
return vk_errorfi(device->instance, NULL,
|
||||||
"failed to get aperture size: %m");
|
VK_ERROR_INITIALIZATION_FAILED,
|
||||||
|
"failed to get aperture size: %m");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,16 +213,16 @@ anv_physical_device_init_uuids(struct anv_physical_device *device)
|
|||||||
const struct build_id_note *note =
|
const struct build_id_note *note =
|
||||||
build_id_find_nhdr_for_addr(anv_physical_device_init_uuids);
|
build_id_find_nhdr_for_addr(anv_physical_device_init_uuids);
|
||||||
if (!note) {
|
if (!note) {
|
||||||
return vk_errorf(device->instance, device,
|
return vk_errorfi(device->instance, NULL,
|
||||||
VK_ERROR_INITIALIZATION_FAILED,
|
VK_ERROR_INITIALIZATION_FAILED,
|
||||||
"Failed to find build-id");
|
"Failed to find build-id");
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned build_id_len = build_id_length(note);
|
unsigned build_id_len = build_id_length(note);
|
||||||
if (build_id_len < 20) {
|
if (build_id_len < 20) {
|
||||||
return vk_errorf(device->instance, device,
|
return vk_errorfi(device->instance, NULL,
|
||||||
VK_ERROR_INITIALIZATION_FAILED,
|
VK_ERROR_INITIALIZATION_FAILED,
|
||||||
"build-id too short. It needs to be a SHA");
|
"build-id too short. It needs to be a SHA");
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(device->driver_build_sha1, build_id_data(note), 20);
|
memcpy(device->driver_build_sha1, build_id_data(note), 20);
|
||||||
@@ -377,9 +378,8 @@ anv_physical_device_init(struct anv_physical_device *device,
|
|||||||
} else if (device->info.gen == 12) {
|
} else if (device->info.gen == 12) {
|
||||||
intel_logw("Vulkan is not yet fully supported on gen12");
|
intel_logw("Vulkan is not yet fully supported on gen12");
|
||||||
} else {
|
} else {
|
||||||
result = vk_errorf(device->instance, device,
|
result = vk_errorfi(instance, NULL, VK_ERROR_INCOMPATIBLE_DRIVER,
|
||||||
VK_ERROR_INCOMPATIBLE_DRIVER,
|
"Vulkan not yet supported on %s", device->name);
|
||||||
"Vulkan not yet supported on %s", device->name);
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,32 +388,32 @@ anv_physical_device_init(struct anv_physical_device *device,
|
|||||||
device->cmd_parser_version =
|
device->cmd_parser_version =
|
||||||
anv_gem_get_param(fd, I915_PARAM_CMD_PARSER_VERSION);
|
anv_gem_get_param(fd, I915_PARAM_CMD_PARSER_VERSION);
|
||||||
if (device->cmd_parser_version == -1) {
|
if (device->cmd_parser_version == -1) {
|
||||||
result = vk_errorf(device->instance, device,
|
result = vk_errorfi(device->instance, NULL,
|
||||||
VK_ERROR_INITIALIZATION_FAILED,
|
VK_ERROR_INITIALIZATION_FAILED,
|
||||||
"failed to get command parser version");
|
"failed to get command parser version");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!anv_gem_get_param(fd, I915_PARAM_HAS_WAIT_TIMEOUT)) {
|
if (!anv_gem_get_param(fd, I915_PARAM_HAS_WAIT_TIMEOUT)) {
|
||||||
result = vk_errorf(device->instance, device,
|
result = vk_errorfi(device->instance, NULL,
|
||||||
VK_ERROR_INITIALIZATION_FAILED,
|
VK_ERROR_INITIALIZATION_FAILED,
|
||||||
"kernel missing gem wait");
|
"kernel missing gem wait");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!anv_gem_get_param(fd, I915_PARAM_HAS_EXECBUF2)) {
|
if (!anv_gem_get_param(fd, I915_PARAM_HAS_EXECBUF2)) {
|
||||||
result = vk_errorf(device->instance, device,
|
result = vk_errorfi(device->instance, NULL,
|
||||||
VK_ERROR_INITIALIZATION_FAILED,
|
VK_ERROR_INITIALIZATION_FAILED,
|
||||||
"kernel missing execbuf2");
|
"kernel missing execbuf2");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!device->info.has_llc &&
|
if (!device->info.has_llc &&
|
||||||
anv_gem_get_param(fd, I915_PARAM_MMAP_VERSION) < 1) {
|
anv_gem_get_param(fd, I915_PARAM_MMAP_VERSION) < 1) {
|
||||||
result = vk_errorf(device->instance, device,
|
result = vk_errorfi(device->instance, NULL,
|
||||||
VK_ERROR_INITIALIZATION_FAILED,
|
VK_ERROR_INITIALIZATION_FAILED,
|
||||||
"kernel missing wc mmap");
|
"kernel missing wc mmap");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3077,7 +3077,7 @@ _anv_device_set_lost(struct anv_device *device,
|
|||||||
p_atomic_inc(&device->_lost);
|
p_atomic_inc(&device->_lost);
|
||||||
|
|
||||||
va_start(ap, msg);
|
va_start(ap, msg);
|
||||||
err = __vk_errorv(device->instance, device,
|
err = __vk_errorv(device->physical->instance, device,
|
||||||
VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
|
VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
|
||||||
VK_ERROR_DEVICE_LOST, file, line, msg, ap);
|
VK_ERROR_DEVICE_LOST, file, line, msg, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
@@ -3099,7 +3099,7 @@ _anv_queue_set_lost(struct anv_queue *queue,
|
|||||||
p_atomic_inc(&queue->device->_lost);
|
p_atomic_inc(&queue->device->_lost);
|
||||||
|
|
||||||
va_start(ap, msg);
|
va_start(ap, msg);
|
||||||
err = __vk_errorv(queue->device->instance, queue->device,
|
err = __vk_errorv(queue->device->physical->instance, queue->device,
|
||||||
VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
|
VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
|
||||||
VK_ERROR_DEVICE_LOST, file, line, msg, ap);
|
VK_ERROR_DEVICE_LOST, file, line, msg, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
@@ -3437,8 +3437,7 @@ VkResult anv_AllocateMemory(
|
|||||||
* this sort of attack but only if it can trust the buffer size.
|
* this sort of attack but only if it can trust the buffer size.
|
||||||
*/
|
*/
|
||||||
if (mem->bo->size < aligned_alloc_size) {
|
if (mem->bo->size < aligned_alloc_size) {
|
||||||
result = vk_errorf(device->instance, device,
|
result = vk_errorf(device, device, VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
||||||
VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
|
||||||
"aligned allocationSize too large for "
|
"aligned allocationSize too large for "
|
||||||
"VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT: "
|
"VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT: "
|
||||||
"%"PRIu64"B > %"PRIu64"B",
|
"%"PRIu64"B > %"PRIu64"B",
|
||||||
@@ -3507,8 +3506,7 @@ VkResult anv_AllocateMemory(
|
|||||||
i915_tiling);
|
i915_tiling);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
anv_device_release_bo(device, mem->bo);
|
anv_device_release_bo(device, mem->bo);
|
||||||
result = vk_errorf(device->instance, NULL,
|
result = vk_errorf(device, device, VK_ERROR_OUT_OF_DEVICE_MEMORY,
|
||||||
VK_ERROR_OUT_OF_DEVICE_MEMORY,
|
|
||||||
"failed to set BO tiling: %m");
|
"failed to set BO tiling: %m");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@@ -3520,8 +3518,7 @@ VkResult anv_AllocateMemory(
|
|||||||
if (mem_heap_used > mem_heap->size) {
|
if (mem_heap_used > mem_heap->size) {
|
||||||
p_atomic_add(&mem_heap->used, -mem->bo->size);
|
p_atomic_add(&mem_heap->used, -mem->bo->size);
|
||||||
anv_device_release_bo(device, mem->bo);
|
anv_device_release_bo(device, mem->bo);
|
||||||
result = vk_errorf(device->instance, NULL,
|
result = vk_errorf(device, device, VK_ERROR_OUT_OF_DEVICE_MEMORY,
|
||||||
VK_ERROR_OUT_OF_DEVICE_MEMORY,
|
|
||||||
"Out of heap memory");
|
"Out of heap memory");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@@ -1160,10 +1160,10 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties2(
|
|||||||
* vkGetPhysicalDeviceImageFormatProperties2 returns
|
* vkGetPhysicalDeviceImageFormatProperties2 returns
|
||||||
* VK_ERROR_FORMAT_NOT_SUPPORTED.
|
* VK_ERROR_FORMAT_NOT_SUPPORTED.
|
||||||
*/
|
*/
|
||||||
result = vk_errorf(physical_device->instance, physical_device,
|
result = vk_errorfi(physical_device->instance, physical_device,
|
||||||
VK_ERROR_FORMAT_NOT_SUPPORTED,
|
VK_ERROR_FORMAT_NOT_SUPPORTED,
|
||||||
"unsupported VkExternalMemoryTypeFlagBits 0x%x",
|
"unsupported VkExternalMemoryTypeFlagBits 0x%x",
|
||||||
external_info->handleType);
|
external_info->handleType);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -82,8 +82,7 @@ VkResult anv_CreateDmaBufImageINTEL(
|
|||||||
VkDeviceSize aligned_image_size = align_u64(image->size, 4096);
|
VkDeviceSize aligned_image_size = align_u64(image->size, 4096);
|
||||||
|
|
||||||
if (mem->bo->size < aligned_image_size) {
|
if (mem->bo->size < aligned_image_size) {
|
||||||
result = vk_errorf(device->instance, device,
|
result = vk_errorf(device, device, VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
||||||
VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
|
||||||
"dma-buf too small for image in "
|
"dma-buf too small for image in "
|
||||||
"vkCreateDmaBufImageINTEL: %"PRIu64"B < %"PRIu64"B",
|
"vkCreateDmaBufImageINTEL: %"PRIu64"B < %"PRIu64"B",
|
||||||
mem->bo->size, aligned_image_size);
|
mem->bo->size, aligned_image_size);
|
||||||
|
@@ -448,15 +448,16 @@ VkResult __vk_errorf(struct anv_instance *instance, const void *object,
|
|||||||
#define vk_error(error) __vk_errorf(NULL, NULL,\
|
#define vk_error(error) __vk_errorf(NULL, NULL,\
|
||||||
VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT,\
|
VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT,\
|
||||||
error, __FILE__, __LINE__, NULL)
|
error, __FILE__, __LINE__, NULL)
|
||||||
#define vk_errorv(instance, obj, error, format, args)\
|
#define vk_errorfi(instance, obj, error, format, ...)\
|
||||||
__vk_errorv(instance, obj, REPORT_OBJECT_TYPE(obj), error,\
|
|
||||||
__FILE__, __LINE__, format, args)
|
|
||||||
#define vk_errorf(instance, obj, error, format, ...)\
|
|
||||||
__vk_errorf(instance, obj, REPORT_OBJECT_TYPE(obj), error,\
|
__vk_errorf(instance, obj, REPORT_OBJECT_TYPE(obj), error,\
|
||||||
__FILE__, __LINE__, format, ## __VA_ARGS__)
|
__FILE__, __LINE__, format, ## __VA_ARGS__)
|
||||||
|
#define vk_errorf(device, obj, error, format, ...)\
|
||||||
|
vk_errorfi(anv_device_instance_or_null(device),\
|
||||||
|
obj, error, format, ## __VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define vk_error(error) error
|
#define vk_error(error) error
|
||||||
#define vk_errorf(instance, obj, error, format, ...) error
|
#define vk_errorfi(instance, obj, error, format, ...) error
|
||||||
|
#define vk_errorf(device, obj, error, format, ...) error
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1270,6 +1271,12 @@ struct anv_device {
|
|||||||
struct gen_aux_map_context *aux_map_ctx;
|
struct gen_aux_map_context *aux_map_ctx;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline struct anv_instance *
|
||||||
|
anv_device_instance_or_null(const struct anv_device *device)
|
||||||
|
{
|
||||||
|
return device ? device->physical->instance : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static inline struct anv_state_pool *
|
static inline struct anv_state_pool *
|
||||||
anv_binding_table_pool(struct anv_device *device)
|
anv_binding_table_pool(struct anv_device *device)
|
||||||
{
|
{
|
||||||
|
@@ -1624,8 +1624,7 @@ VkResult anv_ImportFenceFdKHR(
|
|||||||
|
|
||||||
if (anv_gem_syncobj_import_sync_file(device, new_impl.syncobj, fd)) {
|
if (anv_gem_syncobj_import_sync_file(device, new_impl.syncobj, fd)) {
|
||||||
anv_gem_syncobj_destroy(device, new_impl.syncobj);
|
anv_gem_syncobj_destroy(device, new_impl.syncobj);
|
||||||
return vk_errorf(device->instance, NULL,
|
return vk_errorf(device, NULL, VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
||||||
VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
|
||||||
"syncobj sync file import failed: %m");
|
"syncobj sync file import failed: %m");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -2020,8 +2019,7 @@ VkResult anv_ImportSemaphoreFdKHR(
|
|||||||
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
if (anv_gem_syncobj_import_sync_file(device, new_impl.syncobj, fd)) {
|
if (anv_gem_syncobj_import_sync_file(device, new_impl.syncobj, fd)) {
|
||||||
anv_gem_syncobj_destroy(device, new_impl.syncobj);
|
anv_gem_syncobj_destroy(device, new_impl.syncobj);
|
||||||
return vk_errorf(device->instance, NULL,
|
return vk_errorf(device, NULL, VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
||||||
VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
|
||||||
"syncobj sync file import failed: %m");
|
"syncobj sync file import failed: %m");
|
||||||
}
|
}
|
||||||
/* Ownership of the FD is transfered to Anv. Since we don't need it
|
/* Ownership of the FD is transfered to Anv. Since we don't need it
|
||||||
|
@@ -3838,7 +3838,7 @@ verify_cmd_parser(const struct anv_device *device,
|
|||||||
const char *function)
|
const char *function)
|
||||||
{
|
{
|
||||||
if (device->physical->cmd_parser_version < required_version) {
|
if (device->physical->cmd_parser_version < required_version) {
|
||||||
return vk_errorf(device->instance, device->instance,
|
return vk_errorf(device, device->physical,
|
||||||
VK_ERROR_FEATURE_NOT_PRESENT,
|
VK_ERROR_FEATURE_NOT_PRESENT,
|
||||||
"cmd parser version %d is required for %s",
|
"cmd parser version %d is required for %s",
|
||||||
required_version, function);
|
required_version, function);
|
||||||
|
Reference in New Issue
Block a user