[Mesa-dev] [PATCH] anv/query: ensure visibility of reset before copying query results

Lionel Landwerlin lionel.g.landwerlin at intel.com
Tue Apr 30 17:18:50 UTC 2019


Let me check the new tests and see if where the problem is.
Thanks for letting us know!

-Lionel

On 30/04/2019 13:43, Iago Toral Quiroga wrote:
> Specifically, vkCmdCopyQueryPoolResults is required to see the effect
> of a previous vkCmdResetQueryPool. This may not work currently when
> query execution is still on going, as some of the queries may become
> available asynchronously after the reset.
>
> Fixes new CTS tests:
> dEQP-VK.query_pool.statistics_query.reset_before_copy.*
> ---
>
> Jason, do you have any better ideas?
>
>   src/intel/vulkan/genX_query.c | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
>
> diff --git a/src/intel/vulkan/genX_query.c b/src/intel/vulkan/genX_query.c
> index 146435c3f8f..08b013f6351 100644
> --- a/src/intel/vulkan/genX_query.c
> +++ b/src/intel/vulkan/genX_query.c
> @@ -383,6 +383,19 @@ void genX(CmdResetQueryPool)(
>      ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);
>      ANV_FROM_HANDLE(anv_query_pool, pool, queryPool);
>   
> +   /* From the Vulkan spec:
> +    *
> +    *    "vkCmdCopyQueryPoolResults is guaranteed to see the effect of
> +    *     previous uses of vkCmdResetQueryPool in the same queue, without
> +    *     any additional synchronization. Thus, the results will always
> +    *     reflect the most recent use of the query."
> +    *
> +    * So we need to make sure that any on-going queries are finished by
> +    * the time we emit the reset.
> +    */
> +   cmd_buffer->state.pending_pipe_bits |= ANV_PIPE_CS_STALL_BIT;
> +   genX(cmd_buffer_apply_pipe_flushes)(cmd_buffer);
> +
>      for (uint32_t i = 0; i < queryCount; i++) {
>         anv_batch_emit(&cmd_buffer->batch, GENX(MI_STORE_DATA_IMM), sdm) {
>            sdm.Address = anv_query_address(pool, firstQuery + i);




More information about the mesa-dev mailing list