This is better than having BO and offset fields.
Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
*blorp_surf = (struct blorp_surf) {
.surf = &surface->isl,
.addr = {
- .buffer = image->planes[plane].bo,
- .offset = image->planes[plane].bo_offset + surface->offset,
+ .buffer = image->planes[plane].address.bo,
+ .offset = image->planes[plane].address.offset + surface->offset,
.mocs = device->default_mocs,
},
};
const struct anv_surface *aux_surface = &image->planes[plane].aux_surface;
blorp_surf->aux_surf = &aux_surface->isl,
blorp_surf->aux_addr = (struct blorp_address) {
- .buffer = image->planes[plane].bo,
- .offset = image->planes[plane].bo_offset + aux_surface->offset,
+ .buffer = image->planes[plane].address.bo,
+ .offset = image->planes[plane].address.offset + aux_surface->offset,
.mocs = device->default_mocs,
};
blorp_surf->aux_usage = aux_usage;
struct blorp_surf shadow_surf = {
.surf = &image->planes[0].shadow_surface.isl,
.addr = {
- .buffer = image->planes[0].bo,
- .offset = image->planes[0].bo_offset +
+ .buffer = image->planes[0].address.bo,
+ .offset = image->planes[0].address.offset +
image->planes[0].shadow_surface.offset,
.mocs = cmd_buffer->device->default_mocs,
},
for (uint32_t p = 0; p < image->n_planes; ++p) {
if (image->planes[p].bo_is_owned) {
- assert(image->planes[p].bo != NULL);
- anv_bo_cache_release(device, &device->bo_cache, image->planes[p].bo);
+ assert(image->planes[p].address.bo != NULL);
+ anv_bo_cache_release(device, &device->bo_cache,
+ image->planes[p].address.bo);
}
}
assert(!image->planes[plane].bo_is_owned);
if (!memory) {
- image->planes[plane].bo = NULL;
- image->planes[plane].bo_offset = 0;
+ image->planes[plane].address = ANV_NULL_ADDRESS;
return;
}
- image->planes[plane].bo = memory->bo;
- image->planes[plane].bo_offset = memory_offset;
+ image->planes[plane].address = (struct anv_address) {
+ .bo = memory->bo,
+ .offset = memory_offset,
+ };
}
VkResult anv_BindImageMemory(
if (!clear_color)
clear_color = &default_clear_color;
- const struct anv_address address = {
- .bo = image->planes[plane].bo,
- .offset = image->planes[plane].bo_offset + surface->offset,
- };
+ const struct anv_address address =
+ anv_address_add(image->planes[plane].address, surface->offset);
if (view_usage == ISL_SURF_USAGE_STORAGE_BIT &&
!(flags & ANV_IMAGE_VIEW_STATE_STORAGE_WRITE_ONLY) &&
struct anv_address aux_address = ANV_NULL_ADDRESS;
if (aux_usage != ISL_AUX_USAGE_NONE) {
- aux_address = (struct anv_address) {
- .bo = image->planes[plane].bo,
- .offset = image->planes[plane].bo_offset + aux_surface->offset,
- };
+ aux_address = anv_address_add(image->planes[plane].address,
+ aux_surface->offset);
}
state_inout->aux_address = aux_address;
if (device->instance->physicalDevice.supports_48bit_addresses)
mem->bo->flags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
- image->planes[0].bo = mem->bo;
- image->planes[0].bo_offset = 0;
+ image->planes[0].address = (struct anv_address) {
+ .bo = mem->bo,
+ .offset = 0,
+ };
assert(image->extent.width > 0);
assert(image->extent.height > 0);
/**
* BO associated with this plane, set when bound.
*/
- struct anv_bo *bo;
- VkDeviceSize bo_offset;
+ struct anv_address address;
/**
* When destroying the image, also free the bo.
assert(image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV);
uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect);
- return (struct anv_address) {
- .bo = image->planes[plane].bo,
- .offset = image->planes[plane].bo_offset +
- image->planes[plane].fast_clear_state_offset,
- };
+ return anv_address_add(image->planes[plane].address,
+ image->planes[plane].fast_clear_state_offset);
}
static inline struct anv_address
info.depth_address =
anv_batch_emit_reloc(&cmd_buffer->batch,
dw + device->isl_dev.ds.depth_offset / 4,
- image->planes[depth_plane].bo,
- image->planes[depth_plane].bo_offset +
+ image->planes[depth_plane].address.bo,
+ image->planes[depth_plane].address.offset +
surface->offset);
const uint32_t ds =
info.hiz_address =
anv_batch_emit_reloc(&cmd_buffer->batch,
dw + device->isl_dev.ds.hiz_offset / 4,
- image->planes[depth_plane].bo,
- image->planes[depth_plane].bo_offset +
+ image->planes[depth_plane].address.bo,
+ image->planes[depth_plane].address.offset +
image->planes[depth_plane].aux_surface.offset);
info.depth_clear_value = ANV_HZ_FC_VAL;
info.stencil_address =
anv_batch_emit_reloc(&cmd_buffer->batch,
dw + device->isl_dev.ds.stencil_offset / 4,
- image->planes[stencil_plane].bo,
- image->planes[stencil_plane].bo_offset + surface->offset);
+ image->planes[stencil_plane].address.bo,
+ image->planes[stencil_plane].address.offset +
+ surface->offset);
}
isl_emit_depth_stencil_hiz_s(&device->isl_dev, dw, &info);