From 5f7921620efc100e55416bf11b2adf522f8ced05 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Fri, 26 Jan 2024 18:06:36 +0200 Subject: [PATCH] anv: retain ccs image binding address MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Fixes: e519e06f4b ("anv: add missing alignment for AUX-TT mapping") Reviewed-by: Tapani Pälli Part-of: (cherry picked from commit 9d31680e79ad1aa3a91e917a9e3d615453203298) --- .pick_status.json | 2 +- src/intel/vulkan/anv_image.c | 19 +++++++------------ src/intel/vulkan/anv_private.h | 6 ++++++ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index fe9bb3f7978..98d267285f6 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -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 diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index 3cc1fe98afe..6ead10079b2 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -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; } diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index f35c7f25586..778d2b2c9cb 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -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];