turnip: Add driver skeleton (v2)
[mesa.git] / src / freedreno / vulkan / tu_query.c
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 DEALINGS
23 * IN THE SOFTWARE.
24 */
25
26 #include <assert.h>
27 #include <fcntl.h>
28 #include <stdbool.h>
29 #include <string.h>
30 #include <unistd.h>
31
32 #include "tu_private.h"
33 #include "nir/nir_builder.h"
34
35 VkResult
36 tu_CreateQueryPool(VkDevice _device,
37 const VkQueryPoolCreateInfo *pCreateInfo,
38 const VkAllocationCallbacks *pAllocator,
39 VkQueryPool *pQueryPool)
40 {
41 TU_FROM_HANDLE(tu_device, device, _device);
42 struct tu_query_pool *pool = vk_alloc2(&device->alloc,
43 pAllocator,
44 sizeof(*pool),
45 8,
46 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
47
48 if (!pool)
49 return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
50
51 *pQueryPool = tu_query_pool_to_handle(pool);
52 return VK_SUCCESS;
53 }
54
55 void
56 tu_DestroyQueryPool(VkDevice _device,
57 VkQueryPool _pool,
58 const VkAllocationCallbacks *pAllocator)
59 {
60 TU_FROM_HANDLE(tu_device, device, _device);
61 TU_FROM_HANDLE(tu_query_pool, pool, _pool);
62
63 if (!pool)
64 return;
65
66 vk_free2(&device->alloc, pAllocator, pool);
67 }
68
69 VkResult
70 tu_GetQueryPoolResults(VkDevice _device,
71 VkQueryPool queryPool,
72 uint32_t firstQuery,
73 uint32_t queryCount,
74 size_t dataSize,
75 void *pData,
76 VkDeviceSize stride,
77 VkQueryResultFlags flags)
78 {
79 return VK_SUCCESS;
80 }
81
82 void
83 tu_CmdCopyQueryPoolResults(VkCommandBuffer commandBuffer,
84 VkQueryPool queryPool,
85 uint32_t firstQuery,
86 uint32_t queryCount,
87 VkBuffer dstBuffer,
88 VkDeviceSize dstOffset,
89 VkDeviceSize stride,
90 VkQueryResultFlags flags)
91 {
92 }
93
94 void
95 tu_CmdResetQueryPool(VkCommandBuffer commandBuffer,
96 VkQueryPool queryPool,
97 uint32_t firstQuery,
98 uint32_t queryCount)
99 {
100 }
101
102 void
103 tu_CmdBeginQuery(VkCommandBuffer commandBuffer,
104 VkQueryPool queryPool,
105 uint32_t query,
106 VkQueryControlFlags flags)
107 {
108 }
109
110 void
111 tu_CmdEndQuery(VkCommandBuffer commandBuffer,
112 VkQueryPool queryPool,
113 uint32_t query)
114 {
115 }
116
117 void
118 tu_CmdWriteTimestamp(VkCommandBuffer commandBuffer,
119 VkPipelineStageFlagBits pipelineStage,
120 VkQueryPool queryPool,
121 uint32_t query)
122 {
123 }