<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jun 19, 2017 at 4:57 PM, Nanley Chery <span dir="ltr"><<a href="mailto:nanleychery@gmail.com" target="_blank">nanleychery@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Mon, Jun 19, 2017 at 04:33:29PM -0700, Jason Ekstrand wrote:<br>
> On Tue, Jun 13, 2017 at 11:41 AM, Nanley Chery <<a href="mailto:nanleychery@gmail.com">nanleychery@gmail.com</a>><br>
> wrote:<br>
><br>
> > Splitting out these fields will make the color buffer transitioning<br>
> > function simpler when it gains more features.<br>
> ><br>
> > Signed-off-by: Nanley Chery <<a href="mailto:nanley.g.chery@intel.com">nanley.g.chery@intel.com</a>><br>
> > ---<br>
> > src/intel/vulkan/anv_blorp.c | 33 ++++++++++++------------------<wbr>--<br>
> > src/intel/vulkan/anv_private.h | 4 ++--<br>
> > src/intel/vulkan/genX_cmd_<wbr>buffer.c | 39 +++++++++++++++++++++++++-----<br>
> > --------<br>
> > 3 files changed, 40 insertions(+), 36 deletions(-)<br>
> ><br>
> > diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c<br>
> > index ff3d7b126f..2d970ac3a7 100644<br>
> > --- a/src/intel/vulkan/anv_blorp.c<br>
> > +++ b/src/intel/vulkan/anv_blorp.c<br>
> > @@ -1433,12 +1433,17 @@ void anv_CmdResolveImage(<br>
> > void<br>
> > anv_image_ccs_clear(struct anv_cmd_buffer *cmd_buffer,<br>
> > const struct anv_image *image,<br>
> > - const struct isl_view *view,<br>
> > - const VkImageSubresourceRange *subresourceRange)<br>
> > + const uint32_t base_level, const uint32_t level_count,<br>
> > + const uint32_t base_layer, uint32_t layer_count)<br>
> > {<br>
> > assert(anv_image_has_color_<wbr>aux(image) && image->samples == 1);<br>
> > assert(image->type == VK_IMAGE_TYPE_3D || image->extent.depth == 1);<br>
> ><br>
> > + if (image->type == VK_IMAGE_TYPE_3D) {<br>
> > + assert(base_layer == 0);<br>
> > + assert(layer_count == anv_minify(image->extent.<wbr>depth, base_level));<br>
> > + }<br>
> > +<br>
> > struct blorp_batch batch;<br>
> > blorp_batch_init(&cmd_buffer-><wbr>device->blorp, &batch, cmd_buffer, 0);<br>
> ><br>
> > @@ -1464,11 +1469,8 @@ anv_image_ccs_clear(struct anv_cmd_buffer<br>
> > *cmd_buffer,<br>
> > cmd_buffer->state.pending_<wbr>pipe_bits |=<br>
> > ANV_PIPE_RENDER_TARGET_CACHE_<wbr>FLUSH_BIT | ANV_PIPE_CS_STALL_BIT;<br>
> ><br>
> > - const uint32_t level_count =<br>
> > - view ? view->levels : anv_get_levelCount(image, subresourceRange);<br>
> > for (uint32_t l = 0; l < level_count; l++) {<br>
> > - const uint32_t level =<br>
> > - (view ? view->base_level : subresourceRange-><wbr>baseMipLevel) + l;<br>
> > + const uint32_t level = base_level + l;<br>
> ><br>
> > const VkExtent3D extent = {<br>
> > .width = anv_minify(image->extent.<wbr>width, level),<br>
> > @@ -1476,24 +1478,13 @@ anv_image_ccs_clear(struct anv_cmd_buffer<br>
> > *cmd_buffer,<br>
> > .depth = anv_minify(image->extent.<wbr>depth, level),<br>
> > };<br>
> ><br>
> > - /* Blorp likes to treat 2D_ARRAY and 3D the same. */<br>
> > - uint32_t blorp_base_layer, blorp_layer_count;<br>
> > - if (image->type == VK_IMAGE_TYPE_3D) {<br>
> > - blorp_base_layer = 0;<br>
> > - blorp_layer_count = extent.depth;<br>
> > - } else if (view) {<br>
> > - blorp_base_layer = view->base_array_layer;<br>
> > - blorp_layer_count = view->array_len;<br>
> > - } else {<br>
> > - blorp_base_layer = subresourceRange-><wbr>baseArrayLayer;<br>
> > - blorp_layer_count = anv_get_layerCount(image, subresourceRange);<br>
> > - }<br>
> > + if (image->type == VK_IMAGE_TYPE_3D)<br>
> > + layer_count = extent.depth;<br>
> ><br>
><br>
> Don't you need to minify here? Also, given the assert above, is it needed<br>
> at all?<br>
><br>
><br>
<br>
</div></div>The minify of extent.depth happens a couple lines above. The layer_count<br>
value changes with the miplevel.<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div><div>Right. I missed that. In that case, this looks good.<br><br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">
-Nanley<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> ><br>
> > assert(level < anv_color_aux_levels(image));<br>
> > - assert(blorp_base_layer + blorp_layer_count <=<br>
> > - anv_color_aux_layers(image, level));<br>
> > + assert(base_layer + layer_count <= anv_color_aux_layers(image,<br>
> > level));<br>
> > blorp_fast_clear(&batch, &surf, surf.surf->format,<br>
> > - level, blorp_base_layer, blorp_layer_count,<br>
> > + level, base_layer, layer_count,<br>
> > 0, 0, extent.width, extent.height);<br>
> > }<br>
> ><br>
> > diff --git a/src/intel/vulkan/anv_<wbr>private.h b/src/intel/vulkan/anv_<br>
> > private.h<br>
> > index 32aec7782b..5401c09f02 100644<br>
> > --- a/src/intel/vulkan/anv_<wbr>private.h<br>
> > +++ b/src/intel/vulkan/anv_<wbr>private.h<br>
> > @@ -2130,8 +2130,8 @@ anv_gen8_hiz_op_resolve(struct anv_cmd_buffer<br>
> > *cmd_buffer,<br>
> > void<br>
> > anv_image_ccs_clear(struct anv_cmd_buffer *cmd_buffer,<br>
> > const struct anv_image *image,<br>
> > - const struct isl_view *view,<br>
> > - const VkImageSubresourceRange *subresourceRange);<br>
> > + const uint32_t base_level, const uint32_t level_count,<br>
> > + const uint32_t base_layer, uint32_t layer_count);<br>
> ><br>
> > enum isl_aux_usage<br>
> > anv_layout_to_aux_usage(const struct gen_device_info * const devinfo,<br>
> > diff --git a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> > b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> > index 1027b64cb7..c8c7f8fbd6 100644<br>
> > --- a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> > +++ b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> > @@ -384,10 +384,10 @@ transition_depth_buffer(struct anv_cmd_buffer<br>
> > *cmd_buffer,<br>
> > static void<br>
> > transition_color_buffer(struct anv_cmd_buffer *cmd_buffer,<br>
> > const struct anv_image *image,<br>
> > + const uint32_t base_level, uint32_t level_count,<br>
> > + uint32_t base_layer, uint32_t layer_count,<br>
> > VkImageLayout initial_layout,<br>
> > - VkImageLayout final_layout,<br>
> > - const struct isl_view *view,<br>
> > - const VkImageSubresourceRange *subresourceRange)<br>
> > + VkImageLayout final_layout)<br>
> > {<br>
> > if (image->aux_usage != ISL_AUX_USAGE_CCS_E)<br>
> > return;<br>
> > @@ -396,13 +396,20 @@ transition_color_buffer(struct anv_cmd_buffer<br>
> > *cmd_buffer,<br>
> > initial_layout != VK_IMAGE_LAYOUT_<wbr>PREINITIALIZED)<br>
> > return;<br>
> ><br>
> > + /* A transition of a 3D subresource works on all slices at a time. */<br>
> > + if (image->type == VK_IMAGE_TYPE_3D) {<br>
> > + base_layer = 0;<br>
> > + layer_count = anv_minify(image->extent.<wbr>depth, base_level);<br>
> > + }<br>
> > +<br>
> > #if GEN_GEN >= 9<br>
> > /* We're transitioning from an undefined layout so it doesn't really<br>
> > matter<br>
> > * what data ends up in the color buffer. We do, however, need to<br>
> > ensure<br>
> > * that the CCS has valid data in it. One easy way to do that is to<br>
> > * fast-clear the specified range.<br>
> > */<br>
> > - anv_image_ccs_clear(cmd_<wbr>buffer, image, view, subresourceRange);<br>
> > + anv_image_ccs_clear(cmd_<wbr>buffer, image, base_level, level_count,<br>
> > + base_layer, layer_count);<br>
> > #endif<br>
> > }<br>
> ><br>
> > @@ -987,18 +994,21 @@ void genX(CmdPipelineBarrier)(<br>
> > src_flags |= pImageMemoryBarriers[i].<wbr>srcAccessMask;<br>
> > dst_flags |= pImageMemoryBarriers[i].<wbr>dstAccessMask;<br>
> > ANV_FROM_HANDLE(anv_image, image, pImageMemoryBarriers[i].image)<wbr>;<br>
> > - if (pImageMemoryBarriers[i].<wbr>subresourceRange.aspectMask &<br>
> > - VK_IMAGE_ASPECT_DEPTH_BIT) {<br>
> > + const VkImageSubresourceRange *range =<br>
> > + &pImageMemoryBarriers[i].<wbr>subresourceRange;<br>
> > +<br>
> > + if (range->aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT) {<br>
> > transition_depth_buffer(cmd_<wbr>buffer, image,<br>
> > pImageMemoryBarriers[i].<wbr>oldLayout,<br>
> > pImageMemoryBarriers[i].<wbr>newLayout);<br>
> > - } else if (pImageMemoryBarriers[i].<wbr>subresourceRange.aspectMask ==<br>
> > - VK_IMAGE_ASPECT_COLOR_BIT) {<br>
> > + } else if (range->aspectMask == VK_IMAGE_ASPECT_COLOR_BIT) {<br>
> > transition_color_buffer(cmd_<wbr>buffer, image,<br>
> > + range->baseMipLevel,<br>
> > + anv_get_levelCount(image, range),<br>
> > + range->baseArrayLayer,<br>
> > + anv_get_layerCount(image, range),<br>
> > pImageMemoryBarriers[i].<wbr>oldLayout,<br>
> > - pImageMemoryBarriers[i].<wbr>newLayout,<br>
> > - NULL,<br>
> > - &pImageMemoryBarriers[i].<br>
> > subresourceRange);<br>
> > + pImageMemoryBarriers[i].<wbr>newLayout);<br>
> > }<br>
> > }<br>
> ><br>
> > @@ -2485,10 +2495,13 @@ cmd_buffer_subpass_transition_<wbr>layouts(struct<br>
> > anv_cmd_buffer * const cmd_buffer,<br>
> > image->aspects, target_layout);<br>
> > } else if (image->aspects == VK_IMAGE_ASPECT_COLOR_BIT) {<br>
> > transition_color_buffer(cmd_<wbr>buffer, image,<br>
> > - att_state->current_layout, target_layout,<br>
> > - &iview->isl, NULL);<br>
> > + iview->isl.base_level, 1,<br>
> > + iview->isl.base_array_layer,<br>
> > + iview->isl.array_len,<br>
> > + att_state->current_layout,<br>
> > target_layout);<br>
> > }<br>
> ><br>
> > +<br>
> > att_state->current_layout = target_layout;<br>
> > }<br>
> > }<br>
> > --<br>
> > 2.13.1<br>
> ><br>
> > ______________________________<wbr>_________________<br>
> > mesa-dev mailing list<br>
> > <a href="mailto:mesa-dev@lists.freedesktop.org">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/<wbr>mailman/listinfo/mesa-dev</a><br>
> ><br>
</div></div></blockquote></div><br></div></div>