Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>tags/18.2-branchpoint
@@ -154,8 +154,8 @@ get_blorp_surf_for_anv_buffer(struct anv_device *device, | |||
*blorp_surf = (struct blorp_surf) { | |||
.surf = isl_surf, | |||
.addr = { | |||
.buffer = buffer->bo, | |||
.offset = buffer->offset + offset, | |||
.buffer = buffer->address.bo, | |||
.offset = buffer->address.offset + offset, | |||
.mocs = device->default_mocs, | |||
}, | |||
}; | |||
@@ -662,13 +662,13 @@ void anv_CmdCopyBuffer( | |||
for (unsigned r = 0; r < regionCount; r++) { | |||
struct blorp_address src = { | |||
.buffer = src_buffer->bo, | |||
.offset = src_buffer->offset + pRegions[r].srcOffset, | |||
.buffer = src_buffer->address.bo, | |||
.offset = src_buffer->address.offset + pRegions[r].srcOffset, | |||
.mocs = cmd_buffer->device->default_mocs, | |||
}; | |||
struct blorp_address dst = { | |||
.buffer = dst_buffer->bo, | |||
.offset = dst_buffer->offset + pRegions[r].dstOffset, | |||
.buffer = dst_buffer->address.bo, | |||
.offset = dst_buffer->address.offset + pRegions[r].dstOffset, | |||
.mocs = cmd_buffer->device->default_mocs, | |||
}; | |||
@@ -720,8 +720,8 @@ void anv_CmdUpdateBuffer( | |||
.mocs = cmd_buffer->device->default_mocs, | |||
}; | |||
struct blorp_address dst = { | |||
.buffer = dst_buffer->bo, | |||
.offset = dst_buffer->offset + dstOffset, | |||
.buffer = dst_buffer->address.bo, | |||
.offset = dst_buffer->address.offset + dstOffset, | |||
.mocs = cmd_buffer->device->default_mocs, | |||
}; | |||
@@ -746,10 +746,7 @@ anv_descriptor_set_write_buffer(struct anv_descriptor_set *set, | |||
bview->format = anv_isl_format_for_descriptor_type(type); | |||
bview->range = anv_buffer_get_range(buffer, offset, range); | |||
bview->address = (struct anv_address) { | |||
.bo = buffer->bo, | |||
.offset = buffer->offset + offset, | |||
}; | |||
bview->address = anv_address_add(buffer->address, offset); | |||
/* If we're writing descriptors through a push command, we need to | |||
* allocate the surface state from the command buffer. Otherwise it will |
@@ -2516,11 +2516,12 @@ anv_bind_buffer_memory(const VkBindBufferMemoryInfo *pBindInfo) | |||
if (mem) { | |||
assert((buffer->usage & mem->type->valid_buffer_usage) == buffer->usage); | |||
buffer->bo = mem->bo; | |||
buffer->offset = pBindInfo->memoryOffset; | |||
buffer->address = (struct anv_address) { | |||
.bo = mem->bo, | |||
.offset = pBindInfo->memoryOffset, | |||
}; | |||
} else { | |||
buffer->bo = NULL; | |||
buffer->offset = 0; | |||
buffer->address = ANV_NULL_ADDRESS; | |||
} | |||
} | |||
@@ -2686,8 +2687,7 @@ VkResult anv_CreateBuffer( | |||
buffer->size = pCreateInfo->size; | |||
buffer->usage = pCreateInfo->usage; | |||
buffer->bo = NULL; | |||
buffer->offset = 0; | |||
buffer->address = ANV_NULL_ADDRESS; | |||
*pBuffer = anv_buffer_to_handle(buffer); | |||
@@ -1471,10 +1471,7 @@ anv_CreateBufferView(VkDevice _device, | |||
pCreateInfo->range); | |||
view->range = align_down_npot_u32(view->range, format_bs); | |||
view->address = (struct anv_address) { | |||
.bo = buffer->bo, | |||
.offset = buffer->offset + pCreateInfo->offset, | |||
}; | |||
view->address = anv_address_add(buffer->address, pCreateInfo->offset); | |||
if (buffer->usage & VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT) { | |||
view->surface_state = alloc_surface_state(device); |
@@ -1558,8 +1558,7 @@ struct anv_buffer { | |||
VkBufferUsageFlags usage; | |||
/* Set when bound */ | |||
struct anv_bo * bo; | |||
VkDeviceSize offset; | |||
struct anv_address address; | |||
}; | |||
static inline uint64_t |
@@ -247,10 +247,10 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer) | |||
ib.IndexFormat = cmd_buffer->state.gfx.gen7.index_type; | |||
ib.MemoryObjectControlState = GENX(MOCS); | |||
ib.BufferStartingAddress = | |||
(struct anv_address) { buffer->bo, buffer->offset + offset }; | |||
ib.BufferEndingAddress = | |||
(struct anv_address) { buffer->bo, buffer->offset + buffer->size }; | |||
ib.BufferStartingAddress = anv_address_add(buffer->address, | |||
offset); | |||
ib.BufferEndingAddress = anv_address_add(buffer->address, | |||
buffer->size); | |||
} | |||
} | |||
@@ -566,8 +566,7 @@ void genX(CmdBindIndexBuffer)( | |||
anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_INDEX_BUFFER), ib) { | |||
ib.IndexFormat = vk_to_gen_index_type[indexType]; | |||
ib.MemoryObjectControlState = GENX(MOCS); | |||
ib.BufferStartingAddress = | |||
(struct anv_address) { buffer->bo, buffer->offset + offset }; | |||
ib.BufferStartingAddress = anv_address_add(buffer->address, offset); | |||
ib.BufferSize = buffer->size - offset; | |||
} | |||
@@ -2112,10 +2112,8 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer, | |||
/* Clamp the range to the buffer size */ | |||
uint32_t range = MIN2(desc->range, desc->buffer->size - offset); | |||
struct anv_address address = { | |||
.bo = desc->buffer->bo, | |||
.offset = desc->buffer->offset + offset, | |||
}; | |||
struct anv_address address = | |||
anv_address_add(desc->buffer->address, offset); | |||
surface_state = | |||
anv_state_stream_alloc(&cmd_buffer->surface_state_stream, 64, 64); | |||
@@ -2409,11 +2407,8 @@ cmd_buffer_flush_push_constants(struct anv_cmd_buffer *cmd_buffer, | |||
read_len = MIN2(range->length, | |||
DIV_ROUND_UP(buf_range, 32) - range->start); | |||
read_addr = (struct anv_address) { | |||
.bo = desc->buffer->bo, | |||
.offset = desc->buffer->offset + buf_offset + | |||
range->start * 32, | |||
}; | |||
read_addr = anv_address_add(desc->buffer->address, | |||
buf_offset + range->start * 32); | |||
} | |||
if (read_len > 0) { | |||
@@ -2501,12 +2496,12 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer) | |||
.AddressModifyEnable = true, | |||
.BufferPitch = pipeline->binding_stride[vb], | |||
.BufferStartingAddress = { buffer->bo, buffer->offset + offset }, | |||
.BufferStartingAddress = anv_address_add(buffer->address, offset), | |||
#if GEN_GEN >= 8 | |||
.BufferSize = buffer->size - offset | |||
#else | |||
.EndAddress = { buffer->bo, buffer->offset + buffer->size - 1}, | |||
.EndAddress = anv_address_add(buffer->address, buffer->size - 1), | |||
#endif | |||
}; | |||
@@ -2857,10 +2852,7 @@ void genX(CmdDrawIndirect)( | |||
genX(cmd_buffer_flush_state)(cmd_buffer); | |||
for (uint32_t i = 0; i < drawCount; i++) { | |||
struct anv_address draw = { | |||
.bo = buffer->bo, | |||
.offset = buffer->offset + offset, | |||
}; | |||
struct anv_address draw = anv_address_add(buffer->address, offset); | |||
if (vs_prog_data->uses_firstvertex || | |||
vs_prog_data->uses_baseinstance) | |||
@@ -2898,10 +2890,7 @@ void genX(CmdDrawIndexedIndirect)( | |||
genX(cmd_buffer_flush_state)(cmd_buffer); | |||
for (uint32_t i = 0; i < drawCount; i++) { | |||
struct anv_address draw = { | |||
.bo = buffer->bo, | |||
.offset = buffer->offset + offset, | |||
}; | |||
struct anv_address draw = anv_address_add(buffer->address, offset); | |||
/* TODO: We need to stomp base vertex to 0 somehow */ | |||
if (vs_prog_data->uses_firstvertex || | |||
@@ -3153,10 +3142,7 @@ void genX(CmdDispatchIndirect)( | |||
ANV_FROM_HANDLE(anv_buffer, buffer, _buffer); | |||
struct anv_pipeline *pipeline = cmd_buffer->state.compute.base.pipeline; | |||
const struct brw_cs_prog_data *prog_data = get_cs_prog_data(pipeline); | |||
struct anv_address addr = { | |||
.bo = buffer->bo, | |||
.offset = buffer->offset + offset, | |||
}; | |||
struct anv_address addr = anv_address_add(buffer->address, offset); | |||
struct anv_batch *batch = &cmd_buffer->batch; | |||
anv_cmd_buffer_push_base_group_id(cmd_buffer, 0, 0, 0); |
@@ -686,19 +686,14 @@ gpu_write_query_result(struct anv_batch *batch, | |||
anv_batch_emit(batch, GENX(MI_STORE_REGISTER_MEM), srm) { | |||
srm.RegisterAddress = reg; | |||
srm.MemoryAddress = (struct anv_address) { | |||
.bo = dst_buffer->bo, | |||
.offset = dst_buffer->offset + dst_offset, | |||
}; | |||
srm.MemoryAddress = anv_address_add(dst_buffer->address, dst_offset); | |||
} | |||
if (flags & VK_QUERY_RESULT_64_BIT) { | |||
anv_batch_emit(batch, GENX(MI_STORE_REGISTER_MEM), srm) { | |||
srm.RegisterAddress = reg + 4; | |||
srm.MemoryAddress = (struct anv_address) { | |||
.bo = dst_buffer->bo, | |||
.offset = dst_buffer->offset + dst_offset + 4, | |||
}; | |||
srm.MemoryAddress = anv_address_add(dst_buffer->address, | |||
dst_offset + 4); | |||
} | |||
} | |||
} |