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:
Chad Versace
2020-09-22 11:23:13 -07:00
parent 5fa0e5b87d
commit 87dc3106b0
4 changed files with 25 additions and 10 deletions

View File

@@ -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,