1b8e80941Smrg/*
2b8e80941Smrg * Copyrigh 2016 Red Hat Inc.
3b8e80941Smrg * Based on anv:
4b8e80941Smrg * Copyright © 2015 Intel Corporation
5b8e80941Smrg *
6b8e80941Smrg * Permission is hereby granted, free of charge, to any person obtaining a
7b8e80941Smrg * copy of this software and associated documentation files (the "Software"),
8b8e80941Smrg * to deal in the Software without restriction, including without limitation
9b8e80941Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10b8e80941Smrg * and/or sell copies of the Software, and to permit persons to whom the
11b8e80941Smrg * Software is furnished to do so, subject to the following conditions:
12b8e80941Smrg *
13b8e80941Smrg * The above copyright notice and this permission notice (including the next
14b8e80941Smrg * paragraph) shall be included in all copies or substantial portions of the
15b8e80941Smrg * Software.
16b8e80941Smrg *
17b8e80941Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18b8e80941Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19b8e80941Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20b8e80941Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21b8e80941Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22b8e80941Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23b8e80941Smrg * DEALINGS IN THE SOFTWARE.
24b8e80941Smrg */
25b8e80941Smrg
26b8e80941Smrg#include "tu_private.h"
27b8e80941Smrg
28b8e80941Smrg#include <assert.h>
29b8e80941Smrg#include <fcntl.h>
30b8e80941Smrg#include <stdbool.h>
31b8e80941Smrg#include <string.h>
32b8e80941Smrg#include <unistd.h>
33b8e80941Smrg
34b8e80941Smrg#include "nir/nir_builder.h"
35b8e80941Smrg
36b8e80941SmrgVkResult
37b8e80941Smrgtu_CreateQueryPool(VkDevice _device,
38b8e80941Smrg                   const VkQueryPoolCreateInfo *pCreateInfo,
39b8e80941Smrg                   const VkAllocationCallbacks *pAllocator,
40b8e80941Smrg                   VkQueryPool *pQueryPool)
41b8e80941Smrg{
42b8e80941Smrg   TU_FROM_HANDLE(tu_device, device, _device);
43b8e80941Smrg   struct tu_query_pool *pool =
44b8e80941Smrg      vk_alloc2(&device->alloc, pAllocator, sizeof(*pool), 8,
45b8e80941Smrg                VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
46b8e80941Smrg
47b8e80941Smrg   if (!pool)
48b8e80941Smrg      return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
49b8e80941Smrg
50b8e80941Smrg   *pQueryPool = tu_query_pool_to_handle(pool);
51b8e80941Smrg   return VK_SUCCESS;
52b8e80941Smrg}
53b8e80941Smrg
54b8e80941Smrgvoid
55b8e80941Smrgtu_DestroyQueryPool(VkDevice _device,
56b8e80941Smrg                    VkQueryPool _pool,
57b8e80941Smrg                    const VkAllocationCallbacks *pAllocator)
58b8e80941Smrg{
59b8e80941Smrg   TU_FROM_HANDLE(tu_device, device, _device);
60b8e80941Smrg   TU_FROM_HANDLE(tu_query_pool, pool, _pool);
61b8e80941Smrg
62b8e80941Smrg   if (!pool)
63b8e80941Smrg      return;
64b8e80941Smrg
65b8e80941Smrg   vk_free2(&device->alloc, pAllocator, pool);
66b8e80941Smrg}
67b8e80941Smrg
68b8e80941SmrgVkResult
69b8e80941Smrgtu_GetQueryPoolResults(VkDevice _device,
70b8e80941Smrg                       VkQueryPool queryPool,
71b8e80941Smrg                       uint32_t firstQuery,
72b8e80941Smrg                       uint32_t queryCount,
73b8e80941Smrg                       size_t dataSize,
74b8e80941Smrg                       void *pData,
75b8e80941Smrg                       VkDeviceSize stride,
76b8e80941Smrg                       VkQueryResultFlags flags)
77b8e80941Smrg{
78b8e80941Smrg   return VK_SUCCESS;
79b8e80941Smrg}
80b8e80941Smrg
81b8e80941Smrgvoid
82b8e80941Smrgtu_CmdCopyQueryPoolResults(VkCommandBuffer commandBuffer,
83b8e80941Smrg                           VkQueryPool queryPool,
84b8e80941Smrg                           uint32_t firstQuery,
85b8e80941Smrg                           uint32_t queryCount,
86b8e80941Smrg                           VkBuffer dstBuffer,
87b8e80941Smrg                           VkDeviceSize dstOffset,
88b8e80941Smrg                           VkDeviceSize stride,
89b8e80941Smrg                           VkQueryResultFlags flags)
90b8e80941Smrg{
91b8e80941Smrg}
92b8e80941Smrg
93b8e80941Smrgvoid
94b8e80941Smrgtu_CmdResetQueryPool(VkCommandBuffer commandBuffer,
95b8e80941Smrg                     VkQueryPool queryPool,
96b8e80941Smrg                     uint32_t firstQuery,
97b8e80941Smrg                     uint32_t queryCount)
98b8e80941Smrg{
99b8e80941Smrg}
100b8e80941Smrg
101b8e80941Smrgvoid
102b8e80941Smrgtu_CmdBeginQuery(VkCommandBuffer commandBuffer,
103b8e80941Smrg                 VkQueryPool queryPool,
104b8e80941Smrg                 uint32_t query,
105b8e80941Smrg                 VkQueryControlFlags flags)
106b8e80941Smrg{
107b8e80941Smrg}
108b8e80941Smrg
109b8e80941Smrgvoid
110b8e80941Smrgtu_CmdEndQuery(VkCommandBuffer commandBuffer,
111b8e80941Smrg               VkQueryPool queryPool,
112b8e80941Smrg               uint32_t query)
113b8e80941Smrg{
114b8e80941Smrg}
115b8e80941Smrg
116b8e80941Smrgvoid
117b8e80941Smrgtu_CmdWriteTimestamp(VkCommandBuffer commandBuffer,
118b8e80941Smrg                     VkPipelineStageFlagBits pipelineStage,
119b8e80941Smrg                     VkQueryPool queryPool,
120b8e80941Smrg                     uint32_t query)
121b8e80941Smrg{
122b8e80941Smrg}
123