anv: retain ccs image binding address

Memory can be free before images it is bound to. When unmapping the
CCS range in the AUX-TT, we cannot rely on the anv_bo::offset field
because the anv_bo might have been freed.

Just save the mapping address/size and use those values at unmapping
time.

Fixes an assert on CI with :

  dEQP-VK.synchronization.internally_synchronized_objects.pipeline_cache_graphics

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: e519e06f4b ("anv: add missing alignment for AUX-TT mapping")
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27304>
This commit is contained in:
Lionel Landwerlin
2024-01-26 18:06:36 +02:00
committed by Marge Bot
parent eead86ad8e
commit 9d31680e79
2 changed files with 13 additions and 12 deletions

View File

@@ -1767,18 +1767,11 @@ anv_image_finish(struct anv_image *image)
* mapping.
*/
for (int p = 0; p < image->n_planes; ++p) {
if (!image->planes[p].aux_tt.mapped)
continue;
const struct anv_address main_addr =
anv_image_address(image,
&image->planes[p].primary_surface.memory_range);
const struct isl_surf *surf =
&image->planes[p].primary_surface.isl;
intel_aux_map_del_mapping(device->aux_map_ctx,
anv_address_physical(main_addr),
surf->size_B);
if (image->planes[p].aux_tt.mapped) {
intel_aux_map_del_mapping(device->aux_map_ctx,
image->planes[p].aux_tt.addr,
image->planes[p].aux_tt.size);
}
}
if (image->from_gralloc) {
@@ -2271,6 +2264,8 @@ anv_image_map_aux_tt(struct anv_device *device,
anv_address_physical(main_addr),
anv_address_physical(aux_addr),
surf->size_B, format_bits)) {
image->planes[plane].aux_tt.addr = anv_address_physical(main_addr);
image->planes[plane].aux_tt.size = surf->size_B;
image->planes[plane].aux_tt.mapped = true;
return true;
}

View File

@@ -4835,6 +4835,12 @@ struct anv_image {
struct {
/** Whether the image has CCS data mapped through AUX-TT. */
bool mapped;
/** Main address of the mapping. */
uint64_t addr;
/** Size of the mapping. */
uint64_t size;
} aux_tt;
} planes[3];