<div dir="ltr"><div>Assuming nothing got lost in the indent, looks good to me.</div><div><br></div><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Aug 28, 2018 at 6:27 AM Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com">lionel.g.landwerlin@intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Newer blit tests are enabling depth&stencils blits. We currently don't<br>
support it but can do by iterating over the aspects masks (copy some<br>
logic from the CopyImage function).<br>
<br>
Signed-off-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a>><br>
Fixes: 9f44745eca0e41 ("anv: Use blorp to implement VkBlitImage")<br>
---<br>
src/intel/vulkan/anv_blorp.c | 145 ++++++++++++++++++-----------------<br>
1 file changed, 75 insertions(+), 70 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c<br>
index cd67cc636b2..35b304f92b3 100644<br>
--- a/src/intel/vulkan/anv_blorp.c<br>
+++ b/src/intel/vulkan/anv_blorp.c<br>
@@ -532,81 +532,86 @@ void anv_CmdBlitImage(<br>
const VkImageSubresourceLayers *src_res = &pRegions[r].srcSubresource;<br>
const VkImageSubresourceLayers *dst_res = &pRegions[r].dstSubresource;<br>
<br>
- get_blorp_surf_for_anv_image(cmd_buffer->device,<br>
- src_image, src_res->aspectMask,<br>
- srcImageLayout, ISL_AUX_USAGE_NONE, &src);<br>
- get_blorp_surf_for_anv_image(cmd_buffer->device,<br>
- dst_image, dst_res->aspectMask,<br>
- dstImageLayout, ISL_AUX_USAGE_NONE, &dst);<br>
-<br>
- struct anv_format_plane src_format =<br>
- anv_get_format_plane(&cmd_buffer->device->info, src_image->vk_format,<br>
- src_res->aspectMask, src_image->tiling);<br>
- struct anv_format_plane dst_format =<br>
- anv_get_format_plane(&cmd_buffer->device->info, dst_image->vk_format,<br>
- dst_res->aspectMask, dst_image->tiling);<br>
-<br>
- unsigned dst_start, dst_end;<br>
- if (dst_image->type == VK_IMAGE_TYPE_3D) {<br>
- assert(dst_res->baseArrayLayer == 0);<br>
- dst_start = pRegions[r].dstOffsets[0].z;<br>
- dst_end = pRegions[r].dstOffsets[1].z;<br>
- } else {<br>
- dst_start = dst_res->baseArrayLayer;<br>
- dst_end = dst_start + anv_get_layerCount(dst_image, dst_res);<br>
- }<br>
-<br>
- unsigned src_start, src_end;<br>
- if (src_image->type == VK_IMAGE_TYPE_3D) {<br>
- assert(src_res->baseArrayLayer == 0);<br>
- src_start = pRegions[r].srcOffsets[0].z;<br>
- src_end = pRegions[r].srcOffsets[1].z;<br>
- } else {<br>
- src_start = src_res->baseArrayLayer;<br>
- src_end = src_start + anv_get_layerCount(src_image, src_res);<br>
- }<br>
-<br>
- bool flip_z = flip_coords(&src_start, &src_end, &dst_start, &dst_end);<br>
- float src_z_step = (float)(src_end + 1 - src_start) /<br>
- (float)(dst_end + 1 - dst_start);<br>
+ assert(anv_image_aspects_compatible(src_res->aspectMask,<br>
+ dst_res->aspectMask));<br>
+<br>
+ uint32_t aspect_bit;<br>
+ anv_foreach_image_aspect_bit(aspect_bit, src_image, src_res->aspectMask) {<br>
+ get_blorp_surf_for_anv_image(cmd_buffer->device,<br>
+ src_image, 1U << aspect_bit,<br>
+ srcImageLayout, ISL_AUX_USAGE_NONE, &src);<br>
+ get_blorp_surf_for_anv_image(cmd_buffer->device,<br>
+ dst_image, 1U << aspect_bit,<br>
+ dstImageLayout, ISL_AUX_USAGE_NONE, &dst);<br>
+<br>
+ struct anv_format_plane src_format =<br>
+ anv_get_format_plane(&cmd_buffer->device->info, src_image->vk_format,<br>
+ 1U << aspect_bit, src_image->tiling);<br>
+ struct anv_format_plane dst_format =<br>
+ anv_get_format_plane(&cmd_buffer->device->info, dst_image->vk_format,<br>
+ 1U << aspect_bit, dst_image->tiling);<br>
+<br>
+ unsigned dst_start, dst_end;<br>
+ if (dst_image->type == VK_IMAGE_TYPE_3D) {<br>
+ assert(dst_res->baseArrayLayer == 0);<br>
+ dst_start = pRegions[r].dstOffsets[0].z;<br>
+ dst_end = pRegions[r].dstOffsets[1].z;<br>
+ } else {<br>
+ dst_start = dst_res->baseArrayLayer;<br>
+ dst_end = dst_start + anv_get_layerCount(dst_image, dst_res);<br>
+ }<br>
<br>
- if (flip_z) {<br>
- src_start = src_end;<br>
- src_z_step *= -1;<br>
- }<br>
+ unsigned src_start, src_end;<br>
+ if (src_image->type == VK_IMAGE_TYPE_3D) {<br>
+ assert(src_res->baseArrayLayer == 0);<br>
+ src_start = pRegions[r].srcOffsets[0].z;<br>
+ src_end = pRegions[r].srcOffsets[1].z;<br>
+ } else {<br>
+ src_start = src_res->baseArrayLayer;<br>
+ src_end = src_start + anv_get_layerCount(src_image, src_res);<br>
+ }<br>
<br>
- unsigned src_x0 = pRegions[r].srcOffsets[0].x;<br>
- unsigned src_x1 = pRegions[r].srcOffsets[1].x;<br>
- unsigned dst_x0 = pRegions[r].dstOffsets[0].x;<br>
- unsigned dst_x1 = pRegions[r].dstOffsets[1].x;<br>
- bool flip_x = flip_coords(&src_x0, &src_x1, &dst_x0, &dst_x1);<br>
+ bool flip_z = flip_coords(&src_start, &src_end, &dst_start, &dst_end);<br>
+ float src_z_step = (float)(src_end + 1 - src_start) /<br>
+ (float)(dst_end + 1 - dst_start);<br>
<br>
- unsigned src_y0 = pRegions[r].srcOffsets[0].y;<br>
- unsigned src_y1 = pRegions[r].srcOffsets[1].y;<br>
- unsigned dst_y0 = pRegions[r].dstOffsets[0].y;<br>
- unsigned dst_y1 = pRegions[r].dstOffsets[1].y;<br>
- bool flip_y = flip_coords(&src_y0, &src_y1, &dst_y0, &dst_y1);<br>
+ if (flip_z) {<br>
+ src_start = src_end;<br>
+ src_z_step *= -1;<br>
+ }<br>
<br>
- const unsigned num_layers = dst_end - dst_start;<br>
- anv_cmd_buffer_mark_image_written(cmd_buffer, dst_image,<br>
- dst_res->aspectMask,<br>
- dst.aux_usage,<br>
- dst_res->mipLevel,<br>
- dst_start, num_layers);<br>
-<br>
- for (unsigned i = 0; i < num_layers; i++) {<br>
- unsigned dst_z = dst_start + i;<br>
- unsigned src_z = src_start + i * src_z_step;<br>
-<br>
- blorp_blit(&batch, &src, src_res->mipLevel, src_z,<br>
- src_format.isl_format, src_format.swizzle,<br>
- &dst, dst_res->mipLevel, dst_z,<br>
- dst_format.isl_format, dst_format.swizzle,<br>
- src_x0, src_y0, src_x1, src_y1,<br>
- dst_x0, dst_y0, dst_x1, dst_y1,<br>
- blorp_filter, flip_x, flip_y);<br>
+ unsigned src_x0 = pRegions[r].srcOffsets[0].x;<br>
+ unsigned src_x1 = pRegions[r].srcOffsets[1].x;<br>
+ unsigned dst_x0 = pRegions[r].dstOffsets[0].x;<br>
+ unsigned dst_x1 = pRegions[r].dstOffsets[1].x;<br>
+ bool flip_x = flip_coords(&src_x0, &src_x1, &dst_x0, &dst_x1);<br>
+<br>
+ unsigned src_y0 = pRegions[r].srcOffsets[0].y;<br>
+ unsigned src_y1 = pRegions[r].srcOffsets[1].y;<br>
+ unsigned dst_y0 = pRegions[r].dstOffsets[0].y;<br>
+ unsigned dst_y1 = pRegions[r].dstOffsets[1].y;<br>
+ bool flip_y = flip_coords(&src_y0, &src_y1, &dst_y0, &dst_y1);<br>
+<br>
+ const unsigned num_layers = dst_end - dst_start;<br>
+ anv_cmd_buffer_mark_image_written(cmd_buffer, dst_image,<br>
+ 1U << aspect_bit,<br>
+ dst.aux_usage,<br>
+ dst_res->mipLevel,<br>
+ dst_start, num_layers);<br>
+<br>
+ for (unsigned i = 0; i < num_layers; i++) {<br>
+ unsigned dst_z = dst_start + i;<br>
+ unsigned src_z = src_start + i * src_z_step;<br>
+<br>
+ blorp_blit(&batch, &src, src_res->mipLevel, src_z,<br>
+ src_format.isl_format, src_format.swizzle,<br>
+ &dst, dst_res->mipLevel, dst_z,<br>
+ dst_format.isl_format, dst_format.swizzle,<br>
+ src_x0, src_y0, src_x1, src_y1,<br>
+ dst_x0, dst_y0, dst_x1, dst_y1,<br>
+ blorp_filter, flip_x, flip_y);<br>
+ }<br>
}<br>
-<br>
}<br>
<br>
blorp_batch_finish(&batch);<br>
-- <br>
2.18.0<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div>