diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c index 7e6fb39cf7e..eab86a0807a 100644 --- a/src/intel/vulkan/anv_blorp.c +++ b/src/intel/vulkan/anv_blorp.c @@ -227,11 +227,13 @@ get_blorp_surf_for_anv_image(const struct anv_device *device, if (aux_usage != ISL_AUX_USAGE_NONE) { const struct anv_surface *aux_surface = &image->planes[plane].aux_surface; + const struct anv_address aux_addr = anv_image_get_aux_addr(device, image, plane); + blorp_surf->aux_surf = &aux_surface->isl, blorp_surf->aux_addr = (struct blorp_address) { - .buffer = image->planes[plane].address.bo, - .offset = image->planes[plane].address.offset + aux_surface->offset, - .mocs = anv_mocs(device, image->planes[plane].address.bo, 0), + .buffer = aux_addr.bo, + .offset = aux_addr.offset, + .mocs = anv_mocs(device, aux_addr.bo, 0), }; blorp_surf->aux_usage = aux_usage; diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index fcebe0f770f..53bc8d1abf5 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -1880,8 +1880,7 @@ anv_image_fill_surface_state(struct anv_device *device, struct anv_address aux_address = ANV_NULL_ADDRESS; if (aux_usage != ISL_AUX_USAGE_NONE) { - aux_address = anv_address_add(image->planes[plane].address, - aux_surface->offset); + aux_address = anv_image_get_aux_addr(device, image, plane); } state_inout->aux_address = aux_address; diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index f4abf6bfb82..c1b0d5f4d34 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -3894,6 +3894,19 @@ anv_image_aux_layers(const struct anv_image * const image, return MAX2(image->array_size, image->extent.depth >> miplevel); } +static inline struct anv_address +anv_image_get_aux_addr(UNUSED const struct anv_device *device, + const struct anv_image *image, + uint32_t plane) +{ + const struct anv_image_plane *p = &image->planes[plane]; + + if (p->aux_surface.isl.size_B == 0) + return ANV_NULL_ADDRESS; + + return anv_address_add(p->address, p->aux_surface.offset); +} + static inline struct anv_address anv_image_get_clear_color_addr(UNUSED const struct anv_device *device, const struct anv_image *image, diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 6fb09bba4d8..7eb901b6418 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -5087,15 +5087,16 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer) info.hiz_usage = cmd_buffer->state.attachments[ds].aux_usage; if (info.hiz_usage != ISL_AUX_USAGE_NONE) { assert(isl_aux_usage_has_hiz(info.hiz_usage)); - info.hiz_surf = &image->planes[depth_plane].aux_surface.isl; + struct anv_address hiz_addr = + anv_image_get_aux_addr(device, image, depth_plane); + + info.hiz_surf = &image->planes[depth_plane].aux_surface.isl; info.hiz_address = anv_batch_emit_reloc(&cmd_buffer->batch, dw + device->isl_dev.ds.hiz_offset / 4, - image->planes[depth_plane].address.bo, - image->planes[depth_plane].address.offset + - image->planes[depth_plane].aux_surface.offset); - + hiz_addr.bo, + hiz_addr.offset); info.depth_clear_value = ANV_HZ_FC_VAL; } }