return VK_SUCCESS;
}
-uint64_t
+VkResult
anv_reloc_list_add(struct anv_reloc_list *list,
const VkAllocationCallbacks *alloc,
uint32_t offset, struct anv_bo *target_bo, uint32_t delta)
const uint32_t domain =
target_bo->is_winsys_bo ? I915_GEM_DOMAIN_RENDER : 0;
- anv_reloc_list_grow(list, alloc, 1);
- /* TODO: Handle failure */
+ VkResult result = anv_reloc_list_grow(list, alloc, 1);
+ if (result != VK_SUCCESS)
+ return result;
/* XXX: Can we use I915_EXEC_HANDLE_LUT? */
index = list->num_relocs++;
entry->write_domain = domain;
VG(VALGRIND_CHECK_MEM_IS_DEFINED(entry, sizeof(*entry)));
- return target_bo->offset + delta;
+ return VK_SUCCESS;
}
-static void
+static VkResult
anv_reloc_list_append(struct anv_reloc_list *list,
const VkAllocationCallbacks *alloc,
struct anv_reloc_list *other, uint32_t offset)
{
- anv_reloc_list_grow(list, alloc, other->num_relocs);
- /* TODO: Handle failure */
+ VkResult result = anv_reloc_list_grow(list, alloc, other->num_relocs);
+ if (result != VK_SUCCESS)
+ return result;
memcpy(&list->relocs[list->num_relocs], &other->relocs[0],
other->num_relocs * sizeof(other->relocs[0]));
list->relocs[i + list->num_relocs].offset += offset;
list->num_relocs += other->num_relocs;
+ return VK_SUCCESS;
}
/*-----------------------------------------------------------------------*
anv_batch_emit_reloc(struct anv_batch *batch,
void *location, struct anv_bo *bo, uint32_t delta)
{
- return anv_reloc_list_add(batch->relocs, batch->alloc,
- location - batch->start, bo, delta);
+ VkResult result = anv_reloc_list_add(batch->relocs, batch->alloc,
+ location - batch->start, bo, delta);
+ if (result != VK_SUCCESS) {
+ anv_batch_set_error(batch, result);
+ return 0;
+ }
+
+ return bo->offset + delta;
}
void
memcpy(batch->next, other->start, size);
offset = batch->next - batch->start;
- anv_reloc_list_append(batch->relocs, batch->alloc,
- other->relocs, offset);
+ VkResult result = anv_reloc_list_append(batch->relocs, batch->alloc,
+ other->relocs, offset);
+ if (result != VK_SUCCESS) {
+ anv_batch_set_error(batch, result);
+ return;
+ }
batch->next += size;
}
struct blorp_address address, uint32_t delta)
{
struct anv_cmd_buffer *cmd_buffer = batch->driver_batch;
- anv_reloc_list_add(&cmd_buffer->surface_relocs, &cmd_buffer->pool->alloc,
- ss_offset, address.buffer, address.offset + delta);
+ VkResult result =
+ anv_reloc_list_add(&cmd_buffer->surface_relocs, &cmd_buffer->pool->alloc,
+ ss_offset, address.buffer, address.offset + delta);
+ if (result != VK_SUCCESS)
+ anv_batch_set_error(&cmd_buffer->batch, result);
}
static void *
{
const struct isl_device *isl_dev = &cmd_buffer->device->isl_dev;
- anv_reloc_list_add(&cmd_buffer->surface_relocs, &cmd_buffer->pool->alloc,
- state.offset + isl_dev->ss.addr_offset, bo, offset);
+ VkResult result =
+ anv_reloc_list_add(&cmd_buffer->surface_relocs, &cmd_buffer->pool->alloc,
+ state.offset + isl_dev->ss.addr_offset, bo, offset);
+ if (result != VK_SUCCESS)
+ anv_batch_set_error(&cmd_buffer->batch, result);
}
static void
{
const struct isl_device *isl_dev = &cmd_buffer->device->isl_dev;
- anv_reloc_list_add(&cmd_buffer->surface_relocs, &cmd_buffer->pool->alloc,
- state.offset + isl_dev->ss.addr_offset,
- iview->bo, iview->offset);
+ add_surface_state_reloc(cmd_buffer, state, iview->bo, iview->offset);
if (aux_usage != ISL_AUX_USAGE_NONE) {
uint32_t aux_offset = iview->offset + iview->image->aux_surface.offset;
uint32_t *aux_addr_dw = state.map + isl_dev->ss.aux_addr_offset;
aux_offset += *aux_addr_dw & 0xfff;
- anv_reloc_list_add(&cmd_buffer->surface_relocs, &cmd_buffer->pool->alloc,
- state.offset + isl_dev->ss.aux_addr_offset,
- iview->bo, aux_offset);
+ VkResult result =
+ anv_reloc_list_add(&cmd_buffer->surface_relocs,
+ &cmd_buffer->pool->alloc,
+ state.offset + isl_dev->ss.aux_addr_offset,
+ iview->bo, aux_offset);
+ if (result != VK_SUCCESS)
+ anv_batch_set_error(&cmd_buffer->batch, result);
}
}