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