#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
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,
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;
}
.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
*/
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.
* */
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,