[Mesa-dev] [PATCH 2/4] anv/query: Perform CmdResetQueryPool on the GPU

Lionel Landwerlin lionel.g.landwerlin at intel.com
Mon Feb 20 10:39:17 UTC 2017


On 18/02/17 23:59, Jason Ekstrand wrote:
> This fixes a some rendering corruption in The Talos Principle
>
> Cc: "13.0 17.0" <mesa-dev at lists.freedesktop.org>
> ---
>   src/intel/vulkan/anv_query.c       | 22 ----------------------
>   src/intel/vulkan/genX_cmd_buffer.c | 27 +++++++++++++++++++++++++++
>   2 files changed, 27 insertions(+), 22 deletions(-)
>
> diff --git a/src/intel/vulkan/anv_query.c b/src/intel/vulkan/anv_query.c
> index d674e83..c088e18 100644
> --- a/src/intel/vulkan/anv_query.c
> +++ b/src/intel/vulkan/anv_query.c
> @@ -169,25 +169,3 @@ VkResult anv_GetQueryPoolResults(
>   
>      return VK_SUCCESS;
>   }
> -
> -void anv_CmdResetQueryPool(
> -    VkCommandBuffer                             commandBuffer,
> -    VkQueryPool                                 queryPool,
> -    uint32_t                                    firstQuery,
> -    uint32_t                                    queryCount)
> -{
> -   ANV_FROM_HANDLE(anv_query_pool, pool, queryPool);
> -
> -   for (uint32_t i = 0; i < queryCount; i++) {
> -      switch (pool->type) {
> -      case VK_QUERY_TYPE_OCCLUSION:
> -      case VK_QUERY_TYPE_TIMESTAMP: {
> -         struct anv_query_pool_slot *slot = pool->bo.map;
> -         slot[firstQuery + i].available = 0;
> -         break;
> -      }
> -      default:
> -         assert(!"Invalid query type");
> -      }
> -   }
> -}
> diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
> index 40a72f4..63a8b51 100644
> --- a/src/intel/vulkan/genX_cmd_buffer.c
> +++ b/src/intel/vulkan/genX_cmd_buffer.c
> @@ -2510,6 +2510,33 @@ emit_query_availability(struct anv_cmd_buffer *cmd_buffer,
>      }
>   }
>   
> +void genX(CmdResetQueryPool)(
> +    VkCommandBuffer                             commandBuffer,
> +    VkQueryPool                                 queryPool,
> +    uint32_t                                    firstQuery,
> +    uint32_t                                    queryCount)
> +{
> +   ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);
> +   ANV_FROM_HANDLE(anv_query_pool, pool, queryPool);
> +
> +   for (uint32_t i = 0; i < queryCount; i++) {
> +      switch (pool->type) {
> +      case VK_QUERY_TYPE_OCCLUSION:
> +      case VK_QUERY_TYPE_TIMESTAMP: {
> +         size_t offset = (firstQuery + i) * sizeof(struct anv_query_pool_slot);
> +         anv_batch_emit(&cmd_buffer->batch, GENX(MI_STORE_DATA_IMM), sdm) {
> +            sdm.Address = (struct anv_address) { &pool->bo, offset + 16 };

Maybe using offsetof() rather than +16 ?

> +            sdm.DataDWord0 = 0;
> +            sdm.DataDWord1 = 0;
> +         }
> +         break;
> +      }
> +      default:
> +         assert(!"Invalid query type");
> +      }
> +   }
> +}
> +
>   void genX(CmdBeginQuery)(
>       VkCommandBuffer                             commandBuffer,
>       VkQueryPool                                 queryPool,




More information about the mesa-dev mailing list