From d1aa37dfff2f7d81fc256c1717d9e5ba8dbc2e78 Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Sat, 17 Nov 2018 18:39:24 +0100 Subject: [PATCH] radv: Implement VK_EXT_host_query_reset. Reviewed-by: Samuel Pitoiset Acked-by: Eric Engestrom --- src/amd/vulkan/radv_device.c | 6 ++++++ src/amd/vulkan/radv_extensions.py | 1 + src/amd/vulkan/radv_query.c | 22 ++++++++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 9570c15af02..dc4346b7498 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -887,6 +887,12 @@ void radv_GetPhysicalDeviceFeatures2( features->depthClipEnable = true; break; } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES_EXT: { + VkPhysicalDeviceHostQueryResetFeaturesEXT *features = + (VkPhysicalDeviceHostQueryResetFeaturesEXT *)ext; + features->hostQueryReset = true; + break; + } default: break; } diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py index 0440a2ec9d9..986ef26876d 100644 --- a/src/amd/vulkan/radv_extensions.py +++ b/src/amd/vulkan/radv_extensions.py @@ -107,6 +107,7 @@ EXTENSIONS = [ Extension('VK_EXT_external_memory_dma_buf', 1, True), Extension('VK_EXT_external_memory_host', 1, 'device->rad_info.has_userptr'), Extension('VK_EXT_global_priority', 1, 'device->rad_info.has_ctx_priority'), + Extension('VK_EXT_host_query_reset', 1, True), Extension('VK_EXT_memory_budget', 1, True), Extension('VK_EXT_memory_priority', 1, True), Extension('VK_EXT_pci_bus_info', 2, True), diff --git a/src/amd/vulkan/radv_query.c b/src/amd/vulkan/radv_query.c index cb279172922..e808aa65170 100644 --- a/src/amd/vulkan/radv_query.c +++ b/src/amd/vulkan/radv_query.c @@ -1436,6 +1436,28 @@ void radv_CmdResetQueryPool( } } +void radv_ResetQueryPoolEXT( + VkDevice _device, + VkQueryPool queryPool, + uint32_t firstQuery, + uint32_t queryCount) +{ + RADV_FROM_HANDLE(radv_query_pool, pool, queryPool); + + uint32_t value = pool->type == VK_QUERY_TYPE_TIMESTAMP + ? TIMESTAMP_NOT_READY : 0; + uint32_t *data = (uint32_t*)(pool->ptr + firstQuery * pool->stride); + uint32_t *data_end = (uint32_t*)(pool->ptr + (firstQuery + queryCount) * pool->stride); + + for(uint32_t *p = data; p != data_end; ++p) + *p = value; + + if (pool->type == VK_QUERY_TYPE_PIPELINE_STATISTICS) { + memset(pool->ptr + pool->availability_offset + firstQuery * 4, + 0, queryCount * 4); + } +} + static unsigned event_type_for_stream(unsigned stream) { switch (stream) { -- 2.30.2