anv: handle memory allocation errors during queue submissions
authorIago Toral Quiroga <itoral@igalia.com>
Mon, 6 Mar 2017 11:04:19 +0000 (12:04 +0100)
committerIago Toral Quiroga <itoral@igalia.com>
Thu, 16 Mar 2017 10:40:05 +0000 (11:40 +0100)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/intel/vulkan/anv_batch_chain.c

index abd0c171aaa8c9d6396e753b59d6fa558eb77b16..655182db260a8e3ed7bced8941cb7cdf60a902e1 100644 (file)
@@ -1259,8 +1259,11 @@ anv_cmd_buffer_execbuf(struct anv_device *device,
 
    adjust_relocations_from_state_pool(ss_pool, &cmd_buffer->surface_relocs,
                                       cmd_buffer->last_ss_pool_center);
-   anv_execbuf_add_bo(&execbuf, &ss_pool->bo, &cmd_buffer->surface_relocs,
-                      &cmd_buffer->pool->alloc);
+   VkResult result =
+      anv_execbuf_add_bo(&execbuf, &ss_pool->bo, &cmd_buffer->surface_relocs,
+                         &cmd_buffer->pool->alloc);
+   if (result != VK_SUCCESS)
+      return result;
 
    /* First, we walk over all of the bos we've seen and add them and their
     * relocations to the validate list.
@@ -1376,7 +1379,7 @@ anv_cmd_buffer_execbuf(struct anv_device *device,
          cmd_buffer->surface_relocs.relocs[i].presumed_offset = -1;
    }
 
-   VkResult result = anv_device_execbuf(device, &execbuf.execbuf, execbuf.bos);
+   result = anv_device_execbuf(device, &execbuf.execbuf, execbuf.bos);
 
    anv_execbuf_finish(&execbuf, &cmd_buffer->pool->alloc);