turnip: Implement VK_EXT_host_query_reset
authorHyunjun Ko <zzoon@igalia.com>
Tue, 1 Sep 2020 05:16:02 +0000 (05:16 +0000)
committerMarge Bot <eric+marge@anholt.net>
Wed, 2 Sep 2020 10:49:03 +0000 (10:49 +0000)
Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6299>

src/freedreno/vulkan/tu_device.c
src/freedreno/vulkan/tu_extensions.py
src/freedreno/vulkan/tu_query.c

index 3d68a70204779ee42a42bec58a4111b1553b98ec..3a7b458ea4fbb89e3e3d4b019c9b71b43ed6facc 100644 (file)
@@ -482,7 +482,7 @@ tu_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
          features->uniformBufferStandardLayout         = false;
          features->shaderSubgroupExtendedTypes         = false;
          features->separateDepthStencilLayouts         = false;
-         features->hostQueryReset                      = false;
+         features->hostQueryReset                      = true;
          features->timelineSemaphore                   = false;
          features->bufferDeviceAddress                 = false;
          features->bufferDeviceAddressCaptureReplay    = false;
@@ -612,6 +612,12 @@ tu_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
          features->customBorderColorWithoutFormat = true;
          break;
       }
+      case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES_EXT: {
+         VkPhysicalDeviceHostQueryResetFeaturesEXT *features =
+            (VkPhysicalDeviceHostQueryResetFeaturesEXT *)ext;
+         features->hostQueryReset = true;
+         break;
+      }
       default:
          break;
       }
index b51b5aa329d70fd0ee80d3cc91dc0bcc869d5fa1..16722a3c48b5124cacf37090afa902317e959815 100644 (file)
@@ -93,6 +93,7 @@ EXTENSIONS = [
     Extension('VK_EXT_conditional_rendering',             1, True),
     Extension('VK_EXT_custom_border_color',              12, True),
     Extension('VK_KHR_multiview',                         1, True),
+    Extension('VK_EXT_host_query_reset',                  1, True),
 ]
 
 MAX_API_VERSION = VkVersion(MAX_API_VERSION)
index ea4fb29e5906f480dc7e98beee6862b79bec9880..2bdc4d3dd308aa9c3e32d5600bd1dace8fffd9b0 100644 (file)
@@ -599,6 +599,25 @@ tu_CmdResetQueryPool(VkCommandBuffer commandBuffer,
    tu_bo_list_add(&cmdbuf->bo_list, &pool->bo, MSM_SUBMIT_BO_WRITE);
 }
 
+void
+tu_ResetQueryPool(VkDevice device,
+                  VkQueryPool queryPool,
+                  uint32_t firstQuery,
+                  uint32_t queryCount)
+{
+   TU_FROM_HANDLE(tu_query_pool, pool, queryPool);
+
+   for (uint32_t i = 0; i < queryCount; i++) {
+      struct query_slot *slot = slot_address(pool, i + firstQuery);
+      slot->available = 0;
+
+      for (uint32_t k = 0; k < get_result_count(pool); k++) {
+         uint64_t *res = query_result_addr(pool, i + firstQuery, k);
+         *res = 0;
+      }
+   }
+}
+
 static void
 emit_begin_occlusion_query(struct tu_cmd_buffer *cmdbuf,
                            struct tu_query_pool *pool,