v3dv: implement VK_EXT_host_query_reset
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13319>
This commit is contained in:
parent
393fda2d34
commit
835b98e101
|
@ -464,7 +464,7 @@ Vulkan 1.2 -- all DONE: anv, vn
|
||||||
VK_KHR_uniform_buffer_standard_layout DONE (anv, lvp, radv, tu, v3dv, vn)
|
VK_KHR_uniform_buffer_standard_layout DONE (anv, lvp, radv, tu, v3dv, vn)
|
||||||
VK_KHR_vulkan_memory_model DONE (anv, radv, tu, vn)
|
VK_KHR_vulkan_memory_model DONE (anv, radv, tu, vn)
|
||||||
VK_EXT_descriptor_indexing DONE (anv/gen9+, radv, tu, vn)
|
VK_EXT_descriptor_indexing DONE (anv/gen9+, radv, tu, vn)
|
||||||
VK_EXT_host_query_reset DONE (anv, lvp, radv, tu, vn)
|
VK_EXT_host_query_reset DONE (anv, lvp, radv, tu, v3dv, vn)
|
||||||
VK_EXT_sampler_filter_minmax DONE (anv/gen9+, lvp, radv, tu, vn)
|
VK_EXT_sampler_filter_minmax DONE (anv/gen9+, lvp, radv, tu, vn)
|
||||||
VK_EXT_scalar_block_layout DONE (anv, lvp, radv/gfx7+, tu, vn)
|
VK_EXT_scalar_block_layout DONE (anv, lvp, radv/gfx7+, tu, vn)
|
||||||
VK_EXT_separate_stencil_usage DONE (anv, lvp, tu, vn)
|
VK_EXT_separate_stencil_usage DONE (anv, lvp, tu, vn)
|
||||||
|
|
|
@ -143,6 +143,7 @@ get_device_extensions(const struct v3dv_physical_device *device,
|
||||||
.EXT_color_write_enable = true,
|
.EXT_color_write_enable = true,
|
||||||
.EXT_custom_border_color = true,
|
.EXT_custom_border_color = true,
|
||||||
.EXT_external_memory_dma_buf = true,
|
.EXT_external_memory_dma_buf = true,
|
||||||
|
.EXT_host_query_reset = true,
|
||||||
.EXT_index_type_uint8 = true,
|
.EXT_index_type_uint8 = true,
|
||||||
.EXT_physical_device_drm = true,
|
.EXT_physical_device_drm = true,
|
||||||
.EXT_pipeline_creation_cache_control = true,
|
.EXT_pipeline_creation_cache_control = true,
|
||||||
|
@ -1137,6 +1138,14 @@ v3dv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES: {
|
||||||
|
VkPhysicalDeviceHostQueryResetFeatures *features =
|
||||||
|
(void *) ext;
|
||||||
|
|
||||||
|
features->hostQueryReset = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* Vulkan 1.1 */
|
/* Vulkan 1.1 */
|
||||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES: {
|
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES: {
|
||||||
VkPhysicalDeviceVulkan11Features *features =
|
VkPhysicalDeviceVulkan11Features *features =
|
||||||
|
|
|
@ -1270,6 +1270,11 @@ VkResult v3dv_get_query_pool_results_cpu(struct v3dv_device *device,
|
||||||
VkDeviceSize stride,
|
VkDeviceSize stride,
|
||||||
VkQueryResultFlags flags);
|
VkQueryResultFlags flags);
|
||||||
|
|
||||||
|
void v3dv_reset_query_pools(struct v3dv_device *device,
|
||||||
|
struct v3dv_query_pool *query_pool,
|
||||||
|
uint32_t first,
|
||||||
|
uint32_t last);
|
||||||
|
|
||||||
typedef void (*v3dv_cmd_buffer_private_obj_destroy_cb)(VkDevice device,
|
typedef void (*v3dv_cmd_buffer_private_obj_destroy_cb)(VkDevice device,
|
||||||
uint64_t pobj,
|
uint64_t pobj,
|
||||||
VkAllocationCallbacks *alloc);
|
VkAllocationCallbacks *alloc);
|
||||||
|
|
|
@ -351,3 +351,41 @@ v3dv_CmdEndQuery(VkCommandBuffer commandBuffer,
|
||||||
|
|
||||||
v3dv_cmd_buffer_end_query(cmd_buffer, pool, query);
|
v3dv_cmd_buffer_end_query(cmd_buffer, pool, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
v3dv_reset_query_pools(struct v3dv_device *device,
|
||||||
|
struct v3dv_query_pool *pool,
|
||||||
|
uint32_t first,
|
||||||
|
uint32_t count)
|
||||||
|
{
|
||||||
|
for (uint32_t i = first; i < first + count; i++) {
|
||||||
|
assert(i < pool->query_count);
|
||||||
|
struct v3dv_query *q = &pool->queries[i];
|
||||||
|
q->maybe_available = false;
|
||||||
|
switch (pool->query_type) {
|
||||||
|
case VK_QUERY_TYPE_OCCLUSION: {
|
||||||
|
const uint8_t *q_addr = ((uint8_t *) q->bo->map) + q->offset;
|
||||||
|
uint32_t *counter = (uint32_t *) q_addr;
|
||||||
|
*counter = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case VK_QUERY_TYPE_TIMESTAMP:
|
||||||
|
q->value = 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
unreachable("Unsupported query type");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VKAPI_ATTR void VKAPI_CALL
|
||||||
|
v3dv_ResetQueryPool(VkDevice _device,
|
||||||
|
VkQueryPool queryPool,
|
||||||
|
uint32_t firstQuery,
|
||||||
|
uint32_t queryCount)
|
||||||
|
{
|
||||||
|
V3DV_FROM_HANDLE(v3dv_device, device, _device);
|
||||||
|
V3DV_FROM_HANDLE(v3dv_query_pool, pool, queryPool);
|
||||||
|
|
||||||
|
v3dv_reset_query_pools(device, pool, firstQuery, queryCount);
|
||||||
|
}
|
||||||
|
|
|
@ -176,24 +176,7 @@ handle_reset_query_cpu_job(struct v3dv_job *job)
|
||||||
if (info->pool->query_type == VK_QUERY_TYPE_OCCLUSION)
|
if (info->pool->query_type == VK_QUERY_TYPE_OCCLUSION)
|
||||||
v3dv_bo_wait(job->device, info->pool->bo, PIPE_TIMEOUT_INFINITE);
|
v3dv_bo_wait(job->device, info->pool->bo, PIPE_TIMEOUT_INFINITE);
|
||||||
|
|
||||||
for (uint32_t i = info->first; i < info->first + info->count; i++) {
|
v3dv_reset_query_pools(job->device, info->pool, info->first, info->count);
|
||||||
assert(i < info->pool->query_count);
|
|
||||||
struct v3dv_query *q = &info->pool->queries[i];
|
|
||||||
q->maybe_available = false;
|
|
||||||
switch (info->pool->query_type) {
|
|
||||||
case VK_QUERY_TYPE_OCCLUSION: {
|
|
||||||
const uint8_t *q_addr = ((uint8_t *) q->bo->map) + q->offset;
|
|
||||||
uint32_t *counter = (uint32_t *) q_addr;
|
|
||||||
*counter = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VK_QUERY_TYPE_TIMESTAMP:
|
|
||||||
q->value = 0;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
unreachable("Unsupported query type");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue