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>
(cherry picked from commit 9d31680e79ad1aa3a91e917a9e3d615453203298)
This commit is contained in:
Lionel Landwerlin 2024-01-26 18:06:36 +02:00 committed by Eric Engestrom
parent 8be6eab836
commit 5f7921620e
3 changed files with 14 additions and 13 deletions

View file

@ -564,7 +564,7 @@
"description": "anv: retain ccs image binding address",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "e519e06f4b274fabf9302626c6e63d084372c1ea",
"notes": null

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) {
@ -2267,6 +2260,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

@ -5019,6 +5019,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];