[Mesa-dev] [PATCH v2] anv: Allow PMA optimization to be enabled in secondary command buffers

Jason Ekstrand jason at jlekstrand.net
Fri Jan 5 21:43:55 UTC 2018


On Fri, Jan 5, 2018 at 9:06 AM, Alex Smith <asmith at feralinteractive.com>
wrote:

> This was never enabled in secondary buffers because hiz_enabled was
> never set to true for those.
>
> If the app provides a framebuffer in the inheritance info when beginning
> a secondary buffer, we can determine if HiZ is enabled and therefore
> allow the PMA optimization to be enabled within the command buffer.
>
> This improves performance by ~13% on an internal benchmark on Skylake.
>

Are you sure this is Sky Lake and not Broadwell?  We've never measured the
stencil PMA to help anything before.  Neat!

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>


> v2: Use anv_cmd_buffer_get_depth_stencil_view().
>
> Signed-off-by: Alex Smith <asmith at feralinteractive.com>
> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
> ---
>  src/intel/vulkan/genX_cmd_buffer.c | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/src/intel/vulkan/genX_cmd_buffer.c
> b/src/intel/vulkan/genX_cmd_buffer.c
> index 0bd3874db7..b7253d5251 100644
> --- a/src/intel/vulkan/genX_cmd_buffer.c
> +++ b/src/intel/vulkan/genX_cmd_buffer.c
> @@ -977,11 +977,31 @@ genX(BeginCommandBuffer)(
>           anv_render_pass_from_handle(pBeginInfo->pInheritanceInfo->
> renderPass);
>        cmd_buffer->state.subpass =
>           &cmd_buffer->state.pass->subpasses[pBeginInfo->
> pInheritanceInfo->subpass];
> -      cmd_buffer->state.framebuffer = NULL;
> +
> +      /* This is optional in the inheritance info. */
> +      cmd_buffer->state.framebuffer =
> +         anv_framebuffer_from_handle(pBeginInfo->pInheritanceInfo->
> framebuffer);
>

FYI: The only reason why we were always setting framebuffer to NULL for
secondaries was because most of the CTS tests specify a framebuffer and I
wanted our testing to run without the framebuffer because that's the more
difficult case.  (It's easy to forget that framebuffer may be NULL.)  I
knew it was a potential performance issue but no one was heavily using
secondaries in the wild up until now.  Thanks for getting this working!


>
>        result = genX(cmd_buffer_setup_attachments)(cmd_buffer,
>                                                    cmd_buffer->state.pass,
> NULL);
>
> +      /* Record that HiZ is enabled if we can. */
> +      if (cmd_buffer->state.framebuffer) {
> +         const struct anv_image_view * const iview =
> +            anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
> +
> +         if (iview) {
> +            VkImageLayout layout =
> +                cmd_buffer->state.subpass->depth_stencil_attachment.
> layout;
> +
> +            enum isl_aux_usage aux_usage =
> +               anv_layout_to_aux_usage(&cmd_buffer->device->info,
> iview->image,
> +                                       VK_IMAGE_ASPECT_DEPTH_BIT, layout);
> +
> +            cmd_buffer->state.hiz_enabled = aux_usage ==
> ISL_AUX_USAGE_HIZ;
> +         }
> +      }
> +
>        cmd_buffer->state.dirty |= ANV_CMD_DIRTY_RENDER_TARGETS;
>     }
>
> --
> 2.13.6
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180105/69e98cc3/attachment.html>


More information about the mesa-dev mailing list