return VK_SUCCESS;
}
+#define READ_ONCE(x) (*(volatile __typeof__(x) *)&(x))
+
VkResult
anv_reloc_list_add(struct anv_reloc_list *list,
const VkAllocationCallbacks *alloc,
- uint32_t offset, struct anv_bo *target_bo, uint32_t delta)
+ uint32_t offset, struct anv_bo *target_bo, uint32_t delta,
+ uint64_t *address_u64_out)
{
struct drm_i915_gem_relocation_entry *entry;
int index;
+ uint64_t target_bo_offset = READ_ONCE(target_bo->offset);
+ if (address_u64_out)
+ *address_u64_out = target_bo_offset + delta;
+
if (target_bo->flags & EXEC_OBJECT_PINNED) {
if (list->deps == NULL) {
list->deps = _mesa_pointer_set_create(NULL);
entry->target_handle = target_bo->gem_handle;
entry->delta = delta;
entry->offset = offset;
- entry->presumed_offset = target_bo->offset;
+ entry->presumed_offset = target_bo_offset;
entry->read_domains = 0;
entry->write_domain = 0;
VG(VALGRIND_CHECK_MEM_IS_DEFINED(entry, sizeof(*entry)));
anv_batch_emit_reloc(struct anv_batch *batch,
void *location, struct anv_bo *bo, uint32_t delta)
{
+ uint64_t address_u64 = 0;
VkResult result = anv_reloc_list_add(batch->relocs, batch->alloc,
- location - batch->start, bo, delta);
+ location - batch->start, bo, delta,
+ &address_u64);
if (result != VK_SUCCESS) {
anv_batch_set_error(batch, result);
return 0;
}
- return bo->offset + delta;
+ return address_u64;
}
void
VkResult anv_reloc_list_add(struct anv_reloc_list *list,
const VkAllocationCallbacks *alloc,
uint32_t offset, struct anv_bo *target_bo,
- uint32_t delta);
+ uint32_t delta, uint64_t *address_u64_out);
struct anv_batch_bo {
/* Link in the anv_cmd_buffer.owned_batch_bos list */
struct blorp_address address, uint32_t delta)
{
struct anv_cmd_buffer *cmd_buffer = batch->driver_batch;
+ uint64_t address_u64 = 0;
VkResult result =
anv_reloc_list_add(&cmd_buffer->surface_relocs, &cmd_buffer->pool->alloc,
- ss_offset, address.buffer, address.offset + delta);
+ ss_offset, address.buffer, address.offset + delta,
+ &address_u64);
if (result != VK_SUCCESS)
anv_batch_set_error(&cmd_buffer->batch, result);
void *dest = anv_block_pool_map(
&cmd_buffer->device->surface_state_pool.block_pool, ss_offset);
- uint64_t val = ((struct anv_bo*)address.buffer)->offset + address.offset +
- delta;
- write_reloc(cmd_buffer->device, dest, val, false);
+ write_reloc(cmd_buffer->device, dest, address_u64, false);
}
static uint64_t
VkResult result =
anv_reloc_list_add(&cmd_buffer->surface_relocs, &cmd_buffer->pool->alloc,
state.offset + isl_dev->ss.addr_offset,
- addr.bo, addr.offset);
+ addr.bo, addr.offset, NULL);
if (result != VK_SUCCESS)
anv_batch_set_error(&cmd_buffer->batch, result);
}
anv_reloc_list_add(&cmd_buffer->surface_relocs,
&cmd_buffer->pool->alloc,
state.state.offset + isl_dev->ss.aux_addr_offset,
- state.aux_address.bo, state.aux_address.offset);
+ state.aux_address.bo,
+ state.aux_address.offset,
+ NULL);
if (result != VK_SUCCESS)
anv_batch_set_error(&cmd_buffer->batch, result);
}
&cmd_buffer->pool->alloc,
state.state.offset +
isl_dev->ss.clear_color_state_offset,
- state.clear_address.bo, state.clear_address.offset);
+ state.clear_address.bo,
+ state.clear_address.offset,
+ NULL);
if (result != VK_SUCCESS)
anv_batch_set_error(&cmd_buffer->batch, result);
}