diff options
author | Lionel Landwerlin <[email protected]> | 2019-10-21 17:17:44 +0300 |
---|---|---|
committer | Jordan Justen <[email protected]> | 2019-10-28 00:09:14 -0700 |
commit | 6af8a4acc4a4a30608d221b80ac3aa848db309a7 (patch) | |
tree | d89baca3404f754e1a59772924d7c8f8f1d7763a /src/intel | |
parent | 7737f56544160193bae979d28da8801ab0e5e1cd (diff) |
anv: Add aux-map translation for gen12+
Signed-off-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/vulkan/anv_image.c | 28 | ||||
-rw-r--r-- | src/intel/vulkan/anv_private.h | 16 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index bd00bc83e13..84b9fde0751 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -34,6 +34,8 @@ #include "vk_util.h" #include "util/u_math.h" +#include "common/gen_aux_map.h" + #include "vk_format_info.h" static isl_surf_usage_flags_t @@ -778,6 +780,12 @@ anv_DestroyImage(VkDevice _device, VkImage _image, return; for (uint32_t p = 0; p < image->n_planes; ++p) { + if (anv_image_plane_uses_aux_map(device, image, p) && + image->planes[p].address.bo) { + gen_aux_map_unmap_range(device->aux_map_ctx, + image->planes[p].aux_map_surface_address, + image->planes[p].surface.isl.size_B); + } if (image->planes[p].bo_is_owned) { assert(image->planes[p].address.bo != NULL); anv_bo_cache_release(device, &device->bo_cache, @@ -797,6 +805,12 @@ static void anv_image_bind_memory_plane(struct anv_device *device, assert(!image->planes[plane].bo_is_owned); if (!memory) { + if (anv_image_plane_uses_aux_map(device, image, plane) && + image->planes[plane].address.bo) { + gen_aux_map_unmap_range(device->aux_map_ctx, + image->planes[plane].aux_map_surface_address, + image->planes[plane].surface.isl.size_B); + } image->planes[plane].address = ANV_NULL_ADDRESS; return; } @@ -805,6 +819,20 @@ static void anv_image_bind_memory_plane(struct anv_device *device, .bo = memory->bo, .offset = memory_offset, }; + + if (anv_image_plane_uses_aux_map(device, image, plane)) { + image->planes[plane].aux_map_surface_address = + anv_address_physical( + anv_address_add(image->planes[plane].address, + image->planes[plane].surface.offset)); + + gen_aux_map_add_image(device->aux_map_ctx, + &image->planes[plane].surface.isl, + image->planes[plane].aux_map_surface_address, + anv_address_physical( + anv_address_add(image->planes[plane].address, + image->planes[plane].aux_surface.offset))); + } } /* We are binding AHardwareBuffer. Get a description, resolve the diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 7e83db04346..ef246e4612e 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -3203,6 +3203,13 @@ struct anv_image { struct anv_address address; /** + * Address of the main surface used to fill the aux map table. This is + * used at destruction of the image since the Vulkan spec does not + * guarantee that the address.bo field we still be valid at destruction. + */ + uint64_t aux_map_surface_address; + + /** * When destroying the image, also free the bo. * */ bool bo_is_owned; @@ -3324,6 +3331,15 @@ anv_can_sample_with_hiz(const struct gen_device_info * const devinfo, return image->samples == 1; } +static inline bool +anv_image_plane_uses_aux_map(const struct anv_device *device, + const struct anv_image *image, + uint32_t plane) +{ + return device->info.has_aux_map && + isl_aux_usage_has_ccs(image->planes[plane].aux_usage); +} + void anv_cmd_buffer_mark_image_written(struct anv_cmd_buffer *cmd_buffer, const struct anv_image *image, |