if (!clear_color)
clear_color = &default_clear_color;
- const uint64_t address = image->planes[plane].bo_offset + surface->offset;
- const uint64_t aux_address = aux_usage == ISL_AUX_USAGE_NONE ?
- 0 : (image->planes[plane].bo_offset + aux_surface->offset);
-
- struct anv_address clear_address = { .bo = NULL };
- state_inout->clear_address = 0;
-
- if (device->info.gen >= 10 && aux_usage != ISL_AUX_USAGE_NONE) {
- if (aux_usage == ISL_AUX_USAGE_HIZ) {
- clear_address = (struct anv_address) { .bo = &device->hiz_clear_bo };
- } else {
- clear_address = anv_image_get_clear_color_addr(device, image, aspect);
- }
- }
+ const struct anv_address address = {
+ .bo = image->planes[plane].bo,
+ .offset = image->planes[plane].bo_offset + surface->offset,
+ };
if (view_usage == ISL_SURF_USAGE_STORAGE_BIT &&
!(flags & ANV_IMAGE_VIEW_STATE_STORAGE_WRITE_ONLY) &&
*/
assert(aux_usage == ISL_AUX_USAGE_NONE);
isl_buffer_fill_state(&device->isl_dev, state_inout->state.map,
- .address = address,
+ .address = anv_address_physical(address),
.size = surface->isl.size,
.format = ISL_FORMAT_RAW,
.stride = 1,
.mocs = device->default_mocs);
state_inout->address = address,
- state_inout->aux_address = 0;
- state_inout->clear_address = 0;
+ state_inout->aux_address = ANV_NULL_ADDRESS;
+ state_inout->clear_address = ANV_NULL_ADDRESS;
} else {
if (view_usage == ISL_SURF_USAGE_STORAGE_BIT &&
!(flags & ANV_IMAGE_VIEW_STATE_STORAGE_WRITE_ONLY)) {
}
}
+ state_inout->address = anv_address_add(address, offset_B);
+
+ 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,
+ };
+ }
+ state_inout->aux_address = aux_address;
+
+ struct anv_address clear_address = ANV_NULL_ADDRESS;
+ if (device->info.gen >= 10 && aux_usage != ISL_AUX_USAGE_NONE) {
+ if (aux_usage == ISL_AUX_USAGE_HIZ) {
+ clear_address = (struct anv_address) {
+ .bo = &device->hiz_clear_bo,
+ .offset = 0,
+ };
+ } else {
+ clear_address = anv_image_get_clear_color_addr(device, image, aspect);
+ }
+ }
+ state_inout->clear_address = clear_address;
+
isl_surf_fill_state(&device->isl_dev, state_inout->state.map,
.surf = isl_surf,
.view = &view,
- .address = address + offset_B,
+ .address = anv_address_physical(state_inout->address),
.clear_color = *clear_color,
.aux_surf = &aux_surface->isl,
.aux_usage = aux_usage,
- .aux_address = aux_address,
- .clear_address = clear_address.offset,
- .use_clear_address = clear_address.bo != NULL,
+ .aux_address = anv_address_physical(aux_address),
+ .clear_address = anv_address_physical(clear_address),
+ .use_clear_address = !anv_address_is_null(clear_address),
.mocs = device->default_mocs,
.x_offset_sa = tile_x_sa,
.y_offset_sa = tile_y_sa);
- state_inout->address = address + offset_B;
/* With the exception of gen8, the bottom 12 bits of the MCS base address
* are used to store other information. This should be ok, however,
*/
uint32_t *aux_addr_dw = state_inout->state.map +
device->isl_dev.ss.aux_addr_offset;
- assert((aux_address & 0xfff) == 0);
- assert(aux_address == (*aux_addr_dw & 0xfffff000));
- state_inout->aux_address = *aux_addr_dw;
+ assert((aux_address.offset & 0xfff) == 0);
+ state_inout->aux_address.offset |= *aux_addr_dw & 0xfff;
if (device->info.gen >= 10 && clear_address.bo) {
uint32_t *clear_addr_dw = state_inout->state.map +
device->isl_dev.ss.clear_color_state_offset;
assert((clear_address.offset & 0x3f) == 0);
- state_inout->clear_address = *clear_addr_dw;
+ state_inout->clear_address.offset |= *clear_addr_dw & 0x3f;
}
}
*
* This address is relative to the start of the BO.
*/
- uint64_t address;
+ struct anv_address address;
/* Address of the aux surface, if any
*
- * This field is 0 if and only if no aux surface exists.
+ * This field is ANV_NULL_ADDRESS if and only if no aux surface exists.
*
- * This address is relative to the start of the BO. With the exception of
- * gen8, the bottom 12 bits of this address include extra aux information.
+ * With the exception of gen8, the bottom 12 bits of this address' offset
+ * include extra aux information.
*/
- uint64_t aux_address;
+ struct anv_address aux_address;
/* Address of the clear color, if any
*
* This address is relative to the start of the BO.
*/
- uint64_t clear_address;
+ struct anv_address clear_address;
};
/**
static void
add_image_view_relocs(struct anv_cmd_buffer *cmd_buffer,
- const struct anv_image_view *image_view,
- const uint32_t plane,
struct anv_surface_state state)
{
const struct isl_device *isl_dev = &cmd_buffer->device->isl_dev;
- const struct anv_image *image = image_view->image;
- uint32_t image_plane = image_view->planes[plane].image_plane;
+ assert(!anv_address_is_null(state.address));
add_surface_state_reloc(cmd_buffer, state.state,
- image->planes[image_plane].bo, state.address);
+ state.address.bo, state.address.offset);
- if (state.aux_address) {
+ if (!anv_address_is_null(state.aux_address)) {
VkResult result =
anv_reloc_list_add(&cmd_buffer->surface_relocs,
&cmd_buffer->pool->alloc,
state.state.offset + isl_dev->ss.aux_addr_offset,
- image->planes[image_plane].bo, state.aux_address);
+ state.aux_address.bo, state.aux_address.offset);
if (result != VK_SUCCESS)
anv_batch_set_error(&cmd_buffer->batch, result);
}
- if (state.clear_address) {
+ if (!anv_address_is_null(state.clear_address)) {
VkResult result =
anv_reloc_list_add(&cmd_buffer->surface_relocs,
&cmd_buffer->pool->alloc,
state.state.offset +
isl_dev->ss.clear_color_state_offset,
- image->planes[image_plane].bo, state.clear_address);
+ state.clear_address.bo, state.clear_address.offset);
if (result != VK_SUCCESS)
anv_batch_set_error(&cmd_buffer->batch, result);
}
&state->attachments[i].color,
NULL);
- add_image_view_relocs(cmd_buffer, iview, 0,
- state->attachments[i].color);
+ add_image_view_relocs(cmd_buffer, state->attachments[i].color);
} else {
depth_stencil_attachment_compute_aux_usage(cmd_buffer->device,
state, i,
&state->attachments[i].input,
NULL);
- add_image_view_relocs(cmd_buffer, iview, 0,
- state->attachments[i].input);
+ add_image_view_relocs(cmd_buffer, state->attachments[i].input);
}
}
}
desc->image_view->planes[binding->plane].optimal_sampler_surface_state;
surface_state = sstate.state;
assert(surface_state.alloc_size);
- add_image_view_relocs(cmd_buffer, desc->image_view,
- binding->plane, sstate);
+ add_image_view_relocs(cmd_buffer, sstate);
break;
}
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
desc->image_view->planes[binding->plane].optimal_sampler_surface_state;
surface_state = sstate.state;
assert(surface_state.alloc_size);
- add_image_view_relocs(cmd_buffer, desc->image_view,
- binding->plane, sstate);
+ add_image_view_relocs(cmd_buffer, sstate);
} else {
/* For color input attachments, we create the surface state at
* vkBeginRenderPass time so that we can include aux and clear
: desc->image_view->planes[binding->plane].storage_surface_state;
surface_state = sstate.state;
assert(surface_state.alloc_size);
- add_image_view_relocs(cmd_buffer, desc->image_view,
- binding->plane, sstate);
+ add_image_view_relocs(cmd_buffer, sstate);
struct brw_image_param *image_param =
&cmd_buffer->state.push_constants[stage]->images[image++];