[Mesa-dev] [PATCH] radv: make sure to emit cache flushes before starting a query

Bas Nieuwenhuizen basni at chromium.org
Wed Feb 28 17:07:37 UTC 2018


On Wed, Feb 28, 2018 at 6:00 PM, Samuel Pitoiset <samuel.pitoiset at gmail.com>
wrote:

> If the query pool has been previously resetted using the compute
> shader path.
>
> Fixes: a41e2e9cf5 ("radv: allow to use a compute shader for resetting the
> query pool")
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105292
> Cc: "18.0" <mesa-stable at lists.freedesktop.org>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  src/amd/vulkan/radv_private.h |  1 +
>  src/amd/vulkan/radv_query.c   | 11 +++++++++++
>  2 files changed, 12 insertions(+)
>
> diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
> index c72df5a737..dd57403894 100644
> --- a/src/amd/vulkan/radv_private.h
> +++ b/src/amd/vulkan/radv_private.h
> @@ -1604,6 +1604,7 @@ struct radv_query_pool {
>         char *ptr;
>         VkQueryType type;
>         uint32_t pipeline_stats_mask;
> +       bool pending_reset;
>

You can't do that, since we may be recording multiple command buffers
simultaneously with the same pool.

The ideal would be per commandbuffer per pool, but in the interest of
adding not too much overhead, just put it into the command buffer? (and
make surethat either  it is set at true at the start of the cmd buffer, or
we flush on EndCommandBuffer if it is set, so it works when the reset and
beginQuery are in different command buffers)

 };
>
>  struct radv_semaphore {
> diff --git a/src/amd/vulkan/radv_query.c b/src/amd/vulkan/radv_query.c
> index ace745e4e6..d602707f5e 100644
> --- a/src/amd/vulkan/radv_query.c
> +++ b/src/amd/vulkan/radv_query.c
> @@ -771,6 +771,7 @@ VkResult radv_CreateQueryPool(
>                 unreachable("creating unhandled query type");
>         }
>
> +       pool->pending_reset = false;
>         pool->type = pCreateInfo->queryType;
>         pool->pipeline_stats_mask = pCreateInfo->pipelineStatistics;
>         pool->availability_offset = pool->stride * pCreateInfo->queryCount;
> @@ -1070,6 +1071,8 @@ void radv_CmdResetQueryPool(
>
> pool->availability_offset + firstQuery * 4,
>                                                       queryCount * 4, 0);
>         }
> +
> +       pool->pending_reset = true;
>  }
>
>  void radv_CmdBeginQuery(
> @@ -1086,6 +1089,14 @@ void radv_CmdBeginQuery(
>
>         radv_cs_add_buffer(cmd_buffer->device->ws, cs, pool->bo, 8);
>
> +       if (pool->pending_reset) {
> +               /* Make sure to emit the cache flushes if the query pool
> has
> +                * been previously resetted using a compute shader.
> +                */
> +               si_emit_cache_flush(cmd_buffer);
> +               pool->pending_reset = false;
> +       }
> +
>         switch (pool->type) {
>         case VK_QUERY_TYPE_OCCLUSION:
>                 radeon_check_space(cmd_buffer->device->ws, cs, 7);
> --
> 2.16.2
>
> _______________________________________________
> 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/20180228/c14efde3/attachment-0001.html>


More information about the mesa-dev mailing list