anv/image: Define anv_image_get_aux_addr (v3)
Simple refactor. No intended change in behavior. Replace each derivation of aux address with anv_image_get_aux_addr(). The function will soon do more in support of VK_EXT_image_drm_format_modifier, where the image bo and aux bo may be disjoint. v2: - Replace param 'aspect' with 'plane'. v3: - Workaround for stencil ccs. If no aux surface, then return ANV_NULL_ADDRESS. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> (v2) Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> (v3)
This commit is contained in:
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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,
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user