assert(ok);
}
-#define ANV_AUX_USAGE_DEFAULT ((enum isl_aux_usage)0xff)
+/* Pick something high enough that it won't be used in core and low enough it
+ * will never map to an extension.
+ */
+#define ANV_IMAGE_LAYOUT_EXPLICIT_AUX (VkImageLayout)10000000
static struct blorp_address
anv_to_blorp_address(struct anv_address addr)
get_blorp_surf_for_anv_image(const struct anv_device *device,
const struct anv_image *image,
VkImageAspectFlags aspect,
+ VkImageLayout layout,
enum isl_aux_usage aux_usage,
struct blorp_surf *blorp_surf)
{
uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect);
- if (aux_usage == ANV_AUX_USAGE_DEFAULT) {
- aux_usage = image->planes[plane].aux_usage;
-
- /* Blorp copies and blits can't handle HiZ so disable it by default */
- if (aux_usage == ISL_AUX_USAGE_HIZ)
- aux_usage = ISL_AUX_USAGE_NONE;
- }
+ if (layout != ANV_IMAGE_LAYOUT_EXPLICIT_AUX)
+ aux_usage = anv_layout_to_aux_usage(&device->info, image, aspect, layout);
const struct anv_surface *surface = &image->planes[plane].surface;
*blorp_surf = (struct blorp_surf) {
struct blorp_surf src_surf, dst_surf;
get_blorp_surf_for_anv_image(cmd_buffer->device,
src_image, 1UL << aspect_bit,
- ANV_AUX_USAGE_DEFAULT, &src_surf);
+ srcImageLayout, ISL_AUX_USAGE_NONE,
+ &src_surf);
get_blorp_surf_for_anv_image(cmd_buffer->device,
dst_image, 1UL << aspect_bit,
- ANV_AUX_USAGE_DEFAULT, &dst_surf);
+ dstImageLayout, ISL_AUX_USAGE_NONE,
+ &dst_surf);
anv_cmd_buffer_mark_image_written(cmd_buffer, dst_image,
1UL << aspect_bit,
dst_surf.aux_usage, dst_level,
} else {
struct blorp_surf src_surf, dst_surf;
get_blorp_surf_for_anv_image(cmd_buffer->device, src_image, src_mask,
- ANV_AUX_USAGE_DEFAULT, &src_surf);
+ srcImageLayout, ISL_AUX_USAGE_NONE,
+ &src_surf);
get_blorp_surf_for_anv_image(cmd_buffer->device, dst_image, dst_mask,
- ANV_AUX_USAGE_DEFAULT, &dst_surf);
+ dstImageLayout, ISL_AUX_USAGE_NONE,
+ &dst_surf);
anv_cmd_buffer_mark_image_written(cmd_buffer, dst_image, dst_mask,
dst_surf.aux_usage, dst_level,
dst_base_layer, layer_count);
copy_buffer_to_image(struct anv_cmd_buffer *cmd_buffer,
struct anv_buffer *anv_buffer,
struct anv_image *anv_image,
+ VkImageLayout image_layout,
uint32_t regionCount,
const VkBufferImageCopy* pRegions,
bool buffer_to_image)
const VkImageAspectFlags aspect = pRegions[r].imageSubresource.aspectMask;
get_blorp_surf_for_anv_image(cmd_buffer->device, anv_image, aspect,
- ANV_AUX_USAGE_DEFAULT, &image.surf);
+ image_layout, ISL_AUX_USAGE_NONE,
+ &image.surf);
image.offset =
anv_sanitize_image_offset(anv_image->type, pRegions[r].imageOffset);
image.level = pRegions[r].imageSubresource.mipLevel;
ANV_FROM_HANDLE(anv_buffer, src_buffer, srcBuffer);
ANV_FROM_HANDLE(anv_image, dst_image, dstImage);
- copy_buffer_to_image(cmd_buffer, src_buffer, dst_image,
+ copy_buffer_to_image(cmd_buffer, src_buffer, dst_image, dstImageLayout,
regionCount, pRegions, true);
}
ANV_FROM_HANDLE(anv_image, src_image, srcImage);
ANV_FROM_HANDLE(anv_buffer, dst_buffer, dstBuffer);
- copy_buffer_to_image(cmd_buffer, dst_buffer, src_image,
+ copy_buffer_to_image(cmd_buffer, dst_buffer, src_image, srcImageLayout,
regionCount, pRegions, false);
}
get_blorp_surf_for_anv_image(cmd_buffer->device,
src_image, src_res->aspectMask,
- ANV_AUX_USAGE_DEFAULT, &src);
+ srcImageLayout, ISL_AUX_USAGE_NONE, &src);
get_blorp_surf_for_anv_image(cmd_buffer->device,
dst_image, dst_res->aspectMask,
- ANV_AUX_USAGE_DEFAULT, &dst);
+ dstImageLayout, ISL_AUX_USAGE_NONE, &dst);
struct anv_format_plane src_format =
anv_get_format_plane(&cmd_buffer->device->info, src_image->vk_format,
struct blorp_surf surf;
get_blorp_surf_for_anv_image(cmd_buffer->device,
image, pRanges[r].aspectMask,
- ANV_AUX_USAGE_DEFAULT, &surf);
+ imageLayout, ISL_AUX_USAGE_NONE, &surf);
struct anv_format_plane src_format =
anv_get_format_plane(&cmd_buffer->device->info, image->vk_format,
if (image->aspects & VK_IMAGE_ASPECT_DEPTH_BIT) {
get_blorp_surf_for_anv_image(cmd_buffer->device,
image, VK_IMAGE_ASPECT_DEPTH_BIT,
- ISL_AUX_USAGE_NONE, &depth);
+ imageLayout, ISL_AUX_USAGE_NONE, &depth);
} else {
memset(&depth, 0, sizeof(depth));
}
if (image->aspects & VK_IMAGE_ASPECT_STENCIL_BIT) {
get_blorp_surf_for_anv_image(cmd_buffer->device,
image, VK_IMAGE_ASPECT_STENCIL_BIT,
- ISL_AUX_USAGE_NONE, &stencil);
+ imageLayout, ISL_AUX_USAGE_NONE, &stencil);
} else {
memset(&stencil, 0, sizeof(stencil));
}
resolve_image(struct anv_device *device,
struct blorp_batch *batch,
const struct anv_image *src_image,
+ VkImageLayout src_image_layout,
uint32_t src_level, uint32_t src_layer,
const struct anv_image *dst_image,
+ VkImageLayout dst_image_layout,
uint32_t dst_level, uint32_t dst_layer,
VkImageAspectFlags aspect_mask,
uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y,
anv_foreach_image_aspect_bit(aspect_bit, src_image, aspect_mask) {
struct blorp_surf src_surf, dst_surf;
get_blorp_surf_for_anv_image(device, src_image, 1UL << aspect_bit,
- ANV_AUX_USAGE_DEFAULT, &src_surf);
+ src_image_layout, ISL_AUX_USAGE_NONE,
+ &src_surf);
get_blorp_surf_for_anv_image(device, dst_image, 1UL << aspect_bit,
- ANV_AUX_USAGE_DEFAULT, &dst_surf);
+ dst_image_layout, ISL_AUX_USAGE_NONE,
+ &dst_surf);
anv_cmd_buffer_mark_image_written(cmd_buffer, dst_image,
1UL << aspect_bit,
dst_surf.aux_usage,
for (uint32_t layer = 0; layer < layer_count; layer++) {
resolve_image(cmd_buffer->device, &batch,
- src_image,
+ src_image, srcImageLayout,
pRegions[r].srcSubresource.mipLevel,
pRegions[r].srcSubresource.baseArrayLayer + layer,
- dst_image,
+ dst_image, dstImageLayout,
pRegions[r].dstSubresource.mipLevel,
pRegions[r].dstSubresource.baseArrayLayer + layer,
pRegions[r].dstSubresource.aspectMask,
struct blorp_surf src_surf, dst_surf;
get_blorp_surf_for_anv_image(cmd_buffer->device, src_iview->image,
VK_IMAGE_ASPECT_COLOR_BIT,
+ ANV_IMAGE_LAYOUT_EXPLICIT_AUX,
src_aux_usage, &src_surf);
get_blorp_surf_for_anv_image(cmd_buffer->device, dst_iview->image,
VK_IMAGE_ASPECT_COLOR_BIT,
+ ANV_IMAGE_LAYOUT_EXPLICIT_AUX,
dst_aux_usage, &dst_surf);
anv_cmd_buffer_mark_image_written(cmd_buffer, dst_iview->image,
VK_IMAGE_ASPECT_COLOR_BIT,
struct blorp_surf surf;
get_blorp_surf_for_anv_image(cmd_buffer->device,
image, VK_IMAGE_ASPECT_COLOR_BIT,
+ VK_IMAGE_LAYOUT_GENERAL,
ISL_AUX_USAGE_NONE, &surf);
+ assert(surf.aux_usage == ISL_AUX_USAGE_NONE);
struct blorp_surf shadow_surf = {
.surf = &image->planes[0].shadow_surface.isl,
struct blorp_surf surf;
get_blorp_surf_for_anv_image(cmd_buffer->device, image, aspect,
+ ANV_IMAGE_LAYOUT_EXPLICIT_AUX,
aux_usage, &surf);
anv_cmd_buffer_mark_image_written(cmd_buffer, image, aspect, aux_usage,
level, base_layer, layer_count);
if (aspects & VK_IMAGE_ASPECT_DEPTH_BIT) {
get_blorp_surf_for_anv_image(cmd_buffer->device,
image, VK_IMAGE_ASPECT_DEPTH_BIT,
+ ANV_IMAGE_LAYOUT_EXPLICIT_AUX,
depth_aux_usage, &depth);
depth.clear_color.f32[0] = ANV_HZ_FC_VAL;
}
if (aspects & VK_IMAGE_ASPECT_STENCIL_BIT) {
get_blorp_surf_for_anv_image(cmd_buffer->device,
image, VK_IMAGE_ASPECT_STENCIL_BIT,
+ ANV_IMAGE_LAYOUT_EXPLICIT_AUX,
ISL_AUX_USAGE_NONE, &stencil);
}
struct blorp_surf surf;
get_blorp_surf_for_anv_image(cmd_buffer->device,
image, VK_IMAGE_ASPECT_DEPTH_BIT,
+ ANV_IMAGE_LAYOUT_EXPLICIT_AUX,
ISL_AUX_USAGE_HIZ, &surf);
surf.clear_color.f32[0] = ANV_HZ_FC_VAL;
anv_image_aux_layers(image, VK_IMAGE_ASPECT_DEPTH_BIT, level));
get_blorp_surf_for_anv_image(cmd_buffer->device,
image, VK_IMAGE_ASPECT_DEPTH_BIT,
+ ANV_IMAGE_LAYOUT_EXPLICIT_AUX,
ISL_AUX_USAGE_HIZ, &depth);
depth.clear_color.f32[0] = ANV_HZ_FC_VAL;
}
if (aspects & VK_IMAGE_ASPECT_STENCIL_BIT) {
get_blorp_surf_for_anv_image(cmd_buffer->device,
image, VK_IMAGE_ASPECT_STENCIL_BIT,
+ ANV_IMAGE_LAYOUT_EXPLICIT_AUX,
ISL_AUX_USAGE_NONE, &stencil);
}
struct blorp_surf surf;
get_blorp_surf_for_anv_image(cmd_buffer->device, image, aspect,
- ANV_AUX_USAGE_DEFAULT, &surf);
+ ANV_IMAGE_LAYOUT_EXPLICIT_AUX,
+ ISL_AUX_USAGE_MCS, &surf);
/* From the Sky Lake PRM Vol. 7, "Render Target Fast Clear":
*
struct blorp_surf surf;
get_blorp_surf_for_anv_image(cmd_buffer->device, image, aspect,
+ ANV_IMAGE_LAYOUT_EXPLICIT_AUX,
fast_clear_aux_usage(image, aspect),
&surf);